contribute STF 1.0.0
authorJohnson Ma <johnson.ma@nokia.com>
Fri, 09 Apr 2010 10:46:28 +0800
changeset 2 8bb370ba6d1d
parent 1 bbd31066657e
child 3 a5f55a5789f3
contribute STF 1.0.0
testexecfw/stf/api/api_platform/group/ReleaseNote.txt
testexecfw/stf/api/api_platform/group/bld.inf
testexecfw/stf/api/api_platform/inc/NormalHardcodedAssert.h
testexecfw/stf/api/api_platform/inc/RRefArray.h
testexecfw/stf/api/api_platform/inc/STFLogger.h
testexecfw/stf/api/api_platform/inc/SettingServerClient.h
testexecfw/stf/api/api_platform/inc/StifCommand.h
testexecfw/stf/api/api_platform/inc/StifHWReset.h
testexecfw/stf/api/api_platform/inc/StifItemParser.h
testexecfw/stf/api/api_platform/inc/StifKernelTestClassBase.h
testexecfw/stf/api/api_platform/inc/StifLogger.h
testexecfw/stf/api/api_platform/inc/StifParser.h
testexecfw/stf/api/api_platform/inc/StifSectionParser.h
testexecfw/stf/api/api_platform/inc/StifTFwIf.h
testexecfw/stf/api/api_platform/inc/StifTFwIfProt.h
testexecfw/stf/api/api_platform/inc/StifTestEventInterface.h
testexecfw/stf/api/api_platform/inc/StifTestInterface.h
testexecfw/stf/api/api_platform/inc/StifTestInterference.h
testexecfw/stf/api/api_platform/inc/StifTestModule.h
testexecfw/stf/api/api_platform/inc/StifUnitGeneric.h
testexecfw/stf/api/api_platform/inc/StifUnitMacros.h
testexecfw/stf/api/api_platform/inc/StifUnitUtils.inl
testexecfw/stf/api/api_platform/inc/TestEngineClient.h
testexecfw/stf/api/api_platform/inc/TestEngineClient.inl
testexecfw/stf/api/api_platform/inc/TestScripterInternal.h
testexecfw/stf/api/api_platform/inc/TestServerClient.h
testexecfw/stf/api/api_platform/inc/TestThreadContainerRunnerFactory.h
testexecfw/stf/api/api_platform/inc/TestclassAssert.h
testexecfw/stf/api/api_platform/inc/UIEngine.h
testexecfw/stf/api/api_platform/inc/UIEngineContainer.h
testexecfw/stf/api/api_platform/inc/UIStore.h
testexecfw/stf/api/api_platform/inc/UIStoreContainer.h
testexecfw/stf/api/api_platform/inc/UIStoreIf.h
testexecfw/stf/api/api_platform/inc/UiEnvProxy.h
testexecfw/stf/api/api_platform/inc/atslogger.h
testexecfw/stf/api/api_platform/stif_api.metaxml
testexecfw/stf/doc/HOWTO_Execute_TEF_test_cases_on_STF.doc
testexecfw/stf/doc/STF_Users_Guide.doc
testexecfw/stf/examples/MigrationExample.zip
testexecfw/stf/examples/MigrationExample/FileStore/STF/Bmarm/TestFileStoreU.DEF
testexecfw/stf/examples/MigrationExample/FileStore/STF/Bwins/TestFileStoreU.DEF
testexecfw/stf/examples/MigrationExample/FileStore/STF/EABI/TestFileStoreU.def
testexecfw/stf/examples/MigrationExample/FileStore/STF/conf/TestFileStore.cfg
testexecfw/stf/examples/MigrationExample/FileStore/STF/group/Bld.inf
testexecfw/stf/examples/MigrationExample/FileStore/STF/group/TestFileStore.mmp
testexecfw/stf/examples/MigrationExample/FileStore/STF/group/TestFileStore.pkg
testexecfw/stf/examples/MigrationExample/FileStore/STF/group/TestFramework.ini
testexecfw/stf/examples/MigrationExample/FileStore/STF/inc/TestFileStore.h
testexecfw/stf/examples/MigrationExample/FileStore/STF/src/TestFileStore.cpp
testexecfw/stf/examples/MigrationExample/FileStore/STF/src/TestFileStoreBlocks.cpp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/data/TestFileServer_TEF.ini
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/group/TestFileServer_TEF.driver
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/group/TestFileServer_TEF.iby
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/group/TestFileServer_TEF.mmp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/group/bld.inf
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/inc/CTestFileServerWrapper.h
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/inc/TestFileServer_TEFBlockController.h
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/inc/TestFileServer_TEFBlockServer.h
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/scripts/TestFileServer_TEF.script
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/src/CTestFileServerWrapper.cpp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/src/TestFileServer_TEFBlockController.cpp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/src/TestFileServer_TEFBlockServer.cpp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/data/SystestFilestoreSuite.ini
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/group/TEF_STEP.mmp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/group/bld.inf
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/inc/SystestFilestoreSuiteServer.h
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/inc/TestFSCreateFile.h
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/inc/TestFSPanicExample.h
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/inc/TestFSReadFile.h
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/scripts/SystestFilestoreSuite.script
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/src/SystestFilestoreSuiteServer.cpp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/src/TestFSCreateFile.cpp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/src/TestFSPanicExample.cpp
testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/src/TestFSReadFile.cpp
testexecfw/stf/examples/MigrationExample/doc/TEF_to_STF_Migration_Guide.doc
testexecfw/stf/examples/MigrationExample/group/bld.inf
testexecfw/stf/examples/demomodule/BMARM/DEMOMODULEU.DEF
testexecfw/stf/examples/demomodule/BWINS/DEMOMODULEU.DEF
testexecfw/stf/examples/demomodule/eabi/Demomoduleu.def
testexecfw/stf/examples/demomodule/group/Demomodule.mmp
testexecfw/stf/examples/demomodule/group/bld.inf
testexecfw/stf/examples/demomodule/inc/DemoModule.h
testexecfw/stf/examples/demomodule/src/DemoModule.cpp
testexecfw/stf/examples/demomodule/src/Demomodulecases.cpp
testexecfw/stf/examples/hwresetstub/BMARM/STIFHWRESETSTUBU.DEF
testexecfw/stf/examples/hwresetstub/BWINS/STIFHWRESETSTUBU.DEF
testexecfw/stf/examples/hwresetstub/eabi/StifHWResetStubu.def
testexecfw/stf/examples/hwresetstub/group/StifHWResetStub.mmp
testexecfw/stf/examples/hwresetstub/group/bld.inf
testexecfw/stf/examples/hwresetstub/inc/StifHWResetStub.h
testexecfw/stf/examples/hwresetstub/src/StifHWResetStub.cpp
testexecfw/stf/examples/testmeasurementstub/Bmarm/STIFTESTMEASUREMENTSTUBU.DEF
testexecfw/stf/examples/testmeasurementstub/Bwins/STIFTESTMEASUREMENTSTUBU.DEF
testexecfw/stf/examples/testmeasurementstub/eabi/STIFTestMeasurementStubu.def
testexecfw/stf/examples/testmeasurementstub/group/STIFTestMeasurementStub.mmp
testexecfw/stf/examples/testmeasurementstub/group/STIFTestMeasurementStub_DoxyFile.txt
testexecfw/stf/examples/testmeasurementstub/group/bld.inf
testexecfw/stf/examples/testmeasurementstub/inc/STIFTestMeasurementStub.h
testexecfw/stf/examples/testmeasurementstub/src/STIFTestMeasurementStub.cpp
testexecfw/stf/group/STF_read_me.txt
testexecfw/stf/group/TestFramework.ini
testexecfw/stf/group/bld.inf
testexecfw/stf/group/package_all.bat
testexecfw/stf/inc/STIFConfiguration.mmh
testexecfw/stf/inc/STIFMeasurement.h
testexecfw/stf/inc/StifKernelTestClass.h
testexecfw/stf/inc/StifKernelTestClass.inl
testexecfw/stf/inc/StifPython.h
testexecfw/stf/inc/StifTFw.h
testexecfw/stf/inc/TestModuleInfo.h
testexecfw/stf/inc/TestServerModuleIf.h
testexecfw/stf/inc/TestThreadContainer.h
testexecfw/stf/inc/version.h
testexecfw/stf/rom/STIFTestFramework.iby
testexecfw/stf/rom/Stif.iby
testexecfw/stf/rom/Stif_rom.iby
testexecfw/stf/sis/stf.pkg
testexecfw/stf/stfext/group/bld.inf
testexecfw/stf/stfext/testlibplugins/filelibplugin/bwins/stffiletestlibpluginu.def
testexecfw/stf/stfext/testlibplugins/filelibplugin/eabi/stffiletestlibpluginu.def
testexecfw/stf/stfext/testlibplugins/filelibplugin/group/bld.inf
testexecfw/stf/stfext/testlibplugins/filelibplugin/group/stffiletestlibplugin.mmp
testexecfw/stf/stfext/testlibplugins/filelibplugin/inc/stffiletestlibplugin.h
testexecfw/stf/stfext/testlibplugins/filelibplugin/sis/StfFileTestLib_EKA2.pkg
testexecfw/stf/stfext/testlibplugins/filelibplugin/src/stffiletestlibplugin.cpp
testexecfw/stf/stfext/testlibplugins/group/bld.inf
testexecfw/stf/stfext/testlibplugins/inc/StfTestLibPluginInterface.h
testexecfw/stf/stfext/testlibplugins/syslibplugin/bwins/stfsystemtestlibplugin.def
testexecfw/stf/stfext/testlibplugins/syslibplugin/eabi/stfsystemtestlibplugin.def
testexecfw/stf/stfext/testlibplugins/syslibplugin/group/bld.inf
testexecfw/stf/stfext/testlibplugins/syslibplugin/group/stfsystemtestlibplugin.mmp
testexecfw/stf/stfext/testlibplugins/syslibplugin/inc/AppInstall.h
testexecfw/stf/stfext/testlibplugins/syslibplugin/inc/TestSecurityInstUIHandler.h
testexecfw/stf/stfext/testlibplugins/syslibplugin/inc/stfsystemtestlibplugin.h
testexecfw/stf/stfext/testlibplugins/syslibplugin/inc/stfsystemtestlibplugin.pan
testexecfw/stf/stfext/testlibplugins/syslibplugin/sis/stfsystemtestlibplugin_EKA2.pkg
testexecfw/stf/stfext/testlibplugins/syslibplugin/src/AppInstall.cpp
testexecfw/stf/stfext/testlibplugins/syslibplugin/src/TestSecurityInstUIHandler.cpp
testexecfw/stf/stfext/testlibplugins/syslibplugin/src/stfsystemtestlibplugin.cpp
testexecfw/stf/stfext/testmodules/group/bld.inf
testexecfw/stf/stfext/testmodules/kerneltestmod/Bwins/STIFKERNELTESTCLASSBASEU.DEF
testexecfw/stf/stfext/testmodules/kerneltestmod/Bwins/STIFKERNELTESTCLASSBASE_EKA1U.DEF
testexecfw/stf/stfext/testmodules/kerneltestmod/eabi/StifKernelTestClassBaseu.def
testexecfw/stf/stfext/testmodules/kerneltestmod/group/StifKernelTestClassBase.mmp
testexecfw/stf/stfext/testmodules/kerneltestmod/group/bld.inf
testexecfw/stf/stfext/testmodules/kerneltestmod/src/StifKernelTestClassBase.cpp
testexecfw/stf/stfext/testmodules/scriptermod/Bmarm/TESTSCRIPTERU.DEF
testexecfw/stf/stfext/testmodules/scriptermod/Bwins/TESTSCRIPTERU.DEF
testexecfw/stf/stfext/testmodules/scriptermod/eabi/testscripteru.def
testexecfw/stf/stfext/testmodules/scriptermod/group/TestScripter.mmp
testexecfw/stf/stfext/testmodules/scriptermod/group/bld.inf
testexecfw/stf/stfext/testmodules/scriptermod/inc/Logging.h
testexecfw/stf/stfext/testmodules/scriptermod/inc/SubTestCaseRunner.h
testexecfw/stf/stfext/testmodules/scriptermod/inc/TestKeywords.h
testexecfw/stf/stfext/testmodules/scriptermod/inc/TestScripter.h
testexecfw/stf/stfext/testmodules/scriptermod/inc/TestScripterUtils.h
testexecfw/stf/stfext/testmodules/scriptermod/src/SubTestCaseRunner.cpp
testexecfw/stf/stfext/testmodules/scriptermod/src/TestKeywords.cpp
testexecfw/stf/stfext/testmodules/scriptermod/src/TestScripter.cpp
testexecfw/stf/stfext/testmodules/scriptermod/src/TestScripterInternal.cpp
testexecfw/stf/stfext/testmodules/scriptermod/src/TestScripterUtils.cpp
testexecfw/stf/stfext/testmodules/teftestmod/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/release.txt
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/tef.mrp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/tef.tdf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/teftestmodulefw.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/testexecute.cfg
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/testexecute.ini
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/testexecutelite.cfg
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/bmarm/testexecutelogclientu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/bwins/testexecutelogclientu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/bwins/testexecutelogengineu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/eabi/testexecutelogclientu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/group/testexecutelogclient.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/group/testexecutelogengine.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/group/testexecutelogger.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/inc/testexecutelog.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/client.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/main.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/server.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/server.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/server.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/test/group/testexecuteloggertest.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/test/src/testexecuteloggertest.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/bwins/testexecutepipslogclientu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/eabi/testexecutepipslogclientu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/testexecutepipslogclient.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/testexecutepipslogengine.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/testexecutepipslogger.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/testexecutepipsloggerclient.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/inc/testexecutepipslog.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/client.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/main.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/server.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/server.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/server.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/test/group/testexecutepipsloggertest.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/test/src/testexecutepipsloggertest.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/Bmarm/TEFTestModuleU.DEF
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/Bwins/TEFTestModuleU.DEF
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/eabi/TEFTestModuleu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodule.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodule.pkg
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodule_doxyfile.txt
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodule_nrm.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodulelite.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodulelite_nrm.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/logging.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/scriptengine.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/scriptengine.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/teftestmodule.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/testwatcher.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/src/scriptengine.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/src/teftestmodule.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/src/testwatcher.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/bwins/tefunitteu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/group/tefunit.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/group/tefunitte.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/crunner.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/cteflogger.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/ctefunitserver.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/ctestcommand.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/tefunit.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/tefunit.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/cactivetestfixture.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/crunner.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/cteflogger.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctefunitserver.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestbase.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestcase.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestcommand.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestconfig.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestfixture.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestsuite.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestasyncsuitea.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestasyncsuiteassert.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuitea.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuiteassert.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuiteb.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuitec.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuited.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/samplestep.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/scripts/tefunit.script
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/scripts/test.ini
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestasyncsuitea.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestasyncsuiteassert.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuitea.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuiteassert.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuiteb.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuitec.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuited.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/samplestep.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/t_testtefunit.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/TestDriver/eventlogserver.xml
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/TestDriver/example.xml
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/data/eventlogcontroler.ini
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/scripts/example.script
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/Scripts/buildinfologtest.script
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/Scripts/formatdrivetest.script
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/TestDriver/buildinfologtest.xml
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/TestDriver/formatdrivetest.xml
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/TestDriver/tefutilityserver.xml
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/data/formatdrivetest.ini
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/tefutilityserver.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/tefutilityserver.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/tefutilityservercommon.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/tefutilityserverlite.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/inc/tefbuildinfologstep.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/inc/tefformatdrive.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/inc/tefutiltityserver.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/src/tefbuildinfologstep.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/src/tefformatdrive.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/src/tefutilityserver.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/bwins/plattest_platsecu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/bwins/sampleserveru.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/cleanup/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/cleanup/group/cleanup.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/cleanup/group/tefcleanup.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/cleanup/src/cleanup.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/data/capabilitypolicing.ini
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/group/platsec.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/group/tefplatsec.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/inc/testplatseccleanup.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/inc/testplatseclaunchapp.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/inc/testplatsecserver.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/inc/testplatsecsetcapabilities.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/scripts/capabilitypolicing.script
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/scripts/cleanup.script
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/src/testplatseccleanup.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/src/testplatseclaunchapp.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/src/testplatsecserver.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/src/testplatsecsetcapabilities.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/testdriver/capabilitypolicing.xml
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/testdriver/cleanup.xml
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/testdriver/platsecserver.xml
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/bmarm/testexecuteutils1u.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/bmarm/testexecuteutilsu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/bwins/testexecuteutils1u.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/bwins/testexecuteutilsu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/eabi/testexecuteutilsu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/group/testexecuteutils.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/Logging.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/activecallback.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/blockitems.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/commandprocessor.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/dataaccess.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/datadictionary.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/datawrapper.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/datawrapper.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/serialwriter.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefconst.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefexportconst.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefresult.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefscriptutils.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefshareddata.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefshareddata.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/teftestreport.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/teftimer.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefutils.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testblockcontroller.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testblockcontroller.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecuteclient.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecutelogbase.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecutelogger.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecuteserverbase.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecuteserverutils.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecuteserverutils.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecutestepbase.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testserver2.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testshareddata.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testshareddata.inl
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/version.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/activecallback.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/commandprocessor.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/datadictionary.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/datawrapper.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/serialwriter.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/tefscriptutils.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/teftestreport.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/teftimer.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/tefutils.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testblockcontroller.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testclient.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testexecutelogger.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testserver2.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testserverbase.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/teststepbase.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/test/group/testexecuteloggingtest.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/test/src/testexecuteloggingtest.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/bwins/demoipsuiteu.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/group/demoipsuite.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/group/demoipsuite.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/scripts/demoipsuite.script
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuitedefs.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuiteserver.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuiteserver.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuitestepbase.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuitestepbase.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/tcpstep.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/tcpstep.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/udpstep.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/udpstep.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/testdata/demoipsuite.cfg
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/testdata/demoipsuite.ini
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/bwins/wrapperutilsplugin1u.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/bwins/wrapperutilsplugin5u.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/eabi/wrapperutilsplugin1u.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/eabi/wrapperutilsplugin5u.def
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/group/wrapperutilsplugin.iby
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/group/wrapperutilsplugin.mmp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/inc/fileservplugin.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/inc/sysstartplugin.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/inc/wrapperutilsplugin.h
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/src/fileservplugin.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/src/sysstartplugin.cpp
testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/src/wrapperutilsplugin.cpp
testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/group/Bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/group/tefwrapper.iby
testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/group/tefwrapper.mmp
testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/inc/utils.h
testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/inc/wrapperapplication.h
testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/src/main.cpp
testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/src/utils.cpp
testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/src/wrapperapplication.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/bwins/rfileloggerclientu.def
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/eabi/rfileloggerclientu.def
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/filelogger.mrp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/release.txt
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/rfilelogger.iby
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/rfileloggerclient.cfg
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/rfileloggerclient.mmp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/rfileloggerserver.mmp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/inc/rfilelogger.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/inc/rfileloggermacro.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/client.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/main.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/server.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/server.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/server.inl
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/group/te_rfileloggersuite.iby
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/group/te_rfileloggersuite.mmp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/scripts/te_rfileloggersuite.script
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/addfield_logstep.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/addfield_logstep.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/conn_closestep.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/conn_closestep.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuitedefs.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuiteserver.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuiteserver.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuitestepbase.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuitestepbase.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/testdata/te_rfileloggersuite.ini
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/test/src/testlogger.cpp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/bwins/iniparseru.def
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/eabi/iniparseru.def
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/bld.inf
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/inifileparser.mrp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/iniparser.cfg
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/iniparser.iby
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/iniparser.mmp
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/release.txt
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/inc/iniparser.h
testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/src/iniparser.cpp
testexecfw/stf/stfext/testmodules/testcombiner/Bmarm/TESTCOMBINERU.DEF
testexecfw/stf/stfext/testmodules/testcombiner/Bwins/TESTCOMBINERU.DEF
testexecfw/stf/stfext/testmodules/testcombiner/eabi/testcombineru.def
testexecfw/stf/stfext/testmodules/testcombiner/group/TestCombiner.mmp
testexecfw/stf/stfext/testmodules/testcombiner/group/TestCombinerExample.cfg
testexecfw/stf/stfext/testmodules/testcombiner/group/bld.inf
testexecfw/stf/stfext/testmodules/testcombiner/inc/Logging.h
testexecfw/stf/stfext/testmodules/testcombiner/inc/StifPythonFunComb.h
testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCase.h
testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCaseNotify.h
testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCombiner.h
testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCombinerEvent.h
testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCombinerUtils.h
testexecfw/stf/stfext/testmodules/testcombiner/inc/TestKeywords.h
testexecfw/stf/stfext/testmodules/testcombiner/src/StifPythonFunComb.cpp
testexecfw/stf/stfext/testmodules/testcombiner/src/TestCase.cpp
testexecfw/stf/stfext/testmodules/testcombiner/src/TestCaseNotify.cpp
testexecfw/stf/stfext/testmodules/testcombiner/src/TestCombiner.cpp
testexecfw/stf/stfext/testmodules/testcombiner/src/TestCombinerUtils.cpp
testexecfw/stf/stfext/testmodules/testcombiner/src/TestKeywords.cpp
testexecfw/stf/stffw/atslogger/Bmarm/ATSLOGGERU.DEF
testexecfw/stf/stffw/atslogger/Bwins/ATSLOGGERU.DEF
testexecfw/stf/stffw/atslogger/eabi/atsloggeru.def
testexecfw/stf/stffw/atslogger/group/atsloggerdll.mmp
testexecfw/stf/stffw/atslogger/group/bld.inf
testexecfw/stf/stffw/atslogger/src/atslogger.cpp
testexecfw/stf/stffw/event/Bmarm/SUEventU.DEF
testexecfw/stf/stffw/event/Bwins/SUEventU.DEF
testexecfw/stf/stffw/event/eabi/SUEventu.def
testexecfw/stf/stffw/event/group/SUEvent.mmp
testexecfw/stf/stffw/event/group/bld.inf
testexecfw/stf/stffw/event/inc/SUEvent.h
testexecfw/stf/stffw/event/src/SUEvent.cpp
testexecfw/stf/stffw/event/src/SUEventCases.cpp
testexecfw/stf/stffw/eventsystem/client/bwins/stfeventsystemclientu.def
testexecfw/stf/stffw/eventsystem/client/eabi/stfeventsystemclientu.def
testexecfw/stf/stffw/eventsystem/client/group/bld.inf
testexecfw/stf/stffw/eventsystem/client/group/eventsystemclient.mmp
testexecfw/stf/stffw/eventsystem/client/inc/stfasynceventactive.h
testexecfw/stf/stffw/eventsystem/client/inc/stfasynceventlist.h
testexecfw/stf/stffw/eventsystem/client/inc/stfeventsystem.h
testexecfw/stf/stffw/eventsystem/client/src/stfasynceventactive.cpp
testexecfw/stf/stffw/eventsystem/client/src/stfasynceventlist.cpp
testexecfw/stf/stffw/eventsystem/client/src/stfeventsystem.cpp
testexecfw/stf/stffw/eventsystem/group/bld.inf
testexecfw/stf/stffw/eventsystem/server/group/bld.inf
testexecfw/stf/stffw/eventsystem/server/group/eventsystemsrv.mmp
testexecfw/stf/stffw/eventsystem/server/inc/eventsystemserver.h
testexecfw/stf/stffw/eventsystem/server/inc/eventsystemsession.h
testexecfw/stf/stffw/eventsystem/server/inc/stateevent.h
testexecfw/stf/stffw/eventsystem/server/inc/stfeventsystemdefs.h
testexecfw/stf/stffw/eventsystem/server/inc/stfeventsystemerrorcodes.h
testexecfw/stf/stffw/eventsystem/server/inc/waitingevent.h
testexecfw/stf/stffw/eventsystem/server/src/eventsystemserver.cpp
testexecfw/stf/stffw/eventsystem/server/src/eventsystemsession.cpp
testexecfw/stf/stffw/eventsystem/server/src/main.cpp
testexecfw/stf/stffw/eventsystem/server/src/stateevent.cpp
testexecfw/stf/stffw/eventsystem/server/src/waitingevent.cpp
testexecfw/stf/stffw/group/bld.inf
testexecfw/stf/stffw/logger/STFLogger/inc/STFLoggerOverFlow.h
testexecfw/stf/stffw/logger/STFLogger/src/STFLogger.cpp
testexecfw/stf/stffw/logger/STFLogger/src/STFLoggerOverFlow.cpp
testexecfw/stf/stffw/logger/STFLogger/src/StifLogger.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/group/STFLoggingServer.mmp
testexecfw/stf/stffw/logger/STFLoggingServer/group/bld.inf
testexecfw/stf/stffw/logger/STFLoggingServer/inc/DataLogger.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/FileOutput.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/HtmlLogger.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/LoggerOverFlow.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/NullOutput.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/Output.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/RDebugOutput.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/STFLogServer.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/StifLoggerBase.h
testexecfw/stf/stffw/logger/STFLoggingServer/inc/TxtLogger.h
testexecfw/stf/stffw/logger/STFLoggingServer/sis/STFLoggingServer_EKA2.pkg
testexecfw/stf/stffw/logger/STFLoggingServer/src/DataLogger.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/FileOutput.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/HtmlLogger.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/LoggerOverFlow.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/NullOutput.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/Output.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/RDebugOutput.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/STFLogServer.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/StifLoggerBase.cpp
testexecfw/stf/stffw/logger/STFLoggingServer/src/TxtLogger.cpp
testexecfw/stf/stffw/logger/common/inc/LoggerTracing.h
testexecfw/stf/stffw/logger/common/inc/STFLoggerCSCommon.h
testexecfw/stf/stffw/logger/group/bld.inf
testexecfw/stf/stffw/parser/inc/ParserTracing.h
testexecfw/stf/stffw/parser/inc/StifFileParser.h
testexecfw/stf/stffw/parser/inc/cstackdeprecated.h
testexecfw/stf/stffw/parser/inc/cstackdeprecated.inl
testexecfw/stf/stffw/parser/src/StifFileParser.cpp
testexecfw/stf/stffw/parser/src/StifItemParser.cpp
testexecfw/stf/stffw/parser/src/StifParser.cpp
testexecfw/stf/stffw/parser/src/StifSectionParser.cpp
testexecfw/stf/stffw/testengine/BMARM/STIFTESTENGINEU.DEF
testexecfw/stf/stffw/testengine/BWINS/STIFTESTENGINEU.DEF
testexecfw/stf/stffw/testengine/eabi/StifTestEngineu.def
testexecfw/stf/stffw/testengine/group/TestEngine.mmp
testexecfw/stf/stffw/testengine/group/TestEngineSrv.mmp
testexecfw/stf/stffw/testengine/group/bld.inf
testexecfw/stf/stffw/testengine/inc/Logging.h
testexecfw/stf/stffw/testengine/inc/STIFTestFrameworkSettings.h
testexecfw/stf/stffw/testengine/inc/SettingServer.h
testexecfw/stf/stffw/testengine/inc/SettingServerClientServer.h
testexecfw/stf/stffw/testengine/inc/StifPythonFunEng.h
testexecfw/stf/stffw/testengine/inc/TestCallBack.h
testexecfw/stf/stffw/testengine/inc/TestCaseController.h
testexecfw/stf/stffw/testengine/inc/TestEngine.h
testexecfw/stf/stffw/testengine/inc/TestEngineClientServer.h
testexecfw/stf/stffw/testengine/inc/TestEngineCommon.h
testexecfw/stf/stffw/testengine/inc/TestEngineEvent.h
testexecfw/stf/stffw/testengine/inc/TestEngineServer.h
testexecfw/stf/stffw/testengine/inc/TestEngineUtils.h
testexecfw/stf/stffw/testengine/inc/TestModuleController.h
testexecfw/stf/stffw/testengine/inc/TestReport.h
testexecfw/stf/stffw/testengine/src/STIFTestFrameworkSettings.cpp
testexecfw/stf/stffw/testengine/src/SettingServer.cpp
testexecfw/stf/stffw/testengine/src/SettingServerClient.cpp
testexecfw/stf/stffw/testengine/src/SettingServerSession.cpp
testexecfw/stf/stffw/testengine/src/StifPythonFunEng.cpp
testexecfw/stf/stffw/testengine/src/TestCaseController.cpp
testexecfw/stf/stffw/testengine/src/TestEngine.cpp
testexecfw/stf/stffw/testengine/src/TestEngineClient.cpp
testexecfw/stf/stffw/testengine/src/TestEngineServer.cpp
testexecfw/stf/stffw/testengine/src/TestEngineUtils.cpp
testexecfw/stf/stffw/testengine/src/TestModuleController.cpp
testexecfw/stf/stffw/testengine/src/TestModuleInfo.cpp
testexecfw/stf/stffw/testengine/src/TestReport.cpp
testexecfw/stf/stffw/testengine/src/Testcasetimeout.cpp
testexecfw/stf/stffw/testinterface/BMARM/STIFTESTINTERFACEU.DEF
testexecfw/stf/stffw/testinterface/BWINS/STIFTESTINTERFACEU.DEF
testexecfw/stf/stffw/testinterface/eabi/StifTestInterfaceu.def
testexecfw/stf/stffw/testinterface/group/TestInterface.mmp
testexecfw/stf/stffw/testinterface/group/bld.inf
testexecfw/stf/stffw/testinterface/src/StifTFwIfProt.cpp
testexecfw/stf/stffw/testinterface/src/TestInterface.cpp
testexecfw/stf/stffw/testinterface/src/TestModuleIf.cpp
testexecfw/stf/stffw/testinterface/src/TestModuleParameters.cpp
testexecfw/stf/stffw/testinterference/inc/TestInterferenceImplementation.h
testexecfw/stf/stffw/testinterference/src/StifTestInterference.cpp
testexecfw/stf/stffw/testsrv/BMARM/STIFTESTSERVERU.DEF
testexecfw/stf/stffw/testsrv/BWINS/STIFTESTSERVERU.DEF
testexecfw/stf/stffw/testsrv/eabi/StifTestServeru.def
testexecfw/stf/stffw/testsrv/group/TestServer.mmp
testexecfw/stf/stffw/testsrv/group/bld.inf
testexecfw/stf/stffw/testsrv/inc/Logging.h
testexecfw/stf/stffw/testsrv/inc/PrintQueue.h
testexecfw/stf/stffw/testsrv/inc/TestServer.h
testexecfw/stf/stffw/testsrv/inc/TestServerCommon.h
testexecfw/stf/stffw/testsrv/inc/TestServerEvent.h
testexecfw/stf/stffw/testsrv/inc/TestThreadContainerRunner.h
testexecfw/stf/stffw/testsrv/inc/ThreadLogging.h
testexecfw/stf/stffw/testsrv/src/Printqueue.cpp
testexecfw/stf/stffw/testsrv/src/TestExecutionThread.cpp
testexecfw/stf/stffw/testsrv/src/TestModuleContainer.cpp
testexecfw/stf/stffw/testsrv/src/TestServer.cpp
testexecfw/stf/stffw/testsrv/src/TestServerClient.cpp
testexecfw/stf/stffw/testsrv/src/TestServerEvent.cpp
testexecfw/stf/stffw/testsrv/src/TestThreadContainerRunner.cpp
testexecfw/stf/stffw/testsrv/src/TestThreadContainerRunnerFactory.cpp
testexecfw/stf/stffw/testsrv/src/Testexecution.cpp
testexecfw/stf/stffw/testsrv/src/Testserversession.cpp
testexecfw/stf/stffw/testsrv/src/Testundertaker.cpp
testexecfw/stf/stffw/testsrvstarter/group/TestServerStarter.mmp
testexecfw/stf/stffw/testsrvstarter/group/bld.inf
testexecfw/stf/stffw/testsrvstarter/src/TestServerStarter.cpp
testexecfw/stf/stfui/atsui/group/ATSInterface.mmp
testexecfw/stf/stfui/atsui/group/bld.inf
testexecfw/stf/stfui/atsui/inc/ATSInterface.h
testexecfw/stf/stfui/atsui/inc/ATSInterfaceRunner.h
testexecfw/stf/stfui/atsui/src/ATSInterface.cpp
testexecfw/stf/stfui/atsui/src/ATSInterfaceRunner.cpp
testexecfw/stf/stfui/consoleui/group/ConsoleUI.mmp
testexecfw/stf/stfui/consoleui/group/bld.inf
testexecfw/stf/stfui/consoleui/inc/CallBack.h
testexecfw/stf/stfui/consoleui/inc/ConsoleMenus.h
testexecfw/stf/stfui/consoleui/inc/ConsoleUI.h
testexecfw/stf/stfui/consoleui/src/ConsoleNotify.cpp
testexecfw/stf/stfui/consoleui/src/ConsoleUI.cpp
testexecfw/stf/stfui/consoleui/src/Consolemenus.cpp
testexecfw/stf/stfui/group/bld.inf
testexecfw/stf/stfui/stf/doc/STF CLI Specification.doc
testexecfw/stf/stfui/stf/doc/Stf_cli.doc
testexecfw/stf/stfui/stf/doc/help.txt
testexecfw/stf/stfui/stf/group/bld.inf
testexecfw/stf/stfui/stf/group/stf.mmp
testexecfw/stf/stfui/stf/inc/activetimer.h
testexecfw/stf/stfui/stf/inc/caserunner.h
testexecfw/stf/stfui/stf/inc/cmdparser.h
testexecfw/stf/stfui/stf/inc/executor.h
testexecfw/stf/stfui/stf/inc/helper.h
testexecfw/stf/stfui/stf/inc/stf.h
testexecfw/stf/stfui/stf/src/activetimer.cpp
testexecfw/stf/stfui/stf/src/caserunner.cpp
testexecfw/stf/stfui/stf/src/cmdparser.cpp
testexecfw/stf/stfui/stf/src/executor.cpp
testexecfw/stf/stfui/stf/src/helper.cpp
testexecfw/stf/stfui/stf/src/stf.cpp
testexecfw/stf/stfui/touchconsoleui/group/TouchConsoleUI.mmp
testexecfw/stf/stfui/touchconsoleui/group/bld.inf
testexecfw/stf/stfui/touchconsoleui/inc/CallBack.h
testexecfw/stf/stfui/touchconsoleui/inc/ConsoleMenus.h
testexecfw/stf/stfui/touchconsoleui/inc/ConsoleUI.h
testexecfw/stf/stfui/touchconsoleui/src/ConsoleNotify.cpp
testexecfw/stf/stfui/touchconsoleui/src/ConsoleUI.cpp
testexecfw/stf/stfui/touchconsoleui/src/Consolemenus.cpp
testexecfw/stf/stfui/uiengine/Bmarm/STIFTFWIFU.DEF
testexecfw/stf/stfui/uiengine/Bwins/STIFTFWIFU.DEF
testexecfw/stf/stfui/uiengine/eabi/StifTFwIfu.def
testexecfw/stf/stfui/uiengine/group/StifTFwIf.mmp
testexecfw/stf/stfui/uiengine/group/bld.inf
testexecfw/stf/stfui/uiengine/inc/Logging.h
testexecfw/stf/stfui/uiengine/inc/UIEngineError.h
testexecfw/stf/stfui/uiengine/inc/UIEngineEvent.h
testexecfw/stf/stfui/uiengine/inc/UIEnginePrinter.h
testexecfw/stf/stfui/uiengine/inc/UIEngineRemote.h
testexecfw/stf/stfui/uiengine/inc/UIEngineRunner.h
testexecfw/stf/stfui/uiengine/inc/UIStorePopup.h
testexecfw/stf/stfui/uiengine/src/StifTFwIf.cpp
testexecfw/stf/stfui/uiengine/src/UIEngine.cpp
testexecfw/stf/stfui/uiengine/src/UIEngineContainer.cpp
testexecfw/stf/stfui/uiengine/src/UIEngineError.cpp
testexecfw/stf/stfui/uiengine/src/UIEngineEvent.cpp
testexecfw/stf/stfui/uiengine/src/UIEnginePrinter.cpp
testexecfw/stf/stfui/uiengine/src/UIEngineRemote.cpp
testexecfw/stf/stfui/uiengine/src/UIEngineRunner.cpp
testexecfw/stf/stfui/uiengine/src/UIStore.cpp
testexecfw/stf/stfui/uiengine/src/UIStoreContainer.cpp
testexecfw/stf/stfui/uiengine/src/UIStorePopup.cpp
testexecfw/stf/testmoduletemplates/CapsModifierXXX/CreateCapsModifier.bat
testexecfw/stf/testmoduletemplates/CapsModifierXXX/group/CapsModifierXXX_exe.mmp
testexecfw/stf/testmoduletemplates/CapsModifierXXX/group/CapsModifierXXX_exe.pkg
testexecfw/stf/testmoduletemplates/CapsModifierXXX/group/CapsModifierXXX_exe_nrm.mmp
testexecfw/stf/testmoduletemplates/CapsModifierXXX/group/bld.inf
testexecfw/stf/testmoduletemplates/CapsModifierXXX/src/CapsModifierXXX_exe.cpp
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/Bmarm/HARDCODEDTESTMODULEXXXU.DEF
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/Bwins/HARDCODEDTESTMODULEXXXU.DEF
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/EABI/HardCodedTestModuleXXXU.def
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/createhardcodedmodule.bat
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/Bld.inf
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX.mmp
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX.pkg
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX_DoxyFile.txt
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX_nrm.mmp
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/inc/HardCodedTestModuleXXX.h
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/src/HardCodedTestModuleXXX.cpp
testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/src/HardCodedTestModuleXXXCases.cpp
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/CreateKernelTestClass.bat
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/conf/TemplateKernelScriptXXX.cfg
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/Bld.inf
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX.mmp
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX.pkg
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX_DoxyFile.txt
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX_nrm.mmp
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/inc/TemplateKernelScriptXXX.h
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/src/TemplateKernelScriptXXX.cpp
testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/src/TemplateKernelScriptXXXBlocks.cpp
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/Bmarm/TEMPLATESCRIPTXXXU.DEF
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/Bwins/TEMPLATESCRIPTXXXU.DEF
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/CreateTestClass.bat
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/EABI/TemplateScriptXXXU.def
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/conf/TemplateScriptXXX.cfg
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/Bld.inf
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/TemplateScriptXXX.mmp
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/TemplateScriptXXX.pkg
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/TemplateScriptXXX_DoxyFile.txt
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/TemplateScriptXXX_nrm.mmp
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/inc/TemplateScriptXXX.h
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/src/TemplateScriptXXX.cpp
testexecfw/stf/testmoduletemplates/TemplateScriptXXX/src/TemplateScriptXXXBlocks.cpp
testexecfw/stf/testmoduletemplates/createtestmodule.bat
testexecfw/stf/testmoduletemplates/testmoduletemplates.zip
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/group/ReleaseNote.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,12 @@
+========================================================================
+RELEASE NOTE FOR STIF API PLATFORM - STIF_200946 (7.3.20)
+SUPPORTING SERIES 60 3.0 ->
+========================================================================
+
+Product Description:
+====================
+STIF API PLATFORM is a part of STIF project.
+
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,56 @@
+/*
+* 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: Build information for STIF API.
+*
+*/
+
+#include <platform_paths.hrh>
+
+
+PRJ_EXPORTS
+../inc/UIStoreIf.h                          OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/UIStoreIf.h)
+../inc/UIStoreContainer.h                   OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/UIStoreContainer.h)
+../inc/UIStore.h                            OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/UIStore.h)
+../inc/UIEngineContainer.h                  OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/UIEngineContainer.h)
+../inc/UIEngine.h                           OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/UIEngine.h)
+../inc/RRefArray.h                          OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/RRefArray.h)
+// ------- files for uitestserverstarter  -------
+../inc/TestServerClient.h                   OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/TestServerClient.h)
+../inc/UiEnvProxy.h                         OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/UiEnvProxy.h)
+../inc/TestThreadContainerRunnerFactory.h   OS_LAYER_PLATFORM_EXPORT_PATH(stifinternal/TestThreadContainerRunnerFactory.h)
+// ------- other files  -------
+../inc/atslogger.h                          OS_LAYER_PLATFORM_EXPORT_PATH(atslogger.h)
+../inc/StifKernelTestClassBase.h            OS_LAYER_PLATFORM_EXPORT_PATH(StifKernelTestClassBase.h) 
+../inc/StifTFwIf.h                          OS_LAYER_PLATFORM_EXPORT_PATH(StifTFwIf.h)
+../inc/STFLogger.h                          OS_LAYER_PLATFORM_EXPORT_PATH(STFLogger.h)
+../inc/StifLogger.h                         OS_LAYER_PLATFORM_EXPORT_PATH(StifLogger.h)
+../inc/StifParser.h                         OS_LAYER_PLATFORM_EXPORT_PATH(StifParser.h)
+../inc/StifSectionParser.h                  OS_LAYER_PLATFORM_EXPORT_PATH(StifSectionParser.h)
+../inc/StifItemParser.h                     OS_LAYER_PLATFORM_EXPORT_PATH(StifItemParser.h)
+../inc/StifTestInterface.h                  OS_LAYER_PLATFORM_EXPORT_PATH(StifTestInterface.h)
+../inc/StifTestModule.h                     OS_LAYER_PLATFORM_EXPORT_PATH(StifTestModule.h)
+../inc/StifTestEventInterface.h             OS_LAYER_PLATFORM_EXPORT_PATH(StifTestEventInterface.h)
+../inc/TestScripterInternal.h               OS_LAYER_PLATFORM_EXPORT_PATH(TestScripterInternal.h)
+../inc/StifHWReset.h                        OS_LAYER_PLATFORM_EXPORT_PATH(StifHWReset.h)
+../inc/StifTestInterference.h               OS_LAYER_PLATFORM_EXPORT_PATH(StifTestInterference.h)
+../inc/StifCommand.h                        OS_LAYER_PLATFORM_EXPORT_PATH(StifCommand.h)
+../inc/SettingServerClient.h                OS_LAYER_PLATFORM_EXPORT_PATH(SettingServerClient.h)
+../inc/TestEngineClient.h                   OS_LAYER_PLATFORM_EXPORT_PATH(TestEngineClient.h)
+../inc/TestEngineClient.inl                 OS_LAYER_PLATFORM_EXPORT_PATH(TestEngineClient.inl)
+../inc/StifTFwIfProt.h                      OS_LAYER_PLATFORM_EXPORT_PATH(StifTFwIfProt.h)
+../inc/NormalHardcodedAssert.h              OS_LAYER_PLATFORM_EXPORT_PATH(NormalHardcodedAssert.h)
+../inc/TestclassAssert.h                    OS_LAYER_PLATFORM_EXPORT_PATH(TestclassAssert.h)
+../inc/StifUnitUtils.inl                    OS_LAYER_PLATFORM_EXPORT_PATH(StifUnitUtils.inl)
+../inc/StifUnitMacros.h                     OS_LAYER_PLATFORM_EXPORT_PATH(StifUnitMacros.h)
+../inc/StifUnitGeneric.h                    OS_LAYER_PLATFORM_EXPORT_PATH(StifUnitGeneric.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/NormalHardcodedAssert.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,380 @@
+/*
+* 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: This file contains the header file of the STIF 
+* normal and hardcoded modules assert macros.
+*
+*/
+
+
+#ifndef NormalHardcodedAssert_MACROS_H
+#define NormalHardcodedAssert_MACROS_H
+
+_LIT( KAssertFailedEquals, "AssertEquals Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotEquals, "AssertNotEquals Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNull, "AssertNull Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotNull, "AssertNotNull Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedSame, "AssertSame Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotSame, "AssertNotSame Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedTrue, "AssertTrue Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedFalse, "AssertFalse Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotLeaves, "AssertNotLeaves Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedLeaves, "AssertLeaves Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedLeavesWith, "AssertLeavesWith Failed [F:%s][L:%d]" );
+
+
+#ifdef _UNICODE
+	#define __STIF_WIDEN2(x) L ## x
+	#define __STIF_WIDEN(x) __STIF_WIDEN2(x)
+	#define __STIF_DBG_FILE__ __STIF_WIDEN(__FILE__)
+#else
+	#define __STIF_DBG_FILE__ __FILE__
+#endif
+
+#ifdef _UNICODE
+	#define __STF_WIDEN2(x) L ## x
+	#define __STF_WIDEN(x) __STF_WIDEN2(x)
+	#define __STF_DBG_FILE__ __STF_WIDEN(__FILE__)
+#else
+	#define __STF_DBG_FILE__ __FILE__
+#endif
+
+// Logs to the STIF log file AND to the RDebug
+#define STIF_LOG( aMessage ) \
+    iLog->Log( _L( aMessage ) ); RDebug::Print( _L( aMessage ) );
+    
+// Logs to the STF log file AND to the RDebug
+#define STF_LOG( aMessage ) \
+    iLog->Log( _L( aMessage ) ); RDebug::Print( _L( aMessage ) );	
+    
+/*********************************************************************************
+ * STF Assert Macros
+ *********************************************************************************/
+#define __STF_ASSERT_SHARED( aFunction, aMessage ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STF_DBG_FILE__, __LINE__ );\
+		aResult.SetResult( KErrGeneral, _L("Testcase failed"));\
+		return KErrNone;\
+		}
+
+#define __STF_ASSERT_SHARED_DESC( aFunction, aMessage, aDesc ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STF_DBG_FILE__, __LINE__ );\
+		aResult.SetResult( KErrGeneral, aDesc );\
+		return KErrNone;\
+		} \
+	else \
+		{ \
+		aResult.SetResult( KErrNone, aDesc ); \
+		}
+		
+		
+
+#define STF_ASSERT_EQUALS( aExpected, aActual ) \
+	__STF_ASSERT_SHARED( AssertEquals( aExpected, aActual ) , KAssertFailedEquals );
+
+#define STF_ASSERT_EQUALS_DESC( aExpected, aActual, aDescription ) \
+	__STF_ASSERT_SHARED_DESC( AssertEquals( aExpected, aActual ) , KAssertFailedEquals, aDescription ); 
+
+#define STF_ASSERT_NOT_EQUALS( aExpected, aActual ) \
+	__STF_ASSERT_SHARED( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals );
+
+#define STF_ASSERT_NOT_EQUALS_DESC( aExpected, aActual, aDescription ) \
+	__STF_ASSERT_SHARED_DESC( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals, aDescription );
+
+#define STF_ASSERT_NULL( aPtr ) \
+	__STF_ASSERT_SHARED( AssertNull( aPtr ), KAssertFailedNull );
+
+#define STF_ASSERT_NULL_DESC( aPtr, aDescription ) \
+	__STF_ASSERT_SHARED_DESC( AssertNull( aPtr ), KAssertFailedNull, aDescription );
+
+#define STF_ASSERT_NOT_NULL( aPtr ) \
+	__STF_ASSERT_SHARED( !AssertNull( aPtr ), KAssertFailedNotNull );
+
+#define STF_ASSERT_NOT_NULL_DESC( aPtr, aDescription ) \
+	__STF_ASSERT_SHARED_DESC( !AssertNull( aPtr ), KAssertFailedNotNull, aDescription );
+
+#define STF_ASSERT_SAME( aExpectedPtr, aActualPtr ) \
+	__STF_ASSERT_SHARED( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame );
+
+#define STF_ASSERT_SAME_DESC( aExpectedPtr, aActualPtr, aDescription ) \
+	__STF_ASSERT_SHARED_DESC( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame, aDescription );
+
+#define STF_ASSERT_NOT_SAME( aExpectedPtr, aActualPtr) \
+	__STF_ASSERT_SHARED( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame );
+
+#define STF_ASSERT_NOT_SAME_DESC( aExpectedPtr, aActualPtr, aDescription ) \
+	__STF_ASSERT_SHARED_DESC( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame, aDescription );
+
+#define STF_ASSERT_TRUE( aCondition ) \
+	__STF_ASSERT_SHARED( AssertTrue( aCondition ), KAssertFailedTrue );
+
+#define STF_ASSERT_TRUE_DESC( aCondition, aDescription ) \
+	__STF_ASSERT_SHARED_DESC( AssertTrue( aCondition ), KAssertFailedTrue, aDescription );
+
+#define STF_ASSERT_FALSE( aCondition ) \
+	__STF_ASSERT_SHARED( !AssertTrue( aCondition ), KAssertFailedFalse );
+
+#define STF_ASSERT_FALSE_DESC( aCondition, aDescription ) \
+	__STF_ASSERT_SHARED_DESC( !AssertTrue( aCondition), KAssertFailedFalse, aDescription );
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STF_ASSERT_NOT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves ); \
+    }
+
+#define STF_ASSERT_NOT_LEAVES_DESC( aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED_DESC( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves, aDescription ); \
+    }    
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STF_ASSERT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves ); \
+    }
+
+#define STF_ASSERT_LEAVES_DESC( aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED_DESC( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves, aDescription ); \
+    }   
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STF_ASSERT_LEAVES_WITH( aLeaveCode, aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves ); \
+    }
+
+#define STF_ASSERT_LEAVES_WITH_DESC( aLeaveCode, aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED_DESC( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves, aDescription ); \
+    }
+
+#define STF_ASSERT_PANIC( aPanicCode, aStatement ) \
+	{ \
+	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
+	aStatement; \
+	}
+
+#define STF_ASSERT_PANIC_DESC( aPanicCode, aStatement, aDescription ) \
+	{ \
+	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
+	aResult.SetResult(KErrNone, aDescription); \
+	aStatement; \
+	}
+    
+		
+/*********************************************************************************
+ * STIF Assert Macros
+ *********************************************************************************/
+#define __STIF_ASSERT_SHARED( aFunction, aMessage ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\
+		aResult.SetResult( KErrGeneral, _L("Testcase failed"));\
+		return KErrNone;\
+		}
+
+#define __STIF_ASSERT_SHARED_DESC( aFunction, aMessage, aDesc ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\
+		aResult.SetResult( KErrGeneral, aDesc );\
+		return KErrNone;\
+		} \
+	else \
+		{ \
+		aResult.SetResult( KErrNone, aDesc ); \
+		}
+		
+		
+
+#define STIF_ASSERT_EQUALS( aExpected, aActual ) \
+	__STIF_ASSERT_SHARED( AssertEquals( aExpected, aActual ) , KAssertFailedEquals );
+
+#define STIF_ASSERT_EQUALS_DESC( aExpected, aActual, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( AssertEquals( aExpected, aActual ) , KAssertFailedEquals, aDescription ); 
+
+#define STIF_ASSERT_NOT_EQUALS( aExpected, aActual ) \
+	__STIF_ASSERT_SHARED( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals );
+
+#define STIF_ASSERT_NOT_EQUALS_DESC( aExpected, aActual, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals, aDescription );
+
+#define STIF_ASSERT_NULL( aPtr ) \
+	__STIF_ASSERT_SHARED( AssertNull( aPtr ), KAssertFailedNull );
+
+#define STIF_ASSERT_NULL_DESC( aPtr, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( AssertNull( aPtr ), KAssertFailedNull, aDescription );
+
+#define STIF_ASSERT_NOT_NULL( aPtr ) \
+	__STIF_ASSERT_SHARED( !AssertNull( aPtr ), KAssertFailedNotNull );
+
+#define STIF_ASSERT_NOT_NULL_DESC( aPtr, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( !AssertNull( aPtr ), KAssertFailedNotNull, aDescription );
+
+#define STIF_ASSERT_SAME( aExpectedPtr, aActualPtr ) \
+	__STIF_ASSERT_SHARED( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame );
+
+#define STIF_ASSERT_SAME_DESC( aExpectedPtr, aActualPtr, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame, aDescription );
+
+#define STIF_ASSERT_NOT_SAME( aExpectedPtr, aActualPtr) \
+	__STIF_ASSERT_SHARED( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame );
+
+#define STIF_ASSERT_NOT_SAME_DESC( aExpectedPtr, aActualPtr, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame, aDescription );
+
+#define STIF_ASSERT_TRUE( aCondition ) \
+	__STIF_ASSERT_SHARED( AssertTrue( aCondition ), KAssertFailedTrue );
+
+#define STIF_ASSERT_TRUE_DESC( aCondition, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( AssertTrue( aCondition ), KAssertFailedTrue, aDescription );
+
+#define STIF_ASSERT_FALSE( aCondition ) \
+	__STIF_ASSERT_SHARED( !AssertTrue( aCondition ), KAssertFailedFalse );
+
+#define STIF_ASSERT_FALSE_DESC( aCondition, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( !AssertTrue( aCondition), KAssertFailedFalse, aDescription );
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_NOT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves ); \
+    }
+
+#define STIF_ASSERT_NOT_LEAVES_DESC( aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_DESC( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves, aDescription ); \
+    }    
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves ); \
+    }
+
+#define STIF_ASSERT_LEAVES_DESC( aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_DESC( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves, aDescription ); \
+    }   
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_LEAVES_WITH( aLeaveCode, aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves ); \
+    }
+
+#define STIF_ASSERT_LEAVES_WITH_DESC( aLeaveCode, aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_DESC( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves, aDescription ); \
+    }
+
+#define STIF_ASSERT_PANIC( aPanicCode, aStatement ) \
+	{ \
+	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
+	aStatement; \
+	}
+
+#define STIF_ASSERT_PANIC_DESC( aPanicCode, aStatement, aDescription ) \
+	{ \
+	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
+	aResult.SetResult(KErrNone, aDescription); \
+	aStatement; \
+	}
+
+template <class T>
+inline TBool AssertEquals(const T& aExpected, const T& aActual)
+/**
+ * AssertEquals
+ *
+ *
+ * @param aExpected - Expected result
+ * @param aActual - Actual result
+ * @return - True if equal
+ */
+	{
+	if( aExpected==aActual )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+template <class T>
+inline TBool AssertNull(const T* aPtr)
+/**
+ * AssertNull
+ *
+ *
+ * @param aPtr - Pointer
+ * @return - True if NULL
+ */
+	{
+	if( aPtr==NULL )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+template <class T>
+inline TBool AssertSame(const T* aExpectedPtr, const T* aActualPtr)
+/**
+ * AssertSame
+ *
+ *
+ * @param aExpectedPtr - Expected pointer
+ * @param aActualPtr - Actual pointer
+ * @return - True if equal
+ */
+	{
+	if( aExpectedPtr==aActualPtr )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+inline TBool AssertTrue(const TBool& aCondition)
+/**
+ * AssertTrue
+ *
+ *
+ * @param aCondition - Condition
+ * @return - True if aCondition is true
+ */
+	{
+	if( !aCondition )
+		{
+		return EFalse;
+		}
+	return ETrue;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/RRefArray.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,55 @@
+/*
+* 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: This file contains the header file of the STIF util
+* class RRefArray.
+*
+*/
+
+#ifndef RREFARRAY_H
+#define RREFARRAY_H
+
+// INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+/**
+* Array class for references.
+*/
+template <class T>
+class RRefArray
+    :public RPointerArrayBase
+    {
+    public:
+        inline RRefArray():RPointerArrayBase(){};
+    	inline void Close(){ RPointerArrayBase::Close(); };
+    	inline TInt Count() const{ return RPointerArrayBase::Count(); };
+    	inline T const& operator[](TInt anIndex) const 
+    	    { return *( ( T* ) At(anIndex)); };
+    	inline T& operator[](TInt anIndex) 
+    	    { return *( ( T* ) At(anIndex)); };
+    	inline TInt Append( T const& anEntry )
+    	    { return RPointerArrayBase::Append(( TAny*) &anEntry); };
+    	inline TInt Insert( T const& anEntry, TInt aPos )
+    	    { return RPointerArrayBase::Insert(( TAny*) &anEntry, aPos ); };
+    	inline void Remove( TInt anIndex ) 
+    	    { RPointerArrayBase::Remove( anIndex ); };
+    	inline void Reset(){ RPointerArrayBase::Reset(); };
+    private:
+        RArray<TAny*> iArray;
+    };
+
+
+#endif // RREFARRAY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/STFLogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,233 @@
+/*
+* 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: 
+* 
+*
+*/
+
+// This file defines the API for STFLogger.dll
+
+#ifndef __STFLOGGER_H__
+#define __STFLOGGER_H__
+
+//  Include Files
+
+#include <e32base.h>	// CBase
+#include <e32std.h>	 // TBuf
+#include <f32file.h>
+#include <stiflogger.h>
+
+
+#define __DECLARE_LOG               RSTFLogger stf_Logger;
+#define __OPENLOGL(D, L)            User::LeaveIfError(stf_Logger.Connect()); \
+                                    TParse p; \
+                                    _LIT(KLogFile, L); \
+                                    p.Set(KLogFile(), NULL, NULL); \
+                                    _LIT(KLogDir, D); \
+                                    stf_Logger.CreateL(KLogDir(), p.NameAndExt());
+#define __CLOSELOG                  stf_Logger.Close();
+extern RSTFLogger stf_Logger;
+
+//These type of log should be used as: __LOG(_L("test"));
+#define __LOG(C)                    stf_Logger.Log(C);
+#define __LOG1(C, Z)                stf_Logger.Log(C, Z);
+#define __LOG2(C, Z, Y)             stf_Logger.Log(C, Z, Y);
+#define __LOG3(C, Z, Y, X)          stf_Logger.Log(C, Z, Y, X);
+#define __LOG4(C, Z, Y, X, W)       stf_Logger.Log(C, Z, Y, X, W);
+#define __LOG5(C, Z, Y, X, W, V)    stf_Logger.Log(C, Z, Y, X, W, V);
+#define __LOG6(C, Z, Y, X, W, V, U) stf_Logger.Log(C, Z, Y, X, W, V, U);
+
+
+
+
+class RSTFLogger : public RSessionBase
+	{
+public:
+    
+	// new functions
+	IMPORT_C TInt Connect();
+
+public: // new functions, example API
+		
+	IMPORT_C TInt CreateL(	const TDesC& aTestPath,
+				            const TDesC& aTestFile,
+				            // Default logger type is .txt
+				            CStifLogger::TLoggerType aLoggerType = CStifLogger::ETxt,
+				            // By default output is file
+				            CStifLogger::TOutput aOutput = CStifLogger::EFile,
+				            // By default overwrite is used
+				            TBool aOverWrite = ETrue,
+				            // By default time stamp is used
+				            TBool aWithTimeStamp = ETrue,
+				            // By default line break is used
+				            TBool aWithLineBreak = ETrue,
+				            // By default even ranking is not
+				            // used
+				            TBool aWithEventRanking = EFalse,
+				            // By default thread id is added
+				            // after the log file
+				            TBool aThreadIdToLogFile = ETrue,
+				            // By default log directory will
+				            // not create
+				            TBool aCreateLogDir = EFalse,
+				            // Static logger implementation is
+				            // not yet permanent, may change 
+				            TInt aStaticBufferSize = 0,
+				            // By default files are not written
+				            // in unicode format
+				            TBool aUnicode = EFalse );
+	
+	   IMPORT_C TInt CreateL(   const TDesC& aTestPath,
+	                           const TDesC& aTestFile,
+                               TLoggerSettings& aLoggerSettings );
+	
+    /**
+    * Log a 16 bit information to some storage e.g. text file.
+    */
+    IMPORT_C TInt Log( const TDesC& aLogInfo );
+
+    /**
+    * Log a 8 bit information to some storage e.g. text file.
+    */
+    IMPORT_C TInt Log( const TDesC8& aLogInfo );
+
+    /**
+    * Log a 16 bit information to some storage e.g. text file. There is
+    * also parameter to styling text information e.g. text color.
+    */
+    IMPORT_C TInt Log( TInt aStyle, const TDesC& aLogInfo );
+
+    /**
+    * Log a 8 bit information to some storage e.g. text file. There is
+    * also parameter to styling text information e.g. text color.
+    */
+    IMPORT_C TInt Log( TInt aStyle, const TDesC8& aLogInfo );
+
+    /**
+    * Log a 16 bit information to some storage e.g. text file. In this log
+    * method may set several parameters.
+    */
+    IMPORT_C TInt Log( TRefByValue<const TDesC> aLogInfo,... );
+
+    /**
+    * Log a 8 bit information to some storage e.g. text file. In this log
+    * method may set several parameters.
+    */
+    IMPORT_C TInt Log( TRefByValue<const TDesC8> aLogInfo,... );
+
+    /**
+    * Log a 16 bit information to some storage e.g. text file. There is
+    * also parameter to styling text information e.g. text color.
+    */
+    IMPORT_C TInt Log( TInt aStyle,
+        TRefByValue<const TDesC> aLogInfo,... );
+
+    /**
+    * Log a 8 bit information to some storage e.g. text file. There is
+    * also parameter to styling text information e.g. text color.
+    */
+    IMPORT_C TInt Log( TInt aStyle,
+        TRefByValue<const TDesC8> aLogInfo,... );
+
+    /**
+    * Log a 16 bit delimiter. Default char is '#' and default
+    * repeat count is 60.
+    * This will be used if parameters are not given when calling
+    * this method.
+    */
+    IMPORT_C TInt WriteDelimiter( const TDesC& aDelimiter = _L( "#"),
+                                    TInt aCount = 60 );
+
+    /**
+    * Log a 8 bit delimiter. 8 bit delimiter includes no default values.
+    * Delimiter may be '#' or 'XO' etc.
+    */
+    IMPORT_C TInt WriteDelimiter( const TDesC8& aDelimiter, TInt aCount );
+
+    /**
+    * Used when is need to save file or data to storage e.g. web page.
+    * 16 bit.
+    */
+    IMPORT_C TInt SaveData(const TDesC& aData );
+
+    /**
+    * Used when is need to save file or data to storage e.g. web page.
+    * 8 bit.
+    */
+    IMPORT_C TInt SaveData(const TDesC8& aData );
+    
+    /**
+    * Get creation result.
+    */
+    IMPORT_C TInt CreationResult(TInt& aResult);
+
+    /**
+    * Get output type. Valid only if CreationResult returns KErrNone.
+    */
+    IMPORT_C TInt OutputType(CStifLogger::TOutput& aOutputType);
+    
+    /**
+    * Log 16 bit _LIT information to some storage e.g. text file.
+    */
+    template<TInt S> TInt Log( const TLitC<S>& aLogInfo )
+        { 
+        return Log( CStifLogger::ENoStyle, (TDesC&)aLogInfo );
+        };
+
+    /**
+    * Log 8 bit _LIT information to some storage e.g. text file.
+    */
+    template<TInt S> TInt Log( const TLitC8<S>& aLogInfo )
+        { 
+        return Log( CStifLogger::ENoStyle, (TDesC8&)aLogInfo );
+        };
+
+    /**
+    * Log 16 bit _LIT information to some storage e.g. text file. There is
+    * also parameter to styling text information e.g. text color.
+    */
+    template<TInt S> TInt Log( TInt aStyle, const TLitC<S>& aLogInfo )
+        { 
+        return Log( aStyle, (TDesC&)aLogInfo );
+        };
+
+    /**
+    * Log 8 bit _LIT information to some storage e.g. text file.  There is
+    * also parameter to styling text information e.g. text color.
+    */
+    template<TInt S> TInt Log( TInt aStyle, const TLitC8<S>& aLogInfo )
+        { 
+        return Log( aStyle, (TDesC8&)aLogInfo );
+        };
+    
+private:
+    void OverwriteLoggerSettings( TLoggerSettings& aLoggerSettings,
+                                                TName& aTestPath,
+                                                TName& aTestFile,
+                                                CStifLogger::TLoggerType& aLoggerType,
+                                                CStifLogger::TOutput& aOutput,
+                                                TBool& aOverWrite,
+                                                TBool& aWithTimeStamp,
+                                                TBool& aWithLineBreak,
+                                                TBool& aWithEventRanking,
+                                                TBool& aThreadIdToLogFile,
+                                                TBool& aCreateLogDir,
+                                                TBool& aUnicode );
+
+	};
+
+	
+
+#endif  // __STFLOGGER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/SettingServerClient.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,134 @@
+/*
+* 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: This file contains the header file of the 
+* RSettingServer
+*
+*/
+
+#ifndef SETTING_SERVER_CLIENT_H
+#define SETTING_SERVER_CLIENT_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include <TestEngineClient.h>
+
+// CONSTANTS
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// RSettingServer is a client class of Setting server
+// The connect function starts the server, if it not already running.
+
+class RSettingServer
+        :public RSessionBase 
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Constructor.
+        */
+        IMPORT_C RSettingServer();
+
+        /**
+        * Closes the RSettingServer session.
+        */
+        IMPORT_C void Close();
+
+    public: // New functions
+        
+        /**
+        * Connect method creates new RSettingServer session 
+        */
+        IMPORT_C TInt Connect();
+
+        /**
+        * Version returns the client side version number from the RSettingServer.
+        */
+        IMPORT_C TVersion Version() const;
+
+        /**
+        * Read Logger setting from initialization file. Mainly use from
+        * TestEngine side.
+        */
+        IMPORT_C TInt LoadLoggerSettingsFromIniFile( 
+                                        TLoggerSettings& aLoggerSettings, 
+                                        const TDesC& aIniFile,
+                                        TBool aOverwritePreviousSettings = ETrue );
+
+        /**
+        * Get Logger settings. Mainly use from Logger side.
+        */
+        IMPORT_C TInt GetLoggerSettings( TLoggerSettings& aLoggerSettings );
+
+        /**
+        * Set new initialization file setting(e.g. SetAttribute).
+        */
+        IMPORT_C TInt SetLoggerOutputPath( const TDesC& aLoggerOutputPath );
+
+        IMPORT_C TInt ResetLoggerSettings();
+        
+        /**
+        * Read Logger setting from command line. Mainly use from
+        * TestEngine side.
+        */
+        IMPORT_C TInt LoadLoggerSettingsFromCommandLine(TDesC& aLoggerSettings);
+        
+    public:     // Functions from base classes
+        // None
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:    // Functions from base classes
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // None
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif // SETTING_SERVER_CLIENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifCommand.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,84 @@
+/*
+* 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: This file contains the type definitions used by 
+* command feature (i.e. StopExecution).
+*
+*/
+
+#ifndef STIF_COMMAND_H
+#define STIF_COMMAND_H
+
+
+//  INCLUDES
+#include <E32Base.h>
+
+// CONSTANTS 
+const TInt KMaxCommandParamsLength = 50;	// DEPRECATED use KMaxCommandParamsLength2 instead
+const TInt KMaxCommandParamsLength2 = 600;
+
+// MACROS
+
+// FUNCTION PROTOTYPES
+
+// DATA TYPES
+
+// This enum type lists all possible commands sent from test case to test engine
+enum TCommand
+    {
+    EStopExecution,
+    ESendTestModuleVersion,
+    };
+
+typedef TPckg<TCommand> TCommandPckg;
+
+// This enum type lists all possible ways of how to run StopExecution command
+enum TStopExecutionType
+    {
+    EOk,
+#ifndef __TEF_EXPORT_CONST_H__   
+    //EFail & EAbort are overlaped with enum in tefexportconst.h
+    //TEFTestModule.dll migrates TEF into STIF module, If build TEFTestModule.dll, EFail and EAbort definition will be deleted from STIF. 
+    EFail,
+    EAbort,
+#endif
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+struct TStopExecutionCommandParams
+    {
+    TInt               iTestCaseHandle;
+    TStopExecutionType iType;
+    TInt               iCode;
+    };
+
+typedef TPckg<TStopExecutionCommandParams> TStopExecutionCommandParamsPckg;
+
+
+struct TSendTestModuleVesionCommandParams
+	{
+	TFileName iTestModuleName;
+	TInt iMajor;
+	TInt iMinor;
+	TInt iBuild;
+	};
+
+typedef TPckg<TSendTestModuleVesionCommandParams> TSendTestModuleVesionCommandParamsPckg;
+
+#endif //STIF_COMMAND_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifHWReset.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,117 @@
+/*
+* 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: This file contains the header file of CStifHWReset 
+* of STIF TestFramework.
+*
+*/
+
+#ifndef STIFHWRESET_H
+#define STIFHWRESET_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+
+#include "StifTestModule.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// This is class which can be inherited from own code to perform a
+// reset to the system.
+// This is used when calling dynamic loaded dll from STIF TestFramework.
+class CStifHWReset
+        :public CBase
+    {
+    public:     // Enumerations
+
+        // Different reset types. Possibility to do different king of reset.
+/*        enum TResetType
+            {
+            EResetType0,
+            EResetType1,
+            EResetType2,
+            EResetType3,
+            EResetType4,
+            EResetType5
+            };
+*/
+    public:     // Enumerations
+    	// None
+
+    private:    // Enumerations
+    	// None
+
+    public:     // Constructors and destructor
+    	// None
+
+    public:     // New functions
+        
+        /**
+        * Defines reset type and forwards information to reset module.
+        * This method is pure virtual and it is mandatory to implement it
+        * to specific reset module.
+        */
+        virtual TInt DoReset( CTestModuleIf::TRebootType aResetType ) = 0;
+        
+    public:     // Functions from base classes
+        // None
+
+    protected:  // New functions
+    	// None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+        // None
+
+	public:     // Data
+	    // None
+
+	protected:  // Data
+        // None
+
+    private:    // Data
+        // None
+
+    public:     // Friend classes
+        // None
+    	
+    protected:  // Friend classes
+        // None
+    	
+    private:    // Friend classes
+        // None
+    	
+    };
+
+#endif // STIFHWRESET_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifItemParser.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,296 @@
+/*
+* 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: This file contains the header file of the 
+* CStifItemParser.
+*
+*/
+
+#ifndef STIF_ITEM_PARSER_H
+#define STIF_ITEM_PARSER_H
+
+//  INCLUDES
+#include <f32file.h>
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+const TInt KMaxTag = 256; // A tag maximum length
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CStifItemParser is a STIF Test Framework StifParser class.
+// Class contains a configuration file parsing operations.
+
+class CStifItemParser
+        :public CBase
+    {
+    public:     // Enumerations
+
+        // Parsing type can be given when parsing string(GetString and
+        // GetNextString). This enumeration indicates parsing type.
+        // ENormalParsing:
+        //      - Indicates normal parsing without any modifications to
+        //        parsed information
+        // EQuoteStyleParsing:
+        //      - Indicates special parsing. This style of parsing gives to
+        //        quote(" ") characters special meaning.
+        //      - Information between quotes is handled as a one string. Quotes
+        //        not included to information.
+        enum TParsingType
+            {
+            ENormalParsing,     // Mode on(Default)
+            EQuoteStyleParsing, // Mode off
+            };
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CStifItemParser* NewL( TPtrC aSection,
+                                                TInt aStartPos,
+                                                TInt aLength );
+
+        /**
+        * Destructor.
+        */
+        ~CStifItemParser();
+
+    public:     // New functions
+
+        /**
+        * Get a string with a tag.
+        * Returns an error code and a reference to the parsed string.
+         *If start tag is empty the first string will be parsed and returned.
+        */
+        IMPORT_C TInt GetString( const TDesC& aTag, TPtrC& aString );
+
+        /**
+        * Get next string.
+        * Returns an error code and a reference to the parsed string.
+        * GetString or GetInt or GetChar must be called before call
+        * GetNextString method.
+        */
+        IMPORT_C TInt GetNextString( TPtrC& aString );
+
+        /**
+        * Get next string with a tag.
+        * Returns an error code and a reference to the parsed string.
+        * If start tag is empty the next string will be parsed and returned.
+        * GetString or GetInt or GetChar must be called before call
+        * GetNextString method.
+        */
+        IMPORT_C TInt GetNextString( const TDesC& aTag, TPtrC& aString );
+
+        /**
+        * Get a integer(TInt) with a tag.
+        * Returns an error code and a reference to the parsed integer.
+        * If start tag is empty the first integer will be parsed and returned.
+        */
+        IMPORT_C TInt GetInt( const TDesC& aTag, TInt& aInteger );
+
+        /**
+        * Get next integer(TInt).
+        * Returns an error code and a reference to the parsed integer.
+        * GetString or GetInt or GetChar must be called before call
+        * GetNextInt method.
+        */
+        IMPORT_C TInt GetNextInt( TInt& aInteger );
+
+        /**
+        * Get next integer(TInt) with a tag.
+        * Returns an error code and a reference to the parsed integer.
+        * If start tag is empty the next integer will be parsed and returned.
+        * GetString or GetInt or GetChar must be called before call
+        * GetNextInt method.
+        */
+        IMPORT_C TInt GetNextInt( const TDesC& aTag, TInt& aInteger );
+
+        /**
+        * Get a integer(TUint) with a tag.
+        * Returns an error code and a reference to the parsed integer.
+        * If start tag is empty the first integer will be parsed and returned.
+        * With TRadix parameter can convert a number into different
+        * presentation(EBinary, EOctal, EDecimal and EHex).
+        */
+        IMPORT_C TInt GetInt( const TDesC& aTag,
+                                TUint& aInteger,
+                                TRadix aRadix = EDecimal );
+
+        /**
+        * Get next integer(TUint).
+        * Returns an error code and a reference to the parsed integer.
+        * GetString or GetInt or GetChar must be called before call
+        * GetNextInt method.
+        * With TRadix parameter can convert a number into different
+        * presentation(EBinary, EOctal, EDecimal and EHex).
+        */
+        IMPORT_C TInt GetNextInt( TUint& aInteger,
+                                    TRadix aRadix = EDecimal );
+
+        /**
+        * Get next integer(TUint) with a tag.
+        * Returns an error code and a reference to the parsed integer.
+        * If start tag is empty the next integer will be parsed and returned.
+        * GetString or GetInt or GetChar must be called before call
+        * GetNextInt method.
+        * With TRadix parameter can convert a number into different
+        * presentation(EBinary, EOctal, EDecimal and EHex).
+        */
+        IMPORT_C TInt GetNextInt( const TDesC& aTag,
+                                    TUint& aInteger,
+                                    TRadix aRadix = EDecimal );
+
+        /**
+        * Get a character with a tag.
+        * Returns an error code and a reference to the parsed character.
+        * If start tag is empty the first character will be parsed and
+        * returned.
+        */
+        IMPORT_C TInt GetChar( const TDesC& aTag, TChar& aCharacter );
+
+        /**
+        * Get next character.
+        * Returns an error code and a reference to the parsed character.
+        * GetString or GetInt or GetChar must be called before call
+        * GetNextChar method.
+        */
+        IMPORT_C TInt GetNextChar( TChar& aCharacter );
+
+        /**
+        * Get next character with a tag.
+        * Returns an error code and a reference to the parsed character.
+        * If start tag is empty the next character will be parsed and returned.
+        * GetString or GetInt or GetChar must be called before call
+        * GetNextChar method.
+        */
+        IMPORT_C TInt GetNextChar( const TDesC& aTag, TChar& aCharacter );
+
+        
+        /**
+        * Get remaining strings.
+        * Returns an error code and a reference to the remainder of the 
+        * parsed line.
+        * Note: This method does not support the quote(TParsingType) feature,
+        * only GetString and GetNextString methods include support.
+        */
+        IMPORT_C TInt Remainder( TPtrC& aString );
+        
+        /**
+        * Parsing type can be given when parsing string(GetString and
+        * GetNextString). See TParsingType enumeration for more
+        * inforamtion.
+        */
+        IMPORT_C TInt SetParsingType( CStifItemParser::TParsingType aType );
+        
+        /**
+        * Get current parsing type. Please see TParsingType enumeration for
+        * more inforamtion.
+        */
+        IMPORT_C CStifItemParser::TParsingType ParsingType();
+        
+        /**
+         * Get key-value pair. 
+         * 
+         */
+        IMPORT_C  TInt GetValueOf(const TDesC& aKey, TDes& aValue);
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CStifItemParser( TPtrC aSection,
+                            TInt aStartPos,
+                            TInt aLength );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Generig start and end position parser for given data.
+        * Returns an error code.
+        */
+        TInt ParseStartAndEndPos( TPtrC aSection,
+                                    const TDesC& aStartTag,
+                                    TInt& aStartPos,
+                                    TInt& aEndPos,
+                                    TInt& aLength,
+                                    TInt& aExtraEndPos );
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        /**
+        * Parsed section with GetItemLineL() or GetNextItemLineL() method.
+        */
+        TPtrC                           iItemLineSection;
+
+        /**
+        * Indicates position where start the parsing.
+        */
+        TInt                            iItemSkipAndMarkPos;
+
+        /**
+        * Indicator is GetString(), GetInt() or GetChar() called.
+        */
+        TBool                           iGetMethodsIndicator;
+
+        /**
+        * Parsing type indicator for GetString and GetNextString use.
+        */
+        CStifItemParser::TParsingType   iParsingType;
+
+    public:     // Friend classes
+
+        /**
+        * For testing operations to get length information.
+        */
+        friend class CTestParser;
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // STIF_ITEM_PARSER_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifKernelTestClassBase.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,149 @@
+/*
+* 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: This file contains the header file of the STIF 
+* kernel testclass declaration
+*
+*/
+
+#ifndef STIFKERNELTESTCLASSBASE_H
+#define STIFKERNELTESTCLASSBASE_H
+
+//  INCLUDES
+#include <kernel.h>    
+
+
+// CONSTANTS
+
+// MACROS
+
+
+// In EKA2 kernel only 8bit descriptors are allowed, because of that C++'s 
+// L makro cannot be used.
+
+// ENTRY macro is modified and now it stores data as 8bit descriptor.
+// In EKA2 kernel TText is 8bit descriptor.
+
+#define ENTRY(A,B) \
+	{ (TText*) A, (StifTestFunction) &B }
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class DStifKernelTestClassBase;
+
+// DATA TYPES
+typedef TInt (DStifKernelTestClassBase::* StifTestFunction)( const TDesC& );    
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TStifFunctionInfo
+    {
+    public:            
+        const TText*           iFunctionName;
+        StifTestFunction       iMethod;    
+    };
+    
+// CLASS DECLARATION
+
+/**
+* DStifKernelTestClassBaseDriver is the device driver factory that will
+* instantiate the physical channel, which is the actual
+* physical driver.
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class DStifKernelTestClassBaseDriver : public DLogicalDevice
+    {
+
+    public:
+        IMPORT_C DStifKernelTestClassBaseDriver( const TDesC& aName );
+        IMPORT_C virtual ~DStifKernelTestClassBaseDriver();
+
+        IMPORT_C virtual TInt Install();
+        IMPORT_C virtual void GetCaps(TDes8 &aDes) const;
+
+        virtual TInt Create(DLogicalChannelBase*& aChannel)=0;
+  
+    private:
+        TName   iName;
+    
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  DStifKernelTestClassBase is a base class for kernel test class 
+*  for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class DStifKernelTestClassBase : public DLogicalChannel
+    {
+
+    public:
+        IMPORT_C DStifKernelTestClassBase( DLogicalDevice* aDevice );
+        IMPORT_C virtual ~DStifKernelTestClassBase();
+        
+    public:     
+        /**
+        * Runs a script line. Derived class must implement
+        */
+        virtual TInt RunMethodL( const TDesC& aMethod, const TDesC& aParams ) = 0;  
+        
+        /**
+        * Called from destructor. Derived class may implement.
+        */
+        virtual void Delete(){};  
+        
+        // Processes a message for this logical channel
+        IMPORT_C virtual void HandleMsg( TMessageBase* aMsg );
+    protected: // Derived class uses
+        
+        // Internal fuction to run specified method.              
+        IMPORT_C virtual TInt RunInternalL( 
+                        const TStifFunctionInfo* const aFunctions, 
+                        TInt aCount, 
+                        const TDesC& aMethod, 
+                        const TDesC& aParams );
+
+    private: 
+
+        // No need to export DoControl in EKA2, because it is called
+        // from HandleMsg
+        TInt DoControl( TInt aFunction,TAny* a1,TAny* a2 );
+     
+        // Asynchronous command are not supported
+        void DoCancel( TInt ){};
+                  
+    private:
+     
+        DThread*         iThread;                
+     
+    };
+
+#endif      // STIFKERNELTESTCLASSBASE_H
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifLogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,409 @@
+/*
+* 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: This file contains the header file of the 
+* CStifLogger.
+*
+*/
+
+#ifndef STIFLOGGER_H
+#define STIFLOGGER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>  // TBuf
+
+
+// If using older STIF TF than STIF200414 there is no this definition.
+// If is need to combile e.g. testmodule with older STIF TF there may use
+// in the testmodule this flag to indicating which enum definition is used.
+// Example:
+//          #ifdef __NEW_LOGGER_ENUMS_DEFS__
+//              logger->Log( CStifLogger::ERed, _L( "Logged text" ) );
+//          #else
+//              logger->Log( ERed, _L( "Logged text" ) );
+//          #endif
+#define __NEW_LOGGER_ENUMS_DEFS__
+
+// Maximum length of the data. Must be over 26 because HTML page initializing.
+// Can be only max 254 length because rdebug prints max 256 length text and
+// that includes line break(+2 character)
+const TInt KMaxLogData = 254;
+
+// This is for making partitions of the rdebug( minus 3 is for ' ->')
+const TInt KMaxRDebug = KMaxLogData - 3;
+
+// Maximum count of file type plus dot e.g. ".txt"
+const TInt KMaxFileType = 10;
+
+// Maximum length of the date and time logging
+// Includes date, time, spaces(5) and end of line(2):
+// e.g. "'06.Nov.2003 15:12:18.123    '...logged data...'  '"
+const TInt KMaxTimeStamp = 30;
+
+// MACROS
+// None
+
+// DATA TYPES
+
+// For 16 bit data size definition.
+typedef TBuf<KMaxLogData> TLogInfo;
+
+// For 8 bit data size definition.
+typedef TBuf8<KMaxLogData> TLogInfo8;
+
+// For file type size definition.
+typedef TBuf<KMaxFileType> TFileType;
+
+// For time stamp size definition.
+typedef TBuf8<KMaxTimeStamp> TStifLoggerTimeStamp;
+
+// For time stamp size definition.
+typedef TBuf<KMaxTimeStamp> TStifLoggerTimeStamp8;
+
+// FUNCTION PROTOTYPES
+// None
+
+
+
+// Structs are defined at the end of this file.
+struct TOverwritedSettings;
+struct TLoggerSettings;
+
+
+// FORWARD DECLARATIONS
+class COutput;
+class RSTFLogger;
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CStifLogger is a STIF Test Framework StifLogger class.
+// Class contains a file logging operations.
+
+
+class CStifLogger 
+        :public CBase
+    {
+    public:     // Enumerations
+
+        // Different StifLogger presentations types.
+        enum TLoggerType
+            {
+            ETxt,       // txt file logging
+            EData,      // data file logging(e.g. web page downloading )
+            EHtml       // html file logging
+            };
+
+        // Different StifLogger output modules.
+        enum TOutput
+            {
+            EFile,      // File logging
+            ERDebug     // RDebug logging
+            };
+
+        // Different style forms for text.
+        enum TStyle
+            {
+            ENoStyle    = 0x00000,  // No style parameter
+            EBold       = 0x00001,  // Bold
+            ECursive    = 0x00002,  // Cursive
+            EUnderline  = 0x00004,  // Underline
+            EBlue       = 0x00008,  // Blue
+            EGreen      = 0x00010,  // Green
+            ERed        = 0x00020,  // Red
+            EImportant  = 0x00040,  // Important (Line will starts a 'IMPORTANT' text)
+            EWarning    = 0x00080,  // Warning (Line will starts a 'WARNING' text)
+            EError      = 0x00100   // Error (Line will starts a 'ERROR' text)
+            };
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CStifLogger* NewL( const TDesC& aTestPath,
+                                            const TDesC& aTestFile,
+                                            // Default logger type is .txt
+                                            TLoggerType aLoggerType = ETxt,
+                                            // By default output is file
+                                            TOutput aOutput = EFile,
+                                            // By default overwrite is used
+                                            TBool aOverWrite = ETrue,
+                                            // By default time stamp is used
+                                            TBool aWithTimeStamp = ETrue,
+                                            // By default line break is used
+                                            TBool aWithLineBreak = ETrue,
+                                            // By default even ranking is not
+                                            // used
+                                            TBool aWithEventRanking = EFalse,
+                                            // By default thread id is added
+                                            // after the log file
+                                            TBool aThreadIdToLogFile = ETrue,
+                                            // By default log directory will
+                                            // not create
+                                            TBool aCreateLogDir = EFalse,
+                                            // Static logger implementation is
+                                            // not yet permanent, may change 
+                                            TInt aStaticBufferSize = 0,
+                                            // By default files are not written
+                                            // in unicode format
+                                            TBool aUnicode = EFalse );
+
+        virtual ~CStifLogger();
+
+    public:     // New functions
+
+        CStifLogger();
+
+        /**
+        * Log a 16 bit information to some storage e.g. text file.
+        */
+        IMPORT_C TInt Log( const TDesC& aLogInfo );
+
+        /**
+        * Log a 8 bit information to some storage e.g. text file.
+        */
+        IMPORT_C TInt Log( const TDesC8& aLogInfo );
+
+        /**
+        * Log a 16 bit information to some storage e.g. text file. There is
+        * also parameter to styling text information e.g. text color.
+        */
+        IMPORT_C TInt Log( TInt aStyle, const TDesC& aLogInfo );
+
+        /**
+        * Log a 8 bit information to some storage e.g. text file. There is
+        * also parameter to styling text information e.g. text color.
+        */
+        IMPORT_C TInt Log( TInt aStyle, const TDesC8& aLogInfo );
+
+        /**
+        * Log a 16 bit information to some storage e.g. text file. In this log
+        * method may set several parameters.
+        */
+        IMPORT_C TInt Log( TRefByValue<const TDesC> aLogInfo,... );
+
+        /**
+        * Log a 8 bit information to some storage e.g. text file. In this log
+        * method may set several parameters.
+        */
+        IMPORT_C TInt Log( TRefByValue<const TDesC8> aLogInfo,... );
+
+        /**
+        * Log a 16 bit information to some storage e.g. text file. There is
+        * also parameter to styling text information e.g. text color.
+        */
+        IMPORT_C TInt Log( TInt aStyle,
+            TRefByValue<const TDesC> aLogInfo,... );
+
+        /**
+        * Log a 8 bit information to some storage e.g. text file. There is
+        * also parameter to styling text information e.g. text color.
+        */
+        IMPORT_C TInt Log( TInt aStyle,
+            TRefByValue<const TDesC8> aLogInfo,... );
+
+        /**
+        * Log a 16 bit delimiter. Default char is '#' and default
+        * repeat count is 60.
+        * This will be used if parameters are not given when calling
+        * this method.
+        */
+        IMPORT_C TInt WriteDelimiter( const TDesC& aDelimiter = _L( "#"),
+                                        TInt aCount = 60 );
+
+        /**
+        * Log a 8 bit delimiter. 8 bit delimiter includes no default values.
+        * Delimiter may be '#' or 'XO' etc.
+        */
+        IMPORT_C TInt WriteDelimiter( const TDesC8& aDelimiter, TInt aCount );
+
+        /**
+        * Used when is need to save file or data to storage e.g. web page.
+        * 16 bit.
+        */
+        IMPORT_C TInt SaveData( TDesC& aData );
+
+        /**
+        * Used when is need to save file or data to storage e.g. web page.
+        * 8 bit.
+        */
+        IMPORT_C TInt SaveData( TDesC8& aData );
+        
+        /**
+        * Get creation result.
+        */
+        IMPORT_C TInt CreationResult();
+
+        /**
+        * Get output type. Valid only if CreationResult returns KErrNone.
+        */
+        IMPORT_C TOutput OutputType();
+
+        /**
+        * Pure virtual. Send style information and data to the output module.
+        * 16 bit.
+        */
+        virtual TInt Send( TInt /*aStyle*/, const TDesC& /*aData*/ );
+
+        /**
+        * Pure virtual. Send style information and data to the output module.
+        * 8 bit.
+        */
+        virtual TInt Send( TInt /*aStyle*/, const TDesC8& /*aData*/ );
+
+        /**
+        * Log 16 bit _LIT information to some storage e.g. text file.
+        */
+        template<TInt S> TInt Log( const TLitC<S>& aLogInfo )
+            { 
+            return Send( ENoStyle, (TDesC&)aLogInfo );
+            };
+
+        /**
+        * Log 8 bit _LIT information to some storage e.g. text file.
+        */
+        template<TInt S> TInt Log( const TLitC8<S>& aLogInfo )
+            { 
+            return Send( ENoStyle, (TDesC8&)aLogInfo );
+            };
+
+        /**
+        * Log 16 bit _LIT information to some storage e.g. text file. There is
+        * also parameter to styling text information e.g. text color.
+        */
+        template<TInt S> TInt Log( TInt aStyle, const TLitC<S>& aLogInfo )
+            { 
+            return Send( aStyle, (TDesC&)aLogInfo );
+            };
+
+        /**
+        * Log 8 bit _LIT information to some storage e.g. text file.  There is
+        * also parameter to styling text information e.g. text color.
+        */
+        template<TInt S> TInt Log( TInt aStyle, const TLitC8<S>& aLogInfo )
+            { 
+            return Send( aStyle, (TDesC8&)aLogInfo );
+            };
+
+     protected:
+
+        IMPORT_C static CStifLogger* NewL( const TDesC& aTestPath,
+                                            const TDesC& aTestFile,
+                                            TLoggerSettings& aLoggerSettings );
+
+    protected:
+
+        /**
+        * Deprecated
+        */
+        static void OverwriteLoggerSettings( TLoggerSettings& aLoggerSettings,
+                                                TName& aTestPath,
+                                                TName& aTestFile,
+                                                TLoggerType& aLoggerType,
+                                                TOutput& aOutput,
+                                                TBool& aOverWrite,
+                                                TBool& aWithTimeStamp,
+                                                TBool& aWithLineBreak,
+                                                TBool& aWithEventRanking,
+                                                TBool& aThreadIdToLogFile,
+                                                TBool& aCreateLogDir,
+                                                TBool& aUnicode );
+
+    private:
+        void ConstructL(const TDesC& aTestPath,
+                const TDesC& aTestFile,
+                TLoggerType aLoggerType,
+                TOutput aOutput,
+                TBool aOverWrite,
+                TBool aWithTimeStamp,
+                TBool aWithLineBreak,
+                TBool aWithEventRanking,
+                TBool aThreadIdToLogFile,
+                TBool aCreateLogDir,
+                TInt  aStaticBufferSize,
+                TBool aUnicode);
+        
+        void ConstructL(const TDesC& aTestPath,
+                const TDesC& aTestFile,
+                TLoggerSettings& aLoggerSettings);
+
+    protected:  // Data
+        RSTFLogger* iLogger;
+    private:    // Friend classes
+
+        // TestEngine classes
+        friend class CTestEngineServer;
+        friend class CTestReport;
+        friend class CTestCaseController;
+        friend class CTestEngine;
+
+        // TestServer classes
+        friend class CTestModuleContainer;
+        friend class CTestServer;
+        friend class CTestThreadContainer;
+        friend class CTestThreadContainerRunner;
+
+        // UIEngine classes
+        friend class CUIEngine;
+
+        // SettingServer classes
+        friend class CSettingServer;
+    };
+
+// Struct to indicate StifLogger's settings overwriting
+struct TOverwritedSettings
+    {
+    TBool               iCreateLogDir;
+    TBool               iPath;
+    TBool               iHwPath;
+    TBool               iFormat;
+    TBool               iHwFormat;
+    TBool               iOutput;
+    TBool               iHwOutput;
+    TBool               iOverwrite;
+    TBool               iTimeStamp;
+    TBool               iLineBreak;
+    TBool               iEventRanking;
+    TBool               iThreadId;
+    TBool               iUnicode;
+    TBool               iAddTestCaseTitle;
+    };
+
+// Struct to StifLogger overwrite settings
+struct TLoggerSettings
+    {
+    TBool                       iCreateLogDirectories;
+    TName                       iEmulatorPath;
+    CStifLogger::TLoggerType    iEmulatorFormat;
+    CStifLogger::TOutput        iEmulatorOutput;
+    TName                       iHardwarePath;
+    CStifLogger::TLoggerType    iHardwareFormat;
+    CStifLogger::TOutput        iHardwareOutput;
+    TBool                       iOverwrite;
+    TBool                       iTimeStamp;
+    TBool                       iLineBreak;
+    TBool                       iEventRanking;
+    TBool                       iThreadId;
+    TBool                       iUnicode;
+    TBool                       iAddTestCaseTitle;
+    TOverwritedSettings         iIsDefined;
+    };
+
+#endif      // STIFLOGGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifParser.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,277 @@
+/*
+* 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: This file contains the header file of the 
+* CStifParser.
+*
+*/
+
+#ifndef STIF_PARSER_H
+#define STIF_PARSER_H
+
+//  INCLUDES
+#include <f32file.h>
+#include <e32std.h>
+#include <e32base.h>
+#include "StifSectionParser.h"
+#include "StifItemParser.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CStifSectionParser;
+class CStifFileParser;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CStifParser is a STIF Test Framework StifParser class.
+// Class contains a configuration file parsing operations.
+
+class CStifParser
+        :public CBase
+    {
+    public:     // Enumerations
+
+        // Indication which type of comments are in use
+        enum TCommentType
+            {
+            ENoComments,        // No comments type given, parse all
+            ECStyleComments,    // C-style comments( // and /*...*/ ) are
+                                // removed
+            };
+
+    private:    // Enumerations
+
+        // Indication which mode of parsing are in use
+        enum TParsingMode
+            {
+            EFileParsing,       // Indication for file parsing.
+            EBufferParsing,     // Indication for buffer parsing.
+            };
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * Creating parser with path and file information. For default all
+        * information will be parsed(ENoComments).
+        */
+        IMPORT_C static CStifParser* NewL( const TDesC& aPath, 
+                                            const TDesC& aConfig,
+                                            TCommentType = ENoComments);
+
+        /**
+        * Two-phased constructor.
+        * Creating parser with buffer information. For default all
+        * information will be parsed(ENoComments).
+        */
+        IMPORT_C static CStifParser* NewL( const TDesC& aBuffer, 
+                                            TCommentType = ENoComments );
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CStifParser();
+
+    public:     // New functions
+
+        /**
+         * Open and read configuration source and parses a required section.
+         * If start tag is empty the parsing starts beging of the configuration
+         * file.
+         * If end tag is empty the parsing goes end of configuration file.
+         * This method starts always from beginning of configuration file and
+         * parses first section if aSeeked parameters is not given.
+         * If configuration file includes several sections with both start and
+         * end tags so aSeeked parameter seeks the required section. The aSeeked
+         * parameters indicates section that will be parsed.
+         */
+         IMPORT_C CStifSectionParser* SectionL( const TDesC& aStartTag,
+                                                const TDesC& aEndTag,
+                                                TInt aSeeked = 1 );
+
+           /**
+           * Open and read configuration source and parses a required section.
+           * If start tag is empty the parsing starts beging of the configuration
+           * file.
+           * If end tag is empty the parsing goes end of configuration file.
+           * This method will parse next section after the earlier section if
+           * aSeeked parameter is not given.
+           * If configuration file includes several sections with both start and
+           * end tags so aSeeked parameter seeks the required section. The aSeeked
+           * parameters indicates section that will be parsed.
+           */
+           IMPORT_C CStifSectionParser* NextSectionL( const TDesC& aStartTag,
+                                                       const TDesC& aEndTag,
+                                                       TInt aSeeked = 1);
+        
+        
+        /**
+        * Open and read configuration source and parses a required section.
+        * If start tag is empty the parsing starts beging of the configuration
+        * file.
+        * If end tag is empty the parsing goes end of configuration file.
+        * This method starts always from beginning of configuration file and
+        * parses first section if aSeeked parameters is not given.
+        * If configuration file includes several sections with both start and
+        * end tags so aSeeked parameter seeks the required section. The aSeeked
+        * parameters indicates section that will be parsed.
+        */
+        IMPORT_C CStifSectionParser* SectionL( const TDesC& aStartTag,
+                                                const TDesC& aEndTag,
+                                                TInt aSeeked  ,TBool aIsHasEndTag);
+
+        /**
+        * Open and read configuration source and parses a required section.
+        * If start tag is empty the parsing starts beging of the configuration
+        * file.
+        * If end tag is empty the parsing goes end of configuration file.
+        * This method will parse next section after the earlier section if
+        * aSeeked parameter is not given.
+        * If configuration file includes several sections with both start and
+        * end tags so aSeeked parameter seeks the required section. The aSeeked
+        * parameters indicates section that will be parsed.
+        */
+        IMPORT_C CStifSectionParser* NextSectionL( const TDesC& aStartTag,
+                                                    const TDesC& aEndTag,
+                                                    TInt aSeeked ,TBool aIsHasEndTag );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CStifParser( TCommentType aCommentType );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aPath,
+                         const TDesC& aConfig,
+                         const TDesC& aContent = KNullDesC );
+
+        /**
+        * Convert a section without comments.
+        */
+        void ParseCommentsOff( TPtr& aBuf );
+
+        //
+        // Handles special marks.( '\/\/', '\/\*' and '*/\/' ). This
+        // is used when ECStyleComments comment type is used. 
+        //
+        void HandleSpecialMarks( TPtr& aBuf );
+
+        /**
+        * Open and read configuration source and parses a required section.
+        * If start tag is empty the parsing starts beging of the configuration
+        * file.
+        * If end tag is empty the parsing goes end of configuration file.
+        * This method will parse next section after the earlier section if
+        * aSeeked parameter is not given.
+        * If configuration file includes several sections with both start and
+        * end tags so aSeeked parameter seeks the required section. The aSeeked
+        * parameters indicates section that will be parsed.
+        */
+		CStifSectionParser *NextSectionMemoryL( const TDesC& aStartTag,
+                                              	const TDesC& aEndTag,
+                                                TInt aSeeked ,TBool aIsHasEndTag=ETrue);
+
+        /**
+        * Open and read configuration source and parses a required section.
+        * If start tag is empty the parsing starts beging of the configuration
+        * file.
+        * If end tag is empty the parsing goes end of configuration file.
+        * This method will parse next section after the earlier section if
+        * aSeeked parameter is not given.
+        * If configuration file includes several sections with both start and
+        * end tags so aSeeked parameter seeks the required section. The aSeeked
+        * parameters indicates section that will be parsed.
+        */
+		CStifSectionParser *NextSectionFileL( const TDesC& aStartTag,
+                                              const TDesC& aEndTag,
+                                              TInt aSeeked ,TBool aIsHasEndTag=ETrue);
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        /**
+        * For file opening.
+        */
+        RFs         iFileServer;
+
+        /**
+        * For file opening.
+        */
+        RFile       iFile;
+
+        /**
+        * Indicates position where we are currently.
+        */
+        TInt        iOffset;
+
+        /**
+        * Comment type's indication.
+        */
+        TCommentType iCommentType;
+
+        /**
+        * Indication which mode of parsing are in use.
+        */
+        TParsingMode iParsingMode;
+
+        /**
+        * For buffer parsing.
+        */
+        HBufC*       iBufferTmp;
+        TPtr         iBuffer;
+
+        /**
+        * Flag indicating if file is unicode.
+        */
+        TBool        iIsUnicode;
+
+        /**
+        * Pointer to file parser.
+        */
+		CStifFileParser* iFileParser;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // STIF_PARSER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifSectionParser.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,286 @@
+/*
+* 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: This file contains the header file of the 
+* CStifSectionParser.
+*
+*/
+
+#ifndef STIF_SECTION_PARSER_H
+#define STIF_SECTION_PARSER_H
+
+// INCLUDES
+#include <f32file.h>
+#include <e32std.h>
+#include <e32base.h>
+#include "StifItemParser.h"
+
+// CONSTANTS
+// Indicates is tag included in returned value.
+enum TTagToReturnValue
+    {
+    ETag,   // Return value includes the tag
+    ENoTag  // Return value include no tag
+    };
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CStifItemParser;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CStifSectionParser is a STIF Test Framework StifParser class.
+// Class contains a configuration file parsing operations.
+
+class CStifSectionParser 
+        :public CBase
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CStifSectionParser* NewL( const TInt aLength );
+
+        /**
+        * Destructor.
+        */
+        ~CStifSectionParser();
+
+    public:     // New functions
+        
+        /**
+        * Parses a line for items parsing with a tag.
+        * Returns a CStifItemParser object.
+        * If start tag is empty the parsing starts beging of the section.
+        * TTagToReturnValue indicates will also the aTag value (if exist)
+        * include to the returned object(For default the tag will be added).
+        */
+        IMPORT_C CStifItemParser* GetItemLineL( const TDesC& aTag,
+                                TTagToReturnValue aTagIndicator = ETag );
+
+        /**
+        * Parses a next line for items parsing.
+        * Returns a CStifItemParser object.
+        */
+        IMPORT_C CStifItemParser* GetNextItemLineL();
+
+        /**
+        * Parses a next line for items parsing with a tag.
+        * Returns a CStifItemParser object.
+        * If start tag is empty the parsing starts beging of the section.
+        * TTagToReturnValue indicates will also the aTag value (if exist)
+        * include to the returned object(For default the tag will be added).
+        */
+        IMPORT_C CStifItemParser* GetNextItemLineL( const TDesC& aTag,
+                                TTagToReturnValue aTagIndicator = ETag );
+
+        /**
+        * Parses a sub sections from the main section with a start and with
+        * a end tag.
+        * Returns a CStifSectionParser object.
+        * If start tag is empty the parsing starts beging of the section.
+        * If end tag is empty the parsing goes end of section.
+        * This method will parse next subsection after the earlier subsection
+        * if aSeeked parameter is not given.
+        * If configuration file includes several subsections with both start
+        * and end tags so aSeeked parameter seeks the required subsection. The
+        * aSeeked parameters indicates subsection that will be parsed.
+        */
+        IMPORT_C CStifSectionParser* SubSectionL( const TDesC& aStartTag,
+                                                    const TDesC& aEndTag,
+                                                    TInt aSeeked = 1 );
+
+        /**
+        * Parses a next subsections from the main section with a start and with
+        * a end tag.
+        * Returns a CStifSectionParser object.
+        * If start tag is empty the parsing starts beging of the section.
+        * If end tag is empty the parsing goes end of section.
+        * This method will parse next subsection after the earlier subsection
+        * if aSeeked parameter is not given.
+        * If configuration file includes several subsections with both start
+        * and end tags so aSeeked parameter seeks the required subsection. The
+        * aSeeked parameters indicates subsection that will be parsed.
+        */        
+        IMPORT_C CStifSectionParser* NextSubSectionL( const TDesC& aStartTag,
+                                                const TDesC& aEndTag,
+                                                TInt aSeeked = 1 );
+
+        /**
+        * Get a line from section with a tag.
+        * Returns an error code and a reference to the parsed line.
+        * If start tag is empty the parsing starts beging of the section.
+        * TTagToReturnValue indicates will also the aTag value(if exist)
+        * include to the aLine reference(For default the tag will be added).
+        */
+        IMPORT_C TInt GetLine( const TDesC& aTag, TPtrC& aLine, 
+                                TTagToReturnValue aTagIndicator = ETag );
+
+        /**
+        * Get next line.
+        * Returns an error code and a reference to the parsed line.
+        */
+        IMPORT_C TInt GetNextLine( TPtrC& aLine );
+
+        /**
+        * Get next line with tag.
+        * Returns an error code and a reference to the parsed line.
+        * If start tag is empty the parsing starts beging of the section.
+        * TTagToReturnValue indicates will also the aTag value(if exist)
+        * include to the aLine reference(For default the tag will be added).
+        */
+        IMPORT_C TInt GetNextLine( const TDesC& aTag, TPtrC& aLine,
+                                TTagToReturnValue aTagIndicator = ETag );
+
+        /**
+        * Get current position.
+        * Returns current parsing position, which
+        * can be used as parameter for SetPosition afterwards to go back
+        * to old parsing position.
+        */
+        IMPORT_C TInt GetPosition();
+        
+        /**
+        * Set position.
+        * Returns a Symbian OS error code. aPos indicates the position to 
+        * which section parser should go.  
+        * SetPosition can be used to set parsing position, e.g. to rewind 
+        * back to some old position retrieved with GetPosition.
+        */
+        IMPORT_C TInt SetPosition( TInt aPos );        
+        
+        /**
+        * Create a section.
+        */
+        void SetData( TPtr aData,
+                        TInt aStartPos, 
+                        TInt aLength );
+
+        /**
+        * Returns a current section.
+        */
+        const TPtrC Des();
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CStifSectionParser( const TInt aLength );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Generic start and end position parser for given data.
+        * Returns an error code.
+        */
+        TInt ParseStartAndEndPos(   TPtrC aSection,
+                                    const TDesC& aStartTag,
+                                    TTagToReturnValue aTagIndicator,
+                                    TInt& aStartPos,
+                                    TInt& aEndPos,
+                                    TInt& aLength );
+                                    
+        /**
+        * Generic search for end-of-line.
+        * Returns position before linefeed and 
+        * lex is posotioned to the beginning of next line.
+        */
+        TInt GotoEndOfLine( TLex& lex );                            
+
+        /**
+        * Substracts line from the begining of selected text.
+        */
+        TPtrC SubstractLine( const TPtrC& aText );
+		
+		/**
+		* Searches for selected tag in a text.
+		*/		
+        TInt FindTag( const TDesC& aText, const TDesC& aTag, TInt& aStartPos, TInt& aEndPos );
+        
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        /**
+        * Parsed section with SectionL() or SubSectionL() method.
+        */
+        TPtr                iSection;
+
+        /**
+        * Section length definitions.
+        */
+        HBufC*              iHBufferSection;
+
+        /**
+        * Section length
+        */
+        TInt                iLength;
+
+        /**
+        * Indicates position where start the parsing.
+        */
+        TInt                iSkipAndMarkPos;
+
+        /**
+        * For line and item line parsing. Indicator is GetLine() or
+        * GetItemLineL() method used.
+        */
+        TBool               iLineIndicator;
+
+        /**
+        * Indicates position where we are currently(subsection).
+        */
+        TInt                iSubOffset;
+
+    public:     // Friend classes
+
+        /**
+        * For testing operations to get length information.
+        */
+        friend class CTestParser;
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // STIF_SECTION_PARSER_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifTFwIf.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,279 @@
+/*
+* 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: This file contains the header file of the CStifTFwIf.
+*
+*/
+
+#ifndef STIF_TFW_IF_H
+#define STIF_TFW_IF_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifTestModule.h>
+#include <StifTestInterface.h>
+
+
+// CONSTANTS
+// None
+
+// MACROS
+// Hardcoded deviceid used if DevId function is not overridden
+const TUint16 KDefaultDevId = 0x0001;
+
+// DATA TYPES
+    
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CStifTFw;
+
+// CLASS DECLARATION
+// Information of test case
+class CTestInfo
+    :public CBase
+    {
+    public:
+        IMPORT_C static CTestInfo* NewL();
+        ~CTestInfo();
+        
+    public:
+        const TDesC& ModuleName () const { return iModuleName; };
+        TInt SetModuleName ( const TDesC& aModuleName );
+        const TDesC& TestCaseTitle() const { return iTitle; };
+        TInt SetTestCaseTitle ( const TDesC& aTitle );
+        const TDesC& TestCaseFile() const { return iTestCaseFile; };
+        TInt SetTestCaseFile ( const TDesC& aTestCaseFile );
+        TInt TestCaseNum() const { return iCaseNumber; };
+        void SetTestCaseNumber ( TInt aTestCaseNumber )
+                                { iCaseNumber = aTestCaseNumber; };
+        TInt Priority() const { return iPriority; };
+        void SetPriority ( TInt aPriority )
+                                { iPriority = aPriority; };
+        TTimeIntervalMicroSeconds Timeout() const { return iTimeout; };
+        void SetTimeout ( const TTimeIntervalMicroSeconds& aTimeout )
+                                { iTimeout = aTimeout; };
+        TInt ExpectedResult() const { return iExpectedResult; };
+        void CopyL( const CTestInfo& aTestInfo );
+        TBool operator==(const CTestInfo& aTestInfo) const;
+                                    
+    private:
+        CTestInfo();
+        void ConstructL();
+        CTestInfo( const CTestInfo& /*aTestInfo*/ ){};
+        CTestInfo& operator= ( const CTestInfo& );
+        
+    private:
+        TInt iCaseNumber;
+        TInt iExpectedResult;
+        TTimeIntervalMicroSeconds iTimeout;
+        TInt iPriority; 
+        TPtrC iModuleName;
+        HBufC* iModuleNameBuf;
+        TPtrC iTitle;
+        HBufC* iTitleBuf;
+        TPtrC iTestCaseFile;
+        HBufC* iTestCaseFileBuf;
+    
+    };
+    
+// CLASS DECLARATION
+
+// CStifTFwIf is the main class of STIF Test Framework Interface
+class CStifTFwIf 
+    :public CBase 
+    {
+    public: // Enumerations
+
+    protected: // Enumerations
+        
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Destructor.
+        */
+        virtual IMPORT_C ~CStifTFwIf();
+
+    protected: // Functions that can be called from derived class
+
+        /**
+        * Used to open TestFramework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt Open( TDesC& aTestFrameworkIni = (TDesC&) KNullDesC() );
+
+        /**
+        * Used to close TestFramework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt Close();
+
+        /**
+        * Used to set attributes for test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt SetAttribute( TAttribute aAttribute,
+                                    const TDesC& aValue );
+
+        /**
+        * Receive message from ATS.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt AtsReceive( const TDesC& aMessage );
+
+        /**
+        * Used to add test module to test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt AddTestModule( TDesC& aModuleName, 
+                            TDesC& aIniFile = (TDesC&) KNullDesC() );
+
+        /**
+        * Used to remove test module to test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt RemoveTestModule( TDesC& aModuleName );
+
+        /**
+        * Used to add test case file for test module.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt AddTestCaseFile( TDesC& aModuleName,
+                              TDesC& aCaseFile );
+
+        /**
+        * Used to remove test case file from test module.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt RemoveTestCaseFile( TDesC& aModuleName,
+                                 TDesC& aCaseFile );
+
+        /**
+        * Get testcases from test modules. Returns test case information 
+        * in aTestinfo.
+        * Test module name and test case file can be used to limit the 
+        * set of test cases returned.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt GetTestCases( RPointerArray<CTestInfo>& aTestInfo,
+                           TDesC& aTestModule = (TDesC&) KNullDesC(),
+                           TDesC& aTestCaseFile = (TDesC&) KNullDesC() );
+
+        /**
+        * Start selected test case identified with CTestInfo.
+        * Return TestId, which is handle used in subsequent 
+        * test case execution control.
+        *
+        * Returns Symbian OS error code.
+        */
+
+        IMPORT_C TInt StartTestCase( TInt& aTestId,
+                            const CTestInfo& aTestInfo );
+
+        /**
+        * Cancel test case execution. TestCompleted() will be called 
+        * with aTestExecutionResult set to KErrCancel.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt CancelTestCase( TInt aTestId );
+
+        /**
+        * Pause test case execution.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt PauseTestCase( TInt aTestId );
+
+        /**
+        * Resume test case execution.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt ResumeTestCase( TInt aTestId );
+
+        /**
+        * C++ default constructor.
+        */
+        IMPORT_C CStifTFwIf();
+
+    protected: // Functions that the derived class may implement.
+
+        /**
+        * Function is called when test execution is finished 
+        * with information of test case, result of test case execution 
+        * and test case result.
+        */
+        virtual void TestCompleted( TInt aTestId,
+                                    TInt aTestExecutionResult,
+                                    TTestResult& aTestResult )=0;
+
+        /**
+        * Function is called when test case prints.
+        */
+        virtual void Print( TInt /*aTestId*/,
+                            TTestProgress& /*iProgress*/ ){};
+
+        /**
+        * Send message to ATS.
+        */                            
+        virtual void AtsSend( const TDesC& /*aMessage*/ ){};
+     
+        /**
+        * Get device identifier, should be overridden to make them 
+        * unique among slaves. 
+        * Returns default value for every slave otherwise.
+        */
+        virtual TUint16 DevId(){ return KDefaultDevId; };      
+        
+        /**
+        * Reboot indication. 
+        * After this function returns, reboot is done
+        * by test module or STIF TF.
+        */                            
+        virtual void GoingToDoReset(){};  
+        
+    private:
+
+    public: // Data
+    
+    protected: // Data
+        
+    private: // Data
+        
+        CStifTFw*   iStifTFw;
+
+    public: // Friend classes
+        
+    protected: // Friend classes
+
+    private: // Friend classes
+        friend class CStifTFw;
+    };
+
+#endif      // STIF_TFW_IF_H 
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifTFwIfProt.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,423 @@
+/*
+* 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: This file contains the header file of the 
+* CStifTFwIfProt.
+*
+*/
+
+#ifndef STIF_TFW_IF_PROT_H 
+#define STIF_TFW_IF_PROT_H 
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifTestEventInterface.h>
+#include <StifParser.h>
+
+// CONSTANTS
+// Protocol identifier length
+const TInt KProtocolIdLength=8;
+// Default allocation size for message created with CreateL
+const TInt KDefaultMsgSize=0x200;
+// Maximum length for value added to type-value parameter
+const TInt KMaxValueLength=12;
+
+// MACROS
+// Macros for identifier manipulation
+#define DEVID(x) ((TUint16)( ( 0xffff0000 & ((TUint32)(x)) ) >> 16 ))
+#define TESTID(x) ((TUint16)( 0x0000ffff & ((TUint32)(x)) ))
+#define SETID(d,t) ((TUint32)(( ( 0x0000ffff & ((TUint32)(d)) ) << 16 )|( 0x0000ffff & ((TUint32)(t)) )))
+#define GETDEVID(x) ((TUint32)( 0xffff0000 & ((TUint32)(x)) ))
+
+// DATA TYPES
+typedef TPtrC (*KeywordFunc)( TInt aKeyword );
+// typedef TBuf<KDefaultMessageSize> TRemoteProtMsg;
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+
+// CStifTFwIfProt is the control protocol interface
+class CStifTFwIfProt
+        :public CBase
+    {
+    public: // Enumerations
+
+        // Message type
+        enum TMsgType
+            {
+            EMsgReserve,
+            EMsgRelease,
+            EMsgRemote,
+            EMsgResponse,
+            };
+            
+        // Command types
+        enum TCmdType
+            {
+            ECmdRun,
+            ECmdPause,
+            ECmdResume,
+            ECmdCancel,
+            ECmdRequest,
+            ECmdRelease,
+            ECmdSendReceive,
+            ECmdSetEvent,
+            ECmdUnsetEvent,
+            
+            ECmdUnknown,
+            };
+            
+        // Remote device type
+        enum TRemoteType
+            {
+            ERemotePhone,
+            //ERemoteCallBox, ...
+            
+            ERemoteUnknown,
+            };
+            
+        // Run parameters
+        enum TRunParams
+            {
+            ERunModule,
+            ERunInifile,
+            ERunTestcasefile,
+            ERunTestcasenum,                        
+            ERunTitle,
+            };
+            
+        // Response parameters
+        enum TRespParam
+            {
+            ERespResult,
+            };
+     
+        // Run status
+        enum TRunStatus
+            {
+            ERunStarted,
+            ERunError,
+            ERunReady,
+            };
+            
+        // Run status parameters
+        enum TRunStatusParams
+            {
+            ERunResult,
+            ERunCategory,
+            };
+            
+        // Execution result category
+        enum TResultCategory
+            {
+            EResultNormal = 0,
+            EResultPanic,
+            EResultException,
+            EResultTimeout,
+            EResultLeave,
+            };
+            
+        // Event status
+        enum TEventStatus
+            {
+            EEventActive,
+            EEventSet,
+            EEventError,
+            EEventUnset,
+            }; 
+            
+        // Event status
+        enum TEventStatusParams
+            {
+            EEventResult,
+            EEventType,
+            };           
+                                    
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+       
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CStifTFwIfProt* NewL();
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CStifTFwIfProt();
+
+    public: // New functions
+    
+        /*
+        * Get message handle
+        */ 
+        virtual const TDesC& Message(){ return iMessage; };
+        
+        /**
+        * Set message.
+        */
+        IMPORT_C TInt SetL( const TDesC& aMessage );
+
+        /**
+        * Create message.
+        */
+        IMPORT_C void CreateL( TInt aLength = KDefaultMsgSize );
+        
+        /**
+        * Append string to message.
+        */
+        IMPORT_C TInt Append( const TDesC& aStr );
+        
+        /**
+        * Append hexadecimal protocol identifier to message.
+        */
+        IMPORT_C TInt AppendId( TUint32 aId );
+
+        /**
+        * Append keyword string to message.
+        */
+        IMPORT_C TInt Append( KeywordFunc aFunc, TInt aKeyword );
+
+        /**
+        * Append keyword type-value string to message.
+        */
+        IMPORT_C TInt Append( KeywordFunc aFunc, TInt aKeyword, TInt aValue );
+        
+        /**
+        * Append keyword type-value string to message.
+        */
+        IMPORT_C TInt Append( KeywordFunc aFunc, 
+                              TInt aKeyword, 
+                              const TDesC& aStr );
+        
+        /**
+        * Append keyword type-value string to message.
+        */
+        IMPORT_C TInt Append( KeywordFunc aFunc, 
+                              TInt aKeyword, 
+                              KeywordFunc aValueFunc, 
+                              TInt aValue );
+        
+        /**
+        * Get protocol source identifier.
+        */
+        IMPORT_C TUint32 SrcId();
+
+        /**
+        * Get protocol source device identifier.
+        */
+        IMPORT_C TUint16 SrcDevId();
+
+        /**
+        * Get protocol source test identifier.
+        */
+        IMPORT_C TUint16 SrcTestId();
+
+        /**
+        * Get protocol destination identifier.
+        */
+        IMPORT_C TUint32 DstId();
+        
+        /**
+        * Get protocol destination device identifier.
+        */
+        IMPORT_C TUint16 DstDevId();
+        
+        /**
+        * Get protocol destination test identifier.
+        */
+        IMPORT_C TUint16 DstTestId();
+        
+        /**
+        * Set protocol source identifier.
+        */
+        IMPORT_C TInt SetSrcId( TUint32 aSrcId );
+            
+        /**
+        * Set protocol destination identifier.
+        */
+        IMPORT_C TInt SetDstId( TUint32 aDstId );
+
+        /**
+        * Set message type.
+        */
+        IMPORT_C TInt SetMsgType( TMsgType aMsgType );
+        
+        /**
+        * Set response type.
+        */
+        IMPORT_C TInt SetRespType( TMsgType aRespType );
+
+        /**
+        * Set message type.
+        */
+        IMPORT_C TInt SetCmdType( TCmdType aCmdType );
+
+        /*
+        * String containers.
+        */
+        IMPORT_C static TPtrC MsgType( TInt aKeyword );
+        
+        IMPORT_C static TPtrC CmdType( TInt aKeyword );
+        
+        IMPORT_C static TPtrC RemoteType( TInt aKeyword );
+
+        IMPORT_C static TPtrC RunParams( TInt aKeyword );
+
+        IMPORT_C static TPtrC RunStatus( TInt aKeyword );
+
+        IMPORT_C static TPtrC RunStatusParams( TInt aKeyword );
+
+        IMPORT_C static TPtrC ResultCategory( TInt aKeyword );
+
+        IMPORT_C static TPtrC EventStatus( TInt aKeyword );
+
+        IMPORT_C static TPtrC EventStatusParams( TInt aKeyword );
+
+        IMPORT_C static TPtrC EventType( TInt aKeyword );
+        
+        IMPORT_C static TPtrC RespParam( TInt aKeyword );
+        
+    public: // Functions from base classes
+
+        /**
+        * From <base_class member_description.
+        */
+        //<type member_function( type arg1 );>
+        
+    protected:  // New functions
+        
+        /**
+        * <member_description.>
+        */
+        //<type member_function( type arg1 );>
+
+    protected:  // Functions from base classes
+        
+        /**
+        * From <base_class member_description>
+        */
+        //<type member_function();>
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CStifTFwIfProt();
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Parsing functions.
+        */
+        TInt ParseMessageL();
+        
+        void ParseHeaderL();
+        
+        void ParseReserveL();
+        
+        void ParseRemoteL();
+
+        void ParseResponseL();     
+        
+        void ParseCmdResponseL();   
+
+        static TInt Parse( TDesC& aKeyword, KeywordFunc aFunc );
+        
+        static TInt ParseOptArg( const TDesC& aOptArg, TPtrC& aArg, TPtrC& aVal );
+        
+	public:   //Data
+	    // Message type
+        TMsgType            iMsgType;
+        // Remote type
+        TRemoteType         iRemoteType;
+        // Response request type
+        TMsgType            iRespType;
+        // Remote command type (valid only if TMsgType is EMsgRemote)
+        TCmdType            iCmdType;
+        TPtrC               iCmdDes;
+        
+        // Run parameters (valid only if run command)
+        // Test module name
+        TPtrC               iModule;
+        // Test module initialization file
+        TPtrC               iIniFile;
+        // Test module initialization file
+        TPtrC               iTestCaseFile;
+        // Test case number
+        TInt                iTestCaseNumber;
+        // Test case title
+        TPtrC               iTitle;
+        
+        // Event parameters
+        // Event name
+        TPtrC               iEventName;
+      
+        // Result from request or command
+        TInt            iResult;
+
+        // Response status 
+        union 
+            {
+            TRunStatus      iRunStatus;
+            TEventStatus    iEventStatus;
+            };
+        // Result category
+        TResultCategory     iResultCategory;
+        // Event response parameters
+        // Event type
+        TEventIf::TEventType    iEventType;
+    
+	protected:  // Data
+        //<data_declaration;>
+
+    private:    // Data
+        // Message buffer
+        HBufC*              iMessageBuf;
+        // Message ptr
+        TPtr                iMessage;     
+        
+        // Message parser
+        CStifItemParser*    iItem;
+        
+        // SrcId
+        TInt32              iSrcId;
+        // DstId
+        TInt32              iDstId;
+        
+    public:     // Friend classes
+        //<friend_class_declaration;>
+
+    protected:  // Friend classes
+        //<friend_class_declaration;>
+
+    private:    // Friend classes
+        //<friend_class_declaration;>
+        
+    };
+
+#endif      // STIF_TFW_IF_PROT_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifTestEventInterface.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,184 @@
+/*
+* 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: This file contains the header file of the event 
+* interface.
+*
+*/
+
+#ifndef TESTEVENTINTERFACE_H
+#define TESTEVENTINTERFACE_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Interface class for the event system.
+class TEventIf
+    {
+    public: // Enumerations
+        /**
+        * Event request types.
+        */
+        enum TReqType
+            {
+            // The following can be used by the test module
+            EReqEvent = 1,
+            EWaitEvent,
+            ERelEvent,
+            ESetEvent,
+            EUnsetEvent,
+            
+            // The rest are special
+            // Not used by the test module
+            EEnable,
+            ESetWaitPending,
+            ECmdError,
+            ECancelWait,
+            };
+        
+        /**
+        * Event types.
+        */
+        enum TEventType
+            {
+            EIndication,
+            EState,
+            };
+            
+    private: // Enumerations
+        
+    public:  // Constructors and destructor
+
+        /**
+        * C++ constructor with params.
+        */
+        TEventIf( TReqType aType = EEnable, 
+                  const TName& aName = KNullDesC(), 
+                  TEventType aEventType = EIndication ) 
+            { iType = aType; iName = aName; iEventType = aEventType; }
+
+    public: // New functions
+        
+        /**
+        * Get request type.
+        */        
+        inline TReqType Type() const { return iType; }
+         
+        /**
+        * Get event name.
+        */        
+        inline const TName& Name() const { return iName; } 
+        
+        /**
+        * Get event type.
+        */        
+        inline TEventType EventType() const { return iEventType; } 
+        
+        /**
+        * Set request type.
+        */        
+        inline void SetType( TReqType aType ){ iType = aType; } 
+        
+        /**
+        * Set event name.
+        */        
+        inline void SetName( const TName& aName ){ iName = aName; }
+        
+        /**
+        * Set event to state event.
+        */        
+        inline void SetEventType( TEventType aEventType )
+            { iEventType = aEventType; }
+        
+        /**
+        * Set request type and event name.
+        */        
+        inline void Set( TReqType aType, const TName& aName )
+            { iType = aType; iName = aName; } 
+        
+        /**
+        * Set request type, event name and event type.
+        */        
+        inline void Set( TReqType aType, 
+                         const TName& aName, 
+                         TEventType aEventType )
+            { iType = aType; iName = aName; iEventType = aEventType; } 
+        
+        /**
+        * Copy data from existing TEventIf (or derived class).
+        */
+        inline void Copy( const TEventIf& aEvent) 
+            { iType = aEvent.iType; 
+            iName = aEvent.iName; 
+            iEventType = aEvent.iEventType; } 
+          
+    public: // Functions from base classes
+        
+    protected:  // New functions
+        
+    protected:  // Functions from base classes
+        
+    private:
+        
+    public:   //Data
+        
+    protected:  // Data
+        /**
+        * Request type.
+        */
+        TReqType iType; 
+        
+        /**
+        * Event name (must be unique).
+        */
+        TName iName;     
+        
+        /**
+        * Event type.
+        */
+        TEventType iEventType;
+        
+    private:    // Data
+        
+    public:     // Friend classes
+        
+    protected:  // Friend classes
+        
+    private:    // Friend classes
+        
+    };
+    
+// Packaged TEventIf
+typedef TPckg<TEventIf> TEventIfPckg;
+ 
+#endif      // TESTEVENTINTERFACE_H
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifTestInterface.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,355 @@
+/*
+* 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: This file contains the header file of the 
+* TestInterface.
+*
+*/
+
+#ifndef TEST_INTERFACE_H
+#define TEST_INTERFACE_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifTestModule.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+
+// This defines drive letters that is available in STIF TF.
+//@spe IMPORT_C const TChar StifDriveLetters( TInt aDriveNumber, TInt& aCount );
+
+// This works and used only in EKA2 environment and used from STIF
+// TestFramework internally.
+// Executable module uses defined capabilities(PlatSec's Capability model)
+// to start session. Function for starting the TestServer and
+// Testmodule/TestClass.
+IMPORT_C TInt StartSession();
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+const TInt KMaxStifInfoName = 0x10; 
+typedef TBuf<KMaxStifInfoName> TStifInfoName;
+
+// DESCRIPTION
+// TTestInfo defines the information for test case and Test Module.
+class TTestInfo 
+    {
+    public:
+        IMPORT_C TTestInfo();
+    public:
+        // The name of Test Module.
+        TName iModuleName;
+        // Test case info for test case execution.
+        TTestCaseInfo iTestCaseInfo;
+        // Config file to be used.
+        TFileName iConfig;
+    };
+    
+// Packaged TTestInfo
+typedef TPckg<TTestInfo> TTestInfoPckg;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TFullTestResult defines the full test case result information.
+class TFullTestResult
+    {
+    public:
+        IMPORT_C TFullTestResult();
+
+        enum TCaseExecutionResult
+        {
+            ECaseOngoing,
+            ECaseExecuted,
+            ECaseCancelled,
+            ECaseErrorFromModule,
+            ECaseLeave,
+            ECasePanic,
+            ECaseException,
+            ECaseTimeout,
+            ECaseSuicided,
+        };
+
+    public:
+        // Test case result.
+        TTestResult iTestResult;
+        // Timestamp when test case was started.
+        TTime iStartTime;
+        // Timestamp when test case was ended.
+        TTime iEndTime;
+        
+        // Test result type
+        TCaseExecutionResult iCaseExecutionResultType;      
+        // Test result code
+        TInt iCaseExecutionResultCode;
+    };
+
+// Packaged TFullTestResult
+typedef TPckg<TFullTestResult> TFullTestResultPckg;
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TTestProgress defines the progress information from Test Module.
+class TTestProgress 
+    {
+    public:
+        IMPORT_C TTestProgress();
+    public:
+        // "Priority" of the progress information.
+        TInt iPosition;
+        // Description of the data to be printed.
+        TStifInfoName iDescription;
+        // The actual progress information.
+        TName iText;
+    };
+
+// Packaged TTestProgress
+typedef TPckg<TTestProgress> TTestProgressPckg;
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TErrorNotification defines the error notifications
+class TErrorNotification 
+    {
+    public:
+        IMPORT_C TErrorNotification();
+    public:
+        // Error priority
+        TInt iPriority;
+        // Module reporting error
+        TStifInfoName iModule;
+        // The actual error information.
+        TName iText;
+    };
+
+// Attributes that can be changed with SetAttribute
+enum TAttribute
+    {
+    ELogPath,           // Log file path
+    ERebootPath,        // Reboot path definition
+    ERebootFilename,    // Reboot filename definition
+    EStifMeasurementOn,  // STIF's Measurement enable
+    EStifMeasurementOff // STIF's Measurement disable
+    };
+    
+// Packaged TErrorNotification
+typedef TPckg<TErrorNotification> TErrorNotificationPckg;
+
+// Different STIF internal commands.
+enum TStifCommand
+    {
+    EStifCmdReceive,
+    EStifCmdSend,
+    EStifCmdReboot,
+    EStifCmdStoreState,
+    EStifCmdGetStoredState,
+    EStifCmdRebootProceed,
+    EStifCmdReceiveCancel,
+    EStifCmdMeasurement,
+    };
+typedef TPckg<TStifCommand> TStifCommandPckg;
+
+// Class for Reboot parameter
+class TRebootParams
+    {
+    public:
+        CTestModuleIf::TRebootType aType;
+    };
+
+// Class for Reboot state parameters
+class TRebootStateParams
+    {
+    public:
+        TInt aCode;
+        TName aName;
+    };
+
+// Class for Reboot stored parameters
+class TGetRebootStoredParams
+    {
+    public:
+        TInt aCode;
+        TName aName;
+    };
+
+// Class for Reboot stored parameters(references)
+class TGetRebootStoredParamsRef
+    {
+    public:
+        TGetRebootStoredParamsRef( 
+            TInt& aCode, TName& aName ):iCode(aCode),iName(aName){};
+    public:
+        TInt& iCode;
+        TName& iName;
+    };
+
+// Class for measurement stored parameters
+class TGetMeasurementOptions
+    {
+    public:
+        TInt iOptions;
+    };
+
+// Class for measurement stored parameters(options)
+class TGetMeasurementOptionsRef
+    {
+    public:
+        TGetMeasurementOptionsRef( TInt& aOptions ): iOptions(aOptions){};
+    public:
+        TInt& iOptions;
+    };
+
+// This class offer generic attribute for passing client-server interface
+union TParams
+    {
+    TDes*                       aRemoteMsgRef;
+    const TDesC*                aRemoteMsgConstRef;
+    TRebootParams*              aRebootType;
+    TRebootStateParams*         aRebootState;
+    TGetRebootStoredParamsRef*  aRebootStoredRef;
+    TGetMeasurementOptionsRef*  aMeasurementOption;
+    };
+
+// Packaged TRebootParams
+typedef TPckg<TRebootParams> TRebootParamsPckg;
+
+// Packaged TRebootStateParams
+typedef TPckg<TRebootStateParams> TRebootStateParamsPckg;
+
+// Packaged TGetRebootStoredParams
+typedef TPckg<TGetRebootStoredParams> TGetRebootStoredParamsPckg;
+
+// Packaged TGetMeasurementParams
+typedef TPckg<TGetMeasurementOptions> TGetMeasurementOptionsPckg;
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Base class for test measurement modules. Measurement modules implements
+// measurerement operations.
+NONSHARABLE_CLASS( CSTIFTestMeasurementImplementation ) : public CBase
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+
+    public: // New functions
+
+        /**
+        * Pure virtual measurement start command.
+        * Start method's implementation is in measurement module.
+        */
+        virtual TInt Start( ) = 0;
+
+        /**
+        * Pure virtual measurement stop command.
+        * Stop method's implementation is in measurement module.
+        */
+        virtual TInt Stop( ) = 0;
+
+       /**
+        * Pure virtual measurement stop command.
+        * Stop method's implementation is in measurement module.
+        */
+        virtual CSTIFTestMeasurement::TSTIFMeasurementType MeasurementType() = 0;
+
+
+    public: // Functions from base classes
+
+    protected: // New functions
+
+    protected: // Functions from base classes
+
+    private:
+
+    public: //Data
+
+    protected: // Data
+
+    private: // Data
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+
+    };
+
+// STIF utility class
+class TStifUtil
+	{
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+
+    public: // New functions    
+		/**
+		 * Checks if file path contains drive letter. If not file is serched
+		 * on all drives and first hit is added to file name.
+		 */
+    	IMPORT_C static void CorrectFilePathL( TDes& aFilePath );
+    	
+    	/**
+    	 * Method used by both STIF and STIF UI to retrieve version of STIF  
+    	 */
+    	IMPORT_C static void STIFVersion(TInt& aMajorV, TInt& aMinorV, TInt& aBuildV, TDes& aRelDate);
+    
+    public: // Functions from base classes
+
+    protected: // New functions
+
+    protected: // Functions from base classes
+
+    private:
+
+    public: //Data
+
+    protected: // Data
+
+    private: // Data
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+	
+	};
+    
+    
+#endif // TEST_INTERFACE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifTestInterference.h	Fri Apr 09 10:46:28 2010 +0800
@@ -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: This file contains the header file of the STIF test
+* interference module.
+*
+*/
+
+#ifndef STIFTESTINTERFERENCE_H
+#define STIFTESTINTERFERENCE_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include <e32std.h>
+#include <e32base.h>
+#include <e32svr.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// CLASS DECLARATION
+
+/**
+*  This a MSTIFTestInterference class.
+*  MSTIFTestInterference is an interface class. Purpose is to 
+*  avoid multi heritance in subclasses.
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS( MSTIFTestInterference )
+    {
+    public:     // Enumerations 
+
+    // Way of using test interference
+    enum TStifTestInterferenceCategory
+        {
+        EActiveObject,      // Test interference using active object
+        EThread,            // Test interference using thread
+        };
+
+    // Type of the test interference
+    enum TStifTestInterferenceType
+        {
+        ENone,                    // No test interference
+        ECpuLoad,                 // with CPU load
+        EFileSystemReadC,         // with file system load, read from C-drive
+        EFileSystemReadD,         // with file system load, read from D-drive
+        EFileSystemReadE,         // with file system load, read from E-drive
+        EFileSystemReadZ,         // with file system load, read from Z-drive
+        EFileSystemWriteC,        // with file system load, write from C-drive
+        EFileSystemWriteD,        // with file system load, write from D-drive
+        EFileSystemWriteE,        // with file system load, write from E-drive
+        EFileSystemFillAndEmptyC, // with file system load, fill and empty from
+                                  // C-drive
+        EFileSystemFillAndEmptyD, // with file system load, fill and empty from
+                                  // D-drive
+        EFileSystemFillAndEmptyE, // with file system load, fill and empty from
+                                  // E-drive
+
+        ENoneMicroSeconds,                    // No test interference
+        ECpuLoadMicroSeconds,                 // with CPU load
+        EFileSystemReadCMicroSeconds,         // with file system load, read from C-drive
+        EFileSystemReadDMicroSeconds,         // with file system load, read from D-drive
+        EFileSystemReadEMicroSeconds,         // with file system load, read from E-drive
+        EFileSystemReadZMicroSeconds,         // with file system load, read from Z-drive
+        EFileSystemWriteCMicroSeconds,        // with file system load, write from C-drive
+        EFileSystemWriteDMicroSeconds,        // with file system load, write from D-drive
+        EFileSystemWriteEMicroSeconds,        // with file system load, write from E-drive
+        EFileSystemFillAndEmptyCMicroSeconds, // with file system load, fill and empty from
+                                  			  // C-drive
+        EFileSystemFillAndEmptyDMicroSeconds, // with file system load, fill and empty from
+                                  			  // D-drive
+        EFileSystemFillAndEmptyEMicroSeconds  // with file system load, fill and empty from
+                                  			  // E-drive
+        };
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param: aTestModuleBase: CTestModuleBase object for get test
+                  interference handle to STIF's side(Used if test case panic so
+                  test interference thread can be kill by STIF). 
+        * @param: aCategory: Test interference category
+        * @return: MSTIFTestInterference object
+        */
+        IMPORT_C static MSTIFTestInterference* NewL( 
+                                CTestModuleBase* aTestModuleBase,
+                                TStifTestInterferenceCategory aCategory );
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSTIFTestInterference();
+
+    public: // New functions
+
+        /**
+        * StartL method starts test interference.
+        * @param: aType: Test interference type. 
+        * @param: aIdleTime: Test interference idle time.
+        * @param: aActiveTime: Test interference active time.
+        * @return: Symbian error code.
+        */
+        virtual TInt StartL( TStifTestInterferenceType aType,
+                            TInt aIdleTime,
+                            TInt aActiveTime ) = 0;
+
+        /**
+        * Stop method stops test interference.
+        */
+        virtual TInt Stop() = 0;
+
+        /**
+        * Sets thread or active object priority. This should use before
+        * test interference is started otherwise error code will return.
+        *
+        * Thread priority can set during interference executions time. User
+        * should be sure that given value is acceptable, otherwise SetPriority
+        * panics.
+        *
+        * @param: aPriority: New priority for active object or thread
+        * @return: Symbian error code.
+        */
+        virtual TInt SetPriority( TInt aPriority ) = 0;
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // STIFTESTINTERFERENCE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifTestModule.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1256 @@
+/*
+* 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: This file contains the header file of the 
+* CTestModuleBase and CTestModuleIf classes. Test Module inherits 
+* the CTestModuleBase and uses the CTestModuleIf for printing 
+* to user interface and event system control.
+*
+* The initialization of this interface must be done from the Test Module Server with:
+*   CTestModuleXXX *mod = new CTestModuleXXX;
+*   RThread thread;
+*   CTestModuleIf::NewL( this, (CTestModuleBase*) mod, thread.Id() );
+* 
+* CTestModuleIf is deleted by destructor of the CTestModuleBase. 
+*
+*/
+
+#ifndef TESTMODULE_H
+#define TESTMODULE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "StifCommand.h"
+
+// CONSTANTS
+
+// Define Old Test Module API version - API that doesn't support version of test module
+const TInt KOldTestModuleAPIMajor = 1;
+const TInt KOldTestModuleAPIMinor = 1;
+const TInt KOldTestModuleAPIBuild = 0;
+
+// Define Test Module API version
+const TInt KTestModuleAPIMajor = 1;
+const TInt KTestModuleAPIMinor = 2;
+const TInt KTestModuleAPIBuild = 0;
+const TInt KStifMaxResultDes = 128; // Maximum test result description length
+
+// Max array value for STIF macros allow result.
+const TInt KSTIFMacroResultArraySize = 10;
+
+// Test module def-file check when setting parameters.
+const TUint32 KStifTestModuleParameterChanged = 0xdeadbeef;
+
+// MACROS
+// Test result description. Maximum length is 128 characters.
+typedef TBuf<KStifMaxResultDes> TResultDes;
+
+// Macro for boolean.
+#ifdef TL
+    #pragma message( "============================================================" )
+    #pragma message( " TL macro is already defined, now using STIF TF's TL macro" )
+    #pragma message( "============================================================" )
+#undef TL
+#endif
+// Macro for integer and one expected result.
+#ifdef T1L
+    #pragma message( "==============================================================" )
+    #pragma message( " T1L macro is already defined, now using STIF TF's T1L macro" )
+    #pragma message( "==============================================================" )
+#undef T1L
+#endif
+// Macro for integer and two expected result.
+#ifdef T2L
+    #pragma message( "==============================================================" )
+    #pragma message( " T2L macro is already defined, now using STIF TF's T2L macro" )
+    #pragma message( "==============================================================" )
+#undef T2L
+#endif
+// Macro for integer and three expected result.
+#ifdef T3L
+    #pragma message( "==============================================================" )
+    #pragma message( " T3L macro is already defined, now using STIF TF's T3L macro" )
+    #pragma message( "==============================================================" )
+#undef T3L
+#endif
+// Macro for integer and four expected result.
+#ifdef T4L
+    #pragma message( "==============================================================" )
+    #pragma message( " T4L macro is already defined, now using STIF TF's T4L macro" )
+    #pragma message( "==============================================================" )
+#undef T4L
+#endif
+// Macro for integer and five expected result.
+#ifdef T5L
+    #pragma message( "==============================================================" )
+    #pragma message( " T5L macro is already defined, now using STIF TF's T5L macro" )
+    #pragma message( "==============================================================" )
+#undef T5L
+#endif
+
+// Macro for boolean. Recommended use with TestScripter's test class.
+#ifdef TAL
+    #pragma message( "==============================================================" )
+    #pragma message( " TAL macro is already defined, now using STIF TF's TAL macro" )
+    #pragma message( "==============================================================" )
+#undef TAL
+#endif
+// Macro for integer and one expected result. Recommended use with TestScripter's test
+// class.
+#ifdef TA1L
+    #pragma message( "================================================================" )
+    #pragma message( " TA1L macro is already defined, now using STIF TF's TA1L macro" )
+    #pragma message( "================================================================" )
+#undef TA1L
+#endif
+// Macro for integer and two expected result. Recommended use with TestScripter's test
+// class.
+#ifdef TA2L
+    #pragma message( "================================================================" )
+    #pragma message( " TA2L macro is already defined, now using STIF TF's TA2L macro" )
+    #pragma message( "================================================================" )
+#undef TA2L
+#endif
+// Macro for integer and three expected result. Recommended use with TestScripter's test
+// class.
+#ifdef TA3L
+    #pragma message( "================================================================" )
+    #pragma message( " TA3L macro is already defined, now using STIF TF's TA3L macro" )
+    #pragma message( "================================================================" )
+#undef TA3L
+#endif
+// Macro for integer and four expected result. Recommended use with TestScripter's test
+// class.
+#ifdef TA4L
+    #pragma message( "================================================================" )
+    #pragma message( " TA4L macro is already defined, now using STIF TF's TA4L macro" )
+    #pragma message( "================================================================" )
+#undef TA4L
+#endif
+// Macro for integer and five expected result. Recommended use with TestScripter's test
+// class.
+#ifdef TA5L
+    #pragma message( "================================================================" )
+    #pragma message( " TA5L macro is already defined, now using STIF TF's TA5L macro" )
+    #pragma message( "================================================================" )
+#undef TA5L
+#endif
+
+
+//  TL ========================================================================
+//  Macro for verify boolean value.
+//  Example for use, 1: TL( Open() == KErrNone );
+//                   1: TL( VerifyString1() == VerifyString2() );
+//                   2: TL( 6 <= 8 );
+//  ===========================================================================
+    #define TL( aIsTrue )\
+        if( (!(aIsTrue)) )\
+        { TestModuleIf().StifMacroError( (0), (TText8*)__FILE__, __FUNCTION__, __LINE__ );\
+        User::Leave( KErrArgument ); };
+
+//  T1L =======================================================================
+//  Macro for verify integer value from the expected 1 value.
+//  Example: T1L( Open(), KErrNone );
+//  ===========================================================================
+    #define T1L( aResult, aExpected1 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) ) )\
+            { TestModuleIf().StifMacroError(\
+                (1), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+//  T2L =======================================================================
+//  Macro for verify integer value from the expected 1 and 2 values.
+//  Example for use: T1L( Open(), KErrNone, KErrAlreadyExists );
+//  ===========================================================================
+    #define T2L( aResult, aExpected1, aExpected2 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) && (result) != (aExpected2) ) )\
+            { TestModuleIf().StifMacroError(\
+                (2), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1), (aExpected2) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+//  T3L =======================================================================
+//  Macro for verify integer value from the expected 1, 2 and 3 values.
+//  Example for use: T1L( Open(), KErrNone, KErrAlreadyExists, KErrDiskFull );
+//  ===========================================================================
+    #define T3L( aResult, aExpected1, aExpected2, aExpected3 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) && (result) != (aExpected2) && (result) != (aExpected3) ) )\
+            { TestModuleIf().StifMacroError(\
+                (3), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1), (aExpected2), (aExpected3) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+//  T4L =======================================================================
+//  Macro for verify integer value from the expected 1, 2, 3 and 4 values.
+//  Example for use:
+//  T1L( Open(), KErrNone, KErrAlreadyExists, KErrDiskFull, KErrDisconnected );
+//  ===========================================================================
+    #define T4L( aResult, aExpected1, aExpected2, aExpected3, aExpected4 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) && \
+              (result) != (aExpected2) && \
+              (result) != (aExpected3) && \
+              (result) != (aExpected4) ) )\
+            { TestModuleIf().StifMacroError(\
+                (4), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), \
+                (aExpected1), (aExpected2), (aExpected3), (aExpected4) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+//  T5L =======================================================================
+//  Macro for verify integer value from the expected 1, 2, 3, 4 and 5 values.
+//  Example for use:
+//  T1L( Open(), KErrNone, KErrDied, KErrInUse, KErrDisconnected, KErrAbort );
+//  ===========================================================================
+    #define T5L( aResult, aExpected1, aExpected2, aExpected3, aExpected4, aExpected5 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) && \
+              (result) != (aExpected2) && \
+              (result) != (aExpected3) && \
+              (result) != (aExpected4) && \
+              (result) != (aExpected5) ) )\
+            { TestModuleIf().StifMacroError(\
+                (5), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), \
+                (aExpected1), (aExpected2), (aExpected3), (aExpected4), (aExpected5) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+
+//  TAL ========================================================================
+//  Macro for verify boolean value. 
+//  Recommended use with TestScripter's test class. Allowed result can be defined
+//  with 'allownextresult' and 'allowerrorcodes' keywords.
+//  Example for use, 1: TL( Open() == KErrNone );
+//                   1: TL( VerifyString1() == VerifyString2() );
+//                   2: TL( 6 <= 8 );
+//  =============================================================================
+    #define TAL( aIsTrue )\
+        if( ( !(aIsTrue) ) && TestModuleIf().CheckAllowResult( 0 /* = EFalse*/ ) )\
+            { TestModuleIf().StifMacroError( (0), (TText8*)__FILE__, __FUNCTION__, __LINE__ );\
+            User::Leave( KErrArgument ); };
+
+//  TA1L =======================================================================
+//  Macro for verify integer value from the expected 1 value. 
+//  Recommended use with TestScripter's test class. Allowed result can be defined
+//  with 'allownextresult' and 'allowerrorcodes' keywords.
+//  Example: T1L( Open(), KErrNone );
+//  =============================================================================
+    #define TA1L( aResult, aExpected1 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) ) && \
+               TestModuleIf().CheckAllowResult( result ) ) \
+            { TestModuleIf().StifMacroError(\
+                (1), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+//  TA2L =======================================================================
+//  Macro for verify integer value from the expected 1 and 2 values.
+//  Recommended use with TestScripter's test class. Allowed result can be defined
+//  with 'allownextresult' and 'allowerrorcodes' keywords.
+//  Example for use: T1L( Open(), KErrNone, KErrAlreadyExists );
+//  =============================================================================
+    #define TA2L( aResult, aExpected1, aExpected2 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) && (result) != (aExpected2) ) && \
+               TestModuleIf().CheckAllowResult( result ) ) \
+            { TestModuleIf().StifMacroError(\
+                (2), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1), (aExpected2) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+//  TA3L =======================================================================
+//  Macro for verify integer value from the expected 1, 2 and 3 values. 
+//  Recommended use with TestScripter's test class. Allowed result can be defined
+//  with 'allownextresult' and 'allowerrorcodes' keywords.
+//  Example for use: T1L( Open(), KErrNone, KErrAlreadyExists, KErrDiskFull );
+//  =============================================================================
+    #define TA3L( aResult, aExpected1, aExpected2, aExpected3 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) && (result) != (aExpected2) && (result) != (aExpected3) ) && \
+              TestModuleIf().CheckAllowResult( result ) )\
+            { TestModuleIf().StifMacroError(\
+                (3), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1), (aExpected2), (aExpected3) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+//  TA4L =======================================================================
+//  Macro for verify integer value from the expected 1, 2, 3 and 4 values.
+//  Recommended use with TestScripter's test class. Allowed result can be defined
+//  with 'allownextresult' and 'allowerrorcodes' keywords.
+//  Example for use:
+//  T1L( Open(), KErrNone, KErrAlreadyExists, KErrDiskFull, KErrDisconnected );
+//  =============================================================================
+    #define TA4L( aResult, aExpected1, aExpected2, aExpected3, aExpected4 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) && \
+              (result) != (aExpected2) && \
+              (result) != (aExpected3) && \
+              (result) != (aExpected4) ) && \
+               TestModuleIf().CheckAllowResult( result ) ) \
+            { TestModuleIf().StifMacroError(\
+                (4), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), \
+                (aExpected1), (aExpected2), (aExpected3), (aExpected4) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+//  TA5L =======================================================================
+//  Macro for verify integer value from the expected 1, 2, 3, 4 and 5 values.
+//  Recommended use with TestScripter's test class. Allowed result can be defined
+//  with 'allownextresult' and 'allowerrorcodes' keywords.
+//  Example for use:
+//  T1L( Open(), KErrNone, KErrDied, KErrInUse, KErrDisconnected, KErrAbort );
+//  =============================================================================
+    #define TA5L( aResult, aExpected1, aExpected2, aExpected3, aExpected4, aExpected5 )\
+        {\
+        TInt result = aResult;\
+        if( ( (result) != (aExpected1) && \
+              (result) != (aExpected2) && \
+              (result) != (aExpected3) && \
+              (result) != (aExpected4) && \
+              (result) != (aExpected5) ) && \
+               TestModuleIf().CheckAllowResult( result ) ) \
+            { TestModuleIf().StifMacroError(\
+                (5), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), \
+                (aExpected1), (aExpected2), (aExpected3), (aExpected4), (aExpected5) );\
+            User::Leave( KErrArgument ); };\
+        };
+
+
+// Workaround for ARM RVCT compiler error. This added because if some
+// environment do not include this definition.
+#if !defined (NONSHARABLE_CLASS)
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModuleBase;
+class TEventIf;
+class CTestThreadContainer;
+class MSTIFTestInterference;
+class CSTIFTestMeasurement;
+class CSTIFTestMeasurementImplementation;
+class CUiEnvProxy;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Base class for test case measurement . User can start measurement operations
+// via this class.
+NONSHARABLE_CLASS( CSTIFTestMeasurement )
+        :public CBase 
+    {
+    public: // Enumerations
+
+        /**
+        * Enumeration for different measurement types.
+        */
+        enum TSTIFMeasurementType
+            {
+            KStifMeasurementEnableAll,
+            KStifMeasurementPlugin01,
+            KStifMeasurementPlugin02,
+            KStifMeasurementPlugin03,
+            KStifMeasurementPlugin04,
+            KStifMeasurementPlugin05,
+            KStifMeasurementBappeaProfiler,
+            KStifMeasurementDisableAll,
+            };
+
+        /**
+        * Enumeration for different measurement operations.
+        */
+        enum TSTIFMeasurementOperation
+            {
+            KMeasurementNew,
+            KMeasurementStart,
+            KMeasurementStop,
+            };
+
+        /**
+        * Struct for measurement.
+        */
+        struct TStifMeasurementStruct
+            {
+            TSTIFMeasurementType        iMeasurementType;
+            TFileName                   iConfigurationInfo;
+            TSTIFMeasurementOperation   iMeasurementOperation;
+            TInt                        iOperationResult;
+            CTestModuleBase*            iPointerToMeasurementModule;
+            };
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Intializes test measurement module.
+        */
+        IMPORT_C static CSTIFTestMeasurement* NewL( 
+                                            CTestModuleBase* aTestModuleBase,
+                                            TSTIFMeasurementType aType,
+                                            const TDesC& aConfigurationInfo );
+
+    public: // New functions
+
+        /**
+        * Start commant for test measurement module.
+        * Returns Symbian error code.
+        */
+        IMPORT_C TInt Start();
+
+        /**
+        * Stop command for test measurement module.
+        * Returns Symbian error code.
+        */
+        IMPORT_C TInt Stop();
+
+    public: // Functions from base classes
+
+        /**
+        * Destructor 
+        */
+        virtual ~CSTIFTestMeasurement();
+
+    protected: // New functions
+
+    protected: // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSTIFTestMeasurement( CTestModuleBase* aTestModuleBase );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TSTIFMeasurementType aType,
+                         const TDesC& aConfigurationInfo );
+
+    public: //Data
+
+    protected: // Data
+
+    private: // Data
+
+        // Pointer to STIF side
+        CTestModuleBase*        iTestModuleBase;
+
+        // Stuct that includes measurement related information
+        TStifMeasurementStruct  iMeasurementStruct;
+
+        // Indicates is measurement disable
+        TInt                    iMeasurementOption;
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+        friend class CTestModuleBase;
+
+    };
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TTestResult defines the test case result information.
+class TTestResult 
+    {
+    public:
+
+        /**
+        * Default constructor of TTestResult.
+        */
+        IMPORT_C TTestResult();
+
+        /**
+        * Sets result and result description of the test case.
+        */
+        IMPORT_C void SetResult( TInt aResultCode, const TDesC& aResultDes );
+
+    public:
+
+        // Test case result as Symbian OS error code.
+        TInt iResult;
+        // Descriptive test case result.
+        TResultDes iResultDes;
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TTestCaseInfo defines the information for test case execution.
+class TTestCaseInfo
+    {
+    public:
+        // Default test case priority values
+        enum TPriority
+            {    
+            EPriorityLow = -100,
+            EPriorityNormal = 0,
+            EPriorityHigh = 100,
+            };
+
+    public:
+
+        /**
+        * Default constructor of TTestCaseInfo.
+        */
+        IMPORT_C TTestCaseInfo();
+
+    public:
+
+        // Test case number.
+        TInt iCaseNumber;
+        // Test case title.
+        TName iTitle;
+        // Test Case Timeout ( 0 == No timeout )
+        TTimeIntervalMicroSeconds iTimeout; 
+        // Test case priority
+        TInt iPriority;
+
+    };
+// Packaged TTestCaseInfo
+typedef TPckg<TTestCaseInfo> TTestCaseInfoPckg;
+
+// CLASS DECLARATION
+class CScriptBase;
+class TScriptObject
+    {
+public:
+    TName& ObjectId()
+        {
+        return iName;
+        }
+    TScriptObject():
+            iScript(NULL)
+        {
+        }
+    IMPORT_C virtual ~TScriptObject();
+public:
+    //CScriptBaseProxy iScript;
+    CScriptBase* iScript;
+protected:
+    TName iName;
+    };
+// DESCRIPTION
+// CTestModuleIf provides interface for Test Module to perform 
+// printing to user interface and to control event system.
+class CTestModuleIf
+        :public CBase 
+    {
+    public: // Enumerations
+
+        // Possible test case exit reasons.
+        enum TExitReason
+            {    
+            // Case will exit normally AND return test case result.
+            ENormal,          
+            // Case is expected to panic.
+            EPanic,           
+            // Case will end to exception.
+            EException,
+            };
+
+        enum TRebootType
+            {
+            EDefaultReset = 0,  // Do not change the value
+            EKernelReset,
+
+            EDeviceReset0 = 100,
+            EDeviceReset1,
+            EDeviceReset2,
+            EDeviceReset3,
+            EDeviceReset4,
+            EDeviceReset5
+            };
+
+        enum TTestBehavior
+            {
+            ETestLeaksMem       = 0x00000001,
+            ETestLeaksRequests  = 0x00000002,
+            ETestLeaksHandles   = 0x00000004,
+            EOOMDisableLeakChecks = 0x00000008,
+            };
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CTestModuleIf* NewL( CTestThreadContainer* aExecutionSession, 
+                                             CTestModuleBase* aTestModule );
+
+    public: // New functions
+
+        /**
+        * Printf is used to provide different information up to the UI 
+        * that can be then printed e.g. to the Console Screen. 
+        * The definition of data to be printed is copied to aDefinition. 
+        * The aPriority tells how important information is returned. 
+        * The priority can be used in the UI to decide if the information 
+        * received from the Test Module will be discarded or not in 
+        * the different performance situations. The priority is also 
+        * used in the Test Module server and in the Test Engine to queue 
+        * the Printf responses.
+        * This method is implemented in Test Module Server and the Test Module 
+        * can call it to provide printable information to the UI.
+        */
+        IMPORT_C void Printf( const TInt aPriority, 
+                              const TDesC& aDefinition, 
+                              TRefByValue<const TDesC> aFmt,... );
+
+        /**
+        * Event function is used to control and use the event system. 
+        * TEvent &aEvent encapsulates the request type and 
+        * the event name, see StifTestEventInterface.h for more information.
+        * This method is implemented in Test Module Server and the Test Module 
+        * can call it to control the event system.
+        */
+        IMPORT_C TInt Event( TEventIf& aEvent );
+
+        /**
+        * Asynchronous overload function for the previous. Only one 
+        * asynchronous Event call can be active concurrently. Second 
+        * concurrent call will block until first one is completed.
+        */
+        IMPORT_C void Event( TEventIf& aEvent, TRequestStatus& aStatus );
+
+        /**
+        * Cancel asynchronous event command. 
+        */
+        IMPORT_C TInt CancelEvent( TEventIf& aEvent,
+                                   TRequestStatus* aStatus );
+
+        /**
+        * SetExitReason function is used to set different crash reasons to
+        * acceptable test case result. 
+        * Only one exit reason can be set at time. When function is called
+        * again, previous exit reason is removed and new one is set to
+        * acceptable exit reason.
+        *
+        * Function is typically used to accept test case panics as "passed"
+        * test cases.
+        * 
+        * Test case that panics or gets exception is set to passed 
+        * if aExitReason parameter matches with exit reason and 
+        * aExitCode matches with panic code or exception type.
+        */
+        IMPORT_C void SetExitReason( const CTestModuleIf::TExitReason aExitReason, 
+                                     const TInt aExitCode );
+
+
+        /**
+        * RemoteSend function is used send remote control protocol messages.
+        */
+        IMPORT_C TInt RemoteSend( const TDesC& aRemoteMsg );
+
+        /**
+        * RemoteReceive function is used receive remote 
+        * control protocol messages.
+        */
+        IMPORT_C void RemoteReceive( TDes& aRemoteMsg, 
+                                     TRequestStatus& aStatus );
+
+        /**
+        * RemoteReceiveCancel function is used cancel 
+        * pending RemoteReceive.
+        */
+        IMPORT_C void RemoteReceiveCancel();
+
+        /**
+        * Reboot device, StoreState MUST have been called.
+        */
+        IMPORT_C TInt Reboot( TInt aType = EDefaultReset );
+
+        /**
+        * Store state before reboot. MUST be called before calling Reboot().
+        */
+        IMPORT_C TInt StoreState( TInt aCode, TName& aName );
+
+        /**
+        * Get state after reboot (stored with StoreState).
+        */
+        IMPORT_C TInt GetStoredState( TInt& aCode, TName& aName );
+
+        /**
+        * Set test case behavior, e.g. allow memory leak, handle leak etc.
+        */
+        IMPORT_C TInt SetBehavior( TTestBehavior aType, TAny* aPtr=NULL );
+
+        /**
+        * This can be called from test module but it is recommended to use
+        * TL, T1L, T2L or T3L macro instead of this method.
+        * For more information see macro definitions above on this file.
+        */ 
+        IMPORT_C TInt StifMacroError( TInt aMacroType,
+                                      const TText8* aFile,
+                                      const char* aFunction,
+                                      TInt aLine,
+                                      TInt aResult = 0,
+                                      TInt aExpected1 = 0,
+                                      TInt aExpected2 = 0,
+                                      TInt aExpected3 = 0,
+                                      TInt aExpected4 = 0,
+                                      TInt aExpected5 = 0 );
+
+        /**
+        * Add thread handle to Array. Via array can handle test interference
+        * thread's kill in panic etc. cases
+        */ 
+        TInt AddInterferenceThread( RThread aSTIFTestInterference );
+
+        /**
+        * Remove thread handle from Array.Test interference thread is stopped
+        * and killed successfully
+        */ 
+        TInt RemoveInterferenceThread( RThread aSTIFTestInterference );
+
+        /**
+        * With this can be stored information about test measurement
+        * to TestServer space.
+        */ 
+        TInt HandleMeasurementProcess( CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo );
+
+        /**
+        * Get measurement option(s) given from initialization file etc.
+        */
+        IMPORT_C TInt GetMeasurementOptions( TInt& aOptions );
+
+        /**
+        * Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to allow
+        * results.
+        * Set test case allow result given by user. In TestScripter cases allow
+        * result can set by 'allownextresult' or 'allowerrorcodes' keywords. In
+        * Normal and Hardcoded test modules allow result can be set with this
+        * method, reset should be done with ResetAllowResult method.
+        */
+        IMPORT_C TInt SetAllowResult( TInt aResult );
+
+        /**
+        * This is mainly used by STIF's TAL-TA5L macros internally.
+        * Check is macros result allowed result.
+        */
+        IMPORT_C TInt CheckAllowResult( TInt aResult );
+
+        /**
+        * Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to reset allowed
+        * results.
+        * Reset allow result(s) given with SetAllowResult. In TestScripter
+        * cases this will be called automatically by STIF. Normal and Hardcoded
+        * cases this should be called by user.
+        */
+        IMPORT_C TInt ResetAllowResult();
+
+        /**
+        * StopExecution function is used to stop the execution of test case.
+        */
+        IMPORT_C TInt StopExecution(TStopExecutionType aType, TInt aCode = KErrNone);
+
+        /**
+         * SendTestModuleVersion method is used to pass version of test module
+         * to test engine
+         */
+        IMPORT_C TInt SendTestModuleVersion(TVersion aVersion, TFileName aModuleName);
+        
+        /**
+         * SendTestModuleVersion method is used to pass version of test module
+         * to test engine. This version with 3 parameters were added because version with
+         * 2 parameters has arguments passed by value which is incorrect. So the third argument
+         * was added only to overload the method and enable test modules using "old" version
+         * (with 2 parameters) to work. Only this version (with three parameters) should be used.
+         */
+        IMPORT_C TInt SendTestModuleVersion(TVersion& aVersion, const TDesC& aModuleName, TBool aNewVersion);
+
+        /**
+        * Command function is used to send command to test engine.
+        * It was created to provide possibility to kill test case by itself.
+        */
+        TInt Command(TCommand aCommand, const TDesC8& aParamsPckg);
+
+        /**
+        * GetTestCaseTitleL function is used to obtain test case title.
+        */
+        IMPORT_C void GetTestCaseTitleL(TDes& aTestCaseTitle);
+
+        /**
+        * Checks if testserver supports UI testing
+        */
+        IMPORT_C TBool UITesting();
+
+        /**
+        * Gets UIEnvProxy
+        */
+        IMPORT_C CUiEnvProxy* GetUiEnvProxy();
+        
+        /**
+        * 
+        */
+        IMPORT_C TBool SeperateProcesses();
+
+        /**
+         * Gets CScriptBase
+         */
+        IMPORT_C CScriptBase* GetObjFrmCaseDict(const TDesC& aObjectId);
+
+    public: // Functions from base classes
+
+    protected: // New functions
+        
+        /**
+         * Get TScriptObject
+         */
+        IMPORT_C TScriptObject* GetTestObjFromCaseDict(const TDesC& aObjectId) const;
+
+        /*
+         * Delete Test Object
+         */
+        IMPORT_C void DelTestObjFromCaseDict(const TDesC& aObjectId);
+
+        /**
+         * Add Test Object
+         */
+        IMPORT_C void AddTestObjToCaseDictL(TScriptObject* aObject);
+
+    protected: // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModuleIf( CTestThreadContainer* aTestExecution );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CTestModuleBase* aTestModule );
+
+        /**
+        * Destructor is also private. 
+        * ONLY friend CTestModuleBase can delete CTestModuleIf.
+        */
+        ~CTestModuleIf();
+
+        /**
+        * Check that server is alive.
+        */ 
+        TBool IsServerAlive();
+
+    protected: // Data
+
+    private: // Data
+        CTestThreadContainer* iTestExecution;
+
+        // Indicates is reboot operation ready to start.
+        TBool iIsRebootReady;
+
+        // Indicated StoreState() method's call times.
+        TInt iStoreStateCounter;
+
+        // Test case allowed results. Array is a static one for avoid dynamic
+        // allocations.
+        TInt iTestCaseResults[KSTIFMacroResultArraySize]; 
+        // Test case allowed results count. This is used with
+        // iTestCaseResults array.
+        TInt iAllowTestCaseResultsCount;        
+       
+    public: //Data
+        TInt    iNumberInGlbDict;   
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+        friend class CTestModuleBase;
+        friend class CTestScripter;
+
+    };
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Base class for test module parameters. According to parameters may
+// configure test module. e.g. heap and stack configuring.
+class CTestModuleParam : public CBase 
+    {
+
+    public: // Enumerations
+
+        /**
+        * Evolution version for test module parameters.
+        **/
+        enum TParameterVersio
+            {
+            EVersio1 = 1, // For heap and stack configuring.
+            EVersio2 = 2, // For future needs.
+            EVersio3 = 3, // For future needs.
+            EVersio4 = 4, // For future needs.
+            EVersio5 = 5, // For future needs.
+
+            };
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        //IMPORT_C static CTestModuleParam* NewL();
+
+        /**
+        *
+        */
+        //IMPORT_C ~CTestModuleParam();
+
+    public: // New functions
+
+        /**
+        * 
+        */
+        virtual TInt Version() = 0;
+
+    public: // Functions from base classes
+
+    protected: // New functions
+
+    protected: // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        //CTestModuleParam();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        //void ConstructL();
+
+    public: //Data
+
+    protected: // Data
+
+    private: // Data
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestModuleParamVer01 implements evolution version 1 for test module's 
+// heap and stack configuring.
+class CTestModuleParamVer01 : public CTestModuleParam
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CTestModuleParamVer01* NewL();
+        //IMPORT_C CTestModuleParamVer01* NewL();
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModuleParamVer01();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CTestModuleParamVer01(); 
+
+    private: // Constructors and destructor
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public: // New functions
+
+        /**
+        *
+        */
+        inline TInt Version() { return iVersio; };
+
+    public: // Functions from base classes
+        
+    protected: // New functions
+
+    protected: // Functions from base classes
+
+    private:
+
+    public: // Data
+
+        /**
+        * Test thread stack size defined by user.
+        **/
+        TInt iTestThreadStackSize;
+
+        /**
+        * Test thread heap minimum size defined by user.
+        **/
+        TInt iTestThreadMinHeap;
+
+        /**
+        * Test thread heap maximum size defined by user.
+        **/
+        TInt iTestThreadMaxHeap;
+
+    protected: // Data
+
+    private: // Data
+
+        /**
+        *
+        **/
+        TInt iVersio;
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Test Module inherits the CTestModuleBase class that is used to provide 
+// simple interface between Test Engine and Test Module. CTestModuleBase 
+// consists of pure virtual methods that the Test Module shall implement 
+// and virtual methods that the Test Module should implement.
+class CTestModuleBase
+        :public CBase
+    {
+    public: // Enumerations
+    
+        // For OOM execution
+        enum TOOMFailureType 
+            {    
+            EFailNext
+            };
+    private: // Enumerations
+
+    public: // Version query.
+
+        /**
+        * Returns the API version which this test module complies.
+        * Test Framework uses this function to verify that loaded module
+        * can be used in current framework release.
+        *
+        * Note that this function must always be the very first function
+        * that is defined in CTestModuleBase.
+        */
+        virtual inline TVersion Version()
+                                 { return TVersion ( KTestModuleAPIMajor,
+                                                     KTestModuleAPIMinor,
+                                                     KTestModuleAPIBuild); }
+
+    public: // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModuleBase(): iTestModuleIf(0) {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTestModuleBase(){ delete iTestModuleIf; }; 
+
+    public: // New functions
+
+        /**
+        * InitL is used to initialize the Test Module. The Test Modules may 
+        * use the initialization file to read parameters for Test Module 
+        * initialization but they can also have their own configure file or 
+        * some other routine to initialize themselves.
+        * This method is virtual and it is not mandatory to implement it 
+        * to Test Module.
+        */
+        virtual TInt InitL( TFileName& /* aIniFile */,
+                           TBool /* aFirstTime */ )
+            { return KErrNone; };
+
+        /**
+        * Test cases are inquired from the Test Module by calling 
+        * GetTestCasesL. Test cases may be read from the testcase file 
+        * specified by aTestCaseFile or they can be e.g. hardcoded to testmodule. 
+        * If the Test Module does not use testcase files for test case 
+        * definition it does not use aTestCaseFile parameter. Test cases are 
+        * appended to RPointerArray<TTestCaseInfo> that is a list 
+        * consisting of several TTestCaseInfo objects.
+        * The STIF Test Framework will be the owner of the objects stored to 
+        * RPointerArray after the GetTestCasesL has appended them to the list
+        * and it does the memory deallocation.
+        * This method is pure virtual and the Test Module must implement it.
+        */
+        virtual TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases ) = 0;
+
+        /**
+        * RunTestCaseL is used to run an individual test case specified 
+        * by aCaseNumber and aTestCaseFile (optional). 
+        * This method is synchronous and test case result is returned as 
+        * reference parameter aResult value. 
+        * The function shall return KErrNone if case is started succesfully.
+        * If test case is not available (i.e invalid testcase file or
+        * or case number), then function shall return KErrNotFound. In other 
+        * error situations another Symbian error code is returned.                
+        * This method is pure virtual and the Test Module must implement it. 
+        */
+        virtual TInt RunTestCaseL( const TInt aCaseNumber, 
+                                  const TFileName& aTestCaseFile,
+                                  TTestResult& aResult ) = 0;
+
+        /**
+        * TestModuleIf returns the handle to the CTestModuleIf interface. 
+        * This is an utility function that can be used if the upper layer 
+        * interface is needed to be used.
+        * This method must not be called from the constructor of Test Module 
+        * that derives the CTestModuleBase.
+        */
+        inline CTestModuleIf& TestModuleIf(){ return *iTestModuleIf; };
+
+        /**
+        * Used to perform the test environment setup for a particular OOM test 
+        * case. The Test Modules may use the initialization file to read parameters 
+        * for Test Module initialization but they can also have their own 
+        * configure file or some other routine to initialize themselves.
+        *
+        * This method is virtual and will be implemented if test case is to be
+        * executed using OOM conditions.
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                         const TInt /* aCaseNumber */ ) {};
+
+        /**
+        * Used to perform the test environment cleanup for a particular OOM 
+        * test case.
+        *         
+        * This method is virtual and will be implemented if test case is to be
+        * executed using OOM conditions.
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ ) {};
+
+        /**
+        * Used to check if a particular Test Case should be run in OOM 
+        * conditions and which memory allocations should fail.
+        * Method returns ETrue if test is should run in OOM conditions, EFalse 
+        * otherwise. 
+        *
+        * This method is virtual and will be implemented if test case is to be
+        * executed using OOM conditions.
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& aFailureType, 
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ ) 
+            { 
+            aFailureType = EFailNext;
+            return EFalse; 
+            };
+
+        /**
+        * Used in OOM testing only. Provides a way to the derived TestModule to
+        * handle warnings related to non-leaving or TRAPped allocations.
+        * 
+        * In some cases the allocation should be skipped, either due to problems
+        * in the OS code or components used by the code being tested, or even
+        * inside the tested components which are implemented this way on purpose
+        * (by design), so it is important to give the tester a way to bypass
+        * allocation failures.
+        *
+        * This method is virtual and will be implemented if test case is to be
+        * executed using OOM conditions.
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */) {};
+
+    public: // Functions from base classes
+
+    protected: // New functions
+
+    protected: // Functions from base classes
+
+    private:
+
+    public: // Data
+
+    protected: // Data
+
+    private: // Data
+        CTestModuleIf* iTestModuleIf;
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+        friend class CTestModuleIf;
+        friend class CTestModuleParam;
+        friend class MSTIFTestInterference;
+        friend class CSTIFInterferenceThread;
+        friend class CSTIFTestMeasurement;
+
+    };
+
+#endif      // TESTMODULE_H  
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifUnitGeneric.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,473 @@
+/*
+* 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: STIFUnit module declaration
+*
+*/
+
+#ifndef StifUnitGeneric_H
+#define StifUnitGeneric_H
+
+// INCLUDES
+#include <e32svr.h>
+//#include "StifTestModule.h"
+#include <StifTestInterface.h>
+#include <StifLogger.h>
+#include <StifUnitMacros.h>
+
+// INCLUDES FROM CASES FILE
+#define STIF_UNIT_INCLUDE_SECTION
+#include STIF_UNIT_TEST_CASES
+#undef STIF_UNIT_INCLUDE_SECTION
+
+// FORWARD DECLARATIONS
+class STIF_UNIT_MODULE_CLASS_NAME;
+
+// DATA TYPES
+// A typedef for function that does the actual testing,
+// function is a type 
+// TInt STIF_UNIT_MODULE_CLASS_NAME::<NameOfFunction> ( TTestResult& aResult )
+typedef TInt (STIF_UNIT_MODULE_CLASS_NAME::* TestFunction)(TTestResult&);
+
+// CLASS DECLARATION
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText*    iCaseName;
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {
+        };
+
+    };
+
+// CLASS DECLARATION
+/**
+*  STIFUnit class (name of the class is changed by real module name).
+*/
+NONSHARABLE_CLASS(STIF_UNIT_MODULE_CLASS_NAME) : public CTestModuleBase
+    {
+    public:  //Enums
+        
+    public:  // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor.
+        */
+        static STIF_UNIT_MODULE_CLASS_NAME* NewL()
+            {
+            STIF_UNIT_MODULE_CLASS_NAME* self = new (ELeave) STIF_UNIT_MODULE_CLASS_NAME;
+
+            CleanupStack::PushL( self );
+            self->ConstructL();
+            CleanupStack::Pop();
+
+            return self;
+            }
+
+        /**
+        * Destructor.
+        */
+        virtual ~STIF_UNIT_MODULE_CLASS_NAME()
+            {
+            delete iLog;
+            }
+
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the 
+        *       STIFUnit module. It is called once for every instance of 
+        *       TestModuleUnit after its creation.
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of STIFUnit module.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& /*aIniFile*/, TBool /*aFirstTime*/ )
+            {
+            return KErrNone;
+            }
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from STIFUnit module. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& /*aTestCaseFile*/, 
+                            RPointerArray<TTestCaseInfo>& aTestCases )
+            {
+            TTestResult dummyResult;
+            return MainTestL(EEnumerateTestCases, -1, aTestCases, dummyResult); 
+            }
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& /*aTestCaseFile*/,
+                           TTestResult& aResult )
+        {
+        if(!iVersionLogged)
+            {
+            SendTestModuleVersion();
+            iVersionLogged = ETrue;
+            }
+    
+        RPointerArray<TTestCaseInfo> aTestCases; //temporary
+    
+        // iNumberOfTestCases should contain valid number of test cases present in test module. This info
+        // is gathered in the enumeration procedure.
+        // However if test case crashes, test module is loaded again and enumeration is not performed.
+        // In such case counting procedure must be done.
+        if(iNumberOfTestCases == 0)
+            {
+            TRAPD(errCount, MainTestL(ECountTestCases, aCaseNumber, aTestCases, aResult));
+            if(errCount != KErrNone)
+                {
+        		    iLog->Log(_L("Error during counting test cases [%d]"), errCount);
+        		    return errCount;
+        		    }
+        	  }
+        
+        /**
+         * SetupL is responsible for inicialization of all fields (etc.) common for all testcases
+         * MainTestL starts required testcase
+         * TeardownL destroys all data that was created by SetupL
+         */
+        TInt errSetup = KErrNone;
+        TInt errTestcase = KErrNone;
+        
+        if(aCaseNumber > iNumberOfTestCases)
+            return KErrNotFound;
+        	
+        __UHEAP_MARK;
+        
+        TRAP(errSetup, MainTestL(ERunTestCase, STIF_RUN_SETUP, aTestCases, aResult); TRAP(errTestcase, MainTestL(ERunTestCase, aCaseNumber, aTestCases, aResult))\
+        		MainTestL(ERunTestCase, STIF_RUN_TEARDOWN, aTestCases, aResult));
+        
+        __UHEAP_MARKEND;
+        
+        if(errTestcase != KErrNone)
+            {
+            aResult.SetResult(errTestcase, _L("Testcase failed"));
+            }
+        if(errSetup != KErrNone)
+            {
+            aResult.SetResult(errSetup, _L("Setup or teardown failed"));
+            }
+       
+        return KErrNone;
+        }
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        #ifdef STIFUNIT_OOMTESTQUERYL
+        virtual TBool OOMTestQueryL( const TFileName& aTestCaseFile, 
+                                     const TInt aCaseNumber, 
+                                     TOOMFailureType& aFailureType, 
+                                     TInt& aFirstMemFailure, 
+                                     TInt& aLastMemFailure);
+        #else
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& /* aFailureType */, 
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ )
+            {
+            return EFalse;
+            }
+        #endif
+
+        /**
+        * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        #ifdef STIFUNIT_OOMTESTINITIALIZEL
+        virtual void OOMTestInitializeL( const TFileName& aTestCaseFile, 
+                                         const TInt aCaseNumber);
+        #else
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                         const TInt /* aCaseNumber */ )
+            {
+            }
+        #endif 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        *
+        * User may add implementation for OOM test warning handling. Usually no
+        * implementation is required.           
+        */
+        #ifdef STIFUNIT_OOMHANDLEWARNINGL
+        virtual void OOMHandleWarningL( const TFileName& aTestCaseFile,
+                                        const TInt aCaseNumber, 
+                                        TInt& aFailNextValue);
+        #else
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */)
+            {
+            }
+        #endif 
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        *
+        */
+        #ifdef STIFUNIT_OOMTESTFINALIZEL
+        virtual void OOMTestFinalizeL( const TFileName& aTestCaseFile, 
+                                       const TInt aCaseNumber);
+        #else
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ )
+            {
+            }
+        #endif
+
+        /**
+         * Method used to log version of test module
+         */
+        void SendTestModuleVersion()
+            {
+            TVersion moduleVersion;
+            moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
+            moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
+            moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
+            	
+            TFileName moduleName;
+            moduleName = STIF_UNIT_MODULE_NAME;
+            
+            TBool newVersionOfMethod = ETrue;
+            TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+            }
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        STIF_UNIT_MODULE_CLASS_NAME()
+            {
+            }
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL()
+            {
+            iLog = CStifLogger::NewL( KUnitLogPath, KUnitLogFile);
+
+            // Sample how to use logging
+            iLog->Log( KLogStart );
+
+            iVersionLogged = EFalse;
+            iNumberOfTestCases = 0;
+            }
+
+        /**
+        * Method containing all test cases, setup and teardown sections.
+        */
+        TInt MainTestL(TCallReason aRunReason, TInt aTestToRun, RPointerArray<TTestCaseInfo>& aTestCases, TTestResult& aResult)
+            {
+            aResult.iResult = aResult.iResult; //for avoiding compiler warning when unit test does not use any assert macro  
+            if(aRunReason == ERunTestCase)
+                {
+                if(aTestToRun < 0)
+                    {
+                    iLog->Log(_L("Running setup or teardown"));
+                    }
+                else
+                    {
+                    iLog->Log(_L("Running test case #%d"), aTestToRun);
+                    }
+                }
+            else if(aRunReason == EEnumerateTestCases)
+                {
+                iLog->Log(_L("Enumerating test cases."));
+                }
+            else if(aRunReason == ECountTestCases)
+                {
+                iLog->Log(_L("Counting test cases."));
+                }
+            else
+                {
+                iLog->Log(_L("Unknown run reason [%d]."), aRunReason);
+                return KErrNotSupported;
+                }
+            
+            TInt _test_case_no = -1;
+            
+            //test cases, setup and teardown include
+            #define TEST_CASES
+            #include STIF_UNIT_TEST_CASES
+            #undef TEST_CASES
+            
+            if(aRunReason == EEnumerateTestCases)
+                {
+                iNumberOfTestCases = _test_case_no;
+                iLog->Log(_L("Enumeration completed."));
+                }
+            else if(aRunReason == ECountTestCases)
+                {
+                iNumberOfTestCases = _test_case_no;
+                iLog->Log(_L("Counting completed."));
+                }
+            
+            // Test case was executed
+            return KErrNone;
+            }
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+        // Pointer to logger
+        CStifLogger * iLog; 
+
+        // Flag saying if version of test module was already sent
+        TBool iVersionLogged;
+        // Total number of test cases
+        TInt iNumberOfTestCases;
+
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+        
+		#define TEST_VAR_DECLARATIONS
+        /**
+         * all testmodule-global variables declarations are inserted here
+         */
+        #include STIF_UNIT_TEST_CASES
+		#undef TEST_VAR_DECLARATIONS
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return STIF_UNIT_MODULE_CLASS_NAME::NewL();
+    }
+
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                               TUint32& /*aParameterValid*/ )
+    {
+    return KErrNone;
+    }
+
+#endif      // StifUnitGeneric_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifUnitMacros.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,215 @@
+/*
+* 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: STIFUnit macros declarations
+*
+*/
+
+#ifndef STIFUnit_MACROS_H
+#define STIFUnit_MACROS_H
+
+// Enumeration types
+// Reason for running test method
+enum TCallReason
+    {
+    EEnumerateTestCases,
+    ERunTestCase,
+    ECountTestCases, //Used to count test cases.
+                     //This should be already done by enumerating procedure,
+                     //however in case of test crash all internal data are
+                     //being lost.
+    };
+
+
+// Strings
+_LIT( KAssertFailedEquals, "AssertEquals Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotEquals, "AssertNotEquals Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNull, "AssertNull Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotNull, "AssertNotNull Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedSame, "AssertSame Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotSame, "AssertNotSame Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedTrue, "AssertTrue Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedFalse, "AssertFalse Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotLeaves, "AssertNotLeaves Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedLeaves, "AssertLeaves Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedLeavesWith, "AssertLeavesWith Failed [F:%s][L:%d]" );
+
+
+#ifdef _UNICODE
+	#define __STIF_WIDEN2(x) L ## x
+	#define __STIF_WIDEN(x) __STIF_WIDEN2(x)
+	#define __STIF_DBG_FILE__ __STIF_WIDEN(__FILE__)
+#else
+	#define __STIF_DBG_FILE__ __FILE__
+#endif
+
+
+// Logs to the STIF log file AND to the RDebug
+#define STIF_LOG( aMessage ) \
+    iLog->Log( _L( aMessage ) ); RDebug::Print( _L( aMessage ) );
+
+
+// Defines a separate test case which consists of two blocks - one for enumeration of test cases
+// second for running the testcase.
+#define STIF_TESTDEFINE( aTestName ) \
+_test_case_no++; \
+if( aRunReason == EEnumerateTestCases ) \
+	{ \
+  TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo(); \
+  CleanupStack::PushL( newCase ); \
+  newCase->iCaseNumber = _test_case_no; \
+  newCase->iTitle.Copy( _L( #aTestName ) ); \
+  User::LeaveIfError(aTestCases.Append ( newCase ) ); \
+  CleanupStack::Pop( newCase ); \
+	} \
+else if(aRunReason == ERunTestCase && _test_case_no == aTestToRun)
+
+#define STIF_RUN_SETUP -1
+#define STIF_RUN_TEARDOWN -2
+
+// Defines a setup section of MainTestL method
+#define STIF_SETUP \
+	if( aRunReason == ERunTestCase && aTestToRun == STIF_RUN_SETUP )
+
+// Defines a teardown section of MainTestL method
+#define STIF_TEARDOWN \
+	if( aRunReason == ERunTestCase && aTestToRun == STIF_RUN_TEARDOWN )
+		
+/*********************************************************************************
+ * Assert Macros
+ *********************************************************************************/
+#define __STIF_ASSERT_SHARED( aFunction, aMessage ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\
+		aResult.SetResult( KErrGeneral, _L("Testcase failed"));\
+		User::Leave( KErrGeneral );\
+		}
+
+#define __STIF_ASSERT_SHARED_DESC( aFunction, aMessage, aDesc ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\
+		aResult.SetResult( KErrGeneral, aDesc );\
+		User::Leave( KErrGeneral );\
+		} \
+	else \
+		{ \
+		aResult.SetResult( KErrNone, aDesc ); \
+		}
+		
+		
+
+#define STIF_ASSERT_EQUALS( aExpected, aActual ) \
+	__STIF_ASSERT_SHARED( AssertEquals( aExpected, aActual ) , KAssertFailedEquals );
+
+#define STIF_ASSERT_EQUALS_DESC( aExpected, aActual, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( AssertEquals( aExpected, aActual ) , KAssertFailedEquals, aDescription ); 
+
+#define STIF_ASSERT_NOT_EQUALS( aExpected, aActual ) \
+	__STIF_ASSERT_SHARED( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals );
+
+#define STIF_ASSERT_NOT_EQUALS_DESC( aExpected, aActual, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals, aDescription );
+
+#define STIF_ASSERT_NULL( aPtr ) \
+	__STIF_ASSERT_SHARED( AssertNull( aPtr ), KAssertFailedNull );
+
+#define STIF_ASSERT_NULL_DESC( aPtr, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( AssertNull( aPtr ), KAssertFailedNull, aDescription );
+
+#define STIF_ASSERT_NOT_NULL( aPtr ) \
+	__STIF_ASSERT_SHARED( !AssertNull( aPtr ), KAssertFailedNotNull );
+
+#define STIF_ASSERT_NOT_NULL_DESC( aPtr, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( !AssertNull( aPtr ), KAssertFailedNotNull, aDescription );
+
+#define STIF_ASSERT_SAME( aExpectedPtr, aActualPtr ) \
+	__STIF_ASSERT_SHARED( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame );
+
+#define STIF_ASSERT_SAME_DESC( aExpectedPtr, aActualPtr, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame, aDescription );
+
+#define STIF_ASSERT_NOT_SAME( aExpectedPtr, aActualPtr) \
+	__STIF_ASSERT_SHARED( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame );
+
+#define STIF_ASSERT_NOT_SAME_DESC( aExpectedPtr, aActualPtr, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame, aDescription );
+
+#define STIF_ASSERT_TRUE( aCondition ) \
+	__STIF_ASSERT_SHARED( AssertTrue( aCondition ), KAssertFailedTrue );
+
+#define STIF_ASSERT_TRUE_DESC( aCondition, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( AssertTrue( aCondition ), KAssertFailedTrue, aDescription );
+
+#define STIF_ASSERT_FALSE( aCondition ) \
+	__STIF_ASSERT_SHARED( !AssertTrue( aCondition ), KAssertFailedFalse );
+
+#define STIF_ASSERT_FALSE_DESC( aCondition, aDescription ) \
+	__STIF_ASSERT_SHARED_DESC( !AssertTrue( aCondition), KAssertFailedFalse, aDescription );
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_NOT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves ); \
+    }
+
+#define STIF_ASSERT_NOT_LEAVES_DESC( aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_DESC( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves, aDescription ); \
+    }    
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves ); \
+    }
+
+#define STIF_ASSERT_LEAVES_DESC( aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_DESC( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves, aDescription ); \
+    }   
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_LEAVES_WITH( aLeaveCode, aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves ); \
+    }
+
+#define STIF_ASSERT_LEAVES_WITH_DESC( aLeaveCode, aStatement, aDescription ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_DESC( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves, aDescription ); \
+    }
+
+#define STIF_ASSERT_PANIC( aPanicCode, aStatement ) \
+	{ \
+	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
+	aStatement; \
+	}
+
+#define STIF_ASSERT_PANIC_DESC( aPanicCode, aStatement, aDescription ) \
+	{ \
+	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
+	aResult.SetResult(KErrNone, aDescription); \
+	aStatement; \
+	}
+
+#include <StifUnitUtils.inl>
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/StifUnitUtils.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,98 @@
+/*
+* 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:
+*
+*/
+
+template <class T>
+inline TBool AssertEquals(const T& aExpected, const T& aActual)
+/**
+ * AssertEquals
+ *
+ * @prototype
+ * @test
+ *
+ * @param aExpected - Expected result
+ * @param aActual - Actual result
+ * @return - True if equal
+ */
+	{
+	if( aExpected==aActual )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+template <class T>
+inline TBool AssertNull(const T* aPtr)
+/**
+ * AssertNull
+ *
+ * @prototype
+ * @test
+ *
+ * @param aPtr - Pointer
+ * @return - True if NULL
+ */
+	{
+	if( aPtr==NULL )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+template <class T>
+inline TBool AssertSame(const T* aExpectedPtr, const T* aActualPtr)
+/**
+ * AssertSame
+ *
+ * @prototype
+ * @test
+ *
+ * @param aExpectedPtr - Expected pointer
+ * @param aActualPtr - Actual pointer
+ * @return - True if equal
+ */
+	{
+	if( aExpectedPtr==aActualPtr )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+inline TBool AssertTrue(const TBool& aCondition)
+/**
+ * AssertTrue
+ *
+ * @prototype
+ * @test
+ *
+ * @param aCondition - Condition
+ * @return - True if aCondition is true
+ */
+	{
+	if( !aCondition )
+		{
+		return EFalse;
+		}
+	return ETrue;
+	}
+	
+
+
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/TestEngineClient.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,469 @@
+/*
+* 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: This file contains the header file of the 
+* RTestEngineServer, RTestEngine and RTestCase.
+*
+*/
+
+#ifndef TEST_ENGINE_CLIENT_H
+#define TEST_ENGINE_CLIENT_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <hal.h>
+#include <stiftestinterface.h>
+#include <StifTestEventInterface.h>
+#include <StifLogger.h>
+
+#include <stiftfwifprot.h>
+#include <e32hashtab.h> 
+
+// CONSTANTS
+// None
+
+// Start and end tags for STIF setting denitions
+_LIT( KStifSettingsStartTag, "[StifSettings]" );
+_LIT( KStifSettingsEndTag, "[EndStifSettings]" );
+// Tag for cabs modifier name
+_LIT( KCapsModifier, "CapsModifier=" );
+// Test module thread heap and stack names
+_LIT( KUserDefStackSize, "TestThreadStackSize=" );
+_LIT( KUserDefMinHeap, "TestThreadMinHeap=" );
+_LIT( KUserDefMaxHeap, "TestThreadMaxHeap=" );
+
+// MACROS
+// None
+
+// DATA TYPES
+
+// Package for test case count, used in EnumerateTestCases method
+typedef TPckgBuf<TInt> TCaseCount;
+
+// A set of test engine settings which can be set/read by SettingServer
+struct TEngineSettings
+    {
+    TInt iEngineSessionId;
+    TBool iUITestingSupport;
+    TBool iSeparateProcesses;
+    };
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// Template class delivering test cases from Test Module
+template <class T> class CFixedFlatArray;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// RTestEngineServer is a client class of Test Engine Server
+// The connect function starts the server, if is not already running.
+// An RSessionBase sends messages to the server with
+// the function RSessionBase::SendReceive();
+// specifying an opcode (TTestEngineReq) and array of argument pointers.
+
+class RTestEngine
+        : public RSessionBase 
+    {
+    public:     // Enumerations
+        enum TTestEngineAsyncRequest { EErrorNotification, EEvent };
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+    public:     // New functions
+
+        /**
+        * Connect method creates new RTestEngineServer session that is used
+        * to manage the test case execution.
+        */
+        IMPORT_C TInt Connect();
+
+        /**
+        * Version returns client side version number from the 
+        * RTestEngineServer.
+        */
+        IMPORT_C TVersion Version() const;
+
+        /**
+        * Open creates a subsession to Test Engine and opens new handle to
+        * RTestEngine. The RTestEngineServer subsession shall be created by
+        * calling RTestEngineServer::Connect before calling Open to create new
+        * RTestEngine subsession.
+        */
+        IMPORT_C TInt LoadConfiguration( const TFileName& aIniFile );
+
+        /**
+        * Closes the RTestEngine subsession.
+        */
+        IMPORT_C void Close();
+
+    public:     // New functions
+
+        /**
+        * Sets attributes to Test Framework
+        */
+        IMPORT_C TInt SetAttribute( TAttribute aAttribute,
+                                    const TDesC& aValue );
+
+        /**
+        * AddTestModule is used to add dynamically a new Test Module to the
+        * Test Framework. Test cases can then be run from the new Test Module
+        * without restarting the Test Framework.
+        * If the Test Module specified by aTestModule doesn't exists this
+        * method returns KErrNotFound. If the Test Module has been already
+        * loaded this method returns KErrAlreadyExists.
+        */
+        IMPORT_C TInt AddTestModule( const TName& aTestModule,
+                                     const TFileName& aIniFile );
+
+        /**
+        * RemoveTestModule is used to remove the existing Test Module from Test
+        * Framework. If there are not test cases executing in the Test Module
+        * it will be shut down.
+        * If there is test case running from the Test Module this method
+        * returns KErrInUse.
+        * If the Test Module specified by aTestModule is not loaded this method
+        * returns KErrNotFound.
+        */
+        IMPORT_C TInt RemoveTestModule( const TName& aTestModule );
+
+        /**
+        * AddConfigFile is used to add dynamically a new config file to the
+        * Test Module specified by aTestModule. New test cases are then 
+        * executed by calling first GetTestCases and then RunTestCase. Thus
+        * new test cases can be run from the Test Module without restarting
+        * the Test Framework.
+        */
+        IMPORT_C TInt AddConfigFile( const TName& aTestModule,
+                                     const TFileName& aConfigFile );
+
+        /**
+        * RemoveConfigFile is used to remove a config file from the
+        * Test Module specified by aTestModule. 
+        */
+        IMPORT_C TInt RemoveConfigFile( const TName& aTestModule,
+                                        const TFileName& aConfigFile );
+
+        /**
+        * Test cases are inquired by two-phased operation calling first the
+        * EnumerateTestCases method and then the GetTestCases. Test cases are
+        * inquired from Test Engine that will inquire them from Test Modules.
+        * EnumerateTestCases requests the needed array size for test cases that
+        * will be inquired by GetTestCases method. When the EnumerateTestCases
+        * is completed succesfully the GetTestCases method is called to
+        * retrieve test cases to CArrayFixFlat <TTestInfo> list object.
+        *
+        * TTestInfo defines individual test case and, if needed, a test set
+        * (TName iParent) where the test case belongs to. TTestInfo is used to
+        * create test case by calling RTestCase::Open that constructs the
+        * actual test case. Test case is then executed calling
+        * RTestCase::RunTestCase.
+        */
+        IMPORT_C void EnumerateTestCases( TCaseCount& aCount,
+                                          TRequestStatus& aStatus );
+
+        /**
+        * GetTestCases retrieves test cases from Test Modules to 
+        * aTestCaseBuffer that is a list consisting of several TTestInfo 
+        * objects. If this method is called without previously succesfully
+        * called EnumerateTestCases method, this function returns the
+        * KErrNotReady.
+        */
+        IMPORT_C TInt GetTestCases(
+                            CFixedFlatArray<TTestInfo>& aTestCaseBuffer );
+
+        /**
+        * Asynchronous request can be canceled with CancelAsyncRequest method.
+        * The aReqToCancel parameter defines the request that will be canceled.
+        */
+        IMPORT_C TInt CancelAsyncRequest( TTestEngineAsyncRequest aReqToCancel );
+        
+        /**
+        * Event is used to get and set events in STIF Test Framework.
+        * TEventIf defines the event request information.
+        */
+        IMPORT_C void Event( TEventIfPckg& aEvent,
+                             TRequestStatus& aStatus );
+
+        /**
+        * Used to get Logger's overwrite parameters.
+        */
+        IMPORT_C TInt OpenLoggerSession( TLoggerSettings& aLoggerSettings );
+
+        /**
+        * ErrorNotification obtains error notifications from test engine.
+        */
+        IMPORT_C void ErrorNotification( TErrorNotificationPckg& aError,
+                                         TRequestStatus& aStatus );
+
+        /**
+        * Add info about test case to test report.
+        */
+        IMPORT_C TInt AddTestCaseResultToTestReport(const TTestInfo& aTestInfo,
+                                                    const TFullTestResult& aTestResult,
+                                                    const TInt aError);
+        /**
+        * Update Log Configuration.
+        */
+        IMPORT_C TInt UpdateLogConfiguration(TDesC& aLogConfigList);
+       /**
+        * Update Engine Configuration.
+        */
+        IMPORT_C TInt UpdateEngineConfiguration(TDesC& aEngineConfigList);
+                                         
+    public:     // Functions from base classes
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+    
+// DESCRIPTION
+
+// RTestCase class represents a subsession with the RTestEngineServer.
+// Each RTestCase corresponds to a specific CTestExecution (a CObject
+// derived class) in the server. Messages are passed via the RTestEngineServer.
+// A RTestCase stores a handle from it's server side CTestExecution,
+// and uses this to identify the CTestExecution during communication.
+
+class RTestCase
+        : public RSubSessionBase 
+    {
+
+    public:     // Structured classes
+
+    public:     // Enumerations
+        enum TTestCaseAsyncRequest { ERunTestCase, ENotifyProgress, ENotifyRemoteType, };
+        
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Open creates a subsession for new test case. Test case is initialized
+        * using aTestCaseInfo parameter. The aTestCaseInfo is TTestInfoPckg 
+        * that is a packaged TTestInfo. TTestInfo is got from the Test Engine
+        * by calling RTestEngine::GetTestCases method.
+        * If there was previously called RemoveTestModule for the Test Module
+        * that is defined in aTestCaseInfo this method returns KErrLocked.
+        * This means that new test cases cannot be run from this Test Module
+        * and the user should inquire test cases available calling 
+        * RTestEngine::GetTestCases.
+        */
+        IMPORT_C TInt Open( RTestEngine& aServer,
+                                const TTestInfoPckg& aTestCaseInfo );
+
+        /**
+        * Closes the RTestCase subsession. Test case is normally closed
+        * immediately after the test case was completed.
+        */
+        IMPORT_C void Close();
+
+    public:     // New functions
+
+        /**
+        * RunTestCase is asynchronous method and it is completed when the test
+        * case is completed. Result of the test case is returned to 
+        * aTestResult. The aTestResult is TFullTestResultPckg that is a
+        * packaged TFullTestResult.
+        * The aStatus will have the completion result of this function. If the
+        * test case could be run (despite of succesfully or not) the KErrNone 
+        * is returned to aStatus.
+        */
+        IMPORT_C void RunTestCase( TFullTestResultPckg& aTestResult,
+                                    TRequestStatus& aStatus );
+
+        /**
+        * Pause suspends the execution of the test case. The subsession where
+        * the test case is run is suspended and thus the test case execution is
+        * suspended. Test case execution can be later resumed by calling 
+        * Resume.
+        */
+        IMPORT_C TInt Pause();
+
+        /**
+        * Resume is used to resume the test case suspended by previously called
+        * Pause method. The test case execution should be continued immediately
+        * when the Resume is called.
+        */
+        IMPORT_C TInt Resume();
+
+        /**
+        * NotifyProgress requests different progress information from the test
+        * case execution. This information can be printed to UI. The progress
+        * information is returned to aProgress. The aProgress is
+        * TTestProgressPckg that is a packaged TTestProgress 
+        */
+        IMPORT_C void NotifyProgress( TTestProgressPckg& aProgress,
+                                        TRequestStatus& aStatus );
+                                        
+        /**
+        * NotifyRemoteType requests enable message waiting.
+        */
+        IMPORT_C void NotifyRemoteType( TStifCommandPckg& aType,
+                                        TPckg<TInt>& aMsgSize,
+                                        TRequestStatus& aStatus );
+        /**
+        * NotifyRemoteMsg gets messages.
+        */
+        IMPORT_C TInt NotifyRemoteMsg( TDes8& aMessage,
+                                       TStifCommand aType );
+
+        /**
+        * Asynchronous request can be canceled with CancelAsyncRequest method.
+        * The aReqToCancel parameter defines the request that will be canceled.
+        */
+        IMPORT_C TInt CancelAsyncRequest( TTestCaseAsyncRequest aReqToCancel );
+
+    public:     // Functions from base classes
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+    public:     // Data
+    
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This contains the CFixedFlatArray class definitions.
+
+-------------------------------------------------------------------------------
+*/
+template <class T>
+class CFixedFlatArray 
+        :public CBase
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        inline static CFixedFlatArray<T>* NewL(const TInt aSize);
+
+        /**
+        * Destructor.
+        */
+        inline ~CFixedFlatArray();
+
+    public:     // New functions
+
+        /**
+        * Return descriptor containing array. Used in server calls
+        */
+        inline TPtr8& Des();
+
+        /**
+        * Returns CFixedFlatArray internal array. Used in server calls
+        */
+        inline T& operator[] (TInt aIndex) const;
+
+        /**
+        * Returns count
+        */
+        inline TInt Count() const;
+
+        /**
+        * Sets aBuf to array slot specified by aIndex
+        */
+        inline void Set( TInt aIndex, T& aBuf );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        inline void ConstructL(const TInt aSize);
+
+        /**
+        * C++ default constructor.
+        */
+        inline CFixedFlatArray();
+
+        /**
+        * Check that given index is correct.
+        */
+        inline void CheckIndex( TInt aIndex ) const;
+
+    protected:  // Data
+
+    private:    // Data
+        // Array
+        T*      iArray;
+
+        // Count
+        TInt    iCount;
+
+        // Buffer
+        HBufC8* iBuffer;
+        TPtr8   iBufferPtr;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#include <TestEngineClient.inl>
+
+
+#endif // TEST_ENGINE_CLIENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/TestEngineClient.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,303 @@
+/*
+* 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: This file contains implementation of TestEngineClient's 
+* inline functions.
+*
+*/
+
+#ifndef TEST_ENGINE_CLIENT_INL
+#define TEST_ENGINE_CLIENT_INL
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+/*
+-------------------------------------------------------------------------------
+
+    Class:CFixedFlatArray
+
+    Method: CFixedFlatArray
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+template <class T>
+CFixedFlatArray<T>::CFixedFlatArray() :
+    iArray( NULL ),
+    iBufferPtr(0,0)
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFixedFlatArray
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: const TInt aCount: in: Count of contents
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation for iArray of iBuffer fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+template <class T>
+void CFixedFlatArray<T>::ConstructL( const TInt aCount )
+    {
+
+    iCount = aCount;
+    iArray = new (ELeave) T[iCount];
+
+    const TInt size = iCount * sizeof (T);
+    iBuffer = HBufC8::NewMaxL ( size );
+
+    iBufferPtr.Set( iBuffer->Des() );
+    iBufferPtr.SetLength( size );
+    iBufferPtr.Set( (TUint8*) iArray, size,size );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFixedFlatArray
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CFixedFlatArray<T>: Array of CFixedFlatArray<T> objects
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+template <class T>
+CFixedFlatArray<T>* CFixedFlatArray<T>::NewL(TInt aSize) 
+    {
+    CFixedFlatArray<T>* self = new ( ELeave ) CFixedFlatArray<T>();
+    CleanupStack::PushL( self );
+    self->ConstructL(aSize);
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFixedFlatArray
+
+    Method: ~CFixedFlatArray
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/    
+template <class T>
+CFixedFlatArray<T>::~CFixedFlatArray()
+    {    
+    delete[] iArray;
+    delete iBuffer;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFixedFlatArray
+
+    Method: Des
+
+    Description: Returns descriptor for array
+
+    Parameters: None
+
+    Return Values: TPtr8&: Descriptor for array
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/ 
+template <class T>
+TPtr8& CFixedFlatArray<T>::Des()
+    {   
+    return iBufferPtr;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFixedFlatArray
+
+    Method: operator[]
+
+    Description: Returns index operator
+
+    Parameters: TInt aIndex: in: Index of object to be returned
+
+    Return Values: T&: Reference to requested object
+
+    Errors/Exceptions: Panics if aIndex is out of range
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/ 
+template <class T>
+T& CFixedFlatArray<T>::operator[] ( TInt aIndex ) const
+    {
+    CheckIndex( aIndex );
+
+    return iArray[aIndex];
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFixedFlatArray
+
+    Method: Count
+
+    Description: Returns count
+
+    Parameters: None
+
+    Return Values: TInt: iCount
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+template <class T>
+TInt CFixedFlatArray<T>::Count() const
+    {
+    return iCount;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFixedFlatArray
+
+    Method: Set
+
+    Description: Set buffer to array.
+
+    Parameters: TInt aIndex: in: Index
+                T& aBuf: in: Buffer
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+template <class T>
+void CFixedFlatArray<T>::Set( TInt aIndex, T& aBuf )
+    {
+    CheckIndex( aIndex );
+
+    iArray[aIndex] = aBuf;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFixedFlatArray
+
+    Method: CheckIndex
+
+    Description: Set buffer to array.
+
+    Parameters: TInt aIndex: in: Index to be checked
+
+    Return Values: None
+
+    Errors/Exceptions: Panics if index is incorrect
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+template <class T>
+void CFixedFlatArray<T>::CheckIndex( TInt aIndex ) const
+    {
+    if ( aIndex < 0 || aIndex >= iCount )
+        {
+        User::Panic( _L( "CFixedFlatArray: Array index out of range" ), KErrArgument );
+        }
+
+    }
+
+#endif      // TEST_ENGINE_CLIENT_INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/TestScripterInternal.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,234 @@
+/*
+* 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: This file contains the header file of the 
+* CScriptBase.
+*
+*/
+
+#ifndef SCRIPTRUNNERINTERNAL_H
+#define SCRIPTRUNNERINTERNAL_H
+
+// INCLUDES
+#include <StifTestModule.h>
+#include <StifLogger.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+#define ENTRY(A,B) \
+	{ (TText*) L ##A, (StifTestFunction) &B }
+
+// DATA TYPES
+
+// For function pointer operations. If need a new method that calls
+// from testscriptclass the testscripter. Add method's enum definition
+// here and implement the new method also TestScripterInternal.h need
+// new implementations.
+enum TStifTSCallBackType
+    {
+    EStifTSCallClass,
+    EStifTSGetObject,
+    };
+
+// FORWARD DECLARATIONS
+class CStifItemParser;
+class CTestScripter;
+class CScriptBase;
+
+// DATA TYPES
+typedef TInt (CScriptBase::* StifTestFunction)( CStifItemParser& );    
+class TStifFunctionInfo
+    {
+    public:
+        const TText* iFunctionName;
+        StifTestFunction iMethod;
+    };
+
+// FUNCTION PROTOTYPES
+// (Function pointer) Used to forward operations from test script class
+// to TestScripter.
+typedef TInt (*CallBackFunc)( CTestScripter* aTestScripter,
+                              TStifTSCallBackType aType,
+                              const TDesC& aLine );
+// CLASS DECLARATION
+// None
+
+// DESCRIPTION
+// This a Test Module interface template 
+// that does not really do anything.
+
+class CScriptBase 
+        :public CBase
+    {
+    public: // Enumerations
+       
+    private: // Enumerations
+       
+    public: // Constructors and destructor          
+    
+    public: // New functions
+       
+        /**
+        * Get reference to TestModuleIf API.
+        */ 
+        IMPORT_C CTestModuleIf& TestModuleIf();
+        
+        /**
+        * Signal TestScripter to continue from waittestclass.
+        */
+        IMPORT_C void Signal( TInt aError = KErrNone );
+        
+        // Called from test class. TestScripter forwards
+        // operations to other test class object.
+        // aLine: in: <object name> <method name> <parameters>
+        IMPORT_C TInt CallTestClass( const TDesC& aLine );
+        
+        // Get TestClass object pointer. Use CallTestClass instead if 
+        // you can, use this only with your own risk!!!
+        // aObjectName: in: <object name>
+        IMPORT_C CScriptBase* GetTestObject( const TDesC& aObjectName );
+        
+        // Result description can be set from within the test class method
+        IMPORT_C void SetResultDescription(const TDesC& aDescription);
+        
+    public: 
+        
+        /**
+        * Runs a script line, must be implemented in derived class.
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem ) = 0;  
+
+        /**
+        * Destructor of CScriptBase.
+        */
+        virtual ~CScriptBase(){ iSignalErrors.Reset(); iSignalErrors.Close();  };
+                
+    protected: // New functions
+
+        /**
+        * Constructor.
+        */
+        IMPORT_C CScriptBase( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Internal fuction to run specified method.
+        */
+        IMPORT_C virtual TInt RunInternalL( 
+            TStifFunctionInfo const aFunctions[], 
+            TInt aCount, 
+            CStifItemParser& aItem );
+
+        /**
+         * Internal fuction to get const value defined in 
+         * [Define]...[Enddefine] section of script file
+         */        
+        IMPORT_C TInt GetConstantValue( const TDesC& aName, TDes& aValue );
+
+
+        /**
+         * Internal fuction to get const value defined in 
+         * [Define]...[Enddefine] section of script file
+         */        
+        IMPORT_C TInt GetConstantValue( const TDesC& aName, TInt& aValue );
+
+
+        /**
+         * Internal fuction to get const value defined in 
+         * [Define]...[Enddefine] section of script file
+         */        
+        IMPORT_C TInt GetConstantValue( const TDesC& aName, TReal& aValue );
+        
+        /**
+         * Internal fuction to set value of local variable 
+         */        
+        IMPORT_C TInt SetLocalValue(const TDesC& aName, const TDesC& aValue);
+
+        /**
+         * Internal fuction to set value of local variable 
+         */        
+        IMPORT_C TInt SetLocalValue(const TDesC& aName, const TInt aValue);
+
+        /**
+         * Internal fuction to set value of local variable 
+         */        
+        IMPORT_C TInt SetLocalValue(const TDesC& aName, const TReal aValue);
+
+        /**
+         * Internal fuction to get value of local variable 
+         */        
+        IMPORT_C TInt GetLocalValue(const TDesC& aName, TDes& aValue);
+
+        /**
+         * Internal fuction to get value of local variable 
+         */        
+        IMPORT_C TInt GetLocalValue(const TDesC& aName, TInt& aValue);
+
+        /**
+         * Internal fuction to get value of local variable 
+         */        
+        IMPORT_C TInt GetLocalValue(const TDesC& aName, TReal& aValue);
+        
+    protected: // Functions from base classes
+        
+    private:
+    
+        IMPORT_C void EnableSignal( TRequestStatus& aStatus );           
+        
+        IMPORT_C void CancelSignal();
+        
+        // This set from TestScripter(Initializes function pointer to use)
+        IMPORT_C void SetScripter( CallBackFunc aFunc, CTestScripter* aTestScripter );
+
+    public: // Data
+        
+    protected: // Data
+    
+        /**
+        * Logger.
+        */
+        CStifLogger*    iLog;
+
+        /**
+        * Array for handling multiple 'waittestclass' given from testclass's
+        * test configure file.
+        */
+        RArray<TInt> iSignalErrors;
+
+    private: // Data
+        // Backpointer
+        CTestModuleIf& iTestModuleIf;
+        
+        // Completed when test class signals continue script execution
+        TRequestStatus* iStatus; 
+
+        // Backpointer to TestScripter
+        CallBackFunc iFunc;
+
+        // Backpointer
+        CTestScripter* iTestScripter;
+
+    public: // Friend classes
+        
+    protected: // Friend classes
+        
+    private: // Friend classes
+        friend class CTestScripter;
+        friend class CTestContinue;
+        
+    };
+
+#endif      // SCRIPTRUNNER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/TestServerClient.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,471 @@
+/*
+* 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: This file contains the header file of the 
+* RTestServer, RTestModule and RTestExecution.
+*
+*/
+
+#ifndef TEST_SERVER_CLIENT_H
+#define TEST_SERVER_CLIENT_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "TestEngineClient.h"
+#include "StifTestEventInterface.h"
+#include "StifTFwIfProt.h"
+
+// CONSTANTS
+// Global mutex name
+_LIT( KStifTestServerStartupMutex, "KStifTestServerStartupMutex" );
+
+_LIT( KDefaultExeName, "testserverstarter.exe" );
+_LIT( KDefaultUiExeName, "uitestserverstarter.exe" );
+
+// TestScripter related informations
+const TInt KTestScripterNameLength = 12;    // In STIF are two same name
+_LIT( KTestScripterName, "testscripter" );  // constants, change both when
+                                            // needed !!!
+
+// TestCombiner related information
+_LIT( KTestCombinerName, "testcombiner" );
+
+// Test module thread heap and stack sizes
+const TUint32 KTestThreadMinHeap = 4096;     // 4K heap min
+const TUint32 KTestThreadMaxHeap = 1048576;  // 1M heap max
+const TUint32 KStackSize         = 16384;    // 16K stack
+
+// MACROS
+
+// DATA TYPES
+// Opcodes used in message passing between client and server
+enum TTestServerRequests
+    {
+    // RTestServer requests
+    ETestServerCloseSession,
+    ETestServerGetServerThreadId,
+    ETestServerPassEngineSessionSettings,
+    
+    // RTestModule requests
+    ETestModuleCreateSubSession,
+    ETestModuleCloseSubSession,
+    ETestModuleEnumerateTestCases,
+    ETestModuleGetTestCases,
+    ETestModuleCancelAsyncRequest,
+    ETestModuleErrorNotification,
+
+    // RTestExecution requests
+    ETestExecutionCreateSubSession,
+    ETestExecutionCloseSubSession,
+    ETestExecutionRunTestCase,      
+    ETestExecutionPause,
+    ETestExecutionResume,
+    ETestExecutionNotifyProgress,
+    ETestExecutionNotifyData,
+    ETestExecutionCancelAsyncRequest,
+    ETestExecutionNotifyEvent,
+    ETestExecutionNotifyRemoteCmd,
+    ETestExecutionReadRemoteCmdInfo,
+    ETestExecutionNotifyCommand,
+    };
+
+// 
+typedef TPckgBuf<TInt> TCaseSize;
+
+// FORWARD DECLARATIONS
+class CTestThreadContainerRunnerFactory;
+// FUNCTION PROTOTYPES
+
+// Function for starting the TestServer Server.
+IMPORT_C TInt StartNewServer( const TFileName& aModuleFileName, 
+                              TFileName& aServerName
+                            );
+
+// Function for starting the TestServer Server in either in
+// current thread or in new thread
+IMPORT_C TInt StartNewServer( const TFileName& aModuleFileName,
+                              TFileName& aServerName,
+                              const TBool aInNewThread,
+                              RSemaphore aSynchronisation
+                            );
+
+IMPORT_C TInt StartNewServer( const TFileName& aModuleFileName,
+					        TFileName& aServerName,
+					        const TBool aInNewThread,
+					        RSemaphore aSynchronisation,
+					        TBool aUiTestingServer,
+					        CTestThreadContainerRunnerFactory* aTestThreadContainerRunnerFactory
+					      );
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// RTestServer is a client class of Test Server
+// The connect function starts the server, if it not already running.
+// An RSessionBase sends messages to the server with the function 
+// RSessionBase::SendReceive();
+// specifying an opcode( TTestServerReq ) and array of argument pointers.
+
+class RTestServer
+        :public RSessionBase 
+    {
+    public: // Enumerations
+		// None
+
+    private: // Enumerations
+		// None
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Constructor.
+        */
+        IMPORT_C RTestServer();
+
+        /**
+        * Closes the RTestServer session.
+        */
+        IMPORT_C void Close();
+
+    public: // New functions
+        
+        /**
+        * Connect method creates new RTestServer session that is used to manage
+        * the test case execution.
+        */
+        IMPORT_C TInt Connect( const TFileName& aModuleName,
+                               const TDesC& aConfigFile);
+
+        /**
+        * Version returns the client side version number from the RTestServer.
+        */
+        IMPORT_C TVersion Version() const;
+
+        /**
+        * GetServerThreadId returns the server thread id from the RTestServer.
+        */
+        IMPORT_C TInt GetServerThreadId( TThreadId& aId );
+        
+        IMPORT_C TInt PassEngineSessionSettings( const TEngineSettings& aEngineSessionSettings );
+    public: // Functions from base classes
+        // None
+        
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:  // Functions from base classes
+        // None
+
+        /**
+        * Find exe(CapsModifier) from file system
+        */
+        TInt FindExeL( TFileName aModuleName, TFileName& aPathAndExeModule );
+
+        /**
+        * Get caps modifier module name from TestScripter's test case(config)
+        * file.
+        */
+        TInt GetCapsModifier( const TDesC& aConfigFile,
+                                    TFileName& aCapsModifierName );
+
+    public:     // Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // None
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+    
+
+// DESCRIPTION
+
+// RTestModule class represents a subsession with the RTestServer.
+// Each RTestModule corresponds to a specific CTestModule( a CObject derived
+// class ) in the server. Messages are passed via the RTestServer.
+// A RTestModule stores a handle from it's server side CTestModule, and uses
+// this to identify the CTestModule during communication.
+
+class RTestModule
+        :public RSubSessionBase 
+    {
+    public: // Enumerations
+		// None
+
+    private: // Enumerations
+		// None
+
+    public:  // Constructors and destructor
+		// None
+
+    public: // New functions
+
+        /**
+        * Open creates a subsession to Test Server and opens handle.		
+        * The RTestServer server session shall be created by calling
+        * RTestServer::Connect before calling this function to create new
+        * RTestModule subsession.
+        */
+        IMPORT_C TInt Open( RTestServer& aServer, TFileName& aIniFile );
+
+        /**
+        * Closes the RTestModule subsession.
+        */
+        IMPORT_C void Close();
+
+        /**
+        * EnumerateTestCases requests the needed array size for test cases that
+        * will be inquired by GetTestCases method. The aConfigFile specifies the
+        *( optional ) config file where test cases are defined for this query.
+        * When the EnumerateTestCases is completed succesfully the GetTestCases
+        * method is called to retrieve test cases to
+        * CArrayFixFlat<RTestEngine::TTestInfo> list object.
+        */
+        IMPORT_C void EnumerateTestCases( TDesC& aConfigFile, 
+                                          TCaseSize& aCount,
+                                          TRequestStatus& aStatus );
+
+        /**
+        * GetTestCases is used to synchronously get test cases from Test Server.
+        * The list of test cases is retrieved to aTestCaseBuffer. Test Engine
+        * allocates needed memory for the test case array by calling
+        * EnumerateTestCases to inquire needed size of aTestCaseBuffer.
+        *
+        * If this method is called without previously succesfully called
+        * EnumerateTestCases the Test Server shall return KErrNotReady.
+        */              
+        IMPORT_C TInt GetTestCases( CFixedFlatArray<TTestCaseInfo>& aTestCaseBuffer );
+
+        
+        /**
+        *  
+        */
+        IMPORT_C void ErrorNotification( TErrorNotificationPckg& aError,                                           
+                                         TRequestStatus& aStatus );
+		
+        /**
+        * Asynchronous request can be canceled with CancelAsyncRequest method.
+        * The aReqToCancel parameter defines the request that will be canceled.
+        */
+        IMPORT_C TInt CancelAsyncRequest( TInt aReqToCancel );
+
+    public: // Functions from base classes
+        // None
+        
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:  // Functions from base classes
+        // None
+
+    public:     // Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // None
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+    
+
+// DESCRIPTION
+
+// RTestExecution class represents a subsession with the RTestServer.
+// Each RTestExecution corresponds to a specific CTestExecution( a CObject
+// derived class ) in the server. Messages are passed via the RTestServer.
+// A RTestExecution stores a handle from it's server side CTestExecution,
+// and uses this to identify the CTestExecution during communication.
+
+class RTestExecution
+        :public RSubSessionBase 
+    {
+    public: // Enumerations
+		// None
+
+    private: // Enumerations
+		// None
+
+    public:  // Constructors and destructor
+        // None       
+
+    public: // New functions
+
+        /**
+        * Open creates a subsession for new test case. Test case to be executed
+        * is specified by aTestCaseNumber. The aConfig specifies the optional
+        * config file where the test case is defined. Test cases that can be
+        * executed are retrieved from the Test Server by calling two-phased
+        * RTestModule::GetTestCases operation.
+        */
+        IMPORT_C TInt Open( RTestServer& aServer,
+                            const TInt aCaseNumber,
+                            const TFileName& aConfig );
+
+        /**
+        * Closes the RTestExecution subsession. Test case is normally closed
+        * immediately after the test case was completed.
+        */
+        IMPORT_C void Close();
+        
+         /**
+        * RunTestCase is used to execute the test case previously initialized by
+        * Open method. RunTestCase is asynchronous method and it is completed
+        * when the test case is completed.
+        * The result of the test case is returned to aStatus.
+        */
+        IMPORT_C void RunTestCase( TFullTestResultPckg& aResult,
+                                   TRequestStatus& aStatus );
+
+        /**
+        * Pause suspends the execution of the test case. The subsession where
+        * the test case is run will be suspended and thus the test case
+        * execution is suspended. The test case execution can be later resumed
+        * by calling Resume.
+        */
+        IMPORT_C TInt Pause();
+
+        /**
+        * Resume is used to resume the test case suspended by previously called
+        * Pause method. The test case execution should be continued immediately
+        * after the Resume is called.
+        */
+        IMPORT_C TInt Resume();
+
+        /**
+        * NotifyProgress requests different progress information from the Test
+        * DLL. This information can be e.g. printed to UI. Progress information
+        * is returned to aProgress. The aProgress is TTestProgressPckg that is
+        * a packaged TTestProgress.
+        */
+        IMPORT_C TInt NotifyProgress( TTestProgressPckg& aProgress,
+                                      TRequestStatus& aStatus );
+
+        /**
+        * NotifyData is used to receive different data from the Test Server,
+        * e.g. images or web pages which can be then viewed to tester or
+        * forwarded to some kind of comparison tool. 
+        */
+        IMPORT_C TInt NotifyData( TDes8& aData, TRequestStatus& aStatus );
+
+        /**
+        * Asynchronous request can be canceled with CancelAsyncRequest method.
+        * The aReqToCancel parameter defines the request that will be canceled.
+        */
+        IMPORT_C TInt CancelAsyncRequest( TInt aReqToCancel );
+
+        /**
+        * NotifyEvent is used to control event system.
+        */
+        IMPORT_C TInt NotifyEvent( TEventIfPckg& aEvent,
+                                   TRequestStatus& aStatus,
+                                   TInt aError=KErrNone );
+        
+        /**
+        * NotifyRemoteCmd is used to get notify.
+        */
+        IMPORT_C TInt NotifyRemoteCmd( TStifCommandPckg& aRemoteCommand,
+                                       TPckg<TInt>& aMsgSizePckg,
+                                       TRequestStatus& aStatus );
+                                   
+        /**
+        * ReadRemoteCmdInfo for remote message.
+        */
+        IMPORT_C TInt ReadRemoteCmdInfo( TDes8& aRemoteMsg,
+                                         TStifCommand aType,
+                                         TInt aError = KErrNone );
+
+        /**
+        * NotifyCommand is used to control commands from the test case.
+        * It was created to allow test case to kill itself. DEPRECATED !!
+        * Use NotifyCommand2 instead.
+        */
+        IMPORT_C TInt NotifyCommand(TCommandPckg& aCommandPckg,
+                                    TBuf8<KMaxCommandParamsLength>& aParamsPckg,
+                                    TRequestStatus& aStatus,
+                                    TInt aError = KErrNone);
+        
+        /**
+        * NotifyCommand is used to control commands from the test case.
+        * It was created to allow test case to kill itself.
+        */
+        IMPORT_C TInt NotifyCommand2(TCommandPckg& aCommandPckg,
+                                    TDes8& aParamsPckg,
+                                    TRequestStatus& aStatus,
+                                    TInt aError = KErrNone);
+
+    public: // Functions from base classes
+        // None
+        
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:  // Functions from base classes
+        // None
+
+    public:     // Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // None
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+    };
+    
+
+#endif // TEST_SERVER_CLIENT_H
+    
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/TestThreadContainerRunnerFactory.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,146 @@
+/*
+* 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: This file contains the header file of the 
+* CTestThreadContainerRunnerFactory class implementations.
+*
+*/
+
+#ifndef TESTTHREADCONTAINERRUNNERFACTORY_H_
+#define TESTTHREADCONTAINERRUNNERFACTORY_H_
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestThreadContainerRunner;
+class CUiEnvProxy;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestThreadContainerRunnerFactory class interface.
+class CTestThreadContainerRunnerFactory: public CActive
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+		/**
+		 * .Current operation type
+		 */
+		enum TOperationType { ECreate, // Create TestModuleContainer
+							  EDelete, // Delete TestModuleContainer
+							  ENone    // No operation
+							};
+	
+	public:  // Constructors and destructor
+		/**
+		 * C++ destructor.
+		 */
+		~CTestThreadContainerRunnerFactory();
+	
+	private:  // Constructors and destructor
+	    // None
+	
+	public: // New functions
+	    /**
+	    * NewL is first phase of two-phased constructor.
+	    */		
+		IMPORT_C static CTestThreadContainerRunnerFactory* NewL( TThreadId aThreadId, CActiveScheduler* aScheduler, CUiEnvProxy* aUiEnvProxy );
+	
+		/**
+		 * Creates new CTestThreadContainerRunner object.
+		 */
+		CTestThreadContainerRunner* CreateL();
+		
+		/**
+		 * Deletes CTestThreadContainerRunner object.
+		 */
+		void DeleteL( CTestThreadContainerRunner* aTestThreadContainerRunner );
+
+		/**
+		 * Gets UIEnvProxy.
+		 */
+		CUiEnvProxy* GetUiEnvProxy();
+	public: // Functions from base classes
+		/**
+		 * RunL derived from CActive handles the completed requests.
+		 */
+		void RunL();
+
+		/**
+		 * DoCancel derived from CActive handles the Cancel.
+		 */
+		void DoCancel();
+
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+        
+    private:	// New functions
+	    /**
+	    * C++ default constructor.
+	    */
+		CTestThreadContainerRunnerFactory();
+
+		/**
+	    * By default Symbian OS constructor is private.
+	    */
+		void ConstructL( TThreadId aThreadId, CActiveScheduler* aScheduler, CUiEnvProxy* aUiEnvProxy );
+
+    private:	// Functions from base classes
+        // None    
+    
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+		TThreadId iThreadId;				// Main thread id.
+		CActiveScheduler* iScheduler;		// Active scheduler from main thread.
+		CUiEnvProxy* iUiEnvProxy;			// UIEnvProxy.
+		
+		CTestThreadContainerRunner* iTestThreadContainerRunner; // Temporary pointer for CTestThreadContainerRunner
+																// which was created or should be delated.
+		TOperationType iOperation;			// Indicates current operation.
+		RSemaphore iOperationEndSemaphore;	// Operation end semaphore
+		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None
+	};
+
+
+#endif /*TESTTHREADCONTAINERRUNNERFACTORY_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/TestclassAssert.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,350 @@
+/*
+* 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: This file contains the header file of the testclass
+* assert macros.
+*
+*/
+
+#ifndef TestclassAssert_MACROS_H
+#define TestclassAssert_MACROS_H
+
+_LIT( KAssertFailedEquals, "AssertEquals Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotEquals, "AssertNotEquals Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNull, "AssertNull Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotNull, "AssertNotNull Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedSame, "AssertSame Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotSame, "AssertNotSame Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedTrue, "AssertTrue Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedFalse, "AssertFalse Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedNotLeaves, "AssertNotLeaves Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedLeaves, "AssertLeaves Failed [F:%s][L:%d]" );
+_LIT( KAssertFailedLeavesWith, "AssertLeavesWith Failed [F:%s][L:%d]" );
+
+
+#ifdef _UNICODE
+	#define __STIF_WIDEN2(x) L ## x
+	#define __STIF_WIDEN(x) __STIF_WIDEN2(x)
+	#define __STIF_DBG_FILE__ __STIF_WIDEN(__FILE__)
+#else
+	#define __STIF_DBG_FILE__ __FILE__
+#endif
+
+#ifdef _UNICODE
+	#define __STF_WIDEN2(x) L ## x
+	#define __STF_WIDEN(x) __STF_WIDEN2(x)
+	#define __STF_DBG_FILE__ __STF_WIDEN(__FILE__)
+#else
+	#define __STF_DBG_FILE__ __FILE__
+#endif
+
+// Logs to the STIF log file AND to the RDebug
+#define STIF_LOG( aMessage ) \
+    iLog->Log( _L( aMessage ) ); RDebug::Print( _L( aMessage ) );
+    
+// Logs to the STF log file AND to the RDebug
+#define STF_LOG( aMessage ) \
+    iLog->Log( _L( aMessage ) ); RDebug::Print( _L( aMessage ) );	
+
+/*********************************************************************************
+ * STF Assert Macros
+ *********************************************************************************/
+#define __STF_ASSERT_SHARED( aFunction, aMessage ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STF_DBG_FILE__, __LINE__ );\
+		return KErrGeneral;\
+		}
+
+#define __STF_ASSERT_SHARED_RET( aFunction, aMessage, aFailedReturn ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STF_DBG_FILE__, __LINE__ );\
+		return aFailedReturn;\
+		}
+		
+
+#define STF_ASSERT_EQUALS( aExpected, aActual ) \
+	__STF_ASSERT_SHARED( AssertEquals( aExpected, aActual ) , KAssertFailedEquals );
+
+#define STF_ASSERT_EQUALS_RET( aExpected, aActual, aFailedRet ) \
+	__STF_ASSERT_SHARED_RET( AssertEquals( aExpected, aActual ) , KAssertFailedEquals, aFailedRet );
+
+#define STF_ASSERT_NOT_EQUALS( aExpected, aActual ) \
+	__STF_ASSERT_SHARED( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals );
+
+#define STF_ASSERT_NOT_EQUALS_RET( aExpected, aActual, aFailedRet ) \
+	__STF_ASSERT_SHARED_RET( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals, aFailedRet );
+
+#define STF_ASSERT_NULL( aPtr ) \
+	__STF_ASSERT_SHARED( AssertNull( aPtr ), KAssertFailedNull );
+
+#define STF_ASSERT_NULL_RET( aPtr, aFailedRet ) \
+	__STF_ASSERT_SHARED_RET( AssertNull( aPtr ), KAssertFailedNull, aFailedRet );
+
+#define STF_ASSERT_NOT_NULL( aPtr ) \
+	__STF_ASSERT_SHARED( !AssertNull( aPtr ), KAssertFailedNotNull );
+
+#define STF_ASSERT_NOT_NULL_RET( aPtr, aFailedRet ) \
+	__STF_ASSERT_SHARED_RET( !AssertNull( aPtr ), KAssertFailedNotNull, aFailedRet );
+
+#define STF_ASSERT_SAME( aExpectedPtr, aActualPtr ) \
+	__STF_ASSERT_SHARED( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame );
+
+#define STF_ASSERT_SAME_RET( aExpectedPtr, aActualPtr, aFailedRet ) \
+	__STF_ASSERT_SHARED_RET( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame, aFailedRet );
+
+#define STF_ASSERT_NOT_SAME( aExpectedPtr, aActualPtr ) \
+	__STF_ASSERT_SHARED( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame );
+
+#define STF_ASSERT_NOT_SAME_RET( aExpectedPtr, aActualPtr, aFailedRet ) \
+	__STF_ASSERT_SHARED_RET( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame, aFailedRet );
+
+#define STF_ASSERT_TRUE( aCondition ) \
+	__STF_ASSERT_SHARED( AssertTrue( aCondition ), KAssertFailedTrue );
+
+#define STF_ASSERT_TRUE_RET( aCondition, aFailedRet ) \
+	__STF_ASSERT_SHARED_RET( AssertTrue( aCondition ), KAssertFailedTrue, aFailedRet );
+
+#define STF_ASSERT_FALSE( aCondition ) \
+	__STF_ASSERT_SHARED( !AssertTrue( aCondition ), KAssertFailedFalse );
+
+#define STF_ASSERT_FALSE_RET( aCondition, aFailedRet ) \
+	__STF_ASSERT_SHARED_RET( !AssertTrue( aCondition ), KAssertFailedFalse, aFailedRet );
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STF_ASSERT_NOT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves ); \
+    }
+
+#define STF_ASSERT_NOT_LEAVES_RET( aStatement, aFailedRet ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED_RET( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves, aFailedRet ); \
+    }
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STF_ASSERT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves ); \
+    }
+
+#define STF_ASSERT_LEAVES_RET( aStatement, aFailedRet ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED_RET( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves, aFailedRet ); \
+    }
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STF_ASSERT_LEAVES_WITH( aLeaveCode, aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves ); \
+    }
+
+#define STF_ASSERT_LEAVES_WITH_RET( aLeaveCode, aStatement, aFailedRet ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STF_ASSERT_SHARED_RET( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves, aFailedRet ); \
+    }
+
+#define STF_ASSERT_PANIC( aPanicCode, aStatement ) \
+	{ \
+	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
+	aStatement; \
+	}
+	
+/*********************************************************************************
+ * STIF Assert Macros
+ *********************************************************************************/
+#define __STIF_ASSERT_SHARED( aFunction, aMessage ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\
+		return KErrGeneral;\
+		}
+
+#define __STIF_ASSERT_SHARED_RET( aFunction, aMessage, aFailedReturn ) \
+	if(!aFunction) \
+		{ \
+		iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\
+		return aFailedReturn;\
+		}
+		
+
+#define STIF_ASSERT_EQUALS( aExpected, aActual ) \
+	__STIF_ASSERT_SHARED( AssertEquals( aExpected, aActual ) , KAssertFailedEquals );
+
+#define STIF_ASSERT_EQUALS_RET( aExpected, aActual, aFailedRet ) \
+	__STIF_ASSERT_SHARED_RET( AssertEquals( aExpected, aActual ) , KAssertFailedEquals, aFailedRet );
+
+#define STIF_ASSERT_NOT_EQUALS( aExpected, aActual ) \
+	__STIF_ASSERT_SHARED( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals );
+
+#define STIF_ASSERT_NOT_EQUALS_RET( aExpected, aActual, aFailedRet ) \
+	__STIF_ASSERT_SHARED_RET( !AssertEquals( aExpected, aActual ) , KAssertFailedNotEquals, aFailedRet );
+
+#define STIF_ASSERT_NULL( aPtr ) \
+	__STIF_ASSERT_SHARED( AssertNull( aPtr ), KAssertFailedNull );
+
+#define STIF_ASSERT_NULL_RET( aPtr, aFailedRet ) \
+	__STIF_ASSERT_SHARED_RET( AssertNull( aPtr ), KAssertFailedNull, aFailedRet );
+
+#define STIF_ASSERT_NOT_NULL( aPtr ) \
+	__STIF_ASSERT_SHARED( !AssertNull( aPtr ), KAssertFailedNotNull );
+
+#define STIF_ASSERT_NOT_NULL_RET( aPtr, aFailedRet ) \
+	__STIF_ASSERT_SHARED_RET( !AssertNull( aPtr ), KAssertFailedNotNull, aFailedRet );
+
+#define STIF_ASSERT_SAME( aExpectedPtr, aActualPtr ) \
+	__STIF_ASSERT_SHARED( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame );
+
+#define STIF_ASSERT_SAME_RET( aExpectedPtr, aActualPtr, aFailedRet ) \
+	__STIF_ASSERT_SHARED_RET( AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedSame, aFailedRet );
+
+#define STIF_ASSERT_NOT_SAME( aExpectedPtr, aActualPtr ) \
+	__STIF_ASSERT_SHARED( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame );
+
+#define STIF_ASSERT_NOT_SAME_RET( aExpectedPtr, aActualPtr, aFailedRet ) \
+	__STIF_ASSERT_SHARED_RET( !AssertSame( aExpectedPtr, aActualPtr ), KAssertFailedNotSame, aFailedRet );
+
+#define STIF_ASSERT_TRUE( aCondition ) \
+	__STIF_ASSERT_SHARED( AssertTrue( aCondition ), KAssertFailedTrue );
+
+#define STIF_ASSERT_TRUE_RET( aCondition, aFailedRet ) \
+	__STIF_ASSERT_SHARED_RET( AssertTrue( aCondition ), KAssertFailedTrue, aFailedRet );
+
+#define STIF_ASSERT_FALSE( aCondition ) \
+	__STIF_ASSERT_SHARED( !AssertTrue( aCondition ), KAssertFailedFalse );
+
+#define STIF_ASSERT_FALSE_RET( aCondition, aFailedRet ) \
+	__STIF_ASSERT_SHARED_RET( !AssertTrue( aCondition ), KAssertFailedFalse, aFailedRet );
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_NOT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves ); \
+    }
+
+#define STIF_ASSERT_NOT_LEAVES_RET( aStatement, aFailedRet ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_RET( AssertEquals( __leaveValue, KErrNone ), KAssertFailedNotLeaves, aFailedRet ); \
+    }
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_LEAVES( aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves ); \
+    }
+
+#define STIF_ASSERT_LEAVES_RET( aStatement, aFailedRet ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_RET( !AssertEquals( __leaveValue, KErrNone ), KAssertFailedLeaves, aFailedRet ); \
+    }
+
+// Eclosing block is used to create the scope for the __leaveValue	
+#define STIF_ASSERT_LEAVES_WITH( aLeaveCode, aStatement ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves ); \
+    }
+
+#define STIF_ASSERT_LEAVES_WITH_RET( aLeaveCode, aStatement, aFailedRet ) \
+    { \
+    TRAPD( __leaveValue, aStatement ); \
+    __STIF_ASSERT_SHARED_RET( AssertEquals( __leaveValue, aLeaveCode ), KAssertFailedLeaves, aFailedRet ); \
+    }
+
+#define STIF_ASSERT_PANIC( aPanicCode, aStatement ) \
+	{ \
+	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
+	aStatement; \
+	}
+
+template <class T>
+inline TBool AssertEquals(const T& aExpected, const T& aActual)
+/**
+ * AssertEquals
+ *
+ *
+ * @param aExpected - Expected result
+ * @param aActual - Actual result
+ * @return - True if equal
+ */
+	{
+	if( aExpected==aActual )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+template <class T>
+inline TBool AssertNull(const T* aPtr)
+/**
+ * AssertNull
+ *
+ *
+ * @param aPtr - Pointer
+ * @return - True if NULL
+ */
+	{
+	if( aPtr==NULL )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+template <class T>
+inline TBool AssertSame(const T* aExpectedPtr, const T* aActualPtr)
+/**
+ * AssertSame
+ *
+ *
+ * @param aExpectedPtr - Expected pointer
+ * @param aActualPtr - Actual pointer
+ * @return - True if equal
+ */
+	{
+	if( aExpectedPtr==aActualPtr )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+inline TBool AssertTrue(const TBool& aCondition)
+/**
+ * AssertTrue
+ *
+ *
+ * @param aCondition - Condition
+ * @return - True if aCondition is true
+ */
+	{
+	if( !aCondition )
+		{
+		return EFalse;
+		}
+	return ETrue;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/UIEngine.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,294 @@
+/*
+* 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: This file contains the header file of the UIEngine.
+*
+*/
+
+#ifndef UI_ENGINE_H
+#define UI_ENGINE_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifLogger.h>
+#include <StifTFwIf.h>
+
+#include <TestEngineClient.h>
+#include <StifTFwIfProt.h>
+
+
+// CONSTANTS
+// Log dir and file
+_LIT( KUiLogDir, "\\Logs\\TestFramework\\ui\\" );
+_LIT( KUiLogFile, "ui.txt" );
+
+// TestScripter related informations
+const TInt KTestScripterNameLength = 12;    
+_LIT( KTestScripterName, "testscripter" );  
+_LIT( KTestCombinerName, "testcombiner" ); 
+                                            
+
+// MACROS
+// None
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUIEngineContainer;
+class CUIEngineEvent;
+class CUIEngineErrorPrinter;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+    
+// CUIIf is the interface class of STIF Test Framework UI engine 
+class CUIIf 
+    :public CBase
+    {
+    public: // Functions that the derived class may implement.
+
+        /**
+        * Test case executed.
+        *
+        * Returns Symbian OS error code.
+        */
+        virtual void TestExecuted ( CUIEngineContainer* aContainer,
+                                    TFullTestResult& aFullTestResult ) = 0;
+
+        /**
+        * Progress information from Test case execution.
+        *
+        * Returns Symbian OS error code.
+        */
+        virtual TInt PrintProg ( CUIEngineContainer* /* aContainer */,
+                                 TTestProgress& /* aProgress */ )
+                                 { return KErrNotSupported; };
+                                 
+        /**
+        * Error information from Test Framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        virtual TInt ErrorPrint ( TErrorNotification& /* aError */ )
+                                  { return KErrNotSupported; };
+    
+        /**
+        * Forward remote messages.
+        */
+        virtual TInt RemoteMsg( CUIEngineContainer* /* aContainer */,
+                                const TDesC& /* aMessage */ )
+                                 { return KErrNotSupported; };
+
+        /**
+        * Forward reboot indication.
+        */
+        virtual TInt GoingToReboot( CUIEngineContainer* /* aContainer */,
+                                    TRequestStatus& /* aStatus */ )
+                                 { return KErrNotSupported; };
+
+        /**
+        * Initialize logger.
+        */
+        virtual void InitializeLogger( CStifLogger* /*aLogger*/ ){};
+                             
+    };
+
+
+// CUIEngine is the main class of STIF Test Framework UI engine 
+class CUIEngine 
+    :public CBase
+    {
+    public: // Enumerations
+
+    protected: // Enumerations
+        
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        
+        static CUIEngine* NewL( CUIIf* aUi );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUIEngine();
+
+    public: // New functions
+
+        RTestEngine& TestEngine(){ return iTestEngine; }
+
+        /**
+        * Used to open TestFramework.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt Open( const TDesC& aTestFrameworkIni );
+
+        /**
+        * Used to close TestFramework.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt Close();
+
+        /**
+        * Used to add test module to test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt AddTestModule( const TDesC& aModuleName, 
+                            const TDesC& aIniFile );
+
+        /**
+        * Used to remove test module to test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt RemoveTestModule( const TDesC& aModuleName );
+
+        /**
+        * Used to add test case file for test module.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt AddTestCaseFile( const TDesC& aModuleName,
+                              const TDesC& aCaseFile );
+
+        /**
+        * Used to remove test case file from test module.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt RemoveTestCaseFile( const TDesC& aModuleName,
+                                 const TDesC& aCaseFile );
+
+        /**
+        * Get testcases from test modules. Returns test case information 
+        * in aTestinfo.
+        * Test module name and test case file can be used to limit the 
+        * set of test cases returned.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt GetTestCasesL( RPointerArray<CTestInfo>& aTestInfo,
+                            const TDesC& aTestModule = (TDesC&) KNullDesC(),
+                            const TDesC& aTestCaseFile = (TDesC&) KNullDesC() );
+
+        /**
+        * Start selected test case identified with CTestInfo.
+        * Return TestId, which is handle used in subsequent 
+        * test case execution control.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt StartTestCase( CUIEngineContainer*& aContainer,
+                            const CTestInfo& aTestInfo );
+    
+        /**
+        * Abort started test case.
+        */
+        void AbortStartedTestCase( CUIEngineContainer* aContainer );
+
+    protected: // Functions that the derived class may implement.
+
+    private:
+    
+        /**
+        * C++ default constructor.
+        */
+        CUIEngine( CUIIf* aUi );
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Test case executed.
+        *
+        * Returns Symbian OS error code.
+        */
+        void TestExecuted ( CUIEngineContainer* aContainer,
+                            TFullTestResult& aFullTestResult );
+
+        /**
+        * Progress information from Test case execution.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt PrintProg ( CUIEngineContainer* aContainer,
+                         TTestProgress& aProgress );
+                         
+        /**
+        * Error information from Test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt ErrorPrint ( TErrorNotification& aError );
+
+        /**
+        * Forward remote messages.
+        */
+        TInt RemoteMsg( CUIEngineContainer* aContainer,
+                        const TDesC& aMessage );
+
+        /**
+        * Forward reboot indication..
+        */
+        TInt GoingToReboot( CUIEngineContainer* aContainer, TRequestStatus& aStatus );
+
+        
+    public: // Data
+
+        // Logger 
+        CStifLogger*                            iLogger;
+
+    protected: // Data
+        // None
+        
+    private: // Data
+        
+        /**
+        * Handle to UI.
+        */
+        CUIIf*                                  iUi; 
+
+        // Handle to Test Engine
+        RTestEngine                             iTestEngine;
+        
+        // Container array
+        RPointerArray<CUIEngineContainer>       iContainerArray;
+        
+        // Error printer
+        CUIEngineErrorPrinter*                  iError;
+                
+    public: // Friend classes
+        // None
+        
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        friend class CUIEngineContainer;
+        friend class CUIEngineEvent;
+        friend class CUIEngineErrorPrinter;
+    };
+
+#endif      // UI_ENGINE_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/UIEngineContainer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,238 @@
+/*
+* 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: This file contains the header file of the CUIEngine.
+*
+*/
+
+#ifndef STIF_TFW_IF_CONTAINER_H
+#define STIF_TFW_IF_CONTAINER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifTFwIf.h>
+
+#include <TestEngineClient.h>
+#include <stifinternal/UIEngine.h>
+
+// CONSTANTS
+// None
+_LIT( KUIStoreDefaultDir, "C:\\TestFramework\\" );
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUIEngine;
+class CUIEngineRunner;
+class CUIEnginePrinter;
+class CUIEngineErrorPrinter;
+class CUIEngineRemote;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+
+// CUIEngineContainer is interface between main class CUIEngine
+// and CUIEngineRunner, which execute test cases
+class CUIEngineContainer
+        : public CBase
+    {
+    public: // Enumerations
+        // Case state
+        enum TCaseState
+            {
+            ENotStarted,
+            ERunning,
+            EPaused,
+            EExecuted,
+            EFinished,
+            };
+
+    private: // Enumerations
+        // None
+
+    public: // Constructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CUIEngineContainer* NewL( CUIEngine* aUIEngine,
+                                const TTestInfo& aTestInfo,
+                                RTestEngine& aTestEngine );
+
+    public: // New functions
+
+
+    public: // Functions from base classes
+
+        /**
+        * StartContainerL starts test case execution.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt StartContainerL();
+
+        /**
+        * TestCaseExecuted informs that test case has executed.
+        */
+        void TestCaseExecuted( TFullTestResult& aResult, TInt aStatus );
+
+        /**
+        * PrintProgress forwards print information from test case.
+        */
+        void PrintProgress( TTestProgress& aProgress );
+
+        /**
+        * RemoteSend forwards remote protocol messages from master.
+        */
+        void RemoteSend( const TDesC& aRemoteMsg, TInt aStatus );
+        
+        /**
+        * GoingToReboot forwards reboot indication.
+        */
+        TInt GoingToReboot( TRequestStatus& aStatus );
+        
+        /**
+        * RemoteReceive forwards remote protocol messages to master.
+        */
+        TInt RemoteReceive( const TDesC& aRemoteMsg );
+
+        /**
+        * CancelTest cancels test case execution. TestCompleted() will be called 
+        * with aTestExecutionResult set to KErrCancel.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt CancelTest();
+
+        /**
+        * PauseTest pauses test case execution.
+        *  
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt PauseTest();
+
+        /**
+        * ResumeTest resumes test case execution.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt ResumeTest();
+        
+        /**
+        * Return remote identifier.
+        */
+        TUint32 RemoteId() const { return iRemoteId; };
+
+        /**
+        * Set remote identifier.
+        */
+        void SetRemoteId( TUint32 aRemoteId ){ iRemoteId = aRemoteId; };
+
+        /**
+        * Return master identifier.
+        */
+        TUint32 MasterId() const { return iMasterId; };
+        
+        /**
+        * Return test case execution state. 
+        */
+        TCaseState State() const { return iState; };
+        
+        /**
+        * Printer signals all prints done event.
+        */ 
+        void PrintsDone();
+
+    protected: // New functions
+        // None
+
+    protected: // Functions from base classes
+        // None
+
+    private:  // Constructors and destructor
+
+        /** 
+        * C++ default constructor.
+        */
+        CUIEngineContainer( CUIEngine* aUIEngine,
+            const TTestInfo& aTestInfo,
+            RTestEngine& aTestEngine );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Destructor of CUIEngineContainer.
+        */
+        ~CUIEngineContainer();
+
+    public: //Data
+        // Pointer to UIEngine
+        CUIEngine*                         iUIEngine;
+
+    protected: // Data
+        // None
+
+    private: // Data
+
+        // Handle to Test Engine
+        RTestEngine                         iTestEngine;
+
+        // Handle to Test Case
+        RTestCase                           iTestCase;
+        
+        // Test case runner
+        CUIEngineRunner*                    iRunner;
+        
+        // Test case printer
+        CUIEnginePrinter*                   iPrinter;
+        
+        // Test case remote command handler
+        CUIEngineRemote*                    iRemote;
+
+        // Test info and package
+        TTestInfo                           iTestInfo;
+        TTestInfoPckg                       iTestInfoPckg;
+
+        // Case state
+        TCaseState                          iState;
+        
+        // Remote protocol identifier
+        TUint32                             iRemoteId;
+
+        // Master protocol identifier
+        TUint32                             iMasterId;
+
+    public: // Friend classes
+        friend class CUIEngine;
+
+    protected: // Friend classes
+   
+    private: // Friend classes
+
+    };
+
+
+#endif      // STIF_TFW_IF_CONTAINER_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/UIStore.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,586 @@
+/*
+* 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: This file contains the header file of the CUIStore 
+* class
+*
+*/
+
+#ifndef UISTORE_H
+#define UISTORE_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+
+#include <StifLogger.h>
+
+// CONSTANTS
+_LIT( KDefaultIni, "\\testframework\\testframework.ini" );
+
+// Timeout for popups
+const TInt KDefaultPopupTimeout = 2100; // 35s. Note this is maximun time in
+                                        // current implementation(used in
+                                        // After()-method, 32bit).
+// Timeout for popups
+const TInt KRebootPopupTimeout = 1;
+
+// MACROS
+
+// DATA TYPES
+
+// Menu update type
+
+// FUNCTION PROTOTYPES
+//
+// FORWARD DECLARATIONS
+class CUIStoreIf;
+class CStartedTestCase;
+class CUIEngine;
+class CTestInfo;
+class CUIEngineContainer;
+class CStartedTestSet;
+class CUIStorePopup;
+
+// DESCRIPTION
+// CUIStore class
+class CUIStore
+        :public CUIIf
+    {
+    public: // Enumerations
+                
+    private: // Enumerations
+    
+        // Popup priorities
+        enum TPopupPriority
+            {
+            EPopupPriorityHighest,
+            EPopupPriorityNormal,
+            EPopupPriorityLow
+            };
+         
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */ 
+        static CUIStore* NewL( CUIStoreIf* iUIStoreIf );
+
+        /**
+        * Destructor of CUIStore.
+        */
+        ~CUIStore();
+
+
+    public: // New functions
+        
+        /**
+        * Used to open TestFramework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt Open( const TDesC& aTestFrameworkIni = KNullDesC );
+
+        /**
+        * Used to close TestFramework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt Close();
+
+        /**
+        * Used to add test module to test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt AddTestModule( const TDesC& aModuleName, 
+                                     const TDesC& aIniFile = KNullDesC );
+
+        /**
+        * Used to remove test module to test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt RemoveTestModule( const TDesC& aModuleName );
+
+        /**
+        * Used to add test case file for test module.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt AddTestCaseFile( const TDesC& aModuleName,
+                                       const TDesC& aCaseFile );
+
+        /**
+        * Used to remove test case file from test module.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt RemoveTestCaseFile( const TDesC& aModuleName,
+                                          const TDesC& aCaseFile );
+
+        /**
+        * Start selected test case identified with CTestInfo.
+        * anIndex contains index in StartedTestCase array, 
+        * which is valid only during execution of calling 
+        * function.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt StartTestCase( const CTestInfo& aTestInfo,
+                                     TInt& anIndex );
+                                        
+        /**
+        * Return array of existing test cases.
+        */
+        IMPORT_C TInt TestCases( RRefArray<CTestInfo>& aTestCases,
+                                 const TDesC& aTestModule = (TDesC&) KNullDesC(),
+                                 const TDesC& aTestCaseFile = (TDesC&) KNullDesC() );
+
+        
+        
+        /**
+        * Return started (running/runned) test case
+        */
+        IMPORT_C CStartedTestCase& StartedTestCaseL( TInt anIndex );
+      
+        /**
+        * Return started (running/runned) test cases
+        */
+        IMPORT_C TInt StartedTestCases( RRefArray<CStartedTestCase>& aTestCases,
+                               TInt aStatus = CUIStoreIf::EStatusAll,
+                               const TDesC& aTestModule = (TDesC&) KNullDesC(),
+                               const TDesC& aTestCaseFile = (TDesC&) KNullDesC() );        
+        
+        /**
+        * Return modules array
+        */
+        IMPORT_C TInt Modules( RRefArray<TDesC>& aTestModules );
+
+        /**
+        * Return test case files
+        */
+        IMPORT_C TInt TestCaseFiles( RRefArray<TDesC>& aTestCaseFiles,
+                            const TDesC& aTestModule = (TDesC&) KNullDesC() );
+
+
+        /**
+        * Loads all TestFramework test modules from \sys\bin\ directories 
+        * of all drives.
+        */
+        IMPORT_C TInt LoadAllModules();
+        
+        /**
+        * Lists all TestFramework test modules from \sys\bin\ directories 
+        * of all drives.
+        */
+        IMPORT_C TInt ListAllModules( RPointerArray<TDesC>& aModuleNames );
+
+
+        /**
+        * Test set support.
+        */
+                                     
+        /**
+        * Create new test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt CreateTestSet( const TDesC& aSetName );
+
+        /**
+        * Remove active test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt RemoveTestSet( const TDesC& aSetName );
+        
+        /**
+        * Query test sets.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt TestSets( RRefArray<CTestSetInfo>& aSetInfos );        
+
+        /**
+        * Query test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C const CTestSetInfo& TestSetL( const TDesC& aSetName  );                
+        
+        /**
+        * Add test case to test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt AddToTestSet( const TDesC& aSetName, const CTestInfo& aTestInfo );
+ 
+        /**
+        * Insert test case to test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt InsertToTestSet( const TDesC& aSetName, 
+                                       const CTestInfo& aTestInfo, 
+                                       TInt aPos );
+ 
+        /**
+        * Remove test case from test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt RemoveFromTestSet( const TDesC& aSetName, const CTestInfo& aTestInfo );
+        
+        /**
+        * Save test set. Depreceated, SaveTestSet2 to be used instead
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt SaveTestSet( const TDesC& aSetName );
+
+        /**
+        * Save test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt CUIStore::SaveTestSet2( TDes& aSetName );
+        /**
+        * Load test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt LoadTestSet( const TDesC& aSetName );
+
+        /**
+        * Load saved test cases.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt LoadSavedTestCases();
+                
+        /**
+        * Start selected test set identified with CTestSetInfo.
+        * anIndex contains index in StartedTestSet array, 
+        * which is valid only during execution of calling 
+        * function.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt StartTestSet( const CTestSetInfo& aTestSetInfo,
+                                    TInt& anIndex,
+                                    CStartedTestSet::TSetType aType = 
+                                        CStartedTestSet::ESetSequential );
+        IMPORT_C TInt StartTestSet( const CTestSetInfo& aTestSetInfo,
+                                    TInt& anIndex,
+                                    CStartedTestSet::TSetType aType,
+                                    TBool aNotStartedCasesMode);
+
+        /**
+        * Abort running test set.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt AbortTestSet( CStartedTestSet& aSetInfo );
+
+        /**
+        * Return started (running/runned) test set
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C CStartedTestSet& StartedTestSetL( TInt anIndex );
+      
+        /**
+        * Return started (running/runned) test cases
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt StartedTestSets( RRefArray<CStartedTestSet>& aTestCases,
+                                       TInt aStatus = CUIStoreIf::ESetAll );       
+
+        /**
+        * Updates information stored about test set in file.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt UpdateTestSet(CTestSetInfo& aSetInfo);
+        
+        /**
+        * Reads filters (if any) from initialization file.
+        */
+        IMPORT_C void ReadFiltersL(RPointerArray<TDesC>& aFilters);
+        
+        /**
+        * Creates list of available Test Sets.
+        *
+        * Returns Symbian OS error code.
+        */
+        
+        IMPORT_C TInt GetTestSetsList( RRefArray<TDesC>& aArray );
+        
+
+    public: // Functions from base classes
+
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CUIStore( CUIStoreIf* iUIStoreIf );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Test case executed.
+        *
+        * Returns Symbian OS error code.
+        */
+        void TestExecuted ( CUIEngineContainer* aContainer,
+                            TFullTestResult& aFullTestResult );
+
+        /**
+        * Progress information from Test case execution.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt PrintProg ( CUIEngineContainer* aContainer,
+                         TTestProgress& aProgress );
+
+        /**
+        * Error information from Test framework.
+        *
+        * Returns Symbian OS error code.
+        */
+        TInt ErrorPrint( TErrorNotification& aError );
+                         
+        /**
+        * Remote protocol messages handler.
+        */
+        TInt RemoteMsg( CUIEngineContainer* aContainer,
+                        const TDesC& aMessage );
+        /**
+        * Reboot indication handler.
+        */
+        TInt GoingToReboot( CUIEngineContainer* aContainer,
+                            TRequestStatus& aStatus );
+        
+        TInt MsgRemote( CUIEngineContainer* aContainer,
+                        CStifTFwIfProt& aReq, 
+                        CStifTFwIfProt& aResp );
+        TInt MsgRemoteRun( CUIEngineContainer* aContainer,
+                           CStifTFwIfProt& aReq, 
+                           CStifTFwIfProt& aResp );
+        TInt MsgRemoteTestCtl( CUIEngineContainer* aContainer,
+                               CStifTFwIfProt& aReq, 
+                               CStifTFwIfProt& aResp );
+        TInt MsgRemoteEventCtl( CUIEngineContainer* aContainer,
+                                CStifTFwIfProt& aReq, 
+                                CStifTFwIfProt& aResp );
+
+        /**
+        * Asynchronous remote sendreceive message.
+        */
+        TInt MsgRemoteSendReceive( CUIEngineContainer* aContainer,
+                           CStifTFwIfProt& aReq, 
+                           CStifTFwIfProt& aResp );
+        
+        /**
+        * Initialize logger from UI engine.
+        */
+        inline void InitializeLogger( CStifLogger* aLogger )
+            { iLogger = aLogger; };
+        
+        /**
+        * Set update flag.
+        */
+        inline void RefreshAllCases()
+            { iUpdateNeeded = ETrue; };
+            
+        /**
+        * Update test case list if required.
+        */
+        TInt UpdateCases();
+        
+        /**
+        * Try to locate default initialization file.
+        */
+        void CheckIniL( TFileName& aIni );
+        
+        /**
+        * Find testcase by container.
+        */
+        TInt FindByContainer( CUIEngineContainer* const aContainer,
+                              CStartedTestCase*& aTestCase );
+
+        /**
+        * Loads all TestFramework test modules from \sys\bin\ directories .
+        */
+        void LoadAllModulesL();
+        
+        /**
+        * Lists all TestFramework test modules from \sys\bin\ directories.
+        */
+        void ListAllModulesL( RPointerArray<TDesC>& aModuleNames );
+        
+        /**
+        * Find test set by name.
+        */
+        TInt FindSetByName( const TDesC& aSetName, CTestSetInfo*& aSetInfo );
+        
+        /**
+        * Find test set by CStartedTestCase.
+        */
+        TInt FindStartedSetByCase( const CStartedTestCase* aTestCase, 
+                                   CStartedTestSet*& aSet  );
+   
+        /**
+        * Load test set.
+        */
+        void LoadTestSetL( const TDesC& aSetName, const TDesC& aSetFileName );
+        
+        /**
+        * Save test set.
+        */ 
+        void SaveTestSetL( CTestSetInfo& aSetInfo, const TDesC& aSetFileName );
+
+        /**
+        * Updates in file information about test set.
+        */ 
+        void UpdateTestSetL(CTestSetInfo& aSetInfo, const TDesC& aSetFileName);
+        
+        /**
+        * Read the whole line from the file.
+        */ 
+        void ReadLineL(RFile &file, TDes& buffer);
+
+        /**
+        * Write given line to the file and adds end of line.
+        */ 
+        void WriteLineL(RFile &file, const TDesC& buffer);
+
+        /**
+        * Load saved executed test cases.
+        *
+        * Returns Symbian OS error code.
+        */
+        void LoadExecutedTestCasesL();
+        
+        /**
+        * Load test modules and test case files used in 
+        * aTestCases if not already done.
+        */
+        void LoadTestModulesAndTestCaseFilesL( const RRefArray<const CTestInfo>& aTestCases );
+        
+        /**
+        * Parse test set name from test set file name.
+        */
+        TInt ParseTestSetName( const TDesC& aSetFileName, TPtrC& aSetName, TFileName& aFileName );
+        
+        /**
+        * Do remote popup. Added aPopupPriority parameter for prioritizing popups @js      
+        */
+        TInt RemotePopup( CUIEngineContainer* aContainer,
+                          const TDesC& aReq, 
+                          CStifTFwIfProt* aResp,
+                          TPopupPriority aPopupPriority = EPopupPriorityLow);        
+        
+        /**
+        * Callback from UIStorePopup.
+        */
+        TInt RemotePopupComplete( CUIStorePopup* aPopup, 
+                                  TInt aError,
+                                  CUIEngineContainer* aContainer,
+                                  CStifTFwIfProt* aResp,
+                                  TKeyCode aKeyCode );
+        /**
+        * Return slave id.
+        */
+        inline TInt16 DevId(){ return 1; };
+        
+        /**
+        * Prints the highest priority popup from queue
+        */
+        void SetRemotePopupFromQueue();
+        
+        /**
+        * Shuffles remote run result popups
+        */
+        void ShuffleRemoteRunResultPopups( CUIStorePopup* aPopup );
+        
+    public:   //Data
+        // Logger
+        CStifLogger*                        iLogger;
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+    	RPointerArray<HBufC> 				iFileList;
+        // Pointer to UI (up)
+        CUIStoreIf*                         iUIStoreIf;   
+        
+        // Pointer to UI engine (down)
+        CUIEngine*                          iUIEngine;
+
+    	// Available test cases   
+        RPointerArray<CTestInfo>            iTestCases;    
+        // Started test cases    
+        RPointerArray<CStartedTestCase>     iStartedTestCases; 
+ 
+    	// Available test sets   
+        RPointerArray<CTestSetInfo>         iTestSets;    
+        // Started test sets    
+        RPointerArray<CStartedTestSet>      iStartedTestSets; 
+        
+        RPointerArray<CUIStorePopup>        iPopups;
+               
+        // Flag for update for test case list required
+        TBool                               iUpdateNeeded;
+        
+        // Tells if popup is already active
+        TBool                               iPopupActive;
+        
+        // Priority of the currently active popup
+        TPopupPriority                      iActivePopupPriority;        
+        
+        TFileName                           iTestFrameworkIni;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        friend class CUIStorePopup;
+
+    };
+    
+#endif // UISTORE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/UIStoreContainer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,349 @@
+/*
+* 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: This file contains the header file of the 
+* CTestCaseRunnner, CTestCasePrinter and CStartedTestCase
+*
+*/
+
+#ifndef UISTORECASECONTAINER_H
+#define UISTORECASECONTAINER_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include <StifTestInterface.h>
+
+#include <stifinternal/RRefArray.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CUIEngineContainer;
+class CTestInfo;
+class CUIStore;
+class CTestSetInfo;
+
+// DESCRIPTION
+// CTestProgress defines the progress information from Test Module.
+class CTestProgress
+    :public CBase 
+    {
+    public:
+        static CTestProgress* NewL( const TTestProgress& aProgress );
+
+        ~CTestProgress();
+        
+        void ReplaceTextL( const TTestProgress& aProgress );
+    
+    private:
+        void ConstructL( const TTestProgress& aProgress );
+
+    public:
+        // "Priority" of the progress information.
+        TInt iPosition;
+        // Description of the data to be printed.
+        TPtrC iDescription;
+        // The actual progress information.
+        TPtrC iText;
+    
+    private:
+        // Description of the data to be printed.
+        HBufC* iDescriptionBuf;
+        // The actual progress information.
+        HBufC* iTextBuf;
+
+    };
+
+// DESCRIPTION
+// CStartedTestCase contains active objects that handles one test case
+class CStartedTestCase 
+    :public CBase  
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CStartedTestCase* NewL( const CTestInfo& aTestInfo, 
+                                       CUIEngineContainer& aContainer );
+
+        /**
+        * Destructor of CStartedTestCase.
+        */
+        virtual ~CStartedTestCase();
+
+    public: // New functions
+    
+        /**
+        * Get Engine container handle.
+        */
+        IMPORT_C CUIEngineContainer& UIEngineContainer() const;
+            
+        /**
+        * Set case result
+        */
+        void SetResult( const TFullTestResult& aResult );
+
+        /**
+        * Get test case info.
+        */    
+        inline CTestInfo const& TestInfo() const
+            { return *iTestInfo; }; 
+               
+        /**
+        * Return the result
+        */
+        inline const TFullTestResult& Result() const
+            { return iResult; };
+
+        /**
+        * Return the print array
+        */
+        inline RPointerArray<CTestProgress>& PrintArray()
+            { return iPrints; };
+        inline const RPointerArray<CTestProgress>& PrintArray() const
+            { return iPrints; };
+        
+        /**
+        * Get status.
+        */
+        inline TInt Status() const { return iStatus; }
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:   // Functions from base classes
+        
+        /** 
+        * C++ default constructor.
+        */
+        CStartedTestCase( CUIEngineContainer& aContainer );
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const CTestInfo& aTestInfo );
+        
+        /**
+        * Private constructor for internal use.
+        */
+        CStartedTestCase( CTestInfo* aTestInfo, 
+                          TFullTestResult aResult, 
+                          TInt aStatus  );
+        
+    public:      //Data
+        /**
+        * Backpointer that can be utilized by UI, not used from UI Engine.
+        */
+        TAny*       iBackPtr;
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CUIEngineContainer*             iContainer;
+        CTestInfo*                      iTestInfo;
+        TFullTestResult                 iResult;   // Test case result
+        
+        RPointerArray<CTestProgress>    iPrints;   // Prints from case
+
+        // Execution status (flags from CUIStoreIf::TUpdateFlags)
+        TInt                            iStatus;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        friend class CUIStore;
+
+    };
+
+// DESCRIPTION
+// CStartedTestSet contains test set information
+class CStartedTestSet 
+    :public CBase  
+    {
+    public: // Enumerations
+        enum TSetType
+            {
+            ESetSequential,
+            ESetParallel,
+            };
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CStartedTestSet* NewL( CUIStore* aUIStore, 
+                                      const CTestSetInfo& aTestSetInfo,
+                                      TSetType aType );
+
+        /**
+        * Destructor of CStartedTestCase.
+        */
+        virtual ~CStartedTestSet();
+
+    public: // New functions
+    
+        /**
+        * Get test case info.
+        */    
+        inline CTestSetInfo const& TestSetInfo() const
+            { return *iTestSetInfo; }; 
+               
+        /**
+        * Return the result
+        */
+        inline const TFullTestResult& Result() const
+            { return iResult; };
+
+        /**
+        * Get status.
+        */
+        inline TInt Status() const { return iStatus; }
+        
+        /**
+        * Get test cases runned/running in test set.
+        */
+        inline const RRefArray<CStartedTestCase>& TestCases() const
+            { return iTestCases; };
+        
+        /**
+        * Get type.
+        */ 
+        inline TSetType Type(){ return iType; };        
+        
+        /**
+        * Start next testcase. Returns KErrNotFound if does not exits.
+        */ 
+        TInt StartNext();
+        
+        /**
+        * Abort running testcases.
+        */ 
+        TInt Abort();
+        
+        /**
+        * Check if test case running in this test set.
+        */
+        TBool IsRunning( const CStartedTestCase* aTestCase ); 
+        
+        /**
+        * Test from this set completed.
+        */
+        TInt TestCompleted( const CStartedTestCase* aTestCase, 
+                            TFullTestResult aResult );
+                            
+        /**
+        * Sets mode in which only not executed tests will be run.
+        */
+        void SetNotStartedCasesMode(TBool aNotStartedCasesMode);
+        
+        /**
+        * Returns pointer to original test set.
+        */
+        CTestSetInfo* GetOriginalTestSet();
+
+        /**
+        * Sets pointer to original test set to NULL.
+        */
+        void NullOriginalTestSet();
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:   // Functions from base classes
+        /** 
+        * C++ default constructor.
+        */
+        CStartedTestSet( CUIStore* aUIStore, TSetType aType );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const CTestSetInfo& aTestSetInfo );
+
+    public:      //Data
+        /**
+        * Backpointer that can be utilized by UI, not used from UI Engine.
+        */
+        TAny*       iBackPtr;
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Backpointer
+        CUIStore*                       iUIStore;
+        
+        CTestSetInfo*                   iTestSetInfo;
+        TFullTestResult                 iResult;   // Test case result
+        TBool                           iResultSet;
+        
+        RRefArray<CStartedTestCase>     iTestCases;
+        
+        TSetType                        iType;
+
+        // Execution status (flags from CUIStoreIf::TUpdateFlags)
+        TInt                            iStatus;
+        
+        // Next case to start        
+        TInt                            iNext;
+        // Number of running cases
+        TInt                            iRunningCases;
+        
+        // In this mode only not executed tests will be run
+        TBool                           iNotStartedCasesMode;
+        
+        // Original test set
+        CTestSetInfo*                   iOriginalTestSet;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif // UISTORECASECONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/UIStoreIf.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,267 @@
+/*
+* 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: This file contains the header file of the CUIStore.
+*
+*/
+
+#ifndef UISTOREIF_H
+#define UISTOREIF_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32keys.h>
+
+#include <StifTestInterface.h>
+
+#include <stifinternal/RRefArray.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CUIStore;
+class CStartedTestCase;
+class CTestInfo;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+* UI Store class interface. UI must derive this to use UI Store.
+*/
+class CUIStoreIf 
+    :public CBase
+    {
+    public: // Enumerations
+        // Updated flags
+        enum TUpdateFlags
+            {
+            // Test case status updates 
+            EStatusRunning  = 0x00000001,
+            EStatusExecuted = 0x00000002,
+            EStatusPassed   = 0x00000004,
+            EStatusFailed   = 0x00000008,
+            EStatusAborted  = 0x00000010,
+            EStatusCrashed  = 0x00000020,
+            EStatusAll      = 0x000000ff,
+            // Test set updates
+            ESetRunning     = 0x00000100,
+            ESetExecuted    = 0x00000200,
+            ESetPassed      = 0x00000400,
+            ESetFailed      = 0x00000800,
+            ESetAll         = 0x0000ff00,
+            // Other updates
+            EPrintUpdate    = 0x00010000,                              
+            };
+            
+    private: // Enumerations
+        // None
+        
+    public: // Constructors and destructor
+    
+        /**
+        * Destructor.
+        */      
+        IMPORT_C ~CUIStoreIf();
+        
+    protected:
+        /**
+        * Constructor
+        */
+        IMPORT_C CUIStoreIf();
+
+        /**
+        * Symbian OS second phase constructor. This must be called 
+        * from derived class ConstructL.
+        */      
+        IMPORT_C void ConstructL();
+        
+    public: // New functions
+        /**
+        * Returns reference to CUIStore object, 
+        * which handles test cases and test modules.
+        */
+        IMPORT_C CUIStore& UIStore();
+
+        /**
+        * Receives output update notification from CUIStore.
+        * UI implements this to get update notifications. 
+        * aFlags are from 
+        */
+        virtual void Update( CStartedTestCase* /*aTestCase*/, 
+                             TInt /* aFlags */ ){};
+                                   
+                                   
+        /**
+        * Function is called when test framework prints error.
+        */
+        virtual void Error( TErrorNotification& /*aError*/ ){};
+        
+        /**
+        * Function is called to print message to UI.
+        */
+        virtual TInt PopupMsg( const TDesC& /* aLine1 */, 
+                               const TDesC& /* aLine2 */, 
+                               TInt /* aTimeInSecs */ )
+            { return KErrNotSupported; };
+            
+        /**
+        * Function is called to print message to UI
+        * and wait key pressing.
+        */
+        virtual TInt PopupMsg( const TDesC& /* aLine1 */, 
+                               const TDesC& /* aLine2 */, 
+                               TInt /* aTimeInSecs */,
+                               TKeyCode& /* aKey */,
+                               TRequestStatus& /* aStatus */ )
+            { return KErrNotSupported; };
+       
+       /**
+        * Function is called to close instances.
+        */
+        virtual void Close( TInt /* aHandle */ ){};
+
+    public: // Functions from base classes
+
+    private: 
+
+    private:
+    
+    private: // Data
+		CUIStore*					    iUIStore;
+		
+    };
+    
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestSetInfo contains test set information
+class CTestSetInfo 
+    :public CBase  
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetInfo* NewL( const TDesC& aName );
+
+        /**
+        * Destructor of CStartedTestCase.
+        */
+        virtual ~CTestSetInfo();
+
+    public: // New functions
+        
+        /**
+        * Get test set name.
+        */
+        inline const TDesC& Name() const 
+            { return *iName; };
+        
+        /**
+        * Get test cases.
+        */
+        inline const RRefArray<const CTestInfo>& TestCases() const
+            { return iTestCaseRefs; };
+        
+        /**
+        * Add test case to set.
+        */
+        TInt AddTestCase( const CTestInfo& aTestInfo );
+        
+        /**
+        * Insert test case to specific location.
+        */
+        TInt InsertTestCase( const CTestInfo& aTestInfo, TInt aPos );
+     
+        /**
+        * Remove test case from set.
+        */
+        TInt RemoveTestCase( const CTestInfo& aTestInfo );
+        
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        void CopyL( const CTestSetInfo& aTestSetInfo );
+        
+        /**
+        * Sets the info which test case has been started lately.
+        */
+        void SetLastStartedCaseIndex(TUint aLastStartedCaseIndex);
+
+        /**
+        * Gets the info which test case has been started lately.
+        */
+        TUint GetLastStartedCaseIndex(void);
+                
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:   // Functions from base classes
+        /** 
+        * C++ default constructor.
+        */
+        CTestSetInfo();       
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aName );
+
+    public:     // Data
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        RRefArray<const CTestInfo>      iTestCaseRefs;
+        RPointerArray<CTestInfo>        iTestCases;
+        HBufC*                          iName;
+        // Which test case was started as a last one (index)
+        TUint                           iLastStartedCaseIndex;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif // UISTOREIF_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/UiEnvProxy.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,151 @@
+/*
+* 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: This file contains the header file of the UI Proxy 
+* interface.
+*
+*/
+
+#ifndef UIENVPROXY_H_
+#define UIENVPROXY_H_
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Interface class for the proxy betweene testscripter and AppUi.
+class CUiEnvProxy: public CBase
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+	    // None
+	
+	public:  // Constructors and destructor
+	    // None
+	
+	public: // New functions
+		/**
+		 * Parses key code.
+		 */
+		virtual TInt ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode ) const = 0;
+		
+		/**
+		 * Parses key scan code.
+		 */
+		virtual TInt ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode ) const = 0;
+		
+		/**
+		 * Parses key modifier.
+		 */
+		virtual TInt ParseModifier( const TDesC& aModifierName, TUint& aModifier ) const = 0;
+	
+		/**
+		 * Parse pointer event type
+		 */
+		virtual TInt ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType ) const = 0;
+	
+		/**
+		 * Brings UI control container to foreground.
+		 */
+		virtual void BringToForeground() = 0;
+		
+		/**
+		 * Sends UI control container to background.
+		 */
+		virtual void SendToBackground() = 0;
+		
+		/**
+		 * Sends local key event to UI control.
+		 */
+		virtual void PressKeyL( TRequestStatus* aStatus, TUint aKeyCode, TInt aKeyScanCode = 0, 
+							   TUint aKeyModifiers = 0, TInt keyRepeats = 0 ) = 0;
+		
+		/**
+		 * Sends local key event to UI control.
+		 */
+		virtual void PressKeyL( TUint aKeyCode, TInt aKeyScanCode = 0, 
+							   TUint aKeyModifiers = 0, TInt keyRepeats = 0 ) = 0;
+
+		/**
+		 * Sends text to UI control.
+		 */
+		virtual void TypeTextL( TRequestStatus* aStatus, const TDesC& aText ) = 0;
+
+		/**
+		 * Sends text to UI control.
+		 */
+		virtual void TypeTextL( const TDesC& aText ) = 0;		
+		
+		/**
+		 * Send pointer event
+		 */
+		virtual void SendPointerEventL( TUint aType, const TPoint& aPosition ) = 0;
+
+		/**
+		 * Send local pointer event
+		 */
+		virtual void SendPointerEventL( TRequestStatus* aStatus, TUint aType, const TPoint& aPosition ) = 0;
+
+    public: // Functions from base classes
+        // None
+
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+        
+    private:	// New functions
+    	// None
+	
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+        // None
+		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None
+	};
+
+#endif // UIENVPROXY_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/inc/atslogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,579 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+
+#ifndef __ATSLOGGER_H__
+#define __ATSLOGGER_H__
+
+//  INCLUDES
+#include <f32file.h>
+
+// CONSTANTS
+_LIT(KAtsLogger, "AtsLogger");
+_LIT(KAtsLoggerNa, "NA");
+_LIT(KAtsLoggerPassed, "PASSED");
+_LIT(KAtsLoggerFailed, "FAILED");
+_LIT(KAtsLoggerSkipped, "SKIPPED");
+_LIT(KAtsLoggerEmpty, "");
+_LIT(KAtsLoggerSemaphore, "AtsLogger");
+_LIT(KAtsLoggerXmlDirectory, "\\SPD_LOGS\\XML\\");
+_LIT(KAtsLoggerRawDirectory, "\\SPD_LOGS\\RAW\\");
+_LIT(KAtsLoggerXmlSuffix, ".xml");
+_LIT(KAtsLoggerRawSuffix, ".log");
+
+_LIT(KAtsLoggerTagOpen, "<");
+_LIT(KAtsLoggerSpace, " ");
+_LIT(KAtsLoggerAttr, "=\"");
+_LIT(KAtsLoggerAttrClose, "\">");
+_LIT(KAtsLoggerTagPost, ">");
+_LIT(KAtsLoggerTagClose, "</");
+_LIT(KAtsLoggerLf, "\n");
+_LIT(KAtsLoggerIndent, "  ");
+_LIT8(KAtsLoggerIndent8, "  ");
+_LIT(KAtsLoggerCommentOpen, "<!--");
+_LIT(KAtsLoggerCommentClose, "-->");
+_LIT(KAtsLoggerQuot, "&quot;");
+_LIT(KAtsLoggerAmp, "&amp;");
+_LIT(KAtsLoggerApos, "&apos;");
+_LIT(KAtsLoggerLt, "&lt;");
+_LIT(KAtsLoggerGt, "&gt;");
+
+_LIT8(KAtsLoggerQuot8, "&quot;");
+_LIT8(KAtsLoggerAmp8, "&amp;");
+_LIT8(KAtsLoggerApos8, "&apos;");
+_LIT8(KAtsLoggerLt8, "&lt;");
+_LIT8(KAtsLoggerGt8, "&gt;");
+_LIT8(KAtsLoggerEmpty8, "");
+
+_LIT(KAtsLoggerTagTestReport, "test-report");
+_LIT(KAtsLoggerTagTestSet, "test-batch");
+_LIT(KAtsLoggerTagTestCase, "test-case");
+_LIT(KAtsLoggerTagTestSetInit, "batch-init");
+_LIT(KAtsLoggerTagDescription, "description");
+_LIT(KAtsLoggerTagDate, "date");
+_LIT(KAtsLoggerTagFactory, "factory");
+_LIT(KAtsLoggerTagComponent, "component");
+_LIT(KAtsLoggerTagName, "name");
+_LIT(KAtsLoggerTagVersion, "version");
+_LIT(KAtsLoggerTagTestSetResult, "batch-result");
+_LIT(KAtsLoggerTagId, "id");
+_LIT(KAtsLoggerTagTestCaseInit, "case-init");
+_LIT(KAtsLoggerTagExpected, "expected-result");
+_LIT(KAtsLoggerTagRunTime, "run-time");
+_LIT(KAtsLoggerTagTestCaseResult, "case-result");
+_LIT(KAtsLoggerTagActual, "actual-result");
+_LIT(KAtsLoggerTagDebug, "debug-info");
+_LIT(KAtsLoggerTagWarning, "warning");
+_LIT(KAtsLoggerTagError, "error");
+_LIT(KAtsLoggerTagStatus, "status");
+_LIT(KAtsLoggerTimeStamp, "time-stamp");
+
+const TInt KAtsLoggerBufferSegmentGranularity = 32;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CAtsLogger defines API for test case result logging.
+class CAtsLogger : public CBase
+	{
+	public:	// Public enumerations
+		enum TReportStage
+			{
+			ENone,
+			EUninitialized,
+			EBeginTestReport,
+			EBeginTestSet,
+			EBeginTestCase,
+			ESetTestCaseVerdict,
+			EEndTestCase,
+			EEndTestSet,
+			EEndTestReport,
+			EFinished
+			};
+	private:	// Private enumerations
+				// None
+
+	public:	// Public constructors/desctructors
+		
+		/**
+		 * Symbian OS constructor
+		 */
+		IMPORT_C static CAtsLogger* NewL( const TDesC& aName, 
+		                                  TBool aAfterReboot = EFalse );
+
+		/**
+		 * C++ destructor
+		 */
+		IMPORT_C ~CAtsLogger();
+
+	public:	// Public new functions
+
+		/**
+		 * Returns error message. Also includes
+		 * base E32 error codes.
+		 */
+		IMPORT_C static const TPtrC ErrorMessage(const TInt& aError);
+
+		/**
+		 * Closes opened resources. Desctructor calls
+		 * this if it is not called before.
+		 */
+		IMPORT_C void CloseL();
+
+		/**
+		 * IsValid() returns ETrue if this logger is valid and
+		 * able to write log.
+		 */
+		IMPORT_C TBool IsValid();
+	
+		/**
+		 * BeginTestReportL() should be called at the beginning of the program,
+		 * before any testing begins
+		 */
+		IMPORT_C void BeginTestReportL();
+
+		/**
+		 * EndTestReportL() must be called at the end of the program
+		 */
+		IMPORT_C void EndTestReportL();
+		
+		/**
+		 * SaveForRebootL() should be called before reboot to save data.
+		 */
+		IMPORT_C void SaveForRebootL();
+
+		/**
+		 * ContinueAfterRebootL() must be called to continue 
+		 * after reboot.
+		 */
+		IMPORT_C void ContinueAfterRebootL();
+
+		/**
+		 * BeginTestSetL() must be called when a new test set begins
+		 *
+		 * factory     = component factory whose component is being tested
+		 * component   = name of the software component being tested
+		 * version     = version of the software component
+		 * description = short, optional description of the batch
+		 */
+		IMPORT_C void BeginTestSetL(const TDesC& aFactory = KAtsLoggerNa,
+								    const TDesC& aComponent = KAtsLoggerNa,
+								    const TDesC& aVersion = KAtsLoggerNa,
+								    const TDesC& aDescription = KAtsLoggerEmpty);
+
+		/**
+		 * EndTestSetL() must be called as soon as a test set ends
+		 */
+		IMPORT_C void EndTestSetL();
+
+		/**
+		 * BeginTestCaseL() is called whenever an individual testcase begins
+		 *
+		 * id       = unique id of the testcase
+		 * expected = expected result of the test (if applicable)
+		 * info     = short descritpion of the expected result (if applicable)
+		 */
+		IMPORT_C void BeginTestCaseL(const TDesC& aId,
+									 const TDesC& aExpected = KAtsLoggerNa,
+									 const TDesC& aInfo = KAtsLoggerEmpty,
+									 const TDesC& aVersion = KAtsLoggerEmpty);
+
+		/**
+		 * BeginTestCaseL() is called whenever an individual testcase begins
+		 *
+		 * id       = unique id of the testcase
+		 * expected = expected result code of the test (if applicable)
+		 * info     = short descritpion of the expected result (if applicable)
+		 */
+		IMPORT_C void BeginTestCaseL(const TDesC& aId,
+									 const TInt aExpected,
+									 const TDesC& aInfo = KAtsLoggerEmpty,
+									 const TDesC& aVersion = KAtsLoggerEmpty);
+									
+		/**
+		 * BeginTestCaseReportL() is called whenever an individual testcase report begins
+		 *
+		 * id       = unique id of the testcase
+		 * expected = expected result code of the test (if applicable)
+		 * startTime= test case starting time
+		 * info     = short descritpion of the expected result (if applicable)
+		 */
+		 IMPORT_C void BeginTestCaseReportL( const TDesC& aId,
+			                                const TDesC& aExpected,
+			                                const TTime& aStartTime,
+			                                const TDesC& aInfo = KAtsLoggerEmpty,
+			                                const TDesC& aVersion = KAtsLoggerEmpty );
+			                                
+		/**
+		 * BeginTestCaseReportL() is called whenever an individual testcase report begins
+		 *
+		 * id       = unique id of the testcase
+		 * expected = expected result code of the test (if applicable)
+		 * startTime= test case starting time
+		 * info     = short descritpion of the expected result (if applicable)
+		 */
+		 IMPORT_C void BeginTestCaseReportL( const TDesC& aId,
+			                                const TInt aExpected,
+			                                const TTime& aStartTime,
+			                                const TDesC& aInfo = KAtsLoggerEmpty,
+			                                const TDesC& aVersion = KAtsLoggerEmpty );
+
+		/**
+		 * EndTestCaseL() is called when an individual testcase ends
+		 */
+		IMPORT_C void EndTestCaseL();
+
+		/**
+		 * TestCasePassed() must be called between calls
+		 * to BeginTestCase() and EndTestCase(). This results
+		 * test case to be passed.
+		 */
+		IMPORT_C void TestCasePassed();
+		
+		
+		/**
+		 * TestCaseFailed() must be called between calls
+		 * to BeginTestCase() and EndTestCase(). This results
+		 * test case to be failed.
+		 */
+		IMPORT_C void TestCaseFailed();
+
+		/**
+		 * TestCaseSkipped() must be called between calls
+		 * to BeginTestCase() and EndTestCase(). This results
+		 * test case to be skipped.
+		 */
+		IMPORT_C void TestCaseSkipped();
+		
+		/**
+		 * TestCaseNa() must be called between calls
+		 * to BeginTestCase() and EndTestCase(). This results
+		 * test case to be N/A.
+		 */
+		IMPORT_C void TestCaseNa();
+
+		/**
+		 * SetTestCaseResultL() sets the actual result of the test (if applicable),
+		 * this should correspond to the expected result (see BeginTestCase) if
+		 * the test succeeds.
+
+		 * Must be called between calls to BeginTestCaseL() and EndTestCaseL().
+		 */
+		IMPORT_C void SetTestCaseResultL(const TInt aResult);
+		IMPORT_C void SetTestCaseResultL(const TDesC& aResult = KAtsLoggerEmpty);
+		IMPORT_C void SetTestCaseResultL(TRefByValue<const TDesC> aFmt,...);
+
+		/**
+		 * DebugL(), WarningL(), ErrorL() and CommentL() as used to place
+		 * informational messages of appropriate debug level into the test report.
+         * These functions can be called anywhere between BeginReportL() and EndReportL().
+		 */
+		IMPORT_C void DebugL(const TDesC& aMsg);
+		IMPORT_C void DebugL(TRefByValue<const TDesC> aFmt,...);
+
+		IMPORT_C void WarningL(const TDesC& aMsg);
+		IMPORT_C void WarningL(TRefByValue<const TDesC> aFmt,...);
+
+		IMPORT_C void ErrorL(const TDesC& aMsg);
+		IMPORT_C void ErrorL(TRefByValue<const TDesC> aFmt,...);
+
+		IMPORT_C void CommentL(const TDesC& aMsg);
+		IMPORT_C void CommentL(TRefByValue<const TDesC> aFmt,...);
+
+		/**
+		 * RawLogL() writes to a separate log file.
+		 */
+		IMPORT_C TInt RawLogL(const TDesC& aMsg);
+		IMPORT_C TInt RawLogL(TRefByValue<const TDesC> aFmt,...);
+
+		/**
+		 * DebugOutput() writes to RDebug
+		 */
+		IMPORT_C void DebugOutput(const TDesC& aMsg);
+
+		/**
+		 * Set this to ETrue if client should use
+		 * full set of reporting methods
+		 */
+		IMPORT_C void SetFullReporting(TBool aFlag);
+
+		/**
+		 * Set this to ETrue if XML log should be
+		 * written to the debug port also.
+		 */
+		IMPORT_C void SetDebugOutput(TBool aFlag);
+
+		/**
+		 * Set this to ETrue if XML log should have
+		 * indentation. This only adds human readability.
+		 */
+		IMPORT_C void SetIndentation(TBool aFlag);
+
+
+    public: // Public functions from base classes
+			// None
+	
+    protected:	// Protected new functions
+		/**
+		 * Outputs message closed by the tags.
+		 */
+		void TagL(const TDesC& aTag,
+			      const TDesC& aMsg);
+
+		/**
+		 * Adds attribute with value to the message and
+		 * outputs message closed by the tags.
+		 */
+		void TagL(const TDesC& aTag,
+			      const TDesC& aMsg,
+				  const TDesC& aAttribute,
+				  const TDesC& aValue);
+
+		/**
+		 * Outputs message closed by the tags. This is used with
+		 * DebugL(), WarningL(), ErrorL() and CommentL(). Time stamp is
+		 * added to the message.
+		 */
+		void TimeStampedMessageL(const TDesC& aTag,
+			                     const TDesC& aMsg);
+
+		/**
+		 * Opens a tag. 
+		 */
+		void OpenTagL(const TDesC& aTag);	
+
+		
+		/**
+		 * Opens a tag with attribute and value.
+		 */
+		void OpenTagL(const TDesC& aTag,
+					  const TDesC& aAttribute,
+					  const TDesC& aValue);
+		
+		/**
+		 * Opens a tag and increases indent level.
+		 */
+		void OpenTagIndentL(const TDesC& aTag);
+
+
+		/**
+		 * Opens a tag with attribute having value and increases indent level.
+		 */
+		void OpenTagIndentL(const TDesC& aTag,
+			                const TDesC& aAttribute,
+						    const TDesC& aValue);
+
+		/**
+		 * Closes a tag;
+		 */
+		void CloseTagL(const TDesC& aTag);
+
+		/**
+		 * Closes a tag and descreases indent level.
+		 */
+		void CloseTagIndentL(const TDesC& aTag);
+
+		/**
+		 * Outputs line feed.
+		 */
+		void LineFeedL();
+
+		/**
+		 * Writes data to the specified file.
+		 */
+		void WriteL(const TDesC& aData, RFile& aFile);
+
+		/**
+		 * Writes data to the XML file.
+		 */
+		void WriteL(const TDesC& aData);
+
+		/**
+		 * Encodes XML special chararacters from message
+		 */
+		HBufC* EncodeLC(const TDesC& aMsg);
+
+		/**
+		 * Checks whether report stage transition is legal.
+		 */
+		TBool IsTransitionLegal(const TReportStage& aNewStage);
+
+	protected:  // Protected functions from base classes
+				// None
+
+	protected:	// Protected data
+				// None
+	
+	private:	// Private functions
+        /**
+        * By default Symbian OS two-phase constructor is private.
+        */
+		void ConstructL( TBool aAfterReboot );
+
+		/**
+		 * C++ constructor
+		 */
+		CAtsLogger(const TDesC& aName);
+
+		/**
+		 * Checks whether directory exist or not
+		 */
+		TBool CheckDirectoryL(const TDesC& aDirName, TChar& aDrive);
+		
+		/**
+		 * Replaces file if already exist
+		 */
+		TInt ReplaceFileL(const TDesC& aFileName);
+
+		/**
+		 * Open existing file if already exist
+		 */
+		TInt OpenExistingFileL(const TDesC& aFileName);
+
+		/**
+		 * Formats given date to a format of yyyy-mm-dd hh:mm:ss
+		 */
+		HBufC* FormatDateLC(TDateTime aDate);
+
+		/**
+		 * Formats given time to a format of hh:mm:ss
+		 */
+		HBufC* FormatTimeLC(TTimeIntervalMicroSeconds aTime);
+
+		/**
+		 * Expands buffer and then writes aBuf into it.
+		 */
+		TInt BufferL(CBufBase* aBufBase, TInt& aLength,const TDesC& aBuf);
+		
+		/**
+		 * Writes whole buffer to a file. Does not reset buffer.
+		 */
+		TInt WriteBufferToFileL(CBufBase* aCBufBase, const TDesC& aFileName);
+
+		/**
+		 * Writes whole buffer to the debug port. Does not reset buffer.
+		 */
+		TInt WriteBufferToDebugPortL(CBufBase* aCBufBase);
+
+	protected:	// Protected data
+		// TTestSet data holder class definition and implementation
+		class TTestSet
+			{
+			public:
+				TTime iStartTime;
+			};
+		
+		// TCase data holder class definition and implementation
+		class TTestCase
+			{
+			public:
+				TTestCase() {  iResult = NULL; }
+				~TTestCase()
+					{
+					if (iResult)
+						{
+						delete iResult;
+						iResult = NULL;
+						}
+					}
+			public:
+				HBufC* iResult;
+				TPtrC iStatus;
+				TTime iStartTime;
+			
+			};
+
+		// Data holder for batch information
+		CAtsLogger::TTestSet iTestSet;
+
+		// Data holder for test case information
+		CAtsLogger::TTestCase iTestCase;
+
+		// Holds current report stage
+		CAtsLogger::TReportStage iReportStage;
+
+		// Test case and logger ID
+		const TFileName iName;
+
+	private: // Private data
+		// Dynamic buffer for XML data
+		CBufBase* iXmlBuffer;
+
+		// Current legth of iXmlBuffer
+		TInt iXmlBufferLength;
+		
+		// Indentation level of outputted XML
+		int iIndentLevel;
+
+		// Handle to file server
+		RFs iRfs;
+
+		// The name of XML file
+		TFileName iXmlLogFileName;
+
+		// The name of raw log file
+		TFileName iRawLogFileName;
+
+		// Flag to indicate that raw log should be done
+		TBool iRawLog;
+
+		// Flag to indicate that XML log should be done
+		TBool iXmlLog;
+
+		// Flag to indicate that logger is valid
+		TBool iValid;
+
+		// Flag to indicate that a line feed has been done
+		TBool iLineFeedDone;
+
+		// Flag to indicate that BeginTestCase() has been called
+		// and EndTestCase() hasn't yet been called.
+		TBool iInTestCase;
+
+		// Flag to indicate that logger is closed
+		TBool iClosed;
+
+		// Flag to indicate if client should use
+		// full set of logger methods:
+		//		BeginTestReportL()
+		//		BeginTestSetL();
+		//		BeginTestCaseL();
+		//		TestCasePassed(); // or other verdict method
+		//		EndTestCase();
+		//		EndTestSetL();
+		//		EndTestReportL();
+		TBool iFullReportingMode;
+
+		// Flag to indicate that XML log should be
+		// written to the debug port also
+		TBool iDoDebugOutput;
+
+		// Flag to indicate that logger does intendation
+		// to the XML file
+		TBool iDoIndentation;
+
+	public:	// Friend classes
+			// None
+        
+    protected:	// Friend classes
+				// None
+        
+    private:	// Friend classes
+				// None
+};
+
+#endif// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/api/api_platform/stif_api.metaxml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,27 @@
+<?xml version="1.0" ?>
+<api id="d6c032dbc08ddbb1c1db14ad08df1147" dataversion="2.0">
+  <name>STIF API</name>
+  <description>Defines the API, which is used by STIF and its test modules.</description>
+  <type>c++</type>
+  <collection>stif</collection>
+  <libs>
+    <lib name="atslogger.lib" />
+    <lib name="Demomodule.lib" />
+    <lib name="StifKernelTestClassBase.lib" />
+    <lib name="StifTFwIf.lib" />
+    <lib name="SUEvent.lib" />
+    <lib name="testcombiner.lib" />
+    <lib name="StifTestEngine.lib" />
+    <lib name="StifTestInterface.lib" />
+    <lib name="testscripter.lib" />
+    <lib name="StifTestServer.lib" />
+  </libs>
+  <release category="platform" sinceversion="3.2"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
Binary file testexecfw/stf/doc/HOWTO_Execute_TEF_test_cases_on_STF.doc has changed
Binary file testexecfw/stf/doc/STF_Users_Guide.doc has changed
Binary file testexecfw/stf/examples/MigrationExample.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/Bmarm/TestFileStoreU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/Bwins/TestFileStoreU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/EABI/TestFileStoreU.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/conf/TestFileStore.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,58 @@
+[Test]
+title Case1 (CreateFile, allow error -11)
+create TestFileStore foobar
+allowerrorcodes  -11
+foobar CreateFile c:\testfileserver.test
+foobar WriteFile c:\testfileserver.test
+delete foobar
+[Endtest]
+
+[Test]
+title Case2 (Loop , Print)
+create TestFileStore foobar
+loop 10000 msec
+print Loop test: LOOP_COUNTER .
+foobar ReadFile c:\testfileserver.test
+endloop
+delete foobar
+[Endtest]
+
+[Test]
+title Case3 (pause)
+create TestFileStore foobar
+print Pause 2 seconds.
+pause 2000
+delete foobar
+[Endtest] 
+
+[Test]
+title Case4 (expectedpanic)
+create TestFileStore foobar
+print set expected panic
+expectedpanic 5
+foobar PanicExample USER 5
+delete foobar
+[Endtest] 
+
+[Test]
+title Case5_1 (OpenFile, event testing)
+print This case should be run with Case5_2 parallel.
+create TestFileStore foobar
+request Event1
+wait Event1
+foobar OpenFile c:\testfileserver.test
+release Event1
+delete foobar
+[Endtest] 
+
+[Test]
+title Case5_2 (CreateFile, event testing)
+print This case should be run with Case5_1 parallel.
+create TestFileStore foobar
+allowerrorcodes  -11
+foobar CreateFile c:\testfileserver.test
+set Event1 state
+unset Event1
+delete foobar
+[Endtest]
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/group/Bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,62 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+	
+	DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+../conf/TestFileStore.cfg /epoc32/winscw/c/TestFramework/TestFileStore.cfg
+TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini
+
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in \epoc32\include
+// Example: 
+/*
+\agnmodel\inc\AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+
+
+PRJ_MMPFILES
+TestFileStore.mmp
+
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+\agnmodel\group\agnmodel.mmp
+#if defined(MARM)
+\agnmodel\group\agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/group/TestFileStore.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,76 @@
+/*TYPE TESTCLASS*/
+/*
+* 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: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          TestFileStore.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         TestFileStore.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          TestFileStore.cpp
+SOURCE          TestFileStoreBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/group/TestFileStore.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+;
+; 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:
+;
+; 	Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; 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\TestFileStore.dll"   -   "!:\Sys\Bin\TestFileStore.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/group/TestFramework.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,218 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#   + XML, Test report will be xml type, for example 'TestReport.xml'.
+#          Note, that xml format is available only when output is set to FILE.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport    # Possible values are: 'Empty', 'Summary', 'Environment',
+                              #                      'TestCases' or 'FullReport'
+
+CreateTestReport= YES         # Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT         # Possible values: TXT, HTML or XML
+TestReportOutput= FILE        # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone  # Possible values are:
+              # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+              # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+              # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+              # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0                    # Default timeout value for each test case. In milliseconds
+UITestingSupport= YES        # Possible values: YES or NO
+#SeparateProcesses= YES       # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= c:\testframework\TestFileStore.cfg
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# 	If you want to use filter with ConsoleUI, simply remove comments
+# 	from section below and provide valid filter entries.
+#   Each filter line has to start with "filter= " keyword.
+#   Filter can contain special wildcard characters:
+#     *  which stands for none or any literal;
+#     ?  which stands for single character.
+#   Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/inc/TestFileStore.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,192 @@
+/*
+* 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: STIF testclass declaration
+*
+*/
+
+#ifndef TESTFILESTORE_H
+#define TESTFILESTORE_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( KTestFileStoreLogPath, "\\logs\\testframework\\TestFileStore\\" ); 
+// Log file
+_LIT( KTestFileStoreLogFile, "TestFileStore.txt" ); 
+_LIT( KTestFileStoreLogFileWithTitle, "TestFileStore_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CTestFileStore;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  CTestFileStore test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CTestFileStore) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestFileStore* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTestFileStore();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestFileStore( 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_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt ExampleL( CStifItemParser& aItem );
+        
+        virtual TInt PanicExample(CStifItemParser& aItem);
+
+        virtual TInt TestFileServerCreateFile( CStifItemParser& aItem );      
+
+        virtual TInt TestFileServerWriteFile( CStifItemParser& aItem );
+        
+        virtual TInt TestFileServerReadFile( CStifItemParser& aItem );            
+        
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // TESTFILESTORE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/src/TestFileStore.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,199 @@
+/*
+* 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: This file contains testclass implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "TestFileStore.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTestFileStore::CTestFileStore
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTestFileStore::CTestFileStore( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFileStore::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CTestFileStore::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(KTestFileStoreLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KTestFileStoreLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KTestFileStoreLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+   
+// -----------------------------------------------------------------------------
+// CTestFileStore::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTestFileStore* CTestFileStore::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CTestFileStore* self = new (ELeave) CTestFileStore( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CTestFileStore::~CTestFileStore()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// CTestFileStore::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CTestFileStore::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("TestFileStore.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) CTestFileStore::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/STF/src/TestFileStoreBlocks.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,309 @@
+/*
+* 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: This file contains testclass implementation.
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "TestFileStore.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTestFileStore::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CTestFileStore::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFileStore::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CTestFileStore::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "Example", CTestFileStore::ExampleL ),
+        ENTRY( "PanicExample", CTestFileStore::PanicExample ),
+        ENTRY( "CreateFile", CTestFileStore::TestFileServerCreateFile ),
+        ENTRY( "WriteFile", CTestFileStore::TestFileServerWriteFile ),   
+        ENTRY( "ReadFile", CTestFileStore::TestFileServerReadFile )
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFileStore::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CTestFileStore::ExampleL( CStifItemParser& aItem )
+    {
+
+    // Print to UI
+    _LIT( KTestFileStore, "TestFileStore" );
+    _LIT( KExample, "In Example" );
+    TestModuleIf().Printf( 0, KTestFileStore, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+
+    TInt i = 0;
+    TPtrC string;
+    _LIT( KParam, "Param[%i]: %S" );
+    while ( aItem.GetNextString ( string ) == KErrNone )
+        {
+        TestModuleIf().Printf( i, KTestFileStore, 
+                                KParam, i, &string );
+        i++;
+        }
+
+    return KErrNone;
+
+    }
+
+
+TInt CTestFileStore::TestFileServerCreateFile( CStifItemParser& aItem )
+    {
+    // Print to UI
+    _LIT( KSTIF_TestFileServer, "STIF_TestFileServer" );
+    _LIT( KExample, "Create File" );
+    TestModuleIf().Printf( 0, KSTIF_TestFileServer, KExample );
+    // Print to log file
+    iLog->Log( KExample );  
+    
+    TInt                retValue = KErrNone ;
+    TInt                expErrorCode = 0;   
+    TPtrC filename;
+
+    TInt erro = aItem.GetNextString ( filename );
+    if( erro == KErrNone )
+        {
+        iLog->Log( filename );
+        RFs fileSession;
+        TRAP(erro, fileSession.Connect())
+        if ( erro != KErrNone)
+            {
+            iLog->Log(_L("Failed to connect to the file server"));
+            retValue = erro;
+            }
+        else
+            {
+            RFile file;
+            
+            CleanupClosePushL(fileSession);
+            
+            erro = file.Create( fileSession, filename, EFileRead | EFileWrite );
+            if(erro==expErrorCode)
+                {
+                iLog->Log(_L("===>Opening file passed with error code %D==="), erro);
+                }
+            else
+                {
+                iLog->Log(_L("--->Error in opening file expected error code %D error returned %D"), expErrorCode, erro);
+                }
+            CleanupStack::PopAndDestroy(&fileSession);
+            retValue = erro;
+            }       
+        }
+
+    return retValue;
+    }
+
+
+TInt CTestFileStore::TestFileServerWriteFile( CStifItemParser& aItem )
+    {
+    // Print to UI
+    _LIT( KSTIF_TestFileServer, "STIF_TestFileServer" );
+    _LIT( KExample, "Open File" );
+    TestModuleIf().Printf( 0, KSTIF_TestFileServer, KExample );
+    // Print to log file
+    iLog->Log( KExample );  
+    
+    TInt                retValue = KErrNone ;
+    TInt                expErrorCode = 0;   
+    TPtrC filename;
+
+    TInt erro = aItem.GetNextString ( filename );
+    if( erro == KErrNone )
+        {
+        iLog->Log( filename );
+        RFs fileSession;
+        TRAP(erro, fileSession.Connect())
+        if ( erro != KErrNone)
+            {
+            iLog->Log(_L("Failed to connect to the file server"));
+            }
+        else
+            {
+            RFile file;
+            
+            CleanupClosePushL(fileSession);
+            erro = file.Open(fileSession,filename,EFileRead);
+            if(erro==expErrorCode)
+                {
+                iLog->Log(_L("===>Opening file passed with error code %D==="), erro);
+                }
+            else
+                {
+                iLog->Log(_L("--->Error in opening file expected error code %D error returned %D"), expErrorCode, erro);
+                }
+            CleanupStack::PopAndDestroy(&fileSession);
+            }  
+            retValue = erro;
+        }
+    
+    return retValue;
+    }
+
+TInt CTestFileStore::TestFileServerReadFile( CStifItemParser& aItem )
+    {
+    // Print to UI
+    _LIT( KSTIF_TestFileServer, "STIF_TestFileServer" );
+    _LIT( KExample, "Open File" );
+    TestModuleIf().Printf( 0, KSTIF_TestFileServer, KExample );
+    // Print to log file
+    iLog->Log( KExample );  
+    
+    TInt                retValue = KErrNone ;
+    TInt                expErrorCode = 0;   
+    TPtrC filename;
+
+    TInt erro = aItem.GetNextString ( filename );
+    if( erro == KErrNone )
+        {
+        iLog->Log( filename );
+        RFs fileSession;
+        TRAP(erro, fileSession.Connect())
+        if ( erro != KErrNone)
+            {
+            iLog->Log(_L("Failed to connect to the file server"));
+            }
+        else
+            {
+            RFile file;
+            
+            CleanupClosePushL(fileSession);
+            erro = file.Open(fileSession,filename,EFileRead);
+            if(erro==expErrorCode)
+                {
+                iLog->Log(_L("===>Opening file passed with error code %D==="), erro);
+                }
+            else
+                {
+                iLog->Log(_L("--->Error in opening file expected error code %D error returned %D"), expErrorCode, erro);
+                }
+            CleanupStack::PopAndDestroy(&fileSession);
+            }  
+            retValue = erro;
+        }
+    
+    return retValue;
+    }
+
+
+TInt CTestFileStore::PanicExample(CStifItemParser& aItem)
+    {
+    _LIT( KSTIF_TestFileServer, "STIF_TestFileServer" );
+    _LIT( KFunction, "PanicExample" );
+    TestModuleIf().Printf( 0, KSTIF_TestFileServer, KFunction );
+    iLog->Log( KFunction );
+    TInt expectedPanicCode = 0;
+    TPtrC expectedPanicString;
+    TInt err1 = aItem.GetNextString(expectedPanicString);
+    TInt err2 = aItem.GetNextInt(expectedPanicCode);
+    if ( err1 != KErrNone || err2 != KErrNone)
+         {
+         iLog->Log(_L("Failed to read expected panic code"));
+         User::Panic(_L("USER-EXEC"), 1);
+         }
+     else
+         {
+         iLog->Log( _L("Create expected panic number= %D"),  expectedPanicCode);  
+         iLog->Log( _L("Create expected panic String= %S"),  &expectedPanicString);  
+         User::Panic(expectedPanicString, expectedPanicCode);           
+         }
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/data/TestFileServer_TEF.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,15 @@
+// Sample TestFileServer_TEF.ini
+// Your copyright notice
+
+[fileserver]  
+name        =fileserver
+
+[MyParamsSection]
+FileName = c:\testfileserver.test
+
+[RepeatSection]
+repeatParam = 10
+
+[PanicSection]
+PanicString = USER
+PanicCode = 5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/group/TestFileServer_TEF.driver	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ASCII"?>
+<driver:driver xmlns:driver="http://www.symbian.com/TestDriver">
+  <task name="TestFileServer_TEF" timeout="100000">
+    <task name="testProject" timeout="100000">
+      <executeOnPC>
+        <build testBuild="true" URI="${sourceroot}\TestFileServer_TEF\group"/>
+      </executeOnPC>
+      <transferToSymbian>
+        <transfer move="false" PCPath="${sourceroot}\TestFileServer_TEF\data\TestFileServer_TEF.ini" SymbianPath="c:\data\TestFileServer_TEF.ini"/>
+      </transferToSymbian>
+      <executeOnSymbian>
+        <testExecuteScript PCPath="${sourceroot}\TestFileServer_TEF\scripts\TestFileServer_TEF.script" SymbianPath="c:\scripts\TestFileServer_TEF.script"/>
+      </executeOnSymbian>
+    </task>
+  </task>
+</driver:driver>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/group/TestFileServer_TEF.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+
+#ifndef __TestFileServer_TEF_IBY__
+#define __TestFileServer_TEF_IBY__
+
+#include <testexecute.iby>
+
+file=ABI_DIR\BUILD_DIR\TestFileServer_TEF.exe								sys\bin\TestFileServer_TEF.exe
+data=EPOCROOT##Epoc32\winscw\c\data\TestFileServer_TEF.ini		\data\TestFileServer_TEF.ini
+data=EPOCROOT##Epoc32\winscw\c\scripts\TestFileServer_TEF.script	\scripts\TestFileServer_TEF.script
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/group/TestFileServer_TEF.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* 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: Implements common reset module for STIF 
+* TestFramework. According to this DLL template can be implemented 
+* licensee specific reset module.
+*
+*/
+#include <platform_paths.hrh>
+
+TARGET				TestFileServer_TEF.exe
+TARGETTYPE			exe
+UID					0x1000007B 0x06B13B52
+
+//Please add any change under here
+SOURCEPATH			..\src
+SOURCE				TestFileServer_TEFBlockServer.cpp
+SOURCE				TestFileServer_TEFBlockController.cpp
+SOURCE				CTestFileServerWrapper.cpp
+
+
+USERINCLUDE 		..\inc
+
+SYSTEMINCLUDE		\epoc32\include
+SYSTEMINCLUDE		\epoc32\include\test
+
+OS_LAYER_SYSTEMINCLUDE
+
+//Please add your system include under here. 
+
+LIBRARY				euser.lib
+LIBRARY				testexecuteutils.lib 
+LIBRARY				testexecutelogclient.lib 
+LIBRARY		        efsrv.lib
+LIBRARY			    iniparser.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+// BLD.INF
+//
+// Your copyright notice
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+..\scripts\TestFileServer_TEF.script		\epoc32\winscw\c\scripts\TestFileServer_TEF.script
+..\data\TestFileServer_TEF.ini			\epoc32\winscw\c\data\TestFileServer_TEF.ini
+.\TestFileServer_TEF.iby						\epoc32\rom\include\TestFileServer_TEF.iby
+
+PRJ_MMPFILES
+// None
+
+PRJ_TESTMMPFILES
+TestFileServer_TEF.mmp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/inc/CTestFileServerWrapper.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,84 @@
+/*
+* 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:
+*
+*/
+
+#ifndef __CTESTFILESERVERWRAPPER_H__
+#define __CTESTFILESERVERWRAPPER_H__
+
+#include <DataWrapper.h>
+
+class CTestFileServerWrapper : public CDataWrapper
+	{
+public:
+	// Default Constructor
+	CTestFileServerWrapper();
+	// Default Destructor
+	~CTestFileServerWrapper();
+
+	// Two-Phase Constructor
+	static CTestFileServerWrapper* NewL();
+
+	// Command Dispatcher
+	virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
+
+	// Getter for the wrapped object
+	virtual TAny* GetObject() { return iObject; }
+
+	// Setter for the wrapped object
+	inline virtual void SetObjectL(TAny* aObject)
+		{
+		delete iObject;
+		iObject = NULL;
+		iObject = static_cast<CTestFileServerWrapper*> (aObject);
+		}
+	
+
+	// Asynchronous Run
+	void RunL(CActive* aActive, TInt aIndex);
+	
+    inline virtual void DisownObjectL() 
+        {
+        iObject = NULL;
+        }
+    inline virtual TCleanupOperation CleanupOperation()
+        {
+        return CleanupOperation;
+        }
+
+protected:
+	void ConstructL();
+
+private:
+	// Testing CTestFileServer::CreateFile
+	inline void DoCmdCreateFile(const TDesC& aSection);
+
+	// Testing CTestFileServer::ReadFile
+	inline void DoCmdReadFile(const TDesC& aSection);
+	
+	inline void DoCmdPanicExample(const TDesC& aSection);
+	
+    static void CleanupOperation(TAny* aAny)
+        {
+        CTestFileServerWrapper* myObject = static_cast<CTestFileServerWrapper*>(aAny);
+        delete myObject;
+        }	
+
+
+private:
+	CActiveCallback* iActiveCallback;
+	TAny* iObject;
+	};
+#endif // __CTESTFILESERVERWRAPPER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/inc/TestFileServer_TEFBlockController.h	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*/
+
+#if (!defined __TESTFILESERVER_TEF_BLOCK_CONTROLLER_H__)
+#define __TESTFILESERVER_TEF_BLOCK_CONTROLLER_H__
+#include <TestBlockController.h>
+#include "CTestFileServerWrapper.h"
+
+class CTestFileServer_TEFBlockController : public CTestBlockController
+	{
+public:
+	static CTestFileServer_TEFBlockController* NewL();
+	// Base class pure virtual override
+	virtual CDataWrapper* CreateDataL(const TDesC& aData);
+
+// Please Add/modify your class members
+private:
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/inc/TestFileServer_TEFBlockServer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*/
+
+#if (!defined __TESTFILESERVER_TEF_BLOCK_SERVER_H__)
+#define __TESTFILESERVER_TEF_BLOCK_SERVER_H__
+#include <TestServer2.h>
+#include "TestFileServer_TEFBlockController.h"
+
+class CTestFileServer_TEFBlockServer : public CTestServer2
+	{
+public:
+	static CTestFileServer_TEFBlockServer* NewL();
+	// Base class pure virtual override
+	virtual CTestBlockController* CreateTestBlock();
+
+// Please Add/modify your class members
+private:
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/scripts/TestFileServer_TEF.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,71 @@
+//
+// Copyright (c) 2010 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: 
+//
+// Sample TestFileServer_TEF.script
+// Your copyright notice
+
+LOAD_SUITE TestFileServer_TEF 
+
+START_TESTCASE TEST-CASE1
+	START_TEST_BLOCK 100 TestFileServer_TEF c:\data\TestFileServer_TEF.ini
+		CREATE_OBJECT CTestFileServerWrapper fileserver
+		COMMAND !Error=-11 fileserver CreateFile MyParamsSection
+	END_TEST_BLOCK
+END_TESTCASE TEST-CASE1
+
+START_TESTCASE TEST-CASE2
+	START_TEST_BLOCK 100 TestFileServer_TEF c:\data\TestFileServer_TEF.ini
+		CREATE_OBJECT CTestFileServerWrapper fileserver
+		//START_REPEAT c:\data\TestFileServer_TEF.ini RepeatSection repeatParam
+		//PRINT Loop test
+		COMMAND fileserver ReadFile MyParamsSection	
+		//END_REPEAT
+	END_TEST_BLOCK
+END_TESTCASE TEST-CASE2
+
+START_TESTCASE TEST-CASE3
+	START_TEST_BLOCK 100 TestFileServer_TEF c:\data\TestFileServer_TEF.ini
+		CREATE_OBJECT CTestFileServerWrapper fileserver
+		DELAY 2000
+		COMMAND fileserver ReadFile MyParamsSection
+	END_TEST_BLOCK
+END_TESTCASE TEST-CASE3
+
+
+START_TESTCASE TEST-CASE4
+	START_TEST_BLOCK 100 TestFileServer_TEF c:\data\TestFileServer_TEF.ini
+		CREATE_OBJECT CTestFileServerWrapper fileserver
+		COMMAND fileserver PanicExample PanicSection
+	END_TEST_BLOCK  !PanicString=USER !PanicCode=5
+END_TESTCASE TEST-CASE4
+
+
+
+CONCURRENT
+
+START_TESTCASE TEST-SAMPLE-CONCURRENT
+	START_TEST_BLOCK 100 TestFileServer_TEF c:\data\TestFileServer_TEF.ini
+		CREATE_OBJECT CTestFileServerWrapper fileserver
+		COMMAND fileserver ReadFile MyParamsSection
+	END_TEST_BLOCK
+	START_TEST_BLOCK 100 TestFileServer_TEF c:\data\TestFileServer_TEF.ini
+		CREATE_OBJECT CTestFileServerWrapper fileserver
+		COMMAND !Error=-14 fileserver ReadFile MyParamsSection
+	END_TEST_BLOCK
+	START_TEST_BLOCK 100 TestFileServer_TEF c:\data\TestFileServer_TEF.ini
+		CREATE_OBJECT CTestFileServerWrapper fileserver
+		COMMAND !Error=-14 fileserver ReadFile MyParamsSection
+	END_TEST_BLOCK		
+END_TESTCASE TEST-SAMPLE-CONCURRENT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/src/CTestFileServerWrapper.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,247 @@
+/*
+* 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:
+*
+*/
+
+#include "CTestFileServerWrapper.h"
+_LIT(KCreateFile, "CreateFile");
+_LIT(KReadFile, "ReadFile");
+_LIT(KPanicExample, "PanicExample");
+_LIT(KFileName, "FileName");
+_LIT(KPanicString, "PanicString");
+_LIT(KPanicCode, "PanicCode");
+
+CTestFileServerWrapper::CTestFileServerWrapper() :
+    iObject(NULL)
+    {
+    }
+
+CTestFileServerWrapper::~CTestFileServerWrapper()
+    {
+    delete iObject;
+    iObject = NULL;
+    }
+
+CTestFileServerWrapper*CTestFileServerWrapper::NewL()
+    {
+    CTestFileServerWrapper* ret = new (ELeave) CTestFileServerWrapper();
+    CleanupStack::PushL(ret);
+    ret->ConstructL();
+    CleanupStack::Pop(ret);
+    return ret;
+    }
+
+void CTestFileServerWrapper::ConstructL()
+    {
+    iActiveCallback = CActiveCallback::NewL(*this);
+    // TODO : Initialize wrppped object
+
+    }
+
+void CTestFileServerWrapper::RunL(CActive* aActive, TInt aIndex)
+    {
+    TInt err = aActive->iStatus.Int();
+    SetAsyncError(aIndex, err);
+    DecOutstanding();
+    }
+
+TBool CTestFileServerWrapper::DoCommandL(const TTEFFunction& aCommand,
+        const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
+    {
+    TBool ret = ETrue;
+
+    if (KCreateFile() == aCommand)
+        {
+        // Testing CTestFileServer::CreateFile
+        DoCmdCreateFile(aSection);
+        }
+    else if (KReadFile() == aCommand)
+        {
+        // Testing CTestFileServer::ReadFile
+        DoCmdReadFile(aSection);
+        }
+    else if (KPanicExample() == aCommand)
+        {
+        DoCmdPanicExample(aSection);
+        }
+    else
+        {
+        ret = EFalse;
+        }
+    return ret;
+    }
+
+// Testing CTestFileServer::CreateFile
+void CTestFileServerWrapper::DoCmdCreateFile(const TDesC& aSection)
+    {
+    INFO_PRINTF1(_L("Running CreateFile()"));
+    // TODO : Add a method test here
+    // iObject->CreateFile
+    TInt err = 0;
+    TPtrC fileName;
+
+    if (!GetStringFromConfig(aSection, KFileName, fileName))
+        {
+        ERR_PRINTF1(_L("File Name noinline void DoCmdCreateFile(const TTEFSectionName& aSection); specified"));
+        SetBlockResult(EFail);
+        }
+    else
+        {
+        INFO_PRINTF2(_L("File to be opened is= %S "),&fileName);
+
+        RFs fileSession;
+            TRAP(err, fileSession.Connect())
+        if (err != KErrNone)
+            {
+            ERR_PRINTF1(_L("Failed to connect to the file server"));
+            SetBlockResult(EFail);
+            }
+        else
+            {
+            RFile file;
+
+            CleanupClosePushL(fileSession);
+            err = file.Create(fileSession, fileName, EFileRead | EFileWrite);
+            if (err == KErrNone)
+                {
+                INFO_PRINTF1(_L("===>Opening file passed"));
+                }
+            else
+                {
+                ERR_PRINTF2(_L("--->Error in opening file error returned %D"), err);
+                SetError(err);    
+                }
+            CleanupStack::PopAndDestroy(&fileSession);
+            }
+        }
+    // TODO : Please make changes for checking your test result
+    //SetBlockResult(EPass);
+    }
+
+// Testing CTestFileServer::ReadFile
+void CTestFileServerWrapper::DoCmdReadFile(const TDesC& aSection)
+    {
+    INFO_PRINTF1(_L("Running ReadFile()"));
+    // TODO : Add a method test here
+    // iObject->ReadFile
+        {
+        TInt err = 0;
+        TPtrC fileName;
+
+        INFO_PRINTF1(_L("In test step ReadFile"));
+
+        //Getting the file name from ini file 
+        if (!GetStringFromConfig(aSection, KFileName, fileName))
+            {
+            ERR_PRINTF1(_L("File Name not specified"));
+            SetBlockResult(EFail);
+            }
+        else
+            {
+            INFO_PRINTF2(_L("File to be opened is= %S "),&fileName);
+            }
+
+        if (BlockResult() == EPass)
+            {
+            RFs fileSession;
+                //Connecting to the file server
+                TRAP(err, fileSession.Connect())
+            if (err != KErrNone)
+                {
+                ERR_PRINTF1(_L("Failed to connect to the file server"));
+                SetError(err);
+                }
+            else
+                {
+                RFile file;
+
+                CleanupClosePushL(fileSession);
+                //Opening the file
+                err = file.Open(fileSession, fileName, EFileRead);
+                if (err != KErrNone)
+                    {
+                    ERR_PRINTF1(_L("Error in Opening file"));
+                    SetError(err);
+                    }
+                else
+                    {
+                    CleanupClosePushL(file);
+                    TInt fileSize = 0;
+                    err = file.Size(fileSize);
+                    if (err == KErrNone)
+                        {
+                        HBufC8 *data = HBufC8::NewLC(fileSize);
+                        TPtr8 ptr = data->Des();
+                        //      RaiseInstrumentationEventNotificationL(MTestInstrumentation::EPointFilestoreReadFileStart); 
+                        err = file.Read(ptr);
+                        //      RaiseInstrumentationEventNotificationL(MTestInstrumentation::EPointFilestoreReadFileStop); 
+                        if (err != KErrNone)
+                            {
+                            ERR_PRINTF1(_L("Error in reading the file"));
+                            SetError(err);
+                            }
+                        else
+                            {
+                            INFO_PRINTF1(_L("Read File passed with no error code"));
+                            SetBlockResult(EPass);
+                            }
+                        CleanupStack::PopAndDestroy(data);
+                        }
+                    else
+                        {
+                        ERR_PRINTF1(_L("Error in finding size of the file"));
+                        SetError(err);
+                        }
+                    file.Close();
+                    CleanupStack::PopAndDestroy(&file);
+
+                    }
+                CleanupStack::PopAndDestroy(&fileSession);
+                }
+            }
+
+        // TODO : Please make changes for checking your test result    
+        }
+        SetBlockResult(EPass);
+    }
+
+void CTestFileServerWrapper::DoCmdPanicExample(const TDesC& aSection)
+    {
+    INFO_PRINTF1(_L("Running DoCmdPanicExample()"));
+    //Getting the panic name from ini file 
+    TInt panicCode = 0;
+    TPtrC panicString;
+    if (!GetStringFromConfig(aSection, KPanicString, panicString))
+        {
+        ERR_PRINTF1(_L("Panic string not specified"));
+        SetBlockResult(EFail);
+        }
+    else
+        {
+        INFO_PRINTF2(_L("Get Panic String= %S "),&panicString);
+        }
+    if (!GetIntFromConfig(aSection, KPanicCode, panicCode))
+        {
+        ERR_PRINTF1(_L("Panic code not specified"));
+        SetBlockResult(EFail);
+        }
+    else
+        {
+        INFO_PRINTF2(_L("Get Panic Code= %d "),panicCode);
+        }
+    
+    User::Panic(panicString, panicCode);
+    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/src/TestFileServer_TEFBlockController.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*/
+
+#include "TestFileServer_TEFBlockController.h"
+
+_LIT(KCTestFileServerWrapper, "CTestFileServerWrapper");
+
+CTestFileServer_TEFBlockController* CTestFileServer_TEFBlockController::NewL()
+/**
+ * @return - Instance of the test block controller
+ */
+    {
+    CTestFileServer_TEFBlockController* block = new (ELeave) CTestFileServer_TEFBlockController();
+    return block;
+    }
+
+
+CDataWrapper* CTestFileServer_TEFBlockController::CreateDataL(const TDesC& aData)
+    {
+    CDataWrapper* wrapper = NULL;
+	if (KCTestFileServerWrapper() == aData)
+		{
+		wrapper = CTestFileServerWrapper::NewL();
+		}
+
+    return wrapper;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/src/TestFileServer_TEFBlockServer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,88 @@
+/*
+* 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:
+*
+*/
+
+#include "TestFileServer_TEFBlockServer.h"
+
+CTestFileServer_TEFBlockServer* CTestFileServer_TEFBlockServer::NewL()
+    {
+	CTestFileServer_TEFBlockServer* server = new (ELeave) CTestFileServer_TEFBlockServer();
+	CleanupStack::PushL(server);
+	server->ConstructL();
+	CleanupStack::Pop(server);
+	return server; 
+	}
+
+CTestBlockController* CTestFileServer_TEFBlockServer::CreateTestBlock()
+/**
+ * @return - Instance of the test block controller
+ * Called when CTestFileServer_TEFBlockServer initializing.
+ */
+    {
+    CTestBlockController* controller = NULL;
+    TRAPD(err, controller = CTestFileServer_TEFBlockController::NewL());
+    return controller;
+    }
+
+// Secure variants much simpler
+// For EKA2, just an E32Main and a MainL()
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+	// Leave the hooks in for platform security
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().DataCaging(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler* sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CTestFileServer_TEFBlockServer* server = NULL;
+	// Create the CTestFileServer_TEFBlockServer derived server
+	TRAPD(err,server = CTestFileServer_TEFBlockServer::NewL());
+	if(!err)
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	delete server;
+	delete sched;
+	}
+
+
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAPD(err,MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return err;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/data/SystestFilestoreSuite.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,16 @@
+[Case1Section]
+filename = c:\testfileserver.test
+
+[Case2Section]
+filename = c:\testfileserver.test
+repeatParam  = 3
+
+[Case3Section]
+panicString = USER
+panicCode = 5
+
+[Case4Section]
+filename = c:\testfileserver.test
+
+[Case5Section]
+filename = c:\testfileserver.test
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/group/TEF_STEP.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,44 @@
+/*
+* 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: 
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET		  TEFSTEPFileStore.exe
+TARGETTYPE	  exe
+UID			 0 0xEBA805B7
+
+SYSTEMINCLUDE		\epoc32\include
+SYSTEMINCLUDE		\epoc32\include\test
+
+OS_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE 		..\inc
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE_UDEBONLY
+#endif
+SOURCEPATH ..\src
+SOURCE SystestFilestoreSuiteServer.cpp TestFSCreateFile.cpp TestFSReadFile.cpp
+
+LIBRARY				euser.lib
+LIBRARY				testexecuteutils.lib 
+LIBRARY				testexecutelogclient.lib 
+
+LIBRARY		efsrv.lib
+
+SOURCEPATH ..\src
+SOURCE TestFSPanicExample.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,26 @@
+/*
+* 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: 
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+..\scripts\SystestFilestoreSuite.script		\epoc32\winscw\c\scripts\SystestFilestoreSuite.script
+..\data\SystestFilestoreSuite.ini		\epoc32\winscw\c\data\SystestFilestoreSuite.ini
+
+PRJ_MMPFILES
+TEF_STEP.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/inc/SystestFilestoreSuiteServer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -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: 
+*
+*/
+
+#if (!defined __SYSTESTFILESTORE_SERVER_H__)
+#define __SYSTESTFILESTORE_SERVER_H__
+#include <TestExecuteServerBase.h>
+
+
+class CSystestFilestoreSuite : public CTestServer
+	{
+public:
+	static CSystestFilestoreSuite* NewL();
+	// Base class pure virtual override
+	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
+
+// Please Add/modify your class members
+private:
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/inc/TestFSCreateFile.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,43 @@
+/*
+* 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: 
+*
+*/
+
+#if (!defined __TEST_FS_CREATE_FILE_H__)
+#define __TEST_FS_CREATE_FILE_H__
+
+// System includes
+
+// User includes
+#include <TestExecuteStepBase.h>
+
+// Literal constant for test step name
+_LIT(KCreateFile,"CreateFile");
+
+class CTestFSCreateFile :public CTestStep
+/**
+@internalAll
+@test
+The class implements a test step which creates files or directories. 
+ */
+	{
+public:
+	CTestFSCreateFile();
+	~CTestFSCreateFile();
+	virtual TVerdict doTestStepL();
+	
+	};
+
+#endif /* __TEST_FS_CREATE_FILE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/inc/TestFSPanicExample.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,33 @@
+/*
+* 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:
+*
+*/
+
+#ifndef TESTFSPANICEXAMPLE_H_
+#define TESTFSPANICEXAMPLE_H_
+#include <TestExecuteStepBase.h>
+
+// Literal constant for test step name
+_LIT(KPanicExample,"PanicExample");
+
+class CTestFSPanicExample : public CTestStep
+    {
+public:
+    CTestFSPanicExample();
+    ~CTestFSPanicExample();
+    virtual TVerdict doTestStepL();
+    };
+
+#endif /* TESTFSPANICEXAMPLE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/inc/TestFSReadFile.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,39 @@
+/*
+* 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:
+*
+*/
+#if (!defined __TEST_FS_READ_FILE_H__)
+#define __TEST_FS_READ_FILE_H__
+
+// User includes
+#include <TestExecuteStepBase.h>
+
+// Literal constant for test step name
+_LIT(KTestFSReadFile,"ReadFile");
+
+class CTestFSReadFile :public CTestStep
+/**
+@internalAll
+@test
+The class implements a test step which reads data from a file.
+ */
+	{
+public:
+	CTestFSReadFile();
+	~CTestFSReadFile();
+	virtual TVerdict doTestStepL();
+	};
+
+#endif /* __TEST_FS_READ_FILE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/scripts/SystestFilestoreSuite.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,55 @@
+//
+// Copyright (c) 2010 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: 
+//
+// Sample Test Script
+
+PRINT Run all test Suite Tests
+
+LOAD_SERVER TEFSTEPFileStore
+
+START_TESTCASE  TestCase-1
+RUN_TEST_STEP !Error=-11 5 TEFSTEPFileStore CreateFile  c:\data\SystestFilestoreSuite.ini	Case1Section
+END_TESTCASE TestCase-1
+
+
+START_TESTCASE TestCase-2
+START_REPEAT c:\data\SystestFilestoreSuite.ini Case2Section repeatParam
+PRINT repeat testing.
+RUN_TEST_STEP 1000  TEFSTEPFileStore ReadFile c:\data\SystestFilestoreSuite.ini Case2Section
+END_REPEAT
+END_TESTCASE TestCase-2
+
+START_TESTCASE TestCase-3
+PRINT test Expected Panic.
+RUN_TEST_STEP !PanicString=USER !PanicCode=5 1000  TEFSTEPFileStore PanicExample c:\data\SystestFilestoreSuite.ini Case3Section
+END_TESTCASE TestCase-3
+
+START_TESTCASE TestCase-4
+PRINT test Delay.
+DELAY 2000
+RUN_TEST_STEP 1000 TEFSTEPFileStore ReadFile c:\data\SystestFilestoreSuite.ini Case4Section
+END_TESTCASE TestCase-4
+
+
+
+
+CONCURRENT
+START_TESTCASE  TestCase-5
+RUN_TEST_STEP 1000  TEFSTEPFileStore ReadFile  c:\data\SystestFilestoreSuite.ini	Case5Section
+RUN_TEST_STEP !Error=-14 1000  TEFSTEPFileStore ReadFile  c:\data\SystestFilestoreSuite.ini	Case5Section
+RUN_TEST_STEP !Error=-14 1000  TEFSTEPFileStore ReadFile  c:\data\SystestFilestoreSuite.ini	Case5Section
+END_TESTCASE TestCase-5
+
+PRINT Complete testSuite
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/src/SystestFilestoreSuiteServer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,111 @@
+/*
+* 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:
+*
+*/
+#include "SystestFilestoreSuiteServer.h"
+#include "TestFSCreateFile.h"
+#include "TestFSReadFile.h"
+#include "TestFSPanicExample.h"
+
+_LIT(KServerName,"TEFSTEPFileStore");//SystestFilestoreSuite
+CSystestFilestoreSuite* CSystestFilestoreSuite::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+    {
+    CSystestFilestoreSuite * server = new (ELeave) CSystestFilestoreSuite();
+    CleanupStack::PushL(server);
+
+    server->ConstructL(KServerName);
+    CleanupStack::Pop(server);
+    return server;
+    }
+
+// Secure variants much simpler
+// For EKA2, just an E32Main and a MainL()
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+    {
+    // Leave the hooks in for platform security
+#if (defined __DATA_CAGING__)
+    RProcess().DataCaging(RProcess::EDataCagingOn);
+    RProcess().DataCaging(RProcess::ESecureApiOn);
+#endif
+    CActiveScheduler* sched = NULL;
+    sched = new (ELeave) CActiveScheduler;
+    CActiveScheduler::Install(sched);
+    CSystestFilestoreSuite* server = NULL;
+    // Create the CTestServer derived server
+    TRAPD(err,server = CSystestFilestoreSuite::NewL());
+    if (!err)
+        {
+        // Sync with the client and enter the active scheduler
+        RProcess::Rendezvous(KErrNone);
+        sched->Start();
+        }
+    delete server;
+    delete sched;
+    }
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+    {
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    if (cleanup == NULL)
+        {
+        return KErrNoMemory;
+        }
+    TRAPD(err,MainL());
+    delete cleanup;
+    __UHEAP_MARKEND;
+    return err;
+    }
+
+CTestStep* CSystestFilestoreSuite::CreateTestStep(const TDesC& aStepName)
+/**
+ * @return - A CTestStep derived instance
+ * Secure and non-secure variants
+ * Implementation of CTestServer pure virtual
+ */
+    {
+    CTestStep* testStep = NULL;
+
+
+    if (aStepName == KCreateFile)
+        {
+        testStep = new CTestFSCreateFile();
+        }
+    else if(aStepName == KTestFSReadFile)
+        {
+         testStep = new CTestFSReadFile();   
+        }
+    else if(aStepName == KPanicExample)
+        {
+        testStep = new CTestFSPanicExample();
+        }
+    
+    return testStep;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/src/TestFSCreateFile.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,90 @@
+/*
+* 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:
+*
+*/
+
+// User includes
+#include "TestFSCreateFile.h"
+// Literal constants 
+_LIT(KFileName, "filename");
+
+CTestFSCreateFile::CTestFSCreateFile()
+/**
+ Constructor.
+
+ Sets the test step name.
+ */
+    {
+    // Call base class method to set up the human readable name for logging
+    SetTestStepName(KCreateFile);
+    }
+
+CTestFSCreateFile::~CTestFSCreateFile()
+/**
+ Destructor
+ */
+    {
+    }
+
+TVerdict CTestFSCreateFile::doTestStepL()
+/**
+ This is implementation of the pure virtual function of CTestStep.
+ It creates files or directories
+ @return TVerdict - the test result
+ */
+    {
+    INFO_PRINTF1(_L("In test step CreateFile"));
+
+    if (TestStepResult() == EPass)
+        {
+
+        // Get file or directory name
+        TPtrC file;
+        if (GetStringFromConfig(ConfigSection(), KFileName, file))
+            {
+            INFO_PRINTF2(_L("File name %S"), &file);
+            }
+        else
+            {
+            ERR_PRINTF1(_L("No File Name"));
+            SetTestStepResult(EFail);
+            }
+        
+        RFile rf;
+        RFs fileSession;
+        CleanupClosePushL(rf);
+        TRAPD(error, fileSession.Connect())
+        if ( error != KErrNone)
+            {
+            ERR_PRINTF2(_L("File Session connect error, %d"), error);
+            SetTestStepResult(EFail);
+            }
+        CleanupClosePushL(fileSession);
+        TInt errCode = rf.Create(fileSession, file, EFileWrite);
+        CleanupStack::PopAndDestroy(&fileSession);
+        CleanupStack::PopAndDestroy(&rf);
+                
+        
+        if (KErrNone != errCode)
+            {
+            SetTestStepError(errCode);
+            ERR_PRINTF2(_L("--->Error in Creating file, get result %D"), errCode);
+            SetTestStepResult(EFail);
+            }
+        
+        }
+        return TestStepResult();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/src/TestFSPanicExample.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+/*
+* 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:
+*
+*/
+#include "TestFSPanicExample.h"
+
+_LIT(KPanicString, "panicString");
+_LIT(KPanicCode, "panicCode");
+
+CTestFSPanicExample::CTestFSPanicExample()
+    {
+    // TODO Auto-generated constructor stub
+    SetTestStepName(KPanicExample);
+    }
+
+CTestFSPanicExample::~CTestFSPanicExample()
+    {
+    // TODO Auto-generated destructor stub
+    }
+
+
+TVerdict CTestFSPanicExample::doTestStepL()
+    {
+    TInt panicCode = 0;
+    if (GetIntFromConfig(ConfigSection(), KPanicCode, panicCode))
+        {
+        INFO_PRINTF2(_L("Expected Panic Code= %d"), panicCode);
+        }
+    else
+        {
+        ERR_PRINTF1(_L("Panic Code not set"));
+        SetTestStepResult(EFail);
+        }
+    // Get file or directory name
+    TPtrC panicString;
+    if (GetStringFromConfig(ConfigSection(), KPanicString, panicString))
+        {
+        INFO_PRINTF2(_L("Expected Panic String= %S"), &panicString);
+        }
+    else
+        {
+        ERR_PRINTF1(_L("Panic String not set"));
+        SetTestStepResult(EFail);
+        }
+    
+    User::Panic(panicString, panicCode);    
+    return TestStepResult();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/FileStore/TEF_STEP/src/TestFSReadFile.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,126 @@
+/*
+* 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:
+*
+*/
+
+// User includes
+#include "TestFSReadFile.h"
+
+// System includes
+#include <e32base.h>
+
+
+// Literal constants
+_LIT(KFileName,					"filename");
+
+CTestFSReadFile::CTestFSReadFile()
+/**
+Constructor
+ */
+	{
+	// Call base class method to set up the human readable name for logging
+	SetTestStepName(KTestFSReadFile);
+	}
+
+CTestFSReadFile::~CTestFSReadFile()
+/**
+Destructor
+ */
+	{
+	}
+
+TVerdict CTestFSReadFile::doTestStepL()
+/**
+This is implementation of the pure virtual function of CTestStep.
+It reads data from a file.
+@return TVerdict - the test result
+ */
+	{
+	TInt				err = 0;
+	TPtrC				fileName;
+	
+	INFO_PRINTF1(_L("In test step ReadFile"));
+
+	//Getting the file name from ini file 
+	if(!GetStringFromConfig(ConfigSection(), KFileName ,fileName))
+		{
+		ERR_PRINTF1(_L("File Name not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		INFO_PRINTF2(_L("File to be opened is= %S "),&fileName);
+		}
+
+	if(TestStepResult() == EPass)
+		{
+		RFs fileSession;
+		//Connecting to the file server
+		TRAP(err, fileSession.Connect())
+		if ( err != KErrNone)
+			{
+			ERR_PRINTF1(_L("Failed to connect to the file server"));
+			SetTestStepError(err);
+			}
+		else
+			{
+			RFile file;
+
+			CleanupClosePushL(fileSession);
+			//Opening the file
+			err = file.Open(fileSession,fileName,EFileRead);
+			if ( err != KErrNone)
+				{
+				ERR_PRINTF1(_L("Error in Opening file"));
+				SetTestStepError(err);
+				}
+			else
+				{
+				CleanupClosePushL(file);
+				TInt fileSize = 0;
+				err = file.Size(fileSize);
+				if(err == KErrNone)
+					{
+					HBufC8 *data = HBufC8::NewLC(fileSize);
+					TPtr8 ptr = data->Des();
+			//		RaiseInstrumentationEventNotificationL(MTestInstrumentation::EPointFilestoreReadFileStart); 
+					err = file.Read(ptr);
+			//		RaiseInstrumentationEventNotificationL(MTestInstrumentation::EPointFilestoreReadFileStop); 
+					if(err != KErrNone)
+						{
+						ERR_PRINTF1(_L("Error in reading the file"));
+						SetTestStepError(err);			
+						}
+					else
+						{
+						INFO_PRINTF1(_L("Read File passed with no error code"));
+						SetTestStepResult(EPass);
+						}
+					CleanupStack::PopAndDestroy(data);
+					}
+				else
+					{
+					ERR_PRINTF1(_L("Error in finding size of the file"));
+					SetTestStepError(err);		
+					}
+				file.Close();
+				CleanupStack::PopAndDestroy(&file);
+						
+				}
+			CleanupStack::PopAndDestroy(&fileSession);
+			}
+		}
+	return TestStepResult();
+	}
Binary file testexecfw/stf/examples/MigrationExample/doc/TEF_to_STF_Migration_Guide.doc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/MigrationExample/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,29 @@
+/*
+* 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: This file contains the header of additional functions 
+* needed for Python support and used in PythonScripter, TestEngine 
+* and TestCombiner.
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+
+#include "../FileStore/TEF_BLOCK/group/bld.inf"
+#include "../FileStore/TEF_STEP/group/bld.inf"
+#include "../FileStore/STF/group/bld.inf"
+
+PRJ_MMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/demomodule/BMARM/DEMOMODULEU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/demomodule/BWINS/DEMOMODULEU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+	??1TScriptObject@@UAE@XZ @ 3 NONAME ABSENT ; TScriptObject::~TScriptObject(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/demomodule/eabi/Demomoduleu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/demomodule/group/Demomodule.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,47 @@
+/*
+* 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: MMP file for STIF Test Framework's Demomodule.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET      Demomodule.dll
+TARGETTYPE  dll
+DEFFILE     Demomodule.def
+
+CAPABILITY	ALL -TCB
+VENDORID 	0x101FB657
+SECUREID        0x102073DB
+
+USERINCLUDE     ../inc 
+USERINCLUDE     ../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          DemoModule.cpp
+SOURCE          Demomodulecases.cpp
+
+LIBRARY     euser.lib
+LIBRARY     stiftestinterface.lib
+LIBRARY     stiftestengine.lib
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/demomodule/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,33 @@
+/*
+* 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:
+*
+*	Build information for STIF Test Framework's DemoModule.
+*/
+
+PRJ_PLATFORMS
+
+	DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+
+PRJ_MMPFILES
+
+	Demomodule.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/demomodule/inc/DemoModule.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,327 @@
+/*
+* 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: This file contains the header file of DemoModule of 
+* STIF TestFramework.
+*
+*/
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// Logging path
+_LIT( KDemoModuleLogPath, "\\logs\\testframework\\DemoModule\\" ); 
+// Log file
+_LIT( KDemoModuleLogFile, "DemoModule.txt" ); 
+_LIT( KDemoModuleLogFileWithTitle, "DemoModule_[%S].txt" ); 
+
+// Function pointer related internal definitions
+#define GETPTR &  
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CDemoModule;
+
+// DATA TYPES
+// None
+
+// A typedef for function that does the actual testing,
+// function is a type 
+// TInt CDemoModule::<NameOfFunction> ( TTestResult& aResult )
+typedef TInt (CDemoModule::* TestFunction)(TTestResult&);    
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText* iCaseName;
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;    
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {        
+        };
+
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  This a DemoModule class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CDemoModule) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor.
+        */
+        static CDemoModule* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDemoModule();
+
+    public: // New functions
+    // None
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the 
+        *       DemoModule. It is called once for every instance of 
+        *       TestModuleDemoModule after its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of DemoModule.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from DemoModule. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+    
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& aFailureType,
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */);
+    protected:  // New functions    
+    // None
+
+    protected:  // Functions from base classes
+    // None
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CDemoModule();
+
+        /**
+        * 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& );
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        /**
+        * Simple math calculation test.
+        */
+        TInt SimpleMathTest( TTestResult& aResult );
+
+        /**
+        * Math calculation test.
+        */
+        TInt MathTest( TTestResult& aResult );
+
+        /**
+        * Actual Hardcoded test case functions are listed below.
+        */
+
+        /**
+        * Printing test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt PrintTest( TTestResult& aResult );
+
+        /**
+        * Printing loop test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt LoopTest( TTestResult& aResult );
+
+        /**
+        * Test case for heap memory allocation
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return panic or Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt HeapMemoryAllocation( TTestResult& aResult );
+
+    public:     // Data
+    // None
+
+    protected:  // Data
+    // None
+
+    private:    // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+        // Pointer to logger
+        CStifLogger * iLog;
+
+        // Normal logger
+        CStifLogger* iStdLog;
+
+        // Test case logger
+        CStifLogger* iTCLog;
+
+        // Flag saying if test case title should be added to log file name
+        TBool iAddTestCaseTitleToLogName;
+
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+    // None
+
+    protected:  // Friend classes
+    // None
+
+    private:    // Friend classes
+    // None
+
+    };
+
+#endif      // DEMOMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/demomodule/src/DemoModule.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,595 @@
+/*
+* 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: This file (DemoModule.cpp) contains all test 
+* framework related parts of this test module. Actual test cases 
+* are implemented in file DemoModuleCases.cpp.
+*
+* CTestModuleDemo is an example of test module implementation. This example
+* uses hard coded test cases (i.e it does not have any test case
+* configuration file).
+*
+* Example uses function pointers to call test cases. This provides an easy
+* method to add new test cases.
+*
+* See function Cases in file DemoModuleCases.cpp for instructions how to
+* add new test cases. It is not necessary to modify this file when adding
+* new test cases.
+*
+* To take this module into use, add following lines to test framework
+* initialisation file:
+*
+* # Demo module
+* [New_Module]
+* ModuleName= DemoModule
+* [End_Module]
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include "DemoModule.h"
+#include <e32math.h>
+#include "SettingServerClient.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 =======================================
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: CDemoModule
+
+    Description: C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CDemoModule::CDemoModule()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: ConstructL
+
+    Description: Symbian 2nd phase constructor that can leave.
+
+    Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+    with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+    allocates memory from heap and therefore causes error situations with OOM 
+    testing. For more information about STIF Logger construction, see STIF 
+    Users Guide.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CDemoModule::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+    iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle;
+    
+    // Constructing static buffer size logger, needed with OOM testing because
+    // normally logger allocates memory from heap!
+    iStdLog = CStifLogger::NewL( KDemoModuleLogPath, 
+                              KDemoModuleLogFile,
+                              CStifLogger::ETxt,
+                              CStifLogger::EFile,
+                              ETrue,
+                              ETrue,
+                              ETrue,
+                              EFalse,
+                              ETrue,
+                              EFalse,
+                              100 );
+    iLog = iStdLog;
+    
+    // Sample how to use logging
+    _LIT( KLogInfo, "DemoModule logging starts!" );
+    iLog->Log( KLogInfo );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleDemo
+
+    Method: NewL
+
+    Description: Two-phased constructor. Constructs new CTestModuleDemo
+    instance and returns pointer to it.
+
+    Parameters:    None
+
+    Return Values: CTestModuleDemo*: new object.
+
+    Errors/Exceptions: Leaves if memory allocation fails or ConstructL leaves.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CDemoModule* CDemoModule::NewL()
+    {
+    CDemoModule* self = new (ELeave) CDemoModule;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleDemo
+
+    Method: ~CTestModuleDemo
+
+    Description: Destructor.
+
+    Parameters:    None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CDemoModule::~CDemoModule()
+    { 
+    iLog = NULL;
+    delete iStdLog;
+    iStdLog = NULL;
+    delete iTCLog;
+    iTCLog = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CTestModuleDemo
+
+    Method: InitL
+
+    Description: Method for test case initialization
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+-------------------------------------------------------------------------------
+*/
+TInt CDemoModule::InitL( TFileName& /*aIniFile*/, 
+                         TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleDemo
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module has 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 CDemoModule::GetTestCasesL( const TFileName& /*aConfig*/, 
+                                 RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; 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( Case(i).iCaseName );
+
+        // 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: CTestModuleDemo
+
+    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 CDemoModule::RunTestCaseL( const TInt aCaseNumber,
+                                const TFileName& /* aConfig */,
+                                TTestResult& aResult )
+    {
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    _LIT( KLogInfo, "Starting testcase [%S]" );
+    iLog->Log( KLogInfo, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        //Open new log file with test case title in file name
+        if(iAddTestCaseTitleToLogName)
+            {
+            //delete iLog; //Close currently opened log
+            //iLog = NULL;
+            //Delete test case logger if exists
+            if(iTCLog)
+                {
+                delete iTCLog;
+                iTCLog = NULL;
+                }
+                
+            TFileName logFileName;
+            TName title;
+            TestModuleIf().GetTestCaseTitleL(title);
+        
+            logFileName.Format(KDemoModuleLogFileWithTitle, &title);
+
+            iTCLog = CStifLogger::NewL(KDemoModuleLogPath, 
+                                     logFileName,
+                                     CStifLogger::ETxt,
+                                     CStifLogger::EFile,
+                                     ETrue,
+                                     ETrue,
+                                     ETrue,
+                                     EFalse,
+                                     ETrue,
+                                     EFalse,
+                                     100);
+            iLog = iTCLog;
+            }
+
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        //execStatus  = ( this->*iMethod )( aResult );
+        TRAPD(err, execStatus  = ( this->*iMethod )( aResult ));
+        if(iAddTestCaseTitleToLogName)
+            {
+            //Restore standard log and destroy test case logger
+            iLog = iStdLog;
+            delete iTCLog; //Close currently opened log
+            iTCLog = NULL;
+            }
+        User::LeaveIfError(err);
+        
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: OOMTestQueryL
+
+    Description: Checks test case information for OOM execution. 
+
+    Return Values: TBool
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CDemoModule::OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                  const TInt aCaseNumber, 
+                                  TOOMFailureType& /* aFailureType */, 
+                                  TInt& aFirstMemFailure, 
+                                  TInt& aLastMemFailure ) 
+    {
+    _LIT( KLogInfo, "CDemoModule::OOMTestQueryL" );
+    iLog->Log( KLogInfo ); 
+
+    aFirstMemFailure = Case( aCaseNumber ).iFirstMemoryAllocation;
+    aLastMemFailure = Case( aCaseNumber ).iLastMemoryAllocation;
+
+    return Case( aCaseNumber ).iIsOOMTest;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: OOMTestInitializeL
+
+    Description: Used to perform the test environment setup for a particular
+    OOM test case. Test Modules may use the initialization file to read 
+    parameters for Test Module initialization but they can also have their own
+    configure file or some other routine to initialize themselves. 
+
+    NOTE: User may add implementation for OOM test environment initialization.
+    Usually no implementation is required.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CDemoModule::OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                      const TInt /* aCaseNumber */ )
+    {
+    _LIT( KLogInfo, "CDemoModule::OOMTestInitializeL" );
+    iLog->Log( KLogInfo ); 
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: OOMHandleWarningL
+
+    Description: Used in OOM testing to provide a way to the derived TestModule 
+    to handle warnings related to non-leaving or TRAPped allocations.
+
+    In some cases the allocation should be skipped, either due to problems in 
+    the OS code or components used by the code being tested, or even inside the
+    tested components which are implemented this way on purpose (by design), so
+    it is important to give the tester a way to bypass allocation failures.
+
+    NOTE: User may add implementation for OOM test warning handling. Usually no
+    implementation is required.    
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CDemoModule::OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                     const TInt /* aCaseNumber */, 
+                                     TInt& /* aFailNextValue */ )
+    {
+    _LIT( KLogInfo, "CDemoModule::OOMHandleWarningL" );
+    iLog->Log( KLogInfo );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: OOMTestFinalizeL
+
+    Description: Used to perform the test environment cleanup for a particular OOM 
+    test case.
+
+    NOTE: User may add implementation for OOM test environment finalization.
+    Usually no implementation is required.   
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CDemoModule::OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ )
+    {
+    _LIT( KLogInfo, "CDemoModule::OOMTestFinalizeL" );
+    iLog->Log( KLogInfo );
+
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CDemoModule::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/demomodule/src/Demomodulecases.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,495 @@
+/*
+* 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: This module contains the implementation of 
+* CTestModuleDemo class member functions that does the actual 
+* tests.
+*
+*/
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "DemoModule.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 =======================================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: Case
+
+    Description: Returns a test case by number.
+
+    This function contains an array of all available test cases 
+    i.e pair of case name and test function. If case specified by parameter
+    aCaseNumber is found from array, then that item is returned.
+
+    The reason for this rather complicated function is to specify all the
+    test cases only in one place. It is not necessary to understand how
+    function pointers to class member functions works when adding new test
+    cases. See function body for instructions how to add new test case.
+    
+    Parameters:    const TInt aCaseNumber :in:      Test case number
+
+    Return Values: const TCaseInfo Struct containing case name & function
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/ 
+const TCaseInfo CDemoModule::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /*
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    *
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    OOMHard.cpp file and to OOMHard.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+        
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g. 
+        // CDemoModule::PrintTest. Otherwise the compiler
+        // gives errors.
+                
+        ENTRY( "Loop test", CDemoModule::LoopTest ),
+        ENTRY( "Simple math test", CDemoModule::SimpleMathTest ),
+        ENTRY( "Math test", CDemoModule::MathTest ),
+        ENTRY( "Print test", CDemoModule::PrintTest ),
+        // Example how to use OOM functionality
+        OOM_ENTRY( "Heap memory allocation with OOM [ABORT]", CDemoModule::HeapMemoryAllocation, ETrue, 1, 2 ),
+        ENTRY( "Heap memory allocation (passes)", CDemoModule::HeapMemoryAllocation )
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: SimpleMathTest
+
+    Description: Simple Math testing.
+
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDemoModule::SimpleMathTest( TTestResult& aResult )
+    {
+    /* Test with mathematic calculations and printing */
+    _LIT( KDefinion , "RunTestCase");
+    _LIT( KData , "Simple Math calculations");
+    TestModuleIf().Printf( 0, KDefinion, KData );
+
+    // Random number.
+    TReal num = Math::Random(); 
+    // Intermediate result
+    TReal sqrt = 0;
+    // Result
+    TReal result = 0;
+
+    // Take square root of the number
+    TInt ret = Math::Sqrt( sqrt, num );
+    if( ret != KErrNone )
+        {
+        // Return error if Sqrt failed
+        _LIT( KResult ,"Math::Sqrt failed");
+        aResult.iResultDes.Copy( KResult );
+        aResult.iResult = KErrGeneral;
+
+        // Case was executed but failed
+        return KErrNone;
+        }
+
+    // Take power of two from the previous result
+    ret = Math::Pow( result, sqrt, 2 );
+    if( ret != KErrNone )
+        {
+        // Return error if Pow failed
+        _LIT( KResult ,"Math::Pow failed");
+        aResult.iResultDes.Copy( KResult );
+        aResult.iResult = KErrGeneral;
+        
+        // Case was executed but failed
+        return KErrNone;
+        }
+
+    // Compare final result to the original value, 
+    // rounded values should usually be same.
+    TInt32 a1;
+    TInt32 a2;
+    TInt r = Math::Int(a1, result);
+
+    if (r != KErrNone )
+        {
+        _LIT( KResult ,"1st conversion failed");
+        aResult.iResultDes.Copy( KResult );
+        aResult.iResult = r;
+        return KErrNone;
+        }
+
+    r = Math::Int(a2, num);
+    if (r != KErrNone )
+        {
+        _LIT( KResult ,"2nd conversion failed");
+        aResult.iResultDes.Copy( KResult );
+        aResult.iResult = r;
+        return KErrNone;
+        }
+
+    if(  a1 != a2 )
+        {
+        _LIT( KResult ,"Calculation doesn't match");
+        // Return error if comparison failed
+        aResult.iResultDes.Copy( KResult );
+        aResult.iResult = KErrGeneral;
+        // Case was executed but failed
+        return KErrNone;
+        }
+
+
+    // Test case passed
+
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription , "Test case passed");
+    aResult.SetResult( KErrNone, KDescription );
+    //aResult.iResult = KErrNone;
+    //aResult.iResultDes = KDescription;
+
+    // Case was executed
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: MathTest
+
+    Description: Print loop test. Actually does not test anything, just
+    demonstrate how to print. Test is always pased.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDemoModule::LoopTest( TTestResult& aResult )
+    {
+
+    /* Simple print and wait loop */
+    _LIT( KDefinion ,"State");
+    _LIT( KData ,"Looping");
+    TestModuleIf().Printf( 0, KDefinion, KData );
+    for( TInt i=0; i<10; i++)
+        {
+        _LIT( KRunning ,"Running");
+        _LIT( KLoop ,"%d");
+        TestModuleIf().Printf( 0, KRunning, KLoop, i);
+        User::After( 1000000 );
+        }
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinion, KData2 );
+
+    // Test case passed
+
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription , "Test case passed");
+    aResult.SetResult( KErrNone, KDescription );
+    //aResult.iResult = KErrNone;
+    //aResult.iResultDes = KDescription;
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: MathTest
+
+    Description: Math testing.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDemoModule::MathTest( TTestResult& aResult )
+    {
+    /* Test with mathematic calculations and printing */
+    _LIT( KDefinion ,"RunTestCase");
+    _LIT( KData ,"Math calculations");
+    TestModuleIf().Printf( 0, KDefinion, KData );
+    // Result
+    TRealX res;
+    // Random numbers
+    TInt rand[6];
+    TRealX coef[5];
+    TInt i;
+    TInt j;
+    for( i=0; i<10; i++ )
+        {
+        for(j=0; j<6; j++)
+            rand[j] = Math::Random(); 
+        for(j=0; j<5; j++)
+            coef[j] = rand[j];
+        Math::PolyX(res, rand[5], 5, coef );
+
+        _LIT( KResult ,"Result %d");
+        TestModuleIf().Printf( 0, KDefinion, KResult, ( TInt )res);
+        }
+
+    // Test case passed
+
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription , "Test case passed");
+    aResult.SetResult( KErrNone, KDescription );
+    //aResult.iResult = KErrNone;
+    //aResult.iResultDes = KDescription;
+
+    // Case was executed
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: PrintTest
+
+    Description: Printing testing.
+
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDemoModule::PrintTest( TTestResult& aResult )
+    {
+    /* Tests printing with high intencity and different priority */ 
+    _LIT( KDefinion ,"CTestModuleDemo::RunTestCase");
+    _LIT( KData ,"Heavy print looping");
+    TestModuleIf().Printf( 0, KDefinion, KData );
+    TInt j;
+    for( TInt i=0; i<10; i++)
+        {
+
+        for(j=0; j<2; j++)
+            {
+            _LIT( KTmp ,"RunTestCase");
+            TBuf<15> tmp;
+            tmp.Copy( KTmp );
+            tmp.AppendNum( j );
+            _LIT( KNewData ,"p");
+            TestModuleIf().Printf(3, tmp, KNewData );
+            }
+
+        for(j=0; j<500; j++)
+            {
+             _LIT( KNewDefinion ,"RunTestCase");
+             _LIT( KNewData ,"%c");
+            TestModuleIf().Printf(1+(Math::Random() % 12),
+                KNewDefinion, 
+                KNewData, 'a'+(j%('z'-'a')) );
+            }
+
+        _LIT( KNewDefinion ,"RunTestCase");
+        _LIT( KNewData ,"Running %d");
+        TestModuleIf().Printf( 2, KNewDefinion,KNewData, i);
+        User::After( 1000000 );
+        }
+
+    // Test case passed
+
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription , "Test case passed");
+    aResult.SetResult( KErrNone, KDescription );
+    //aResult.iResult = KErrNone;
+    //aResult.iResultDes = KDescription;
+
+    // Case was executed
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: HeapMemoryAllocation
+
+    Description: Allocates heap descriptor.
+  
+    Parameters: TTestResult& aError
+
+    Return Values: TInt
+
+    Errors/Exceptions: Leaves with KErrNoMemory if heap allocation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CDemoModule::HeapMemoryAllocation( TTestResult& aResult )
+    {
+    _LIT( KLogInfo , "CDemoModule::HeapMemoryAllocation" );
+    iLog->Log( KLogInfo );
+
+    // Allocate heap descriptor
+    HBufC * buffer = HBufC::New( 10 );
+    if( buffer == NULL )
+        {
+        // Allocation failed
+        _LIT( KNewLogInfo , "buffer was NULL");
+        iLog->Log( KNewLogInfo );
+        User::Leave( KErrNoMemory );
+        }
+    else
+        {
+        // Descriptor creation was ok
+        _LIT( KNewLogInfo ,"buffer was allocated properly" );
+        iLog->Log( KNewLogInfo );
+        }
+
+    delete buffer;
+
+    _LIT( KDescription , "Test case passed");
+    aResult.SetResult( KErrNone, KDescription );
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/hwresetstub/BMARM/STIFHWRESETSTUBU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	NewL__16CStifHWResetStub @ 2 NONAME R3UNUSED ; CStifHWResetStub::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/hwresetstub/BWINS/STIFHWRESETSTUBU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCStifHWResetStub@@XZ @ 1 NONAME ; class CStifHWResetStub * __cdecl LibEntryL(void)
+	?NewL@CStifHWResetStub@@SAPAV1@XZ @ 2 NONAME ; public: static class CStifHWResetStub * __cdecl CStifHWResetStub::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/hwresetstub/eabi/StifHWResetStubu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_ZN16CStifHWResetStub4NewLEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/hwresetstub/group/StifHWResetStub.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* 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: MMP file for STIF Test Framework's StifHWResetStub.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET      StifHWResetStub.dll
+TARGETTYPE  dll
+DEFFILE     StifHWResetStub.def
+
+CAPABILITY	ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+LIBRARY     euser.lib
+LIBRARY     stiftestinterface.lib
+
+USERINCLUDE     ../inc 
+USERINCLUDE     ../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          StifHWResetStub.cpp
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/hwresetstub/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+/*
+* 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:
+*
+*	Build information for STIF Test Framework's StifHWResetStub.
+*/
+
+
+PRJ_PLATFORMS
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+
+PRJ_TESTEXPORTS
+
+
+PRJ_MMPFILES
+	
+	StifHWResetStub.mmp
+
+PRJ_TESTMMPFILES
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/hwresetstub/inc/StifHWResetStub.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,130 @@
+/*
+* 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: This file contains the header file of 
+* CStifHWResetStub of STIF TestFramework.
+*
+*/
+
+#ifndef STIFHWRESETSTUB_H
+#define STIFHWRESETSTUB_H
+
+// INCLUDES
+#include <StifHWReset.h>
+#include <StifLogger.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+// None
+
+// DESCRIPTION
+// Implements common reset module for STIF TestFramework. According to this DLL
+// template can be implemented licensee specific reset module.
+NONSHARABLE_CLASS(CStifHWResetStub) 
+        :public CStifHWReset
+    {
+    public:     // Enumerations
+    	// None
+
+    private:    // Enumerations
+    	// None
+
+    public:     // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CStifHWResetStub* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CStifHWResetStub();
+
+    public:     // New functions
+        
+        /**
+        * Does reset according to reset type.
+        */
+        TInt DoReset( CTestModuleIf::TRebootType aResetType );
+        
+    public:     // Functions from base classes
+    	// None
+       
+    protected:  // New functions
+    	// None
+    	
+    protected:  // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CStifHWResetStub();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Kills process. Example method.
+        */
+        TInt KillProcess();
+
+        /**
+        * General reset. Example method.
+        */
+        TInt GeneralReset();
+
+	public:     // Data
+	    // None
+
+	protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Logger instance
+        CStifLogger*            iLogger;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+    	
+    };
+
+#endif // STIFHWRESETSTUB_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/hwresetstub/src/StifHWResetStub.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,326 @@
+/*
+* 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: Implements common reset module for STIF 
+* TestFramework. According to this DLL template can be implemented 
+* licensee specific reset module.
+*
+*/
+
+// INCLUDE FILES
+#include "StifHWResetStub.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 =======================================
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifHWResetStub
+
+    Method: CStifHWResetStub
+
+    Description: Default constructor.
+    
+    Parameters:    None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CStifHWResetStub::CStifHWResetStub()
+    {
+    // None
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifHWResetStub
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor. Nothing to do.
+
+    Parameters:    None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CStifHWResetStub::ConstructL()
+    {
+    // Create Logger
+    iLogger = CStifLogger::NewL( _L( "C:\\logs\\testframework\\testengine\\"),
+                                    _L( "StifHWResetStub" ),
+                                        CStifLogger::ETxt,
+                                        CStifLogger::EFile,
+                                        EFalse, // Append
+                                        ETrue,
+                                        ETrue,
+                                        EFalse,
+                                        EFalse );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifHWResetStub
+
+    Method: NewL
+
+    Description: Two-phased constructor. Constructs new CStifHWResetStub
+                 instance and returns pointer to it.
+        
+    Parameters: None
+
+    Return Values: CStifHWResetStub*: new object.
+
+    Errors/Exceptions: Leaves if memory allocation fails or ConstructL leaves.
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifHWResetStub* CStifHWResetStub::NewL()
+    {
+    // Construct new CStifHWResetStub instance.
+    CStifHWResetStub* self = new ( ELeave ) CStifHWResetStub();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifHWResetStub
+
+    Method: ~CStifHWResetStub
+
+    Description: Destructor.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/    
+CStifHWResetStub::~CStifHWResetStub()
+    {
+    delete iLogger;
+    iLogger = NULL;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifHWResetStub
+
+    Method: DoReset
+
+    Description: Does reset according to reset type.
+    
+    Parameters: CTestModuleIf::TRebootType aResetType: in: Reset type
+
+    Return Values: TInt: Symbian OS error
+
+    Errors/Exceptions: Error code returned if reset method returns an error.
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/    
+TInt CStifHWResetStub::DoReset( CTestModuleIf::TRebootType aResetType )
+    {
+    iLogger->Log( _L( "CStifHWResetStub::DoReset(), reset type: %d" ), aResetType );
+    TInt ret( KErrNone );
+
+    switch( aResetType )
+        {
+        case CTestModuleIf::EDefaultReset:
+            {
+            ret = KillProcess(); // For an example
+            break;
+            }
+        case CTestModuleIf::EDeviceReset0:
+            {
+            ret = KillProcess(); // For an example
+            break;
+            }
+        case CTestModuleIf::EDeviceReset1:
+            {
+            ret = KillProcess(); // For an example
+            break;
+            }
+        case CTestModuleIf::EDeviceReset2:
+            {
+            ret = GeneralReset(); // Do nothing, for an example
+            break;
+            }
+        case CTestModuleIf::EDeviceReset3:
+            {
+            ret = GeneralReset(); // Do nothing, for an example
+            break;
+            }
+        case CTestModuleIf::EDeviceReset4:
+            {
+            ret = GeneralReset(); // Do nothing, for an example
+            break;
+            }
+        case CTestModuleIf::EDeviceReset5:
+            {
+            ret = GeneralReset(); // Do nothing, for an example
+            break;
+            }
+        default:
+            {
+            return KErrArgument;
+            }
+        }
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifHWResetStub
+
+    Method: KillProcess
+
+    Description: Kills process
+    
+    Parameters: None
+
+    Return Values: TInt: Symbian OS error
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/    
+TInt CStifHWResetStub::KillProcess()
+    {
+    iLogger->Log( _L( "KillProcess()" ) );
+    // Do process kill if MTC messages not allowed
+    RProcess thisProcess;
+    thisProcess.Kill( KErrNone );
+    thisProcess.Close();
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifHWResetStub
+
+    Method: GeneralReset
+
+    Description: General reset for example.
+    
+    Parameters: None
+
+    Return Values: TInt: Symbian OS error
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/    
+TInt CStifHWResetStub::GeneralReset()
+    {
+    // Lisencee specific reset
+    iLogger->Log( _L( "GeneralReset()" ) );
+    return KErrNone;
+
+    }
+
+// ================= 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: CStifHWResetStub* Pointer to CStifHWResetStub instance
+    
+    Errors/Exceptions: Leaves if CStifHWResetStub::NewL leaves
+    
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifHWResetStub* LibEntryL()
+    {
+    return CStifHWResetStub::NewL();
+
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/testmeasurementstub/Bmarm/STIFTESTMEASUREMENTSTUBU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FRC7TDesC16Q220CSTIFTestMeasurement20TSTIFMeasurementType @ 1 NONAME R3UNUSED ; LibEntryL(TDesC16 const &, CSTIFTestMeasurement::TSTIFMeasurementType)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/testmeasurementstub/Bwins/STIFTESTMEASUREMENTSTUBU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCSTIFTestMeasurementImplementation@@ABVTDesC16@@W4TSTIFMeasurementType@CSTIFTestMeasurement@@@Z @ 1 NONAME ; class CSTIFTestMeasurementImplementation * __cdecl LibEntryL(class TDesC16 const &,enum CSTIFTestMeasurement::TSTIFMeasurementType)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/testmeasurementstub/eabi/STIFTestMeasurementStubu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLRK7TDesC16N20CSTIFTestMeasurement20TSTIFMeasurementTypeE @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/testmeasurementstub/group/STIFTestMeasurementStub.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,72 @@
+/*
+* 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: MMP file for STIF Test Framework's TestMeasurement 
+* stub module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET          STIFTestMeasurementStub.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         STIFTestMeasurementStub.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          STIFTestMeasurementStub.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/testmeasurementstub/group/STIFTestMeasurementStub_DoxyFile.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,237 @@
+#
+# 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:
+#
+#
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = STIFTestMeasurementStub
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = w:\STIFTestMeasurementStub\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = w:\STIFTestMeasurementStub\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/testmeasurementstub/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,32 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+
+	DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+
+PRJ_MMPFILES
+
+	STIFTestMeasurementStub.mmp
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/testmeasurementstub/inc/STIFTestMeasurementStub.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,156 @@
+/*
+* 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: STIF measurement stub module declaration
+*
+*/
+
+#ifndef STIFTESTMEASUREMENTSTUB_H
+#define STIFTESTMEASUREMENTSTUB_H
+
+// INCLUDES
+#include <f32file.h>
+#include <StifTestInterface.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  This a CSTIFTestMeasurementStub stub class for Test Measurement Module
+*  Pluging.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS( CSTIFTestMeasurementStub ) : 
+                                public CSTIFTestMeasurementImplementation
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CSTIFTestMeasurementStub* NewL( 
+                const TDesC& aConfigurationInfo,
+                CSTIFTestMeasurement::TSTIFMeasurementType aMeasurementType );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSTIFTestMeasurementStub();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CSTIFTestMeasurementStub Start
+        * @since ?Series60_version
+        * @return Symbian OS error code
+        */
+        virtual TInt Start();
+
+        /**
+        * From CSTIFTestMeasurementStub Start
+        * @since ?Series60_version
+        * @return Symbian OS error code
+        */
+        virtual TInt Stop();
+
+        /**
+        * From CSTIFTestMeasurementStub Start
+        * @since ?Series60_version
+        * @return CSTIFTestMeasurement::TSTIFMeasurementType
+        */
+        virtual CSTIFTestMeasurement::TSTIFMeasurementType MeasurementType();
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSTIFTestMeasurementStub(
+            CSTIFTestMeasurement::TSTIFMeasurementType aMeasurementType );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( const TDesC& aConfigurationInfo );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+
+        // Test Measurement module type
+        CSTIFTestMeasurement::TSTIFMeasurementType iMeasurementType;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // STIFTESTMEASUREMENTSTUB_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/examples/testmeasurementstub/src/STIFTestMeasurementStub.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,183 @@
+/*
+* 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: This file contains testmeasurementstub declaration.
+*
+*/
+
+// INCLUDE FILES
+#include "STIFTestMeasurementStub.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSTIFTestMeasurementStub::CSTIFTestMeasurementStub
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSTIFTestMeasurementStub::CSTIFTestMeasurementStub( 
+            CSTIFTestMeasurement::TSTIFMeasurementType aMeasurementType ):
+    iMeasurementType( aMeasurementType )
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSTIFTestMeasurementStub::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSTIFTestMeasurementStub::ConstructL( const TDesC& aConfigurationInfo )
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSTIFTestMeasurementStub::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSTIFTestMeasurementStub* CSTIFTestMeasurementStub::NewL(
+                    const TDesC& aConfigurationInfo,
+                    CSTIFTestMeasurement::TSTIFMeasurementType aMeasurementType )
+    {
+    CSTIFTestMeasurementStub* self = new (ELeave) CSTIFTestMeasurementStub( 
+                                                            aMeasurementType );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aConfigurationInfo );
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+// -----------------------------------------------------------------------------
+// CSTIFTestMeasurementStub::~CSTIFTestMeasurementStub
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSTIFTestMeasurementStub::~CSTIFTestMeasurementStub()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSTIFTestMeasurementStub::Start
+// Starts test measurement
+// Returns Symbian error code
+// -----------------------------------------------------------------------------
+//
+TInt CSTIFTestMeasurementStub::Start( )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSTIFTestMeasurementStub::Stop
+// Stops test measurement
+// Returns Symbian error code
+// -----------------------------------------------------------------------------
+//
+TInt CSTIFTestMeasurementStub::Stop( )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSTIFTestMeasurementStub::MeasurementType
+// 
+// Returns measurement module's type
+// -----------------------------------------------------------------------------
+//
+CSTIFTestMeasurement::TSTIFMeasurementType CSTIFTestMeasurementStub::MeasurementType( )
+    {
+    return iMeasurementType;
+
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CSTIFTestMeasurementImplementation*: Pointer to STIF Test 
+// Measurement Module
+// object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSTIFTestMeasurementImplementation* LibEntryL( 
+                const TDesC& aConfigurationInfo,
+                CSTIFTestMeasurement::TSTIFMeasurementType aMeasurementType )
+    {
+    CSTIFTestMeasurementImplementation* measurement;
+    measurement = CSTIFTestMeasurementStub::NewL( 
+                                        aConfigurationInfo, aMeasurementType );
+    return measurement;
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/group/STF_read_me.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,36 @@
+STF release Note:
+
+
+How to deploy:
+****************
+From the zip:
+	unzip all the files into your EPOCROOT and replace \epoc32\... repository.
+
+
+What's in this zip :
+********************
+--epoc32
+
+   --data		----> STF configuration files
+
+   --include	----> exported header file
+
+   --release	----> STF binaries of winscw & armv5
+
+   --rom		----> .iby files for rom build
+
+   --tools		----> sis package of STF, test module templates for test suite developers
+
+   --wins		----> STF configuration files
+
+   --winscw	----> STF configuration files
+
+
+Project wiki page :
+********************
+http://wikis.in.nokia.com/TestingSolutions/STFUserWiki
+
+
+Support :
+*********
+STF-Support@Nokia.com
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/group/TestFramework.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,217 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#   + XML, Test report will be xml type, for example 'TestReport.xml'.
+#          Note, that xml format is available only when output is set to FILE.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport    # Possible values are: 'Empty', 'Summary', 'Environment',
+                              #                      'TestCases' or 'FullReport'
+
+CreateTestReport= YES         # Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT         # Possible values: TXT, HTML or XML
+TestReportOutput= FILE        # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone  # Possible values are:
+              # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+              # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+              # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+              # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0                    # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES        # Possible values: YES or NO
+#SeparateProcesses= YES       # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= demomodule
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# 	If you want to use filter with ConsoleUI, simply remove comments
+# 	from section below and provide valid filter entries.
+#   Each filter line has to start with "filter= " keyword.
+#   Filter can contain special wildcard characters:
+#     *  which stands for none or any literal;
+#     ?  which stands for single character.
+#   Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,63 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STF.
+*/
+
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+
+	DEFAULT
+
+
+PRJ_EXPORTS
+
+	TestFramework.ini +/wins/c/TestFramework/TestFramework.ini
+	TestFramework.ini +/winscw/c/TestFramework/TestFramework.ini
+	TestFramework.ini +/data/z/system/data/TestFramework.ini
+	
+	// This is added in order to export iby files automaticly in 5.0 env
+	../rom/Stif.iby     CORE_IBY_EXPORT_PATH(tools,Stif.iby) 
+	
+	../rom/stif_rom.iby CORE_IBY_EXPORT_PATH(tools/rom,stif_rom.iby)
+	
+	:zip ../TestModuleTemplates/TestModuleTemplates.zip +/tools/s60rndtools/stf
+	:zip ../examples/MigrationExample.zip +/tools/s60rndtools/stf
+	
+PRJ_TESTEXPORTS
+	
+PRJ_MMPFILES	
+
+// STF API
+#include "../api/api_platform/group/bld.inf"
+
+// STF framework
+#include "../stffw/group/bld.inf"
+
+// STF extensions
+#include "../stfext/group/bld.inf"
+
+// STF UI
+#include "../stfui/group/bld.inf"
+
+// Examples
+#include "../examples/demomodule/group/bld.inf"
+
+
+// End of File
+
+PRJ_MMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/group/package_all.bat	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,105 @@
+@rem
+@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description: 
+@rem
+@echo off
+rem ---remove any old zip files if exists---
+@del *.zip 2>1
+
+rem --- prepare zip file name STF_Version_Timestamp.zip
+set VER=1.0.0
+
+rem Date
+set DATE0=%date%
+if %DATE0% equ 0 (set DATE0=%date:~-10%) else (set DATE0=%date:~,10%)
+rem time
+set tsp="%time:~0,1%"
+if %tsp%==" " (set TIME0=0%time:~1,1%%time:~3,2%%time:~6,2%)&goto NEXTTASK:
+set TIME0=%time:~0,2%%time:~3,2%%time:~6,2%
+rem time stamp
+:NEXTTASK
+set TMST=%DATE0%_%TIME0%
+
+echo STF Version: %VER%
+set ZIPFILE=STF_%VER%_%TMST%.zip
+echo Package file name: %ZIPFILE%
+
+rem ---------BUILD----------
+rem call abld reallyclean
+rem call bldmake clean
+rem call bldmake bldfiles
+rem call abld build
+
+rem ---------packaging---------
+rem "abld build -what" to get all exported files
+call abld build -what > TEMP
+
+for /f %%l in (TEMP) do (
+@zip %ZIPFILE% %%l
+)
+
+del TEMP
+
+
+rem ---------BUILD STFQTUI----------
+rem pushd %cd%
+
+rem cd ..\stfui\qtui\StfQtUI
+rem call qmake
+rem call bldmake bldfiles
+rem call abld build
+
+rem ---------packaging STFQTUI---------
+rem "abld build -what" to get all exported files
+rem call abld build -what > TEMP
+
+rem for /f %%l in (TEMP) do (
+rem @zip ..\..\..\group\%ZIPFILE% %%l
+rem )
+
+rem del TEMP
+
+rem popd
+
+rem ---------packaging MigrationExample---------
+set TEMPLATE_TARGET=\epoc32\tools\s60rndtools\stf\MigrationExample
+zip %ZIPFILE% %TEMPLATE_TARGET%\*
+zip %ZIPFILE% %TEMPLATE_TARGET%\*\*
+zip %ZIPFILE% %TEMPLATE_TARGET%\*\*\*
+zip %ZIPFILE% %TEMPLATE_TARGET%\*\*\*\*
+
+rem --------packaging testmoduletemplates--------
+set TEMPLATE_TARGET=\epoc32\tools\s60rndtools\stf\testmoduletemplates
+zip %ZIPFILE% %TEMPLATE_TARGET%\*
+zip %ZIPFILE% %TEMPLATE_TARGET%\*\*
+zip %ZIPFILE% %TEMPLATE_TARGET%\*\*\*
+
+rem ---------create and add sis package into zip file--------
+set SIS_TARGET=\epoc32\tools\s60rndtools\stf\sis
+md %SIS_TARGET%
+rem set KEY_DIR to the real path
+rem set KEY_DIR=YOUR_KEY_DIR
+copy ..\sis\stf.pkg %SIS_TARGET%\stf.pkg /y
+rem copy ..\stfui\qtui\StfQtUI\StfQtUI.pkg %SIS_TARGET%\StfQtUI.pkg /y
+rem ----create sis----
+makesis %SIS_TARGET%\stf.pkg %SIS_TARGET%\stf.sis
+rem makesis %SIS_TARGET%\StfQtUI.pkg %SIS_TARGET%\StfQtUI.sis
+rem ----sign sis------
+rem signsis -s %SIS_TARGET%\stf.sis %SIS_TARGET%\stf.sisx %KEY_DIR%\rd.crt %KEY_DIR%\rd.key
+rem signsis -s %SIS_TARGET%\StfQtUI.sis %SIS_TARGET%\StfQtUI.sisx %KEY_DIR%\rd.crt %KEY_DIR%\rd.key
+rem -----zip all------
+zip %ZIPFILE% %SIS_TARGET%\*
+
+rem -----STF_read_me.txt------
+zip %ZIPFILE% STF_read_me.txt
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/STIFConfiguration.mmh	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*/
+
+#ifndef STIFCONFIGURATION_MMH
+#define STIFCONFIGURATION_MMH
+
+// MMP's header file for macro definitions.
+
+/**
+* STIF's TestEngine and TestServer logs to c:\logs\testframework\testengine
+* and c:\logs\testframework\testserver directories. These logging can be changed
+* to log RDebug with next macro. If uncommenting this macro STIFTestFramework
+* reallyclean and compile is needed (from \STIFTestFramework\group\bld.inf).
+*/
+//MACRO FORCE_STIF_INTERNAL_LOGGING_TO_RDEBUG
+
+
+#endif      // STIFCONFIGURATION_MMH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/STIFMeasurement.h	Fri Apr 09 10:46:28 2010 +0800
@@ -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: StifMeasurement plugin names declaration
+*
+*/
+
+#ifndef STIF_MEASUREMENT_H
+#define STIF_MEASUREMENT_H
+
+// INCLUDES
+#include <E32Base.h>
+
+// Maximum length of measurement types(see literals below)
+const TInt KStifMeasurementTypeLength = 30; 
+
+/**
+* Literals for measurement types.
+*/
+_LIT( KStifMeasurementEnableAll, "stifmeasurementenableall" );
+_LIT( KStifMeasurementDisableAll, "stifmeasurementdisableall" );
+_LIT( KStifMeasurement01, "stifmeasurementplugin01" );
+_LIT( KStifMeasurement02, "stifmeasurementplugin02" );
+_LIT( KStifMeasurement03, "stifmeasurementplugin03" );
+_LIT( KStifMeasurement04, "stifmeasurementplugin04" );
+_LIT( KStifMeasurement05, "stifmeasurementplugin05" );
+_LIT( KStifMeasurementBappea, "stifbappeaprofiler" );
+// Next is used in testframework.ini file
+_LIT( KStifMeasurementDisableNone, "stifmeasurementdisablenone" );
+
+
+// Measurement module types definition(used in keyword's parameters)
+_LIT( KParamMeasurement01, "measurementplugin01" );
+_LIT( KParamMeasurement02, "measurementplugin02" );
+_LIT( KParamMeasurement03, "measurementplugin03" );
+_LIT( KParamMeasurement04, "measurementplugin04" );
+_LIT( KParamMeasurement05, "measurementplugin05" );
+_LIT( KParamMeasurementBappea, "stifbappeaprofiler" );
+
+/**
+* Enumeration for measurement disable and enable.
+*/
+enum TDisableMeasurement
+    {
+    EDisableAll     = 0xFFFFFFFF,   // Disable all measurement, 1111
+    EEnableAll      = ~EDisableAll, // This allowes all measurements, 0000
+    EMeasurement01  = 1<<0,         // User specific measurement
+    EMeasurement02  = 1<<1,         // User specific measurement
+    EMeasurement03  = 1<<2,         // User specific measurement
+    EMeasurement04  = 1<<3,         // User specific measurement
+    EMeasurement05  = 1<<4,         // User specific measurement
+    EBappea         = 1<<25,        // Disable bappea measurement
+    };
+
+#endif // STIF_MEASUREMENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/StifKernelTestClass.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,111 @@
+/*
+* 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: Kernel test class for STIF Test Framework TestScripter
+*
+*/
+
+
+#ifndef STIFKERNELTESTCLASS_H
+#define STIFKERNELTESTCLASS_H
+
+// INCLUDES
+
+#include <e32cmn.h>
+
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+typedef TBuf8<0x80>  TMethodResultDes;
+typedef TBuf8<0x20>  TMethodName;
+typedef TBuf8<0x100> TMethodParams;
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class TStifRunMethodInfo
+    {
+    public:
+        TStifRunMethodInfo() : 
+            iResult( 0 )
+            {
+            iMethodName.Zero();
+            iMethodParams.Zero();
+            iMethodResultDes.Zero();
+            }
+    
+    public:
+        TMethodName         iMethodName;
+        TMethodParams       iMethodParams;
+        TMethodResultDes    iMethodResultDes;
+        TInt                iResult;
+        
+    };
+
+// CLASS DECLARATION
+
+/**
+*  RStifKernelTestClass kernel test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class RStifKernelTestClass : public RBusLogicalChannel
+    {
+    public:
+        // Synchronous operations
+        enum TStifKernelTCOperation
+            { 
+            ERunMethod = 1,                       
+            };
+    
+        // Version number
+        enum TStifKernelTCVersion
+            {
+            EMajorVersionNumber=1,
+            EMinorVersionNumber=0,
+            EBuildVersionNumber=1
+            };
+
+    public: // Interface functions
+
+          // Open
+          inline TInt Open( const TVersion& aVer, const TDesC& aDriverName );
+
+          // Return required version
+          inline TVersion VersionRequired() const;
+          
+          // Run specific method
+          
+        
+          inline TInt RunMethod( const TDesC8&  aMethodName,
+                                 const TDesC8&  aParams,
+                                 TInt&          aResult,
+                                 TDes8&         aResultDes );
+ 
+    };
+    
+// Include inline function implementations
+#include "StifKernelTestClass.inl"
+
+#endif      // STIFKERNELTESTCLASS_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/StifKernelTestClass.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,79 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef STIFKERNELTESTCLASS_INL
+#define STIFKERNELTESTCLASS_INL
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RStifKernelTestClass::Open
+// Open driver.
+// -----------------------------------------------------------------------------
+//
+TInt RStifKernelTestClass::Open( const TVersion& aVer, const TDesC& aDriverName )
+    {       
+    return DoCreate( aDriverName, aVer, KNullUnit, NULL, NULL );    
+    }
+
+// -----------------------------------------------------------------------------
+// RStifKernelTestClass::VersionRequired
+// Get version info.
+// -----------------------------------------------------------------------------
+//
+TVersion RStifKernelTestClass::VersionRequired() const
+    {
+    return TVersion( EMajorVersionNumber, EMinorVersionNumber, EBuildVersionNumber );
+    }
+    
+// -----------------------------------------------------------------------------
+// RStifKernelTestClass::RunMethod
+// DoControl call to the kernel side for test case execution
+// -----------------------------------------------------------------------------
+//
+                                    
+TInt RStifKernelTestClass::RunMethod( const TDesC8&  aMethodName,
+                                      const TDesC8&  aMethodParams,
+                                      TInt&          aResult,
+                                      TDes8&         aResultDes )                                   
+    {      
+    TStifRunMethodInfo methodInfo;
+    if( ( aMethodName.Length() > methodInfo.iMethodName.MaxLength() ) ||
+        ( aMethodParams.Length() > methodInfo.iMethodParams.MaxLength() ) ) 
+        {
+        return KErrArgument;
+        }
+    methodInfo.iMethodName.Copy( aMethodName );
+    methodInfo.iMethodParams.Copy( aMethodParams );
+    
+    TPckg<TStifRunMethodInfo> methodInfoPckg( methodInfo );
+    TInt ret = DoControl( ERunMethod, ( TAny* )&methodInfoPckg );
+    
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    aResult = methodInfo.iResult;
+    aResultDes.Copy( methodInfo.iMethodResultDes.Left( aResultDes.MaxLength() ) );
+    return KErrNone;
+    }
+
+#endif      // STIFKERNELTESTCLASS_INL
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/StifPython.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,48 @@
+/*
+* 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: This file contains the header of additional functions 
+* needed for Python support and used in PythonScripter, TestEngine 
+* and TestCombiner.
+*
+*/
+
+#ifndef STIFPYTHON_H
+#define STIFPYTHON_H
+
+//  INCLUDES
+#include <E32Base.h>
+
+// CONSTANTS
+_LIT(KPythonScripter, "pythonscripter");
+const TInt KPythonScripterLength = 14;
+
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+// None
+
+#endif        // STIFPYTHON_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/StifTFw.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,190 @@
+/*
+* 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: This file contains the header file of the CStifTFw.
+*
+*/
+
+#ifndef STIF_TFW_H
+#define STIF_TFW_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifLogger.h>
+#include <StifTestInterface.h>
+#include <stifinternal/UIEngine.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUIEngineContainer;
+class CUIEngineEvent;
+class CStifTFwIf;
+
+// CLASS DECLARATION
+
+// CStifTFw is the sub class of STIF Test Framework Interface
+class CStifTFw
+    :public CUIIf
+    {
+    public: // Enumerations
+
+    protected: // Enumerations
+        
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+         /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CStifTFw* NewL( CStifTFwIf* aStifTFwIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CStifTFw();
+        
+    public: 
+
+    protected: // Functions that can be called from derived class
+
+    protected: // Functions that the derived class may implement.
+ 
+    private:
+
+        /**
+        * Constructor.
+        */
+        CStifTFw( CStifTFwIf* aStifTFwIf );
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Test case executed.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C void TestExecuted( CUIEngineContainer* aContainer, 
+                                    TFullTestResult& aFullTestResult );
+        /**
+        * Progress information from Test case execution.
+        *
+        * Returns Symbian OS error code.
+        */
+        IMPORT_C TInt PrintProg ( CUIEngineContainer* aContainer,
+                                  TTestProgress& aProgress );
+
+        /**
+        * Forward message to ATS.
+        */                            
+        IMPORT_C TInt RemoteMsg( CUIEngineContainer* aContainer,
+                                 const TDesC& /*aMessage*/ );
+                                 
+        /**
+        * Forward reboot indication to ATS.
+        */                            
+        IMPORT_C TInt GoingToReboot( CUIEngineContainer* aContainer,
+                                     TRequestStatus& aStatus );
+ 
+        /**
+        * Initialize logger from UI engine.
+        */
+        void InitializeLogger( CStifLogger* aLogger ){ iLogger = aLogger; }
+
+        /**
+        * Remote ATS call
+        */
+        TInt AtsRemote( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp );
+
+        /**
+        * Remote ATS run call
+        */
+        TInt AtsRemoteRun( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp );
+
+        /**
+        * Remote ATS test control call
+        */
+        TInt AtsRemoteTestCtl( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp );
+
+        /**
+        * Remote ATS event system control call
+        */
+        TInt AtsRemoteEventCtl( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp );
+        
+        /**
+        * Delete data in class
+        */
+        void DeleteData();
+
+        /**
+        * Enumerates test cases from given module and finds test case index by title
+        */
+        TInt GetCaseNumByTitle(TDesC& aModule, TDesC& aTestCaseFile, TDesC& aTitle, TInt& aCaseNum);
+
+    public: // Data
+        /**
+        * Logger created by UI engine.
+        */ 
+        CStifLogger* iLogger;
+        
+    protected: // Data
+        
+    private: // Data
+        /**
+        * Pointer to UI engine.
+        */ 
+        CUIEngine* iUIEngine;
+        
+        /**
+        * Pointer to CStifTfwIf
+        */ 
+        CStifTFwIf* iStifTFwIf;
+
+        // Execute test case table
+        RPointerArray<CUIEngineContainer>      iTestExecutionTable;
+
+        // Remote execute test case table
+        RPointerArray<CUIEngineContainer>      iTestRemoteExecutionTable;
+
+        // Remote execute test case table
+        RPointerArray<CUIEngineEvent>          iEventArray;
+        
+        // Array of master identifiers that have reserved the slave
+        RArray<TUint32>                        iMasterArray;
+
+    public: // Friend classes
+        // None
+        
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        friend class CStifTFwIf;
+
+    };
+
+#endif      // STIF_TFW_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/TestModuleInfo.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,294 @@
+/*
+* 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: This file contains the header file of the 
+* CTestModuleInfo class. The class was created to keep module names, 
+* ini files and test case configuration files.
+*
+*/
+
+#ifndef TESTMODULEINFO_H
+#define TESTMODULEINFO_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <StifLogger.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Class with information about configuration (test case) file.
+class CTestCaseFileInfo
+    :public CBase
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * NewL.
+        */
+        static CTestCaseFileInfo* NewL(TDesC& aCfgFileName, CStifLogger* aLogger);
+
+        /**
+        * C++ destructor.
+        */
+        virtual ~CTestCaseFileInfo();
+
+    private: // Constructors and destructor
+        /**
+        * C++ constructor.
+        */
+        CTestCaseFileInfo();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(TDesC& aCfgFileName, CStifLogger* aLogger);
+
+    public: // New functions
+        /**
+        * Set configuration file as already checked.
+        */
+        IMPORT_C void SetChecked(void);
+
+        /**
+        * Return if config file has been checked.
+        */
+        TBool IsChecked(void);
+
+        /**
+        * Get module name.
+        */
+        IMPORT_C TInt GetCfgFileName(TDes& aCfgFileName);
+        
+       
+
+    protected:  // New functions
+
+    private:    // New functions
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+        //Config file name
+        HBufC* iCfgFileName;
+
+        //Was checked
+        TBool iChecked;
+
+        // Logger instance
+        CStifLogger* iLogger;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+    };
+
+// DESCRIPTION
+// Class with information about test modules.
+class CTestModuleInfo
+    :public CBase
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * NewL.
+        */
+        static CTestModuleInfo* NewL(TDesC& aModuleName, CStifLogger* aLogger);
+
+        /**
+        * C++ destructor.
+        */
+        virtual ~CTestModuleInfo();
+
+    private: // Constructors and destructor
+        /**
+        * C++ constructor.
+        */
+        CTestModuleInfo();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(TDesC& aModuleName, CStifLogger* aLogger);
+
+    public: // New functions
+        /**
+        * Set initialization file name.
+        */
+        IMPORT_C TInt SetIniFile(TDesC& aIniFileName);
+
+        /**
+        * Add configuration (test case) file name to array.
+        */
+        IMPORT_C TInt AddCfgFile(TDesC& aCfgFileName);
+
+        /**
+        * Get number of test case files.
+        */
+        IMPORT_C TInt CountCfgFiles(void);
+
+        /**
+        * Get module name.
+        */
+        IMPORT_C TInt GetModuleName(TDes& aModuleName);
+
+        /**
+        * Get ini file.
+        */
+        IMPORT_C TInt GetIniFileName(TDes& aIniFileName);
+
+        /**
+        * Get cfg file.
+        */
+        IMPORT_C TInt GetCfgFileName(TInt aIndex, TDes& aCfgFileName);
+
+        /**
+        * Get first unchecked config file.
+        */
+        CTestCaseFileInfo* GetUncheckedCfgFile(void);
+       
+    protected:  // New functions
+
+    private:    // New functions
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+        //Module name
+        HBufC* iModuleName;
+
+        //Initialization file
+        HBufC* iIniFileName;
+
+        //Array of cfg files
+        RPointerArray<CTestCaseFileInfo> iCfgFiles;
+
+        // Logger instance
+        CStifLogger* iLogger;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+    };
+
+// DESCRIPTION
+// Class with list of test modules.
+class CTestModuleList
+    :public CBase
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * NewL.
+        */
+        IMPORT_C static CTestModuleList* NewL(CStifLogger* aLogger);
+
+        /**
+        * C++ destructor.
+        */
+        IMPORT_C virtual ~CTestModuleList();
+
+    private: // Constructors and destructor
+        /**
+        * C++ constructor.
+        */
+        CTestModuleList();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(CStifLogger* aLogger);
+
+    public: // New functions
+        /**
+        * Add test module to list.
+        */
+        IMPORT_C TInt AddTestModule(TDesC& aModuleName);
+
+        /**
+        * Get number of test modules.
+        */
+        IMPORT_C TInt Count(void);
+
+        /**
+        * Get module.
+        */
+        IMPORT_C CTestModuleInfo* GetModule(TDesC& aModuleName);
+
+        /**
+        * Get module.
+        */
+        IMPORT_C CTestModuleInfo* GetModule(TInt aIndex);
+
+        /**
+        * Get first unchecked test case file (module: testscripter and testcombiner).
+        */
+        IMPORT_C CTestCaseFileInfo* GetUncheckedCfgFile(void);
+
+    protected:  // New functions
+
+    private:    // New functions
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+        //Array of test modules
+        RPointerArray<CTestModuleInfo> iTestModules;
+
+        // Logger instance
+        CStifLogger* iLogger;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+    };
+
+#endif      // TESTMODULEINFO_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/TestServerModuleIf.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,697 @@
+/*
+* 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: This file contains the header file of the CTestExecution.
+*
+*/
+
+#ifndef TEST_SERVER_MODULE_IF_H
+#define TEST_SERVER_MODULE_IF_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifTestModule.h>
+#include <StifTestInterface.h>
+#include <stfeventsystem.h>
+#include <stfasynceventactive.h>
+#include "StifTFwIfProt.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+typedef CSTIFTestMeasurementImplementation*( 
+        *CTestMeasurementFactory )( const TDesC&,
+                                    CSTIFTestMeasurement::TSTIFMeasurementType );
+
+// FORWARD DECLARATIONS
+class TEvent;
+class CTestModule;
+class CTestModuleContainer;
+class CPrintQueue;
+class CPrintHandler;
+class CEventHandler;
+class CSndHandler;
+class CRcvHandler;
+class CErrorPrintHandler;
+class CInterferenceHandler;
+class CMeasurementHandler;
+class CCommandHandler;
+class CAsyncEventActive;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TCmdDef represents remote command
+class TCmdDef
+    {
+    public:
+        TStifCommand    iCommand;
+        TParams         iParam;
+        TInt            iLen;
+        TRequestStatus* iStatus;
+    };
+
+// TCommandDef represents command
+class TCommandDef
+    {
+    public:
+        TCommand                       iCommand;
+        TBuf8<KMaxCommandParamsLength2> iParamsPckg;
+    };
+    
+// DESCRIPTION
+// CCommandDef represents command
+class CCommandDef : public CBase
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+        
+    public:  // Constructors and destructor
+    		static CCommandDef* NewL();
+        	~CCommandDef();
+
+    private:  // Constructors and destructor
+    		CCommandDef();
+        	void ConstructL();
+
+    public: // New functions
+          
+    public: // Functions from base classes
+        
+    protected:  // New functions
+        
+    protected:  // Functions from base classes
+        
+    private:
+        
+    public:		//Data
+            TCommand iCommand;
+            TBuf8<KMaxCommandParamsLength2> iParamsPckg;
+        
+    protected:  // Data
+        
+    private:    // Data
+        
+    public:     // Friend classes
+        
+    protected:  // Friend classes
+        
+    private:    // Friend classes
+        
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TCmdDef represents remote command
+class TEventDef
+    {
+    public:
+        enum TEventCmdType
+            {
+            EEventCmd,
+            EEventCmdCancel,
+            };
+    // Added constructor to TEventDef @js
+        TEventDef():iStatus(NULL){};
+            
+    public:
+        TEventCmdType   iType;
+        TEventIf        iEvent;
+        TRequestStatus* iStatus;
+    };
+
+// DESCRIPTION
+// TTestInterference represents remote command
+class TTestInterference 
+    {
+    public:
+        enum TOperation
+            {
+            EAppend,
+            ERemove,
+            };
+    public:
+        TTestInterference(){};
+    public:
+        // Thread id.
+        TUint iThreadId;
+        // Is operations append or remove.
+        TOperation iOperation;
+    };
+
+// DESCRIPTION
+// TTestMeasurement contains measurement related information
+// transfering between TestInterface and TestServer.
+class TTestMeasurement 
+    {
+    public:
+        TTestMeasurement(){};
+    public:
+        // Struct for information.
+        CSTIFTestMeasurement::TStifMeasurementStruct iMeasurementStruct;
+
+    };
+
+// DESCRIPTION
+// TMeasurementHandling keeps information for measurement module
+// dynamic loading, types, etc.
+class TMeasurementHandling 
+    {
+    public:
+        TMeasurementHandling() : iMeasurement( NULL ),
+                                 iMeasurementModulePtr( NULL ){};
+
+        ~TMeasurementHandling()
+            { 
+            delete iMeasurement;
+            delete iMeasurementModulePtr;
+            // After close test measurement's pointer is not valid anymore.
+            if ( iMeasurementModule.Handle() )
+                { 
+                iMeasurementModule.Close(); 
+                }
+            };
+    public:
+        RLibrary iMeasurementModule;
+        CTestMeasurementFactory iMeasurementLibEntry;
+        CSTIFTestMeasurementImplementation* iMeasurement;
+        CSTIFTestMeasurement::TSTIFMeasurementType iMeasurementType;
+        CSTIFTestMeasurementImplementation* iMeasurementModulePtr;
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestExecution represents a subsession object in the CTestServer.
+// A session may own any number of CTestExecution objects
+class CTestExecution
+        :public CObject
+    {
+
+    public: // Enumerations
+        enum TTestState
+            {
+            ENotStarted,
+            EOnGoing,
+            EFinished,
+            ECancelled,
+            };
+        
+        enum TRequestType
+            {
+            ERqPrint,
+            ERqEvent,
+            ERqSnd,
+            ERqRcv,
+            ERqInterference,
+            ERqMeasurement,
+            ERqCommand,
+            };
+
+        enum TTestThreadFailure
+            {
+            ETestThreadOk       = 0,
+            ETestMemLeak        = 0x00000001,
+            ETestRequestLeak    = 0x00000002,
+            ETestHandleLeak     = 0x00000004,
+            };
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestExecution* NewL( CTestModule* aModuleSession, 
+                                     TInt aCaseNumber, 
+                                     const TFileName& aConfig
+                                   );
+
+        /**
+        * Destructor
+        */
+        virtual ~CTestExecution();
+
+    public: // New functions
+
+        /**
+        * Close Test Execution
+        */
+        TInt CloseTestExecution( const RMessage2& aMessage );
+
+        /**
+        * Run a test case
+        */
+        TInt RunTestCase( const RMessage2& aMessage );
+
+        /**
+        * Sets a print notification
+        */
+        TInt NotifyPrint( const RMessage2& aMessage );
+
+        /**
+        * Sets a event notification
+        */
+        TInt NotifyEvent( const RMessage2& aMessage );
+
+        /**
+        * Sets a RemoteCmd notification
+        */
+        TInt NotifyRemoteCmd( const RMessage2& aMessage );
+
+        /**
+        * Reads a RemoteCmd notification
+        */
+        TInt ReadRemoteCmdInfo( const RMessage2& aMessage );
+
+        /**
+        * Resumes a paused test case
+        */
+        TInt Resume( const RMessage2& aMessage );
+
+        /**
+        * Pauses ongoing test case
+        */
+        TInt Pause( const RMessage2& aMessage );
+
+
+        /**
+        * Cancels asynchronous request
+        */
+        TInt CancelRequestL( const RMessage2& aMessage );
+
+
+        /**
+        * Completes a print request. 
+        */
+        void DoNotifyPrint();
+
+        /**
+        * Completes a interference request. 
+        */
+        void DoNotifyInterference();
+
+        /**
+        * Completes a measurement request. 
+        */
+        TInt DoNotifyMeasurement();
+
+        /**
+        * Completes a print request. 
+        */
+        void DoErrorPrint();
+
+        /**
+        * Enables remote command receiving. 
+        */
+        void DoRemoteReceive();
+
+        /**
+        * Sends remote commands. 
+        */
+        void DoRemoteSend();
+        
+        /**
+        * Completes a event request. 
+        */
+        TInt DoNotifyEvent();
+
+        /**
+        * Completes a event cancel request. 
+        */
+        void CancelEvent();
+        
+        /** 
+        * Set thread State. 
+        * This function can be called from test execution thread.
+        */
+        void SetThreadState( const TTestState aState );
+        
+        /**
+        * Completes print request if print queue is empty
+        */
+        void CompletePrintRequestIfQueueEmpty();
+
+        /**
+        * Completes print request if print queue is empty
+        */
+        void CleanupEvents();
+
+        /**
+        * Completes test execution
+        */
+        void CompleteTestExecution( const TInt aCompletionCode, 
+                                    const TFullTestResult::TCaseExecutionResult aCaseExecutionType,
+                                    const TInt aCaseExecutionCode,
+                                    const TInt aCaseResult,
+                                    const TDesC& aText );
+
+        /**
+        * Unsets all pending state events.
+        */
+        void UnsetStateEvents();
+
+        /**
+        * Completes test execution
+        */
+        void CompleteTestExecution( const TInt aCompletionCode );
+        
+        /**
+        * Current thread state.
+        */
+        TTestState ThreadState(){ return iThreadState; }
+
+        /**
+        * Cancels test(s) execution in special cases e.g. timeout, exit etc.
+        */
+        TInt CancelTestExecution();
+
+        /**
+        * Make sure that any of the test interference thread's won't stay
+        * to run if test case is crashed of test interference object is not
+        * deleted.
+        */
+        TInt KillTestinterferenceThread();
+
+        /**
+        * Make sure that any of the test measurement process's won't stay
+        * to run if test case is crashed of test measurement object is not
+        * deleted.
+        */
+        TInt KillTestMeasurement();
+
+        /**
+        * Executes command for ongoing test case.
+        * Created to allow test case to kill itself.
+        */
+        TInt NotifyCommand(const RMessage2& aMessage);
+
+        /**
+        * Completes a command request.
+        * Created to allow test case to kill itself.
+        */
+        TInt DoNotifyCommand();
+
+        /**
+        * Cancels command request.
+        * Created to allow test case to kill itself.
+        */
+        TInt CancelCommandRequest();
+
+    public: // Functions that are called from test thread
+
+        /**
+        * Get mutex handles.
+        */
+        TInt EventMutexHandle(){ return iEventMutex.Handle(); };
+        TInt SndMutexHandle(){ return iSndMutex.Handle(); };
+        TInt RcvMutexHandle(){ return iRcvMutex.Handle(); };
+        TInt PrintMutexHandle(){ return iPrintMutex.Handle(); };
+        TInt InterferenceMutexHandle(){ return iInterferenceMutex.Handle(); };
+        TInt MeasurementMutexHandle(){ return iMeasurementMutex.Handle(); };
+        TInt CommandMutexHandle(){ return iCommandMutex.Handle(); };
+
+        /**
+        * Get semaphore handles.
+        */
+        TInt EventSemHandle(){ return iEventSem.Handle(); };
+        TInt SndSemHandle(){ return iSndSem.Handle(); };
+        TInt RcvSemHandle(){ return iRcvSem.Handle(); };
+        //TInt ReceiverSemHandle(){ return iReceiverSem.Handle(); };
+        TInt PrintSemHandle(){ return iPrintSem.Handle(); };
+        TInt InterferenceSemHandle(){ return iInterferenceSem.Handle(); };
+        TInt MeasurementSemHandle(){ return iMeasurementSem.Handle(); };
+        TInt CommandSemHandle(){ return iCommandSem.Handle(); };
+
+        /**
+        * Set execution test thread id.
+        */ 
+        void SetTestThread( TThreadId aThreadId ){ iTestThreadId = aThreadId; };
+
+        /**
+        * Access to "shared" memory.
+        */
+        TFullTestResult& FullResult(){ return iFullResult; };
+        TTestProgress& TestProgress(){ return iProgress; };
+        TEventDef& EventDef(){ return iEventDef; };
+        TCmdDef& SndInfo(){ return iCmdDef; };
+        TCmdDef& RcvInfo(){ return iRcvCmdDef; };
+        TInt& TestThreadFailure(){ return iTestThreadFailure; };
+        TTestInterference& TestInterference(){ return iTestInterference; };
+        TTestMeasurement& TestMeasurement(){ return iTestMeasurement; };
+        CCommandDef& CommandDef(){ return *iCommandDef; };
+
+        /**
+        * Get specific TRequestStatus variable.
+        */
+        TRequestStatus* GetRq( TRequestType aType );
+
+        /**
+        * Get mutex handle.
+        * This mutex meaning is to make sure that test complete and test
+        * case cancel operations are not executed at the same time.
+        */
+        TInt TestThreadMutexHandle() { return iTestThreadMutex.Handle(); };
+
+        const TDesC& GetConfigFileName() const { return iConfig; }
+    public: // Functions from base classes
+        // None
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CTestExecution(); 
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CTestModule* aModuleSession,
+                         TInt aCaseNumber,
+                         const TFileName& aConfig );
+
+        /**
+        * Cancels print request.
+        */
+        TInt CancelPrintRequest();
+
+        /**
+        * Cancels test interference request.
+        */
+        TInt CancelInterferenceRequest();
+
+        /**
+        * Cancels test execution request
+        */
+        TInt CancelTestRequest();
+
+        /**
+        * Cancel event request.
+        */
+        TInt CancelEventRequest();
+
+        /**
+        * Cancel event request.
+        */
+        TInt CancelRemoteCmdRequest();
+
+        /**
+        * Writes a print notification to client memory space.
+        */
+        TInt WritePrint( TTestProgress& aProgress );
+
+        /**
+        * Complete event TRequestStatus if pending. 
+        */
+        void CompleteEvent( TInt aError );
+
+        /**
+        * Handle event unsets. 
+        */
+        TInt UnsetEvent( TEventIf& aEvent, const RMessage2& aMessage );
+
+        /**
+        * Handle event request. 
+        */
+        TInt RequestEvent( TEventIf& aEvent );
+
+        /**
+        * Wait event request. 
+        */
+        TInt WaitEvent( TEventIf& aEvent, TRequestStatus* aStatus );
+
+        /**
+        * Handle event releases. 
+        */
+        TInt ReleaseEvent( TEventIf& aEvent );
+
+        /**
+        * Handle state events. 
+        */
+        TInt EventStateChange( TEventIf& aEvent );
+
+        /**
+        * Complete request in test thread.
+        */
+        void TestThreadRequestComplete( TRequestStatus* aStatus, TInt aCode );
+
+    public:     // Data
+        // None
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointers to things around
+        CTestModule* iModuleSession;             // Session owning us
+        CTestModuleContainer* iModuleContainer;  // Container used to execute this case
+
+        // Test execution related members
+        TInt iCaseNumber;                        // Case to be executed
+        TPtr iConfig;                            // Configuration file name
+        HBufC* iConfigNameBuffer;                // HBuffer for configuration file;
+        RMessage2 iTestExeMessage;               // Test execution message
+        TTestState iThreadState;                 // Thread state
+
+        // Print related members
+        RMutex          iPrintMutex;             // For iPrintSem semaphore handling
+        RSemaphore      iPrintSem;               // Synchonize print queue access
+        CPrintQueue*    iPrintQueue;             // Print queue
+        RMessage2 iNotifyPrintMessage;           // Print notification message
+        TBool iPrintNotifyAvailable;             // Is print notification available?
+
+        // Event related members
+        RMessage2 iNotifyEventMessage;           // Event nofitication message
+        TBool           iEventNotifyAvailable;   // Is event notification available?
+        RMutex          iEventMutex;             // For iEventSem semaphore handling
+        RSemaphore      iEventSem;               // Signal event request availability
+        TEventDef       iEventDef;
+
+        // Remote command protocol related stuff
+        RMessage2       iNotifyRemoteCmdMessage;// RemoteCmd notication message
+        TBool           iRemoteSendAvailable;    // Is RemoteSend available
+        RMutex          iSndMutex;               // For iSndSem semaphore handling
+        RSemaphore      iSndSem;                 // Signal RemoteCmd request availability
+        TThreadId       iTestThreadId;           // Thread id for receiver 
+        RThread         iTestThread;
+        TBool           iTestThreadOpen;
+        TBool           iRemoteReceiveAvailable; // Is RemoteReceive available
+        RMutex          iRcvMutex;               // For iRcvSem semaphore handling
+        RSemaphore      iRcvSem;                 // Signal RemoteCmd request availability
+        //RSemaphore      iReceiverSem;            // Signal testmodule request availability
+        RPointerArray<HBufC8> iMessageQueue;
+        
+        TCmdDef         iCmdDef;
+        TCmdDef         iRcvCmdDef;  
+        TTestProgress   iProgress;
+                
+
+        // Result with timestamp information
+        TFullTestResult iFullResult;    
+        TInt            iTestThreadFailure;         
+        
+        // Event array        
+        RPointerArray<TEvent>           iEventArray; 
+        // State event array
+        RPointerArray<TDesC>            iStateEvents;  
+        
+        // Event handlers
+        CPrintHandler*          iPrintHandler;
+        CEventHandler*          iEventHandler;
+        CSndHandler*            iSndHandler;
+        CRcvHandler*            iRcvHandler;
+        CInterferenceHandler*   iInterferenceHandler;
+        CMeasurementHandler*    iMeasurementHandler;
+        CCommandHandler*        iCommandHandler;
+        
+        // Test Interface related members
+        RMutex          iInterferenceMutex; // For iInterferenceMutex semaphore handling
+        RSemaphore      iInterferenceSem;   // Synchronize interference queue access
+        TBool           iInterferenceNotifyAvailable; // Is interference notification
+                                                      //available?
+        // Test measurement related members
+        RMutex          iMeasurementMutex;  // For iMeasurementMutex semaphore handling
+        RSemaphore      iMeasurementSem;    // Synchronize measurement queue access
+        TBool           iMeasurementNotifyAvailable; // Is measurement notification
+                                                      //available?
+        RMessage2 iNotifyInterferenceMessage; // Interference notification message
+
+        TTestInterference   iTestInterference; // Struct for information
+        // Array for handling test interference thread's kill in
+        // panic etc. cases
+        RArray<RThread>  iSTIFTestInterferenceArray;
+
+        RMessage2 iNotifyMeasurementMessage; // Measurement notification message
+
+        // Struct for information
+        TTestMeasurement   iTestMeasurement;
+        // Array for handling measurement
+        RPointerArray<TMeasurementHandling>  iMeasurementHandlingArray;
+
+        // This mutex meaning is to make sure that test complete and test
+        // case cancel operations are not executed at the same time.
+        RMutex          iTestThreadMutex; 
+
+        // Command related members
+        CCommandDef*     iCommandDef;             // Command definition (content)
+        RMessage2       iNotifyCommandMessage;   // Command nofitication message
+        TBool           iCommandNotifyAvailable; // Is command notification available?
+        RMutex          iCommandMutex;           // For iCommandSem semaphore handling
+        RSemaphore      iCommandSem;             // Signal command request availability
+        
+        // New event system
+        CAsyncEventActive* iAsyncEventActive;    // Active object to handle asynchronous wait.
+                                                 // Only one asynchronous operation can be handled at a time,
+                                                 // so if the object is created and is pending, it means
+                                                 // that operation is ongoing.
+                                                 // AO after completion closes connection to server and object
+                                                 // can be deleted and new wait can be handled
+        
+    public:     // Friend classes
+        // None
+        
+    protected:  // Friend classes
+        // None
+    	
+    private:    // Friend classes
+        friend class CUnderTaker;
+        friend class CPrintHandler;
+        friend class CEventHandler;
+        friend class CSndHandler;
+        friend class CRcvHandler;
+        friend class TEvent;
+        friend class CInterferenceHandler;
+        friend class CMeasurementHandler;
+        friend class CCommandHandler;
+    };
+
+#endif // TEST_SERVER_MODULE_IF_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/TestThreadContainer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,440 @@
+/*
+* 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: This file contains the header file of the CTestServer.
+*
+*/
+
+#ifndef TEST_THREAD_CONTAINER_H
+#define TEST_THREAD_CONTAINER_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifLogger.h>
+#include <StifTestModule.h>
+#include <StifTestInterface.h>
+#include "TestServerModuleIf.h"
+
+// CONSTANTS
+const TInt KStifMacroMax = 128;         // Maximum description length for
+                                        // STIF TF's macro cases
+const TInt KStifMacroMaxFile = 50;      // Maximum test result description
+                                        // length for STIF TF's macro cases
+const TInt KStifMacroMaxFunction = 30;  // Maximum test result description
+                                        // length for STIF TF's macro cases
+
+typedef TBuf<KStifMacroMax> TStifMacroDes;
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CUiEnvProxy;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestThreadContainer is a class, which contains the test execution thread
+// and interface functions to do operations in that thread context.
+class CTestThreadContainer 
+       :public CBase 
+    {
+
+    public: // Enumerations
+
+    private: // Enumerations
+        enum TPanicReason
+            {
+            EUnknownEventCmd,
+            EInvalidCTestThreadContainer,
+            ECreateTrapCleanup,
+            ENullTestThreadContainer,
+            EReInitializingTestModule,
+            ETestModuleNotInitialized,
+            EInvalidTestModuleOperation,
+            ENullRequest,            
+            EDuplicateFail,
+            EServerDied,
+            ENullExecution,
+            EThreadHandleOpenFail,
+            };
+
+    public: // Structured classes
+
+        /**
+        * For STIF TF's macro information
+        */
+        struct TTestMacro
+            {
+            TBool   iIndication;
+            TName   iFileDes;
+            TName   iFunctionDes;
+            TInt    iLine;
+            TInt    iReceivedError;
+            };
+
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestThreadContainer* NewL( 
+            CTestModuleContainer* aModuleContainer,
+            TThreadId aServerThreadId );
+
+        /**
+        * Destructor of CTestThreadContainer.
+        */
+        virtual ~CTestThreadContainer();
+
+
+    public: // New functions
+    
+        /**
+        * Test case execution thread thread function
+        */
+        static TInt ExecutionThread( TAny* aParams );        
+
+        /**
+         * UI Test case execution thread thread function
+         */
+         static TInt UIExecutionThread( TAny* aParams );        
+        
+        /**
+        * Returns pointer to test cases
+        */
+        const RPointerArray<TTestCaseInfo>* TestCases() const;
+        
+        /**
+        * Completes a print request. 
+        * This function is called from test execution thread.
+        */
+        virtual void DoNotifyPrint( const TInt aPriority, 
+                                    const TStifInfoName& aDes, 
+                                    const TName& aBuffer
+                                    );
+
+        /**
+        * Enables remote command receiving. 
+        * This function is called from test execution thread.
+        */
+        virtual void DoRemoteReceive( TStifCommand aRemoteCommand,
+                                      TParams aParams,
+                                      TInt aLen,
+                                      TRequestStatus& aStatus );
+        
+        /**
+        * Cancel remote command receiving. 
+        * This function is called from test execution thread.
+        */
+        virtual TInt DoRemoteReceiveCancel();
+
+        /**
+        * Completes a event request. 
+        * This function is called from test execution thread.
+        */
+        virtual TInt DoNotifyEvent( TEventIf& aEvent,
+                                    TRequestStatus* aStatus = NULL );
+                                    
+        /**
+        * Cancels pending asynchronous event request. 
+        * This function is called from test execution thread.
+        */
+        virtual void CancelEvent( TEventIf& aEvent, 
+                                  TRequestStatus* aStatus );
+                          
+        /**
+        * Set exit reason.
+        */
+        virtual void SetExitReason( const CTestModuleIf::TExitReason aExitReason, 
+                                    const TInt aExitCode );
+                                    
+        /**
+        * Set test behavior.
+        */
+        virtual TInt SetBehavior( const CTestModuleIf::TTestBehavior aType, 
+                                  TAny* aPtr );
+
+        /**
+        * Get exit reason.
+        */
+        virtual void ExitReason (  CTestModuleIf::TExitReason& aExitReason, 
+                                   TInt& aExitCode );
+
+        /**
+        * STIF TF's macro. Initialized TTestMacro.
+        */
+        virtual void StifMacroErrorInit();
+
+        /**
+        * STIF TF's(TL, T1L, T2L, etc )macro. Saves information for later use.
+        */ 
+        virtual TInt StifMacroError( TInt aMacroType,
+                                     const TText8* aFile,
+                                     const char* aFunction,
+                                     TInt aLine,
+                                     TInt aResult,
+                                     TInt aExpected1,
+                                     TInt aExpected2,
+                                     TInt aExpected3,
+                                     TInt aExpected4,
+                                     TInt aExpected5 );
+
+        /**
+        * With this can be store information about test interference
+        * thread to client space.
+        */ 
+        virtual TInt AddInterferenceThread( RThread aSTIFTestInterference );
+
+        /**
+        * With this can be remove information about test interference
+        * thread from client space.
+        */ 
+        virtual TInt RemoveInterferenceThread( RThread aSTIFTestInterference );
+
+        /**
+        * With this can be stored information about test measurement
+        * to TestServer space.
+        */ 
+        virtual TInt HandleMeasurementProcess(
+                    CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo );
+
+        /**
+        * Completes a command request.
+        * This function is called from test execution thread.
+        */
+        virtual void DoNotifyCommand(TCommand aCommand, const TDesC8& aParamsPckg);
+
+        /**
+        * Obtain title of currently running test case.
+        */
+        virtual void GetTestCaseTitleL(TDes& aTestCaseTitle);
+
+        /**
+         * Sets thread logger.
+         */
+        void SetThreadLogger( CStifLogger* aThreadLogger );
+        
+        /**
+         * Gets thread logger.
+         */
+        CStifLogger* GetThreadLogger();
+        
+        /**
+         * Gets information if testserver supports UI testing.
+         */
+        IMPORT_C TBool UITesting();
+                
+        /**
+         * Gets UIEnvProxy.
+         */
+        IMPORT_C CUiEnvProxy* GetUiEnvProxy();
+        
+        IMPORT_C TBool SeperateProcesses();
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    private:  // New functions
+
+        /**
+        * Function that initialise module in execution thread context.
+        */
+        TInt InitializeModuleInThread( RLibrary& aModule );
+
+        /**
+        * Function that enumerates test cases in execution thread context.
+        */
+        TInt EnumerateInThread();
+
+        /**
+        * Function that frees the enumeration data in execution thread context.
+        */
+        void FreeEnumerationDataInThread();
+
+        /**
+        * Function that executes test case in execution thread context.
+        */
+        TInt ExecuteTestCaseInThread();
+
+        
+        /**
+        * Complete testcase.
+        */
+        void TestComplete( TInt aCompletionCode );
+        
+        /**
+        * Delete a test module instance
+        */
+        void DeleteTestModule();
+        
+        /**
+        * Store TRequestStatus.
+        */
+        void SetEventReq(  TEventDef::TEventCmdType aType, 
+                           TEventIf& aEvent, 
+                           TRequestStatus* aStatus );
+
+        /**
+        * Destroys the event queue. 
+        * This function is called from test execution thread.
+        */
+        void DestroyEventQueue();
+        
+        /**
+        * Error print.
+        */
+        void ErrorPrint( const TInt aPriority, TPtrC aError );
+
+        /**
+        * Panicing function for test thread.
+        */ 
+        static void Panic( TPanicReason aReason );
+     
+        /**
+        * Check that server is alive.
+        */ 
+        void IsServerAlive();
+
+        /**
+        * Exception handler
+        */
+        static void ExceptionHandler( TExcType );
+
+         /**
+        * Modifies aRecFile and aRecFunction lenghts if nesessarily.
+        */ 
+        void SetMacroInformation( TInt aFileMaxLength,
+                                  TInt aFuntionMaxLength,
+                                  const TText8* aRecFile,
+                                  const char* aRecFunction,
+                                  TDes& aFile,
+                                  TDes& aFunction );
+        /**
+        * Duplicates mutexes
+        */                                 
+        TInt DuplicateMutexHandles( RThread& aThread );
+        
+        /**
+        * Executes test case using OOM simulation
+        */       
+        TInt ExecuteOOMTestCase( TInt aTestCaseNumber,                
+                                 TInt aFirst, 
+                                 TInt aLast, 
+                                 TInt& aResult, 
+                                 TTestResult& caseResult );
+        /**
+        * Leak checks for test case
+        */       
+
+        void LeakChecksForTestCase( TBool aReturnLeakCheckFail,
+                            TInt aThreadHandleCountBeforeTest,
+                            TInt aThreadHandleCountAfterTest,
+                            TInt aRequestCountBeforeTest, 
+                            TInt aRequestCountAfterTest );                           
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TThreadId aServerThreadId );
+
+        /** 
+        * C++ default constructor.
+        */
+        CTestThreadContainer( CTestModuleContainer* aModuleContainer );
+                              
+        /**
+        * Handles to parent.
+        */
+        CTestExecution& TestExecution();
+        CTestModuleContainer& ModuleContainer();
+        
+    public:     // Data
+        
+    protected:  // Data
+        // None
+
+    private:    // Data     
+        // Pointers to server 
+        CTestModuleContainer*           iModuleContainer;
+        
+        // Pointer to test module
+        CTestModuleBase*                iTestModule;            
+        
+        // Test cases
+        RPointerArray<TTestCaseInfo>*   iCases;    
+        
+        // Resource checking
+        TUint                           iCheckResourceFlags;
+
+        // Internal if none provoded from testmodule        
+        TRequestStatus                  iReqStatus;
+
+         // StifLogger used in test module thread
+        CStifLogger* iThreadLogger;             
+        
+        // Handles to server
+        RThread     iServerThread;
+
+        // Mutexes, duplicated handles
+        RMutex  iPrintMutex;                // For iPrintSem semaphore handling
+        //RMutex  iErrorPrintMutex;         // For iErrorPrintSem semaphore handling
+        RMutex  iEventMutex;                // For iEventSem semaphore handling
+        RMutex  iSndMutex;                  // For iSndSem semaphore handling
+        RMutex  iRcvMutex;                  // For iRcvSem semaphore handling
+        RMutex  iInterferenceMutex;         // For iInterferenceSem semaphore handling
+        RMutex  iMeasurementMutex;          // For iMeasurementSem semaphore handling
+        RMutex  iCommandMutex;              // For iCommandSem semaphore handling
+        
+        // Mutex, duplicated handle. This mutex meaning is to make sure that
+        // test complete and test case cancel operations are not executed at
+        // the same time.
+        RMutex          iTestThreadMutex;                 
+                
+        // Semaphores, duplicated handles
+        RSemaphore  iPrintSem;          // Signal print request availability
+        RSemaphore  iErrorPrintSem;     // Signal error request availability
+        RSemaphore  iEventSem;          // Signal event request availability
+        RSemaphore  iSndSem;            // Signal Send request availability
+        RSemaphore  iRcvSem;            // Signal Receive request availability
+        RSemaphore  iInterferenceSem;   // Synchronize test interference access
+        RSemaphore  iMeasurementSem;    // Synchronize test measurement access
+        RSemaphore  iCommandSem;        // Signal command request availability
+
+        // Macro information
+        TTestMacro  iTestMacroInfo;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+    	friend class CTestThreadContainerRunner;
+    };
+
+#endif // TEST_THREAD_CONTAINER_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/inc/version.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,29 @@
+/*
+* 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: STIF version declaration
+*
+*/
+
+#ifndef VERSION_H_
+#define VERSION_H_
+
+#define STIF_MAJOR_VERSION 1
+#define STIF_MINOR_VERSION 0
+#define STIF_BUILD_VERSION 0
+
+#define STIF_REL_DATE "1st Mar 2010"
+
+#define TO_UNICODE(text) _L(text) 
+
+#endif /*VERSION_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/rom/STIFTestFramework.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,25 @@
+/*
+* 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: STIFTestFramework.iby file specifies needed 
+* components for ROM image
+*
+*/
+
+#ifndef __STIF_TEST_FRAMEWORK_IBY__
+#define __STIF_TEST_FRAMEWORK_IBY__
+ 
+   #include <Stif.iby>
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/rom/Stif.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,51 @@
+/*
+* 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: Stif.iby file specifies needed components for ROM image
+*
+*/
+
+#ifndef __STIF_IBY__
+#define __STIF_IBY__
+
+// TEF Test Module
+#include <teftestmodulefw.iby>
+#include <rfilelogger.iby>
+#include <iniparser.iby>
+#include <tefwrapper.iby>
+
+file=ABI_DIR\BUILD_DIR\stiftestengine.dll            SHARED_LIB_DIR\stiftestengine.dll
+file=ABI_DIR\BUILD_DIR\stftestenginesrv.exe          SHARED_LIB_DIR\stftestenginesrv.exe
+file=ABI_DIR\BUILD_DIR\stiftestserver.dll            SHARED_LIB_DIR\stiftestserver.dll
+file=ABI_DIR\BUILD_DIR\stiftestinterface.dll         SHARED_LIB_DIR\stiftestinterface.dll
+file=ABI_DIR\BUILD_DIR\testcombiner.dll              SHARED_LIB_DIR\testcombiner.dll
+file=ABI_DIR\BUILD_DIR\TestServerStarter.exe         SHARED_LIB_DIR\TestServerStarter.exe
+file=ABI_DIR\BUILD_DIR\demomodule.dll                SHARED_LIB_DIR\demomodule.dll
+file=ABI_DIR\BUILD_DIR\atslogger.dll                 SHARED_LIB_DIR\atslogger.dll
+file=ABI_DIR\BUILD_DIR\testscripter.dll              SHARED_LIB_DIR\testscripter.dll
+file=ABI_DIR\BUILD_DIR\stiftfwif.dll                 SHARED_LIB_DIR\stiftfwif.dll
+file=ABI_DIR\BUILD_DIR\suevent.dll                   SHARED_LIB_DIR\suevent.dll
+file=ABI_DIR\BUILD_DIR\stfloggingserver.exe          SHARED_LIB_DIR\stfloggingserver.exe
+file=ABI_DIR\BUILD_DIR\stf.exe                       SHARED_LIB_DIR\stf.exe
+file=ABI_DIR\BUILD_DIR\stfeventsystemsrv.exe         SHARED_LIB_DIR\stfeventsystemsrv.exe
+file=ABI_DIR\BUILD_DIR\stfeventsystemclient.dll      SHARED_LIB_DIR\stfeventsystemclient.dll
+file=ABI_DIR\BUILD_DIR\ConsoleUI.exe                 SHARED_LIB_DIR\ConsoleUI.exe
+  
+data=\epoc32\data\z\system\data\TestFramework.ini    testframework\TestFramework.ini
+
+// Touchconsoleui is a component that allows to work with touch screen devices in console mode.
+// It should be use only swith environments that do not supports S60 graphical user interface
+// file=ABI_DIR\BUILD_DIR\TouchConsoleUI.exe            SHARED_LIB_DIR\TouchConsoleUI.exe
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/rom/Stif_rom.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,27 @@
+/*
+* 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: Stif.iby file specifies needed components for ROM image
+*
+*/
+
+#ifndef __STIF_ROM_IBY__
+#define __STIF_ROM_IBY__
+
+#if defined(__S60_)
+// For kernel testing support, uncomment the following line
+device[VARID]=ABI_DIR\BUILD_DIR\StifKernelTestClassBase.dll  SHARED_LIB_DIR\StifKernelTestClassBase.dll
+#endif
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/sis/stf.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,77 @@
+;
+; 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: Installation file for STIF UI
+;
+
+; Languages
+&EN
+
+; Package header, uid is the Stf's uid
+#{"STF"},(0x2002BC9F),1,0,0
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; 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\urel\stiftestengine.dll"-"!:\Sys\Bin\stiftestengine.dll"
+  "\epoc32\release\armv5\urel\stftestenginesrv.exe"-"!:\Sys\Bin\stftestenginesrv.exe"
+  "\epoc32\release\armv5\urel\stiftestserver.dll"-"!:\Sys\Bin\stiftestserver.dll"
+  "\epoc32\release\armv5\urel\stiftestinterface.dll"-"!:\Sys\Bin\stiftestinterface.dll"
+  "\epoc32\release\armv5\urel\TestServerStarter.exe"-"!:\Sys\Bin\TestServerStarter.exe"
+  "\epoc32\release\armv5\urel\demomodule.dll"-"!:\Sys\Bin\demomodule.dll"
+  "\epoc32\release\armv5\urel\atslogger.dll"-"!:\Sys\Bin\atslogger.dll"
+  "\epoc32\release\armv5\urel\testscripter.dll"-"!:\Sys\Bin\testscripter.dll"
+  "\epoc32\release\armv5\urel\testcombiner.dll"-"!:\Sys\Bin\testcombiner.dll"
+  "\epoc32\release\armv5\urel\stiftfwif.dll"-"!:\Sys\Bin\stiftfwif.dll"
+  "\epoc32\release\armv5\urel\suevent.dll"-"!:\Sys\Bin\suevent.dll"
+  "\epoc32\release\armv5\urel\stfloggingserver.exe"-"!:\Sys\Bin\stfloggingserver.exe"
+  "\epoc32\release\armv5\urel\stf.exe"-"!:\Sys\Bin\stf.exe"
+  "\epoc32\release\armv5\urel\ConsoleUI.exe"-"!:\Sys\Bin\ConsoleUI.exe"
+  
+  "\epoc32\release\armv5\urel\stfeventsystemsrv.exe"-"!:\Sys\Bin\stfeventsystemsrv.exe"
+  "\epoc32\release\armv5\urel\stfeventsystemclient.dll"-"!:\Sys\Bin\stfeventsystemclient.dll"
+  "\epoc32\data\z\system\data\TestFramework.ini"-"c:\testframework\TestFramework.ini"
+
+; 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/testexecfw/stf/stfext/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,28 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STF extension.
+*/
+
+
+
+// STF TestLib Plugins
+#include "../testlibplugins/group/bld.inf"
+
+// STF Test Modules
+#include "../testmodules/group/bld.inf"
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/filelibplugin/bwins/stffiletestlibpluginu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,6 @@
+EXPORTS
+	?LibEntryL@@YAPAVCStfFileTestLibPlugin@@XZ @ 1 NONAME ; class CStfFileTestLibPlugin * LibEntryL(void)
+	?ExecuteCommandL@CStfFileTestLibPlugin@@UAEHABVTDesC16@@@Z @ 2 NONAME ; int CStfFileTestLibPlugin::ExecuteCommandL(class TDesC16 const &)
+	?IsCommandSupported@CStfFileTestLibPlugin@@UAEHABVTDesC16@@@Z @ 3 NONAME ; int CStfFileTestLibPlugin::IsCommandSupported(class TDesC16 const &)
+		
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/filelibplugin/eabi/stffiletestlibpluginu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,7 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_ZN21CStfFileTestLibPlugin15ExecuteCommandLERK7TDesC16 @ 2 NONAME
+	_ZN21CStfFileTestLibPlugin18IsCommandSupportedERK7TDesC16 @ 3 NONAME
+	_ZTI21CStfFileTestLibPlugin @ 4 NONAME ; #<TI>#
+	_ZTV21CStfFileTestLibPlugin @ 5 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/filelibplugin/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -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: 
+*
+*/
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/stffiletestlibplugin.h
+PRJ_MMPFILES
+stffiletestlibplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/filelibplugin/group/stffiletestlibplugin.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -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: 
+*
+*/
+#include <platform_paths.hrh>
+SMPSAFE
+TARGET		  stffiletestlibplugin.dll
+TARGETTYPE	  dll
+UID			 0x1000008d 0x2002BC96
+
+USERINCLUDE	 ..\inc
+
+OS_LAYER_SYSTEMINCLUDE
+SOURCEPATH	  ..\src
+
+SOURCE		  stffiletestlibplugin.cpp
+
+
+
+
+//EXPORTUNFROZEN
+DEFFILE         stffiletestlibplugin.def
+
+
+LIBRARY		 euser.lib
+LIBRARY	     efsrv.lib
+CAPABILITY	ALL -TCB
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/filelibplugin/inc/stffiletestlibplugin.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+
+#ifndef __STFFILETESTLIB_H__
+#define __STFFILETESTLIB_H__
+
+//  Include Files
+
+#include <e32base.h>	// CBase
+#include <e32std.h>	 // TBuf
+#include "StfTestLibPluginInterface.h"
+
+
+
+
+
+//  Class Definitions
+    
+class CStfFileTestLibPlugin : public CStfTestLibPlugin
+    {
+public:    // new functions
+    
+    ~CStfFileTestLibPlugin();
+    
+    static CStfFileTestLibPlugin* NewL();
+   
+
+public:
+    // new functions, example API
+    virtual TBool IsCommandSupported(const TDesC& aCommand) ;
+    virtual TInt  ExecuteCommandL(const TDesC& aCommandLine);
+private:
+    // new functions
+    CStfFileTestLibPlugin();
+    void ConstructL();
+
+private:
+    // data
+   
+    };
+
+
+
+#endif  // __STFFILETESTLIB_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/filelibplugin/sis/StfFileTestLib_EKA2.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,36 @@
+;
+; Copyright (c) 2010 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: 
+;
+; Installation file for StfFileTestLib dll
+;
+; This is an auto-generated PKG file by Carbide.
+; This file uses variables specific to Carbide builds that will not work
+; on command-line builds. If you want to use this generated PKG file from the
+; command-line tools you will need to modify the variables with the appropriate
+; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
+
+;
+; UID is the dll's UID
+;
+#{"StfFileTestLib DLL"},(0xE887D696),1,0,0
+
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\StfFileTestLib.dll"		  -"!:\sys\bin\StfFileTestLib.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/filelibplugin/src/stffiletestlibplugin.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,203 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+
+#include "stffiletestlibplugin.h"	
+#include <f32file.h> 
+
+_LIT(KSTFRunUtilsMakeReadWrite,"MakeReadWrite");
+_LIT(KSTFRunUtilsCopyFile,"CopyFile");
+_LIT(KSTFRunUtilsMkDir,"MkDir");
+_LIT(KSTFRunUtilsDeleteFile,"DeleteFile");
+_LIT(KSTFRunUtilsDelete,"Delete");
+_LIT(KSTFRunUtilsDeleteDirectory,"DeleteDirectory");
+EXPORT_C  CStfFileTestLibPlugin* LibEntryL()
+    {
+    CStfFileTestLibPlugin* self=CStfFileTestLibPlugin::NewL();
+    return  self;
+    }
+
+
+
+//  Member Functions
+
+CStfFileTestLibPlugin* CStfFileTestLibPlugin::NewL()
+    {
+    CStfFileTestLibPlugin* self = new (ELeave) CStfFileTestLibPlugin;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+CStfFileTestLibPlugin::~CStfFileTestLibPlugin()
+    {
+
+    }
+
+
+
+
+EXPORT_C TBool CStfFileTestLibPlugin::IsCommandSupported(const TDesC& aCommand)
+    {
+    TBool result=EFalse;
+    if(aCommand==KSTFRunUtilsMakeReadWrite)
+        {
+        result=ETrue;
+        }
+    else if(aCommand==KSTFRunUtilsCopyFile)
+        {
+        result=ETrue;
+        }
+    else if(aCommand==KSTFRunUtilsMkDir)
+        {
+        result=ETrue;
+        }
+    else if(aCommand==KSTFRunUtilsDeleteFile)
+        {
+        result=ETrue;
+        }
+    else if(aCommand==KSTFRunUtilsDelete)
+        {
+        result=ETrue;
+        }
+    else if(aCommand==KSTFRunUtilsDeleteDirectory)
+        {
+        result=ETrue;
+        }
+    
+    return result;
+    }
+
+EXPORT_C TInt CStfFileTestLibPlugin::ExecuteCommandL(const TDesC& aCommandLine) 
+    {
+    TInt err = 0;
+    _LIT(KDefault,              "?:\\default");
+    _LIT(KCDrive,               "?:\\"); 
+    _LIT(KSTFBackslash,         "\\" );
+    TBuf<10> defaultPath(KDefault);
+    defaultPath.Replace(0, 2, _L("c:"));
+
+    TBuf<3> cDrive(KCDrive);
+    cDrive.Replace(0, 2, _L("c:"));
+
+    RFs fS;
+    User::LeaveIfError(fS.Connect() );
+    CleanupClosePushL(fS);
+
+    TLex lex(aCommandLine);
+  //  lex.NextToken();
+    TPtrC token(lex.NextToken());
+    if(token.CompareF(KSTFRunUtilsCopyFile) == 0)
+        {
+        TPtrC file1=lex.NextToken();
+        TPtrC file2=lex.NextToken();
+        TParse source, dest;
+        CFileMan* fMan = CFileMan::NewL(fS);
+        CleanupStack::PushL(fMan);
+        User::LeaveIfError(source.Set(file1, &defaultPath, NULL) );
+        User::LeaveIfError(dest.Set(file2, &defaultPath, NULL) );
+        TPtrC sourcefile=source.FullName();
+        TPtrC destfile=dest.FullName();
+        err=fMan->Copy(file1, file2, CFileMan::EOverWrite);
+        User::LeaveIfError(err);
+        CleanupStack::PopAndDestroy(fMan);
+        }
+    else if(token.CompareF(KSTFRunUtilsMkDir) == 0)
+        {
+        token.Set(lex.NextToken());
+        TParse fileName;
+
+        if (!token.Length())
+            User::Leave(KErrPathNotFound);
+        
+        TPtrC lastChar(token.Mid(token.Length() - 1));
+        if ( lastChar.CompareF(KSTFBackslash) != 0 )
+            {
+            TBuf<64> tempToken(token);
+            tempToken.Append(KSTFBackslash);
+            token.Set(tempToken);
+            }
+
+        User::LeaveIfError( fileName.Set(token, &cDrive, NULL) );
+        err=fS.MkDir( fileName.DriveAndPath() );
+        User::LeaveIfError( err );
+        }
+    else if(token.CompareF(KSTFRunUtilsDeleteFile) == 0 ||
+             token.CompareF(KSTFRunUtilsDelete) == 0)
+        {
+        token.Set(lex.NextToken());
+  
+        CFileMan* fMan = CFileMan::NewL(fS);
+        CleanupStack::PushL(fMan);
+        err=fMan->Delete(token);
+        User::LeaveIfError(err );
+        CleanupStack::PopAndDestroy(fMan);
+        }
+    else if(token.CompareF(KSTFRunUtilsMakeReadWrite) == 0)
+        {
+        token.Set(lex.NextToken());
+        TParse fileName;
+        User::LeaveIfError(fileName.Set(token, &defaultPath, NULL) );
+        err = fS.SetAtt(fileName.FullName(),0, KEntryAttReadOnly);
+        if (err != KErrNone && err != KErrNotFound)
+            User::Leave(err);
+        }
+    //It deletes the specified directory
+    else if(token.CompareF(KSTFRunUtilsDeleteDirectory) == 0)
+        {
+        token.Set(lex.NextToken());
+        TParse fileName;
+
+        if (!token.Length())
+            User::Leave(KErrPathNotFound);
+        
+        TPtrC lastChar(token.Mid(token.Length() - 1));
+        if ( lastChar.CompareF(KSTFBackslash) != 0 )
+            {
+            TBuf<64> tempToken(token);
+            tempToken.Append(KSTFBackslash);
+            token.Set(tempToken);
+            }
+
+        CFileMan* fMan = CFileMan::NewL(fS);
+        CleanupStack::PushL(fMan);
+
+        User::LeaveIfError(fileName.Set(token, &cDrive, NULL) );
+        err=fMan->RmDir( fileName.DriveAndPath() );
+        User::LeaveIfError(err  );
+
+        CleanupStack::PopAndDestroy(fMan);
+        }
+    
+    fS.Close();
+    CleanupStack::Pop(&fS);
+    return err;
+    }
+
+CStfFileTestLibPlugin::CStfFileTestLibPlugin()
+// note, CBase initialises all member variables to zero
+    {
+    }
+
+void CStfFileTestLibPlugin::ConstructL()
+    {
+    // second phase constructor, anything that may leave must be constructed here
+  
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,26 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STF testlib plugins.
+*/
+
+#include "../filelibplugin/group/bld.inf"
+#include "../syslibplugin/group/bld.inf"
+
+
+
+
+PRJ_EXPORTS
+../inc/StfTestLibPluginInterface.h
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/inc/StfTestLibPluginInterface.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+/*
+ * StfTestLibPluginInterface.h
+ *
+ *  Created on: Nov 10, 2009
+ *      Author: h112wang
+ */
+
+#ifndef STFTESTLIBPLUGININTERFACE_H_
+#define STFTESTLIBPLUGININTERFACE_H_
+
+class CStfTestLibPlugin : public CBase {
+public:
+   
+
+    /**
+    * Result indicates eiterh plug-in is able to process command 
+    * @param aCommand command to check
+    */
+    virtual TBool IsCommandSupported(const TDesC& aCommand) = 0;
+
+    /**
+    * Execution of the specified library command
+    * implementation of , should return ASAP.
+    * aMessage contan is service specific.
+    * it will return KErrNone for successfully execution
+    * otherwise, it will return the error code
+    * @param aCommandLine command to execute
+ 
+    */
+    virtual TInt ExecuteCommandL(const TDesC& aCommandLine) = 0;
+ };
+
+
+
+
+#endif /* STFTESTLIBPLUGININTERFACE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/bwins/stfsystemtestlibplugin.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,6 @@
+EXPORTS
+	?LibEntryL@@YAPAVCstfsystemtestlibplugin@@XZ @ 1 NONAME ; class Cstfsystemtestlibplugin * LibEntryL(void)
+	?ExecuteCommandL@Cstfsystemtestlibplugin@@UAEHABVTDesC16@@@Z @ 2 NONAME ; int Cstfsystemtestlibplugin::ExecuteCommandL(class TDesC16 const &)
+	?IsCommandSupported@Cstfsystemtestlibplugin@@UAEHABVTDesC16@@@Z @ 3 NONAME ; int Cstfsystemtestlibplugin::IsCommandSupported(class TDesC16 const &)
+	
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/eabi/stfsystemtestlibplugin.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,9 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_ZN23Cstfsystemtestlibplugin15ExecuteCommandLERK7TDesC16 @ 2 NONAME
+	_ZN23Cstfsystemtestlibplugin18IsCommandSupportedERK7TDesC16 @ 3 NONAME
+	_ZTI23Cstfsystemtestlibplugin @ 4 NONAME ; #<TI>#
+	_ZTV23Cstfsystemtestlibplugin @ 5 NONAME ; #<VT>#
+	_ZTI26CTestSecurityInstUIHandler @ 6 NONAME ; #<TI>#
+	_ZTV26CTestSecurityInstUIHandler @ 7 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,25 @@
+/*
+* 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: 
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+..\inc\stfsystemtestlibplugin.h
+
+PRJ_MMPFILES
+stfsystemtestlibplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/group/stfsystemtestlibplugin.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,68 @@
+/*
+* 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: MMP file for STIF Test Framework's remote events module.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET		  stfsystemtestlibplugin.dll
+TARGETTYPE	  dll
+UID			 0x1000008d 0x2002BC97
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE	 ..\inc
+SYSTEMINCLUDE   \epoc32\include
+SYSTEMINCLUDE   \epoc32\include\swi
+SYSTEMINCLUDE   \epoc32\include\platform\mw\swi
+SOURCEPATH	  ..\src
+
+SOURCE		  stfsystemtestlibplugin.cpp
+SOURCE		  AppInstall.cpp TestSecurityInstUIHandler.cpp
+
+// In order to use .def files to freeze code you must use one or more DEFFILE lines;
+// see the ones commented out below for examples.
+// By default, the build tools look for the WINSCW def file in a BWINS directory
+// (at the same level as the directory containing the mmp file), 
+// the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory. 
+// If your .def files are stored in these default locations, you can simply specify the
+// .def filename(s) with no path. If you want to store .def files in non-default 
+// locations, you will need to specify the paths in the DEFFILE statement(s).
+
+//The following commented out code shows how the build system uses the implicit
+// location for defiles. To create the DEF files Choose Project > Freeze Exports from Carbide
+// or run 'abld freeze' from the command-line
+//#if defined (WINS)
+//  DEFFILE ..\bwins\stfsystemtestlibplugin.def
+//#elif defined (GCC32)
+//  DEFFILE ..\bmarm\stfsystemtestlibplugin.def
+//#else 
+//  DEFFILE ..\eabi\stfsystemtestlibplugin.def
+//#endif
+
+nostrictdef
+
+LIBRARY		 euser.lib
+LIBRARY	     sishelper.lib 
+
+CAPABILITY	ALL -TCB
+
+DEFFILE stfsystemtestlibplugin.def
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE_UDEBONLY
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/inc/AppInstall.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+
+#if (!defined __TEST_SECURITY_APPINSTALL_H__)
+#define __TEST_SECURITY_APPINSTALL_H__
+
+
+class CAppInstall 
+
+{
+public:
+	CAppInstall();
+
+	static TInt Install(const TDesC&);
+	static TInt Uninstall(const TDesC&);	
+	
+protected:
+	
+private:
+};
+
+#endif // __TEST_SECURITY_APPINSTALL_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/inc/TestSecurityInstUIHandler.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,340 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+#include <msisuihandlers.h>
+
+/*@{*/
+///Macros
+#define KUserNameMaxLength	64
+#define KPassword			64
+/*@}*/
+
+enum KMyErrCode
+	{
+	KErrNothing,
+	KErrLanguage,        
+	KErrDrive,
+	KErrOptions,        
+	KErrAbortInstall,
+	KErrAbortUnInstall,        
+	KErrLeave,
+	KErrCannotOverwriteFile,
+	KErrError        
+	};
+	
+/**
+This represents the User Interface handler for the install engine
+The higher code should provide one of these interfaces for the engine
+to use for a UI.
+
+@publishedPartner
+@released
+*/
+using namespace Swi;
+
+class CTestSecurityInstUIHandler : public CBase, public Swi::MUiHandler
+// This represents the User Interface handler for the install engine
+// The higher code should provide one of these interfaces for the engine
+// to use for a UI
+	{
+	public:
+		static CTestSecurityInstUIHandler* NewL();
+		
+		~CTestSecurityInstUIHandler();
+
+		/**
+		 * Displays a dialog at the beginning of an installation with details about the SISX package
+	 	 * being installed. This dialog must be shown in TrustedUI mode.
+	 	 *
+	 	 * @param aAppInfo	Information about the application.
+	 	 * @param aLogo		The logo data in the SISX file. If no logo is present it will be NULL.
+		 * @param aCertificates An array of end entity certificates, one for each chain in the SISX file.
+		 *				If the SISX file is unsigned this array will have zero length.
+		 *
+		 * @note 		Trusted UI
+	   	 *
+		 * @return		ETrue if the user pressed the Yes button to continue the install,
+		 *				EFalse if the user pressed the No button, aborting the installation.
+		 */
+		TBool  DisplayInstallL (const CAppInfo& aAppInfo, 
+			const CApaMaskedBitmap* aLogo, 
+			const RPointerArray <CCertificateInfo> & aCertificates);
+		/**
+		 * Displays a dialog requesting that the user grants these capabilities to the SISX package 
+		 * being installed. This dialog must be shown in TrustedUI mode.
+		 *
+		 * @param aAppInfo	 Information about the application.
+		 * @param aCapabilitySet The capabilities requested by the SISX package.
+		 *
+		 * @note Trusted UI
+		 *
+		 * @return		ETrue to continue the installation, or EFalse to abort the installation.
+		 */
+		TBool DisplayGrantCapabilitiesL(const CAppInfo& aAppInfo, 
+						const TCapabilitySet& aCapabilitySet);
+										
+		/**
+		 * Requests preferred language and dialect information from the UI.
+		 *
+		 * @param aAppInfo	Information about the application.
+		 * @param aLanguages	Array of languages supported by the SIS file. 
+		 *
+		 * @return		Must return index in the passed array that corresponds to the user's selected 
+		 *			preferred language. If out-of-bounds value is returned, the engine will abort 
+		 *			installation.
+		 */
+		TInt DisplayLanguageL(const CAppInfo& aAppInfo, 
+				      const RArray<TLanguage>& aLanguages);
+	
+		/**
+		 * Requests the drive to install the package on, from the UI.
+		 *
+		 * @param aAppInfo	Information about the application.
+		 * @param aSize		Total size of the files that will be installed on the configurable drive.
+		 * @param aDriveLetters	Array of drive letters on which the package can be installed.
+		 * @param aDriveSpaces	Array of space free (in bytes) on each of the drives in the aDriveLetters array. 
+		 *
+		 * @return		An index in the drive array. If the index is out of range the engine will abort
+		 *                      the installation.
+		 */
+		TInt DisplayDriveL(const CAppInfo& aAppInfo, 
+				   TInt64 aSize,
+				   const RArray<TChar>& aDriveLetters,
+				   const RArray<TInt64>& aDriveSpaces);
+	
+		/**
+		 * Displays a dialog asking whether we want to upgrade an application present on the device.
+		 *
+		 * @param aAppInfo	        Information about the application being installed.
+		 * @param aExistingAppInfo	Information about the existing application.
+		 *
+		 * @return		ETrue if the user pressed the Yes button,
+		 *			EFalse if the user pressed the No button.
+		 */
+		TBool DisplayUpgradeL(const CAppInfo& aAppInfo, 
+				      const CAppInfo& aExistingAppInfo);
+	
+		/**
+		 * Displays a dialog box asking which options the user wishes to install.
+		 *
+		 * @param aAppInfo	Information about the application.
+		 * @param aOptions	An array of option names.
+		 * @param aSelections	An array of booleans, corresponding to the aOptions array.
+		 *
+		 * @return		ETrue on success, EFalse on error.
+		 */
+		TBool DisplayOptionsL(const CAppInfo& aAppInfo,
+				      const RPointerArray<TDesC>& aOptions,
+				      RArray<TBool>& aSelections);
+	
+		/**
+		 * Informs the UI of events occurring during installation.  
+		 *
+		 * @param aEvent	The event which has occurred.
+		 * @param aValue	The value associated with the event if applicable.
+		 * @param aDes          A descriptor associated with the event if applicable.
+		 */
+		TBool HandleInstallEventL(const CAppInfo& aAppInfo,
+						TInstallEvent aEvent, 
+						TInt aValue=0, 
+						const TDesC& aDes=KNullDesC);
+		/**
+		 * Informs the UI of cancellable events occurring during installation.  
+		 *
+		 * @param aEvent	 The event which has occurred.
+		 * @param aCancelHandler This mix-in is used to inform Software Install that the user has
+		 *			 pressed the cancel button on the dialog.
+		 * @param aValue	 The value associated with the event if applicable.
+		 * @param aDes           A descriptor associated with the event if applicable.
+		 */
+		void HandleCancellableInstallEventL(const CAppInfo& aAppInfo,
+						TInstallCancellableEvent aEvent, 
+						MCancelHandler& aCancelHandler,
+						TInt aValue=0, 
+						const TDesC& aDes=KNullDesC);
+		/**
+		 * Displays a dialog indicating that the package is unsigned, or that signature validation has failed.
+		 *
+		 * @param aAppInfo              Information about the application.
+		 * @param aSigValidationResult	The result of signature validation.
+		 * @param aPkixResult           Results of a validation of the PKIX  certificate chain.
+		 *                              Note that is can be NULL, in this case no validation results are available.
+		 * @param aCertificates         An array containing information about the certificates in the chain.
+		 * @param aInstallAnyway		ETrue if installation is allowed to continue.
+		 *
+		 * @return						ETrue to continue the installation, EFalse to abort.
+		 */
+		TBool DisplaySecurityWarningL(const CAppInfo& aAppInfo,
+						Swi::TSignatureValidationResult aSigValidationResult,
+						RPointerArray<CPKIXValidationResultBase>& aPkixResults,
+						RPointerArray<CCertificateInfo>& aCertificates,
+						TBool aInstallAnyway);
+	
+		/**
+		 * Displays a dialog indicating that there was an error carrying out online certificate status checking.
+		 *
+		 * @param aMessage	The error which occurred during online certificate status checking
+		 * @param aOutcome	The outcome of the OCSP check. If no outcome can be given, it will be NULL.
+		 * @param aWarningOnly	ETrue if the installation is allowed to continue after a warning, EFalse otherwise.
+		 *
+		 * @return		ETrue on success, EFalse on error.
+		 */
+		TBool DisplayOcspResultL(const CAppInfo& aAppInfo,
+						TRevocationDialogMessage aMessage, 
+						RPointerArray<TOCSPOutcome>& aOutcomes, 
+						RPointerArray<CCertificateInfo>& aCertificates,
+						TBool aWarningOnly);
+	
+		/**
+		 * Used to inform the user the installation they are attempting is trying to overwrite
+		 * a file that does not belong to it. Following this message installation is aborted.
+		 *
+		 * @param aAppInfo	        Information about the application.
+		 * @param aInstalledAppInfo	Information about the application that owns the file in question.
+		 * @param aFileName		The filename of the file in question
+		 */
+		void DisplayCannotOverwriteFileL(const CAppInfo& aAppInfo,
+						 const CAppInfo& aInstalledAppInfo,
+						 const TDesC& aFileName);
+						 
+		/**
+		 * Displays a dialog at the start of the uninstallation with information about the application
+		 * to be uninstalled. The user may cancel the uninstallation at this stage. This dialog must 
+		 * be shown in TrustedUI mode.
+		 *	
+		 * @param aAppInfo	Information about the application.
+		 *
+		 * @note Trusted UI
+		 *
+		 * @return			ETrue to continue the uninstallation, or EFalse to abort the uninstallation.
+		 */
+		TBool DisplayUninstallL(const CAppInfo& aAppInfo);
+
+
+		/**
+		 * Displays a dialog containing text. This dialog has only a Continue button if aOption is 
+		 * EInstFileTextOptionContinue, or Yes and No buttons otherwise.
+		 *
+		 * @param aAppInfo	Information about the application.
+		 * @param aOption	The type of dialog box to display.
+		 * @param aText		The text to display
+		 *
+		 * @return		ETrue is the user wants to go forward, EFalse otherwise.
+		 */
+		 TBool DisplayTextL(const CAppInfo& aAppInfo, 
+				    TFileTextOption aOption,
+				    const TDesC& aText);
+	 
+		/**
+		 * Displays a dialog showing an error message. 
+		 *
+		 * @param aAppInfo	    Information about the application.
+		 * @param aType		    The error message to display.
+		 * @param aParam	    An error specific parameter.
+		 */
+		void DisplayErrorL(const CAppInfo& aAppInfo,
+				   TErrorDialog aType, 
+				   const TDesC& aParam);
+
+		/**
+		 * Displays a dialog indicating that a component which is being uninstalled is a dependency
+		 * of another component installed.
+		 *
+		 * @param aAppInfo	Information about the application.
+		 * @param aComponents	An array of components which depend on components of the application
+		 *
+		 * @return		ETrue to continue the uninstallation, EFalse to abort.
+		 */
+		TBool DisplayDependencyBreakL(const CAppInfo& aAppInfo,
+					      const RPointerArray<TDesC>& aComponents);
+		
+		/**
+		 * Informs user that the applications are in use during an uninstallation.
+		 * Return ETrue if the user wishes to continue the removal process and 
+		 * close the applications anyway
+		 *
+		 * @param aAppNames		An array containing the name of the application in use.
+		 *
+		 * @return			ETrue if the user wishes to continue with removal.
+		 */
+		TBool DisplayApplicationsInUseL(const CAppInfo& aAppInfo, const RPointerArray<TDesC>& aAppNames);
+	
+		/**
+		 * Displays a generic question dialog with a Yes/No answer.
+		 *
+		 * @param aAppInfo	Information about the application.
+		 * @param aQuestion The question to ask.
+		 * @param aDes		A descriptor associated with the question if applicable. 
+		 *
+		 * @return			ETrue if the user pressed the Yes button,
+		 *				EFalse if the user pressed the No button.
+		 */
+		TBool DisplayQuestionL(const CAppInfo& aAppInfo, TQuestionDialog aQuestion, const TDesC& aDes=KNullDesC);
+	
+		/**
+	 	* Used to inform the user of a missing dependency needed to install the 
+	 	* current package. It is up to the UI implementors and/or the user whether
+	 	* or not this warning can be overridden.
+	 	*
+	 	* @param aAppInfo           Info about the current application.
+	 	* @param aDependencyName    Name of the missing dependency.
+	 	* @param aWantedVersionFrom Starting suitable version number of the mising
+	 	*                           dependency. Can be all zeros, meaning it is 
+	 	*                           unknown.
+		 * @param aWantedVersionFrom Ending suitable version number of the mising
+	 	*                           dependency. Can be all zeros, meaning it is 
+	 	*                           unknown.
+	 	* @param aInstalledVersion  The installed (unsuitable) version of the 
+	 	*                           missing dependency. Can be all zeros, meaning 
+	 	*                           the missing dependency is not installed.
+	 	*
+	 	* @return \e ETrue to continue installation, \e EFalse to abort.
+	 	*/
+		TBool DisplayMissingDependencyL(
+		const CAppInfo& aAppInfo,
+		const TDesC& aDependencyName,
+		TVersion aWantedVersionFrom,
+		TVersion aWantedVersionTo,
+		TVersion aInstalledVersion);
+	
+
+
+
+		TBool 	iDispInstall;
+		TBool	iDispGrantCapabilities;
+		TBool	iDispUnInstall;
+		TInt	iDispLanguage;
+		TInt	iDispDialect;
+		TChar	iDispDrive;
+		TBool	iDispUpgrade;
+		TBool	iDispDependencyBreak;
+		TBool	iDispQuestion;
+		TBool	iDispSecurityWarning;
+		TBool	iDispRevocationQuery;
+		TBool	iDispApplicationInUse;
+		TBool	iDispTextDialog;
+		TInt	iDispOptions;
+		TInt	iAppUID;
+		
+		KMyErrCode 	iErrCode;
+		
+	private:
+		CTestSecurityInstUIHandler();
+		void ConstructL();
+	};
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/inc/stfsystemtestlibplugin.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,59 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+
+// This file defines the API for stfsystemtestlibplugin.dll
+
+#ifndef __STFSYSTEMTESTLIBPLUGIN_H__
+#define __STFSYSTEMTESTLIBPLUGIN_H__
+
+//  Include Files
+
+#include <e32base.h>	// CBase
+#include <e32std.h>	 // TBuf
+#include "StfTestLibPluginInterface.h"
+//  Constants
+
+const TInt KstfsystemtestlibpluginBufferLength = 15;
+typedef TBuf<KstfsystemtestlibpluginBufferLength>
+        TstfsystemtestlibpluginExampleString;
+
+//  Class Definitions
+
+class Cstfsystemtestlibplugin : public CStfTestLibPlugin
+    {
+public:
+    // new functions
+    static Cstfsystemtestlibplugin* NewL();
+    ~Cstfsystemtestlibplugin();
+
+public:
+    // new functions, example API
+    virtual TBool IsCommandSupported(const TDesC& aCommand) ;
+    virtual TInt  ExecuteCommandL(const TDesC& aCommandLine);
+
+private:
+    // new functions
+    Cstfsystemtestlibplugin();
+    void ConstructL();
+
+private:
+    
+    };
+
+#endif  // __STFSYSTEMTESTLIBPLUGIN_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/inc/stfsystemtestlibplugin.pan	Fri Apr 09 10:46:28 2010 +0800
@@ -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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+
+#ifndef __STFSYSTEMTESTLIBPLUGIN_PAN__
+#define __STFSYSTEMTESTLIBPLUGIN_PAN__
+
+//  Data Types
+
+enum TstfsystemtestlibpluginPanic
+    {
+    EstfsystemtestlibpluginNullPointer
+    };
+
+//  Function Prototypes
+
+GLREF_C void Panic(TstfsystemtestlibpluginPanic aPanic);
+
+#endif  // __STFSYSTEMTESTLIBPLUGIN_PAN__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/sis/stfsystemtestlibplugin_EKA2.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,36 @@
+;
+; Copyright (c) 2010 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: 
+;
+; Installation file for stfsystemtestlibplugin dll
+;
+; This is an auto-generated PKG file by Carbide.
+; This file uses variables specific to Carbide builds that will not work
+; on command-line builds. If you want to use this generated PKG file from the
+; command-line tools you will need to modify the variables with the appropriate
+; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
+
+;
+; UID is the dll's UID
+;
+#{"stfsystemtestlibplugin DLL"},(0xED788704),1,0,0
+
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\stfsystemtestlibplugin.dll"		  -"!:\sys\bin\stfsystemtestlibplugin.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/src/AppInstall.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,85 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+#include <e32base.h>
+#include <e32cons.h>
+#include <hal.h>
+
+
+// Epoc Includes
+#include <swi/launcher.h>
+
+
+#include "appinstall.h"
+#include "testsecurityinstuihandler.h"
+
+
+CAppInstall::CAppInstall()
+	{
+	}
+
+TInt CAppInstall::Install(const TDesC& aFileName)
+	{
+	
+	TInt error = KErrNone;
+
+	TFileName fileName(aFileName);
+	
+	fileName.PtrZ();	
+	
+	Swi::CInstallPrefs* iInstallPrefs = Swi::CInstallPrefs::NewL();
+	
+	CTestSecurityInstUIHandler* iUIHandler = CTestSecurityInstUIHandler::NewL();
+	
+	error = Swi::Launcher::Install(*iUIHandler,fileName,*iInstallPrefs);
+
+	delete iUIHandler;
+	delete iInstallPrefs;
+	
+	return error;
+	
+	}
+
+TInt CAppInstall::Uninstall(const TDesC& aUid)
+	{
+	
+	TInt error = KErrNone;
+
+	TLex conv(aUid);
+	
+	TUint32 id;
+	
+	error = conv.Val(id,EHex);
+	
+	if(error!=KErrNone)
+		{
+		return error;
+		}
+		
+	TUid uid = TUid::Uid(id);
+		
+	
+	CTestSecurityInstUIHandler* iUIHandler = CTestSecurityInstUIHandler::NewL();
+
+	error = Swi::Launcher::Uninstall(*iUIHandler, uid);
+	
+	delete iUIHandler;
+
+	return error;
+		
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/src/TestSecurityInstUIHandler.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,484 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+#include "TestSecurityInstUIHandler.h"
+
+/**
+ * Creates a new Instance of the CTestSecurityInstUIHandler and calls the
+ * appropriate ConsturctL
+ * @param None
+ * @return CTestSecurityInstUIHandler* 
+ * 
+ */
+CTestSecurityInstUIHandler* CTestSecurityInstUIHandler::NewL()
+	{
+	CTestSecurityInstUIHandler*	self=new(ELeave) CTestSecurityInstUIHandler();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop();
+	return self;
+	}
+
+/**
+ * Constructor for CTestSecurityInstUIHandler
+ */	
+CTestSecurityInstUIHandler::CTestSecurityInstUIHandler()
+:	iDispInstall(TRUE),
+	iDispGrantCapabilities(TRUE),
+	iDispUnInstall(TRUE),
+	iDispLanguage(0),
+	iDispDialect(0),
+	iDispDrive('C'),
+	iDispUpgrade(TRUE),
+	iDispDependencyBreak(TRUE),
+	iDispQuestion(TRUE),
+	iDispSecurityWarning(TRUE),
+	iDispRevocationQuery(TRUE),
+	iDispApplicationInUse(TRUE),
+	iDispTextDialog(TRUE),
+	iDispOptions(0),
+	iAppUID(0),
+	iErrCode(KErrNothing)
+	{
+	}
+
+/**
+ * Second stage constructor for CTestSecurityInstUIHandler
+ */	
+void CTestSecurityInstUIHandler::ConstructL()
+	{
+	}
+
+/**
+ * Destructor for CTestSecurityInstUIHandler
+ */	
+CTestSecurityInstUIHandler::~CTestSecurityInstUIHandler()
+	{
+	iDispInstall = FALSE;
+	iDispGrantCapabilities = FALSE;
+	iDispUnInstall = FALSE;
+	iDispLanguage = 0;
+	iDispDialect = 0;
+	iDispDrive = 'C';
+	iDispUpgrade = FALSE;
+	iDispDependencyBreak = FALSE;
+	iDispQuestion = FALSE;
+	iDispSecurityWarning = FALSE;
+	iDispRevocationQuery = FALSE;
+	iDispApplicationInUse = FALSE;
+	iDispTextDialog = FALSE;
+	iDispOptions = 0;
+	iAppUID = 0;
+		
+	iErrCode = KErrNothing;
+	}
+
+/**
+ * Displays a dialog at the beginning of an installation with details about the SISX package
+ * being installed. This dialog must be shown in TrustedUI mode.
+ *
+ * @param aAppInfo		Information about the application.
+ * @param aLogo			The logo data in the SISX file. If no logo is present it will be NULL.
+ * @param aCertificates An array of end entity certificates, one for each chain in the SISX file.
+ *						If the SISX file is unsigned this array will have zero length.
+ *
+ * @note 				Trusted UI
+ *
+ * @return				ETrue if the user pressed the Yes button to continue the install,
+ *						EFalse if the user pressed the No button, aborting the installation.
+ */
+TBool CTestSecurityInstUIHandler::DisplayInstallL(const CAppInfo& /*aAppInfo*/, 
+			const CApaMaskedBitmap* /*aLogo*/, 
+			const RPointerArray< CCertificateInfo >& /*aCertificates*/)
+	{
+	return iDispInstall;
+	}
+
+/**
+ * Displays a dialog requesting that the user grants these capabilities to the SISX package 
+ * being installed. This dialog must be shown in TrustedUI mode.
+ *
+ * @param aAppInfo	 		Information about the application.
+ * @param aCapabilitySet 	The capabilities requested by the SISX package.
+ *
+ * @note 					Trusted UI
+ *
+ * @return					ETrue to continue the installation, or EFalse to abort the installation.
+ */
+TBool CTestSecurityInstUIHandler::DisplayGrantCapabilitiesL(const CAppInfo& /*aAppInfo*/, 
+			const TCapabilitySet& /*aCapabilitySet*/)
+	{
+	return iDispGrantCapabilities;
+	}
+
+/**
+ * Requests preferred language and dialect information from the UI.
+ *
+ * @param aAppInfo		Information about the application.
+ * @param aLanguages	Array of languages supported by the SIS file. 
+ *
+ * @return				Must return index in the passed array that corresponds to the user's selected 
+ *						preferred language. If out-of-bounds value is returned, the engine will abort 
+ *						installation.
+ */
+TInt CTestSecurityInstUIHandler::DisplayLanguageL(const CAppInfo& /*aAppInfo*/, 
+	      const RArray<TLanguage>& aLanguages)
+	{
+	TInt languageCode = iDispLanguage;
+	TInt index;
+	
+	// Return the index value in the array which matches the language code 
+	// obtained from the ini file.
+	for (index=0; index<aLanguages.Count(); index++)
+		{
+		if (aLanguages[index] == (TLanguage)languageCode)
+			{
+			return index;
+			}
+		}
+	// Language Code did not match - error
+	iErrCode = KErrLanguage;
+	
+	return languageCode;
+	}
+	
+/**
+ * Requests the drive to install the package on, from the UI.
+ *
+ * @param aAppInfo	Information about the application.
+ * @param aSize		Total size of the files that will be installed on the configurable drive.
+ * @param aDriveLetters	Array of drive letters on which the package can be installed.
+ * @param aDriveSpaces	Array of space free (in bytes) on each of the drives in the aDriveLetters array. 
+ *
+ * @return		An index in the drive array. If the index is out of range the engine will abort
+ *                      the installation.
+ */
+TInt CTestSecurityInstUIHandler::DisplayDriveL(const CAppInfo& /*aAppInfo*/, 
+		   TInt64 /*aSize*/,
+		   const RArray<TChar>& aDriveLetters,
+		   const RArray<TInt64>& /*aDriveSpaces*/)
+	{
+	TInt index;
+	TInt driveIndex=0;
+	for (index=0; index < aDriveLetters.Count(); index++)
+		{
+		if (aDriveLetters[index] == iDispDrive)
+			{
+			driveIndex = index;
+			break;
+			}
+		}
+		
+	if (index == aDriveLetters.Count()) // Out of range error 
+		{
+		iErrCode = KErrDrive;
+		driveIndex = index;
+		}
+	return driveIndex;
+	}
+	
+/**
+ * Displays a dialog asking whether we want to upgrade an application present on the device.
+ *
+ * @param aAppInfo	        Information about the application being installed.
+ * @param aExistingAppInfo	Information about the existing application.
+ *
+ * @return		ETrue if the user pressed the Yes button,
+ *			EFalse if the user pressed the No button.
+ */
+TBool CTestSecurityInstUIHandler::DisplayUpgradeL(const CAppInfo& /*aAppInfo*/, 
+		      const CAppInfo& /*aExistingAppInfo*/)
+	{
+	return iDispUpgrade;
+	}
+	
+/**
+ * Displays a dialog box asking which options the user wishes to install.
+ *
+ * @param aAppInfo	Information about the application.
+ * @param aOptions	An array of option names.
+ * @param aSelections	An array of booleans, corresponding to the aOptions array.
+ *
+ * @return		ETrue on success, EFalse on error.
+ */
+TBool CTestSecurityInstUIHandler::DisplayOptionsL(const CAppInfo& /*aAppInfo*/,
+		      const RPointerArray<TDesC>& aOptions,
+		      RArray<TBool>& aSelections)
+	{
+	
+	TInt index;
+	TBool setFlag = EFalse;
+	
+	for (index=0; index<aOptions.Count();index++)
+		{
+		if (index == iDispOptions)
+			{
+			aSelections[index] = ETrue;
+			setFlag = ETrue;
+			}
+		else
+			{
+			aSelections[index] = EFalse;
+			}
+		}
+
+	if (setFlag == (TBool)ETrue)
+		{
+		return ETrue;
+		}
+	else
+		{
+		iErrCode = KErrOptions;
+		return EFalse;
+		}
+	}
+	
+/**
+ * Informs the UI of events occurring during installation.  
+ *
+ * @param aEvent	The event which has occurred.
+ * @param aValue	The value associated with the event if applicable.
+ * @param aDes		A descriptor associated with the event if applicable.
+ * @return TBool	Always returns ETrue to indicate the Install Event is always handled
+ */
+TBool CTestSecurityInstUIHandler::HandleInstallEventL(const CAppInfo& /*aAppInfo*/,
+			 TInstallEvent aEvent, 
+			 TInt /*aValue=0*/, 
+			 const TDesC& /*aDes=KNullDesC*/)
+	{
+	switch (aEvent)
+		{
+		case EEventSetProgressBarFinalValue:
+			break;
+		case EEventUpdateProgressBar:
+			break;
+		case EEventAbortedInstall:
+			iErrCode = KErrAbortInstall;
+			break;
+		case EEventCompletedInstall:
+			break;
+		case EEventCompletedUnInstall:
+			break;
+		case EEventAbortedUnInstall:
+			iErrCode = KErrAbortUnInstall;
+			break;
+		case EEventCompletedNoMessage:
+			break;
+		case EEventLeave:
+			iErrCode = KErrLeave;
+			break;
+		case EEventOcspCheckEnd:
+			break;
+		default:
+			break;
+		}
+	return ETrue;
+	}
+	
+/**
+ * Informs the UI of cancellable events occurring during installation.  
+ *
+ * @param aEvent	 		The event which has occurred.
+ * @param aCancelHandler 	This mix-in is used to inform Software Install that the user has
+ *			 				pressed the cancel button on the dialog.
+ * @param aValue	 		The value associated with the event if applicable.
+ * @param aDes           	A descriptor associated with the event if applicable.
+ */
+void CTestSecurityInstUIHandler::HandleCancellableInstallEventL(const CAppInfo& /*aAppInfo*/,
+			TInstallCancellableEvent aEvent, 
+		    MCancelHandler& /*aCancelHandler*/,
+		    TInt /*aValue=0*/, 
+		    const TDesC& /*aDes=KNullDesC*/)
+	{
+	switch (aEvent)
+		{
+		case EEventRemovingFiles:
+			break;
+		case EEventShuttingDownApps:
+			break;
+		case EEventCopyingFiles:
+			break;
+		case EEventOcspCheckStart:
+			break;
+		default:
+			break;
+		}
+	}
+
+/**
+ * Displays a dialog indicating that the package is unsigned, or that signature validation has failed.
+ *
+ * @param aAppInfo              Information about the application.
+ * @param aSigValidationResult	The result of signature validation.
+ * @param aPkixResult           Results of a validation of the PKIX  certificate chain.
+ *                              Note that is can be NULL, in this case no validation results are available.
+ * @param aCertificates         An array containing information about the certificates in the chain.
+ * @param aInstallAnyway		ETrue if installation is allowed to continue.
+ *
+ * @return						ETrue to continue the installation, EFalse to abort.
+ */
+TBool CTestSecurityInstUIHandler::DisplaySecurityWarningL(const CAppInfo& /*aAppInfo*/,
+						Swi::TSignatureValidationResult /*aSigValidationResult*/,
+						RPointerArray<CPKIXValidationResultBase>& /*aPkixResults*/,
+						RPointerArray<CCertificateInfo>& /*aCertificates*/,
+						TBool /*aInstallAnyway*/)
+	{
+	return ETrue;
+	}
+
+/**
+ * Displays a dialog indicating that there was an error carrying out online certificate status checking.
+ *
+ * @param aMessage		The error which occurred during online certificate status checking
+ * @param aOutcome		The outcome of the OCSP check. If no outcome can be given, it will be NULL.
+ * @param aWarningOnly	ETrue if the installation is allowed to continue after a warning, EFalse otherwise.
+ *
+ * @return				ETrue on success, EFalse on error.
+ */
+TBool CTestSecurityInstUIHandler::DisplayOcspResultL(const CAppInfo& /*aAppInfo*/,
+						TRevocationDialogMessage /*aMessage*/, 
+						RPointerArray<TOCSPOutcome>& /*aOutcomes*/, 
+						RPointerArray<CCertificateInfo>& /*aCertificates*/,
+						TBool aWarningOnly)
+	{
+	return aWarningOnly;
+	}
+	
+/**
+ * Used to inform the user the installation they are attempting is trying to overwrite
+ * a file that does not belong to it. Following this message installation is aborted.
+ *
+ * @param aAppInfo	        Information about the application.
+ * @param aInstalledAppInfo	Information about the application that owns the file in question.
+ * @param aFileName			The filename of the file in question
+ */
+void CTestSecurityInstUIHandler::DisplayCannotOverwriteFileL(const CAppInfo& /*aAppInfo*/,
+				 const CAppInfo& /*aInstalledAppInfo*/,
+				 const TDesC& /*aFileName*/)
+	{
+	iErrCode = KErrCannotOverwriteFile;
+	}
+	
+/**
+ * Displays a dialog at the start of the uninstallation with information about the application
+ * to be uninstalled. The user may cancel the uninstallation at this stage. This dialog must 
+ * be shown in TrustedUI mode.
+ *	
+ * @param aAppInfo	Information about the application.
+ *
+ * @note Trusted UI
+ *
+ * @return			ETrue to continue the uninstallation, or EFalse to abort the uninstallation.
+ */
+TBool CTestSecurityInstUIHandler::DisplayUninstallL(const CAppInfo& /*aAppInfo*/)
+	{
+	return iDispUnInstall;
+	}
+
+/**
+ * Displays a dialog containing text. This dialog has only a Continue button if aOption is 
+ * EInstFileTextOptionContinue, or Yes and No buttons otherwise.
+ *
+ * @param aAppInfo	Information about the application.
+ * @param aOption	The type of dialog box to display.
+ * @param aText		The text to display
+ *
+ * @return		ETrue if the user wants to go forward, EFalse otherwise.
+ */
+TBool CTestSecurityInstUIHandler::DisplayTextL(const CAppInfo& /*aAppInfo*/, 
+			    TFileTextOption /*aOption*/,
+			    const TDesC& /*aText*/)
+	{
+	return iDispTextDialog;
+	}
+	
+/**
+ * Displays a dialog showing an error message. 
+ *
+ * @param aAppInfo	    Information about the application.
+ * @param aType		    The error message to display.
+ * @param aParam	    An error specific parameter.
+ */
+void CTestSecurityInstUIHandler::DisplayErrorL(const CAppInfo& /*aAppInfo*/,
+			   TErrorDialog /*aType*/,
+			   const TDesC& /*aParam*/)
+	{
+	iErrCode = KErrError;
+	}
+
+/**
+ * Displays a dialog indicating that a component which is being uninstalled is a dependency
+ * of another component installed.
+ *
+ * @param aAppInfo		Information about the application.
+ * @param aComponents	An array of components which depend on components of the application
+ *
+ * @return				ETrue to continue the uninstallation, EFalse to abort.
+ */
+TBool CTestSecurityInstUIHandler::DisplayDependencyBreakL(const CAppInfo& /*aAppInfo*/,
+		      const RPointerArray<TDesC>& /*aComponents*/)
+	{
+	return iDispDependencyBreak;
+	}
+	
+/**
+ * Informs user that the applications are in use during an uninstallation.
+ * Return ETrue if the user wishes to continue the removal process and 
+ * close the applications anyway
+ *
+ * @param aAppNames		An array containing the name of the application in use.
+ *
+ * @return				ETrue if the user wishes to continue with removal.
+ */
+TBool CTestSecurityInstUIHandler::DisplayApplicationsInUseL(const CAppInfo& /*aAppInfo*/, 
+			const RPointerArray<TDesC>& /*aAppNames*/)
+	{
+	return iDispApplicationInUse;
+	}
+	
+/**
+ * Displays a generic question dialog with a Yes/No answer.
+ *
+ * @param aAppInfo	Information about the application.
+ * @param aQuestion The question to ask.
+ * @param aDes		A descriptor associated with the question if applicable. 
+ *
+ * @return			ETrue if the user pressed the Yes button,
+ *					EFalse if the user pressed the No button.
+ */
+TBool CTestSecurityInstUIHandler::DisplayQuestionL(const CAppInfo& /*aAppInfo*/, 
+			TQuestionDialog aQuestion, const TDesC& /*aDes=KNullDesC*/)
+	{
+	
+	switch(aQuestion)
+		{
+		case EQuestionIncompatible:
+			break;
+		default:
+			break;
+		}
+		
+	return iDispQuestion;
+	}
+
+TBool CTestSecurityInstUIHandler::DisplayMissingDependencyL(const CAppInfo& /*aAppInfo*/,
+	const TDesC& /*aDependencyName*/,TVersion /*aWantedVersionFrom*/,
+	TVersion /*aWantedVersionTo*/,TVersion /*aInstalledVersion*/)
+	{
+	return ETrue;
+	}
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testlibplugins/syslibplugin/src/stfsystemtestlibplugin.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,156 @@
+/*
+* 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: This file contains the header file of the CAtsLogger 
+* class.
+*
+*/
+
+//  Include Files  
+
+#include "stfsystemtestlibplugin.h"	// Cstfsystemtestlibplugin
+#include "stfsystemtestlibplugin.pan"	  	// panic codes
+#include "AppInstall.h"
+_LIT(KSTFRunProgram,"RUN_PROGRAM");
+_LIT(KSTFKillProgram,"KILL_PROGRAM");
+_LIT(KSTFInstallSIS,"InstallSis");
+_LIT(KSTFUnInstallSIS,"UnInstallSis");
+//  Member Functions
+
+EXPORT_C  Cstfsystemtestlibplugin* LibEntryL()
+    {
+    Cstfsystemtestlibplugin* self=Cstfsystemtestlibplugin::NewL();
+    return  self;
+    }
+
+Cstfsystemtestlibplugin* Cstfsystemtestlibplugin::NewL()
+    {
+    Cstfsystemtestlibplugin* self = new (ELeave) Cstfsystemtestlibplugin;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+Cstfsystemtestlibplugin::Cstfsystemtestlibplugin()
+// note, CBase initialises all member variables to zero
+    {
+    }
+
+void Cstfsystemtestlibplugin::ConstructL()
+    {
+    }
+
+Cstfsystemtestlibplugin::~Cstfsystemtestlibplugin()
+    {
+   
+    }
+
+ 
+
+EXPORT_C TBool Cstfsystemtestlibplugin::IsCommandSupported(const TDesC& aCommand)
+    {
+    TBool result=EFalse;
+        if(aCommand==KSTFRunProgram)
+            {
+            result=ETrue;
+            }
+        else if(aCommand==KSTFKillProgram)
+            {
+            result=ETrue;
+            }
+      
+        else if(aCommand==KSTFInstallSIS)
+            {
+            result=ETrue;
+            }
+        else if(aCommand==KSTFUnInstallSIS)
+            {
+            result=ETrue;
+            }
+        
+        
+    return result;
+    }
+EXPORT_C TInt  Cstfsystemtestlibplugin::ExecuteCommandL(const TDesC& aCommandLine)
+    {
+    TInt result=KErrNone;
+    TLex lex(aCommandLine);
+    TPtrC token(lex.NextToken());
+    if(token.CompareF(KSTFRunProgram) == 0)
+        {
+        RProcess process;
+        TPtrC filename(lex.NextToken());
+        TPtrC para(lex.NextToken());
+        TInt err=process.Create(filename, para);
+        if (err == KErrNone)
+        {
+        CleanupClosePushL(process);
+        TRequestStatus status;
+        process.Rendezvous(status);
+       if (status == KRequestPending)
+           {
+           process.Resume();
+           User::WaitForRequest(status);
+           }
+       else
+           {
+           process.RendezvousCancel(status);
+           process.Kill(0);
+          
+           }
+       CleanupStack::PopAndDestroy();
+       }
+       else
+       {
+          
+       }
+        }
+    else if(token.CompareF(KSTFKillProgram) == 0)
+        {
+        
+        
+            TBuf<100> execute;    
+            execute.Append(lex.NextToken());
+            execute.TrimAll();
+            execute.Append(_L("*"));
+           
+            TFindProcess processFinder(execute);
+           
+            TFullName result;
+            TInt err=processFinder.Next(result);
+             if( err == KErrNone)
+             {
+            
+             RProcess processHandle;
+             User::LeaveIfError(processHandle.Open ( processFinder, EOwnerThread));   
+             processHandle.Kill(KErrNone); 
+             processHandle.Close();
+             }
+        
+        
+        
+        
+        }
+    else if(token.CompareF(KSTFInstallSIS) == 0)
+        {
+        TPtrC sisname(lex.NextToken());
+        result=CAppInstall::Install(sisname);
+        }
+    else if(token.CompareF(KSTFUnInstallSIS) == 0)
+        {
+        TPtrC uid(lex.NextToken());
+        result=CAppInstall::Uninstall(uid);
+        }
+    return result;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*	bld.inf Toplevel build information for STF test modules.
+*/
+//scripter test module
+#include "../scriptermod/group/bld.inf"
+#if defined(__S60_)
+	// StifKernelTestClassBase
+        #include "../kerneltestmod/group/bld.inf"
+#endif // __S60_
+
+//TEF test module
+//#include "../teftestmod/group/bld.inf"
+
+//Test Combiner test module
+#include "../testcombiner/group/bld.inf"
+
+//TEF Test Module
+#include "../teftestmod/group/bld.inf"
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/kerneltestmod/Bwins/STIFKERNELTESTCLASSBASEU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,10 @@
+EXPORTS
+	??0DStifKernelTestClassBase@@QAE@PAVDLogicalDevice@@@Z @ 1 NONAME ; DStifKernelTestClassBase::DStifKernelTestClassBase(class DLogicalDevice *)
+	??0DStifKernelTestClassBaseDriver@@QAE@ABVTDesC8@@@Z @ 2 NONAME ; DStifKernelTestClassBaseDriver::DStifKernelTestClassBaseDriver(class TDesC8 const &)
+	??1DStifKernelTestClassBase@@UAE@XZ @ 3 NONAME ; DStifKernelTestClassBase::~DStifKernelTestClassBase(void)
+	??1DStifKernelTestClassBaseDriver@@UAE@XZ @ 4 NONAME ; DStifKernelTestClassBaseDriver::~DStifKernelTestClassBaseDriver(void)
+	?GetCaps@DStifKernelTestClassBaseDriver@@UBEXAAVTDes8@@@Z @ 5 NONAME ; void DStifKernelTestClassBaseDriver::GetCaps(class TDes8 &) const
+	?HandleMsg@DStifKernelTestClassBase@@UAEXPAVTMessageBase@@@Z @ 6 NONAME ; void DStifKernelTestClassBase::HandleMsg(class TMessageBase *)
+	?Install@DStifKernelTestClassBaseDriver@@UAEHXZ @ 7 NONAME ; int DStifKernelTestClassBaseDriver::Install(void)
+	?RunInternalL@DStifKernelTestClassBase@@MAEHPBVTStifFunctionInfo@@HABVTDesC8@@1@Z @ 8 NONAME ; int DStifKernelTestClassBase::RunInternalL(class TStifFunctionInfo const *, int, class TDesC8 const &, class TDesC8 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/kerneltestmod/Bwins/STIFKERNELTESTCLASSBASE_EKA1U.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,10 @@
+EXPORTS
+	??0DStifKernelTestClassBase@@QAE@PAVDLogicalDevice@@@Z @ 1 NONAME ; DStifKernelTestClassBase::DStifKernelTestClassBase(class DLogicalDevice *)
+	??0DStifKernelTestClassBaseDriver@@QAE@ABVTDesC16@@@Z @ 2 NONAME ; DStifKernelTestClassBaseDriver::DStifKernelTestClassBaseDriver(class TDesC16 const &)
+	??1DStifKernelTestClassBase@@UAE@XZ @ 3 NONAME ; DStifKernelTestClassBase::~DStifKernelTestClassBase(void)
+	??1DStifKernelTestClassBaseDriver@@UAE@XZ @ 4 NONAME ; DStifKernelTestClassBaseDriver::~DStifKernelTestClassBaseDriver(void)
+	?DoControl@DStifKernelTestClassBase@@EAEHHPAX0@Z @ 5 NONAME ; int DStifKernelTestClassBase::DoControl(int, void *, void *)
+	?GetCaps@DStifKernelTestClassBaseDriver@@UBEXAAVTDes8@@@Z @ 6 NONAME ; void DStifKernelTestClassBaseDriver::GetCaps(class TDes8 &) const
+	?Install@DStifKernelTestClassBaseDriver@@UAEHXZ @ 7 NONAME ; int DStifKernelTestClassBaseDriver::Install(void)
+	?RunInternalL@DStifKernelTestClassBase@@MAEHPBVTStifFunctionInfo@@HABVTDesC16@@1@Z @ 8 NONAME ; int DStifKernelTestClassBase::RunInternalL(class TStifFunctionInfo const *, int, class TDesC16 const &, class TDesC16 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/kerneltestmod/eabi/StifKernelTestClassBaseu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,18 @@
+EXPORTS
+	_ZN24DStifKernelTestClassBase12RunInternalLEPK17TStifFunctionInfoiRK6TDesC8S5_ @ 1 NONAME
+	_ZN24DStifKernelTestClassBase9HandleMsgEP12TMessageBase @ 2 NONAME
+	_ZN24DStifKernelTestClassBaseC2EP14DLogicalDevice @ 3 NONAME
+	_ZN24DStifKernelTestClassBaseD0Ev @ 4 NONAME
+	_ZN24DStifKernelTestClassBaseD1Ev @ 5 NONAME
+	_ZN24DStifKernelTestClassBaseD2Ev @ 6 NONAME
+	_ZN30DStifKernelTestClassBaseDriver7InstallEv @ 7 NONAME
+	_ZN30DStifKernelTestClassBaseDriverC2ERK6TDesC8 @ 8 NONAME
+	_ZN30DStifKernelTestClassBaseDriverD0Ev @ 9 NONAME
+	_ZN30DStifKernelTestClassBaseDriverD1Ev @ 10 NONAME
+	_ZN30DStifKernelTestClassBaseDriverD2Ev @ 11 NONAME
+	_ZNK30DStifKernelTestClassBaseDriver7GetCapsER5TDes8 @ 12 NONAME
+	_ZTI24DStifKernelTestClassBase @ 13 NONAME ; #<TI>#
+	_ZTI30DStifKernelTestClassBaseDriver @ 14 NONAME ; #<TI>#
+	_ZTV24DStifKernelTestClassBase @ 15 NONAME ; #<VT>#
+	_ZTV30DStifKernelTestClassBaseDriver @ 16 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/kerneltestmod/group/StifKernelTestClassBase.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,51 @@
+/*
+* 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: MMP file for STIF Test Framework's Kernel testclass
+* base module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+#include        "kernel/kern_ext.mmh"
+
+CAPABILITY      ALL
+VENDORID        0x101FB657
+SECUREID        0x102073DD
+EPOCALLOWDLLDATA
+
+
+TARGET          StifKernelTestClassBase.dll
+TARGETTYPE      kdll
+UID             0x1000008D 0x101FB3E3
+
+DEFFILE         StifKernelTestClassBase.def
+
+USERINCLUDE     ../inc 
+USERINCLUDE     ../../../../inc 
+
+OS_LAYER_KERNEL_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          StifKernelTestClassBase.cpp
+
+LIBRARY         ekern.lib
+
+
+
+LANG            SC
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/kerneltestmod/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*/
+
+#include <platform_paths.hrh>
+
+//
+// TO DO: (mandatory)
+//
+// Add here a definition for your port (as declared in E32PLAT.PM)
+//
+// WINSCW added for debugging test programs
+PRJ_PLATFORMS
+	WINSCW ARMV5
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+	StifKernelTestClassBase.mmp
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/kerneltestmod/src/StifKernelTestClassBase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,295 @@
+/*
+* 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: This file contains DStifKernelTestClassBaseDriver 
+* implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "StifKernelTestClass.h"
+#include "StifKernelTestClassBase.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// DStifKernelTestClassBaseDriver::DStifKernelTestClassBaseDriver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C DStifKernelTestClassBaseDriver::DStifKernelTestClassBaseDriver( 
+    const TDesC& aName )
+    {
+
+    __KTRACE_OPT(KHARDWARE, 
+       Kern::Printf("DStifKernelTestClassBaseDriver::DStifKernelTestClassBaseDriver()"));
+
+    iVersion=TVersion( RStifKernelTestClass::EMajorVersionNumber,
+                       RStifKernelTestClass::EMinorVersionNumber,
+                       RStifKernelTestClass::EBuildVersionNumber );
+ 
+    iName.Copy( aName.Left( KMaxName ) );
+
+    }
+
+// -----------------------------------------------------------------------------
+// DStifKernelTestClassBaseDriver::Install
+// Set name.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt DStifKernelTestClassBaseDriver::Install()
+    {
+
+    __KTRACE_OPT(KHARDWARE, 
+        Kern::Printf("DStifKernelTestClassBaseDriver::Install()"));
+ 
+
+    return SetName( &iName );       // Set our name and return error code.
+
+    }
+
+// -----------------------------------------------------------------------------
+// DStifKernelTestClassBaseDriver::~DStifKernelTestClassBaseDriver
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C DStifKernelTestClassBaseDriver::~DStifKernelTestClassBaseDriver()
+    {
+
+    __KTRACE_OPT(KHARDWARE, 
+        Kern::Printf("DStifKernelTestClassBaseDriver::~DStifKernelTestClassBaseDriver()"));
+
+    }
+
+// -----------------------------------------------------------------------------
+// DStifKernelTestClassBaseDriver::GetCaps
+// Returns the drivers capabilities, may be used by LDD
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void DStifKernelTestClassBaseDriver::GetCaps( TDes8& /* aDes */ ) const
+    {
+
+    __KTRACE_OPT(KHARDWARE, 
+        Kern::Printf("DStifKernelTestClassBaseDriver::GetCaps()"));
+  
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CStifKernelTestClassBase::CStifKernelTestClassBase
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+
+EXPORT_C DStifKernelTestClassBase::DStifKernelTestClassBase( DLogicalDevice* /* aDevice */ )
+    {
+    // Get pointer to client threads DThread object
+    iThread=&Kern::CurrentThread();
+
+    // Open a reference on client thread so it's control block can't dissapear until
+    // this driver has finished with it
+    ((DObject*)iThread)->Open();
+
+    __KTRACE_OPT(KHARDWARE, 
+        Kern::Printf("DStifKernelTestClassBase::DStifKernelTestClassBase()"));         
+    }
+            
+        
+// -----------------------------------------------------------------------------
+// DStifKernelTestClassBase::~DStifKernelTestClassBase()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+
+EXPORT_C DStifKernelTestClassBase::~DStifKernelTestClassBase()
+    { 
+
+    __KTRACE_OPT(KHARDWARE, 
+        Kern::Printf("DStifKernelTestClassBase::~DStifKernelTestClassBase()"));
+
+    // Close our reference on the client thread
+    Kern::SafeClose((DObject*&)iThread,NULL);
+
+            
+    Delete();        
+    }
+
+// -----------------------------------------------------------------------------
+// CStifKernelTestClassBase::DoControl
+// Handle syncronous request,
+// -----------------------------------------------------------------------------
+//
+
+TInt DStifKernelTestClassBase::DoControl( 
+    TInt aFunction, 
+    TAny* a1, 
+    TAny* /* a2 */ )   
+    {
+
+    __KTRACE_OPT(KHARDWARE, 
+        Kern::Printf("DStifKernelTestClassBase::DoControl()")); 
+    
+    TInt ret = KErrNone;
+    switch( aFunction )
+        {
+        case RStifKernelTestClass::ERunMethod:
+            {
+            TStifRunMethodInfo methodInfo;
+            TPckg<TStifRunMethodInfo> methodInfoPckg( methodInfo );
+
+            TInt err = KErrNone;
+                                                          
+            ret = Kern::ThreadDesRead( iThread, a1, methodInfoPckg, 0, KChunkShiftBy0 );
+            if( ret != KErrNone )
+                {
+                __KTRACE_OPT(KHARDWARE, 
+                    Kern::Printf("DStifKernelTestClassBase::DoControl: ThreadDesRead fails! %d", 333));
+                return ret;
+                }                
+                            
+            // TRAP is not supported in EKA2 kernel, so we can't use it. However, it is not even needed 
+            // any longer because kernel test cases cannot leave either. Although RunMethodL's name 
+            // seems to allow leaves (L in the end of the name), it really doesn't!
+            ret = RunMethodL( methodInfo.iMethodName, methodInfo.iMethodParams );                                           
+                                     
+            if( err != KErrNone )
+                {
+                methodInfo.iResult = err;
+                methodInfo.iMethodResultDes.Copy( _L("RunMethodL leave: ") );
+                methodInfo.iMethodResultDes.AppendNum( err );
+                }
+            else if( ret != KErrNone )
+                {
+                methodInfo.iResult = ret;
+                methodInfo.iMethodResultDes.Copy( _L("RunMethodL returned error: ") );
+                methodInfo.iMethodResultDes.AppendNum( ret );
+                }
+            else
+                {
+                methodInfo.iResult = KErrNone;
+                }
+
+            ret = Kern::ThreadDesWrite( iThread, a1, methodInfoPckg, 0, 0, &Kern::CurrentThread() );
+
+            }
+            break;
+        default:
+            ret = KErrNotFound;
+        }
+        
+    return ret;
+    } 
+
+
+// -----------------------------------------------------------------------------
+// void DStifKernelTestClassBase::HandleMsg(TMessageBase* aMsg)
+// Processes the DoControl call in EKA2
+// -----------------------------------------------------------------------------
+//
+       
+EXPORT_C void DStifKernelTestClassBase::HandleMsg( TMessageBase* aMsg )
+    {       
+    __KTRACE_OPT(KHARDWARE, 
+        Kern::Printf("DStifKernelTestClassBase::HandleMsg"));
+    
+    TThreadMessage& m=*(TThreadMessage*)aMsg;
+
+    // Get the id
+    TInt id=m.iValue;
+   
+    if(id == (TInt)ECloseMsg)
+        {
+        // Lets close the channel
+        m.Complete( KErrNone, EFalse );
+        return;
+        }
+        
+    if (id == KMaxTInt)
+        {
+        // Cancel operations are not needed because we don't use async requests
+        m.Complete( KErrNone, ETrue );
+        return;
+        }
+   
+    if( id > 0 ) 
+        {
+        // Process the DoControl call
+        TInt r = DoControl( id, m.Ptr0(), m.Ptr1() );
+        m.Complete( r, ETrue );
+        return;
+        }        
+    }
+
+
+// -----------------------------------------------------------------------------
+// DStifKernelTestClassBase::RunInternalL( 
+//                        const TStifKernelFunctionInfo* const aFunctions, 
+//                        TInt aCount, 
+//                        const TDesC& aMethod, 
+//                        const TDesC& aParams )
+//
+// Executes the test case. In EKA2 this function cannot leave.
+// -----------------------------------------------------------------------------
+//
+
+EXPORT_C TInt DStifKernelTestClassBase::RunInternalL( 
+                        const TStifFunctionInfo* const aFunctions, 
+                        TInt aCount, 
+                        const TDesC& aMethod, 
+                        const TDesC& aParams )
+    {
+    
+    TInt ret = KErrNotFound;
+
+    TInt i = 0;
+    TName funcName;
+    
+    // Search function from table and call it
+    for ( i = 0; i < aCount; i++ )
+        {
+        funcName = aFunctions[i].iFunctionName;      
+        if ( aMethod == funcName )
+            {
+            ret  = ( this->*(aFunctions[i].iMethod) )( aParams );
+            break;            
+            }
+    
+        }
+
+    return ret;
+    
+    }
+
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/Bmarm/TESTSCRIPTERU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/Bwins/TESTSCRIPTERU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,8 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestScripter@@XZ @ 1 NONAME ; class CTestScripter * LibEntryL(void)
+	?GetConstantValue@CTestScripter@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 2 NONAME ; int CTestScripter::GetConstantValue(class TDesC16 const &, class TDes16 &)
+	?SetResultDescription@CTestScripter@@QAEXABVTDesC16@@@Z @ 3 NONAME ; void CTestScripter::SetResultDescription(class TDesC16 const &)
+	?SetLocalValue@CTestScripter@@QAEHABVTDesC16@@0@Z @ 4 NONAME ; int CTestScripter::SetLocalValue(class TDesC16 const &, class TDesC16 const &)
+	?GetLocalValue@CTestScripter@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 5 NONAME ; int CTestScripter::GetLocalValue(class TDesC16 const &, class TDes16 &)
+	??1TScriptObject@@UAE@XZ @ 6 NONAME ABSENT ; TScriptObject::~TScriptObject(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/eabi/testscripteru.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,21 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_ZTI11CTestRunner @ 2 NONAME ; #<TI>#
+	_ZTI11TTestObject @ 3 NONAME ; #<TI>#
+	_ZTI13CDefinedValue @ 4 NONAME ; #<TI>#
+	_ZTI13CTestContinue @ 5 NONAME ; #<TI>#
+	_ZTI13CTestScripter @ 6 NONAME ; #<TI>#
+	_ZTI15TTestObjectBase @ 7 NONAME ; #<TI>#
+	_ZTI17TTestObjectKernel @ 8 NONAME ; #<TI>#
+	_ZTV11CTestRunner @ 9 NONAME ; #<VT>#
+	_ZTV11TTestObject @ 10 NONAME ; #<VT>#
+	_ZTV13CDefinedValue @ 11 NONAME ; #<VT>#
+	_ZTV13CTestContinue @ 12 NONAME ; #<VT>#
+	_ZTV13CTestScripter @ 13 NONAME ; #<VT>#
+	_ZTV15TTestObjectBase @ 14 NONAME ; #<VT>#
+	_ZTV17TTestObjectKernel @ 15 NONAME ; #<VT>#
+	_ZN13CTestScripter16GetConstantValueERK7TDesC16R6TDes16 @ 16 NONAME
+	_ZN13CTestScripter20SetResultDescriptionERK7TDesC16 @ 17 NONAME
+	_ZN13CTestScripter13GetLocalValueERK7TDesC16R6TDes16 @ 18 NONAME
+	_ZN13CTestScripter13SetLocalValueERK7TDesC16S2_ @ 19 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/group/TestScripter.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* 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: MMP file for STIF Test Framework's TestScripter.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET          testscripter.dll
+TARGETTYPE      dll
+
+CAPABILITY      ALL -TCB
+VENDORID        0x101FB657
+SECUREID        0x102073E2
+
+DEFFILE         testscripter.def
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         efsrv.lib 
+LIBRARY         stiftestengine.lib
+
+USERINCLUDE     ../inc 
+USERINCLUDE     ../../../../inc
+USERINCLUDE     ../../../../stffw/parser/inc
+USERINCLUDE     ../../../testlibplugins/inc 
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          TestScripter.cpp
+SOURCE          TestKeywords.cpp
+SOURCE          SubTestCaseRunner.cpp
+SOURCE			TestScripterUtils.cpp
+
+// ------- Parser -------
+
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* 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:
+*
+*	Build information for STIF Test Framework's TestScripter.
+*/
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+	
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	TestScripter.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/inc/Logging.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,75 @@
+/*
+* 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: This file contains Logging macros for TestScripter.
+*
+*/
+
+#ifndef LOGGINGDEFS_H
+#define LOGGINGDEFS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+
+// CONSTANTS
+const TUint KError              = 0x1;
+const TUint KInit               = 0x2;
+const TUint KPrint              = 0x4;
+const TUint KMessage            = 0x10;
+const TUint KFunction           = 0x20;
+const TUint KVerbose            = 0x40;
+const TUint KAlways             = 0xFFFFFFFF;
+const TUint KDebugLevel         = ( KPrint | KError | KMessage );
+
+// MACROS
+#define __TRACING_ENABLED
+
+#ifdef __TRACING_ENABLED
+
+     // Disable conditional expression is constant -warning
+    #pragma warning( disable : 4127 )
+
+    // General tracing function
+    #define __TRACE(level,p) if ( ( (level) & KDebugLevel ) && LOGGER )\
+                                          {LOGGER->Log p;}
+              
+    // Direct RDebug::Print                            
+    #define __RDEBUG(p) if( KVerbose & KDebugLevel ){ RDebug::Print p ; } 
+
+     // Log function name
+    #define __TRACEFUNC() if( ( KFunction & KDebugLevel ) && LOGGER ){\
+                                const char* f = __FUNCTION__;\
+                                 TPtrC8 F((const unsigned char*)f);\
+                                 LOGGER->Log(F);}
+
+#else // __TRACING_ENABLED
+     // No tracing
+    #define __TRACE(level,p)
+    #define __RDEBUG(p)
+    #define __TRACEFUNC()
+#endif // __TRACING_ENABLED
+
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // LOGGINGDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/inc/SubTestCaseRunner.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,341 @@
+/*
+ * 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: This file contains the header file of the TestScripter 
+ * module of STIF Test Framework.
+ *
+ */
+
+#ifndef SUBTESTCASERUNNER_H_
+#define SUBTESTCASERUNNER_H_
+
+//  INCLUDES
+#include <StifTestInterface.h>
+#include <TestEngineClient.h>
+#include "TestScripterUtils.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestRunner;
+class CSlave;
+class CRemoteCallsProxy;
+
+// CLASS DECLARATION
+// DESCRIPTION
+// CSubTestCaseRunner manages sub test cases execution and retuns 
+// execution results to CTestRunner
+NONSHARABLE_CLASS(CSubTestCaseRunner): public CActive
+    {
+public:
+    enum TSubTestCaseType { ESTTLocal, ESTTRemote };
+    enum TSubTestCaseState { ESTSIdle, ESTSRunning, ESTSPaused };
+public:
+    /**
+     * Coinstructor.
+     */
+    CSubTestCaseRunner();
+
+    /**
+     * Starts execution of selected test case.
+     */
+    virtual void RunSubTestCaseL( CStartInfo& aStartTestCaseInfo ) = 0;
+    
+    /**
+     * Pauses selected sub test case.
+     */
+    virtual void PauseSubTestCaseL() = 0;
+    
+    /**
+     * Reasume selected sub test case.
+     */
+    virtual void ResumeSubTestCaseL() = 0;
+    
+    virtual void CancelSubTestCaseL() = 0;
+    
+    
+    /**
+     * Gets execution result.
+     */
+    virtual TInt GetRunResult() const = 0;
+
+    /**
+     * Gets test case execution result..
+     */
+    virtual const TFullTestResult& GetTestCaseResult() const = 0;
+    
+    /**
+     * Gets executed test case info.
+     */
+    virtual const CStartInfo* GetStartInfo() const = 0;
+
+    /**
+     * Gets sub test case runner type.
+     */
+    virtual TSubTestCaseType GetType() const = 0;
+    
+    TSubTestCaseState GetState() const;
+protected:
+    TSubTestCaseState iState;
+    }; // class CSubTestCaseRunner
+
+
+// DESCRIPTION
+// CSubTestCaseRunner manages sub test cases execution and retuns 
+// execution results to CTestRunner
+NONSHARABLE_CLASS(CLocalSubTestCaseRunner): public CSubTestCaseRunner
+    {
+public:
+    /**
+     * Two-phased constructor.
+     */
+    static CLocalSubTestCaseRunner* NewL( CTestRunner* aTestRunner );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CLocalSubTestCaseRunner* NewLC( CTestRunner* aTestRunner );
+public:
+    /**
+     * Destructor.
+     */
+    ~CLocalSubTestCaseRunner();
+
+    /**
+     * Starts execution of selected test case.
+     */
+    void RunSubTestCaseL( CStartInfo& aStartTestCaseInfo );
+    
+    /**
+     * Pauses selected sub test case.
+     */
+    void PauseSubTestCaseL();
+    
+    /**
+     * Reasume selected sub test case.
+     */
+    void ResumeSubTestCaseL();
+    
+    void CancelSubTestCaseL();
+    
+    /**
+     * Gets execution result.
+     */
+    TInt GetRunResult() const;
+
+    /**
+     * Gets test case execution result..
+     */
+    const TFullTestResult& GetTestCaseResult() const;
+    
+    /**
+     * Gets executed test case info.
+     */
+    const CStartInfo* GetStartInfo() const;
+
+    /**
+     * Gets sub test case runner type.
+     */
+    TSubTestCaseType GetType() const;    
+private:
+    /**
+     * Constructor.
+     */
+    CLocalSubTestCaseRunner( CTestRunner* aTestRunner );
+
+    /**
+     * Second phase of two-phased constructor.
+     */
+    void ConstructL();
+    
+    /**
+     * See CActive::RunL()
+     */
+    void RunL();
+
+    /**
+     * See CActive::DoCancel()
+     */
+    void DoCancel();
+    
+    /**
+     * Resets runner internal state to default values.
+     */
+    void Reset();
+private:
+    // Pointer to test runner which will be notified about test case execution end.
+    CTestRunner* iTestRunner;
+    
+    // Test engine session used to load test module and open RTestCase subsession
+    RTestEngine iTestEngine;
+    
+    // Test case sub session used to run test case
+    RTestCase iTestCase;
+
+    // Copy of CStartInfo passed as an argument of RunSubTestCaseL call 
+    CStartInfo* iStartInfo;
+    
+    // Value of iState.Int() after test case execution
+    TInt iRunResult;
+    
+    // Result of test case execution
+    TFullTestResult iResult;
+    
+    // Descriptor used to retrive result from TestEngine
+    TFullTestResultPckg iResultPckg;
+    }; // class CLocalSubTestCaseRunner
+
+
+// DESCRIPTION
+// CRemoteSubTestCaseRunner manages sub test cases execution and retuns 
+// execution results to CTestRunner
+NONSHARABLE_CLASS(CRemoteSubTestCaseRunner): public CSubTestCaseRunner
+    {
+    private:
+        enum TCurrentOperation {    ECONone, 
+                                    ECORunSubtestCase,
+                                    ECOPauseSubtestCase,
+                                    ECOResumeSubtestCase,
+                                    ECOCancelSubtestCase };
+    public:
+        /**
+         * Two-phased constructor.
+         */
+        static CRemoteSubTestCaseRunner* NewL( CTestRunner* aTestRunner, 
+                CSlave* aSlave, CRemoteCallsProxy* aRemoteCallsProxy );
+        
+        /**
+         * Two-phased constructor.
+         */
+        static CRemoteSubTestCaseRunner* NewLC( CTestRunner* aTestRunner, 
+                CSlave* aSlave, CRemoteCallsProxy* aRemoteCallsProxy );
+    public:
+        /**
+         * Destructor.
+         */
+        ~CRemoteSubTestCaseRunner();
+    
+        /**
+         * Starts execution of selected test case.
+         */
+        void RunSubTestCaseL( CStartInfo& aStartTestCaseInfo );
+        
+        /**
+         * Pauses selected sub test case.
+         */
+        void PauseSubTestCaseL();
+        
+        /**
+         * Reasume selected sub test case.
+         */
+        void ResumeSubTestCaseL();
+    
+        void CancelSubTestCaseL();
+        
+        /**
+         * Gets execution result.
+         */
+        TInt GetRunResult() const;
+    
+        /**
+         * Gets test case execution result..
+         */
+        const TFullTestResult& GetTestCaseResult() const;
+        
+        /**
+         * Gets executed test case info.
+         */
+        const CStartInfo* GetStartInfo() const;
+    
+        /**
+         * Gets sub test case runner type.
+         */
+        TSubTestCaseType GetType() const;
+        
+        CSlave* GetSlave();
+        
+        TUint16 GetTestCaseId() const;
+        
+        void NotifyTestCaseStartedL( TUint16 aTestCaseId );
+        void NotifyTestCaseRunError( const TFullTestResult& aTestCaseResult );
+        
+        void NotifyTestCasePausedL();
+        void NotifyTestCaseResumedL();
+        void NotifyTestCaseCancelledL();
+        
+        void NotifyTestCaseFinishedL( const TFullTestResult& aTestCaseResult );
+        
+        TBool IsRunSubTestCaseRequestOngoing() const;
+    private:
+        /**
+         * Constructor.
+         */
+        CRemoteSubTestCaseRunner( CTestRunner* aTestRunner, 
+                CSlave* aSlave, CRemoteCallsProxy* aRemoteCallsProxy );
+
+        /**
+         * Second phase of two-phased constructor.
+         */
+        void ConstructL();
+        
+        /**
+         * See CActive::RunL()
+         */
+        void RunL();
+
+        /**
+         * See CActive::DoCancel()
+         */
+        void DoCancel();
+        
+        void Reset();
+    private:
+        // Pointer to test runner which will be notified about test case execution end.
+        CTestRunner* iTestRunner;
+        CSlave* iSlave;
+        CRemoteCallsProxy* iRemoteCallsProxy;
+                        
+        // Copy of CStartInfo passed as an argument of RunSubTestCaseL call 
+        CStartInfo* iStartInfo;
+        
+        TUint16 iTestCaseId;
+                
+        // Value of iState.Int() after test case execution
+        TInt iRunResult;
+        
+        // Result of test case execution
+        TFullTestResult iResult;
+        
+        TCurrentOperation iCurrentOperation;
+        TInt iOperationResult;
+        
+        TTimeIntervalMicroSeconds32 iOperationTimeout;
+        RTimer iTimeoutTimer;
+        
+        CActiveSchedulerWait* iNestedASLoop;
+    }; // class CRemoteSubTestCaseRunner
+
+
+
+#endif /* SUBTESTCASERUNNER_H_ */
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/inc/TestKeywords.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,187 @@
+/*
+* 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: This file contains the keywords for the 
+* TestScripter module.
+*
+*/
+
+#ifndef TESTKEYWORDS_H
+#define TESTKEYWORDS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <StifTestInterface.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+typedef TPtrC (*KeywordFunc)( TInt aKeyword );
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TestScripter Keyword class
+class TTestKeywords 
+    {
+    public: // Enumerations
+        // Keyword enum
+        enum TKeywords
+            {
+            ETitle,
+            ETimeout,
+            EPriority,
+            ECreate,
+            EDelete,
+            ERequest,
+            EWait,
+            ERelease,
+            ESet,
+            EUnset,
+            EPrint,
+            EAllowNextResult,
+            EWaitTestClass,
+            ECreateKernel,
+            EPause,
+            ELoop,
+            EEndLoop,
+            EOOMIgnoreFailure,
+            EOOMHeapFailNext,
+            EOOMHeapSetFail,
+            EOOMHeapToNormal,
+            ETestInterference,
+            EMeasurement,
+            EAllowErrorCodes,
+            EBringToForeground,
+            ESendToBackground,
+            EPressKey,
+            ETypeText,
+            EVar,
+            ECallSub,
+            ECreateX,
+            ESetResultDescription,
+            ESendPointerEvent,
+            EUsing,
+            EExpectedPanic,
+            ECreateShareObj,
+            ERestoreShareObj,
+            EDeleteShareObj,
+            ERun,
+            EComplete,
+            ECancelIfError,
+            EPauseTest,
+            EResume,
+            ECancel,
+            EAllocate,
+            EFree,
+            ERemote,
+            ESendReceive,            
+            };
+
+        // run keyword optional arguments
+        enum TRunOptArgs
+            {
+            EExpect,
+            ETestid,
+            EIni,
+            ECategory,
+            ECaseTimeout,
+            ECaseTitle,
+            };        
+        
+        // priorities
+        enum TPriority
+            {
+            EPriHigh,
+            EPriNormal,
+            EPriLow,
+            };
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+
+    public: // Constructors and destructor
+
+    public: // New functions
+
+        /**
+        * Returns a string desrciptor corresponding to keyword number. 
+        */
+        static TPtrC Keyword( TInt aKeyword );
+
+        /**
+        * Returns a string desrciptor corresponding to priority 
+        * enum value. 
+        */
+        static TPtrC Priority( TInt aArg );
+
+        /**
+        * Returns a keyword enum corresponding to keyword 
+        * string descriptor. 
+        */
+        static TInt Parse( TDesC& aKeyword, KeywordFunc aFunc );
+
+        /**
+        * Returns a string desrciptor corresponding to run keyword 
+        * optional argument number. 
+        */
+        static TPtrC RunOptArg( TInt aArg );
+
+        /**
+        * Returns result category description. 
+        */
+        static TPtrC ResultCategory( TInt aArg );        
+        
+        /**
+        * Returns result category type. 
+        */
+        static TFullTestResult::TCaseExecutionResult 
+            GetResultCategory( TDesC& aCategory );
+        
+        
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif        // TESTKEYWORDS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/inc/TestScripter.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1183 @@
+/*
+ * 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: This file contains the header file of the TestScripter 
+ * module of STIF Test Framework.
+ *
+ */
+
+#ifndef TestScripter_H
+#define TestScripter_H
+
+//  INCLUDES
+#include <e32std.h>
+
+#include <StifParser.h>
+#include <StifLogger.h>
+#include <StifTestModule.h>
+#include "TestScripterInternal.h"
+#include "TestKeywords.h"
+#include "StifKernelTestClass.h"
+#include "StifTestInterference.h"
+#include "STIFMeasurement.h"
+#include "StfTestLibPluginInterface.h"
+#include "StifTestModule.h"
+#include "TestScripterUtils.h"
+#include "SubTestCaseRunner.h"
+
+// CONSTANTS
+// Printing priorities
+const TInt KPrintPriLow = 10;
+const TInt KPrintPriNorm = 30;
+const TInt KPrintPriHigh = 50;
+// Log dir and file
+_LIT( KTestScripterLogDir, "\\Logs\\TestFramework\\TestScripter\\" );
+_LIT( KTestScripterLogFile, "TestScripter.txt" );
+_LIT( KTestScripterLogFileWithTitle, "TestScripter_[%S].txt");
+// Configuration file tags
+_LIT( KTestStartTag, "[Test]" );
+_LIT( KTestEndTag, "[Endtest]" );
+// Define tags
+_LIT( KDefineStartTag, "[Define]" );
+_LIT( KDefineEndTag, "[Enddefine]" );
+// Data tags
+_LIT( KDataStartTag, "[Data]" );
+_LIT( KDataEndTag, "[Enddata]" );
+// Loop counter macro
+_LIT( KLoopCounter, "LOOP_COUNTER" );
+// ini flag
+_LIT(KFileFlag,"$");
+_LIT(KSectionFlag,"@");
+_LIT(KKeyFlag,"#");
+
+// Remote protocol timeout 
+const TInt KRemoteProtocolTimeout = 30000000;
+// Remote protocol Master id
+const TUint32 KRemoteProtocolMasterId = 0xdeadbeef;
+
+
+// MACROS
+// None
+
+// DATA TYPES
+class CTestRunner;
+typedef CScriptBase* (*CInterfaceFactory)(CTestModuleIf& aTestModuleIf);
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestRunner;
+class CTestContinue;
+class TTestModule;
+class TTestObjectBase;
+class TTestObject;
+class TTestInterference;
+class CStifTestMeasurement;
+class TTestMeasurement;
+class TSharedTestModule;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Predefined value entry
+class CDefinedValue : public CBase
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CDefinedValue* NewL(TDesC& aName, TDesC& aValue);
+
+    /**
+     * Destructor.
+     */
+    virtual ~CDefinedValue();
+
+public:
+    // New functions
+
+    /**
+     * Returns define name.
+     */
+    TDesC& Name();
+
+    /**
+     * Returns define value.
+     */
+    TDesC& Value();
+
+    /**
+     * Returns new define value.
+     */
+    void SetValueL(TDesC& aValue);
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CDefinedValue();
+
+    /**
+     * By default Symbian OS constructor is private.
+     */
+    void ConstructL(TDesC& aName, TDesC& aValue);
+
+private:
+    // Data
+
+    // Define name
+    HBufC* iNameBuf;
+    TPtrC iName;
+
+    // Define value
+    HBufC* iValueBuf;
+    TPtrC iValue;
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestScripter contains the Test Module interface of TestScripter 
+// for STIF Test Framework
+
+class CTestScripter : public CTestModuleBase
+    {
+public:
+    // Enumerations
+
+private:
+    // Enumerations
+
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CTestScripter* NewL();
+
+    /**
+     * Destructor.
+     */
+    ~CTestScripter();
+
+public:
+    // New functions
+
+    /**
+     * Call specified tst class object.
+     */
+    TInt CallTestClass(const TDesC& aLine);
+
+    /**
+     * Get pointer to test class object.
+     */
+    TInt GetTestScriptObject(const TDesC& aObjectName);
+
+    /**
+     * Return runner handle.
+     */
+    CTestRunner& TestRunner()
+        {
+        return *iTestRunner;
+        }
+    ;
+
+public:
+    // Functions from base classes
+
+    /**
+     * Test module initialization.
+     */
+    TInt InitL(TFileName& aIniFile, TBool aFirstTime);
+
+    /**
+     * GetTestCasesL is used to inquire testcases. 
+     */
+    TInt GetTestCasesL(const TFileName& aConfigFile, RPointerArray<
+            TTestCaseInfo>& aTestCases);
+
+    /**
+     * RunTestCase is used to run an individual test case specified 
+     * by aTestCase. 
+     */
+    TInt RunTestCaseL(const TInt aCaseNumber, const TFileName& aConfig,
+            TTestResult& aResult);
+
+    /**
+     * Internal fuction to get const value defined in 
+     * [Define]...[Enddefine] section of script file
+     */
+    IMPORT_C TInt GetConstantValue(const TDesC& aName, TDes& aValue);
+
+    /**
+     * Set result description of test case.
+     */
+    IMPORT_C void SetResultDescription(const TDesC& aDescr);
+
+    /**
+     * Internal fuction to set local value.
+     */
+    IMPORT_C TInt SetLocalValue(const TDesC& aName, const TDesC& aValue);
+
+    /**
+     * Internal fuction to get local value.
+     */
+    IMPORT_C TInt GetLocalValue(const TDesC& aName, TDes& aValue);
+
+protected:
+    // New functions
+
+protected:
+    // Functions from base classes
+
+private:
+    /**
+     * C++ default constructor.
+     */
+    CTestScripter();
+
+    /**
+     * By default Symbian OS constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * GetTestCaseL gets the specified test case section 
+     * from the onfigfile.
+     */
+    CStifSectionParser* GetTestCaseL(TInt aCaseNumber,
+            const TFileName& aConfig);
+
+    /**
+     * RunTestL runs the testcase specified in section.
+     */
+    void RunTestL();
+
+    /**
+     * LoadTestModuleL loads test module.
+     */
+    TTestModule* LoadTestModuleL(TDesC& aModule);
+    
+    /**
+     * LoadTestModuleL loads test module.
+     */
+    TTestModule* LoadSharedTestModuleL(TDesC& aModule);
+
+    /**
+     * CreateObjectL create new object.
+     */
+    void CreateObjectL(TDesC& aModule, TDesC& aObjectId);
+
+    /**
+     * CreateShareObjectL create new object.
+     */
+    void CreateShareObjectL(TDesC& aModule, TDesC& aObjectId);
+
+    /**
+     * RestoreShareObjectL create new object.
+     */
+    void RestoreShareObjectL(TDesC& aObjectId);
+
+    /**
+     * CreateKernelObjectL create new kernel object.
+     */
+    void CreateKernelObjectL(TDesC& aDriver, TDesC& aObjectId);
+
+    /**
+     * DeleteObjectL deletes object with aObjectId.
+     */
+    TInt DeleteObjectL(TDesC& aObjectId);
+
+    /**
+     * DeleteGlobalObjectL deletes object with aObjectId.
+     */
+    TInt CTestScripter::DeleteScripterObjectL(TDesC& aObjectId);
+
+    /**
+     * GetObject returns object corresponding to aObjectId.
+     */
+    TTestObjectBase* GetObject(const TDesC& aObjectId);
+
+    /**
+     * Read initialization from file.
+     */
+    void ReadInitializationL(const TDesC& aIniFile, RPointerArray<
+            CDefinedValue>& aDefines);
+
+    /**
+     * Read sub section from test case file.
+     */
+    CStifSectionParser* GetSubL(const TDesC& aSubName);
+
+    /**
+     * Updates result of test case.
+     */
+    void UpdateTestCaseResult(const TInt aError, const TDesC& aDescr);
+
+    void Substitute(const TDesC& aSrc, TDes& aDest);
+
+    /**
+     * Add Test object 
+     */
+    void AddTestObjToScripterDictL(TTestObject* aObject);
+
+    /**
+     * Delete Test object
+     */
+    void DelTestObjFromScripterDict(const TDesC& aObjectId);
+
+    /**
+     * Get Test object
+     */
+    TTestObject* GetTestObjFromScripterDict(const TDesC& aObjectId) const;
+
+    /**
+    * Append to TS's result description (if possible due to length)
+    * limitation provided text in [] brackets.
+    */
+    void AppendTestResultToResultDes(TDes& aResultDescr, const TDesC& aTestCaseResultDescr);
+    
+    /**
+     * Trace memory usage of global objects and output to log. method return the used cells.
+    */
+    TInt TraceGlobalObjectsMemoryUsage();
+    
+public:
+    // Data
+    // Logger 
+    CStifLogger* iLog;
+
+protected:
+    // Data
+
+private:
+    // Data
+    // Test case array of running/runned test cases 
+    RPointerArray<TTestObjectBase> iTestObjects;
+    // Array of test modules
+    RPointerArray<TTestModule> iTestModules;
+    
+    // Array of test modules
+    RPointerArray<TSharedTestModule> iSharedTestModules;
+
+    // Test case array of global test objects 
+    RPointerArray<TTestObject> iGlobalObjects;
+
+    // Test case result of the TestScripter
+    TTestResult iResult;
+
+    // Sectionparser for the current testcase
+    CStifSectionParser* iSectionParser;
+
+    // Currently used section parser (changed when executing a function (sub))
+    CStifSectionParser* iCurrentParser;
+
+    // It says if we need to call GetLine or GetNextLine for the parser
+    TBool iCurrentParserReadFirstLine;
+
+    // Stack of parsers for called functions (subs)
+    RPointerArray<CStifSectionParser> iParserStack;
+
+    // Pointer to used testrunner
+    CTestRunner* iTestRunner;
+
+    // Predefined values are listed here
+    RPointerArray<CDefinedValue> iDefinedIni;
+    RPointerArray<CDefinedValue> iDefinedRuntime;
+    RPointerArray<CDefinedValue> iDefinedLocal;
+
+    // Flag for OOM testing. If true test class's build
+    // block execution result will ignored.
+    TBool iOOMIgnoreFailure;
+
+    // Flag which says if heap balance should be checked (affects only 
+    // EKA2 environment). May be set in StifSettings section.
+    TBool iCheckHeapBalance;
+
+    // Standard logger 
+    CStifLogger* iStdLog;
+
+    // Test case Logger 
+    CStifLogger* iTCLog;
+
+    // Flag which says if test case title should be appended to the
+    // log file name. This is read from SettingServer
+    TBool iAddTestCaseTitleToLogName;
+
+    // The running test case's config file name
+    TFileName iConfig;
+
+    TBuf<KMaxFileName> iCurrentFile;
+    TBuf<KMaxFileName> iCurrentFileAlias;
+
+    TBuf<KMaxFileName> iCurrentSection;
+    TBuf<KMaxFileName> iCurrentSectionFileAlias;
+
+    TBuf<KMaxFileName> iCurrentKey;
+    TBuf<KMaxFileName> iCurrentvalues;
+
+    RArray<TBuf<KMaxFileName> > iKeys;
+    RArray<TBuf<KMaxFileName> > iValues;
+    RPointerArray<TScriptObject> *iObjects;
+
+    // Indicates if pass limit in loops was met
+    TBool iPassLimitNotMet;    
+public:
+    // Friend classes
+
+protected:
+    // Friend classes
+
+private:
+    // Friend classes
+    friend class CTestRunner;
+    friend class CTestContinue;
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestRunner parses the TestScripter configuration file and 
+// runs a testcase. CTestRunner is the friend of CTestScripter
+// and uses its private member variables directly.
+
+class CTestRunner : public CActive
+    {
+public:
+    // Enumerations
+
+private:
+    // Enumerations
+    enum TRunnerState
+        {
+        ERunnerIdle,
+        ERunnerRunning,
+        ERunnerCancel,
+        ERunnerError,
+        ERunnerPaused,
+        };
+
+    enum TInternalStateForSubTestCases
+        {
+        EISNotStarted,
+        EISRuning,
+        EISWaitingForComplete,
+        EISEndLoopWaitingForSubTestCases,
+        EISFinishedWaitingForSubTestCases,
+        EISFinished,
+        };
+public:
+    // Constructors and destructor  
+    /**
+     * Two-phased constructor.
+     */
+    static CTestRunner* NewL(CTestScripter* aTestScripter);
+
+    /**
+     * Destructor.
+     */
+    ~CTestRunner();
+
+public:
+    // New functions
+    /**
+     * Calls SetActive() from CActive.
+     */
+    void SetRunnerActive();
+
+    /**
+     * Get test case result handle.
+     */
+    RArray<TInt>& TestCaseResults()
+        {
+        return iTestCaseResults;
+        }
+    ;
+
+public:
+    // Functions from base classes     
+    /**
+     * RunL derived from CActive handles the completed requests.
+     */
+    void RunL();
+
+    /**
+     * DoCancel derived from CActive handles the Cancel.
+     */
+    void DoCancel();
+
+    /**
+     * RunError derived from CActive handles errors from active handler.
+     */
+    TInt RunError(TInt aError);
+
+    CStifLogger* GetLogger();
+    
+    /**
+     * Recieves notification about finished sub test case execution.
+     */
+    void SubTestCaseFinishedL( CSubTestCaseRunner* aSubTestCaseRunner );
+
+    /**
+     * Recives report from CLoopHelper about result of loop execution
+     */
+    void ReportLoopEndResultL( TInt aPassedIterations );
+    
+    /**
+     * Releases resources allocated in loop
+     */
+    void ReleaseRemoteResourcesAllocatedInLoopL();
+        
+    /**
+     * Gets information if there was reported executed sub test case 
+     * which failed.
+     */
+    TBool IsFailedSubTestCaseReported() const;
+
+    /**
+     * Returns first failed sub test case result.
+     */
+    TFullTestResult GetFailedSubTestCaseResult() const;
+    
+    /**
+     * Returns first failed sub test case info.
+     */
+    const CStartInfo* GetFailedSubTestCaseInfo() const;
+    
+    void HandleRemoteReceiveError( TInt aError, const TDesC& aErrorDescription );
+protected:
+    // New functions
+
+protected:
+    // Functions from base classes
+
+private:
+    /**
+     * C++ default constructor.
+     */
+    CTestRunner(CTestScripter* aTestScripter);
+
+    /**
+     * By default Symbian OS constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Executes one script line.
+     */
+    TBool ExecuteLineL(TDesC& aKeyword, CStifItemParser* aItem);
+
+    /**
+    * Executes run script line.
+    */
+    TBool ExecuteRunL( CStifItemParser* aItem );
+    
+    TBool ExecuteCompleteL( CStifItemParser* aItem );
+    
+    /**
+    * Parses run parameters.
+    */
+    void ParseRunParamsL( CStifItemParser* aItem, CStartInfo& aStartInfo );
+
+    /**
+    * Parses optional argument.
+    */
+    void ParseOptArgL( const TDesC& aOptArg, TPtrC& aArg, TPtrC& aVal);    
+    
+    /**
+     * Executes method call to object script line.
+     */
+    TBool ExecuteCommandL(TDesC& aObject, CStifItemParser* aItem);
+
+    /**
+     * Executes method call to object script line.
+     */
+    TBool ExecuteLibL(TDesC& lib, CStifItemParser* aItem);
+
+    /**
+     * Executes event control script line.
+     */
+    TBool ExecuteEventL(TDesC& aKeyword, CStifItemParser* aItem);
+
+    /**
+     * Preprocess hardcoded values in test case.
+     */
+    CStifItemParser* PreprocessLineL(TDesC& line);
+
+    /**
+     * Checks if aWord is defined value.
+     */
+    TInt CheckDefined(TPtrC& aWord);
+
+    /**
+     * Checks if aWord is a local variable.
+     */
+    TInt CheckDefinedLocals(TPtrC& aWord);
+
+    /**
+     * Handles 'oomignorefailure' keyword parsing.
+     */
+    void OOMIgnoreFailureL(CStifItemParser* aItem);
+
+    /**
+     * Handles 'oomheapfailnext' keyword parsing.
+     */
+    void OOMHeapFailNextL(CStifItemParser* aItem);
+
+    /**
+     * Handles 'oomheapsetfail' keyword parsing.
+     */
+    void OOMHeapSetFailL(CStifItemParser* aItem);
+
+    /**
+     * Initialize all OOM related variables.
+     */
+    void OOMHeapToNormal();
+
+    /**
+     * Handles 'testinterference' keyword parsing.
+     */
+    void TestInterferenceL(CStifItemParser* aItem);
+
+    /**
+     * Starts test interference.
+     */
+    void StartInterferenceL(TDesC& aName, CStifItemParser* aItem);
+
+    /**
+     * Stops test interference.
+     */
+    void StopInterferenceL(TDesC& aName);
+
+    /**
+     * Handles 'measurement' keyword parsing.
+     */
+    void MeasurementL(CStifItemParser* aItem);
+
+    /**
+     * Starts measurement.
+     */
+    void StartMeasurementL(const TDesC& aType, CStifItemParser* aItem);
+
+    /**
+     * Stops measurementplugin's measurement.
+     */
+    void StopMeasurementL(const TDesC& aType);
+
+    /**
+     * Adds new test case result. Used with 'allownextresult'
+     * and 'allowerrorcodes' keywords.
+     */
+    void AddTestCaseResultL(CStifItemParser* aItem);
+
+    /** Adds new test case panic. Used with 'allowpanic'
+     */
+    void AddTestCasePanicL(CStifItemParser* aItem);
+
+    /**
+     * Sends key press event to AppUi
+     */
+    TBool PressKeyL(CStifItemParser* aItem);
+
+    /**
+     * Sends text to AppUi
+     */
+    TBool TypeTextL(CStifItemParser* aItem);
+
+    /**
+     * Sends pointer event to AppUi
+     */
+    TBool SendPointerEventL(CStifItemParser* aItem);
+    
+    /**
+     * Controls sub test case execution
+     */
+    TBool ControlSubTestCaseL( TTestKeywords::TKeywords aOperation, CStifItemParser* aItem );
+
+    /**
+     * Executes loop keyword
+     */
+    TBool ExecuteLoopL( CStifItemParser* aItem );
+    
+    /**
+     * Executes endloop keyword
+     */
+    TBool ExecuteEndLoopL( CStifItemParser* aItem );
+    
+    TBool ExecuteAllocateL( CStifItemParser* aItem );
+    TBool ExecuteFreeL( CStifItemParser* aItem );
+    TBool ExecuteRemoteL( CStifItemParser* aItem );
+    
+    /**
+    * Executes remote run script line.
+    */
+    TBool ExecuteRemoteRunL( CStifItemParser* aItem, CSlave* aSlave,
+                             HBufC *aSetUnsetEvent = NULL,
+                             TInt aCaseNumber = 0 );
+
+    /**
+    * Executes remote event control script line.
+    */
+    TBool ExecuteRemoteEventCtlL( CStifItemParser* aItem, 
+                                  CSlave* aSlave, 
+                                  TInt aCmd );
+
+    /**
+    * Executes asynchronous remote sendreceive control script line.
+    */
+    TBool ExecuteRemoteSendReceiveL( CStifItemParser* aItem, 
+                                  CSlave* aSlave );
+
+    /**
+    * Executes remote unknown control script line.
+    */
+    TBool ExecuteRemoteUnknownL( CStifItemParser* aItem, 
+                                 CSlave* aSlave,
+                                 TDesC& aCommand );    
+    
+public:
+    // Data
+
+protected:
+    // Data
+
+private:
+    // Data
+    // Runner state
+    TRunnerState iState;
+
+    TInternalStateForSubTestCases iInternalStateForSubTestCases;
+    
+    // Backpointer to CTestScripter
+    CTestScripter* iTestScripter;
+
+    // Allowed test case results
+    RArray<TInt> iTestCaseResults;
+
+    // Temporary line buffer 
+    HBufC* iLine;
+
+    // Store for requested events
+    RPointerArray<HBufC> iEventArray;
+
+    // Pause timer
+    RTimer iPauseTimer;
+
+    // Pause value for timer
+    TInt iRemainingTimeValue;
+
+    // Loop times, counter and start position
+    TInt iLoopTimes;
+    TInt iLoopCounter;
+    TInt iLoopStartPos;
+    TBuf<10> iLoopCounterDes;
+
+    // Loop (timed loop option)
+    TBool iTimedLoop;
+    TTime iStartTime;
+    TTimeIntervalMicroSeconds iExpectedLoopTime;
+
+    // For OOM heap testing, FAILNEXT: count
+    TInt iHeapFailNext;
+    // For OOM heap testing, SETFAIL: type and value(rate)
+    RHeap::TAllocFail iHeapSetFailType;
+    TInt iHeapSetFailValue;
+
+    // Array for test interference
+    RPointerArray<TTestInterference> iTestInterferenceArray;
+
+    // CStifTestMeasurement object
+    RPointerArray<TTestMeasurement> iTestMeasurementArray;
+
+    // Message displayed when leave occurs during script parsing
+    TBuf<256> iRunErrorMessage;
+
+    // test lib plugins array 
+    RPointerArray<CStfTestLibPlugin> iPlugins;
+
+    // test lib pluginnames array 
+    RPointerArray<HBufC> iPluginnames;
+
+    RLibrary iLibrary;
+    
+    // Array of executed sub test cases
+    RPointerArray<CSubTestCaseRunner> iSubTestCases;
+    
+    // Indicates on which sub test case waits last complete call
+    HBufC* iTestIdForComplete;
+    
+    // Indicates if execution of some sub test case failed
+    TBool iFailedSubTestCaseReported;
+    
+    // Caintains test execution result of first failed sub test case 
+    TFullTestResult iFailedSubTestCaseResult;
+    
+    // Caintains information about first failed sub test case
+    CStartInfo* iFailedSubTestCaseInfo;
+    
+    // Indicates if test case executions should be breaked when of the sub test case fails
+    TBool iCancelIfError;
+    
+    // Indicates whether passlimit feature is enabled or not
+    TBool iPasslimitEnabled;
+    
+    // Pass limit for loop
+    TInt iPasslimit;
+
+    // Loop helper
+    CLoopHelper* iLoopHelper;
+
+    // Slaves manager
+    CSlavesManager* iSlavesManager;
+public:
+    // Friend classes
+
+protected:
+    // Friend classes
+
+private:
+    // Friend classes
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestContinue gets ContinueScript signals from test class
+class CTestContinue : public CActive
+    {
+public:
+    // Enumerations
+
+private:
+    // Enumerations
+
+public:
+    // Constructors and destructor  
+    /**
+     * Two-phased constructor.
+     */
+    static CTestContinue* NewL(CTestScripter* aTestScripter,
+            TTestObject* aObject);
+
+    /**
+     * Destructor.
+     */
+    ~CTestContinue();
+
+public:
+    // New functions
+
+public:
+    // Functions from base classes     
+    /**
+     * RunL derived from CActive handles the completed requests.
+     */
+    void RunL();
+
+    /**
+     * DoCancel derived from CActive handles the Cancel.
+     */
+    void DoCancel();
+
+    /**
+     * RunError derived from CActive handles errors from active handler.
+     */
+    TInt RunError(TInt aError);
+
+protected:
+    // New functions
+
+protected:
+    // Functions from base classes
+
+private:
+    /**
+     * C++ default constructor.
+     */
+    CTestContinue(CTestScripter* aTestScripter, TTestObject* aObject);
+
+    /**
+     * By default Symbian OS constructor is private.
+     */
+    void ConstructL();
+
+public:
+    //Data
+
+protected:
+    // Data
+
+private:
+    // Data
+    // Backpointer to CTestScripter
+    CTestScripter* iTestScripter;
+
+    // Objectid for this object
+    TTestObject* iObject;
+
+public:
+    // Friend classes
+
+protected:
+    // Friend classes
+
+private:
+    // Friend classes
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TTestObjectBase contains test object base information
+class TTestObjectBase : public TScriptObject
+    {
+public:
+    enum TObjectType
+        {
+        EObjectNormal, EObjectKernel,
+        };
+
+public:
+    TTestObjectBase(TObjectType aType);
+    virtual ~TTestObjectBase();
+public:
+    TObjectType ObjectType()
+        {
+        return iType;
+        }
+    ;
+
+    virtual TInt RunMethodL(CStifItemParser& aItem) = 0;
+    virtual TBool Signal() = 0;
+    virtual TBool Wait() = 0;
+
+public:
+    TInt iAsyncResult;
+
+protected:
+    TObjectType iType;
+
+private:
+    //     TName       iName;
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TTestObject contains test object information
+class TTestObject : public TTestObjectBase
+    {
+public:
+    TTestObject();
+    virtual ~TTestObject();
+
+public:
+    TInt RunMethodL(CStifItemParser& aItem);
+    inline TBool Signal()
+        {
+        return (iCount++ < 0);
+        }
+    ;
+    inline TBool Wait()
+        {
+        return (--iCount >= 0);
+        }
+    ;
+
+public:
+    CTestContinue* iContinue;
+    TName iModule;
+private:
+    TInt iCount;
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TTestObjectKernel contains kernel test object information
+class TTestObjectKernel : public TTestObjectBase
+    {
+public:
+    TTestObjectKernel();
+    virtual ~TTestObjectKernel();
+
+public:
+    TInt RunMethodL(CStifItemParser& aItem);
+
+    // Signal and Wait not supported
+    TBool Signal()
+        {
+        return ETrue;
+        }
+    ;
+    TBool Wait()
+        {
+        return ETrue;
+        }
+    ;
+
+    TName& LddName()
+        {
+        return iLddName;
+        }
+    RStifKernelTestClass& KernelTestClass()
+        {
+        return iTestClass;
+        }
+
+private:
+    RStifKernelTestClass iTestClass;
+    TName iLddName;
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TTestModule contains test module information
+class TTestModule
+    {
+public:
+    TTestModule()
+        {
+        }
+    ;
+    ~TTestModule()
+        {
+        iLibrary.Close();
+        }
+    ;
+
+public:
+    TName& ModuleName()
+        {
+        return iName;
+        }
+
+public:
+    RLibrary iLibrary;
+    CInterfaceFactory iLibEntry;
+
+private:
+    TName iName;
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TSharedTestModule contains test module information
+class TSharedTestModule
+    {
+public:
+    TSharedTestModule(TTestModule *aTestModule)
+    {
+        refCount=1;
+        iTestModule = aTestModule;
+    };
+    ~TSharedTestModule(){};
+    TName& ModuleName()
+        {
+        return iTestModule->ModuleName();
+        };
+    TTestModule* Get()
+            {
+                ++refCount;
+                return iTestModule;
+            }
+    void Del()
+        {
+        if(--refCount<=0)
+            {
+                delete iTestModule;
+                iTestModule = NULL;
+            }
+        };
+    
+    const TInt RefCount(){ return refCount; };
+
+private:
+    TInt refCount;
+    TTestModule *iTestModule;
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TTestInterference contains test interference object information
+class TTestInterference
+    {
+public:
+    TTestInterference()
+        {
+        iInterference = NULL;
+        }
+    ;
+    ~TTestInterference()
+        {
+        delete iInterference;
+        }
+    ;
+
+public:
+
+public:
+    // "object" name given in test case file.
+    TName iName;
+    // MSTIFTestInterference object.
+    MSTIFTestInterference* iInterference;
+
+private:
+
+    };
+
+// DESCRIPTION
+// TTestMeasurement contains test measurement module information
+class TTestMeasurement
+    {
+public:
+    TTestMeasurement()
+        {
+        iMeasurement = NULL;
+        }
+    ;
+    ~TTestMeasurement()
+        {
+        delete iMeasurement;
+        }
+    ;
+
+public:
+
+public:
+    // "object" name given in test case file.
+    TName iName;
+    // MSTIFTestInterference object.
+    CSTIFTestMeasurement* iMeasurement;
+
+private:
+
+    };
+
+#endif        // TestScripter_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/inc/TestScripterUtils.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1080 @@
+/*
+ * 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: This file contains the header file of the TestScripter 
+ * module of STIF Test Framework.
+ *
+ */
+
+#ifndef TESTSCRIPTERUTILS_H_
+#define TESTSCRIPTERUTILS_H_
+
+//  INCLUDES
+#include <StifTestInterface.h>
+#include <StifTFwIfProt.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+typedef TBuf<0x200> TRemoteProtMsg;
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestRunner;
+class CSubTestCaseRunner;
+class CRemoteCallTimeoutMonitor;
+class CStifTFwIfProt;
+class CStifLogger;
+class CSlave;
+class CRemoteSubTestCaseRunner;
+
+// DESCRIPTION
+// Testcase starting information
+NONSHARABLE_CLASS(CStartInfo): public CBase
+    {
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CStartInfo* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CStartInfo();
+            
+    public: // New functions
+        /**
+        * Sets module name.
+        */
+        void SetModuleNameL( const TDesC& aModule, TInt aExtLength = 0 );
+            
+        /**
+        * Sets initialization file name.
+        */
+        void SetIniFileL( const TDesC& aIni );
+            
+        /**
+        * Sets configuration file name.
+        */
+        void SetConfigL( const TDesC& aConfig );
+            
+        /**
+        * Sets test identifier.
+        */
+        void SetTestIdL( const TDesC& aTestId );
+
+        /**
+        * Sets test case title.
+        */
+        void SetTitleL( const TDesC& aTitle);
+
+        /**
+         * Sets test case index.
+         */
+        void SetTestCaseNumber( TInt aTestCaseNumber );
+        
+        /**
+         * Sets test case expected result.
+         */
+        void SetExpectedResult( TInt aExpectedResult );
+        
+        /**
+         * Sets expected result category.
+         */
+        void SetExpectedResultCategory( TFullTestResult::TCaseExecutionResult aCategory );
+
+        /**
+         * Sets timeout value.
+         */
+        void SetTimeout( TInt aTimeout );
+        
+        /**
+         * Gets test module name.
+         */
+        const TDesC& GetModuleName() const;
+
+        /**
+         * Gets ini file path.
+         */
+        const TDesC& GetIniFile() const;
+
+        /**
+         * Gets config file path
+         */
+        const TDesC& GetConfig() const;
+
+        /**
+         * Gets test case id.
+         */
+        const TDesC& GetTestId() const;
+
+        /**
+         * Gets test case title.
+         */
+        const TDesC& GetTitle() const;
+
+        /**
+         * Gets test case title.
+         */
+        TInt GetTestCaseNumber() const;
+        
+        /**
+         * Gets expected result.
+         */
+        TInt GetExpectedResult() const;
+
+        /**
+         * Gets expected result category.
+         */
+        TFullTestResult::TCaseExecutionResult GetExpectedResultCategory() const;
+
+        /**
+         * Gets timeout value.
+         */
+        TInt GetTimeout() const;
+
+        /**
+         * Copy values from other CStartInfo instance.
+         */
+        void CopyL( const CStartInfo& aStartInfo );
+        
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CStartInfo();
+                    
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+                
+    private:
+        // Module name
+        HBufC*  iModule;
+        
+        // Ini file path
+        HBufC*  iIniFile;
+        
+        // Config file path
+        HBufC*  iConfig;
+        
+        // Test id ( used for complete, pausetest, reasume
+        HBufC*  iTestId;
+        
+        // Title of the test case
+        HBufC*  iTitle;
+
+        // Test case index
+        TInt    iCaseNum;
+        
+        // Test case expected result
+        TInt    iExpectedResult;
+        
+        // Test case expected result category
+        TFullTestResult::TCaseExecutionResult iCategory;
+        
+        // Test case timeout value
+        TInt    iTimeout;
+    };
+
+// TestScripter loop helper
+NONSHARABLE_CLASS(CLoopHelper): public CActive
+    {
+    public:
+        /**
+        * Two-phased constructor.
+        */
+        static CLoopHelper* NewL( CTestRunner* aTestRunner );
+    public:
+        /**
+        * Destrucktor.
+        */
+        ~CLoopHelper();
+        
+        /**
+         * Should be to indicate loop start.
+         */
+        void LoopStartL();
+        
+        /**
+         * Should be called to indicate end of iteration and begining of next iteration
+         */
+        void IterationEndStartNextIterationL();
+        
+        /**
+         * Should be called to indicate loop end
+         */
+        void LoopEndL();
+
+        /**
+         * Should be called to register sub test case executed inside loop
+         */
+        void RegisterInLoopSubTestCaseL( CSubTestCaseRunner* aSubTestCaseRunner );
+        
+        /**
+         * Should be called to unregister sub test case executed inside loop
+         */
+        void UnregisterInLoopSubTestCaseL( CSubTestCaseRunner* aSubTestCaseRunner );
+
+        /**
+         * Should be called to register remote event allocated inside loop
+         */
+        void RegisterInLoopSlaveL( CSlave* aSlave );
+
+        /**
+         * Should be called to unregister remote event allocated inside loop
+         */
+        void UnregisterInLoopSlaveL( CSlave* aSlave );
+        
+        /**
+         * Returns array of registered in loop slaves.
+         */
+        RPointerArray<CSlave>& GetRegisteredInLoopSlaves();
+        
+        /**
+         * Should be called to indicate end of sub test case executed inside loop
+         */
+        void NotifySubTestCaseEndL( CSubTestCaseRunner* aSubTestCaseRunner, TBool aPassed );
+        
+        /**
+         * Indicates whether loop is in progress or not
+         */
+        TBool LoopInProgress() const;
+    private:
+        /**
+         * Constructor
+         */
+        CLoopHelper( CTestRunner* aTestRunner );
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+         * See CActive::DoCancel
+         */
+        void DoCancel();
+        
+        /**
+         * See CActive::Runl
+         */
+        void RunL();
+
+        /**
+         * Indicate begining of the loop iteration
+         */
+        void IterationBeginL( TBool aFirstIteration );
+
+        /**
+         * Indicate end of the loop iteration
+         */
+        void IterationEndL( TBool aLastIteration );        
+    private:
+        // Pointer to CTestRunner
+        CTestRunner* iTestRunner;
+        
+        // Indicates whether loop is in progress
+        TBool iInProgress;
+        
+        // Indicates whether loop iteration is ongoing
+        TBool iIterationOngoing;
+        
+        // Indicates whether current iteration is last iteration 
+        TBool iLoopEnd;
+        
+        // Counter of passed iterations
+        TInt iPassedIterationsCounter;
+        
+        // Indicates if current iteration should be count as passed or failed
+        TBool iPassCurrentIteration;
+        
+        // Array of sub test cases executed in loop
+        RPointerArray<CSubTestCaseRunner> iInLoopSubTestCases;    
+        
+        // Array of remote events allocated inside loop
+        RPointerArray<CSlave> iInLoopSlaves;
+    };   
+
+// TestScripter remote event wrapper
+class TEventTS: public TEventIf
+    {
+    public:  // Constructors and destructor
+        /**
+        * C++ default constructor.
+        */
+        TEventTS();
+        
+        /**
+        * C++ parametric constructor.
+        */
+        TEventTS( TName& aEventName );
+  
+        /**
+        * C++ destructor.
+        */
+        ~TEventTS();
+
+    public: // New functions
+        
+        /**
+        * Set request status member.
+        */
+        void SetRequestStatus( TRequestStatus* aStatus );
+        
+        /**
+        * Set event pending.
+        */
+        void SetEvent( TEventType aEventType );
+        
+        /**
+        * Wait event.
+        */
+        void WaitEvent( TRequestStatus& aStatus );
+        
+    private: // New functions
+        /**
+        * Complete request status member.
+        */
+        void Complete( TInt aError );
+
+    private:    // Data
+        /**
+        * Request status.
+        */
+        TRequestStatus* iClientReqStatus; 
+    };
+
+// Interface for classes which can handle errors which may occure during remote
+// message receive
+NONSHARABLE_CLASS( MReceiveErrorHandler )
+    {
+    public:
+		/**
+		 * Handle error which occured during remote message receive
+		 */
+        virtual void HandleRemoteReceiveError( 
+                TInt aError, const TDesC& aErrorDescription ) = 0;        
+    };
+
+// Interface for classes which should be notified about remote allocate 
+// and free requests results
+NONSHARABLE_CLASS( MSlaveAllocateFreeMonitor )
+    {
+    public:
+		/**
+		 * Notify slave is allocated
+		 */
+        virtual void NotifySlaveAllocatedL( TUint16 aSlaveId ) = 0;
+        
+        /**
+         * Notify slave is freed
+         */
+        virtual void NotifySlaveFreedL( TUint16 aSlaveId ) = 0;
+    };
+
+// Interface for classes which should be notified about results of remote test 
+// control requests 
+NONSHARABLE_CLASS( MRemoteTestCasesMonitor )
+    {
+    public:
+		/**
+		 * Notify test case has been started.
+		 */
+        virtual void NotifyTestCaseStartedL( TUint16 aSlaveId, TUint16 aSlaveTestId ) = 0;
+        
+        /**
+         * Notify test case can't be started.
+         */
+        virtual void NotifyTestCaseRunErrorL( TUint16 aSlaveId, const TFullTestResult& aTestCaseResult ) = 0;
+        
+        /**
+         * Notify execution test case has finished
+         */
+        virtual void NotifyTestCaseFinishedL( TUint16 aSlaveId, TUint16 aSlaveTestId, const TFullTestResult& aTestCaseResult ) = 0;
+        
+        /**
+         * Notify test case has been paused.
+         */
+        virtual void NotifyTestCasePausedL( TUint16 aSlaveId, TUint16 aSlaveTestId ) = 0;
+        
+        /**
+         * Notify test case has been resumed.
+         */
+        virtual void NotifyTestCaseResumedL( TUint16 aSlaveId, TUint16 aSlaveTestId ) = 0;
+        
+        /**
+         * Notify test case has been cancelled.
+         */
+        virtual void NotifyTestCaseCancelledL( TUint16 aSlaveId, TUint16 aSlaveTestId ) = 0;
+    };
+
+// Interface for classes which should be notified about results of remote events
+// control requests.
+NONSHARABLE_CLASS( MRemoteEventsMonitor )
+    {
+    public:
+		/**
+		 * Notify remote event has been requested
+		 */
+        virtual void NotifyEventRequestedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, 
+                CStifTFwIfProt::TEventStatus aEventStatus,
+                TEventIf::TEventType aEventType,
+                TInt aResult ) = 0;
+
+        /**
+         * Notify remote event state has changed
+         */
+        virtual void NotifyEventStateChangedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, 
+                CStifTFwIfProt::TEventStatus aEventStatus,
+                TEventIf::TEventType aEventType,
+                TInt aResult ) = 0;
+        
+        /**
+         * Notify remote event has been released
+         */
+        virtual void NotifyEventReleasedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, TInt aResult ) = 0;
+        
+        /**
+         * Notify remote event has been sucessfully set
+         */
+        virtual void NotifyEventSetCompletedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, TInt aResult ) = 0;
+        
+        /**
+         * Notify remote event has been sucessfully unset
+         */
+        virtual void NotifyEventUnsetCompletedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, TInt aResult ) = 0;        
+    };
+
+// Interface for classes which should be notified about results of sendreceive 
+// and send unknown requests 
+NONSHARABLE_CLASS( MRemoteSendReceiveMonitor )
+    {
+    public:
+		/**
+		 * Notify sendreceive request has been started
+		 */
+        virtual void NotifySendReceiveStartedL( TUint16 aSlaveId ) = 0;
+
+        /**
+         * Notify sendreceive request has finished
+         */
+        virtual void NotifySendReceiveResultL( 
+                TUint16 aSlaveId, 
+                CStifTFwIfProt::TRunStatus aRunStatus,
+                TInt aRunResult ) = 0;
+        
+        /**
+         * Notify send unknown request has finished
+         */
+        virtual void NotifySendUnknownL( TUint16 aSlaveId, TInt aResult ) = 0;        
+    };
+
+// This class creates, execute and recive respons for master-slave requests
+NONSHARABLE_CLASS( CRemoteCallsProxy ): public CActive
+    {
+    public:
+		/**
+		 * Two phase constructor.
+		 */
+        static CRemoteCallsProxy* NewL( CTestModuleIf& aTestModuleIf, CStifLogger* aLogger );
+    public:
+        /**
+         * Destructor.
+         */
+        ~CRemoteCallsProxy();
+
+        /**
+         * Sends slave allocate request.
+         */
+        void AllocateL( TUint32 aMasterId, const TDesC& aType );
+        
+        /**
+         * Sends slave free request.
+         */
+        void FreeL( TUint32 aMasterId, TUint16 aSlaveId );
+        
+        /**
+         * Sends sendreceive request.
+         */
+        void SendReceiveL(  TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aMessage );
+        
+        /**
+         * Sends unknown request
+         */        
+        void SendUnknownL(  TUint32 aMasterId, TUint16 aSlaveId,
+                const TDesC& aCommand, const TDesC& aMessage );
+        
+        /**
+         * Sends start test case request.
+         */
+        void RunTestCaseL( TUint32 aMasterId, TUint16 aSlaveId, CStartInfo* aStartInfo );
+        
+        /**
+         * Sends pause test case request.
+         */
+        void PauseTestCaseL( TUint32 aMasterId, TUint16 aSlaveId, TUint16 aTestId );
+        
+        /**
+         * Sends resume test case request.
+         */
+        void ResumeTestCaseL( TUint32 aMasterId, TUint16 aSlaveId, TUint16 aTestId );
+        
+        /**
+         * Sends cancel test case request.
+         */
+        void CancelTestCaseL( TUint32 aMasterId, TUint16 aSlaveId, TUint16 aTestId );
+        
+        /**
+         * Sends request event request.
+         */
+        void RequestEventL( TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aEventName );
+        
+        /**
+         * Sends set event request.
+         */
+        void SetEventL( TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aEventName, 
+                TEventIf::TEventType aEventType = TEventIf::EIndication );
+        
+        /**
+         * Sends unset event request.
+         */
+        void UnsetEventL( TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aEventName );
+        
+        /**
+         * Sends release event request.
+         */
+        void ReleaseEventL( TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aEventName );
+        
+        /**
+         * Sets slave allocate/free requests notyfications handler.
+         */
+        void SetSlaveAllocateFreeMonitor( MSlaveAllocateFreeMonitor* aSlaveAllocateFreeMonitor );
+
+        /**
+         * Sets remote test case control requests notyfications handler.
+         */
+        void SetRemoteTestCasesMonitor( MRemoteTestCasesMonitor* aRemoteTestCasesMonitor );
+
+        /**
+         * Sets remote events control requests notyfications handler.
+         */
+        void SetRemoteEventsMonitor( MRemoteEventsMonitor* aRemoteEventssMonitor );
+
+        /**
+         * Sets remote sendreceive request notyfications handler.
+         */
+        void SetRemoteSendReceiveMonitor( MRemoteSendReceiveMonitor* aRemoteSendReceiveMonitor );
+
+        /**
+         * Sets remote respones receive error handler.
+         */
+        void SetReceiveErrorHandler( MReceiveErrorHandler* aReceiveErrorHandler );
+        
+    private:
+        /**
+         * Constructor.
+         */
+        CRemoteCallsProxy( CTestModuleIf& aTestModuleIf, CStifLogger* aLogger  );
+        
+        /**
+         * Second phase of two phase construction.
+         */
+        void ConstructL();
+        
+        /**
+         * Cancels remote responses receiving.
+         */
+        void DoCancel();
+        
+        /**
+         * Handlers remote request respons
+         */
+        void RunL();
+        
+        /**
+         * Handles errors during remote request response dispatching
+         */
+        TInt RunError( TInt aError );
+        
+        /**
+         * Starts remote requests respons receiving.
+         */
+        void StartReceivingL();
+        
+        /**
+         * Dispatches received remote request response.
+         */
+        void DispatchReceivedRemoteMsgL();
+        
+        /**
+         * Handles slave reserve request response.
+         */
+        void ReceiveResponseReserveL( CStifTFwIfProt* aMsg );
+        
+        /**
+         * Handles slave release request response.
+         */
+        void ReceiveResponseReleaseL( CStifTFwIfProt* aMsg );
+        
+        /**
+         * Handles remote test case run request response.
+         */
+        void ReceiveResponseRunL( CStifTFwIfProt* aMsg );
+        
+        /**
+         * Handles remote test case control request response.
+         */
+        void ReceiveResponseTestCtlL( CStifTFwIfProt* aMsg );
+
+        /**
+         * Handles remote event control request response.
+         */
+        void ReceiveResponseEventCtlL( CStifTFwIfProt* aMsg );
+
+        /**
+         * Handles remote sendreceive request response.
+         */
+        void ReceiveResponseSendReceiveL( CStifTFwIfProt* aMsg );
+        
+        /**
+         * Handles remote send unknown request response.
+         */
+        void ReceiveResponseSendUnknownL( CStifTFwIfProt* aMsg );
+    private:
+        // Pointer to STF looger
+        CStifLogger* iLogger;
+        
+        // TestModuleIf used to send master-slave requests
+        CTestModuleIf& iTestModuleIf;
+        
+        // Buffer for remote request response
+        TRemoteProtMsg iReceivedRemoteMsg;
+
+        // Buffer for error  description
+        TBuf<256> iReceiveErrorDescription;
+        
+        // Pointer to slave allocate/free monitor
+        MSlaveAllocateFreeMonitor* iSlaveAllocateFreeMonitor;
+        
+        // Pointer to test case control requests monitor
+        MRemoteTestCasesMonitor* iRemoteTestCasesMonitor;
+        
+        // Pointer to events control requests monitor
+        MRemoteEventsMonitor* iRemoteEventsMonitor;
+        
+        // Pointer to send/receive requests monitor
+        MRemoteSendReceiveMonitor* iRemoteSendReceiveMonitor;
+        
+        // Pointer to receive error handler
+        MReceiveErrorHandler* iReceiveErrorHandler;
+    };
+
+// This class contains most important informations about allocated slave device
+NONSHARABLE_CLASS( CSlave ): public CBase
+    {
+    public:
+		/**
+		 * Two phase constructor.
+		 */
+        static CSlave* NewL();
+        
+        /**
+         * Destructor.
+         */
+        ~CSlave();
+        
+        /**
+         * Returns slave name.
+         */
+        const TDesC& GetName() const;
+        
+        /**
+         * Sets slave name.
+         */
+        void SetNameL( const TDesC& aName );
+        
+        /**
+         * Returns slave master's id.
+         */
+        TUint32 GetMasterId() const;
+        
+        /**
+         * Sets slave master's id
+         */
+        void SetMasterId( TUint32 aMasterId );
+        
+        /**
+         * Returns slave's id.
+         */
+        TUint16 GetSlaveId() const;
+        
+        /**
+         * Sets slave's id.
+         */
+        void SetSlaveId( TUint16 aSlaveId );
+
+        /**
+         * Returns true if slave has running remote sub test cases.
+         */
+        TBool HasRunningTestCases() const;
+        
+        /**
+         * Register slave remote sub test case.
+         */
+        void RegisterSubTestCaseL( CRemoteSubTestCaseRunner* aSubTestCase );
+        
+        /**
+         * Unregister slave remote sub test case.
+         */
+        void UnregisterSubTestCaseL( CRemoteSubTestCaseRunner* aSubTestCase );
+        
+        /**
+         * Returns list of slave remote sub test cases. 
+         */
+        RPointerArray<CRemoteSubTestCaseRunner>& GetSubTestCases();
+        
+        /**
+         * Waits until all running slave remote sub test cases finis.
+         */
+        void WaitForSubTestCasesL();
+        
+        /**
+         * Cancel WaitForSubTestCasesL call.
+         */
+        void CancelWaitForSubTestCases();
+        
+        /**
+         * Register slave remote event.
+         */
+        void AddEventL( TEventTS* aEvent );
+
+        /**
+         * Unregister slave remote event.
+         */
+        void RemoveEventL( TEventTS* aEvent );
+        
+        /**
+         * Returns selected slave remote event.
+         */
+        TEventTS* GetEvent( const TDesC& aName );
+        
+        RPointerArray<TEventTS>& GetEvents();
+    private:
+        /**
+         * Constructor.
+         */
+        CSlave();
+        
+        /**
+         * Second phase of two phase construction.
+         */
+        void ConstructL();
+    private:
+        /**
+         * Slave's name.
+         */
+        HBufC* iName;
+        
+        /**
+         * Slave's master id.
+         */
+        TUint32 iMasterId;
+        
+        /**
+         * Slave's id.
+         */
+        TUint16 iSlaveId;
+        
+        /**
+         * List of slave's remote sub test cases.
+         */
+        RPointerArray<CRemoteSubTestCaseRunner> iSubTestCases;
+        
+        /**
+         * List of slave's remote events.
+         */
+        RPointerArray<TEventTS> iEvents;
+        
+        /**
+         * nested active scheduler loop used to wait for running remote sub
+         * test cases finis.
+         */
+        CActiveSchedulerWait* iNestedASLoop;
+    };
+
+// Manages slaves and wraps most of the master-slave communication
+NONSHARABLE_CLASS( CSlavesManager ): 
+    protected CActive, 
+    private MSlaveAllocateFreeMonitor, 
+    private MRemoteTestCasesMonitor,
+    private MRemoteEventsMonitor,
+    private MRemoteSendReceiveMonitor,
+    private MReceiveErrorHandler
+    {
+    private:
+		/**
+		 * Types of internal CSlavesManager states.
+		 */
+        enum TSlavesManagerOperation { 
+			ESMOIdle, 
+			ESMOSlaveAllocate, 
+			ESMOSlaveFree,
+			ESMOEventRequest, 
+			ESMOEventRelease,
+			ESMOEventSet, 
+			ESMOEventUnset,
+			ESMOSendReceiveWaitForStarted,
+			ESMOSendReceiveWaitForReady,
+			ESMOSendUnknown,
+			};
+    public:
+        /**
+         * Two phase constructor.
+         */
+        static CSlavesManager* NewL( CTestRunner* aTestRunner, CTestModuleIf& aTestModuleIf );
+        
+        /**
+         * Destructor.
+         */
+        ~CSlavesManager();
+        
+        /**
+         * Allocates slave device.
+         */
+        void SlaveAllocateL( const TDesC& aName, const TDesC& aType );
+        
+        /**
+         * Frees slave device.
+         */
+        void SlaveFreeL( const TDesC& aName );
+
+        /**
+         * Send remote command.
+         */
+        void SendReceiveL( CSlave* aSlave, const TDesC& aMessage );
+        
+        /**
+         * Send command not specified in STF master-slave protocol
+         */
+        void SendUnknownL( CSlave* aSlave, const TDesC& aCommand, const TDesC& aMessage );
+        
+        /**
+         * Returns selected slave device wrapper object.
+         */
+        CSlave* GetSlave( const TDesC& aName );
+        
+        /**
+         * Returns selected slave device wrapper object.
+         */
+        CSlave* GetSlave( TUint16 aSlaveId );
+
+        RPointerArray<CSlave>& GetSlaves();
+
+        /**
+         * Requests specified event from slave device
+         */
+        void EventRequestL( CSlave* aSlave, TEventTS* aEvent );
+        
+        /**
+         * Releases selected remote event.
+         */
+        void EventReleaseL( CSlave* aSlave, const TDesC& aEventName );        
+
+        /**
+         * Sets remote event.
+         */
+        void EventSetL( CSlave* aSlave, const TDesC& aEventName, TEventIf::TEventType aEventType );
+        
+        /**
+         * Unsets remote event
+         */
+        void EventUnsetL( CSlave* aSlave, const TDesC& aEventName );        
+        
+        /**
+         * Returns CRemoteCallsProxy used in master-slave communication.
+         */
+        CRemoteCallsProxy* GetRemoteCallsProxy();
+        
+    private:
+        /**
+         * Constructor.
+         */
+        CSlavesManager( CTestRunner* aTestRunner, CTestModuleIf& aTestModuleIf );
+        
+        /**
+         * Second phase of two phase construction.
+         */
+        void ConstructL();
+
+        /**
+         * Handles operation timeout event.
+         */
+        void RunL();
+        
+        /**
+         * Cancels operation timeout monitor.
+         */
+        void DoCancel();
+        
+		/**
+		 * Notify slave is allocated
+		 */
+        void NotifySlaveAllocatedL( TUint16 aSlaveId );
+        
+        /**
+         * Notify slave is freed
+         */
+        void NotifySlaveFreedL( TUint16 aSlaveId );
+
+		/**
+		 * Notify test case has been started.
+		 */
+        void NotifyTestCaseStartedL( TUint16 aSlaveId, TUint16 aSlaveTestId );
+        
+        /**
+         * Notify test case can't be started.
+         */        
+        void NotifyTestCaseRunErrorL( TUint16 aSlaveId, 
+        		const TFullTestResult& aTestCaseResult );
+        
+        /**
+         * Notify execution test case has finished
+         */
+        void NotifyTestCaseFinishedL( TUint16 aSlaveId, TUint16 aSlaveTestId, 
+        		const TFullTestResult& aTestCaseResult );
+        
+        /**
+         * Notify test case has been paused.
+         */
+        void NotifyTestCasePausedL( TUint16 aSlaveId, TUint16 aSlaveTestId );
+        
+        /**
+         * Notify test case has been resumed.
+         */
+        void NotifyTestCaseResumedL( TUint16 aSlaveId, TUint16 aSlaveTestId );
+        
+        /**
+         * Notify test case has been cancelled.
+         */
+        void NotifyTestCaseCancelledL( TUint16 aSlaveId, TUint16 aSlaveTestId );
+        
+		/**
+		 * Notify remote event has been requested
+		 */
+        void NotifyEventRequestedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, 
+                CStifTFwIfProt::TEventStatus aEventStatus,
+                TEventIf::TEventType aEventType,
+                TInt aResult );
+        
+        /**
+         * Notify remote event state has changed
+         */
+        void NotifyEventStateChangedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, 
+                CStifTFwIfProt::TEventStatus aEventStatus,
+                TEventIf::TEventType aEventType,
+                TInt aResult );
+        
+        /**
+         * Notify remote event has been released
+         */
+        void NotifyEventReleasedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, TInt aResult  );
+
+        /**
+         * Notify remote event has been sucessfully set
+         */
+        void NotifyEventSetCompletedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, TInt aResult );
+        
+        /**
+         * Notify remote event has been sucessfully unset
+         */
+        void NotifyEventUnsetCompletedL( TUint16 aSlaveId, 
+                const TDesC& aEventName, TInt aResult );        
+        
+		/**
+		 * Notify sendreceive request has been started
+		 */
+        void NotifySendReceiveStartedL( TUint16 aSlaveId );
+        
+        /**
+         * Notify sendreceive request has finished
+         */
+        void NotifySendReceiveResultL( 
+                TUint16 aSlaveId, 
+                CStifTFwIfProt::TRunStatus aRunStatus,
+                TInt aRunResult );
+        
+        /**
+         * Notify send unknown request has finished
+         */
+        void NotifySendUnknownL( TUint16 aSlaveId, TInt aResult );
+        
+		/**
+		 * Handle error which occured during remote message receive
+		 */
+        void HandleRemoteReceiveError( TInt aError, const TDesC& aErrorDescription );
+        
+    private:
+        // Indicates currently performed operation
+        TSlavesManagerOperation iOperation;
+        
+        // Contains last operation result
+        TInt iLastOperationResult;
+        
+        // Pointer to CTestRunner object
+        CTestRunner* iTestRunner;
+        
+        // TestModuleIf used by CRemoteCallsProxy in master-slave communication
+        CTestModuleIf& iTestModuleIf;
+        
+        // CRemoteCallsProxy used in master-slave communication
+        CRemoteCallsProxy* iRemoteCallsProxy;
+        
+        // Array of allocated slave devices
+        RPointerArray<CSlave> iSlaves;
+        
+        // Temporary field used during slave device allocation
+        CSlave* iSlaveForAllocate;
+        
+        // Temporary field used during event request
+        TEventTS* iEventForRequest;
+        
+        // Operation timeout
+        TTimeIntervalMicroSeconds32 iOperationTimeout;
+
+        // Operation timeout timer
+        RTimer iOperationTimeoutTimer;
+        
+        // Nested active scheduler loop used to block CSlavesManager methods 
+        // execution until respons for selected request is received
+        CActiveSchedulerWait* iNestedASLoop;
+    };
+
+#endif /* TESTSCRIPTERUTILS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/src/SubTestCaseRunner.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,950 @@
+/*
+* 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: This file contains TestScripter implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "SubTestCaseRunner.h"
+#include <TestEngineClient.h>
+#include "TestScripter.h"
+#include "Logging.h"
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iTestRunner->GetLogger()
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CSubTestCaseRunner
+
+     Method: CSubTestCaseRunner
+
+     Description: Constructor
+
+     Constructor.
+     
+     Parameters: CTestRunner* aTestRunner : in: Pointer to test runner which 
+                         should be notified about test case end
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CSubTestCaseRunner::CSubTestCaseRunner()
+:CActive( EPriorityStandard ), iState( ESTSIdle )
+    {
+    }
+
+CSubTestCaseRunner::TSubTestCaseState CSubTestCaseRunner::GetState() const
+    {
+    return iState;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: NewLC
+
+     Description: Two-phased constructor.
+
+     Two-phased constructor.
+     
+     Parameters: CTestRunner* aTestRunner : in: Pointer to test runner which 
+                         should be notified about test case end
+
+     Return Values: Pointer to newly created CLocalSubTestCaseRunner object.
+
+     Errors/Exceptions: Leaves if there is some problem during method execution
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CLocalSubTestCaseRunner* CLocalSubTestCaseRunner::NewLC( CTestRunner* aTestRunner )
+    {
+    CLocalSubTestCaseRunner* self = new(ELeave)CLocalSubTestCaseRunner( aTestRunner );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+
+     Two-phased constructor.
+     
+     Parameters: CTestRunner* aTestRunner : in: Pointer to test runner which 
+                         should be notified about test case end
+
+     Return Values: Pointer to newly created CLocalSubTestCaseRunner object.
+
+     Errors/Exceptions: Leaves if there is some problem during method execution
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CLocalSubTestCaseRunner* CLocalSubTestCaseRunner::NewL( CTestRunner* aTestRunner )
+    {
+    CLocalSubTestCaseRunner* self = NewL( aTestRunner );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: CLocalSubTestCaseRunner
+
+     Description: Destructor
+
+     Destructor
+     
+     Parameters: none
+
+     Return Values: none
+
+     Errors/Exceptions: none
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CLocalSubTestCaseRunner::~CLocalSubTestCaseRunner()
+    {
+    CancelSubTestCaseL();
+    
+    delete iStartInfo;
+    iTestCase.Close();
+    iTestEngine.Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: CLocalSubTestCaseRunner
+
+     Description: Constructor
+
+     Constructor.
+     
+     Parameters: CTestRunner* aTestRunner : in: Pointer to test runner which 
+                         should be notified about test case end
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CLocalSubTestCaseRunner::CLocalSubTestCaseRunner( CTestRunner* aTestRunner )
+:iTestRunner( aTestRunner ), iResultPckg( iResult )
+    {
+    CActiveScheduler::Add( this );    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: ConstructL
+
+     Description: Second phase of two-phased constructor.
+
+     Second phase of two-phased constructor.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLocalSubTestCaseRunner::ConstructL()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: NewL
+
+     Description: Handles test case execution end.
+
+     Handles test case execution end and pass test case execution result to 
+     proper CTestCaseRunner.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves if there is some problem during method execution
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLocalSubTestCaseRunner::RunL()
+    {
+    // Store run result
+    iRunResult = iStatus.Int();
+    
+    iTestCase.Close();
+    iTestEngine.Close();    
+    
+    iState = ESTSIdle;
+    
+    // Report sub test case result to  CTestRunner
+    iTestRunner->SubTestCaseFinishedL( this );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: DoCancel
+
+     Description: Cancels test case execution
+
+     Cancels test case execution
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLocalSubTestCaseRunner::DoCancel()
+    {
+    TInt ret = iTestCase.CancelAsyncRequest( RTestCase::ERunTestCase );
+    if ( ret != KErrNone )
+        {
+        // There was some error during sub test case cancel
+        // Only put message to log.
+        __TRACE( KMessage, ( _L( "Unexpected error during sub test case testid=%S cancel." ), &iStartInfo->GetTestId() ) );
+        }
+
+    iTestCase.Close();
+    iTestEngine.Close();    
+    
+    // Mart test case as canceled
+    iResult.iTestResult.SetResult( KErrNone, KNullDesC );
+    iResult.iCaseExecutionResultCode = KErrCancel;
+    iResult.iCaseExecutionResultType = TFullTestResult::ECaseCancelled;
+    iState = ESTSIdle;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: RunSubTestCaseL
+
+     Description: Starts test case execution.
+
+     Starts test case execution.
+     
+     Parameters: CStartInfo* aStartInfo : in: Pointer to structure which hold
+                          information about test case which should be executed.
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves if there is some problem during method execution
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLocalSubTestCaseRunner::RunSubTestCaseL( CStartInfo& aStartTestCaseInfo )
+    {
+    // Check if this AO is already running some sub test case
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    // Reset runner internal state
+    Reset();
+    
+    // Copy sub test case startup information
+    CStartInfo* startInfo = CStartInfo::NewL();
+    CleanupStack::PushL( startInfo );
+    startInfo->CopyL( aStartTestCaseInfo );
+    CleanupStack::Pop( startInfo );
+    iStartInfo = startInfo;
+    
+    // Connect to TestEngine
+    TInt ret = iTestEngine.Connect();
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }
+
+    // Initialize TestEngine session
+    CleanupClosePushL( iTestEngine );
+    ret = iTestEngine.LoadConfiguration( KNullDesC() );    
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }
+
+    // Load selected test module with specified ini file
+    ret = iTestEngine.AddTestModule( iStartInfo->GetModuleName(),
+            iStartInfo->GetIniFile() );
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }
+
+    // Set optional cfg file
+    if ( iStartInfo->GetConfig() != KNullDesC )
+        {
+        ret = iTestEngine.AddConfigFile( iStartInfo->GetModuleName(),
+                iStartInfo->GetConfig() );
+        if ( ret != KErrNone )
+            {
+            User::Leave( ret );
+            }
+        }
+
+    // Get list of available test cases from test engine
+    TRequestStatus enumerationRequestStatus;
+    TCaseCount testCasesCount;
+    iTestEngine.EnumerateTestCases( testCasesCount, enumerationRequestStatus );
+    User::WaitForRequest( enumerationRequestStatus );
+    if ( enumerationRequestStatus.Int() != KErrNone )
+        {
+        User::Leave( enumerationRequestStatus.Int() );
+        }
+
+    CFixedFlatArray<TTestInfo>* testCasesList = CFixedFlatArray<TTestInfo>::NewL( testCasesCount() );
+    CleanupStack::PushL( testCasesList );
+
+    ret = iTestEngine.GetTestCases( *testCasesList );
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }
+
+    // Find requested test case in test cases enumerated from TestEngine 
+    TBool findByTitle = ( iStartInfo->GetTitle() != KNullDesC );    
+    TTestInfo testInfo;
+    TBool foundTestCase = EFalse;
+    if ( findByTitle )
+        {
+        iStartInfo->SetTestCaseNumber( -1 );
+        }
+    for ( TInt i = 0; i < testCasesList->Count(); i++ )
+        {
+        if ( ( findByTitle && ( (*testCasesList)[ i ].iTestCaseInfo.iTitle == iStartInfo->GetTitle() ) ) ||
+             ( (*testCasesList)[ i ].iTestCaseInfo.iCaseNumber == iStartInfo->GetTestCaseNumber() ) )
+            {
+            testInfo = (*testCasesList)[ i ];
+            foundTestCase = ETrue;
+            }
+        }
+
+    // Store test case title
+    iStartInfo->SetTitleL( testInfo.iTestCaseInfo.iTitle );
+
+    // Check if requested test case is availabe or not
+    if ( !foundTestCase )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    CleanupStack::PopAndDestroy( testCasesList );
+
+    // Open test case subsession
+    TTestInfoPckg testInfoPckg( testInfo );
+    ret = iTestCase.Open( iTestEngine, testInfoPckg );
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }
+
+    // Run sub test case
+    CleanupClosePushL( iTestCase );
+    iTestCase.RunTestCase( iResultPckg, iStatus );
+    SetActive();
+    CleanupStack::Pop(); // Remove iTestCase from cleanup stack
+    CleanupStack::Pop(); // Remove iTestEngine from cleanup stack
+    iState = ESTSRunning;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: PauseSubTestCaseL
+
+     Description: Pauses selected sub test case.
+
+     Pauses selected sub test case.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves if sub test case is not running
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLocalSubTestCaseRunner::PauseSubTestCaseL()
+    {
+    // Check if sub test case is running
+    if ( !IsActive() )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    User::LeaveIfError( iTestCase.Pause() );
+    iState = ESTSPaused;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: ReasumeSubTestCaseL
+
+     Description: Reasume selected sub test case.
+
+     Reasume selected sub test case.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves if sub test case is not running
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLocalSubTestCaseRunner::ResumeSubTestCaseL()
+    {    
+    // Check if sub test case is running
+    if ( !IsActive() )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    User::LeaveIfError( iTestCase.Resume() );
+    iState = ESTSRunning;
+    }
+
+void CLocalSubTestCaseRunner::CancelSubTestCaseL()
+    {
+    Cancel();
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: Reset
+
+     Description: Resets sub test case runner internal state.
+
+     Resets sub test case runner internal state.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLocalSubTestCaseRunner::Reset()
+    {
+    delete iStartInfo;
+    iStartInfo = NULL;
+        
+    iRunResult = KErrNone;
+    
+    iResult.iCaseExecutionResultCode = KErrNone;
+    iResult.iCaseExecutionResultType = TFullTestResult::ECaseOngoing;
+    iResult.iTestResult.SetResult( KErrNone, KNullDesC );
+    
+    iState = ESTSIdle;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: GetRunResult
+
+     Description: Returns execution result.
+
+     Returns execution result.
+     
+     Parameters: None
+
+     Return Values: Execution result
+
+     Errors/Exceptions: 
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CLocalSubTestCaseRunner::GetRunResult() const
+    {
+    return iRunResult;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: GetTestCaseResult
+
+     Description: Returns test case execution result.
+
+     Returns test case execution result.
+     
+     Parameters: None
+
+     Return Values: Test case execution result.
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+const TFullTestResult& CLocalSubTestCaseRunner::GetTestCaseResult() const    
+    {
+    return iResult;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLocalSubTestCaseRunner
+
+     Method: GetStartInfo
+
+     Description: Returns informations about started test case.
+
+     Returns informations about started test case.
+     
+     Parameters: None
+
+     Return Values: Returns information about started test case.
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+const CStartInfo* CLocalSubTestCaseRunner::GetStartInfo() const
+    {
+    return iStartInfo;
+    }
+
+CSubTestCaseRunner::TSubTestCaseType CLocalSubTestCaseRunner::GetType() const
+    {
+    return ESTTLocal;
+    }
+
+
+
+
+CRemoteSubTestCaseRunner* CRemoteSubTestCaseRunner::NewL( CTestRunner* aTestRunner, 
+        CSlave* aSlave, CRemoteCallsProxy* aRemoteCallsProxy )
+    {
+    CRemoteSubTestCaseRunner* self = new(ELeave)CRemoteSubTestCaseRunner( 
+            aTestRunner, aSlave, aRemoteCallsProxy );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;    
+    }
+
+CRemoteSubTestCaseRunner* CRemoteSubTestCaseRunner::NewLC( CTestRunner* aTestRunner, 
+        CSlave* aSlave, CRemoteCallsProxy* aRemoteCallsProxy )
+    {    
+    CRemoteSubTestCaseRunner* self = new(ELeave)CRemoteSubTestCaseRunner( 
+            aTestRunner, aSlave, aRemoteCallsProxy );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;    
+    }
+
+CRemoteSubTestCaseRunner::~CRemoteSubTestCaseRunner()
+    {
+    Cancel();
+    
+    iTimeoutTimer.Close();
+    
+    delete iNestedASLoop;
+    iNestedASLoop = NULL;
+    
+    delete iStartInfo;
+    iStartInfo = NULL;
+    
+    TRAPD( err, iSlave->UnregisterSubTestCaseL( this ) );
+    if ( err != KErrNone )
+        {
+        RDebug::Print( _L("Unexpected error during slave subtestcase deregistration %d"), err );
+        }
+    }
+
+void CRemoteSubTestCaseRunner::RunSubTestCaseL( CStartInfo& aStartTestCaseInfo )
+    {
+    // Check if this AO is already running some sub test case
+    if ( IsActive() || ( iState != ESTSIdle ) )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    // Reset runner internal state
+    Reset();
+    
+    // Copy sub test case startup information
+    CStartInfo* startInfo = CStartInfo::NewL();
+    CleanupStack::PushL( startInfo );
+    startInfo->CopyL( aStartTestCaseInfo );
+    CleanupStack::Pop( startInfo );
+    iStartInfo = startInfo;
+    
+    // Connect to TestEngine
+    iRemoteCallsProxy->RunTestCaseL( iSlave->GetMasterId(), iSlave->GetSlaveId(), iStartInfo );
+    
+    iCurrentOperation = ECORunSubtestCase;
+    
+    iTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iOperationResult );
+    iState = ESTSRunning;
+    }
+
+void CRemoteSubTestCaseRunner::PauseSubTestCaseL()
+    {
+    // Check if sub test case is running
+    if ( IsActive() || ( iState != ESTSRunning ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    iRemoteCallsProxy->PauseTestCaseL( iSlave->GetMasterId(), iSlave->GetSlaveId(), iTestCaseId );
+
+    iCurrentOperation = ECOPauseSubtestCase;
+    
+    iTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iOperationResult );
+    iState = ESTSPaused;
+    }
+
+void CRemoteSubTestCaseRunner::ResumeSubTestCaseL()
+    {    
+    // Check if sub test case is running
+    if ( IsActive() || ( iState != ESTSPaused ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    iRemoteCallsProxy->ResumeTestCaseL( iSlave->GetMasterId(), iSlave->GetSlaveId(), iTestCaseId );
+
+    iCurrentOperation = ECOResumeSubtestCase;
+    
+    iTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iOperationResult );
+    iState = ESTSRunning;
+    }
+
+void CRemoteSubTestCaseRunner::CancelSubTestCaseL()
+    {
+    // Check if sub test case is running
+    if ( IsActive() || ( iState != ESTSIdle ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    iRemoteCallsProxy->CancelTestCaseL( iSlave->GetMasterId(), iSlave->GetSlaveId(), iTestCaseId );
+
+    iCurrentOperation = ECOCancelSubtestCase;
+    
+    iTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iOperationResult );
+    
+    iRunResult = KErrCancel;
+    // Mart test case as canceled
+    iResult.iTestResult.SetResult( KErrNone, KNullDesC );
+    iResult.iCaseExecutionResultCode = KErrCancel;
+    iResult.iCaseExecutionResultType = TFullTestResult::ECaseCancelled;
+    
+    iState = ESTSIdle;
+    }
+
+TInt CRemoteSubTestCaseRunner::GetRunResult() const
+    {
+    return iRunResult;
+    }
+
+const TFullTestResult& CRemoteSubTestCaseRunner::GetTestCaseResult() const
+    {
+    return iResult;
+    }
+
+const CStartInfo* CRemoteSubTestCaseRunner::GetStartInfo() const
+    {
+    return iStartInfo;
+    }
+
+CSubTestCaseRunner::TSubTestCaseType CRemoteSubTestCaseRunner::GetType() const
+    {
+    return ESTTRemote;
+    }
+
+CRemoteSubTestCaseRunner::CRemoteSubTestCaseRunner( CTestRunner* aTestRunner, 
+        CSlave* aSlave, CRemoteCallsProxy* aRemoteCallsProxy )
+:iTestRunner( aTestRunner ), iSlave( aSlave ), 
+ iRemoteCallsProxy( aRemoteCallsProxy ), iOperationTimeout( 30000000 )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+void CRemoteSubTestCaseRunner::ConstructL()
+    {
+    User::LeaveIfError( iTimeoutTimer.CreateLocal() );
+    iNestedASLoop = new(ELeave)CActiveSchedulerWait;
+    iSlave->RegisterSubTestCaseL( this );
+    }
+
+void CRemoteSubTestCaseRunner::RunL()
+    {
+    // Test case timeouted.
+    iCurrentOperation = ECONone;
+    iOperationResult = KErrTimedOut;
+    iNestedASLoop->AsyncStop();
+    }
+
+void CRemoteSubTestCaseRunner::DoCancel()
+    {
+    if ( GetState() == ESTSRunning )
+        {
+        TRAPD( err, CancelSubTestCaseL() );
+        if ( err != KErrNone )
+            {
+            RDebug::Print( _L("Unexpected error during slave subtestcase cancel %d"), err );
+            }
+        }
+    
+    iTimeoutTimer.Cancel();
+    }
+
+void CRemoteSubTestCaseRunner::Reset()
+    {
+    delete iStartInfo;
+    iStartInfo = NULL;
+    iTestCaseId = 0;
+    iRunResult = 0;
+    iResult = TFullTestResult();
+    }
+
+CSlave* CRemoteSubTestCaseRunner::GetSlave()
+    {
+    return iSlave;
+    }
+
+TUint16 CRemoteSubTestCaseRunner::GetTestCaseId() const
+    {
+    return iTestCaseId;
+    }
+
+void CRemoteSubTestCaseRunner::NotifyTestCaseStartedL( TUint16 aTestCaseId )
+    {
+    if ( !iNestedASLoop->IsStarted() || ( iCurrentOperation != ECORunSubtestCase ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    iTestCaseId = aTestCaseId;
+
+    Cancel();
+    
+    iNestedASLoop->AsyncStop();
+    iCurrentOperation = ECONone;
+    iOperationResult = KErrNone;
+    }
+
+void CRemoteSubTestCaseRunner::NotifyTestCaseRunError( const TFullTestResult& aTestCaseResult )
+    {
+    if ( !iNestedASLoop->IsStarted() || ( iCurrentOperation != ECORunSubtestCase ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel();
+    
+    iResult = aTestCaseResult;
+    
+    iNestedASLoop->AsyncStop();
+    iCurrentOperation = ECONone;
+    iOperationResult = iResult.iCaseExecutionResultCode;
+    }
+
+void CRemoteSubTestCaseRunner::NotifyTestCasePausedL()
+    {
+    if ( !iNestedASLoop->IsStarted() || ( iCurrentOperation != ECOPauseSubtestCase ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel();
+    
+    iNestedASLoop->AsyncStop();
+    iCurrentOperation = ECONone;
+    iOperationResult = KErrNone;
+    }
+
+void CRemoteSubTestCaseRunner::NotifyTestCaseResumedL()
+    {
+    if ( !iNestedASLoop->IsStarted() || ( iCurrentOperation != ECOResumeSubtestCase ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel();
+    
+    iNestedASLoop->AsyncStop();
+    iCurrentOperation = ECONone;
+    iOperationResult = KErrNone;
+    }
+
+void CRemoteSubTestCaseRunner::NotifyTestCaseCancelledL()
+    {
+    if ( !iNestedASLoop->IsStarted() || ( iCurrentOperation != ECOCancelSubtestCase ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel();
+    
+    iNestedASLoop->AsyncStop();
+    iCurrentOperation = ECONone;
+    iOperationResult = KErrNone;
+    }
+
+void CRemoteSubTestCaseRunner::NotifyTestCaseFinishedL( const TFullTestResult& aTestCaseResult )
+    {
+    iRunResult = KErrNone;
+    iResult = aTestCaseResult;
+    
+    iState = ESTSIdle;
+    
+    // Report sub test case result to  CTestRunner
+    iTestRunner->SubTestCaseFinishedL( this );    
+    }
+
+TBool CRemoteSubTestCaseRunner::IsRunSubTestCaseRequestOngoing() const
+    {
+    if ( iCurrentOperation == ECORunSubtestCase )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/src/TestKeywords.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,344 @@
+/*
+* 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: This module contains the implementation of 
+* TTestKeywords class member functions.
+*
+*/
+
+
+// INCLUDE FILES
+#include "TestKeywords.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestKeywords
+
+     Method: Keyword
+
+     Description: Returns a string desrciptor corresponding to keyword number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC8: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Approved 
+    
+-------------------------------------------------------------------------------
+*/
+TPtrC TTestKeywords::Keyword( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"title",
+        (TText*)L"timeout",
+        (TText*)L"priority",
+        (TText*)L"create",
+        (TText*)L"delete",
+        (TText*)L"request",
+        (TText*)L"wait",
+        (TText*)L"release",
+        (TText*)L"set",
+        (TText*)L"unset",
+        (TText*)L"print",
+        (TText*)L"allownextresult",
+        (TText*)L"waittestclass",
+        (TText*)L"createkernel",
+        (TText*)L"pause",
+        (TText*)L"loop",
+        (TText*)L"endloop",
+        (TText*)L"oomignorefailure",
+        (TText*)L"oomheapfailnext",
+        (TText*)L"oomheapsetfail",
+        (TText*)L"oomheaptonormal",
+        (TText*)L"testinterference",
+        (TText*)L"measurement",
+        (TText*)L"allowerrorcodes",
+        (TText*)L"bringtoforeground",
+        (TText*)L"sendtobackground",
+        (TText*)L"presskey",
+        (TText*)L"typetext",        
+        (TText*)L"var",
+        (TText*)L"callsub",
+        (TText*)L"createx",
+        (TText*)L"setresultdescription",
+        (TText*)L"sendpointerevent",
+        (TText*)L"using",
+        (TText*)L"expectedpanic",
+        (TText*)L"createshareobj",
+        (TText*)L"restoreshareobj",
+        (TText*)L"deleteshareobj",
+        (TText*)L"run",
+        (TText*)L"complete",
+        (TText*)L"canceliferror",
+        (TText*)L"pausetest",
+        (TText*)L"resume",
+        (TText*)L"cancel",
+        (TText*)L"allocate",
+        (TText*)L"free",
+        (TText*)L"remote",
+        (TText*)L"sendreceive",        
+        };
+
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestKeywords
+
+     Method: Priority
+
+     Description: Returns a string desrciptor corresponding to priority 
+                    keywords optional argument number. 
+
+     Parameters:   TInt aArg: in: argument index.
+     
+     Return Values: TPtrC8: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/
+TPtrC TTestKeywords::Priority( TInt aArg )
+    {
+    static TText* const priority[] =
+        {
+        (TText*)L"high",
+        (TText*)L"normal",
+        (TText*)L"low",
+        };
+
+    if( aArg >= (TInt)(sizeof( priority )/sizeof(TText*)) )
+        {
+        TPtrC null;
+        return null;
+        } 
+
+    TPtrC arg( priority[ aArg ] ); 
+    return arg;
+    
+    }
+      
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestKeywords
+
+     Method: Parse
+
+     Description: Returns a keyword enum corresponding to keyword 
+                      string descriptor.
+
+     Parameters:    TPtrC aKeyword: in: keyword descriptor.
+                    KeywordFunc aFunc: in: Function pointer to keyword parser 
+     
+     Return Values: TInt: keyword index
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/
+TInt TTestKeywords::Parse( TDesC& aKeyword, KeywordFunc aFunc )
+    {
+    TInt ind;
+    for( ind = 0; aFunc( ind ).Length() > 0; ind++ )
+        {
+        if( aFunc( ind ) == aKeyword )
+            {
+            return ind;
+            }
+        }
+    return KErrNotFound;
+    };
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestKeywords
+
+     Method: RunOptArg
+
+     Description: Returns a string desrciptor corresponding to run keyword 
+                  optional argument number. 
+
+     Parameters:    TRunOptArgs aArg: in: run keyword optional argument index
+     
+     Return Values: TPtrC8: argument descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Approved 
+    
+-------------------------------------------------------------------------------
+*/
+TPtrC TTestKeywords::RunOptArg( TInt aArg )
+    {
+    static TText* const runOptArgs[] =
+        {
+        (TText*)L"expect",
+        (TText*)L"testid",
+        (TText*)L"ini",
+        (TText*)L"category",
+        (TText*)L"timeout",
+        (TText*)L"title",
+        };
+
+    if( aArg >= (TInt)(sizeof( runOptArgs )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          }
+
+    TPtrC arg( runOptArgs[ aArg ] );
+    return arg;    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestKeywords
+
+     Method: ResultCategory
+
+     Description: Returns a string desrciptor corresponding to result 
+        category number. 
+
+     Parameters:    TInt aArg: in: argument index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/              
+TPtrC TTestKeywords::ResultCategory( TInt aArg )
+    {
+    static TText* const category[] =
+        {
+        (TText*)L"ongoing",
+        (TText*)L"normal",
+        (TText*)L"cancelled",
+        (TText*)L"errorfrommodule",
+        (TText*)L"leave",
+        (TText*)L"panic",
+        (TText*)L"exception",
+        (TText*)L"timeout",
+        };
+        
+    if( aArg >= (TInt)(sizeof( category )/sizeof(TText*)) )
+        {
+        TPtrC null;
+        return null;
+        } 
+    
+    TPtrC arg( category[ aArg ] ); 
+    return arg;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestKeywords
+
+     Method: ResultCategory
+
+     Description: Returns a string desrciptor corresponding to event keywords 
+                      optional argument number. 
+
+     Parameters:    TEventOptArgs aArg: in: argument index.
+     
+     Return Values: TPtrC8: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Proposal 
+    
+-------------------------------------------------------------------------------
+*/              
+TFullTestResult::TCaseExecutionResult TTestKeywords::GetResultCategory( TDesC& aCategory )
+    {
+    
+    TInt ind;
+    for( ind = 0; ResultCategory( ind ).Length() > 0; ind++ )
+        {
+        if( ResultCategory( ind ) == aCategory )
+            {
+            switch( ind )
+                {
+                case TFullTestResult::ECaseExecuted:
+                case TFullTestResult::ECaseLeave:
+                case TFullTestResult::ECasePanic:
+                case TFullTestResult::ECaseException:
+                case TFullTestResult::ECaseTimeout:
+                    return (TFullTestResult::TCaseExecutionResult)ind;
+                default:
+                    break;
+                }        
+            }
+        }      
+    return TFullTestResult::ECaseOngoing;    
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/src/TestScripter.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,7350 @@
+/*
+* 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: This file contains TestScripter implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestEventInterface.h>
+#include <StifLogger.h>
+#include "TestScripter.h"
+#include "TestKeywords.h"
+#include "Logging.h"
+#include "TestEngineClient.h"
+#include "SettingServerClient.h"
+#include "TestScripterInternal.h"
+#include "SubTestCaseRunner.h"
+#include <stifinternal/TestServerClient.h>
+
+
+#include <stifinternal/UiEnvProxy.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+const TUid KPropertyCat =
+    {
+    0x101FB3DE
+    };
+const TUint KPropertyKey = 0x00000001;
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iLog
+
+// LOCAL CONSTANTS AND MACROS
+_LIT( KExecute, "Execute");
+// Printing priorities
+const TInt KPrintPriExec = 400;
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: -
+
+     Method: CallBack
+
+     Description: (Function pointer) Called from CScriptBase class. Generic
+                  method for call back operations from Test Script Class to
+                  TestScripter.
+  
+     Parameters: CTestScripter* aTestScripter: in: Pointer to TestScripter
+                 TStifTSCallBackType aCallType: in: Call back type
+                 const TDesC& aLine: in Script line
+                    
+     Return Values: TInt: Symbian error code
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CallBack( CTestScripter* aTestScripter,
+                TStifTSCallBackType aCallType,
+                const TDesC& aLine )
+    {
+    TInt ret( 0 );
+    switch( aCallType )
+        {
+        case EStifTSCallClass:
+            {
+            ret = aTestScripter->CallTestClass( aLine );
+            break;
+            }
+        case EStifTSGetObject:
+            {
+            ret = aTestScripter->GetTestScriptObject( aLine );
+            break;
+            }
+        default:
+            {
+            ret = KErrArgument;
+            break;
+            }
+        }
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CTestScripter class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: CTestScripter
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+ Status: Draft
+ 
+ -------------------------------------------------------------------------------
+ */
+CTestScripter::CTestScripter() :
+    iObjects(NULL)
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::ConstructL()
+    {
+    __TRACE( KPrint, ( _L("New TestScripter") ) );
+    iStdLog = CStifLogger::NewL( KTestScripterLogDir,
+                                KTestScripterLogFile );
+    iLog = iStdLog;
+
+    iOOMIgnoreFailure = EFalse; // OFF for default
+
+    iCheckHeapBalance = EFalse; // No checking heap balance by default
+
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+    iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle;
+    
+    // Initialize parser variables
+    iCurrentParser = NULL;
+    iCurrentParserReadFirstLine = EFalse;
+
+    TUint ProperKey = RProcess().Id().Id();
+    TInt err = RProperty::Define(KPropertyCat, ProperKey, RProperty::EInt);
+
+    iObjects = new (ELeave) RPointerArray<TScriptObject> ;
+    err = RProperty::Set(KPropertyCat, ProperKey, (TInt) iObjects);
+    User::LeaveIfError(err);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters:    None
+
+     Return Values: CTestScripter*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestScripter* CTestScripter::NewL()
+    {
+     
+    CTestScripter* self = new (ELeave) CTestScripter();
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: ~CTestScripter
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestScripter::~CTestScripter()
+    {
+    iTestObjects.ResetAndDestroy();
+    iTestModules.ResetAndDestroy();
+    iDefinedIni.ResetAndDestroy();
+    iDefinedRuntime.ResetAndDestroy();
+    iDefinedLocal.ResetAndDestroy();
+    iParserStack.ResetAndDestroy();
+    iGlobalObjects.ResetAndDestroy();
+    iSharedTestModules.ResetAndDestroy();
+    iObjects->Reset();
+    iTestObjects.Close();
+    iTestModules.Close();
+    iDefinedIni.Close();
+    iGlobalObjects.Close();
+    iDefinedRuntime.Close();
+    iDefinedLocal.Close();
+    iParserStack.Close();
+    iObjects->Close();
+    iSharedTestModules.Close();
+
+    iCurrentParser = NULL;
+    delete iSectionParser;
+    delete iTestRunner;
+    delete iObjects;
+
+    iLog = NULL;
+    delete iStdLog;
+    iStdLog = NULL;
+    delete iTCLog;
+    iTCLog = NULL;   
+    
+    TUint ProperKey = RProcess().Id().Id(); 
+    TInt err = RProperty::Delete(KPropertyCat, ProperKey);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: InitL
+
+     Description: InitL is used to initialize the Test Module.
+
+     Parameters: const TFileName& aIniFile: in: Initialization file
+                 TBool aFirstTime: in: First time flag 
+                         
+     Return Values: Symbian OS error code
+
+     Errors/Exceptions: Leaves if ReadInitializationL leaves
+     
+     Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+TInt CTestScripter::InitL( TFileName& aIniFile, 
+                           TBool /*aFirstTime*/ )
+    {
+ 
+    __TRACEFUNC();
+ 
+    if( aIniFile.Length() > 0 )
+        {
+        // Read initialization from test case file
+        ReadInitializationL( aIniFile, iDefinedIni );
+        }
+        
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetTestCases
+
+     Description: GetTestCases is used to inquired test cases
+
+     Parameters:    const TFileName& aConfigFile: in: Test case file
+                    RPointerArray<RTestEngine::TTestCaseInfo>& aTestCases: out: 
+                          Array of TestCases 
+     
+     Return Values: KErrNone: Success
+                    Symbian OS error code
+
+     Errors/Exceptions: Leaves if CStifParser::SectionL leaves
+                        Leaves if CStifParser::NextSectionL leaves
+                        Leaves if memory allocation fails
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/        
+TInt CTestScripter::GetTestCasesL( const TFileName& aConfigFile, 
+                                   RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+    __TRACEFUNC();
+    
+    if( aConfigFile.Length() == 0 )
+        {
+        __TRACE( KError, (_L("No test case script file given") ) );
+        __RDEBUG( (_L("No test case script file given") ) );
+        return KErrNotFound;
+        }
+
+    CStifParser* parser = NULL; 
+    
+    // Open test case file
+    TRAPD( err, 
+        parser = CStifParser::NewL( _L(""), 
+                                    aConfigFile, 
+                                    CStifParser::ECStyleComments ) );
+    if( err != KErrNone )
+        {
+        __TRACE( KError, (_L("Given test case script file [%S] not found"),
+            &aConfigFile ) );
+        __RDEBUG( (_L("Given test case script file [%S] not found"),
+            &aConfigFile ) );
+        return err;
+        }
+        
+    CleanupStack::PushL( parser );
+    CStifSectionParser* section;
+    TPtrC tmp;
+    TInt index = 0;
+    TInt ret = KErrNone;
+
+    // Find first section
+    section = parser->SectionL( KTestStartTag, KTestEndTag );
+    if( section == NULL )
+        {
+        ret = KErrNotFound;
+        }
+    else
+        {    
+        // Parse all sections
+        while( section )
+            {
+            CleanupStack::PushL( section );
+             
+            // Get title line
+            if( section->GetLine( TTestKeywords::Keyword( TTestKeywords::ETitle ),
+                tmp, ENoTag ) != KErrNone )
+                {
+                __TRACE( KError, (_L("Title not given for test case")));
+                User::Leave( KErrNotFound );
+                }
+            else
+                {
+                if( tmp.Length() > KMaxName )
+                    {
+                    tmp.Set( tmp.Left( KMaxName ) );
+                    }   
+                TTestCaseInfo* tc = new ( ELeave ) TTestCaseInfo();
+                CleanupStack::PushL( tc );
+                __TRACE( KVerbose, (_L("TestCase: %S"), &tmp));
+                tc->iTitle.Copy( tmp );
+                tc->iCaseNumber = ++index;
+                 
+                 // Get timeout if defined
+                CStifItemParser* item = section->GetItemLineL(  
+                   TTestKeywords::Keyword( TTestKeywords::ETimeout ) );
+                if( item )
+                    {
+                    TInt timeout; // In milliseconds
+                    ret = item->GetInt( 
+                        TTestKeywords::Keyword( TTestKeywords::ETimeout ), 
+                        timeout ); 
+                    if( ret != KErrNone )
+                        {
+                        __TRACE( KError, (_L("Illegal timeout")));
+                        User::Leave( ret ); 
+                        }
+                        
+                    // Type cast timeout to TInt64    
+                    tc->iTimeout = TInt64( timeout ) * 1000;
+                    __TRACE( KMessage, (_L("Timeout: %i"), tc->iTimeout.Int64() ));
+                    }
+                    
+                 // Get priority if defined
+                item = section->GetItemLineL(  
+                   TTestKeywords::Keyword( TTestKeywords::EPriority ) );
+                if( item )
+                    {
+                    // First try to interpret as integer
+                    ret = item->GetInt( 
+                        TTestKeywords::Keyword( TTestKeywords::EPriority ), 
+                        tc->iPriority ); 
+                    if( ret != KErrNone )
+                        {
+                        TPtrC priority;
+                        // If priority was not given as integer, it must be 
+                        // one of the predefined values
+                        ret = item->GetString( 
+                            TTestKeywords::Keyword( TTestKeywords::EPriority ),
+                            priority );
+                        if( ret != KErrNone )
+                            {
+                            __TRACE( KError, (_L("Illegal priority")));
+                            User::Leave( ret ); 
+                            }
+                        switch( TTestKeywords::Parse( priority, 
+                                                       TTestKeywords::Priority ) )
+                            {
+                            case TTestKeywords::EPriHigh:
+                                tc->iPriority = TTestCaseInfo::EPriorityHigh;
+                                break;
+                            case TTestKeywords::EPriNormal:
+                                tc->iPriority = TTestCaseInfo::EPriorityNormal;
+                                break;
+                            case TTestKeywords::EPriLow:
+                                tc->iPriority = TTestCaseInfo::EPriorityLow;
+                                break;
+                            default:
+                                __TRACE( KError, (_L("Illegal priority")));
+                                User::Leave( KErrArgument ); 
+                            }
+                        }
+                    __TRACE( KMessage, (_L("Priority: %i"), tc->iPriority ));
+                    }
+                    
+                aTestCases.Append(tc);
+                CleanupStack::Pop( tc );
+                }
+            CleanupStack::PopAndDestroy( section );
+            section = parser->NextSectionL( KTestStartTag, KTestEndTag );
+            }
+        }
+          
+    CleanupStack::PopAndDestroy( parser );
+
+    __TRACE( KPrint, (  _L( "Configfile '%S', testcases %d" ),
+        &aConfigFile, index ));     
+     
+    return ret;
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetConstantValue
+
+     Description: Internal fuction to get const value defined in 
+                  [Define]...[Enddefine] section of script file
+
+     GetConstantValue gets const value defined in [Define]...[Enddefine] 
+     section of script file
+
+     Parameters:    const TDesC& aName: in: constant name 
+                    TDes& avalue: out: constant value
+
+     Return Values: KErrNone: Value is returned succesfully.
+                    KErrNotFound: Constant was not found
+                    Any other SymbianOS error
+                    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestScripter::GetConstantValue( const TDesC& aName, TDes& aValue )
+    {
+    
+    __TRACEFUNC();
+
+    TInt count = iDefinedLocal.Count();
+    for(TInt i = 0; i < count; i++)
+        {
+        if(iDefinedLocal[i]->Name() == aName)
+            {
+            aValue.Copy(iDefinedLocal[i]->Value());
+            return KErrNone;
+            }
+        }   
+
+      count = iDefinedIni.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDefinedIni[i]->Name() == aName )
+            {
+            aValue.Copy( iDefinedIni[i]->Value() );
+            return KErrNone;
+            }
+        }   
+    
+    count = iDefinedRuntime.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iDefinedRuntime[i]->Name() == aName )
+            {
+            aValue.Copy( iDefinedRuntime[i]->Value() );
+            return KErrNone;
+            }
+        }   
+    return KErrNotFound;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: RunTestCaseL
+
+     Description: Run a specified testcase.
+
+     RunTestCaseL is used to run an individual test case. 
+  
+     Parameters:    const TInt aCaseNumber: in: Testcase number 
+                    const TFileName& aConfig: in: Test case file
+                    TTestResult& aResult: out: test case result
+
+     Return Values: KErrNone: Test case started succesfully.
+                    KErrNotFound: Testcase not found
+                    KErrUnknown: Unknown TestScripter error
+                    Any other SymbianOS error
+
+     Errors/Exceptions: Leaves if GetTestCaseL leaves
+                        Leaves if RunTestL leaves
+                        Leaves if memory allocation fails
+     
+     Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestScripter::RunTestCaseL( const TInt aCaseNumber,
+                                  const TFileName& aConfig,
+                                  TTestResult& aResult )
+    {
+
+    // Heap is checked by test server
+    //__UHEAP_MARK;
+
+    __TRACEFUNC();
+
+    //Open new log file with test case title in file name
+    if(iAddTestCaseTitleToLogName)
+        {
+        //Delete test case logger if exists
+        if(iTCLog)
+            {
+            delete iTCLog;
+            iTCLog = NULL;
+            }
+            
+        TFileName logFileName;
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        
+        logFileName.Format(KTestScripterLogFileWithTitle, &title);
+        iTCLog = CStifLogger::NewL(KTestScripterLogDir, logFileName);
+        iLog = iTCLog;
+        }
+
+    __TRACE( KMessage, (_L("\n\n***Testcase started***")));
+
+    // Remove locally defined variables 
+    iDefinedLocal.ResetAndDestroy();
+    // Remove existing function parsers (there shouldn't be any)
+    iParserStack.ResetAndDestroy();
+    
+    // Keep file name of config file
+    iConfig = aConfig;
+
+    // Read initialization from test case file
+    ReadInitializationL( aConfig, iDefinedRuntime );
+
+    // Get case from test case file
+    iSectionParser = GetTestCaseL( aCaseNumber, aConfig );
+    iCurrentParser = iSectionParser;
+    iCurrentParserReadFirstLine = EFalse;
+
+    // Check parsing result
+    if( iSectionParser == NULL )
+        {
+        __TRACE( KError, (_L("***Parsing testcase failed***\n\n")));
+        // Delete runtime defines
+        iDefinedRuntime.ResetAndDestroy();
+        //__UHEAP_MARKEND;
+        return KErrNotFound;
+        }
+
+    // When option is set in cfg file, on EKA2 env memory leaking is enabled
+    TInt memCellsBef = 0; //memory in current thread allocated before the test case is run
+    TInt memCellsAft = 0; //memory in current thread allocated after the test case has run
+
+    memCellsBef = User::Heap().Count();
+    __TRACE(KMessage, (_L("Allocated memory cells before the test case: %d"), memCellsBef));
+    
+    __TRACE(KMessage, (_L("Memory usage in global objects before the execution:")));
+    TInt beforeGlobalMemCells = TraceGlobalObjectsMemoryUsage();
+        
+
+    CActiveScheduler* activeScheduler =
+        new ( ELeave ) CActiveScheduler();
+    CleanupStack::PushL( activeScheduler );
+     
+    if ( CActiveScheduler::Current() == NULL )
+        {
+        CActiveScheduler::Install( activeScheduler );
+        }
+
+    // Run the given testcase described in iSectionParser section
+    RunTestL();
+
+    iTestObjects.ResetAndDestroy();
+    iTestModules.ResetAndDestroy();
+    iObjects->Reset();
+
+    // TestScripter must stop Active Scheduler after test
+    // object is destroyed. Otherwise if unexpected error occurs
+    // handling is erronous.
+    CleanupStack::PopAndDestroy( activeScheduler );
+
+    // Check for memory leak.
+    // It is reported in log always, but result of test case is changed only
+    // when option in cfg file is enabled.
+    memCellsAft = User::Heap().Count();
+    __TRACE(KMessage, (_L("Allocated memory cells after the test case: %d"), memCellsAft));
+
+
+    __TRACE(KMessage, (_L("Memory usage in global objects after the execution:")));
+    TInt afterGlobalMemCells = TraceGlobalObjectsMemoryUsage();
+        
+    memCellsAft = memCellsAft - afterGlobalMemCells + beforeGlobalMemCells; 
+    
+    // if there is a difference report memory leak
+    if(memCellsAft != memCellsBef)
+        {
+        __TRACE(KError, (_L("Memory leak, %d cell(s) is missing"), memCellsAft - memCellsBef));
+        if(iCheckHeapBalance)
+            {
+            // Memory leaks detection is disabled for UI components testing
+            if ( !( TestModuleIf().UITesting() ) )
+                {
+                UpdateTestCaseResult(KErrGeneral, _L("Memory leak has occured"));
+                }
+            }
+        }
+
+    // Delete parser and set current parser to NULL
+    iCurrentParser = NULL;
+    delete iSectionParser;
+    iSectionParser = NULL;  
+    
+    // Erase config file name
+    iConfig = KNullDesC; 
+    
+    // Return result 
+    aResult = iResult;
+    
+    if( iResult.iResult == KErrNone )
+        {
+        __TRACE( KPrint, (_L("***Testcase PASSED***\n\n")));
+        TestModuleIf().Printf( KPrintPriNorm, _L("TestScripter"), 
+            _L("***Testcase PASSED***\n\n"));
+        }
+    else
+        {        
+        __TRACE( KPrint, (_L("***Testcase FAILED***\n\n")));
+        TestModuleIf().Printf( KPrintPriNorm, _L("TestScripter"), 
+            _L("***Testcase FAILED***\n\n"));
+        }
+    User::After(300000);
+    // Delete runtime defines
+    iDefinedRuntime.ResetAndDestroy();
+    
+    //__UHEAP_MARKEND;
+             
+    //If log was replaced then restore it
+    if(iAddTestCaseTitleToLogName)
+        {
+        iLog = iStdLog;
+        delete iTCLog;
+        iTCLog = NULL;
+        }
+    
+    return KErrNone;
+     
+    }
+
+TInt CTestScripter::TraceGlobalObjectsMemoryUsage()
+    {
+    __TRACEFUNC();
+    
+    TInt moduleNumber = iSharedTestModules.Count();
+    TInt shareObjNumber = iGlobalObjects.Count();
+    __TRACE(KMessage, (_L("There are %d item(s) in shared modules list"),moduleNumber));
+    __TRACE(KMessage, (_L("There are %d item(s) in shared objects list"),shareObjNumber));
+    
+    TInt listNumber = 0;
+    
+    if(moduleNumber != 0)
+        {
+        listNumber++;
+        __TRACE(KMessage, (_L("Shared module list used 1 cell.")));        
+        __TRACE(KMessage, (_L("There are %d shared module(s), they used %d cells"), moduleNumber , moduleNumber * 2));        
+        }
+
+    if(shareObjNumber != 0)
+        {
+        listNumber++;
+        __TRACE(KMessage, (_L("Shared object list used 1 cell.")));        
+        __TRACE(KMessage, (_L("There are %d shared object(s), they used %d cells"), shareObjNumber, shareObjNumber * 4));     
+        }
+    TInt result = listNumber + moduleNumber * 2 + shareObjNumber * 4;
+    __TRACE(KMessage, (_L("There are %d cells used by shared objects and their modules."), result));        
+            
+    return result;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: ReadInitializationL
+
+     Description: Read initialization from file.
+
+     Parameters:    const TDesC& aIniFile: in: File that contains initialization
+                    
+     Return Values: None
+     
+     Errors/Exceptions: None
+     
+     Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::ReadInitializationL(
+    const TDesC& aIniFile,
+    RPointerArray<CDefinedValue>& aDefines )
+    {
+
+    CStifParser* parser = NULL;
+
+    // Open file
+    TRAPD( err,
+        parser = CStifParser::NewL( _L(""),
+                                    aIniFile,
+                                    CStifParser::ECStyleComments ) );
+    if( ( err == KErrNone ) && parser )
+        {
+        CleanupStack::PushL( parser );
+        __TRACE( KMessage, (_L("Read initialization from [%S]"),
+            &aIniFile ) );
+
+        CStifSectionParser* section = parser->SectionL( KDefineStartTag,
+                                                        KDefineEndTag );
+        while(section)
+            {
+            CleanupStack::PushL( section );
+            __TRACE( KMessage, (_L("Read defines")) );
+
+            TPtrC name;
+            TPtrC value;
+            CStifItemParser* item = section->GetItemLineL( _L("") );
+            while( item )
+                {
+                CleanupStack::PushL( item );
+
+                if( item->GetString( _L(""), name ) != KErrNone )
+                    {
+                    __TRACE( KError, (_L("No define name given")) );
+                    User::Leave( KErrGeneral );
+                    }
+                if( item->Remainder( value ) != KErrNone )
+                    {
+                    __TRACE( KError, (_L("No define value given")) );
+                    User::Leave( KErrGeneral );
+                    }
+                TInt count = aDefines.Count();
+                TInt i = 0;
+                for( ; i < count; i++ )
+                    {
+                    if( aDefines[i]->Name() == name )
+                        {
+                        // Update existing
+                        aDefines[i]->SetValueL( value );
+                        __TRACE(KMessage, (_L("Update define [%S]: [%S]"), &name, &value));
+                        break;
+                        }
+                    }
+                if( i == count)
+                    {
+                    // New define, store it
+                    CDefinedValue* define = CDefinedValue::NewL( name, value );
+                    CleanupStack::PushL( define );
+                    User::LeaveIfError( aDefines.Append( define ) );
+                    CleanupStack::Pop( define );
+                    }
+
+                CleanupStack::PopAndDestroy( item );
+                item = section->GetNextItemLineL();
+                }
+            CleanupStack::PopAndDestroy( section );
+            section = parser->NextSectionL(KDefineStartTag, KDefineEndTag);
+            }
+
+        //Read StifSettings section and find value for CheckHeapBalance.
+        //(In cfg file in settings section User may also set CapsModifier
+        // option. This is handled in TestServerClient.cpp in 
+        // RTestServer::GetCapsModifier method).
+        section = parser->SectionL(KStifSettingsStartTag, KStifSettingsEndTag);
+
+        if(section)
+            {
+            CleanupStack::PushL(section);
+            __TRACE(KMessage, (_L("Read stif settings")));
+
+            TPtrC value;
+            CStifItemParser* item = section->GetItemLineL(_L(""));
+            while(item)
+                {
+                CleanupStack::PushL(item);
+                __TRACE( KMessage, (_L("Got settings line")));
+
+                if(item->GetString(_L("CheckHeapBalance="), value) == KErrNone)
+                    {
+                    __TRACE(KMessage, (_L("Got CheckHeapBalance item, value=%S"), &value));
+                    if(value.Compare(_L("off")) == 0)
+                        {
+                        iCheckHeapBalance = EFalse;
+                        }
+                    else if(value.Compare(_L("on")) == 0)
+                        {
+                        iCheckHeapBalance = ETrue;
+                        }
+                    else
+                        {
+                        __TRACE(KError, (_L("Value '%S' for CheckHeapBalance setting is not supported. Aborting"), &value));
+                        User::Leave(KErrNotSupported);
+                        }
+                    }
+                CleanupStack::PopAndDestroy(item);
+                item = section->GetNextItemLineL();
+                }
+            CleanupStack::PopAndDestroy(section);
+            }
+        
+        
+        
+        
+        //Read data section 
+    section = parser->SectionL(KDataStartTag, KDataEndTag);
+
+    if(section)
+        {
+        CleanupStack::PushL(section);
+        __TRACE(KMessage, (_L("Read data section")));
+
+        
+        CStifItemParser* item = section->GetItemLineL(_L(""));
+        
+        while(item)
+            {
+            CleanupStack::PushL(item);
+            __TRACE( KMessage, (_L("Got data section line")));
+            TPtrC inifile;
+            TPtrC inisection;
+            if(item->GetString(_L("File"), inifile) == KErrNone)
+                {
+               
+                __TRACE(KMessage, (_L("Got ini file name: %S"), &inifile));
+                
+                iCurrentFile.Zero();
+                
+              
+                if(inifile.Find(_L("\\"))==KErrNotFound)
+                    {
+                    iCurrentFile.Append(_L("c:\\TestFramework\\"));
+                    }
+               
+                iCurrentFile.Append(inifile);
+               
+                
+                
+                TPtrC alias;
+                err=item->GetNextString(alias);
+                __TRACE(KMessage, (_L("Got ini file alias: %S"), &alias));
+                
+                iCurrentFileAlias.Zero();
+                if(err==KErrNone)
+                    {
+                    iCurrentFileAlias.Copy(alias);
+                    }
+                else
+                    {
+                    TParsePtr filespec(iCurrentFile);
+                    iCurrentFileAlias.Copy(filespec.NameAndExt());
+                    }
+                
+                
+              
+                }
+            else if(item->GetString(_L("Section"), inisection) == KErrNone)
+                {
+                
+                __TRACE(KMessage, (_L("Got Section name: %S"), &inisection));
+                
+                iCurrentSection.Zero();
+                iCurrentSection.Copy(inisection);
+                
+                
+                TPtrC alias;
+                TInt err=item->GetNextString(alias);
+                __TRACE(KMessage, (_L("Got Section alias: %S"), &alias));
+               
+                iCurrentSectionFileAlias.Zero();
+                
+                if(err==KErrNone)
+                    {
+                    iCurrentSectionFileAlias.Copy(alias);
+                    }
+                else
+                    {
+                    iCurrentSectionFileAlias.Copy(iCurrentSection);
+                    }
+                
+                TParsePtr filespec(iCurrentFile);
+          
+                CStifParser* parser=CStifParser::NewL(filespec.DriveAndPath(),filespec.NameAndExt());
+                
+                TBuf<KMaxFileName> section;
+                section.Append(_L("["));
+                section.Append(iCurrentSection);
+                section.Append(_L("]"));
+                CStifSectionParser* sectionparser=parser->SectionL(section,KNullDesC,1,EFalse);
+                
+                CStifItemParser* itemparser=sectionparser->GetItemLineL(KNullDesC);
+                
+                while(itemparser)
+                {
+                    itemparser->SetParsingType(CStifItemParser::EQuoteStyleParsing);
+                    TPtrC temp;
+                   
+                    itemparser->Remainder(temp);
+                    __TRACE(KMessage, (_L("Got item string: %S"), &temp));
+                    iCurrentKey.Zero();
+                    iCurrentKey.Append(KFileFlag);
+                    iCurrentKey.Append(iCurrentFileAlias);
+                    iCurrentKey.Append(KSectionFlag);
+                    iCurrentKey.Append(iCurrentSectionFileAlias);
+                    iCurrentKey.Append(KKeyFlag);
+                    
+                    TBuf<KMaxFileName> tempkey;
+                    TBuf<KMaxFileName> tempvalue;
+                    TLex lex(temp);
+                    TChar ch;
+                    while((ch = lex.Get()) != 0 )
+                       {
+                       while ((ch = lex.Peek()) != '=') 
+                       lex.Inc();
+                       tempkey.Append(lex.MarkedToken());
+                       lex.Inc();
+                       lex.Mark();
+                       break;
+                       }
+                    tempkey.TrimAll();
+                    iCurrentKey.Append(tempkey);
+                    iKeys.Append(iCurrentKey);
+                   
+                    
+                    tempvalue.Append(lex.Remainder());
+                    tempvalue.TrimAll();
+                    
+                    
+                    iCurrentvalues.Zero();
+                    iCurrentvalues.Copy(tempvalue);
+                   
+                  
+                   
+                    iValues.Append(iCurrentvalues);
+                    delete itemparser;
+                    itemparser=NULL;
+                    itemparser=sectionparser->GetNextItemLineL();
+                    
+                }
+                
+                
+           
+                     
+                delete sectionparser;
+                delete parser;
+                
+                
+                
+              
+                    
+                
+                
+                }
+            CleanupStack::PopAndDestroy(item);
+            item = section->GetNextItemLineL();
+            }
+        CleanupStack::PopAndDestroy(section);
+        }
+
+        
+
+        CleanupStack::PopAndDestroy( parser );
+        }
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetTestCaseL
+
+     Description: Get specified test case section from configfile.
+
+     Parameters:    const TInt aCaseNumber: in: Test case number
+                    const TFileName& aConfig: in: Configfile name 
+     
+     Return Values: CStifSectionParser*: pointer to test case section
+
+     Errors/Exceptions: Leaves if CStifParser::NewL leaves
+                        Leaves if CStifParser::SectionL leaves
+                        Leaves if memory allocation fails
+                                
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStifSectionParser* CTestScripter::GetTestCaseL( const TInt aCaseNumber, 
+                                             const TFileName& aConfig )
+    {
+    __TRACEFUNC();
+    CStifParser* parser = NULL;
+    
+    TRAPD( err, 
+        parser = CStifParser::NewL( _L(""), 
+                                    aConfig, 
+                                    CStifParser::ECStyleComments ); );
+    if( err != KErrNone )
+        {
+        __TRACE( KError, (_L("Test case file [%S] not found"), &aConfig ));
+        User::Leave( err );
+        }
+    CleanupStack::PushL( parser );
+
+    CStifSectionParser* section = NULL;
+    TRAP( err, 
+        section =parser->SectionL( KTestStartTag, KTestEndTag, aCaseNumber ););
+    if( err != KErrNone )
+        {
+        __TRACE( KError, 
+            (_L("Section [%S/%d] not found"), &aConfig, aCaseNumber ));
+        User::Leave( err );
+        }
+
+    CleanupStack::PopAndDestroy( parser );
+    return section;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetSubL
+
+     Description: Get specified function (sub) from stored config file.
+
+     Parameters:    const TDesC& aSubName: in: function name 
+     
+     Return Values: CStifSectionParser*: pointer to test function section
+
+     Errors/Exceptions: Leaves if CStifParser::NewL leaves
+                        Leaves if CStifParser::SectionL leaves
+                        Leaves if memory allocation fails
+                                
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStifSectionParser* CTestScripter::GetSubL(const TDesC& aSubName)
+    {
+    __TRACE(KMessage, (_L("Searching sub [%S]."), &aSubName));
+    // Check if config file is set
+    if(iConfig.Length() == 0)
+        {
+        __TRACE(KError, (_L("Searching sub [%S]. Config file is not set."), &aSubName));
+        User::Leave(KErrBadName);
+        }
+        
+    // Create parser
+    CStifParser* parser = NULL;
+    CStifSectionParser* section = NULL;
+        
+    TRAPD(err, 
+          parser = CStifParser::NewL(_L(""), iConfig, CStifParser::ECStyleComments);
+         );
+    if(err != KErrNone)
+        {
+        __TRACE(KError, (_L("Searching sub [%S]. Error [%d] when loading config file [%S]."), &aSubName, err, &iConfig));
+        User::Leave(err);
+        }
+    CleanupStack::PushL(parser);
+
+    // Set section tags
+    _LIT(KEndSubTag, "[EndSub]");
+    TName startSubTag;
+    startSubTag.Copy(_L("[Sub "));
+    startSubTag.Append(aSubName);
+    startSubTag.Append(_L("]"));
+    
+    // Load section
+    TRAP(err, 
+         section = parser->SectionL(startSubTag, KEndSubTag, 1);
+        );
+    if(err != KErrNone)
+        {
+        __TRACE(KError, (_L("Searching sub [%S]. Searching section %S%S ended with error [%d]."), &aSubName, &startSubTag, &KEndSubTag, err));
+        User::Leave(err);
+        }
+    if(!section)
+        {
+        __TRACE(KError, (_L("Searching sub [%S]. Section %S%S not found."), &aSubName, &startSubTag, &KEndSubTag));
+        User::Leave(err);
+        }
+    else
+        {
+        __TRACE(KMessage, (_L("Searching sub [%S]. Section %S%S found."), &aSubName, &startSubTag, &KEndSubTag));
+        }
+
+    CleanupStack::PopAndDestroy(parser);
+    return section;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: RunTestL
+
+     Description: Run a testcase specified by iSectionParser.
+
+     Parameters:    None
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if CSectionParser::GetItemLineL leaves
+                        Leaves if CTestRunner::NewL leaves
+                        Leaves if memory allocation fails                                
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::RunTestL()
+    {
+    __TRACEFUNC();
+    iResult.iResult = KErrNone;
+    iResult.iResultDes.Zero();
+     
+    // "title" keyword must be in the first line
+    TPtrC title;
+    if( iCurrentParser->GetLine( 
+        TTestKeywords::Keyword( TTestKeywords::ETitle ), title, ENoTag ) 
+        != KErrNone )
+        {
+        __TRACE( KError, (_L("title not found from section")));
+        User::Leave( KErrNotFound ); 
+        }
+    iCurrentParserReadFirstLine = ETrue;
+
+    __TRACE( KMessage, (_L("RunTest: %S"), &title ));
+     
+    iTestRunner = CTestRunner::NewL( this );
+
+    TestModuleIf().Printf( KPrintPriNorm, _L("RunTest"), _L("%S"), &title );
+    
+    // Rest of the job is done by test runner
+    iTestRunner->SetRunnerActive();
+
+    // Start activeScheduler looping testcase lines
+    __TRACE( KMessage, (_L("Start CActiveScheduler")));
+    CActiveScheduler::Current()->Start();
+  
+    if ( iTestRunner->IsFailedSubTestCaseReported() && !(iPassLimitNotMet) )
+        {
+        TFullTestResult testResult = iTestRunner->GetFailedSubTestCaseResult();
+        const CStartInfo* startInfo = iTestRunner->GetFailedSubTestCaseInfo();
+        if( testResult.iCaseExecutionResultType == TFullTestResult::ECaseExecuted )
+            {
+            iResult.iResult = testResult.iTestResult.iResult;
+            }
+        else
+            {
+            iResult.iResult = testResult.iCaseExecutionResultCode;
+            }
+        iResult.iResultDes.Format( _L("Sub test case \"%S\" execution failed. "), &startInfo->GetTitle() );
+        iResult.iResultDes.AppendFormat( _L("Result [%d], expected result [%d]"), iResult.iResult, startInfo->GetExpectedResult() );
+        }
+    
+    delete iTestRunner;
+    iTestRunner = NULL;
+    __TRACE( KMessage, ( _L("RunTestL: Done")));
+ 
+    // Destroy locally defined variables 
+    iDefinedLocal.ResetAndDestroy();
+    // Destroy function parsers (there shouldn't be any)
+    iParserStack.ResetAndDestroy();
+    }     
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetTestModuleL
+
+     Description: Load testmodule if not already loaded, otherwise return
+                  description of the loaded testmodule.
+
+     Parameters:    TDesC& aModule: in: module name
+                    TDesC& aIniFile: in: ini file name
+     
+     Return Values: CTCTestModule*: pointer to testmodules description
+     
+     Errors/Exceptions: Leaves if CTCTestModule::NewL leaves
+                        Leaves if RPointerArray::Append fails  
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/              
+TTestModule* CTestScripter::LoadTestModuleL( TDesC& aModule )
+    {     
+    __TRACEFUNC();
+    TInt count = iTestModules.Count();
+    for( TInt i=0; i < count; i++ )
+        {
+        if( iTestModules[i]->ModuleName() == aModule )
+            {
+            // Found test module, return description
+            __TRACE( KMessage, 
+                (_L("GetTestModuleL: Use already loaded TestModule (%S)"), 
+                &aModule ));
+            return iTestModules[i];
+            }
+        }
+         
+    __TRACE( KMessage, (_L("GetTestModuleL: Load new TestModule (%S)"), 
+        &aModule ));
+    TTestModule* module = new (ELeave) TTestModule();
+    CleanupStack::PushL( module );
+    module->ModuleName() = aModule;
+    User::LeaveIfError( iTestModules.Append( module ) );
+    CleanupStack::Pop( module );
+
+    TInt ret = module->iLibrary.Load ( aModule );
+    
+    if( ret != KErrNone )
+        {
+        __TRACE( KMessage, (_L("GetTestModuleL: %S loading failed"), 
+            &aModule ));
+        TestModuleIf().Printf( KMessage, _L("Load dll"), _L("%S failed"), 
+            &aModule );
+        
+        User::Leave( ret );
+        }
+         
+    // Get pointer to first exported function    
+    module->iLibEntry = (CInterfaceFactory) module->iLibrary.Lookup(1);
+    return module;
+    
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CTestScripter
+
+ Method: LoadSharedTestModuleL
+
+ Description: Load testmodule if not already loaded, otherwise return
+ description of the loaded testmodule.
+
+ Parameters:    TDesC& aModule: in: module name
+ TDesC& aIniFile: in: ini file name
+ 
+ Return Values: CTCTestModule*: pointer to testmodules description
+ 
+ Errors/Exceptions: Leaves if CTCTestModule::NewL leaves
+ Leaves if RPointerArray::Append fails  
+
+ Status: Draft
+ 
+ -------------------------------------------------------------------------------
+ */
+
+TTestModule* CTestScripter::LoadSharedTestModuleL(TDesC& aModule)
+    {
+    __TRACEFUNC();
+    TInt count = iSharedTestModules.Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        if (iSharedTestModules[i]->ModuleName() == aModule)
+            {
+            // Found test module, return description
+            __TRACE( KMessage,
+                    (_L("GetTestModuleL: Use already loaded TestModule (%S)"),
+                            &aModule ));
+            return iSharedTestModules[i]->Get();
+            }
+        }
+
+    __TRACE( KMessage, (_L("GetTestModuleL: Load new TestModule (%S)"),
+                    &aModule ));
+    TTestModule* module = new (ELeave) TTestModule();
+    CleanupStack::PushL(module);
+    module->ModuleName() = aModule;
+    User::LeaveIfError(iSharedTestModules.Append(
+            new (ELeave) TSharedTestModule(module)));
+    CleanupStack::Pop(module);
+
+    TInt ret = module->iLibrary.Load(aModule);
+    TestModuleIf().iNumberInGlbDict++;
+
+    if (ret != KErrNone)
+        {
+        __TRACE( KMessage, (_L("GetTestModuleL: %S loading failed"),
+                        &aModule ));
+        TestModuleIf().Printf(KMessage, _L("Load dll"), _L("%S failed"),
+                &aModule);
+
+        User::Leave(ret);
+        }
+
+    // Get pointer to first exported function    
+    module->iLibEntry = (CInterfaceFactory) module->iLibrary.Lookup(1);
+    return module;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: CreateObjectL
+
+     Description: Load testmodule if not already loaded, otherwise return
+                  description of the loaded testmodule.
+
+     Parameters:    TDesC& aModule: in: module name
+                    TDesC& aObjectId: in: object id name
+     
+     Return Values: None
+     
+     Errors/Exceptions: Leaves on error
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::CreateObjectL( TDesC& aModule, TDesC& aObjectId )
+    {     
+    __TRACEFUNC();
+
+    // Load module and get pointer
+    TTestModule* module = LoadTestModuleL( aModule );
+    TTestObject* object = new (ELeave) TTestObject();
+    CleanupStack::PushL( object );
+    object->ObjectId() = aObjectId;
+    object->iModule.Copy(aModule);
+    User::LeaveIfError( iTestObjects.Append( object ) );
+    CleanupStack::Pop( object );
+        
+    // Create object    
+    object->iScript = module->iLibEntry( TestModuleIf() );
+    //User::LeaveIfNull ( object->iScript );
+    if( object->iScript == NULL )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    // Create continue callback 
+    object->iContinue = CTestContinue::NewL( this, object );
+
+    // Create function pointer operation to possible
+    object->iScript->SetScripter( &CallBack, this );
+    
+    TestModuleIf().AddTestObjToCaseDictL(object);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: CreateShareObjectL
+
+     Description: Load testmodule if not already loaded, otherwise return
+                  description of the loaded testmodule.
+
+     Parameters:    TDesC& aModule: in: module name
+                    TDesC& aObjectId: in: object id name
+     
+     Return Values: None
+     
+     Errors/Exceptions: Leaves on error
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::CreateShareObjectL( TDesC& aModule, TDesC& aObjectId )
+    {     
+    __TRACEFUNC();
+
+    // Load module and get pointer
+    TTestModule* module = LoadSharedTestModuleL(aModule);
+    TTestObject* object = new (ELeave) TTestObject();
+    CleanupStack::PushL( object );
+    object->ObjectId() = aObjectId;
+    CleanupStack::Pop( object );
+    object->iModule.Copy(aModule);    
+    // Create object    
+    object->iScript = module->iLibEntry( TestModuleIf() );
+    //User::LeaveIfNull ( object->iScript );
+    if( object->iScript == NULL )
+        {
+        User::Leave( KErrGeneral );
+        }  
+
+    TestModuleIf().AddTestObjToCaseDictL(object);
+    AddTestObjToScripterDictL(object);
+    TestModuleIf().iNumberInGlbDict++; 
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: RestoreShareObjectL
+
+     Description: Load testmodule if not already loaded, otherwise return
+                  description of the loaded testmodule.
+
+     Parameters:    TDesC& aModule: in: module name
+                    TDesC& aObjectId: in: object id name
+     
+     Return Values: None
+     
+     Errors/Exceptions: Leaves on error
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::RestoreShareObjectL( TDesC& aObjectId )
+    {     
+    __TRACEFUNC();  
+  
+    TTestObject* object = NULL;
+    object = (TTestObject*)GetTestObjFromScripterDict( aObjectId );
+    
+    if( NULL == object )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    //User::LeaveIfNull ( object->iScript );
+    if( object->iScript == NULL )
+        {
+        User::Leave( KErrGeneral );
+        }  
+    
+    TestModuleIf().AddTestObjToCaseDictL(object);     
+    }
+  
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: CreateKernelObjectL
+
+     Description: Load testdriver if not already loaded, otherwise return
+                  description of the loaded testdriver.
+
+     Parameters:    TDesC& aDriver: in: driver name
+                    TDesC& aObjectId: in: object id name
+     
+     Return Values: None
+     
+     Errors/Exceptions: Leaves on error
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::CreateKernelObjectL( TDesC& aDriver, TDesC& aObjectId )
+    {     
+
+    __TRACEFUNC();
+    
+    if( ( aDriver.Length() > KMaxName ) ||
+        ( aObjectId.Length() > KMaxName ) )
+        {
+        __TRACE( KError, (_L("CreateKernelObjectL: Max lenght exceeded") ) );
+        User::Leave( KErrArgument );
+        }
+    TInt ret = User::LoadLogicalDevice( aDriver );
+    if( ( ret != KErrNone ) && ( ret != KErrAlreadyExists ) )
+        {
+        __TRACE( KError, 
+            (_L("CreateKernelObjectL: User::LoadLogicalDevice failed %d"), 
+                ret ) );
+        User::Leave( ret );
+        } 
+        
+    TTestObjectKernel* object = new (ELeave) TTestObjectKernel();
+    CleanupStack::PushL( object );
+    object->ObjectId() = aObjectId;
+    object->LddName().Copy( aDriver );
+    ret = object->KernelTestClass().Open( 
+                object->KernelTestClass().VersionRequired(), 
+                aDriver );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, 
+            (_L("CreateKernelObjectL: KernelTestClass().Open failed %d"), 
+                ret ) );
+        User::Leave( ret );
+        }
+        
+    User::LeaveIfError( iTestObjects.Append( object ) );
+    CleanupStack::Pop( object );
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetTestModuleL
+
+     Description: Load testmodule if not already loaded, otherwise return
+                  description of the loaded testmodule.
+
+     Parameters:    TDesC& aModule: in: module name
+                    TDesC& aIniFile: in: ini file name
+     
+     Return Values: CTCTestModule*: pointer to testmodules description
+     
+     Errors/Exceptions: Leaves if CTCTestModule::NewL leaves
+                        Leaves if RPointerArray::Append fails  
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestScripter::DeleteObjectL( TDesC& aObjectId )
+    {     
+    __TRACEFUNC();
+    
+    TestModuleIf().DelTestObjFromCaseDict(aObjectId);
+    
+    TInt count = iTestObjects.Count();
+    for( TInt i=0; i < count; i++ )
+        {
+        if( iTestObjects[i]->ObjectId() == aObjectId )
+            {
+            TTestObjectBase* object = iTestObjects[i];
+            iTestObjects.Remove( i );
+            delete object;
+            return KErrNone;
+            }
+        }
+     
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: DeleteGlobalObjectL
+
+     Description: Delete test object from dictionary
+
+     Parameters:    TDesC& aObjectId: in: object name
+     
+     Return Values: void
+     
+     Errors/Exceptions: Leaves if CTCTestModule::NewL leaves
+                        Leaves if RPointerArray::Append fails  
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestScripter::DeleteScripterObjectL( TDesC& aObjectId )
+    {     
+    __TRACEFUNC();
+    
+    TScriptObject* obj = TestModuleIf().GetTestObjFromCaseDict(aObjectId);
+    if(obj == NULL)
+        {
+        return KErrNotFound;
+        }
+    
+    TestModuleIf().DelTestObjFromCaseDict(aObjectId);
+    DelTestObjFromScripterDict(aObjectId);    
+    
+    return KErrNone;   
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetTest
+
+     Description: Get test case from testcase array.
+
+     Parameters:    TDesC& aTestId: in: TestId for testcase
+     
+     Return Values: CTCTestCase*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned 
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TTestObjectBase* CTestScripter::GetObject( const TDesC& aObjectId )
+    {
+    __TRACEFUNC();
+    
+    TInt count = iTestObjects.Count();
+    for( TInt i=0; i < count; i++ )
+        {
+        if( iTestObjects[i]->ObjectId() == aObjectId )
+            {
+            // Found testcase with specified TestId
+            return iTestObjects[i];
+            }
+        }
+    
+    TTestObject* object = NULL;
+    object = (TTestObject*)TestModuleIf().GetTestObjFromCaseDict( aObjectId );
+    
+    return object; 
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: CallTestClass
+
+     Description: For sub classing operations.
+  
+     Parameters: const TDesC& aLine: in: script line
+                    
+     Return Values: TInt: Symbian error code
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestScripter::CallTestClass( const TDesC& aLine )
+    {
+    CStifItemParser* item = CStifItemParser::NewL( aLine, 0, aLine.Length() );
+    CleanupStack::PushL( item );
+
+    TPtrC objectName;
+    TInt ret( KErrNone );
+    ret = item->GetString( _L( "" ), objectName );
+    if( ret != KErrNone )
+        {
+        CleanupStack::PopAndDestroy( item);
+        return ret;
+        }
+
+    TTestObjectBase* obj = GetObject( objectName );
+    if( obj == NULL )
+        {
+        CleanupStack::PopAndDestroy(item );
+        return KErrNotFound;
+        }
+
+    TRAPD( commandResult, commandResult = obj->RunMethodL( *item ) );
+
+    CleanupStack::PopAndDestroy(item );
+
+    return commandResult;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetTestScriptObject
+
+     Description: Get object address.
+  
+     Parameters: const TDesC& aObjectName: in: object name
+                    
+     Return Values: TInt: Symbian error code
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestScripter::GetTestScriptObject( const TDesC& aObjectName )
+    {
+
+    TTestObjectBase* objBase = GetObject( aObjectName );
+    if( ( objBase == NULL ) || 
+        ( objBase->ObjectType() != TTestObjectBase::EObjectNormal ) )
+        {
+        return KErrNotFound;
+        }
+    
+    TTestObject* object = ( TTestObject* )objBase;
+    
+    return (TInt) object->iScript;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: UpdateTestCaseResult
+
+     Description: Updates result of test case. If there is already some
+                  description stored, it is put in the [] brackets.
+  
+     Parameters: const TInt aResult: in: error code
+                 const TDesC& aDescr: in: description
+                    
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::UpdateTestCaseResult(const TInt aResult, const TDesC& aDescr)
+    {
+    // Create buffer
+    RBuf buf;
+
+    TInt ret = buf.Create(iResult.iResultDes.Length() + aDescr.Length() + 5);
+    if(ret != KErrNone)
+        {
+        __TRACE(KError, (_L("UpdateResultDescription: descriptor creation failed [%d]"), ret));
+        return;
+        }
+    CleanupClosePushL(buf);
+
+    // Update result
+    iResult.iResult = aResult;
+    if(iResult.iResultDes.Length() > 0)
+        {
+        buf.Format(_L("%S [%S]"), &aDescr, &iResult.iResultDes);
+        }
+    else
+        {
+        buf.Copy(aDescr);
+        }
+
+    SetResultDescription(buf);
+    
+    // Close buffer
+    CleanupStack::PopAndDestroy(&buf);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: SetResultDescription
+
+     Description: Sets result description of test case.
+  
+     Parameters: const TDesC& aDescr: in: new description
+                    
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CTestScripter::SetResultDescription(const TDesC& aDescr)
+    {
+    if(aDescr.Length() > KStifMaxResultDes)
+        {
+        iResult.iResultDes.Copy(aDescr.Mid(0, KStifMaxResultDes));
+        }
+    else
+        {
+        iResult.iResultDes.Copy(aDescr);
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: SetLocalValue
+
+     Description: Internal fuction to set value of local variable defined in script 
+
+     Parameters:    const TDesC& aName: in: local variable name 
+                    const TDesC& avalue: in: local variable value
+
+     Return Values: KErrNone: Value is returned succesfully.
+                    KErrNotFound: Variable was not found
+                    Any other SymbianOS error
+                    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestScripter::SetLocalValue(const TDesC& aName, const TDesC& aValue)
+    {   
+    __TRACEFUNC();
+
+    TInt count = iDefinedLocal.Count();
+    for(TInt i = 0; i < count; i++)
+        {
+        if(iDefinedLocal[i]->Name() == aName)
+            {
+            iDefinedLocal[i]->SetValueL(const_cast<TDesC&>(aValue));
+            return KErrNone;
+            }
+        }   
+
+    return KErrNotFound;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetLocalValue
+
+     Description: Internal fuction to get value of local variable 
+
+     Parameters:    const TDesC& aName: in: local variable name 
+                    const TDesC& avalue: in: local variable value
+
+     Return Values: KErrNone: Value is returned succesfully.
+                    KErrNotFound: Variable was not found
+                    Any other SymbianOS error
+                    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestScripter::GetLocalValue(const TDesC& aName, TDes& aValue)
+    {
+    __TRACEFUNC();
+
+    TInt count = iDefinedLocal.Count();
+    for(TInt i = 0; i < count; i++)
+        {
+        if(iDefinedLocal[i]->Name() == aName)
+            {
+            aValue.Copy(iDefinedLocal[i]->Value());
+            return KErrNone;
+            }
+        }   
+
+    return KErrNotFound;
+    }
+
+TBool CompareTBuf(const TBuf<KMaxFileName>& aLeft,const TBuf<KMaxFileName>& aRight)
+{
+    return aLeft.Compare(aRight) == 0 ? ETrue : EFalse;
+    
+}
+
+void CTestScripter::Substitute(const TDesC& aSrc,TDes& aDest)
+{
+    TIdentityRelation<TBuf<KMaxFileName> > relation(CompareTBuf);
+    
+    
+   
+           
+ 
+           
+    
+    
+    
+    TInt fileindex=aSrc.Find(KFileFlag);
+    TInt sectionindex=aSrc.Find(KSectionFlag);
+    TInt keyindex=aSrc.Find(KKeyFlag);
+    TBuf<KMaxFileName> srcbuf;
+    if(fileindex==KErrNotFound&&sectionindex==KErrNotFound&&keyindex!=KErrNotFound)
+        {
+        srcbuf.Append(KFileFlag);
+        srcbuf.Append(iCurrentFileAlias);
+        srcbuf.Append(KSectionFlag);
+        srcbuf.Append(iCurrentSectionFileAlias);
+       
+        srcbuf.Append(aSrc);
+        
+        }
+    else if(fileindex==KErrNotFound&&sectionindex!=KErrNotFound&&keyindex!=KErrNotFound)
+        {
+        srcbuf.Append(KFileFlag);
+        srcbuf.Append(iCurrentFileAlias);
+     
+        
+        srcbuf.Append(aSrc);
+        
+        }
+    else
+        {
+        srcbuf.Append(aSrc);
+        }
+    
+    
+    TInt index=iKeys.Find(srcbuf,relation);
+    if(index==KErrNotFound)
+        {
+        
+        aDest.Append(aSrc);
+        }
+    else
+        {
+        
+        aDest.Append(iValues[index]);
+        }
+  
+}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: AddTestObjToDictL
+
+     Description: Add Test Object to dictionary
+  
+     Parameters: TTestObject* aObject: in: test object
+                     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::AddTestObjToScripterDictL(TTestObject* aObject)
+    {
+    __TRACEFUNC();
+    
+    User::LeaveIfNull( (TAny*)aObject );
+   
+    TInt count = iGlobalObjects.Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        if (iGlobalObjects[i]->ObjectId() == aObject->ObjectId())
+            {
+            // Found testcase with specified TestId
+            return;
+            }
+        }
+    
+    User::LeaveIfError( iGlobalObjects.Append(aObject) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: DelTestObjFromDict
+
+     Description: delete Test Object from dictionary
+  
+     Parameters: const TDesC& aObjectId: in: id
+                    
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::DelTestObjFromScripterDict(const TDesC& aObjectId)
+    {
+    __TRACEFUNC();
+
+    TInt count = iGlobalObjects.Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        if (iGlobalObjects[i]->ObjectId() == aObjectId)
+            {
+            // Found testcase with specified TestId
+            TTestObject *object = (TTestObject*) iGlobalObjects[i];
+            iGlobalObjects.Remove(i);
+            TInt count2 = iSharedTestModules.Count();
+            for (TInt j = 0; j < count2; j++)
+                {
+                if (iSharedTestModules[j]->ModuleName() == object->iModule)
+                    {
+                    delete object;
+                    TestModuleIf().iNumberInGlbDict--;
+                    iSharedTestModules[j]->Del();
+                    if (iSharedTestModules[j]->RefCount() <= 0)
+                        {
+                        TestModuleIf().iNumberInGlbDict--;
+                        }
+                    delete iSharedTestModules[j];
+                    iSharedTestModules.Remove(j);
+                    break;
+                    }
+                }
+            if(iSharedTestModules.Count() == 0)
+                {
+                iSharedTestModules.Reset();
+                }
+            if(iGlobalObjects.Count() == 0)            
+                {
+                iGlobalObjects.Reset();
+                }
+            return;
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: GetTestObjFromDict
+
+     Description: delete Test Object from dictionary
+  
+     Parameters: const TDesC& aObjectId: in: id
+                    
+     Return Values: TTestObject* : pointer to TTestObject
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TTestObject* CTestScripter::GetTestObjFromScripterDict(const TDesC& aObjectId) const
+    {
+    __TRACEFUNC();
+    
+    TInt count = iGlobalObjects.Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        if (iGlobalObjects[i]->ObjectId() == aObjectId)
+            {
+            // Found testcase with specified TestId
+            return iGlobalObjects[i];
+            }
+        }
+    
+    return NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestScripter
+
+     Method: AppendTestResultToResultDes
+
+     Description: Append to TC's result description (if possible due to length) 
+                  limitation provided text in [] brackets.
+  
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestScripter::AppendTestResultToResultDes(TDes& aResultDescr, const TDesC& aTestCaseResultDescr)
+    {
+    if(aTestCaseResultDescr != KNullDesC)
+        {
+        _LIT(KAdditionalInfo, " [%S]");
+        TInt len = aResultDescr.Length() + KAdditionalInfo().Length() + aTestCaseResultDescr.Length();
+
+        if(len > KStifMaxResultDes)
+            {
+            len = KStifMaxResultDes - aResultDescr.Length() - KAdditionalInfo().Length();
+            if(len > 0)
+                {
+                TPtrC descr = aTestCaseResultDescr.Mid(0, len); 
+                aResultDescr.AppendFormat(KAdditionalInfo, &descr);
+                }
+            }
+        else
+            {
+            aResultDescr.AppendFormat(KAdditionalInfo, &aTestCaseResultDescr);
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CTestRunner class 
+    member functions. CTestRunner is used to execute TestScripter testcase by 
+    CTestScripter.
+
+-------------------------------------------------------------------------------
+*/
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iTestScripter->iLog
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: CTestRunner
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: CTestScripter* aTestScripter: in: Backpointer to CTestScripter
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestRunner::CTestRunner( CTestScripter* aTestScripter ): 
+    CActive(  CActive::EPriorityHigh ), // Executed with highest priority 
+    iState( ERunnerIdle ),
+    iInternalStateForSubTestCases( EISNotStarted ),
+    iTestScripter( aTestScripter ),
+    iRemainingTimeValue( 0 )
+    {
+    CActiveScheduler::Add( this );
+    __TRACEFUNC();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ConstructL()
+    {
+    
+    iPauseTimer.CreateLocal();
+    
+    // Initiaze all OOM related variables to default.
+    OOMHeapToNormal();
+    
+    iLoopHelper = CLoopHelper::NewL( this );
+    
+    iSlavesManager = CSlavesManager::NewL( this, iTestScripter->TestModuleIf() );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters: CTestScripter* aTestScripter: in: Backpointer to CTestScripter
+
+     Return Values: CTestRunner*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+
+CTestRunner* CTestRunner::NewL( CTestScripter* aTestScripter )
+    {
+    CTestRunner* self = new (ELeave) CTestRunner( aTestScripter );
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ~CTestRunner
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/     
+
+CTestRunner::~CTestRunner()
+    {
+    __TRACEFUNC();
+    Cancel();
+
+    iPauseTimer.Close();
+    
+    delete iLine;
+    iLine = NULL;
+    
+    delete iLoopHelper;
+    iLoopHelper = NULL;
+    
+    iSubTestCases.ResetAndDestroy();
+    iSubTestCases.Close();
+        
+    delete iTestIdForComplete;
+    iTestIdForComplete = NULL;
+    
+    delete iFailedSubTestCaseInfo;
+    iFailedSubTestCaseInfo = NULL;
+    
+    TInt count = iEventArray.Count();
+    TEventIf event( TEventIf::ERelEvent ); 
+    for( TInt i = 0; i < count; i++ )
+        {
+        HBufC* tmp = iEventArray[0];
+        event.SetName( iEventArray[0]->Des() );
+        iEventArray.Remove(0);
+        if( iTestScripter != NULL )
+            {
+            iTestScripter->TestModuleIf().Event( event );
+            }
+        delete tmp;
+        }
+     
+    iTestCaseResults.Reset();
+    iEventArray.ResetAndDestroy();
+    iTestCaseResults.Close();
+    iEventArray.Close();
+
+    delete iSlavesManager;
+    iSlavesManager = NULL;
+    
+    // Reset test case allow result to CTestModuleIf side too. This is
+    // used in TAL-TA5L macro handling.
+    if( iTestScripter != NULL )
+        {
+        User::LeaveIfError( 
+            iTestScripter->TestModuleIf().ResetAllowResult() );
+        }
+        
+    // Stop all remaining interference object
+    TInt count_inter = iTestInterferenceArray.Count();
+    for( TInt a = 0; a < count_inter; a++ )
+        {
+        if( iTestInterferenceArray[a] != NULL )
+            {
+            iTestInterferenceArray[a]->iInterference->Stop();
+            }
+        }
+    iTestInterferenceArray.ResetAndDestroy();
+    iTestInterferenceArray.Close();
+    
+    // Stop all remaining measurement modules
+    const TInt count_meas = iTestMeasurementArray.Count();
+    for( TInt b = 0; b < count_meas; b++ )
+        {
+        if( iTestMeasurementArray[b] != NULL )
+            {
+            iTestMeasurementArray[b]->iMeasurement->Stop();
+            }
+        }
+    iTestMeasurementArray.ResetAndDestroy();
+    iTestMeasurementArray.Close();
+    iPlugins.ResetAndDestroy();
+    iPlugins.Close();
+    iPluginnames.ResetAndDestroy();
+    iPluginnames.Close();
+    iLibrary.Close();
+   
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: RunL
+
+     Description: Derived from CActive, handles testcase execution.
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::RunL()
+    {
+    __TRACEFUNC();
+    __TRACE( KMessage, (_L("CTestRunner::RunL: [%d] "), iStatus.Int() ));
+     
+    if ( iInternalStateForSubTestCases == EISNotStarted )
+        {
+        iInternalStateForSubTestCases = EISRuning;
+        }
+    
+    // Check if we need to Pause test case again  
+    if( iStatus == KErrNone && iRemainingTimeValue > 0 )
+        {           
+        // Maximum time for one RTimer::After request                   
+        TInt maximumTime = KMaxTInt / 1000;                       
+        
+        __TRACE( KMessage, (_L("CTestRunner::RunL: Going to reissue After request ") ) );           
+        __TRACE( KMessage, (_L("CTestRunner::RunL: iRemainingTimeValue = %d"), iRemainingTimeValue ) );        
+        
+        if( iRemainingTimeValue < maximumTime )
+            {                           
+            iPauseTimer.After( iStatus, ( iRemainingTimeValue * 1000  ) );
+            iRemainingTimeValue = 0;
+            }
+        else
+            {            
+            iRemainingTimeValue -= maximumTime;
+            iPauseTimer.After( iStatus, ( maximumTime * 1000 ) );                
+            }     
+        SetActive();
+        }     
+    else    
+        {  
+        TBool continueTask = EFalse;
+
+        User::LeaveIfError( iStatus.Int() );
+
+        if( ( iTestScripter == NULL ) || 
+            ( iTestScripter->iCurrentParser == NULL ) )
+            {
+            __TRACE( KError, (_L("CTestRunner invalid arguments")));
+            User::Leave( KErrGeneral );
+            }
+           
+        iState = ERunnerIdle;
+
+        // Get next execution line from configuration section
+        TPtrC line;
+        // If current parser already has read the first line, then read next line.
+        // Otherwise read the first line.
+        if(iTestScripter->iCurrentParserReadFirstLine && iTestScripter->iCurrentParser->GetNextLine(line) == KErrNone 
+           || !iTestScripter->iCurrentParserReadFirstLine && iTestScripter->iCurrentParser->GetLine(KNullDesC, line) == KErrNone)
+            {
+            iTestScripter->iCurrentParserReadFirstLine = ETrue;
+            
+            // Got new execution line 
+            __TRACE( KMessage, (_L("Executing line [%S]"), &line));
+            
+            CStifItemParser* item = PreprocessLineL( line );
+                
+            CleanupStack::PushL( item ); 
+              
+            TPtrC keyword;
+             // Get first word from line, i.e. keyword
+            User::LeaveIfError( item->GetString( _L(""), keyword ) );
+
+            __TRACE( KMessage, (_L("CTestRunner execute %S"), &keyword ));
+
+            // Execute script line 
+            continueTask = ExecuteLineL( keyword, item );
+            __TRACE( KMessage, (_L("CTestRunner %S executed"), &keyword ));
+                         
+            if( continueTask )
+                {
+                  __TRACE( KMessage, (_L("RunL: continueTask")));
+                 // Set CTestRunner active again to perform 
+                 // next execution line
+                 // from testcase section 
+                SetRunnerActive();
+                }
+
+            CleanupStack::PopAndDestroy( item );
+            }
+        else // Stop execution if end of test case
+            {
+            __TRACE( KMessage, (_L("Executing line: no more lines from this section")));
+            // There is no more lines in current parser, but it needs to be
+            // checked if the parser is not taken for function (sub).
+            // If this is true, then we have to get back to the parser which
+            // has called the function.
+            TInt lastParserIndex = iTestScripter->iParserStack.Count() - 1;
+            if(lastParserIndex >= 0)
+                {
+                // Delete current (the last one) parser
+                delete iTestScripter->iParserStack[lastParserIndex];
+                iTestScripter->iParserStack.Remove(lastParserIndex);
+                if(lastParserIndex >= 1) //There is some other parser on the stack
+                    {
+                    iTestScripter->iCurrentParser = iTestScripter->iParserStack[lastParserIndex - 1];
+                    }
+                else //The parser stack is empty
+                    {
+                    iTestScripter->iCurrentParser = iTestScripter->iSectionParser;
+                    }
+                __TRACE(KMessage, (_L("Returning to calling parser stored on section stack")));
+                
+                // Continue with the test case
+                __TRACE(KMessage, (_L("RunL: continueTask (end of Sub reached)")));
+                SetRunnerActive();
+                return;
+                }
+            // No more execution lines in testcase section
+            // Check if there are running test cases
+            if ( iSubTestCases.Count() > 0 )
+                {
+                if ( iInternalStateForSubTestCases != EISFinishedWaitingForSubTestCases )
+                    {
+                    iInternalStateForSubTestCases = EISFinishedWaitingForSubTestCases;
+                    }
+                // Continue with the test case
+                // proper sub test case runner should activate test runner                 
+                return;
+                }
+            
+            iInternalStateForSubTestCases = EISFinished;
+            
+            
+            // Release remote resources
+            RPointerArray<CSlave>& slaves = iSlavesManager->GetSlaves();
+            
+            while ( slaves.Count() > 0 )
+                {
+                slaves[ 0 ]->WaitForSubTestCasesL();
+            
+                RPointerArray<TEventTS>& slaveEvents = slaves[ 0 ]->GetEvents();
+                for ( TInt k = 0; k < slaveEvents.Count(); k++ )
+                    {
+                    iSlavesManager->EventReleaseL( slaves[ 0 ], slaveEvents[ k ]->Name() );
+                    }
+                slaveEvents.ResetAndDestroy();
+                
+                iSlavesManager->SlaveFreeL( slaves[ 0 ]->GetName() );
+                }
+            
+            __TRACE( KMessage, 
+                (_L("CTestRunner::RunL: Testcase script done") ));
+            iTestScripter->TestModuleIf().Printf( KPrintPriLow, 
+                _L("RunL"), _L("Script done"));
+            
+       
+            __TRACE( KMessage, 
+                (_L("RunL: All TestCases done, stop CActiveScheduler")));
+            CActiveScheduler::Current()->Stop();
+            // Now testcase section is executed, 
+            // so CTestRunner has done its job and stops
+            }
+        }
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: DoCancel
+
+     Description: Derived from CActive handles the Cancel
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::DoCancel()
+    {
+    __TRACEFUNC();
+    __TRACE( KMessage, (_L("CTestRunner::DoCancel")));
+    iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), _L("DoCancel"));
+    
+    iPauseTimer.Cancel();
+   
+    CActiveScheduler::Current()->Stop();
+         
+    iState = ERunnerCancel;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: RunError
+
+     Description: Derived from CActive handles errors from active handler.
+  
+     Parameters:    TInt aError: in: error from CActive
+     
+     Return Values: KErrNone: success
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestRunner::RunError( TInt aError )
+    {
+    __TRACEFUNC();
+    __TRACE( KMessage, (_L("CTestRunner::RunError %d"), aError));
+
+    if ( iRunErrorMessage.Length() != 0 )
+        {
+        iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+                _L("RunError : %S"), &iRunErrorMessage );  
+        iRunErrorMessage = KNullDesC;
+        }
+    else
+        {
+        iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+                _L("RunError"));            
+        }
+
+    iState = ERunnerError;
+    
+    // Return error from here, if none given from execution
+    if( iTestScripter->iResult.iResult == KErrNone )
+        {
+        iTestScripter->UpdateTestCaseResult(aError, _L("CTestRunner::RunError"));
+        }
+        
+    CActiveScheduler::Current()->Stop();
+        
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: GetLogger
+
+     Description: Returns TestScripter logger
+  
+     Parameters: None
+     
+     Return Values: Pointer to TestScripter logger.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStifLogger* CTestRunner::GetLogger()
+    {
+    return iTestScripter->iLog;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: PreprocessLineL
+
+     Description: Preprocesses script line
+  
+     Parameters:  TPtrC& line: in: script line
+                  CStifItemParser*& aItem: out: New CItemParser for script line.
+                    
+     Return Values: HBufC* pointer if new memory that has been allocated
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/        
+CStifItemParser* CTestRunner::PreprocessLineL( TDesC& line )
+    {
+    CStifItemParser* item = NULL;
+    TPtrC tmp;
+    TInt len = 0;
+    TInt ret = 0;
+        
+    // Decide how long buffer should be allocated
+    if( line.Length() < KMaxName/2 )
+        {
+        len = KMaxName;
+        }
+    else 
+        {
+        len = line.Length() + KMaxName;
+        }
+    delete iLine;
+    iLine = 0;
+    iLine = HBufC::NewL(len);
+    TPtr parsedLine(iLine->Des());
+    len = 0;
+    
+    HBufC* sourceLine = line.AllocL();
+    CleanupStack::PushL(sourceLine);
+    
+    //Check for local variable definitions
+    item = CStifItemParser::NewL(sourceLine->Des(), 0, sourceLine->Length());
+    CleanupStack::PushL(item);
+    
+    ret = item->GetString(KNullDesC, tmp);
+    TBool isVarDefinition = (tmp == TTestKeywords::Keyword(TTestKeywords::EVar));
+         
+    if(!isVarDefinition)
+        {
+        while( ret == KErrNone )
+            {
+            len += CheckDefinedLocals(tmp);
+            if((parsedLine.Length() + tmp.Length() + 1) > parsedLine.MaxLength())
+                {
+                // Allocate bigger buffer
+                HBufC* tmpBuf = HBufC::NewL(parsedLine.MaxLength() + KMaxName);
+                CleanupStack::PushL(tmpBuf);
+                TPtrC ptr(iLine->Des());
+                parsedLine.Set(tmpBuf->Des());
+                parsedLine.Copy(ptr);
+                delete iLine;
+                iLine = tmpBuf;
+                CleanupStack::Pop(tmpBuf);
+                } 
+            parsedLine.Append(tmp);        
+            ret = item->GetNextString(tmp);
+            if(ret == KErrNone)
+                {
+                // Add space only if we got new string
+                parsedLine.Append(_L(" "));        
+                }
+            }
+        CleanupStack::PopAndDestroy(item);
+        item = NULL;
+        CleanupStack::PopAndDestroy(sourceLine);
+        sourceLine = NULL;
+        
+        //Prepare data for checking for defines
+        sourceLine = parsedLine.AllocL();
+        CleanupStack::PushL(sourceLine);
+        parsedLine.Zero();
+        
+        item = CStifItemParser::NewL(sourceLine->Des(), 0, sourceLine->Length());
+        CleanupStack::PushL(item);
+    
+        ret = item->GetString(KNullDesC, tmp);
+        }
+
+    //Check for defines
+    while(ret == KErrNone)
+        {
+        if(!isVarDefinition)
+            {
+            len += CheckDefined(tmp);
+            }
+        
+        if((parsedLine.Length() + tmp.Length() + 1) > parsedLine.MaxLength())
+            {
+            // Allocate bigger buffer
+            HBufC* tmpBuf = HBufC::NewL(parsedLine.MaxLength() + KMaxName);
+            CleanupStack::PushL(tmpBuf);
+            TPtrC ptr(iLine->Des());
+            parsedLine.Set(tmpBuf->Des());
+            parsedLine.Copy(ptr);
+            delete iLine;
+            iLine = tmpBuf;
+            CleanupStack::Pop(tmpBuf);
+            } 
+        parsedLine.Append(tmp);        
+        ret = item->GetNextString(tmp);
+        if( ret == KErrNone )
+            {
+            // Add space only if we got new string
+            parsedLine.Append(_L(" "));        
+            }
+        }
+    
+    //Cleaning...
+    CleanupStack::PopAndDestroy(item);
+    item = NULL;
+    CleanupStack::PopAndDestroy(sourceLine);
+    sourceLine = NULL;
+
+    __TRACE(KMessage, (_L("Preprocessed line [%S]"), &parsedLine));
+    item = CStifItemParser::NewL( parsedLine, 0, parsedLine.Length() );
+    
+    return item;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: CheckDefined
+
+     Description: Check if aWord is some defined word
+  
+     Parameters:  TPtrC& aWord: inout: Parsed word, defined or original returned
+                    
+     Return Values: TInt: length diference between new and old word
+     
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/   
+TInt CTestRunner::CheckDefined( TPtrC& aWord )
+    {
+    
+    TInt len = 0;
+    TInt i = 0;
+
+    // KLoopCounter word changing to current loop count value.
+    if( aWord == KLoopCounter )
+        {
+        iLoopCounterDes.Zero();
+        iLoopCounterDes.AppendNum( iLoopCounter );
+        len = iLoopCounterDes.Length() - aWord.Length();
+        aWord.Set( iLoopCounterDes );
+        return len;
+        }
+
+    // First, check values defined in test case file
+    TInt count = iTestScripter->iDefinedRuntime.Count();
+    for( i = 0; i < count; i++ )
+        {
+        if( iTestScripter->iDefinedRuntime[i]->Name() == aWord )
+            { 
+            len = iTestScripter->iDefinedRuntime[i]->Value().Length() - aWord.Length();
+            aWord.Set( iTestScripter->iDefinedRuntime[i]->Value() );
+            return len;
+            }
+        }
+
+    // Second, check values defined in test module initialization file
+    count = iTestScripter->iDefinedIni.Count();
+    for( i = 0; i < count; i++ )
+        {
+        if( iTestScripter->iDefinedIni[i]->Name() == aWord )
+            { 
+            len = iTestScripter->iDefinedIni[i]->Value().Length() - aWord.Length();
+            aWord.Set( iTestScripter->iDefinedIni[i]->Value() );
+            return len;
+            }
+        }
+
+    return len;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: CheckDefinedLocals
+
+     Description: Check if aWord is a local variable
+  
+     Parameters:  TPtrC& aWord: inout: Parsed word, defined or original returned
+                    
+     Return Values: TInt: length diference between new and old word
+     
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/   
+TInt CTestRunner::CheckDefinedLocals( TPtrC& aWord )
+    {
+    
+    TInt len = 0;
+    TInt i = 0;
+
+    TInt count = iTestScripter->iDefinedLocal.Count();
+    for(i = 0; i < count; i++)
+        {
+        if(iTestScripter->iDefinedLocal[i]->Name() == aWord)
+            { 
+            len = iTestScripter->iDefinedLocal[i]->Value().Length() - aWord.Length();
+            aWord.Set(iTestScripter->iDefinedLocal[i]->Value());
+            return len;
+            }
+        }
+
+    return len;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteLineL
+
+     Description: Executes script line
+  
+     Parameters:    TDesC& aKeyword: in: keyword string
+                    CStifItemParser* aItem: in: script line
+                    
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteLineL( TDesC& aKeyword,
+                                 CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgDeleteNoParam, "Delete: Name of object is not defined" );
+    _LIT( KErrMsgDeleteObjNotFound, "Delete: Can't delete object %S. Object does not exists." );
+    _LIT( KErrMsgPauseTimeoutNotDefined, "Pause: No timeout value given or value has invalid format" );
+    _LIT( KErrMsgPauseTimeoutNotPositive, "Pause: Timeout value can't be <0" );
+    _LIT( KErrMsgCreateTestModeleNotDefined, "Create: Name of test module is not defined" );
+    _LIT( KErrMsgCreateObjectIdNotDefined, "Create: Name of test module object is not defined" );
+    _LIT( KErrMsgCreateKernelDriverNotDefined, "CreateKernel: Kernel driver name is not defined" );
+    _LIT( KErrMsgCreateKernelObjectNameNotDefined, "CreateKernel: Kernel driver object name is not defined" );
+    _LIT( KErrMsgCreateKernelFailed, "CreateKernel: Can't creeate kernel driver %S" );
+    _LIT( KErrMsgWaitTestClassNameNotDefined, "WaitTestClass: Test class object name is not defined" );
+    _LIT( KErrMsgWaitTestClassObjNotFound, "WaitTestClass: Test class object %S does not exists" );
+    _LIT( KErrMsgBringToForegroundNotSupported, "BringToForeground: BringToForeground is not supported in non s60 environment" );
+    _LIT( KErrMsgSendToBackgroundNotSupported, "SendToBackground: SendToBackground is not supported in non s60 environment" );    
+    _LIT( KErrMsgPressKeyNotSupported, "PressKey: PressKey is not supported in non s60 environment. Check if .cfg file name contains ui_ prefix and UITestingSupport= YES entry is defined in TestFrameworkd.ini" );
+    _LIT( KErrMsgTypeTextNotSupported, "TypeText: TypeText is not supported in non s60 environment. Check if .cfg file name contains ui_ prefix and UITestingSupport= YES entry is defined in TestFrameworkd.ini" );
+    _LIT( KErrMsgSendPointerEventNotSupported, "SendPointerEvent: SendPointerEvent is not supported in non s60 environment. Check if .cfg file name contains ui_ prefix and UITestingSupport= YES entry is defined in TestFrameworkd.ini" );
+    _LIT( KErrVarNameError, "Variable: Could not get variable name");
+    _LIT( KErrVarValueError, "Variable: Value too long");
+    _LIT( KErrSubNameError, "Sub: Could not get name of Sub to be called");
+    _LIT( KErrSubGetError, "Sub: Could not get Sub section");
+    
+    TPtrC temp;
+    RBuf buf;
+    buf.Create(512);
+    CleanupClosePushL(buf);
+    buf.Append(aKeyword);
+    buf.Append(_L(" "));
+    while(aItem->GetNextString(temp)==KErrNone)
+      {
+      
+      
+        RBuf tempbuf;
+        tempbuf.Create(512);
+        iTestScripter->Substitute(temp,tempbuf);
+        buf.Append(tempbuf);
+        
+        buf.Append(_L(" "));
+        tempbuf.Close();
+      }
+    
+    delete aItem;
+    aItem=NULL;
+    
+    temp.Set((TUint16 *)buf.Ptr(),buf.Length());
+    aItem=CStifItemParser::NewL(temp,0,temp.Length());
+    
+    aItem->GetString(KNullDesC,temp);
+    
+    
+    iRunErrorMessage = KNullDesC;    
+    TBool continueTask = ETrue;
+    
+    TInt key = TTestKeywords::Parse( aKeyword, TTestKeywords::Keyword );
+
+    switch( key )
+        {
+        // Test case execution control cases
+        case TTestKeywords::ECreate:
+        case TTestKeywords::ECreateX:
+        case TTestKeywords::ECreateShareObj:
+            {
+            TPtrC tmp;
+            TName module;
+
+            // Testmodule name
+            TInt ret = aItem->GetNextString( tmp );
+            
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage = KErrMsgCreateTestModeleNotDefined;
+                User::Leave( KErrArgument );
+                }
+            TParse p;
+            p.Set( tmp, NULL, NULL );
+            // Check if exists in module name
+            if( p.ExtPresent() )
+                {
+                module.Copy( tmp );
+                }
+            else 
+                {
+                // No extension in module name, add it here
+                _LIT( KDllExtension, ".dll");
+                module.Copy( tmp );
+                module.Append( KDllExtension );
+                }
+
+            // objectid
+            ret = aItem->GetNextString( tmp );
+            
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage = KErrMsgCreateObjectIdNotDefined;
+                User::Leave( KErrArgument );
+                }        
+
+            __TRACE( KMessage, (_L("%S %S"), &aKeyword, &tmp));
+            iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+                _L("%S %S"), &aKeyword, &tmp);
+
+            if( TTestKeywords::ECreateShareObj == key )
+                {
+                iTestScripter->CreateShareObjectL( module, tmp ); 
+                }
+            else
+                {
+                iTestScripter->CreateObjectL( module, tmp );
+                }
+            }
+            break;        
+        case TTestKeywords::ERestoreShareObj:
+            {
+            TPtrC tmp;
+
+            // objectid
+            TInt ret = aItem->GetNextString( tmp );
+            
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage = KErrMsgCreateObjectIdNotDefined;
+                User::Leave( KErrArgument );
+                }        
+
+            __TRACE( KMessage, (_L("%S %S"), &aKeyword, &tmp));
+            iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+                _L("%S %S"), &aKeyword, &tmp);
+
+          
+            iTestScripter->RestoreShareObjectL( tmp );
+            }
+            break;            
+        case TTestKeywords::ECreateKernel:
+            {
+            TPtrC obj;
+            TPtrC driver;
+
+            // Testdriver name
+            TInt ret = aItem->GetNextString( driver );
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage = KErrMsgCreateKernelDriverNotDefined;
+                User::Leave( ret );
+                }
+
+            // objectid            
+            ret = aItem->GetNextString( obj );
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage = KErrMsgCreateKernelObjectNameNotDefined;
+                User::Leave( ret );
+                }
+
+            __TRACE( KMessage, (_L("%S %S"), &aKeyword, &obj));
+            iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+                _L("%S %S"), &aKeyword, &obj);
+            TInt leaveErr = KErrNone;
+            TRAP( leaveErr, iTestScripter->CreateKernelObjectL( driver, obj ));
+            if ( leaveErr != KErrNone )
+                {
+                iRunErrorMessage.Format( KErrMsgCreateKernelFailed, &driver );
+                User::Leave( leaveErr );
+                }
+            }
+            break;
+        case TTestKeywords::EDelete:
+            {
+            TPtrC tmp;
+            // objectid
+            TInt ret = aItem->GetNextString( tmp );
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage = KErrMsgDeleteNoParam;
+                User::Leave( ret );
+                }
+
+            __TRACE( KMessage, (_L("%S %S"), &aKeyword, &tmp));
+            iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+                _L("%S %S"), &aKeyword, &tmp);
+
+            ret = iTestScripter->DeleteObjectL( tmp );
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage.Format( KErrMsgDeleteObjNotFound, &tmp );
+                User::Leave( ret );
+                }
+            }
+            break;
+        case TTestKeywords::EDeleteShareObj:
+            {
+            TPtrC tmp;
+            // objectid
+            TInt ret = aItem->GetNextString( tmp );
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage = KErrMsgDeleteNoParam;
+                User::Leave( ret );
+                }
+
+            __TRACE( KMessage, (_L("%S %S"), &aKeyword, &tmp));
+            iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+                _L("%S %S"), &aKeyword, &tmp);
+
+            ret = iTestScripter->DeleteScripterObjectL( tmp );
+            if(ret)
+                {
+                iRunErrorMessage.Format( KErrMsgDeleteObjNotFound, &tmp );
+                User::Leave( ret );            
+                }
+            }
+            break;
+        case TTestKeywords::ERun:
+            continueTask = ExecuteRunL( aItem );
+            break;
+        case TTestKeywords::ECancelIfError:
+            iCancelIfError = ETrue;
+            break;            
+        case TTestKeywords::EComplete:
+            continueTask = ExecuteCompleteL( aItem );
+            break;
+        case TTestKeywords::EPauseTest:
+            continueTask = ControlSubTestCaseL( TTestKeywords::EPauseTest, aItem );
+            break;            
+        case TTestKeywords::EResume:            
+            continueTask = ControlSubTestCaseL( TTestKeywords::EResume, aItem );
+            break;
+        case TTestKeywords::ECancel:
+            continueTask = ControlSubTestCaseL( TTestKeywords::ECancel, aItem );
+            break;
+        case TTestKeywords::ERequest:
+        case TTestKeywords::EWait:
+        case TTestKeywords::ERelease:
+        case TTestKeywords::ESet:
+        case TTestKeywords::EUnset:
+            continueTask = ExecuteEventL( aKeyword, aItem );
+            break;
+        case TTestKeywords::EPrint:
+            {
+            __TRACE( KMessage, (_L("%S"), &aKeyword));
+            iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+                _L("%S"), &aKeyword );
+
+            RBuf buf;
+            buf.CreateL(1024);
+            CleanupClosePushL(buf);
+            
+            TPtrC tmp;
+
+            while( aItem->GetNextString( tmp ) == KErrNone )
+                {
+                if( buf.Length() + tmp.Length() >= buf.MaxLength() )
+                    {
+                    buf.ReAllocL(buf.MaxLength() + tmp.Length() * 10);
+                    }
+                buf.Append( tmp );
+                buf.Append( _L(" ") );
+                }
+            
+            iTestScripter->TestModuleIf().Printf( KPrintPriNorm, 
+                _L("Test"), 
+                _L("%S"), &buf);
+            RDebug::Print( _L("Print : Test : %S"), &buf );
+            CleanupStack::PopAndDestroy(&buf);
+            }
+            break;
+        case TTestKeywords::EAllowNextResult:
+            {
+            AddTestCaseResultL( aItem );
+            }
+            break;
+        case TTestKeywords::EExpectedPanic:
+            {
+            AddTestCasePanicL( aItem );
+            }
+            break;            
+        case TTestKeywords::EWaitTestClass:
+            {
+            // Just stop script running, continue event is signaled 
+            // from test class with specified object name
+            TPtrC objectName;
+            // Get Object name
+            TInt ret = aItem->GetNextString( objectName );
+            if ( ret != KErrNone )
+                {
+                iRunErrorMessage = KErrMsgWaitTestClassNameNotDefined;
+                User::Leave( ret );
+                }
+            TTestObjectBase* obj = iTestScripter->GetObject ( objectName );
+            //User::LeaveIfNull( obj );
+            if( obj == NULL )
+                {
+                iRunErrorMessage.Format( KErrMsgWaitTestClassObjNotFound, &objectName );
+                User::Leave( KErrGeneral );
+                }
+            continueTask = obj->Wait();
+            
+            if( continueTask )
+                {
+                // If OOM testing is ongoing ignore result check(given by user)
+                if( !iTestScripter->iOOMIgnoreFailure )
+                    {
+                    if( iTestCaseResults.Count() == 0 )
+                        {
+                        // KErrNone is the default result expected 
+                        // if nothing else is given 
+                        User::LeaveIfError( iTestCaseResults.Append( 
+                                                                KErrNone ) );
+                        }
+                    
+                    if( iTestCaseResults.Find( obj->iAsyncResult ) < 0 ) 
+                        {
+                        __TRACE( KError, ( _L("Command for [%S] failed (%d)"), 
+                                &objectName, obj->iAsyncResult ));
+                        iTestScripter->UpdateTestCaseResult(obj->iAsyncResult, _L("CTestRunner::ExecuteLineL: asynchronous method returned error"));
+                        // Stops execution from CTestRunner::RunError
+                        User::Leave( KErrGeneral );
+                        }
+                    }
+                else
+                    {
+                    __TRACE( KMessage, ( 
+                        _L( "OOM test: 'oomignorefailure' is ON, test case result will reset" ) ) );
+                    }
+
+                iTestCaseResults.Reset();
+                // Reset test case allow result to CTestModuleIf side too. This is
+                // used in TAL-TA5L macro handling.
+                User::LeaveIfError( 
+                    iTestScripter->TestModuleIf().ResetAllowResult() );
+                }
+
+            }
+            break;
+        case TTestKeywords::EPause:
+            {
+            // Maximum time for one RTimer::After request
+            TInt maximumTime = KMaxTInt / 1000;
+            // Set iRemainingTimeValue to zero
+            iRemainingTimeValue = 0;
+
+            TInt timeout;
+            // Read valid results to timeout
+            if( aItem->GetNextInt( timeout ) != KErrNone )
+                {
+                __TRACE( KError, (_L("CTestRunner::ExecuteLineL: No timeout value given for pause")));
+                iRunErrorMessage = KErrMsgPauseTimeoutNotDefined;
+                User::Leave( KErrArgument );
+                }
+
+            // Test case file parsing was success
+
+            __TRACE( KMessage, (_L("CTestRunner::ExecuteLineL: Pause for %d milliseconds"), timeout));
+
+            if( timeout < 0 )
+                {
+                __TRACE( KError, (_L("CTestRunner::ExecuteLineL: Given pause value < 0")));
+                iRunErrorMessage = KErrMsgPauseTimeoutNotPositive;
+                User::Leave( KErrArgument );
+                }
+            else
+                {
+                // Check is pause value suitable for RTimer::After
+                if( timeout < maximumTime )
+                    {
+                    iPauseTimer.After( iStatus, ( timeout * 1000  ) );
+                    }
+                else
+                    {
+                    // Given pause value after multiplication with 1000 is
+                    // larger than KMaxTInt, so we need to split it and 
+                    // re-request After with remaining value from RunL
+
+                    iRemainingTimeValue =  timeout - maximumTime;
+                    iPauseTimer.After( iStatus, maximumTime * 1000 );
+                    }
+
+                SetActive();
+
+                // Stop execution after paused for given timeout
+                continueTask = EFalse;
+                }
+            }
+            break;
+        case TTestKeywords::EAllocate:
+            continueTask = ExecuteAllocateL( aItem );
+            break;
+        case TTestKeywords::EFree:
+            continueTask = ExecuteFreeL( aItem );
+            break;
+        case TTestKeywords::ERemote:
+            continueTask = ExecuteRemoteL( aItem );
+            break;            
+        case TTestKeywords::ELoop:
+            continueTask = ExecuteLoopL( aItem );
+            break;
+        case TTestKeywords::EEndLoop:
+            continueTask = ExecuteEndLoopL( aItem );
+            break;
+        case TTestKeywords::ETimeout:
+        case TTestKeywords::EPriority:
+            // not used here
+            break;
+        case TTestKeywords::EOOMIgnoreFailure:
+            {
+            OOMIgnoreFailureL( aItem );  // Handle parsing
+            break;
+            }
+        case TTestKeywords::EOOMHeapFailNext:
+            {
+            OOMHeapFailNextL( aItem );   // Handle parsing
+            break;
+            }
+        case TTestKeywords::EOOMHeapSetFail:
+            {
+            OOMHeapSetFailL( aItem );    // Handle parsing
+            break;
+            }
+       case TTestKeywords::EOOMHeapToNormal:
+            {
+            // Initialize all OOM related variables back to default.
+            OOMHeapToNormal();
+            __TRACE( KMessage, (
+                _L( "'oomheaptonormal' called, OOM initialization or ending OOM test") ) );
+            break;
+            }
+       case TTestKeywords::ETestInterference:
+            {
+            TestInterferenceL( aItem );  // Handle parsing
+            break;
+            }
+       case TTestKeywords::EMeasurement:
+            {
+            MeasurementL( aItem );      // Handle parsing
+            break;
+            }
+       case TTestKeywords::EAllowErrorCodes:
+            {
+            // Check is KErrNone already appended to iTestCaseResults array.
+            if( iTestCaseResults.Find( KErrNone ) < 0 )
+                {
+                // 'allowerrorcodes' keyword sets KErrNone as a default
+                User::LeaveIfError( iTestCaseResults.Append( KErrNone ) );
+                // Set test case allow result to CTestModuleIf side too. This
+                // is used in TAL-TA5L macro handling.
+                User::LeaveIfError( 
+                    iTestScripter->TestModuleIf().SetAllowResult( KErrNone ) );
+                }
+
+            // Set user given specific error code to be allowed.
+            AddTestCaseResultL( aItem );
+            }
+            break;
+
+       case TTestKeywords::EBringToForeground:
+           {
+           if ( iTestScripter->TestModuleIf().UITesting() == true )
+               {
+               iTestScripter->TestModuleIf().GetUiEnvProxy()->BringToForeground();
+               }
+           else
+               {
+                __TRACE( KError, (_L("ExecuteLineL: Can't execute bringtoforeground in non s60 environment. Check if .cfg file name contains ui_ prefix and UITestingSupport= YES entry is defined in TestFrameworkd.ini")));
+                iRunErrorMessage = KErrMsgBringToForegroundNotSupported;
+                User::Leave( KErrNotSupported );               
+               }
+           }
+            break;
+       case TTestKeywords::ESendToBackground:
+           {
+           if ( iTestScripter->TestModuleIf().UITesting() == true )
+               {
+               iTestScripter->TestModuleIf().GetUiEnvProxy()->SendToBackground();
+               }
+           else
+               {
+                __TRACE( KError, (_L("ExecuteLineL: Can't execute sendtobackground in non s60 environment. Check if .cfg file name contains ui_ prefix and UITestingSupport= YES entry is defined in TestFrameworkd.ini")));
+                iRunErrorMessage = KErrMsgSendToBackgroundNotSupported;
+                User::Leave( KErrNotSupported );               
+               }
+           }
+            break;
+       case TTestKeywords::EPressKey:
+           {
+           if ( iTestScripter->TestModuleIf().UITesting() == true )
+               {
+               continueTask = PressKeyL( aItem );
+               }
+           else
+               {
+               __TRACE( KError, (_L("ExecuteLineL: Can't execute presskey in non s60 environment. Check if .cfg file name contains ui_ prefix and UITestingSupport= YES entry is defined in TestFrameworkd.ini")));
+               iRunErrorMessage = KErrMsgPressKeyNotSupported;
+               User::Leave( KErrNotSupported );            
+               }    
+
+           // Check if it was global or local presskey
+           if ( !continueTask )
+               {
+               // Stop execution after key is pressed and wait until it is handled
+               SetActive();
+               }           
+           }
+            break;
+       case TTestKeywords::ETypeText:
+           {
+           if ( iTestScripter->TestModuleIf().UITesting() == true )
+               {
+               continueTask = TypeTextL( aItem );
+               }
+           else
+               {
+               __TRACE( KError, (_L("ExecuteLineL: Can't execute typetext in non s60 environment. Check if .cfg file name contains ui_ prefix and UITestingSupport= YES entry is defined in TestFrameworkd.ini")));
+               iRunErrorMessage = KErrMsgTypeTextNotSupported;
+               User::Leave( KErrNotSupported );            
+               }
+
+           // Check if it was global or local typetext
+           if ( !continueTask )
+               {
+               // Stop execution after key is pressed and wait until it is handled
+               SetActive();
+               }           
+           }
+            break;
+        case TTestKeywords::EVar:
+            {
+            TName name;
+            TName buf;
+            TPtrC tmp;
+            
+            //Get variable name
+            if(aItem->GetNextString(tmp) == KErrNone)
+                {
+                name.Copy(tmp);
+                }
+            else
+                {
+                //Error when getting variable name
+                __TRACE(KError, (_L("ExecuteLineL: Could not read variable name")));
+                iRunErrorMessage = KErrVarNameError;
+                User::Leave(KErrArgument);                
+                }
+
+            //Get value for variable
+            while(aItem->GetNextString(tmp) == KErrNone)
+                {
+                if(buf.Length() + tmp.Length() >= buf.MaxLength())
+                    {
+                    //Error when getting variable name
+                    __TRACE(KError, (_L("ExecuteLineL: Variable value too long")));
+                    iRunErrorMessage = KErrVarValueError;
+                    User::Leave(KErrArgument);                
+                    }
+                buf.Append(tmp);
+                buf.Append(_L(" "));
+                }
+            //Remove last space
+            if(buf.Length() > 0)
+                {
+                buf.SetLength(buf.Length() - 1);
+                }
+                
+            //Store local variable
+            TInt count = iTestScripter->iDefinedLocal.Count();
+            TInt i;
+            for(i = 0; i < count; i++)
+                {
+                if(iTestScripter->iDefinedLocal[i]->Name() == name)
+                    {
+                    // Update existing
+                    iTestScripter->iDefinedLocal[i]->SetValueL(buf);
+                    __TRACE(KMessage, (_L("Update local variable [%S]: [%S]"), &name, &buf));
+                    break;
+                    }
+                }
+            if(i == count)
+                {
+                // New define, store it
+                CDefinedValue* define = CDefinedValue::NewL(name, buf);
+                CleanupStack::PushL(define);
+                User::LeaveIfError(iTestScripter->iDefinedLocal.Append(define));
+                CleanupStack::Pop(define);
+                __TRACE(KMessage, (_L("Add local variable [%S]: [%S]"), &name, &buf));
+                }
+            }
+            break;
+        case TTestKeywords::ECallSub:
+            {
+            // Get sub name
+            TPtrC subName;
+            
+            //Get sub name
+            TInt err = aItem->GetNextString(subName);
+            if(err != KErrNone)
+                {
+                //Error when getting sub name
+                __TRACE(KError, (_L("ExecuteLineL: Could not read sub name [%d]"), err));
+                iRunErrorMessage = KErrSubNameError;
+                User::Leave(KErrArgument);                
+                }
+            
+            // Load section
+            CStifSectionParser* subSection = NULL;
+            TRAP(err, 
+                 subSection = iTestScripter->GetSubL(subName);
+                );
+            if((err != KErrNone) || (!subSection))
+                {
+                //Error when getting sub name
+                if(err == KErrNone)
+                    {
+                    err = KErrArgument;
+                    }
+                __TRACE(KError, (_L("ExecuteLineL: Could not get section for sub [%d]"), err));
+                iRunErrorMessage = KErrSubGetError;
+                User::Leave(err);                
+                }
+            
+            // Handle new section parser
+            CleanupStack::PushL(subSection);
+            iTestScripter->iParserStack.AppendL(subSection);
+            __TRACE(KMessage, (_L("ExecuteLineL: Section for sub [%S] appended to section stack"), &subName));
+            CleanupStack::Pop(subSection);
+            iTestScripter->iCurrentParser = subSection;
+            iTestScripter->iCurrentParserReadFirstLine = EFalse; //Change it to false, becaue subSection is a new parser and it has nothing read
+            }
+            break;
+        case TTestKeywords::ESetResultDescription:
+            {
+            __TRACE(KMessage, (_L("%S"), &aKeyword));
+            iTestScripter->TestModuleIf().Printf(KPrintPriLow, _L("Runner"), _L("%S"), &aKeyword);
+
+            TName buf;
+            TPtrC tmp;
+
+            while(aItem->GetNextString(tmp) == KErrNone)
+                {
+                if(buf.Length() + tmp.Length() >= buf.MaxLength())
+                    {
+                    break;
+                    }
+                if(buf.Length() > 0)
+                    {
+                    buf.Append(_L(" "));
+                    }
+                buf.Append(tmp);
+                }
+            
+            iTestScripter->SetResultDescription(buf);
+            RDebug::Print( _L("SetDescription to [%S]"), &buf );
+            }
+            break;
+        case TTestKeywords::ESendPointerEvent:
+           {
+           if ( iTestScripter->TestModuleIf().UITesting() == true )
+               {
+               continueTask = SendPointerEventL( aItem );
+               }
+           else
+               {
+               __TRACE( KError, (_L("ExecuteLineL: Can't execute sendpointerevent in non s60 environment. Check if .cfg file name contains ui_ prefix and UITestingSupport= YES entry is defined in TestFrameworkd.ini")));
+               iRunErrorMessage = KErrMsgSendPointerEventNotSupported;
+               User::Leave( KErrNotSupported );            
+               }
+
+           // Check if it was global or local sendpointerevent
+           if ( !continueTask )
+               {
+               // Stop execution after pointer event is send and wait until it is handled
+               SetActive();
+               }           
+           }
+           break;
+        case TTestKeywords::EUsing:
+             {
+             TInt err;
+             TPtrC dll;
+             err=aItem->GetNextString(dll);
+             err=iLibrary.Load(dll);
+           
+             User::LeaveIfError(err);
+             TLibraryFunction LibEntryL=iLibrary.Lookup(1);
+             iPlugins.Append((CStfTestLibPlugin*)LibEntryL());
+             TPtrC temp;
+             err=aItem->GetNextString(temp);
+             HBufC* alias=HBufC::NewL(temp.Length());
+             alias->Des().Copy(temp);
+             iPluginnames.Append(alias);
+           
+             break;
+             }
+        default:
+            {
+            if(ExecuteLibL(aKeyword, aItem))
+                {
+                
+                }
+            else
+                {
+            continueTask = ExecuteCommandL( aKeyword, aItem );
+                }
+            }
+            break;
+        }
+
+    __TRACE( KMessage, (_L("ExecuteLineL: TestCase line executed")));
+    CleanupStack::PopAndDestroy(&buf);
+    return continueTask;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteRunL
+
+     Description: Executes run line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteRunL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgCaseRunError, "Run : %S[case=%d] run error" );
+    __TRACE( KMessage, (_L("Run")));
+    iTestScripter->TestModuleIf().Printf( KPrintPriExec, KExecute, _L("Run"));
+    
+    CStartInfo* startInfo = CStartInfo::NewL();
+    CleanupStack::PushL( startInfo );
+
+    ParseRunParamsL( aItem, *startInfo );
+             
+    // Start new case with configurations parsed above                
+    
+    iRunErrorMessage.Format( KErrMsgCaseRunError, &startInfo->GetModuleName(), startInfo->GetTestCaseNumber() );
+    
+    CSubTestCaseRunner* subTestCaseRunner = CLocalSubTestCaseRunner::NewLC( this );
+
+    __TRACE( KMessage, ( _L( "Executing sub test case: module=%S cfg=%S tcnum=%d id=%S" ),
+         &startInfo->GetModuleName(), &startInfo->GetConfig(), 
+         startInfo->GetTestCaseNumber(), &startInfo->GetTestId()) );
+
+    RDebug::Print( _L( "Executing sub test case: module=%S cfg=%S tcnum=%d id=%S" ),
+            &startInfo->GetModuleName(), &startInfo->GetConfig(), 
+            startInfo->GetTestCaseNumber(), &startInfo->GetTestId() );
+    
+    subTestCaseRunner->RunSubTestCaseL( *startInfo );
+    iSubTestCases.AppendL( subTestCaseRunner );
+    if ( iLoopHelper->LoopInProgress() )
+        {
+        iLoopHelper->RegisterInLoopSubTestCaseL( subTestCaseRunner );
+        }
+    
+    CleanupStack::Pop( subTestCaseRunner );
+    
+    iRunErrorMessage = KNullDesC;
+    
+    CleanupStack::PopAndDestroy( startInfo );
+        
+    return ETrue;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteCompleteL
+
+     Description: Executes complete line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteCompleteL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgTestIdNotDefined, "%S : testid is not defined" );
+    TPtrC testId;
+
+    TInt ret = KErrNone;
+
+    TPtrC keywordStr = TTestKeywords::Keyword( TTestKeywords::EComplete );
+
+    // Parse testid
+    ret = aItem->GetNextString( testId );
+    if( ret != KErrNone )
+        {
+        iRunErrorMessage.Format( KErrMsgTestIdNotDefined, &keywordStr );
+        User::Leave( ret );
+        }
+
+    for ( TInt i = 0; i < iSubTestCases.Count(); i++ )
+        {
+        if ( iSubTestCases[ i ]->GetStartInfo()->GetTestId() == testId )
+            {
+            delete iTestIdForComplete;
+            iTestIdForComplete = testId.AllocL();
+            iInternalStateForSubTestCases = EISWaitingForComplete;
+            return EFalse;
+            }
+        }   
+    
+    return ETrue;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ParseRunParamsL
+
+     Description: Parses run parameters
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CStartInfo& aStartInfo: out: Parsed information
+     
+     Return Values: None
+     
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ParseRunParamsL( CStifItemParser* aItem,
+                                    CStartInfo& aStartInfo )
+    {
+    _LIT( KErrMsgRunTestmoduleNameNotDefined, "Run : Testmodule name is not defined " );
+    _LIT( KErrMsgRunCfgFileNotDefined, "Run : Testmodule configuration file is not defined" );
+    _LIT( KErrMsgRunTestcaseNumberNotDefined, "Run : Testcase number is not defined or has invalid value" );
+    _LIT( KErrMsgRunCfgFileNameToLong, "Run : TestScripter test case file(config)'s name is too long. Current length[%d], allowed max length[%d]. Cannot continue" );
+    _LIT( KErrMsgRunInvalidExpectValue, "Run : Invalid expected result value" );
+    _LIT( KErrMsgRunUnknownOrIllegalCategory, "Run : Unknown or illegal result category" );
+    _LIT( KErrMsgRunInvalidTimeoutValue, "Run: Invalid testcase timeout value" );
+    _LIT( KErrMsgRunUnknowOrIllegalKeyword, "Run: Unknown or illegal keyword %S" );
+    
+    TPtrC tmp;
+    TInt ret = KErrNone;
+
+    // Get mandatory run arguments
+    // Testmodule name
+    ret = aItem->GetNextString( tmp );
+    if ( ret != KErrNone )
+        {
+        iRunErrorMessage = KErrMsgRunTestmoduleNameNotDefined;
+        User::Leave( ret );
+        }
+    
+    aStartInfo.SetModuleNameL( tmp );
+    __TRACE( KMessage, (_L("module: %S"), &aStartInfo.GetModuleName() ));
+    
+    // Configuration file
+    ret = aItem->GetNextString( tmp );
+    if ( ret != KErrNone )
+        {
+        iRunErrorMessage = KErrMsgRunCfgFileNotDefined;
+        User::Leave( ret );
+        }
+    
+    TFileName cfgFileName( tmp );
+    TStifUtil::CorrectFilePathL( cfgFileName );    
+    aStartInfo.SetConfigL( cfgFileName );
+    
+    __TRACE( KMessage, (_L("config: %S"), &aStartInfo.GetConfig() ));
+
+    // Check is TestScripter
+    if( aStartInfo.GetModuleName().Find( KTestScripterName ) != KErrNotFound )
+        {
+        // TestScripter name is format: 'testscripter_testcasefilename'
+
+        TParse parse;
+        parse.Set( aStartInfo.GetConfig(), NULL, NULL );
+
+        // Maximum length of TestScripter's name(Max limitation from
+        // CTestModuleController creation)
+        TInt maximumLength = KMaxName - ( KTestScripterNameLength + 1 );
+
+        TFileName testScripterAndTestCaseFile; // InitL() takes TFileName
+        testScripterAndTestCaseFile.Copy( KTestScripterName );
+        testScripterAndTestCaseFile.Append( _L( "_" ) );
+        if( parse.Name().Length() < maximumLength )
+            {
+            testScripterAndTestCaseFile.Append( parse.Name() );
+            }
+        else
+            {
+            __TRACE( KInit, ( CStifLogger::ERed,
+                _L( "TestScripter test case file(config)'s name is too long. Current length[%d], allowed max length[%d]. Cannot continue" ),
+                parse.Name().Length(), maximumLength ) );
+            iRunErrorMessage.Format( KErrMsgRunCfgFileNameToLong, parse.Name().Length(), maximumLength );
+            User::Leave( KErrArgument );
+            }
+        aStartInfo.SetModuleNameL( testScripterAndTestCaseFile );
+        }
+
+    // Testcase number
+    TInt testCaseNumber;
+    ret = aItem->GetInt( tmp, testCaseNumber );
+    if ( ret != KErrNone )
+        {
+        iRunErrorMessage = KErrMsgRunTestcaseNumberNotDefined;
+        User::Leave( ret );
+        }
+    aStartInfo.SetTestCaseNumber( testCaseNumber );
+    
+    __TRACE( KMessage, (_L("testcasenum: %d"), testCaseNumber ) );
+     
+    // Set mode of item parser to be able to read titles with spaces inside
+    aItem->SetParsingType(CStifItemParser::EQuoteStyleParsing);
+
+    // Get optional run arguments
+    while( aItem->GetNextString( tmp ) == KErrNone )
+        {
+        TPtrC val;   
+        TPtrC arg;
+        ParseOptArgL( tmp, arg, val );
+        CheckDefined( val );
+              
+        // Parse optional argument
+        switch( TTestKeywords::Parse( arg, TTestKeywords::RunOptArg ) )
+            {
+            case TTestKeywords::EExpect:
+                {
+                TLex ptr( val );
+                TInt expectedResult;
+                ret = ptr.Val( expectedResult );
+                if ( ret != KErrNone )
+                    {
+                    iRunErrorMessage = KErrMsgRunInvalidExpectValue;
+                    User::Leave( ret );
+                    }
+                aStartInfo.SetExpectedResult( expectedResult );
+                __TRACE( KMessage, (_L("expect=%d"), expectedResult ));
+                }
+                break;
+            case TTestKeywords::ETestid:
+                {
+                aStartInfo.SetTestIdL( val );
+                __TRACE( KMessage, (_L("TestId=%S"), &val));
+                }
+                break;
+            case TTestKeywords::EIni:
+                {
+                __TRACE( KMessage, (_L("ini=%S"), &val));
+                TFileName iniFileName( val );
+                TStifUtil::CorrectFilePathL( iniFileName );
+                aStartInfo.SetIniFileL( iniFileName );
+                }
+                break;
+            case TTestKeywords::ECategory:
+                {
+                __TRACE( KMessage, (_L("category=%S"), &val));
+                aStartInfo.SetExpectedResultCategory( TTestKeywords::GetResultCategory( val ) );
+                if( aStartInfo.GetExpectedResultCategory() == TFullTestResult::ECaseOngoing )
+                    {
+                    __TRACE( KError, (_L("Unknown or illegal result category")));
+                    //Unknown or illegal category
+                    iRunErrorMessage = KErrMsgRunUnknownOrIllegalCategory;
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                break;
+            case TTestKeywords::ECaseTimeout:
+                {
+                TInt timeout;
+                TLex ptr( val );
+                ret = ptr.Val( timeout );
+                if ( ret != KErrNone )
+                    {
+                    iRunErrorMessage = KErrMsgRunInvalidTimeoutValue;
+                    User::Leave( ret );
+                    }
+                aStartInfo.SetTimeout( timeout );
+                __TRACE( KMessage, (_L("timeout=%d"), timeout ) );
+                }
+                break;
+            case TTestKeywords::ECaseTitle:
+                {
+                __TRACE( KMessage, (_L("case title=%S"), &val));
+                aStartInfo.SetTitleL(val);
+                break;
+                }
+            default:
+                {
+                __TRACE( KError, (_L("Unknown or illegal keyword")));
+                //Unknown or illegal keyword
+                iRunErrorMessage.Format( KErrMsgRunUnknowOrIllegalKeyword, &arg );
+                User::Leave( KErrGeneral );
+                }
+            }
+        }             
+    } 
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ParseOptArgL
+
+     Description: Parses optional argument 
+  
+     Parameters: const TDesC& aOptArg: in: 
+                    argument-value pair (format arg=value)
+                 TPtrC& aArg: out: parsed argument  
+                 TPtrC& aVal: out: parsed value
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if parsing fails.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ParseOptArgL( const TDesC& aOptArg, TPtrC& aArg, TPtrC& aVal)
+    { 
+    _LIT( KErrMsgUnknownOrIllegalKeyword, "Unknown or illegal argument %S" );
+    _LIT( KErrMsgValueNotDefined, "Value of optional argument %S is not defined" );
+    TInt length = aOptArg.Length();
+    for( TInt i=0; i < length; i++) 
+        {
+        // find the '=' sign 
+        if( aOptArg[i] == '=' )
+            {
+            if( i+1 >= length )
+                {
+                __TRACE( KError, 
+                    (_L("Illegal optional argument(%S), no value"), 
+                    &aOptArg ));    
+                TPtrC tmp = aOptArg.Left( i );
+                iRunErrorMessage.Format( KErrMsgValueNotDefined, &tmp );
+                User::Leave( KErrArgument );
+                }
+            aArg.Set( aOptArg.Left( i ) );
+            aVal.Set( aOptArg.Mid( i+1 ) );
+            __TRACE( KMessage, (  _L( "arg '%S', val '%S'" ),
+                &aArg, &aVal ));        
+            return;
+            }
+        }
+    __TRACE( KError, (_L("Illegal optional argument(%S)"), &aOptArg ));    
+    iRunErrorMessage.Format( KErrMsgUnknownOrIllegalKeyword, &aOptArg );
+    User::Leave( KErrArgument );
+    
+    }
+
+TBool CompareTDesC(const TDesC8& aLeft,const TDesC8& aRight)
+{
+    return aLeft.Compare(aRight) == 0 ? ETrue : EFalse;
+    
+}
+
+
+
+/**
+* Executes method call to object script line.
+*/
+TBool CTestRunner::ExecuteLibL( TDesC& lib,
+                      CStifItemParser* aItem )
+{
+    TBool result=EFalse;
+    TIdentityRelation<TDesC8 > relation(CompareTDesC);
+    TInt count=iPluginnames.Count();
+    TInt index;
+    for( index=0;index<count;index++)
+        {
+        HBufC* temp=iPluginnames[index];
+        TPtr tempptr=temp->Des();
+        if(tempptr==lib)
+            {
+            TPtrC partcommand;
+            TBuf<300> commandline;
+            TBuf<100> command;
+            result=ETrue;
+            TInt i=0;
+            while(aItem->GetNextString(partcommand)==KErrNone)
+                {
+                if(i==0)
+                    {
+                    command.Append(partcommand);
+                    }
+                commandline.Append(partcommand);
+                commandline.Append(_L(" "));
+                i++;
+                }
+            commandline.TrimAll();
+            if(iPlugins[index]->IsCommandSupported(command))
+                
+                {
+                iPlugins[index]->ExecuteCommandL(commandline);
+                }
+            break;
+            }
+        }
+    return result;
+}
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: PressKeyL
+
+     Description: Send key press event to AppUi
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::PressKeyL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgSendKeyEventInvalidParameterValue, "PressKey: Invalid parameter %s value " );
+    _LIT( KErrMsgSendKeyEventInvalidParameter, "PressKey: Invalid parameter %s" );    
+    
+    _LIT( KKeyCodeParameter, "keycode=" );
+    _LIT( KKeyScanCodeParameter, "keyscancode=" );
+    _LIT( KModifierParameter, "modifier=" );
+    _LIT( KRepeatsParameter, "repeats=" );
+    
+    _LIT( KModeGlobal, "global" );
+    _LIT( KModeLocal, "local" );
+    
+    TBool globalMode = EFalse;
+    TUint keyCode = 0; 
+    TInt keyScanCode = 0; 
+    TUint keyModifiers = 0; 
+    TInt keyRepeats = 0;
+        
+    TPtrC parameter;
+        
+    CUiEnvProxy* uiEnvProxy = iTestScripter->TestModuleIf().GetUiEnvProxy();
+    
+    while( aItem->GetNextString( parameter ) == KErrNone )
+        {
+        if ( parameter.Find( KKeyCodeParameter ) == 0 )
+            {
+            TPtrC parameterValue = parameter.Right( parameter.Length() - KKeyCodeParameter().Length() );
+            TLex parameterValueParser( parameterValue );
+            if ( parameterValueParser.Val( keyCode ) != KErrNone )
+                {
+                    if ( uiEnvProxy->ParseKeyCode( parameterValue, keyCode ) != KErrNone )
+                        {
+                        __TRACE( KError, (_L("SendKeyEvent: Invalid parameter value")));
+                        TBuf<128> errMsg;
+                        errMsg.Format( KErrMsgSendKeyEventInvalidParameterValue, &KKeyCodeParameter() );
+                        iRunErrorMessage = errMsg;
+                        User::Leave( KErrArgument );                            
+                        }
+                }
+            }
+        else if ( parameter.Find( KKeyScanCodeParameter ) == 0 )
+            {
+            TPtrC parameterValue = parameter.Right( parameter.Length() - KKeyScanCodeParameter().Length() );
+            TLex parameterValueParser( parameterValue );
+            if ( parameterValueParser.Val( keyScanCode ) != KErrNone )
+                {
+                if ( uiEnvProxy->ParseKeyScanCode( parameterValue, keyScanCode ) != KErrNone )
+                    {
+                    __TRACE( KError, (_L("SendKeyEvent: Invalid parameter value")));
+                    TBuf<128> errMsg;
+                    errMsg.Format( KErrMsgSendKeyEventInvalidParameterValue, &KKeyCodeParameter() );
+                    iRunErrorMessage = errMsg;
+                    User::Leave( KErrArgument );                            
+                    }
+                }
+            }
+        else if ( parameter.Find( KModifierParameter ) == 0 )
+            {
+            TPtrC parameterValue = parameter.Right( parameter.Length() - KModifierParameter().Length() );
+            TLex parameterValueParser( parameterValue );
+            if ( parameterValueParser.Val( keyModifiers ) != KErrNone )
+                {
+                if ( uiEnvProxy->ParseModifier( parameterValue, keyModifiers ) != KErrNone )
+                    {
+                    __TRACE( KError, (_L("SendKeyEvent: Invalid parameter value")));
+                    TBuf<128> errMsg;
+                    errMsg.Format( KErrMsgSendKeyEventInvalidParameterValue, &KModifierParameter() );
+                    iRunErrorMessage = errMsg;
+                    User::Leave( KErrArgument );                            
+                    }
+                }
+            }
+        else if ( parameter.Find( KRepeatsParameter ) == 0 )
+            {
+            TPtrC parameterValue = parameter.Right( parameter.Length() - KRepeatsParameter().Length() );
+            TLex parameterValueParser( parameterValue );
+            if ( parameterValueParser.Val( keyRepeats ) != KErrNone )
+                {
+                __TRACE( KError, (_L("SendKeyEvent: Invalid parameter value")));
+                TBuf<128> errMsg;
+                errMsg.Format( KErrMsgSendKeyEventInvalidParameterValue, &KRepeatsParameter() );
+                iRunErrorMessage = errMsg;
+                User::Leave( KErrArgument );                            
+                }
+            }
+        else if ( parameter == KModeGlobal )
+            {
+            globalMode = ETrue;
+            }
+        else if ( parameter == KModeLocal )
+            {
+            globalMode = EFalse;
+            }
+        else if ( uiEnvProxy->ParseKeyCode( parameter, keyCode ) == KErrNone ) 
+            {           
+            }           
+        else if ( parameter.Length() == 1 )
+            {
+            keyCode = parameter[ 0 ];
+            }
+        else
+            {
+            __TRACE( KError, (_L("PressKey: Invalid parameter")));
+            TBuf<128> errMsg;
+            errMsg.Format( KErrMsgSendKeyEventInvalidParameter, &parameter );
+            iRunErrorMessage = errMsg;
+            User::Leave( KErrArgument );            
+            }
+        }
+    
+    if ( globalMode )
+        {
+        uiEnvProxy->PressKeyL( keyCode, keyScanCode, keyModifiers, keyRepeats );            
+        }
+    else
+        {
+        uiEnvProxy->PressKeyL( &iStatus, keyCode, keyScanCode, keyModifiers, keyRepeats );
+        }
+        
+    return globalMode;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: TypeTextL
+
+     Description: Sends text to AppUi
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::TypeTextL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgTypeTextInvalidParameter, "TypeText: Invalid parameter %S" );
+    _LIT( KErrMsgTypeTextNotEnoughParameters, "TypeText: Not enough parameters" );
+    
+    TBool globalMode = EFalse;
+    
+    TPtrC command;
+    TPtrC text;
+    aItem->SetParsingType( CStifItemParser::EQuoteStyleParsing );
+    
+    // Read first parameter
+    TInt ret = aItem->GetNextString( command );
+    
+    if ( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("TypeText: Not enough parameters")));
+        iRunErrorMessage = KErrMsgTypeTextNotEnoughParameters;
+        User::Leave( ret );
+        }
+    
+    // Read second parameter
+    ret = aItem->GetNextString( text );
+    
+    // Check if second can be read. if yes then check if first parameters is
+    // 'global' parameter
+    if ( ret != KErrNone )
+        {
+        // normal type text
+        text.Set( command );
+        iTestScripter->TestModuleIf().GetUiEnvProxy()->TypeTextL( &iStatus, text );
+        globalMode = EFalse;
+        }
+    else if ( command == _L("global") )
+        {
+        iTestScripter->TestModuleIf().GetUiEnvProxy()->TypeTextL( text );
+        globalMode = ETrue;
+        }
+    else
+        {
+        __TRACE( KError, (_L("TypeText: Invalid parameter")));
+        TBuf<128> errMsg;
+        errMsg.Format( KErrMsgTypeTextInvalidParameter, &command );
+        iRunErrorMessage = errMsg;
+        User::Leave( KErrNotSupported );
+        }
+        
+    return globalMode;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: SendPointerEventL
+
+     Description: Send key press event to AppUi
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::SendPointerEventL( CStifItemParser* aItem )
+    {
+    // Error messages
+    _LIT( KErrMsgNotEnoughParameters, "SendPointerEvent: Not enough parameters" );
+    _LIT( KErrMsgPointerEventTypeNotDefined, "SendPointerEvent: Pointer event type not defined" );
+    _LIT( KErrMsgInvalidUnknownPointerEventType, "SendPointerEvent: Invalid/Unknown pointer event type %S" );
+    _LIT( KErrMsgPositionXNotDefined, "SendPointerEvent: x co-ordinate is not defined" );
+    _LIT( KErrMsgPositionYNotDefined, "SendPointerEvent: y co-ordinate is not defined" );
+    _LIT( KErrMsgPositionXInvalidValue, "SendPointerEvent: Invalid value of x co-ordinate" );
+    _LIT( KErrMsgPositionYInvalidValue, "SendPointerEvent: Invalid value of y co-ordinate" );
+
+    // Parameters keywords
+    _LIT( KModeGlobal, "global" );
+    _LIT( KModeLocal, "local" );
+    
+    TBool globalMode = EFalse;
+    TUint eventType = 0; 
+    TPoint position( 0, 0 );
+    TPoint parentPosition( 0, 0 );
+        
+    TPtrC parameter;
+
+    CUiEnvProxy* uiEnvProxy = iTestScripter->TestModuleIf().GetUiEnvProxy();
+
+    // Get first parameter
+    if ( aItem->GetNextString( parameter ) != KErrNone )
+        {
+        __TRACE( KError, (_L("SendPointerEvent: Not enough parameters")));
+        iRunErrorMessage = KErrMsgNotEnoughParameters;
+        User::Leave( KErrArgument );            
+        }
+    else
+        {
+        TBool modeSelected = EFalse;
+        // Check if global/local mode is defined
+        if ( parameter == KModeLocal )
+            {
+            globalMode = false;
+            modeSelected = ETrue;
+            }
+        else if ( parameter == KModeGlobal )
+            {
+            globalMode = true;
+            modeSelected = ETrue;
+            }
+        
+        if ( modeSelected )
+            {
+            // First parameter was mode so we need get next parameter which should 
+            // contain event type
+            if ( aItem->GetNextString( parameter ) != KErrNone )
+                {
+                __TRACE( KError, (_L("SendPointerEvent: Pointer event type not defined")));
+                iRunErrorMessage = KErrMsgPointerEventTypeNotDefined;
+                User::Leave( KErrArgument );            
+                }
+            }
+        }
+    
+    // Parse event type
+    if ( uiEnvProxy->ParsePointerEventType( parameter, eventType ) != KErrNone )
+        {
+        __TRACE( KError, (_L("PressKey: Invalid/Unknown pointer event type %S"), &parameter ));
+        iRunErrorMessage.Format( KErrMsgInvalidUnknownPointerEventType, &parameter );
+        User::Leave( KErrArgument );            
+        }
+    
+    if ( aItem->GetNextString( parameter ) != KErrNone )
+        {
+        __TRACE( KError, (_L("SendPointerEvent: x co-ordinate is not defined")));
+        iRunErrorMessage = KErrMsgPositionXNotDefined;
+        User::Leave( KErrArgument );            
+        }
+
+    TLex parameterParser( parameter );
+    if ( parameterParser.Val( position.iX ) != KErrNone )
+        {
+        __TRACE( KError, (_L("SendPointerEvent: Invalid value of x co-ordinate")));
+        iRunErrorMessage = KErrMsgPositionXInvalidValue;
+        User::Leave( KErrArgument );            
+        }
+
+    if ( aItem->GetNextString( parameter ) != KErrNone )
+        {
+        __TRACE( KError, (_L("SendPointerEvent: y co-ordinate is not defined")));
+        iRunErrorMessage = KErrMsgPositionYNotDefined;
+        User::Leave( KErrArgument );            
+        }
+
+    parameterParser.Assign( parameter );
+    if ( parameterParser.Val( position.iY ) != KErrNone )
+        {
+        __TRACE( KError, (_L("SendPointerEvent: Invalid value of y co-ordinate")));
+        iRunErrorMessage = KErrMsgPositionYInvalidValue;
+        User::Leave( KErrArgument );            
+        }       
+        
+    // Send pointer event
+    if ( globalMode )
+        {
+        uiEnvProxy->SendPointerEventL( eventType, position );           
+        }
+    else
+        {
+        uiEnvProxy->SendPointerEventL( &iStatus, eventType, position );
+        }
+
+    return globalMode;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteEventL
+
+     Description: Executes event command script line
+  
+     Parameters:    TDesC& aKeyword: in: keyword string
+                    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteEventL( TDesC& aKeyword,
+                                  CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgEventNameNotDefined, "%S : Event name not defined" );
+    _LIT( KErrMsgUnknowKeyword, "Unknow keyword %S" );
+    
+    TInt ret = KErrNone;
+    TInt key = TTestKeywords::Parse( aKeyword, TTestKeywords::Keyword );
+    TBool continueTask = ETrue;
+     
+    TPtrC eventName;
+    // read eventname
+    ret = aItem->GetNextString( eventName );
+    if ( ret != KErrNone )
+        {
+        iRunErrorMessage.Format( KErrMsgEventNameNotDefined, &aKeyword );
+        User::Leave( ret );
+        }
+    
+    TEventIf event;
+    event.SetName( eventName );
+    
+    __TRACE( KMessage, (_L("%S %S"), &aKeyword, &eventName));
+    iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Event"), 
+        _L("%S %S"), &aKeyword, &eventName);
+
+    switch( key )
+        {
+        case TTestKeywords::ERequest:
+            {
+            HBufC* eName = eventName.AllocLC();
+            User::LeaveIfError( iEventArray.Append( eName ) );
+            CleanupStack::Pop( eName );
+            event.SetType( TEventIf::EReqEvent );
+            ret = iTestScripter->TestModuleIf().Event( event );
+            }
+            break;
+        case TTestKeywords::EWait:
+            {
+            event.SetType( TEventIf::EWaitEvent );
+            iTestScripter->TestModuleIf().Event( event, iStatus );
+            SetActive();
+            continueTask = EFalse;
+            }
+            break;
+        case TTestKeywords::ERelease:
+            {
+            event.SetType( TEventIf::ERelEvent );
+            ret = iTestScripter->TestModuleIf().Event( event );
+            if( ret == KErrNone )
+                {
+                TPtrC eName;
+                TInt count = iEventArray.Count();
+                for( TInt i = 0; i < count; i++ )
+                    {
+                    eName.Set( iEventArray[i]->Des() );
+                    if( eName == eventName )
+                        {
+                        HBufC* tmp = iEventArray[i];
+                        iEventArray.Remove(i);
+                        delete tmp;
+                        break;
+                        }
+                    }
+                }
+            }
+            break;
+        case TTestKeywords::ESet:
+            {
+            event.SetType( TEventIf::ESetEvent );
+            
+            TPtrC tmp;
+            // Get optional set argument
+            if( aItem->GetNextString( tmp ) == KErrNone )
+                {                      
+                // Parse optional set argument
+                if( tmp == _L("state") )
+                    {
+                    __TRACE( KMessage, (_L("State event")));
+                    event.SetEventType( TEventIf::EState );
+                    }
+                else
+                    {
+                    __TRACE( KError, 
+                        (_L("Unknown argument for set %S"), 
+                        &tmp));
+                    }
+                }      
+            
+            ret = iTestScripter->TestModuleIf().Event( event );
+            }
+            break;
+        case TTestKeywords::EUnset:
+            {
+            event.SetType( TEventIf::EUnsetEvent );
+            event.SetEventType( TEventIf::EState );
+            ret = iTestScripter->TestModuleIf().Event( event );
+            }
+            break;
+        default:
+            __TRACE( KError, (_L("Unknown keyword %S"), &aKeyword));
+            iRunErrorMessage.Format( KErrMsgUnknowKeyword, &aKeyword );
+            User::Leave( KErrGeneral );
+            break;
+        }
+    if( ret != KErrNone )
+        {
+        TName resultDescr;
+        resultDescr.Format(_L("Event %S returned error: %d"), &aKeyword, ret);
+        iTestScripter->UpdateTestCaseResult(ret, resultDescr);
+        // Stops execution from CTestRunner::RunError
+        User::Leave( KErrGeneral );
+        }
+
+    return continueTask;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteCommandL
+
+     Description: Executes script line
+
+     Parameters:    TDesC& aObject: in: object name 
+                    CStifItemParser* aItem: in: script line
+
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteCommandL( TDesC& aObject, CStifItemParser* aItem)
+    {
+    _LIT( KErrMsgUnknownObjOrKeyword, "Unknow keyword/object %S" );
+    
+   
+    TTestObjectBase* obj = iTestScripter->GetObject ( aObject );    
+    if( obj == NULL )
+        {
+        iRunErrorMessage.Format( KErrMsgUnknownObjOrKeyword, &aObject );
+        User::Leave( KErrGeneral );
+        }
+
+    if( iTestCaseResults.Count() == 0 )
+        {
+        // KErrNone is the default result expected if nothing else is given 
+        User::LeaveIfError( iTestCaseResults.Append( KErrNone ) );
+        }
+
+    // OOM heap testing with FAILNEXT
+    if( iHeapFailNext > 0 )
+        {
+        __TRACE( KPrint, ( 
+            _L( "OOM FAILNEXT is used with count value: %d " ),
+            iHeapFailNext) );
+        User::__DbgSetAllocFail( RHeap::EUser, RHeap::EFailNext, iHeapFailNext  );
+        }
+    // OOM heap testing with SETFAIL
+    if( iHeapSetFailValue > 0 )
+        {
+        __TRACE( KPrint, (
+            _L("OOM SETFAIL is used with type:[%d] and value(rate):[%d]"),
+            iHeapSetFailType, iHeapSetFailValue ) );
+        User::__DbgSetAllocFail( RHeap::EUser, iHeapSetFailType, iHeapSetFailValue );
+        }
+
+    TInt commandResult = KErrNone;
+    TRAP( commandResult, commandResult = obj->RunMethodL( *aItem ) );
+
+    
+    // Reset OOM macro immediately(Otherwise other allocations
+    // will be blocked)
+    User::__DbgSetAllocFail( RHeap::EUser, RHeap::ENone, 1 );
+
+    // OOM test class's build block handling
+    if( iTestScripter->iOOMIgnoreFailure )
+        {
+        __TRACE( KPrint, ( 
+            _L( "----------< OOM related test information >----------" ) ) );
+        if( iHeapFailNext > 0 )
+            {
+            __TRACE( KPrint, ( 
+                _L( "'oomignorefailure' is:[ON] and 'failnextvalue' count is:[%d]" ),
+                iHeapFailNext ) );
+            }
+        if( iHeapSetFailValue > 0 )
+            {
+            __TRACE( KPrint, ( 
+                _L( "'oomignorefailure' is:[ON], 'setfailtype' type is:[%d] and value is:[%d]" ),
+                iHeapSetFailType, iHeapSetFailValue ) );
+            }
+        __TRACE( KPrint, ( 
+            _L( "Test class build block execution with result:[%d]" ),
+            commandResult ) );
+        __TRACE( KPrint, ( 
+            _L( "----------------------------------------------------" ) ) );
+
+        // Continue testing, despite the memory error situations
+        iTestCaseResults.Reset();
+        return ETrue; // Continue script executions
+        }
+
+    // Normal test class's build block handling
+    if( iTestCaseResults.Find( commandResult ) < 0 ) 
+        {
+        __TRACE( KError, ( _L("Command for [%S] failed (%d)"), 
+                &aObject, commandResult ));
+
+        // Added more logging for this special case
+        if( commandResult == KErrNone )
+            {
+            __TRACE( KError, (_L("Test fails with result KErrGeneral, because execution result was KErrNone and expected results given with 'allownextresult' were Symbian's error codes (<0)")));    
+            }
+           
+        iTestScripter->UpdateTestCaseResult(commandResult, _L("CTestRunner::ExecuteCommandL returned error"));
+
+        // Stops execution from CTestRunner::RunError
+        User::Leave( KErrGeneral );
+        }
+        
+    iTestCaseResults.Reset();
+    // Reset test case allow result to CTestModuleIf side too. This is
+    // used in TAL-TA5L macro handling.
+    User::LeaveIfError( 
+        iTestScripter->TestModuleIf().ResetAllowResult() );
+        
+    return ETrue;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: SetRunnerActive
+
+     Description: Set CTestRunner active and complete.
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::SetRunnerActive()
+     {
+     __TRACEFUNC();
+     // Update state
+     iState = ERunnerRunning;
+
+     iStatus = KRequestPending;
+     TRequestStatus* rs = &iStatus;
+     SetActive();
+     User::RequestComplete( rs, KErrNone );
+
+     }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: OOMIgnoreFailure
+
+     Description: Handles 'oomignorefailure' keyword parsing.
+  
+     Parameters: CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::OOMIgnoreFailureL( CStifItemParser* aItem )
+    {
+    _LIT( KerrMsgOOMIgnoreFailureUnknownArgument, "OOMIgnoreFailure : Invalid argument %S" );
+    _LIT( KerrMsgOOMIgnoreFailureNoArgument, "OOMIgnoreFailure : Parameter not defined" );
+    
+    __TRACEFUNC();
+
+    TPtrC tmp;
+    // Get result
+    if( aItem->GetNextString( tmp ) == KErrNone )
+        {                      
+        if( tmp == _L("ON") || tmp == _L("on") )
+            {
+            __TRACE( KMessage, (_L("OOM related 'oomignorefailure': ON")));
+            iTestScripter->iOOMIgnoreFailure = ETrue;
+            }
+        else if( tmp == _L("OFF") || tmp == _L("off") )
+            {
+            __TRACE( KMessage, (_L("OOM related 'oomignorefailure': OFF")));
+            iTestScripter->iOOMIgnoreFailure = EFalse;
+            }
+        else
+            {
+            __TRACE( KError, 
+                (_L("Unknown argument for 'oomignorefailure': [%S]"), 
+                &tmp));
+            iRunErrorMessage.Format( KerrMsgOOMIgnoreFailureUnknownArgument, &tmp );
+            User::Leave( KErrArgument );
+            }
+        }
+    else
+        {
+        __TRACE( KError, ( _L( "Unknown argument for 'oomignorefailure'" ) ) );
+        iRunErrorMessage = KerrMsgOOMIgnoreFailureNoArgument;
+        User::Leave( KErrArgument );
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: OOMHeapFailNext
+
+     Description: Handles 'oomheapfailnext' keyword parsing.
+  
+     Parameters: CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::OOMHeapFailNextL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgHeapFailNextNoArgument, "HeapFailNext : Parameters is not defined or has invalid value" );
+    _LIT( KErrMsgHeapFailNextInvalidValue, "HeapFailNext : Argument value can't be <0" );
+    __TRACEFUNC();
+
+    TInt heapfailNext( 0 );
+    // If LOOP_COUNTER is used the GetNextInt returns a correct
+    // value(Because of the LOOP_COUNTER implementation).
+    if( aItem->GetNextInt( heapfailNext ) == KErrNone )
+        {
+        if( heapfailNext < 0 )
+            {
+            __TRACE( KError, ( _L( "Argument value must be >0" ) ) );
+            iRunErrorMessage = KErrMsgHeapFailNextInvalidValue;
+            User::Leave( KErrArgument );            
+            }
+        // OOM heap's FAILNEXT range is from 1 to n
+        iHeapFailNext = heapfailNext + 1;
+        __TRACE( KMessage, ( _L( "'oomheapfailnext' count value(rate): %d" ),
+            iHeapFailNext ) );
+        }
+    else
+        {
+        __TRACE( KError, ( _L( "Unknown argument for 'oomheapfailnext'" ) ) );
+        iRunErrorMessage = KErrMsgHeapFailNextNoArgument;
+        User::Leave( KErrArgument );
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: OOMHeapSetFail
+
+     Description: Handles 'oomheapsetfail' keyword parsing.
+  
+     Parameters: CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::OOMHeapSetFailL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgOOMHeapSetFailTypeNotDefined, "OOMHeapSetFail : Parameter type is not defined" );
+    _LIT( KErrMsgOOMHeapSetFailRateNotDefined, "OOMHeapSetFail : Parameter rate is not defined" );
+    _LIT( KErrMsgOOMHeapSetFailTypeInvalidValue, "OOMHeapSetFail : Parameter type has invalid value" );
+    _LIT( KErrMsgOOMHeapSetFailRateInvalidValue, "OOMHeapSetFail : Parameter rate can't be <0" );
+    __TRACEFUNC();
+    
+    _LIT( KRandom,        "random");
+    _LIT( KTrueRandom,    "truerandom");
+    _LIT( KDeterministic, "deterministic");
+    _LIT( KNone,          "none");
+    _LIT( KFailNext,      "failnext");
+
+    TPtrC type;
+    TInt value( 0 );
+
+    // NOTE: If error in type or value parsing => return without changing
+    //       iHeapSetFailType or iHeapSetFailValue variables.
+
+    // Get type
+    if( aItem->GetNextString( type ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'oomheapsetfail' type" ) ) );
+        iRunErrorMessage = KErrMsgOOMHeapSetFailTypeNotDefined;
+        User::Leave( KErrArgument );
+        }
+    // Get value(rate)
+    if( aItem->GetNextInt( value ) != KErrNone )
+        {
+        if(type == KNone)
+            {
+            value = 0;
+            }
+        else
+            {
+            __TRACE( KError, (_L( "Unknown argument for 'oomheapsetfail' value(rate)" ) ) );
+            iRunErrorMessage = KErrMsgOOMHeapSetFailRateNotDefined;
+            User::Leave( KErrArgument );
+            }
+        }
+    
+    // All parsing operations are passed, get type and value
+
+    // Get type
+    if(type == KRandom)
+        {
+        __TRACE( KMessage, (_L("'oomheapsetfail' type: random")));
+        iHeapSetFailType = RHeap::ERandom;
+        }
+    else if(type == KTrueRandom)
+        {
+        __TRACE( KMessage, (_L("'oomheapsetfail' type: truerandom")));
+        iHeapSetFailType = RHeap::ETrueRandom;
+        }
+    else if(type == KDeterministic)
+        {
+        __TRACE( KMessage, (_L("'oomheapsetfail' type: deterministic")));
+        iHeapSetFailType = RHeap::EDeterministic;
+        }
+    else if(type == KNone)
+        {
+        __TRACE( KMessage, (_L("'oomheapsetfail' type: none")));
+        iHeapSetFailType = RHeap::ENone;
+        }
+    else if(type == KFailNext)
+        {
+        __TRACE( KMessage, (_L("'oomheapsetfail' type: failnext")));
+        iHeapSetFailType = RHeap::EFailNext;
+        }
+    else
+        {
+        __TRACE( KError, 
+            ( _L( "Unknown argument for 'oomheapsetfail' type: [%S]" ),
+            &type ) );
+        iRunErrorMessage = KErrMsgOOMHeapSetFailTypeInvalidValue;
+        User::Leave( KErrArgument );
+        }
+
+    if( value < 0 )
+        {
+        __TRACE( KError, _L( "'oomheapsetfail' value(rate) can't be <0" ) );                
+        iRunErrorMessage = KErrMsgOOMHeapSetFailRateInvalidValue;
+        User::Leave( KErrArgument );
+        }
+    // Get value
+    // OOM heap's SETFAIL range is from 1 to n
+    iHeapSetFailValue = value + 1;
+    __TRACE(KMessage, (_L( "'oomheapsetfail' value(rate): [%d]" ), iHeapSetFailValue));
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: OOMHeapToNormal
+
+     Description: Initialize all OOM related variables.
+  
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::OOMHeapToNormal()
+    {
+    __TRACEFUNC();
+
+    if( iTestScripter )
+        {
+        // This should initialize also
+        iTestScripter->iOOMIgnoreFailure = EFalse;
+        }
+
+    iHeapFailNext = 0;
+    iHeapSetFailType = RHeap::ENone;
+    iHeapSetFailValue = 0;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: TestInterference
+
+     Description: Starts test interference.
+  
+     Parameters: CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::TestInterferenceL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgTestInterferenceNameNotDefined, "TestInterference : Parameter name is not defined" );
+    _LIT( KErrMsgTestInterferenceCommandNotDefined, "TestInterference : Parameter command is not defined" );
+    _LIT( KErrMsgTestInterferenceCommandInvalidValue, "TestInterference : Parameter command has invalid value" );
+    __TRACEFUNC();
+    TPtrC name;
+    TPtrC command;
+
+    // Get name
+    if( aItem->GetNextString( name ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' name" ) ) );
+        iRunErrorMessage = KErrMsgTestInterferenceNameNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+    // Get command
+    if( aItem->GetNextString( command ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' command" ) ) );
+        iRunErrorMessage = KErrMsgTestInterferenceCommandNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+
+    if( command == _L( "start" ) )
+        {
+        __TRACE( KMessage, ( _L( "'testinterference' called, starts test interference") ) );
+        StartInterferenceL( name, aItem );
+        }
+    else if( command == _L( "stop" ) )
+        {
+        __TRACE( KMessage, ( _L( "'testinterference' called, stops and releases test interference") ) );
+        StopInterferenceL( name );
+        }
+    else
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown command for 'testinterference'[%S]" ), &command ) );
+        iRunErrorMessage = KErrMsgTestInterferenceCommandInvalidValue;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: StartInterference
+
+     Description: 
+  
+     Parameters: CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::StartInterferenceL( TDesC& aName, CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgStartInterferenceCategoryNotDefined, "TestInterference : Parameter category is not defined" );
+    _LIT( KErrMsgStartInterferenceCategoryInvalidValue, "TestInterference : Parameter category has invalid value" );
+    _LIT( KErrMsgStartInterferenceTypeNotDefined, "TestInterference : Parameter type is not defined" );
+    _LIT( KErrMsgStartInterferenceTypeInvalidValue, "TestInterference : Parameter type has invalid value" );
+    _LIT( KErrMsgStartInterferenceIdleNotDefined, "TestInterference : Parameter idle is not defined or has invalid value" );
+    _LIT( KErrMsgStartInterferenceIdleInvalidValue, "TestInterference : Parameter idle has invalid value" );
+    _LIT( KErrMsgStartInterferenceActiveNotDefined, "TestInterference : Parameter active is not defined or has invalid value" );
+    _LIT( KErrMsgStartInterferenceActiveInvalidValue, "TestInterference : Parameter active has invalid value" );
+    
+    __TRACEFUNC();
+    TPtrC category;
+    TPtrC type;
+    TInt idle( 0 );
+    TInt active( 0 );
+    TInt priority( 0 );
+
+    // Get category
+    if( aItem->GetNextString( category ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' category" ) ) );
+        iRunErrorMessage = KErrMsgStartInterferenceCategoryNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+    // Get type
+    if( aItem->GetNextString( type ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' type" ) ) );
+        iRunErrorMessage = KErrMsgStartInterferenceTypeNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+
+    TPtrC timeStr;
+    TReal time;
+    // Get idle time
+    if( aItem->GetNextString( timeStr ) != KErrNone )
+        {        
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' idle" ) ) );
+        iRunErrorMessage = KErrMsgStartInterferenceIdleNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+    if ( TLex( timeStr ).Val( time, '.' ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' idle" ) ) );
+        iRunErrorMessage = KErrMsgStartInterferenceIdleNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave       
+        }
+    // Convert idle time from milli to micro seconds
+    idle = time * 1000.0;
+
+    if( idle < 0 )
+        {
+        __TRACE( KError, ( 
+                _L( "Argument 'testinterference' idle can't be <0" ) ) );
+        iRunErrorMessage = KErrMsgStartInterferenceIdleInvalidValue;
+        User::Leave( KErrArgument );
+        }
+   // Get active time
+    if( aItem->GetNextString( timeStr ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' active" ) ) );
+        iRunErrorMessage = KErrMsgStartInterferenceActiveNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+    if ( TLex( timeStr ).Val( time, '.' ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' idle" ) ) );
+        iRunErrorMessage = KErrMsgStartInterferenceIdleNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave       
+        }
+    
+    // Convert active time from milli to micro seconds
+    active = time * 1000.0;
+    
+    if( active < 0 )
+        {
+        __TRACE( KError, ( 
+                _L( "Argument 'testinterference' active can't be <0" ) ) );
+        iRunErrorMessage = KErrMsgStartInterferenceActiveInvalidValue;
+        User::Leave( KErrArgument );
+        }
+    
+   // Get priority
+    if( aItem->GetNextInt( priority ) != KErrNone )
+        {
+        // Log information only do not return. Priority value is optional.
+        __TRACE( KInit, ( 
+            _L( "Unknown argument for 'testinterference' priority or value not given, default priority will be used" ) ) );
+        }    
+
+    MSTIFTestInterference* interference = NULL;
+
+    // Get category
+    if( category == _L("activeobject") )
+        {
+        interference = MSTIFTestInterference::NewL( iTestScripter,
+                            MSTIFTestInterference::EActiveObject );
+        }
+    else if( category == _L("thread") )
+        {
+        interference = MSTIFTestInterference::NewL( iTestScripter,
+                            MSTIFTestInterference::EThread );
+        }
+    else
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' category[%S]" ), &category ) );
+        iRunErrorMessage = KErrMsgStartInterferenceCategoryInvalidValue;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+
+    // Create object that include test interference information and append this
+    // to array.
+    TTestInterference* object = new (ELeave) TTestInterference();
+    object->iName = aName;
+    object->iInterference = interference;
+
+    // Array for handling test interference between different objects
+    TInt ret = iTestInterferenceArray.Append( object );
+    if( ret != KErrNone )
+        {
+        delete object;
+        __TRACE( KError, ( 
+            _L( "CTestRunner::StartInterference: iTestInterferenceArray.Append fails:[%d]" ), ret ) );
+        User::Leave( ret );
+        }
+
+    // Set priority if user given
+    if( priority != 0 )
+        {
+        interference->SetPriority( priority );
+        }
+
+    // Get type
+    if( type == _L("cpuload") )
+        {
+        interference->StartL( MSTIFTestInterference::ECpuLoadMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemreadc") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemReadCMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemreadd") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemReadDMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemreade") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemReadEMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemreadz") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemReadZMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemwritec") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemWriteCMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemwrited") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemWriteDMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemwritee") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemWriteEMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemfillandemptyc") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemFillAndEmptyCMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemfillandemptyd") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemFillAndEmptyDMicroSeconds, idle , active );
+        }
+    else if( type == _L("filesystemfillandemptye") )
+        {
+        interference->StartL( MSTIFTestInterference::EFileSystemFillAndEmptyEMicroSeconds, idle , active );
+        }
+    else
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'testinterference' type[%S]" ), &type ) );
+        iRunErrorMessage = KErrMsgStartInterferenceTypeInvalidValue;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: StopInterference
+
+     Description: Stops test interference.
+  
+     Parameters: TDesC& aName: in: Indicates right test interference object.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::StopInterferenceL( TDesC& aName )
+    {    
+    _LIT( KErrMsgStopInterference, "TestInterference : testinterference %S was not start" );
+    __TRACEFUNC();
+    
+    TInt count = iTestInterferenceArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iTestInterferenceArray[i]->iName == aName )
+            {
+            // Found test module, return description
+            iTestInterferenceArray[i]->iInterference->Stop();
+            // Delete data
+            delete iTestInterferenceArray[i];
+            // Remove pointer to deleted data(Append())
+            iTestInterferenceArray.Remove( i );
+            // iTestMeasurementArray can contain only one type of measurement
+            // so we can break when type is removed.
+            return;
+            }
+        }
+    __TRACE( KError, ( 
+            _L( "'testinterference' type[%S] was not start" ), &aName ) );
+    iRunErrorMessage.Format( KErrMsgStopInterference, &aName );
+    User::Leave( KErrArgument ); // Error in parsing => Leave
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: MeasurementL
+
+     Description: Starts test measurement.
+  
+     Parameters: CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if StartBappeaMeasurementL() fails.
+                        Leaves if StopBappeaMeasurementL() fails.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::MeasurementL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgMeasurementCommandNotDefined, "TestMeasurement : Parameter command is not defined" );
+    _LIT( KErrMsgMeasurementTypeNotDefined, "TestMeasurement : Parameter type is not defined" );
+    _LIT( KErrMsgMeasurementUnknownType, "TestMeasurement : Unknown measurement type %S" );
+    _LIT( KErrMsgMeasurementUnknownCommand, "TestMeasurement : Unknown command %S" );
+    __TRACEFUNC();
+    TPtrC type;
+    TPtrC command;
+
+    // Get command
+    if( aItem->GetNextString( command ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'measurement' command" ) ) );
+        iRunErrorMessage = KErrMsgMeasurementCommandNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+    // Get name
+    if( aItem->GetNextString( type ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'measurement' type" ) ) );
+        iRunErrorMessage = KErrMsgMeasurementTypeNotDefined;
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+
+    // Verify measurement type
+    if( !( type == KParamMeasurement01 ||
+                type == KParamMeasurement02 ||
+                type == KParamMeasurement03 ||
+                type == KParamMeasurement04 ||
+                type == KParamMeasurement05 ||
+                type == KParamMeasurementBappea ) )
+
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown measurement type:[%S]" ), &type ) );
+        iRunErrorMessage.Format( KErrMsgMeasurementUnknownType, &type );
+        User::Leave( KErrArgument ); // Error in types => Leave
+        }
+
+    // Verify command
+   if( command == _L( "start" ) )
+        {
+        // START measurement's process
+        __TRACE( KMessage, ( _L( "Start 'measurement' with '%S'"), &type ) );
+        StartMeasurementL( type, aItem );
+        }
+    else if( command == _L( "stop" ) )
+        {
+        // STOP measurement's process
+        __TRACE( KMessage, ( _L( "'Stop 'measurement' with '%S'"), &type ) );
+        StopMeasurementL( type );
+        }
+    else
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown command for 'measurement' command:[%S] or type:[%S]" ), &command, &type ) );
+        iRunErrorMessage.Format( KErrMsgMeasurementUnknownCommand, &command );
+        User::Leave( KErrArgument ); // Error in commands => Leave
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: StartMeasurementL
+
+     Description: Start measurement
+  
+     Parameters: const TDesC& aType: in: Plugin type.
+                 CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves is measurement operation fails.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::StartMeasurementL( const TDesC& aType,
+                                           CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgMeasurementUnknownPlugin, "Measurement : Unknown measurement plugin %S" );
+    _LIT( KErrMsgMeasurementStartFail, "Measurement : Measurement start fails" );
+    __TRACEFUNC();
+
+    CSTIFTestMeasurement* testMeasurement = NULL;
+
+    // Get Measurement configuration info
+    TPtrC configurationInfo( KNullDesC() );
+    if( aItem->Remainder( configurationInfo ) != KErrNone )
+        {
+        __TRACE( KInit, ( 
+            _L( "Using default path and file name for measurement configure" ) ) );
+        } 
+
+    if( aType == KParamMeasurement01 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    iTestScripter, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin01,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurement02 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    iTestScripter, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin02,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurement03 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    iTestScripter, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin03,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurement04 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    iTestScripter, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin04,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurement05 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    iTestScripter, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin05,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurementBappea )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    iTestScripter, 
+                    CSTIFTestMeasurement::KStifMeasurementBappeaProfiler,
+                    configurationInfo );
+        }
+    else
+        {
+        __TRACE( KError, ( _L( "Unknown plugin[%S] for 'measurement'" ), &aType ) );
+        iRunErrorMessage.Format( KErrMsgMeasurementUnknownPlugin, &aType );        
+        User::Leave( KErrArgument );
+        }
+
+    // Start test measurement
+    TInt start_ret( KErrNone );
+    start_ret = testMeasurement->Start();
+    if( start_ret != KErrNone )
+        {
+        delete testMeasurement;
+        //CleanupStack::PopAndDestroy( setting_buf );
+        __TRACE( KError, ( 
+            _L( "CTestRunner::StartMeasurementL(): Measurement Start() fails:[%d]" ), start_ret ) );
+        iRunErrorMessage = KErrMsgMeasurementStartFail;
+        User::Leave( start_ret );
+        }
+
+    TTestMeasurement* object = new (ELeave) TTestMeasurement();
+    object->iName = aType;
+    object->iMeasurement = testMeasurement;
+
+    // Array for handling test measurement between different objects
+    TInt ret = iTestMeasurementArray.Append( object );
+    if( ret != KErrNone )
+        {
+        delete object;
+        __TRACE( KError, ( 
+            _L( "CTestRunner::StartMeasurementL(): iTestMeasurementArray.Append fails:[%d]" ), ret ) );
+        User::Leave( ret );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: StopMeasurementL
+
+     Description: Stops test measurement.
+  
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::StopMeasurementL( const TDesC& aType )
+    {
+    _LIT( KErrMsgMeasurementNotStarted, "Measurement : Measurement %S was not start" );
+    __TRACEFUNC();
+
+    TInt count = iTestMeasurementArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iTestMeasurementArray[i]->iName == aType )
+            {
+            // Found measurement module, stop
+            iTestMeasurementArray[i]->iMeasurement->Stop();
+            // Delete data
+            delete iTestMeasurementArray[i];
+            // Remove pointer to deleted data(Append())
+            iTestMeasurementArray.Remove( i );
+            // iTestMeasurementArray can contain only one type of measurement
+            // so we can break when type is removed.
+            return;
+            }
+        }
+
+    __TRACE( KError, ( 
+            _L( "CTestRunner::StopMeasurementL(): Measurement %S was not start" ), &aType ) );
+    iRunErrorMessage.Format( KErrMsgMeasurementNotStarted, &aType  );
+    User::Leave( KErrArgument );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: AddTestCaseResultL
+
+     Description: Adds new test case result. Used with 'allownextresult'
+                  and 'allowerrorcodes' keywords.
+  
+     Parameters: CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if iTestCaseResults.Append fails.
+                        Leaves if aItem->GetNextInt() fails.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::AddTestCaseResultL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgAllowNextResultInvalidValue, "No expected result value given or value has invalid format" );
+    TInt result;
+
+    TPtrC codeBuf;
+    TBool found = EFalse;
+    while( aItem->GetNextString( codeBuf ) == KErrNone )
+        {
+        TLex codeParser( codeBuf );
+        if ( codeParser.Val( result ) != KErrNone )
+            {
+            __TRACE( KError, (_L("ExecuteLineL: No expected result value given")));
+            iRunErrorMessage = KErrMsgAllowNextResultInvalidValue;
+            User::Leave( KErrArgument );            
+            }
+        else
+            {
+            User::LeaveIfError( iTestCaseResults.Append( result ) );
+            // Set test case allow result to CTestModuleIf side too. This is
+            // used in TAL-TA5L macro handling.
+            User::LeaveIfError( 
+                iTestScripter->TestModuleIf().SetAllowResult( result ) );
+            found = ETrue;
+            }
+        }
+
+    if ( !found )
+        {
+        __TRACE( KError, (_L("ExecuteLineL: No expected result value given")));
+        iRunErrorMessage = KErrMsgAllowNextResultInvalidValue;
+        User::Leave( KErrArgument );
+        }    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: AddTestCasePanicL
+
+     Description: Adds new test case result. Used with 'allowpanic'
+                  and 'allowerrorcodes' keywords.
+  
+     Parameters: CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if iTestCaseResults.Append fails.
+                        Leaves if aItem->GetNextInt() fails.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+
+void CTestRunner::AddTestCasePanicL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgAllowNextPanicInvalidValue, "No expected panic value given or value has invalid format" );
+    TInt panic;
+
+    TPtrC codeBuf;
+    while( aItem->GetNextString( codeBuf ) == KErrNone )
+        {
+        TLex codeParser( codeBuf );
+        if ( codeParser.Val( panic ) != KErrNone )
+            {
+            __TRACE( KError, (_L("ExecuteLineL: No expected panic value given")));
+            iRunErrorMessage = KErrMsgAllowNextPanicInvalidValue;
+            User::Leave( KErrArgument );            
+            }
+        else
+            {
+            //do not add panic result to allowed result of case.
+            //User::LeaveIfError( iTestCaseResults.Append( panic ) );
+            // Set test case allow result to CTestModuleIf side too. This is
+            // used in TAL-TA5L macro handling.
+            iTestScripter->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, panic );
+            break;
+            }
+        }  
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: SubTestCaseFinishedL
+
+     Description: Recieves and handles notification about finished sub test 
+     \            case execution.
+  
+     Parameters:    CSubTestCaseRunner* aSubTestCaseRunner: in: sub test case
+                         runner used to run test case.
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::SubTestCaseFinishedL( CSubTestCaseRunner* aSubTestCaseRunner )
+    {
+    if ( iInternalStateForSubTestCases == EISFinished )
+        {
+        if ( aSubTestCaseRunner->GetTestCaseResult().iCaseExecutionResultCode == KErrCancel )
+            {
+            // Test was canceled. Do nothing.
+            return;
+            }
+        else
+            {
+            User::Leave( KErrGeneral );
+            }
+        }
+    
+    TInt index = iSubTestCases.Find( aSubTestCaseRunner );
+    if ( index < 0 )
+        {
+        // Debug info
+        return;
+        }
+    
+    CSubTestCaseRunner* subTestCaseRunner = iSubTestCases[ index ];
+    iSubTestCases.Remove( index );
+    CleanupStack::PushL( subTestCaseRunner );
+    
+    TInt runResult = subTestCaseRunner->GetRunResult();
+    TFullTestResult testCaseResult = subTestCaseRunner->GetTestCaseResult();
+    const CStartInfo* startInfo = subTestCaseRunner->GetStartInfo();
+
+    __TRACE( KMessage, ( _L( "Sub test case execution finished: module=%S cfg=%S tcnum=%d id=%S" ),
+         &startInfo->GetModuleName(), &startInfo->GetConfig(), 
+         startInfo->GetTestCaseNumber(), &startInfo->GetTestId()) );
+
+    __TRACE( KMessage, ( _L( "Sub test case execution result: execution_result=%d, test_result=%d, des=%S" ),
+         testCaseResult.iCaseExecutionResultCode, testCaseResult.iTestResult.iResult,
+         &testCaseResult.iTestResult.iResultDes ) );
+
+    RDebug::Print( _L( "Sub test case execution finished: module=%S cfg=%S tcnum=%d id=%S" ),
+            &startInfo->GetModuleName(), &startInfo->GetConfig(), 
+            startInfo->GetTestCaseNumber(), &startInfo->GetTestId() );
+
+    RDebug::Print( _L( "Sub test case execution result: execution_result=%d, test_result=%d, des=%S" ),
+            testCaseResult.iCaseExecutionResultCode, testCaseResult.iTestResult.iResult,
+            &testCaseResult.iTestResult.iResultDes );
+    
+    // Check expected execution result type
+    TBool reportFailedSubTestCase = EFalse;
+    if( testCaseResult.iCaseExecutionResultType != startInfo->GetExpectedResultCategory() ) 
+        {
+        reportFailedSubTestCase = true;
+        }
+    else
+        {
+        if( startInfo->GetExpectedResultCategory() == TFullTestResult::ECaseExecuted )
+            {
+            if ( startInfo->GetExpectedResult() != testCaseResult.iTestResult.iResult )
+                {
+                reportFailedSubTestCase = true;
+                }
+            }
+        else
+            {
+            if ( startInfo->GetExpectedResult() != testCaseResult.iCaseExecutionResultCode )
+                {
+                reportFailedSubTestCase = true;
+                }
+            }
+        }    
+
+    if ( reportFailedSubTestCase )
+        {
+        // Only remember first failed sub test case
+        if ( iFailedSubTestCaseReported == EFalse )
+            {
+            // If passlimit is enabled and loop is in progress ignore sub test case fail. 
+            // Fail will be reported only if passlimit is not met.
+            // It is done in ReportLoopEndResultL
+            if ( !( iLoopHelper->LoopInProgress() && iPasslimitEnabled ) || iCancelIfError )
+                {
+                iFailedSubTestCaseReported = true;
+                iFailedSubTestCaseResult = testCaseResult;
+                iFailedSubTestCaseInfo = CStartInfo::NewL();
+                iFailedSubTestCaseInfo->CopyL( *startInfo );
+                }
+            }
+        }
+    
+    switch( iInternalStateForSubTestCases )
+        {
+        case EISRuning:
+            // Do noting
+            if ( iLoopHelper->LoopInProgress() )
+                {
+                iLoopHelper->NotifySubTestCaseEndL( subTestCaseRunner, !reportFailedSubTestCase );
+                }
+            break;
+        case EISWaitingForComplete:
+            if ( iLoopHelper->LoopInProgress() )
+                {
+                iLoopHelper->NotifySubTestCaseEndL( subTestCaseRunner, !reportFailedSubTestCase );
+                }
+            // Do noting
+            if ( subTestCaseRunner->GetStartInfo()->GetTestId() == *iTestIdForComplete )
+                {
+                delete iTestIdForComplete;
+                iTestIdForComplete = NULL;
+                SetRunnerActive(); // Continue test case execution after complete
+                iInternalStateForSubTestCases = EISRuning;
+                }
+            break;
+        case EISFinishedWaitingForSubTestCases:
+            if ( iSubTestCases.Count() <= 0 )
+                {
+                SetRunnerActive();
+                }
+            break;
+        default:
+            break;
+        }
+
+    CleanupStack::PopAndDestroy( subTestCaseRunner );
+    
+    if ( iCancelIfError && iFailedSubTestCaseReported )
+        {
+        // Make sure that DoCancel will be executed 
+        if ( !IsActive() )
+            {
+            SetRunnerActive();
+            }
+        // Stop Test Case execution
+        Cancel();
+        }    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ReportLoopEndResultL
+
+     Description: Recives report from CLoopHelper about result of loop execution
+  
+     Parameters: TInt aPassedIterations: in: number of passed loop iterations
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ReportLoopEndResultL( TInt aPassedIterations )
+    {
+    //If passlimit was given and number of passed test is less then expected, stop execution of scripter's test case
+    if( iPasslimitEnabled && ( aPassedIterations < iPasslimit ) )
+        {
+        __TRACE( KMessage, ( _L( "Loop has failed (passlimit). Finishing with KErrCompletion." ) ) );
+        iTestScripter->iPassLimitNotMet = ETrue;
+        iTestScripter->iResult.iResult = KErrCompletion;
+        iTestScripter->iResult.iResultDes = _L("Loop has not reached passlimit requirement.");
+        Cancel();
+        }
+    else if( iPasslimitEnabled && ( aPassedIterations >= iPasslimit ) )
+        {
+        __TRACE( KMessage, ( _L( "Loop has passed (passlimit)" ) ) );
+        }
+
+    iPasslimit = 0;
+    iPasslimitEnabled = EFalse;    
+    }
+
+void CTestRunner::ReleaseRemoteResourcesAllocatedInLoopL()
+    {
+    RPointerArray<CSlave>& inLoopSlaves = iLoopHelper->GetRegisteredInLoopSlaves();
+    
+    for ( TInt i = 0; i < inLoopSlaves.Count(); i++ )
+        {
+        inLoopSlaves[ i ]->WaitForSubTestCasesL();
+    
+        RPointerArray<TEventTS>& slaveEvents = inLoopSlaves[ i ]->GetEvents();
+        for ( TInt k = 0; k < slaveEvents.Count(); k++ )
+            {
+            iSlavesManager->EventReleaseL( inLoopSlaves[ i ], slaveEvents[ k ]->Name() );
+            }
+        slaveEvents.ResetAndDestroy();
+        
+        iSlavesManager->SlaveFreeL( inLoopSlaves[ i ]->GetName() );
+        }
+    
+    inLoopSlaves.Reset();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: IsFailedSubTestCaseReported
+
+     Description: Gets information if there was reported executed sub test 
+                  case which failed.
+  
+     Parameters:    None
+     
+     Return Values: ETrue: test case was reported
+                    EFalse: test case was not reported
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::IsFailedSubTestCaseReported() const
+    {
+    return iFailedSubTestCaseReported;
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: GetFailedSubTestCaseResult
+
+     Description: Returns first failed sub test case result.
+  
+     Parameters:    None
+     
+     Return Values: First failed sub test case result.
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TFullTestResult CTestRunner::GetFailedSubTestCaseResult() const
+    {
+    return iFailedSubTestCaseResult;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: GetFailedSubTestCaseInfo
+
+     Description: Returns first failed sub test case info.
+  
+     Parameters:    None
+     
+     Return Values: First failed sub test case info.
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+const CStartInfo* CTestRunner::GetFailedSubTestCaseInfo() const
+    {
+    return iFailedSubTestCaseInfo;
+    }
+
+void CTestRunner::HandleRemoteReceiveError( TInt aError, const TDesC& aErrorDescription )
+    {
+    iTestScripter->UpdateTestCaseResult( aError, aErrorDescription );
+    CActiveScheduler::Current()->Stop();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ControlSubTestCaseL
+
+     Description: Controls sub test case execution
+  
+     Parameters:    Sub test case id
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ControlSubTestCaseL( TTestKeywords::TKeywords aOperation, CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgInvalidTestId, "testid is not specified or it has invalid value" );
+    _LIT( KErrMsgUnknownCall, "Unknown operation call on sub test case" );
+    
+    TPtrC subTestId;
+    TInt ret = aItem->GetNextString( subTestId );
+    if ( ret != KErrNone )
+        {
+        iRunErrorMessage = KErrMsgInvalidTestId;
+        User::Leave( KErrArgument );
+        }
+    
+    TInt subTestCasesCount = iSubTestCases.Count();
+    for ( TInt i = 0; i < subTestCasesCount; i++ )
+        {
+        if ( iSubTestCases[ i ]->GetStartInfo()->GetTestId() == subTestId )
+            {
+            switch ( aOperation )
+                {
+                case TTestKeywords::EPauseTest:
+                    {
+                    __TRACE( KMessage, ( _L( "Pause sub test case testid=%S" ), &subTestId ) );
+                    iSubTestCases[ i ]->PauseSubTestCaseL();
+                    }
+                    break;
+                case TTestKeywords::EResume:
+                    {
+                    __TRACE( KMessage, ( _L( "Reasume sub test case testid=%S" ), &subTestId ) );
+                    iSubTestCases[ i ]->ResumeSubTestCaseL();
+                    }
+                    break;
+                case TTestKeywords::ECancel:
+                    {
+                    __TRACE( KMessage, ( _L( "Cancel sub test case testid=%S" ), &subTestId ) );
+                    CSubTestCaseRunner* subTestCaseRunner = iSubTestCases[ i ];
+                    subTestCaseRunner->CancelSubTestCaseL();
+                    if ( subTestCaseRunner->GetType() == CSubTestCaseRunner::ESTTRemote )
+                        {
+                        CRemoteSubTestCaseRunner* remoteSubTestCaseRunner = 
+                                (CRemoteSubTestCaseRunner*)subTestCaseRunner;
+                        CSlave* slave = remoteSubTestCaseRunner->GetSlave();
+                        slave->UnregisterSubTestCaseL( remoteSubTestCaseRunner );
+                        }
+                    if ( iLoopHelper->LoopInProgress() )
+                        {
+                        iLoopHelper->UnregisterInLoopSubTestCaseL( subTestCaseRunner );
+                        }
+                    delete iSubTestCases[ i ];
+                    iSubTestCases.Remove( i );
+                    }
+                    break;
+                default:
+                    {
+                    iRunErrorMessage = KErrMsgUnknownCall;
+                    User::Leave( KErrArgument );
+                    }
+                    break;
+                }
+            
+            return true;
+            }
+        }
+    
+    __TRACE( KMessage, ( _L( "Sub test case testid=%S not found" ), &subTestId ) );
+    RDebug::Print( _L( "Sub test case testid=%S not found" ), &subTestId );
+
+    return true;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteLoopL
+
+     Description: Executes loop keyword
+  
+     Parameters: CStifItemParser* aItem: in: script line
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteLoopL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgLoopNested, "Loop: Nested loop are not supported" );
+    _LIT( KErrMsgLoopNoParam, "Loop: No loop iterations count given or value has invalid format" );
+    _LIT( KErrMsgLoopInvalidParam, "Loop: Loop count must be >0" );
+    _LIT( KErrMsgLoopUnknownUnexpectedOption, "Loop: Unknown or unexpected loop option");
+    _LIT( KErrMsgLoopPasslimitInvalidValue, "Loop: No passlimit value given for loop or value has invalid format" );
+    _LIT( KErrMsgLoopPasslimitNotInRange, "Loop: Passlimit value is lower than 0 or higher than loop count" );
+    
+    if( iLoopTimes > 0 )
+        {
+        __TRACE( KError, (_L("ExecuteLineL: Nested loop are not supported")));
+        iRunErrorMessage = KErrMsgLoopNested;
+        User::Leave( KErrNotSupported );
+        }
+    
+    iLoopTimes = 0;
+    iLoopCounter = 0;
+    iTimedLoop = EFalse;
+    
+    if( aItem->GetNextInt( iLoopTimes ) != KErrNone )
+        {
+        __TRACE( KError, (_L("ExecuteLineL: No loop count value given for loop")));
+        iRunErrorMessage = KErrMsgLoopNoParam;
+        User::Leave( KErrArgument );
+        }
+    
+    if( iLoopTimes < 1 )
+        {
+        __TRACE( KError, (_L("ExecuteLineL: Loop count must be >0")));
+        iRunErrorMessage = KErrMsgLoopInvalidParam;
+        User::Leave( KErrArgument );
+        }
+    
+    __TRACE( KMessage, (_L("ExecuteLineL: Loop for %d times" ), iLoopTimes ) );
+    
+    //Check loop options
+    TPtrC option;
+    TInt ret = aItem->GetNextString(option);
+    if(ret == KErrNone)
+        {
+        if(option.Compare(_L("msec")) == 0) //time loop option
+            {
+            iTimedLoop = ETrue;
+            iStartTime.HomeTime();
+            iExpectedLoopTime = TInt64(iLoopTimes) * TInt64(1000); //convert to micro seconds
+            __TRACE(KMessage, (_L("ExecuteLineL: Timed loop for %d msec" ), iLoopTimes));
+            
+            ret = aItem->GetNextString(option); //Get next option
+            }
+        }
+        
+    if(ret == KErrNone)
+        {
+        if(option.Compare(_L("passlimit")) == 0) //passlimit option
+            {
+            iPasslimit = 0;
+            if( aItem->GetNextInt( iPasslimit ) != KErrNone )
+                {
+                __TRACE( KError, ( _L( "ExecuteLoopL: No passlimit value given for loop." ) ) );
+                iRunErrorMessage = KErrMsgLoopPasslimitInvalidValue;
+                User::Leave( KErrArgument );
+                }
+            __TRACE( KMessage, ( _L( "ExecuteLoopL: Passlimit set on %d" ), iPasslimit ) );
+            //Check if passlimit has valid value
+            if(iPasslimit < 0 || (iPasslimit > iLoopTimes && !iTimedLoop))
+                {
+                __TRACE( KError, ( _L( "ExecuteLoopL: Passlimit value is lower than 0 or higher than loop count." ) ) );
+                iRunErrorMessage = KErrMsgLoopPasslimitNotInRange;
+                User::Leave( KErrArgument );
+                }
+            iPasslimitEnabled = ETrue;
+
+            ret = aItem->GetNextString(option); //Get next option
+            }
+        }    
+    
+    if(ret == KErrNone)
+        {
+        __TRACE( KError, (_L("ExecuteLineL: Unknown or unexpected loop option [%S]"), &option));
+        iRunErrorMessage = KErrMsgLoopUnknownUnexpectedOption;
+        User::Leave( KErrNotSupported );
+        }
+    
+    iLoopStartPos = iTestScripter->iCurrentParser->GetPosition();
+    
+    iLoopHelper->LoopStartL();
+    
+    return ETrue;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteEndLoopL
+
+     Description: Executes endloop keyword
+  
+     Parameters: CStifItemParser* aItem: in: script line
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteEndLoopL( CStifItemParser* /*aItem*/ )
+    {
+    _LIT( KErrMsgEndLoopNotOpened, "Endloop: Can't execute endloop. No opened loop exists" );
+
+    if( iLoopTimes == 0 )
+        {
+        __TRACE( KError, (_L("ExecuteLineL: Can't execute endloop. No opened loop exists")));
+        iRunErrorMessage = KErrMsgEndLoopNotOpened;
+        User::Leave( KErrNotFound );
+        }
+    
+    iLoopCounter++;
+    __TRACE( KMessage, 
+        (_L("ExecuteLineL: Loop executed for %d times" ), 
+            iLoopCounter ) );
+
+    TTime currTime;
+    currTime.HomeTime();
+    
+    if(((!iTimedLoop) && (iLoopCounter < iLoopTimes)) //Normal loop
+       ||
+       iTimedLoop && (currTime.MicroSecondsFrom(iStartTime) < iExpectedLoopTime)) //Timed loop
+        {
+        // Go to beginning of the loop
+        User::LeaveIfError(
+            iTestScripter->iCurrentParser->SetPosition( iLoopStartPos ));
+        iLoopHelper->IterationEndStartNextIterationL();
+        }
+    else
+        {            
+        // End looping
+        iLoopCounter = 0;
+        iLoopTimes = 0;
+        iLoopStartPos = 0;
+        
+        iLoopHelper->LoopEndL();
+        }
+    
+    // iLoopHelper will activate runner in proper moment
+    return EFalse;
+    }
+
+TBool CTestRunner::ExecuteAllocateL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgAllocateSlaveTypeNotDefined, "Allocate : Slave type was not given for allocate" );
+    _LIT( KErrMsgAllocateSlaveNameNotDefined, "Allocate : Slave name is not defined" );
+    _LIT( KErrMsgAllocateSlaveAlreadyAllocated, "Allocate : Slave with name %S already allocated" );
+    __TRACE( KMessage, (_L("Allocate")));
+       
+    TPtrC type;
+    TPtrC name;
+    // Get slave type
+    TInt ret = aItem->GetNextString( type );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave type was not given for allocate")));
+        iRunErrorMessage = KErrMsgAllocateSlaveTypeNotDefined;
+        User::Leave( KErrArgument );
+        }
+    
+    // Get slave name
+    ret = aItem->GetNextString( name );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave name was not given for allocate")));
+        iRunErrorMessage = KErrMsgAllocateSlaveNameNotDefined;
+        User::Leave( KErrArgument );
+        }
+
+    iTestScripter->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+        _L("Allocate %S"), &name );
+        
+    __TRACE( KMessage, (_L("Allocate %S [name: %S]"), &type, &name));
+    
+    if( iSlavesManager->GetSlave( name ) )
+        {
+        __TRACE( KError, (_L("Slave with name %S already allocated"), 
+            &name ) );
+        iRunErrorMessage.Format( KErrMsgAllocateSlaveAlreadyAllocated, &name );
+        User::Leave( KErrAlreadyExists );
+        } 
+
+    iSlavesManager->SlaveAllocateL( name, type );
+    
+    if ( iLoopHelper->LoopInProgress() )
+        {
+        CSlave* slave = iSlavesManager->GetSlave( name );
+        iLoopHelper->RegisterInLoopSlaveL( slave );
+        }
+    
+    return ETrue;    
+    }
+
+TBool CTestRunner::ExecuteFreeL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgFreeSlaveNameNotDefined, "Free : Slave name is not defined" );
+    _LIT( KErrMsgFreeSlaveNotFound, "Free : Slave %S not found" );
+    __TRACE( KMessage, (_L("Free")));
+    
+    TPtrC name;    
+    // Get slave name
+    TInt ret = aItem->GetNextString( name );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave name was not given for free")));
+        iRunErrorMessage = KErrMsgFreeSlaveNameNotDefined;
+        User::Leave( KErrArgument );
+        }
+
+    iTestScripter->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+        _L("Free %S"), &name );
+        
+    __TRACE( KMessage, (_L("Free %S"), &name ) );
+    
+    CSlave* slave = iSlavesManager->GetSlave( name );
+    if( slave == NULL )
+        {
+        __TRACE( KError, (_L("Slave %S not found"), &name ));
+        iRunErrorMessage.Format( KErrMsgFreeSlaveNotFound, &name );
+        User::Leave( KErrNotFound );
+        }
+    
+    if ( iLoopHelper->LoopInProgress() )
+        {        
+        iLoopHelper->UnregisterInLoopSlaveL( slave );
+        }
+    
+    if ( slave->HasRunningTestCases() )
+        {
+        slave->WaitForSubTestCasesL();
+        }
+    
+    iSlavesManager->SlaveFreeL( name );
+    
+    return ETrue;
+    }
+
+TBool CTestRunner::ExecuteRemoteL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgRemoteSlaveNameNotDefined, "Remote : Slave name is not defined" );
+    _LIT( KErrMsgRemoteSlaveNotFound, "Remore : Slave %S not found" );
+    _LIT( KErrMsgRemoteCommandNotDefined, "Slave command name was not given for remote" );
+
+    TPtrC name;
+    TPtrC command;    
+    
+    // Get slave name
+    TInt ret = aItem->GetNextString( name );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave name was not given for remote")));
+        iRunErrorMessage = KErrMsgRemoteSlaveNameNotDefined;
+        User::Leave( KErrArgument );
+        }
+        
+    __TRACE( KMessage, (_L("Remote command to %S"), &name));
+    
+    CSlave* slave = iSlavesManager->GetSlave( name );
+    if( slave == NULL )
+        {
+        __TRACE( KError, (_L("Slave %S not found"), &name ));
+        iRunErrorMessage.Format( KErrMsgRemoteSlaveNotFound, &name );
+        User::Leave( KErrArgument );
+        }
+        
+    // Get remote command name
+    ret = aItem->GetNextString( command );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave command name was not given for remote")));
+        iRunErrorMessage = KErrMsgRemoteCommandNotDefined;
+        User::Leave( KErrArgument );
+        }
+
+    iTestScripter->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+        _L("remote %S %S"), &name, &command );
+
+    __TRACE( KPrint, (_L("remote %S %S"), &name, &command ) );
+
+    // Parse command name
+    TInt key = TTestKeywords::Parse( command, TTestKeywords::Keyword );    
+    TBool continueTask = ETrue;
+    
+    switch( key )
+        {
+        // Test case starting
+        case TTestKeywords::ERun:
+            continueTask = ExecuteRemoteRunL( aItem, slave );
+            break;
+                   
+        // Event control cases
+        case TTestKeywords::ERequest:
+        case TTestKeywords::EWait:
+        case TTestKeywords::ERelease:
+        case TTestKeywords::ESet:
+        case TTestKeywords::EUnset:
+            continueTask = ExecuteRemoteEventCtlL( aItem, slave, key );
+            break;
+        // asynchronous 'sendreceive'
+        case TTestKeywords::ESendReceive:
+            continueTask = ExecuteRemoteSendReceiveL( aItem, slave );
+            break;
+
+        default:
+            // Some unknown remote command, forward as such 
+            continueTask = ExecuteRemoteUnknownL( aItem, slave, command );
+            break;
+        }
+    
+    return continueTask;    
+    }
+
+
+TBool CTestRunner::ExecuteRemoteRunL( CStifItemParser* aItem, CSlave* aSlave,
+                         HBufC *aSetUnsetEvent,
+                         TInt aCaseNumber )
+    {
+    CStartInfo* startInfo = CStartInfo::NewL();
+    CleanupStack::PushL( startInfo );
+    //if aSetUnsetEvent is given, then get start info from this argument
+    if( aSetUnsetEvent != NULL )
+        {
+        TBuf<10> tmpModuleName;
+        tmpModuleName.Copy( _L( "suevent" ) );
+        startInfo->SetModuleNameL( tmpModuleName );
+        startInfo->SetConfigL( *aSetUnsetEvent );
+        startInfo->SetTestCaseNumber( aCaseNumber );
+        }
+    else
+        {
+        ParseRunParamsL( aItem, *startInfo );   
+        }
+
+    CRemoteSubTestCaseRunner* remoteSubTestCase = CRemoteSubTestCaseRunner::NewL( 
+            this, 
+            aSlave, 
+            iSlavesManager->GetRemoteCallsProxy() );
+    CleanupStack::PushL( remoteSubTestCase );
+
+    __TRACE( KMessage, ( _L( "Executing sub test case: module=%S cfg=%S tcnum=%d id=%S" ),
+         &startInfo->GetModuleName(), &startInfo->GetConfig(), 
+         startInfo->GetTestCaseNumber(), &startInfo->GetTestId()) );
+
+    RDebug::Print( _L( "Executing sub test case: module=%S cfg=%S tcnum=%d id=%S" ),
+            &startInfo->GetModuleName(), &startInfo->GetConfig(), 
+            startInfo->GetTestCaseNumber(), &startInfo->GetTestId() );
+    
+    remoteSubTestCase->RunSubTestCaseL( *startInfo );
+    iSubTestCases.AppendL( remoteSubTestCase );
+    if ( iLoopHelper->LoopInProgress() )
+        {
+        iLoopHelper->RegisterInLoopSubTestCaseL( remoteSubTestCase );
+        }
+    
+    CleanupStack::Pop( remoteSubTestCase );
+    
+    iRunErrorMessage = KNullDesC;
+    
+    CleanupStack::PopAndDestroy( startInfo );    
+
+    return ETrue;    
+    }
+
+TBool CTestRunner::ExecuteRemoteEventCtlL( CStifItemParser* aItem, 
+                              CSlave* aSlave, 
+                              TInt aCmd  )
+    {
+    TPtrC eventName;
+    // Get event name
+    TInt ret = aItem->GetNextString( eventName );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Event name was not given for remote")));
+        User::Leave( KErrArgument );
+        }
+    
+    TBool continueTask = ETrue;
+    switch( aCmd )
+        {       
+        // Event control cases
+        case TTestKeywords::ERequest:
+            {
+            TEventTS* event = aSlave->GetEvent( eventName );
+            if( event != NULL )
+                {
+                __TRACE( KError, (_L("Event %S already requested"), 
+                    &eventName  ) );
+                User::Leave( KErrNotFound );
+                }
+            event = new( ELeave ) TEventTS( (TName&)eventName );
+            CleanupStack::PushL( event );
+            iSlavesManager->EventRequestL( aSlave, event );
+            aSlave->AddEventL( event );
+            CleanupStack::Pop( event );
+            }
+            break;
+        case TTestKeywords::ERelease:
+            {
+            TEventTS* event = aSlave->GetEvent( eventName );            
+            if( event == NULL )
+                {
+                __TRACE( KError, (_L("Event not found %S"), 
+                    &eventName  ) );
+                User::Leave( KErrNotFound );
+                }
+                                                  
+            aSlave->RemoveEventL( event );
+            delete event;
+            // Release event
+            iSlavesManager->EventReleaseL( aSlave, eventName );
+            }
+            break;
+        case TTestKeywords::EWait:
+            {
+            TEventTS* event = aSlave->GetEvent( eventName );
+            if( event == NULL )
+                {
+                __TRACE( KError, (_L("Waited event %S not requested"), 
+                    &eventName  ) );
+                User::Leave( KErrNotFound );
+                }
+            
+            iState = ERunnerRunning;
+            SetActive();
+            event->WaitEvent( iStatus );
+            // Execution continue if waited event is set or after it is set       
+            continueTask = EFalse;            
+            }
+            break;
+        case TTestKeywords::ESet:
+            {
+            TPtrC optParam;
+            ret = aItem->GetNextString( optParam );
+            TEventIf::TEventType eventType = TEventIf::EIndication;
+            if( ret == KErrNone )
+                {
+                if ( optParam != _L("state") )
+                    {
+                    __TRACE( KError, (_L("Invalid optional argument")));
+                    User::Leave( KErrArgument );
+                    }
+                eventType = TEventIf::EState;
+                }
+            iSlavesManager->EventSetL( aSlave, eventName, eventType );
+            }            
+            break;
+        case TTestKeywords::EUnset:
+            {
+            iSlavesManager->EventUnsetL( aSlave, eventName );
+            }
+            break;            
+        default:
+             // Should never come here
+            User::Leave( KErrGeneral );            
+        }
+            
+    return continueTask;
+    }
+
+TBool CTestRunner::ExecuteRemoteSendReceiveL( CStifItemParser* aItem, 
+                              CSlave* aSlave )
+    {
+    TPtrC message;
+    aItem->Remainder( message );
+    
+    iSlavesManager->SendReceiveL( aSlave, message );
+    return ETrue;
+    }
+
+TBool CTestRunner::ExecuteRemoteUnknownL( CStifItemParser* aItem, 
+                             CSlave* aSlave,
+                             TDesC& aCommand )
+    {
+    TPtrC message;
+    aItem->Remainder( message );
+    
+    iSlavesManager->SendUnknownL( aSlave, aCommand, message );
+    return ETrue;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CTestContinue class
+    member functions. CTestContinue handles ContinueScript calls from 
+    TestScripter.
+
+-------------------------------------------------------------------------------
+*/
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iTestScripter->iLog
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestContinue
+
+     Method: CTestContinue
+
+     Description: Default constructor
+
+     Parameters: CTestRunner* aTestRunner: in: Backpointer to CTestRunner
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestContinue::CTestContinue( CTestScripter* aTestScripter,
+                              TTestObject* aObject ): 
+    // Executed with lowest priority, must be lower than CTesRunner priority 
+    CActive(  CActive::EPriorityLow ),
+    iTestScripter( aTestScripter ),
+    iObject( aObject )
+    {
+    CActiveScheduler::Add( this );
+    __TRACEFUNC();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestContinue
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestContinue::ConstructL()
+    {
+    
+    iObject->iScript->EnableSignal( iStatus );
+    SetActive();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestContinue
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters: CTestRunner* aTestRunner: in: Backpointer to CTestRunner
+
+     Return Values: CTestContinue*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+
+CTestContinue* CTestContinue::NewL( CTestScripter* aTestScripter,
+                                    TTestObject* aObject )
+    {
+    CTestContinue* self = 
+        new (ELeave) CTestContinue( aTestScripter, aObject );
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestContinue
+
+     Method: ~CTestContinue
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/     
+
+CTestContinue::~CTestContinue()
+    {
+    __TRACEFUNC();
+    Cancel();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestContinue
+
+     Method: RunL
+
+     Description: Derived from CActive, handles testcase execution.
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestContinue::RunL()
+    {
+
+    __TRACEFUNC();
+    __TRACE( KMessage, (_L("CTestContinue::RunL: [%d] "), iStatus.Int() ));
+
+    if( iObject->Signal() ) 
+        {
+        // If OOM testing is ongoing ignore result check(given by user).
+        if( !iTestScripter->iOOMIgnoreFailure )
+            {
+            // Erronous case RunError will called and test handling continue 
+            // from there.
+            if( iTestScripter->TestRunner().TestCaseResults().Count() == 0 )
+                {
+                // KErrNone is the default result expected 
+                // if nothing else is given 
+                User::LeaveIfError( iTestScripter->TestRunner().
+                    TestCaseResults().Append( KErrNone ) );
+                }
+            
+            if( iTestScripter->TestRunner().TestCaseResults().
+                    Find( iStatus.Int() ) < 0 ) 
+                {
+                __TRACE( KError, ( _L("Command for [%S] failed (%d)"), 
+                    &iObject->ObjectId(), iStatus.Int() ));
+
+
+                if( iStatus.Int() == KErrNone )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                else
+                    {
+                    User::Leave( iStatus.Int() );
+                    }
+                }
+            }
+        else
+            {
+            __TRACE( KMessage, ( 
+                _L( "OOM test: 'oomignorefailure' is ON, signal result[%d] ignored" ),
+                iStatus.Int() ));
+            }
+
+        iTestScripter->TestRunner().TestCaseResults().Reset();
+        
+         __TRACE( KMessage, (_L("CTestContinue::RunL: Set runner active ")));
+        iTestScripter->iTestRunner->SetRunnerActive();   
+        }
+    else
+        {
+        // Signal called from test side but 'waittestclass' not yet processed
+        iObject->iAsyncResult = iStatus.Int();
+        }        
+        
+    iObject->iScript->EnableSignal( iStatus );
+    SetActive();
+    
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestContinue
+
+     Method: DoCancel
+
+     Description: Derived from CActive handles the Cancel
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestContinue::DoCancel()
+    {
+
+    __TRACEFUNC();
+    __TRACE( KMessage, (_L("CTestContinue::DoCancel")));
+
+    iObject->iScript->CancelSignal();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestContinue
+
+     Method: RunError
+
+     Description: Derived from CActive handles the Cancel
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestContinue::RunError( TInt aError )
+    {
+
+    // Return error from here, if none given from execution
+    if( iTestScripter->iResult.iResult == KErrNone )
+        {
+        iTestScripter->UpdateTestCaseResult(aError, _L("CTestContinue::RunError"));
+        }
+    CActiveScheduler::Current()->Stop();
+     
+    return KErrNone;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CDefinedValue class
+    member functions. 
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: CDefinedValue
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CDefinedValue::CDefinedValue()
+    {
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    TDesC& aName: in: Define name
+                    TDesC& aValue: in: Define value
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CDefinedValue::ConstructL( TDesC& aName, TDesC& aValue )
+    {    
+
+    iNameBuf = aName.AllocLC();
+    iName.Set( iNameBuf->Des() );
+    iValueBuf = aValue.AllocLC();
+    iValue.Set( iValueBuf->Des() );
+    CleanupStack::Pop( iValueBuf );
+    CleanupStack::Pop( iNameBuf );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters:    TDesC& aName: in: Define name
+                    TDesC& aValue: in: Define value
+
+     Return Values: CDefinedValue*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CDefinedValue* CDefinedValue::NewL( TDesC& aName, TDesC& aValue )
+    {
+
+    CDefinedValue* self = new (ELeave) CDefinedValue();
+     
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aValue );
+    CleanupStack::Pop();
+
+    return self;
+
+    }    
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: ~CDefinedValue
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/     
+CDefinedValue::~CDefinedValue()
+    {
+    
+    delete iValueBuf;
+    delete iNameBuf;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: SetValueL
+
+     Description: Set new define value
+
+     Parameters:    TDesC& aValue: in: Define value
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CDefinedValue::SetValueL( TDesC& aValue )
+    {
+    delete iValueBuf;
+    iValueBuf = 0;
+    iValueBuf = aValue.AllocLC();
+    iValue.Set( iValueBuf->Des() );
+    CleanupStack::Pop( iValueBuf );
+    
+    }
+
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: Name
+
+     Description: Returns define name.
+
+     Parameters:  None
+
+     Return Values: TDesC: Define name
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TDesC& CDefinedValue::Name()
+    { 
+    return iName; 
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: Value
+
+     Description: Returns define value.
+
+     Parameters:  None
+
+     Return Values: TDesC: Define value
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TDesC& CDefinedValue::Value()
+    { 
+    return iValue; 
+    }
+    
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TTestObjectBase class
+    member functions. 
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestObjectBase
+
+     Method: TTestObjectBase
+
+     Description: Constructor
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/    
+TTestObjectBase::TTestObjectBase( TObjectType aType ) : 
+    iAsyncResult( KErrNone ),
+    iType( aType )
+    {
+    
+    RDebug::Print( _L("TTestObjectBase::TTestObjectBase") );
+    iName.Zero(); 
+    
+    }
+    
+    /*
+-------------------------------------------------------------------------------
+
+     Class: TTestObjectBase
+
+     Method: ~TTestObjectBase
+
+     Description: Destructor
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/    
+TTestObjectBase::~TTestObjectBase()
+    {
+    
+    RDebug::Print( _L("TTestObjectBase::~TTestObjectBase") );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TTestObject class
+    member functions. 
+-------------------------------------------------------------------------------
+*/
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestObject
+
+     Method: TTestObject
+
+     Description: Constructor
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/    
+TTestObject::TTestObject() :
+    TTestObjectBase( EObjectNormal ),
+    iContinue(0),
+    iCount(0)
+    {
+    iScript = 0;
+    RDebug::Print( _L("TTestObject::TTestObject") );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestObject
+
+     Method: ~TTestObject
+
+     Description: Destructor
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TTestObject::~TTestObject()
+    { 
+    
+    RDebug::Print( _L("TTestObject::~TTestObject") );
+    delete iContinue;
+    iContinue = 0;
+
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestObject
+
+     Method: RunMethodL
+
+     Description: Run specified method from testclass.
+
+     Parameters: CStifItemParser* aItem: in: itemparser
+
+     Return Values: Symbian OS error code
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt TTestObject::RunMethodL( CStifItemParser& aItem )
+    { 
+    
+    return iScript->RunMethodL( aItem ); 
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TTestObjectKernel class
+    member functions. 
+-------------------------------------------------------------------------------
+*/
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestObjectKernel
+
+     Method: TTestObjectKernel
+
+     Description: Constructor
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/    
+TTestObjectKernel::TTestObjectKernel() : 
+    TTestObjectBase( EObjectKernel )
+    {
+    
+    RDebug::Print( _L("TTestObjectKernel::TTestObjectKernel") );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestObjectKernel
+
+     Method: ~TTestObjectKernel
+
+     Description: Destructor
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TTestObjectKernel::~TTestObjectKernel()
+    { 
+    
+    RDebug::Print( _L("TTestObjectKernel::~TTestObjectKernel") );
+    
+    iTestClass.Close(); 
+    User::FreeLogicalDevice( iLddName );
+    
+    }
+   
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTestObjectKernel
+
+     Method: RunMethodL
+
+     Description: Run specified method from kernel testclass.
+
+     Parameters: CStifItemParser& aItem: in: itemparser
+
+     Return Values: Symbian OS error code
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt TTestObjectKernel::RunMethodL( CStifItemParser& aItem )
+    { 
+    
+    TPtrC method;
+    TPtrC params;
+    
+    User::LeaveIfError( aItem.GetNextString( method ) );
+    aItem.Remainder( params );
+    
+    TInt result;
+    TMethodResultDes resultDes;
+          
+    // Need to change descriptors from 16bit to 8bit for EKA2 kernel
+    // because STIF Parser doesn't support 8bit parsing
+    HBufC8 * myBuf1 = HBufC8::NewL( method.Length() );
+    TPtr8 met8 = myBuf1->Des();   
+    met8.Copy( method );
+        
+    HBufC8 * myBuf2 = HBufC8::NewL( params.Length() );
+    TPtr8 par8 = myBuf2->Des();   
+    par8.Copy( params );
+    
+    TInt ret =  iTestClass.RunMethod( met8, par8, result, resultDes );
+
+    delete myBuf1;
+    delete myBuf2;
+    
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    return result;                             
+                                     
+    };
+
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+    
+     Function: LibEntryL
+
+     Description: Polymorphic Dll Entry Point
+
+     Parameters:    None.
+
+     Return Values: CTestScripter*: pointer to new CTestScripter
+
+     Errors/Exceptions: Leaves if NewL leaves.
+
+     Status: Draft
+     
+-------------------------------------------------------------------------------
+*/
+
+EXPORT_C CTestScripter* LibEntryL()
+    {
+    return CTestScripter::NewL();
+    
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/src/TestScripterInternal.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,390 @@
+/*
+* 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: This file contains TestScripterImp implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include <StifParser.h>
+#include "TestScripterInternal.h"
+#include "TestScripter.h"
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// None
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CScriptBase::CScriptBase
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase::CScriptBase( CTestModuleIf& aTestModuleIf ):
+    iTestModuleIf( aTestModuleIf )
+    {
+	// Handles multible 'waittestclass' given in test configure file.
+    iSignalErrors.Reset();
+
+    }
+
+       
+// -----------------------------------------------------------------------------
+// CScriptBase::TestModuleIf
+// Get reference to TestModuleIf API.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleIf& CScriptBase::TestModuleIf()
+    { 
+    
+    return iTestModuleIf; 
+    
+    }
+        
+// -----------------------------------------------------------------------------
+// CScriptBase::Signal
+// Signal TestScripter to continue from waittestclass.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CScriptBase::Signal( TInt aError )
+    { 
+    
+    if( iStatus ) 
+        {
+        User::RequestComplete( iStatus, aError ); 
+        }
+    else
+    	{
+		// Handles multible 'waittestclass' given in test configure file.
+		// There is active object in CTestRunner also and it has higher
+		// priority than CTestContinue(It must be higher that e.g.
+		// 'allownextresult' is gotten right from configure file). That why we
+		// have to use this array and take signal "count" to the array for
+		// later handling.
+    	iSignalErrors.Append( aError );
+    	}
+        
+    }
+
+// -----------------------------------------------------------------------------
+// CScriptBase::CallTestClass
+// Called from test class. TestScripter forwards
+// operations to other test class object.
+// aLine: in: <object name> <method name> <parameters>
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::CallTestClass( const TDesC& aLine )
+    { 
+    
+    if( iFunc )
+        {
+        return iFunc( iTestScripter, EStifTSCallClass, aLine ); 
+        }
+    
+    return KErrNotSupported;
+    
+    };
+
+// -----------------------------------------------------------------------------
+// CScriptBase::GetTestObject
+// Get test class object address.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* CScriptBase::GetTestObject( const TDesC& aObjectName )
+    { 
+    
+    if( iFunc )
+        {
+        TInt ret = iFunc( iTestScripter, EStifTSGetObject, aObjectName );
+        if( ret > 0 )
+            {
+            return( CScriptBase* )ret;
+            } 
+        }
+    
+    return NULL;
+    };
+
+// -----------------------------------------------------------------------------
+// CScriptBase::EnableSignal
+// Enable Signal().
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CScriptBase::EnableSignal( TRequestStatus& aStatus )
+    { 
+    
+    aStatus = KRequestPending; 
+    iStatus = &aStatus; 
+
+	// Handles multible 'waittestclass' given in test configure file.
+    if( iSignalErrors.Count() > 0 )
+    	{
+		// Complete signal and remove it from array.
+    	TInt error = iSignalErrors[0];
+    	iSignalErrors.Remove( 0 );
+    	User::RequestComplete( iStatus, error ); 
+    	}
+    
+    }
+   
+// -----------------------------------------------------------------------------
+// CScriptBase::CancelSignal
+// Cancel Signal().
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CScriptBase::CancelSignal()
+    { 
+    if(iStatus!=NULL)
+        {
+        User::RequestComplete( iStatus, KErrCancel ); 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScriptBase::SetScripter
+// Set scripter callback.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CScriptBase::SetScripter( CallBackFunc aFunc, CTestScripter* aTestScripter )
+    { 
+    
+    iTestScripter = aTestScripter; 
+    iFunc = aFunc; 
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CScriptBase::RunInternalL
+// Run specified method from test class.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::RunInternalL ( 
+    TStifFunctionInfo const aFunctions[], 
+    TInt aCount, 
+    CStifItemParser& aItem  ) 
+    {
+
+    TInt ret = KErrNotFound;
+    
+    TPtrC command; 
+    User::LeaveIfError ( aItem.GetNextString( command ) );
+    TInt i = 0;
+    TName funcName;
+    
+    // Search function from table and call it
+    for ( i = 0; i < aCount; i++ )
+        {
+        funcName = aFunctions[i].iFunctionName;      
+        if ( command == funcName )
+            {
+            if( iLog )
+                {
+                iLog->Log(_L("Calling [%S]"), &command );
+                }
+            ret  = ( this->*(aFunctions[i].iMethod) )( aItem );    
+
+            break;            
+            }
+    
+        }
+
+    if( i == aCount )
+        {
+        iLog->Log( _L("[%S] not found"), &command );
+        }
+
+    return ret;
+
+    }
+    
+// -----------------------------------------------------------------------------
+// CScriptBase::GetConstantValue
+// Internal fuction to get const value defined in 
+// [Define]...[Enddefine] section of script file
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::GetConstantValue( const TDesC& aName, TDes& aValue )
+	{	
+		return iTestScripter->GetConstantValue( aName, aValue );
+	}
+
+    
+// -----------------------------------------------------------------------------
+// CScriptBase::GetConstantValue
+// Internal fuction to get const value defined in 
+// [Define]...[Enddefine] section of script file
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::GetConstantValue( const TDesC& aName, TInt& aValue )
+	{	
+	TInt ret = KErrNone;
+	TBuf<32> valStr;
+	ret = iTestScripter->GetConstantValue( aName, valStr );
+	if ( ret != KErrNone )
+	{
+		return ret;
+	}
+
+	TLex converter( valStr );
+	ret = converter.Val( aValue );
+
+	return ret;
+	}
+    
+// -----------------------------------------------------------------------------
+// CScriptBase::GetConstantValue
+// Internal fuction to get const value defined in 
+// [Define]...[Enddefine] section of script file
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::GetConstantValue( const TDesC& aName, TReal& aValue )
+	{	
+	TInt ret = KErrNone;
+	TBuf<32> valStr;
+	ret = iTestScripter->GetConstantValue( aName, valStr );
+	if ( ret != KErrNone )
+	{
+		return ret;
+	}
+
+	TLex converter( valStr );
+	ret = converter.Val( aValue );
+
+	return ret;
+	}
+
+// -----------------------------------------------------------------------------
+// CScriptBase::SetResultDescription
+// Result description can be set from within the test class method 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CScriptBase::SetResultDescription(const TDesC& aDescription)
+	{
+	iTestScripter->SetResultDescription(aDescription);
+	}
+
+// -----------------------------------------------------------------------------
+// CScriptBase::SetLocalValue
+// Internal fuction to set local value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::SetLocalValue(const TDesC& aName, const TDesC& aValue)
+    {	
+		return iTestScripter->SetLocalValue(aName, aValue);
+    }
+	
+// -----------------------------------------------------------------------------
+// CScriptBase::SetLocalValue
+// Internal fuction to set local value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::SetLocalValue(const TDesC& aName, const TInt aValue)
+    {
+    TBuf<20> buf;
+    buf.Format(_L("%d"), aValue);
+    return iTestScripter->SetLocalValue(aName, buf);
+    }
+	
+// -----------------------------------------------------------------------------
+// CScriptBase::SetLocalValue
+// Internal fuction to set local value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::SetLocalValue(const TDesC& aName, const TReal aValue )
+    {	
+    TBuf<50> buf;
+    buf.Format(_L("%g"), aValue);
+    return iTestScripter->SetLocalValue(aName, buf);
+    }	
+
+// -----------------------------------------------------------------------------
+// CScriptBase::GetLocalValue
+// Internal fuction to get local value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::GetLocalValue(const TDesC& aName, TDes& aValue)
+    {	
+		return iTestScripter->GetLocalValue(aName, aValue);
+    }
+	
+// -----------------------------------------------------------------------------
+// CScriptBase::GetLocalValue
+// Internal fuction to get local value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::GetLocalValue(const TDesC& aName, TInt& aValue)
+    {
+    TInt ret = KErrNone;
+    TBuf<50> valStr;
+    ret = iTestScripter->GetLocalValue(aName, valStr);
+    if(ret != KErrNone)
+        {
+        return ret;
+        }
+
+    TLex converter(valStr);
+    ret = converter.Val(aValue);
+
+    return ret;
+    }
+	
+// -----------------------------------------------------------------------------
+// CScriptBase::GetLocalValue
+// Internal fuction to get local value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CScriptBase::GetLocalValue(const TDesC& aName, TReal& aValue )
+    {
+    TInt ret = KErrNone;
+    TBuf<50> valStr;
+    ret = iTestScripter->GetLocalValue(aName, valStr);
+    if(ret != KErrNone)
+        {
+        return ret;
+        }
+
+    TLex converter(valStr);
+    ret = converter.Val(aValue);
+
+    return ret;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/scriptermod/src/TestScripterUtils.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3078 @@
+/*
+* 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: This file contains TestScripter implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "TestScripterUtils.h"
+#include <f32file.h>
+#include "TestScripter.h"
+#include "Logging.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 =======================================
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: CStartInfo
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStartInfo::CStartInfo():
+iCategory( TFullTestResult::ECaseExecuted ) 
+    {
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CStartInfo::ConstructL()
+    {
+    iModule = HBufC::NewL( 0 );
+    iIniFile = HBufC::NewL( 0 );
+    iConfig = HBufC::NewL( 0 );
+    iTestId = HBufC::NewL( 0 );
+    iTitle = HBufC::NewL( 0 );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters:    None
+     
+     Return Values: CStartInfo*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStartInfo* CStartInfo::NewL()
+    {
+    CStartInfo* self = new (ELeave) CStartInfo();
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }    
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: ~CStartInfo
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/     
+CStartInfo::~CStartInfo()
+    {
+    delete iModule;
+    delete iIniFile;
+    delete iConfig;
+    delete iTestId;
+    delete iTitle;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetModuleNameL
+
+     Description: Set module name.
+     
+     Parameters: TDesC& aModule: in: Module name 
+                 TInt aExtLength: in: Extra length reserved for buffer
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+ void CStartInfo::SetModuleNameL( const TDesC& aModule, TInt aExtLength )
+    {
+    HBufC* module = HBufC::NewL( aModule.Length() + aExtLength );
+    CleanupStack::PushL( module );
+    TPtr modulePtr( module->Des() );
+    modulePtr.Append( aModule );
+    
+    // Remove optional '.DLL' from file name
+    modulePtr.LowerCase();
+    TParse parse;
+    parse.Set( *module, NULL, NULL );
+    
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        modulePtr.Delete ( modulePtr.Length() - len, len );
+        }
+    CleanupStack::Pop( module );
+    delete iModule;
+    iModule = module;
+    };
+            
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetIniFileL
+
+     Description: Set initialization file name name.
+     
+     Parameters: TDesC& aIni: in: Initialization file name
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetIniFileL( const TDesC& aIni )
+    {
+    HBufC* inifile = aIni.AllocL();
+    delete iIniFile;
+    iIniFile = inifile;
+    };
+            
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetConfigL
+
+     Description: Set configuration file name name.
+     
+     Parameters: TDesC& aConfig: in: Configuration file name
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetConfigL( const TDesC& aConfig )
+    {
+    HBufC* config = aConfig.AllocL();
+    delete iConfig;
+    iConfig = config;
+    };
+            
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetTestIdL
+
+     Description: Set test identifier.
+     
+     Parameters: TDesC& aTestId: in: test identifier
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetTestIdL( const TDesC& aTestId )
+    {
+    HBufC* testId = aTestId.AllocL();
+    delete iTestId;
+    iTestId = testId;
+    };
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetTitleL
+
+     Description: Set title.
+     
+     Parameters: TDesC& aTitle: in: Test case title
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetTitleL( const TDesC& aTitle)
+    {
+    HBufC* title = aTitle.AllocL();
+    delete iTitle;
+    iTitle = title;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetTestCaseNumber
+
+     Description: Sets test case index.
+     
+     Parameters: TInt aTestCaseNumber: in: Test case index
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetTestCaseNumber( TInt aTestCaseNumber )
+    {
+    iCaseNum = aTestCaseNumber;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetExpectedResult
+
+     Description: Sets test case expected result
+     
+     Parameters: TInt aExpectedResult: in: Test case expected result
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetExpectedResult( TInt aExpectedResult )
+    {    
+    iExpectedResult = aExpectedResult;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetExpectedResultCategory
+
+     Description: Sets test case expected result category
+     
+     Parameters: TFullTestResult::TCaseExecutionResult aCategory: in: Test case expected result category
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetExpectedResultCategory( TFullTestResult::TCaseExecutionResult aCategory )
+    {
+    iCategory = aCategory;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetTimeout
+
+     Description: Sets test case timeout value
+     
+     Parameters:  TInt aTimeout: in: Test case timeout value
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetTimeout( TInt aTimeout )
+    {    
+    iTimeout = aTimeout;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetModuleName
+
+     Description: Gets test module name.
+     
+     Parameters:  None
+     
+     Return Values: Test module name
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+const TDesC& CStartInfo::GetModuleName() const
+    {
+    return *iModule;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetIniFile
+
+     Description: Gets ini file path
+     
+     Parameters:  None
+     
+     Return Values: Ini file path
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+const TDesC& CStartInfo::GetIniFile() const
+    {
+    return *iIniFile;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetConfig
+
+     Description: Gets config file path
+     
+     Parameters:  None
+     
+     Return Values: Config file path
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+const TDesC& CStartInfo::GetConfig() const
+    {
+    return *iConfig;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetTestId
+
+     Description: Gets test case id
+     
+     Parameters:  None
+     
+     Return Values: Test case id
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+const TDesC& CStartInfo::GetTestId() const
+    {
+    return *iTestId;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetTitle
+
+     Description: Gets test case title
+     
+     Parameters:  None
+     
+     Return Values: Test case title
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+const TDesC& CStartInfo::GetTitle() const
+    {
+    return *iTitle;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetTestCaseNumber
+
+     Description: Gets test case index
+     
+     Parameters:  None
+     
+     Return Values: Test case index
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+TInt CStartInfo::GetTestCaseNumber() const
+    {
+    return iCaseNum;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetExpectedResult
+
+     Description: Gets test case expected result
+     
+     Parameters:  None
+     
+     Return Values: Test case expected result
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+TInt CStartInfo::GetExpectedResult() const
+    {
+    return iExpectedResult;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetExpectedResultCategory
+
+     Description: Gets test case expected result category
+     
+     Parameters:  None
+     
+     Return Values: Test case expected result category
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+TFullTestResult::TCaseExecutionResult CStartInfo::GetExpectedResultCategory() const
+    {    
+    return iCategory;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: GetTimeout
+
+     Description: Gets test case timeout value
+     
+     Parameters:  None
+     
+     Return Values: Test case timeout value
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+TInt CStartInfo::GetTimeout() const
+    {
+    return iTimeout;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: CopyL
+
+     Description: Copy values from other CStartInfo instance.
+     
+     Parameters:  const CStartInfo& aStartInfo: in: CStartInfo instance
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::CopyL( const CStartInfo& aStartInfo )
+    {
+    SetConfigL( aStartInfo.GetConfig() );
+    SetExpectedResult( aStartInfo.GetExpectedResult() );
+    SetExpectedResultCategory( aStartInfo.GetExpectedResultCategory() );
+    SetIniFileL( aStartInfo.GetIniFile() );
+    SetModuleNameL( aStartInfo.GetModuleName() );
+    SetTestCaseNumber( aStartInfo.GetTestCaseNumber() );
+    SetTestIdL( aStartInfo.GetTestId() );
+    SetTimeout( aStartInfo.GetTimeout() );
+    SetTitleL( aStartInfo.GetTitle() );    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters: CTestRunner* aTestRunner: in: Pointer to CTestRunner
+     
+     Return Values: CLoopHelper*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CLoopHelper* CLoopHelper::NewL( CTestRunner* aTestRunner )
+    {    
+    CLoopHelper* self = new(ELeave)CLoopHelper( aTestRunner );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: ~CLoopHelper
+
+     Description: Destructor.
+          
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CLoopHelper::~CLoopHelper()
+    {
+    Cancel();
+    iInLoopSubTestCases.Reset();
+    iInLoopSubTestCases.Close();    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: CLoopHelper
+
+     Description: Constructor.
+          
+     Parameters: CTestRunner* aTestRunner: in: Pointer to CTestRunner
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CLoopHelper::CLoopHelper( CTestRunner* aTestRunner )
+:CActive( EPriorityStandard ), iTestRunner( aTestRunner )
+    {    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: ConstructL
+
+     Description: Two-phased constructor.
+          
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::ConstructL()
+    {    
+    CActiveScheduler::Add( this );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: LoopStartL
+
+     Description: Should be to indicate loop start.
+          
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::LoopStartL()
+    {
+    IterationBeginL( ETrue );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: IterationEndStartNextIterationL
+
+     Description: Should be called to indicate end of iteration and begining of next iteration
+          
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::IterationEndStartNextIterationL()
+    {
+    IterationEndL( EFalse );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: LoopEndL
+
+     Description: Should be called to indicate loop end
+          
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::LoopEndL()
+    {
+    IterationEndL( ETrue );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: IterationBeginL
+
+     Description: Indicate begining of the loop iteration
+          
+     Parameters: TBool aFirstIteration: in: Indicates if it is first iteration
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::IterationBeginL( TBool aFirstIteration )
+    {
+    // Check if it is first iteration. If yes then reset CLoopHelper state
+    if ( aFirstIteration )
+        {
+        if ( iInProgress )
+            {
+            User::Leave( KErrInUse );
+            }
+        iPassedIterationsCounter = 0;
+        iInProgress = ETrue;
+        iLoopEnd = EFalse;
+        }
+
+    // Check for invalid calls order
+    if ( iIterationOngoing )
+        {
+        User::Leave( KErrInUse );
+        }
+    iIterationOngoing = ETrue;
+    iPassCurrentIteration = ETrue;    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: IterationEndL
+
+     Description: Indicate end of the loop iteration
+          
+     Parameters: TBool aLastIteration: in: Indicates if it is last iteration
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::IterationEndL( TBool aLastIteration )
+    {
+    // Perform tests to check if methods were called in proper order
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    if ( !( iInProgress && iIterationOngoing ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    if ( aLastIteration )
+        {
+        iLoopEnd = ETrue;
+        }
+
+    // It is end of loop iteration. Wait for all sub test cases executed inside loop
+    // to finish its execution.
+    iStatus = KRequestPending;
+    SetActive();
+    if ( iInLoopSubTestCases.Count() == 0 )
+        {
+        // All sub test cases executed inside loop are already finished.
+        // Schedule activation of CTestRunner to continue script execution after endloop keyword
+        // ( it is done in CLoopHelper::RunL )
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: RegisterInLoopSubTestCaseL
+
+     Description: Should be called to register sub test case executed inside loop
+          
+     Parameters: CSubTestCaseRunner* aSubTestCaseRunner: in: Sub test case runner 
+                 to be registered
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::RegisterInLoopSubTestCaseL( CSubTestCaseRunner* aSubTestCaseRunner )
+    {
+    // Check if loop iteration is ongoing
+    if ( !( iInProgress && iIterationOngoing ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    iInLoopSubTestCases.AppendL( aSubTestCaseRunner );
+    }
+
+void CLoopHelper::UnregisterInLoopSubTestCaseL( CSubTestCaseRunner* aSubTestCaseRunner )
+    {
+    // Check if loop iteration is ongoing
+    if ( !( iInProgress && iIterationOngoing ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    TInt idx = iInLoopSubTestCases.Find( aSubTestCaseRunner );
+    if ( idx >= 0 )
+        {
+        iInLoopSubTestCases.Remove( idx );
+        }    
+    }
+
+void CLoopHelper::RegisterInLoopSlaveL( CSlave* aSlave )
+    {
+    // Check if loop iteration is ongoing
+    if ( !( iInProgress && iIterationOngoing ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    iInLoopSlaves.AppendL( aSlave );
+    }
+
+void CLoopHelper::UnregisterInLoopSlaveL( CSlave* aSlave )
+    {
+    // Check if loop iteration is ongoing
+    if ( !( iInProgress && iIterationOngoing ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    TInt idx = iInLoopSlaves.Find( aSlave );
+    if ( idx >= 0 )
+        {
+        iInLoopSlaves.Remove( idx );
+        }
+    }
+
+RPointerArray<CSlave>& CLoopHelper::GetRegisteredInLoopSlaves()
+    {
+    return iInLoopSlaves;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: NotifySubTestCaseEndL
+
+     Description: Should be called to indicate end of sub test case executed inside loop
+          
+     Parameters:  CSubTestCaseRunner* aSubTestCaseRunner: in: Sub test case which ended
+                  TBool aPassed: in: Indicates if test case passed or not
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::NotifySubTestCaseEndL( CSubTestCaseRunner* aSubTestCaseRunner, TBool aPassed )
+    {
+    // Check if execution of the loop is ongoing
+    if ( !iInProgress )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    // Check if selected sub test case was executed inside loop
+    TInt idx = iInLoopSubTestCases.Find( aSubTestCaseRunner );
+    if ( idx >= 0 )
+        {
+        iInLoopSubTestCases.Remove( idx );
+        if ( !aPassed )
+            {
+            iPassCurrentIteration = EFalse;
+            }
+        
+        // Check if there are other ont finished sub test cases executed inside loop
+        if ( iInLoopSubTestCases.Count() == 0 )
+            {
+            // Check if CLoopHelper is active.
+            if ( IsActive() )
+                {
+                // CLoopHelper is active. It means that IterationEndL method was called 
+                // and CTestRunner currently waiting for sub test end before executing next
+                // iteration of the loop. Since all sub test cases executed inside lopp are 
+                // already finished we can activate CTestRunner ( it is done in CLoopHelper::RunL )
+                TRequestStatus* status = &iStatus;
+                User::RequestComplete( status, KErrNone );
+                }
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: LoopInProgress
+
+     Description: Indicates if loop execution is in progress
+          
+     Parameters: None
+     
+     Return Values: True if loop is in progress.
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CLoopHelper::LoopInProgress() const
+    {
+    return iInProgress;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: DoCancel
+
+     Description: See CActive::DoCancel
+          
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::DoCancel()
+    {
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrCancel );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CLoopHelper
+
+     Method: RunL
+
+     Description: See CActive::RunL
+          
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CLoopHelper::RunL()
+    {
+    // Iteration has ended and all sub test cases executed inside loop has ended.
+    User::LeaveIfError( iStatus.Int() );
+    iIterationOngoing = EFalse;
+
+    if ( iPassCurrentIteration )
+        {
+        iPassedIterationsCounter++;
+        }
+
+    // Activate CTestRunner to continue test case execution
+    iTestRunner->SetRunnerActive();
+    
+    if ( iLoopEnd )
+        {
+        iTestRunner->ReleaseRemoteResourcesAllocatedInLoopL();
+        // It was last iteration. Report loop result to CTestRunner
+        iTestRunner->ReportLoopEndResultL( iPassedIterationsCounter );
+        // Reset CLoopHelper state
+        iLoopEnd = EFalse;
+        iInProgress = EFalse;
+        }
+    else
+        {
+        // Begin next loop iteration
+        IterationBeginL( EFalse );    
+        }
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CSlaveInfo
+
+     Method: GetEvent
+
+     Description: Returns event with given name.
+
+     Parameters:  TDesC& aEventName: in; Event name
+
+     Return Values: TEventTc: Event structure
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+//TEventTc* CSlaveInfo::GetEvent( TDesC& aEventName )
+//    {
+//    
+//    TInt count = iEvents.Count();
+//    for( TInt i = 0; i < count; i++ )
+//        {
+//        if( iEvents[i]->Name() == aEventName )
+//            {
+//            return iEvents[i];
+//            }
+//        }
+//    return NULL;
+//    
+//    }
+
+#ifdef LOGGER
+#undef LOGGER
+#endif
+
+#define LOGGER iLogger
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTS
+
+     Method: TEventTS
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TEventTS::TEventTS()
+:iClientReqStatus( NULL )
+    {
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTS
+
+     Method: TEventTS
+
+     Description: Parametric constructor
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+TEventTS::TEventTS( TName& aEventName )
+:iClientReqStatus( NULL )
+    {
+    SetName( aEventName );
+    SetType( EReqEvent );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTS
+
+     Method: ~TEventTS
+
+     Description: Destructor
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+TEventTS::~TEventTS()
+    { 
+    Complete( KErrNone ); 
+    }
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTS
+
+     Method: SetRequestStatus
+
+     Description: Set request status member.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+void TEventTS::SetRequestStatus( TRequestStatus* aStatus )
+    { 
+    iClientReqStatus = aStatus; 
+    *iClientReqStatus = KRequestPending;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTS
+
+     Method: Complete
+
+     Description: Complete request status member.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+void TEventTS::Complete( TInt aError )
+    { 
+    if( iClientReqStatus )
+        { 
+        User::RequestComplete( iClientReqStatus, aError ); 
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTS
+
+     Method: SetEvent
+
+     Description: Set event pending.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+void TEventTS::SetEvent( TEventType aEventType )
+    {
+    SetEventType( aEventType );
+    if( iClientReqStatus )
+        {
+        Complete( KErrNone );
+        if( EventType() == EState )
+            {
+            SetType( ESetEvent ) ;
+            }
+        }
+    else 
+        {
+        SetType( ESetEvent ) ;
+        }
+    }
+   
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTS
+
+     Method: WaitEvent
+
+     Description: Wait event.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void TEventTS::WaitEvent( TRequestStatus& aStatus )
+    {
+    SetRequestStatus( &aStatus );
+    if( Type() == ESetEvent )
+        {
+        Complete( KErrNone );
+        if( EventType() == EIndication )
+            {
+            SetType( EReqEvent );
+            }
+        }
+    }
+
+CRemoteCallsProxy* CRemoteCallsProxy::NewL( CTestModuleIf& aTestModuleIf, CStifLogger* aLogger )
+    {
+    CRemoteCallsProxy* self = new(ELeave)CRemoteCallsProxy( aTestModuleIf, aLogger );
+    CleanupStack::PushL( self );
+    self->ConstructL(); 
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CRemoteCallsProxy::~CRemoteCallsProxy()
+    {
+    Cancel();
+    
+    iLogger = NULL;
+    iSlaveAllocateFreeMonitor = NULL;
+    iRemoteTestCasesMonitor = NULL;
+    iRemoteEventsMonitor = NULL;
+    iRemoteSendReceiveMonitor = NULL;
+    iReceiveErrorHandler = NULL;    
+    }
+
+CRemoteCallsProxy::CRemoteCallsProxy( CTestModuleIf& aTestModuleIf, CStifLogger* aLogger )
+: CActive( EPriorityNormal ), iLogger( aLogger ), iTestModuleIf( aTestModuleIf )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+void CRemoteCallsProxy::ConstructL()
+    {
+    StartReceivingL();
+    }
+
+void CRemoteCallsProxy::DoCancel()
+    {
+    iTestModuleIf.RemoteReceiveCancel();
+    }
+
+void CRemoteCallsProxy::RunL()
+    {
+    RDebug::Print( _L("[STIF Master received response] %S"), &iReceivedRemoteMsg );    
+    
+    DispatchReceivedRemoteMsgL();
+    StartReceivingL();
+    }
+
+TInt CRemoteCallsProxy::RunError( TInt aError )
+    {
+    if ( iReceiveErrorHandler != NULL )
+        {
+        iReceiveErrorHandler->HandleRemoteReceiveError( aError, iReceiveErrorDescription );
+        return KErrNone;
+        }
+    return aError;
+    }
+
+void CRemoteCallsProxy::AllocateL( TUint32 aMasterId, const TDesC& aType )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    
+    remoteRequest->CreateL();    
+    // Reserve message
+    User::LeaveIfError(
+            remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgReserve ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError(
+            remoteRequest->AppendId( aMasterId ) );
+    // DstId, broacast id
+    User::LeaveIfError(
+            remoteRequest->AppendId( 0 ) );
+    // Slave type
+    User::LeaveIfError( 
+            remoteRequest->Append( aType ) );
+
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+    
+    User::LeaveIfError( 
+        iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+    
+    CleanupStack::PopAndDestroy( remoteRequest );
+    }
+
+void CRemoteCallsProxy::FreeL( TUint32 aMasterId, TUint16 aSlaveId )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    
+    remoteRequest->CreateL();
+    
+    // Release message
+    User::LeaveIfError( 
+            remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRelease ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError( 
+            remoteRequest->AppendId( aMasterId ) );
+    // DstId is device broadcast
+    User::LeaveIfError( 
+            remoteRequest->AppendId( SETID( aSlaveId, 0 ) ) );
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+        iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+        
+    CleanupStack::PopAndDestroy( remoteRequest );
+    }
+
+void CRemoteCallsProxy::SendReceiveL(  TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aMessage )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError(
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError( remoteRequest->AppendId( aMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( remoteRequest->AppendId( SETID( aSlaveId, 0 ) ) );
+    // Run command
+    User::LeaveIfError( remoteRequest->Append( 
+        CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdSendReceive ) );
+    // asynchronous sendreceive's parameters    
+    if ( aMessage != KNullDesC )
+        {        
+        // Append parameters
+        User::LeaveIfError( remoteRequest->Append( aMessage ) );  
+        }
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+    User::LeaveIfError( 
+        iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+
+    CleanupStack::PopAndDestroy( remoteRequest );
+    }
+
+void CRemoteCallsProxy::SendUnknownL(  TUint32 aMasterId, TUint16 aSlaveId, 
+        const TDesC& aCommand, const TDesC& aMessage )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError(
+            remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError( remoteRequest->AppendId( aMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( remoteRequest->AppendId( SETID( aSlaveId, 0 ) ) );
+    
+    // Append command name
+    User::LeaveIfError( remoteRequest->Append( aCommand ) );
+    
+    if ( aMessage != KNullDesC )
+        {        
+        // Append parameters
+        User::LeaveIfError( remoteRequest->Append( aMessage ) );  
+        }
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+        iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+                
+    CleanupStack::PopAndDestroy( remoteRequest );
+    }
+
+
+void CRemoteCallsProxy::RunTestCaseL( TUint32 aMasterId, TUint16 aSlaveId, CStartInfo* aStartInfo )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    remoteRequest->CreateL();
+    
+    // Remote message
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError( remoteRequest->AppendId( aMasterId ) );
+    // DstId is device broadcast
+    User::LeaveIfError( 
+        remoteRequest->AppendId( SETID( aSlaveId, 0 ) ) );
+    // Run command
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRun ) );
+    // Run parameters
+    User::LeaveIfError(
+        remoteRequest->Append( CStifTFwIfProt::RunParams, 
+                CStifTFwIfProt::ERunModule, 
+                aStartInfo->GetModuleName() ) );
+    User::LeaveIfError(
+        remoteRequest->Append( CStifTFwIfProt::RunParams, 
+                CStifTFwIfProt::ERunTestcasenum, 
+                aStartInfo->GetTestCaseNumber() ));
+    if( aStartInfo->GetIniFile().Length() > 0 )
+        {
+        // Initialization file
+        __TRACE( KMessage, (_L("ini: %S"), &aStartInfo->GetIniFile() ));     
+        User::LeaveIfError(
+            remoteRequest->Append( CStifTFwIfProt::RunParams, 
+                    CStifTFwIfProt::ERunInifile, 
+                    aStartInfo->GetIniFile() ) );
+        }
+    if( aStartInfo->GetConfig().Length() > 0 )
+        {
+        // Initialization file
+        __TRACE( KMessage, (_L("config: %S"), &aStartInfo->GetConfig() ));     
+        User::LeaveIfError(
+            remoteRequest->Append( CStifTFwIfProt::RunParams, 
+                    CStifTFwIfProt::ERunTestcasefile, 
+                    aStartInfo->GetConfig() ));
+        } 
+    //Title (must be given between quotation marks in case of any spaces inside
+    if( aStartInfo->GetTitle().Length() > 0 )
+        {
+        __TRACE(KMessage, (_L("title: %S"), &aStartInfo->GetTitle() ) );
+        TName title;
+        title.Format(_L("\"title=%S\""), &aStartInfo->GetTitle() );
+        User::LeaveIfError( remoteRequest->Append( title ) );
+        }
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError(
+        iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+        
+    CleanupStack::PopAndDestroy( remoteRequest );    
+    }
+
+void CRemoteCallsProxy::PauseTestCaseL( TUint32 aMasterId, TUint16 aSlaveId, TUint16 aTestId )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError(
+        remoteRequest->AppendId( aMasterId ) );
+    // DstId, i.e.slave id
+    User::LeaveIfError(
+        remoteRequest->AppendId( SETID( aSlaveId, aTestId ) ) );
+    
+    // Pause command
+    User::LeaveIfError(
+        remoteRequest->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdPause ) );
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+            iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+    
+    CleanupStack::PopAndDestroy( remoteRequest );    
+    }
+
+void CRemoteCallsProxy::ResumeTestCaseL( TUint32 aMasterId, TUint16 aSlaveId, TUint16 aTestId )
+    {    
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError(
+        remoteRequest->AppendId( aMasterId ));
+    // DstId, i.e.slave id
+    User::LeaveIfError(
+        remoteRequest->AppendId( SETID( aSlaveId, aTestId ) ) );
+    
+    // Resume command
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdResume ));
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+            iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+    
+    CleanupStack::PopAndDestroy( remoteRequest );    
+    }
+
+void CRemoteCallsProxy::CancelTestCaseL( TUint32 aMasterId, TUint16 aSlaveId, TUint16 aTestId )
+    {    
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError(
+        remoteRequest->AppendId( aMasterId ));
+    // DstId, i.e.slave id
+    User::LeaveIfError(
+        remoteRequest->AppendId( SETID( aSlaveId, aTestId ) ) );
+    
+    // Cancel command
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdCancel ));
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+            iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+    
+    CleanupStack::PopAndDestroy( remoteRequest );    
+    }
+
+void CRemoteCallsProxy::RequestEventL( TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aEventName )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ));
+    // Srcid. i.e. master id
+    User::LeaveIfError( remoteRequest->AppendId( aMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( remoteRequest->AppendId( SETID( aSlaveId, 0 ) ) );
+    
+    // Request event
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest )); 
+        
+    // Event name
+    User::LeaveIfError( remoteRequest->Append( aEventName ) ); 
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+            iTestModuleIf.RemoteSend( remoteRequest->Message() ) );
+    
+    CleanupStack::PopAndDestroy( remoteRequest );    
+    }
+
+void CRemoteCallsProxy::SetEventL( TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aEventName, 
+        TEventIf::TEventType aEventType )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ));
+    // Srcid. i.e. master id
+    User::LeaveIfError( remoteRequest->AppendId( aMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( remoteRequest->AppendId( SETID( aSlaveId, 0 ) ) );
+        
+    // Set event
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdSetEvent ) ); 
+        
+    // Event name
+    User::LeaveIfError( remoteRequest->Append( aEventName ) ); 
+    
+    if ( aEventType == TEventIf::EState )
+        {
+        // State event
+        User::LeaveIfError( remoteRequest->Append( remoteRequest->EventType( aEventType ) ) ); 
+        }
+        
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+            iTestModuleIf.RemoteSend( remoteRequest->Message() ) );    
+    
+    CleanupStack::PopAndDestroy( remoteRequest );    
+    }
+
+void CRemoteCallsProxy::UnsetEventL( TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aEventName )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ));
+    // Srcid. i.e. master id
+    User::LeaveIfError( remoteRequest->AppendId( aMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( remoteRequest->AppendId( SETID( aSlaveId, 0 ) ) );
+    
+    // Set event
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdUnsetEvent ) ); 
+        
+    // Event name
+    User::LeaveIfError( remoteRequest->Append( aEventName ) ); 
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+            iTestModuleIf.RemoteSend( remoteRequest->Message() ) );    
+    
+    CleanupStack::PopAndDestroy( remoteRequest );    
+    }
+
+void CRemoteCallsProxy::ReleaseEventL( TUint32 aMasterId, TUint16 aSlaveId, const TDesC& aEventName )
+    {
+    CStifTFwIfProt* remoteRequest = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( remoteRequest );
+    
+    remoteRequest->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        remoteRequest->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ));
+    // Srcid. i.e. master id
+    User::LeaveIfError( remoteRequest->AppendId( aMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( remoteRequest->AppendId( SETID( aSlaveId, 0 ) ) );
+    
+    // Release event
+    User::LeaveIfError(
+        remoteRequest->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRelease )); 
+
+    // Event name
+    User::LeaveIfError( remoteRequest->Append( aEventName ) );
+    
+    RDebug::Print( _L("[STIF Master sending request] %S"), &remoteRequest->Message() );
+
+    User::LeaveIfError( 
+            iTestModuleIf.RemoteSend( remoteRequest->Message() ) );    
+    
+    CleanupStack::PopAndDestroy( remoteRequest );
+    }
+
+void CRemoteCallsProxy::SetSlaveAllocateFreeMonitor( MSlaveAllocateFreeMonitor* aSlaveAllocateFreeMonitor )
+    {
+    iSlaveAllocateFreeMonitor = aSlaveAllocateFreeMonitor;
+    }
+
+void CRemoteCallsProxy::SetRemoteTestCasesMonitor( MRemoteTestCasesMonitor* aRemoteTestCasesMonitor )
+    {
+    iRemoteTestCasesMonitor = aRemoteTestCasesMonitor;
+    }
+
+void CRemoteCallsProxy::SetRemoteEventsMonitor( MRemoteEventsMonitor* aRemoteEventsMonitor )
+    {
+    iRemoteEventsMonitor = aRemoteEventsMonitor;
+    }
+
+void CRemoteCallsProxy::SetRemoteSendReceiveMonitor( MRemoteSendReceiveMonitor* aRemoteSendReceiveMonitor )
+    {
+    iRemoteSendReceiveMonitor = aRemoteSendReceiveMonitor;
+    }
+
+void CRemoteCallsProxy::SetReceiveErrorHandler( MReceiveErrorHandler* aReceiveErrorHandler )
+    {
+    iReceiveErrorHandler = aReceiveErrorHandler;
+    }
+
+void CRemoteCallsProxy::StartReceivingL()
+    {
+    iTestModuleIf.RemoteReceive( iReceivedRemoteMsg, iStatus );        
+    SetActive();
+    }
+
+void CRemoteCallsProxy::DispatchReceivedRemoteMsgL()
+    {
+    _LIT( KErrMsg, "Error during slave respons handling");
+    
+    iReceiveErrorDescription = KErrMsg;
+    
+    CStifTFwIfProt* msg = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( msg );
+    TRAPD( err, msg->SetL( iReceivedRemoteMsg ); );
+    if( err != KErrNone )
+        {
+        __TRACE( KError, (_L("Response parsing failed")));
+        User::Leave( err );
+        }
+    
+    // Check protocol identifiers
+    if( ( msg->SrcDevId() == 0 ) ||
+        ( msg->DstDevId() == 0 ) ||
+        ( msg->DstTestId() == 0 ) )
+        {
+        __TRACE( KError, (_L("Illegal deviceid received")));
+        User::Leave( KErrGeneral );
+        }
+    
+    // This is master, cannot receive anything else but responses
+    if( msg->iMsgType != CStifTFwIfProt::EMsgResponse )
+        {
+        __TRACE( KError, (_L("Illegal message received %d"), 
+            msg->iMsgType ));
+        User::Leave( KErrGeneral );        
+        }
+        
+    switch( msg->iRespType )
+        {
+        case CStifTFwIfProt::EMsgReserve:
+            {
+            ReceiveResponseReserveL( msg );
+            }
+            break;
+        case CStifTFwIfProt::EMsgRelease:
+            {
+            ReceiveResponseReleaseL( msg );
+            }            
+            break;
+        case CStifTFwIfProt::EMsgRemote:
+            {         
+            __TRACE( KMessage, (_L("ReceiveResponse Remote")));
+            switch( msg->iCmdType )
+                {
+                case CStifTFwIfProt::ECmdRun:
+                    ReceiveResponseRunL( msg );
+                    break;
+                case CStifTFwIfProt::ECmdPause:
+                case CStifTFwIfProt::ECmdResume:
+                case CStifTFwIfProt::ECmdCancel:
+                    ReceiveResponseTestCtlL( msg );
+                    break;
+                case CStifTFwIfProt::ECmdRequest:
+                case CStifTFwIfProt::ECmdRelease:
+                case CStifTFwIfProt::ECmdSetEvent:
+                case CStifTFwIfProt::ECmdUnsetEvent:
+                    ReceiveResponseEventCtlL( msg );                    
+                    break;
+                case CStifTFwIfProt::ECmdSendReceive:
+                    ReceiveResponseSendReceiveL( msg );                    
+                    break;
+                default:
+                    ReceiveResponseSendUnknownL( msg );                    
+                    break;
+                }
+            }            
+            break;
+        default:
+            User::Leave( KErrGeneral );
+        } 
+               
+    CleanupStack::PopAndDestroy( msg );    
+    iReceiveErrorDescription = KNullDesC;
+    }
+
+void CRemoteCallsProxy::ReceiveResponseReserveL( CStifTFwIfProt* aMsg )
+    {
+    _LIT( KErrMsg, "Error during slave allocate respons handling");
+    __TRACE( KMessage, (_L("ReceiveResponse Reserve")));
+    
+    // Check protocol Src test id
+    if( aMsg->SrcTestId() != 0 )
+        {
+        __TRACE( KError, (_L("Illegal deviceid received")));
+        User::Leave( KErrGeneral );
+        }
+    
+    if( aMsg->iResult != KErrNone )
+        {
+        __TRACE( KError, (_L("Response with error %d"), aMsg->iResult ));
+        User::Leave( aMsg->iResult );
+        }
+    
+    iReceiveErrorDescription = KErrMsg;
+    iSlaveAllocateFreeMonitor->NotifySlaveAllocatedL( aMsg->SrcDevId() );
+    iReceiveErrorDescription = KNullDesC;
+    __TRACE( KMessage, (_L("Slave allocated succesfully, continue execution")));
+    }
+
+void CRemoteCallsProxy::ReceiveResponseReleaseL( CStifTFwIfProt* aMsg )
+    {
+    _LIT( KErrMsg, "Error during slave release respons handling");
+    __TRACE( KMessage, (_L("ReceiveResponse Release")));
+    
+    // Check protocol Src test id
+    if( aMsg->SrcTestId() != 0 )
+        {
+        __TRACE( KError, (_L("Illegal deviceid received")));
+        User::Leave( KErrGeneral );
+        }
+    
+    if( aMsg->iResult != KErrNone )
+        {
+        __TRACE( KError, (_L("Response with error %d"), aMsg->iResult ));
+        User::Leave( aMsg->iResult );
+        }
+
+    iReceiveErrorDescription = KErrMsg;
+    iSlaveAllocateFreeMonitor->NotifySlaveFreedL( aMsg->SrcDevId() );
+    iReceiveErrorDescription = KNullDesC;
+    __TRACE( KMessage, (_L("Slave freed succesfully, continue execution")));
+    }
+
+void CRemoteCallsProxy::ReceiveResponseRunL( CStifTFwIfProt* aMsg )
+    {
+    _LIT( KErrMsgRun, "Error during remote sub test casse run respons handling");
+
+    
+    TPtrC tmp = CStifTFwIfProt::RunStatus( aMsg->iRunStatus ); 
+    __TRACE( KMessage, (_L("ReceiveResponse Remote Run %S"), &tmp ));
+
+    
+    if ( iRemoteTestCasesMonitor == NULL )
+        {
+        return;
+        }
+    
+    switch( aMsg->iRunStatus )
+        {
+        case CStifTFwIfProt::ERunStarted:
+            {
+            iReceiveErrorDescription = KErrMsgRun;
+            iRemoteTestCasesMonitor->NotifyTestCaseStartedL( aMsg->SrcDevId(), aMsg->SrcTestId() );
+            iReceiveErrorDescription = KNullDesC;
+            }
+            break;
+        case CStifTFwIfProt::ERunError:
+        case CStifTFwIfProt::ERunReady:
+            {
+            TFullTestResult testCaseResult;
+            switch( aMsg->iResultCategory )
+                {
+                case CStifTFwIfProt::EResultNormal:
+                    testCaseResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECaseExecuted;
+                    testCaseResult.iTestResult.iResult = aMsg->iResult;
+                    testCaseResult.iCaseExecutionResultCode = 0;
+                    break;
+                case CStifTFwIfProt::EResultPanic:
+                    testCaseResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECasePanic;
+                    testCaseResult.iTestResult.iResult = KErrGeneral;
+                    testCaseResult.iCaseExecutionResultCode = aMsg->iResult;
+                    break;
+                case CStifTFwIfProt::EResultException:
+                    testCaseResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECaseException;
+                    testCaseResult.iTestResult.iResult = KErrGeneral;
+                    testCaseResult.iCaseExecutionResultCode = aMsg->iResult;
+                    break;
+                case CStifTFwIfProt::EResultTimeout:
+                    testCaseResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECaseTimeout;                
+                    testCaseResult.iTestResult.iResult = KErrGeneral;
+                    testCaseResult.iCaseExecutionResultCode = aMsg->iResult;
+                    break;
+                case CStifTFwIfProt::EResultLeave:
+                    testCaseResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECaseLeave;                
+                    testCaseResult.iTestResult.iResult = KErrGeneral;
+                    testCaseResult.iCaseExecutionResultCode = aMsg->iResult;
+                    break;
+                default:
+                    User::Leave( KErrGeneral );
+                }
+            
+            iReceiveErrorDescription = KErrMsgRun;
+            if ( aMsg->iRunStatus == CStifTFwIfProt::ERunError )
+                {
+                iRemoteTestCasesMonitor->NotifyTestCaseRunErrorL( aMsg->SrcDevId(), testCaseResult );
+                }
+            else
+                {
+                iRemoteTestCasesMonitor->NotifyTestCaseFinishedL( aMsg->SrcDevId(), aMsg->SrcTestId(), testCaseResult );
+                }
+            iReceiveErrorDescription = KNullDesC;
+            }
+            break;
+        default:
+            // Should never come here
+            User::Leave( KErrGeneral );    
+        }        
+    }
+
+void CRemoteCallsProxy::ReceiveResponseTestCtlL( CStifTFwIfProt* aMsg )
+    {
+    _LIT( KErrMsgPause, "Error during remote sub test casse pause respons handling");
+    _LIT( KErrMsgResume, "Error during remote sub test casse resume respons handling");
+    _LIT( KErrMsgCancel, "Error during remote sub test casse cancel respons handling");
+
+    if( aMsg->iResult != KErrNone )
+        {
+        __TRACE( KError, (_L("Response with error %d"), aMsg->iResult ));
+        User::Leave( aMsg->iResult );
+        }
+        
+    switch( aMsg->iCmdType )
+        {
+        case CStifTFwIfProt::ECmdPause:
+            {
+            __TRACE( KMessage, (_L("ReceiveResponse Remote Pause")));
+            iReceiveErrorDescription = KErrMsgPause;
+            iRemoteTestCasesMonitor->NotifyTestCasePausedL( aMsg->SrcDevId(), aMsg->SrcTestId() );
+            iReceiveErrorDescription = KNullDesC;
+            }
+            break;
+        case CStifTFwIfProt::ECmdResume:
+            {
+            __TRACE( KMessage, (_L("ReceiveResponse Remote Resume")));
+            iReceiveErrorDescription = KErrMsgResume;
+            iRemoteTestCasesMonitor->NotifyTestCaseResumedL( aMsg->SrcDevId(), aMsg->SrcTestId() );
+            iReceiveErrorDescription = KNullDesC;
+            }
+            break;
+        case CStifTFwIfProt::ECmdCancel:
+            __TRACE( KMessage, (_L("ReceiveResponse Remote Cancel")));
+            iReceiveErrorDescription = KErrMsgCancel;
+            iRemoteTestCasesMonitor->NotifyTestCaseCancelledL( aMsg->SrcDevId(), aMsg->SrcTestId() );
+            iReceiveErrorDescription = KNullDesC;
+            break;
+        default:
+            // Should never come here
+            User::Leave( KErrGeneral );
+        }    
+    }
+
+void CRemoteCallsProxy::ReceiveResponseEventCtlL( CStifTFwIfProt* aMsg )
+    {
+    _LIT( KErrMsgRequest, "Error during remote event request respons handling");
+    _LIT( KErrMsgStateChanged, "Error during remote event state change respons handling");
+    _LIT( KErrMsgSet, "Error during remote event set respons handling");
+    _LIT( KErrMsgUnset, "Error during remote event unset respons handling");
+    _LIT( KErrMsgRelease, "Error during remote event release respons handling");
+    
+    if ( iRemoteEventsMonitor == NULL )
+        {
+        return;
+        }
+    
+    switch( aMsg->iCmdType )
+        {
+        case CStifTFwIfProt::ECmdRequest:
+            {
+            if ( ( aMsg->iEventStatus == CStifTFwIfProt::EEventSet ) || 
+                    ( aMsg->iEventStatus == CStifTFwIfProt::EEventUnset ) )
+                {
+                iReceiveErrorDescription = KErrMsgStateChanged;
+                iRemoteEventsMonitor->NotifyEventStateChangedL( 
+                        aMsg->SrcDevId(),
+                        aMsg->iEventName,
+                        aMsg->iEventStatus,
+                        aMsg->iEventType,
+                        aMsg->iResult
+                        );
+                iReceiveErrorDescription = KNullDesC;
+                }
+            else
+                {
+                iReceiveErrorDescription = KErrMsgRequest;
+                iRemoteEventsMonitor->NotifyEventRequestedL( 
+                        aMsg->SrcDevId(),
+                        aMsg->iEventName,
+                        aMsg->iEventStatus,
+                        aMsg->iEventType,
+                        aMsg->iResult
+                        );
+                iReceiveErrorDescription = KNullDesC;
+                }
+            }
+            break;
+        case CStifTFwIfProt::ECmdRelease:
+            {
+            iReceiveErrorDescription = KErrMsgRelease;
+            iRemoteEventsMonitor->NotifyEventReleasedL( 
+                    aMsg->SrcDevId(),
+                    aMsg->iEventName,
+                    aMsg->iResult
+                    );
+            iReceiveErrorDescription = KNullDesC;
+            }
+            break;
+        case CStifTFwIfProt::ECmdSetEvent:
+            {
+            iReceiveErrorDescription = KErrMsgSet;
+            iRemoteEventsMonitor->NotifyEventSetCompletedL( 
+                    aMsg->SrcDevId(),
+                    aMsg->iEventName,
+                    aMsg->iResult
+                    );
+            iReceiveErrorDescription = KNullDesC;
+            }
+            break;
+        case CStifTFwIfProt::ECmdUnsetEvent:
+            {
+            iReceiveErrorDescription = KErrMsgUnset;
+            iRemoteEventsMonitor->NotifyEventUnsetCompletedL( 
+                    aMsg->SrcDevId(),
+                    aMsg->iEventName,
+                    aMsg->iResult
+                    );
+            iReceiveErrorDescription = KNullDesC;
+            }
+            break;
+        default:
+            // Should never come here
+            User::Leave( KErrGeneral );
+        }
+    
+    }
+
+void CRemoteCallsProxy::ReceiveResponseSendReceiveL( CStifTFwIfProt* aMsg )
+    {
+    _LIT( KErrMsgStarted, "Error during remote sendreceive started respons handling");
+    _LIT( KErrMsgResult, "Error during remote sendreceive result respons handling");
+
+    if ( iRemoteSendReceiveMonitor == NULL )
+        {
+        return;
+        }
+    
+    switch( aMsg->iRunStatus )
+        {
+        case CStifTFwIfProt::ERunStarted:
+            {
+            iReceiveErrorDescription = KErrMsgStarted;
+            iRemoteSendReceiveMonitor->NotifySendReceiveStartedL( aMsg->SrcDevId() );
+            iReceiveErrorDescription = KNullDesC;
+            break;
+            }
+        case CStifTFwIfProt::ERunError:
+        case CStifTFwIfProt::ERunReady:
+            {
+            iReceiveErrorDescription = KErrMsgResult;
+            iRemoteSendReceiveMonitor->NotifySendReceiveResultL( 
+                    aMsg->SrcDevId(),
+                    aMsg->iRunStatus,
+                    aMsg->iResult );
+            iReceiveErrorDescription = KNullDesC;
+            break;
+            }
+        default:
+            {
+            // Should never come here
+            User::Leave( KErrGeneral );    
+            }
+        }
+    }
+
+void CRemoteCallsProxy::ReceiveResponseSendUnknownL( CStifTFwIfProt* aMsg )
+    {
+    _LIT( KErrMsg, "Error during remote send unknown respons handling");
+
+    if ( iRemoteSendReceiveMonitor == NULL )
+        {
+        return;
+        }
+    
+    iReceiveErrorDescription = KErrMsg;
+    iRemoteSendReceiveMonitor->NotifySendUnknownL( aMsg->SrcDevId(), aMsg->iResult );
+    iReceiveErrorDescription = KNullDesC;
+    }
+
+CSlave* CSlave::NewL()
+    {
+    CSlave* self = new(ELeave)CSlave;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CSlave::~CSlave()
+    {
+    iSubTestCases.Reset(); // CSlave does not own sub test cases objects
+    iSubTestCases.Close();
+    
+    iEvents.ResetAndDestroy();
+    iEvents.Close();
+    
+    delete iNestedASLoop;
+    iNestedASLoop = NULL;
+    
+    delete iName;
+    iName = NULL;
+    }
+
+CSlave::CSlave()
+    {    
+    }
+
+void CSlave::ConstructL()
+    {
+    iName = HBufC::NewL( 0 );
+    iNestedASLoop = new(ELeave)CActiveSchedulerWait;
+    }
+
+const TDesC& CSlave::GetName() const
+    {
+    return *iName;
+    }
+
+void CSlave::SetNameL( const TDesC& aName )
+    {
+    HBufC* tmp = aName.AllocL();
+    delete iName;
+    iName = tmp;
+    }
+
+TUint32 CSlave::GetMasterId() const
+    {    
+    return iMasterId;
+    }
+
+void CSlave::SetMasterId( TUint32 aMasterId )
+    {
+    iMasterId = aMasterId;
+    }
+
+TUint16 CSlave::GetSlaveId() const
+    {
+    return iSlaveId;
+    }
+
+TBool CSlave::HasRunningTestCases() const
+    {
+    if ( iSubTestCases.Count() > 0 )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+void CSlave::RegisterSubTestCaseL( CRemoteSubTestCaseRunner* aSubTestCase )
+    {
+    iSubTestCases.AppendL( aSubTestCase );
+    }
+        
+void CSlave::UnregisterSubTestCaseL( CRemoteSubTestCaseRunner* aSubTestCase )
+    {    
+    TInt idx = iSubTestCases.Find( aSubTestCase );
+    if ( idx >= 0 )
+        {
+        iSubTestCases.Remove( idx );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    if ( ( !HasRunningTestCases() ) && iNestedASLoop->IsStarted() )
+        {
+        iNestedASLoop->AsyncStop();
+        }
+    }
+        
+RPointerArray<CRemoteSubTestCaseRunner>& CSlave::GetSubTestCases()
+    {
+    return iSubTestCases;
+    }
+
+void CSlave::WaitForSubTestCasesL()
+    {
+    if ( iNestedASLoop->IsStarted() )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    if ( !HasRunningTestCases() )
+        {
+        return;
+        }
+    
+    iNestedASLoop->Start();
+    }
+
+void CSlave::CancelWaitForSubTestCases()
+    {
+    iNestedASLoop->AsyncStop();
+    }
+
+void CSlave::AddEventL( TEventTS* aEvent )
+    {
+    iEvents.AppendL( aEvent );
+    }
+
+void CSlave::RemoveEventL( TEventTS* aEvent )
+    {
+    TInt idx = iEvents.Find( aEvent );
+    if ( idx >= 0 )
+        {
+        iEvents.Remove( idx );        
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }    
+    }
+
+TEventTS* CSlave::GetEvent( const TDesC& aName )
+    {
+    for ( TInt i = 0; i < iEvents.Count(); i++ )
+        {
+        if ( iEvents[ i ]->Name() == aName )
+            {
+            return iEvents[ i ];
+            }
+        }
+    
+    return NULL;
+    }
+
+RPointerArray<TEventTS>& CSlave::GetEvents()
+    {
+    return iEvents;
+    }
+
+#ifdef LOGGER
+#undef LOGGER
+#endif
+
+#define LOGGER iTestRunner->GetLogger()
+
+void CSlave::SetSlaveId( TUint16 aSlaveId )
+    {
+    iSlaveId = aSlaveId;
+    }
+
+CSlavesManager* CSlavesManager::NewL( CTestRunner* aTestRunner, CTestModuleIf& aTestModuleIf )
+    {
+    CSlavesManager* self = new(ELeave)CSlavesManager( aTestRunner, aTestModuleIf );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CSlavesManager::~CSlavesManager()
+    {
+    Cancel();
+    iOperationTimeoutTimer.Close();
+
+    iRemoteCallsProxy->Cancel();
+    
+    delete iSlaveForAllocate;
+    iSlaveForAllocate = NULL;
+    
+    iSlaves.ResetAndDestroy();
+    iSlaves.Close();
+    
+    delete iNestedASLoop;
+    iNestedASLoop = NULL;
+    
+    delete iRemoteCallsProxy;
+    iRemoteCallsProxy = NULL;
+    }
+
+CSlavesManager::CSlavesManager( CTestRunner* aTestRunner, CTestModuleIf& aTestModuleIf )
+:CActive( EPriorityNormal ), iTestRunner( aTestRunner ), 
+ iTestModuleIf( aTestModuleIf ), iOperationTimeout( 30000000 )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+void CSlavesManager::ConstructL()
+    {
+    iOperationTimeoutTimer.CreateLocal();
+    iRemoteCallsProxy = CRemoteCallsProxy::NewL( iTestModuleIf, LOGGER );
+    iNestedASLoop = new(ELeave)CActiveSchedulerWait;
+    
+    iRemoteCallsProxy->SetReceiveErrorHandler( this );
+    iRemoteCallsProxy->SetSlaveAllocateFreeMonitor( this );
+    iRemoteCallsProxy->SetRemoteTestCasesMonitor( this );
+    iRemoteCallsProxy->SetRemoteEventsMonitor( this );
+    iRemoteCallsProxy->SetRemoteSendReceiveMonitor( this );
+    }
+
+void CSlavesManager::SlaveAllocateL( const TDesC& aName, const TDesC& aType )
+    {
+    if ( iOperation != ESMOIdle )
+        {
+        User::Leave( KErrInUse );
+        }
+    if ( GetSlave( aName ) != NULL )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+    
+    delete iSlaveForAllocate;
+    iSlaveForAllocate = NULL;
+    
+    CSlave* slaveForAllocate = CSlave::NewL();
+    CleanupStack::PushL( slaveForAllocate );
+    slaveForAllocate->SetNameL( aName );
+    slaveForAllocate->SetMasterId( KRemoteProtocolMasterId );
+
+    iRemoteCallsProxy->AllocateL( KRemoteProtocolMasterId, aType );    
+    CleanupStack::Pop( slaveForAllocate );
+    iSlaveForAllocate = slaveForAllocate;    
+    iOperation = ESMOSlaveAllocate;
+    iLastOperationResult = KErrNone;
+    
+    iOperationTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iLastOperationResult );
+    }
+
+void CSlavesManager::SlaveFreeL( const TDesC& aName )
+    {
+    if ( iOperation != ESMOIdle )
+        {
+        User::Leave( KErrInUse );
+        }
+    CSlave* slave = GetSlave( aName );
+    
+    if ( slave == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    if ( slave->HasRunningTestCases() )
+        {
+    
+        }
+    
+    iSlaves.Remove( iSlaves.Find( slave ) );
+    
+    TUint32 masterId = slave->GetMasterId();
+    TUint16 slaveId = slave->GetSlaveId();
+
+    delete slave;
+
+    iRemoteCallsProxy->FreeL( masterId, slaveId );        
+    iOperation = ESMOSlaveFree;
+    iLastOperationResult = KErrNone;
+    
+    iOperationTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iLastOperationResult );
+    }
+
+void CSlavesManager::SendReceiveL( CSlave* aSlave, const TDesC& aMessage )
+    {
+    if ( iOperation != ESMOIdle )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    iRemoteCallsProxy->SendReceiveL( aSlave->GetMasterId(), 
+            aSlave->GetSlaveId(), aMessage );    
+    iOperation = ESMOSendReceiveWaitForStarted;
+    
+    iOperationTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iLastOperationResult );    
+    }
+
+void CSlavesManager::SendUnknownL( CSlave* aSlave, const TDesC& aCommand, const TDesC& aMessage )
+    {
+    if ( iOperation != ESMOIdle )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    iRemoteCallsProxy->SendUnknownL( aSlave->GetMasterId(), 
+            aSlave->GetSlaveId(), aCommand, aMessage );    
+    iOperation = ESMOSendUnknown;
+    
+    iOperationTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iLastOperationResult );  
+    }
+
+CSlave* CSlavesManager::GetSlave( const TDesC& aName )
+    {
+    for ( TInt i = 0; i < iSlaves.Count(); i++ )
+        {
+        if ( iSlaves[ i ]->GetName() == aName )
+            {
+            return iSlaves[ i ];
+            }
+        }
+    return NULL;
+    }
+
+CSlave* CSlavesManager::GetSlave( TUint16 aSlaveId )
+    {
+    for ( TInt i = 0; i < iSlaves.Count(); i++ )
+        {
+        if ( iSlaves[ i ]->GetSlaveId() == aSlaveId )
+            {
+            return iSlaves[ i ];
+            }
+        }
+    return NULL;
+    }
+
+RPointerArray<CSlave>& CSlavesManager::GetSlaves()
+    {
+    return iSlaves;
+    }
+
+CRemoteCallsProxy* CSlavesManager::GetRemoteCallsProxy()
+    {
+    return iRemoteCallsProxy;
+    }
+
+void CSlavesManager::EventRequestL( CSlave* aSlave, TEventTS* aEvent )
+    {
+    if ( iOperation != ESMOIdle )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    iEventForRequest = aEvent;
+    
+    iRemoteCallsProxy->RequestEventL( aSlave->GetMasterId(),
+            aSlave->GetSlaveId(), iEventForRequest->Name() );    
+    iOperation = ESMOEventRequest;
+    iLastOperationResult = KErrNone;
+    
+    iOperationTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    iNestedASLoop->Start();
+    
+    iEventForRequest = NULL;
+    
+    User::LeaveIfError( iLastOperationResult );
+    }
+
+void CSlavesManager::EventReleaseL( CSlave* aSlave, const TDesC& aEventName )
+    {
+    if ( iOperation != ESMOIdle )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    iRemoteCallsProxy->ReleaseEventL( aSlave->GetMasterId(),
+            aSlave->GetSlaveId(), aEventName );    
+    iOperation = ESMOEventRelease;
+    
+    iOperationTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iLastOperationResult );
+    }
+
+void CSlavesManager::EventSetL( CSlave* aSlave, const TDesC& aEventName, TEventIf::TEventType aEventType )
+    {
+    if ( iOperation != ESMOIdle )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    iRemoteCallsProxy->SetEventL( aSlave->GetMasterId(),
+            aSlave->GetSlaveId(), aEventName, aEventType );    
+    iOperation = ESMOEventSet;
+    
+    iOperationTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iLastOperationResult );
+    }
+
+void CSlavesManager::EventUnsetL( CSlave* aSlave, const TDesC& aEventName )
+    {
+    if ( iOperation != ESMOIdle )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    iRemoteCallsProxy->UnsetEventL( aSlave->GetMasterId(), 
+            aSlave->GetSlaveId(), aEventName );    
+    iOperation = ESMOEventUnset;
+    
+    iOperationTimeoutTimer.After( iStatus, iOperationTimeout );
+    SetActive();
+    iNestedASLoop->Start();
+    
+    User::LeaveIfError( iLastOperationResult );
+    }
+
+void CSlavesManager::NotifySlaveAllocatedL( TUint16 aSlaveId )
+    {
+    Cancel(); // Stop operation timeout monitor
+
+    if( iOperation != ESMOSlaveAllocate )
+        {        
+        iLastOperationResult = KErrNotReady;
+        delete iSlaveForAllocate;
+        iSlaveForAllocate = NULL;
+        User::Leave( KErrNotReady );
+        }
+    else
+        {
+        iSlaveForAllocate->SetSlaveId( aSlaveId );
+        iSlaves.AppendL( iSlaveForAllocate );
+        iSlaveForAllocate = NULL;
+        iLastOperationResult = KErrNone;
+        }
+
+    iOperation = ESMOIdle;
+    iNestedASLoop->AsyncStop();
+    }
+
+void CSlavesManager::NotifySlaveFreedL( TUint16 /*aSlaveId*/ )
+    {
+    Cancel(); // Stop operation timeout monitor
+
+    if( iOperation != ESMOSlaveFree )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    iLastOperationResult = KErrNone;
+    
+    iOperation = ESMOIdle;
+    iNestedASLoop->AsyncStop();
+    }
+
+void CSlavesManager::NotifyTestCaseStartedL( TUint16 aSlaveId, TUint16 aSlaveTestId )
+    {
+    for ( TInt i = 0; i < iSlaves.Count(); i++ )
+        {
+        if ( iSlaves[ i ]->GetSlaveId() == aSlaveId )
+            {
+            RPointerArray<CRemoteSubTestCaseRunner>& remoteTestCases = 
+                    iSlaves[ i ]->GetSubTestCases();
+            for ( TInt k = 0; k < remoteTestCases.Count(); k++ )
+                {
+                if ( remoteTestCases[ k ]->IsRunSubTestCaseRequestOngoing() )
+                    {
+                    remoteTestCases[ k ]->NotifyTestCaseStartedL( aSlaveTestId );
+                    // There should be only one test case which waits for 
+                    // run test case request response
+                    return;
+                    }
+                }        
+            }
+        }
+    
+    // There is no test case which waits for run request response
+    User::Leave( KErrNotFound );
+    }
+
+void CSlavesManager::NotifyTestCaseRunErrorL( TUint16 aSlaveId, const TFullTestResult& aTestCaseResult )
+    {
+    for ( TInt i = 0; i < iSlaves.Count(); i++ )
+        {
+        if ( iSlaves[ i ]->GetSlaveId() == aSlaveId )
+            {
+            RPointerArray<CRemoteSubTestCaseRunner>& remoteTestCases = 
+                    iSlaves[ i ]->GetSubTestCases();
+            for ( TInt k = 0; k < remoteTestCases.Count(); k++ )
+                {
+                if ( remoteTestCases[ k ]->IsRunSubTestCaseRequestOngoing() )
+                    {
+                    remoteTestCases[ k ]->NotifyTestCaseRunError( aTestCaseResult );
+                    // There should be only one test case which waits for 
+                    // run test case request response
+                    return;
+                    }
+                }        
+            }
+        }
+    
+    // There is no test case which waits for run request response
+    User::Leave( KErrNotFound );
+    }
+
+void CSlavesManager::NotifyTestCaseFinishedL( TUint16 aSlaveId, TUint16 aSlaveTestId, const TFullTestResult& aTestCaseResult )
+    {
+    for ( TInt i = 0; i < iSlaves.Count(); i++ )
+        {
+        if ( iSlaves[ i ]->GetSlaveId() == aSlaveId )
+            {
+            RPointerArray<CRemoteSubTestCaseRunner>& remoteTestCases = 
+                    iSlaves[ i ]->GetSubTestCases();
+            for ( TInt k = 0; k < remoteTestCases.Count(); k++ )
+                {
+                if ( remoteTestCases[ k ]->GetTestCaseId() == aSlaveTestId )
+                    {
+                    remoteTestCases[ k ]->NotifyTestCaseFinishedL( aTestCaseResult );
+                    // There should be only one test case which waits for 
+                    // run test case request response
+                    return;
+                    }
+                }        
+            }
+        }
+    // There is no test case which waits for run request response
+    User::Leave( KErrNotFound );
+    }
+
+void CSlavesManager::NotifyTestCasePausedL( TUint16 aSlaveId, TUint16 aSlaveTestId )
+    {    
+    for ( TInt i = 0; i < iSlaves.Count(); i++ )
+        {
+        if ( iSlaves[ i ]->GetSlaveId() == aSlaveId )
+            {
+            RPointerArray<CRemoteSubTestCaseRunner>& remoteTestCases = 
+                    iSlaves[ i ]->GetSubTestCases();
+            for ( TInt k = 0; k < remoteTestCases.Count(); k++ )
+                {
+                if ( remoteTestCases[ k ]->GetTestCaseId() == aSlaveTestId )
+                    {
+                    remoteTestCases[ k ]->NotifyTestCasePausedL();
+                    // There should be only one test case which waits for 
+                    // run test case request response
+                    return;
+                    }
+                }        
+            }
+        }
+    // There is no test case which waits for run request response
+    User::Leave( KErrNotFound );
+    }
+
+void CSlavesManager::NotifyTestCaseResumedL( TUint16 aSlaveId, TUint16 aSlaveTestId )
+    {    
+    for ( TInt i = 0; i < iSlaves.Count(); i++ )
+        {
+        if ( iSlaves[ i ]->GetSlaveId() == aSlaveId )
+            {
+            RPointerArray<CRemoteSubTestCaseRunner>& remoteTestCases = 
+                    iSlaves[ i ]->GetSubTestCases();
+            for ( TInt k = 0; k < remoteTestCases.Count(); k++ )
+                {
+                if ( remoteTestCases[ k ]->GetTestCaseId() == aSlaveTestId )
+                    {
+                    remoteTestCases[ k ]->NotifyTestCaseResumedL();
+                    // There should be only one test case which waits for 
+                    // run test case request response
+                    return;
+                    }
+                }        
+            }
+        }
+    // There is no test case which waits for run request response
+    User::Leave( KErrNotFound );
+    }
+
+void CSlavesManager::NotifyTestCaseCancelledL( TUint16 aSlaveId, TUint16 aSlaveTestId )
+    {    
+    for ( TInt i = 0; i < iSlaves.Count(); i++ )
+        {
+        if ( iSlaves[ i ]->GetSlaveId() == aSlaveId )
+            {
+            RPointerArray<CRemoteSubTestCaseRunner>& remoteTestCases = 
+                    iSlaves[ i ]->GetSubTestCases();
+            for ( TInt k = 0; k < remoteTestCases.Count(); k++ )
+                {
+                if ( remoteTestCases[ k ]->GetTestCaseId() == aSlaveTestId )
+                    {
+                    remoteTestCases[ k ]->NotifyTestCaseCancelledL();
+                    // There should be only one test case which waits for 
+                    // run test case request response
+                    return;
+                    }
+                }        
+            }
+        }
+    // There is no test case which waits for run request response
+    User::Leave( KErrNotFound );
+    }
+
+void CSlavesManager::NotifyEventRequestedL( TUint16 /*aSlaveId*/, 
+        const TDesC& aEventName, 
+        CStifTFwIfProt::TEventStatus aEventStatus,
+        TEventIf::TEventType /*aEventType*/,
+        TInt aResult )
+    {
+    if ( iOperation != ESMOEventRequest )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel(); // Stop operation timeout monitor    
+    
+    iLastOperationResult = KErrNone;
+    switch( aEventStatus )
+        {
+        case CStifTFwIfProt::EEventActive:
+            __TRACE( KMessage, (_L("Event %S active"), &aEventName ));
+            break;
+        case CStifTFwIfProt::EEventError:
+            __TRACE( KMessage, (_L("Event %S error %d"), &aEventName, aResult ));
+            iLastOperationResult = aResult;
+            break;
+        default:
+            User::Leave( KErrGeneral );
+        }    
+    
+    iOperation = ESMOIdle;
+    iNestedASLoop->AsyncStop();
+    }
+
+void CSlavesManager::NotifyEventStateChangedL( TUint16 aSlaveId, 
+        const TDesC& aEventName, 
+        CStifTFwIfProt::TEventStatus aEventStatus,
+        TEventIf::TEventType aEventType,
+        TInt aResult )
+    {
+    switch( aEventStatus )
+        {
+        case CStifTFwIfProt::EEventSet:
+            {
+            __TRACE( KMessage, (_L("Event %S set"), &aEventName ));
+            // Set event            
+            CSlave* slave = GetSlave( aSlaveId );
+            if ( slave != NULL )
+                {
+                TEventTS* event = slave->GetEvent( aEventName );
+                if ( event != NULL )
+                    {
+                    event->SetEvent( aEventType );
+                    }                
+                else
+                    {
+                    User::Leave( KErrNotFound );
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotFound );
+                }
+            }
+            break;
+        case CStifTFwIfProt::EEventUnset:
+            {
+            __TRACE( KMessage, (_L("Event %S set"), &aEventName ));
+            // Set event            
+            CSlave* slave = GetSlave( aSlaveId );
+            if ( slave != NULL )
+                {
+                TEventTS* event = slave->GetEvent( aEventName );
+                if ( event != NULL )
+                    {
+                    event->SetType( TEventIf::EUnsetEvent );
+                    }                
+                else
+                    {
+                    User::Leave( KErrNotFound );
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotFound );
+                }
+            }
+            break;
+        case CStifTFwIfProt::EEventError:
+            {
+            __TRACE( KMessage, (_L("Event %S error %d"), &aEventName, aResult ));
+            User::Leave( aResult );
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrGeneral );
+            }
+        }
+    }
+
+void CSlavesManager::NotifyEventReleasedL( TUint16 /*aSlaveId*/, 
+        const TDesC& /*aEventName*/, TInt aResult )
+    {
+    if ( iOperation != ESMOEventRelease )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel(); // Stop operation timeout monitor
+    
+    iOperation = ESMOIdle;
+    iLastOperationResult = aResult;
+    iNestedASLoop->AsyncStop();
+    }
+
+void CSlavesManager::NotifyEventSetCompletedL( TUint16 /*aSlaveId*/, 
+        const TDesC& /*aEventName*/, TInt aResult )       
+    {
+    if ( iOperation != ESMOEventSet )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel(); // Stop operation timeout monitor
+    
+    iOperation = ESMOIdle;
+    iLastOperationResult = aResult;
+    iNestedASLoop->AsyncStop();
+    }
+
+void CSlavesManager::NotifyEventUnsetCompletedL( TUint16 /*aSlaveId*/, 
+        const TDesC& /*aEventName*/, TInt aResult )        
+    {
+    if ( iOperation != ESMOEventUnset )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel(); // Stop operation timeout monitor
+    
+    iOperation = ESMOIdle;
+    iLastOperationResult = aResult;
+    iNestedASLoop->AsyncStop();
+    }
+
+
+void CSlavesManager::NotifySendReceiveStartedL( TUint16 /*aSlaveId*/ )
+    {
+    if ( iOperation != ESMOSendReceiveWaitForStarted )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel(); // Stop operation timeout monitor
+    
+    iOperation = ESMOSendReceiveWaitForReady;
+    }
+
+void CSlavesManager::NotifySendReceiveResultL( 
+        TUint16 /*aSlaveId*/, 
+        CStifTFwIfProt::TRunStatus /*aRunStatus*/,
+        TInt aRunResult )
+    {
+    if ( ( iOperation != ESMOSendReceiveWaitForStarted ) &&
+            ( iOperation != ESMOSendReceiveWaitForReady ) )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    iLastOperationResult = aRunResult;
+    
+    if ( iOperation == ESMOSendReceiveWaitForStarted )
+        {
+        Cancel(); // Stop operation timeout monitor
+        }
+    
+    iOperation = ESMOIdle;
+    iNestedASLoop->AsyncStop();
+    }
+
+void CSlavesManager::NotifySendUnknownL( TUint16 aSlaveId, TInt aResult )
+    {
+    if ( iOperation != ESMOSendUnknown )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    Cancel(); // Stop operation timeout monitor
+    
+    CSlave* slave = GetSlave( aSlaveId );
+    if( slave == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    iOperation = ESMOIdle;
+    iLastOperationResult = aResult; 
+    iNestedASLoop->AsyncStop();    
+    }
+
+void CSlavesManager::HandleRemoteReceiveError( TInt aError, const TDesC& aErrorDescription )
+    {
+    iTestRunner->HandleRemoteReceiveError( aError, aErrorDescription );
+    }
+
+void CSlavesManager::RunL()
+    {
+    // Last operation timeouted
+    if ( iOperation ==  ESMOSlaveAllocate )
+        {
+        delete iSlaveForAllocate;
+        iSlaveForAllocate = NULL;
+        }
+    
+    iLastOperationResult = KErrTimedOut;
+    iOperation = ESMOIdle;
+    iNestedASLoop->AsyncStop();
+    }
+
+void CSlavesManager::DoCancel()
+    {
+    iOperationTimeoutTimer.Cancel();
+    }
+
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+// File Logger
+#include "../testexecmdw/filelogger/group/bld.inf"
+
+// Ini File Parser
+#include "../testexecmdw/inifileparser/group/bld.inf"
+
+//TEF Test Module Framework
+#include "../teftestmodulefw/group/bld.inf"
+
+// TEF Wrapper Utility
+#include "../tefwrapper/group/bld.inf"
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
+//End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,42 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#include "testexecute.cfg"
+
+#include "../wrapperutils/group/bld.inf"
+#include "../logger/group/bld.inf"
+#include "../pipslogger/group/bld.inf"
+#include "../utils/group/bld.inf"
+#include "../teftestmodule/group/bld.inf"
+#include "../tefunit/group/bld.inf"
+#include "../tefutilities/group/bld.inf"
+// #include "../test/regressiontest/group/bld.inf"
+
+PRJ_EXPORTS
+..\Group\teftestmodulefw.iby   	\epoc32\rom\include\teftestmodulefw.iby
+..\Group\testexecute.ini		\epoc32\winscw\c\system\data\testexecute.ini
+..\Group\testexecute.ini		\epoc32\data\z\system\data\testexecute.ini
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
+
+#if !(defined TEF_LITE_VERSION)
+#include "../workshop/demoipsuite/group/bld.inf"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/release.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5 @@
+NOTESRC_RELEASER
+Nokia Corporation.
+
+NOTESRC_RELEASE_REASON
+tef release.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/tef.mrp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2005-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: 
+#
+
+component	ana_testfw_testexecfw_tef
+source		/src/tools/ana/testfw/testexecfw/tef
+exports		/src/tools/ana/testfw/testexecfw/tef/group
+binary		/src/tools/ana/testfw/testexecfw/tef/group	all
+notes_source    /src/tools/ana/testfw/testexecfw/tef/group/release.txt
+
+
+#  == IPR section auto-inserted from distribution.policy files  ==
+ipr T 
+
+# == end auto-inserted section ==
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/tef.tdf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tool name="TEF" 
+	description="Test Execute Framework"  
+	version="3.2.1032" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:noNamespaceSchemaLocation="TDF_v1.1.xsd">
+	
+  <files>
+    <file source="\epoc32\release\ARMV5\UDEB\gwstestexecute.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\" overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\gwstestexecute.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\" overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefcleanup.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"    overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefcleanup.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefplatsec.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefplatsec.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefunit.lib" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefutilityserver.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefutilityserver.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefutilityserverlite.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\tefutilityserverlite.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecute.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecute.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutelite.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutelite.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutelogclient.dll" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutepipslogclient.dll" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutelogclient.dll.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutepipslogclient.dll.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutelogengine.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutepipslogengine.exe" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutelogengine.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecutepipslogengine.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecuteutils.dll" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UDEB\testexecuteutils.dll.map" target="$EPOCROOT\epoc32\release\ARMV5\UDEB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\gwstestexecute.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\gwstestexecute.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefcleanup.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefcleanup.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefplatsec.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefplatsec.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefunit.lib" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefutilityserver.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefutilityserver.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefutilityserverlite.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\tefutilityserverlite.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecute.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecute.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutelite.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutelite.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"        overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutelogclient.dll" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutepipslogclient.dll" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutelogclient.dll.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"  overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutepipslogclient.dll.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"  overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutelogengine.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutelogengine.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"   overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutepipslogengine.exe" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecutepipslogengine.exe.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"   overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecuteutils.dll" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\UREL\testexecuteutils.dll.map" target="$EPOCROOT\epoc32\release\ARMV5\UREL\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecutelogclient.dso" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecutepipslogclient.dso" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecutelogclient.lib" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecutepipslogclient.lib" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecutelogclient{000a0000}.dso" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"   overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecutelogclient{000a0000}.lib" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"   overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecutepipslogclient{000a0000}.dso" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"   overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecutepipslogclient{000a0000}.lib" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"   overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecuteutils.dso" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"     overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecuteutils.lib" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"     overwrite="true"/>  
+    <file source="\epoc32\release\ARMV5\LIB\testexecuteutils{000a0000}.dso" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"       overwrite="true"/>
+    <file source="\epoc32\release\ARMV5\LIB\testexecuteutils{000a0000}.lib" target="$EPOCROOT\epoc32\release\ARMV5\LIB\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecutelogclient.lib" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecutepipslogclient.lib" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecuteutils.lib" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\gwstestexecute.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\tefcleanup.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\tefplatsec.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\tefunit.lib" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"          overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\tefutilityserver.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\" overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\tefutilityserverlite.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\" overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecute.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"      overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecutelite.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"      overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecutelogclient.dll" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecutepipslogclient.dll" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecutelogengine.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecutepipslogengine.exe" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\udeb\testexecuteutils.dll" target="$EPOCROOT\epoc32\release\WINSCW\udeb\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\gwstestexecute.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\gwstestexecute.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\tefcleanup.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"       overwrite="true"/>  
+    <file source="\epoc32\release\WINSCW\urel\tefcleanup.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\tefplatsec.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\tefplatsec.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"       overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\tefunit.lib" target="$EPOCROOT\epoc32\release\WINSCW\urel\"      overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\tefutilityserver.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\tefutilityserver.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\tefutilityserverlite.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\tefutilityserverlite.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecute.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"      overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecute.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"      overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutelite.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"      overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutelite.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"      overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutelogclient.dll" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutepipslogclient.dll" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutelogclient.dll.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutepipslogclient.dll.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutelogengine.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutelogengine.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutepipslogengine.exe" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecutepipslogengine.exe.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecuteutils.dll" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\release\WINSCW\urel\testexecuteutils.dll.map" target="$EPOCROOT\epoc32\release\WINSCW\urel\"     overwrite="true"/>
+    <file source="\epoc32\include\test\testexecutelog.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\testexecutepipslog.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\rom\include\testexecutelogger.iby" target="$EPOCROOT\epoc32\rom\include\"        overwrite="true"/>  
+    <file source="\epoc32\rom\include\testexecutepipslogger.iby" target="$EPOCROOT\epoc32\rom\include\"        overwrite="true"/>  
+    <file source="\epoc32\rom\include\testexecutepipsloggerclient.iby" target="$EPOCROOT\epoc32\rom\include\"        overwrite="true"/>  
+    <file source="\epoc32\include\test\testexecutestepbase.h" target="$EPOCROOT\epoc32\include\test\"      overwrite="true"/>
+    <file source="\epoc32\include\test\testexecuteserverbase.h" target="$EPOCROOT\epoc32\include\test\"        overwrite="true"/>
+    <file source="\epoc32\include\test\testexecuteclient.h" target="$EPOCROOT\epoc32\include\test\"        overwrite="true"/>
+    <file source="\epoc32\include\test\testexecuteserverutils.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\testexecuteserverutils.inl" target="$EPOCROOT\epoc32\include\test\"     overwrite="true"/>
+    <file source="\epoc32\include\test\tefshareddata.h" target="$EPOCROOT\epoc32\include\test\"        overwrite="true"/>
+    <file source="\epoc32\include\test\tefshareddata.inl" target="$EPOCROOT\epoc32\include\test\"      overwrite="true"/>
+    <file source="\epoc32\include\test\testshareddata.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\testshareddata.inl" target="$EPOCROOT\epoc32\include\test\"     overwrite="true"/>
+    <file source="\epoc32\include\test\tefexportconst.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\testexecutelogbase.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\testexecutelogger.h" target="$EPOCROOT\epoc32\include\test\"        overwrite="true"/>
+    <file source="\epoc32\include\test\tefscriptutils.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\tefunit.h" target="$EPOCROOT\epoc32\include\test\"      overwrite="true"/>
+    <file source="\epoc32\include\test\tefunit.inl" target="$EPOCROOT\epoc32\include\test\"        overwrite="true"/>
+    <file source="\epoc32\include\test\cteflogger.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\ctefunitserver.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\BlockItems.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\DataWrapper.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\TestServer2.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\TestBlockController.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\TestBlockController.inl" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\ActiveCallback.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\DataDictionary.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\TEFResult.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\CommandProcessor.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\TEFTimer.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\TEFUtils.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\DataAccess.h" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\include\test\DataWrapper.inl" target="$EPOCROOT\epoc32\include\test\"       overwrite="true"/>
+    <file source="\epoc32\engineeringtools\plugins\tef.vp" target="$EPOCROOT\epoc32\engineeringtools\plugins\"     overwrite="true"/>
+    <file source="\epoc32\rom\include\tefcleanup.iby" target="$EPOCROOT\epoc32\rom\include\"       overwrite="true"/>
+    <file source="\epoc32\rom\include\tefplatsec.iby" target="$EPOCROOT\epoc32\rom\include\"       overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\platsec\xml\platsecserver.xml" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\platsec\xml\"    overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\platsec\xml\platsecserver\capabilitypolicing.xml" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\platsec\xml\platsecserver\"       overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\platsec\xml\platsecserver\cleanup.xml" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\platsec\xml\platsecserver\"      overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\platsec\scripts\capabilitypolicing.script" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\platsec\scripts\"        overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\platsec\scripts\cleanup.script" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\platsec\scripts\"       overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\platsec\data\capabilitypolicing.ini" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\platsec\data\"     overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\eventlogserver\xml\eventlogserver.xml" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\eventlogserver\xml\"     overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\eventlogserver\xml\eventlogserver\example.xml" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\eventlogserver\xml\eventlogserver\"      overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\eventlogserver\scripts\example.script" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\eventlogserver\scripts\"     overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\eventlogserver\data\eventlogcontroler.ini" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\eventlogserver\data\"        overwrite="true"/>
+    <file source="\epoc32\rom\include\tefutilityserver.iby" target="$EPOCROOT\epoc32\rom\include\"     overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\tefutilityserver.xml" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\"       overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\tefutilityserver\buildinfologtest.xml" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\tefutilityserver\"         overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\tefutilityserver\formatdrivetest.xml" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\tefutilityserver\"      overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\tefutilityserver\scripts\buildinfologtest.script" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\tefutilityserver\scripts\"        overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\tefutilityserver\scripts\formatdrivetest.script" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\tefutilityserver\scripts\"     overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\tefutilityserver\data\formatdrivetest.ini" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\tefutilityserver\data\"      overwrite="true"/>
+    <file source="\epoc32\engineeringtools\tefutilities\documentation\tefutilities_how-to.doc" target="$EPOCROOT\epoc32\engineeringtools\tefutilities\documentation\"      overwrite="true"/>
+    <file source="\epoc32\rom\include\testexecute.iby" target="$EPOCROOT\epoc32\rom\include\"      overwrite="true"/>
+    <file source="\epoc32\rom\include\base_testexecutelite.iby" target="$EPOCROOT\epoc32\rom\include\"      overwrite="true"/>
+    <file source="\epoc32\winscw\c\system\data\testexecute.ini" target="$EPOCROOT\epoc32\winscw\c\system\data\"        overwrite="true"/>
+    <file source="\epoc32\data\Z\system\data\testexecute.ini" target="$EPOCROOT\epoc32\data\Z\system\data\"        overwrite="true"/>
+  </files>
+
+
+  <dependencies>
+    <dependency name="TestToolsUtilities1" />
+    <dependency name="TestToolsUtilities5" />
+    <dependency name="SystemMonitor" />
+  </dependencies>
+
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/teftestmodulefw.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,40 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+
+#ifndef __TEFTESTMODULEFW_IBY__
+#define __TEFTESTMODULEFW_IBY__
+
+#ifndef TEF_LITE
+#define TEF_LITE
+#endif
+
+#include <testexecutelogger.iby>
+#include <iniparser.iby>
+#include <rfilelogger.iby>
+#include <testexecutepipsloggerclient.iby>
+#include <wrapperutilsplugin.iby>
+
+
+file=ABI_DIR\BUILD_DIR\TEFTestModule.dll	SHARED_LIB_DIR\TEFTestModule.dll
+file=ABI_DIR\BUILD_DIR\TEFTestModuleLite.dll	SHARED_LIB_DIR\TEFTestModuleLite.dll
+
+// Below files are duplicated with testexecute.iby(TEF v1). They are commented out temporarily
+// If TEF v1 is removed from MCL, the two files should be added in rom.
+
+//file=ABI_DIR\BUILD_DIR\testexecuteutils.dll	SHARED_LIB_DIR\testexecuteutils.dll 
+//data=\epoc32\data\z\system\data\testexecute.ini			system\data\testexecute.ini
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/testexecute.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2005-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: 
+// Conditional includes for All capabilities and TEF LITE
+//
+
+// Uncomment these lines for an All Capability build
+//#if !defined (TEF_ALL_CAP)
+//#define TEF_ALL_CAP
+//#endif
+
+//Uncomment these lines for a TEF LITE build
+//#if !defined (TEF_LITE_VERSION)
+//#define TEF_LITE_VERSION
+//MACRO TEF_LITE
+//#endif
+
+// Uncomment these lines to make the logger session available by all threads within a process
+//#if !defined (TEF_SHARE_AUTO_VERSION)
+//#define TEF_SHARE_AUTO_VERSION
+//MACRO TEF_SHARE_AUTO
+//#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/testexecute.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,15 @@
+[TestExecute]
+HTML     	 	= ${SYSDRIVE}\logs\testexecute\
+XML      	 	= ${SYSDRIVE}\logs\testexecute\
+LogLevel   	 	= FULL
+//DefaultScriptDir 	= z:\sampletest\
+JustInTimeDebug	 	= 0
+LogMode		 	= HTML
+LogChannel		= File
+output_port		= 0
+RemotePanicDetection 	= OFF
+EnableIniAccessLog	= ON
+EnableTestsCountLog	= ON
+SystemStarter		= OFF
+DefaultSysDrive		= SYSDRIVE
+WaitForLoggingTime	= 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/group/testexecutelite.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#if !defined (TEF_LITE_VERSION)
+#define TEF_LITE_VERSION
+MACRO TEF_LITE
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/bmarm/testexecutelogclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,10 @@
+EXPORTS
+	Write__19RTestExecuteLogServRC7TDesC16 @ 1 NONAME R3UNUSED ; RTestExecuteLogServ::Write(TDesC16 const &)
+	CreateLog__19RTestExecuteLogServRC7TDesC16Q219RTestExecuteLogServ8TLogMode @ 2 NONAME R3UNUSED ; RTestExecuteLogServ::CreateLog(TDesC16 const &, RTestExecuteLogServ::TLogMode)
+	LogExtra__19RTestExecuteLogServPCUciiGt11TRefByValue1ZC7TDesC16PPSc @ 3 NONAME ; RTestExecuteLogServ::LogExtra(unsigned char const *, int, int, TRefByValue<TDesC16 const>, signed char **)
+	LogExtra__19RTestExecuteLogServPCUciiGt11TRefByValue1ZC7TDesC16e @ 4 NONAME ; RTestExecuteLogServ::LogExtra(unsigned char const *, int, int, TRefByValue<TDesC16 const>,...)
+	WriteFormat__19RTestExecuteLogServGt11TRefByValue1ZC6TDesC8e @ 5 NONAME ; RTestExecuteLogServ::WriteFormat(TRefByValue<TDesC8 const>,...)
+	WriteFormat__19RTestExecuteLogServGt11TRefByValue1ZC7TDesC16e @ 6 NONAME ; RTestExecuteLogServ::WriteFormat(TRefByValue<TDesC16 const>,...)
+	Write__19RTestExecuteLogServRC6TDesC8 @ 7 NONAME R3UNUSED ; RTestExecuteLogServ::Write(TDesC8 const &)
+	Connect__19RTestExecuteLogServ @ 8 NONAME R3UNUSED ; RTestExecuteLogServ::Connect(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/bwins/testexecutelogclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,13 @@
+EXPORTS
+	?Connect@RTestExecuteLogServ@@QAEHXZ @ 1 NONAME ; int RTestExecuteLogServ::Connect(void)
+	?CreateLog@RTestExecuteLogServ@@QAEHABVTDesC16@@W4TLogMode@1@@Z @ 2 NONAME ; int RTestExecuteLogServ::CreateLog(class TDesC16 const &, enum RTestExecuteLogServ::TLogMode)
+	?LogExtra@RTestExecuteLogServ@@QAAXPBEHHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 3 NONAME ; void RTestExecuteLogServ::LogExtra(unsigned char const *, int, int, class TRefByValue<class TDesC16 const >, ...)
+	?LogExtra@RTestExecuteLogServ@@QAEXPBEHHV?$TRefByValue@$$CBVTDesC16@@@@QAPAC@Z @ 4 NONAME ; void RTestExecuteLogServ::LogExtra(unsigned char const *, int, int, class TRefByValue<class TDesC16 const >, signed char * * const)
+	?Write@RTestExecuteLogServ@@QAEXABVTDesC16@@@Z @ 5 NONAME ; void RTestExecuteLogServ::Write(class TDesC16 const &)
+	?Write@RTestExecuteLogServ@@QAEXABVTDesC8@@@Z @ 6 NONAME ; void RTestExecuteLogServ::Write(class TDesC8 const &)
+	?WriteFormat@RTestExecuteLogServ@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 7 NONAME ; void RTestExecuteLogServ::WriteFormat(class TRefByValue<class TDesC16 const >, ...)
+	?WriteFormat@RTestExecuteLogServ@@QAAXV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 8 NONAME ; void RTestExecuteLogServ::WriteFormat(class TRefByValue<class TDesC8 const >, ...)
+	?WriteFormat@RTestExecuteLogServ@@QAEXV?$TRefByValue@$$CBVTDesC16@@@@QAPAC@Z @ 9 NONAME ; void RTestExecuteLogServ::WriteFormat(class TRefByValue<class TDesC16 const >, signed char * * const)
+	?WriteFormat@RTestExecuteLogServ@@QAEXV?$TRefByValue@$$CBVTDesC8@@@@QAPAC@Z @ 10 NONAME ; void RTestExecuteLogServ::WriteFormat(class TRefByValue<class TDesC8 const >, signed char * * const)
+	?SetLogLevel@RTestExecuteLogServ@@QAEXW4TLogSeverity@@@Z @ 11 NONAME ; void RTestExecuteLogServ::SetLogLevel(enum TLogSeverity)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/bwins/testexecutelogengineu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewServer@@YAHXZ @ 1 NONAME ; int __cdecl NewServer(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/eabi/testexecutelogclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,13 @@
+EXPORTS
+	_ZN19RTestExecuteLogServ11WriteFormatE11TRefByValueIK6TDesC8Ez @ 1 NONAME
+	_ZN19RTestExecuteLogServ11WriteFormatE11TRefByValueIK7TDesC16Ez @ 2 NONAME
+	_ZN19RTestExecuteLogServ5WriteERK6TDesC8 @ 3 NONAME
+	_ZN19RTestExecuteLogServ5WriteERK7TDesC16 @ 4 NONAME
+	_ZN19RTestExecuteLogServ7ConnectEv @ 5 NONAME
+	_ZN19RTestExecuteLogServ8LogExtraEPKhii11TRefByValueIK7TDesC16ESt9__va_list @ 6 NONAME
+	_ZN19RTestExecuteLogServ8LogExtraEPKhii11TRefByValueIK7TDesC16Ez @ 7 NONAME
+	_ZN19RTestExecuteLogServ9CreateLogERK7TDesC16NS_8TLogModeE @ 8 NONAME
+	_ZN19RTestExecuteLogServ11WriteFormatE11TRefByValueIK6TDesC8ESt9__va_list @ 9 NONAME
+	_ZN19RTestExecuteLogServ11WriteFormatE11TRefByValueIK7TDesC16ESt9__va_list @ 10 NONAME
+	_ZN19RTestExecuteLogServ11SetLogLevelE12TLogSeverity @ 11 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_EXPORTS
+..\inc\testexecutelog.h				\epoc32\include\test\testexecutelog.h
+..\group\testexecutelogger.iby		\epoc32\rom\include\testexecutelogger.iby
+PRJ_MMPFILES
+testexecutelogengine.mmp
+testexecutelogclient.mmp
+PRJ_TESTMMPFILES
+//..\test\group\testexecuteloggertest.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/group/testexecutelogclient.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+#include "../../Group/testexecute.cfg"
+//Unpaged
+TARGET      testexecutelogclient.dll
+
+CAPABILITY All
+TARGETTYPE  dll
+UID             0x1000008d 0x101F778B
+VENDORID 0x70000001
+
+//CAPABILITY ReadSystemData WriteSystemData ReadUserData WriteUserData PhoneNetwork //LocalNetwork
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH  ../src
+SOURCE      client.cpp
+
+USERINCLUDE   ../src
+
+LIBRARY		euser.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/group/testexecutelogengine.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2005-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:  
+* testexecutelogserver.mmp
+* Using relative paths for sourcepath and user includes
+* Unpaged
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+TARGET      testexecutelogengine.exe
+CAPABILITY All -Tcb
+TARGETTYPE  exe
+UID             0x100039CE 0x10281ADF  
+VENDORID 0x70000001
+
+
+APP_LAYER_SYSTEMINCLUDE
+
+//CAPABILITY
+
+SOURCEPATH  ../src
+SOURCE      server.Cpp
+SOURCE		main.cpp
+
+USERINCLUDE   ../src
+
+LIBRARY		euser.lib
+LIBRARY		efsrv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/group/testexecutelogger.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __TESTEXECUTE_LOGGER_IBY__
+#define __TESTEXECUTE_LOGGER_IBY__
+
+
+file=ABI_DIR\BUILD_DIR\testexecutelogclient.dll		SHARED_LIB_DIR\testexecutelogclient.dll
+file=ABI_DIR\BUILD_DIR\testexecutelogengine.exe	SHARED_LIB_DIR\testexecutelogengine.exe
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/inc/testexecutelog.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TestExecuteLog.h
+*/
+
+#if !(defined __TESTEXECUTE_LOG_H__)
+#define __TESTEXECUTE_LOG_H__
+
+#include <e32base.h>
+#include <test/tefexportconst.h>
+
+_LIT8(KTEFOverflowMessage8, "\t..Message Truncated");
+_LIT16(KTEFOverflowMessage16, "\t..Message Truncated");
+const TInt overflowMessageLen = 21; // Size of the truncation message. To be changed if the text above is changed
+
+/**
+ @internalComponent
+ @test
+ * Derived class implementation of TDes16Overflow class
+ * Implements the base class pure virtual Overflow() to handle descriptor overflow
+ * during AppendFormatList() operations on TDes16 objects
+ */
+class TTEFDes16Overflow : public TDes16Overflow
+	{
+	inline virtual void Overflow(TDes16& aDes)
+		{
+		TInt actualMessageLen = aDes.Length();
+		TInt maxLengthOfDes = aDes.MaxLength();
+
+		TInt midPosForEdit = maxLengthOfDes - overflowMessageLen;
+		if (actualMessageLen <= midPosForEdit)
+			{
+			aDes.Append(KTEFOverflowMessage16());
+			}
+		else
+			{
+			aDes.SetLength(midPosForEdit + overflowMessageLen);
+			aDes.Replace(midPosForEdit, overflowMessageLen, KTEFOverflowMessage16());
+			}
+		}
+	};
+
+/**
+ @internalComponent
+ @test
+ * Derived class implementation of TDes8Overflow class
+ * Implements the base class pure virtual Overflow() to handle descriptor overflow
+ * during AppendFormatList() operations on TDes8 objects
+ */
+class TTEFDes8Overflow : public TDes8Overflow
+	{
+	inline virtual void Overflow(TDes8& aDes)
+		{
+		TInt actualMessageLen = aDes.Length();
+		TInt maxLengthOfDes = aDes.MaxLength();
+
+		TInt midPosForEdit = maxLengthOfDes - overflowMessageLen;
+		if (actualMessageLen <= midPosForEdit)
+			{
+			aDes.Append(KTEFOverflowMessage8());
+			}
+		else
+			{
+			aDes.SetLength(midPosForEdit + overflowMessageLen);
+			aDes.Replace(midPosForEdit, overflowMessageLen, KTEFOverflowMessage8());
+			}
+		}
+	};
+
+class RTestExecuteLogServ : public RSessionBase
+/**
+@internalComponent
+@test
+*/
+	{
+public:
+	enum TLogMode{ELogModeAppend,ELogModeOverWrite};
+	// Logging level
+	enum TLogCommand{ECreateLog,EWriteLog};
+
+	IMPORT_C TInt Connect();
+	IMPORT_C TInt CreateLog(const TDesC& aLogFilePath,TLogMode aMode);
+	IMPORT_C void LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt,...);
+	IMPORT_C void Write(const TDesC& aLogBuffer);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC> aFmt,...);
+	IMPORT_C void Write(const TDesC8& aLogBuffer);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC8> aFmt,...);
+	IMPORT_C void LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt, VA_LIST aList);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC> aFmt, VA_LIST aList);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC8> aFmt, VA_LIST aList);
+	IMPORT_C void SetLogLevel(TLogSeverity aSeverity);
+private:
+	void WriteL(const TDesC& aLogBuffer);
+	void WriteL(TDes8& aLogBuffer);
+	void GetCPPModuleName(TDes& aModuleName, const TText8* aCPPFileName);
+	void AddTime(TDes8& aTime);
+	TLogSeverity iLogLevel;
+	};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/client.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,409 @@
+/*
+* Copyright (c) 2005-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:  
+* Source file for the client api
+*
+*/
+
+
+
+/**
+ @file Client.cpp
+*/
+#include <test/testexecutelog.h>
+
+
+const TInt KMaxFilename = 50;
+const TInt KLowMemBufLength = 128;
+
+// EKA1 requires DLL entry point
+
+
+EXPORT_C TInt RTestExecuteLogServ::Connect()
+/**
+ * @return int - Standard error codes
+ * EKA2 all variants and EKA1 target.
+ * Server is an exe
+ */
+	{
+	TVersion version(KTestExecuteLoggerMajorVersion,KTestExecuteLoggerMinorVersion,KTestExecuteLoggerBuildVersion);
+	// Assume the server is already running and attempt to create a session
+	TInt err = CreateSession(KTestExecuteLogServerName,version,8);
+	if(err == KErrNotFound)
+		{
+		// Server not running
+		// Construct the server binary name
+		_LIT(KEmpty,"");
+		// EKA2 is simple
+		// No path required
+		TBuf<32> serverFile;
+		serverFile.Copy(KTestExecuteLogServerName);
+		_LIT(KExe,".exe");
+		serverFile.Append(KExe);
+		RProcess server;
+		err = server.Create(serverFile,KEmpty);
+		if(err != KErrNone)
+			return err;
+		// Synchronise with the server
+		TRequestStatus reqStatus;
+		server.Rendezvous(reqStatus);
+		server.Resume();
+		// Server will call the reciprocal static synchronise call
+		User::WaitForRequest(reqStatus);
+		server.Close();
+		if(reqStatus.Int() != KErrNone)
+			return reqStatus.Int();
+		// Create the root server session
+		err = CreateSession(KTestExecuteLogServerName,version,8);
+		}
+
+#ifdef TEF_SHARE_AUTO
+	// Makes the session shared among all threads in the process
+  	if( err == KErrNone )
+  		{
+  		err = ShareAuto();
+  		}
+#endif
+
+	return err;
+	}
+
+///////
+EXPORT_C TInt RTestExecuteLogServ::CreateLog(const TDesC& aLogFilePath, TLogMode aMode)
+/**
+ * @param aLogFilePath - Full path and filename of the log file
+ * @param aMode - Overwrite or Append
+ * Makes synchronous call to the log server to create a log session
+ */
+	{
+	if(aLogFilePath.Length() > KMaxTestExecuteLogFilePath)
+		return KErrTooBig;
+
+	iLogLevel = TLogSeverity(ESevrAll);
+	TIpcArgs args;
+	args.Set(0,&aLogFilePath);
+	args.Set(1,aMode);
+	return SendReceive(ECreateLog,args);
+
+	}
+
+EXPORT_C void RTestExecuteLogServ::LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt,...)
+/**
+ * @param aFile - Source file name
+ * @param aLine - Source file line number
+ * @param aSeverity - ERR, WARN, INFO
+ * @param aFmt - UNICODE format string
+ */
+	{
+	if (aSeverity>iLogLevel) 
+		{
+		return;
+		}
+	// Set up a Variable argument list and call private method
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	LogExtra(aFile, aLine, aSeverity, aFmt, aList);
+	VA_END(aList); 
+	}
+
+EXPORT_C void RTestExecuteLogServ::WriteFormat(TRefByValue<const TDesC> aFmt,...)
+/**
+ * @param aFmt - UNICODE format string
+ */
+	{
+	// Set up a Variable argument list and call private method
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	WriteFormat(aFmt, aList);
+	VA_END(aList); 
+	}
+
+
+EXPORT_C void RTestExecuteLogServ::Write(const TDesC& aLogBuffer)
+/**
+ * @param aLogBuffer - Pre-formatted UNICODE buffer
+ */
+	{
+	// Just call private method
+	// Ignore errors. Could put in ASSERT
+	TRAP_IGNORE(WriteL(aLogBuffer));
+	}
+
+
+EXPORT_C void RTestExecuteLogServ::WriteFormat(TRefByValue<const TDesC8> aFmt,...)
+/**
+ * @param aFmt - Narrow format string
+ */
+	{
+	// Set up a Variable argument list and call private method
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	WriteFormat(aFmt, aList);
+	VA_END(aList); 
+	}
+
+
+EXPORT_C void RTestExecuteLogServ::Write(const TDesC8& aLogBuffer)
+/**
+ * @param aLogBuffer - Pre-formatted Narrow buffer
+ */
+	{
+	// Create a larger buffer for adding terminators
+	// Could do more formatting but just allow for CRLF plus time stamp for the time being
+	HBufC8* buffer = HBufC8::New(aLogBuffer.Length()+20);
+	if(buffer)
+		{
+		TPtr8 ptr(buffer->Des());
+		AddTime(ptr);
+		ptr.Append(aLogBuffer);
+		// Ignore error for the time being. Could do an ASSERT
+		TRAP_IGNORE(WriteL(ptr));
+		delete buffer;
+		}
+	}
+
+void RTestExecuteLogServ::AddTime(TDes8& aLogBuffer)
+	{
+	TTime now;
+	now.UniversalTime();
+	TDateTime dateTime = now.DateTime();
+	_LIT8(KFormat,"%02d:%02d:%02d:%03d ");
+	// add the current time 
+	aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000)); 
+	}
+
+EXPORT_C void RTestExecuteLogServ::LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt, VA_LIST aList)
+/**
+ * @param aFile - Source file name
+ * @param aLine - Source file line number
+ * @param aSeverity - ERR, WARN, INFO
+ * @param aFmt - UNICODE format string
+ * @param aList - Variable argument list
+ *
+ * Format a log output line
+ */
+	{
+	if (aSeverity>iLogLevel) 
+		{
+		return;
+		}
+	// Create a filename string
+	TBuf16<KMaxFilename> fileName;
+	GetCPPModuleName(fileName, aFile);
+	// Create a buffer for formatting
+	HBufC* buffer = HBufC::New(KMaxTestExecuteLogLineLength*2);
+	if (buffer)
+		{
+		TPtr ptr(buffer->Des());
+		_LIT(KErr,"ERROR - ");
+		_LIT(KHigh,"HIGH - ");
+		_LIT(KWarn,"WARN - ");
+		_LIT(KMedium,"MEDIUM - ");
+		_LIT(KInfo,"INFO - ");
+		_LIT(KLow,"LOW - ");
+		_LIT(KFormat," %d %S %d ");
+		if(aSeverity == ESevrErr)
+			ptr.Append(KErr);
+		else if(aSeverity == ESevrHigh)
+			ptr.Append(KHigh);
+		else if(aSeverity == ESevrWarn)
+			ptr.Append(KWarn);
+		else if(aSeverity == ESevrMedium)
+			ptr.Append(KMedium);
+		else if (aSeverity == ESevrInfo)
+			ptr.Append(KInfo);
+		else if(aSeverity == ESevrLow)
+			ptr.Append(KLow);
+		else //if(aSeverity == ESevrAll)
+			ptr.Append(KInfo);
+		// Add the thread id
+		ptr.AppendFormat(KFormat,(TInt)RThread().Id(),&fileName, aLine);
+		TTEFDes16Overflow des16OverflowObject;
+		ptr.AppendFormatList(aFmt, aList, &des16OverflowObject);
+		
+
+		TRAP_IGNORE(WriteL(ptr));
+		delete buffer;
+		}
+	else
+		{
+		_LIT(KWarn,"WARN - ");
+		TBuf8<KLowMemBufLength> noMemory;
+		AddTime(noMemory);
+		noMemory.Append(KWarn);
+		noMemory.AppendFormat(_L8(" %d "), (TInt)RThread().Id());
+		noMemory.Append(fileName);
+		noMemory.AppendFormat(_L8(" %d %S"), aLine, &KLoggerNotEnoughMemory8());
+		TRAP_IGNORE(WriteL(noMemory));
+		}
+	}
+
+EXPORT_C void RTestExecuteLogServ::WriteFormat(TRefByValue<const TDesC> aFmt, VA_LIST aList)
+/**
+ * @param aFmt - UNICODE format string
+ * @param aList - Variable argument list
+ */
+	{
+	HBufC* buffer = HBufC::New(KMaxTestExecuteLogLineLength*2);
+	if (buffer)
+		{
+		TPtr ptr(buffer->Des());
+		TTEFDes16Overflow des16OverflowObject;
+		ptr.AppendFormatList(aFmt, aList, &des16OverflowObject);
+
+		TRAP_IGNORE(WriteL(ptr));
+		delete buffer;
+		}
+	else
+		{
+		TRAP_IGNORE(WriteL((TDes8&)KLoggerNotEnoughMemory8()));
+		}
+	}
+
+EXPORT_C void RTestExecuteLogServ::WriteFormat(TRefByValue<const TDesC8> aFmt, VA_LIST aList)
+/**
+ * @param aFmt - UNICODE format string
+ * @param aList - Variable argument list
+ */
+	{
+	HBufC8* buffer = HBufC8::New(KMaxTestExecuteLogLineLength*2);
+	if (buffer)
+		{
+		TPtr8 ptr(buffer->Des());
+		AddTime(ptr);
+		TTEFDes8Overflow des8OverflowObject;
+		ptr.AppendFormatList(aFmt, aList, &des8OverflowObject);
+
+		TRAP_IGNORE(WriteL(ptr));
+		delete buffer;
+		}
+	else
+		{
+		TRAP_IGNORE(WriteL((TDes8&)KLoggerNotEnoughMemory8()));
+		}
+	}
+
+void RTestExecuteLogServ::WriteL(const TDesC& aLogBuffer)
+/**
+ * @param aLogBuffer - UNICODE buffer
+ */
+	{
+	HBufC8* buffer = NULL;
+	TRAPD(err, buffer=HBufC8::NewL(aLogBuffer.Length()+20));
+	if (KErrNoMemory == err)
+		{
+		_LIT8(KWarn,"WARN - ");
+		TInt startPos = 13; // The place change "INFO" to "WARN"
+		TInt endPos = 7;
+		TInt wordCount = 5; // The message before the actual log info
+		TBuf8<KLowMemBufLength> buffer;
+		AddTime(buffer);
+		TLex lex(aLogBuffer);
+		lex.Mark();
+		for (TInt i=0; i<wordCount; i++)
+			{
+			lex.NextToken();
+			}
+		lex.SkipSpace();
+		buffer.Append(lex.MarkedToken());
+		buffer.Append(KLoggerNotEnoughMemory8);
+		buffer.Replace(startPos, endPos, KWarn);
+		WriteL(buffer);
+		}
+	else
+		{
+		CleanupStack::PushL(buffer);
+	  	TPtr8 ptr(buffer->Des());
+	  	AddTime(ptr);
+	  	ptr.Append(aLogBuffer);
+	  	WriteL(ptr);
+	  
+	  	CleanupStack::PopAndDestroy(buffer);
+		}
+	}
+
+void RTestExecuteLogServ::WriteL(TDes8& aLogBuffer)
+/**
+ * @param aLogBuffer - pre-formatted narrow buffer
+ * 
+ * Synchronous write to the server
+ */
+	{
+	_LIT8(KEnd,"\r\n");
+	// Check to see if there's room to add CRLF
+	if(aLogBuffer.Length()+2 > aLogBuffer.MaxLength())
+		{
+		HBufC8* buffer = NULL;
+		TRAPD(err, buffer=HBufC8::NewL(aLogBuffer.Length()+2));
+		if (KErrNoMemory == err)
+			{
+			aLogBuffer.Replace(aLogBuffer.Length()-2, 2, KEnd);
+			TIpcArgs args;
+			args.Set(0,&aLogBuffer);
+			args.Set(1,aLogBuffer.Length());
+			User::LeaveIfError(SendReceive(EWriteLog,args));
+			}
+		else
+			{
+			CleanupStack::PushL(buffer);
+			TPtr8 ptr(buffer->Des());
+			ptr.Copy(aLogBuffer);
+			ptr.Append(KEnd);
+			TIpcArgs args;
+			args.Set(0,&ptr);
+			args.Set(1,ptr.Length());
+			User::LeaveIfError(SendReceive(EWriteLog,args));
+			CleanupStack::PopAndDestroy(buffer);
+			}
+		}
+	else
+		{
+		aLogBuffer.Append(KEnd);
+		TIpcArgs args;
+		args.Set(0,&aLogBuffer);
+		args.Set(1,aLogBuffer.Length());
+		User::LeaveIfError(SendReceive(EWriteLog,args));
+		}
+	}
+
+void RTestExecuteLogServ::GetCPPModuleName(TDes& aModuleName, const TText8* aCPPFileName)
+/**
+ * @return aModuleName - Filename in descriptor
+ * @param aCppFileName - Filename
+ * Borrowed from scheduletest
+ */
+	{
+	TPtrC8 fileNamePtrC8(aCPPFileName);
+	// We do our own filename munging here; TParse can't help us since that's
+	// expressly for EPOC filepaths and here we've got whatever the build system is
+	// At present Win32 and Unix directory delimiters are supported
+	TInt lastDelimiter = Max(fileNamePtrC8.LocateReverse('\\'), fileNamePtrC8.LocateReverse('/'));
+	if(lastDelimiter >= 0 && lastDelimiter < fileNamePtrC8.Length() - 1)
+		{
+		// Found a delimiter which isn't trailing; update the ptr to start at the next char
+		TInt fileNameLen = Min(KMaxFilename, fileNamePtrC8.Length() - (lastDelimiter + 1));
+		fileNamePtrC8.Set(aCPPFileName + lastDelimiter + 1, fileNameLen);
+		}
+	else
+		{
+		// Didn't find a delimiter; take as much of the right-end of the name as fits
+		fileNamePtrC8.Set(aCPPFileName + Max(0, fileNamePtrC8.Length() - KMaxFilename), Min(fileNamePtrC8.Length(), KMaxFilename));
+		}
+	aModuleName.Copy(fileNamePtrC8);
+	}
+
+EXPORT_C void RTestExecuteLogServ::SetLogLevel(TLogSeverity aSeverity)
+	{
+	iLogLevel = aSeverity;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/main.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005-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:  
+* Server entry points
+* EKA1 & EKA2
+* EKA1 & WINS is a DLL. All others are exe's
+*
+*/
+
+
+
+/**
+ @file Main.cpp
+*/
+#include <test/testexecutelog.h>
+#include "server.h"
+
+// Emulator EKA1 is the only DLL case
+
+// EKA2 all variats & EKA1 target only
+// E32Main calls MainL()
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+	// Leave Platform security hooks in place
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler* sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CLogServer* server = NULL;
+	// Create the sever
+	TRAPD(err,server = CLogServer::NewL());
+	if(!err)
+		{
+		// Client Synchronisation different for EKA1 and EKA2
+		// EKA2 really simple. Client blocks on reciprocal Rendezvous call
+		RProcess::Rendezvous(KErrNone);
+		// Go into the Active scheduler
+		sched->Start();
+		// Free the server class
+		delete server;
+		}
+	delete sched;
+	}
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Process entry point. Called by client using RProcess API
+ */
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/server.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2005-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:  
+* Main log server engine.
+* Process log requests from multiple clients simultaneously.
+*
+*/
+
+
+
+/**
+ @file server.cpp
+*/
+#include "server.h"
+
+const TInt KLowMemBufLength = 128;
+
+CLogServer* CLogServer::NewL()
+/**
+ * @return - Instance of the log server
+ */
+	{
+	CLogServer * server = new (ELeave) CLogServer();
+	CleanupStack::PushL(server);
+	server->ConstructL();
+	// CServer base class call
+	server->StartL(KTestExecuteLogServerName);
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+void CLogServer::ConstructL()
+/**
+ * Second phase construction
+ */
+	{
+	User::LeaveIfError(Fs().Connect());
+	}
+
+
+CLogServer::CLogServer() : CServer2(EPriorityStandard,ESharableSessions)
+/**
+ * Constructor
+ */
+	{
+	}
+
+CLogServer::~CLogServer()
+/**
+ * Destructor
+ */
+	{
+	// Close the array of control structures
+	LogControl().Close();
+	Fs().Close();
+	}
+
+
+CSession2* CLogServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
+/**
+ * @param RMessage - RMessage for the session open
+ */
+	{
+	// Just create the session
+	CLogSession* session = new (ELeave) CLogSession();
+	return session;
+	}
+
+void CLogServer::ControlComplete(CLogFileControl& aControl)
+/**
+ * @param aControl - Logfile control class reference
+ *
+ * Checks to see if this control session can be removed 
+ */
+	{
+	// Check session count and the data buffers on the queue 
+	if(aControl.SessionCount() || !aControl.QueueEmpty())
+		return;
+
+	// There are no subsessions mapped to the logfile control class and
+	// no data buffers on its write queue
+	// Loop through the server's control array and remove it then delete it
+	TInt i;
+	for(i=0;i<LogControl().Count();i++)
+		{
+		if(&aControl == LogControl()[i])
+			{
+			// Done
+			LogControl().Remove(i);
+			delete &aControl;
+			break;
+			}
+		}
+	// If it's the last one then exit the server
+	if(!LogControl().Count())
+		CActiveScheduler::Stop();
+	}
+
+
+///////
+
+CLogSession::CLogSession()
+/**
+ * Constructor
+ */
+	{
+	}
+
+CLogSession::~CLogSession()
+/**
+ * Destructor
+ */
+	{
+	// Check for null
+	// Session close without a createlog call leaves iControl null
+	if(!iControl)
+		return;
+	// A logfile control structure can have multiple server sessions
+	// decrement its server session count
+	iControl->RemoveSession();
+	CLogServer* p=(CLogServer*) Server();
+	// Shuts Down the server if this is the last open session
+	p->ControlComplete(*iControl);
+	}
+
+void CLogSession::ServiceL(const RMessage2& aMessage)
+/**
+ * @param aMessage - Function and data for the session
+ */
+	{
+	switch(aMessage.Function())
+		{
+		// API CreateLog() call
+		case RTestExecuteLogServ::ECreateLog :
+			{
+			// Sanity check to make sure it's not been called multiple times
+			if(iControl)
+				{
+				aMessage.Complete(KErrInUse);
+				break;
+				}
+			// Get the filepath
+			// size policed on the client side
+			TBuf<KMaxTestExecuteLogFilePath> logFilePath;
+			// Read it
+			aMessage.ReadL(0,logFilePath);
+			// Get the log mode in the second argument
+			RTestExecuteLogServ::TLogMode logMode;
+			logMode = (RTestExecuteLogServ::TLogMode)aMessage.Int1();
+			// Get a pointer to the parent server
+			CLogServer* server=(CLogServer*) Server();
+			// For compare's convert the whole path to lower case
+			logFilePath.LowerCase();
+			// Get rid of leading and trailing spaces.
+			logFilePath.Trim();
+			// Loop the through the server's logfile control class list
+			// to see if there's a match.
+			TInt i;
+			for(i=0;i<server->LogControl().Count();i++)
+				{
+				if(server->LogControl()[i]->LogFile() == logFilePath)
+					// This file's already in open so we don't have to open it
+					break;
+				}
+			TInt err = KErrNone;
+			// Check the count
+			if(i < server->LogControl().Count())
+				// Map this session to an existing logfile control class in the list
+				iControl = server->LogControl()[i];
+			else
+				{
+				// Create a new logfile control class
+				// creates/opens the logfile
+				TRAP(err,iControl = CLogFileControl::NewL(*server,logFilePath,logMode));
+				if(!err)
+					// Append it to the logfile control class list
+					server->LogControl().Append(iControl);
+				}
+			if(!err)
+				// Increment its session count
+				iControl->AddSession();
+			aMessage.Complete(err);
+			}
+			break;
+		// One of the API write calls
+		case RTestExecuteLogServ::EWriteLog :
+			{
+			// Sanity check
+			if(!iControl)
+				{
+				aMessage.Complete(KErrNotFound);
+				break;
+				}
+			// Data can be any size
+			// Get the length from second argument
+			TInt bufferLength = aMessage.Int1();
+			// Get a heap buffer of the right size
+			HBufC8* buffer = NULL;
+			TRAPD(err, buffer = HBufC8::NewL(bufferLength));
+			if (KErrNoMemory == err)
+				{
+				// If the buffer length is bigger than 128 and allocation failed, try to allocate
+				// 128 bytes and set it the low memory information.
+				if (bufferLength > KLowMemBufLength)  
+					{
+					HBufC8* buf = HBufC8::NewL(KLowMemBufLength);
+					CleanupStack::PushL(buf);
+					TPtr8 ptr = buf->Des();
+					ptr.Copy(KLoggerNotEnoughMemory8);
+					CLogBuffer* logBuffer = new (ELeave) CLogBuffer(*buf);
+					CleanupStack::Pop(buf);
+					iControl->AddLogBuffer(*logBuffer);
+					}
+				}
+			else
+				{
+				CleanupStack::PushL(buffer);
+				TPtr8 ptr(buffer->Des());
+				// read the data
+				aMessage.ReadL(0,ptr);			
+				// Get a buffer control class contructed with the heap data
+				// takes ownership
+				CLogBuffer* logBuffer = new (ELeave) CLogBuffer(*buffer);
+				CleanupStack::Pop(buffer);
+				// Add it to the logfile control class buffer queue
+				iControl->AddLogBuffer(*logBuffer);
+				}
+			if(!iControl->IsActive())
+				// AO is idle, kick into life
+				iControl->Kick();
+			aMessage.Complete(KErrNone);
+			}
+			break;
+
+		default:
+			break;
+		}
+	}
+
+///////
+
+CLogFileControl* CLogFileControl::NewL(CLogServer& aParent, const TDesC& aLogFilePath,RTestExecuteLogServ::TLogMode aMode)
+/**
+ * @param aParent - Server reference for callback
+ * @param aLogFilePath - Full path and filename of the logfile
+ * @param aMode - Overwrite or Append
+ *
+ * First phase construction for logfile control class
+ */
+	{
+	CLogFileControl* self = new (ELeave) CLogFileControl(aParent,aLogFilePath);
+	self->ConstructL(aMode);
+	return self;
+	}
+
+CLogFileControl::CLogFileControl(CLogServer& aParent,const TDesC& aLogFilePath) :
+	iParent(aParent),
+	iLogFileName(aLogFilePath),
+	iTransmitted(EFalse)
+/**
+ * @param aParent - Server reference for callback
+ * @param aLogFilePath - Full path and filename of the logfile
+ *
+ * Constructor - Safe initialisation
+ */
+	{
+	iQueue.SetOffset(CLogBuffer::LinkOffset());
+	}
+
+void CLogFileControl::ConstructL(RTestExecuteLogServ::TLogMode aMode)
+/**
+ * @param aMode - Overwrite or Append
+ *
+ * Second phase construction - Create or open the logfile
+ */
+	{
+	if(aMode == RTestExecuteLogServ::ELogModeOverWrite)
+		// In overwrite mode replace
+		User::LeaveIfError(iLogFile.Replace(iParent.Fs(),iLogFileName,EFileWrite|EFileShareAny));
+	else
+		{
+		// For append try open then replace
+		TInt err = iLogFile.Open(iParent.Fs(),iLogFileName,EFileWrite|EFileShareAny);
+		if(err != KErrNone)
+			// Bomb out if replace fails
+			User::LeaveIfError(iLogFile.Replace(iParent.Fs(),iLogFileName,EFileWrite|EFileShareAny));
+		else
+			{
+			// Open worked. Position at EOF
+			TInt pos;
+			User::LeaveIfError(iLogFile.Seek(ESeekEnd,pos));
+			}
+		}
+	}
+
+CLogFileControl::~CLogFileControl()
+/**
+ * Destructor
+ * The server maintains a list of these classes and will not destruct one if there
+ * is data on its queue
+ * Destructor just closes the file handle.
+ */
+	{
+	iLogFile.Close();
+	}
+
+void CLogFileControl::RunL()
+/**
+ * Main File writing pump
+ * Called on write completion or Kick() by the session that accepts the data
+ */
+	{
+#if (defined _DEBUG)
+	_LIT(KPanic,"LogEng RunL()");
+#endif
+	__ASSERT_DEBUG(iStatus.Int() == KErrNone,User::Panic(KPanic,iStatus.Int()));
+	// Check to see if this is the result of write completion
+	if(iTransmitted)
+		{
+		// Write completed
+		// Remove the buffer at the head of the queue and free it
+		CLogBuffer* buffer = iQueue.First();
+		iQueue.Remove(*buffer);
+		delete buffer;
+		}
+	// Check to see if there's more on the queue
+	if(!iQueue.IsEmpty())
+		{
+		// There is so write the head of the queue
+		CLogBuffer* buffer = iQueue.First();	
+		SetActive();
+		// Set the flag to say we've transmitted
+		iTransmitted = ETrue;
+		iLogFile.Write(buffer->Buf(),iStatus);
+		iLogFile.Flush();
+		}
+	else
+		{
+		// Nothing on the queue
+		iTransmitted = EFalse;
+		// Call into the server to check if this resource can be freed
+		iParent.ControlComplete(*this);
+		}
+	}
+
+///////
+CLogBuffer::CLogBuffer(HBufC8& aLogBuffer) : iLogBuffer(aLogBuffer)
+/**
+ * @param aLogBuffer - Heap descriptor. This class takes ownership
+ * Constructor
+ */
+	{
+	}
+
+CLogBuffer::~CLogBuffer()
+/**
+ * Destructor
+ * This class owns a heap buffer so just free it
+ */
+	{
+	delete &iLogBuffer;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/server.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file Server.h
+*/
+
+#if (!defined __TESTEXECUTE_LOG_SERVER_H__)
+#define __TESTEXECUTE_LOG_SERVER_H__
+#include <e32base.h>
+#include <f32file.h>
+#include <test/testexecutelog.h>
+
+class CActiveBase : public CActive
+	{
+public:
+	inline 	TRequestStatus& Status();
+	inline 	void SetActive();
+	inline	void Kick();
+	inline	void Prime();
+	inline	void Complete(TInt aCode);
+	inline	virtual ~CActiveBase();
+protected:
+	inline	CActiveBase();
+	};
+
+class CLogBuffer : public CBase
+	{
+public:
+	CLogBuffer(HBufC8& aBuffer);
+	~CLogBuffer();
+	inline const TDesC8& Buf();
+	inline static TInt LinkOffset();
+private:
+	TSglQueLink iLink;
+	HBufC8& iLogBuffer;
+	};
+
+class CLogServer;
+class CLogFileControl : public CActiveBase
+	{
+public:
+	static CLogFileControl* NewL(CLogServer& aParent, const TDesC& aLogFilePath,RTestExecuteLogServ::TLogMode aMode);
+	~CLogFileControl();
+	void RunL();
+	inline void AddLogBuffer(CLogBuffer& aBuffer);
+	inline const TDesC& LogFile();
+	inline void DoCancel();
+	inline void AddSession();
+	inline void RemoveSession();
+	inline TInt SessionCount() const;
+	inline TBool QueueEmpty() const;
+
+private:
+	void ConstructL(RTestExecuteLogServ::TLogMode aMode);
+	CLogFileControl(CLogServer& aParent, const TDesC& aLogFilePath);
+private:
+	CLogServer& iParent;
+	TBuf<KMaxTestExecuteLogFilePath> iLogFileName;
+	RFile iLogFile;
+	TSglQue<CLogBuffer> iQueue;
+	TInt iSessionCount;
+	TBool iTransmitted;
+	};
+
+class CLogServer : public CServer2
+	{
+public:
+	static CLogServer* NewL();
+	~CLogServer();
+	void ControlComplete(CLogFileControl& aControl);
+	
+	inline RPointerArray<CLogFileControl>& LogControl();
+	inline RFs& Fs();
+
+	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
+	void SessionClosed();
+private:
+	CLogServer();
+	void ConstructL();
+private:
+	RFs iFs;
+	RPointerArray<CLogFileControl> iControl;
+	};
+
+class CLogSession : public CSession2
+	{
+public:
+	inline const CLogServer& LogServer() const;
+	CLogSession();
+	~CLogSession();
+	void ServiceL(const RMessage2& aMessage);
+private:
+	CLogFileControl* iControl;
+	};
+
+#include "Server.inl"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/src/server.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+
+inline TRequestStatus& CActiveBase::Status()
+	{return iStatus;}
+
+inline void CActiveBase::SetActive()
+	{
+	if(!IsActive())
+		CActive::SetActive();
+	}
+
+inline void CActiveBase::Kick()
+	{
+	Prime();
+	Complete(KErrNone);
+	}
+
+inline void CActiveBase::Prime()
+	{
+	iStatus = KRequestPending;
+	if(!IsActive())
+		CActive::SetActive();
+	}
+
+inline void CActiveBase::Complete(TInt aCode)
+	{
+	TRequestStatus* status = &iStatus;
+	User::RequestComplete(status,aCode);
+	}
+
+inline	CActiveBase::CActiveBase() : CActive(EPriorityStandard)
+	{CActiveScheduler::Add(this);}
+
+inline CActiveBase::~CActiveBase()
+	{}
+
+///////
+inline const TDesC& CLogFileControl::LogFile()
+	{return iLogFileName;}
+
+inline void CLogFileControl::DoCancel()
+	{}
+
+inline void CLogFileControl::AddSession()
+	{iSessionCount++;}
+
+inline void CLogFileControl::RemoveSession()
+	{iSessionCount--;}
+
+inline TInt CLogFileControl::SessionCount() const
+	{return iSessionCount;}
+
+inline TBool CLogFileControl::QueueEmpty() const
+	{return iQueue.IsEmpty();}
+
+inline void CLogFileControl::AddLogBuffer(CLogBuffer& aBuffer)
+	{iQueue.AddLast(aBuffer);}
+
+///////
+inline RPointerArray<CLogFileControl>& CLogServer::LogControl()
+	{return iControl;}
+
+inline RFs& CLogServer::Fs()
+	{return iFs;}
+
+///////
+inline const TDesC8& CLogBuffer::Buf()
+	{return iLogBuffer;} 
+
+inline TInt CLogBuffer::LinkOffset()
+	{return _FOFF(CLogBuffer,iLink);}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/test/group/testexecuteloggertest.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+SMPSAFE
+
+TARGET      testexecuteloggertest.exe
+TARGETTYPE  exe
+UID             0x100039CE 0x101F778D
+VENDORID 0x70000001
+
+SOURCEPATH  ../src
+SOURCE		testexecuteloggertest.cpp
+
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/test
+
+LIBRARY     	euser.lib
+LIBRARY     	efsrv.lib
+LIBRARY		testexecutelogclient.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/logger/test/src/testexecuteloggertest.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2005-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:  
+* Demonstration use of the TestExecute standalone logger client API
+*
+*/
+
+
+
+/**
+ @file TestExecuteLoggerTest.cpp
+*/
+#include <testexecutelog.h>
+#include <e32cons.h>
+#include <wrapperutilsplugin.h>
+
+_LIT(KLogFile1,"?:\\TestExecuteLoggerTest.txt");
+
+_LIT(K16BitText,"This is a short line of 16 Bit Text");
+_LIT8(K8BitText,"This is a short line of  8 Bit Text");
+
+_LIT(K16BitFormatText,"This is a short line of 16 Bit Format Text int = %d string = %S");
+_LIT8(K8BitFormatText,"This is a short line of  8 Bit Format Text int = %d string = %S");
+_LIT(K16BitString,"The String16");
+_LIT8(K8BitString,"The String8");
+
+LOCAL_C void MainL()
+	{
+	TDriveName defaultSysDrive(KTEFLegacySysDrive);
+
+	RFs fileServer;
+	TVersionName version(fileServer.Version().Name());
+	
+	if (fileServer.Version().iMajor >= 2 &&
+		fileServer.Version().iBuild >= 1100)
+		{
+		RLibrary pluginLibrary;
+		TInt pluginErr = pluginLibrary.Load(KTEFWrapperPluginDll);
+		if (pluginErr == KErrNone)
+			{
+			TLibraryFunction newl;
+			newl = pluginLibrary.Lookup(2);
+			CWrapperUtilsPlugin* plugin = (CWrapperUtilsPlugin*)newl();
+			TDriveUnit driveUnit(plugin->GetSystemDrive());
+			defaultSysDrive.Copy(driveUnit.Name());
+			delete plugin;
+			pluginLibrary.Close();
+			}
+		}
+
+	TFileName logFile1(KLogFile1);
+	logFile1.Replace(0, 2, defaultSysDrive);
+
+	_LIT(KTitle,"TestExecute Standalone Logger Test Code");
+	CConsoleBase* console = Console::NewL(KTitle,TSize(KConsFullScreen,KConsFullScreen));
+	CleanupStack::PushL(console);
+
+	_LIT(KMessage1,"Connect() To Logger and Close() immediately\r\n");
+	console->Printf(KMessage1);
+	RTestExecuteLogServ logger;
+	User::LeaveIfError(logger.Connect());
+	logger.Close();
+
+	_LIT(KMessage2,"Immediate re-Connect() To Logger and Close() immediately\r\n");
+	console->Printf(KMessage2);
+	User::LeaveIfError(logger.Connect());
+	logger.Close();
+
+	_LIT(KMessage3,"Immediate re-Connect() To Logger CreateLog() and Close() immediately\r\n");
+	console->Printf(KMessage3);
+	User::LeaveIfError(logger.Connect());
+	User::LeaveIfError(logger.CreateLog(logFile1,RTestExecuteLogServ::ELogModeOverWrite));
+	logger.Close();
+
+	// OS needs time to shutdown the server
+	// No delay means we get server terminated from the OS
+	User::After(1000000);
+
+	_LIT(KMessage4,"Connect() To Logger CreateLog() %S Call API's\r\n");
+	console->Printf(KMessage4,&logFile1);
+	User::LeaveIfError(logger.Connect());
+	User::LeaveIfError(logger.CreateLog(logFile1,RTestExecuteLogServ::ELogModeOverWrite));
+	TBuf<20> buf16(K16BitString);
+	TBuf8<20> buf8(K8BitString);
+	logger.Write(K16BitText);
+	logger.Write(K8BitText);
+	logger.WriteFormat(K16BitFormatText,16,&buf16);
+	logger.WriteFormat(K8BitFormatText,8,&buf8);
+	logger.LogExtra(((TText8*)__FILE__), __LINE__,ESevrInfo,K16BitFormatText,1,&buf16);
+
+	_LIT(KMessage5,"ALL API's Called - Call Close(),\r\nHit Any Key\r\n");
+	console->Printf(KMessage5);
+	console->Getch();
+	logger.Close();
+
+	CleanupStack::PopAndDestroy(console);
+
+	}
+
+// Entry point for all Epoc32 executables
+// See PSP Chapter 2 Getting Started
+GLDEF_C TInt E32Main()
+	{
+	// Heap balance checking
+	// See PSP Chapter 6 Error Handling
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAPD(err,MainL());
+	_LIT(KPanic,"LoggerTest");
+	__ASSERT_ALWAYS(!err, User::Panic(KPanic,err));
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/bwins/testexecutepipslogclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,14 @@
+EXPORTS
+	??4RTestExecutePIPSLogServ@@QAEAAV0@ABV0@@Z @ 1 NONAME ABSENT ; class RTestExecutePIPSLogServ & RTestExecutePIPSLogServ::operator=(class RTestExecutePIPSLogServ const &)
+	?Connect@RTestExecutePIPSLogServ@@QAEHXZ @ 2 NONAME ; int RTestExecutePIPSLogServ::Connect(void)
+	?CreateLog@RTestExecutePIPSLogServ@@QAEHABVTDesC16@@@Z @ 3 NONAME ; int RTestExecutePIPSLogServ::CreateLog(class TDesC16 const &)
+	?LogExtra@RTestExecutePIPSLogServ@@QAAXPBEHHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 4 NONAME ; void RTestExecutePIPSLogServ::LogExtra(unsigned char const *, int, int, class TRefByValue<class TDesC16 const >, ...)
+	?LogExtra@RTestExecutePIPSLogServ@@QAEXPBEHHV?$TRefByValue@$$CBVTDesC16@@@@QAPAC@Z @ 5 NONAME ; void RTestExecutePIPSLogServ::LogExtra(unsigned char const *, int, int, class TRefByValue<class TDesC16 const >, signed char * * const)
+	?SetLogLevel@RTestExecutePIPSLogServ@@QAEXW4TLogSeverity@@@Z @ 6 NONAME ; void RTestExecutePIPSLogServ::SetLogLevel(enum TLogSeverity)
+	?Write@RTestExecutePIPSLogServ@@QAEXABVTDesC16@@@Z @ 7 NONAME ; void RTestExecutePIPSLogServ::Write(class TDesC16 const &)
+	?Write@RTestExecutePIPSLogServ@@QAEXABVTDesC8@@@Z @ 8 NONAME ; void RTestExecutePIPSLogServ::Write(class TDesC8 const &)
+	?WriteFormat@RTestExecutePIPSLogServ@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 9 NONAME ; void RTestExecutePIPSLogServ::WriteFormat(class TRefByValue<class TDesC16 const >, ...)
+	?WriteFormat@RTestExecutePIPSLogServ@@QAAXV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 10 NONAME ; void RTestExecutePIPSLogServ::WriteFormat(class TRefByValue<class TDesC8 const >, ...)
+	?WriteFormat@RTestExecutePIPSLogServ@@QAEXV?$TRefByValue@$$CBVTDesC16@@@@QAPAC@Z @ 11 NONAME ; void RTestExecutePIPSLogServ::WriteFormat(class TRefByValue<class TDesC16 const >, signed char * * const)
+	?WriteFormat@RTestExecutePIPSLogServ@@QAEXV?$TRefByValue@$$CBVTDesC8@@@@QAPAC@Z @ 12 NONAME ; void RTestExecutePIPSLogServ::WriteFormat(class TRefByValue<class TDesC8 const >, signed char * * const)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/eabi/testexecutepipslogclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,14 @@
+EXPORTS
+	_ZN23RTestExecutePIPSLogServ11SetLogLevelE12TLogSeverity @ 1 NONAME
+	_ZN23RTestExecutePIPSLogServ11WriteFormatE11TRefByValueIK6TDesC8ESt9__va_list @ 2 NONAME
+	_ZN23RTestExecutePIPSLogServ11WriteFormatE11TRefByValueIK6TDesC8Ez @ 3 NONAME
+	_ZN23RTestExecutePIPSLogServ11WriteFormatE11TRefByValueIK7TDesC16ESt9__va_list @ 4 NONAME
+	_ZN23RTestExecutePIPSLogServ11WriteFormatE11TRefByValueIK7TDesC16Ez @ 5 NONAME
+	_ZN23RTestExecutePIPSLogServ5WriteERK6TDesC8 @ 6 NONAME
+	_ZN23RTestExecutePIPSLogServ5WriteERK7TDesC16 @ 7 NONAME
+	_ZN23RTestExecutePIPSLogServ7ConnectEv @ 8 NONAME
+	_ZN23RTestExecutePIPSLogServ8LogExtraEPKhii11TRefByValueIK7TDesC16ESt9__va_list @ 9 NONAME
+	_ZN23RTestExecutePIPSLogServ8LogExtraEPKhii11TRefByValueIK7TDesC16Ez @ 10 NONAME
+	_ZN23RTestExecutePIPSLogServ9CreateLogERK7TDesC16 @ 11 NONAME
+	_ZN23RTestExecutePIPSLogServaSERKS_ @ 12 NONAME ABSENT
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_EXPORTS
+..\inc\testexecutepipslog.h				\epoc32\include\test\testexecutepipslog.h
+..\group\testexecutepipslogger.iby		\epoc32\rom\include\testexecutepipslogger.iby
+..\group\testexecutepipsloggerclient.iby		\epoc32\rom\include\testexecutepipsloggerclient.iby
+
+PRJ_MMPFILES
+testexecutepipslogclient.mmp
+testexecutepipslogengine.mmp
+
+
+PRJ_TESTMMPFILES
+//..\test\group\testexecutepipsloggertest.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/testexecutepipslogclient.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+#include "../../group/testexecute.cfg"
+
+OS_LAYER_SYSTEMINCLUDE
+
+TARGET      testexecutepipslogclient.dll
+
+CAPABILITY All
+TARGETTYPE  dll
+UID             0x1000008d 0x10210D4D
+VENDORID 0x70000001
+
+SOURCEPATH  ../src
+SOURCE      client.cpp
+
+USERINCLUDE   ../src
+
+LIBRARY		euser.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/testexecutepipslogengine.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2005-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:  
+* testexecutepipslogserver.mmp
+* Using relative paths for sourcepath and user includes
+*
+*/
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+TARGET      testexecutepipslogengine.exe
+CAPABILITY All -Tcb
+TARGETTYPE  exe
+UID             0x100039CE 0x10210D4C
+VENDORID 0x70000001
+
+OS_LAYER_SYSTEMINCLUDE
+OS_LAYER_LIBC_SYSTEMINCLUDE
+
+SOURCEPATH  ../src
+SOURCE      server.cpp
+SOURCE		main.cpp 
+
+USERINCLUDE   ../src
+
+LIBRARY		euser.lib
+LIBRARY		efsrv.lib
+
+LIBRARY libc.lib
+STATICLIBRARY libcrt0.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/testexecutepipslogger.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __TESTEXECUTEPIPS_LOGGER_IBY__
+#define __TESTEXECUTEPIPS_LOGGER_IBY__
+
+
+file=ABI_DIR\BUILD_DIR\testexecutepipslogengine.exe		SHARED_LIB_DIR\testexecutepipslogengine.exe
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/group/testexecutepipsloggerclient.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __TESTEXECUTEPIPS_LOGGER_CLIENT_IBY__
+#define __TESTEXECUTEPIPS_LOGGER_CLIENT_IBY__
+
+
+file=ABI_DIR\BUILD_DIR\testexecutepipslogclient.dll		SHARED_LIB_DIR\testexecutepipslogclient.dll
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/inc/testexecutepipslog.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TestExecuteLog.h
+*/
+
+#if !(defined __TESTEXECUTE_PIPS_LOG_H__)
+#define __TESTEXECUTE_PIPS_LOG_H__
+
+#include <e32base.h>
+#include <test/tefexportconst.h>
+
+_LIT8(KTEFOverflowMessagePIPS8, "\t..Message Truncated");
+_LIT16(KTEFOverflowMessagePIPS16, "\t..Message Truncated");
+//const TInt overflowMessageLen1 = 21; // Size of the truncation message. To be changed if the text above is changed
+
+/**
+ @internalComponent
+ @test
+ * Derived class implementation of TDes16Overflow class
+ * Implements the base class pure virtual Overflow() to handle descriptor overflow
+ * during AppendFormatList() operations on TDes16 objects
+ */
+class TTEFDes16OverflowPIPS : public TDes16Overflow
+	{
+	inline virtual void Overflow(TDes16& aDes)
+		{
+		TInt actualMessageLen = aDes.Length();
+		TInt maxLengthOfDes = aDes.MaxLength();
+
+		TInt midPosForEdit = maxLengthOfDes - KTEFOverflowMessagePIPS16().Length();
+		if (actualMessageLen <= midPosForEdit)
+			{
+			aDes.Append(KTEFOverflowMessagePIPS16());
+			}
+		else
+			{
+			aDes.SetLength(midPosForEdit + KTEFOverflowMessagePIPS16().Length());
+			aDes.Replace(midPosForEdit, KTEFOverflowMessagePIPS16().Length(), KTEFOverflowMessagePIPS16());
+			}
+		}
+	};
+
+/**
+ @internalComponent
+ @test
+ * Derived class implementation of TDes8Overflow class
+ * Implements the base class pure virtual Overflow() to handle descriptor overflow
+ * during AppendFormatList() operations on TDes8 objects
+ */
+class TTEFDes8OverflowPIPS : public TDes8Overflow
+	{
+	inline virtual void Overflow(TDes8& aDes)
+		{
+		TInt actualMessageLen = aDes.Length();
+		TInt maxLengthOfDes = aDes.MaxLength();
+
+		TInt midPosForEdit = maxLengthOfDes - KTEFOverflowMessagePIPS8().Length();
+		if (actualMessageLen <= midPosForEdit)
+			{
+			aDes.Append(KTEFOverflowMessagePIPS8());
+			}
+		else
+			{
+			aDes.SetLength(midPosForEdit + KTEFOverflowMessagePIPS8().Length());
+			aDes.Replace(midPosForEdit, KTEFOverflowMessagePIPS8().Length(), KTEFOverflowMessagePIPS8());
+			}
+		}
+	};
+
+class RTestExecutePIPSLogServ : public RSessionBase
+/**
+@internalComponent
+@test
+*/
+	{
+public:
+	enum TLogMode{ELogModeAppend,ELogModeOverWrite};
+	// Logging level
+	enum TLogCommand{/*ECreateLog,*/EWriteLog};
+
+	IMPORT_C TInt Connect();
+	IMPORT_C TInt CreateLog(const TDesC& aLogFilePath);
+	IMPORT_C void LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt,...);
+	IMPORT_C void Write(const TDesC& aLogBuffer);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC> aFmt,...);
+	IMPORT_C void Write(const TDesC8& aLogBuffer);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC8> aFmt,...);
+	IMPORT_C void LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt, VA_LIST aList);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC> aFmt, VA_LIST aList);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC8> aFmt, VA_LIST aList);
+	IMPORT_C void SetLogLevel(TLogSeverity aSeverity);
+private:
+	void WriteL(const TDesC& aLogBuffer);
+	void WriteL(TDes8& aLogBuffer);
+	void GetCPPModuleName(TDes& aModuleName, const TText8* aCPPFileName);
+	void AddTime(TDes8& aTime);
+	TLogSeverity iLogLevel;
+	TBufC<KMaxTestExecuteLogFilePath> iLogFilename;
+	};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/client.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,366 @@
+/*
+* Copyright (c) 2005-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:  
+* Source file for the client api
+*
+*/
+
+
+
+/**
+ @file Client.cpp
+*/
+#include <test/testexecutepipslog.h>
+
+const TInt KMaxFilename = 50;
+// EKA1 requires DLL entry point
+EXPORT_C TInt RTestExecutePIPSLogServ::Connect()
+/**
+ * @return int - Standard error codes
+ * EKA2 all variants and EKA1 target.
+ * Server is an exe
+ */
+	{
+	TVersion version(KTestExecuteLoggerMajorVersion,KTestExecuteLoggerMinorVersion,KTestExecuteLoggerBuildVersion);
+	// Assume the server is already running and attempt to create a session
+	TInt err = CreateSession(KTestExecutePIPSLogServerName,version,8);
+	if(err == KErrNotFound)
+		{
+		// Server not running
+		// Construct the server binary name
+		_LIT(KEmpty,"");
+		// EKA2 is simple
+		// No path required
+		TBuf<32> serverFile;
+		serverFile.Copy(KTestExecutePIPSLogServerName);
+		_LIT(KExe,".exe");
+		serverFile.Append(KExe);
+		RProcess server;
+		err = server.Create(serverFile,KEmpty);
+		if(err != KErrNone)
+			return err;
+		// Synchronise with the server
+		TRequestStatus reqStatus;
+		server.Rendezvous(reqStatus);
+		server.Resume();
+		// Server will call the reciprocal static synchronise call
+		User::WaitForRequest(reqStatus);
+		server.Close();
+		if(reqStatus.Int() != KErrNone)
+			return reqStatus.Int();
+		// Create the root server session
+		err = CreateSession(KTestExecutePIPSLogServerName,version,8);
+		}
+
+#ifdef TEF_SHARE_AUTO
+	// Makes the session shared among all threads in the process
+  	if( err == KErrNone )
+  		{
+  		err = ShareAuto();
+  		}
+#endif
+
+	return err;
+	}
+
+EXPORT_C TInt RTestExecutePIPSLogServ::CreateLog(const TDesC& aLogFilePath)
+/**
+ * @param aLogFilePath - Full path and filename of the log file
+ * @param aMode - Overwrite or Append
+ * Makes synchronous call to the log server to create a log session
+ */
+	{
+	iLogFilename = aLogFilePath; 
+	return KErrNone;
+
+	}
+
+EXPORT_C void RTestExecutePIPSLogServ::LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt,...)
+/**
+ * @param aFile - Source file name
+ * @param aLine - Source file line number
+ * @param aSeverity - ERR, WARN, INFO
+ * @param aFmt - UNICODE format string
+ */
+	{
+	if (aSeverity>iLogLevel) 
+		{
+		return;
+		}
+	// Set up a Variable argument list and call private method
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	LogExtra(aFile, aLine, aSeverity, aFmt, aList);
+	VA_END(aList); 
+	}
+
+EXPORT_C void RTestExecutePIPSLogServ::WriteFormat(TRefByValue<const TDesC> aFmt,...)
+/**
+ * @param aFmt - UNICODE format string
+ */
+	{
+	// Set up a Variable argument list and call private method
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	WriteFormat(aFmt, aList);
+	VA_END(aList); 
+	}
+
+
+EXPORT_C void RTestExecutePIPSLogServ::Write(const TDesC& aLogBuffer)
+/**
+ * @param aLogBuffer - Pre-formatted UNICODE buffer
+ */
+	{
+	// Just call private method
+	// Ignore errors. Could put in ASSERT
+	TRAP_IGNORE(WriteL(aLogBuffer));
+	}
+
+
+EXPORT_C void RTestExecutePIPSLogServ::WriteFormat(TRefByValue<const TDesC8> aFmt,...)
+/**
+ * @param aFmt - Narrow format string
+ */
+	{
+	// Set up a Variable argument list and call private method
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	WriteFormat(aFmt, aList);
+	VA_END(aList); 
+	}
+
+
+EXPORT_C void RTestExecutePIPSLogServ::Write(const TDesC8& aLogBuffer)
+/**
+ * @param aLogBuffer - Pre-formatted Narrow buffer
+ */
+	{
+	// Create a larger buffer for adding terminators
+	// Could do more formatting but just allow for CRLF plus time stamp for the time being
+	HBufC8* buffer = HBufC8::New(aLogBuffer.Length()+20);
+	if(buffer)
+		{
+		TPtr8 ptr(buffer->Des());
+		AddTime(ptr);
+		ptr.Append(aLogBuffer);
+		// Ignore error for the time being. Could do an ASSERT
+		TRAP_IGNORE(WriteL(ptr));
+		delete buffer;
+		}
+	}
+
+void RTestExecutePIPSLogServ::AddTime(TDes8& aLogBuffer)
+/**
+ * @param aLogBuffer - the line to be decorated
+ * decorate the output with current time
+ */
+
+	{
+	TTime now;
+	now.UniversalTime();
+	TDateTime dateTime = now.DateTime();
+	_LIT8(KFormat,"%02d:%02d:%02d:%03d ");
+	// add the current time 
+	aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000)); 
+	}
+
+EXPORT_C void RTestExecutePIPSLogServ::LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt, VA_LIST aList)
+/**
+ * @param aFile - Source file name
+ * @param aLine - Source file line number
+ * @param aSeverity - ERR, WARN, INFO
+ * @param aFmt - UNICODE format string
+ * @param aList - Variable argument list
+ *
+ * Format a log output line
+ */
+	{
+	if (aSeverity>iLogLevel) 
+		{
+		return;
+		}
+	// Create a filename string
+	TBuf16<KMaxFilename> fileName;
+	GetCPPModuleName(fileName, aFile);
+	// Create a buffer for formatting
+	HBufC* buffer = HBufC::New(KMaxTestExecuteLogLineLength*2);
+	if (buffer)
+		{
+		TPtr ptr(buffer->Des());
+		_LIT(KErr,"ERROR - ");
+		_LIT(KHigh,"HIGH - ");
+		_LIT(KWarn,"WARN - ");
+		_LIT(KMedium,"MEDIUM - ");
+		_LIT(KInfo,"INFO - ");
+		_LIT(KLow,"LOW - ");
+		_LIT(KFormat," %d %S %d ");
+		if(aSeverity == ESevrErr)
+			ptr.Append(KErr);
+		else if(aSeverity == ESevrHigh)
+			ptr.Append(KHigh);
+		else if(aSeverity == ESevrWarn)
+			ptr.Append(KWarn);
+		else if(aSeverity == ESevrMedium)
+			ptr.Append(KMedium);
+		else if (aSeverity == ESevrInfo)
+			ptr.Append(KInfo);
+		else if(aSeverity == ESevrLow)
+			ptr.Append(KLow);
+		else //if(aSeverity == ESevrAll)
+			ptr.Append(KInfo);
+		// Add the thread id
+		ptr.AppendFormat(KFormat,(TInt)RThread().Id(),&fileName, aLine);
+		TTEFDes16OverflowPIPS des16OverflowObject;
+		ptr.AppendFormatList(aFmt, aList, &des16OverflowObject);
+		
+
+		TRAP_IGNORE(WriteL(ptr));
+		delete buffer;
+		}
+	}
+
+EXPORT_C void RTestExecutePIPSLogServ::WriteFormat(TRefByValue<const TDesC> aFmt, VA_LIST aList)
+/**
+ * @param aFmt - UNICODE format string
+ * @param aList - Variable argument list
+ */
+	{
+	HBufC* buffer = HBufC::New(KMaxTestExecuteLogLineLength*2);
+	if (buffer)
+		{
+		TPtr ptr(buffer->Des());
+		TTEFDes16OverflowPIPS des16OverflowObject;
+		ptr.AppendFormatList(aFmt, aList, &des16OverflowObject);
+
+		TRAP_IGNORE(WriteL(ptr));
+		delete buffer;
+		}
+	}
+
+EXPORT_C void RTestExecutePIPSLogServ::WriteFormat(TRefByValue<const TDesC8> aFmt, VA_LIST aList)
+/**
+ * @param aFmt - UNICODE format string
+ * @param aList - Variable argument list
+ */
+	{
+	HBufC8* buffer = HBufC8::New(KMaxTestExecuteLogLineLength*2);
+	if (buffer)
+		{
+		TPtr8 ptr(buffer->Des());
+		AddTime(ptr);
+		TTEFDes8OverflowPIPS des8OverflowObject;
+		ptr.AppendFormatList(aFmt, aList, &des8OverflowObject);
+
+		TRAP_IGNORE(WriteL(ptr));
+		delete buffer;
+		}
+	}
+
+void RTestExecutePIPSLogServ::WriteL(const TDesC& aLogBuffer)
+/**
+ * @param aLogBuffer - UNICODE buffer
+ */
+	{
+	HBufC8* buffer = HBufC8::NewLC(aLogBuffer.Length()+20);
+	TPtr8 ptr(buffer->Des());
+	AddTime(ptr);
+	ptr.Append(aLogBuffer);
+	WriteL(ptr);
+
+	CleanupStack::PopAndDestroy(buffer);
+	}
+
+void RTestExecutePIPSLogServ::WriteL(TDes8& aLogBuffer)
+/**
+ * @param aLogBuffer - pre-formatted narrow buffer
+ * 
+ * Synchronous write to the server
+ */
+	{
+	//try to make a buf out of pipeName...
+	
+	HBufC8* bufferFile = HBufC8::NewL(iLogFilename.Length());
+	TPtr8 ptrFile(bufferFile->Des());
+	ptrFile.Append(iLogFilename);
+	
+	_LIT8(KEnd,"\r\n");
+
+	TInt retValue = 0 ; 
+	// Check to see if there's room to add CRLF
+	if(aLogBuffer.Length()+2 > aLogBuffer.MaxLength())
+		{
+		HBufC8* buffer = HBufC8::NewLC(aLogBuffer.Length()+2);
+		TPtr8 ptr(buffer->Des());
+		ptr.Copy(aLogBuffer);
+		ptr.Append(KEnd);
+		TIpcArgs args;
+		args.Set(0,&ptr);
+		args.Set(1,ptr.Length());
+		args.Set(2,&ptrFile);
+		args.Set(3,iLogFilename.Length());
+
+		//User::LeaveIfError(SendReceive(EWriteLog,args));
+		retValue = SendReceive(EWriteLog,args) ; 
+		CleanupStack::PopAndDestroy(buffer);
+		}
+	else
+		{
+		aLogBuffer.Append(KEnd);
+		TIpcArgs args;
+		args.Set(0,&aLogBuffer);
+		args.Set(1,aLogBuffer.Length());
+		args.Set(2,&ptrFile);
+		args.Set(3,iLogFilename.Length());
+		//User::LeaveIfError(SendReceive(EWriteLog,args));
+		retValue = SendReceive(EWriteLog,args) ; 
+		}
+	delete bufferFile;
+	User::LeaveIfError(retValue) ; 
+	}
+
+void RTestExecutePIPSLogServ::GetCPPModuleName(TDes& aModuleName, const TText8* aCPPFileName)
+/**
+ * @return aModuleName - Filename in descriptor
+ * @param aCppFileName - Filename
+ * Borrowed from scheduletest
+ */
+	{
+	TPtrC8 fileNamePtrC8(aCPPFileName);
+	// We do our own filename munging here; TParse can't help us since that's
+	// expressly for EPOC filepaths and here we've got whatever the build system is
+	// At present Win32 and Unix directory delimiters are supported
+	TInt lastDelimiter = Max(fileNamePtrC8.LocateReverse('\\'), fileNamePtrC8.LocateReverse('/'));
+	if(lastDelimiter >= 0 && lastDelimiter < fileNamePtrC8.Length() - 1)
+		{
+		// Found a delimiter which isn't trailing; update the ptr to start at the next char
+		TInt fileNameLen = Min(KMaxFilename, fileNamePtrC8.Length() - (lastDelimiter + 1));
+		fileNamePtrC8.Set(aCPPFileName + lastDelimiter + 1, fileNameLen);
+		}
+	else
+		{
+		// Didn't find a delimiter; take as much of the right-end of the name as fits
+		fileNamePtrC8.Set(aCPPFileName + Max(0, fileNamePtrC8.Length() - KMaxFilename), Min(fileNamePtrC8.Length(), KMaxFilename));
+		}
+	aModuleName.Copy(fileNamePtrC8);
+	}
+
+EXPORT_C void RTestExecutePIPSLogServ::SetLogLevel(TLogSeverity aSeverity)
+/**
+ * @return void
+ * @param aSeverity - severity of the logs
+ */
+	{
+	iLogLevel = aSeverity;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/main.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2005-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:  
+* Server entry points
+* EKA1 & EKA2
+* EKA1 & WINS is a DLL. All others are exe's
+*
+*/
+
+
+
+/**
+ @file Main.cpp
+*/
+#include <test/testexecutepipslog.h>
+#include "server.h"
+
+// Emulator EKA1 is the only DLL case
+// EKA2 all variats & EKA1 target only
+// E32Main calls MainL()
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+	// Leave Platform security hooks in place
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler* sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CLogServer* server = NULL;
+	// Create the sever
+	TRAPD(err,server = CLogServer::NewL());
+	if(!err)
+		{
+		// Client Synchronisation different for EKA1 and EKA2
+		// EKA2 really simple. Client blocks on reciprocal Rendezvous call
+		RProcess::Rendezvous(KErrNone);
+		// Go into the Active scheduler
+		sched->Start();
+		// Free the server class
+		delete server;
+		}
+	sched->Stop() ; 
+	delete sched;
+	}
+
+//GLDEF_C TInt E32Main()
+//this being an OE application we shall use 
+// the OE provided main signature
+int main(int,char**,char* )
+/**
+ * @return - Standard Epoc error code on process exit
+ * Process entry point. Called by client using RProcess API
+ */
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/server.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2005-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:  
+* Main log server engine.
+* Process log requests from multiple clients simultaneously.
+*
+*/
+
+
+
+/**
+ @file server.cpp
+*/
+#include "server.h"
+#include <unistd.h>
+#include <fcntl.h>
+
+CLogServer* CLogServer::NewL()
+/**
+ * @return - Instance of the log server
+ */
+	{
+	CLogServer * server = new (ELeave) CLogServer();
+	CleanupStack::PushL(server);
+	server->ConstructL();
+	// CServer base class call
+	server->StartL(KTestExecutePIPSLogServerName);
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+void CLogServer::ConstructL()
+/**
+ * Second phase construction
+ */
+	{
+	}
+
+
+CLogServer::CLogServer() : CServer2(EPriorityStandard,ESharableSessions)
+/**
+ * Constructor
+ */
+	{
+	}
+
+CLogServer::~CLogServer()
+/**
+ * Destructor
+ */
+	{
+	// Close the array of control structures
+	LogControl().Close();
+	//Fs().Close();
+	}
+
+
+CSession2* CLogServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
+/**
+ * @param RMessage - RMessage for the session open
+ */
+	{
+	// Just create the session
+	CLogSession* session = new (ELeave) CLogSession();
+	return session;
+	}
+
+void CLogServer::ControlComplete(CLogSession& aControl)
+/**
+ * @param aControl - Logfile control class reference
+ *
+ * Checks to see if this control session can be removed 
+ */
+	{
+	if(aControl.SessionCount())
+		return;
+
+	// There are no subsessions mapped to the logfile control class and
+	// no data buffers on its write queue
+	// Loop through the server's control array and remove it then delete it
+	TInt i;
+	for(i=0;i<LogControl().Count();i++)
+		{
+		if(&aControl == LogControl()[i])
+			{
+			// Done
+			LogControl().Remove(i);
+			delete &aControl;
+			break;
+			}
+		}
+	// If it's the last one then exit the server
+	if(!LogControl().Count())
+		CActiveScheduler::Stop();
+	}
+
+
+///////
+
+CLogSession::CLogSession()
+:iFileDes(-1)
+/**
+ * Constructor
+ */
+	{
+	}
+
+CLogSession::~CLogSession()
+/**
+ * Destructor
+ */
+	{
+	// Check for null
+	// Session close without a createlog call leaves iControl null
+	// A logfile control structure can have multiple server sessions
+	// decrement its server session count
+	RemoveSession();
+	CLogServer* p=(CLogServer*) Server();
+	// Shuts Down the server if this is the last open session
+	p->ControlComplete(*this);
+	}
+
+void CLogSession::ServiceL(const RMessage2& aMessage)
+/**
+ * @param aMessage - Function and data for the session
+ */
+	{
+	switch(aMessage.Function())
+		{
+//		case RTestExecutePIPSLogServ::ECreateLog :
+//			{}
+		// One of the API write calls
+		case RTestExecutePIPSLogServ::EWriteLog :
+			{
+			// Data can be any size
+			// Get the length from second argument
+			TInt bufferLength = aMessage.Int1();
+			// Get a heap buffer of the right size
+			HBufC8* buffer = HBufC8::NewLC(bufferLength);
+			TPtr8 ptr(buffer->Des());
+			// read the data
+			aMessage.ReadL(0,ptr);			
+			// Get a buffer control class contructed with the heap data
+			// takes ownership
+			//CLogBuffer* logBuffer = new (ELeave) CLogBuffer(*buffer);
+			CleanupStack::Pop(buffer);
+			//get the name of the pipe we want to dump the logs to
+			TInt pipeNameLen = aMessage.Int3();
+			// Get a heap buffer of the right size
+			HBufC8* pipebuffer = HBufC8::NewLC(pipeNameLen);
+			TPtr8 pipePtr(pipebuffer->Des());
+			// read the data
+			aMessage.ReadL(2,pipePtr);			
+			// Get a buffer control class contructed with the heap data
+			// takes ownership
+			CleanupStack::Pop(pipebuffer);
+			
+			if((iFileDes == -1)  || (!iPipeName ) || (iPipeName->CompareF(pipePtr))  )
+				{
+				iPipeName = new TPtr8(pipePtr) ; 
+				//iPipeName.Set(pipePtr) ;  
+				
+				char arr[KMaxPath];
+				int var;
+				for (var = 0; var < pipePtr.Length(); ++var) {
+					arr[var]=pipePtr[var];
+				}
+				arr[var]='\0';
+				
+				iFileDes = open( arr, O_WRONLY);
+				}
+			
+			const char *printsomething = (const char *)ptr.Ptr() ;
+			// incases when the pipe name given was empty / incorrect
+			// or unavailable for some reason, the open is expected
+			// to return -1, and then we do nothing
+			if(iFileDes != -1 ) 
+				{
+				write(iFileDes , printsomething, bufferLength) ; 
+				aMessage.Complete(KErrNone);
+				}
+			else
+				{
+				aMessage.Complete(KErrNotFound);
+				}
+			// apparently closing the pipe is an issue with named pipes
+			// so let be for now
+			//close(aFileDes); 
+			}
+			break;
+
+		default:
+			break;
+		}
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/server.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file Server.h
+*/
+
+#if (!defined __TESTEXECUTE_PIPS_LOG_SERVER_H__)
+#define __TESTEXECUTE_PIPS_LOG_SERVER_H__
+#include <e32base.h>
+#include <f32file.h>
+#include <test/testexecutepipslog.h>
+
+class CLogSession ; 
+class CLogServer : public CServer2
+	{
+public:
+	static CLogServer* NewL();
+	~CLogServer();
+	void ControlComplete(CLogSession& aControl);
+	
+	inline RPointerArray<CLogSession>& LogControl();
+
+	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
+	void SessionClosed();
+private:
+	CLogServer();
+	void ConstructL();
+private:
+	RPointerArray<CLogSession> iControl;
+	};
+
+class CLogSession : public CSession2
+	{
+public:
+	inline const CLogServer& LogServer() const;
+	CLogSession();
+	~CLogSession();
+	
+	void ServiceL(const RMessage2& aMessage);
+	
+	inline void AddSession();
+	inline void RemoveSession();
+	inline TInt SessionCount() const;
+
+private:
+	int iFileDes ; 
+	TPtr8* iPipeName;
+	TInt iSessionCount;
+	};
+
+#include "Server.inl"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/src/server.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+inline void CLogSession::AddSession()
+	{iSessionCount++;}
+
+inline void CLogSession::RemoveSession()
+	{iSessionCount--;}
+
+inline TInt CLogSession::SessionCount() const
+	{return iSessionCount;}
+
+///////
+inline RPointerArray<CLogSession>& CLogServer::LogControl()
+	{return iControl;}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/test/group/testexecutepipsloggertest.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+SMPSAFE
+
+TARGET      testexecutepipsloggertest.exe
+TARGETTYPE  exe
+UID             0x100039CE 0x101F778D
+VENDORID 0x70000001
+
+SOURCEPATH  ../src
+SOURCE		testexecutepipsloggertest.cpp
+
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/test
+SYSTEMINCLUDE /epoc32/include/stdapis
+
+LIBRARY     	euser.lib
+LIBRARY			testexecutepipslogclient.lib
+LIBRARY libc.lib
+STATICLIBRARY libcrt0.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/pipslogger/test/src/testexecutepipsloggertest.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2005-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:  
+* Demonstration use of the TestExecute standalone PIPS logger client API
+*
+*/
+
+
+
+/**
+ @file TestExecutePIPSLoggerTest.cpp
+*/
+
+#include <testexecutepipslog.h>
+#include <e32cons.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/fcntl.h>
+
+_LIT(KLogFile1,"c:/pipe_no1");
+_LIT(K16BitText,"This is a short line of 16 Bit Text");
+_LIT8(K8BitText,"This is a short line of  8 Bit Text");
+_LIT(K16BitFormatText,"This is a short line of 16 Bit Format Text int = %d string = %S");
+_LIT8(K8BitFormatText,"This is a short line of  8 Bit Format Text int = %d string = %S");
+_LIT(K16BitString,"The String16");
+_LIT8(K8BitString,"The String8");
+
+#define HALF_DUPLEX		"c:/pipe_no1"
+#define MAX_BUF_SIZE	255
+
+void MainL()
+	{
+	
+	/* Create the named - pipe */
+    int ret_val = mkfifo(HALF_DUPLEX, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
+    
+    if ((ret_val == -1) && (errno != EEXIST)) {
+        perror("Error creating the named pipe");
+        return ; 
+        //exit (1);
+    }
+    
+    int pipe = open(HALF_DUPLEX, O_RDONLY | O_NONBLOCK);
+    
+	_LIT(KTitle,"TestExecute Standalone Logger Test Code");
+	CConsoleBase* console = Console::NewL(KTitle,TSize(KConsFullScreen,KConsFullScreen));
+	CleanupStack::PushL(console);
+
+	_LIT(KMessage1,"Connect() To Logger and Close() immediately\r\n");
+	console->Printf(KMessage1);
+	RTestExecutePIPSLogServ logger;
+	User::LeaveIfError(logger.Connect());
+	logger.Close();
+
+	_LIT(KMessage2,"Immediate re-Connect() To Logger and Close() immediately\r\n");
+	console->Printf(KMessage2);
+	User::LeaveIfError(logger.Connect());
+	logger.Close();
+
+	_LIT(KMessage3,"Immediate re-Connect() To Logger CreateLog() and Close() immediately\r\n");
+	console->Printf(KMessage3);
+	User::LeaveIfError(logger.Connect());
+	User::LeaveIfError(logger.CreateLog(KLogFile1));
+	logger.Close();
+
+	// OS needs time to shutdown the server
+	// No delay means we get server terminated from the OS
+	User::After(1000000);
+
+	_LIT(KMessage4,"Connect() To Logger CreateLog() %S Call API's\r\n");
+	TBuf<80> logFile(KLogFile1);
+	console->Printf(KMessage4,&logFile);
+	User::LeaveIfError(logger.Connect());
+	User::LeaveIfError(logger.CreateLog(KLogFile1));
+	TBuf<20> buf16(K16BitString);
+	TBuf8<20> buf8(K8BitString);
+	logger.Write(K16BitText);
+	logger.Write(K8BitText);
+	logger.WriteFormat(K16BitFormatText,16,&buf16);
+	logger.WriteFormat(K8BitFormatText,8,&buf8);
+	logger.LogExtra(((TText8*)__FILE__), __LINE__,ESevrInfo,K16BitFormatText,1,&buf16);
+
+	_LIT(KMessage5,"ALL API's Called - Call Close(),\r\n");
+	console->Printf(KMessage5);
+	//console->Getch();
+	logger.Close();
+	
+	//try an empty pipe 
+	_LIT(KLogFileEmpty,"");
+	_LIT(KMessageEmp,"Connect() To Logger CreateLog() %S Call API's\r\n");
+	TBuf<80> logFiley(KLogFileEmpty);
+	console->Printf(KMessageEmp,&logFiley);
+	User::LeaveIfError(logger.Connect());
+	User::LeaveIfError(logger.CreateLog(KLogFileEmpty));
+	logger.Write(K16BitText);
+	logger.Write(K8BitText);
+	logger.WriteFormat(K16BitFormatText,16,&buf16);
+	logger.WriteFormat(K8BitFormatText,8,&buf8);
+	logger.LogExtra(((TText8*)__FILE__), __LINE__,ESevrInfo,K16BitFormatText,1,&buf16);
+	console->Printf(KMessage5);
+	console->Getch();
+	logger.Close();
+
+	CleanupStack::PopAndDestroy(console);
+
+	}
+
+// Entry point for all Epoc32 executables
+// See PSP Chapter 2 Getting Started
+int main(int,char**,char* )
+	{
+	// Heap balance checking
+	// See PSP Chapter 6 Error Handling
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAPD(err,MainL());
+	_LIT(KPanic,"PIPSLoggerTest");
+	__ASSERT_ALWAYS(!err, User::Panic(KPanic,err));
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/Bmarm/TEFTestModuleU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/Bwins/TEFTestModuleU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+	??1TScriptObject@@UAE@XZ @ 3 NONAME ABSENT ; TScriptObject::~TScriptObject(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/eabi/TEFTestModuleu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,20 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTaskTimer @ 3 NONAME
+	_ZTI12CSyncControl @ 4 NONAME
+	_ZTI12CTestWatcher @ 5 NONAME
+	_ZTI13CScriptMaster @ 6 NONAME
+	_ZTI14CClientControl @ 7 NONAME
+	_ZTI14CScriptControl @ 8 NONAME
+	_ZTI15CProgramControl @ 9 NONAME
+	_ZTI16CTaskControlBase @ 10 NONAME
+	_ZTV10CTaskTimer @ 11 NONAME
+	_ZTV12CSyncControl @ 12 NONAME
+	_ZTV12CTestWatcher @ 13 NONAME
+	_ZTV13CScriptMaster @ 14 NONAME
+	_ZTV14CClientControl @ 15 NONAME
+	_ZTV14CScriptControl @ 16 NONAME
+	_ZTV15CProgramControl @ 17 NONAME
+	_ZTV16CTaskControlBase @ 18 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,61 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+	
+	DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in \epoc32\include
+// Example: 
+/*
+\agnmodel\inc\AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+	
+	teftestmodule.mmp
+    teftestmodulelite.mmp
+
+PRJ_MMPFILES
+	
+	teftestmodule_nrm.mmp
+    teftestmodulelite_nrm.mmp
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+\agnmodel\group\agnmodel.mmp
+#if defined(MARM)
+\agnmodel\group\agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodule.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005-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:  MMP file for STIF Test Framework's Normal test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET          TEFTestModule.dll
+TARGETTYPE      dll
+#ifndef _USE_EWSD_
+EPOCALLOWDLLDATA
+#endif
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+
+DEFFILE         TEFTestModule.def
+//TARGETPATH      ?target_path
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../utils/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          teftestmodule.cpp
+SOURCE	        scriptengine.cpp
+SOURCE	        testwatcher.cpp
+
+LIBRARY         euser.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
+LIBRARY			testexecuteutils.lib
+LIBRARY			efsrv.lib
+LIBRARY			testexecutelogclient.lib
+LIBRARY			testexecutepipslogclient.lib
+LIBRARY			iniparser.lib
+
+#if !defined(TEF_LITE_VERSION)
+LIBRARY			apparc.lib
+LIBRARY			apgrfx.lib
+LIBRARY        	domaincli.lib
+LIBRARY			ws32.lib
+#endif
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCEPATH   ?source_path
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// AIF ?filename
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodule.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,63 @@
+;
+; Copyright (c) 2005-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:  
+;
+; Installation file for STIF
+;
+
+
+
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; 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\TEFTestModule.dll"   -   "!:\Sys\Bin\TEFTestModule.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodule_doxyfile.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,240 @@
+#
+# Copyright (c) 2005-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:
+#
+#
+
+
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = TEFTestModule
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = V:\workspace\TEFTestModule\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = V:\workspace\TEFTestModule\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodule_nrm.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005-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:  MMP file for STIF Test Framework's Normal test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET          TEFTestModule.dll
+TARGETTYPE      dll
+#ifndef _USE_EWSD_
+EPOCALLOWDLLDATA
+#endif
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+
+DEFFILE         TEFTestModule.def
+//TARGETPATH      ?target_path
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../utils/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          teftestmodule.cpp
+SOURCE	        scriptengine.cpp
+SOURCE	        testwatcher.cpp
+
+LIBRARY         euser.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
+LIBRARY			testexecuteutils.lib
+LIBRARY			efsrv.lib
+LIBRARY			testexecutelogclient.lib
+LIBRARY			testexecutepipslogclient.lib
+LIBRARY			iniparser.lib
+
+#if !defined(TEF_LITE_VERSION)
+LIBRARY			apparc.lib
+LIBRARY			apgrfx.lib
+LIBRARY        	domaincli.lib
+LIBRARY			ws32.lib
+#endif
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCEPATH   ?source_path
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// AIF ?filename
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodulelite.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2005-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:  MMP file for STIF Test Framework's Normal test module.
+*
+*/
+
+#include "../../Group/testexecutelite.cfg"
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET          TEFTestModuleLite.dll
+TARGETTYPE      dll
+#ifndef _USE_EWSD_
+EPOCALLOWDLLDATA
+#endif
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+
+DEFFILE         TEFTestModule.def
+//TARGETPATH      ?target_path
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../utils/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          teftestmodule.cpp
+SOURCE	        scriptengine.cpp
+SOURCE	        testwatcher.cpp
+
+LIBRARY         euser.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
+LIBRARY			testexecuteutils.lib
+LIBRARY			efsrv.lib
+LIBRARY			testexecutelogclient.lib
+LIBRARY			testexecutepipslogclient.lib
+LIBRARY			iniparser.lib
+
+#if !defined(TEF_LITE_VERSION)
+LIBRARY			apparc.lib
+LIBRARY			apgrfx.lib
+LIBRARY        	domaincli.lib
+LIBRARY			ws32.lib
+#endif
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCEPATH   ?source_path
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// AIF ?filename
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/group/teftestmodulelite_nrm.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2005-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:  MMP file for STIF Test Framework's Normal test module.
+*
+*/
+
+#include "../../Group/testexecutelite.cfg"
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET          TEFTestModuleLite.dll
+TARGETTYPE      dll
+#ifndef _USE_EWSD_
+EPOCALLOWDLLDATA
+#endif
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+
+DEFFILE         TEFTestModule.def
+//TARGETPATH      ?target_path
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../utils/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          teftestmodule.cpp
+SOURCE	        scriptengine.cpp
+SOURCE	        testwatcher.cpp
+
+LIBRARY         euser.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
+LIBRARY			testexecuteutils.lib
+LIBRARY			efsrv.lib
+LIBRARY			testexecutelogclient.lib
+LIBRARY			testexecutepipslogclient.lib
+LIBRARY			iniparser.lib
+
+#if !defined(TEF_LITE_VERSION)
+LIBRARY			apparc.lib
+LIBRARY			apgrfx.lib
+LIBRARY        	domaincli.lib
+LIBRARY			ws32.lib
+#endif
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCEPATH   ?source_path
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// AIF ?filename
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/logging.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+#ifndef LOGGINGDEFS_H
+#define LOGGINGDEFS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+const TUint KError           = 0x1;
+const TUint KInit            = 0x2;
+const TUint KVerbose         = 0x4;
+const TUint KAlways          = 0xFFFFFFFF;
+const TUint KDebugLevel      = ( KInit | KError );
+
+// MACROS
+#define __TRACING_ENABLED
+
+// Define USE_LOGGER to use logger for logging
+#define USE_LOGGER
+
+#ifdef __TRACING_ENABLED
+
+    // Disable conditional expression is constant -warning
+    #pragma warning( disable : 4127 )
+
+    // Using logger
+    #if defined (USE_LOGGER)
+    #define __TRACE(level,p) if ( (level) & KDebugLevel) { LOGGER->Log p; }
+    #else
+    #define __TRACE(level,p);
+    #endif
+
+    #define __RDEBUG(x) if( KVerbose & KDebugLevel){ RDebug::Print x ; }
+
+#else
+    // No tracing
+    #define __TRACE(level,p);
+    
+    #define __RDEBUG(x)
+
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // LOGGINGDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/scriptengine.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,477 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file ScriptEngine.h
+*/
+
+#if !(defined __SCRIPT_ENGINE_H__)
+#define __SCRIPT_ENGINE_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "testexecutestepbase.h"
+#include <e32cons.h>
+#if !(defined TEF_LITE)
+#include <apgcli.h>
+#include <w32std.h>
+#endif
+#include <iniparser.h>
+#include <test/tefshareddata.h>
+#include <test/testshareddata.h>
+#include "tefconst.h"
+#include "blockitems.h"
+
+#define SUB_PROC_TYPE RProcess
+
+/** 
+ * Define flogger based class that can also be used to log to console
+ */
+class RConsoleLogger
+	{
+public:
+	RConsoleLogger(CConsoleBase& aConsole) : iConsole(aConsole) {};
+	inline CConsoleBase& Console() const;
+private:
+	CConsoleBase& iConsole;
+	};
+
+class CActiveBase;
+class MChildCompletion
+	{
+public:
+	virtual void ChildCompletion(TInt aError) = 0;
+	};
+
+class RScriptTestServ : public RTestServ
+	{
+friend class RScriptTestSession;
+public:
+	inline RScriptTestServ();
+	TInt Connect(const TDesC& aServerName,TBool aSharedData = EFalse);
+	inline TBool SharedData() const;
+	inline TInt SessionCount() const;
+private:
+	inline void AddSession();
+	inline void RemoveSession();
+private:
+	TBool iSharedData;
+	TBool iSessionCount;
+	};
+
+class RScriptTestSession : public RTestSession
+	{
+public:
+	TInt Open(RScriptTestServ& aServ, const TBool aIsTestStep, const TDesC& aStepName = KNull );
+	inline void Close();
+protected:
+	RScriptTestServ* iServ;
+private:
+	};
+
+class CActiveBase : public CActive
+	{
+public:
+	inline void Kick();
+	inline virtual ~CActiveBase();
+protected:
+	inline void Prime();
+	inline void Complete(TInt aErr);
+	inline CActiveBase();
+	};
+
+class CScriptActive : public CActiveBase, public MChildCompletion
+	{
+public:
+	inline virtual ~CScriptActive();
+	inline virtual void ChildCompletion(TInt aErr);
+protected:
+	inline CScriptActive();
+	};
+
+
+class MTaskCompletion
+	{
+public:
+	virtual void TaskCompletion(TInt aErr, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,TBool aTaskCanComplete,TTEFItemArray* aItemArray=NULL) = 0;
+	};
+
+class TRange
+	{
+public : 
+	enum EState
+	{
+	EStateNotUsed,
+	EStateInUse,
+	EStateUsed,
+	};
+	
+	TRange(TPtrC aStartTestCase,TPtrC aEndTestCase  ):
+	iStartTestCase (aStartTestCase),
+	iEndTestCase (aEndTestCase ),
+	iState (EStateNotUsed)
+	{};
+	
+	//some utility methods
+	static TBool CompareTRangeEnd(const TRange& aRng1, const TRange& aRng2) ;
+	static TBool CompareTRangeStartCase(const TRange& aRng1, const TRange& aRng2) ;
+	static TInt CompareTRangeStartOrder(const TRange& aRng1, const TRange& aRng2) ;
+
+public : 
+	TPtrC    iStartTestCase ;
+	TPtrC    iEndTestCase ;
+	EState	iState ;
+
+	};
+
+enum ESelectiveTesting 
+	{
+	iInclusive =0 ,
+	iExclusive	
+	};
+
+class TSelectiveTestingOptions
+	{
+public :
+	TSelectiveTestingOptions(RArray<TRange>& aSelectiveCaseRange,ESelectiveTesting& aSelectiveTestingType )
+	:iSelectiveCaseRange(aSelectiveCaseRange),
+	iSelectiveTestingType(aSelectiveTestingType)
+	{};
+	
+	//some utility methods...
+	static TBool CompareTPtrC(const TPtrC& aPtrC1, const TPtrC& aPtrC2);
+	static TInt CompareTPtrCOrder(const TPtrC& aPtrC1, const TPtrC& aPtrC2) ;
+	
+	TSelectiveTestingOptions::~TSelectiveTestingOptions()
+	 	{iSelectiveCaseRange.Close();};
+
+	
+public :
+	RArray<TRange> iSelectiveCaseRange;
+	ESelectiveTesting iSelectiveTestingType;
+	};
+
+class CScriptMaster : public CScriptActive
+	{
+public:
+	CScriptMaster(const TDesC& aScriptFilePath, CTestExecuteLogger& aLogger, RConsoleLogger& aConsoleLogger, const TDriveName& aSysDrive, const TDriveName& aTestSysDrive, TSelectiveTestingOptions* aSelTestingOptions = NULL );
+	virtual ~CScriptMaster();
+	void RunL();
+	inline void DoCancel();
+private:
+	inline CTestExecuteLogger& Logger() const;
+	inline RConsoleLogger& ConsoleLogger() const;
+private:
+	enum TState{EInit,ERunning};
+	TState iState;
+	TPtrC iScriptFilePath;
+	CTestExecuteLogger& iLogger;
+	RConsoleLogger& iConsoleLogger;
+	TBool iLoop;
+	TBool iStartLooping;
+	TDriveName iDefaultSysDrive;
+	TDriveName iTestSysDrive;
+	TSelectiveTestingOptions* iSelTestingOptions;
+	};
+
+class CSyncControl;
+class CScriptControl : public CScriptActive, public MTaskCompletion
+	{
+public:
+								CScriptControl(MChildCompletion& aCompletion,const TDesC& aScriptFilePath,CTestExecuteLogger& aLogger,RConsoleLogger& aConsoleLogger,TBool aStartLooping,TBool aLoop, const TDriveName& aSysDrive, const TDriveName& aTestSysDrive, TSelectiveTestingOptions* aSelTestingOptions = NULL);
+	virtual						~CScriptControl();
+	virtual void				TaskCompletion(TInt aErr, const TDesC& aPanicString, TInt aScriptLineNumber, const TDesC& aCommand, TBool aTaskCanComplete, TTEFItemArray* aItemArray = NULL);
+	void						RunL();
+	inline void					DoCancel();
+private:
+	void						PrintFromScriptLine() const;
+	void						LogTestCaseMarkerL();
+	TVerdict					HasTestCasePassedL(TPtrC TestCaseMarker);
+	void						PrintCurrentScriptLine() const;
+	void						SetPrefix();
+	TBool						GetNextScriptLine(TPtrC& aScriptLine);
+	TBool						GetLoopScriptLine(TPtrC& aScriptLine);
+	void						CreateScriptDataFromScriptFileL();
+	void						CreateServerFromScriptLineL();
+	TBool						GetServerIndexFromScriptLine(TInt& aIndex);
+	void						RunUtilsFromScriptLineL() const;
+	void						GetScriptFileFromScriptLine();
+	void						RunCedFromScriptLineL();
+	void						StartTimerFromScriptLine();
+	void						LogResult(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber, const TDesC& aCommand);
+	inline CTestExecuteLogger&	Logger() const;
+	inline RConsoleLogger&		ConsoleLogger() const;
+	void						PrintScriptEngineError(TInt aErr) const;
+	TBool						CheckValidScriptLine() const;
+	TBool						CheckCommentedCommands() const;
+	void						FindValueL(CIniData* aConfigData, TPtrC aConfigSection, TPtrC aSharedData, TInt& aSharedDataNum);
+	void						FindValueL(CIniData* aConfigData, TPtrC aConfigSection, TPtrC aSharedData, TPtrC& aSharedDataName);
+	void						CreateSharedObjectsFromScriptLineL();
+	void						ParseTestBlockL( TTEFItemArray& aItemArray );
+	void						MakeAbsoluteFilePathsL(TPtrC16& aScriptLineString);
+	void						ConvertRelativeToAbsoluteL(TDes& aCommandString);
+	TInt 						RunError(TInt aError);
+	void						ExpandVariables(TDes& aCommandString);
+	TBool 						ProceedTestCase() ;
+	void 						ProcessEndCase();
+	// Fix defect 118337
+	TBool						ParseTestBlockHeader();
+	// End defect 118337
+private:
+	enum TState{
+				EInit,
+				ERunning,
+				EClosing,
+				ERunCedPending,
+				ERunCed,
+				ERunScriptPending,
+				ERunScript,
+				EDelayPending,
+				EPausePending,
+				EPause,
+				EEndTestCasePending,
+				ERunEndTestCase,
+				ERunStartSyncTestCase,
+				EPrefixPending,
+				ERunPrefix,
+				EDelay,
+				EIdling,
+				EWaitCompletions,
+				ETestCaseIgnore
+				};
+	TPtrC								iScriptFile;
+	RTimer								iTimer;
+	TState								iState;
+	HBufC*								iScriptData;
+	TLex								iScriptLex;
+	MChildCompletion&					iParent;
+	TPtrC								iCurrentScriptLine;
+	TBuf<KMaxTestExecuteCommandLength>	iScriptLinePrefix;	
+	TBuf<KMaxTestExecuteCommandLength>	iPrefixedCurrentScriptLine;
+	TBool								iConcurrent;
+	TBool								iCanComplete;
+	TBool								iBreakOnError;
+	TInt								iAsyncTasksOutstanding;
+	RPointerArray<RScriptTestServ>		iServers;
+	TInt								iCurrentScriptLineNumber;
+	CTestExecuteLogger&					iLogger;
+	RConsoleLogger&						iConsoleLogger;
+	TPtrC								iChildScriptFile;
+	RFs									iFS;
+	RFile								iResultFile;
+	TBool								iScriptLinePrefixSet;
+	TLex								iTempStoreLoop;
+	TLex								iStoreLoop;
+	TBool								iStartLooping;
+	TInt								iLoopCounter;
+	TBool								iCheckVar;
+	TInt								iRepeatParam;
+	TBool								iLoop;
+	CTEFSharedData<CTestSharedData>*	iSharedDataArray[KTEFMaxSharedArraySize];
+	TInt								iSharedDataNum;
+	TBool								iIsSharedData;
+	CSyncControl*						iSyncControl;
+	// Fix defect 119337. Change static TBool value to TInt value
+	// This value shows the nested count when call RUN_SCRIPT in loop
+	static TInt							iNestedNumRunScriptInLoop;
+	// End defect 119337
+	TBuf<KMaxTestExecuteCommandLength>	iTestCaseID;
+	TBuf<KTEFMaxScriptLineLength>		iAlteredScriptLine;
+	TDriveName							iDefaultSysDrive;
+	TDriveName							iTestSysDrive;
+	TSelectiveTestingOptions* 			iSelTestingOptions;
+	TBool 								iSelectOne;
+	TInt 								iRangeRefCounter;
+	TInt 								iTestCaseCounter;
+	TPtrC   							iTestCaseIDToIgnore ; 
+public:
+	static TInt							commentedCommandsCount;
+	static TInt							iRunScriptFailCount;
+	};
+
+class MTaskTimerCompletion
+	{
+public:
+	virtual void TaskTimerCompletion() =0;
+	};
+
+class CTaskTimer : public CTimer
+	{
+public:
+	static CTaskTimer* NewL(MTaskTimerCompletion& aCompletion);
+	~CTaskTimer();
+	void RunL();
+	void Timeout(TInt aSeconds);
+private:
+	CTaskTimer(MTaskTimerCompletion& aCompletion);
+	void RunTimeout();
+	inline void ConstructL();
+private:
+	MTaskTimerCompletion&	iParent;
+	TInt					iTimesAfter;
+	TInt					iSecondsRemaining;
+	};
+
+const TInt KDefaultTimeoutSeconds = 120;
+const TInt KDefaultDelayMilliseconds = 5000;
+const TInt KTEFStatusDelay = 2000;
+
+
+class CTaskControlBase : public CActiveBase , public MTaskTimerCompletion
+	{
+public:
+	inline void SetTaskComplete(TBool aTaskCanComplete);
+protected:
+	CTaskControlBase(const TDesC& aCommand, MTaskCompletion& aCompletion,TInt aScriptLineNumber, CTestExecuteLogger& aLogger);
+	virtual ~CTaskControlBase();
+	inline const CTestExecuteLogger& Logger() const;
+private:
+protected:
+	TBuf<KTEFMaxScriptLineLength> iCommandLine;
+	MTaskCompletion&				iParent;
+	TInt							iScriptLineNumber;
+	CTestExecuteLogger&				iLogger;
+	CTaskTimer*						iTaskTimer;
+	TInt							iTaskTimeout;
+	TBuf<KTEFMaxTaskExitCategory>	iTaskExitCategory;
+	TBool							iTaskCanComplete;
+private:
+	};
+
+class CClientControl : public CTaskControlBase
+	{
+public:	
+	CClientControl(	RScriptTestServ& aTestServ,
+					const TDesC& aStepCommand,
+					MTaskCompletion& aCompletion,
+					TInt aScriptLineNumber,
+					CTestExecuteLogger& aLogger,
+					TInt aLoopIndex,
+					const TDesC& aTestCaseID,
+					TPtrC& aScriptFilePath,
+					const TDriveName& aSysDrive,
+					const TDriveName& aTestSysDrive);
+					
+	static	CClientControl* NewL(	RScriptTestServ& aTestServ,
+									const TDesC& aCommand,
+									MTaskCompletion& aCompletion,
+									TInt aScriptLineNumber,
+									CTestExecuteLogger& aLogger,
+									TInt aLoopIndex,
+									const TDesC& aTestCaseID,
+									const TDesC& aEndBlockCommand,
+									TPtrC& aScriptFilePath,
+									const TTEFItemArray& aBlockArray,
+									const TDriveName& aSysDrive,
+									const TDriveName& aTestSysDrive);
+
+	virtual void TaskTimerCompletion();
+	virtual ~CClientControl();
+	void RunL();
+	inline void DoCancel();
+private:
+	void GetStepParamsFromStepCommand();
+	void ConstructL( const TDesC& aEndBlockCommand, const TTEFItemArray& aBlockArray );
+	TTEFItemArray* CreateBlockArrayLC();
+	TInt RunError(TInt aError);
+	void TestStepComplete();
+	
+private:
+	enum TState
+		{
+		EInit		= 0,
+		ERunning,
+		EServerRetry
+		};
+
+	TPtrC								iEndBlockCommand;		
+	TState								iState;
+	RScriptTestServ&					iServ;
+	TBuf<KMaxTestExecuteCommandLength>	iStepArgs;
+	TPtrC								iStepName;
+	RScriptTestSession					iSession;
+	RTimer								iTimer;
+	TInt								iRetryCount;
+	TPtrC								iTaskHeapSize;
+	TBool								iOOMRequestSet;
+	TBuf<KMaxTestExecuteCommandLength>	iSetUpParamValue;
+	TInt								iLoopIndex;
+	TBuf<KMaxTestExecuteCommandLength>	iTestCaseID;
+	HBufC8*								iBlockArrayPkg;
+	TPtr8								iBlockArrayPtr;
+	TPtrC								iScriptFilePath;
+	TDriveName							iDefaultSysDrive;
+	TDriveName							iTestSysDrive;
+	};
+
+class CProgramControl : public CTaskControlBase
+	{
+public:
+	virtual void TaskTimerCompletion();
+	CProgramControl(const TDesC& aCommand,MTaskCompletion& aCompletion,TInt aScriptLineNumber, CTestExecuteLogger& aLogger, TBool aWSProgRun=EFalse);
+	~CProgramControl();
+	void RunL();
+	inline void DoCancel();
+private:
+	void GetProgramArgsFromCommand();
+	void RunProgramL();
+	#if !defined TEF_LITE
+	bool IsWindowServerAvailable(void) const;
+	#endif
+private:
+	SUB_PROC_TYPE iProgram;
+	TPtrC iProgramArgs;
+	TBool iProgRenamed;
+	enum TState{EInit,ERunning};
+	TState iState;
+	TBool iWSProgRun;
+	#if !defined TEF_LITE
+	RThread iProgramWS; // Specific for EKA2 with a Window Server available	
+	RApaLsSession iApaLsSess;
+	RWsSession iWs;
+	#endif
+	};
+
+#if !defined TEF_LITE
+inline bool CProgramControl::IsWindowServerAvailable(void) const
+{
+	return (0 != iWs.WsHandle());
+}
+#endif
+class CSyncControl : public CBase
+	{
+public:
+	CSyncControl();
+	~CSyncControl();
+	
+	static	CSyncControl* NewL();
+	static	CSyncControl* NewLC();
+	
+	void	SetResultL( TVerdict aError );
+	TBool	TestCaseContinueL();
+	
+private:
+	void ConstructL();
+	
+	CTEFSharedData<CTestSharedData>* iSharedTEFStatus;
+	CTEFSharedData<CTestSharedData>* iSharedTEFResult;
+	};
+	
+#include "ScriptEngine.inl"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/scriptengine.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+
+inline CConsoleBase& RConsoleLogger::Console() const
+	{return iConsole;}
+
+///////
+
+inline RScriptTestServ::RScriptTestServ() : iSharedData(EFalse), iSessionCount(0)
+	{}
+
+inline TBool RScriptTestServ::SharedData() const
+	{return iSharedData;}
+
+inline TInt RScriptTestServ::SessionCount() const
+	{return iSessionCount;}
+
+inline void RScriptTestServ::AddSession()
+	{iSessionCount++;}
+
+inline void RScriptTestServ::RemoveSession()
+	{iSessionCount--;}
+
+///////
+
+inline void RScriptTestSession::Close()
+	{
+	iServ->RemoveSession();
+	RTestSession::Close();
+	}
+
+///////
+
+inline CActiveBase::CActiveBase() : CActive(EPriorityStandard)
+	{CActiveScheduler::Add(this);}
+
+/**
+ * Abstract class methods for priming, kicking and completing active objects. 
+ */
+inline void CActiveBase::Kick()
+/**
+ * Self Kick an active object into its RunL()
+ */
+	{
+	Prime();
+	Complete(KErrNone);
+	}
+
+inline void CActiveBase::Prime()
+/**
+ * Self Prime an Active Object for completion
+ */
+	{
+	iStatus = KRequestPending;
+	if(!IsActive())
+		SetActive();
+	}
+
+inline void CActiveBase::Complete(TInt aErr)
+/**
+ * @param aErr - Error code to complete the Active Object 
+ *
+ * Self Complete an Active Object 
+ */
+	{
+	TRequestStatus* status = &iStatus;
+	User::RequestComplete(status,aErr);
+	}
+
+
+inline CActiveBase::~CActiveBase()
+	{}
+
+///////
+inline void CScriptActive::ChildCompletion(TInt aErr)
+/**
+ * @param aErr - Error code to complete the Active Object
+ * @param aChild - Child object whose work is done
+ * Callback from the child.
+ * Self complete.
+ */
+	{
+	Complete(aErr);
+	}
+
+inline CScriptActive::~CScriptActive()
+	{}
+
+inline CScriptActive::CScriptActive()
+	{}
+
+///////
+
+inline CTestExecuteLogger& CScriptMaster::Logger() const
+	{return iLogger;}
+
+inline RConsoleLogger& CScriptMaster::ConsoleLogger() const
+	{return iConsoleLogger;}
+
+inline void CScriptMaster::DoCancel()
+	{}
+
+///////
+inline CTestExecuteLogger& CScriptControl::Logger() const
+	{return iLogger;}
+
+inline RConsoleLogger& CScriptControl::ConsoleLogger() const
+	{return iConsoleLogger;}
+
+inline void CScriptControl::DoCancel()
+	{}
+
+///////
+
+inline void CTaskTimer::ConstructL()
+	{CTimer::ConstructL();}
+
+///////
+
+inline const CTestExecuteLogger& CTaskControlBase::Logger() const
+	{return iLogger;}
+
+inline void CTaskControlBase::SetTaskComplete(TBool aTaskCanComplete)
+	{
+	iTaskCanComplete = aTaskCanComplete;
+	}
+
+///////
+
+void CClientControl::DoCancel()
+	{}
+
+///////
+
+void CProgramControl::DoCancel()
+	{}
+
+///////
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/teftestmodule.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,353 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+#ifndef TEFTESTMODULE_H
+#define TEFTESTMODULE_H
+
+// INCLUDES
+#include "stiftestmodule.h"
+#include <stiflogger.h>
+#include <normalhardcodedassert.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_MODULE_VERSION_MAJOR 0
+#define TEST_MODULE_VERSION_MINOR 0
+#define TEST_MODULE_VERSION_BUILD 0
+
+// Logging path
+_LIT( KTEFTestModuleLogPath, "\\logs\\testframework\\TEFTestModule\\" ); 
+// Log file
+_LIT( KTEFTestModuleLogFile, "TEFTestModule.txt" ); 
+_LIT( KTEFTestModuleLogFileWithTitle, "TEFTestModule_[%S].txt" );
+
+typedef TBuf<200> TScriptName;
+typedef TBuf<200> TTcsName;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// CLASS DECLARATION
+
+/**
+*  This a TEFTestModule class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CTEFTestModule) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTEFTestModule* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTEFTestModule();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the TEFTestModule. 
+        *       It is called once for every instance of TEFTestModule after
+        *       its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of TEFTestModule.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from TEFTestModule. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& /* aFailureType */,
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; User may add implementation for OOM test 
+        * environment initialization. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL. User may add implementation 
+        * for OOM test warning handling. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */);
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+        /**
+         * Method used to log version of test module
+         */
+        void SendTestModuleVersion();
+        
+        /**
+        * Get stack size set by user, in TestFramework.ini
+        */ 
+        static TInt ParseStackSizeL(TInt& aStackSize);
+
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTEFTestModule();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Read the Cfg File data into a heap buffer
+        * And populate the arrays of selective test case IDs and 
+        * Ranges to be used by the state machine
+        * NOTE: we do not support nested cfgs...
+        */
+        void CreateTitleLoggerL(void);
+
+        /**
+        * Check for logger settings and delete title logger.
+        */
+        void DeleteTitleLogger(void);
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+        
+        /**
+         * Load and wait to start, only used under Non-Lite version.
+         */
+        
+		#if !(defined TEF_LITE)
+        void StartSystemL(void);
+		#endif   
+		
+        
+        /**
+         * Initialization.
+         */
+        void TEFInitialize(void);
+        
+        /**
+         * Parse configuration file to get config information and script list.
+         */
+        TInt ParseTEFTestCfgFileL(const TFileName& aConfigFile, RPointerArray<TTestCaseInfo>& aTestCases);
+        
+        /**
+         * Execute sigle script.
+         */
+        TInt RunScriptL(CActiveScheduler* aScheduler, const TScriptName& aScriptFilePath, const TTcsName& aTcsData);
+        
+        /**
+         * Read Testexecute.ini to get configuration, otherwise use a default config.
+         */ 
+        void CreateCfgDataFromFileL(TPtrC& aCfgFilePath, RArray<TRange>& aSelectiveCaseRange, TDesC*& aSelTestCfgFileData);
+        
+        /**
+        * Get elements from configuration file.
+        */ 
+        void DistinguishElement(const TPtrC& aElement, RArray<TRange>& aSelectiveCaseRange);
+        
+        
+        /**
+        * Parse TcsData from configration file to select test case flag. Get cases Included or Excluded.
+        */ 
+        void ParseTcsDataForSelectiveTestingOptions( const TTcsName& aTcsData, 
+        											 CTestExecuteIniData& aParseTestExecuteIni,
+        											 RArray<TRange>& aSelectiveCaseRange,  
+        											 TDesC*& aSelTestCfgFileData );
+        	
+        
+        /**
+        * Add script full name(c:/xx/xxx.script) to iScriptFileNames, add cases based on script.
+        */ 
+        TInt MatchScriptsToCasesL(const TScriptName& aSscriptFile, TInt aScriptCount, RPointerArray<TTestCaseInfo>& aTestCases);
+        
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        CStifLogger * iLog;
+
+        // Standard logger
+        CStifLogger *iStdLog;
+
+        // Logger for currently running test case
+        CStifLogger *iTCLog;
+        
+        // Flag saying if test case title should be added to log file name
+        TBool iAddTestCaseTitleToLogName;
+        
+        // Flag saying if test module version was already sent
+        TBool iVersionLogged;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+        
+        //For iCfg_tcs
+    	enum TCfgTcs
+    		{
+    		EInclude,
+    		EExclude,
+    		EOFF
+    		};
+    	
+    	//For Tcs in configration file
+    	TCfgTcs	iCfg_tcs;
+    	
+    	//For Debug in configration file
+    	TBool	iCfg_Debug;
+    	
+    	//For SeparateLog in configration file
+    	TBool	iCfg_SeparateLog;
+    	
+    	//For Pipe in configration file
+    	TName	iCfg_Pipe;
+ 	    	
+    	//Store script full name(with path), such as c:/xxxx/xxxx.script
+    	//This array's sequence is same as test cases.
+    	RPointerArray<TScriptName>	iArray_ScriptFilePaths;
+    	
+    	//Store TcsData in configration file, TcsData is paired with Script.
+    	RPointerArray<TTcsName>		iArray_Cfg_TcsData;
+    	
+    	//System drive name
+    	TDriveName iDefaultSysDrive;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // TEFTESTMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/inc/testwatcher.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TestWatcher.h
+*/
+
+#if !(defined __TEST_WATCHER_H__)
+#define __TEST_WATCHER_H__
+
+#include <e32base.h>
+#include <e32std.h>
+
+/////////
+// Remote Panic Detection
+////////
+class TThreadPanicDetails
+	{
+public:
+	TThreadPanicDetails(TName aThreadName, TInt aReason, TExitCategoryName aCategory, TTime aTime);
+	TName iThreadName;
+	TInt iReason;
+	TExitCategoryName iCategory;
+	TTime iTime;
+	};
+
+/** Provides access to shared data between the threads. Because of the nature of construction	
+ *	it is too complicated to generate mutexes, and as such you MUST NOT
+ *  use this class inside TestWatcher whilst the UndertakerWatcher thread is running.
+ *  Kill it before you access this data, and construct the object before that thread
+ *  is running. YHBW.
+ */	
+class CSharedData : public CBase
+	{
+public:
+	RPointerArray<TThreadPanicDetails> iPanicDetails;
+	};
+
+class CTestWatcher : public CBase
+	{
+public:
+	CTestWatcher();
+	~CTestWatcher();
+	void ConstructL();
+	void StartL();
+	void Stop();
+	static CTestWatcher* NewL();
+	CSharedData* iSharedData;
+private:
+	RThread iWorker;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/src/scriptengine.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4076 @@
+/*
+* Copyright (c) 2005-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:  
+* Design Overview:
+* The diagram below shows the Script Engine classes and their parent child
+* hierarchy. All classes have a CActive base, and apart from CTaskTimer, all classes
+* have their own state machine. Apart from CScriptMaster, all classes have a reference
+* to a Mixin/Interface completion call of its parent, which it calls when the object
+* needs to notify the parent of an event.
+* CScriptMaster (derived CActive)
+* CScriptControl (derived CActiveBase - Can go recursive)
+* CProgramControl (derived CTaskControlBase) CClientControl ( derived CTaskControlBase maps to n x test steps)
+* CTaskTimer                                 CTaskTimer (derived CTimer)
+*  state transition tables for CScriptMaster, CScriptControl & CClientControl
+* CActiveBase:
+* Derives CActive.
+* Contains code for priming, triggering and completing AO's
+* Implements the pure abstract MChildCompletion::ChildCompletion() method
+* CTaskControlBase:
+* Derives CActiveBase.
+* Abstract class. Base for CClientControl and CProgramControl.
+* CScriptMaster:
+* Derives CActiveBase.
+* Master control active object with simple state machine.
+* Instantiates the top level CScriptControl object and triggers its state machine.
+* CScriptContol:
+* Derives CActiveBase.
+* Main script interpreter state machine. Creates one or more CClientControl and/or
+* CProgramControl objects.
+* In CONCURRENT mode, it can create as many instances as there are RUN_TEST_STEP and/or 
+* RUN_PROGRAM calls.
+* Creates root sessions with the xxxtest servers using the RTestServ::Connect() client call.
+* In the case of non-nested scripts, the parent object is CScriptMaster.
+* When scripts are nested and it goes recursive, the parent object could be another 
+* CScriptControl.
+* Implements the MTaskCompletion pure abstract class for callbacks from
+* CClientControl or CProgramControl objects
+* Calls back into its parent object when the script is complete and all async commands have
+* completed.
+* CClientControl:
+* Derives CTaskControlBase.
+* Test Step Controler. Instantiated by CScriptControl when a RUN_TEST_STEP line is interpreted
+* Creates and kicks off a CTaskTimer object set to the timeout value for the test step.
+* Opens a test step using the RTestSession::Open() client call.
+* Executes a test step using the RTestSession::RunTestStep() client call.
+* This method issues the client RTestSession::AbortTestStep() call and
+* the RunL() state machine handles the completion from the test server.
+* Implements the MTaskTimerCompletion pure abstract class for callbacks from the
+* CTaskTimer class.
+* Calls back into its parent CScriptControl object when a test step completes.
+* CProgramControl
+* Derives CTaskControlBase
+* Kicks off an executable in its own process and handles process completion asynchronously
+* CTaskTimer:
+* Derives CTimer.
+* Calls back into its parent object if the timer expires.
+* EPOC include
+*
+*/
+
+
+
+/**
+ @file scriptengine.cpp
+*/
+
+//#include <utf.h>
+#if !(defined TEF_LITE)
+#include <apacmdln.h>
+#include <apgtask.h>
+#endif
+
+// User include
+#include <test/testexecuteclient.h>
+#include "scriptengine.h"
+
+// Fix defect 119337, initialize the integer to zero
+GLDEF_D TInt CScriptControl::iNestedNumRunScriptInLoop=0;
+// End defect 119337
+
+/**
+ * @param aPtrC1 - Instance of TPtrC to compare
+ * @param aPtrC2 - Instance of TPtrC to compare
+ * Function to implement the comparison algo for RArray::Find to work with
+ */
+TBool TSelectiveTestingOptions::CompareTPtrC(const TPtrC& aPtrC1, const TPtrC& aPtrC2)
+	{
+	TInt ret =aPtrC1.CompareF(aPtrC2);
+	return (ret==0) ? ETrue : EFalse;
+	} 
+
+/**
+ * @param aRng1 - Instance of TRange to compare
+ * @param aRng2 - Instance of TRange to compare
+ * Function to implement the comparison algo for RArray::Find to work with.
+ * TRange::iStartTestCase determines the match
+ */
+TBool TRange::CompareTRangeStartCase(const TRange& aRng1, const TRange& aRng2) 
+	{
+	TInt ret =aRng2.iStartTestCase.CompareF(aRng1.iStartTestCase);
+	return (ret==0) ? ETrue : EFalse;
+	}
+
+/**
+ * @param aRng1 - Instance of TRange to compare
+ * @param aRng2 - Instance of TRange to compare
+ * Function to implement the comparison algo for RArray::Find to work with.
+ * TRange::iEndTestCase determines the match
+ */
+TBool TRange::CompareTRangeEnd(const TRange& aRng1, const TRange& aRng2) 
+	{
+	TInt ret =aRng2.iEndTestCase.CompareF(aRng1.iEndTestCase);
+	return (ret==0) ? ETrue : EFalse;  
+	}
+
+/**
+ * @param aRng1 - Instance of TRange to compare
+ * @param aRng2 - Instance of TRange to compare
+ * Function to implement the comparison algo for RArray::Sort to work with.
+ * TRange::iStartTestCase is used as the sort key
+ */
+TInt TRange::CompareTRangeStartOrder(const TRange& aRng1, const TRange& aRng2) 
+	{
+	return aRng1.iStartTestCase.CompareF( aRng2.iStartTestCase);
+	}
+
+/**
+ * @param aPtrC1 - Instance of TPtrC to compare
+ * @param aPtrC2 - Instance of TPtrC to compare
+ * Function to implement the comparison algo for RArray::Sort to work with.
+ */
+TInt TSelectiveTestingOptions::CompareTPtrCOrder(const TPtrC& aPtrC1, const TPtrC& aPtrC2) 
+	{
+	return aPtrC1.CompareF(aPtrC2);
+	}
+
+/**
+ * @param aServ - Instance of the test server handle
+ * @param aStepName - Test step name
+ * Wrapper around the RTestServ class. Performs counting on test step sessions
+ */
+TInt RScriptTestSession::Open(RScriptTestServ& aServ, const TBool aIsTestStep, const TDesC& aStepName )
+	{
+	if(aServ.SharedData() && aServ.SessionCount())
+			return KErrInUse;
+	TInt ret = KErrNone;
+	
+	if( aIsTestStep )
+		{
+		ret = RTestSession::Open(aServ, aStepName, aServ.SharedData());
+		}
+	else
+		{
+		ret = RTestSession::Open(aServ, aServ.SharedData());
+		}
+	if(ret)
+		return ret;
+	aServ.AddSession();
+	iServ = &aServ;
+	return KErrNone;
+	}
+	
+/**
+ * @param aScriptFilePath - The full path and filename of a script command file.
+ * @param aLogger - Reference to a logger interface object that contains HTML & XML log client sessions.
+ * @param aConsole - Reference to console object for printing script line during test execution
+ * @param aSysDrive - Default System drive letter
+ * @param aTestSysDrive - Default System drive letter overwritten through testexecute.ini
+ * Constructor
+ */
+CScriptMaster::CScriptMaster(const TDesC& aScriptFilePath, CTestExecuteLogger& aLogger, RConsoleLogger& aConsole, const TDriveName& aSysDrive, const TDriveName& aTestSysDrive, TSelectiveTestingOptions* aSelTestingOptions ) :
+	iState(EInit), iScriptFilePath(aScriptFilePath), iLogger(aLogger), iConsoleLogger(aConsole), iDefaultSysDrive(aSysDrive), iTestSysDrive(aTestSysDrive), iSelTestingOptions(aSelTestingOptions)
+	{
+	}
+
+/**
+ * Destructor
+ */
+CScriptMaster::~CScriptMaster()
+	{
+	}
+
+/**
+ * Pure virtual implementation.
+ * The Top level state machine Kick'd() into by MainL()
+ * Picks up the completion from a CScriptControl instance then exits the scheduler
+ */
+void CScriptMaster::RunL()
+	{
+	switch (iState)
+		{
+	case EInit	:
+		{
+		// Create the master CScriptControl instance. 
+		CScriptControl* scriptControl = new (ELeave) CScriptControl(*this,iScriptFilePath,Logger(),ConsoleLogger(),iStartLooping,iLoop,iDefaultSysDrive,iTestSysDrive,iSelTestingOptions);
+		iState = ERunning;
+		// Set our AO up ready for completion
+		Prime();
+		// Kick the CScriptControl state machine
+		scriptControl->Kick();
+		}
+		break;
+	case ERunning	:
+		{
+		// All child AO's have completed and been deleted so it's safe to exit.
+		CActiveScheduler::Stop();
+		}
+		break;
+	default:
+		break;
+		}
+	}
+
+/**
+ * @param aCompletion - Callback into the parent object.
+ * @param aScriptFilePath - The full path and filename of a script file
+ * @param aLogger - Reference to a logger instance
+ * @param aConsole - Reference to console object for printing script line during test execution
+ * @param aStartLooping - Initiate the looping
+ * @param aLoop - Check for nesting of loops
+ * @param aSysDrive - Default System drive letter
+ * @param aTestSysDrive - System drive letter overwritten from testexecute.ini
+ * Constructor
+ */
+CScriptControl::CScriptControl(MChildCompletion& aCompletion, const TDesC& aScriptFilePath, CTestExecuteLogger& aLogger, RConsoleLogger& aConsole, TBool aStartLooping, TBool aLoop, const TDriveName& aSysDrive, const TDriveName& aTestSysDrive, TSelectiveTestingOptions* aSelTestingOptions):
+	iScriptFile(aScriptFilePath),
+	iState(EInit),
+	iParent(aCompletion),
+	iConcurrent(EFalse),
+	iCanComplete(ETrue),
+	iBreakOnError(EFalse),
+	iAsyncTasksOutstanding(0),
+	iCurrentScriptLineNumber(0),
+	iLogger(aLogger),
+	iConsoleLogger(aConsole),
+	iScriptLinePrefixSet(EFalse),
+	iStartLooping(aStartLooping),
+	iLoop(aLoop),
+	iSharedDataNum(KTEFZeroValue),
+	iIsSharedData(EFalse),
+	iSyncControl(NULL),
+	iTestCaseID(KTEFTestCaseDefault),
+	iDefaultSysDrive(aSysDrive),
+	iTestSysDrive(aTestSysDrive),
+	iSelTestingOptions(aSelTestingOptions),
+	iSelectOne(EFalse),
+	iRangeRefCounter(0),
+	iTestCaseCounter(0)
+	{
+	}
+
+/**
+ * Destructor
+ */
+CScriptControl::~CScriptControl()
+	{
+	iTimer.Cancel();
+	iTimer.Close();
+	// We read the complete script into the heap for parsing so:
+	delete iScriptData;
+	for (TInt index = 0; index < iSharedDataNum; index++)
+		{
+		delete iSharedDataArray[index];
+		}
+	// Instance has an array of pointers to RTestServer objects.
+	// Loop through deleting and closing
+	TInt i = 0;
+	TInt count = iServers.Count();
+	for(i=0;i<count;i++)
+		{
+		iServers[0]->Close();
+		delete iServers[0];
+		iServers.Remove(0);
+		}
+	iServers.Close();
+	if( iSyncControl )
+		{
+		delete iSyncControl;
+		}
+	}
+
+/**
+ * @param aError - Integer error value returned by the active object while leaving
+ * @return TInt - System-wide error codes
+ * Error Handler for active object
+ */
+TInt CScriptControl::RunError(TInt aError)
+	{
+	if (aError == KErrNoMemory)
+		{
+		ERR_PRINTF1(_L("Insufficient memory available to perform further operation.\n\tPlease increase the maximum heap size from the testexecute.mmp and try running the test again. Exiting test script..."));
+		}
+	else
+		{
+		ERR_PRINTF2(_L("Test execution failed with error %d. Terminating tests.."), aError);
+		}
+	iParent.ChildCompletion(KErrNone);
+	delete this;
+	return KErrNone;
+	}
+
+/**
+ * Implementation of pure virtual
+ * The main script interpreter state machine.
+ * Kick'd() into by CScriptMaster or, in the case of nested scripts, another CScriptControl
+ * instance.
+ * Picks up the completions from CClientControls and/or, in the case of nested scripts,
+ * another CScriptControl instance.
+ */
+void CScriptControl::RunL()
+	{
+	switch (iState)
+		{
+	case EInit		:
+		// First state after Kick() from parent
+		{
+		// Standard log output goes to flogger
+		// Result log goes to a propietary file in c:\logs\testexecute
+		User::LeaveIfError(iTimer.CreateLocal());
+		TRAPD(err,CreateScriptDataFromScriptFileL());
+		if(err)
+			{
+			// If we can't open the script file then log the fact and gracefully exit
+			// the state machine.
+			TBuf<KMaxTestExecuteCommandLength> buf(iScriptFile);
+			_LIT(KScriptFileError,"Failed Script File Open %S");
+			ERR_PRINTF2(KScriptFileError,&buf);
+			iState = EClosing;
+			//condition used for checking failure in testexecute.cpp
+			commentedCommandsCount=-1;
+			iRunScriptFailCount++;
+			Kick();
+			break;
+			}
+
+		// Script file reading state next
+		iState = ERunning;
+		// Kick ourselves into the next state
+		Kick();
+		}
+		break;
+
+	case ERunning	:
+		// Always in this state whilst we're reading lines from script file data member
+		{
+		TPtrC scriptLine;
+		if(!iStartLooping)
+			{
+			if(!GetNextScriptLine(scriptLine))
+				{
+				// End of the script file
+				// Check see if there are any async requests outstanding
+				// In concurrent mode there are very likely to be
+				if(iAsyncTasksOutstanding == 0)
+					{
+					// No requests outstanding so call into the parent
+					iParent.ChildCompletion(KErrNone);
+					delete this;
+					}
+				else
+					{
+					// Requests outstanding
+					// Next time we're completed we'll be in the closing state
+					iState = EClosing;
+					iCanComplete =ETrue;
+					// Prime ourselves for completion
+					Prime();
+					}
+				break;
+				}
+			}
+		//Get the script lines which are to be looped
+		else if(!GetLoopScriptLine(scriptLine))
+			{
+			// End of the script file
+			// Check see if there are any async requests outstanding
+			// In concurrent mode there are very likely to be
+			if(iAsyncTasksOutstanding == 0)
+				{
+				// No requests outstanding so call into the parent
+				iParent.ChildCompletion(KErrNone);
+				delete this;
+				}
+			else
+				{
+				// Requests outstanding
+				// Next time we're completed we'll be in the closing state
+				iState = EClosing;
+				iCanComplete =ETrue;
+				// Prime ourselves for completion
+				Prime();
+				}
+			break;
+			}
+
+		iCurrentScriptLine.Set(scriptLine);
+		
+		TBool commentedCommand = CheckCommentedCommands();
+		if(commentedCommand)
+			{
+			iCanComplete = EFalse;
+			Kick();
+			break;
+			}
+
+		if (iScriptLinePrefixSet )
+			{
+			TLex lookahead(iCurrentScriptLine);
+
+			TPtrC firstCommand(lookahead.NextToken());
+
+			if (firstCommand.CompareF(KTEFRemovePrefixCommand) != 0)
+				{
+				// If we aren't the Remove_Prefix command, prefix the current line...
+				iPrefixedCurrentScriptLine = iScriptLinePrefix;
+				iPrefixedCurrentScriptLine.Append(scriptLine);
+				iCurrentScriptLine.Set(iPrefixedCurrentScriptLine);
+				}
+			}
+
+		TRAPD(err, MakeAbsoluteFilePathsL(iCurrentScriptLine));
+		PrintCurrentScriptLine();
+		
+		TLex lex(iCurrentScriptLine);
+
+		TPtrC token(lex.NextToken());
+
+		if (err == KTEFErrInvalidRelPath)
+			{
+			_LIT(KTEFErrInvalidRelPathText,"Invalid relative path provided in the script file. Skipping the script line from execution..");
+			ERR_PRINTF1(KTEFErrInvalidRelPathText);
+
+			if (token.CompareF(KTEFRunTestStepCommand) == 0 ||
+				token.CompareF(KTEFRunPanicStepCommand) == 0 ||
+				token.CompareF(KTEFRunTestStepResultCommand) == 0 ||
+				token.CompareF(KTEFRunPanicStepResultCommand) == 0)
+				{
+				TExitCategoryName  blankPanicString; //Not a Panic
+				LogResult(EIgnore, blankPanicString, iCurrentScriptLineNumber, iCurrentScriptLine);
+				}
+			iCanComplete = EFalse;
+			Kick();
+			break;
+			}
+
+		if(err == KErrTooBig)
+			{
+			_LIT(KTEFErrTooBigArguments, "One or more arguments for the command exceeded allowed limit for length. Skipping test..");
+			ERR_PRINTF1(KTEFErrTooBigArguments);
+
+			if (token.CompareF(KTEFRunTestStepCommand) == 0 ||
+				token.CompareF(KTEFRunPanicStepCommand) == 0 ||
+				token.CompareF(KTEFRunTestStepResultCommand) == 0 ||
+				token.CompareF(KTEFRunPanicStepResultCommand) == 0)
+				{
+				TExitCategoryName  blankPanicString; //Not a Panic
+				LogResult(EIgnore, blankPanicString, iCurrentScriptLineNumber, iCurrentScriptLine);
+				}
+			iCanComplete = EFalse;
+			Kick();
+			break;
+			}
+
+		// Main parser
+		if(token.CompareF(KTEFLoadSuiteCommand) == 0 || token.CompareF(KTEFLoadServerCommand) == 0)
+			{
+			TRAPD(err,CreateServerFromScriptLineL());
+			
+			// Create a TLogField structure array
+			// Size of array equals to number of fields to be displayed for the command
+			TExtraLogField logField[2];
+
+			// The first member of the structure stores the field name
+			// The second one holds the value for the particular field
+			_LIT(KSuiteName, "SUITE_NAME");
+			logField[0].iLogFieldName.Copy(KSuiteName);
+			logField[0].iLogFieldValue.Copy(lex.NextToken());
+			
+			logField[1].iLogFieldName.Copy(KTEFResultString);
+			if(err != KErrNone)
+				{
+				logField[1].iLogFieldValue.Copy(KTEFResultFail);
+				if( KErrNotFound == err )
+					{
+					_LIT(KServerNotFound,"Failed to create server, either the server or one of its dependancies could not be found.");
+					ERR_PRINTF1(KServerNotFound);
+					}
+				else
+					{
+					_LIT(KServerCreateError,"Failed to Create Server Err = %d");
+					ERR_PRINTF2(KServerCreateError,err);
+					}
+				}
+			else
+				{
+				logField[1].iLogFieldValue.Copy(KTEFResultPass);
+				}
+			
+			// Call the Logger().LogToXml routine which handles XML logging for individual commands
+			// Takes in the command name, number of fields and the struture array
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, token, 2, logField);
+			iCanComplete = EFalse;
+			Kick();
+			}
+		else if(token.CompareF(KTEFStartTestBlock)==0)
+			{
+			// Parse the START_TEST_BLOCK command line
+			TInt index = 0;
+			TBool taskCanComplete = ETrue;
+			TBool concurrent = iConcurrent;
+			// Make sure the server is loaded
+			if(!GetServerIndexFromScriptLine(index))
+				{
+				// Not loaded. Skip the line, but ensure its logged as a failure.
+				TExitCategoryName  blankPanicString; //Not a Panic
+				LogResult(EIgnore, blankPanicString, iCurrentScriptLineNumber, iCurrentScriptLine);
+
+				iCanComplete = EFalse;
+				Kick();
+				break;
+				}
+			
+			TBuf<KMaxTestExecuteCommandLength>	startBlockLine = iCurrentScriptLine;
+			
+			// Parse the test block of commands
+			TTEFItemArray* itemArray = new (ELeave) TTEFItemArray(1);
+			CleanupStack::PushL( itemArray );
+			TRAPD( err, ParseTestBlockL(*itemArray) );
+			
+			if( KErrNone == err )
+				{
+				if(!iConcurrent)
+					{
+					// If we're not in concurrent mode then child objects can complete us
+					taskCanComplete = ETrue;
+					// Prime ready for completion
+					Prime();
+					}
+				else
+					{
+					// In concurrent mode children can't complete us as we kick() ourselves.
+					taskCanComplete = EFalse;
+					Kick();
+					}
+				// Create the test block controler object
+				TInt loopIndex = -1;
+				if (iLoop)
+					{
+					loopIndex = iLoopCounter + 1;
+					}
+				
+				CClientControl* blockController = CClientControl::NewL(	*iServers[index],
+																		startBlockLine,
+																		*this,
+																		iCurrentScriptLineNumber,
+																		Logger(),
+																		loopIndex,
+																		iTestCaseID,
+																		iCurrentScriptLine,
+																		iScriptFile,
+																		*itemArray,
+																		iDefaultSysDrive,
+																		iTestSysDrive);
+
+				blockController->SetTaskComplete(taskCanComplete);
+				iAsyncTasksOutstanding++;
+				// Kick() the test step  object into its state machine
+				blockController->Kick();
+				}
+			else
+				{
+				iCanComplete = EFalse;
+				Kick();				
+				}
+
+			iConcurrent = concurrent;
+			CleanupStack::PopAndDestroy( itemArray );
+			}
+		else if(token.CompareF(KTEFEndTestBlock)==0)
+			{
+			// If this is called then there is a missing START_TEST_BLOCK command
+			TExitCategoryName  blankPanicString;
+			LogResult(EIgnore, blankPanicString, iCurrentScriptLineNumber, iCurrentScriptLine);
+			iCanComplete = EFalse;
+			Kick();
+			}
+		else if(token.CompareF(KTEFStartRepeat)==0)
+			{
+			TPtrC iniFile(lex.NextToken());
+			TPtrC iniSection(lex.NextToken());
+			TPtrC tempRepeatParam=lex.NextToken();
+			CIniData* configData = NULL;
+			TInt err = 0;
+			if(iniFile.Length())
+				{
+				TRAP(err,configData = CIniData::NewL(iniFile));
+				}
+			if(err != KErrNone)
+				{
+				_LIT(KTEFIniFileNotFound,"Ini file not found.. Looping Ignored");
+				ERR_PRINTF1(KTEFIniFileNotFound);
+				Kick();
+				break;
+				}
+			iRepeatParam=0;
+			CleanupStack::PushL(configData);
+			if(configData)
+				{
+				//For Syntax Error  continue ignoring looping
+				if (!configData->FindVar(iniSection, tempRepeatParam, iRepeatParam))
+					{
+					_LIT(KIniFailMessage,"The input data is not found in the ini specified");
+					INFO_PRINTF1(KIniFailMessage);
+					CleanupStack::PopAndDestroy(configData);
+					Kick();
+					break;
+					}
+				}
+				
+			CleanupStack::PopAndDestroy(configData);
+			TExtraLogField logField[1];
+			_LIT(KIterations,"ITERATIONS");
+			logField[0].iLogFieldName.Copy(KIterations);
+			logField[0].iLogFieldValue.Copy(KNull);
+			logField[0].iLogFieldValue.AppendNum(iRepeatParam);
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, token, 1, logField);
+
+			if(tempRepeatParam.Compare(KNull)==0)
+				{
+				_LIT(KRepeatKeyNotFound,"Repeat Parameter Key Not Found");
+				INFO_PRINTF1(KRepeatKeyNotFound);
+				Kick();
+				break;
+				}
+			//Nesting of Control Logic is Not supported
+			if(iLoop)
+				{
+				_LIT(KNestingNotAllowed,"Nesting of START_REPEAT is not supported.. Looping Ignored");
+				WARN_PRINTF1(KNestingNotAllowed);
+				iLoop=EFalse;
+				Kick();
+				break;
+				}
+			//Looping is not to be started with Concurrent mode
+			if(iConcurrent)
+				{
+				_LIT(KConcurrentNotAllowed,"No concurrent Execution is Allowed in Looping");
+				INFO_PRINTF1(KConcurrentNotAllowed);
+				Kick();
+				break;
+				}
+				
+			iLoopCounter=0;
+			//For Invalid Parameter continue ignoring looping
+			if(iRepeatParam<1)
+				{
+				_LIT(KInvalidRepeatParam,"The repeat Parameter is invalid");
+				INFO_PRINTF1(KInvalidRepeatParam);
+				Kick();
+				break;
+				}
+			iLoop=ETrue;
+			iCheckVar=EFalse;
+			Kick();
+			}
+		else if(token.CompareF(KTEFEndRepeat)==0)
+			{
+			if(!iLoop)
+				{
+				_LIT(KLoopNotInitiated,"The Looping is Not Initiated");
+				INFO_PRINTF1(KLoopNotInitiated);
+				Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, token);
+				Kick();
+				break;
+				}
+				
+			iLoopCounter++;
+			if(iLoopCounter==iRepeatParam)
+				{
+				Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, token);
+				iStartLooping=EFalse;
+				iLoop=EFalse;
+				}
+			else
+				{
+				iStartLooping=ETrue;
+				//Looping needs to be started in CONSECUTIVE mode
+				if(iConcurrent)
+					{
+					iConcurrent=EFalse;
+					}
+				}
+			Kick();
+			}
+		else if(token.CompareF(KTEFRunTestStepCommand) == 0 ||
+				token.CompareF(KTEFRunPanicStepCommand) == 0 ||
+				token.CompareF(KTEFRunTestStepResultCommand) == 0 ||
+				token.CompareF(KTEFRunPanicStepResultCommand) == 0
+				)
+			{
+			if(!CheckValidScriptLine())
+				{
+				// Not a Valid Script Line
+
+				TExitCategoryName  blankPanicString; //Not a Panic
+				LogResult(EIgnore, blankPanicString, iCurrentScriptLineNumber, iCurrentScriptLine);
+				// End of defect 037066
+
+				iCanComplete = EFalse;
+				Kick();
+				break;
+				}
+			
+			TInt index;
+			TBool taskCanComplete = ETrue;
+			TBool concurrent = iConcurrent;
+			// Make sure the server is loaded
+			if(!GetServerIndexFromScriptLine(index))
+				{
+				// Not loaded. Skip the line, but ensure its logged as a failure.
+
+				// Start of defect 037066
+				TExitCategoryName  blankPanicString; //Not a Panic
+				LogResult(EIgnore, blankPanicString, iCurrentScriptLineNumber, iCurrentScriptLine);
+				// End of defect 037066
+
+				iCanComplete = EFalse;
+				Kick();
+				break;
+				}
+
+			if(!iConcurrent)
+				{
+				// If we're not in concurrent mode then child objects can complete us
+				taskCanComplete = ETrue;
+				// Prime ready for completion
+				Prime();
+				}
+			else
+				{
+				// In concurrent mode children can't complete us as we kick() ourselves.
+				taskCanComplete = EFalse;
+				Kick();
+				}
+			iConcurrent = concurrent;
+			// Create the test step controler object
+			TInt loopIndex = -1;
+			if (iLoop)
+				{
+				loopIndex = iLoopCounter + 1;
+				}
+			CClientControl* stepController = new (ELeave) CClientControl(*iServers[index],iCurrentScriptLine,*this,iCurrentScriptLineNumber,Logger(), loopIndex, iTestCaseID, iScriptFile, iDefaultSysDrive, iTestSysDrive);
+			stepController->SetTaskComplete(taskCanComplete);
+			iAsyncTasksOutstanding++;
+			// Kick() the test step  object into its state machine
+			stepController->Kick();
+			}
+		else if(token.CompareF(KTEFRunProgramCommand) == 0)
+			{
+			TBool taskCanComplete = ETrue;
+			if(!iConcurrent)
+				{
+				// If we're not in concurrent mode then child objects can complete us
+				taskCanComplete = ETrue;
+				// Prime ready for completion
+				Prime();
+				}
+			else
+				{
+				// In concurrent mode children can't complete us as we kick() ourselves.
+				taskCanComplete = EFalse;
+				Kick();
+				}
+			// Create the test step controller object
+			CProgramControl* programController = new (ELeave) CProgramControl(iCurrentScriptLine,*this,iCurrentScriptLineNumber,Logger());
+			programController->SetTaskComplete(taskCanComplete);
+			iAsyncTasksOutstanding++;
+			// Kick() the test step  object into its state machine
+			programController->Kick();
+			}
+		else if(token.CompareF(KTEFRunWSProgramCommand) == 0)
+			{
+			TBool taskCanComplete = ETrue;
+			if(!iConcurrent)
+				{
+				// If we're not in concurrent mode then child objects can complete us
+				taskCanComplete = ETrue;
+				// Prime ready for completion
+				Prime();
+				}
+			else
+				{
+				// In concurrent mode children can't complete us as we kick() ourselves.
+				taskCanComplete = EFalse;
+				Kick();
+				}
+			// Create the test step controller object
+			CProgramControl* programController = new (ELeave) CProgramControl(iCurrentScriptLine,*this,iCurrentScriptLineNumber,Logger(),ETrue);
+			iAsyncTasksOutstanding++;
+			programController->SetTaskComplete(taskCanComplete);
+			// Kick() the test step  object into its state machine
+			programController->Kick();
+			}
+		else if(token.CompareF(KTEFConcurrentCommand) == 0)
+			{
+			// Go into concurrent mode
+			// Whilst we're in concurrent mode we always kick() ourselves
+			// around the state engine
+				iConcurrent = ETrue;
+			// Call the Logger()'s LogToXml routine to handle XML logging
+			// Takes in just the command name without any field
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, KTEFConcurrentCommand);
+			iCanComplete = EFalse;
+			Kick();
+			}
+		else if(token.CompareF(KTEFConsecutiveCommand) == 0)
+			{
+			// If we go into consecutive mode we have to make sure there are no
+			// requests outstanding.Set the state accordingly
+			iConcurrent = EFalse;
+
+			// Call the Logger()'s LogToXml routine to handle XML logging
+			// Takes in just the command name without any field
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, KTEFConsecutiveCommand);
+			if(iAsyncTasksOutstanding)
+				{
+				iCanComplete = ETrue;
+				iState = EWaitCompletions;
+				Prime();
+				}
+			else
+				{
+				iCanComplete = EFalse;
+				iState = ERunning;
+				Kick();
+				}
+			}
+		else if(token.CompareF(KTEFRunUtilsCommand) == 0)
+			{
+			// All utils complete synchronously
+			TRAPD(err,RunUtilsFromScriptLineL());
+			
+			// Create a TLogField structure array
+			// Size of array equals to number of fields to be displayed for the command
+			TExtraLogField logField[2];
+
+			// The first member of the structure stores the field name
+			// The second one holds the value for the particular field
+			_LIT(KCommand,"COMMAND");
+			logField[0].iLogFieldName.Copy(KCommand);
+			logField[0].iLogFieldValue.Copy(lex.NextToken());
+			
+			logField[1].iLogFieldName.Copy(KTEFResultString);
+			if (err == KErrNone)
+				{
+				logField[1].iLogFieldValue.Copy(KTEFResultPass);
+				}
+			else
+				{
+				logField[1].iLogFieldValue.Copy(KTEFResultFail);
+				}
+
+			// Call the Logger().LogToXml routine which handles XML logging for individual commands
+			// Takes in the command name, number of fields and the struture array
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, KTEFRunUtilsCommand, 2, logField);
+			
+			if(err != KErrNone)
+				{
+				_LIT(KRunUtilsError,"RUN_UTILS ret = %d");
+				INFO_PRINTF2(KRunUtilsError,err);
+				}
+			iCanComplete = EFalse;
+			Kick();
+			}
+		else if(token.CompareF(KTEFPrintCommand) == 0)
+			{
+			PrintFromScriptLine();
+			iCanComplete = EFalse;
+			Kick();
+			}
+		else if (token.CompareF(KTEFPrefixCommand) == 0)
+			{
+
+			if(iAsyncTasksOutstanding)
+				// Don't run Prefix until all outstanding requests have completed
+				{
+				iState = EPrefixPending;
+				iCanComplete = ETrue;
+				Prime();
+				}
+			else
+				{
+				// Ok to run PREFIX - Kick the stated machine so it's run next time in the RunL()
+				iState = ERunPrefix;
+				iCanComplete = EFalse;
+				Kick();
+				}
+
+			}
+		else if (token.CompareF(KTEFRemovePrefixCommand) == 0)
+			{
+			iScriptLinePrefixSet = EFalse;
+			iCanComplete = EFalse;
+			Kick();
+			}
+		else if (token.CompareF(KTEFStartTestCaseCommand) == 0) 
+			{
+			if(ProceedTestCase())
+				{	
+				LogTestCaseMarkerL();
+				iCanComplete = EFalse;
+				Kick();	
+				}
+			else
+				{
+				iState = ETestCaseIgnore;
+				iCanComplete = EFalse;
+				Kick();	
+				}
+			}
+		else if (token.CompareF(KTEFEndTestCaseCommand) == 0)
+			{
+			ProcessEndCase();
+			if(iAsyncTasksOutstanding)
+				// Don't run END_TESTCASE until all outstanding requests have completed
+				{
+				iState = EEndTestCasePending;
+				iCanComplete = ETrue;
+				Prime();
+				}
+			else
+				{
+				// Ok to run END_TESTCASE - Kick the stated machine so it's run next time in the RunL()
+				iState = ERunEndTestCase;
+				iCanComplete = EFalse;
+				Kick();
+				}
+			}
+		else if (token.CompareF(KTEFStartSyncTestCaseCommand) == 0) 
+			{
+			if(ProceedTestCase())
+				{
+				// Start Synchronised Test Case
+				// Check to see if the Sync Data has been created
+				// If not then create it
+				if( iSyncControl == NULL )
+					{
+					iSyncControl = CSyncControl::NewL();
+					}
+				LogTestCaseMarkerL();
+				iState = ERunStartSyncTestCase;
+				iCanComplete = EFalse;
+				Kick();	
+				}
+			else
+				{
+				//go into some sleep state until you 
+				//encounter an end test case for this...
+				iState = ETestCaseIgnore;
+				iCanComplete = EFalse;
+				Kick();	
+				}
+			}
+		else if (token.CompareF(KTEFEndSyncTestCaseCommand) == 0)
+			{
+			ProcessEndCase();
+			// End Synchronised Test Case
+			if(iAsyncTasksOutstanding)
+				// Don't run END_SYNCHRONISED_TESTCASE until all outstanding requests have completed
+				{
+				iState = EEndTestCasePending;
+				iCanComplete = ETrue;
+				Prime();
+				}
+			else
+				{
+				// Ok to run END_SYNCHRONISED_TESTCASE - Kick the stated machine so it's run next time in the RunL()
+				iState = ERunEndTestCase;
+				iCanComplete = EFalse;
+				Kick();
+				}
+			}
+		else if(token.CompareF(KTEFRunScriptCommand) == 0)
+			{
+			// Create a TLogField structure array
+			// Size of array equals to number of fields to be displayed for the command
+			TExtraLogField logField[1];
+
+			// The first member of the structure stores the field name
+			// The second one holds the value for the particular field
+			_LIT(KScriptName,"SCRIPT_NAME");
+			logField[0].iLogFieldName.Copy(KScriptName);
+			logField[0].iLogFieldValue.Copy(lex.NextToken());
+			
+			// Call the Logger().LogToXml routine which handles XML logging for individual commands
+			// Takes in the command name, number of fields and the struture array
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrHigh, KTEFRunScriptCommand, 1, logField);
+			if(iAsyncTasksOutstanding)
+				{
+				// Don't recursively process a new script until this one's async
+				// requests are completed
+				iState = ERunScriptPending;
+				iCanComplete = ETrue;
+				Prime();
+				}
+			else
+				{
+				// Ok to process the script recursively
+				iState = ERunScript;
+				iCanComplete = EFalse;
+				Kick();
+				}
+			}
+		else if(token.CompareF(KTEFCedCommand) == 0)
+			// Run the CED comms database editor
+			{
+			if(iAsyncTasksOutstanding)
+				// Don't run CED until all outstanding requests have completed
+				{
+				iState = ERunCedPending;
+				iCanComplete = ETrue;
+				Prime();
+				}
+			else
+				{
+				// Ok to run CED - Kick the stated machine so it's run next time in the RunL()
+				iState = ERunCed;
+				iCanComplete = EFalse;
+				Kick();
+				}
+			}
+		else if(token.CompareF(KTEFDelayCommand) == 0)
+			// Delay n milliseconds
+			{
+			if(iAsyncTasksOutstanding)
+				// Don't delay until all outstanding requests have completed
+				{
+				iState = EDelayPending;
+				iCanComplete = ETrue;
+				Prime();
+				}
+			else
+				{
+				// Ok to delay
+				iState = EDelay;
+				iCanComplete = EFalse;
+				Kick();
+				}
+			}
+		// Script can exit on error
+		// Flag is checked on async task completion
+		else if(token.CompareF(KTEFBreakErrorOnCommand) == 0)
+			{
+			// Set the flag and process next line
+			iCanComplete = EFalse;
+			iBreakOnError = ETrue;
+
+			// Call the Logger()'s LogToXml routine to handle XML logging
+			// Takes in just the command name without any field
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, KTEFBreakErrorOnCommand);
+			Kick();
+			}
+		else if(token.CompareF(KTEFBreakErrorOffCommand) == 0)
+			{
+			// Reset the flag and process next line
+			iCanComplete = EFalse;
+			iBreakOnError = EFalse;
+
+			// Call the Logger()'s LogToXml routine to handle XML logging
+			// Takes in just the command name without any field
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrMedium, KTEFBreakErrorOffCommand);
+			Kick();
+			}
+		// We only implement the pause command if JustInTime debugging is switched on
+		else if(token.CompareF(KTEFPauseCommand) == 0 && User::JustInTime())
+			{
+			// Create a TLogField structure array
+			// Size of array equals to number of fields to be displayed for the command
+			TExtraLogField logField[1];
+
+			// The first member of the structure stores the field name
+			// The second one holds the value for the particular field
+			_LIT(KDelay,"DELAY");
+			logField[0].iLogFieldName.Copy(KDelay);
+			logField[0].iLogFieldValue.Copy(lex.NextToken());
+
+			// Call the Logger().LogToXml routine which handles XML logging for individual commands
+			// Takes in the command name, number of fields and the struture array
+			Logger().LogToXml(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrLow, KTEFPauseCommand, 1, logField);
+
+			if(iAsyncTasksOutstanding)
+				// Don't pause until all outstanding requests have completed
+				{
+				iState = EPausePending;
+				iCanComplete = ETrue;
+				Prime();
+				}
+			else
+				{
+				// Ok to Pause
+				iState = EPause;
+				iCanComplete = EFalse;
+				Kick();
+				}
+			}
+		// Handles the shared comand and also creates the shared object
+		// on reading user inputs from ini file
+		else if(token.CompareF(KTEFSharedDataCommand) == 0)
+			{
+			if (iIsSharedData)
+				{
+				WARN_PRINTF1(KTEFSharedDataCommandRepeated);
+				}
+			else
+				{
+				TRAPD(err,CreateSharedObjectsFromScriptLineL());
+				if (err != KErrNone)
+					{
+					ERR_PRINTF1(KTEFErrInCreatingSharedObjects);
+					}
+				}
+			iCanComplete = EFalse;
+			Kick();
+			}
+		else
+			{
+			// Command not implemented or a comment line
+			// Code implemented for defect 047340
+			TBuf<KMaxTestExecuteCommandLength> bufWarning;
+			if(token.Length())
+				{
+				TInt firstChar = iCurrentScriptLine[0];
+				if(firstChar != '\r' && firstChar != '\n' && firstChar != '#' && firstChar != '/' && token.CompareF(KTEFPauseCommand) != 0)
+					{
+					_LIT(KUnrecognised,"Unrecognised Command - %S");
+					if(token.Length() < bufWarning.MaxLength())
+						{
+						bufWarning.Copy(token);
+						WARN_PRINTF2(KUnrecognised,&bufWarning);
+						}
+					else
+						{
+						_LIT(KLineTooLong,"Command line too long");
+						bufWarning.Copy(KLineTooLong);
+						WARN_PRINTF2(KUnrecognised,&bufWarning);
+						}
+					}
+				}
+			iCanComplete = EFalse;
+			Kick();
+			}
+		}
+		break;
+
+	case EClosing :
+		// Script has been processed
+		// Pick up the completions
+		{
+		if(iAsyncTasksOutstanding == 0)
+			{
+			// Script finished
+			// Call into the parent
+			iParent.ChildCompletion(KErrNone);
+			delete this;
+			}
+		else
+			{
+			// More requests to complete
+			iCanComplete = ETrue;
+			Prime();
+			}
+		}
+		break;
+
+	case ERunScriptPending :
+	case EWaitCompletions :
+	case ERunCedPending :
+	case EDelayPending :
+	case EPausePending :
+	case EEndTestCasePending :
+	case EPrefixPending:
+		// We go into this state if we're waiting for RUN_TEST_STEP's
+		// to complete before we execute another command
+		{
+		if(iAsyncTasksOutstanding == 0)
+			{
+			// All steps complete
+			// Set up the next state and kick() the state machine
+			if(iState == ERunScriptPending)
+				iState = ERunScript;
+			else if(iState == EWaitCompletions)
+				iState = ERunning;
+			else if(iState == ERunCedPending)
+				iState = ERunCed;
+			else if(iState == EDelayPending)
+				iState = EDelay;
+			else if(iState == EPausePending)
+				iState = EPause;
+			else if(iState == EEndTestCasePending)
+				iState = ERunEndTestCase;
+			else if(iState == EPrefixPending)
+				iState = ERunPrefix;
+			// Safe to Kick() the state machine again
+			iCanComplete = EFalse;
+			Kick();
+			}
+		else
+			{
+			// More requests outstanding
+			iCanComplete = ETrue;
+			Prime();
+			}
+		}
+		break;
+
+	case ERunScript :
+		// Recursively instantiate the CScriptControl class
+		{
+		GetScriptFileFromScriptLine();
+		CScriptControl* scriptControl = new (ELeave) CScriptControl(*this,iChildScriptFile,Logger(),ConsoleLogger(),iStartLooping,iLoop,iDefaultSysDrive,iTestSysDrive,iSelTestingOptions);
+		// Kick the nested CScriptControl state machine
+		scriptControl->Kick();
+		// Put our instance in the idling state, Prime()'d ready for clild-parent
+		// completion by the nested one.
+		iState = EIdling;
+		iCanComplete = ETrue;
+		Prime();
+		}
+		break;
+
+	case ERunCed :
+		// Slightly tricky one
+		// WIN32 & Non-secure means we execute CED synchronously
+		{
+		SetActive();
+		TRAPD(err,RunCedFromScriptLineL());
+		if(!err)
+			// Expect completion asynchronously
+			// We're set for completion so just set the state
+			iState = EIdling;
+		else
+			{
+			_LIT(KCedError,"CED Error = %d");
+			ERR_PRINTF2(KCedError,err);
+			// A CED error so kick the state machine
+			iState = ERunning;
+			Kick();
+			}
+		}
+		break;
+	
+	case EDelay :
+		{
+		// Kick the timer and wait for completion
+		SetActive();
+		StartTimerFromScriptLine();
+		iState = EIdling;
+		}
+		break;
+
+	case ERunEndTestCase :
+		{
+			LogTestCaseMarkerL();
+			iState = ERunning;
+			iCanComplete = EFalse;
+			Kick();
+		}
+		break;
+
+	case ERunStartSyncTestCase :
+		{
+			// Check to see if the test case is ready to continue
+			SetActive();
+			iTimer.After( iStatus, KTEFStatusDelay*1000 );
+			TBool syncContinue = iSyncControl->TestCaseContinueL();
+			if( syncContinue )
+				{
+				iState = EIdling;
+				}
+		}
+		break;
+	case ERunPrefix :
+		{
+			SetPrefix();
+			iState = ERunning;
+			iCanComplete = EFalse;
+			Kick();
+		}
+		break;
+		
+	case EIdling :
+		{
+		// Woken up due to either:
+		// A child CScriptControl instance completing OR
+		// the delay timer has completed.
+		iState = ERunning;
+		iCanComplete = EFalse;
+		Kick();
+		}
+		break;
+
+	case EPause :
+		{
+		_LIT(KPaused,"PAUSED - Hit Any Key to Continue\n");
+		ConsoleLogger().Console().Printf(KPaused);
+		ConsoleLogger().Console().Getch();
+		iState = ERunning;
+		iCanComplete = EFalse;
+		Kick();
+		}
+		//Start of defect 115942 
+		break;
+		//End of defect 115942
+
+	case ETestCaseIgnore:
+		{
+		TPtrC scriptLine;
+		//do we want to while till we come to end of test case?
+		while(GetNextScriptLine(scriptLine))
+			{
+			TLex lex(scriptLine);
+			TPtrC token(lex.NextToken());
+			if((token.CompareF(KTEFEndTestCaseCommand) == 0)
+					|| (token.CompareF(KTEFEndSyncTestCaseCommand) == 0)) //we found an end test case one
+				{
+				TPtrC testCID(lex.NextToken());
+				//to support nested test cases
+				if(iTestCaseIDToIgnore.CompareF(testCID) == 0)
+				{
+					//in any case...go back to running and re-evaluate our position at
+					iState = ERunning;
+					iTestCaseIDToIgnore.Set(KTEFNull);
+					iCanComplete = EFalse;
+					iCurrentScriptLine.Set(scriptLine);
+					//before going back to running re-evaluate the 
+					//state of selective testing
+					ProcessEndCase() ; 
+					Kick();
+					break;
+				}
+				}
+			}
+		break;
+		}
+
+	default:
+		break;
+		}
+	}
+
+/**
+ * Implement the PRINT command
+ * Print the string(s) following the PRINT command to the log file
+ */
+void CScriptControl::PrintFromScriptLine() const
+	{
+	TLex lex(iCurrentScriptLine);
+	lex.NextToken();
+	TBuf<KMaxTestExecuteCommandLength> buf;
+	buf.Copy(lex.Remainder());
+
+	_LIT(KCommentString, " //");
+
+	TInt offset = buf.Find(KCommentString);
+	if (offset != KErrNotFound)
+		{
+		buf.SetLength(offset);
+		}
+
+	_LIT(KS,"%S");
+	INFO_PRINTF2(KS,&buf);
+	}
+
+/**
+ * Implement the PREFIX command
+ * Stores the prefix for command line prefixing
+ */
+void CScriptControl::SetPrefix() 
+	{
+	TLex lex(iCurrentScriptLine);
+	// Bypass the PREFIX command
+	lex.NextToken();
+
+	// Get rid of any leading spaces
+	while(!lex.Eos())
+		{
+		TChar peek = lex.Peek();
+		if(peek == ' ')
+			{
+			lex.Inc();
+			}
+		else
+			break;
+		}
+
+	// Chop off the carriage return and insert a space
+	// If there  is a preceding comment line, get rid of that.
+
+	iScriptLinePrefix.Copy(lex.Remainder());
+
+	_LIT(KCarriageReturn, "\r\n");
+	_LIT(KCommentString, " //");
+
+	TInt offset = iScriptLinePrefix.Find(KCommentString);
+	if (offset != KErrNotFound)
+		{
+		iScriptLinePrefix.SetLength(offset);
+		}
+	else
+		{
+		offset = iScriptLinePrefix.Find(KCarriageReturn);
+
+		if (offset != KErrNotFound)
+			{
+			iScriptLinePrefix.SetLength(offset);
+			}
+		}
+
+	_LIT(KTEFSpace, " ");
+	iScriptLinePrefix.Append(KTEFSpace);
+
+	iScriptLinePrefixSet = ETrue;
+		
+	}
+
+/**
+ * Function to evaluate the situation of selective testing 
+ * Returns whether the testcase on the current script line 
+ * should be run.
+ */
+TBool CScriptControl::ProceedTestCase() 
+	{ 
+	
+	//if selective testing is not on, dont bother
+	if(iSelTestingOptions == NULL)
+		return ETrue;
+	iTestCaseCounter++;
+	if(iTestCaseCounter > 1) //if this is nested, let it run unconditionally
+		return ETrue;
+	// the remaining continues only if selective testing is on
+	// AND we have a non-null, and hopefully valid instance of
+	// iSelTestingOptions
+	TLex lex(iCurrentScriptLine);
+	TPtrC token(lex.NextToken());
+	TPtrC testCaseID(lex.NextToken());
+	//evaluating class state variables...
+	//check range
+	TIdentityRelation<TPtrC> crackID(TSelectiveTestingOptions::CompareTPtrC);
+	TIdentityRelation<TRange> rangeComprtr(TRange::CompareTRangeStartCase);
+	TRange dummy(testCaseID,testCaseID);
+	for ( TInt index=0; index<iSelTestingOptions->iSelectiveCaseRange.Count(); ++index )
+		{
+		if ( testCaseID.CompareF(iSelTestingOptions->iSelectiveCaseRange[index].iStartTestCase) == 0 )
+			{
+			iSelTestingOptions->iSelectiveCaseRange[index].iState=TRange::EStateInUse;
+			++iRangeRefCounter;//number of ranges now in operation	
+			}
+		}
+	
+	
+	TBool runCase = ETrue ; //run everything by def
+	if( iSelTestingOptions->iSelectiveTestingType == iInclusive )
+		{
+		//so selective testing is on and also its inclusive...
+		runCase = (iRangeRefCounter>0) || iSelectOne ; 
+		}
+	else if(iSelTestingOptions->iSelectiveTestingType == iExclusive)
+		{
+		//so selective testing is on and also its exclusive...
+		runCase = (iRangeRefCounter<=0) && !iSelectOne ; 
+		}
+	if(!runCase)//if the test case is to be selectively skipped, log it...
+		{
+		//use this one to log unexecuted cases...
+		Logger().LogTestCaseResult(iScriptFile, iCurrentScriptLineNumber, RFileFlogger::ESevrInfo, token, testCaseID,ESkippedSelectively);
+		}
+	if(runCase == EFalse)
+		{
+			iTestCaseIDToIgnore.Set(testCaseID) ; 
+		}
+		
+	return runCase ; 	
+	}
+
+/**
+ * Function to evaluate the state variables 
+ * at the end of test case 
+ */
+void CScriptControl::ProcessEndCase()
+	{
+	if(iSelTestingOptions==NULL) //selective testing is not on
+		return;					// dont bother
+	iTestCaseCounter--;
+	if(iTestCaseCounter<0) //in case we encountered unmatched end cases
+		iTestCaseCounter=0;
+	TLex lex(iCurrentScriptLine);
+	TPtrC token(lex.NextToken());
+	TPtrC testCaseID(lex.NextToken());	
+	//check if this is ending a range
+	TRange dummy(testCaseID,testCaseID);
+	TIdentityRelation<TRange> crackIDRangeend(TRange::CompareTRangeEnd);
+	for ( TInt index=0; index<iSelTestingOptions->iSelectiveCaseRange.Count(); ++index )
+		{
+		if ( testCaseID.CompareF(iSelTestingOptions->iSelectiveCaseRange[index].iEndTestCase) == 0 )
+			{
+			if ( iSelTestingOptions->iSelectiveCaseRange[index].iState == TRange::EStateInUse )
+				{
+				iSelTestingOptions->iSelectiveCaseRange[index].iState=TRange::EStateUsed;
+				--iRangeRefCounter;
+				}
+			else
+				{
+				//	Error condition. An end test case has been matched to a range that has not processed the start test case
+				//	Either the start test case does not exist or the start test case comes after the end test case in the script
+				//or maybe do nothing
+				
+				}
+			}
+		}
+	
+		
+	//always reset the onetime test case thing
+	iSelectOne = EFalse;
+	}
+
+/**
+ * Implement START_TESTCASE/ END_TESTCASE commands
+ * Write a testcase marker to the logfile
+ */
+void CScriptControl::LogTestCaseMarkerL() 
+	{
+	TLex lex(iCurrentScriptLine);
+	TPtrC token(lex.NextToken());
+	TVerdict TestCaseResult(EFail);
+
+	TPtrC TestCaseMarker(lex.NextToken());
+
+	if (token.CompareF(KTEFStartTestCaseCommand) == 0 || token.CompareF(KTEFStartSyncTestCaseCommand) == 0)
+		{
+		// Call the interface routine for logging in HTML & XML format
+		Logger().LogTestCaseResult(iScriptFile, iCurrentScriptLineNumber, RFileFlogger::ESevrHigh, token, TestCaseMarker);
+		iTestCaseID.Copy(TestCaseMarker);
+		}
+	else
+		{
+		// Its an END_TESTCASE.
+		// Need to identify whether all preceding test steps in the file
+		// passed (back to a *matching* START_TESTCASE).
+		TestCaseResult = HasTestCasePassedL(TestCaseMarker);
+
+			// Special case for KTEFEndSyncTestCaseCommand where the result in 
+			// the shared data area needs to be updated so STAT can retrieve it later.
+			if( token.CompareF(KTEFEndSyncTestCaseCommand) == 0 )
+				{
+				// Check to see if the Sync Data has been created
+				if( iSyncControl != NULL )
+					{
+					// Update the TEFResult shared data value
+					iSyncControl->SetResultL( TestCaseResult );
+					}
+				else
+					{
+					User::Leave( KErrNotReady );
+					}
+				}
+		// Call the interface routine for logging in HTML & XML format
+		Logger().LogTestCaseResult(iScriptFile, iCurrentScriptLineNumber, RFileFlogger::ESevrHigh, token, TestCaseMarker, TestCaseResult);
+		iTestCaseID.Copy(KTEFTestCaseDefault);
+		}
+	}
+
+/**
+ *
+ * Implement TestCase pass checking
+ */
+TVerdict CScriptControl::HasTestCasePassedL(TPtrC aTestCaseMarker)
+	{
+	// Looks from the top of the file for the equivalent Start_TestCase
+	// when it finds it it checks that all the steps to the bottom of 
+	// the file (the current position) 
+
+	// Create a Cinidata object to parse through the testexecute.ini
+	// To retrieve the path where the log is to be placed
+
+	CTestExecuteIniData* parseTestExecuteIni = NULL;
+	TBuf<KMaxTestExecuteNameLength> resultFilePath;
+
+	TRAPD(err,parseTestExecuteIni = CTestExecuteIniData::NewL(iDefaultSysDrive));
+	if (err == KErrNone)
+		{
+		CleanupStack::PushL(parseTestExecuteIni);
+		parseTestExecuteIni->ExtractValuesFromIni();
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFHtmlKey, resultFilePath);
+		}
+	else
+		{
+		resultFilePath.Copy(KTestExecuteLogPath);
+		resultFilePath.Replace(0, 2, iDefaultSysDrive);
+		}
+
+	TBuf<KMaxTestExecuteNameLength> resultFileName(resultFilePath);
+	// loading the simplified test result in case of out-of-memory 
+	resultFileName.Append(KTEFTestExecuteResultSimplifiedSummaryFile);
+	if (parseTestExecuteIni != NULL)
+		{
+		CleanupStack::PopAndDestroy(parseTestExecuteIni);
+		}
+
+	// Open the result summary file
+	RFs fS;
+	User::LeaveIfError(fS.Connect());
+	CleanupClosePushL(fS);
+
+	RFile logFile;
+	User::LeaveIfError(logFile.Open(fS,resultFileName, EFileWrite | EFileRead | EFileShareAny));
+	CleanupClosePushL(logFile);
+	TInt fileSize;
+	// Read the complete result summary file onto the heap
+	// It wont be that large
+	User::LeaveIfError(logFile.Size(fileSize));
+	HBufC* resultData = HBufC::NewLC(fileSize);
+	HBufC8* resultData8 = HBufC8::NewLC(fileSize);	
+	TPtr8 ptrData8(resultData8->Des());
+	User::LeaveIfError(logFile.Read(ptrData8));
+	TPtr ptrData(resultData->Des());
+	ptrData.Copy(ptrData8);
+	CleanupStack::PopAndDestroy(resultData8);
+
+	TBool foundMarker(EFalse);
+	TBool foundNonPassResult(EFalse);
+	TInt duplicatesCounter(0);
+
+	TLex lex(ptrData);
+	while (!lex.Eos())
+		{
+		// Find the ***Result keywords
+		TPtrC commandName( lex.NextToken() );
+		if(	commandName.CompareF(KTEFStartTestCaseCommand) == 0 ||
+			commandName.CompareF(KTEFStartSyncTestCaseCommand) == 0 )
+			{
+			if (lex.NextToken() == aTestCaseMarker)
+				{
+				// Increment the counter to identify that the test case id is duplicated
+				duplicatesCounter++;
+				if (duplicatesCounter == 2)
+					{
+					// If the test case id is duplicated for more than once,
+					// issue a warning in the log file, mentioning duplicate of test case id
+					_LIT(KWarnDuplicateTCID, "Test Case ID : %S re-used");
+					WARN_PRINTF2(KWarnDuplicateTCID, &aTestCaseMarker);
+					}
+
+				// When a matching test case id is found, the found marker is set to ETrue
+				foundMarker = ETrue;
+				// Initialise the foundNonPassResult to EFalse, on entry into each test case result in the log
+				foundNonPassResult = EFalse;
+				continue;
+				}
+			continue;
+			}
+		else if (foundMarker && commandName == KTEFResultTag)
+			{
+			// If the START_TESTCASE is found and a RESULT tag is found in the test result file,
+			// Extract the result value set for every test step called within
+			// and check to see if there are any non-pas results
+			_LIT(KTEFEquals,"=");
+			if (lex.NextToken() != KTEFEquals)
+			continue;
+			TPtrC result(lex.NextToken());
+			if(result != KTEFResultPass)
+				{
+				// Set the foundNonPassResult to ETrue indicating the test case to fail
+				foundNonPassResult = ETrue;
+				}
+			}			
+		}
+
+	CleanupStack::PopAndDestroy(resultData);
+	CleanupStack::Pop(&logFile);
+	logFile.Close();
+	CleanupStack::Pop(&fS);
+	fS.Close();
+
+	if (foundMarker)
+		{
+		if (foundNonPassResult)
+			{
+			return EFail;
+			}
+		else
+			{
+			return EPass;
+			}
+		}
+	else
+		{
+		return EInconclusive;
+		}
+	}
+
+/**
+ * Implement the DELAY command
+ */
+void CScriptControl::StartTimerFromScriptLine()
+	{
+	TLex lex(iCurrentScriptLine);
+	lex.NextToken();
+	TLex delayLex(lex.NextToken());
+	TInt delay;
+	// Read the delay in milliseconds
+	TInt err = delayLex.Val(delay);
+	if(err)
+		// Set the default
+		delay = KDefaultDelayMilliseconds;
+	iTimer.After(iStatus,delay*1000);
+	}
+
+/**
+ * Secure - same for Target and Wins
+ */
+void CScriptControl::RunCedFromScriptLineL()
+	{
+	TLex lex(iCurrentScriptLine);
+	// Skip CED
+	lex.NextToken();
+	TPtrC cedCommandLine(lex.Remainder());
+	iCurrentScriptLine.Set(cedCommandLine);
+	RProcess process;
+	User::LeaveIfError(process.Create(_L("ced.exe"),iCurrentScriptLine));
+	process.Rendezvous(iStatus);
+	// Run CED asynchronously
+	process.Resume();
+	process.Close();
+	}
+
+/**
+ * Set up the path of a script file for a child CScriptControl object
+ */
+void CScriptControl::GetScriptFileFromScriptLine()
+	{
+	TLex lex(iCurrentScriptLine);
+	lex.NextToken();
+	iChildScriptFile.Set(lex.NextToken());
+	}
+
+/**
+ * @param aUtilsCommand - Command string for the utilities command
+ * Implement basic commands:
+ * NB: Always requires the full path
+ * Logic borrowed from Scheduletest
+ * Always complete synchronously
+ * 
+ * CopyFile
+ * MKDir
+ * MakeReadWrite
+ * Delete
+ * DeleteDirectory
+ */
+void CScriptControl::RunUtilsFromScriptLineL() const
+	{
+	_LIT(KDefault,				"?:\\default");
+	_LIT(KCDrive,				"?:\\"); 
+	_LIT(KTEFBackslash,			"\\" );
+
+	TBuf<10> defaultPath(KDefault);
+	defaultPath.Replace(0, 2, iTestSysDrive);
+
+	TBuf<3> cDrive(KCDrive);
+	cDrive.Replace(0, 2, iTestSysDrive);
+
+	RFs fS;
+	User::LeaveIfError(fS.Connect() );
+	CleanupClosePushL(fS);
+
+	TLex lex(iCurrentScriptLine);
+	lex.NextToken();
+	TPtrC token(lex.NextToken());
+	if(token.CompareF(KTEFRunUtilsCopyFile) == 0)
+		{
+		TPtrC file1=lex.NextToken();
+		TPtrC file2=lex.NextToken();
+		TParse source, dest;
+		CFileMan* fMan = CFileMan::NewL(fS);
+		CleanupStack::PushL(fMan);
+		User::LeaveIfError(source.Set(file1, &defaultPath, NULL) );
+		User::LeaveIfError(dest.Set(file2, &defaultPath, NULL) );
+		User::LeaveIfError(fMan->Copy(source.FullName(), dest.FullName(), CFileMan::EOverWrite) );
+		CleanupStack::PopAndDestroy(fMan);
+		}
+	else if(token.CompareF(KTEFRunUtilsMkDir) == 0)
+		{
+		token.Set(lex.NextToken());
+		TParse fileName;
+
+		if (!token.Length())
+			User::Leave(KErrPathNotFound);
+		
+		TPtrC lastChar(token.Mid(token.Length() - 1));
+		if ( lastChar.CompareF(KTEFBackslash) != 0 )
+			{
+			TBuf<64> tempToken(token);
+			tempToken.Append(KTEFBackslash);
+			token.Set(tempToken);
+			}
+
+		User::LeaveIfError( fileName.Set(token, &cDrive, NULL) );
+		User::LeaveIfError( fS.MkDir( fileName.DriveAndPath() ) );
+		}
+	else if(token.CompareF(KTEFRunUtilsDeleteFile) == 0 ||
+	         token.CompareF(KTEFRunUtilsDelete) == 0)
+		{
+		token.Set(lex.NextToken());
+		// defect047128 - Code change for handling wildcard deletes
+		CFileMan* fMan = CFileMan::NewL(fS);
+		CleanupStack::PushL(fMan);
+		User::LeaveIfError(fMan->Delete(token) );
+		CleanupStack::PopAndDestroy(fMan);
+		}
+	else if(token.CompareF(KTEFRunUtilsMakeReadWrite) == 0)
+		{
+		token.Set(lex.NextToken());
+		TParse fileName;
+		User::LeaveIfError(fileName.Set(token, &defaultPath, NULL) );
+		TInt err = fS.SetAtt(fileName.FullName(),0, KEntryAttReadOnly);
+		if (err != KErrNone && err != KErrNotFound)
+			User::Leave(err);
+		}
+	//It deletes the specified directory
+	else if(token.CompareF(KTEFDeleteDirectory) == 0)
+		{
+		token.Set(lex.NextToken());
+		TParse fileName;
+
+		if (!token.Length())
+			User::Leave(KErrPathNotFound);
+		
+		TPtrC lastChar(token.Mid(token.Length() - 1));
+		if ( lastChar.CompareF(KTEFBackslash) != 0 )
+			{
+			TBuf<64> tempToken(token);
+			tempToken.Append(KTEFBackslash);
+			token.Set(tempToken);
+			}
+
+		CFileMan* fMan = CFileMan::NewL(fS);
+		CleanupStack::PushL(fMan);
+
+		User::LeaveIfError(fileName.Set(token, &cDrive, NULL) );
+		User::LeaveIfError( fMan->RmDir( fileName.DriveAndPath() ) );
+
+		CleanupStack::PopAndDestroy(fMan);
+		}
+	
+	fS.Close();
+	CleanupStack::Pop(&fS);	
+	}
+
+/**
+ * Read the Script File data into a heap buffer
+ * We could read the file line by line but that would be cumbersome, and unless there
+ * is a heap size problem, this is tidier.
+ */
+void CScriptControl::CreateScriptDataFromScriptFileL()
+	{
+	RFs fS;
+	User::LeaveIfError(fS.Connect());
+	CleanupClosePushL(fS);
+	RFile scriptFile;
+	User::LeaveIfError(scriptFile.Open(fS,iScriptFile,EFileRead | EFileShareAny));
+	CleanupClosePushL(scriptFile);
+	TInt fileSize;
+	User::LeaveIfError(scriptFile.Size(fileSize));
+	// Create a 16bit heap buffer
+	iScriptData = HBufC::NewL(fileSize);
+	HBufC8* narrowData = HBufC8::NewL(fileSize);
+	CleanupStack::PushL(narrowData);
+	TPtr8 narrowPtr=narrowData->Des();
+	// Read the file into an 8bit heap buffer
+	User::LeaveIfError(scriptFile.Read(narrowPtr));
+	TPtr widePtr(iScriptData->Des());
+	// Copy it to the 16bit buffer
+	widePtr.Copy(narrowData->Des());
+	CleanupStack::PopAndDestroy(narrowData);
+	CleanupStack::Pop(2);
+	scriptFile.Close();
+	fS.Close();
+	// Set up the instance token parser
+	iScriptLex = iScriptData->Des();
+	}
+
+/**
+ * Extracts the human readable server name from the current script line then
+ * calls Client RTestServ Interface to make a connection to the server.
+ */
+void CScriptControl::CreateServerFromScriptLineL()
+	{
+	TLex lex(iCurrentScriptLine);
+	lex.NextToken();
+	TInt i=0;
+	TInt count = iServers.Count();
+	TPtrC serverName(lex.NextToken());
+	
+	// We loop through to see if the server has already been created
+	for(i=0;i<count;i++)
+		{
+		if(iServers[i]->ServerName() == serverName)
+			// Server already exists in our array
+			break;
+		}
+	if(i == count)
+		{
+		// Create a new RTestServ pointer and add it to the list
+		RScriptTestServ* serv = new (ELeave) RScriptTestServ;
+		// Connect using the client API
+		TInt err;
+		if(lex.NextToken().CompareF(KTEFLoadSuiteSharedData) == 0)
+			{
+			err = serv->Connect(serverName,ETrue);
+			}
+		else
+			err = serv->Connect(serverName,EFalse);
+		if(err)
+			{
+			// Don't add the server to the array if we fail to connect.
+			delete serv;
+			// Caller TRAP's
+			User::Leave(err);
+			}
+		iServers.Append(serv);
+		}
+	}
+
+/**
+ * @param aIndex - Return the index of the RTestServ instance - If found
+ * @return - EFalse if server not found. ETrue if server found.
+ * 
+ */
+TBool CScriptControl::GetServerIndexFromScriptLine(TInt& aIndex)
+	{
+	TLex lex(iCurrentScriptLine);
+	TLex lexTimeout;
+	_LIT(KErrInvalidArgumentSet,"The arguments are not provided in proper format.\
+			Unable to retrieve the details of the server from the command line");
+
+	TPtrC command(lex.NextToken());
+	if(command.CompareF(KTEFRunTestStepResultCommand) == 0)
+		{
+		lex.NextToken();
+		lex.SkipSpace();
+		lex.Mark();
+		}
+		
+	else if(command.CompareF(KTEFRunPanicStepResultCommand) == 0)
+		{
+		lex.NextToken();
+		TPtrC panicString(lex.NextToken());
+		// Check to see if the panic string contains open quotes and close quotes
+		// If the panic string token contains open quote, it is understood that the panic string contains spaces
+		// So, look for close quote in the subsequent tokens. If not found, return boolean false as return value
+		if(panicString.Left(1).Compare(KTEFOpenQuotes) == 0 && panicString.Right(1).Compare(KTEFOpenQuotes) != 0)
+			{
+			TBool validCommandLine(EFalse);
+			while(!lex.Eos() && !validCommandLine)
+				{				
+				panicString.Set(lex.NextToken());
+				if(panicString.Right(1).Compare(KTEFOpenQuotes) == 0)
+					validCommandLine = ETrue;
+				}
+			if (!validCommandLine)
+				{
+				ERR_PRINTF1(KErrInvalidArgumentSet);
+				return EFalse;
+				}
+			}
+		lex.SkipSpace();
+		lex.Mark();
+		}
+	else if(command.CompareF(KTEFRunTestStepCommand) == 0 ||
+			command.CompareF(KTEFStartTestBlock) == 0)
+		{
+		TInt firstChar;
+		TPtrC commandStr;
+		TBool panicStringComplete(ETrue);
+		while(!lex.Eos())
+			{
+			lex.SkipSpace();
+			lex.Mark();
+			
+			TPtrC	token = lex.NextToken();
+			if( token.Length()>0 )
+				{
+				commandStr.Set( token );
+				firstChar = commandStr[0];
+				// 33 is the ascii value for "!". Used here for confirming switches
+				if (firstChar != KTEFAsciiExclamation && panicStringComplete)
+					{
+					break;
+					}
+				// Check to see if !PanicString TEF parameter contains panic string with spaces
+				// If so, see if they are enclosed within a open & close braces
+				if(commandStr.Length() > 14 && 
+					commandStr.Mid(0,14).Compare(_L("!PanicString=\"")) == 0)
+						panicStringComplete = EFalse;
+				if(!panicStringComplete && commandStr.Right(1).Compare(KTEFOpenQuotes) == 0)
+					panicStringComplete = ETrue;
+				}
+			}
+			if (!panicStringComplete)
+				{
+				ERR_PRINTF1(KErrInvalidArgumentSet);
+				return EFalse;
+				}
+		}
+	
+	// We need to skip the timeout if it's there.
+	if(	command.CompareF(KTEFRunTestStepCommand) == 0 ||
+		command.CompareF(KTEFStartTestBlock) == 0)
+		lexTimeout=lex.MarkedToken();
+	else
+		lexTimeout=lex.NextToken();
+	TInt timeout;
+	TPtrC serverName;
+	if(lexTimeout.Val(timeout) != KErrNone)
+		// No timeout so use the second token
+		serverName.Set(lex.MarkedToken());
+	else
+		// Timeout value there
+		serverName.Set(lex.NextToken());
+	TInt i=0;
+	// Loop through the installed servers
+	TInt count = iServers.Count();
+	for(i=0;i<count;i++)
+		{
+		if(iServers[i]->ServerName() == serverName)
+			// Found server installed
+			break;
+		}
+	// Return found or not found
+	if(i == count)
+		return EFalse;
+	else
+		{
+		aIndex = i;
+		if (iServers[i]->SharedData())
+			{
+			iConcurrent = EFalse;
+			}
+		return ETrue;
+		}
+	}
+
+/**
+ *  * @return - ETrue if the scriptline is valid, else retuens EFalse
+ */
+TBool CScriptControl::CheckValidScriptLine() const
+	{
+	TLex lex(iCurrentScriptLine);
+	TPtrC command(lex.NextToken());
+	TBool panicCodeSet(EFalse);
+	TBool panicStringSet(EFalse);
+	TBool heapValueSet(EFalse);
+	TBool validScript(ETrue);
+	TBool oomRequestSet(EFalse);
+	TBool setupOptionSet(EFalse);
+	
+	if(command.CompareF(KTEFRunTestStepCommand) == 0)
+		{
+		TInt firstChar;
+		TPtrC commandStr;
+		while(!lex.Eos())
+			{
+			lex.SkipSpace();
+			commandStr.Set(lex.NextToken());
+			firstChar = commandStr[0];
+			// 33 is the ascii value for "!". Used here for confirming switches
+			if (firstChar == KTEFAsciiExclamation)
+				{
+				if (commandStr.Length() >= KTEFMinErrorParamLength && commandStr.Mid(0,KTEFMinErrorParamLength).CompareF(KTEFError) == 0)
+					{
+					if(command.CompareF(KTEFRunTestStepCommand) == 0)
+						command.Set(KTEFRunErrorStepResultCommand);
+					else
+						validScript = EFalse;
+					}
+				else if (commandStr.Length() >= KTEFMinSetupParamLength && commandStr.Mid(0,KTEFMinSetupParamLength).CompareF(KTEFSetUpParam) == 0)
+					{
+					if(command.CompareF(KTEFRunTestStepCommand) == 0 && !setupOptionSet)
+						setupOptionSet = ETrue;
+					else
+						validScript = EFalse;
+					}
+				else if (commandStr.Length() > KTEFMinResultParamLength && commandStr.Mid(0,KTEFMinResultParamLength).CompareF(KTEFResult) == 0 && commandStr.Mid(KTEFMinResultParamLength).Length() <= KTEFMaxVerdictLength)
+					{
+					if (command.CompareF(KTEFRunTestStepCommand)  == 0)
+						command.Set(KTEFRunTestStepResultCommand);
+					else
+						validScript = EFalse;
+					}
+				else if (commandStr.Length() >= KTEFMinPanicCodeParamLength && commandStr.Mid(0,KTEFMinPanicCodeParamLength).CompareF(KTEFPanicCode) == 0)
+					{
+					if ((command.CompareF(KTEFRunTestStepCommand) == 0 || command.CompareF(KTEFRunPanicStepResultCommand) == 0) && !panicCodeSet)
+						{
+						command.Set(KTEFRunPanicStepResultCommand);
+						panicCodeSet=ETrue;
+						}
+					else
+						validScript = EFalse;
+					}
+				else if (commandStr.Length() >= KTEFMinPanicStringParamLength && commandStr.Mid(0,KTEFMinPanicStringParamLength).CompareF(KTEFPanicString) == 0)
+					{
+					if ((command.CompareF(KTEFRunTestStepCommand) == 0 || command.CompareF(KTEFRunPanicStepResultCommand) == 0) && !panicStringSet)
+						{
+						command.Set(KTEFRunPanicStepResultCommand);
+						panicStringSet = ETrue;
+						}
+					else
+						validScript = EFalse;
+					}
+				else
+					{
+					if (commandStr.Length() >= KTEFMinHeapParamLength && commandStr.Mid(0,KTEFMinHeapParamLength).CompareF(KTEFHeap) == 0 && !heapValueSet)
+						heapValueSet = ETrue;
+					else if (commandStr.Length() >= KTEFMinOomParamLength && commandStr.Mid(0,KTEFMinOomParamLength).CompareF(KTEFOom) == 0 && !oomRequestSet)
+						oomRequestSet = ETrue;
+					else
+						validScript = EFalse;
+					}
+				}
+			else
+				break;
+			}
+		}
+		return validScript;
+	}
+
+/**
+ * Return the next line in the script file
+ * @param aScriptLine - return line in the script file minus CRLF
+ * @return - True if line found, false for end of file.
+ */	
+TBool CScriptControl::GetNextScriptLine(TPtrC& aScriptLine)
+	{
+	if(iScriptLex.Eos())
+		{
+		// Fix defect 1193337, check the value is zero or not. If zero, this should be no nested run script
+		if((0 == iNestedNumRunScriptInLoop) && iLoop)
+		// End defect 119337
+			{
+			_LIT(KEndRepeatNotFound,"The END_REPEAT command is not found");
+			INFO_PRINTF1(KEndRepeatNotFound);
+			}
+		
+		// Fix defect 119337, check if this is still in loop and this run script command is nested
+		// decrease one shows that the nested number is decreased
+		else if (iNestedNumRunScriptInLoop > 0 && iLoop)
+			{
+			--iNestedNumRunScriptInLoop;
+			}
+		// End defect 119337
+		
+		return EFalse;
+		}
+	// Mark the current script line to return
+	iScriptLex.Mark();
+	if(iLoop && !iCheckVar)
+		{
+		iStoreLoop.Assign(iScriptLex.RemainderFromMark());
+		iTempStoreLoop.Assign(iScriptLex.RemainderFromMark());
+		iCheckVar=ETrue;
+		}
+	// Place the lex marker for the next read
+	while(!iScriptLex.Eos())
+		{
+		TChar peek = iScriptLex.Peek();
+		if(peek == '\n')
+			{
+			iScriptLex.Inc();
+			iCurrentScriptLineNumber++;
+			break;
+			}
+		else
+			iScriptLex.Inc();
+		}
+	aScriptLine.Set(iScriptLex.MarkedToken());
+	if(aScriptLine.FindF(KTEFRunScriptCommand)!=KErrNotFound && iLoop)
+		{
+		// Fix defect 119337, add this integer shows a nested run script added.
+		++iNestedNumRunScriptInLoop;
+		// End Fix defect 119337
+		}
+	if(aScriptLine.Length() || !iScriptLex.Eos())
+		return ETrue;
+	else
+		return EFalse;
+	}
+
+/**
+ * Return the next line from script file which is to be looped
+ * @param aScriptLine - return line in the script file which is under loop minus CRLF
+ * @return -True if line is found else return false
+ * 
+ * If RUN_SCRIPT command has been encountered return the line from GetNextScriptLine Function
+ */
+TBool CScriptControl::GetLoopScriptLine(TPtrC& aScriptLine)
+	{
+	// Fix defect 119337, check if the run script is nested
+	if (0 != iNestedNumRunScriptInLoop)
+	// End defect 119337
+		return(GetNextScriptLine(aScriptLine));
+	if(iStoreLoop.Eos())
+		return EFalse;
+	iStoreLoop.Mark();
+	while(!iStoreLoop.Eos())
+		{
+		TChar peek = iStoreLoop.Peek();
+		if(peek == '\n')
+			{
+			iStoreLoop.Inc();
+			break;
+			}
+		else
+			iStoreLoop.Inc();
+		}
+	aScriptLine.Set(iStoreLoop.MarkedToken());
+	if(aScriptLine.Find(KTEFEndRepeat)!=KErrNotFound)
+		{
+		iStoreLoop.Assign(iTempStoreLoop);	
+		}
+	if(aScriptLine.FindF(KTEFRunScriptCommand)!=KErrNotFound)
+		{
+		// Fix defect 119337, add this integer shows a nested run script added.
+		++iNestedNumRunScriptInLoop;
+		// End defect 119337
+		}
+	if(aScriptLine.Length() || !iStoreLoop.Eos())
+		return ETrue;
+	else
+		return EFalse;
+	}
+
+/**
+ * @param aErr - The completion code
+ * @param aPanicString - Descriptor reference containing the panic string if a test were to panic
+ * @param aScriptLineNumber - Script line number used for printing result into log file
+ * @param aCommand - Command name also used for printing result into log file
+ * Called by a CClientControl or CProgramControl child object
+ */
+void CScriptControl::TaskCompletion(TInt aErr, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,TBool aTaskCanComplete,TTEFItemArray* aItemArray)
+	{
+	if(aItemArray)
+		{
+		TVerdict err = Logger().LogBlock( aItemArray, aScriptLineNumber );
+		
+		// If no error was set on the server side (ie. a panic) then set
+		//  it here with the post processing result
+		if( EPass == aErr && aPanicString.Length() == 0 )
+			{
+			aErr = err;
+			}
+		}
+	// Log the test step result to the output file
+	LogResult((TVerdict)aErr, aPanicString, aScriptLineNumber, aCommand);
+		
+	if(aErr != KErrNone && aErr != KErrNotSupported && iBreakOnError)
+		// Put this instance of the script engine into the closing state as we've
+		// encountered the BREAK_ERROR_ON command.
+		// KErrNotSupported is considered a benign error 
+		{
+		iState = EClosing;
+		}
+	iAsyncTasksOutstanding--;
+	// Check the flag first then trigger our own RunL()
+	if(aTaskCanComplete || iCanComplete)
+		Complete(aErr);
+	}
+
+/**
+ * Print the current script line to the console
+ */
+void CScriptControl::PrintCurrentScriptLine() const
+	{
+	// Check we don't overflow
+	TBuf<KMaxTestExecuteLogLineLength> output;
+	if((iCurrentScriptLine.Length() + iScriptFile.Length() + 4 ) > output.MaxLength())
+		{
+		output.Copy(iAlteredScriptLine);
+		Logger().PrintCurrentScriptLine(output);
+		return;
+		}
+	// Copy the script filename. Handy for recursion
+	output.Copy(iScriptFile);
+	output.Append(KTEFSpace);
+	// Append the script file line
+	output.Append(iCurrentScriptLine);
+	// Write to console
+	ConsoleLogger().Console().Printf(KTEFStringFormat,&output);
+
+	Logger().PrintCurrentScriptLine(output);
+	}
+
+/**
+ * Checks for commented commands and increments a counter for logging
+ */
+TBool CScriptControl::CheckCommentedCommands() const
+	{
+	if(!iCurrentScriptLine.Length())
+		return ETrue;
+	
+	TLex lex(iCurrentScriptLine);
+	TPtrC token(lex.NextToken());
+	if (!token.Length())
+		return ETrue;
+	
+	TInt firstChar = iCurrentScriptLine[0];
+	if(firstChar == '/')
+		{
+		TInt findRunTestStep;
+		TInt findRunPanicStep;
+		TInt findRunScript;
+		TInt findRunProgram;
+		TInt findRunWSProgram;
+		TInt findStartTestBlock;
+		findRunTestStep=iCurrentScriptLine.Find(KTEFRunTestStepCommand);
+		findRunScript=iCurrentScriptLine.Find(KTEFRunScriptCommand);
+		findRunPanicStep=iCurrentScriptLine.Find(KTEFRunPanicStepCommand);
+		findRunProgram=iCurrentScriptLine.Find(KTEFRunProgramCommand);
+		findRunWSProgram=iCurrentScriptLine.Find(KTEFRunWSProgramCommand);
+		findStartTestBlock=iCurrentScriptLine.Find(KTEFStartTestBlock);
+		if(findRunTestStep>0 || findRunScript>0 || findRunPanicStep>0 || findRunProgram>0 || findRunWSProgram>0 || findStartTestBlock>0 && !iStartLooping)
+			{
+			commentedCommandsCount++;
+			}
+		}
+	if(firstChar == '\r' || firstChar == '\n' || firstChar == '#' || firstChar == '/')
+		return ETrue;
+	return EFalse;
+	}
+
+/**
+ * @param aResult - Test Step result
+ * @param aPanicString - Descriptor containing the panic string if test were to panic
+ * @param aScriptLineNumber - The line in the script file
+ * @param aCommand - Command name whose result is set for logging
+ * Log a RUN_TEST_STEP, RUN_PANIC_STEP or RUN_PROGRAM result to file
+ */
+void CScriptControl::LogResult(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand)
+	{
+	// Call the Logger()'s LogResult() routine to manipulate results of RUN_TEST_STEP command/variants
+	// Also controls the fields for logging both HTML & XML logging
+	Logger().LogResult(aResult, aPanicString, aScriptLineNumber, aCommand, iScriptFile, RFileFlogger::ESevrHigh);
+	}
+
+/**
+ * Constructor
+ * @param RTestServ - Reference to a root RTestServer instance
+ * @param aCommand - Reference to a RUN_TEST_STEP script line
+ * @param MTaskCompletion - Reference to the parent completion interface
+ * @param aScriptLineNumber - The line in script file
+ * @param aLogger - Reference to the Logger class
+ * @param aLoopIndex - TInt reference that provides the loop index for the test. The value is 0 if not in loop.
+ * @param aTestCaseID - Descriptor containing the test case id, if test run is within a test case
+ * @param aScriptFilePath - The path of the script file being executed
+ * @param aSysDrive - Default system drive letter
+ * @param aTestSysDrive - System drive letter overwritten from testexecute.ini
+ */
+CClientControl::CClientControl(RScriptTestServ& aServ,const TDesC& aCommand, MTaskCompletion& aCompletion, TInt aScriptLineNumber, CTestExecuteLogger& aLogger, TInt aLoopIndex, const TDesC& aTestCaseID, TPtrC& aScriptFilePath, const TDriveName& aSysDrive, const TDriveName& aTestSysDrive)
+:	CTaskControlBase(aCommand,aCompletion,aScriptLineNumber,aLogger)
+,	iServ(aServ)
+,	iRetryCount(0)
+,	iLoopIndex(aLoopIndex)
+,	iTestCaseID(aTestCaseID)
+,	iBlockArrayPkg(NULL)
+,	iBlockArrayPtr(STATIC_CAST(TUint8*,NULL), 0)
+,	iScriptFilePath(aScriptFilePath)
+,	iDefaultSysDrive(aSysDrive)
+,	iTestSysDrive(aTestSysDrive)
+	{
+	// Extract the parameters to the test step and store them in the class
+	GetStepParamsFromStepCommand();
+	}
+
+CClientControl* CClientControl::NewL(	RScriptTestServ& aTestServ,
+										const TDesC& aCommand,
+										MTaskCompletion& aCompletion,
+										TInt aScriptLineNumber,
+										CTestExecuteLogger& aLogger,
+										TInt aLoopIndex,
+										const TDesC& aTestCaseID,
+										const TDesC& aEndBlockCommand,
+										TPtrC& aScriptFilePath,
+										const TTEFItemArray& aBlockArray,
+										const TDriveName& aSysDrive,
+										const TDriveName& aTestSysDrive)
+	{
+	CClientControl* self = new (ELeave) CClientControl(	aTestServ,
+														aCommand,
+														aCompletion,
+														aScriptLineNumber,
+														aLogger,
+														aLoopIndex,
+														aTestCaseID,
+														aScriptFilePath,
+														aSysDrive,
+														aTestSysDrive);
+	CleanupStack::PushL(self);
+	self->ConstructL(aEndBlockCommand, aBlockArray);
+	CleanupStack::Pop();
+	return self;
+	}
+
+void CClientControl::ConstructL( const TDesC& aEndBlockCommand, const TTEFItemArray& aBlockArray )
+	{
+	iEndBlockCommand.Set( aEndBlockCommand );
+	TTEFItemPkgBuf	itemPckgBuf;
+	TInt			count = aBlockArray.Count();
+	iBlockArrayPkg	= HBufC8::NewL( count * itemPckgBuf.Size() );
+	iBlockArrayPtr.Set( iBlockArrayPkg->Des() );
+	for( TInt i=0; i<count; i++ )
+		{
+		itemPckgBuf = aBlockArray.At(i);
+		iBlockArrayPtr.Append( itemPckgBuf );
+		}
+	}
+
+TTEFItemArray* CClientControl::CreateBlockArrayLC()
+	{
+	TTEFItemPkgBuf	itemPckgBuf;
+	TPtr8			blockArrayPtr(iBlockArrayPkg->Des());
+	TInt			count = blockArrayPtr.Size()/itemPckgBuf.Size();
+	TTEFItemArray*	itemArray = new (ELeave) TTEFItemArray( count );
+	CleanupStack::PushL( itemArray );
+
+	TInt	pos = 0;
+	for( TInt i=0; i<count; i++ )
+		{
+		itemPckgBuf.Copy(blockArrayPtr.Mid(pos, itemPckgBuf.Size()));
+		pos += itemPckgBuf.Size();
+		itemArray->AppendL( itemPckgBuf() );
+		}
+
+	return itemArray;
+	}
+	
+/**
+ * Destructor
+ */
+CClientControl::~CClientControl()
+	{
+	iTimer.Cancel();
+	iTimer.Close();
+	
+	if( iBlockArrayPkg )
+		{
+		delete iBlockArrayPkg;
+		iBlockArrayPkg = NULL;
+		}
+	}
+const TInt KDisableTimer = -1;
+
+/** 
+ * Test step has done. log the test result. 
+ */
+void CClientControl::TestStepComplete()
+	{
+	iSession.Close();
+	if(iBlockArrayPkg)
+		{
+		TTEFItemArray *itemArray = CreateBlockArrayLC();
+		iParent.TaskCompletion(iStatus.Int(), iTaskExitCategory, iScriptLineNumber, iEndBlockCommand, iTaskCanComplete, itemArray);
+		CleanupStack::PopAndDestroy(itemArray);
+		}
+	else
+		{
+		iParent.TaskCompletion(iStatus.Int(), iTaskExitCategory, iScriptLineNumber, iCommandLine, iTaskCanComplete);
+		}
+	}
+
+/**
+ * Pure virtual
+ * Test step handling state machine
+ * Kick'd() into by the parent CScriptControl object. Constructed in the EInit state
+ */
+void CClientControl::RunL()
+	{
+	switch(iState)
+		{
+	case EInit	:
+		User::LeaveIfError(iTimer.CreateLocal());
+		if(iBlockArrayPkg)
+			{
+			User::LeaveIfError(iSession.Open(iServ, EFalse));		
+			}
+		else
+			{
+			User::LeaveIfError(iSession.Open(iServ, ETrue, iStepName));
+			}
+		// Whilst testing concurrent mode, the OS occasionally completes with
+		// KErrServerBusy or KErrInUse.
+		
+		// clean up retry counter. case ERetry will using.
+		iRetryCount = 0;
+	case EServerRetry :
+		{
+		SetActive();
+		
+		// Set the heap size for creating the thread heap size
+		iTaskExitCategory.Copy(iTaskHeapSize);
+
+		TBuf<5> checkOOMArgsBuf;
+
+		// Check if the step args has the OOM arguments already
+		// A minimum 5 chars expected to check this : "OOM=0" or "OOM=1"
+		if (iStepArgs.Length() >=5)
+			{
+			// Extract the first 5 chars from the start of step args string
+			checkOOMArgsBuf.Copy(iStepArgs.Mid(0,5));
+			}
+
+		_LIT(KOOMOne,"OOM=1");
+		_LIT(KOOMZero,"OOM=0");
+
+		// Set the OOM argument after checking for existence of OOM param already
+		if ((checkOOMArgsBuf.CompareF(KOOMOne) != KErrNone) && (checkOOMArgsBuf.CompareF(KOOMZero) != KErrNone))
+			{
+			// Insert the OOM arguments to the start of iStepArgs string
+			if (iOOMRequestSet) // Set OOM=1 if !OOM is used in the RUN_TEST_STEP command
+				iStepArgs.Insert(0,_L("OOM=1 "));
+			else
+				iStepArgs.Insert(0,_L("OOM=0 "));
+			}
+
+		TBuf<KMaxTestExecuteCommandLength> checkSetUpArgsBuf;
+
+		// Check if the step args has the Setup arguments already
+		// A min of 13 chars expected to check this : "OOM=0 !Setup=" or "OOM=1 !Setup="
+		if (iStepArgs.Length() >=13)
+			{
+			// Extract 7 chars after skipping the OOM arguments "OOM=0 " or "OOM=1 "
+			checkSetUpArgsBuf.Copy(iStepArgs.Mid(6,7));
+			}
+
+		// Set the !Setup argument after checking for existence !Setup param already
+		if (checkSetUpArgsBuf.CompareF(KTEFSetUpParam) != KErrNone)
+			{
+			// Retain the !Setup value from RUN_TEST_STEP command, if available
+			if (iSetUpParamValue.Length() == KTEFZeroValue)
+				{
+				// If !Setup is not used in RUN_TEST_STEP, set the !Setup to TTestSetupState::ESetupNone (0)
+				iSetUpParamValue.Copy(KTEFSetUpParam);
+				iSetUpParamValue.AppendNum(TTestSetupState(ESetupNone));
+				}
+
+			// Append a space and also include the loop index
+			iSetUpParamValue.Append(KTEFSpace);
+			// The loop index is 0 if the test is not in loop; loop index, otherwise
+			iSetUpParamValue.AppendNum(iLoopIndex);
+			iSetUpParamValue.Append(KTEFSpace);
+			
+			// Append the TestCaseID along with the Setup params
+			iSetUpParamValue.Append(iTestCaseID);
+			iSetUpParamValue.Append(KTEFSpace);
+
+			// Insert the !Setup arguments after the OOM arguments within the iStepArgs
+			iStepArgs.Insert(6, iSetUpParamValue);
+			}
+		
+		// Call the async client API to run the test step
+		if(iBlockArrayPkg)
+			{
+			iSession.RunTestBlock(iStepArgs,iTaskExitCategory,iBlockArrayPtr,iStatus);
+			}
+		else
+			{
+			iSession.RunTestStep(iStepArgs,iTaskExitCategory,iStatus);
+			}
+		// Start a timer and provide it with our callback MTaskCompletion
+		iState = ERunning;
+		// Only start the timer if the disable value is not set
+		if(iTaskTimeout != KDisableTimer)
+			{
+			iTaskTimer = CTaskTimer::NewL(*this);
+			iTaskTimer->Timeout(iTaskTimeout);
+			}
+		}
+		break;
+
+	case ERunning :
+		{
+		// We have been completed but we need to find out the source
+		// If the timer expires it Aborts the server test step which results in
+		// the RunTestStep call completing with KErrAbort.
+		// When the timer expires it calls us back and we delete it then NULL it.
+		if(iTaskTimer)
+			{
+			// The timer did not expire
+			iTaskTimer->Cancel();
+			delete iTaskTimer;
+			iTaskTimer = NULL;
+			}
+		const TInt KRetry10Microseconds = 100000;
+		const TInt KMaxRetryCount = 20;
+		if(iStatus.Int() == KErrInUse && iRetryCount < KMaxRetryCount)
+			{
+			// OS (not the server) has rejected the call.
+			// Timed retry
+			// Noticed this one after panic's in shared data mode
+			iState = EServerRetry;
+			// Keep increasing the timeout
+			iRetryCount++;
+			SetActive();
+			iLogger.LogExtra((TText8*)__FILE__,__LINE__,ESevrInfo,
+					_L("Error Message :: The Task Is Retrying "));
+			iTimer.After(iStatus,KRetry10Microseconds * iRetryCount);							
+			}		
+		else if(iStatus.Int() == KErrServerBusy)
+			{
+			// tempt to do test again when test server return busy.
+			iState = EServerRetry;
+			iRetryCount++;
+			if(iRetryCount < KMaxRetryCount)
+				{
+				iState = EServerRetry;
+				SetActive();
+				iLogger.LogExtra((TText8*)__FILE__,__LINE__,ESevrInfo,
+						_L("Error Message : Server return -16 = KErrServerBusy : Retrying %d"),iRetryCount);
+				iTimer.After(iStatus,KRetry10Microseconds );
+				}
+			else//server alwayse busy. stop test. 
+				{
+				iLogger.LogExtra((TText8*)__FILE__,__LINE__,ESevrErr,
+										_L("Error Message : Server Busy Retrying %d times. Test Teminated!"),iRetryCount);
+				iParent.TaskCompletion(iStatus.Int(),iTaskExitCategory,iScriptLineNumber,iCommandLine,iTaskCanComplete);
+
+				iSession.Close();
+				delete this;				
+				}
+			}			
+		else
+			{
+			// see testserverbase.cpp::void SytemWideErrToTefErr(TInt &aErr). converting thi value.
+			//Check the status, if the status is KErrTestExecuteInUse
+			//then log the information  and change it back to 
+			if(iStatus.Int() == KErrTestExecuteInUse)
+				{
+				//Convert the status back to KErrInUse
+				iStatus=KErrInUse;
+				}
+			else if(iStatus.Int() == KErrTestExecuteServerBusy)
+				{
+				//this is not server really busy! we should change the server side iStatus back to -16
+				//Convert the status back to KErrServerBusy
+				iStatus = KErrServerBusy;
+				}
+			// Step completion
+			TestStepComplete();
+			delete this;
+			}
+		}
+		break;
+
+	default:
+		break;
+		}
+	}
+
+/**
+ * @param aError - TInt value representing error returned due to processing request from RunL()
+ * Handles the leave from RunL() and cleans up the allocated objects
+ * Also returns KErrNone upon sucessful handling of leave
+ */
+TInt CClientControl::RunError(TInt aError)
+	{
+	if(iBlockArrayPkg)
+		{
+		TTEFItemArray*	itemArray = CreateBlockArrayLC();
+		iParent.TaskCompletion(aError,iTaskExitCategory,iScriptLineNumber,iEndBlockCommand,iTaskCanComplete,itemArray);
+		CleanupStack::PopAndDestroy( itemArray );
+		}
+	else
+		{
+		iParent.TaskCompletion(aError,iTaskExitCategory,iScriptLineNumber,iCommandLine,iTaskCanComplete);
+		}
+	delete this;
+	return KErrNone;
+	}
+
+/**
+ * Extract and save the timeout, step name and test step arguments
+ */
+void CClientControl::GetStepParamsFromStepCommand()
+	{
+	TLex scriptLineLex(iCommandLine);
+	TPtrC command(scriptLineLex.NextToken());
+	if(command.CompareF(KTEFRunTestStepResultCommand) == 0)
+		scriptLineLex.NextToken();
+	else if(command.CompareF(KTEFRunPanicStepResultCommand) == 0)
+		{
+		scriptLineLex.NextToken();
+		TPtrC panicString(scriptLineLex.NextToken());
+		if(panicString.Left(1).Compare(KTEFOpenQuotes) == 0 && panicString.Right(1).Compare(KTEFOpenQuotes) != 0)
+			{
+			TBool validCommandLine(EFalse);
+			while(!scriptLineLex.Eos() && !validCommandLine)
+				{				
+				panicString.Set(scriptLineLex.NextToken());
+				if(panicString.Right(1).Compare(KTEFOpenQuotes) == 0)
+					validCommandLine = ETrue;
+				}
+			}
+		}
+	else if(command.CompareF(KTEFRunTestStepCommand) == 0 ||
+			command.CompareF(KTEFStartTestBlock) == 0 )
+		{
+		TInt firstChar;
+		TPtrC commandStr;
+		TBool panicStringComplete(ETrue);
+		while(!scriptLineLex.Eos())
+			{
+			scriptLineLex.SkipSpace();
+			scriptLineLex.Mark();
+			
+			TPtrC	token = scriptLineLex.NextToken();
+			if( token.Length()>0 )
+				{
+				commandStr.Set( token );
+				firstChar = commandStr[0];
+				// 33 is the ascii value for "!". Used here for confirming switches
+				if (firstChar != KTEFAsciiExclamation && panicStringComplete)
+					{
+					break;
+					}
+				if(commandStr.Length() > 14 && 
+					commandStr.Mid(0,14).Compare(_L("!PanicString=\"")) == 0)
+						panicStringComplete = EFalse;
+				if(!panicStringComplete && commandStr.Right(1).Compare(KTEFOpenQuotes) == 0)
+					panicStringComplete = ETrue;
+				if (commandStr.Length() >= KTEFMinHeapParamLength && commandStr.Mid(0,KTEFMinHeapParamLength).CompareF(KTEFHeap) == 0)
+					iTaskHeapSize.Set(commandStr.Mid(KTEFMinHeapParamLength));
+				else if (commandStr.Length() >= KTEFMinSetupParamLength && commandStr.Mid(0,KTEFMinSetupParamLength).CompareF(KTEFSetUpParam) == 0)
+					iSetUpParamValue.Copy(commandStr);
+				else if (commandStr.Length() >= KTEFMinOomParamLength && commandStr.Mid(0,KTEFMinOomParamLength).CompareF(KTEFOom) == 0)
+					{
+					// Out of memory cannot be supported for UREL builds due to UHEAP macros
+					// not being supported in UREL builds
+					#if defined(_DEBUG)
+						iOOMRequestSet = ETrue;
+					#else
+						iOOMRequestSet = EFalse;
+						iLogger.LogExtra((TText8*)__FILE__,__LINE__,ESevrWarn,
+								_L("Out of Memory Testing is not supported for UREL builds"));
+					#endif
+					}
+				}
+			}
+		}
+
+	TLex timeoutLex;
+	if(	command.CompareF(KTEFRunTestStepCommand) == 0 ||
+		command.CompareF(KTEFStartTestBlock) == 0)
+		timeoutLex = scriptLineLex.MarkedToken();
+	else
+		timeoutLex = scriptLineLex.NextToken();
+	TInt err = timeoutLex.Val(iTaskTimeout);
+	if(err)
+		{
+		// No timeout specified
+		iTaskTimeout = KDefaultTimeoutSeconds;
+		iStepName.Set(scriptLineLex.NextToken());
+		}
+	else
+		{
+		scriptLineLex.NextToken();
+		if( command.CompareF(KTEFRunTestStepCommand) == 0 ||
+			command.CompareF(KTEFRunTestStepResultCommand) == 0 ||
+			command.CompareF(KTEFRunPanicStepResultCommand) == 0 ||
+			command.CompareF(KTEFRunPanicStepCommand) == 0||
+			command.CompareF(KTEFRunErrorStepResultCommand) == 0)
+			{
+			// Save the step name
+			iStepName.Set(scriptLineLex.NextToken());
+			}
+		}
+	// The rest is sent to the server
+	scriptLineLex.SkipSpace();
+  	iStepArgs.Copy(iScriptFilePath.Mid(0,2));
+  	iStepArgs.Append(KTEFSpace);
+	iStepArgs.Append(iDefaultSysDrive);
+	iStepArgs.Append(KTEFSpace);
+	iStepArgs.Append(iTestSysDrive);
+	iStepArgs.Append(KTEFSpace);
+  	iStepArgs.Append(scriptLineLex.Remainder());
+	}
+
+/**
+ * Callback from a CTaskTimer object
+ * Abort the test step, NULL the timer so we know that a timeout has caused test step completion
+ */
+void CClientControl::TaskTimerCompletion()
+	{
+	delete iTaskTimer;
+	iTaskTimer = NULL;
+	iSession.AbortTestStep();
+	}
+
+/**
+ * Constructor
+ * @param aCompletion - Reference to a callback method in the CClientControl parent object
+ */
+CTaskTimer::CTaskTimer(MTaskTimerCompletion& aCompletion) : CTimer(EPriorityUserInput), iParent(aCompletion)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+/**
+ * Iterate till the timer has expired and callback into the parent
+ */
+void CTaskTimer::RunL()
+	{
+	if (iTimesAfter > 0 || iSecondsRemaining > 0)
+		{
+		RunTimeout(); // Function call implementing the After() routines
+		}
+	else
+		{
+		iParent.TaskTimerCompletion(); // Call the completion routine for the timeout
+		}
+	}
+
+/**
+ * Implements a timeout based using CTimer::After()
+ * Modified for handling huge timeout values
+ * @param aSeconds - Timeout value in seconds
+ */
+ void CTaskTimer::Timeout(TInt aSeconds)
+	{
+	iTimesAfter = aSeconds/60; // Convert the aSeconds to equivalent minutes
+	iSecondsRemaining = (aSeconds - (iTimesAfter*60)); // Remainder of seconds after converting to equivalent minutes
+	RunTimeout();
+	}
+
+/**
+ * Implements the After() routines for the timeout value specified
+ * The call is initiated from Timeout() & is iterated from the RunL()
+ */
+void CTaskTimer::RunTimeout()
+	{
+	if (iTimesAfter > 0)
+		{
+		After(60*1000000); // Call After() for every minute until iTimesAfter is >0
+		iTimesAfter--;
+		}
+	else if (iSecondsRemaining > 0)
+		{
+		After(iSecondsRemaining*1000000); // Call After() for remainder of microsec
+		iSecondsRemaining = 0;
+		}
+	}
+
+/**
+ * Destructor
+ */
+CTaskTimer::~CTaskTimer()
+	{
+	}
+
+/*
+ * @param aCompletion - Reference to a callback method in a CTaskControlBase parent object
+ * Two phase contruction
+ */
+CTaskTimer* CTaskTimer::NewL(MTaskTimerCompletion& aCompletion)
+	{
+	CTaskTimer* taskTimer = new(ELeave) CTaskTimer(aCompletion);
+	CleanupStack::PushL(taskTimer);
+	// We have to call the base class second phase constructor
+	taskTimer->ConstructL();
+	CleanupStack::Pop(taskTimer);
+	return taskTimer;
+	}
+
+/**
+ * @param aCommand - Command for the derived class
+ * @param aCompletion - Reference to the parent class callback method
+ * @param aScriptLineNumber - The script file line number of this command
+ * @param aLogger - Reference to a Flogger derived session
+ * Constructor - Just initialise the abstract class data
+ */
+CTaskControlBase::CTaskControlBase(const TDesC& aCommand, MTaskCompletion& aCompletion,TInt aScriptLineNumber, CTestExecuteLogger& aLogger) :
+	iCommandLine(aCommand),
+	iParent(aCompletion),
+	iScriptLineNumber(aScriptLineNumber),
+	iLogger(aLogger),
+	iTaskTimer(NULL)
+	{
+	}
+
+/**
+ * Destructor
+ */
+CTaskControlBase::~CTaskControlBase()
+	{
+	}
+
+/**
+ * @param aCommand - Command line for the program (Store in base class)
+ * @param aCompletion - Reference to the parent class callback method (Store in base class)
+ * @param aScriptLineNumber - The script file line number of this command (Store in base class)
+ * @param aLogger - Reference to a Flogger derived session (Store in base class)
+ * @param aWSProgRun - Boolean value used for identifying window server programs
+ */
+CProgramControl::CProgramControl(const TDesC& aCommand,MTaskCompletion& aCompletion,TInt aScriptLineNumber, CTestExecuteLogger& aLogger, TBool aWSProgRun) : CTaskControlBase(aCommand,aCompletion,aScriptLineNumber,aLogger),
+	iState(EInit)
+	{
+ 	// Extract the program arguments from the command line
+	GetProgramArgsFromCommand();
+
+	// Try to connect to the window server (if available)
+	iWSProgRun = aWSProgRun;
+  	#if !defined TEF_LITE
+	if( iWSProgRun )
+		{
+		iWs.Connect();
+		}
+  	#else
+  	// Always set to false if TEF_LITE is set
+  	//iWSProgRun = EFalse;
+  	#endif
+	}
+
+/**
+ * Destructor
+ */
+CProgramControl::~CProgramControl()
+	{
+	#if !defined TEF_LITE
+	if( iWSProgRun )
+		{
+		iWs.Close();
+		}
+	#endif
+	}
+
+/**
+ * Simple State machine.
+ * Kick()'d into by parent object.
+ * Runs an executable in its own process.
+ */
+void CProgramControl::RunL()
+	{
+	switch(iState)
+		{
+	case EInit	:
+		{
+		TRAPD(err,RunProgramL());
+		if(err != KErrNone)
+			{
+			// Special case where the executable has already completed
+			if( err == KErrCompletion )
+				{
+				// Reset the error code
+				err = KErrNone;
+				}
+			// Failed so complete immediately
+			iParent.TaskCompletion(err,iTaskExitCategory,iScriptLineNumber,iCommandLine,iTaskCanComplete);
+			delete this;
+			}
+		else
+			{
+			SetActive();
+			iState = ERunning;
+			// Only start the timer if the disable value is not set
+			if(iTaskTimeout != KDisableTimer)
+				{
+				iTaskTimer = CTaskTimer::NewL(*this);
+				iTaskTimer->Timeout(iTaskTimeout);
+				}
+			if (iProgRenamed == 1)
+ 				{
+  				iLogger.LogExtra((TText8*)__FILE__,__LINE__,ESevrInfo,
+  					_L(".EXE not found - .APP run instead"));
+  				}
+
+			}
+		}
+		break;
+
+	case ERunning :
+		{
+		if(iTaskTimer)
+			{
+			// The timer did not expire
+			iTaskTimer->Cancel();
+			delete iTaskTimer;
+			iTaskTimer = NULL;
+			}
+		// Set up the panic string if the program panicked
+		if( !iWSProgRun )
+			{
+			if(iProgram.ExitType() == EExitPanic)
+				{
+				iTaskExitCategory.Copy(KPanicEquals);
+				iTaskExitCategory.Append(iProgram.ExitCategory());
+				}
+			else if (iProgram.ExitType() == EExitPending)
+				{
+				iProgram.Kill(KErrAbort);
+				iLogger.LogExtra((TText8*)__FILE__,__LINE__,ESevrWarn,
+				  	_L("Program has been killed as the timeout is achieved."));
+				}
+			iProgram.Close();
+			}
+  		#if !defined TEF_LITE
+		else
+			{
+			if(iProgramWS.ExitType() == EExitPanic)
+				{
+				iTaskExitCategory.Copy(KPanicEquals);
+				iTaskExitCategory.Append(iProgramWS.ExitCategory());
+				}
+			
+			// Close the application
+			TInt prev = 0;
+			TInt winGid = iWs.FindWindowGroupIdentifier(prev, iProgramWS.Id());
+			TApaTask task(iWs);
+			task.SetWgId(winGid);
+			if( task.Exists() )
+				{
+				task.KillTask();
+				}
+			iProgramWS.Close();
+			}
+		#endif
+		
+		// Complete to the parent object.
+		iParent.TaskCompletion(iStatus.Int(),iTaskExitCategory,iScriptLineNumber,iCommandLine,iTaskCanComplete);
+		delete this;
+		}
+		break;
+
+	default:
+		break;
+		}
+	}
+
+/**
+ * Retrieve the program arguments from the script line.
+ */
+void CProgramControl::GetProgramArgsFromCommand()
+	{
+	TLex scriptLineLex(iCommandLine);
+	// Skip the RUN_PROGRAM command
+	scriptLineLex.NextToken();
+	TLex lex(scriptLineLex);
+	// Get the timer if it's been included
+	TLex timeoutLex(lex.NextToken());
+	TInt err = timeoutLex.Val(iTaskTimeout);
+	if(err)
+		// No timeout specified
+		iTaskTimeout = KDefaultTimeoutSeconds;
+	else
+		// Skip the timeout value
+		scriptLineLex.NextToken();
+	scriptLineLex.SkipSpace();
+	// Use the rest
+	iProgramArgs.Set(scriptLineLex.Remainder());
+	}
+
+/**
+ * Task timer expired
+ */
+void CProgramControl::TaskTimerCompletion()
+	{
+	delete iTaskTimer;
+	iTaskTimer = NULL;
+		if( !iWSProgRun )
+			{
+			iProgram.RendezvousCancel(iStatus);
+			}
+		#if !defined TEF_LITE
+		else
+			{
+			iProgramWS.RendezvousCancel(iStatus);
+			}
+		#endif
+		// We ORPHAN the process
+		// Our RunL() gets called immediately
+		// Kill requires KillAnyProcess capability
+		// ups the stakes as regards CAPABILITY
+	}
+
+/**
+ * Processes RUN_PROGRAM command arguments and starts the program
+ */
+void CProgramControl::RunProgramL()
+	{
+	TLex lex(iProgramArgs);
+	//	Get program name.	
+	lex.Mark();
+	lex.NextToken();
+#if   !defined TEF_LITE
+	// Set up the program arguments
+	TBuf<KMaxTestExecuteCommandLength> programArgs(lex.Remainder());
+	programArgs.Trim();
+	iProgramArgs.Set(programArgs);
+
+	if( !iWSProgRun )
+		{
+		// Create the Process
+		User::LeaveIfError(iProgram.Create(lex.MarkedToken(),iProgramArgs));
+		}
+	else
+		{
+ 		if( !IsWindowServerAvailable() )
+ 			{
+ 			User::Leave(KErrNotSupported);
+ 			}
+ 
+ 		// Launch the application using RApaLsSession
+		// This will only work if there is a window server available.
+		// It allows TechView apps to be launched
+		CApaCommandLine *cmd=CApaCommandLine::NewLC();
+		cmd->SetExecutableNameL(lex.MarkedToken());
+		
+		// Set the program arguments
+		cmd->SetDocumentNameL( iProgramArgs );
+		cmd->SetCommandL(EApaCommandRun);
+
+		User::LeaveIfError( iApaLsSess.Connect() );
+		// startup
+		TThreadId thread;
+		User::LeaveIfError( iApaLsSess.StartApp(*cmd, thread) );
+		TInt ret = iProgramWS.Open(thread);
+		if( ret != KErrNone )
+			{
+			if( ret == KErrNotFound )
+				{
+				// If the thread can not be found then it has already completed
+				// Leave with a relavent error
+				User::Leave(KErrCompletion);
+				}
+			User::Leave(ret);
+			}
+
+		//cleanup
+		iApaLsSess.Close();
+		CleanupStack::PopAndDestroy();
+		}
+#else
+/**
+ * Kick off an exe in its own pocess
+ * completes asynchronously
+ */
+	
+	if (iWSProgRun)  //TEF lite doesn't support RUN_WS_PROGRAM.
+		{
+		iLogger.LogExtra((TText8*)__FILE__,__LINE__,ESevrErr,
+				_L("Error Message :: TEF lite doesn't support RUN_WS_PROGRAM."));
+		User::Leave(EFail);
+		}
+	
+	// Set up the program arguments
+	TPtrC commandLine(lex.Remainder());
+	iProgramArgs.Set(commandLine);
+	// Create the Process
+	User::LeaveIfError(iProgram.Create(lex.MarkedToken(),iProgramArgs));
+
+#endif 
+	if( !iWSProgRun )
+		{
+		iProgram.Rendezvous(iStatus);
+		iProgram.Resume();
+		}
+	#if !defined TEF_LITE
+	else
+		{
+		iProgramWS.Rendezvous(iStatus);
+		}
+	#endif
+	}
+
+/**
+ * @param aServerName - Test server to connect to
+ * @param aSharedData - Flag for shared data mode session with test server
+ * Connect to the test server
+ * EKA2 version requires a just in time debug flag for the test server process
+ * This is read from the command line.
+ * Base class connect acts on this.
+ */
+TInt RScriptTestServ::Connect(const TDesC& aServerName,TBool aSharedData)
+	{
+	iSharedData = aSharedData;
+	// Parse the command line for -d
+	TBuf<KMaxTestExecuteCommandLength> commandLine;
+	if(User::CommandLineLength() > commandLine.MaxLength())
+		User::Leave(KErrTooBig);
+	User::CommandLine(commandLine);
+	TLex flagLex(commandLine);
+	// Default to false
+	TBool aJustInTime(EFalse);
+	while(!flagLex.Eos())
+		{
+		TPtrC token(flagLex.NextToken());
+		if(token == KTestExecuteCommandLineFlagDebugMode)
+			{
+			aJustInTime = ETrue;
+			break;
+			}
+		}
+	return RTestServ::Connect(aServerName,aJustInTime);
+	
+	}
+
+/**
+ * Copies the integer value read from ini file to the reference integer passed to the function
+ * @param aConfigData - Pointer to CIniData object used for reading data from ini file
+ * @param aConfigSection - Descriptor value describing the section name within an ini file for reading
+ * @param aSharedData - KeyName within a section where the input data is available in ini file
+ * @param aSharedDataNum - Reference integer variable for collecting the value at the keyname specified
+ * @Leave system wide errors
+ */
+void CScriptControl::FindValueL(CIniData* aConfigData, TPtrC aConfigSection, TPtrC aSharedData, TInt& aSharedDataNum)
+	{
+	aConfigData->FindVar(aConfigSection, aSharedData, aSharedDataNum);
+	if (aSharedDataNum == 0)
+		{
+		User::Leave(KErrGeneral);
+		}
+	}
+
+/**
+ * Copies the descriptor value read from ini file to the reference descriptor passed to the function
+ * @param aConfigData - Pointer to CIniData object used for reading data from ini file
+ * @param aConfigSection - Descriptor value describing the section name within an ini file for reading
+ * @param aSharedData - KeyName within a section where the input data is available in ini file
+ * @param aSharedDataName - Reference descriptor variable for collecting the value at the keyname specified
+ * @Leave system wide errors
+ */
+void CScriptControl::FindValueL(CIniData* aConfigData, TPtrC aConfigSection, TPtrC aSharedData, TPtrC& aSharedDataName)
+	{
+	User::LeaveIfError(aConfigData->FindVar(aConfigSection, aSharedData, aSharedDataName));
+	TPtrC blankString(KNull);
+	if (aSharedDataName.CompareF(blankString) == 0)
+		{
+		User::Leave(KErrGeneral);
+		}
+	}
+
+/**
+ * Creates one or more shared objects based on the inputs provided in ini file
+ * @Leave system wide errors
+ */
+void CScriptControl::CreateSharedObjectsFromScriptLineL()
+	{
+	CIniData* configData = NULL;
+	TInt err = 0;
+	TInt sharedDataCount = 0;
+	TPtrC sharedDataName;
+
+	// Sets the boolean to ETrue
+	// Avoids SHARED_DATA command being called more than once
+	iIsSharedData = ETrue;
+	
+	//It copies the current line from the script to TLex object
+	TLex shareLex(iCurrentScriptLine);
+
+	//reads the next word
+	shareLex.NextToken();
+
+	TPtrC configFile(shareLex.NextToken());
+
+	TPtrC configSection(shareLex.NextToken());
+
+	if(configFile.Length())
+		{
+		// Create instance of CIniData for reading ini input
+		TRAP(err,configData = CIniData::NewL(configFile));
+		}
+	if(err != KErrNone)
+		{
+		ERR_PRINTF1(KTEFErrorReadingIni);
+		User::Leave(err);
+		}
+	if(configData)
+		{
+		CleanupStack::PushL(configData);
+		TPtrC sharedDataNumberKey(KTEFSharedDataNum);
+		// Read the ini file for number of shared objects to be created
+		// Store the value into variable sharedDataCount
+		TRAP(err,FindValueL(configData,configSection,sharedDataNumberKey,sharedDataCount));
+		if (err != KErrNone)
+			{
+			ERR_PRINTF1(KTEFErrNumberOfShareNotInIni);
+			}
+		else
+			{
+			// If ini input is available for number of shared data
+			// Run a loop to read individual shared objects name
+			for (TInt i=1; i<=sharedDataCount; i++)
+				{
+				TBuf<20> keyName(KTEFSharedName);
+
+				keyName.AppendNum(i);
+
+				keyName.ZeroTerminate();
+
+				TPtrC sharedDataNameKey(keyName);
+
+				sharedDataName.Set(KNull);
+
+				// Read ini file for i th object name
+				TRAP(err,FindValueL(configData,configSection,sharedDataNameKey,sharedDataName));
+				if (err != KErrNone)
+					{
+					ERR_PRINTF2(KTEFErrShareNameNotInIni,i);
+					}
+				else
+					{
+					// Number of shared data is limited to the value set in the constant KTEFMaxSharedArraySize
+					// The constant is defined in ScriptEngine.h which can be extended from there
+					if (iSharedDataNum < KTEFMaxSharedArraySize)
+						{
+						// If ini input is available for i th object name
+						// Creating template class object for sharing the object
+						CTestSharedData* sharedObject = NULL;
+
+						CTEFSharedData<CTestSharedData>* sharedData1 = NULL;
+						TRAP(err,sharedData1 = CTEFSharedData<CTestSharedData>::NewL(sharedObject, KTEFSharedDataSize, sharedDataName));
+						if (err != KErrNone)
+							{
+							User::Leave(err);
+							}
+						else
+							{
+							sharedData1->EnterCriticalSection();
+							sharedObject->Construct();
+							sharedData1->ExitCriticalSection();
+							// Adding the template object to an array
+							iSharedDataArray[iSharedDataNum] = sharedData1;
+							// Counting the number of objects created
+							// destructor can destroy the objects based on this count
+							iSharedDataNum++;
+							}
+						}
+					else
+						{
+						WARN_PRINTF1(KTEFMaxNumberOfSharedObjectsReached);
+						}
+					}
+				}
+			}
+		// Cleanup CInidata object
+		CleanupStack::PopAndDestroy(configData);
+		}
+	}
+	
+/**
+ * Parses the test block header
+ * @Return ETrue if pass ok else EFalse
+ */
+// Fix defect 118337, check the configuration file exists or not, and set the flag.
+TBool CScriptControl::ParseTestBlockHeader()
+	{
+	TLex lex(iCurrentScriptLine);
+	TPtrC token = lex.NextToken();
+	TInt paraCount = 1;
+	const TInt KLeastBlockHeaderParaCount = 4;
+	_LIT(KLegacySysDrive, "C:");
+	_LIT(KDefaultIniFilePath, "\\System\\Data\\");
+	
+	while (!lex.Eos())
+		{
+		token.Set(lex.NextToken());
+		lex.SkipSpace();
+		++paraCount;
+		}
+	
+	if (paraCount < KLeastBlockHeaderParaCount)
+		{
+		_LIT(KBadError, "Bad error syntax!");
+		ERR_PRINTF1(KBadError);
+		return EFalse;
+		}
+
+	TFileName defaultIniFilePath(KLegacySysDrive);
+	defaultIniFilePath.Append(KDefaultIniFilePath);
+	
+	iFS.Connect();
+	TFindFile fileFind(iFS);
+	TInt ret = fileFind.FindByDir(token, defaultIniFilePath);
+	iFS.Close();
+	if (KErrNotFound == ret)
+		{
+		_LIT(KFileNotFound, "Configuration File %S Not Found!");
+		ERR_PRINTF2(KFileNotFound, &token);
+		return EFalse;
+		}
+	return ETrue;
+	}
+// End defect 118337
+
+/**
+ * Parses the test block and populates the iBlockArray
+ * @Leave system wide errors
+ */
+void CScriptControl::ParseTestBlockL( TTEFItemArray& aItemArray )
+	{
+	// Iterate through the commands contained within the test block
+	//  and append them to the itemArray.
+	TPtrC	startBlockScriptLine	= iCurrentScriptLine;
+	TInt	startBlockLineNumber 	= iCurrentScriptLineNumber;
+	
+	TBool parseResult = ParseTestBlockHeader();
+	
+	FOREVER
+		{
+		TTEFBlockItem	blockItem;
+		
+		// Read in the next script line
+		TBool	scriptLineRes = EFalse;
+		if( !iStartLooping )
+			{
+			scriptLineRes = GetNextScriptLine(iCurrentScriptLine);
+			}
+		else
+			{
+			scriptLineRes = GetLoopScriptLine(iCurrentScriptLine);
+			}
+		
+		if( !scriptLineRes )
+			{
+			_LIT( KTEFEoF, "Unexpectedly hit the end of the file" );
+			ERR_PRINTF1( KTEFEoF );
+			TExitCategoryName  blankPanicString;
+			LogResult(EFail, blankPanicString, startBlockLineNumber, startBlockScriptLine);
+			User::Leave( KErrEof );
+			}
+
+		// Strip off any trailling comment
+		TInt offset = iCurrentScriptLine.Find(KTEFComment);
+		if( offset != KErrNotFound )
+			{
+			iCurrentScriptLine.Set( iCurrentScriptLine.Mid(0, offset) );
+			}
+
+		TLex lex(iCurrentScriptLine);
+		TPtrC token(lex.NextToken());
+		
+		// Populate the blockItem with the data required for each command
+		
+		// CREATE_OBJECT <object type> <object name section>
+		if(	0 == token.CompareF(KTEFCreateObject) )
+			{
+			blockItem.iItemType		= ETEFCreateObject;
+			blockItem.iObjectType	= lex.NextToken().Left(KTEFMaxNameLength);
+			blockItem.iSection		= lex.NextToken().Left(KTEFMaxNameLength);
+			}
+		// RESTORE_OBJECT <object type> <object name section>
+		else if( 0 == token.CompareF(KTEFRestoreObject) )
+			{
+			blockItem.iItemType		= ETEFRestoreObject;
+			blockItem.iObjectType	= lex.NextToken().Left(KTEFMaxNameLength);
+			blockItem.iSection		= lex.NextToken().Left(KTEFMaxNameLength);
+			}
+		// COMMAND [Error TEFParameter] <object name section> <function name> [section]
+		else if( 0 == token.CompareF(KTEFCommand) )
+			{
+			blockItem.iItemType = ETEFCommand;
+			TPtrC param = lex.NextToken().Left(KTEFMaxNameLength);
+			
+			if( param.Length() > 0 )
+				{
+				while( param[0] == KTEFAsciiExclamation )
+					{
+					// This is a TEF Error Parameter
+					// Extract the type of TEF parameter being read in
+					if( param.Length() >= KTEFError().Length() &&
+						0 == param.Mid(0,KTEFError().Length()).CompareF(KTEFError) )
+						{
+						TInt	start = KTEFError().Length();
+						TInt	length = param.Length()-start;
+						TLex	errorCodeLex( param.Mid(start,
+														length ));
+						
+						TInt errorCode = 0;
+						if( errorCodeLex.Val(errorCode) == KErrNone )
+							{
+							blockItem.iExpectedError = errorCode;
+							}
+						else
+							{
+							_LIT(KBadError,"Bad error syntax.");
+							ERR_PRINTF1(KBadError);	
+							blockItem.iError = KErrNotSupported;
+							}
+						}
+					else if( param.Length() >= KTEFAsyncError().Length() &&
+							 0 == param.Mid(0,KTEFAsyncError().Length()).CompareF(KTEFAsyncError))
+						{
+						TInt	start = KTEFAsyncError().Length();
+						TInt	length = param.Length()-start;
+						TLex	errorCodeLex( param.Mid(start,
+														length ));
+						
+						TInt errorCode = 0;
+						if( errorCodeLex.Val(errorCode) == KErrNone )
+							{
+							blockItem.iExpectedAsyncError = errorCode;
+							}
+						else
+							{
+							_LIT(KBadError,"Bad error syntax.");
+							ERR_PRINTF1(KBadError);
+							blockItem.iAsyncError = KErrNotSupported;					
+							}
+						}
+					else
+						{
+						// Unknown TEFParameter
+						_LIT(KUnknownTEFParam,"Unknown Test Block TEFParameter.");
+						ERR_PRINTF1(KUnknownTEFParam);
+						TExitCategoryName  blankPanicString;
+						LogResult(EFail, blankPanicString, startBlockLineNumber, startBlockScriptLine);
+						User::Leave(KErrNotSupported);
+						}
+
+					// Read the next token
+					param.Set( lex.NextToken().Left(KTEFMaxNameLength) );
+					}
+				}
+				
+			// Read in the object section name, function name and optional data section
+			blockItem.iCommand.iObject		= param;
+			blockItem.iCommand.iFunction	= lex.NextToken().Left(KTEFMaxNameLength);
+			blockItem.iSection				= lex.NextToken().Left(KTEFMaxNameLength);
+			}
+		// STORE <section>
+		else if( 0 == token.CompareF(KTEFStore) )
+			{
+			blockItem.iItemType		= ETEFStore;
+			blockItem.iSection		= lex.NextToken().Left(KTEFMaxNameLength);
+			}
+		// OUTSTANDING <poll interval in ms>
+		else if( 0 == token.CompareF(KTEFOutstanding) )
+			{
+			blockItem.iItemType		= ETEFOutstanding;
+			TLex	pollLex( lex.NextToken().Left(KTEFMaxNameLength) );
+			TInt	poll = 0;
+			blockItem.iTime			= (KErrNone==pollLex.Val(poll)?poll:0);
+			blockItem.iSection		= lex.NextToken().Left(KTEFMaxNameLength);		
+			}
+		// DELAY <time in ms>
+		else if( 0 == token.CompareF(KTEFDelay) )
+			{
+			blockItem.iItemType		= ETEFDelay;
+			TLex	delayLex( lex.NextToken().Left(KTEFMaxNameLength) );
+			TInt	delay = 0;
+			blockItem.iTime = (KErrNone==delayLex.Val(delay)?delay:0);		
+			}
+		// ASYNC_DELAY <time in ms>
+		else if( 0 == token.CompareF(KTEFAsyncDelay) )
+			{
+			blockItem.iItemType		= ETEFAsyncDelay;
+			TLex	delayLex( lex.NextToken().Left(KTEFMaxNameLength) );
+			TInt	delay = 0;
+			blockItem.iTime = (KErrNone==delayLex.Val(delay)?delay:0);
+			}
+		// SHARED_ACTIVE_SCHEDULER
+		else if( 0 == token.CompareF(KTEFSharedActiveScheduler) )
+			{
+			blockItem.iItemType		= ETEFSharedActiveScheduler;			
+			}
+		// STORE_ACTIVE_SCHEDULER
+		else if( 0 == token.CompareF(KTEFStoreActiveScheduler) )
+			{
+			blockItem.iItemType		= ETEFStoreActiveScheduler;			
+			}
+		// END_TEST_BLOCK [Scheduler Cleanup]
+		else if( 0 == token.CompareF(KTEFEndTestBlock) )
+			{
+			TExitCategoryName  blankPanicString;
+			if( 0 == aItemArray.Count() )
+				{
+				_LIT( KTEFEmptyBlock, "The Test Block is empty." );
+				ERR_PRINTF1( KTEFEmptyBlock );
+				LogResult(EFail, blankPanicString, startBlockLineNumber, startBlockScriptLine);
+				User::Leave(KErrNotFound);
+				}
+			else
+				{
+				// Hit the end of the test block and the package is ready
+				// Fix defect 118337, check parse result, and print corresponding message.
+				LogResult(parseResult?EPass:EFail, blankPanicString, startBlockLineNumber, startBlockScriptLine);
+				//End defect 118337
+				break;
+				}
+			}
+		else if( 0 == token.CompareF(KTEFStartTestBlock) )
+			{
+			// Error - there was no end test block command
+			_LIT(KMissingEnd,"Missing END_TEST_BLOCK command.");
+			ERR_PRINTF1(KMissingEnd);
+			TExitCategoryName  blankPanicString;
+			LogResult(EFail, blankPanicString, startBlockLineNumber, startBlockScriptLine);
+			User::Leave(KErrNotFound);
+			}
+		else
+			{
+			if( token.Length() > 0 )
+				{
+				if( 0 != token.Left(2).Compare(KTEFComment) )
+					{
+					// The SART_TEST_BLOCK command failed
+					_LIT(KUnknownCmd,"Unknown Test Block command.");
+					ERR_PRINTF1(KUnknownCmd);
+					TExitCategoryName  blankPanicString;
+					LogResult(EFail, blankPanicString, startBlockLineNumber, startBlockScriptLine);
+		
+					// Special case for END_TESTCASE commands
+					//  If one has been hit here because an END_TEST_BLOCK command was missing
+					//  the we must log its completion.
+					if( token.CompareF(KTEFEndTestCaseCommand) == 0 || token.CompareF(KTEFEndSyncTestCaseCommand) == 0 )
+						{
+						LogTestCaseMarkerL();
+						}
+					User::Leave(KErrNotSupported);
+					}
+				}
+			}
+			
+		// Append the blockItem to the package
+		if( ETEFNull != blockItem.iItemType )
+			{
+			aItemArray.AppendL( blockItem );
+			}
+		}
+	}
+
+
+_LIT( KTEFSyncStatus, "TEFStatus" );
+_LIT( KTEFSyncResult, "TEFResult" );
+const TInt KDelay		= 3000000;
+const TInt KRetryCount	= 10;
+
+enum TSyncStatus
+	{
+	ETEFSyncUnknown		= 0,
+	ETEFSyncRunning		= 1,
+	ETEFSyncComplete	= 2,
+	ETEFSyncWaiting		= 3,
+	ETEFSyncContinue	= 4,
+	ETEFRetrieveResult	= 5
+	};
+
+/**
+ * Constructor
+ */
+CSyncControl::CSyncControl()
+	: iSharedTEFStatus(NULL), iSharedTEFResult(NULL)
+	{
+	}
+/**
+ * Destructor
+ */
+CSyncControl::~CSyncControl()
+	{
+	if( iSharedTEFResult && iSharedTEFStatus )
+		{
+		// Don't cleanup until the status is correct
+		// This will allow time for any retrieve result calls to get through before TEF exits
+		// Will retry for 30 seconds
+		CTestSharedData* tefStatus = iSharedTEFStatus->Ptr();
+		if( tefStatus != NULL )
+			{
+			TInt64 status = ETEFRetrieveResult;
+			TInt count = 0;
+			while( status == ETEFRetrieveResult && count < KRetryCount )
+				{
+				iSharedTEFStatus->EnterCriticalSection();
+				HBufC* statusBuffer = NULL;
+				TRAPD( err, statusBuffer = HBufC::NewL(tefStatus->TextLength()) );
+				if( err == KErrNone )
+					{
+					TPtr statusPtr( statusBuffer->Des() );
+					tefStatus->GetText( statusPtr );
+					TLex lex(statusPtr);
+					lex.Val(status);
+					delete statusBuffer;
+					}
+				iSharedTEFStatus->ExitCriticalSection();
+
+				// Don't deley for the first i
+				if( count > 0 )
+					{
+					User::After( KDelay );
+					}
+				count++;
+				}
+			}
+		delete iSharedTEFResult;
+		delete iSharedTEFStatus;		
+		}
+	}
+
+/**
+ * Two phase construction
+ */	
+CSyncControl* CSyncControl::NewL()
+	{
+	CSyncControl* self = CSyncControl::NewLC();
+	CleanupStack::Pop();
+	return self;
+	}
+
+/**
+ * Two phase construction
+ */	
+CSyncControl* CSyncControl::NewLC()
+	{
+	CSyncControl* self = new (ELeave) CSyncControl();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+/**
+ * ConstructL
+ */	
+void CSyncControl::ConstructL()
+	{
+	// Initialise the sync status shared data
+	CTestSharedData* tefStatus = NULL;
+	iSharedTEFStatus = CTEFSharedData<CTestSharedData>::NewL(	tefStatus,
+																KMaxSharedDataLength,
+																KTEFSyncStatus );
+	iSharedTEFStatus->EnterCriticalSection();
+	tefStatus->Construct();
+	HBufC* statusBuffer = NULL;
+	TRAPD( err, statusBuffer = HBufC::NewL(sizeof(TInt64)) );
+	if( err != KErrNone )
+		{
+		iSharedTEFStatus->ExitCriticalSection();
+		User::Leave( err );
+		}
+	TPtr statusPtr( statusBuffer->Des() );
+	statusPtr.Num( ETEFSyncWaiting );
+	tefStatus->SetText( statusPtr );
+	delete statusBuffer;
+	iSharedTEFStatus->ExitCriticalSection();
+
+	// Initialise the sync result shared data
+	CTestSharedData* tefResult = NULL;
+	iSharedTEFResult = CTEFSharedData<CTestSharedData>::NewL(	tefResult,
+																KMaxSharedDataLength,
+																KTEFSyncResult );
+	iSharedTEFResult->EnterCriticalSection();
+	tefResult->Construct();
+	HBufC* resBuffer = NULL;
+	TRAP( err, resBuffer = HBufC::NewL(sizeof(TInt64)) );
+	if( err != KErrNone )
+		{
+		iSharedTEFResult->ExitCriticalSection();
+		User::Leave( err );
+		}
+	TPtr resPtr( resBuffer->Des() );
+	resPtr.Num( EInconclusive );
+	tefResult->SetText( resPtr );
+	delete resBuffer;
+	iSharedTEFResult->ExitCriticalSection();
+	}
+
+/**
+ * @param aError - Error value resulting from synchronised testcase for logging
+ * Sets the result obtained from synchronised testcase for logging
+ */
+void CSyncControl::SetResultL( TVerdict aError )
+	{
+	// Retrieve the status and result shared data pointers
+	CTestSharedData* tefResult = iSharedTEFResult->Ptr();
+	CTestSharedData* tefStatus = iSharedTEFStatus->Ptr();
+
+	if( tefResult != NULL && tefStatus != NULL )
+		{
+		// Update the shared sync test case result code
+		iSharedTEFResult->EnterCriticalSection();
+		HBufC* resBuffer = NULL;
+		TRAPD( err, resBuffer = HBufC::NewL(sizeof(TInt64)) );
+		if( err != KErrNone )
+			{
+			iSharedTEFResult->ExitCriticalSection();
+			User::Leave( err );
+			}
+		TPtr resPtr( resBuffer->Des() );
+		resPtr.Num( (TInt64)aError );
+		tefResult->SetText( resPtr );
+		delete resBuffer;
+		
+		iSharedTEFResult->ExitCriticalSection();
+		
+		// So now the test has complete and the result has been updated
+		//  we need to update the status to reflect this
+		iSharedTEFStatus->EnterCriticalSection();
+		HBufC* statusBuffer = NULL;
+		TRAP( err, statusBuffer = HBufC::NewL(sizeof(TInt64)) );
+		if( err != KErrNone )
+			{
+			iSharedTEFStatus->ExitCriticalSection();
+			User::Leave( err );
+			}
+		TPtr statusPtr( statusBuffer->Des() );
+		statusPtr.Num( ETEFRetrieveResult );
+		tefStatus->SetText( statusPtr );
+		delete statusBuffer;
+		
+		iSharedTEFStatus->ExitCriticalSection();
+		}
+	else
+		{
+		User::Leave( KErrNotFound );
+		}
+	}
+
+/**
+ * Identifies state of synchronised testcases and continues with the test or completes the tests
+ */
+TBool CSyncControl::TestCaseContinueL()
+	{
+	TBool tefContinue = EFalse;
+	
+	// Retrieve the status and result shared data pointers
+	CTestSharedData* tefStatus = iSharedTEFStatus->Ptr();
+	CTestSharedData* tefResult = iSharedTEFResult->Ptr();
+
+	if( tefStatus != NULL && tefResult != NULL )
+		{
+		iSharedTEFStatus->EnterCriticalSection();
+
+		// Retrieve the current status
+		HBufC* statusBuffer = NULL;
+		TRAPD( err, statusBuffer = HBufC::NewL(tefStatus->TextLength()) );
+		if( err != KErrNone )
+			{
+			iSharedTEFStatus->ExitCriticalSection();
+			User::Leave( err );
+			}
+
+		TPtr statusPtr( statusBuffer->Des() );
+		tefStatus->GetText( statusPtr );
+		TLex lex(statusPtr);
+		TInt64	status = ETEFSyncUnknown;
+		User::LeaveIfError( lex.Val(status) );
+
+		if( status == ETEFSyncContinue )
+			{
+			tefContinue = ETrue;
+			// Update the status to running
+			HBufC* buffer = NULL;
+			TRAP( err, buffer = HBufC::NewL(sizeof(TInt64)) );
+			if( err != KErrNone )
+				{
+				delete statusBuffer;
+				iSharedTEFStatus->ExitCriticalSection();
+				User::Leave( err );
+				}
+
+			TPtr ptr( buffer->Des() );
+			ptr.Num( ETEFSyncRunning );
+			tefStatus->SetText( ptr );
+			delete buffer;
+			}
+		else if( status == ETEFSyncComplete )
+			{
+			// Previous test has completed and a new sync block has been hit
+			// Update the status to waiting
+			HBufC* buffer = NULL;
+			TRAP( err, buffer = HBufC::NewL(sizeof(TInt64)) );
+			if( err != KErrNone )
+				{
+				delete statusBuffer;
+				iSharedTEFStatus->ExitCriticalSection();
+				User::Leave( err );
+				}
+
+			TPtr ptr( buffer->Des() );
+			ptr.Num( ETEFSyncWaiting );
+			tefStatus->SetText( ptr );
+			delete buffer;
+			}
+		delete statusBuffer;
+		iSharedTEFStatus->ExitCriticalSection();
+		}
+	else
+		{
+		User::Leave( KErrNotFound );
+		}
+	return tefContinue;
+	}
+
+/**
+ * Takes in a script line updates any relative file paths into corresponding absolute path based on the current script file path
+ * @param aScriptLineString - Pointer descriptor containing a particular script line for updation
+ */
+void CScriptControl::MakeAbsoluteFilePathsL(TPtrC16& aScriptLineString)
+	{
+	TLex lex(aScriptLineString);
+	iAlteredScriptLine.Zero(); // Initialise the altered script line to zero b4 we start processing
+	TBuf<KMaxTestExecuteCommandLength> commandName; // To store the command name, basically first token of each script line
+	TBuf<KMaxTestExecuteCommandLength> commandString; // To store individual tokens of script line for processing
+	TBuf<KMaxTestExecuteCommandLength> prevCommandString;
+	const TInt KTEFMinFileExtnSizeIni = 4;
+	const TInt KTEFMinFileExtnSizeScript = 7;
+
+	while(!lex.Eos()) // start a loop for each token until end of the script line
+		{
+		lex.NextToken();
+		lex.SkipSpace();
+		if (lex.MarkedToken().Length() > KMaxTestExecuteCommandLength)
+			{
+			User::Leave(KErrTooBig);
+			}
+
+		commandString.Copy(lex.MarkedToken());
+		lex.Mark();
+
+		if (commandName.CompareF(KTEFRunScriptCommand) == 0 &&
+			commandString.CompareF(KTEFNull) != 0)
+			{
+			// if the command name is RUN_SCRIPT, then check the parameter is not not null and has valid .script extn
+			// We append .script extn if the length of the token is less than 7 (.script -> Length)
+			// Or when the token does not end with .script enxtn
+			if(commandString.Length() < KTEFMinFileExtnSizeScript ||
+				commandString.Right(KTEFMinFileExtnSizeScript).CompareF(KTEFScriptExtension) != 0)
+				{
+				commandString.Append(KTEFScriptExtension);
+				}
+			}
+
+		// Expand recognised variables into their values
+		// At the moment just ${SYSDRIVE} -> GetSystemDrive()
+		ExpandVariables(commandString);
+
+		// we consider eligible path if the token is an argument for RUN_SCRIPT
+		// or any INI file or an argument for RUN_UTILS command
+		// Check to see if the token contains a ":" as second character represeting a drive letter
+		if (commandString.Length() >= KTEFMinFileExtnSizeIni &&
+			commandString.Mid(1,1).CompareF(KTEFColon) != 0)
+			{
+			// if the ":" is not found, we process converting relative -> absolute path
+			// Provided the token ends with .script or .ini extns
+		    if ((commandString.Length() >= KTEFMinFileExtnSizeScript && 
+				commandString.Right(KTEFMinFileExtnSizeScript).CompareF(KTEFScriptExtension) == 0) ||
+				(commandString.Length() >= KTEFMinFileExtnSizeIni && 
+				commandString.Right(KTEFMinFileExtnSizeIni).CompareF(KTEFIniExtension) == 0))
+				{
+				// token does not does not have a ':' but is a eligible path,
+				// so, convert relative path to absolute path
+				TRAPD(err, ConvertRelativeToAbsoluteL(commandString));
+				if(err != KErrNone)
+					{
+					// Leave here since we have got an invalid path
+					User::Leave(err);
+					}				
+				}
+			else if(commandName.CompareF(KTEFRunUtilsCommand) == 0 &&
+					(prevCommandString.CompareF(KTEFRunUtilsCopyFile) == 0 ||
+					prevCommandString.CompareF(KTEFRunUtilsMkDir) == 0 ||
+					prevCommandString.CompareF(KTEFRunUtilsDeleteFile) == 0 ||
+					prevCommandString.CompareF(KTEFRunUtilsDelete) == 0 ||
+					prevCommandString.CompareF(KTEFRunUtilsMakeReadWrite) == 0 ||
+					prevCommandString.CompareF(KTEFDeleteDirectory) == 0))
+				{
+				// token does not does not have a ':' but is a eligible path,
+				// so, convert relative path to absolute path
+				TRAPD(err, ConvertRelativeToAbsoluteL(commandString));
+				if(err != KErrNone)
+					{
+					// Leave here since we have got an invalid path
+					User::Leave(err);
+					}
+				}
+			}
+		//start defect 120600 
+		//remove the code which append an extra space.
+		// if (iAlteredScriptLine.Length())
+		//end defect 120600
+		if (iAlteredScriptLine.Length() == 0)
+			{
+			// While completng the processing for the first token in the script line,
+			// we record the token as command name, so that we can use it to identify
+			// eligible paths in the following loop cycles for the script line
+			commandName.Copy(commandString);
+			}
+		prevCommandString.Copy(commandString);
+		// Construct the altered script line with individual verified tokens of script line
+		if(iAlteredScriptLine.Length() + commandString.Length() <= iAlteredScriptLine.MaxLength() )
+			{
+			iAlteredScriptLine.Append(commandString);			
+			}
+		else// this scipte too long buffer not long enought
+			{			
+			User::Leave(KErrTooBig);
+			}
+		}
+	// At the end of the while loop, we are ready with new processed script line
+	// which we shall update it with the original reference taken in
+	aScriptLineString.Set(iAlteredScriptLine);
+	}
+
+/**
+ * Takes in lex token and updates any relative file paths into corresponding absolute path based on the current script file path
+ * @param aCommandString - Pointer descriptor containing a particular token within a script line for updation
+ */
+void CScriptControl::ConvertRelativeToAbsoluteL(TDes& aCommandString)
+	{
+	TInt offset = 0;
+	TInt posOfLastSlash=iScriptFile.LocateReverse('\\') ;
+	TBuf<KMaxTestExecuteCommandLength> tempStore(iScriptFile.Mid(0,posOfLastSlash)); // Initial script file path
+
+	if(aCommandString.FindC(KTEFOneUp) >= 0)
+		{
+		while(aCommandString.FindC(KTEFOneUp) >= 0)
+			{
+			offset = aCommandString.FindC(KTEFOneUp);
+			posOfLastSlash=tempStore.LocateReverse('\\') ;
+			if (posOfLastSlash <= 0)
+				{
+				User::Leave(KTEFErrInvalidRelPath);
+				}
+			tempStore.Copy(iScriptFile.Mid(0,posOfLastSlash));// script file path
+			aCommandString.Copy(aCommandString.Mid(offset + 3)); // 3 for ..'\\'
+			}
+
+		tempStore.Append('\\');
+		}
+	else if (aCommandString.FindC(KTEFDotSlash) >= 0)
+		{
+		offset = aCommandString.FindC(KTEFDotSlash);
+		aCommandString.Copy(aCommandString.Mid(offset + 1));
+		}
+	else if(aCommandString.Locate('\\') == 0)
+		{
+		tempStore.Copy(iScriptFile.Mid(0,2)); // Example: c:
+		}
+	else
+		{
+		tempStore.Append('\\');
+		}
+
+	tempStore.Append(aCommandString);
+	aCommandString.Copy(tempStore);
+	}
+
+/**
+ * Expand recognised variables in script file into their corresponding value
+ * Currently supported variable is ${SYSDRIVE} -> GetSystemDrive() / Drive letter set from testexecute.ini
+ * @param aCommandString - Descriptor containing a particular token within a script line for updation
+ */
+void CScriptControl::ExpandVariables(TDes& aCommandString)
+	{
+	TInt offset = 0;
+	if (aCommandString.FindC(KTEFSysDrive) >= 0)
+		{
+		// If we find ${SYSDRIVE} in the token, replace it with the drive letter to be substitued
+		offset = aCommandString.FindC(KTEFSysDrive);
+		aCommandString.Replace(offset, 11, iTestSysDrive);
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/src/teftestmodule.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1613 @@
+/*
+* Copyright (c) 2005-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:  
+*
+*/
+
+// INCLUDE FILES
+// For TEF
+#include "scriptengine.h"
+#include <test/testexecuteclient.h>
+#include <test/testexecutelogger.h>
+#include "testwatcher.h"
+#include "version.h"
+#include "tefutils.h"
+#include <f32file.h>
+#include <test/wrapperutilsplugin.h>
+// For STIF
+#include <StifTestInterface.h>
+#include "teftestmodule.h"
+#include "SettingServerClient.h"
+#include "logging.h"
+
+GLDEF_D TInt CScriptControl::commentedCommandsCount;
+GLDEF_D TInt CScriptControl::iRunScriptFailCount;
+
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::CTEFTestModule
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTEFTestModule::CTEFTestModule()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::ConstructL
+// Symbian 2nd phase constructor can leave.
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+    iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle;
+
+    iStdLog = CStifLogger::NewL( KTEFTestModuleLogPath, 
+                          KTEFTestModuleLogFile);
+    iLog = iStdLog;
+    
+    iVersionLogged = EFalse;
+    
+    iCfg_tcs = EOFF;
+    iCfg_Debug = EFalse;
+    iCfg_SeparateLog = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTEFTestModule* CTEFTestModule::NewL()
+    {
+    CTEFTestModule* self = new (ELeave) CTEFTestModule;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CTEFTestModule::~CTEFTestModule()
+    { 
+    iLog = NULL;
+    delete iStdLog;
+    iStdLog = NULL;
+    delete iTCLog;
+    iTCLog = NULL;
+    iArray_ScriptFilePaths.Close();
+    iArray_Cfg_TcsData.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CTEFTestModule::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::CreateTitleLoggerL
+// Check for settings and create logger with test case title in file name.
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::CreateTitleLoggerL(void)
+    {
+    //Open new log file with test case title in file name
+    if(iAddTestCaseTitleToLogName)
+        {
+        // Check if there is no test case logger already created.
+        if(iTCLog) 
+            { 
+            delete iTCLog; 
+            iTCLog = NULL; 
+            } 
+            
+        TFileName logFileName;
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        
+        logFileName.Format(KTEFTestModuleLogFileWithTitle, &title);
+
+        iTCLog = CStifLogger::NewL(KTEFTestModuleLogPath, 
+                                 logFileName);
+        iLog = iTCLog; 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::CreateStdLoggerL
+// Check for logger settings and create standard logger.
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::DeleteTitleLogger(void)
+    {
+    //Delete title logger
+    if(iAddTestCaseTitleToLogName)
+        {
+        iLog = iStdLog;
+        delete iTCLog;
+        iTCLog = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CTEFTestModule::GetTestCasesL( 
+    const TFileName& aConfig, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+    iLog->Log(_L("GetTestCasesL"));
+    TInt ret = KErrNone;
+    
+    TRAPD(err, ret = ParseTEFTestCfgFileL(aConfig, aTestCases));
+    if(err != KErrNone)
+    	{
+    	//ret = KErrNotFound;
+    	_LIT(KErrLog, "Error in given test configuration file %S. Error = %d.");
+    	iLog->Log(CStifLogger::ERed, KErrLog, &aConfig, ret);
+    	}
+    
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CTEFTestModule::RunTestCaseL(
+    const TInt aCaseNumber,
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+    iLog->Log(_L("RunTestCaseL"));
+    SendTestModuleVersion();
+
+    CreateTitleLoggerL();
+    //Test case implementation or function call here
+    TRAPD(err, TEFInitialize() );
+    __ASSERT_ALWAYS(!err, User::Panic(KTestExecuteName,err));
+
+#if (defined __DATA_CAGING__)
+	// Platform security hooks    
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+    
+	CActiveScheduler* sched = new (ELeave) CActiveScheduler();
+	CleanupStack::PushL(sched);
+	CActiveScheduler::Install(sched);
+
+    if(!sched)
+    {
+    __RDEBUG( (_L("Error: TEFTestModule.dll, Error in getting current active scheduler.") ) );
+	iLog->Log(CStifLogger::ERed, _L("Error: TEFTestModule.dll, Error in getting current active scheduler."));
+    User::Panic(_L("TEFTestModule"), -2);
+    }
+	
+	TInt scriptCount = iArray_ScriptFilePaths.Count();
+	TInt tcsDataCount = iArray_Cfg_TcsData.Count();
+
+	if(aCaseNumber > scriptCount)
+		{
+		__RDEBUG( (_L("Error: Case number to run is bigger than expected.") ) );
+		iLog->Log(CStifLogger::ERed, _L("Error: Case number to run is bigger than expected."));
+		// Cleanup the scheduler object
+		CleanupStack::PopAndDestroy(sched);
+		DeleteTitleLogger();
+		User::Leave(KErrNotFound);
+		}
+	    
+	TRAPD(errRun, RunScriptL(	sched,
+								*(iArray_ScriptFilePaths[aCaseNumber-1]), 
+								*(iArray_Cfg_TcsData[aCaseNumber-1])
+							) );
+	if (errRun != KErrNone)
+		{
+		__RDEBUG( (_L("Run script leave. code=%d"),errRun) );
+		iLog->Log(CStifLogger::ERed, _L("Run script leave. code=%d"),errRun);
+		}
+  
+	// Cleanup the scheduler object
+	CleanupStack::PopAndDestroy(sched);
+
+    aResult.SetResult( errRun, *(iArray_ScriptFilePaths[aCaseNumber-1]) );     
+    
+    // Test case was executed
+    DeleteTitleLogger();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+TBool CTEFTestModule::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& /* aFirstMemFailure */, 
+                                TInt& /* aLastMemFailure */ ) 
+    {
+    _LIT( KOOMTestQueryL, "CTEFTestModule::OOMTestQueryL" );
+    iLog->Log( KOOMTestQueryL ); 
+
+    return EFalse;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//                  
+void CTEFTestModule::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+//-----------------------------------------------------------------------------
+// CTemplateScriptTEFTestModule::SendTestModuleVersion
+// Method used to send version of test module
+//-----------------------------------------------------------------------------
+//
+void CTEFTestModule::SendTestModuleVersion()
+	{
+	if(iVersionLogged)
+		{
+		return;
+		}
+	
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("TEFTestModule.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	iVersionLogged = ETrue;
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CTEFTestModule::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, 
+                                TUint32& aParameterValid )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    //We're quite heavy on the stack...
+    // Stack size
+    param->iTestThreadStackSize= 28672; // 28K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1260480;// 1.2M heap max
+    
+    TInt stackSizeFromUser = -1;
+    TInt parseErr = KErrNone;
+    TRAPD( err, parseErr = CTEFTestModule::ParseStackSizeL(stackSizeFromUser));
+    if(err != KErrNone)
+    	{
+    	__RDEBUG( (_L("Error: Leaves when get StackSize from TestFramework.ini") ) );
+    	}
+    if(parseErr != KErrNone)
+    	{
+    	__RDEBUG( (_L("Error: Error when get StackSize from TestFramework.ini, err= %d"), parseErr) );
+    	}
+
+    if(stackSizeFromUser > 0)
+    	{
+    	param->iTestThreadStackSize = stackSizeFromUser; // user configed stack size
+    	}
+    aTestModuleParam = param;
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::TEFInitialize
+// InitializeModule is used to do some preparations.
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::TEFInitialize(void)
+	{
+	// Check to see if the plugin wrapper around the GetSystemDrive is loadable
+	// If yes, then instantiate the wrapper object and obtain the default system drive
+	// Else, use the hardcoded default drive as c:
+	iDefaultSysDrive = KTEFLegacySysDrive;	
+	
+	RLibrary pluginLibrary;
+	CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary);
+	
+	if (plugin!=NULL)
+		{
+		TDriveUnit driveUnit(plugin->GetSystemDrive());
+		iDefaultSysDrive.Copy(driveUnit.Name());
+		delete plugin;
+		pluginLibrary.Close();
+		}
+	
+	TBool enableSysStart = ETrue;
+	CTestExecuteIniData* iniData = NULL;
+	TRAPD(err, iniData = CTestExecuteIniData::NewL(iDefaultSysDrive));
+	if (err == KErrNone)
+		{
+		// Extract all the key values within the object
+		iniData->ExtractValuesFromIni();
+		iniData->GetKeyValueFromIni(KTEFSystemStarter, enableSysStart);
+		}
+
+	err = KErrNone;
+	
+	#if !(defined TEF_LITE)
+	if (enableSysStart)
+		{
+		TRAP(err, StartSystemL());
+		if (KErrNone != err)
+			{
+			__RDEBUG( (_L("Wait for system starter failed, error code=%d"),err) );
+			iLog->Log(CStifLogger::ERed, _L("Wait for system starter failed, error code=%d"),err);
+			User::After(5000000);
+			}
+		}
+	#endif
+	
+	if (iniData != NULL)
+		{
+		delete iniData;
+		}	
+	
+	}
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::ParseTEFTestCfgFileL
+// ParseTEFTestCfgFileL is used to parse configuration file
+// to get config information and script list.
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+TInt CTEFTestModule::ParseTEFTestCfgFileL( const TFileName& aConfigFile, 
+		    								RPointerArray<TTestCaseInfo>& aTestCases)
+	{
+	iLog->Log(_L("Start parsing TEFTestModule configuration."));
+	
+    if( aConfigFile.Length() == 0 )
+        {
+        iLog->Log(CStifLogger::ERed, _L("Error: No test configuration file given") ) ;
+        __RDEBUG( (_L("Error: No test configuration file given") ) );
+        return KErrNotFound;
+        }
+
+    CStifParser* parser = NULL; 
+    
+    // Open .cfg file
+    TRAPD( err, 
+        parser = CStifParser::NewL( _L(""), 
+                                    aConfigFile, 
+                                    CStifParser::ECStyleComments ) );
+    if( err != KErrNone )
+        {
+        __RDEBUG( (_L("Error: Given test configuration file [%S] not found"),
+            &aConfigFile ) );
+        iLog->Log(CStifLogger::ERed, _L("Error: Given test configuration file [%S] not found. Error=%d."),
+        	&aConfigFile,err);
+        return err;
+        }
+    
+    CleanupStack::PushL( parser );
+    CStifSectionParser* section = NULL;
+    TPtrC tmp;
+    TInt ret = KErrNone;
+
+    // Find first section
+    _LIT( KModuleStartTag, "[New_TEFTest]" );
+    _LIT( KModuleEndTag, "[End_TEFTest]" );
+    section = parser->SectionL( KModuleStartTag, KModuleEndTag );
+    if( section == NULL )
+        {
+        __RDEBUG( (_L("Error: Can not find TEFTest section from %S."), 
+                &aConfigFile) );
+        iLog->Log(CStifLogger::ERed, _L("Error: Can not find TEFTest section from %S."), 
+        		&aConfigFile);
+        ret = KErrNotFound;
+        }
+    else
+        {
+        // Parse section
+        CleanupStack::PushL( section );
+            
+        CStifItemParser* item = NULL; 
+    	
+        // Get Tcs from configuration file.
+        TRAPD( getTcs, item = section ->GetItemLineL(_L( "Tcs=" ), ENoTag));
+        if( getTcs != KErrNone )
+            {
+            __RDEBUG( (_L("Error: From file %S, get item 'Tcs=' leaves with error: %d."), &aConfigFile ,getTcs) );
+            iLog->Log(CStifLogger::ERed, _L("Error: From file %S, get item 'Tcs=' leaves with error: %d."), &aConfigFile ,getTcs);
+            delete item;
+            item=NULL;
+            return getTcs;
+            }
+        if( !item )
+            {
+            __RDEBUG( (_L("Warning: From file %S, can not get item 'Tcs=' value. Use default OFF."), &aConfigFile) );
+            iLog->Log( _L("Warning: From file %S, can not get item 'Tcs=' value. Use default OFF."), &aConfigFile);
+            //set Tcs to default OFF.
+            iCfg_tcs = EOFF;
+            iLog->Log(_L("Tcs = %d"),iCfg_tcs);
+            delete item;
+            item=NULL;
+            }
+        else
+        	{
+        	TPtrC tcs;
+        	ret = item->GetString( _L( "" ), tcs );
+    	
+    		HBufC* tcsHbuf = tcs.AllocL();
+    		TPtr modifiableString = tcsHbuf->Des();
+    		modifiableString.UpperCase();
+    		
+    		if( modifiableString == _L( "INCLUDE" ) )
+    			{
+    			iCfg_tcs = EInclude;
+    			}
+    		else if( modifiableString == _L( "EXCLUDE" ) )
+    			{
+    			iCfg_tcs = EExclude;
+    			}
+    		else if( modifiableString == _L( "OFF" ) )
+    			{
+    			iCfg_tcs = EOFF;
+    			}
+    		else
+    			{
+                __RDEBUG( (_L("Warning: From file %S, item 'Tcs=' value is not recognized. Use default OFF."), &aConfigFile) );
+                iLog->Log( _L("Warning: From file %S, item 'Tcs=' value is not recognized. Use default OFF."), &aConfigFile);    
+                iCfg_tcs = EOFF;
+    			}
+    		iLog->Log(_L("Tcs = %d"),iCfg_tcs);
+    		delete tcsHbuf;
+    		tcsHbuf=NULL;
+    		delete item;	  
+    		item=NULL;
+        	}
+        
+        //Get Debug from configuration file.
+        TRAPD( getDebug, item = section ->GetItemLineL(_L( "Debug=" ), ENoTag));
+        if( getDebug != KErrNone )
+            {
+            __RDEBUG( (_L("Error: From file %S, get item 'Debug=' leaves with error: %d."), &aConfigFile, getDebug) );
+            iLog->Log(CStifLogger::ERed, _L("Error: From file %S, get item 'Debug=' leaves with error: %d."), &aConfigFile, getDebug);
+            delete item;
+            item=NULL;
+            return getDebug;
+            }
+        if( !item )
+            {
+            __RDEBUG( (_L("Warning: From file %S, can not get item 'Debug=' value. Use default OFF."), &aConfigFile) );
+            iLog->Log( _L("Warning: From file %S, can not get item 'Debug=' value. Use default OFF."), &aConfigFile);
+            // set Debug to default OFF.
+            iCfg_Debug = EFalse;
+            iLog->Log(_L("Debug = %d"),iCfg_Debug);
+            delete item;
+            item=NULL;
+            }
+        else
+        	{
+        	TPtrC debug;
+        	ret = item->GetString( _L( "" ), debug );
+    	
+    		HBufC* debugHbuf = debug.AllocL();
+    		TPtr modifiableString = debugHbuf->Des();
+    		modifiableString.UpperCase();
+    		
+    		if( modifiableString == _L( "ON" ) )
+    			{
+    			iCfg_Debug = ETrue;
+    			}
+    		else if( modifiableString == _L( "OFF" ) )
+    			{
+    			iCfg_Debug = EFalse;
+    			}
+    		else
+    			{
+                __RDEBUG( (_L("Warning: From file %S, item 'Debug=' value is not recognized. Use default OFF."), &aConfigFile) );
+                iLog->Log( _L("Warning: From file %S, item 'Debug=' value is not recognized. Use default OFF."), &aConfigFile);  
+                iCfg_Debug = EFalse;
+    			}
+    		iLog->Log(_L("Debug = %d"),iCfg_Debug);
+    		delete debugHbuf;
+    		debugHbuf=NULL;
+    		delete item;	   
+    		item=NULL;
+        	}
+         
+        //Get SeparateLog from configuration file.
+        TRAPD( getSep, item = section ->GetItemLineL(_L( "SeparateLog=" ), ENoTag));
+        if( getSep != KErrNone )
+            {
+            __RDEBUG( (_L("Error: From file %S, get item 'SeparateLog=' leaves with error: %d."), &aConfigFile, getSep) );
+            iLog->Log(CStifLogger::ERed, _L("Error: From file %S, get item 'SeparateLog=' leaves with error: %d."), &aConfigFile, getSep);
+            delete item;
+            item=NULL;
+            return getSep;
+            }
+        if( !item )
+            {
+            __RDEBUG( (_L("Warning: From file %S, can not get item 'SeparateLog=' value. Use default OFF."), &aConfigFile) );
+            iLog->Log( _L("Warning: From file %S, can not get item 'SeparateLog=' value. Use default OFF."), &aConfigFile);
+            //set SeparateLog to OFF.
+            iCfg_SeparateLog = EFalse;
+            iLog->Log(_L("SeparateLog = %d"),iCfg_SeparateLog);
+            delete item;
+            item=NULL;
+            }
+        else
+        	{
+        	TPtrC separateLog;
+        	ret = item->GetString( _L( "" ), separateLog );
+    	
+    		HBufC* separateLogHbuf = separateLog.AllocL();
+    		TPtr modifiableString = separateLogHbuf->Des();
+    		modifiableString.UpperCase();
+    		
+    		if( modifiableString == _L( "ON" ) )
+    			{
+    			iCfg_SeparateLog = ETrue;
+    			}
+    		else if( modifiableString == _L( "OFF" ) )
+    			{
+    			iCfg_SeparateLog = EFalse;
+    			}
+    		else
+    			{
+                __RDEBUG( (_L("Warning: From file %S, item 'SeparateLog=' value is not recognized. Use default OFF."), &aConfigFile) );
+                iLog->Log( _L("Warning: From file %S, item 'SeparateLog=' value is not recognized. Use default OFF."), &aConfigFile);  
+    			iCfg_SeparateLog = EFalse;
+    			}
+    		iLog->Log(_L("SeparateLog = %d"),iCfg_SeparateLog);
+    		delete separateLogHbuf;
+    		separateLogHbuf=NULL;
+    		delete item;	            	
+    		item=NULL;
+        	}
+
+        //Get Pipe from configuration file.
+        TRAPD( getPipe, item = section ->GetItemLineL(_L( "Pipe=" ), ENoTag));
+        if( getPipe != KErrNone )
+            {
+            __RDEBUG( (_L("Error: From file %S, get item 'Pipe=' leaves with error: %d."), &aConfigFile, getPipe) );
+            iLog->Log(CStifLogger::ERed, _L("Error: From file %S, get item 'Pipe=' leaves with error: %d."), &aConfigFile, getPipe);
+            delete item;
+            item=NULL;
+            return getPipe;
+            }
+        if( !item )
+            {
+            __RDEBUG( (_L("Warning: From file %S, can not get item 'Pipe=' value. Use default OFF."), &aConfigFile) );
+            iLog->Log( _L("Warning: From file %S, can not get item 'Pipe=' value. Use default OFF."), &aConfigFile);
+            iCfg_Pipe.Copy(_L("OFF"));	
+            iLog->Log(_L("Pipe = %S"),&iCfg_Pipe);
+            delete item;
+            item=NULL;
+            }
+        else
+        	{
+        	TPtrC pipeName;
+        	ret = item->GetString( _L( "" ), pipeName );
+        	iCfg_Pipe.Copy(pipeName);		
+    		if(iCfg_Pipe.Length()<=0)
+			{
+            __RDEBUG( (_L("Warning: From file %S, can not get item 'Pipe=' value. Use default OFF."), &aConfigFile) );
+            iLog->Log( _L("Warning: From file %S, can not get item 'Pipe=' value. Use default OFF."), &aConfigFile);
+            iCfg_Pipe.Copy(_L("OFF"));	
+            delete item;
+            item=NULL;
+			}
+    		iLog->Log(_L("Pipe = %S"),&iCfg_Pipe);
+    		delete item;	   
+    		item=NULL;
+        	}        
+        
+        //Get Script from configuration file.
+        TInt scriptCount = 0;
+        TRAPD(getScript, item = section->GetItemLineL(_L( "Script=" ), ENoTag));
+        if( getScript != KErrNone )
+            {
+            __RDEBUG( (_L("Error: From file %S, get item 'Script=' leaves with error: %d."), &aConfigFile, getScript) );
+            iLog->Log(CStifLogger::ERed, _L("Error: From file %S, get item 'Script=' leaves with error: %d."), &aConfigFile, getScript);
+            delete item;
+            item=NULL;
+            return getScript;
+            }
+        if( !item )
+            {
+            __RDEBUG( (_L("Error: From file %S, can not get item 'Script=' value."), &aConfigFile) );
+            iLog->Log(CStifLogger::ERed, _L("Error: From file %S, can not get item 'Script=' value."), &aConfigFile);
+            delete item;
+            item=NULL;
+            return KErrNotFound;
+            }
+
+        while(item)
+            {
+            //script count, from 1 to ...
+            scriptCount++;
+            CleanupStack::PushL(item);
+            TPtrC script;
+            ret = item->GetString(_L( "" ), script);
+                
+            TScriptName scriptFile;
+            scriptFile.Copy(script);
+            TStifUtil::CorrectFilePathL( scriptFile );
+            scriptFile.LowerCase();
+            iLog->Log(_L("Script = %S"),&scriptFile);
+            
+            ret = MatchScriptsToCasesL(scriptFile, scriptCount, aTestCases);
+
+            CleanupStack::PopAndDestroy(item);
+            item=NULL;
+            TRAPD(getScript2, item = section->GetNextItemLineL(_L( "Script=" ), ENoTag));
+            if( getScript2 != KErrNone )
+                {
+                __RDEBUG( (_L("Error: From file %S, get item 'Script=' leaves with error: %d."), &aConfigFile, getScript2) );
+                iLog->Log(CStifLogger::ERed, _L("Error: From file %S, get item 'Script=' leaves with error: %d."), &aConfigFile, getScript2);
+                delete item;
+                item=NULL;
+                return getScript2;
+                }
+            }         
+        
+        //Get TcsFile from configuration file.
+        if (iCfg_tcs != EOFF)
+        	{
+	        TInt tcsCount = 0;
+	        TRAPD(getTcsData, item = section->GetItemLineL(_L( "TcsData=" ), ENoTag));
+	        if( getTcsData != KErrNone )
+	            {
+	            __RDEBUG( (_L("Error: From file %S, get item 'TcsData=' leaves with error: %d."), &aConfigFile, getTcsData) );
+	            iLog->Log(CStifLogger::ERed, _L("Error: From file %S, get item 'TcsData=' leaves with error: %d."), &aConfigFile, getTcsData);
+	            delete item;
+	            item=NULL;
+	            return getTcsData;
+	            }
+	        if( !item )
+	            {
+	            __RDEBUG( (_L("Error: From file %S, can not get item 'TcsData=' value."), &aConfigFile) );
+	            iLog->Log(CStifLogger::ERed, _L("Error: From file %S, can not get item 'TcsData=' value."), &aConfigFile);
+	            delete item;
+	            item=NULL;
+	            return KErrNotFound;
+	            }
+	
+	        while(item)
+	            {
+	            //script count, from 1 to ...
+	            tcsCount++;
+	            CleanupStack::PushL(item);
+	            TPtrC tcsFile;
+	            ret = item->GetString(_L( "" ), tcsFile);
+	                
+	            TTcsName* tcsData = new(ELeave) TTcsName(tcsFile);
+	            TStifUtil::CorrectFilePathL( *tcsData );
+	            tcsData->LowerCase();
+	            iLog->Log(_L("TcsData = %S"),&(*tcsData));
+	    
+	            //Add tcsData list to iArray_Cfg_TcsData.
+	            CleanupStack::PushL( tcsData );
+	            // Append tcsData to the iArray_Cfg_TcsData array. After appended succesfully 
+	            // the tcsData object is owned (and freed) by the iArray_Cfg_TcsData in ~CTEFTestModule() method.
+	            // The sequence of tcs in iArray_Cfg_TcsData is same as sequence of script list iArray_ScriptFilePaths.
+	            // tcsData and script is paired.
+	            User::LeaveIfError( iArray_Cfg_TcsData.Append( tcsData ) );
+	            CleanupStack::Pop(tcsData);
+	            
+	            CleanupStack::PopAndDestroy(item);
+	            item=NULL;
+	            TRAPD(getTcsData2, item = section->GetNextItemLineL(_L( "TcsData=" ), ENoTag));
+	            if( getTcsData2 != KErrNone )
+	                {
+	                __RDEBUG( (_L("Error: From file %S, get item 'TcsData=' leaves with error: %d."), &aConfigFile, getTcsData2) );
+	                iLog->Log(CStifLogger::ERed, _L("Error: From file %S, get item 'TcsData=' leaves with error: %d."), &aConfigFile, getTcsData2);
+	                delete item;
+	                item=NULL;
+	                return getTcsData2;
+	                }
+	            }
+        	}
+        else
+        	//iCfg_tcs == EOFF, pair Script with TcsData(NULL).
+        	{
+        	TTcsName* tcsDataNull = new(ELeave) TTcsName();
+        	CleanupStack::PushL( tcsDataNull );
+        	for(TInt i=0; i<iArray_ScriptFilePaths.Count();i++)
+        		{
+        		// Append tcsDataNull to the iArray_Cfg_TcsData array. After appended succesfully 
+        		// the tcsDataNull object is owned (and freed) by the iArray_Cfg_TcsData in ~CTEFTestModule() method.
+        		User::LeaveIfError( iArray_Cfg_TcsData.Append( tcsDataNull ) );
+        		}
+        	CleanupStack::Pop(tcsDataNull);
+        	}
+      
+        CleanupStack::PopAndDestroy( section );
+        section = NULL;
+        }
+    CleanupStack::PopAndDestroy( parser );
+    
+    //check: At leasr one script exist in TEFTestModule configration file
+    if(iArray_ScriptFilePaths.Count()<=0)
+    	{
+    	__RDEBUG( (_L("Error: From file %S, no Script founded."), &aConfigFile) );
+    	iLog->Log(CStifLogger::ERed, _L("Error: From file %S, no Script founded."), &aConfigFile);
+    	ret = KErrArgument;
+    	}
+    
+    //check: Script is paired with TcsData.
+    if(iArray_ScriptFilePaths.Count() != iArray_Cfg_TcsData.Count())
+    	{
+    	__RDEBUG( (_L("Error: From file %S, Script is not paired with TcsData."), &aConfigFile) );
+    	iLog->Log(CStifLogger::ERed, _L("Error: From file %S, Script is not paired with TcsData."), &aConfigFile);
+    	ret = KErrArgument;
+    	} 	
+
+    
+    return ret; 
+	}
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::MatchScriptsToCasesL
+// MatchScriptsToCasesL is used to add cases based on script list.
+// Case title use script short name(xxx, No path and No extension '.script'). 
+// Script list stores in iArray_ScriptFilePaths, using full name(c:\xx\xxx\xxx.script)
+// The sequence of Case list and script list are the same. 
+// This is called by ParseTestFrameWorkCfgL().
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+TInt CTEFTestModule::MatchScriptsToCasesL(	const TScriptName& aScriptFile,
+											TInt aScriptCount,
+											RPointerArray<TTestCaseInfo>& aTestCases )
+	{
+	
+	TInt ret = KErrNone;
+	
+	//Get the script name(xxx.script) from full name(c:\xx\xxx\xxx.script)
+	TInt offset = aScriptFile.LocateReverse('\\');
+	if (offset == KErrNotFound)
+		{
+		ret = KErrNotFound;
+		return ret;
+		}
+	TFileName scriptName;
+	scriptName.Copy( aScriptFile.Mid(offset+1));
+	//Get the script name(xxx, No '.script')
+	offset = scriptName.LocateReverse('.');
+	if (offset == KErrNotFound)
+		{
+		ret = KErrNotFound;
+		return ret;
+		}
+	scriptName.Copy( scriptName.Left(offset));
+	
+	//Add script list. Full name(c:\xx\xxx\xxx.script) to iArray_ScriptFilePaths.
+	TScriptName* scriptfile = new(ELeave) TScriptName(aScriptFile);
+	CleanupStack::PushL( scriptfile );
+	// Append TTestCaseInfo to the iArray_ScriptFilePaths array. After appended succesfully 
+	// the TTestCaseInfo object is owned (and freed) by the iArray_ScriptFilePaths in ~CTEFTestModule() method.
+	// The sequence of script in iArray_ScriptFilePaths is same as sequence of case list.
+	User::LeaveIfError( iArray_ScriptFilePaths.Append( scriptfile ) );
+	CleanupStack::Pop(scriptfile);
+	
+	//Add case, case title is xxx, no path, no extesion '.script'
+	TTestCaseInfo* testCase = new(ELeave) TTestCaseInfo();
+	CleanupStack::PushL( testCase );
+	testCase->iCaseNumber = aScriptCount;
+	testCase->iTitle.Copy( scriptName );
+	
+    // Append TTestCaseInfo to the testcase array. After appended succesfully 
+    // the TTestCaseInfo object is owned (and freed) by the TestServer. 
+	User::LeaveIfError( aTestCases.Append( testCase ) );
+	CleanupStack::Pop(testCase);
+	
+	return ret; 
+	}
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::RunScriptL
+// RunScriptL is used to Execute sigle script. 
+// This is the main functionality of script execution based 
+// on legacy TEF's functionality.
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+TInt CTEFTestModule::RunScriptL(CActiveScheduler* aScheduler, 
+								const TScriptName& aScriptFilePath, 
+								const TTcsName& aTcsData )
+	{  
+	TDriveName testSysDrive(KTEFLegacySysDrive);
+	TInt waitForLoggingTime = 0;
+	TBuf<KMaxTestExecuteNameLength> htmlLogPath;
+	// Create a object of the Parser for TestExecute.ini
+	CTestExecuteIniData* parseTestExecuteIni = NULL;
+	TRAPD(err, parseTestExecuteIni = CTestExecuteIniData::NewL(iDefaultSysDrive));
+	if (err == KErrNone)
+		{
+		CleanupStack::PushL(parseTestExecuteIni);
+		// Extract all the key values within the object
+		parseTestExecuteIni->ExtractValuesFromIni();
+		}
+	
+	TDesC* selTestCfgFileData = NULL; //the pointer to the data of in the .tcs file
+	
+	// If Debug == ON, then set Just In Time debugging. Panicks break into debug on emulator
+	(iCfg_Debug) ? (User::SetJustInTime(ETrue)) : (User::SetJustInTime(EFalse)); 
+	
+	// Create a console
+	_LIT(KMessage,"TestExecute Script Engine");
+	CConsoleBase* console = Console::NewL(KMessage,TSize(KConsFullScreen,KConsFullScreen));
+	CleanupStack::PushL(console);
+	console->SetCursorHeight(0);
+	RConsoleLogger consoleLogger(*console);
+	
+	// Check whether script name is provided along with folder path in the command line
+	// If not, take the path from testexecute.ini & name from the command line	
+	TPtrC scriptFilePath(aScriptFilePath);
+	TScriptName tempScriptPath(scriptFilePath);
+	TInt ret=scriptFilePath.FindC(KTEFColon);
+	if(ret==KErrNotFound)
+		{
+		if (parseTestExecuteIni != NULL)
+			{
+			TBuf<KMaxTestExecuteNameLength> tempBuffer;
+			parseTestExecuteIni->GetKeyValueFromIni(KTEFDefaultScriptPath, tempBuffer);
+			// If the relative script file path does not refer to the root,
+			// we will look for DefaultScriptDir entry in testexecute.ini
+			// If available prepend it to the relative path
+			// else if the relative path refers to root,
+			// then set the default system drive, i.e. c:
+			// else leaving it as it is (considering invalid path)
+			if (scriptFilePath.Left(1).CompareF(KTEFSlash) != 0 &&
+			 tempBuffer.Length() > 0)
+				scriptFilePath.Set(tempBuffer);
+			else if (scriptFilePath.Left(1).CompareF(KTEFSlash) == 0)
+				scriptFilePath.Set(iDefaultSysDrive);
+			else
+				scriptFilePath.Set(KNull);
+			}
+		else
+			{
+			// If the file path is not provided in command line as well as in testexecute.ini
+			// then set the  script file path to be 'blank'
+			scriptFilePath.Set(KNull);
+			}
+
+		// Construct the full file path from the values extracted from command line and ini file
+		TScriptName storeScriptPathTemp(scriptFilePath);
+		storeScriptPathTemp.Append(tempScriptPath);
+		scriptFilePath.Set(storeScriptPathTemp);
+		tempScriptPath.Copy(scriptFilePath);
+		}
+
+	//If scriptFilePath is not appended by .script Append .script 
+	if(scriptFilePath.Find(KTEFScriptExtension)==KErrNotFound)
+		{
+		tempScriptPath.Append(KTEFScriptExtension);
+		}
+	scriptFilePath.Set(tempScriptPath);
+	
+	//Parse TcsData from configration file to select test case flag. Get cases Included or Excluded.
+	TSelectiveTestingOptions* selTestingOptions =NULL;
+	if(iCfg_tcs!=EOFF)
+		{
+		RArray<TRange> selectiveCaseRange;
+		ParseTcsDataForSelectiveTestingOptions(aTcsData, *parseTestExecuteIni,selectiveCaseRange, selTestCfgFileData);
+		
+		//you need to sort these two arrays first, and also if they are both empty ignore the entire option altogether.
+		if(  selectiveCaseRange.Count() > 0 )
+			{
+			CleanupStack::PushL(selTestCfgFileData);
+			TLinearOrder<TRange> orderingrng(TRange::CompareTRangeStartOrder) ; 
+			selectiveCaseRange.Sort(orderingrng );
+			ESelectiveTesting selectiveTestingType(iExclusive);
+			if(iCfg_tcs == EInclude)
+				{
+				selectiveTestingType = iInclusive ; 
+				}
+			selTestingOptions = new(ELeave) TSelectiveTestingOptions(selectiveCaseRange, selectiveTestingType);
+			}
+		else
+			{
+			//if iCfg_tcs == EOFF, no tcs option used, ignore it...
+			delete selTestCfgFileData;
+			}
+		}
+	
+	if (scriptFilePath.CompareF(KNull)==0)
+		{
+		if (!iCfg_SeparateLog && !iCfg_Debug)
+			{
+			// Print the product version details through console window
+			iLog->Log(KTEFVersionMessage);
+			iLog->Log(KTEFProductVersion);
+			}
+		else
+			{
+			// Display a error message on the log file of error TEF configration file.
+			__RDEBUG( (_L("Error: In TEFTestModule configuration file. No script founded.") ) );
+			iLog->Log(CStifLogger::ERed, _L("Error: In TEFTestModule configuration file. No script founded."));
+			}
+		// Exit on a key press from user
+		console->Printf(KTEFEnterKeyMessage);
+		console->Getch();
+		}
+	else
+		{
+		// Create a Interface class object for generating HTML & XML logs
+		CTestExecuteLogger *tefLogger = new(ELeave) CTestExecuteLogger();
+		CleanupStack::PushL(tefLogger);
+
+		TInt logMode;
+		TInt logLevel;
+		TInt remotePanicDetection;
+		TBuf<KMaxTestExecuteNameLength> iniSysDrive;
+
+		if (parseTestExecuteIni != NULL)
+			{
+			// Parse ini for retrieving logging options set through ini
+			parseTestExecuteIni->GetKeyValueFromIni(KTEFLogMode, logMode);
+			parseTestExecuteIni->GetKeyValueFromIni(KTEFLogSeverityKey, logLevel);
+			parseTestExecuteIni->GetKeyValueFromIni(KTEFRemotePanicDetection, remotePanicDetection);
+			parseTestExecuteIni->GetKeyValueFromIni(KTEFDefaultSysDrive, iniSysDrive);
+			parseTestExecuteIni->GetKeyValueFromIni(KTEFWaitForLoggingTime, waitForLoggingTime);
+			parseTestExecuteIni->GetKeyValueFromIni(KTEFHtmlKey, htmlLogPath);
+			}
+		else
+			{
+			// Set default values for logging options if parser is not functioning
+			logMode = TLoggerOptions(ELogHTMLOnly);
+			logLevel = RFileFlogger::TLogSeverity(ESevrAll);
+			remotePanicDetection = 0;
+			iniSysDrive.Copy(KTEFIniSysDrive);
+			waitForLoggingTime = 5;
+			htmlLogPath.Copy(KTestExecuteLogPath);
+			htmlLogPath.Replace(0, 2, iDefaultSysDrive);
+			}
+		
+		tefLogger->SetLoggerOptions(logMode);
+		if(iCfg_Pipe!=_L("OFF"))
+			{
+			TPtrC pipeName(iCfg_Pipe); 
+			tefLogger->SetPipeName(pipeName); 
+			}
+		
+		// Initialise the logging passing in the script file path & log level to the interface
+		tefLogger->InitialiseLoggingL(scriptFilePath, iCfg_SeparateLog, logLevel);
+
+		// Check to see if defaultsysdrive key is set in testexecute.ini
+		// if set to SYSDRIVE, assign the default system drive obtained from the plugin
+		// else, if a true value is set in testexecute.ini, use it as system drive for all test artifacts
+		if (iniSysDrive.Length() == 2 && iniSysDrive.Right(1).Compare(KTEFColon) == 0)
+			testSysDrive.Copy(iniSysDrive);
+		else if (iniSysDrive.CompareF(KTEFIniSysDrive) == 0)
+			testSysDrive.Copy(iDefaultSysDrive);
+
+
+		// Pass the first command line argument to the script master
+		// which is always the command script
+		CScriptMaster* scriptMaster = new (ELeave) CScriptMaster(scriptFilePath,*tefLogger, consoleLogger, iDefaultSysDrive, testSysDrive, selTestingOptions);
+		// To kick the state machine of the script master off -
+		// Call the kick method which jumps us into the RunL() of the CScriptMaster class
+		// CScriptMaster is the top AO in the hierarchy.
+		scriptMaster->Kick();
+		
+		// Construct and Install a test watcher object for capturing remote panics during test execution
+		CTestWatcher* testWatcher = NULL;
+		if (remotePanicDetection != 0)
+			{
+			testWatcher = CTestWatcher::NewL();
+			testWatcher->StartL();
+			}
+		// Enter the Active Scheduler
+		aScheduler->Start();
+		
+		// Cleanup
+		delete scriptMaster;
+		
+		TInt commentedCommandsCnt=CScriptControl::commentedCommandsCount;
+		if(commentedCommandsCnt==-1)
+			{
+			CScriptControl::commentedCommandsCount=0;
+			//If the path specified fails check out for path from testexecute.ini
+			if(ret!=KErrNotFound)
+				{
+				//To get scriptFile name  i.e get sampleFile.script
+				TInt posOfLastSlash=scriptFilePath.LocateReverse('\\') ;
+				scriptFilePath.Set(scriptFilePath.Mid(posOfLastSlash+1));
+				TScriptName tempStore(scriptFilePath);
+				if (parseTestExecuteIni != NULL)
+					{
+					TBuf<KMaxTestExecuteNameLength> tempBuffer;
+					parseTestExecuteIni->GetKeyValueFromIni(KTEFDefaultScriptPath, tempBuffer);
+					if (tempBuffer.CompareF(KNull) != 0)
+						{
+						scriptFilePath.Set(tempBuffer);
+						TScriptName tempStoreScriptPath(scriptFilePath);
+						tempStoreScriptPath.Append(tempStore);
+						scriptFilePath.Set(tempStoreScriptPath);
+						TBuf<KMaxTestExecuteNameLength> scriptFileLocation(scriptFilePath);
+						CScriptMaster* scriptMaster = new (ELeave) CScriptMaster(scriptFilePath,*tefLogger, consoleLogger, iDefaultSysDrive, testSysDrive, selTestingOptions);
+						// To kick the state machine of the script master off -
+						// Call the kick method which jumps us into the RunL() of the CScriptMaster class
+						// CScriptMaster is the top AO in the hierarchy.
+						scriptMaster->Kick();
+						// Enter the Active Scheduler                        
+						aScheduler->Start();
+						
+						commentedCommandsCnt=CScriptControl::commentedCommandsCount;
+						if(commentedCommandsCnt==-1)
+							{
+							CScriptControl::commentedCommandsCount=0;
+							}
+							
+						// Cleanup
+						delete scriptMaster;
+						}
+					}
+				}
+			}
+		delete selTestingOptions;
+		
+		TInt commandsCount = CScriptControl::commentedCommandsCount;
+		TInt countOfRemotePanics = 0;
+
+		// Stop and Process the test watcher object for extracting panic informations and print them to the log files
+		if (remotePanicDetection != 0)
+			{
+			testWatcher->Stop();
+			countOfRemotePanics = testWatcher->iSharedData->iPanicDetails.Count();
+			if (countOfRemotePanics > 0)
+				{
+				tefLogger->LogExtra((TText8*)__FILE__,__LINE__,ESevrErr,
+					_L("The panic detection thread detected %d panics:"), countOfRemotePanics);
+				for (TInt count = 0; count < countOfRemotePanics; count++)
+					tefLogger->LogExtra((TText8*)__FILE__,__LINE__,ESevrErr,_L("Remote Panic %d - Name of Panicked Thread: %S, Exit Reason: %d, Exit Category %S"), count+1, &(testWatcher->iSharedData->iPanicDetails)[count]->iThreadName,(testWatcher->iSharedData->iPanicDetails)[count]->iReason,&(testWatcher->iSharedData->iPanicDetails)[count]->iCategory);
+				}
+			delete testWatcher;
+			}
+
+		// Call the Termination routine for logging within the interface
+		tefLogger->TerminateLoggingL(commandsCount, countOfRemotePanics, CScriptControl::iRunScriptFailCount);
+		CleanupStack::Pop(tefLogger);
+		delete tefLogger;
+		}
+	
+	if(iCfg_tcs != EOFF)
+		{
+		CleanupStack::PopAndDestroy(selTestCfgFileData);
+		selTestCfgFileData = NULL;
+		}
+	
+	// Close the parser instance if it is active
+	CleanupStack::PopAndDestroy(console);
+	if (parseTestExecuteIni != NULL)
+		{
+		CleanupStack::PopAndDestroy(parseTestExecuteIni);
+		}
+	
+	if (scriptFilePath.CompareF(KNull)!=0)
+		{
+		// Wait for flogger to write to file
+		_LIT(KHtmExtension,".htm");
+		TParse fileNameParse;
+		fileNameParse.Set(scriptFilePath, NULL, NULL);
+		
+		TPtrC fileName = fileNameParse.Name();
+		htmlLogPath.Append(fileName);
+		htmlLogPath.Append(KHtmExtension);
+
+		__RDEBUG( (_L("Log file path--> %S"), &htmlLogPath) );
+		
+		RFs fs;
+		fs.Connect();
+		TBool answer = EFalse;
+		while(ETrue)
+			{
+			TInt err = fs.IsFileOpen(htmlLogPath, answer);
+			if ((KErrNone==err&&!answer) || KErrNotFound==err || KErrPathNotFound==err) 
+				{
+				break;
+				}
+			User::After(100000);
+			}
+		
+		if (waitForLoggingTime > 0)
+			{
+			User::After(waitForLoggingTime*1000000);
+			}
+		fs.Close();
+		}				
+	return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::CreateCfgDataFromFileL
+// ParseTestFrameWorkCfg is used to Read the Cfg File data into a heap buffer
+// And populate the arrays of selective test case IDs and 
+// Ranges to be used by the state machine.
+// NOTE: we do not support nested cfgs...
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::CreateCfgDataFromFileL(TPtrC& aCfgFilePath,RArray<TRange>& aSelectiveCaseRange, TDesC*& aSelTestCfgFileData)
+	{
+	RFs fS;
+	User::LeaveIfError(fS.Connect());
+	CleanupClosePushL(fS);
+	RFile cfgFile;
+	User::LeaveIfError(cfgFile.Open(fS,aCfgFilePath,EFileRead | EFileShareAny));
+	CleanupClosePushL(cfgFile);
+	TInt fileSize;
+	User::LeaveIfError(cfgFile.Size(fileSize));
+	// Create a 16bit heap buffer
+	HBufC* cfgData = HBufC::NewL(fileSize);
+	CleanupStack::PushL(cfgData);
+	HBufC8* narrowData = HBufC8::NewL(fileSize);
+	CleanupStack::PushL(narrowData);
+	TPtr8 narrowPtr=narrowData->Des();
+	// Read the file into an 8bit heap buffer
+	User::LeaveIfError(cfgFile.Read(narrowPtr));
+	TPtr widePtr(cfgData->Des());
+	// Copy it to the 16bit buffer
+	widePtr.Copy(narrowData->Des());
+	CleanupStack::PopAndDestroy(narrowData);
+	CleanupStack::Pop(cfgData);
+	CleanupStack::Pop(2);
+	cfgFile.Close();
+	fS.Close();
+	// Set up the instance token parser
+	TLex cfgLex = cfgData->Des();
+	aSelTestCfgFileData = cfgData; // to preserve the pointer of cfgdata and transfer the ownership to aSelTestCfgFileData 
+	cfgData = NULL; // relinquish the ownership
+	while(!cfgLex.Eos())
+		{
+		DistinguishElement(cfgLex.NextToken(),aSelectiveCaseRange) ; 
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::ParseTcsDataForSelectiveTestingOptions
+// DistinguishElement is used to parse TcsData from configration file to select test case flag. 
+// Get cases Included or Excluded.
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::ParseTcsDataForSelectiveTestingOptions( const TTcsName& aTcsData, 
+												CTestExecuteIniData& aParseTestExecuteIni,
+												RArray<TRange>& aSelectiveCaseRange,  
+												TDesC*& aSelTestCfgFileData )
+	{
+	TPtrC argument(aTcsData) ; 
+	while(argument.Length() > 0 )	
+		{
+		TInt commaOccurance = argument.FindC(KTEFComma) ;
+		TPtrC element ; 
+		if(commaOccurance == -1)	
+			{
+			//handle the case where no comma is found, 
+			//assume only one item in the list
+			element.Set(argument) ; 
+			//reset argument to break the while
+			argument.Set(KNull);
+			}
+		else
+			{
+			element.Set(argument.Left(commaOccurance));
+			//take the remaining in the argument
+			TInt len = argument.Length()-commaOccurance-1 ; 
+			argument.Set(argument.Right(len)) ; 	
+			}
+		
+		TInt cfgExtensionOccurance = element.FindC(KTEFCfgExtension) ; 
+		if (cfgExtensionOccurance!=KErrNotFound) //madatory extension to be given
+			{
+			
+			TPtrC cfgFilePath(element);
+			//its probably the cfg file path.
+			TScriptName tempScriptPath(cfgFilePath);
+			// Check whether cfg name is provided along with folder path in the command line
+			// If not, take the path from testexecute.ini & name from the command line
+			if(cfgFilePath.FindC(KTEFColon)==KErrNotFound)
+				{
+				TBuf<KMaxTestExecuteNameLength> tempBuffer;
+				aParseTestExecuteIni.GetKeyValueFromIni(KTEFDefaultScriptPath, tempBuffer);
+				cfgFilePath.Set(tempBuffer);
+				// Construct the full file path from the values extracted from command line and ini file
+				TScriptName storeScriptPathTemp(cfgFilePath);
+				storeScriptPathTemp.Append(tempScriptPath);
+				cfgFilePath.Set(storeScriptPathTemp);
+				tempScriptPath.Copy(cfgFilePath);
+				}
+				// and parse this cfg File to populate our structures
+				TRAP_IGNORE(CreateCfgDataFromFileL(cfgFilePath,aSelectiveCaseRange, aSelTestCfgFileData));
+				//actually do nothing with the error...
+			}
+		else
+			{
+			DistinguishElement(element,aSelectiveCaseRange  );
+			}
+		}
+	}
+// -----------------------------------------------------------------------------
+// CTEFTestModule::DistinguishElement
+// DistinguishElement is used to get the element from configration
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CTEFTestModule::DistinguishElement(const TPtrC& aElement, RArray<TRange>& aSelectiveCaseRange)
+{
+
+	TInt colonOccurance = aElement.FindC(KTEFColon);
+	//we are expecting only a range or a test case ID over here...
+	if( colonOccurance!=KErrNotFound )
+		{
+		//then this is a range of testcases, split it at the colon
+		TRange newRange(aElement.Left(colonOccurance),aElement.Mid(colonOccurance+1));
+		aSelectiveCaseRange.Append(newRange);
+		}
+	else
+		{
+		TRange newRange(aElement,aElement);
+		aSelectiveCaseRange.Append(newRange);	
+		}
+}
+
+// -----------------------------------------------------------------------------
+// CTEFTestModule::ParseStackSize
+// Get stack size set by user, in TestFramework.ini.
+// Returns: TInt. System wide error code.
+// -----------------------------------------------------------------------------
+//
+TInt CTEFTestModule::ParseStackSizeL(TInt& aStackSize)
+	{
+	//Parse from testframwork to get stack size set of TEFTestModule.
+	//If not found, default stack size is 28672.
+    CStifParser* parser = NULL; 
+    TRAPD( err, 
+           parser = CStifParser::NewL( _L(""), 
+                                       _L("c:\\TestFramework\\TestFramework.ini"), 
+                                       CStifParser::ECStyleComments ) );
+    if( err != KErrNone )
+        {
+        __RDEBUG( (_L("Error: TestFramework.ini not found")));
+        return err;
+        }
+    CleanupStack::PushL( parser );
+    CStifSectionParser* section = NULL;
+    _LIT( KModuleStartTag, "[New_Module]" );
+    _LIT( KModuleEndTag, "[End_Module]" );
+    section = parser->SectionL( KModuleStartTag, KModuleEndTag );
+    if( section == NULL )
+        {
+        CleanupStack::PopAndDestroy( parser );
+        parser = NULL;
+        return KErrNone;
+        }
+    while(section)
+    	{
+        // Parse section
+        CleanupStack::PushL( section );
+            
+        CStifItemParser* item = NULL; 
+        // Get ModuleName from configuration file.
+        TRAPD( getModuleName, item = section ->GetItemLineL(_L( "ModuleName=" ), ENoTag));
+        if( getModuleName != KErrNone )
+            {
+            __RDEBUG( (_L("Error: From file TestFramework.ini, get item 'ModuleName=' leaves with error: %d."),getModuleName) );
+            delete item;
+            item=NULL;
+            CleanupStack::PopAndDestroy( section );
+            section = NULL;
+            CleanupStack::PopAndDestroy( parser );
+            parser = NULL;
+            return getModuleName;
+            }
+        if( !item )
+            {
+            delete item;
+            item=NULL;
+            CleanupStack::PopAndDestroy( section );
+            section = NULL;
+            CleanupStack::PopAndDestroy( parser );
+            parser = NULL;
+            return KErrNone;
+            }
+        else
+        	{
+        	TPtrC moduleName;
+        	item->GetString( _L( "" ), moduleName );
+        	HBufC* moduleNameHbuf = moduleName.AllocL();
+        	TPtr modifiableString = moduleNameHbuf->Des();
+        	modifiableString.UpperCase();
+        	
+        	if( modifiableString == _L( "TEFTESTMODULE" ) )
+	        	{
+	        	CStifItemParser* itemStackSize = NULL; 
+	        	TRAPD( getStackSize, itemStackSize = section ->GetItemLineL(_L( "StackSize=" ), ENoTag));
+	        	if( getStackSize != KErrNone )
+    	            {
+    	            __RDEBUG( (_L("Error: From file TestFramework.ini, get item 'getStackSize=' leaves with error: %d."),getStackSize) );
+    	            delete item;
+    	            item=NULL;
+    	    		delete moduleNameHbuf;
+    	    		moduleNameHbuf=NULL;
+    	            CleanupStack::PopAndDestroy( section );
+    	            section = NULL;
+    	            CleanupStack::PopAndDestroy( parser );
+    	            parser = NULL;
+    	            return getStackSize;
+    	            }
+    	        if( !itemStackSize )
+    	            {
+    	    		delete item;	  
+    	    		item=NULL;
+    	    		delete moduleNameHbuf;
+    	    		moduleNameHbuf=NULL;
+    	            CleanupStack::PopAndDestroy( section );
+    	            section = NULL;
+    	            CleanupStack::PopAndDestroy( parser );
+    	            parser = NULL;
+    	            return KErrNone;
+    	            }
+    	        else
+    	        	{
+    	        	itemStackSize->GetInt( _L( "" ), aStackSize );
+    	        	CleanupStack::PopAndDestroy( section );
+    	        	section = NULL;
+    	        	delete itemStackSize;
+    	        	itemStackSize = NULL;
+    	        	}
+	        	}
+        	else
+	        	{
+	        	CleanupStack::PopAndDestroy(section);
+	        	section = NULL;
+	        	section = parser->NextSectionL(KModuleStartTag, KModuleEndTag);
+	        	}
+        	
+    		delete moduleNameHbuf;
+    		moduleNameHbuf=NULL;
+    		delete item;	  
+    		item=NULL;
+        	
+        	}
+    	}
+    CleanupStack::PopAndDestroy( parser );
+    return KErrNone;
+	}
+// -----------------------------------------------------------------------------
+// CTEFTestModule::StartSystemL
+// DistinguishElement is used to load and wait to start. 
+// StartSystemL() will be build and called only when Lite version is NOT defined.
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+
+#if !(defined TEF_LITE)
+void CTEFTestModule::StartSystemL(void)
+	{	
+	CActiveScheduler* theScheduler = new (ELeave) CActiveScheduler();
+	CleanupStack::PushL(theScheduler);
+	CActiveScheduler::Install(theScheduler);
+	
+	RLibrary pluginLibrary;
+	CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary);
+	
+	if (plugin!=NULL)
+		{
+		CleanupStack::PushL(plugin);
+		plugin->WaitForSystemStartL();
+		CleanupStack::PopAndDestroy(plugin);
+		pluginLibrary.Close();
+		}
+	else
+		{
+		User::Leave(KErrGeneral);
+		}
+	
+	CleanupStack::PopAndDestroy(theScheduler);
+	}
+#endif
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/teftestmodule/src/testwatcher.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2005-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:  
+* Implementation for Test Watcher object using RUndertaker object
+* for trapping dead threads during test execution
+* Collect details of dead threads and pass it on to TEF for logging
+*
+*/
+
+
+
+/**
+ @file TestWatcher.cpp
+*/
+
+#include "testwatcher.h"
+
+TThreadPanicDetails::TThreadPanicDetails(TName aThreadName, 
+	TInt aReason, TExitCategoryName aCategory, TTime aTime)
+	: iThreadName(aThreadName), iReason(aReason), iCategory(aCategory), iTime(aTime)
+	{
+	}
+
+CTestWatcher::CTestWatcher()
+	{
+	}
+
+TInt ThreadFunc(TAny* anArgument)
+	{
+	CSharedData* mySharedData = reinterpret_cast<CSharedData*> (anArgument);
+	
+	RUndertaker u;
+	u.Create();
+	
+	TRequestStatus status;
+	TInt deadThread;
+	
+	TBool clientWaiting = ETrue;
+	
+	FOREVER
+		{
+		status = KRequestPending;
+		u.Logon(status,deadThread);
+		// wait for the next thread to die.
+	
+		if (clientWaiting)
+			{
+			// rendezvous with the client so that they know we're ready.
+			// This guarantees that we will catch at least the first panic to 
+			// occur (as long as we aren't closed before kernel tells us.
+			RThread::Rendezvous(KErrNone);
+			clientWaiting = EFalse;
+			}
+
+		User::WaitForRequest(status);
+		// until we get back around to the top we are missing notifications now.
+		// being high priority helps us, but still...
+		// deal with this QUICKLY
+
+
+		// get handle to the dead thread (this has already been marked for us in 
+		// the kernel)
+		RThread t;
+		t.SetHandle(deadThread);
+	
+		if (t.ExitType() == EExitPanic)
+			{
+			// the other ways threads can die are uninteresting
+			TTime now;
+			now.UniversalTime();
+			
+			TThreadPanicDetails* tpd = new TThreadPanicDetails (t.Name(),
+				t.ExitReason(),t.ExitCategory(),now);
+			
+			mySharedData->iPanicDetails.AppendL(tpd);
+			}
+		t.Close();
+		}
+	}
+	
+	
+CTestWatcher::~CTestWatcher()
+	{
+	iWorker.Close();
+	for (TInt i = 0; i<iSharedData->iPanicDetails.Count();i++)
+		{
+		delete iSharedData->iPanicDetails[i];
+		}
+	iSharedData->iPanicDetails.Close();
+	delete iSharedData;
+	}
+
+CTestWatcher* CTestWatcher::NewL()
+	{
+	CTestWatcher* tw = new (ELeave) CTestWatcher();
+	CleanupStack::PushL(tw);
+	tw->ConstructL();
+	CleanupStack::Pop(tw);
+	return tw;
+	}
+	
+void CTestWatcher::ConstructL() 
+	{
+	iSharedData = new CSharedData();
+	_LIT(KUndertakerWatcher,"UndertakerWatcher");
+	User::LeaveIfError(iWorker.Create(KUndertakerWatcher(),ThreadFunc,KDefaultStackSize,&User::Heap(),iSharedData,EOwnerProcess));
+	iWorker.SetPriority(EPriorityAbsoluteForeground);
+	}
+
+void CTestWatcher::StartL()
+	{
+	TRequestStatus status = KRequestPending;
+	iWorker.Rendezvous(status); 
+	iWorker.Resume();
+	User::WaitForRequest(status);// wait for it to have initialized the undertaker.
+	User::LeaveIfError(status.Int());
+	}
+	
+void CTestWatcher::Stop()
+	{
+	iWorker.Suspend();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/bwins/tefunitteu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewServer@@YAHXZ @ 1 NONAME ; int NewServer(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2005-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:  
+// Component description file
+//
+
+PRJ_EXPORTS
+..\inc\tefunit.h		\epoc32\include\test\tefunit.h
+..\inc\tefunit.inl		\epoc32\include\test\tefunit.inl
+..\inc\cteflogger.h		\epoc32\include\test\cteflogger.h
+..\inc\ctefunitserver.h		\epoc32\include\test\ctefunitserver.h
+
+PRJ_MMPFILES
+tefunit.mmp
+
+PRJ_TESTMMPFILES
+//tefunitte.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/group/tefunit.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+#include "../../group/testexecute.cfg"
+
+TARGET			tefunit.lib
+TARGETTYPE		lib
+UID				0
+
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH		../src
+SOURCE			crunner.cpp
+SOURCE			ctefunitserver.cpp
+SOURCE			ctestbase.cpp
+SOURCE			ctestcase.cpp
+SOURCE			ctestcommand.cpp
+SOURCE			ctestconfig.cpp
+SOURCE			ctestfixture.cpp
+SOURCE			ctestsuite.cpp
+SOURCE			cteflogger.cpp
+SOURCE			cactivetestfixture.cpp
+
+USERINCLUDE		../inc
+
+
+VENDORID 0x70000001
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/group/tefunitte.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+#include "../../group/testexecute.cfg"
+TARGET			tefunitte.exe
+TARGETTYPE		exe
+UID		0x100039CE 0x101F777C
+
+
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH		../test/src
+SOURCE			ctestsuitea.cpp
+SOURCE			ctestsuiteassert.cpp
+SOURCE			ctestsuiteb.cpp
+SOURCE			ctestsuitec.cpp
+SOURCE			ctestsuited.cpp
+SOURCE			ctestasyncsuitea.cpp
+SOURCE			ctestasyncsuiteassert.cpp
+SOURCE			t_testtefunit.cpp
+SOURCE			samplestep.cpp
+
+USERINCLUDE		../test/inc
+USERINCLUDE		../inc
+
+STATICLIBRARY		tefunit.lib
+LIBRARY			euser.lib
+LIBRARY			testexecuteutils.lib
+LIBRARY			efsrv.lib
+LIBRARY			testexecutelogclient.lib
+LIBRARY			testexecutepipslogclient.lib
+LIBRARY			rfileloggerclient.lib
+
+#if (!defined WINS) && (!defined TEF_LITE_VERSION)
+LIBRARY			estlib.lib 
+#endif
+
+VENDORID 0x70000001
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/crunner.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CRunner.h
+*/
+
+#ifndef __RUNNER__
+#define __RUNNER__
+
+#include <e32base.h>
+
+#include "tefunit.h"
+
+class CPath
+	{
+public:
+	CPath();
+	void ConstructL( const TDes& aPath);
+	static CPath* NewL( TDes& aPath );
+	~CPath();
+	TTestName Current() const;
+	TTestName NextL();
+	TInt Count() const;
+	TInt Remaining() const;
+
+private:
+	RArray<TTestName>	iFields;
+	TInt				iCurrent;
+	};
+
+class CRunner : public CBase, public MVisitor
+	{
+public: 
+	CRunner( const CTestConfig& aConfig, const CTestExecuteLogger& aLogger);
+	virtual ~CRunner();
+	void ConstructL( const TTestPath& aPath );
+	static CRunner* NewL( const TTestPath &aPath, const CTestConfig& aConfig, const CTestExecuteLogger& aLogger );
+	virtual void VisitL(CTestCase* aTestCase);
+	virtual void VisitL(CTestSuite* aTestSuite);
+private:
+	CPath				iPath;
+	CTestConfig			iConfig;
+	CTestExecuteLogger	iLogger;
+	};
+
+#endif // __RUNNER__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/cteflogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTEFLogger.h
+*/
+
+#ifndef __TEF_LOGGER__
+#define __TEF_LOGGER__
+
+#include <e32base.h>
+#include <test/testexecutelogger.h>
+
+class CTEFLogger
+/**
+@internalComponent
+@test
+*/
+	{
+public:
+	static void LogResult( const TDesC& aTestName, TInt aResult, CTestExecuteLogger& aLogger );
+	static void LogTraverse( const TDesC& aSuiteName, CTestExecuteLogger& aLogger );
+	};
+
+#endif // __TEF_LOGGER__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/ctefunitserver.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTEFUnitServer.h
+*/
+
+#ifndef __TEF_UNIT_SERVER_H__
+#define __TEF_UNIT_SERVER_H__
+
+#include <test/testexecuteserverbase.h>
+#include <test/tefunit.h>
+const TInt KMinTEFUnitStepNameSize=8;
+
+class CTEFUnitServer : public CTestServer
+	{
+/**
+@internalComponent
+@test
+*/
+public:
+	virtual ~CTEFUnitServer();
+	static CTEFUnitServer* NewL();
+	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
+	RFs& Fs(){return iFs;};
+
+private:
+	RFs iFs;
+	CTestSuite*	iSuite;
+	};
+
+#endif // __TEF_UNIT_SERVER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/ctestcommand.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestCommand.h
+*/
+
+#ifndef __TEST_COMMAND__
+#define __TEST_COMMAND__
+
+#include <test/testexecuteserverbase.h>
+#include "tefunit.h"
+
+class CTestCommand : public CTestStep
+	{
+public:
+	CTestCommand( const TDes& aStepPath, CTestSuite* aSuite );
+	~CTestCommand();
+
+	virtual TVerdict doTestStepL();
+
+private:
+	CTestSuite*	iSuite;
+	TTestPath	iStepPath;
+	};
+
+#endif // __TEST_COMMAND__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/tefunit.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TEFUnit.h
+*/
+
+#ifndef __TEF_UNIT__
+#define __TEF_UNIT__
+
+#include <e32std.h>
+#include <test/testexecutestepbase.h>
+#include <test/cteflogger.h>
+
+/*********************************************************************************
+ * Assert Macros
+ *********************************************************************************/
+#define __ASSERT_SHARED(aFunction, aMessage) \
+	if(!aFunction) \
+		{ \
+		Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrAll, aMessage );\
+		User::Leave(KErrTEFUnitFail);\
+		}
+
+#define ASSERT_EQUALS(aExpected, aActual) \
+	__ASSERT_SHARED(AssertEquals(aExpected, aActual) , KTEFAssertFailedEquals);
+
+#define ASSERT_NULL(aPtr) \
+	__ASSERT_SHARED(AssertNull(aPtr), KTEFAssertFailedNull);
+
+#define ASSERT_NOT_NULL(aPtr) \
+	__ASSERT_SHARED(!AssertNull(aPtr), KTEFAssertFailedNotNull);
+
+#define ASSERT_SAME(aExpectedPtr, aActualPtr) \
+	__ASSERT_SHARED(AssertSame(aExpectedPtr, aActualPtr), KTEFAssertFailedSame);
+
+#define ASSERT_NOT_SAME(aExpectedPtr, aActualPtr) \
+	__ASSERT_SHARED(!AssertSame(aExpectedPtr, aActualPtr), KTEFAssertFailedNotSame);
+
+#define ASSERT_TRUE(aCondition) \
+	__ASSERT_SHARED(AssertTrue(aCondition), KTEFAssertFailedTrue);
+
+#define ASSERT_FALSE(aCondition) \
+	__ASSERT_SHARED(!AssertTrue(aCondition), KTEFAssertFailedFalse);
+
+/*********************************************************************************
+ * CTestConfig class
+ *********************************************************************************/
+
+class CTestConfig
+/**
+@publishedPartner
+@test
+*/
+	{
+public:
+	CTestConfig();
+	CTestConfig(const CTestConfig& aTestConfig );
+	CTestConfig( CTestStep* aTestStep );
+	~CTestConfig();
+
+	TBool GetBool(const TDesC& aSectionName, const TDesC& aKey, TBool& aResult) const;
+	TBool GetInt(const TDesC& aSectionName, const TDesC& aKey, TInt& aResult) const;
+	TBool GetHex(const TDesC& aSectionName, const TDesC& aKey, TInt& aResult) const;
+	TBool GetString(const TDesC& aSectionName, const TDesC& aKey, TPtrC& aResult) const;
+
+	// Use the section name passed in via the script
+	TBool GetBool(const TDesC& aKey, TBool& aResult) const;
+	TBool GetInt(const TDesC& aKey, TInt& aResult) const;
+	TBool GetHex(const TDesC& aKey, TInt& aResult) const;
+	TBool GetString(const TDesC& aKey, TPtrC& aResult) const;
+
+	TBool WriteBool(const TDesC& aSectionName, const TDesC& aKey, TBool& aValue) const;
+	TBool WriteInt(const TDesC& aSectionName, const TDesC& aKey, TInt& aValue) const;
+	TBool WriteHex(const TDesC& aSectionName, const TDesC& aKey, TInt& aValue) const;
+	TBool WriteString(const TDesC& aSectionName, const TDesC& aKey, TPtrC& aValue) const;
+
+	// Use the section name passed in via the script
+	TBool WriteBool(const TDesC& aKey, TBool& aValue) const;
+	TBool WriteInt(const TDesC& aKey, TInt& aValue) const;
+	TBool WriteHex(const TDesC& aKey, TInt& aValue) const;
+	TBool WriteString(const TDesC& aKey, TPtrC& aValue) const;
+	
+	TBool GetInt(const TDesC& aSectionName, const TDesC& aKey, TInt64& aResult) const;
+	TBool GetInt(const TDesC& aKey, TInt64& aResult) const;
+	TBool WriteInt(const TDesC& aSectionName, const TDesC& aKey, TInt64& aValue) const;
+	TBool WriteInt(const TDesC& aKey, TInt64& aValue) const;
+		
+private:
+	CTestStep*	iTestStep;
+	};
+
+
+/*********************************************************************************
+ * CTestFixture class
+ *********************************************************************************/
+	
+class CTestFixture : public CBase
+/**
+@publishedPartner
+@test
+*/
+	{
+public:
+	virtual	~CTestFixture();
+
+	virtual void SetupL();
+	virtual void TearDownL();
+	
+	void SetConfigL(CTestConfig& aConfig);
+	void SetLoggerL( CTestExecuteLogger& aLogger );
+	inline CTestExecuteLogger& Logger() { return iLogger; }
+
+protected:
+	CTestConfig			iConfig;
+	CTestExecuteLogger	iLogger;
+	};
+
+/*********************************************************************************
+ * CActiveTestFixture class
+ *********************************************************************************/
+ 
+class CActiveTestFixture : public CTestFixture
+/**
+@publishedPartner
+@test
+*/
+	{
+public:
+	virtual	~CActiveTestFixture();
+	virtual void SetupL();
+	virtual void TearDownL();
+ 	// Construct the active environment
+ 	virtual void ConstructEnvL();
+ 	// Destroy the active environment
+ 	virtual void DestroyEnvL();
+ 	// Start the active environnment
+   	virtual void StartEnvL();
+ 	// Stop the active environnment
+   	virtual void StopEnvL();
+	CActiveScheduler* iSched;
+	};
+
+class CTestCase;
+class CTestSuite;
+
+/*********************************************************************************
+ * MVisitor class
+ *********************************************************************************/
+class MVisitor
+	{
+public: 
+	virtual void VisitL(CTestCase* aTestCase) = 0;
+	virtual void VisitL(CTestSuite* aTestSuite) = 0;
+	};
+
+
+const TInt KMaxTestName = 256;
+typedef TBuf<KMaxTestName> TTestName;
+
+const TInt KMaxPathSize = KMaxTestName*10;
+typedef TBuf<KMaxPathSize> TTestPath;
+
+/*********************************************************************************
+ * CTestBase class
+ *********************************************************************************/
+class CTestBase : public CBase
+	{
+public:
+	CTestBase(const TTestName &aName); 
+	virtual ~CTestBase();
+		
+	const TTestName& Name() const; 
+	virtual void RunL(CTestConfig& aConfig, CTestExecuteLogger& aLogger) = 0;
+	virtual void AcceptL(MVisitor &aVisitor) = 0;
+	
+protected: 
+	TTestName iName; 
+	};
+
+
+/*********************************************************************************
+ * CTestCase class
+ *********************************************************************************/
+class CTestCase : public CTestBase
+	{
+public:
+	CTestCase(const TTestName& aName);
+	virtual ~CTestCase(); 
+
+	virtual void RunL(CTestConfig& aConfig, CTestExecuteLogger& aLogger) = 0;
+	virtual void AcceptL(MVisitor &aVisitor);
+	};
+
+/*********************************************************************************
+ * Test Suite Macros
+ *********************************************************************************/
+#define START_SUITE \
+	CTestSuite* lTestSuite = CTestSuite::NewL();
+
+#define SUB_SUITE \
+	CTestSuite* lTestSuite = CTestSuite::NewL(aName);
+
+#define END_SUITE \
+	return lTestSuite;
+//PDEF115446 start
+// By adding a condition marco to reconginize different compiler
+#ifndef __GCCXML__
+	// this means using gcc or armcc or mwccsym2 
+	#define ADD_TEST_STEP(name) \
+		_LIT( KTest ## name, #name); \
+		AddTestCase(lTestSuite, KTest ## name, &name);
+	
+	#define ADD_ASYNC_TEST_STEP(name) \
+		_LIT( KTest ## name, #name); \
+		AddAsyncTestCase(lTestSuite, KTest ## name, &name);
+#endif
+#ifdef __GCCXML__
+	// this means using gccxml
+	// GCCXML compiler NOT use ADD_TEST_STEP 
+	// Please use 2 parameter Macro ADD_(ASYNC)_TEST_STEP_CLASS	 
+#endif
+	
+//PDEF115446
+//new version marco
+//For both GCCXML and Non-GCCXML compiler
+#define ADD_TEST_STEP_CLASS(classname, callback) \
+    _LIT( KTest ## callback, #callback);\
+    AddTestCase(lTestSuite, KTest ## callback, & classname::callback);
+
+#define ADD_ASYNC_TEST_STEP_CLASS(classname, callback) \
+    _LIT( KTest ## callback, #callback);\
+    AddAsyncTestCase (lTestSuite, KTest ## callback, & classname::callback);
+//PDEF115446 end
+	
+#define ADD_TEST_SUITE(name) \
+	_LIT( KTest ## name, #name); \
+	lTestSuite->AddL( name::CreateSuiteL( KTest##name));
+
+
+/*********************************************************************************
+ * CTestSuite class
+ *********************************************************************************/
+
+class CTestSuite : public CTestBase
+/**
+@publishedPartner
+@test
+*/
+	{
+public: 
+	CTestSuite(const TTestName& aName);
+	CTestSuite(CTestSuite &rhs);
+	void ConstructL();
+	static CTestSuite* NewL();
+	static CTestSuite* NewL(const TTestName& aName);
+	virtual ~CTestSuite();
+		
+	// Add a test to the suite
+	virtual void AddL(CTestBase* aTest);
+
+	// Run all the tests in the suite
+	virtual void RunL(CTestConfig& aConfig, CTestExecuteLogger& aLogger);
+
+	virtual void AcceptL(MVisitor &aVisitor);
+
+	TInt Count();
+	TTestName NameL( TInt anIndex );
+	CTestBase*	TestL( TInt anIndex );
+
+private:
+	RPointerArray<CTestBase>	iTests;
+	TInt iError;
+	};
+
+
+/*********************************************************************************
+ * CTestCaseTemplate class
+ *********************************************************************************/
+template <class Fixture>
+class CTestCaseTemplate : public CTestCase
+	{
+private:
+	typedef void (Fixture::*TestMethod)();
+	
+public:
+	CTestCaseTemplate(const TDesC &aName, TestMethod aTestMethod );
+	virtual ~CTestCaseTemplate();
+
+	virtual void RunL(CTestConfig& aConfig, CTestExecuteLogger& aLogger);
+
+protected:
+	TestMethod	iTest;
+	};
+
+/*********************************************************************************
+ * CActiveTester class
+ *********************************************************************************/
+const TInt KNumberOfDelays = 3;
+
+template <class Fixture>
+class CActiveTester : public CTimer
+	{
+private:
+	typedef void (Fixture::*TestMethod)();
+
+public:
+	CActiveTester(Fixture* aFixture, TestMethod aTestMethod, TTimeIntervalMicroSeconds32 /*aDelays[KNumberOfDelays]*/ );
+	virtual ~CActiveTester();
+
+	virtual void RunL();
+	virtual TInt RunError(TInt /*aError*/);
+	TInt Error();
+	virtual void ConstructEnvL();
+	void DestroyEnvL();
+	void StartEnvL();
+	void SetLoggerL(CTestExecuteLogger& aLogger);
+	void SetConfigL(CTestConfig& aConfig);
+
+protected:
+	enum TTestState
+		{
+		EConstruct = 0,
+		ERunTest,
+		EDestroy,
+		EExit
+		};
+
+	TTestState					iState;
+	Fixture*					iFixture;
+	TestMethod					iTest;
+	TTimeIntervalMicroSeconds32	iDelays[KNumberOfDelays];
+	TInt						iError;
+	};
+
+
+/*********************************************************************************
+ * CAsyncTestCase class
+ *********************************************************************************/
+template <class Fixture>
+class CAsyncTestCase : public CTestCase
+	{
+private:
+	typedef void (Fixture::*TestMethod)();
+
+public:
+	CAsyncTestCase(const TDesC &aName, TestMethod aTestMethod );
+	virtual ~CAsyncTestCase();
+
+	virtual void RunL(CTestConfig& aConfig, CTestExecuteLogger& aLogger);
+
+protected:
+	TestMethod iTest;
+	};
+
+#include <test/tefunit.inl>
+
+#endif // __TEF_UNIT__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/inc/tefunit.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,420 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TEFUnit.inl
+*/
+
+
+#if !(defined TEF_LITE)
+#include <basched.h>
+#endif
+
+template <class T>
+inline TBool AssertEquals(const T& aExpected, const T& aActual)
+/**
+ * AssertEquals
+ *
+ * @publishedPartner
+ * @test
+ *
+ * @param aExpected - Expected result
+ * @param aActual - Actual result
+ * @return - True if equal
+ */
+	{
+	if( aExpected==aActual )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+template <class T>
+inline TBool AssertNull(const T* aPtr)
+/**
+ * AssertNull
+ *
+ * @publishedPartner
+ * @test
+ *
+ * @param aPtr - Pointer
+ * @return - True if NULL
+ */
+	{
+	if( aPtr==NULL )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+template <class T>
+inline TBool AssertSame(const T* aExpectedPtr, const T* aActualPtr)
+/**
+ * AssertSame
+ *
+ * @publishedPartner
+ * @test
+ *
+ * @param aExpectedPtr - Expected pointer
+ * @param aActualPtr - Actual pointer
+ * @return - True if equal
+ */
+	{
+	if( aExpectedPtr==aActualPtr )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+inline TBool AssertTrue(const TBool& aCondition)
+/**
+ * AssertTrue
+ *
+ * @publishedPartner
+ * @test
+ *
+ * @param aCondition - Condition
+ * @return - True if aCondition is true
+ */
+	{
+	if( !aCondition )
+		{
+		return EFalse;
+		}
+	return ETrue;
+	}
+	
+	
+template<class Fixture>
+inline void AddTestCase(CTestSuite* aTestSuite, const TDesC& aName, void (Fixture::*aTestMethod)())
+/**
+ * AddTestCase
+ *
+ * @param aTestSuite - CTestSuite
+ * @param aName - Test name
+ * @param aTestMethod - Test method within the fixture
+ */
+	{
+	CTestCaseTemplate<Fixture> *testCaseTemplate = new (ELeave) CTestCaseTemplate<Fixture>(aName, aTestMethod);
+	CleanupStack::PushL(testCaseTemplate);
+	aTestSuite->AddL( testCaseTemplate );
+	CleanupStack::Pop(testCaseTemplate);
+	}
+
+template<class Fixture>
+inline void AddAsyncTestCase(CTestSuite* aTestSuite, const TDesC& aName, void (Fixture::*aTestMethod)())
+/**
+ * AddAsyncTestCase
+ *
+ * @param aTestSuite - CTestSuite
+ * @param aName - Test name
+ * @param aTestMethod - Test method within the active fixture
+ */
+	{
+	CAsyncTestCase<Fixture> *asyncTestCase = new (ELeave) CAsyncTestCase<Fixture>(aName, aTestMethod);
+	CleanupStack::PushL(asyncTestCase);
+	aTestSuite->AddL( asyncTestCase );
+	CleanupStack::Pop(asyncTestCase);
+	}
+
+template <class Fixture>
+inline CTestCaseTemplate<Fixture>::CTestCaseTemplate(const TDesC &aName, TestMethod aTestMethod )
+/**
+ * Constructor
+ *
+ * @param aName - Test name
+ * @param aTestMethod - Test method
+ */
+	: CTestCase(aName), iTest(aTestMethod)
+	{
+	}
+
+template <class Fixture>
+inline CTestCaseTemplate<Fixture>::~CTestCaseTemplate()
+/**
+ * Destructor
+ */
+	{
+	}
+
+template <class Fixture>
+inline void CTestCaseTemplate<Fixture>::RunL(CTestConfig& aConfig, CTestExecuteLogger& aLogger)
+/**
+ * RunL
+ *
+ * @param aConfig - Test configuration
+ * @param aLogger - Test logger
+ */
+	{
+	Fixture* iFixture = new (ELeave) Fixture();
+	CleanupStack::PushL(iFixture);
+	
+	// Must set the Logger and Config now
+	iFixture->SetLoggerL( aLogger );
+	iFixture->SetConfigL( aConfig );
+	
+	// Setup code
+	iFixture->SetupL();
+	
+	// Run the test
+	TRAPD( err, (iFixture->*iTest)() );
+
+	// Log the result
+	CTEFLogger::LogResult( iName, err, aLogger );
+
+	// Now the test case has been logged we need to leave
+	// again if that is what the test did
+	if( err != KErrTEFUnitPass )
+		{
+		User::Leave(err);
+		}
+
+	// Teardown code
+	iFixture->TearDownL();
+
+	CleanupStack::PopAndDestroy();
+	}
+
+template <class Fixture>
+inline CActiveTester<Fixture>::CActiveTester(Fixture* aFixture, TestMethod aTestMethod, TTimeIntervalMicroSeconds32 /*aDelays[KNumberOfDelays]*/ )
+/**
+ * Constructor
+ *
+ * @param aFixture - Test fixture
+ * @param aTestMethod - Test method within the fixture
+ */
+	:	CTimer(EPriorityStandard), iState(EConstruct), iFixture(aFixture),
+		iTest(aTestMethod), iError(KErrTEFUnitPass)
+	{
+	for( TInt i=0 ; i<KNumberOfDelays ; i++ )
+		{
+		iDelays[i] = 1;
+		}
+	}
+
+template <class Fixture>
+inline CActiveTester<Fixture>::~CActiveTester()
+/**
+ * Destructor
+ */
+	{
+	}
+
+template <class Fixture>
+inline void CActiveTester<Fixture>::RunL()
+/**
+ * RunL
+ */
+	{
+	switch( iState )
+		{
+		case EConstruct:
+			// Run generic startup code - delegate to the fixture
+			iFixture->SetupL();
+			iState = ERunTest;
+			After( iDelays[0] );
+			break;
+		case ERunTest:
+			// Run the test - delegate to the fixture
+			(iFixture->*iTest)();
+			iState = EDestroy;
+			After( iDelays[1] );
+			break;
+		case EDestroy:
+			// Run generic teardown code - delegate to the fixture
+			iFixture->TearDownL();
+			iState = EExit;
+			After( iDelays[2] );
+			break;
+		case EExit:
+			// Stop the Active Scheduler, test complete - delegate to the fixture
+			iFixture->StopEnvL();
+			return;
+		default:
+			break;
+		}
+	}
+
+template <class Fixture>
+inline TInt CActiveTester<Fixture>::RunError(TInt aError)
+/**
+ * RunError
+ *
+ * @return - Error
+ */
+	{
+	if (aError != KErrNone)
+		{
+		#if !(defined TEF_LITE)	
+		if(aError != KLeaveExit)
+			{
+		#endif
+			iError = KErrTEFUnitFail;
+			// Run generic teardown code - delegate to the fixture
+			iFixture->TearDownL();
+			// Stop the ActiveScheduler - delegate to the fixture
+			iFixture->StopEnvL();
+			return KErrNone;
+		#if !(defined TEF_LITE)
+			}
+		else
+			{
+			return aError;
+			}
+		#endif
+		}
+	else
+		{
+		return aError;
+		}
+	}
+
+template <class Fixture>
+inline TInt CActiveTester<Fixture>::Error()
+/**
+ * Error
+ *
+ * @return - Error
+ */
+	{
+	return iError;
+	}
+
+template <class Fixture>
+inline void CActiveTester<Fixture>::ConstructEnvL()
+/**
+ * ConstructEnvL
+ */
+	{
+	CTimer::ConstructL();
+	// Delegate to the fixture
+	iFixture->ConstructEnvL();
+	}
+
+template <class Fixture>
+inline void CActiveTester<Fixture>::DestroyEnvL()
+/**
+ * DestroyEnvL
+ */
+	{
+	// Delgate to the fixture
+	iFixture->DestroyEnvL();
+	}
+
+template <class Fixture>
+inline void CActiveTester<Fixture>::StartEnvL()
+/**
+ * StartEnvL
+ */
+	{
+	After( iDelays[0] );
+	// Delegate to the fixture
+	iFixture->StartEnvL();
+	}
+
+template <class Fixture>
+inline void CActiveTester<Fixture>::SetLoggerL(CTestExecuteLogger& aLogger)
+/**
+ * SetLoggerL
+ *
+ * @param aLogger - Test logger
+ */
+	{
+	// Delegate to the fixture
+	iFixture->SetLoggerL(aLogger);
+	}
+
+template <class Fixture>
+inline void CActiveTester<Fixture>::SetConfigL(CTestConfig& aConfig)
+/**
+ * SetConfigL
+ *
+ * @param aConfig - test configuration
+ */
+	{
+	// Delegate to the fixture
+	iFixture->SetConfigL(aConfig);
+	}
+
+
+template <class Fixture>
+inline CAsyncTestCase<Fixture>::CAsyncTestCase(const TDesC &aName, TestMethod aTestMethod )
+/**
+ * Constructor
+ *
+ * @param aName - Test name
+ * @param aTestMethod - Test method within the fixture
+ */
+	: CTestCase(aName), iTest(aTestMethod)
+	{
+	}
+
+template <class Fixture>
+inline CAsyncTestCase<Fixture>::~CAsyncTestCase()
+/**
+ * Destructor
+ */
+	{
+	}
+
+template <class Fixture>
+inline void CAsyncTestCase<Fixture>::RunL(CTestConfig& aConfig, CTestExecuteLogger& aLogger)
+/**
+ * RunL
+ *
+ * @param aConfig - Test configuration
+ * @param aLogger - Test logger
+ */
+	{
+	// Create the active Object
+	Fixture *fixture = new (ELeave) Fixture();
+	CleanupStack::PushL(fixture);
+	CActiveTester<Fixture>* tester = new (ELeave) CActiveTester<Fixture>(fixture, iTest, 0);
+	CleanupStack::PushL(tester);
+
+	// Set the Logger and Config now
+	tester->SetLoggerL( aLogger );
+	tester->SetConfigL( aConfig );
+
+	// Create the Active Scheduler Environment
+	tester->ConstructEnvL();
+
+	// Add the ActiveObject which has the test fixture
+	CActiveScheduler::Add( tester );
+
+	// Start the ActiveSheduler
+	tester->StartEnvL();
+
+	// When complete Teardown
+	tester->DestroyEnvL();
+
+	// Log the result
+	CTEFLogger::LogResult( iName, tester->Error(), aLogger );
+
+	// If an error was returned from the ActiveTester Leave here
+	if( tester->Error() != KErrTEFUnitPass )
+		{
+		User::Leave( tester->Error() );
+		}
+
+	CleanupStack::PopAndDestroy(2, fixture);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/cactivetestfixture.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CActiveTestFixture.cpp
+*/
+
+#include "tefunit.h"
+
+CActiveTestFixture::~CActiveTestFixture()
+/**
+ * Destructor
+ */
+	{
+	}
+
+void CActiveTestFixture::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CActiveTestFixture::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CActiveTestFixture::ConstructEnvL()
+/**
+ * ConstructEnvL
+ */
+	{
+	// Construct a new ActiveScheduler and install it
+	iSched = new (ELeave) CActiveScheduler();
+	CActiveScheduler::Install(iSched);
+	}
+
+void CActiveTestFixture::DestroyEnvL()
+/**
+ * DestroyEnvL
+ */
+	{
+	delete iSched;
+	iSched = NULL;
+	}
+
+void CActiveTestFixture::StartEnvL()
+/**
+ * StartEnvL
+ */
+	{
+	// Start the ActiveScheduler
+	CActiveScheduler::Start();
+	}
+
+void CActiveTestFixture::StopEnvL()
+/**
+ * StopEnvL
+ */
+	{
+	// Stop the ActiveScheduler
+	CActiveScheduler::Stop();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/crunner.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,240 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CRunner.cpp
+*/
+
+
+#include "cteflogger.h"
+#include "crunner.h"
+
+_LIT( KWildCard, "*"); 
+
+CRunner::CRunner( const CTestConfig& aConfig, const CTestExecuteLogger& aLogger)
+/**
+ * Constructor
+ *
+ * @param aConfig - Instance of the test config
+ * @param aLogger - Instance of the logger
+ */
+	: iConfig(aConfig), iLogger(aLogger)
+	{
+	}
+
+CRunner::~CRunner()
+/**
+ *	Destructor
+ */
+	{
+	}
+
+void CRunner::ConstructL( const TTestPath& aPath )
+/**
+ * ConstructL
+ *
+ * @param aPath - The path of the test case to be executed
+ */
+	{
+	iPath.ConstructL( aPath );
+	}
+
+/*
+ *	NewL
+ *    Return an instance of CRunner
+ */
+CRunner* CRunner::NewL( const TTestPath &aPath, const CTestConfig& aConfig, const CTestExecuteLogger& aLogger )
+/**
+ * NewL
+ *
+ * @param aPath - The path of the test case to be executed
+ * @param aConfig - Instance of the test config
+ * @param aLogger - Instance of the logger
+ * @return - Instance of CRunner
+ */
+	{
+	CRunner* lRunner = new (ELeave) CRunner(aConfig, aLogger); 
+	CleanupStack::PushL(lRunner); 
+	lRunner->ConstructL(aPath);
+	CleanupStack::Pop(); 
+	return lRunner; 
+	}
+
+void CRunner::VisitL(CTestCase* aTestCase)
+/**
+ * VisitL
+ *
+ * @param aTestCase - The test case to visit
+ */
+	{
+	aTestCase->RunL(iConfig, iLogger);
+	}
+
+void CRunner::VisitL(CTestSuite* aTestSuite)
+/**
+ * VisitL
+ *
+ * @param aTestSuite - The test suite to visit
+ */
+	{
+	// Get the next field from the path and search for it
+	if( iPath.Remaining() )
+		{
+		TTestName testSuite = iPath.NextL();
+		if( testSuite == KWildCard )
+			{
+			// Run all the tests in the suite and sub suites
+			aTestSuite->RunL( iConfig, iLogger );
+			}
+		else
+			{
+			TInt lIndex = 0;
+			while( (lIndex < aTestSuite->Count()) &&
+					(aTestSuite->NameL(lIndex)!=iPath.Current()) )
+				{
+				lIndex++;
+				}
+			if( (lIndex < aTestSuite->Count()) &&
+					(aTestSuite->NameL(lIndex)==iPath.Current()) )
+				{
+				// Log that the runner is currently in this suite
+				CTEFLogger::LogTraverse( aTestSuite->Name(), iLogger );
+				aTestSuite->TestL( lIndex )->AcceptL( *this );
+				}
+			else
+				{
+				User::Leave(KErrTEFUnitTestSuiteError);
+				}
+			}
+		}
+	else
+		{
+		// Run all the tests in the suite and sub suites
+		aTestSuite->RunL( iConfig, iLogger );
+		}
+	}
+
+CPath::CPath()
+/**
+ * Constructor
+ */
+	: iCurrent(0)
+	{
+	}
+
+void CPath::ConstructL( const TDes& aPath )
+/**
+ * ConstructL
+ *
+ * @param aPath - The path to be parsed
+ */
+	{
+	// Prepend a NULL field for the top level suite
+	User::LeaveIfError(	iFields.Append(_L("NULL")) );
+	HBufC* ptrPath = HBufC::NewLC(KMaxPathSize);
+	TPtr ptr(ptrPath->Des());
+	ptr.Copy(aPath);
+	// Populate the path fields array
+	TInt offset = ptr.Locate( '.' );
+	while( offset != KErrNotFound )
+		{
+		TTestName field;
+		field.Append( ptr.Ptr(), offset );
+		User::LeaveIfError(	iFields.Append(field) );
+		ptr.Delete( 0, offset+1 );
+		offset = ptr.Locate( '.' );
+		}
+	// There will be one more field
+	TTestName field;
+	field.Append( ptrPath->Ptr(), ptrPath->Size()/2 );
+	CleanupStack::PopAndDestroy(ptrPath);
+	User::LeaveIfError(	iFields.Append(field) );
+	}
+
+/*
+ *	NewL
+ *    Return an instance of CPath
+ */
+CPath* CPath::NewL( TDes& aPath )
+/**
+ * NewL
+ *
+ * @param aPath - The path to be parsed
+ * @return - Instance of CPath
+ */
+	{
+	CPath* lPath = new (ELeave) CPath();
+	CleanupStack::PushL(lPath);
+	lPath->ConstructL(aPath);
+	CleanupStack::Pop();
+	return lPath;
+	}
+
+CPath::~CPath()
+/**
+ * Destructor
+ */
+	{
+	iFields.Close();
+	}
+
+TTestName CPath::Current() const
+/**
+ * Current
+ *
+ * @return - The current field within the path
+ */
+	{
+	return iFields[iCurrent];
+	}
+
+TTestName CPath::NextL()
+/**
+ * NextL
+ *
+ * @return - The next field in the path
+ */
+	{
+	if( iCurrent>(iFields.Count()-2) )
+		{
+		User::Leave(KErrTEFUnitFail);
+		}
+
+	return iFields[++iCurrent];
+	}
+
+TInt CPath::Count() const
+/**
+ * Count
+ *
+ * @return - The number of fields in the path
+ */
+	{
+	return iFields.Count();	
+	}
+
+TInt CPath::Remaining() const
+/**
+ * Remaining
+ *
+ * @return - The number of remaining fields from the current location in the path
+ */
+	{
+	return (iFields.Count()-1)-iCurrent;	
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/cteflogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTEFLogger.cpp
+*/
+
+#include "cteflogger.h"
+#include "tefunit.h"
+
+void CTEFLogger::LogResult( const TDesC& aTestName, TInt aResult, CTestExecuteLogger& aLogger )
+/**
+ * LogResult
+ *
+ * @param aTestName - Name of the test case
+ * @param aResult - Result of the test
+ * @param aLogger - The logger
+ */
+	{
+	// Log the test case result in the correct colour
+	HBufC* resultBuffer = HBufC::NewLC(KMaxTestExecuteCommandLength*3);
+	TPtr ptr(resultBuffer->Des());
+
+	TFullName serverName;
+	TFindServer htmServerFinder( KTestExecuteLogServerName );
+	TInt errCode = htmServerFinder.Next( serverName );
+	
+	if ( errCode != KErrNotFound )
+		{
+		// Set the result text colour
+		switch(aResult)
+			{
+			case KErrTEFUnitPass:
+				{
+				ptr.Append(KTEFFontGreen);
+				}
+				break;
+			case KErrTEFUnitFail:
+				{
+				ptr.Append(KTEFFontRed);
+				}
+				break;
+			default:
+				{
+				ptr.Append(KTEFFontBlue);
+				}
+				break;
+			}
+
+		// Append the test case name
+		ptr.AppendFormat( _L("Test Case") );
+		ptr.Append(KTEFSpace);
+		ptr.Append( aTestName );
+		ptr.Append(KTEFSpace);
+		ptr.AppendFormat( KTEFResultTag );
+		ptr.Append(KTEFSpace);
+		ptr.Append( KTEFEquals );
+		ptr.Append(KTEFSpace);
+
+		// Append the test result
+		switch(aResult)
+			{
+			case KErrTEFUnitPass:
+				{
+				ptr.Append(KTEFResultPass);
+				}
+				break;
+			case KErrTEFUnitFail:
+				{
+				ptr.Append(KTEFResultFail);
+				}
+				break;
+			case KErrTEFUnitInconclusive:
+				{
+				ptr.Append(KTEFResultInconclusive);
+				}
+				break;
+			case KErrTEFUnitAbort:
+				{
+				ptr.Append(KTEFResultAbort);
+				}
+				break;
+			default:
+				{
+				ptr.Append(KTEFResultUnknown);
+				}
+				break;
+			}
+
+		ptr.Append(KTEFSpace);
+		ptr.Append(KTEFFontEnd);
+
+		HBufC8* resultBuffer8 = HBufC8::NewLC(ptr.Length()+2);
+		TPtr8 ptr8(resultBuffer8->Des());
+		ptr8.Copy(ptr);
+
+		// Write to the log file
+		aLogger.HtmlLogger().Write(ptr8);
+
+		CleanupStack::PopAndDestroy(resultBuffer8);
+	}
+
+	TFindServer xmlServerFinder( KFileLogrerServerName );
+	errCode = xmlServerFinder.Next( serverName );
+	
+	if ( errCode != KErrNotFound )
+		{
+		// Append the test case name
+		ptr.AppendFormat( _L("Test Case") );
+		ptr.Append(KTEFSpace);
+		ptr.Append( aTestName );
+		ptr.Append(KTEFSpace);
+		ptr.AppendFormat( KTEFResultTag );
+		ptr.Append(KTEFSpace);
+		ptr.Append( KTEFEquals );
+		ptr.Append(KTEFSpace);
+
+		// Append the test result
+		switch(aResult)
+			{
+			case KErrTEFUnitPass:
+				{
+				ptr.Append(KTEFResultPass);
+				}
+				break;
+			case KErrTEFUnitFail:
+				{
+				ptr.Append(KTEFResultFail);
+				}
+				break;
+			case KErrTEFUnitInconclusive:
+				{
+				ptr.Append(KTEFResultInconclusive);
+				}
+				break;
+			case KErrTEFUnitAbort:
+				{
+				ptr.Append(KTEFResultAbort);
+				}
+				break;
+			default:
+				{
+				ptr.Append(KTEFResultUnknown);
+				}
+				break;
+			}
+		aLogger.XmlLogger().Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrTEFUnit, ptr);
+		}
+
+	CleanupStack::PopAndDestroy(resultBuffer);
+	}
+
+
+void CTEFLogger::LogTraverse( const TDesC& aSuiteName, CTestExecuteLogger& aLogger )
+/**
+ * LogTraverse
+ *
+ * @param aSuiteName - Name of the test suite
+ * @param aLogger - The logger
+ */
+	{
+	// Log the test case result in the correct colour
+	HBufC* resultBuffer = HBufC::NewLC(KMaxTestExecuteCommandLength*3);
+	TPtr ptr(resultBuffer->Des());
+
+	TFullName serverName;
+	TFindServer htmServerFinder( KTestExecuteLogServerName );
+	TInt errCode = htmServerFinder.Next( serverName );
+	
+	if ( errCode != KErrNotFound )
+		{
+		// Always blue for suite traversal
+		ptr.Append(KTEFFontLightBlue);
+
+		// Append the test case name
+		ptr.AppendFormat( _L("Entering Test Suite:") );
+		ptr.Append(KTEFSpace);
+		ptr.Append( aSuiteName );
+		ptr.Append(KTEFSpace);
+		ptr.Append(KTEFFontEnd);
+	
+		HBufC8* resultBuffer8 = HBufC8::NewLC(ptr.Length()+2);
+		TPtr8 ptr8(resultBuffer8->Des());
+		ptr8.Copy(ptr);
+
+		// Write to the log file
+		aLogger.HtmlLogger().Write(ptr8);
+
+		CleanupStack::PopAndDestroy(resultBuffer8);
+		}
+
+	TFindServer xmlServerFinder( KFileLogrerServerName );
+	errCode = xmlServerFinder.Next( serverName );
+	
+	if ( errCode != KErrNotFound )
+		{
+		// Append the test case name
+		ptr.AppendFormat( _L("Entering Test Suite:") );
+		ptr.Append(KTEFSpace);
+		ptr.Append( aSuiteName );
+		ptr.Append(KTEFSpace);
+
+		aLogger.XmlLogger().Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrTEFUnit, ptr);
+		}
+	CleanupStack::PopAndDestroy(resultBuffer);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctefunitserver.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2005-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:  
+* Example file/test code to demonstrate how to develop a TestExecute Server
+* Developers should take this project as a template and substitute their own
+* code at the __EDIT_ME__ tags
+* for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
+* in the process of the client. The client initialises the server by calling the
+* one and only ordinal.
+*
+*/
+
+
+
+/**
+ @file CTEFUnitServer.cpp
+*/
+#include "ctefunitserver.h"
+#include "ctestcommand.h"
+#include "tefunit.h"
+
+_LIT(KTEFUnitStepNamePrefix, "tefunit.");
+GLREF_D const TTestName ServerName();
+GLREF_D CTestSuite* CreateTestSuiteL();
+GLREF_D CTestStep* CreateTEFTestStep(const TDesC& aStepName, CTEFUnitServer& aServer);
+
+// __EDIT_ME__ - Use your own server class name
+CTEFUnitServer* CTEFUnitServer::NewL()
+/**
+ * @return - Instance of the test server
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+	{
+	// __EDIT_ME__ new your server class here
+	CTEFUnitServer * server = new (ELeave) CTEFUnitServer();
+	CleanupStack::PushL(server);
+	
+	// Either use a StartL or ConstructL, the latter will permit
+	// Server Logging.
+
+	//server->StartL(ServerName());
+	server->ConstructL(ServerName());
+	server->iSuite = CreateTestSuiteL();
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+CTEFUnitServer::~CTEFUnitServer()
+	{
+	delete iSuite;
+	iSuite = NULL;
+	}
+
+// EKA2 much simpler
+// Just an E32Main and a MainL()
+LOCAL_C void MainL()
+/**
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+	// Leave the hooks in for platform security
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler* sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	// __EDIT_ME__ Your server name
+	CTEFUnitServer* server = NULL;
+	// Create the CTestServer derived server
+	// __EDIT_ME__ Your server name
+	TRAPD(err,server = CTEFUnitServer::NewL());
+	if(!err)
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	delete server;
+	server = NULL;
+	delete sched;
+//	sched = NULL:
+	}
+
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on exit
+ */
+	{
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	cleanup = NULL;
+	return KErrNone;
+    }
+
+// Create a thread in the calling process
+
+// __EDIT_ME__ - Use your own server class name
+CTestStep* CTEFUnitServer::CreateTestStep(const TDesC& aStepName)
+/**
+ * @return - A CTestStep derived instance
+ * Implementation of CTestServer pure virtual
+ */
+	{
+	CTestStep* testStep = NULL;
+
+	TBuf<9> stepNamePrefix;
+	if (aStepName.Length() > KMinTEFUnitStepNameSize)
+		{
+		stepNamePrefix.Copy(aStepName.Mid(0,KMinTEFUnitStepNameSize));
+		stepNamePrefix.LowerCase();
+		}
+
+	// If StepName prefix with TEFUnit. Create a CTestCommand here with the aStepName passed in
+		//   note: aStepName will actually be the path of the the test
+		//         in the suite hirarchy
+	// Else Call Global CreateTEFTestStep() which proceeds with legacy Test Step creation
+		// Refer Example TEFUnitTE test component for implementation
+		// CreateTEFTestStep() should return NULL if TEF steps are not used
+	if (stepNamePrefix.Length() && stepNamePrefix == KTEFUnitStepNamePrefix)
+		{
+		TTestPath aStepPath(aStepName.Mid(KMinTEFUnitStepNameSize));
+		testStep = new CTestCommand( aStepPath, iSuite );
+		}
+	else
+		{
+		testStep = CreateTEFTestStep(aStepName, *this);
+		}
+
+	return testStep;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestbase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestBase.cpp
+*/
+
+#include "tefunit.h"
+
+CTestBase::CTestBase(const TTestName &aName)
+/**
+ * Constructor
+ *
+ * @param aName - The name of the test
+ */
+	: iName(aName)
+	{
+	}
+
+CTestBase::~CTestBase() 
+/**
+ * Destructor
+ */
+	{
+	}
+
+const TTestName& CTestBase::Name() const
+/**
+ * Name
+ *
+ * @return - The name of the test
+ */
+	{
+	return iName;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestcase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestCase.cpp
+*/
+
+#include "tefunit.h"
+
+CTestCase::CTestCase(const TTestName& aName)
+/**
+ * Constructor
+ *
+ * param - The name of the test
+ */
+	: CTestBase(aName)
+	{
+	}
+
+CTestCase::~CTestCase()
+/**
+ * Destructor
+ */
+	{
+	}
+
+void CTestCase::AcceptL(MVisitor &aVisitor)
+/**
+ * AcceptL
+ *
+ * @param aVisitor - Instance of the visitor (runner) to accept
+ */
+	{
+	aVisitor.VisitL(this);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestcommand.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestCommand.cpp
+*/
+
+#include "ctestcommand.h"
+#include "crunner.h"
+
+CTestCommand::CTestCommand(const TDes& aStepPath, CTestSuite* aSuite )
+/**
+ * Constructor
+ *
+ * @param aStepPath - Path of the test to execute
+ * @param aSuite - Suite of tests
+ */
+	: iSuite(aSuite), iStepPath(aStepPath)
+	{
+	}
+
+CTestCommand::~CTestCommand()
+/**
+ * Destructor
+ */
+	{
+	}
+
+TVerdict CTestCommand::doTestStepL()
+/**
+ * dotestStepL
+ */
+	{
+	// Create a test config from this test step
+	CTestConfig testConfig(this);
+	
+	// Search for the test/suite of tests and run it/them
+	CRunner* runner = CRunner::NewL( iStepPath, testConfig,	Logger() );
+	CleanupStack::PushL(runner);
+	TRAPD( err, iSuite->AcceptL( *runner ) );
+
+	if( err != KErrTEFUnitPass )
+		{
+		// Map the TEFVerdict onto a TVerdict for TestExecute
+		switch(err)
+			{
+			case KErrTEFUnitFail:
+				{
+				SetTestStepResult(EFail);
+				}
+				break;
+			case KErrTEFUnitInconclusive:
+				{
+				SetTestStepResult(EInconclusive);
+				}
+				break;
+			case KErrTEFUnitTestSuiteError:
+				{
+				SetTestStepResult(ETestSuiteError);
+				}
+				break;
+			case KErrTEFUnitAbort:
+				{
+				SetTestStepResult(EAbort);
+				}
+				break;
+			case KErrTEFUnitIgnore:
+				{
+				SetTestStepResult(EIgnore);
+				}
+				break;
+			default:
+				{
+				// Else, if another error code is contained in the leave,
+				//  leave again
+				User::Leave(err);
+				}
+				break;
+			}
+		}
+
+	// Cleanup
+	CleanupStack::PopAndDestroy(runner);
+
+	return TestStepResult();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestconfig.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,357 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestConfig.cpp
+*/
+
+#include "tefunit.h"
+
+CTestConfig::CTestConfig()
+/**
+ * Constructor
+ */
+	{
+	}
+
+CTestConfig::CTestConfig( CTestStep* aTestStep )
+/**
+ * Constructor
+ *
+ * @param aTestStep - Test step to use for the configuration access
+ */
+	: iTestStep(aTestStep)
+	{
+	}
+
+CTestConfig::CTestConfig(const CTestConfig& aTestConfig )
+/**
+ * Constructor
+ *
+ * @param aTestConfig - Test config to copy
+ */
+	{
+	iTestStep = aTestConfig.iTestStep;
+	}
+
+CTestConfig::~CTestConfig()
+/**
+ * Destructor
+ */
+	{
+	}
+
+TBool CTestConfig::GetBool(const TDesC& aSectionName, const TDesC& aKey, TBool& aResult) const
+/**
+ * GetBool
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved boolean
+ * @return - Call result
+ */
+	{
+	return iTestStep->GetBoolFromConfig( aSectionName, aKey, aResult );
+	}
+
+TBool CTestConfig::GetInt(const TDesC& aSectionName, const TDesC& aKey, TInt& aResult) const
+/**
+ * GetInt
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved int
+ * @return - Call result
+ */
+	{
+	return iTestStep->GetIntFromConfig( aSectionName, aKey, aResult );
+	}
+TBool CTestConfig::GetInt(const TDesC& aSectionName, const TDesC& aKey, TInt64& aResult) const
+/**
+ * GetInt
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved int64
+ * @return - Call result
+ */
+	{
+	return iTestStep->GetIntFromConfig( aSectionName, aKey, aResult );
+	}
+
+TBool CTestConfig::GetInt(const TDesC& aKey, TInt64& aResult) const
+/**
+ * GetInt
+ *
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved int64
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->GetIntFromConfig( iTestStep->ConfigSection(), aKey, aResult );
+		}
+	return ret;
+	}
+
+TBool CTestConfig::WriteInt(const TDesC& aSectionName, const TDesC& aKey, TInt64& aValue) const
+/**
+ * WriteInt
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aValue - Written int64
+ * @return - Call result
+ */
+	{
+	return iTestStep->WriteIntToConfig( aSectionName, aKey, aValue );
+	}
+
+TBool CTestConfig::WriteInt(const TDesC& aKey, TInt64& aValue) const
+/**
+ * WriteInt
+ *
+ * @param aKey - Key within the ini file
+ * @param aValue - Written int
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->WriteIntToConfig( iTestStep->ConfigSection(), aKey, aValue );
+		}
+	return ret;
+	}
+TBool CTestConfig::GetHex(const TDesC& aSectionName, const TDesC& aKey, TInt& aResult) const
+/**
+ * GetHex
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved hex
+ * @return - Call result
+ */
+	{
+	return iTestStep->GetHexFromConfig( aSectionName, aKey, aResult );
+	}
+
+TBool CTestConfig::GetString(const TDesC& aSectionName, const TDesC& aKey, TPtrC& aResult) const
+/**
+ * GetString
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved string
+ * @return - Call result
+ */
+	{
+	return iTestStep->GetStringFromConfig( aSectionName, aKey, aResult );
+	}
+
+TBool CTestConfig::GetBool(const TDesC& aKey, TBool& aResult) const
+/**
+ * GetBool
+ *
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved boolean from section passed in via the script
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->GetBoolFromConfig( iTestStep->ConfigSection(), aKey, aResult );
+		}
+	return ret;
+	}
+
+TBool CTestConfig::GetInt(const TDesC& aKey, TInt& aResult) const
+/**
+ * GetInt
+ *
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved int
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->GetIntFromConfig( iTestStep->ConfigSection(), aKey, aResult );
+		}
+	return ret;
+	}
+
+TBool CTestConfig::GetHex(const TDesC& aKey, TInt& aResult) const
+/**
+ * GetHex
+ *
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved hex
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->GetHexFromConfig( iTestStep->ConfigSection(), aKey, aResult );
+		}
+	return ret;
+	}
+
+TBool CTestConfig::GetString(const TDesC& aKey, TPtrC& aResult) const
+/**
+ * GetString
+ *
+ * @param aKey - Key within the ini file
+ * @param aResult - Retrieved string
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->GetStringFromConfig( iTestStep->ConfigSection(), aKey, aResult );
+		}
+	return ret;
+	}
+
+// Newly added functions for writing to ini file
+TBool CTestConfig::WriteBool(const TDesC& aSectionName, const TDesC& aKey, TBool& aValue) const
+/**
+ * WriteBool
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aValue - Written boolean
+ * @return - Call result
+ */
+	{
+	return iTestStep->WriteBoolToConfig( aSectionName, aKey, aValue );
+	}
+
+TBool CTestConfig::WriteInt(const TDesC& aSectionName, const TDesC& aKey, TInt& aValue) const
+/**
+ * WriteInt
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aValue - Written int
+ * @return - Call result
+ */
+	{
+	return iTestStep->WriteIntToConfig( aSectionName, aKey, aValue );
+	}
+
+TBool CTestConfig::WriteHex(const TDesC& aSectionName, const TDesC& aKey, TInt& aValue) const
+/**
+ * WriteHex
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aValue - Written hex
+ * @return - Call result
+ */
+	{
+	return iTestStep->WriteHexToConfig( aSectionName, aKey, aValue );
+	}
+
+TBool CTestConfig::WriteString(const TDesC& aSectionName, const TDesC& aKey, TPtrC& aValue) const
+/**
+ * WriteString
+ *
+ * @param aSectionName - Section name within the ini file
+ * @param aKey - Key within the ini file
+ * @param aValue - Written string
+ * @return - Call result
+ */
+	{
+	return iTestStep->WriteStringToConfig( aSectionName, aKey, aValue );
+	}
+
+TBool CTestConfig::WriteBool(const TDesC& aKey, TBool& aValue) const
+/**
+ * WriteBool
+ *
+ * @param aKey - Key within the ini file
+ * @param aValue - Written boolean from section passed in via the script
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->WriteBoolToConfig( iTestStep->ConfigSection(), aKey, aValue );
+		}
+	return ret;
+	}
+
+TBool CTestConfig::WriteInt(const TDesC& aKey, TInt& aValue) const
+/**
+ * WriteInt
+ *
+ * @param aKey - Key within the ini file
+ * @param aValue - Written int
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->WriteIntToConfig( iTestStep->ConfigSection(), aKey, aValue );
+		}
+	return ret;
+	}
+
+TBool CTestConfig::WriteHex(const TDesC& aKey, TInt& aValue) const
+/**
+ * WriteHex
+ *
+ * @param aKey - Key within the ini file
+ * @param aValue - Written hex
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->WriteHexToConfig( iTestStep->ConfigSection(), aKey, aValue );
+		}
+	return ret;
+	}
+
+TBool CTestConfig::WriteString(const TDesC& aKey, TPtrC& aValue) const
+/**
+ * WriteString
+ *
+ * @param aKey - Key within the ini file
+ * @param aValue - Written string
+ * @return - Call result
+ */
+	{
+	TBool ret = EFalse;
+	if( iTestStep->ConfigSection().Length() > 0 )
+		{
+		ret = iTestStep->WriteStringToConfig( iTestStep->ConfigSection(), aKey, aValue );
+		}
+	return ret;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestfixture.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestFixture.cpp
+*/
+
+#include "tefunit.h"
+
+CTestFixture::~CTestFixture()
+/**
+ * Destructor
+ */
+	{
+	}
+
+void CTestFixture::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CTestFixture::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CTestFixture::SetConfigL(CTestConfig& aConfig)
+/**
+ * SetConfigL
+ *
+ * @param aConfig - Test config to be used by the test cases
+ */
+	{
+	iConfig = aConfig;
+	}
+
+void CTestFixture::SetLoggerL( CTestExecuteLogger& aLogger )
+/**
+ * SetLoggerL
+ *
+ * @param aLogger - Logger ot be used by the test cases
+ */
+	{
+	iLogger = aLogger;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/src/ctestsuite.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuite.cpp
+*/
+
+#include "tefunit.h"
+
+CTestSuite::CTestSuite(const TTestName& aName)
+/**
+ * Constructor
+ *
+ * @param aName - Test suite name
+ */
+	: CTestBase(aName)
+	{
+	}
+
+CTestSuite::CTestSuite(CTestSuite &rhs)
+/**
+ * Constructor
+ *
+ * @param rhs - Test suite to copy
+ */
+	: CTestBase(rhs.iName)
+	{
+	iTests=rhs.iTests;
+	}
+
+void CTestSuite::ConstructL()
+/**
+ * ConstructL
+ */
+	{
+	}
+
+CTestSuite* CTestSuite::NewL()
+/**
+ * NewL
+ *
+ * @return - Instance of CTestSuite
+ */
+	{
+	return NewL(_L("TEFUnit"));
+	}
+
+CTestSuite* CTestSuite::NewL(const TTestName& aName)
+/**
+ * NewL
+ *
+ * @param aName - Name of the test suite
+ * @return - Instance of CTestSuite
+ */
+	{
+	CTestSuite* lTestSuite = new (ELeave) CTestSuite(aName);
+	CleanupStack::PushL(lTestSuite);
+	lTestSuite->ConstructL();
+	CleanupStack::Pop();
+	return lTestSuite;
+	}
+
+CTestSuite::~CTestSuite()
+/**
+ * Destructor
+ */
+	{
+	for(TInt lIndex = 0; lIndex < iTests.Count(); lIndex++)
+		{
+		delete iTests[lIndex];
+		iTests[lIndex] = NULL;
+		}
+	iTests.Close();
+	}
+
+void CTestSuite::AddL(CTestBase* aTest)
+/**
+ * AddL
+ *
+ * @param aTest - Test to add to the suite
+ */
+	{
+	User::LeaveIfError(	iTests.Append(aTest) );
+	}
+
+void CTestSuite::RunL(CTestConfig& aConfig, CTestExecuteLogger& aLogger)
+/**
+ * RunL
+ *
+ * @param aConfig - Config to use within the test case
+ * @param aLogger - Logger to use within the test case
+ */
+	{
+	// Log that the runner is currently in this suite
+	CTEFLogger::LogTraverse( iName, aLogger );
+	for(TInt lIndex = 0; lIndex < iTests.Count(); lIndex++)
+		{
+		TRAPD(err,iTests[lIndex]->RunL(aConfig, aLogger));
+		if(err != KErrTEFUnitPass)
+			{
+			iError=err;
+			}
+		}
+	if(iError != KErrTEFUnitPass)
+		{
+		User::Leave(iError);
+		}
+	}
+
+void CTestSuite::AcceptL(MVisitor &aVisitor)
+/**
+ * AcceptL
+ *
+ * @param aVisitor - Visitor (runner) to accept
+ */
+	{
+	aVisitor.VisitL(this);
+	}
+
+TInt CTestSuite::Count()
+/**
+ * Count
+ *
+ * @return - Number of tests cases/sub-suites
+ */
+	{
+	return iTests.Count();
+	}
+
+TTestName CTestSuite::NameL( TInt anIndex )
+/**
+ * NameL
+ *
+ * @param anIndex - Index of name to retrieve
+ * @return - Test name
+ */
+	{
+	return TestL(anIndex)->Name();
+	}
+
+CTestBase*	CTestSuite::TestL( TInt anIndex )
+/**
+ * TestL
+ *
+ * @param anIndex - Index of test to retrieve
+ * @return - Test case/suite
+ */
+	{
+	if( anIndex>=iTests.Count() )
+		{
+		User::Leave(KErrTEFUnitFail);
+		}
+
+	return iTests[anIndex];
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestasyncsuitea.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestAsyncSuiteA.h
+*/
+
+#ifndef __TEST_ASYNC_SUITE_A__
+#define __TEST_ASYNC_SUITE_A__
+
+#include "tefunit.h"
+
+class CTestAsyncSuiteA : public CActiveTestFixture 
+	{
+public:
+	// SetUp and TearDown code 
+	virtual void SetupL();
+	virtual void TearDownL();
+
+	// Tests
+	void TestOne();
+	void TestTwo();
+	void TestAssertEquals();
+	void TestAssertNull();
+	void TestAssertNotNull();
+	void TestAssertSame();
+	void TestAssertNotSame();
+	void TestAssertTrue();
+	void TestAssertFalse();
+
+	// Create a suite of all the tests
+	static CTestSuite* CreateSuiteL(const TDesC& aName);
+
+private:
+	};
+
+#endif // __TEST_ASYNC_SUITE_A__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestasyncsuiteassert.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestAsyncSuiteAssert.h
+*/
+
+#ifndef __TEST_ASYNC_SUITE_ASSERT__
+#define __TEST_ASYNC_SUITE_ASSERT__
+
+#include "tefunit.h"
+
+class CTestAsyncSuiteAssert : public CActiveTestFixture 
+	{
+public:
+	// SetUp and TearDown code 
+	virtual void SetupL();
+	virtual void TearDownL();
+
+	// Tests
+	void TestAssertEquals();
+	void TestAssertNull();
+	void TestAssertNotNull();
+	void TestAssertSame();
+	void TestAssertNotSame();
+	void TestAssertTrue();
+	void TestAssertFalse();
+
+	// Create a suite of all the tests
+	static CTestSuite* CreateSuiteL(const TDesC& aName);
+
+private:
+	};
+
+#endif // __TEST_ASYNC_SUITE_ASSERT__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuitea.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteA.h
+*/
+
+#ifndef __TEST_SUITE_A__
+#define __TEST_SUITE_A__
+
+#include "tefunit.h"
+
+class CTestSuiteA : public CTestFixture 
+	{
+public:
+	// SetUp and TearDown code 
+	virtual void SetupL();
+	virtual void TearDownL();
+
+	// Tests
+	void TestOne();
+	void TestTwo();
+	void TestThree();
+	void TestAssertEquals();
+	void TestAssertNull();
+	void TestAssertNotNull();
+	void TestAssertSame();
+	void TestAssertNotSame();
+	void TestAssertTrue();
+	void TestAssertFalse();
+
+	// Create a suite of all the tests
+	static CTestSuite* CreateSuiteL(const TDesC& aName);
+	};
+
+#endif // __TEST_SUITE_A__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuiteassert.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteAssert.h
+*/
+
+#ifndef __TEST_SUITE_ASSERT__
+#define __TEST_SUITE_ASSERT__
+
+#include "tefunit.h"
+
+class CTestSuiteAssert : public CTestFixture 
+	{
+public:
+	// SetUp and TearDown code 
+	virtual void SetupL();
+	virtual void TearDownL();
+
+	// Tests
+	void TestAssertEquals();
+	void TestAssertNull();
+	void TestAssertNotNull();
+	void TestAssertSame();
+	void TestAssertNotSame();
+	void TestAssertTrue();
+	void TestAssertFalse();
+
+	// Create a suite of all the tests
+	static CTestSuite* CreateSuiteL(const TDesC& aName);
+	};
+
+#endif // __TEST_SUITE_ASSERT__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuiteb.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteB.h
+*/
+
+#ifndef __TEST_SUITE_B__
+#define __TEST_SUITE_B__
+
+#include "tefunit.h"
+
+class CTestSuiteB : public CTestFixture 
+	{
+public:
+	// SetUp and TearDown code 
+	virtual void SetupL();
+	virtual void TearDownL();
+
+	// Tests
+	void TestOne();
+	void TestTwo();
+
+	// Create a suite of all the tests
+	static CTestSuite* CreateSuiteL(const TDesC& aName);
+	};
+
+#endif // __TEST_SUITE_B__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuitec.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteC.h
+*/
+
+#ifndef __TEST_SUITE_C__
+#define __TEST_SUITE_C__
+
+#include "tefunit.h"
+
+class CTestSuiteC : public CTestFixture 
+	{
+public:
+	// SetUp and TearDown code 
+	virtual void SetupL();
+	virtual void TearDownL();
+
+	// Tests
+	void TestOne();
+	void TestTwo();
+
+	// Create a suite of all the tests
+	static CTestSuite* CreateSuiteL(const TDesC& aName);
+	};
+
+#endif // __TEST_SUITE_C__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/ctestsuited.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteD.h
+*/
+
+#ifndef __TEST_SUITE_D__
+#define __TEST_SUITE_D__
+
+#include "tefunit.h"
+
+class CTestSuiteD : public CTestFixture 
+	{
+public:
+	// SetUp and TearDown code 
+	virtual void SetupL();
+	virtual void TearDownL();
+
+	// Tests
+	void TestOne();
+	void TestTwo();
+
+	// Create a suite of all the tests
+	static CTestSuite* CreateSuiteL(const TDesC& aName);
+	};
+
+#endif // __TEST_SUITE_D__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/inc/samplestep.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file SampleStep.h
+*/
+#if (!defined __SAMPLE_STEP_H__)
+#define __SAMPLE_STEP_H__
+#include <testexecutestepbase.h>
+#include "ctefunitserver.h"
+
+// __EDIT_ME__ - Create your own test step definitions
+class CSampleStep1 : public CTestStep
+	{
+public:
+	CSampleStep1();
+	~CSampleStep1();
+	virtual TVerdict doTestStepPreambleL();
+	virtual TVerdict doTestStepPostambleL();
+	virtual TVerdict doTestStepL();
+private:
+	};
+
+class CSampleStep2 : public CTestStep
+	{
+public:
+	CSampleStep2(CTEFUnitServer& aParent);
+	~CSampleStep2();
+	virtual TVerdict doTestStepPreambleL();
+	virtual TVerdict doTestStepPostambleL();
+	virtual TVerdict doTestStepL();
+private:
+	CTEFUnitServer& iParent;
+	};
+
+class CSampleStep3 : public CTestStep
+	{
+public:
+	CSampleStep3(CTEFUnitServer& aParent);
+	~CSampleStep3();
+	virtual TVerdict doTestStepPreambleL();
+	virtual TVerdict doTestStepPostambleL();
+	virtual TVerdict doTestStepL();
+private:
+	CTEFUnitServer& iParent;
+	};
+
+
+_LIT(KSampleStep1,"SampleStep1");
+_LIT(KSampleStep2,"SampleStep2");
+_LIT(KSampleStep3,"SampleStep3");
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/scripts/tefunit.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,198 @@
+//
+// Copyright (c) 2005-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:  
+// Test Suite Hirarchy
+// SuiteTEFUnit---------------------------------
+// SuiteA       SuiteD          AsyncSuiteAssert  SuiteAssert
+// SuiteD One Two One Two  AsyncSuiteA
+// One  Two                 One  Two      
+//
+
+// Load Server for Shared Data Mode
+LOAD_SERVER TEFUnitTE -SharedData
+//
+PRINT ----------------------------------------------
+PRINT
+PRINT TEFUnit Plugin Test with Test Steps
+PRINT
+PRINT ----------------------------------------------
+PRINT
+
+START_TESTCASE TCTEF01
+PRINT ----------------------------------------------
+PRINT Run TEF test steps in TEFUnit
+PRINT (shared data mode)
+PRINT ----------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE SampleStep2  ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+RUN_TEST_STEP 100 TEFUnitTE SampleStep3  ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+RUN_TEST_STEP 100 TEFUnitTE SampleStep2  ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+RUN_TEST_STEP 100 TEFUnitTE SampleStep3  ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+END_TESTCASE TCTEF01
+
+// Load Suite for Normal Mode
+LOAD_SUITE TEFUnitTE
+//
+START_TESTCASE TCTEF02
+PRINT ----------------------------------------------
+PRINT Run TEF test steps in TEFUnit
+PRINT (Normal Mode)
+PRINT ----------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE SampleStep1  ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+RUN_TEST_STEP_RESULT 0 100 TEFUnitTE SampleStep1  ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+RUN_PANIC_STEP 1 TEFUnitTE SampleStep1  ${SYSDRIVE}\TEFUnitScripts\test.ini SectionThree
+RUN_PANIC_STEP_RESULT 1 SampleServer TEFUnitTE SampleStep1  ${SYSDRIVE}\TEFUnitScripts\test.ini SectionThree
+RUN_TEST_STEP 100 TEFUnitTE SampleStep2  ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TCTEF02
+
+PRINT ----------------------------------------------
+PRINT
+PRINT TEFUnit Plugin Test with Test Suites
+PRINT
+PRINT ----------------------------------------------
+PRINT
+
+START_TESTCASE TCTEFUNIT01
+PRINT -------------------------------------------------------
+PRINT TestFixture derived Suite TestSteps called individually
+PRINT -------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.TestOne ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.TestTwo ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.TestThree ${SYSDRIVE}\TEFUnitScripts\test.ini SectionWriteTest1
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteD.TestOne ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteD.TestTwo ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+END_TESTCASE TCTEFUNIT01
+
+START_TESTCASE TCTEFUNIT02
+PRINT ----------------------------------------------------------
+PRINT TestFixture derived Subsuite TestSteps called individually
+PRINT ----------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.TestOne ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.TestTwo ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.CTestSuiteC.TestOne ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.CTestSuiteC.TestTwo ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TCTEFUNIT02
+
+START_TESTCASE TCTEFUNIT03
+PRINT ----------------------------------------------------------------
+PRINT ActiveTestFixture derived Subsuite TestSteps called individually
+PRINT ----------------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteD.CTestAsyncSuiteA.TestOne ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteD.CTestAsyncSuiteA.TestTwo ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+END_TESTCASE TCTEFUNIT03
+
+START_TESTCASE TCTEFUNIT04
+PRINT ----------------------------------------------------------
+PRINT TestFixture derived Suite TestSteps called using Wildcards
+PRINT (Check logs to ensure all sub suites are also run)
+PRINT ----------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.* ${SYSDRIVE}\TEFUnitScripts\test.ini SectionWriteTest1
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteD.* ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+END_TESTCASE TCTEFUNIT04
+
+START_TESTCASE TCTEFUNIT05
+PRINT --------------------------------------------------------------
+PRINT TestFixture derived subsuite TestSteps called using wildcards
+PRINT (Check logs to ensure all sub suites are also run - if exists)
+PRINT --------------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.* ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.CTestSuiteC.* ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TCTEFUNIT05
+
+START_TESTCASE TCTEFUNIT06
+PRINT -------------------------------------------------------------------
+PRINT ActiveTestFixture derived Subsuite TestSteps called using wildcards
+PRINT -------------------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteD.CTestAsyncSuiteA.* ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+END_TESTCASE TCTEFUNIT06
+
+START_TESTCASE TCTEFUNIT07
+PRINT ------------------------------------------------------------------
+PRINT TestFixture derived Suite TestSteps called without using Wildcards
+PRINT (Check logs to ensure all sub suites are also run)
+PRINT ------------------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA ${SYSDRIVE}\TEFUnitScripts\test.ini SectionWriteTest1
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteD ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+END_TESTCASE TCTEFUNIT07
+
+START_TESTCASE TCTEFUNIT08
+PRINT ---------------------------------------------------------------------
+PRINT TestFixture derived subsuite TestSteps called without using wildcards
+PRINT (Check logs to ensure all sub suites are also run - if exists)
+PRINT ---------------------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.CTestSuiteC ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TCTEFUNIT08
+
+START_TESTCASE TCTEFUNIT09
+PRINT ---------------------------------------------------------------------------
+PRINT ActiveTestFixture derived Subsuite TestSteps called without using wildcards
+PRINT ---------------------------------------------------------------------------
+RUN_TEST_STEP 100 TEFUnitTE TEFUnit.CTestSuiteD.CTestAsyncSuiteA ${SYSDRIVE}\TEFUnitScripts\test.ini SectionOne
+END_TESTCASE TCTEFUNIT09
+
+START_TESTCASE TC10
+PRINT ----------------------------------------------------------
+PRINT Try to run some invalid tests/suites
+PRINT ----------------------------------------------------------
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteA.Banana ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteA.Banana.* ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteD.CTestAsyncSuiteA.Banana ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TC10
+
+START_TESTCASE TC11
+PRINT ----------------------------------------------------------
+PRINT Try to run some tests/suites with the case being incorrect
+PRINT ----------------------------------------------------------
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuitea ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteA.Testone ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteD.CTestAsyncSuiteA.Testtwo ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TC11
+
+START_TESTCASE TC12
+PRINT -----------------------------------------------------------
+PRINT Try to run some tests with only part of the test/suite name
+PRINT -----------------------------------------------------------
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteA.TestOn ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteA.TestTw ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.TestOn ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSui ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuit ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 108 100 TEFUnitTE TEFUnit.CTestSuiteA.CTestSuiteB.CTestSui ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TC12
+
+START_TESTCASE TC13
+PRINT ----------------------------------------------------------
+PRINT   Assert Tests
+PRINT ----------------------------------------------------------
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestSuiteAssert.TestAssertEquals ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestSuiteAssert.TestAssertNull ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestSuiteAssert.TestAssertNotNull ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestSuiteAssert.TestAssertSame ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestSuiteAssert.TestAssertNotSame ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestSuiteAssert.TestAssertTrue ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestSuiteAssert.TestAssertFalse ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TC13
+
+START_TESTCASE TC14
+PRINT ----------------------------------------------------------
+PRINT   Assert Tests in an Active Environment
+PRINT ----------------------------------------------------------
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestAsyncSuiteAssert.TestAssertEquals ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestAsyncSuiteAssert.TestAssertNull ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestAsyncSuiteAssert.TestAssertNotNull ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestAsyncSuiteAssert.TestAssertSame ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestAsyncSuiteAssert.TestAssertNotSame ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestAsyncSuiteAssert.TestAssertTrue ${SYSDRIVE}\TEFUnitScripts\test.ini
+RUN_TEST_STEP_RESULT 106 100 TEFUnitTE TEFUnit.CTestAsyncSuiteAssert.TestAssertFalse ${SYSDRIVE}\TEFUnitScripts\test.ini
+END_TESTCASE TC14
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/scripts/test.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,16 @@
+[SectionOne]
+TheInt=999
+TheBool=true
+TheHex=12345678
+TheString=TheString
+
+[SectionTwo]
+TheInt=666
+TheBool=false
+TheHex=87654321
+TheString=TheStringReturns
+
+[SectionThree]
+TheString =PanicMe
+TheInt    =2
+TheBool   =false
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestasyncsuitea.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestAsyncSuiteA.cpp
+*/
+
+#include "ctestasyncsuitea.h"
+
+void CTestAsyncSuiteA::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CTestAsyncSuiteA::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CTestAsyncSuiteA::TestOne()
+/**
+ * TestOne
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteA:One"));
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("TheInt"),theInt);
+	ASSERT_TRUE(res);
+
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("TheBool"), theBool);
+	ASSERT_TRUE(res);
+
+	// Test all the Logging functions
+	INFO_PRINTF1(_L("Info Print Tests"));
+	INFO_PRINTF2(_L("Int = %d"),theInt);
+	INFO_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool);
+	INFO_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt);
+	INFO_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool);
+	INFO_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt);
+	INFO_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool);
+
+	WARN_PRINTF1(_L("Warn Print Tests"));
+	WARN_PRINTF2(_L("Int = %d"),theInt);
+	WARN_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool);
+	WARN_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt);
+	WARN_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool);
+	WARN_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt);
+	WARN_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool);
+
+	ERR_PRINTF1(_L("Err Print Tests"));
+	ERR_PRINTF2(_L("Int = %d"),theInt);
+	ERR_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool);
+	ERR_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt);
+	ERR_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool);
+	ERR_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt);
+	ERR_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool);
+	}
+
+void CTestAsyncSuiteA::TestTwo()
+/**
+ * TestTwo
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteA:Two"));
+
+	// Test all the configuration info is retrieved correctly from SectionOne
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("SectionOne"),_L("TheInt"),theInt);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theInt, 999 );
+
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("SectionOne"),_L("TheBool"), theBool);
+	ASSERT_TRUE(res);
+	ASSERT_TRUE( theBool );
+
+	TInt theHex = 0;
+	res = iConfig.GetHex(_L("SectionOne"), _L("TheHex"), theHex);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theHex, (TInt)0x12345678 );
+
+	TPtrC theString;
+	res = iConfig.GetString(_L("SectionOne"), _L("TheString"), theString);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theString, _L("TheString") );
+
+	// Test all the configuration info is retrieved correctly from SectionTwo
+	res = iConfig.GetInt(_L("SectionTwo"),_L("TheInt"),theInt);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theInt, 666 );
+
+	res = iConfig.GetBool(_L("SectionTwo"),_L("TheBool"), theBool);
+	ASSERT_TRUE(res);
+	ASSERT_FALSE( theBool );
+
+	res = iConfig.GetHex(_L("SectionTwo"), _L("TheHex"), theHex);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theHex, (TInt)0x87654321 );
+
+	res = iConfig.GetString(_L("SectionTwo"), _L("TheString"), theString);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theString, _L("TheStringReturns") );
+
+	// Test all the asserts work
+	TInt a = 5;
+	TInt b = 5;
+	ASSERT_EQUALS(a, b);
+
+	CTestConfig* aPtr = NULL;
+	ASSERT_NULL( aPtr );
+
+	aPtr = &iConfig;
+	ASSERT_NOT_NULL( aPtr );
+
+	ASSERT_SAME( aPtr, &iConfig );
+
+	aPtr = NULL;
+	ASSERT_NOT_SAME( aPtr, &iConfig );
+
+	TBool aBool = ETrue;
+	ASSERT_TRUE(aBool);
+	ASSERT_FALSE(!aBool);
+	}
+
+CTestSuite* CTestAsyncSuiteA::CreateSuiteL( const TDesC& aName )
+/**
+ * CreateSuiteL
+ *
+ * @param aName - Suite name
+ * @return - Suite
+ */
+	{
+	SUB_SUITE;
+#ifndef __GCCXML__
+	ADD_ASYNC_TEST_STEP( TestOne );
+	ADD_ASYNC_TEST_STEP( TestTwo );	
+#endif
+#ifdef __GCCXML__
+	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteA, TestOne );
+	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteA, TestTwo );
+#endif
+	END_SUITE;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestasyncsuiteassert.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestAsyncSuiteAssert.cpp
+*/
+
+#include "ctestasyncsuiteassert.h"
+
+void CTestAsyncSuiteAssert::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CTestAsyncSuiteAssert::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CTestAsyncSuiteAssert::TestAssertEquals()
+/**
+ * TestAssertEquals
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteAssert:AssertEquals"));
+	ASSERT_EQUALS( 5, 10 );
+	}
+
+void CTestAsyncSuiteAssert::TestAssertNull()
+/**
+ * TestAssertNull
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteAssert:AssertNull"));
+	CTestConfig* aPtr = NULL;
+	aPtr = &iConfig;
+	ASSERT_NULL( aPtr );
+	}
+
+void CTestAsyncSuiteAssert::TestAssertNotNull()
+/**
+ * TestAssertNotNull
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteAssert:AssertNotNull"));
+	CTestConfig* aPtr = NULL;
+	ASSERT_NOT_NULL( aPtr );
+	}
+
+void CTestAsyncSuiteAssert::TestAssertSame()
+/**
+ * TestAssertSame
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteAssert:AssertSame"));
+	CTestConfig* aPtr = NULL;
+	ASSERT_SAME( aPtr, &iConfig );
+	}
+
+void CTestAsyncSuiteAssert::TestAssertNotSame()
+/**
+ * TestAssertNotSame
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteAssert:AssertNotSame"));
+	ASSERT_NOT_SAME( &iConfig, &iConfig );
+	}
+
+void CTestAsyncSuiteAssert::TestAssertTrue()
+/**
+ * TestAssertTrue
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteAssert:AssertTrue"));
+	ASSERT_TRUE( EFalse );
+	}
+
+
+void CTestAsyncSuiteAssert::TestAssertFalse()
+/**
+ * TestAssertfalse
+ */
+	{
+	INFO_PRINTF1(_L("Running AsyncSuiteAssert:AssertFalse"));
+	ASSERT_FALSE( ETrue );
+	}
+
+CTestSuite* CTestAsyncSuiteAssert::CreateSuiteL( const TDesC& aName )
+/**
+ * CreateSuiteL
+ *
+ * @param aName - Suite name
+ * @return - Suite
+ */
+	{
+	SUB_SUITE;
+#ifndef __GCCXML__
+ 	ADD_ASYNC_TEST_STEP( TestAssertEquals );
+ 	ADD_ASYNC_TEST_STEP( TestAssertNull );
+ 	ADD_ASYNC_TEST_STEP( TestAssertNotNull );
+ 	ADD_ASYNC_TEST_STEP( TestAssertSame );
+ 	ADD_ASYNC_TEST_STEP( TestAssertNotSame );
+ 	ADD_ASYNC_TEST_STEP( TestAssertTrue );
+ 	ADD_ASYNC_TEST_STEP( TestAssertFalse );
+#endif
+#ifdef __GCCXML__
+ 	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteAssert, TestAssertEquals );
+ 	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteAssert, TestAssertNull );
+ 	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteAssert, TestAssertNotNull );
+ 	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteAssert, TestAssertSame );
+ 	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteAssert, TestAssertNotSame );
+ 	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteAssert, TestAssertTrue );
+ 	ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteAssert, TestAssertFalse );
+#endif
+	END_SUITE;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuitea.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteA.cpp
+*/
+
+#include "ctestsuitea.h"
+#include "ctestsuiteb.h"
+
+void CTestSuiteA::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CTestSuiteA::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CTestSuiteA::TestOne()
+/**
+ * TestOne
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:One"));
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("SectionOne"),_L("TheInt"),theInt);
+	ASSERT_TRUE(res);
+
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("SectionOne"),_L("TheBool"), theBool);
+	ASSERT_TRUE(res);
+
+	// Test all the Logging functions
+	INFO_PRINTF1(_L("Info Print Tests"));
+	INFO_PRINTF2(_L("Int = %d"),theInt);
+	INFO_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool);
+	INFO_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt);
+	INFO_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool);
+	INFO_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt);
+	INFO_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool);
+
+	WARN_PRINTF1(_L("Warn Print Tests"));
+	WARN_PRINTF2(_L("Int = %d"),theInt);
+	WARN_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool);
+	WARN_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt);
+	WARN_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool);
+	WARN_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt);
+	WARN_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool);
+
+	ERR_PRINTF1(_L("Err Print Tests"));
+	ERR_PRINTF2(_L("Int = %d"),theInt);
+	ERR_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool);
+	ERR_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt);
+	ERR_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool);
+	ERR_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt);
+	ERR_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool);
+	}
+
+void CTestSuiteA::TestTwo()
+/**
+ * TestTwo
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:Two"));
+
+	// Test all the configuration info is retrieved correctly from SectionOne
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("SectionOne"),_L("TheInt"),theInt);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theInt, 999 );
+
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("SectionOne"),_L("TheBool"), theBool);
+	ASSERT_TRUE(res);
+	ASSERT_TRUE( theBool );
+
+	TInt theHex = 0;
+	res = iConfig.GetHex(_L("SectionOne"), _L("TheHex"), theHex);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theHex, (TInt)0x12345678 );
+
+	TPtrC theString;
+	res = iConfig.GetString(_L("SectionOne"), _L("TheString"), theString);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theString, _L("TheString") );
+
+	// Test all the configuration info is retrieved correctly from SectionTwo
+	res = iConfig.GetInt(_L("SectionTwo"),_L("TheInt"),theInt);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theInt, 666 );
+
+	res = iConfig.GetBool(_L("SectionTwo"),_L("TheBool"), theBool);
+	ASSERT_TRUE(res);
+	ASSERT_FALSE( theBool );
+
+	res = iConfig.GetHex(_L("SectionTwo"), _L("TheHex"), theHex);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theHex, (TInt)0x87654321 );
+
+	res = iConfig.GetString(_L("SectionTwo"), _L("TheString"), theString);
+	ASSERT_TRUE(res);
+	ASSERT_EQUALS( theString, _L("TheStringReturns") );
+
+	// Test all the asserts work
+	TInt a = 5;
+	TInt b = 5;
+	ASSERT_EQUALS(a, b);
+
+	CTestConfig* aPtr = NULL;
+	ASSERT_NULL( aPtr );
+
+	aPtr = &iConfig;
+	ASSERT_NOT_NULL( aPtr );
+
+	ASSERT_SAME( aPtr, &iConfig );
+
+	aPtr = NULL;
+	ASSERT_NOT_SAME( aPtr, &iConfig );
+
+	TBool aBool = ETrue;
+	ASSERT_TRUE(aBool);
+	ASSERT_FALSE(!aBool);
+	}
+
+void CTestSuiteA::TestThree()
+/**
+ * TestThree
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:Three"));
+
+	// Test all the configuration info is retrieved correctly from SectionOne
+	TInt theInt = 90021;
+	TBool res = iConfig.WriteInt(_L("SectionWriteTest2"),_L("TheInt"),theInt);
+	ASSERT_TRUE(res);
+
+	TBool theBool = EFalse;
+	res = iConfig.WriteBool(_L("SectionWriteTest2"),_L("TheBool"), theBool);
+	ASSERT_TRUE(res);
+
+	TInt theHex = 12345;
+	res = iConfig.WriteHex(_L("SectionWriteTest2"), _L("TheHex"), theHex);
+	ASSERT_TRUE(res);
+
+	TPtrC theString(_L("WriteThisStringToSectionWriteTest2Section"));
+	res = iConfig.WriteString(_L("SectionWriteTest2"), _L("TheString"), theString);
+	ASSERT_TRUE(res);
+
+	// Test all the configuration info is retrieved correctly from SectionTwo
+	res = iConfig.WriteInt(_L("TheInt"),theInt);
+	ASSERT_TRUE(res);
+
+	res = iConfig.WriteBool(_L("TheBool"), theBool);
+	ASSERT_TRUE(res);
+
+	res = iConfig.WriteHex(_L("TheHex"), theHex);
+	ASSERT_TRUE(res);
+
+	res = iConfig.WriteString(_L("TheString"), theString);
+	ASSERT_TRUE(res);
+	}
+
+CTestSuite* CTestSuiteA::CreateSuiteL( const TDesC& aName )
+/**
+ * CreateSuiteL
+ *
+ * @param aName - Suite name
+ * @return - Suite
+ */
+	{
+	SUB_SUITE;
+#ifndef __GCCXML__
+ 	ADD_TEST_STEP( TestOne );
+ 	ADD_TEST_STEP( TestTwo );
+ 	ADD_TEST_STEP( TestThree );
+#endif
+#ifdef __GCCXML__
+ 	ADD_TEST_STEP_CLASS( CTestSuiteA, TestOne );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteA, TestTwo );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteA, TestThree );
+#endif
+ 	ADD_TEST_SUITE( CTestSuiteB )
+	END_SUITE;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuiteassert.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteAssert.cpp
+*/
+
+#include "ctestsuiteassert.h"
+
+void CTestSuiteAssert::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CTestSuiteAssert::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CTestSuiteAssert::TestAssertEquals()
+/**
+ * TestAssertEquals
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:AssertEquals"));
+	ASSERT_EQUALS( 5, 10 );
+	}
+
+void CTestSuiteAssert::TestAssertNull()
+/**
+ * TestAssertNull
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:AssertNull"));
+	CTestConfig* aPtr = NULL;
+	aPtr = &iConfig;
+	ASSERT_NULL( aPtr );
+	}
+
+void CTestSuiteAssert::TestAssertNotNull()
+/**
+ * TestAssertNotNull
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:AssertNotNull"));
+	CTestConfig* aPtr = NULL;
+	ASSERT_NOT_NULL( aPtr );
+	}
+
+void CTestSuiteAssert::TestAssertSame()
+/**
+ * TestAssertSame
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:AssertSame"));
+	CTestConfig* aPtr = NULL;
+	ASSERT_SAME( aPtr, &iConfig );
+	}
+
+void CTestSuiteAssert::TestAssertNotSame()
+/**
+ * TestAssertNotSame
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:AssertNotSame"));
+	ASSERT_NOT_SAME( &iConfig, &iConfig );
+	}
+
+void CTestSuiteAssert::TestAssertTrue()
+/**
+ * TestAssertTrue
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:AssertTrue"));
+	ASSERT_TRUE( EFalse );
+	}
+
+void CTestSuiteAssert::TestAssertFalse()
+/**
+ * TestAssertFalse
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteA:AssertFalse"));
+	ASSERT_FALSE( ETrue );
+	}
+
+CTestSuite* CTestSuiteAssert::CreateSuiteL( const TDesC& aName )
+/**
+ * CreateSuiteL
+ *
+ * @param aName - Suite name
+ * @return - Suite
+ */
+	{
+	SUB_SUITE;
+#ifndef __GCCXML__
+ 	ADD_TEST_STEP( TestAssertEquals );
+ 	ADD_TEST_STEP( TestAssertNull );
+ 	ADD_TEST_STEP( TestAssertNotNull );
+ 	ADD_TEST_STEP( TestAssertSame );
+ 	ADD_TEST_STEP( TestAssertNotSame );
+ 	ADD_TEST_STEP( TestAssertTrue );
+ 	ADD_TEST_STEP( TestAssertFalse );
+#endif
+#ifdef __GCCXML__
+ 	ADD_TEST_STEP_CLASS( CTestSuiteAssert, TestAssertEquals );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteAssert, TestAssertNull );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteAssert, TestAssertNotNull );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteAssert, TestAssertSame );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteAssert, TestAssertNotSame );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteAssert, TestAssertTrue );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteAssert, TestAssertFalse );
+#endif	
+ 	END_SUITE;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuiteb.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteB.cpp
+*/
+
+#include "ctestsuiteb.h"
+#include "ctestsuitec.h"
+
+void CTestSuiteB::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CTestSuiteB::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CTestSuiteB::TestOne()
+/**
+ * TestOne
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteB:One"));
+	TInt theInt = 0;
+	ASSERT_EQUALS( theInt, 0 );
+	TBool res = iConfig.GetInt(_L("SectionOne"),_L("TheInt"),theInt);
+	ASSERT_TRUE( res );
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("SectionOne"),_L("TheBool"), theBool);
+	ASSERT_TRUE( res );
+	INFO_PRINTF3(_L("TheInt = %d The Bool = %d"),theInt,theBool);
+	}
+
+void CTestSuiteB::TestTwo()
+/**
+ * TestTwo
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteB:Two"));
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("SectionOne"),_L("TheInt"),theInt);
+	ASSERT_TRUE( res );
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("SectionOne"),_L("TheBool"), theBool);
+	ASSERT_TRUE( res );
+	INFO_PRINTF3(_L("TheInt = %d The Bool = %d"),theInt,theBool);
+	}
+
+CTestSuite* CTestSuiteB::CreateSuiteL(	const TDesC& aName )
+/**
+ * CreateSuiteL
+ *
+ * @param aName - Suite name
+ * @return - Suite
+ */
+	{
+	SUB_SUITE;
+#ifndef __GCCXML__
+ 	ADD_TEST_STEP( TestOne );
+ 	ADD_TEST_STEP( TestTwo );
+#endif
+#ifdef __GCCXML__
+ 	ADD_TEST_STEP_CLASS( CTestSuiteB, TestOne );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteB, TestTwo );
+#endif
+ 	ADD_TEST_SUITE( CTestSuiteC )
+	END_SUITE;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuitec.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteC.cpp
+*/
+
+#include "ctestsuitec.h"
+
+void CTestSuiteC::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CTestSuiteC::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CTestSuiteC::TestOne()
+/**
+ * TestOne
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteC:One"));
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("SectionOne"),_L("TheInt"),theInt);
+	ASSERT_TRUE( res );
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("SectionOne"),_L("TheBool"), theBool);
+	ASSERT_TRUE( res );
+	INFO_PRINTF3(_L("TheInt = %d The Bool = %d"),theInt,theBool);
+	}
+
+/*
+ *  A test step
+ */
+void CTestSuiteC::TestTwo()
+/**
+ * TestTwo
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteC:Two"));
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("SectionOne"),_L("TheInt"),theInt);
+	ASSERT_TRUE( res );
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("SectionOne"),_L("TheBool"), theBool);
+	ASSERT_TRUE( res );
+	INFO_PRINTF3(_L("TheInt = %d The Bool = %d"),theInt,theBool);
+	}
+
+CTestSuite* CTestSuiteC::CreateSuiteL(	const TDesC& aName )
+/**
+ * CreateSuiteL
+ *
+ * @param aName - Suite name
+ * @return - Suite
+ */
+	{
+	SUB_SUITE;
+#ifndef __GCCXML__
+ 	ADD_TEST_STEP( TestOne );
+ 	ADD_TEST_STEP( TestTwo );
+#endif
+#ifdef __GCCXML__
+ 	ADD_TEST_STEP_CLASS( CTestSuiteC, TestOne );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteC, TestTwo );
+#endif
+ 	END_SUITE;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/ctestsuited.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file CTestSuiteD.cpp
+*/
+
+#include "ctestsuited.h"
+#include "ctestasyncsuitea.h"
+
+void CTestSuiteD::SetupL()
+/**
+ * SetupL
+ */
+	{
+	}
+
+void CTestSuiteD::TearDownL()
+/**
+ * TearDownL
+ */
+	{
+	}
+
+void CTestSuiteD::TestOne()
+/**
+ * TestOne
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteD:One"));
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("TheInt"),theInt);
+	ASSERT_TRUE( res );
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("TheBool"), theBool);
+	ASSERT_TRUE( res );
+	INFO_PRINTF3(_L("TheInt = %d The Bool = %d"),theInt,theBool);
+	}
+
+void CTestSuiteD::TestTwo()
+/**
+ * TestTwo
+ */
+	{
+	INFO_PRINTF1(_L("Running SuiteD:Two"));
+	TInt theInt = 0;
+	TBool res = iConfig.GetInt(_L("TheInt"),theInt);
+	ASSERT_TRUE( res );
+	TBool theBool = EFalse;
+	res = iConfig.GetBool(_L("TheBool"), theBool);
+	ASSERT_TRUE( res );
+	INFO_PRINTF3(_L("TheInt = %d The Bool = %d"),theInt,theBool);
+	}
+
+CTestSuite* CTestSuiteD::CreateSuiteL(	const TDesC& aName )
+/**
+ * CreateSuiteL
+ *
+ * @param aName - Suite name
+ * @return - Suite
+ */
+	{
+	SUB_SUITE;
+#ifndef __GCCXML__
+ 	ADD_TEST_STEP( TestOne );
+ 	ADD_TEST_STEP( TestTwo );
+#endif
+#ifdef __GCCXML__
+ 	ADD_TEST_STEP_CLASS( CTestSuiteD, TestOne );
+ 	ADD_TEST_STEP_CLASS( CTestSuiteD, TestTwo ); 	
+#endif
+ 	ADD_TEST_SUITE( CTestAsyncSuiteA )
+	END_SUITE;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/samplestep.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2005-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:  
+* Example CTestStep derived implementation
+*
+*/
+
+
+
+/**
+ @file SampleStep.cpp
+*/
+#include "samplestep.h"
+#include <testexecutelog.h>
+
+CSampleStep1::~CSampleStep1()
+/**
+ * Destructor
+ */
+	{
+	}
+
+CSampleStep1::CSampleStep1()
+/**
+ * Constructor
+ */
+	{
+	// Call base class method to set up the human readable name for logging
+	SetTestStepName(KSampleStep1);
+	}
+
+TVerdict CSampleStep1::doTestStepPreambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	SetTestStepResult(EPass);
+	return TestStepResult();
+	}
+
+TVerdict CSampleStep1::doTestStepL()
+/**
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ * Demonstrates reading configuration parameters fom an ini file section
+ */
+	{
+	// Use logging macro
+	// Could use Flogger().Write.. directly
+	INFO_PRINTF1(_L("In Test Step"));
+	TInt theInt;
+	TBool theBool;
+	TBuf<40> buf;
+	TPtrC theString;
+	GetIntFromConfig(ConfigSection(),_L("TheInt"),theInt);
+	GetBoolFromConfig(ConfigSection(),_L("TheBool"),theBool);
+	GetStringFromConfig(ConfigSection(),_L("TheString"),theString);
+	buf.Copy(theString);
+	INFO_PRINTF4(_L("TheInt = %d The Bool = %d TheString = %S"),theInt,theBool,&buf);
+	SetTestStepResult(EPass);
+	// Demonstrate panic
+	if(theString == _L("PanicMe"))
+		{
+		const TInt KSampleServerPanic = 1;
+		User::Panic(_L("SampleServer"),KSampleServerPanic);
+		}
+	// Demonstrate fail
+	if(theString != _L("TheString"))
+		{
+		SetTestStepResult(EFail);
+		}
+	User::After(5000000);
+	return TestStepResult();
+	}
+
+TVerdict CSampleStep1::doTestStepPostambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	INFO_PRINTF1(_L("Test Step Postamble"));
+	return TestStepResult();
+	}
+
+///////
+
+CSampleStep2::~CSampleStep2()
+/**
+ * Destructor
+ */
+	{
+	}
+
+CSampleStep2::CSampleStep2(CTEFUnitServer& aParent) : iParent(aParent)
+/**
+ * Constructor
+ */
+	{
+	// Call base class method to set up the human readable name for logging
+	SetTestStepName(KSampleStep2);
+	}
+
+TVerdict CSampleStep2::doTestStepPreambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	INFO_PRINTF1(_L("Test Step Preamble"));
+	SetTestStepResult(EPass);
+	return TestStepResult();
+	}
+
+TVerdict CSampleStep2::doTestStepL()
+/**
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ * Demonstrates reading configuration parameters fom an ini file section
+ */
+	{
+	INFO_PRINTF1(_L("doTestStepL"));
+	User::LeaveIfError(iParent.Fs().Connect());
+	SetTestStepResult(EPass);
+	User::After(5000000);
+	return TestStepResult();
+	}
+
+TVerdict CSampleStep2::doTestStepPostambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	INFO_PRINTF1(_L("Test Step Postamble"));
+	SetTestStepResult(EPass);
+	return TestStepResult();
+	}
+///////
+
+CSampleStep3::~CSampleStep3()
+/**
+ * Destructor
+ */
+	{
+	}
+
+CSampleStep3::CSampleStep3(CTEFUnitServer& aParent) : iParent(aParent)
+/**
+ * Constructor
+ */
+	{
+	// Call base class method to set up the human readable name for logging
+	SetTestStepName(KSampleStep3);
+	}
+
+TVerdict CSampleStep3::doTestStepPreambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	INFO_PRINTF1(_L("Test Step Preamble"));
+	SetTestStepResult(EPass);
+	return TestStepResult();
+	}
+
+TVerdict CSampleStep3::doTestStepL()
+/**
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ * Demonstrates reading configuration parameters fom an ini file section
+ */
+	{
+	INFO_PRINTF1(_L("doTestStepL"));
+	iParent.Fs().Close();
+	SetTestStepResult(EPass);
+	User::After(5000000);
+	return TestStepResult();
+	}
+
+TVerdict CSampleStep3::doTestStepPostambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	INFO_PRINTF1(_L("Test Step Postamble"));
+	INFO_PRINTF1( GetServerName() );
+	SetTestStepResult(EPass);
+	return TestStepResult();
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefunit/test/src/t_testtefunit.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file T_TestUniTEF.cpp
+*/
+
+#include "ctestsuitea.h"
+#include "ctestsuited.h"
+#include "ctestsuiteassert.h"
+#include "ctestasyncsuiteassert.h"
+#include "samplestep.h"
+
+_LIT( KServerName, "TEFUnitTE" );
+
+
+GLDEF_C const TTestName ServerName()
+/**
+ * ServerName
+ *
+ * @return - The TEF server name
+ */
+	{
+	TTestName serverName(KServerName);
+	return serverName;
+	}
+
+GLDEF_C CTestSuite* CreateTestSuiteL()
+/**
+ * CreateTestSuiteL
+ *
+ *	Test Suite Hirarchy
+ *
+ *               TEFUnitSuite---------------------------------
+ *              /           \                 \              \
+ *           SuiteA       SuiteD           SuiteAssert  AsyncSuiteAssert
+ *          /   |  \     /  |   \
+ *      SuiteD One Two One Two  AsyncSuiteA
+ *       /  \                     /    \
+ *     One  Two                 One    Two
+ *
+ * @return - The top level suite
+ */
+	{
+	START_SUITE
+ 	ADD_TEST_SUITE( CTestSuiteA )
+ 	ADD_TEST_SUITE( CTestSuiteD )
+ 	ADD_TEST_SUITE( CTestSuiteAssert )
+ 	ADD_TEST_SUITE( CTestAsyncSuiteAssert )
+	END_SUITE
+	}
+
+GLDEF_C CTestStep* CreateTEFTestStep(const TDesC& aStepName, CTEFUnitServer& aServer)
+	{
+	// Initialise test step object to NULL if no TEF steps are assigned
+	CTestStep* testStep = NULL;
+	if(aStepName == KSampleStep1)
+		testStep = new CSampleStep1();
+	else if(aStepName == KSampleStep2)
+		testStep = new CSampleStep2(aServer);
+	else if(aStepName == KSampleStep3)
+		testStep = new CSampleStep3(aServer);
+	return testStep;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/TestDriver/eventlogserver.xml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!DOCTYPE testSuite SYSTEM "file:///testdriver/xml/testSuite.dtd" [ ]>
+<testSuite>
+	<name>EventLogServer</name>
+
+	<testItems>
+		<test>example</test>
+	</testItems>
+	
+</testSuite>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/TestDriver/example.xml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE testExecuteTest SYSTEM "file:///testdriver/xml/testExecuteTest.dtd" [ ]>
+<testExecuteTest>
+	<name>example</name>
+	<timeout>1000</timeout>
+	<testScripts>
+		<script>
+			<hostPath>\epoc32\EngineeringTools\TEFUtilities\EventLogServer\Scripts\example.script</hostPath>
+			<devicePath>c:\EventLogController\example.script</devicePath>
+		</script>
+	</testScripts>
+	<dependencies>
+		<data>
+			<hostPath>\epoc32\EngineeringTools\TEFUtilities\EventLogServer\data\EventLogControler.ini</hostPath>
+			<devicePath>c:\EventLogController\EventLogControler.ini</devicePath>
+		</data>
+		<data>
+			<hostPath>\epoc32\release\${platform}\${build}\SystemMonitor.dll</hostPath>
+			<devicePath>c:\sys\bin\SystemMonitor.dll</devicePath>
+		</data>
+		<data>
+			<hostPath>\epoc32\release\${platform}\${build}\instrumentationhandler.dll</hostPath>
+			<devicePath>c:\sys\bin\instrumentationhandler.dll</devicePath>
+		</data>		
+		<data>
+			<hostPath>\epoc32\release\${platform}\${build}\EventLogServer.exe</hostPath>
+			<devicePath>c:\sys\bin\EventLogServer.exe</devicePath>
+		</data>
+	</dependencies>
+</testExecuteTest>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/data/eventlogcontroler.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,140 @@
+[EventLog]
+
+Interval  =100
+
+[EventLog2]
+
+Interval    	= 1
+
+
+[EventLog3]
+
+Interval    	= 0
+
+[EventLog4]
+
+
+[Masks1]
+NumberOfMasks =4
+Mask1 =ffffff00
+Mask2 =ffffff01
+Mask3 =ffffff02
+Mask4 =ffffff03
+
+[Masks2]
+NumberOfMasks =1
+Mask1 =fffff000
+
+[Masks3]
+NumberOfMasks =1
+Mask1 =00000000
+
+[Masks4]
+NumberOfMasks =1
+Mask1 =ffffffff
+
+[Masks5]  ////only allow records 1,2,3,256,512,768 and 2048
+NumberOfMasks =3
+Mask1 =fffffffc
+Mask2 =fffffcff
+Mask3 =fffff7ff
+
+[Masks6]
+NumberOfMasks =1
+Mask1 =fffff7ff  //only allow record 2048
+
+[Masks7]
+NumberOfMasks =20
+Mask1 =fffff7ff 
+Mask2 =fffff7ff 
+Mask3 =fffff7ff 
+Mask4 =fffff7ff 
+Mask5 =fffff7ff 
+Mask6 =fffff7ff 
+Mask7 =fffff7ff 
+Mask8 =fffff7ff 
+Mask9 =fffff7ff 
+Mask10 =fffff7ff 
+Mask11 =fffff7ff 
+Mask12 =fffff7ff 
+Mask13 =fffff7ff 
+Mask14 =fffff7ff 
+Mask15 =fffff7ff 
+Mask16 =fffff7ff 
+Mask17 =fffff7ff 
+Mask18 =fffff7ff 
+Mask19 =fffff7ff 
+Mask20 =fffff7ff 
+
+
+[Masks8]
+
+[Masks9] //invalid hex values for test
+NumberOfMasks =2
+Mask1 =Zffff7ff 
+Mask2 =zffff7ff 
+
+[Masks10]
+NumberOfMasks =1
+Mask1 =ffffff7f  //only allow record 128
+
+
+[TestGathererOn]
+TestGathererOn =true
+
+[TestGathererOff]
+TestGathererOn =false
+
+[TestGathererNotFound]
+
+[SectionOne]
+
+Interval    =102
+NumberofRecords =  103
+
+[SectionTwo]
+
+Interval    =0
+NumberofRecords =  2400
+
+
+[SectionThree]
+
+Interval    =1000
+NumberofRecords =  2400
+
+[SectionFour]
+
+Interval    =10
+NumberofRecords =  2400
+
+[SectionFive]
+
+Interval    	= 1000
+NumberofRecords =  2400
+
+[SectionSix]
+
+Interval    =0
+NumberofRecords =  2600
+
+[SectionSeven]
+
+Interval    =10
+NumberofRecords =  5000
+
+[SectionEight]
+
+Interval    =1
+NumberofRecords =  2400
+
+[SectionNine]
+
+Interval    =0
+NumberofRecords =  5000
+
+[SectionTen]
+
+Interval    =1
+NumberofRecords =  5000
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_EXPORTS
+..\testdriver\eventlogserver.xml	\epoc32\engineeringtools\tefutilities\eventlogserver\xml\eventlogserver.xml
+..\testdriver\example.xml		\epoc32\engineeringtools\tefutilities\eventlogserver\xml\eventlogserver\example.xml
+..\scripts\example.script		\epoc32\engineeringtools\tefutilities\eventlogserver\scripts\example.script
+..\data\eventlogcontroler.ini		\epoc32\engineeringtools\tefutilities\eventlogserver\data\eventlogcontroler.ini
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/SystemMonitor/scripts/example.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2005-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: 
+//
+PRINT Run all EventLogServer Tests 
+//
+LOAD_SUITE EventLogServer -SharedData
+//
+#
+
+/verify that the system monitor can be called
+RUN_TEST_STEP 1000 EventLogServer Start  ${SYSDRIVE}\EventLogController\EventLogControler.ini SectionOne
+
+DELAY 1000
+
+RUN_TEST_STEP 1000 EventLogServer Stop  ${SYSDRIVE}\EventLogController\EventLogControler.ini SectionOne
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/Scripts/buildinfologtest.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRINT Test Step to print the OS build version to the log file output
+
+LOAD_SUITE TEFUtilityServer
+
+DELAY 5000
+
+RUN_TEST_STEP	1000	TEFUtilityServer	PrintBuildInfo
+
+PRINT End of PrintBuildInfo Test Step
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/Scripts/formatdrivetest.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRINT Test Step to format a disk drive mentioned in the ini test data
+
+LOAD_SUITE TEFUtilityServer
+
+DELAY 5000
+
+RUN_TEST_STEP	1000	TEFUtilityServer	FormatDrive	${SYSDRIVE}\TEFUtilityServer\FormatDriveTest.ini	formatdrive
+
+PRINT End of FormatDrive Test Step
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/TestDriver/buildinfologtest.xml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE testExecuteTest SYSTEM "file:///testdriver/xml/testExecuteTest.dtd" [ ]>
+<testExecuteTest>
+	<name>BuildInfoLogTest</name>
+	<timeout>1000</timeout>
+	<testScripts>
+		<script>
+			<hostPath>\epoc32\EngineeringTools\TEFUtilities\TEFUtilityServer\Scripts\BuildInfoLogTest.script</hostPath>
+			<devicePath>c:\TEFUtilityServer\BuildInfoLogTest.script</devicePath>
+		</script>
+	</testScripts>
+	
+
+	<dependencies>
+		<data>
+			<hostPath>\epoc32\release\${platform}\${build}\TEFUtilityServer.exe</hostPath>
+			<devicePath>c:\sys\bin\TEFUtilityServer.exe</devicePath>
+		</data>
+		<data>
+			<hostPath>\epoc32\data\buildinfo.txt</hostPath>
+			<devicePath>c:\TEFUtilityServer\data\buildinfo.txt</devicePath>
+		</data>
+	</dependencies>
+
+</testExecuteTest>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/TestDriver/formatdrivetest.xml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE testExecuteTest SYSTEM "file:///testdriver/xml/testExecuteTest.dtd" [ ]>
+<testExecuteTest>
+	<name>FormatDriveTest</name>
+	<timeout>1000</timeout>
+	<testScripts>
+		<script>
+			<hostPath>\epoc32\EngineeringTools\TEFUtilities\TEFUtilityServer\Scripts\FormatDriveTest.script</hostPath>
+			<devicePath>c:\TEFUtilityServer\FormatDriveTest.script</devicePath>
+		</script>
+	</testScripts>
+	
+
+	<dependencies>
+		<data>
+			<hostPath>\epoc32\release\${platform}\${build}\TEFUtilityServer.exe</hostPath>
+			<devicePath>c:\sys\bin\TEFUtilityServer.exe</devicePath>
+		</data>
+		<data>
+			<hostPath>\epoc32\EngineeringTools\TEFUtilities\TEFUtilityServer\Data\FormatDriveTest.ini</hostPath>
+			<devicePath>c:\TEFUtilityServer\FormatDriveTest.ini</devicePath>
+		</data>
+	</dependencies>
+
+</testExecuteTest>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/TestDriver/tefutilityserver.xml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!DOCTYPE testSuite SYSTEM "file:///testdriver/xml/testSuite.dtd" [ ]>
+<testSuite>
+	<name>TEFUtilityServer</name>
+	
+	<testItems>
+		<test>BuildInfoLogTest</test>
+		<test>FormatDriveTest</test>
+	</testItems>
+	
+</testSuite>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/data/formatdrivetest.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+[formatdrive]
+drivename=E:
+formattype=EQuickFormat
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2005-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:  
+// Integration test system build description file for self test suite
+//
+
+PRJ_EXPORTS
+
+tefutilityserver.iby						\epoc32\rom\include\tefutilityserver.iby
+
+..\testdriver\tefutilityserver.xml			\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\tefutilityserver.xml
+..\testdriver\buildInfologtest.xml			\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\tefutilityserver\buildinfologtest.xml
+..\testdriver\formatdrivetest.xml			\epoc32\engineeringtools\tefutilities\tefutilityserver\xml\tefutilityserver\formatdrivetest.xml
+
+..\scripts\buildinfologtest.script			\epoc32\engineeringtools\tefutilities\tefutilityserver\scripts\buildinfologtest.script
+..\scripts\formatdrivetest.script			\epoc32\engineeringtools\tefutilities\tefutilityserver\scripts\formatdrivetest.script
+..\data\formatdrivetest.ini				\epoc32\engineeringtools\tefutilities\tefutilityserver\data\formatdrivetest.ini
+
+PRJ_MMPFILES
+tefutilityserver.mmp
+tefutilityserverlite.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/tefutilityserver.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#if (!defined __TEF_UTILITY_SERVER_IBY__)
+#define __TEF_UTILITY_SERVER_IBY__
+
+//#include <testexecute.iby>
+
+#ifdef TEF_LITE
+data=ABI_DIR\BUILD_DIR\tefutilityserverlite.exe			SHARED_LIB_DIR\tefutilityserverlite.exe
+#else
+data=ABI_DIR\BUILD_DIR\tefutilityserver.exe			SHARED_LIB_DIR\tefutilityserver.exe
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/tefutilityserver.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+SMPSAFE
+
+#include "tefutilityservercommon.mmp"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/tefutilityservercommon.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2005-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:  
+* TEFUtilityServer.mmp
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+SMPSAFE
+#include <platform_paths.hrh>
+
+#if !(defined TEF_LITE_VERSION)
+TARGET      tefutilityserver.exe
+#else
+TARGET      tefutilityserverlite.exe
+#endif
+
+TARGETTYPE  exe
+UID         0x100039CE 0x10281AE1  
+
+CAPABILITY	All -TCB
+
+SOURCEPATH  			../src 
+
+SOURCE				tefutilityserver.cpp
+#if !(defined TEF_LITE_VERSION)
+SOURCE				tefbuildinfologstep.cpp
+#endif
+SOURCE				tefformatdrive.cpp
+
+USERINCLUDE		../inc 
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY     	euser.lib
+LIBRARY			testexecuteutils.lib
+LIBRARY			testexecutelogclient.lib
+#if !(defined TEF_LITE_VERSION)
+LIBRARY			bafl.lib
+#endif
+LIBRARY			efsrv.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/group/tefutilityserverlite.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2005-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:  
+* TEFUtilityServer.mmp
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+SMPSAFE
+
+#include "../../../group/testexecutelite.cfg"
+#include "tefutilityservercommon.mmp"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/inc/tefbuildinfologstep.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2005-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:  
+* CTestStep derived test step class to print OS build version to log file output
+*
+*/
+
+
+
+/**
+ @file TEFBuildInfoLogStep.h
+*/
+
+#if (!defined __TEF_BUILD_INFO_LOG_STEP_H__)
+#define __TEF_BUILD_INFO_LOG_STEP_H__
+
+
+#include <test/testexecutestepbase.h>
+#include <e32std.h>
+#include <f32file.h>
+#if !(defined TEF_LITE)
+#include <bautils.h>
+#endif
+_LIT(KPrintBuildInfo,"PrintBuildInfo");
+_LIT(KBuildInfoFilePath,"?:\\TEFUtilityServer\\data\\BuildInfo.txt");
+_LIT8(KBuildNumberFlag,"ManufacturerSoftwareBuild");
+
+const TInt KOffsetToBuildNumber = 27; // Length of ManufacturerSoftwareBuild + 2 spaces 
+const TInt KLengthOfBuildNumber = 5; // Length of current build number
+
+class CTEFBuildInfoLogStep : public CTestStep
+{
+public:
+	CTEFBuildInfoLogStep();
+public:
+	virtual	TVerdict	doTestStepL();
+	virtual	TVerdict	doTestStepPreambleL();
+	virtual	TVerdict	doTestStepPostambleL();
+
+private:
+	RFs		iFs;
+	// Keeps the status of the file server session object
+	TBool	iSessionConnected;	
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/inc/tefformatdrive.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2005-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:  
+* This Test step formats the specified drive
+*
+*/
+
+
+
+/**
+ @file TEFFormatDrive.h
+*/
+
+#if (!defined __TEF_FORMAT_DRIVE_H__)
+#define __TEF_FORMAT_DRIVE_H__
+
+
+#include <test/testexecutestepbase.h>
+#include <f32file.h>
+
+class CTEFFormatDrive : public CTestStep
+{
+public:
+	CTEFFormatDrive();
+public:
+	virtual	TVerdict	doTestStepL();
+	virtual	TVerdict	doTestStepPreambleL();
+	virtual	TVerdict	doTestStepPostambleL();
+
+private:
+	void ReadDriveNameL(TDriveUnit &aDriveName);
+	TInt PreParseFileNameL(const TDesC& aInputFileName, HBufC*& aOutputFileName);	
+	TInt FormatDiskL(TPtrC aDrivePath, TPtrC aFormatType, TBool& aFormatFlag);	
+private:
+	RFs		iFs;
+
+};
+
+_LIT(KFormatDrive,"FormatDrive");
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/inc/tefutiltityserver.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005-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:  
+* Test Server to run utility tests supported by TEF
+*
+*/
+
+
+
+/**
+ @file TEFUtilityServer.h
+*/
+
+#if (!defined __TEF_UTILTITY_SERVER_H__)
+#define __TEF_UTILTITY_SERVER_H__
+
+#include <test/testexecuteserverbase.h>
+
+/**
+This class will initialise test steps and return pointer to TEF
+*/
+class  CTEFUtilityServer : public CTestServer
+{
+public:
+	static CTEFUtilityServer*	NewL();
+	virtual CTestStep*			CreateTestStep(const TDesC& aStepName);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/src/tefbuildinfologstep.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005-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:  
+* CTestStep derived class implementation to print OS build version to log file output
+*
+*/
+
+
+
+/**
+ @file TEFBuildInfoLogStep.cpp
+*/
+
+#include "tefbuildinfologstep.h"
+#include <test/wrapperutilsplugin.h>
+#include <test/tefutils.h>
+
+CTEFBuildInfoLogStep::CTEFBuildInfoLogStep()
+	{
+	SetTestStepName(KPrintBuildInfo);
+	}
+
+/**
+ * Run preamble scripts for the test
+ * Make the connection with the File Server and creates a session object
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ */
+TVerdict CTEFBuildInfoLogStep::doTestStepPreambleL()
+	{
+	User::LeaveIfError(iFs.Connect());
+	iSessionConnected=ETrue;
+	return TestStepResult();
+	}
+
+/**
+ * Run postample scripts for the test
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ */
+TVerdict CTEFBuildInfoLogStep::doTestStepPostambleL()
+	{
+	iFs.Close();
+	iSessionConnected=EFalse;
+	return TestStepResult();
+	}
+
+/**
+ * Overrides base class virtual
+ * @return - TVerdict codes
+ * Parses buildinfo.txt from \epoc32\... and prints it to TEF log file outout
+ */
+TVerdict CTEFBuildInfoLogStep::doTestStepL()
+	{
+	const TInt KBuildVersionMaxLength = 128;
+	const TInt KBuildInfoFileMaxLength = 256;
+
+	RFs fileServer;
+	TVersionName version(fileServer.Version().Name());
+	TDriveName defaultSysDrive(_L("C:"));	
+	RLibrary pluginLibrary;
+	CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary);
+	
+	if (plugin!=NULL)
+		{
+		TDriveUnit driveUnit(plugin->GetSystemDrive());
+		defaultSysDrive.Copy(driveUnit.Name());
+		delete plugin;
+		pluginLibrary.Close();
+		}
+
+	TBuf<KBuildVersionMaxLength> text;
+	TInt startOfData;
+	TBuf8<KBuildInfoFileMaxLength> buf;
+
+	TFileName buildInfoFilePath(KBuildInfoFilePath);
+	buildInfoFilePath.Replace(0, 2, defaultSysDrive);
+
+	SetTestStepResult(EFail);
+	if(BaflUtils::FileExists(iFs,buildInfoFilePath))
+		{
+		if (!(iFs.IsFileOpen(buildInfoFilePath,iSessionConnected)))
+			{													
+			RFile file;			
+			User::LeaveIfError(file.Open(iFs, buildInfoFilePath, EFileShareAny));							
+			User::LeaveIfError(file.Read(buf));
+			startOfData = buf.Find(KBuildNumberFlag);
+			if(!(startOfData==KErrNotFound))  // if build number flag present
+				{
+				startOfData += KOffsetToBuildNumber;
+				if((KLengthOfBuildNumber+startOfData)<=buf.Length())  // if build number present
+					{
+					text.Copy(buf.Mid(startOfData));
+					INFO_PRINTF2(_L("Build version is %S"),&text);
+					SetTestStepResult(EPass);
+					}
+				else
+					{
+					INFO_PRINTF1(_L("Build number is not specified along with ManufacturerSoftwareBuild flag"));
+					}
+				}
+			else
+				{
+				INFO_PRINTF1(_L("ManufacturerSoftwareBuild flag is not found in the buildinfo.txt file"));
+				}
+			file.Close();
+			}	
+		}
+	else 
+		{
+		INFO_PRINTF2(_L("%S -  file not found"), &buildInfoFilePath);
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/src/tefformatdrive.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2005-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:  
+* This class implements the formdrive test step to format given drive
+*
+*/
+
+
+
+/**
+ @file TEFFormaDrive.cpp
+*/
+
+#include "tefformatdrive.h"
+
+//literals
+
+_LIT(KFormatType,		"formattype");
+_LIT(KDriveName,		"drivename");
+
+_LIT(KDriveSeperator,	":");
+_LIT(KDeviceSeperator,	"\\\\");
+_LIT(KDirSeperator,		"\\");
+
+
+/**
+ This is constructor,which sets the test step name
+*/
+CTEFFormatDrive::CTEFFormatDrive()
+	{
+	SetTestStepName(KFormatDrive);
+	}
+
+/**
+ * Run preamble scripts for the test
+ * Make the connection with the File Server and creates a session object
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ */
+TVerdict CTEFFormatDrive::doTestStepPreambleL()
+	{
+	User::LeaveIfError(iFs.Connect());
+	return TestStepResult();
+	}
+
+/**
+ * Run postample scripts for the test
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ */
+TVerdict CTEFFormatDrive::doTestStepPostambleL()
+	{
+	iFs.Close();
+	return TestStepResult();
+	}
+
+/**
+ * Overrides base class virtual
+ * @return - TVerdict codes
+ * Parses buildinfo.txt from \epoc32\... and prints it to TEF log file outout
+ */
+TVerdict CTEFFormatDrive::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Formating Disk"));
+	
+	TDriveUnit	driveUnit;
+	ReadDriveNameL(driveUnit);
+
+	//	Get the format type
+	TPtrC	formatType;
+	if(!GetStringFromConfig(ConfigSection(), KFormatType, formatType))
+		{
+		WARN_PRINTF1(_L("No format type specified - default is EFullFormat"));
+		}
+
+	if(TestStepResult() == EPass)
+		{
+		TBool		formatFlag=EFalse;
+		TDriveName	drivePath(driveUnit.Name());
+		//Format the specified driver.
+		TInt		errCode= FormatDiskL(drivePath, formatType, formatFlag);
+
+		if(formatFlag)
+			{
+			INFO_PRINTF1(_L("Disk is fully formatted"));
+			SetTestStepResult(EPass);
+			}
+		else
+			{
+			INFO_PRINTF2(_L("Error in formatting %D"), errCode);
+			SetTestStepResult(EFail);
+			SetTestStepError(errCode);
+			}
+		}
+
+	return TestStepResult();
+	}
+/**
+This functions reads the drive name specified in the ini file
+@param aDriveName - specifies the drive name
+@panic - system wide error
+*/
+void CTEFFormatDrive::ReadDriveNameL(TDriveUnit &aDriveName)
+{
+	TPtrC driveName;
+	//read the drive name from ini file
+	TInt result = GetStringFromConfig(ConfigSection(),KDriveName,driveName);
+	if(result)
+		{
+		INFO_PRINTF2(_L("Drive name is %S"),&driveName);
+		HBufC*	drivePath;
+		TInt	parseRet=PreParseFileNameL(driveName, drivePath);
+		CleanupStack::PushL(drivePath);
+
+		if ( parseRet==KErrNone )
+			{
+			aDriveName=drivePath->Des();
+			}
+		else
+			{
+			ERR_PRINTF2(_L("Drive %S illegal"), &driveName);
+			SetTestStepResult(EFail);
+			}
+			CleanupStack::PopAndDestroy(drivePath);
+		}
+		else
+		{
+		 ERR_PRINTF1(_L("Unable to read the drive name"));
+		 SetTestStepResult(EFail);
+		}	
+}
+/**
+This method to parse a file name which may include the device name
+@param aInputFileName - input file name which may contain the drive name also
+@param aOutputFileName - holds the return value.
+@panic - system wide error
+*/
+TInt CTEFFormatDrive::PreParseFileNameL(const TDesC& aInputFileName, HBufC*& aOutputFileName)
+	{
+	aOutputFileName=HBufC::NewL(aInputFileName.Length());
+
+	TInt	ret=KErrNone;
+	const	TDesC&	sep=KDeviceSeperator;
+
+	if ( aInputFileName.FindC(sep) == 0 )
+		{
+		//	Starts with device name
+		TPtrC	strippedFileName=aInputFileName.Right(aInputFileName.Length()-sep.Length());
+		INFO_PRINTF2(_L("DeviceSeperator stripped %S"), &strippedFileName);
+
+		TInt	find=strippedFileName.Find(KDirSeperator);
+		TPtrC	driveName(find==KErrNotFound
+							? strippedFileName
+							: strippedFileName.Left(find));
+
+		INFO_PRINTF2(_L("Drive name %S"), &driveName);
+		TFileName	driveNameRead;
+		TInt		drive;
+		TBool		found=EFalse;
+		for ( drive=EDriveA; (drive<=EDriveZ) && (!found); )
+			{
+			if ( iFs.GetDriveName(drive, driveNameRead)==KErrNone )
+				{
+				if ( driveNameRead.Length()>0 )
+					{
+					INFO_PRINTF3(_L("Drive %c:='%S'"), TUint(drive+'A'), &driveNameRead);
+					}
+				found=(driveName.Compare(driveNameRead)==0);
+				}
+			if ( !found )
+				{
+				++drive;
+				}
+			}
+
+		if ( found )
+			{
+			TPtr	ptrTemp=aOutputFileName->Des();
+			ptrTemp.Format(_L("%c"), TUint(drive+'A'));
+			ptrTemp.Append(KDriveSeperator);
+			ptrTemp.Append(strippedFileName.Right(strippedFileName.Length()-driveName.Length()));
+			}
+		else
+			{
+			WARN_PRINTF2(_L("Drive %S not found"), &driveName);
+			ret=KErrNotFound;
+			SetTestStepResult(EFail);
+			}
+		}
+	else
+		{
+		*aOutputFileName=aInputFileName;
+		}
+
+	return ret;
+	}
+/**
+ This functions reads the type of format that users wants to do and also drive name
+ @param aDrivePath - path of the drive to be formated
+ @param aFormatType - type of format 
+ @param aFormatFlag - flag
+ 
+*/
+TInt CTEFFormatDrive::FormatDiskL(TPtrC aDrivePath, TPtrC aFormatType, TBool& aFormatFlag)
+{
+
+	TInt	errCode=KErrNone;
+	//Format type default to EFullFormat
+	TUint	formatType=EFullFormat;
+	if(aFormatType == _L("EHighDensity"))
+		{
+		formatType = EHighDensity;
+		}
+	else if(aFormatType == _L("ELowDensity"))
+		{
+		formatType = ELowDensity;
+		}
+	else if(aFormatType == _L("EQuickFormat"))
+		{
+		formatType = EQuickFormat;
+		}
+	else if((aFormatType == _L("EFullFormat")) || (aFormatType.Length() == 0))
+		{
+		formatType = EFullFormat;
+		}
+	else
+		{
+		ERR_PRINTF2(_L("Illegal format type %S."), &aFormatType);
+		errCode=KErrArgument;
+		}
+
+	aFormatFlag = EFalse;
+
+	if ( errCode == KErrNone )
+		{
+		//Open the format object for format
+		//Format object to format.
+		RFormat	formatObj;
+
+		//To hold the number of tracks in the disk
+		TInt	trackCount=0;
+
+		//Error code
+		errCode = formatObj.Open(iFs, aDrivePath, formatType, trackCount);
+		switch ( errCode )
+			{
+		case KErrNone:
+			//Format while track remains for formating
+			while(trackCount>0)
+				{
+				errCode = formatObj.Next(trackCount);
+				if(errCode != KErrNone)
+					{
+					ERR_PRINTF2(_L("Error %d formatObj.Next."), errCode);
+					ERR_PRINTF2(_L("Drive Path  %S."), &aDrivePath);
+					ERR_PRINTF2(_L("Format Type %d."), formatType);
+					ERR_PRINTF2(_L("Track Count %d."), trackCount);
+					aFormatFlag = EFalse;
+					break;
+					}
+				else
+					{
+					aFormatFlag = ETrue;
+					}
+				}
+			formatObj.Close();
+			break;
+		default:
+			ERR_PRINTF2(_L("Error %d formatObj.Open."), errCode);
+			ERR_PRINTF2(_L("Drive Path  %S."), &aDrivePath);
+			ERR_PRINTF2(_L("Format Type %d."), formatType);
+			ERR_PRINTF2(_L("Track Count %d."), trackCount);
+			}
+		}
+
+	return errCode;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/TEFUtilityServer/src/tefutilityserver.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2005-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:  
+* Basic Test Server implementation to instantiate tests and return a pointer to run tests
+*
+*/
+
+
+
+/**
+ @file TEFUtilityServer.cpp
+*/
+
+#include "tefutiltityserver.h"
+#include "tefbuildinfologstep.h"
+#include "tefformatdrive.h"
+
+/**
+ * @name Constant Literals used
+ */
+_LIT(KServerName,"TEFUtilityServer");
+
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+CTEFUtilityServer* CTEFUtilityServer::NewL()
+	{
+	CTEFUtilityServer*	server = new (ELeave) CTEFUtilityServer();
+	CleanupStack::PushL(server);
+	// CServer base class call
+	server->ConstructL(KServerName);
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+LOCAL_C void MainL()
+	{
+	#if (defined __DATA_CAGING__)
+		RProcess().DataCaging(RProcess::EDataCagingOn);
+		RProcess().SecureApi(RProcess::ESecureApiOn);
+	#endif
+	CActiveScheduler*	sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CTEFUtilityServer*	server = NULL;
+	// Create the CTestServer derived server
+	TRAPD(err,server = CTEFUtilityServer::NewL());
+	if(!err)
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	delete server;
+	delete sched;
+	}
+
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+GLDEF_C TInt E32Main()
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
+
+/**
+ * @return - A CTestStep derived instance
+ * Implementation of CTestServer pure virtual
+ */
+CTestStep* CTEFUtilityServer::CreateTestStep(const TDesC& aStepName)
+	{
+	CTestStep* testStep = NULL;
+	
+	if(aStepName == KPrintBuildInfo)
+		{
+#if !(defined TEF_LITE)
+		testStep = new CTEFBuildInfoLogStep();
+#endif
+		}
+	
+	if(aStepName == KFormatDrive)
+		{
+		testStep = new CTEFFormatDrive();
+		}
+			 
+	return testStep;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,17 @@
+//
+// Copyright (c) 2005-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:  
+// Integration test system build description file for self test suite
+//
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/bwins/plattest_platsecu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewServer@@YAHXZ @ 1 NONAME ; int __cdecl NewServer(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/bwins/sampleserveru.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewServer@@YAHXZ @ 1 NONAME ; int __cdecl NewServer(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/cleanup/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2005-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:  
+// Integration test system build description file for self test suite
+//
+
+
+PRJ_MMPFILES
+cleanup.mmp
+
+PRJ_EXPORTS
+tefcleanup.iby \epoc32\rom\include\tefcleanup.iby
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/cleanup/group/cleanup.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+SMPSAFE
+#include <platform_paths.hrh>
+
+TARGET			tefcleanup.exe
+TARGETTYPE		exe
+UID			0x100039CE 0x101FF344
+
+#if (!defined __NO_VENDORID__)
+VENDORID		0x70000001
+#endif
+
+CAPABILITY		Tcb
+
+SOURCEPATH		../Src
+
+SOURCE			Cleanup.cpp
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY			euser.lib
+LIBRARY			efsrv.lib
+LIBRARY			testexecuteutils.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/cleanup/group/tefcleanup.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __TEFCLEANUP_IBY__
+#define __TEFCLEANUP_IBY__
+
+
+data=ABI_DIR\BUILD_DIR\tefcleanup.exe				SHARED_LIB_DIR\tefcleanup.exe
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/cleanup/src/cleanup.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2005-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:  
+* Plattest_Platsec_Cleanup.exe
+* Deletes the file specified in the command line. 
+* Command Line Syntax:
+* Plattest_Platsec_Cleanup.exe <Filename>
+* <Filename> can be with path or without path. If path is not
+* specified, the default path of c:\sys\bin\ will be taken.
+*
+*/
+
+
+
+/**
+ @file cleanup.cpp
+*/
+
+
+//Epoc include
+#include <f32file.h>
+#include <f32image.h>
+#include <wrapperutilsplugin.h>
+#include <test/tefutils.h>
+
+TParse FileName;
+
+_LIT(KDefaultExePath,"?:\\sys\\bin\\");
+
+/**
+ Parses the Command Line arguments
+ @return TInt - KErrNone if no error else, system wide error codes
+*/
+TInt ParseCommandLine()
+      {
+	TDriveName defaultSysDrive(_L("C:"));
+	RFs fileServer;
+	TVersionName version(fileServer.Version().Name());
+	
+	RLibrary pluginLibrary;
+	CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary);
+	
+	if (plugin!=NULL)
+		{
+		TDriveUnit driveUnit(plugin->GetSystemDrive());
+		defaultSysDrive.Copy(driveUnit.Name());
+		delete plugin;
+		pluginLibrary.Close();
+		}
+
+	  TBuf<256> c;
+      
+      User::CommandLine(c);
+
+      TLex l(c);
+
+	  TFileName defaultExePath(KDefaultExePath);
+	  defaultExePath.Replace(0, 2, defaultSysDrive);
+
+      if(FileName.SetNoWild(l.NextToken(),0,&defaultExePath)!=KErrNone)
+            return KErrArgument;
+
+      // Check we used all the arguments
+      if (l.NextToken() != KNullDesC)
+            return KErrArgument;
+
+      return KErrNone;
+      }
+
+
+TInt E32Main()
+	{
+	TInt r;
+
+	//Parses the command line
+	r = ParseCommandLine();
+	if(r!=KErrNone)
+		return r;
+
+	//Connects with FileServer
+	RFs Fs;
+	r = Fs.Connect();
+	if(r!=KErrNone)
+		return r;
+
+	//Deletes the File specified
+	r= Fs.Delete(FileName.FullName());
+	if(r != KErrNone)
+		return r;
+
+	//Closes the sesssion with FileServer
+	Fs.Close();
+
+	return r;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/data/capabilitypolicing.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1017 @@
+[default]
+CapabilityTest = YES
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//For Section 1
+//////////////////////////////////////////////////////////////////////////////////////////////////
+[CONTACTS_CAP]
+executable		=PlatTest_contacts.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Contacts_Cap.exe
+capabilities		=ReadUserData
+
+[MESSAGING_CAP]
+executable		=PlatTest_Mess.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Mess_Cap.exe
+capabilities		=ReadUserData
+
+[TELEPHONY_CAP]
+executable		=PlatTest_Telephony.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Telephony_Cap.exe
+capabilities		=ReadDeviceData
+
+[COMMDB_CAP]
+executable		=PlatTest_Commdb.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Commdb_cap.exe
+capabilities		=ReadUserData
+
+[AGENDA_CAP]
+executable		=PlatTest_agenda.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_agenda_Cap.exe
+capabilities		=ReadUserData
+
+//For the test cases
+[CreateDB_Contacts]
+filename		=${SYSDRIVE}\Private\100012a5\PT_Contacts.cdb
+ExpectedCapCheckResult	=EFalse
+
+[AddEntries]
+filename		=${SYSDRIVE}\Private\100012a5\PT_Contacts.cdb
+count			=5
+firstname1		=FirstName1
+lastname1		=LastName1
+company1		=own company
+job1			=CEO and Chairman
+workphone1		=12345678
+workemail1		=firstname1.lastname1@symbian.com
+firstname2		=FirstName2
+lastname2		=LastName2
+company2		=Company2
+job2			=engineer
+workphone2		=11111111
+workemail2		=firstname2.lastname2@symbian.com
+FirstNamePrn2		=firstnameprn2
+LastNamePrn2		=lastnameprn2
+CompanyNamePrn2		=companynameprn2
+firstname3		=firstname3
+lastname3		=lastname3
+company3		=company3
+job3			=star
+workmobile3		=100000000
+fax3			=100000001
+workemail3		=firstname3.lastname3@symbian.com
+internet3		=www.internet3.com
+street3			=Street3 Road
+town3			=Town3
+county3			=County3
+postcode3		=W1
+country3		=Country3
+FirstNamePrn3		=firstnameprn3
+LastNamePrn3		=lastnameprn3
+CompanyNamePrn3		=companynameprn3
+firstname4		=firstname4
+lastname4		=lastname4
+company4		=Music
+job4			=Singer
+workemail4		=firstname4.lastname4@symbian.com
+FirstNamePrn4		=firstnameprn4
+LastNamePrn4		=lastnameprn4
+CompanyNamePrn4		=companynameprn4
+firstname5		=firstname5
+lastname5		=lastname5
+company5		=company5
+job5			=Chain Smoker
+workphone5		=222222222222
+workemail5		=firstname5.lastname5@symbian.com
+picturename		=${SYSDRIVE}\plattest\contacts\contacts.jpg
+FirstNamePrn5		=firstnameprn5
+LastNamePrn5		=lastnameprn5
+CompanyNamePrn5		=companynameprn5
+ExpectedCapCheckResult	=EFalse
+
+[Export]
+filename		=${SYSDRIVE}\Private\100012a5\PT_Contacts.cdb
+export1			=${SYSDRIVE}\PlatTest\platsec\PT_Capability.vcf
+key1			=Umesh
+ExpectedCapCheckResult	=EFalse
+
+[RootFolder]
+depth=0
+ExpectedCapCheckResult	=EFalse
+
+[PopAccount]
+accountname		=pt_capability
+myname			=pt_capabilityaccount
+username		=ktl1@blr.cityonlines.com
+password		=1234
+emailaddress		=ktl1@blr.cityonlines.com
+outserver		=blr.cityonlines.com
+inserver		=blr.cityonlines.com
+from			=PT_capability test
+iap			=19
+ExpectedCapCheckResult	=EFalse
+
+[HangupIAPCall]
+iap			=19
+ExpectedCapCheckResult	=EFalse
+
+[CreateEmail]
+from			=PT_capability
+to			=ktl1@blr.cityonlines.com
+subject			=PT_capability test
+body			=${SYSDRIVE}\PlatTest\Platsec\cap_message.txt
+priority		=low
+attachments		=1
+attachment1		=${SYSDRIVE}\PlatTest\platsec\PT_Capability.vcf
+ExpectedCapCheckResult	=EFalse
+
+[SendEmail]
+subject			=PT_capability test
+ExpectedCapCheckResult	=EFalse
+
+[SetField]
+tablename		=DialOutISP
+tableindex		=6
+setting			=IpNameServer1
+type			=Text
+value			=1.1.1.1
+ExpectedCapCheckResult	=EFalse
+
+[CreateDB_Agenda]
+filename		=${SYSDRIVE}\private\10003A5B\PT_Agenda
+ExpectedCapCheckResult	=EFalse
+
+[AddAppts]
+filename		=${SYSDRIVE}\private\10003A5B\PT_Agenda
+count			=3
+year1			=2002
+month1			=9
+day1			=15
+hour1			=9
+min1			=0
+duration1		=15
+message1		=make a cup of tea
+year2			=2002
+month2			=9
+day2			=16
+hour2			=14
+min2			=0
+duration2		=60
+message2		=football
+year3			=2002
+month3			=9
+day3			=15
+hour3			=12
+min3			=0
+duration3		=30
+message3		=have lunch
+ExpectedCapCheckResult	=EFalse
+
+[PopAccount_IAP]
+accountname=Pop Account
+myname=Pop Account (CSD)
+username=mdgi15
+password=vethihiz
+emailaddress=mdgi15@dial.pipex.com
+outserver=smtp.dial.pipex.com
+inserver=pop.dial.pipex.com
+iap=6
+ExpectedCapCheckResult	=EFalse
+
+[ConnectIap]
+iap			=19
+ExpectedCapCheckResult	=EFalse
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//For section 2
+//////////////////////////////////////////////////////////////////////////////////////////////////
+[ALARMSERVER_CAP_RD]
+executable		=PlatTest_Alarmserver.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Alarmserver_Cap_RD.exe
+capabilities		=ReadUserData
+
+[AGENDA_CAP_RD]
+executable		=PlatTest_agenda.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_agenda_Cap_RD.exe
+capabilities		=ReadUserData
+
+[COMMDB_CAP_RD]
+executable		=PlatTest_Commdb.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Commdb_cap_RD.exe
+capabilities		=ReadUserData
+
+[CONTACTS_CAP_RD]
+executable		=PlatTest_Contacts.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Contacts_Cap_RD.exe
+capabilities		=ReadUserData
+
+[TELEPHONY_CAP_RD]
+executable		=PlatTest_Telephony.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Telephony_Cap_RD.exe
+capabilities		=ReadUserData
+
+[HTTP_CAP_RD]
+executable		=PlatTest_Http.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Http_cap_RD.exe
+capabilities		=ReadUserData
+
+[IPSUITE_CAP_RD]
+executable		=PlatTest_Ip.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Ip_Cap_RD.exe
+capabilities		=ReadUserData
+
+[MESS_CAP_RD]
+executable		=PlatTest_Mess.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Mess_cap_RD.exe
+capabilities		=ReadUserData
+
+[OBEX_CAP_RD]
+executable		=PlatTest_Obex.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Obex_cap_RD.exe
+capabilities		=ReadUserData
+
+[MULTIMEDIA_CAP_RD]
+executable		=PlatTest_Multimedia.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Multimedia_cap_RD.exe
+capabilities		=ReadUserData
+
+[FILESTORE_CAP_RD]
+executable		=PlatTest_FileStore.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_FileStore_cap_RD.exe
+capabilities		=ReadUserData
+
+//TestCases
+
+//TestCase 1
+[SetAlarm_RD]
+count			=1
+category1		=12
+status1			=1
+message1		=Alarm for next minute1
+repeatalarm1		=1
+soundfile1		=Alarm doesn't have a sound file
+name1			=ganga5
+
+[SnoozeAlarm_RD]
+count			=1
+name1			=ganga5
+
+[DeleteAlarm_RD]
+count			=1
+name1			=ganga5
+
+//End of TestCase 1
+
+//TestCase 8
+[SetField_RD]
+tablename		=DialOutISP
+tableindex		=3
+setting			=Name
+type			=Text
+value			=NT RAS1
+
+//End of TestCase 8
+
+//TestCase 10
+[CreateDB_Agenda_RD]
+filename		=c:PTAgenda
+
+[AddAppts_RD]
+filename		=c:PTAgenda
+count			=1
+year1			=2002
+month1			=9
+day1			=15
+hour1			=9
+min1			=0
+duration1		=15
+message1		=make a cup of tea
+
+[AddToDo_RD]
+filename		=c:PTAgenda
+count			=1
+isalarm			=0
+name1			=TestToDoList1
+todocount1		=2
+summary11		=ToDoList1 - Meeting1
+location11		=RoomNo1
+priority11		=5
+alarm11			=1
+daywarning11	=0
+time11			=525
+duration11		=1
+
+[AddAnniversary_RD]
+filename		=c:PTAgenda
+year1			=2002
+month1			=9
+day1			=25
+hour1			=17
+min1			=0
+duration1		=30
+message1		=Anniversary in repeat mode!!
+
+[AddEvents_RD]
+filename		=c:PTAgenda
+year1			=2002
+month1			=9
+day1			=25
+hour1			=10
+min1			=0
+message1		=To Organise Meeting !!
+alarm1			=0
+
+//End of TestCase 10
+
+//TestCase 11
+[Edit_Appt_RD]
+filename		=c:PTAgenda
+key1			=make a cup of tea
+keyyearstart1		=2002
+keymonthstart1		=9
+keydaystart1		=15
+message1		=make a new cup of tea
+//End of TestCase 11
+
+//TestCase 13
+[Delete_Appt_RD]
+filename		=c:PTAgenda
+key1			=make a cup of tea
+keyyearstart1		=2002
+keymonthstart1		=9
+keydaystart1		=15
+//End of TestCase 13
+
+//TestCase 14
+[Import_01_RD]
+filename		=c:PTAgenda
+import1			=${SYSDRIVE}\PlatTest\Platsec\PlatTest.vcs
+//End of TestCase 14
+
+//TestCase 25
+[ScanDisk_RD]
+drivename=D:
+//End of TestCase 25
+
+//TestCase 26
+[FormatDisk_RD]
+drivename=D:
+formattype=EQuickFormat
+//End of TestCase 26
+
+//TestCase 27
+[CreateDB_Contacts_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+
+[AddEntries_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+count			=1
+firstname1		=firstname1
+lastname1		=lastname1
+company1		=company1
+job1			=Cricket fan
+workphone1		=0207
+workemail1		=firstname1.lastname1@symbian.com
+
+[DeleteEntries_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+count			=1
+key1			=Feroz
+//End of TestCase 27
+
+//TestCase 29
+[Export_VCard_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+export1			=${SYSDRIVE}\PlatTest\PlatTest.vcf
+key1			=Feroz
+
+[BtSend_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+DeviceName		=Bojangles
+ProtocolName		=BTLinkManager
+class			=OBEX
+attribute		=IrDA:TinyTP:LsapSel
+tempfile		=${SYSDRIVE}\PlatTest\PlatTest.vcf
+count			=1
+key1			=Feroz
+security		=False
+//End of TestCase 29
+
+//TestCase 30
+[Import_VCard_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+import1			=${SYSDRIVE}\PlatTest\Platsec\ValidContact.vcf
+//End of TestCase 30
+
+//TestCase 31
+[EditEntries_Contacts_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+count			=1
+key1			=key1
+firstname1		=firstname1
+lastname1		=lastname1
+workemail1		=firstname1.lastname1@symbian.com
+//End of TestCase 31
+
+//TestCase 32
+[SortEntries_Contacts_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+sortcriteria	=KUidContactFieldGivenName
+//End of TestCase 32
+
+//TestCase 37
+[AudioPlay_RD]
+filename=${SYSDRIVE}\PlatTest\Platsec\16BitPcm.wav
+open=NewFilePlayerL
+volume=6
+volumeramp=5
+//End of TestCase 37
+
+//TestCase 39
+[BtDiscover_RD]
+DeviceName		=Bojangles
+ProtocolName		=BTLinkManager
+timeout			=20000
+//End of TestCase 39
+
+//TestCase 40
+[BtSend_RD]
+ProtocolName		=BTLinkManager
+timeout			=200000
+count			=5
+security		=FALSE
+passkey			=1234
+targetDeviceName	=Bojangles
+transportlayer		=BT
+filename1		=${SYSDRIVE}\plattest\platsec\symbian_Preq64.gif
+type1			=image/gif
+//End of TestCase 40
+
+//TestCase 42
+[MakeNewVoiceCall_RD]
+expectedresult		=0
+sectionnumber		=1
+telnumber		=+919845775893
+iap			=1
+
+[HangupVoiceCall_RD]
+
+key			=Venkat
+calltobeanswered	=FALSE
+iap			=1
+linenumber              =1
+//End of TestCase 42
+
+//TestCase 47
+[QueryNetworkData_01_RD]
+registrationstatus	=5
+currentnetworkinfo	=TRUE
+networkmode		=2
+networkstatus		=0
+networkcountrycode	=ABCD
+networkshortname	=Voda
+networklongname		=Vodafone_UK
+iap			=1
+sectionnumber		=2
+//End of TestCase 47
+
+//TestCase 48
+[QueryNetworkData_02_RD]
+registrationstatus	=5
+currentnetworkinfo	=TRUE
+networkmode		=2
+networkstatus		=0
+networkcountrycode	=ABCD
+networkshortname	=Voda
+networklongname		=Vodafone_UK
+iap			=1
+sectionnumber		=2
+//End of TestCase 48
+
+//TestCase 49
+[EditNamStatus_RD]
+namOperation		=UnlockNam
+loadtsy			=ETrue
+iap			=1
+spcPassword		=2222
+//End of TestCase 49
+
+//TestCase 52
+[CreateSms_RD]
+SaveInDraft=EFalse
+body=${SYSDRIVE}\PlatTest\Platsec\Sms.txt
+text=SMS message 1
+to1=1234567890
+DeliveryReport=NO
+
+[SendSms_01_RD]
+text=SMS message 1
+CancelSms=EFalse
+
+//End of TestCase 52
+
+//TestCase 54
+[DeleteMessages_SMS_RD]
+count=1
+sourceFolder1_1=Local
+sourceFolder1_2=Outbox
+messageType1=SMS
+processMsgBy1=UseMsgType
+//End of TestCase 54
+
+//TestCase 55
+[CreateEms_RD]
+to1=1234567890
+body=${SYSDRIVE}\PlatTest\Platsec\Ems.txt
+elements=1
+StartPosition1=1
+Type1=Format
+FormatLength1=10
+Underline1=TRUE
+Bold1=TRUE
+FontSize1=Normal
+Alignment1=RightAlign
+text=EMS message 1
+[SendSms_02_RD]
+text=EMS message 1
+
+//End of TestCase 55
+
+//TestCase 57
+[DeleteMessages_EMS_RD]
+count=1
+sourceFolder1_1=Local
+sourceFolder1_2=Outbox
+messageType1=SMS
+processMsgBy1=UseMsgType
+//End of TestCase 57
+
+//TestCase 58
+[ForwardMessage_EMS_RD]
+depth=3
+folder1=Local
+folder2=Outbox
+folder3=EMS message 1
+includeBody=TRUE
+includeRecipient=TRUE
+EditRecipients=1
+recipient1=1234567890
+body=${SYSDRIVE}\PlatTest\Platsec\ems.txt
+elements=0
+Musthavedata=EFalse
+//End of TestCase 58
+
+//TestCase 63
+[CreateEmail_RD]
+from=Ktl1
+to=mdgi14@dial.pipex.com
+subject=Email Message 1
+body=${SYSDRIVE}\PlatTest\Platsec\Email.txt
+priority=low
+characterSetType=ChineseGB2312
+
+[SendEmail_01_RD]
+subject=Email Message 1
+text=Email Message 1
+priority=low
+
+//End of TestCase 63
+
+//TestCase 65
+[DeleteMessages_Email_RD]
+count=1
+sourceFolder1_1=Local
+sourceFolder1_2=Outbox
+messageType1=POP3
+processMsgBy1=UseMsgType
+//End of TestCase 65
+
+//TestCase 66
+[ForwardMessage_Email_RD]
+depth=3
+folder1=Local
+folder2=Outbox
+folder3=Email Message 1
+includeBody=TRUE
+includeRecipient=TRUE
+EditRecipients=1
+recipient1=1234567890
+body=${SYSDRIVE}\PlatTest\Platsec\email.txt
+elements=0
+Musthavedata=EFalse
+//End of TestCase 66
+
+//TestCase 69
+[SaveEmailAttachments_01_RD]
+depth=3
+folder1=Local
+folder2=Outbox
+folder3=Email Message 2
+fileName1=${SYSDRIVE}\plattest\Platsec\ValidContact.vcf
+emailEntryType=This
+attachmentType=AllAttachments
+
+[Import_VCard_01_RD]
+dbFilenameSecure	=c:PTContacts.cdb
+import1			=${SYSDRIVE}\PlatTest\Platsec\ValidContact.vcf
+//End of TestCase 69
+
+//TestCase 70
+[Root_Folder_RD]
+depth=0
+//End of TestCase 70
+
+//TestCase 76
+[Get_01_RD]
+method=					GET
+uri=					http://10.22.64.12:80
+validation_statuscode=	200
+
+[Put_01_RD]
+method=					PUT
+uri=					http://10.22.64.12:80
+validation_statuscode=	200
+//End of TestCase 76
+
+//TestCase 77
+[Get_02_RD]
+method=					GET
+uri=					http://10.22.64.12:80
+validation_statuscode=	200
+
+[Post_01_RD]
+method=					POST
+uri=					http://10.22.64.12:80
+validation_statuscode=	200
+
+//End of TestCase 77
+
+//TestCase 78
+[Trace_01_RD]
+method=					TRACE
+uri=					http://10.22.64.12:80
+validation_statuscode=	200
+[Delete_01_RD]
+method=					DELETE
+uri=					http://10.22.64.12:80
+validation_statuscode=	200
+//End of TestCase 78
+
+//TestCase 80
+[Connect_Send_RD]
+iap=1
+Timeout=20
+Ip_Addr=10.32.192.128
+Test_Data=11111122221111111111111111111111
+//End of TestCase 80
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//For section 3
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+[AGENDA_CAP_WR]
+executable		=PlatTest_agenda.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_agenda_Cap_WR.exe
+capabilities		=WriteUserData 
+
+[COMMDB_CAP_WR]
+executable		=PlatTest_Commdb.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Commdb_cap_WR.exe
+capabilities		=WriteUserData
+
+[CONTACTS_CAP_WR]
+executable		=PlatTest_Contacts.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Contacts_cap_WR.exe
+capabilities		=WriteUserData
+
+[MESS_CAP_WR]
+executable		=PlatTest_Mess.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Mess_cap_WR.exe
+capabilities		=WriteUserData
+
+//TestCases
+
+//TestCase 4
+[SetAlarm_WR]
+count			=1
+category1		=12
+status1			=1
+message1		=Alarm for next minute1
+repeatalarm1		=1
+soundfile1		=Alarm doesn't have a sound file
+name1			=ganga5
+
+[QueryAlarm_WR]
+bycategory		=0
+count			=1
+message1		=Alarm for next minute1
+name1			=ganga5
+
+[DeleteAlarm_WR]
+count			=1
+name1			=ganga5
+
+//End of TestCase 4
+
+//TestCase 9
+[SetField_WR]
+tablename		=DialOutISP
+tableindex		=3
+setting			=Name
+type			=Text
+value			=NT RAS1
+
+[DeleteRecord_WR]
+tablename		=DialOutISP
+tableindex		=3
+setting			=Name
+type			=Text
+value			=NT RAS
+
+//End of TestCase 9
+
+//TestCase 12
+[Iterate_WR]
+filename		=c:PTAgenda
+keyyear			=2002
+keymonth		=9
+keyday			=15
+//End of TestCase 12
+
+//TestCase 15
+[Export_01_WR]
+filename		=c:PTAgenda
+export1			=${SYSDRIVE}\PlatTest\PlatTest_Export.vcs
+key1			=make a cup of tea
+keyyearstart1		=2001
+keymonthstart1		=8
+keydaystart1		=29
+//End of TestCase 15
+
+//TestCase 28
+[VerifyEntries_WR]
+dbFilenameSecure	=c:PTContacts.cdb
+count			=1
+key1			=Feroz
+firstname1		=Feroz
+
+//End of TestCase 28
+
+//TestCase 33
+[FilterEntries_WR]
+dbFilenameSecure	=c:PTContacts.cdb
+filterCriteria		=email
+//End of TestCase 33
+
+//TestCase 53
+[VerifyEntry_Sms_WR]
+depth=3
+folder1=Local
+folder2=Outbox
+folder3=SMS message 1
+text=SMS message 1
+//End of TestCase 53
+
+//TestCase 56
+[VerifyEntry_Ems_WR]
+depth=3
+folder1=Local
+folder2=Outbox
+folder3=EMS message 1
+text=EMS message 1
+//End of TestCase 56
+
+//TestCase 64
+[VerifyEntry_Email_WR]
+depth=3
+folder1=Local
+folder2=Outbox
+folder3=Email message 1
+text=Email message 1
+//End of TestCase 64
+
+//TestCase 71
+[EditSmsAccount_WR]
+accountname=Short Message
+scname=Airtel
+scnumber=+919845087112
+
+[ValidateSmsAccount_WR]
+accountname=Short Message
+scname=Airtel
+scnumber=9845087112
+delivery=ESmsDeliveryImmediately
+SmsReplyQuoted=TRUE	
+rejectduplicate=TRUE
+replypath=TRUE
+concatenate=TRUE
+validityperiod=10080
+deliveryreport=TRUE
+msgconversion=ESmsConvPIDNone
+valildityformat=ESmsVPFNone
+//End of Testcase 71
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//For section 4a
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+[COMMDB_CAP_MX_1]
+executable		=PlatTest_Commdb.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Commdb_cap_MX_1.exe
+capabilities		=ReadDeviceData
+
+[TELEPHONY_CAP_MX_1]
+executable		=PlatTest_Telephony.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Telephony_Cap_MX_1.exe
+capabilities		=ReadDeviceData 
+
+[BASE_CAP_MX_1]
+executable		=PlatTest_Base.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Base_cap_MX_1.exe
+capabilities		=ReadDeviceData
+
+[FILESTORE_CAP_MX_1]
+executable		=PlatTest_FileStore.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_FileStore_cap_MX_1.exe
+capabilities		=ReadUserData
+
+//TestCases
+
+//TestCase 3
+[CreateDB_Agenda_MX_1]
+filename		=c:PTAgenda
+
+[AddToDo_MX_1]
+filename		=c:PTAgenda
+count			=2
+isalarm			=1
+
+name1			=TestToDoList1
+todocount1		=2
+summary11		=ToDoList1 - Meeting1
+location11		=RoomNo1
+priority11		=5
+alarm11			=1
+daywarning11		=0
+time11			=1
+duration11		=1
+
+summary12		=ToDoList1 - Meeting2
+location12		=RoomNo1
+priority12		=7
+
+name2			=TestToDoList2
+todocount2		=2
+summary21		=ToDoList2 - Meeting2
+location21		=RoomNo2
+alarm22			=1
+
+[SnoozeAlarm_MX_1]
+count			=1
+name1			=ToDoList1 - Meeting1
+
+[DeleteAlarm_MX_1]
+bycategory		=0
+count			=1
+name1			=ToDoList1 - Meeting1
+//End of TestCase 3
+
+//TestCase 5
+[DeleteRecord_MX_1]
+tablename		=DialOutISP
+tableindex		=2
+setting			=Name
+type			=Text
+value			=NT RAS
+//End of TestCase 5
+
+//TestCase 34
+[Set_Japanese_MX_1]
+count			=1
+attribute1		=ELanguageIndex
+value1			=31
+//End of TestCase 34
+
+//TestCase 36
+[Set_Volume_Label_MX_1]
+drivename=C
+volumelabel=RAM
+//End of TestCase 36
+
+//TestCase 44
+[AddCallingCardEntry_MX_1]
+accountnumber		=0500800800,,12345999
+pinnumber		=01824774
+localrule		=HG
+natrule			=HFG
+intlrule		=HEFG
+//End of TestCase 44
+
+//TestCase 46
+[EditLocationPrivacySettings_MX_1]
+requestOperation	=SetLocPrivacySetngs
+privacySetngsTo		=ELocationPrivacyOn
+iap			=12
+loadtsy			=ETrue
+//End of TestCase 46
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//For section 4b
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+[AGENDA_CAP_MX_2]
+executable		=PlatTest_agenda.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_agenda_Cap_MX_2.exe
+capabilities		=ReadUserData WriteUserData LocalServices
+
+[OBEX_CAP_MX_2]
+executable		=PlatTest_Obex.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Obex_Cap_MX_2.exe
+capabilities		=ReadUserData
+
+[COMMDB_CAP_MX_2]
+executable		=PlatTest_Commdb.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Commdb_cap_MX_2.exe
+capabilities		=NetworkControl
+
+[TELEPHONY_CAP_MX_2]
+executable		=PlatTest_Telephony.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Telephony_Cap_MX_2.exe
+capabilities		=NetworkServices
+
+[MULTIMEDIA_CAP_MX_2]
+executable		=PlatTest_Multimedia.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Multimedia_cap_MX_2.exe
+capabilities		=MultimediaDD Drm
+
+[MESS_CAP_MX_2]
+executable		=PlatTest_Mess.exe
+destinationPath		=${SYSDRIVE}\sys\bin\PlatTest_Mess_cap_MX_2.exe
+capabilities		=ReadUserData
+
+//TestCases
+
+//TestCase 6
+[VerifyandDeleteField_MX_2]
+tablename		=DialOutISP
+tableindex		=2
+setting			=Name
+type			=Text
+value			=NT RAS
+//End of TestCase 6
+
+//TestCase 7
+[SetConnectionPreference_MX_2]
+tablename		=ConnectionPreferences
+tableindex		=1
+setting			=DialogPref
+type			=Bool
+value			=1
+//End of TestCase 7
+
+//TestCase 17
+[Export_Ir_MX_2]
+filename		=c:PTAgenda
+export1			=${SYSDRIVE}\PlatTest\PlatTestTemp.vcs
+key1			=make a cup of tea
+keyyearstart1		=2001
+keymonthstart1		=8
+keydaystart1		=29
+
+[Ir_Send_MX_2]
+port			=9
+transport		=IrTinyTP
+class			=OBEX
+attribute		=IrDA:TinyTP:LsapSel
+timeout			=200000
+count			=1
+filename1		=${SYSDRIVE}\PlatTest\PlatTestTemp.vcs
+type1			=text/X-vCalendar
+//End of TestCase 17
+
+//TestCase 38
+
+//End of TestCase 38
+[ImageRotate_MX_2]
+Filename=${SYSDRIVE}\plattest\platsec\sea.gif
+FrameNumber=0
+Angle=90
+TargetFilename=${SYSDRIVE}\plattest\platsec\sea_rotate.gif
+
+[CreateEmail_MX_2]
+from=Ktl1
+to=mdgi14@dial.pipex.com
+subject=Email Message 1
+body=${SYSDRIVE}\PlatTest\Platsec\Email.txt
+priority=low
+characterSetType=ChineseGB2312
+attachments=1
+attachment1=${SYSDRIVE}\plattest\platsec\sea_rotate.gif
+
+//TestCase 50
+[MakeVoiceCall_Contacts_MX_2]
+filename		=C:PTContacts.cdb
+key			=Feroz
+expectedresult		=0
+sectionnumber		=1
+iap			=1
+//End of TestCase 50
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2005-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:  
+// Integration test system build description file for self test suite
+//
+
+PRJ_MMPFILES
+Platsec.mmp
+
+PRJ_EXPORTS
+
+tefplatsec.iby					\epoc32\rom\include\tefplatsec.iby
+
+// For Test Driver exports with Binary dependency
+..\testdriver\platsecserver.xml			\epoc32\engineeringtools\tefutilities\platsec\xml\platsecserver.xml
+..\testdriver\capabilitypolicing.xml		\epoc32\engineeringtools\tefutilities\platsec\xml\platsecserver\capabilitypolicing.xml		
+..\testdriver\cleanup.xml		\epoc32\engineeringtools\tefutilities\platsec\xml\platsecserver\cleanup.xml		
+
+..\scripts\capabilitypolicing.script		\epoc32\engineeringtools\tefutilities\platsec\scripts\capabilitypolicing.script
+..\scripts\cleanup.script		\epoc32\engineeringtools\tefutilities\platsec\scripts\cleanup.script
+..\data\capabilitypolicing.ini	\epoc32\engineeringtools\tefutilities\platsec\data\capabilitypolicing.ini
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/group/platsec.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+* Unpaged
+*
+*/
+
+SMPSAFE
+#include <platform_paths.hrh>
+
+TARGET			tefplatsec.exe
+TARGETTYPE		exe
+UID             0x100039CE 0x10281AE0  
+
+#if (!defined __NO_VENDORID__)
+VENDORID		0x70000001
+#endif
+
+CAPABILITY		ReadUserData WriteUserData
+
+SOURCEPATH  	../src
+
+SOURCE			testplatsecserver.cpp
+SOURCE			testplatsecsetcapabilities.cpp
+SOURCE			testplatseclaunchapp.cpp
+SOURCE			testplatseccleanup.cpp
+
+USERINCLUDE 	../inc
+USERINCLUDE	../group
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY			euser.lib
+LIBRARY			testexecuteutils.lib 
+LIBRARY			testexecutelogclient.lib
+LIBRARY			efsrv.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/group/tefplatsec.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#if (!defined __PLATSEC_TEST_IBY__)
+#define __PLATSEC_TEST_IBY__
+
+
+//#include <testexecute.iby>
+#include <TEFCleanup.iby>
+
+data=ABI_DIR\BUILD_DIR\tefplatsec.exe			SHARED_LIB_DIR\tefplatsec.exe
+data=ABI_DIR\BUILD_DIR\setcap.exe				SHARED_LIB_DIR\setcap.exe
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/inc/testplatseccleanup.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestPlatSecCleanup. This class deletes the extra 
+* executables which are created with required capabilities 
+*
+*/
+
+
+
+#if (!defined __TEST_PLATSEC_CLEANUP_H__)
+#define __TEST_PLATSEC_CLEANUP_H__
+
+//TEF include
+#include <test/testexecutestepbase.h>
+
+/**
+ This class deletes the executables created with extra capabilities. 
+ The executable name is read from
+ the ini file. The executable "Plattest_Platsec_Cleanup.exe" is used to
+ delete the extra servers .
+*/
+class CTestPlatSecCleanup : public CTestStep
+	{
+public:
+	//Constructor
+	CTestPlatSecCleanup();
+
+	//Destructor
+	~CTestPlatSecCleanup();
+	//Implementation of CTestStep pure virtual funtion
+	virtual TVerdict doTestStepL();
+
+private:
+	void DeleteExtraServersL(const TDesC& aDestination);
+	
+		
+	};
+#endif //__TEST_PLATSEC_LAUNCHAPP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/inc/testplatseclaunchapp.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestPlatSecLaunchApp. This class sets the capabilities
+* of the executables. 
+*
+*/
+
+
+
+#if (!defined __TEST_PLATSEC_LAUNCHAPP_H__)
+#define __TEST_PLATSEC_LAUNCHAPP_H__
+
+//TEF include
+#include <test/testexecutestepbase.h>
+
+/**
+ This class sets the capabilities of the executables. 
+ The executable name and its capabilities are read from
+ the ini file. The executable "SetCap.exe" is used to
+ set the capabilities.
+*/
+class CTestPlatSecLaunchApp : public CTestStep
+	{
+public:
+	//Constructor
+	CTestPlatSecLaunchApp();
+
+	//Destructor
+	~CTestPlatSecLaunchApp();
+
+	//Implementation of CTestStep pure virtual funtion
+	virtual TVerdict doTestStepL();
+	};
+#endif //__TEST_PLATSEC_LAUNCHAPP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/inc/testplatsecserver.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestPlatSecServer. This class creates and initializes
+* the test steps and return the pointer to TEF
+*
+*/
+
+
+
+#if (!defined __TEST_PLATSEC_SERVER_H__)
+#define __TEST_PLATSEC_SERVER_H__
+
+//TEF include
+#include <test/testexecuteserverbase.h>
+
+/**
+ This class creates and initializes the test steps and return 
+ the pointer to TEF
+*/
+
+class CTestPlatSecServer : public CTestServer
+{
+public:
+	//Two phase constructor
+	static CTestPlatSecServer* NewL();
+
+	//Creates the test step
+	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
+
+	//Destructor
+	~CTestPlatSecServer();
+
+protected:
+	//Constructor
+	CTestPlatSecServer();
+};
+#endif //__TEST_PLATSEC_SERVER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/inc/testplatsecsetcapabilities.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestPlatSecSetCapabilities. This class sets the capabilities
+* of the executables. 
+*
+*/
+
+
+
+#if (!defined __TEST_PLATSEC_SET_CAPABILITIES_H__)
+#define __TEST_PLATSEC_SET_CAPABILITIES_H__
+
+//TEF include
+#include <test/testexecutestepbase.h>
+
+/**
+ This class sets the capabilities of the executables. 
+ The executable name and its capabilities are read from
+ the ini file. The executable "SetCap.exe" is used to
+ set the capabilities.
+*/
+class CTestPlatSecSetCapabilities : public CTestStep
+	{
+public:
+	//Constructor
+	CTestPlatSecSetCapabilities();
+
+	//Destructor
+	~CTestPlatSecSetCapabilities();
+
+	//Implementation of CTestStep pure virtual funtion
+	virtual TVerdict doTestStepL();
+private:
+	//Set the capabilites of the executables
+	void SetCapabilitiesL(const TDesC & aExecutable, const TDesC & aCapabilities, const TDesC & aDestination);
+
+	//Get the capability
+	TInt GetCapability(TPtrC aCapability, TCapability& aCapabilityValue);
+
+	//return the hex value for the capabilities
+	TInt CreateHexCapabilities(TDesC& aCapabilities );
+
+	};
+#endif //__TEST_PLATSEC_SET_CAPABILITIES_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/scripts/capabilitypolicing.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+LOAD_SUITE	TEFPlatSec
+
+PRINT Change the capabilites
+
+RUN_TEST_STEP 100 TEFPlatSec SetCapabilities ${SYSDRIVE}\platsec\CapabilityPolicing.ini MESSAGING_CAP
+DELAY 500
+
+//
+//Load the test suites after the required capabilites for testing are set 
+//
+LOAD_SUITE	PlatTest_Mess_Cap 
+
+RUN_TEST_STEP 10000 PlatTest_Mess_Cap CleanMessageFolder ${SYSDRIVE}\Platsec\CapabilityPolicing.ini RootFolder
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/scripts/cleanup.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,19 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+LOAD_SUITE TEFPlatsec
+
+RUN_TEST_STEP 100 TEFPlatsec Cleanup ${SYSDRIVE}\platsec\CapabilityPolicing.ini MESSAGING_CAP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/src/testplatseccleanup.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestPlatSecCleanup class functions implementation.
+* This class sets the capabilities of the executables and libraries.
+*
+*/
+
+
+#include "testplatseccleanup.h"
+
+//TEF include
+#include <testexecutelog.h>
+
+/*@{*/
+_LIT(KDestinationPath,		"destinationPath");
+/*@}*/
+
+// Test step name
+_LIT(KCleanupStep,	"Cleanup");
+
+/**
+ Destructor
+*/
+CTestPlatSecCleanup::~CTestPlatSecCleanup()
+	{
+	}
+
+/** 
+ Constructor
+*/
+CTestPlatSecCleanup::CTestPlatSecCleanup()
+	{
+	SetTestStepName(KCleanupStep);
+	}
+
+/**
+ The implementation of the CTestPlatSecCleanup::doTestStepL() pure virutal
+ function. Gets the required executable (server) to be deleted. It reads 
+ the  destination executable name  from the ini file and calls DeleteExtraServersL function.
+ @return TVerdict - result of the test step
+ @leave - system wide error codes
+*/
+TVerdict CTestPlatSecCleanup::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Cleaning up the exe"));
+
+	TPtrC ServerName(GetServerName());
+	INFO_PRINTF1(_L("Server Name"));
+	INFO_PRINTF2(_L("Server Name %S"), &ServerName);
+	
+	TPtrC destination;
+	if(!GetStringFromConfig(ConfigSection(), KDestinationPath, destination))
+		{
+		ERR_PRINTF1(_L("Executable/Server name not provided in INI file"));
+		SetTestStepResult(EFail);
+		return TestStepResult();	
+		}
+	DeleteExtraServersL(destination);
+	return TestStepResult();
+	}
+
+/**
+Deletes the extra servers created with limited capabilities. Uses Plattest_Platsec_Cleanup.exe
+  @param aDestination - name of the executable to be deleted
+ @leave - system wide error codes
+ @return None
+*/
+void CTestPlatSecCleanup::DeleteExtraServersL(const TDesC& aDestination)
+	{
+	RProcess process;
+	CleanupClosePushL(process);
+	TInt err=KErrNone;
+	_LIT(KTEFCleanupExe, "TEFCleanup.exe");
+	err = process.Create(KTEFCleanupExe,aDestination);
+	if(err!=KErrNone)
+		{
+		ERR_PRINTF2(_L("Creating the process failed with error : %D"),err);
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TRAP(err,process.Resume();)
+		if(err!=KErrNone)
+			{
+			ERR_PRINTF2(_L("Creating the process failed with error : %D"),err);
+			SetTestStepResult(EFail);
+			}
+		}
+	CleanupStack::PopAndDestroy(1);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/src/testplatseclaunchapp.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestPlatSecLaunchApp class functions implementation.
+* This class sets the capabilities of the executables and libraries.
+*
+*/
+
+
+#include "testplatseclaunchapp.h"
+
+//TEF include
+#include <testexecutelog.h>
+
+/*@{*/
+_LIT(KExecutableName,		"executable");
+_LIT(KCommandLineParams,	"CommandLineParams");
+
+/*@}*/
+
+// Test step name
+_LIT(KLaunchAppStep,	"LaunchApp");
+
+/**
+ Destructor
+*/
+CTestPlatSecLaunchApp::~CTestPlatSecLaunchApp()
+	{
+	}
+
+/** 
+ Constructor
+*/
+CTestPlatSecLaunchApp::CTestPlatSecLaunchApp()
+	{
+	SetTestStepName(KLaunchAppStep);
+	}
+
+/**
+ The implementation of the CTestStepPlatTest::doTestStepL() pure virutal
+ function.It reads the application name from Config file and tries to 
+ launch the application.
+ @return TVerdict - result of the test step
+ @leave - system wide error codes
+*/
+TVerdict CTestPlatSecLaunchApp::doTestStepL()
+	{
+	
+
+	TPtrC ServerName(GetServerName());
+	INFO_PRINTF1(_L("Server Name"));
+	INFO_PRINTF2(_L("Server Name %S"), &ServerName);
+	
+	//read the executable name from the ini file
+	TPtrC	appName;
+    TPtrC   commandLine;
+	if(!GetStringFromConfig(ConfigSection(), KExecutableName, appName))
+		{
+		ERR_PRINTF1(_L("Executable/Server name not provided in INI file"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		INFO_PRINTF2(_L("Executable name read from the ini file is  %S"),&appName); 
+        if(!GetStringFromConfig(ConfigSection(), KCommandLineParams, commandLine))
+            {
+            INFO_PRINTF1(_L("No Command line arguments provided"));
+            }
+        RProcess process;
+        CleanupClosePushL(process);
+        TInt err=KErrNone;
+        err = process.Create(appName,commandLine);
+        if(err!=KErrNone)
+            {
+            INFO_PRINTF2(_L("Launching the app failed with error : %D"),err);
+            SetTestStepError(err);
+            }
+        else
+            {
+            TRAPD(error,process.Resume();)
+                if(error!=KErrNone)
+                    {
+                    ERR_PRINTF2(_L("Launching the app failed with error: %D"),err);
+                    SetTestStepError(err);
+                    SetTestStepResult(EFail);
+                    }
+            }
+        CleanupStack::PopAndDestroy(1);
+		}
+	return TestStepResult();
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/src/testplatsecserver.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestPlatSecServer. This class creates and initializes
+* the test steps and return the pointer to TEF
+*
+*/
+
+
+#include "testplatsecserver.h"
+#include "testplatsecsetcapabilities.h"
+#include "testplatseclaunchapp.h"
+#include "testplatseccleanup.h"
+
+
+
+/**
+ Secure variant
+ Much simpler, uses the new Rendezvous() call to sync with the client
+*/
+LOCAL_C void MainL()
+	{
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler*	sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CTestPlatSecServer*	server = NULL;
+	// Create the CTestServer derived server
+	TRAPD(err,server = CTestPlatSecServer::NewL());
+	if(!err)
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	delete server;
+	delete sched;
+	}
+
+
+/**
+ Secure variant only
+ Process entry point. Called by client using RProcess API
+ @return - Standard Epoc error code on process exit
+*/
+GLDEF_C TInt E32Main()
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
+
+
+
+/**
+ Two Phase constructor
+ @return CTestPlatSecServer object pointer
+ @leave KErrNoMemory
+ @leave system wide error codes
+*/
+CTestPlatSecServer* CTestPlatSecServer::NewL()
+	{
+	CTestPlatSecServer*	server=new(ELeave) CTestPlatSecServer();
+	CleanupStack::PushL(server);
+	RProcess handle = RProcess();
+	TParsePtrC serverName(handle.FileName());
+	server->ConstructL(serverName.Name());
+	CleanupStack::Pop();
+	return server;
+	}
+
+/**
+ Constructor
+*/
+CTestPlatSecServer::CTestPlatSecServer()
+	{
+	}
+
+/**
+ Destructor
+*/
+CTestPlatSecServer::~CTestPlatSecServer()
+	{
+	}
+
+/**
+ Implementation of CTestServer pure virtual. 
+ Creates the test step.
+ @param aStepName - test step name to run.
+ @return - A CTestStep derived instance
+*/
+
+CTestStep* CTestPlatSecServer::CreateTestStep(const TDesC& aStepName)
+	{
+	CTestStep*	testStep = NULL;
+	if(aStepName == _L("SetCapabilities"))
+		{
+		testStep = new CTestPlatSecSetCapabilities();
+		}
+    else if (aStepName == _L("LaunchApp"))
+        {
+        testStep = new CTestPlatSecLaunchApp();
+        }
+	else if (aStepName == _L("Cleanup"))
+		{
+		testStep = new CTestPlatSecCleanup();
+		}
+	return testStep;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/src/testplatsecsetcapabilities.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,303 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestPlatSecSetCapabilities class functions implementation.
+* This class sets the capabilities of the executables and libraries.
+*
+*/
+
+
+#include "testplatsecsetcapabilities.h"
+
+//TEF include
+#include <test/testexecutelog.h>
+
+/*@{*/
+_LIT(KExecutableName,		"executable");
+_LIT(KCapabalities,			"capabilities");
+_LIT(KDestinationPath,		"destinationPath");
+/*@}*/
+
+// Test step name
+_LIT(KSetCapabilitiesStep,	"SetCapabilities");
+
+/**
+ Destructor
+*/
+CTestPlatSecSetCapabilities::~CTestPlatSecSetCapabilities()
+	{
+	}
+
+/** 
+ Constructor
+*/
+CTestPlatSecSetCapabilities::CTestPlatSecSetCapabilities()
+	{
+	SetTestStepName(KSetCapabilitiesStep);
+	}
+
+/**
+ The implementation of the CTestStepPlatTest::doTestStepL() pure virutal
+ function. Sets the defined capabilities to the executables. It reads 
+ the executable name, destination executable name and its capabilities 
+ from the ini file.
+ @return TVerdict - result of the test step
+ @leave - system wide error codes
+*/
+TVerdict CTestPlatSecSetCapabilities::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Setting the capabilities of the executable."));
+
+	TPtrC ServerName(GetServerName());
+	INFO_PRINTF1(_L("Server Name"));
+	INFO_PRINTF2(_L("Server Name %S"), &ServerName);
+	
+	//read the executable name from the ini file
+	TPtrC	executableName;
+	if(!GetStringFromConfig(ConfigSection(), KExecutableName, executableName))
+		{
+		ERR_PRINTF1(_L("Executable/Server name not provided in INI file"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		INFO_PRINTF2(_L("Executable name read from the ini file is  %S"),&executableName); 
+		//read capabilities to be set
+		TPtrC capabilities;
+		if(!GetStringFromConfig(ConfigSection(), KCapabalities, capabilities))
+			{
+			ERR_PRINTF1(_L("Capabilities to be set are not specified in the INI file")); 
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			INFO_PRINTF2(_L("New capabilities for the executable :  %S"),&capabilities); 
+			//read the destination executable name including path
+			TPtrC destination;
+			if(!GetStringFromConfig(ConfigSection(), KDestinationPath, destination))
+				{
+				ERR_PRINTF1(_L("Destination  not specified in the INI file")); 
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				INFO_PRINTF2(_L("Destination path specified is  :  %S"),&destination); 
+				//set the capabilities
+				SetCapabilitiesL(executableName, capabilities,destination);
+				}
+			}
+		}
+	return TestStepResult();
+	}
+
+/**
+ Sets the capabilites for a given executable. Uses SetCap.exe
+ @param aExecutable - name of the executable
+ @param aCapabilities - capabilities to be set for the executable
+ @param aDestination - name of the output executable
+ @leave - system wide error codes
+ @return None
+*/
+void CTestPlatSecSetCapabilities::SetCapabilitiesL(const TDesC& aExecutable, const TDesC& aCapabilities,const TDesC& aDestination)
+	{
+	//create the commandline arguments
+	TBuf<KMaxTestExecuteCommandLength> buf(aCapabilities);
+	TUint hexCapability = CreateHexCapabilities(buf);
+
+	INFO_PRINTF2( _L("Capality Hex value is %X"),hexCapability);
+	TBuf<KMaxTestExecuteCommandLength> commandLine(aExecutable);
+	commandLine.Append(_L(" "));
+	commandLine.AppendNumUC(hexCapability,EHex);
+	commandLine.Append(_L(" "));
+	commandLine.Append(aDestination);
+
+	INFO_PRINTF2( _L("command line arguments for setcap  is  %S"),&commandLine);
+	
+	//instantiate Setcap.exe as a new process with the executable and capabilities as command line arguments
+	RProcess process;
+	CleanupClosePushL(process);
+	TInt err=KErrNone;
+	User::LeaveIfError(err = process.Create(_L("setcap.exe"),commandLine));
+	if(err!=KErrNone)
+		{
+		ERR_PRINTF2(_L("Creating the process failed with error : %D"),err);
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TRAPD(error,process.Resume();)
+		if(error!=KErrNone)
+			{
+			ERR_PRINTF2(_L("Creating the process failed with error : %D"),err);
+			SetTestStepResult(EFail);
+			}
+		}
+	CleanupStack::PopAndDestroy(1);
+	}
+
+/**
+ Creates the hex values to be passed to SetCap.exe.
+ @param aCapabilities - capabilites for which hex values to be created
+ @return TInt - integer value after manipulating all capabilities
+ @leave - none
+*/
+TInt  CTestPlatSecSetCapabilities::CreateHexCapabilities(TDesC& aCapabilities )
+	{
+	TInt capability=0;
+	TInt capCountCheck=0;
+	TLex parser(aCapabilities);
+	
+	//create the capability hex value
+	while(!parser.Eos())
+		{
+		TPtrC token(parser.NextToken());
+		INFO_PRINTF2( _L("Adding capability %S"),&token);
+
+		TCapability capabilityValue;
+		
+		TInt err = GetCapability(token, capabilityValue);
+		if (err != KErrNone)
+			{
+			WARN_PRINTF1(_L("Unrecognised capability, rejected"));
+			}
+		else
+			{
+			capCountCheck++;
+			if(capabilityValue == ECapability_None)
+				{
+				capability = ECapability_None;
+				break;
+				}
+			else
+				{
+				capability = capability | (1<<capabilityValue);
+				}
+			}
+		if(capCountCheck == 0)
+			{
+			WARN_PRINTF1(_L("No capability given is valid, capability set to None"));
+			capability = ECapability_None;
+			}
+		}
+	return capability;
+	}
+	
+/**
+ Get the capability id (enum value) for the capability name 
+ given as string.
+ @param aCapability - Capability name 
+ @param aCapabilityValue - value for the capability name
+ @return TInt - error codes
+ @leave - None
+*/
+TInt CTestPlatSecSetCapabilities::GetCapability(TPtrC aCapability, TCapability& aCapabilityValue)
+	{
+	INFO_PRINTF2(_L("The capability get is %S"), &aCapability);
+	TInt	ret=KErrNone;
+
+	TBuf<KMaxTestExecuteCommandLength>	capCaseValue(aCapability);
+	capCaseValue.LowerCase();
+
+	if(!capCaseValue.Compare(_L("tcb" )))
+		{
+		aCapabilityValue=ECapabilityTCB;
+		}
+	else if(!capCaseValue.Compare(_L("commdd" )))
+		{
+		aCapabilityValue=ECapabilityCommDD;
+		}
+	else if(!capCaseValue.Compare(_L("powermgmt" )))
+		{
+		aCapabilityValue=ECapabilityPowerMgmt;
+		}
+	else if(!capCaseValue.Compare(_L("multimediadd" )))
+		{
+		aCapabilityValue=ECapabilityMultimediaDD;
+		}
+	else if(!capCaseValue.Compare(_L("readdevicedata" )))
+		{
+		aCapabilityValue=ECapabilityReadDeviceData;
+		}
+	else if(!capCaseValue.Compare(_L("writedevicedata" )))
+		{
+		aCapabilityValue=ECapabilityWriteDeviceData;
+		}
+	else if(!capCaseValue.Compare(_L("drm" )))
+		{
+		aCapabilityValue=ECapabilityDRM;
+		}
+	else if(!capCaseValue.Compare(_L("trustedui" )))
+		{
+		aCapabilityValue=ECapabilityTrustedUI;
+		}
+	else if(!capCaseValue.Compare(_L("protserv" )))
+		{
+		aCapabilityValue=ECapabilityProtServ;
+		}
+	else if(!capCaseValue.Compare(_L("diskadmin" )))
+		{
+		aCapabilityValue=ECapabilityDiskAdmin;
+		}
+	else if(!capCaseValue.Compare(_L("networkcontrol" )))
+		{
+		aCapabilityValue=ECapabilityNetworkControl;
+		}
+	else if(!capCaseValue.Compare(_L("allfiles" )))
+		{
+		aCapabilityValue=ECapabilityAllFiles;
+		}
+	else if(!capCaseValue.Compare(_L("swevent" )))
+		{
+		aCapabilityValue=ECapabilitySwEvent;
+		}
+	else if(!capCaseValue.Compare(_L("networkservices" )))
+		{
+		aCapabilityValue=ECapabilityNetworkServices;
+		}
+	else if(!capCaseValue.Compare(_L("localservices" )))
+		{
+		aCapabilityValue=ECapabilityLocalServices;
+		}
+	else if(!capCaseValue.Compare(_L("readuserdata" )))
+		{
+		aCapabilityValue=ECapabilityReadUserData;
+		}
+	else if(!capCaseValue.Compare(_L("writeuserdata")))
+		{
+		aCapabilityValue=ECapabilityWriteUserData;
+		}
+	else if(!capCaseValue.Compare(_L("location")))
+		{
+		aCapabilityValue=ECapabilityLocation;
+		}
+	else if(!capCaseValue.Compare(_L("surroundingsdd")))
+		{
+		aCapabilityValue=ECapabilitySurroundingsDD;
+		}
+	else if(!capCaseValue.Compare(_L("userenvironment")))
+		{
+		aCapabilityValue=ECapabilityUserEnvironment;
+		} 		
+	else if(!capCaseValue.Compare(_L("none")))
+		{
+		aCapabilityValue=ECapability_None;
+		}
+	else
+		{
+		INFO_PRINTF2(_L("Unrecognised capability %S, will be rejected"), &capCaseValue);
+		ret=KErrNotFound;
+		}
+
+	return ret;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/testdriver/capabilitypolicing.xml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE testExecuteTest SYSTEM "file:///testdriver/xml/testExecuteTest.dtd" [ ]>
+<testExecuteTest>
+	<name>CapabilityPolicing</name>
+	<timeout>1000</timeout>
+	<testScripts>
+		<script>
+			<hostPath>\epoc32\EngineeringTools\TEFUtilities\PlatSec\Scripts\CapabilityPolicing.script</hostPath>
+			<devicePath>c:\platsec\CapabilityPolicing.script</devicePath>
+		</script>
+	</testScripts>
+	
+
+	<dependencies>
+		<data>
+			<hostPath>\epoc32\EngineeringTools\TEFUtilities\PlatSec\data\CapabilityPolicing.ini</hostPath>
+			<devicePath>c:\platsec\CapabilityPolicing.ini</devicePath>
+		</data>
+		<data>
+			<hostPath>\epoc32\release\${platform}\${build}\TEFPlatsec.exe</hostPath>
+			<devicePath>c:\sys\bin\TEFPlatsec.exe</devicePath>
+		</data>
+
+	</dependencies>
+
+</testExecuteTest>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/testdriver/cleanup.xml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE testExecuteTest SYSTEM "file:///testdriver/xml/testExecuteTest.dtd" [ ]>
+<testExecuteTest>
+	<name>Cleanup</name>
+	<timeout>1000</timeout>
+	<testScripts>
+		<script>
+			<hostPath>\epoc32\EngineeringTools\TEFUtilities\PlatSec\Scripts\Cleanup.script</hostPath>
+			<devicePath>c:\platsec\Cleanup.script</devicePath>
+		</script>
+	</testScripts>
+	<dependencies>
+		<data>
+			<hostPath>\epoc32\release\${platform}\${build}\TEFCleanup.exe</hostPath>
+			<devicePath>c:\sys\bin\TEFCleanup.exe</devicePath>
+		</data>	
+
+	</dependencies>
+</testExecuteTest>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/tefutilities/platsec/testdriver/platsecserver.xml	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE testSuite SYSTEM "file:///testdriver/xml/testSuite.dtd" [ ]>
+<testSuite>
+	<name>PlatSecServer</name>
+	
+	<testItems>
+		<test>CapabilityPolicing</test>
+		<test>Cleanup</test>
+	</testItems>
+	
+</testSuite>
+                                                                                                                                                                                                                                                                                                                                                                                                                
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/bmarm/testexecuteutils1u.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+EXPORTS
+	testBooleanTrue__9CTestStepiPCUcii @ 1 NONAME ; CTestStep::testBooleanTrue(int, unsigned char const *, int, int)
+	Close__12RTestSession @ 2 NONAME R3UNUSED ; RTestSession::Close(void)
+	Connect__9RTestServRC7TDesC16 @ 3 NONAME R3UNUSED ; RTestServ::Connect(TDesC16 const &)
+	ConstructL__11CTestServerRC7TDesC16 @ 4 NONAME R3UNUSED ; CTestServer::ConstructL(TDesC16 const &)
+	GetBoolFromConfig__C9CTestStepRC7TDesC16T1Ri @ 5 NONAME ; CTestStep::GetBoolFromConfig(TDesC16 const &, TDesC16 const &, int &) const
+	GetIntFromConfig__C9CTestStepRC7TDesC16T1Ri @ 6 NONAME ; CTestStep::GetIntFromConfig(TDesC16 const &, TDesC16 const &, int &) const
+	GetStringFromConfig__C9CTestStepRC7TDesC16T1R7TPtrC16 @ 7 NONAME ; CTestStep::GetStringFromConfig(TDesC16 const &, TDesC16 const &, TPtrC16 &) const
+	NewSessionL__C11CTestServerRC8TVersionRC9RMessage2 @ 8 NONAME R3UNUSED ; CTestServer::NewSessionL(TVersion const &, RMessage2 const &) const
+	Open__12RTestSessionR9RTestServRC7TDesC16i @ 9 NONAME ; RTestSession::Open(RTestServ &, TDesC16 const &, int)
+	RunTestStep__12RTestSessionRC7TDesC16R6TDes16R14TRequestStatus @ 10 NONAME ; RTestSession::RunTestStep(TDesC16 const &, TDes16 &, TRequestStatus &)
+	ServerName__C9RTestServ @ 11 NONAME R3UNUSED ; RTestServ::ServerName(void) const
+	ServiceL__12CTestSessionRC9RMessage2 @ 12 NONAME R3UNUSED ; CTestSession::ServiceL(RMessage2 const &)
+	SetTestStepName__9CTestStepRC7TDesC16 @ 13 NONAME R3UNUSED ; CTestStep::SetTestStepName(TDesC16 const &)
+	TestCheckPointCompareL__9CTestStepiiRC7TDesC16PCUci @ 14 NONAME ; CTestStep::TestCheckPointCompareL(int, int, TDesC16 const &, unsigned char const *, int)
+	"_._11CTestServer" @ 15 NONAME R3UNUSED ; CTestServer::~CTestServer(void)
+	"_._12CTestSession" @ 16 NONAME R3UNUSED ; CTestSession::~CTestSession(void)
+	"_._9CTestStep" @ 17 NONAME R3UNUSED ; CTestStep::~CTestStep(void)
+	__11CTestServer @ 18 NONAME R3UNUSED ; CTestServer::CTestServer(void)
+	__12CTestSession @ 19 NONAME R3UNUSED ; CTestSession::CTestSession(void)
+	__9CTestStep @ 20 NONAME R3UNUSED ; CTestStep::CTestStep(void)
+	doTestStepPostambleL__9CTestStep @ 21 NONAME R3UNUSED ; CTestStep::doTestStepPostambleL(void)
+	doTestStepPreambleL__9CTestStep @ 22 NONAME R3UNUSED ; CTestStep::doTestStepPreambleL(void)
+	testBooleanTrueL__9CTestStepiPCUci @ 23 NONAME ; CTestStep::testBooleanTrueL(int, unsigned char const *, int)
+	testBooleanTrueL__9CTestStepiPCUcii @ 24 NONAME ; CTestStep::testBooleanTrueL(int, unsigned char const *, int, int)
+	testBooleanTrueWithErrorCodeL__9CTestStepiiPCUci @ 25 NONAME ; CTestStep::testBooleanTrueWithErrorCodeL(int, int, unsigned char const *, int)
+	testBooleanTrueWithErrorCodeL__9CTestStepiiPCUcii @ 26 NONAME ; CTestStep::testBooleanTrueWithErrorCodeL(int, int, unsigned char const *, int, int)
+	testBooleanTrueWithErrorCode__9CTestStepiiPCUci @ 27 NONAME ; CTestStep::testBooleanTrueWithErrorCode(int, int, unsigned char const *, int)
+	testBooleanTrueWithErrorCode__9CTestStepiiPCUcii @ 28 NONAME ; CTestStep::testBooleanTrueWithErrorCode(int, int, unsigned char const *, int, int)
+	testBooleanTrue__9CTestStepiPCUci @ 29 NONAME ; CTestStep::testBooleanTrue(int, unsigned char const *, int)
+	AbortTestStep__12RTestSession @ 30 NONAME R3UNUSED ; RTestSession::AbortTestStep(void)
+	GetHexFromConfig__C9CTestStepRC7TDesC16T1Ri @ 31 NONAME ; CTestStep::GetHexFromConfig(TDesC16 const &, TDesC16 const &, int &) const
+	GetServerName__C9CTestStep @ 32 NONAME R3UNUSED ; CTestStep::GetServerName(void) const
+	SetTestStepError__9CTestStepRCi @ 33 NONAME R3UNUSED ; CTestStep::SetTestStepError(int const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/bmarm/testexecuteutilsu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,39 @@
+EXPORTS
+	testBooleanTrue__9CTestStepiPCUcii @ 1 NONAME ; CTestStep::testBooleanTrue(int, unsigned char const *, int, int)
+	Close__12RTestSession @ 2 NONAME R3UNUSED ; RTestSession::Close(void)
+	Connect__9RTestServRC7TDesC16i @ 3 NONAME R3UNUSED ; RTestServ::Connect(TDesC16 const &, int)
+	ConstructL__11CTestServerRC7TDesC16 @ 4 NONAME R3UNUSED ; CTestServer::ConstructL(TDesC16 const &)
+	GetBoolFromConfig__9CTestStepRC7TDesC16T1Ri @ 5 NONAME ; CTestStep::GetBoolFromConfig(TDesC16 const &, TDesC16 const &, int &)
+	GetHexFromConfig__9CTestStepRC7TDesC16T1Ri @ 6 NONAME ; CTestStep::GetHexFromConfig(TDesC16 const &, TDesC16 const &, int &)
+	GetIntFromConfig__9CTestStepRC7TDesC16T1Ri @ 7 NONAME ; CTestStep::GetIntFromConfig(TDesC16 const &, TDesC16 const &, int &)
+	GetServerName__C9CTestStep @ 8 NONAME R3UNUSED ; CTestStep::GetServerName(void) const
+	GetStringFromConfig__9CTestStepRC7TDesC16T1R7TPtrC16 @ 9 NONAME ; CTestStep::GetStringFromConfig(TDesC16 const &, TDesC16 const &, TPtrC16 &)
+	NewSessionL__C11CTestServerRC8TVersionRC9RMessage2 @ 10 NONAME R3UNUSED ; CTestServer::NewSessionL(TVersion const &, RMessage2 const &) const
+	Open__12RTestSessionR9RTestServRC7TDesC16i @ 11 NONAME ; RTestSession::Open(RTestServ &, TDesC16 const &, int)
+	RunTestStep__12RTestSessionRC7TDesC16R6TDes16R14TRequestStatus @ 12 NONAME ; RTestSession::RunTestStep(TDesC16 const &, TDes16 &, TRequestStatus &)
+	ServerName__C9RTestServ @ 13 NONAME R3UNUSED ; RTestServ::ServerName(void) const
+	ServiceL__12CTestSessionRC9RMessage2 @ 14 NONAME R3UNUSED ; CTestSession::ServiceL(RMessage2 const &)
+	SetTestStepError__9CTestStepRCi @ 15 NONAME R3UNUSED ; CTestStep::SetTestStepError(int const &)
+	SetTestStepName__9CTestStepRC7TDesC16 @ 16 NONAME R3UNUSED ; CTestStep::SetTestStepName(TDesC16 const &)
+	TestCheckPointCompareL__9CTestStepiiRC7TDesC16PCUci @ 17 NONAME ; CTestStep::TestCheckPointCompareL(int, int, TDesC16 const &, unsigned char const *, int)
+	WriteBoolToConfig__9CTestStepRC7TDesC16T1RCi @ 18 NONAME ; CTestStep::WriteBoolToConfig(TDesC16 const &, TDesC16 const &, int const &)
+	WriteHexToConfig__9CTestStepRC7TDesC16T1RCi @ 19 NONAME ; CTestStep::WriteHexToConfig(TDesC16 const &, TDesC16 const &, int const &)
+	WriteIntToConfig__9CTestStepRC7TDesC16T1RCi @ 20 NONAME ; CTestStep::WriteIntToConfig(TDesC16 const &, TDesC16 const &, int const &)
+	WriteStringToConfig__9CTestStepRC7TDesC16T1RC7TPtrC16 @ 21 NONAME ; CTestStep::WriteStringToConfig(TDesC16 const &, TDesC16 const &, TPtrC16 const &)
+	"_._11CTestServer" @ 22 NONAME R3UNUSED ; CTestServer::~CTestServer(void)
+	"_._12CTestSession" @ 23 NONAME R3UNUSED ; CTestSession::~CTestSession(void)
+	"_._9CTestStep" @ 24 NONAME R3UNUSED ; CTestStep::~CTestStep(void)
+	__11CTestServer @ 25 NONAME R3UNUSED ; CTestServer::CTestServer(void)
+	__12CTestSession @ 26 NONAME R3UNUSED ; CTestSession::CTestSession(void)
+	__9CTestStep @ 27 NONAME R3UNUSED ; CTestStep::CTestStep(void)
+	doTestStepPostambleL__9CTestStep @ 28 NONAME R3UNUSED ; CTestStep::doTestStepPostambleL(void)
+	doTestStepPreambleL__9CTestStep @ 29 NONAME R3UNUSED ; CTestStep::doTestStepPreambleL(void)
+	testBooleanTrueL__9CTestStepiPCUci @ 30 NONAME ; CTestStep::testBooleanTrueL(int, unsigned char const *, int)
+	testBooleanTrueL__9CTestStepiPCUcii @ 31 NONAME ; CTestStep::testBooleanTrueL(int, unsigned char const *, int, int)
+	testBooleanTrueWithErrorCodeL__9CTestStepiiPCUci @ 32 NONAME ; CTestStep::testBooleanTrueWithErrorCodeL(int, int, unsigned char const *, int)
+	testBooleanTrueWithErrorCodeL__9CTestStepiiPCUcii @ 33 NONAME ; CTestStep::testBooleanTrueWithErrorCodeL(int, int, unsigned char const *, int, int)
+	testBooleanTrueWithErrorCode__9CTestStepiiPCUci @ 34 NONAME ; CTestStep::testBooleanTrueWithErrorCode(int, int, unsigned char const *, int)
+	testBooleanTrueWithErrorCode__9CTestStepiiPCUcii @ 35 NONAME ; CTestStep::testBooleanTrueWithErrorCode(int, int, unsigned char const *, int, int)
+	testBooleanTrue__9CTestStepiPCUci @ 36 NONAME ; CTestStep::testBooleanTrue(int, unsigned char const *, int)
+	AbortTestStep__12RTestSession @ 37 NONAME R3UNUSED ; RTestSession::AbortTestStep(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/bwins/testexecuteutils1u.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+EXPORTS
+	??0CTestServer@@IAE@XZ @ 1 NONAME ; protected: __thiscall CTestServer::CTestServer(void)
+	??0CTestSession@@QAE@XZ @ 2 NONAME ; public: __thiscall CTestSession::CTestSession(void)
+	??0CTestStep@@IAE@XZ @ 3 NONAME ; protected: __thiscall CTestStep::CTestStep(void)
+	??1CTestServer@@UAE@XZ @ 4 NONAME ; public: virtual __thiscall CTestServer::~CTestServer(void)
+	??1CTestSession@@UAE@XZ @ 5 NONAME ; public: virtual __thiscall CTestSession::~CTestSession(void)
+	??1CTestStep@@UAE@XZ @ 6 NONAME ; public: virtual __thiscall CTestStep::~CTestStep(void)
+	?AbortTestStep@RTestSession@@QAEHXZ @ 7 NONAME ; public: int __thiscall RTestSession::AbortTestStep(void)
+	?Close@RTestSession@@QAEXXZ @ 8 NONAME ; public: void __thiscall RTestSession::Close(void)
+	?Connect@RTestServ@@QAEHABVTDesC16@@@Z @ 9 NONAME ; public: int __thiscall RTestServ::Connect(class TDesC16 const &)
+	?ConstructL@CTestServer@@UAEXABVTDesC16@@@Z @ 10 NONAME ; public: virtual void __thiscall CTestServer::ConstructL(class TDesC16 const &)
+	?GetBoolFromConfig@CTestStep@@QBEHABVTDesC16@@0AAH@Z @ 11 NONAME ; public: int __thiscall CTestStep::GetBoolFromConfig(class TDesC16 const &,class TDesC16 const &,int &)const 
+	?GetIntFromConfig@CTestStep@@QBEHABVTDesC16@@0AAH@Z @ 12 NONAME ; public: int __thiscall CTestStep::GetIntFromConfig(class TDesC16 const &,class TDesC16 const &,int &)const 
+	?GetStringFromConfig@CTestStep@@QBEHABVTDesC16@@0AAVTPtrC16@@@Z @ 13 NONAME ; public: int __thiscall CTestStep::GetStringFromConfig(class TDesC16 const &,class TDesC16 const &,class TPtrC16 &)const 
+	?NewSessionL@CTestServer@@UBEPAVCSession2@@ABVTVersion@@ABVRMessage2@@@Z @ 14 NONAME ; public: virtual class CSession2 * __thiscall CTestServer::NewSessionL(class TVersion const &,class RMessage2 const &)const 
+	?Open@RTestSession@@QAEHAAVRTestServ@@ABVTDesC16@@H@Z @ 15 NONAME ; public: int __thiscall RTestSession::Open(class RTestServ &,class TDesC16 const &,int)
+	?RunTestStep@RTestSession@@QAEXABVTDesC16@@AAVTDes16@@AAVTRequestStatus@@@Z @ 16 NONAME ; public: void __thiscall RTestSession::RunTestStep(class TDesC16 const &,class TDes16 &,class TRequestStatus &)
+	?ServerName@RTestServ@@QBEABVTDesC16@@XZ @ 17 NONAME ; public: class TDesC16 const & __thiscall RTestServ::ServerName(void)const 
+	?ServiceL@CTestSession@@UAEXABVRMessage2@@@Z @ 18 NONAME ; public: virtual void __thiscall CTestSession::ServiceL(class RMessage2 const &)
+	?SetTestStepName@CTestStep@@QAEXABVTDesC16@@@Z @ 19 NONAME ; public: void __thiscall CTestStep::SetTestStepName(class TDesC16 const &)
+	?TestCheckPointCompareL@CTestStep@@QAEXHHABVTDesC16@@PBEH@Z @ 20 NONAME ; public: void __thiscall CTestStep::TestCheckPointCompareL(int,int,class TDesC16 const &,unsigned char const *,int)
+	?doTestStepPostambleL@CTestStep@@UAE?AW4TVerdict@@XZ @ 21 NONAME ; public: virtual enum TVerdict  __thiscall CTestStep::doTestStepPostambleL(void)
+	?doTestStepPreambleL@CTestStep@@UAE?AW4TVerdict@@XZ @ 22 NONAME ; public: virtual enum TVerdict  __thiscall CTestStep::doTestStepPreambleL(void)
+	?testBooleanTrue@CTestStep@@QAEXHPBEH@Z @ 23 NONAME ; public: void __thiscall CTestStep::testBooleanTrue(int,unsigned char const *,int)
+	?testBooleanTrue@CTestStep@@QAEXHPBEHH@Z @ 24 NONAME ; public: void __thiscall CTestStep::testBooleanTrue(int,unsigned char const *,int,int)
+	?testBooleanTrueL@CTestStep@@QAEXHPBEH@Z @ 25 NONAME ; public: void __thiscall CTestStep::testBooleanTrueL(int,unsigned char const *,int)
+	?testBooleanTrueL@CTestStep@@QAEXHPBEHH@Z @ 26 NONAME ; public: void __thiscall CTestStep::testBooleanTrueL(int,unsigned char const *,int,int)
+	?testBooleanTrueWithErrorCode@CTestStep@@QAEXHHPBEH@Z @ 27 NONAME ; public: void __thiscall CTestStep::testBooleanTrueWithErrorCode(int,int,unsigned char const *,int)
+	?testBooleanTrueWithErrorCode@CTestStep@@QAEXHHPBEHH@Z @ 28 NONAME ; public: void __thiscall CTestStep::testBooleanTrueWithErrorCode(int,int,unsigned char const *,int,int)
+	?testBooleanTrueWithErrorCodeL@CTestStep@@QAEXHHPBEH@Z @ 29 NONAME ; public: void __thiscall CTestStep::testBooleanTrueWithErrorCodeL(int,int,unsigned char const *,int)
+	?testBooleanTrueWithErrorCodeL@CTestStep@@QAEXHHPBEHH@Z @ 30 NONAME ; public: void __thiscall CTestStep::testBooleanTrueWithErrorCodeL(int,int,unsigned char const *,int,int)
+	?GetHexFromConfig@CTestStep@@QBEHABVTDesC16@@0AAH@Z @ 31 NONAME ; public: int __thiscall CTestStep::GetHexFromConfig(class TDesC16 const &,class TDesC16 const &,int &)const 
+	?GetServerName@CTestStep@@QBEABVTDesC16@@XZ @ 32 NONAME ; public: class TDesC16 const & __thiscall CTestStep::GetServerName(void)const 
+	?SetTestStepError@CTestStep@@QAEXABH@Z @ 33 NONAME ; public: void __thiscall CTestStep::SetTestStepError(int const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/bwins/testexecuteutilsu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,153 @@
+EXPORTS
+	??0CTestExecuteIniData@@QAE@XZ @ 1 NONAME ; CTestExecuteIniData::CTestExecuteIniData(void)
+	??0CTestExecuteLogger@@QAE@W4TLoggerOptions@@@Z @ 2 NONAME ; CTestExecuteLogger::CTestExecuteLogger(enum TLoggerOptions)
+	??0CTestServer@@IAE@XZ @ 3 NONAME ; CTestServer::CTestServer(void)
+	??0CTestSession@@QAE@XZ @ 4 NONAME ; CTestSession::CTestSession(void)
+	??0CTestStep@@IAE@XZ @ 5 NONAME ; CTestStep::CTestStep(void)
+	??1CTestExecuteIniData@@UAE@XZ @ 6 NONAME ; CTestExecuteIniData::~CTestExecuteIniData(void)
+	??1CTestExecuteLogger@@UAE@XZ @ 7 NONAME ; CTestExecuteLogger::~CTestExecuteLogger(void)
+	??1CTestServer@@UAE@XZ @ 8 NONAME ; CTestServer::~CTestServer(void)
+	??1CTestSession@@UAE@XZ @ 9 NONAME ; CTestSession::~CTestSession(void)
+	??1CTestStep@@UAE@XZ @ 10 NONAME ; CTestStep::~CTestStep(void)
+	?AbortTestStep@RTestSession@@QAEHXZ @ 11 NONAME ; int RTestSession::AbortTestStep(void)
+	?Close@CTestExecuteLogger@@UAEXXZ @ 12 NONAME ; void CTestExecuteLogger::Close(void)
+	?Close@RTestSession@@QAEXXZ @ 13 NONAME ; void RTestSession::Close(void)
+	?Connect@CTestExecuteLogger@@UAEHXZ @ 14 NONAME ; int CTestExecuteLogger::Connect(void)
+	?Connect@RTestServ@@QAEHABVTDesC16@@H@Z @ 15 NONAME ; int RTestServ::Connect(class TDesC16 const &, int)
+	?ConstructL@CTestExecuteIniData@@QAEXXZ @ 16 NONAME ; void CTestExecuteIniData::ConstructL(void)
+	?ConstructL@CTestServer@@UAEXABVTDesC16@@@Z @ 17 NONAME ; void CTestServer::ConstructL(class TDesC16 const &)
+	?ExtractValuesFromIni@CTestExecuteIniData@@QAEXXZ @ 18 NONAME ; void CTestExecuteIniData::ExtractValuesFromIni(void)
+	?GetBoolFromConfig@CTestStep@@QAEHABVTDesC16@@0AAH@Z @ 19 NONAME ; int CTestStep::GetBoolFromConfig(class TDesC16 const &, class TDesC16 const &, int &)
+	?GetHexFromConfig@CTestStep@@QAEHABVTDesC16@@0AAH@Z @ 20 NONAME ; int CTestStep::GetHexFromConfig(class TDesC16 const &, class TDesC16 const &, int &)
+	?GetIntFromConfig@CTestStep@@QAEHABVTDesC16@@0AAH@Z @ 21 NONAME ; int CTestStep::GetIntFromConfig(class TDesC16 const &, class TDesC16 const &, int &)
+	?GetKeyValueFromIni@CTestExecuteIniData@@QAEXABVTDesC16@@AAH@Z @ 22 NONAME ; void CTestExecuteIniData::GetKeyValueFromIni(class TDesC16 const &, int &)
+	?GetKeyValueFromIni@CTestExecuteIniData@@QAEXABVTDesC16@@AAVTDes16@@@Z @ 23 NONAME ; void CTestExecuteIniData::GetKeyValueFromIni(class TDesC16 const &, class TDes16 &)
+	?GetServerName@CTestStep@@QBEABVTDesC16@@XZ @ 24 NONAME ; class TDesC16 const & CTestStep::GetServerName(void) const
+	?GetStringFromConfig@CTestStep@@QAEHABVTDesC16@@0AAVTPtrC16@@@Z @ 25 NONAME ; int CTestStep::GetStringFromConfig(class TDesC16 const &, class TDesC16 const &, class TPtrC16 &)
+	?InitialiseLoggingL@CTestExecuteLogger@@UAEXABVTDesC16@@HH@Z @ 26 NONAME ; void CTestExecuteLogger::InitialiseLoggingL(class TDesC16 const &, int, int)
+	?LogExtra@CTestExecuteLogger@@UAAXPBEHHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 27 NONAME ; void CTestExecuteLogger::LogExtra(unsigned char const *, int, int, class TRefByValue<class TDesC16 const >, ...)
+	?LogResult@CTestExecuteLogger@@UAEXW4TVerdict@@ABVTDesC16@@H11H@Z @ 28 NONAME ; void CTestExecuteLogger::LogResult(enum TVerdict, class TDesC16 const &, int, class TDesC16 const &, class TDesC16 const &, int)
+	?LogTestCaseResult@CTestExecuteLogger@@UAEXABVTDesC16@@HH00W4TVerdict@@@Z @ 29 NONAME ; void CTestExecuteLogger::LogTestCaseResult(class TDesC16 const &, int, int, class TDesC16 const &, class TDesC16 const &, enum TVerdict)
+	?LogToXml@CTestExecuteLogger@@UAEXPBEHHABVTDesC16@@@Z @ 30 NONAME ; void CTestExecuteLogger::LogToXml(unsigned char const *, int, int, class TDesC16 const &)
+	?LogToXml@CTestExecuteLogger@@UAEXPBEHHABVTDesC16@@HPAUTExtraLogField@@@Z @ 31 NONAME ; void CTestExecuteLogger::LogToXml(unsigned char const *, int, int, class TDesC16 const &, int, struct TExtraLogField *)
+	?NewL@CTestExecuteIniData@@SAPAV1@XZ @ 32 NONAME ; class CTestExecuteIniData * CTestExecuteIniData::NewL(void)
+	?NewLC@CTestExecuteIniData@@SAPAV1@XZ @ 33 NONAME ; class CTestExecuteIniData * CTestExecuteIniData::NewLC(void)
+	?NewSessionL@CTestServer@@UBEPAVCSession2@@ABVTVersion@@ABVRMessage2@@@Z @ 34 NONAME ; class CSession2 * CTestServer::NewSessionL(class TVersion const &, class RMessage2 const &) const
+	?Open@RTestSession@@QAEHAAVRTestServ@@ABVTDesC16@@H@Z @ 35 NONAME ; int RTestSession::Open(class RTestServ &, class TDesC16 const &, int)
+	?PrintCurrentScriptLine@CTestExecuteLogger@@UAEXAAVTDes16@@@Z @ 36 NONAME ; void CTestExecuteLogger::PrintCurrentScriptLine(class TDes16 &)
+	?ReadSharedDataL@CTestStep@@QAEXABVTDesC16@@AAVTDes16@@@Z @ 37 NONAME ; void CTestStep::ReadSharedDataL(class TDesC16 const &, class TDes16 &)
+	?RunTestStep@RTestSession@@QAEXABVTDesC16@@AAVTDes16@@AAVTRequestStatus@@@Z @ 38 NONAME ; void RTestSession::RunTestStep(class TDesC16 const &, class TDes16 &, class TRequestStatus &)
+	?ServerName@RTestServ@@QBEABVTDesC16@@XZ @ 39 NONAME ; class TDesC16 const & RTestServ::ServerName(void) const
+	?ServiceL@CTestSession@@UAEXABVRMessage2@@@Z @ 40 NONAME ; void CTestSession::ServiceL(class RMessage2 const &)
+	?SetLoggerOptions@CTestExecuteLogger@@UAEXH@Z @ 41 NONAME ; void CTestExecuteLogger::SetLoggerOptions(int)
+	?SetTestStepError@CTestStep@@QAEXABH@Z @ 42 NONAME ; void CTestStep::SetTestStepError(int const &)
+	?SetTestStepName@CTestStep@@QAEXABVTDesC16@@@Z @ 43 NONAME ; void CTestStep::SetTestStepName(class TDesC16 const &)
+	?ShareAuto@CTestExecuteLogger@@UAEHXZ @ 44 NONAME ; int CTestExecuteLogger::ShareAuto(void)
+	?TerminateLoggingL@CTestExecuteLogger@@UAEXHHH@Z @ 45 NONAME ; void CTestExecuteLogger::TerminateLoggingL(int, int, int)
+	?TestCheckPointCompareL@CTestStep@@QAEXHHABVTDesC16@@PBEH@Z @ 46 NONAME ; void CTestStep::TestCheckPointCompareL(int, int, class TDesC16 const &, unsigned char const *, int)
+	?Write@CTestExecuteLogger@@UAEXABVTDesC16@@@Z @ 47 NONAME ; void CTestExecuteLogger::Write(class TDesC16 const &)
+	?Write@CTestExecuteLogger@@UAEXABVTDesC8@@@Z @ 48 NONAME ; void CTestExecuteLogger::Write(class TDesC8 const &)
+	?WriteBoolToConfig@CTestStep@@QAEHABVTDesC16@@0ABH@Z @ 49 NONAME ; int CTestStep::WriteBoolToConfig(class TDesC16 const &, class TDesC16 const &, int const &)
+	?WriteFormat@CTestExecuteLogger@@UAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 50 NONAME ; void CTestExecuteLogger::WriteFormat(class TRefByValue<class TDesC16 const >, ...)
+	?WriteFormat@CTestExecuteLogger@@UAAXV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 51 NONAME ; void CTestExecuteLogger::WriteFormat(class TRefByValue<class TDesC8 const >, ...)
+	?WriteHexToConfig@CTestStep@@QAEHABVTDesC16@@0ABH@Z @ 52 NONAME ; int CTestStep::WriteHexToConfig(class TDesC16 const &, class TDesC16 const &, int const &)
+	?WriteIntToConfig@CTestStep@@QAEHABVTDesC16@@0ABH@Z @ 53 NONAME ; int CTestStep::WriteIntToConfig(class TDesC16 const &, class TDesC16 const &, int const &)
+	?WriteSharedDataL@CTestStep@@QAEXABVTDesC16@@AAV2@W4TModeCopy@@@Z @ 54 NONAME ; void CTestStep::WriteSharedDataL(class TDesC16 const &, class TDesC16 &, enum TModeCopy)
+	?WriteStringToConfig@CTestStep@@QAEHABVTDesC16@@0ABVTPtrC16@@@Z @ 55 NONAME ; int CTestStep::WriteStringToConfig(class TDesC16 const &, class TDesC16 const &, class TPtrC16 const &)
+	?doTestStepPostambleL@CTestStep@@UAE?AW4TVerdict@@XZ @ 56 NONAME ; enum TVerdict CTestStep::doTestStepPostambleL(void)
+	?doTestStepPreambleL@CTestStep@@UAE?AW4TVerdict@@XZ @ 57 NONAME ; enum TVerdict CTestStep::doTestStepPreambleL(void)
+	?testBooleanTrue@CTestStep@@QAEXHPBEH@Z @ 58 NONAME ; void CTestStep::testBooleanTrue(int, unsigned char const *, int)
+	?testBooleanTrue@CTestStep@@QAEXHPBEHH@Z @ 59 NONAME ; void CTestStep::testBooleanTrue(int, unsigned char const *, int, int)
+	?testBooleanTrueL@CTestStep@@QAEXHPBEH@Z @ 60 NONAME ; void CTestStep::testBooleanTrueL(int, unsigned char const *, int)
+	?testBooleanTrueL@CTestStep@@QAEXHPBEHH@Z @ 61 NONAME ; void CTestStep::testBooleanTrueL(int, unsigned char const *, int, int)
+	?testBooleanTrueWithErrorCode@CTestStep@@QAEXHHPBEH@Z @ 62 NONAME ; void CTestStep::testBooleanTrueWithErrorCode(int, int, unsigned char const *, int)
+	?testBooleanTrueWithErrorCode@CTestStep@@QAEXHHPBEHH@Z @ 63 NONAME ; void CTestStep::testBooleanTrueWithErrorCode(int, int, unsigned char const *, int, int)
+	?testBooleanTrueWithErrorCodeL@CTestStep@@QAEXHHPBEH@Z @ 64 NONAME ; void CTestStep::testBooleanTrueWithErrorCodeL(int, int, unsigned char const *, int)
+	?testBooleanTrueWithErrorCodeL@CTestStep@@QAEXHHPBEHH@Z @ 65 NONAME ; void CTestStep::testBooleanTrueWithErrorCodeL(int, int, unsigned char const *, int, int)
+	?CheckForHeapFailNext@CTestStep@@UAEHXZ @ 66 NONAME ; int CTestStep::CheckForHeapFailNext(void)
+	?ResetHeapFailNext@CTestStep@@UAEXXZ @ 67 NONAME ; void CTestStep::ResetHeapFailNext(void)
+	?SetHeapFailNext@CTestStep@@UAEXH@Z @ 68 NONAME ; void CTestStep::SetHeapFailNext(int)
+	?TestCaseName@CTestStep@@QAEHAAVTDes16@@@Z @ 69 NONAME ; int CTestStep::TestCaseName(class TDes16 &)
+	??0CActiveCallback@@IAE@AAVMActiveCallback@@H@Z @ 70 NONAME ; CActiveCallback::CActiveCallback(class MActiveCallback &, int)
+	??0CBlockActiveScheduler@CTestBlockController@@QAE@AAV1@@Z @ 71 NONAME ; CTestBlockController::CBlockActiveScheduler::CBlockActiveScheduler(class CTestBlockController &)
+	??0CDataWrapper@@IAE@XZ @ 72 NONAME ; CDataWrapper::CDataWrapper(void)
+	??0CTestBlockController@@QAE@XZ @ 73 NONAME ; CTestBlockController::CTestBlockController(void)
+	??0CTestServer2@@QAE@XZ @ 74 NONAME ; CTestServer2::CTestServer2(void)
+	??1CActiveCallback@@UAE@XZ @ 75 NONAME ; CActiveCallback::~CActiveCallback(void)
+	??1CBlockActiveScheduler@CTestBlockController@@UAE@XZ @ 76 NONAME ; CTestBlockController::CBlockActiveScheduler::~CBlockActiveScheduler(void)
+	??1CCommandProcessor@@UAE@XZ @ 77 NONAME ; CCommandProcessor::~CCommandProcessor(void)
+	??1CDataWrapper@@UAE@XZ @ 78 NONAME ; CDataWrapper::~CDataWrapper(void)
+	??1CTestBlockController@@UAE@XZ @ 79 NONAME ; CTestBlockController::~CTestBlockController(void)
+	??1CTestServer2@@UAE@XZ @ 80 NONAME ; CTestServer2::~CTestServer2(void)
+	?Activate@CActiveCallback@@QAEXH@Z @ 81 NONAME ; void CActiveCallback::Activate(int)
+	?Activate@CCommandProcessor@@QAEXXZ @ 82 NONAME ; void CCommandProcessor::Activate(void)
+	?BlockResult@CDataWrapper@@UAE?AW4TVerdict@@XZ @ 83 NONAME ; enum TVerdict CDataWrapper::BlockResult(void)
+	?BlockResult@CTestBlockController@@UAE?AW4TVerdict@@XZ @ 84 NONAME ; enum TVerdict CTestBlockController::BlockResult(void)
+	?CancelTimer@CTestBlockController@@AAEXXZ @ 85 NONAME ; void CTestBlockController::CancelTimer(void)
+	?ConstructL@CActiveCallback@@IAEXXZ @ 86 NONAME ; void CActiveCallback::ConstructL(void)
+	?ConstructL@CTestServer2@@QAEXXZ @ 87 NONAME ; void CTestServer2::ConstructL(void)
+	?CreateActiveSchedulerL@CTestServer2@@UAEXXZ @ 88 NONAME ; void CTestServer2::CreateActiveSchedulerL(void)
+	?CreateTestStep@CTestServer2@@UAEPAVCTestStep@@ABVTDesC16@@@Z @ 89 NONAME ; class CTestStep * CTestServer2::CreateTestStep(class TDesC16 const &)
+	?DeleteActiveSchedulerL@CTestServer2@@UAEXXZ @ 90 NONAME ; void CTestServer2::DeleteActiveSchedulerL(void)
+	?DoCancel@CActiveCallback@@UAEXXZ @ 91 NONAME ; void CActiveCallback::DoCancel(void)
+	?DoCancel@CDataWrapper@@UAEXPAVCActive@@H@Z @ 92 NONAME ; void CDataWrapper::DoCancel(class CActive *, int)
+	?DoCommandL@CTestBlockController@@MAEHAAVTTEFBlockItem@@H@Z @ 93 NONAME ; int CTestBlockController::DoCommandL(class TTEFBlockItem &, int)
+	?Error@CBlockActiveScheduler@CTestBlockController@@UBEXH@Z @ 94 NONAME ; void CTestBlockController::CBlockActiveScheduler::Error(int) const
+	?GetBoolFromConfig@CDataWrapper@@UAEHABVTDesC16@@0AAH@Z @ 95 NONAME ; int CDataWrapper::GetBoolFromConfig(class TDesC16 const &, class TDesC16 const &, int &)
+	?GetDataObjectL@CDataWrapper@@UAEPAXABVTDesC16@@@Z @ 96 NONAME ; void * CDataWrapper::GetDataObjectL(class TDesC16 const &)
+	?GetDataWrapperL@CDataWrapper@@UAEPAV1@ABVTDesC16@@@Z @ 97 NONAME ; class CDataWrapper * CDataWrapper::GetDataWrapperL(class TDesC16 const &)
+	?GetHexFromConfig@CDataWrapper@@UAEHABVTDesC16@@0AAH@Z @ 98 NONAME ; int CDataWrapper::GetHexFromConfig(class TDesC16 const &, class TDesC16 const &, int &)
+	?GetIntFromConfig@CDataWrapper@@UAEHABVTDesC16@@0AAH@Z @ 99 NONAME ; int CDataWrapper::GetIntFromConfig(class TDesC16 const &, class TDesC16 const &, int &)
+	?GetObjectAndOwnL@CTestServer2@@UAEPAXABVTDesC16@@@Z @ 100 NONAME ; void * CTestServer2::GetObjectAndOwnL(class TDesC16 const &)
+	?GetStringFromConfig@CDataWrapper@@UAEHABVTDesC16@@0AAVTPtrC16@@@Z @ 101 NONAME ; int CDataWrapper::GetStringFromConfig(class TDesC16 const &, class TDesC16 const &, class TPtrC16 &)
+	?KickState@CActiveCallback@@QAEXXZ @ 102 NONAME ; void CActiveCallback::KickState(void)
+	?KickState@CCommandProcessor@@QAEXXZ @ 103 NONAME ; void CCommandProcessor::KickState(void)
+	?LogBlock@CTestExecuteLogger@@UAE?AW4TVerdict@@PAV?$CArrayFixFlat@VTTEFBlockItem@@@@H@Z @ 104 NONAME ; enum TVerdict CTestExecuteLogger::LogBlock(class CArrayFixFlat<class TTEFBlockItem> *, int)
+	?Logger@CDataWrapper@@UAEAAVCTestExecuteLogger@@XZ @ 105 NONAME ; class CTestExecuteLogger & CDataWrapper::Logger(void)
+	?NewL@CActiveCallback@@SAPAV1@AAVMActiveCallback@@H@Z @ 106 NONAME ; class CActiveCallback * CActiveCallback::NewL(class MActiveCallback &, int)
+	?NewL@CCommandProcessor@@SAPAV1@AAVMCommandProcessorCallback@@H@Z @ 107 NONAME ; class CCommandProcessor * CCommandProcessor::NewL(class MCommandProcessorCallback &, int)
+	?NewL@CTEFTimer@@SAPAV1@AAVMTEFTimerCallback@@H@Z @ 108 NONAME ; class CTEFTimer * CTEFTimer::NewL(class MTEFTimerCallback &, int)
+	?NewLC@CActiveCallback@@SAPAV1@AAVMActiveCallback@@H@Z @ 109 NONAME ; class CActiveCallback * CActiveCallback::NewLC(class MActiveCallback &, int)
+	?NewLC@CCommandProcessor@@SAPAV1@AAVMCommandProcessorCallback@@H@Z @ 110 NONAME ; class CCommandProcessor * CCommandProcessor::NewLC(class MCommandProcessorCallback &, int)
+	?NextCommandL@CTestBlockController@@UAEXXZ @ 111 NONAME ; void CTestBlockController::NextCommandL(void)
+	?Open@RTestSession@@QAEHAAVRTestServ@@H@Z @ 112 NONAME ; int RTestSession::Open(class RTestServ &, int)
+	?OutstandingCallback@CTestBlockController@@AAEXXZ @ 113 NONAME ; void CTestBlockController::OutstandingCallback(void)
+	?OutstandingCallback@CTestBlockController@@CAHPAX@Z @ 114 NONAME ; int CTestBlockController::OutstandingCallback(void *)
+	?PutAndDisownL@CTestServer2@@UAEXABVTDesC16@@PAXP6AX1@Z@Z @ 115 NONAME ; void CTestServer2::PutAndDisownL(class TDesC16 const &, void *, void (*)(void *))
+	?ReadSharedDataL@CDataWrapper@@UAEXABVTDesC16@@AAVTDes16@@@Z @ 116 NONAME ; void CDataWrapper::ReadSharedDataL(class TDesC16 const &, class TDes16 &)
+	?RunL@CActiveCallback@@UAEXXZ @ 117 NONAME ; void CActiveCallback::RunL(void)
+	?RunL@CDataWrapper@@UAEXPAVCActive@@H@Z @ 118 NONAME ; void CDataWrapper::RunL(class CActive *, int)
+	?RunTestBlock@RTestSession@@QAEXABVTDesC16@@AAVTDes16@@AAVTDes8@@AAVTRequestStatus@@@Z @ 119 NONAME ; void RTestSession::RunTestBlock(class TDesC16 const &, class TDes16 &, class TDes8 &, class TRequestStatus &)
+	?SetAsyncError@CDataWrapper@@UAEXHH@Z @ 120 NONAME ; void CDataWrapper::SetAsyncError(int, int)
+	?SetAsyncError@CTestBlockController@@UAEXHH@Z @ 121 NONAME ; void CTestBlockController::SetAsyncError(int, int)
+	?SetBlockArray@CTestBlockController@@QAEXPAV?$CArrayFixFlat@VTTEFBlockItem@@@@@Z @ 122 NONAME ; void CTestBlockController::SetBlockArray(class CArrayFixFlat<class TTEFBlockItem> *)
+	?SetBlockResult@CDataWrapper@@UAEXW4TVerdict@@@Z @ 123 NONAME ; void CDataWrapper::SetBlockResult(enum TVerdict)
+	?SetBlockResult@CTestBlockController@@UAEXW4TVerdict@@@Z @ 124 NONAME ; void CTestBlockController::SetBlockResult(enum TVerdict)
+	?SetDataDictionary@CDataWrapper@@QAEXPAVCDataDictionary@@@Z @ 125 NONAME ; void CDataWrapper::SetDataDictionary(class CDataDictionary *)
+	?SetDataObjectL@CDataWrapper@@UAEXABVTDesC16@@PAX@Z @ 126 NONAME ; void CDataWrapper::SetDataObjectL(class TDesC16 const &, void *)
+	?SetError@CDataWrapper@@UAEXH@Z @ 127 NONAME ; void CDataWrapper::SetError(int)
+	?SetError@CTestBlockController@@UAEXH@Z @ 128 NONAME ; void CTestBlockController::SetError(int)
+	?SetSharedData@CTestBlockController@@QAEXPAVMSharedData@@@Z @ 129 NONAME ; void CTestBlockController::SetSharedData(class MSharedData *)
+	?SetTestBlockController@CDataWrapper@@QAEXPAVCTestBlockController@@@Z @ 130 NONAME ; void CDataWrapper::SetTestBlockController(class CTestBlockController *)
+	?StartCommands@CTestBlockController@@IAEXXZ @ 131 NONAME ; void CTestBlockController::StartCommands(void)
+	?StartTimer@CTestBlockController@@AAEXABVTTEFBlockItem@@@Z @ 132 NONAME ; void CTestBlockController::StartTimer(class TTEFBlockItem const &)
+	?TimerCompleted@CTestBlockController@@UAEXXZ @ 133 NONAME ; void CTestBlockController::TimerCompleted(void)
+	?WriteBoolToConfig@CDataWrapper@@UAEHABVTDesC16@@0ABH@Z @ 134 NONAME ; int CDataWrapper::WriteBoolToConfig(class TDesC16 const &, class TDesC16 const &, int const &)
+	?WriteHexToConfig@CDataWrapper@@UAEHABVTDesC16@@0ABH@Z @ 135 NONAME ; int CDataWrapper::WriteHexToConfig(class TDesC16 const &, class TDesC16 const &, int const &)
+	?WriteIntToConfig@CDataWrapper@@UAEHABVTDesC16@@0ABH@Z @ 136 NONAME ; int CDataWrapper::WriteIntToConfig(class TDesC16 const &, class TDesC16 const &, int const &)
+	?WriteSharedDataL@CDataWrapper@@UAEXABVTDesC16@@AAV2@W4TModeCopy@@@Z @ 137 NONAME ; void CDataWrapper::WriteSharedDataL(class TDesC16 const &, class TDesC16 &, enum TModeCopy)
+	?WriteStringToConfig@CDataWrapper@@UAEHABVTDesC16@@0ABVTPtrC16@@@Z @ 138 NONAME ; int CDataWrapper::WriteStringToConfig(class TDesC16 const &, class TDesC16 const &, class TPtrC16 const &)
+	?doTestStepL@CTestBlockController@@UAE?AW4TVerdict@@XZ @ 139 NONAME ; enum TVerdict CTestBlockController::doTestStepL(void)
+	?doTestStepPostambleL@CTestBlockController@@UAE?AW4TVerdict@@XZ @ 140 NONAME ; enum TVerdict CTestBlockController::doTestStepPostambleL(void)
+	?doTestStepPreambleL@CTestBlockController@@UAE?AW4TVerdict@@XZ @ 141 NONAME ; enum TVerdict CTestBlockController::doTestStepPreambleL(void)
+	?NewL@CTestExecuteLogger@@SAPAV1@W4TLoggerOptions@@@Z @ 142 NONAME ; class CTestExecuteLogger * CTestExecuteLogger::NewL(enum TLoggerOptions)
+	?NewLC@CTestExecuteLogger@@SAPAV1@W4TLoggerOptions@@@Z @ 143 NONAME ; class CTestExecuteLogger * CTestExecuteLogger::NewLC(enum TLoggerOptions)
+	?SetLoggerChannel@CTestExecuteLogger@@QAEXH@Z @ 144 NONAME ; void CTestExecuteLogger::SetLoggerChannel(int)
+	?SetPipeName@CTestExecuteLogger@@QAEXAAVTPtrC16@@@Z @ 145 NONAME ; void CTestExecuteLogger::SetPipeName(class TPtrC16 &)
+	??0CTestExecuteIniData@@QAE@AAV?$TBuf@$01@@@Z @ 146 NONAME ; CTestExecuteIniData::CTestExecuteIniData(class TBuf<2> &)
+	?NewL@CTestExecuteIniData@@SAPAV1@AAV?$TBuf@$01@@@Z @ 147 NONAME ; class CTestExecuteIniData * CTestExecuteIniData::NewL(class TBuf<2> &)
+	?NewLC@CTestExecuteIniData@@SAPAV1@AAV?$TBuf@$01@@@Z @ 148 NONAME ; class CTestExecuteIniData * CTestExecuteIniData::NewLC(class TBuf<2> &)
+	?GetIntFromConfig@CTestStep@@QAEHABVTDesC16@@0AA_J@Z @ 149 NONAME ; int CTestStep::GetIntFromConfig(class TDesC16 const &, class TDesC16 const &, long long &)
+	?WriteIntToConfig@CTestStep@@QAEHABVTDesC16@@0AB_J@Z @ 150 NONAME ; int CTestStep::WriteIntToConfig(class TDesC16 const &, class TDesC16 const &, long long const &)
+	?WrapperPluginNew@TEFUtils@@SAPAVCWrapperUtilsPlugin@@AAVRLibrary@@@Z @ 151 NONAME ; class CWrapperUtilsPlugin * TEFUtils::WrapperPluginNew(class RLibrary &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/eabi/testexecuteutilsu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,269 @@
+EXPORTS
+	_ZN11CTestServer10ConstructLERK7TDesC16 @ 1 NONAME
+	_ZN11CTestServerC2Ev @ 2 NONAME
+	_ZN11CTestServerD0Ev @ 3 NONAME
+	_ZN11CTestServerD1Ev @ 4 NONAME
+	_ZN11CTestServerD2Ev @ 5 NONAME
+	_ZN12CTestSession8ServiceLERK9RMessage2 @ 6 NONAME
+	_ZN12CTestSessionC1Ev @ 7 NONAME
+	_ZN12CTestSessionC2Ev @ 8 NONAME
+	_ZN12CTestSessionD0Ev @ 9 NONAME
+	_ZN12CTestSessionD1Ev @ 10 NONAME
+	_ZN12CTestSessionD2Ev @ 11 NONAME
+	_ZN12RTestSession11RunTestStepERK7TDesC16R6TDes16R14TRequestStatus @ 12 NONAME
+	_ZN12RTestSession13AbortTestStepEv @ 13 NONAME
+	_ZN12RTestSession4OpenER9RTestServRK7TDesC16i @ 14 NONAME
+	_ZN12RTestSession5CloseEv @ 15 NONAME
+	_ZN18CTestExecuteLogger11WriteFormatE11TRefByValueIK6TDesC8Ez @ 16 NONAME
+	_ZN18CTestExecuteLogger11WriteFormatE11TRefByValueIK7TDesC16Ez @ 17 NONAME
+	_ZN18CTestExecuteLogger16SetLoggerOptionsEi @ 18 NONAME
+	_ZN18CTestExecuteLogger17LogTestCaseResultERK7TDesC16iiS2_S2_8TVerdict @ 19 NONAME
+	_ZN18CTestExecuteLogger17TerminateLoggingLEiii @ 20 NONAME
+	_ZN18CTestExecuteLogger18InitialiseLoggingLERK7TDesC16ii @ 21 NONAME
+	_ZN18CTestExecuteLogger22PrintCurrentScriptLineER6TDes16 @ 22 NONAME
+	_ZN18CTestExecuteLogger5CloseEv @ 23 NONAME
+	_ZN18CTestExecuteLogger5WriteERK6TDesC8 @ 24 NONAME
+	_ZN18CTestExecuteLogger5WriteERK7TDesC16 @ 25 NONAME
+	_ZN18CTestExecuteLogger7ConnectEv @ 26 NONAME
+	_ZN18CTestExecuteLogger8LogExtraEPKhii11TRefByValueIK7TDesC16Ez @ 27 NONAME
+	_ZN18CTestExecuteLogger8LogToXmlEPKhiiRK7TDesC16 @ 28 NONAME
+	_ZN18CTestExecuteLogger8LogToXmlEPKhiiRK7TDesC16iP14TExtraLogField @ 29 NONAME
+	_ZN18CTestExecuteLogger9LogResultE8TVerdictRK7TDesC16iS3_S3_i @ 30 NONAME
+	_ZN18CTestExecuteLogger9ShareAutoEv @ 31 NONAME
+	_ZN18CTestExecuteLoggerC1E14TLoggerOptions @ 32 NONAME
+	_ZN18CTestExecuteLoggerC2E14TLoggerOptions @ 33 NONAME
+	_ZN18CTestExecuteLoggerD0Ev @ 34 NONAME
+	_ZN18CTestExecuteLoggerD1Ev @ 35 NONAME
+	_ZN18CTestExecuteLoggerD2Ev @ 36 NONAME
+	_ZN19CTestExecuteIniData10ConstructLEv @ 37 NONAME
+	_ZN19CTestExecuteIniData18GetKeyValueFromIniERK7TDesC16R6TDes16 @ 38 NONAME
+	_ZN19CTestExecuteIniData18GetKeyValueFromIniERK7TDesC16Ri @ 39 NONAME
+	_ZN19CTestExecuteIniData20ExtractValuesFromIniEv @ 40 NONAME
+	_ZN19CTestExecuteIniData4NewLEv @ 41 NONAME
+	_ZN19CTestExecuteIniData5NewLCEv @ 42 NONAME
+	_ZN19CTestExecuteIniDataC1Ev @ 43 NONAME
+	_ZN19CTestExecuteIniDataC2Ev @ 44 NONAME
+	_ZN19CTestExecuteIniDataD0Ev @ 45 NONAME
+	_ZN19CTestExecuteIniDataD1Ev @ 46 NONAME
+	_ZN19CTestExecuteIniDataD2Ev @ 47 NONAME
+	_ZN9CTestStep15ReadSharedDataLERK7TDesC16R6TDes16 @ 48 NONAME
+	_ZN9CTestStep15SetTestStepNameERK7TDesC16 @ 49 NONAME
+	_ZN9CTestStep15testBooleanTrueEiPKhi @ 50 NONAME
+	_ZN9CTestStep15testBooleanTrueEiPKhii @ 51 NONAME
+	_ZN9CTestStep16GetHexFromConfigERK7TDesC16S2_Ri @ 52 NONAME
+	_ZN9CTestStep16GetIntFromConfigERK7TDesC16S2_Ri @ 53 NONAME
+	_ZN9CTestStep16SetTestStepErrorERKi @ 54 NONAME
+	_ZN9CTestStep16WriteHexToConfigERK7TDesC16S2_RKi @ 55 NONAME
+	_ZN9CTestStep16WriteIntToConfigERK7TDesC16S2_RKi @ 56 NONAME
+	_ZN9CTestStep16WriteSharedDataLERK7TDesC16RS0_9TModeCopy @ 57 NONAME
+	_ZN9CTestStep16testBooleanTrueLEiPKhi @ 58 NONAME
+	_ZN9CTestStep16testBooleanTrueLEiPKhii @ 59 NONAME
+	_ZN9CTestStep17GetBoolFromConfigERK7TDesC16S2_Ri @ 60 NONAME
+	_ZN9CTestStep17WriteBoolToConfigERK7TDesC16S2_RKi @ 61 NONAME
+	_ZN9CTestStep19GetStringFromConfigERK7TDesC16S2_R7TPtrC16 @ 62 NONAME
+	_ZN9CTestStep19WriteStringToConfigERK7TDesC16S2_RK7TPtrC16 @ 63 NONAME
+	_ZN9CTestStep19doTestStepPreambleLEv @ 64 NONAME
+	_ZN9CTestStep20doTestStepPostambleLEv @ 65 NONAME
+	_ZN9CTestStep22TestCheckPointCompareLEiiRK7TDesC16PKhi @ 66 NONAME
+	_ZN9CTestStep28testBooleanTrueWithErrorCodeEiiPKhi @ 67 NONAME
+	_ZN9CTestStep28testBooleanTrueWithErrorCodeEiiPKhii @ 68 NONAME
+	_ZN9CTestStep29testBooleanTrueWithErrorCodeLEiiPKhi @ 69 NONAME
+	_ZN9CTestStep29testBooleanTrueWithErrorCodeLEiiPKhii @ 70 NONAME
+	_ZN9CTestStepC2Ev @ 71 NONAME
+	_ZN9CTestStepD0Ev @ 72 NONAME
+	_ZN9CTestStepD1Ev @ 73 NONAME
+	_ZN9CTestStepD2Ev @ 74 NONAME
+	_ZN9RTestServ7ConnectERK7TDesC16i @ 75 NONAME
+	_ZNK11CTestServer11NewSessionLERK8TVersionRK9RMessage2 @ 76 NONAME
+	_ZNK9CTestStep13GetServerNameEv @ 77 NONAME
+	_ZNK9RTestServ10ServerNameEv @ 78 NONAME
+	_ZTI11CTestServer @ 79 NONAME ; #<TI>#
+	_ZTI12CStepControl @ 80 NONAME ; #<TI>#
+	_ZTI12CTestSession @ 81 NONAME ; #<TI>#
+	_ZTI18CTestExecuteLogger @ 82 NONAME ; #<TI>#
+	_ZTI19CTestExecuteIniData @ 83 NONAME ; #<TI>#
+	_ZTI22CPersistentStepControl @ 84 NONAME ; #<TI>#
+	_ZTI9CTestStep @ 85 NONAME ; #<TI>#
+	_ZTV11CTestServer @ 86 NONAME ; #<VT>#
+	_ZTV12CStepControl @ 87 NONAME ; #<VT>#
+	_ZTV12CTestSession @ 88 NONAME ; #<VT>#
+	_ZTV18CTestExecuteLogger @ 89 NONAME ; #<VT>#
+	_ZTV19CTestExecuteIniData @ 90 NONAME ; #<VT>#
+	_ZTV22CPersistentStepControl @ 91 NONAME ; #<VT>#
+	_ZTV9CTestStep @ 92 NONAME ; #<VT>#
+	_ZTI17CScriptPreProcess @ 93 NONAME ; #<TI>#
+	_ZTV17CScriptPreProcess @ 94 NONAME ; #<VT>#
+	_ZN9CTestStep15SetHeapFailNextEi @ 95 NONAME
+	_ZN9CTestStep17ResetHeapFailNextEv @ 96 NONAME
+	_ZN9CTestStep20CheckForHeapFailNextEv @ 97 NONAME
+	_ZN9CTestStep12TestCaseNameER6TDes16 @ 98 NONAME
+	_ZN12CDataWrapper11BlockResultEv @ 99 NONAME
+	_ZN12CDataWrapper13SetAsyncErrorEii @ 100 NONAME
+	_ZN12CDataWrapper14GetDataObjectLERK7TDesC16 @ 101 NONAME
+	_ZN12CDataWrapper14SetBlockResultE8TVerdict @ 102 NONAME
+	_ZN12CDataWrapper14SetDataObjectLERK7TDesC16Pv @ 103 NONAME
+	_ZN12CDataWrapper15GetDataWrapperLERK7TDesC16 @ 104 NONAME
+	_ZN12CDataWrapper15ReadSharedDataLERK7TDesC16R6TDes16 @ 105 NONAME
+	_ZN12CDataWrapper16GetHexFromConfigERK7TDesC16S2_Ri @ 106 NONAME
+	_ZN12CDataWrapper16GetIntFromConfigERK7TDesC16S2_Ri @ 107 NONAME
+	_ZN12CDataWrapper16WriteHexToConfigERK7TDesC16S2_RKi @ 108 NONAME
+	_ZN12CDataWrapper16WriteIntToConfigERK7TDesC16S2_RKi @ 109 NONAME
+	_ZN12CDataWrapper16WriteSharedDataLERK7TDesC16RS0_9TModeCopy @ 110 NONAME
+	_ZN12CDataWrapper17GetBoolFromConfigERK7TDesC16S2_Ri @ 111 NONAME
+	_ZN12CDataWrapper17SetDataDictionaryEP15CDataDictionary @ 112 NONAME
+	_ZN12CDataWrapper17WriteBoolToConfigERK7TDesC16S2_RKi @ 113 NONAME
+	_ZN12CDataWrapper19GetStringFromConfigERK7TDesC16S2_R7TPtrC16 @ 114 NONAME
+	_ZN12CDataWrapper19WriteStringToConfigERK7TDesC16S2_RK7TPtrC16 @ 115 NONAME
+	_ZN12CDataWrapper22SetTestBlockControllerEP20CTestBlockController @ 116 NONAME
+	_ZN12CDataWrapper4RunLEP7CActivei @ 117 NONAME
+	_ZN12CDataWrapper6LoggerEv @ 118 NONAME
+	_ZN12CDataWrapper8DoCancelEP7CActivei @ 119 NONAME
+	_ZN12CDataWrapper8SetErrorEi @ 120 NONAME
+	_ZN12CDataWrapperC2Ev @ 121 NONAME
+	_ZN12CDataWrapperD0Ev @ 122 NONAME
+	_ZN12CDataWrapperD1Ev @ 123 NONAME
+	_ZN12CDataWrapperD2Ev @ 124 NONAME
+	_ZN12CTestServer210ConstructLEv @ 125 NONAME
+	_ZN12CTestServer213PutAndDisownLERK7TDesC16PvPFvS3_E @ 126 NONAME
+	_ZN12CTestServer214CreateTestStepERK7TDesC16 @ 127 NONAME
+	_ZN12CTestServer216GetObjectAndOwnLERK7TDesC16 @ 128 NONAME
+	_ZN12CTestServer222CreateActiveSchedulerLEv @ 129 NONAME
+	_ZN12CTestServer222DeleteActiveSchedulerLEv @ 130 NONAME
+	_ZN12CTestServer2C2Ev @ 131 NONAME
+	_ZN12CTestServer2D0Ev @ 132 NONAME
+	_ZN12CTestServer2D1Ev @ 133 NONAME
+	_ZN12CTestServer2D2Ev @ 134 NONAME
+	_ZN12RTestSession12RunTestBlockERK7TDesC16R6TDes16R5TDes8R14TRequestStatus @ 135 NONAME
+	_ZN12RTestSession4OpenER9RTestServi @ 136 NONAME
+	_ZN15CActiveCallback10ConstructLEv @ 137 NONAME
+	_ZN15CActiveCallback4NewLER15MActiveCallbacki @ 138 NONAME
+	_ZN15CActiveCallback4RunLEv @ 139 NONAME
+	_ZN15CActiveCallback5NewLCER15MActiveCallbacki @ 140 NONAME
+	_ZN15CActiveCallback8ActivateEi @ 141 NONAME
+	_ZN15CActiveCallback8DoCancelEv @ 142 NONAME
+	_ZN15CActiveCallback9KickStateEv @ 143 NONAME
+	_ZN15CActiveCallbackC1ER15MActiveCallbacki @ 144 NONAME
+	_ZN15CActiveCallbackC2ER15MActiveCallbacki @ 145 NONAME
+	_ZN15CActiveCallbackD0Ev @ 146 NONAME
+	_ZN15CActiveCallbackD1Ev @ 147 NONAME
+	_ZN15CActiveCallbackD2Ev @ 148 NONAME
+	_ZN17CCommandProcessor4NewLER25MCommandProcessorCallbacki @ 149 NONAME
+	_ZN17CCommandProcessor5NewLCER25MCommandProcessorCallbacki @ 150 NONAME
+	_ZN17CCommandProcessor8ActivateEv @ 151 NONAME
+	_ZN17CCommandProcessor9KickStateEv @ 152 NONAME
+	_ZN17CCommandProcessorD0Ev @ 153 NONAME
+	_ZN17CCommandProcessorD1Ev @ 154 NONAME
+	_ZN17CCommandProcessorD2Ev @ 155 NONAME
+	_ZN18CTestExecuteLogger8LogBlockEP13CArrayFixFlatI13TTEFBlockItemEi @ 156 NONAME
+	_ZN20CTestBlockController10DoCommandLER13TTEFBlockItemi @ 157 NONAME
+	_ZN20CTestBlockController10StartTimerERK13TTEFBlockItem @ 158 NONAME
+	_ZN20CTestBlockController11BlockResultEv @ 159 NONAME
+	_ZN20CTestBlockController11CancelTimerEv @ 160 NONAME
+	_ZN20CTestBlockController11doTestStepLEv @ 161 NONAME
+	_ZN20CTestBlockController12NextCommandLEv @ 162 NONAME
+	_ZN20CTestBlockController13SetAsyncErrorEii @ 163 NONAME
+	_ZN20CTestBlockController13SetBlockArrayEP13CArrayFixFlatI13TTEFBlockItemE @ 164 NONAME
+	_ZN20CTestBlockController13SetSharedDataEP11MSharedData @ 165 NONAME
+	_ZN20CTestBlockController13StartCommandsEv @ 166 NONAME
+	_ZN20CTestBlockController14SetBlockResultE8TVerdict @ 167 NONAME
+	_ZN20CTestBlockController14TimerCompletedEv @ 168 NONAME
+	_ZN20CTestBlockController19OutstandingCallbackEPv @ 169 NONAME
+	_ZN20CTestBlockController19OutstandingCallbackEv @ 170 NONAME
+	_ZN20CTestBlockController19doTestStepPreambleLEv @ 171 NONAME
+	_ZN20CTestBlockController20doTestStepPostambleLEv @ 172 NONAME
+	_ZN20CTestBlockController21CBlockActiveSchedulerC1ERS_ @ 173 NONAME
+	_ZN20CTestBlockController21CBlockActiveSchedulerC2ERS_ @ 174 NONAME
+	_ZN20CTestBlockController21CBlockActiveSchedulerD0Ev @ 175 NONAME
+	_ZN20CTestBlockController21CBlockActiveSchedulerD1Ev @ 176 NONAME
+	_ZN20CTestBlockController21CBlockActiveSchedulerD2Ev @ 177 NONAME
+	_ZN20CTestBlockController8SetErrorEi @ 178 NONAME
+	_ZN20CTestBlockControllerC2Ev @ 179 NONAME
+	_ZN20CTestBlockControllerD0Ev @ 180 NONAME
+	_ZN20CTestBlockControllerD1Ev @ 181 NONAME
+	_ZN20CTestBlockControllerD2Ev @ 182 NONAME
+	_ZN9CTEFTimer4NewLER17MTEFTimerCallbacki @ 183 NONAME
+	_ZNK20CTestBlockController21CBlockActiveScheduler5ErrorEi @ 184 NONAME
+	_ZTI12CDataWrapper @ 185 NONAME
+	_ZTI12CTestServer2 @ 186 NONAME
+	_ZTI13CBlockControl @ 187 NONAME
+	_ZTI15CActiveCallback @ 188 NONAME
+	_ZTI15CDataDictionary @ 189 NONAME
+	_ZTI17CBlockControlBase @ 190 NONAME
+	_ZTI17CCommandProcessor @ 191 NONAME
+	_ZTI20CTestBlockController @ 192 NONAME
+	_ZTI23CPersistentBlockControl @ 193 NONAME
+	_ZTI9CTEFTimer @ 194 NONAME
+	_ZTIN20CTestBlockController21CBlockActiveSchedulerE @ 195 NONAME
+	_ZTV12CDataWrapper @ 196 NONAME
+	_ZTV12CTestServer2 @ 197 NONAME
+	_ZTV13CBlockControl @ 198 NONAME
+	_ZTV15CActiveCallback @ 199 NONAME
+	_ZTV15CDataDictionary @ 200 NONAME
+	_ZTV17CBlockControlBase @ 201 NONAME
+	_ZTV17CCommandProcessor @ 202 NONAME
+	_ZTV20CTestBlockController @ 203 NONAME
+	_ZTV23CPersistentBlockControl @ 204 NONAME
+	_ZTV9CTEFTimer @ 205 NONAME
+	_ZTVN20CTestBlockController21CBlockActiveSchedulerE @ 206 NONAME
+	_ZThn728_N20CTestBlockController11BlockResultEv @ 207 NONAME ABSENT
+	_ZThn728_N20CTestBlockController13SetAsyncErrorEii @ 208 NONAME ABSENT
+	_ZThn728_N20CTestBlockController14SetBlockResultE8TVerdict @ 209 NONAME ABSENT
+	_ZThn728_N20CTestBlockController8SetErrorEi @ 210 NONAME ABSENT
+	_ZThn732_N20CTestBlockController14TimerCompletedEv @ 211 NONAME ABSENT
+	_ZThn736_N20CTestBlockController12NextCommandLEv @ 212 NONAME ABSENT
+	_ZThn12_N12CDataWrapper11BlockResultEv @ 213 NONAME
+	_ZThn12_N12CDataWrapper13SetAsyncErrorEii @ 214 NONAME
+	_ZThn12_N12CDataWrapper14SetBlockResultE8TVerdict @ 215 NONAME
+	_ZThn12_N12CDataWrapper8SetErrorEi @ 216 NONAME
+	_ZThn4_N12CDataWrapper4RunLEP7CActivei @ 217 NONAME
+	_ZThn4_N12CDataWrapper8DoCancelEP7CActivei @ 218 NONAME
+	_ZThn752_N12CTestServer213PutAndDisownLERK7TDesC16PvPFvS3_E @ 219 NONAME ABSENT
+	_ZThn752_N12CTestServer216GetObjectAndOwnLERK7TDesC16 @ 220 NONAME ABSENT
+	_ZThn752_N12CTestServer222CreateActiveSchedulerLEv @ 221 NONAME ABSENT
+	_ZThn752_N12CTestServer222DeleteActiveSchedulerLEv @ 222 NONAME ABSENT
+	_ZThn8_N12CDataWrapper14GetDataObjectLERK7TDesC16 @ 223 NONAME
+	_ZThn8_N12CDataWrapper14SetDataObjectLERK7TDesC16Pv @ 224 NONAME
+	_ZThn8_N12CDataWrapper15GetDataWrapperLERK7TDesC16 @ 225 NONAME
+	_ZThn8_N12CDataWrapper15ReadSharedDataLERK7TDesC16R6TDes16 @ 226 NONAME
+	_ZThn8_N12CDataWrapper16GetHexFromConfigERK7TDesC16S2_Ri @ 227 NONAME
+	_ZThn8_N12CDataWrapper16GetIntFromConfigERK7TDesC16S2_Ri @ 228 NONAME
+	_ZThn8_N12CDataWrapper16WriteHexToConfigERK7TDesC16S2_RKi @ 229 NONAME
+	_ZThn8_N12CDataWrapper16WriteIntToConfigERK7TDesC16S2_RKi @ 230 NONAME
+	_ZThn8_N12CDataWrapper16WriteSharedDataLERK7TDesC16RS0_9TModeCopy @ 231 NONAME
+	_ZThn8_N12CDataWrapper17GetBoolFromConfigERK7TDesC16S2_Ri @ 232 NONAME
+	_ZThn8_N12CDataWrapper17WriteBoolToConfigERK7TDesC16S2_RKi @ 233 NONAME
+	_ZThn8_N12CDataWrapper19GetStringFromConfigERK7TDesC16S2_R7TPtrC16 @ 234 NONAME
+	_ZThn8_N12CDataWrapper19WriteStringToConfigERK7TDesC16S2_RK7TPtrC16 @ 235 NONAME
+	_ZThn8_N12CDataWrapper6LoggerEv @ 236 NONAME
+	_ZN18CTestExecuteLogger4NewLE14TLoggerOptions @ 237 NONAME
+	_ZN18CTestExecuteLogger5NewLCE14TLoggerOptions @ 238 NONAME
+	_ZN18CTestExecuteLogger16SetLoggerChannelEi @ 239 NONAME
+	_ZN18CTestExecuteLogger11SetPipeNameER7TPtrC16 @ 240 NONAME
+	_ZThn772_N12CTestServer213PutAndDisownLERK7TDesC16PvPFvS3_E @ 241 NONAME ABSENT
+	_ZThn772_N12CTestServer216GetObjectAndOwnLERK7TDesC16 @ 242 NONAME ABSENT
+	_ZThn772_N12CTestServer222CreateActiveSchedulerLEv @ 243 NONAME ABSENT
+	_ZThn772_N12CTestServer222DeleteActiveSchedulerLEv @ 244 NONAME ABSENT
+	_ZN19CTestExecuteIniData4NewLER4TBufILi2EE @ 245 NONAME
+	_ZN19CTestExecuteIniData5NewLCER4TBufILi2EE @ 246 NONAME
+	_ZN19CTestExecuteIniDataC1ER4TBufILi2EE @ 247 NONAME
+	_ZN19CTestExecuteIniDataC2ER4TBufILi2EE @ 248 NONAME
+	_ZThn3184_N20CTestBlockController11BlockResultEv @ 249 NONAME ; #<thunk>#
+	_ZThn3184_N20CTestBlockController13SetAsyncErrorEii @ 250 NONAME ; #<thunk>#
+	_ZThn3184_N20CTestBlockController14SetBlockResultE8TVerdict @ 251 NONAME ; #<thunk>#
+	_ZThn3184_N20CTestBlockController8SetErrorEi @ 252 NONAME ; #<thunk>#
+	_ZThn3188_N20CTestBlockController14TimerCompletedEv @ 253 NONAME ; #<thunk>#
+	_ZThn3192_N20CTestBlockController12NextCommandLEv @ 254 NONAME ; #<thunk>#
+	_ZThn1280_N12CTestServer213PutAndDisownLERK7TDesC16PvPFvS3_E @ 255 NONAME ABSENT
+	_ZThn1280_N12CTestServer216GetObjectAndOwnLERK7TDesC16 @ 256 NONAME ABSENT
+	_ZThn1280_N12CTestServer222CreateActiveSchedulerLEv @ 257 NONAME ABSENT
+	_ZThn1280_N12CTestServer222DeleteActiveSchedulerLEv @ 258 NONAME ABSENT
+	_ZN9CTestStep16GetIntFromConfigERK7TDesC16S2_Rx @ 259 NONAME
+	_ZN9CTestStep16WriteIntToConfigERK7TDesC16S2_RKx @ 260 NONAME
+	_ZN8TEFUtils16WrapperPluginNewER8RLibrary @ 261 NONAME
+	_ZTI14CTEFTestReport @ 262 NONAME DATA 12
+	_ZTV14CTEFTestReport @ 263 NONAME DATA 20
+	_ZThn1340_N12CTestServer213PutAndDisownLERK7TDesC16PvPFvS3_E @ 264 NONAME
+	_ZThn1340_N12CTestServer216GetObjectAndOwnLERK7TDesC16 @ 265 NONAME
+	_ZThn1340_N12CTestServer222CreateActiveSchedulerLEv @ 266 NONAME
+	_ZThn1340_N12CTestServer222DeleteActiveSchedulerLEv @ 267 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_EXPORTS
+..\inc\testexecutestepbase.h			\epoc32\include\test\testexecutestepbase.h
+..\inc\testexecuteserverbase.h			\epoc32\include\test\testexecuteserverbase.h
+..\inc\testexecuteclient.h			\epoc32\include\test\testexecuteclient.h
+..\inc\testexecuteserverutils.h			\epoc32\include\test\testexecuteserverutils.h
+..\inc\testexecuteserverutils.inl		\epoc32\include\test\testexecuteserverutils.inl
+..\inc\tefshareddata.h				\epoc32\include\test\tefshareddata.h
+..\inc\tefshareddata.inl			\epoc32\include\test\tefshareddata.inl
+..\inc\testshareddata.h				\epoc32\include\test\testshareddata.h
+..\inc\testshareddata.inl			\epoc32\include\test\testshareddata.inl
+..\inc\tefexportconst.h				\epoc32\include\test\tefexportconst.h
+..\inc\testexecutelogbase.h			\epoc32\include\test\testexecutelogbase.h
+..\inc\testexecutelogger.h			\epoc32\include\test\testexecutelogger.h
+..\inc\tefscriptutils.h				\epoc32\include\test\tefscriptutils.h
+..\inc\blockitems.h				\epoc32\include\test\blockitems.h
+..\inc\datawrapper.h				\epoc32\include\test\datawrapper.h
+..\inc\testserver2.h				\epoc32\include\test\testserver2.h
+..\inc\testblockcontroller.h			\epoc32\include\test\testblockcontroller.h
+..\inc\testblockcontroller.inl			\epoc32\include\test\testblockcontroller.inl
+..\inc\activecallback.h				\epoc32\include\test\activecallback.h
+..\inc\datadictionary.h				\epoc32\include\test\datadictionary.h
+..\inc\tefresult.h				\epoc32\include\test\tefresult.h
+..\inc\commandprocessor.h			\epoc32\include\test\commandprocessor.h
+..\inc\teftimer.h				\epoc32\include\test\teftimer.h
+..\inc\dataaccess.h				\epoc32\include\test\dataaccess.h
+..\inc\datawrapper.inl				\epoc32\include\test\datawrapper.inl
+..\inc\tefutils.h				\epoc32\include\test\tefutils.h
+..\inc\teftestreport.h				\epoc32\include\test\teftestreport.h
+
+PRJ_MMPFILES
+testexecuteutils.mmp
+
+PRJ_TESTMMPFILES
+//..\test\group\testexecuteloggingtest.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/group/testexecuteutils.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+#include "../../group/testexecute.cfg"
+
+//Unpaged
+TARGET      testexecuteutils.dll
+
+DEFFILE     testexecuteutils.def
+
+TARGETTYPE 	dll
+UID		0x1000008d 0x101F777A
+VENDORID	0x70000001
+
+OS_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE	../inc
+
+
+SOURCEPATH 	../src
+
+SOURCE		testserverbase.Cpp
+SOURCE		teststepbase.Cpp
+SOURCE		testclient.cpp
+SOURCE		testexecutelogger.cpp
+SOURCE		tefscriptutils.cpp
+SOURCE      serialwriter.cpp
+
+SOURCE		datawrapper.cpp
+SOURCE		commandprocessor.cpp
+SOURCE		datadictionary.cpp
+SOURCE		activecallback.cpp
+SOURCE		testserver2.cpp
+SOURCE		testblockcontroller.cpp
+SOURCE		teftimer.cpp 
+SOURCE		tefutils.cpp
+SOURCE		teftestreport.cpp
+
+LIBRARY		euser.lib
+LIBRARY		iniparser.lib
+LIBRARY		testexecutelogclient.lib
+LIBRARY		testexecutepipslogclient.lib
+LIBRARY		efsrv.lib
+LIBRARY		rfileloggerclient.lib
+LIBRARY     hal.lib                 // For logging (HAL)
+
+CAPABILITY	All
+
+//testexecuteseriallogclient.lib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/Logging.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,70 @@
+/*
+* 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: This file contains logging macros for test engine.
+*
+*/
+
+#ifndef LOGGINGDEFS_H
+#define LOGGINGDEFS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+const TUint KError           = 0x1;
+const TUint KInit            = 0x2;
+const TUint KVerbose         = 0x4;
+const TUint KAlways          = 0xFFFFFFFF;
+const TUint KDebugLevel      = ( KInit | KError );
+
+// MACROS
+#define __TRACING_ENABLED
+
+// Define USE_LOGGER to use logger for logging
+#define USE_LOGGER
+
+#ifdef __TRACING_ENABLED
+
+    // Disable conditional expression is constant -warning
+    #pragma warning( disable : 4127 )
+
+    // Using logger
+    #if defined (USE_LOGGER)
+    #define __TRACE(level,p) if ( (level) & KDebugLevel) { LOGGER->Log p; }
+    #else
+    #define __TRACE(level,p);
+    #endif
+
+    #define __RDEBUG(x) if( KVerbose & KDebugLevel){ RDebug::Print x ; }
+
+#else
+    // No tracing
+    #define __TRACE(level,p);
+    
+    #define __RDEBUG(x)
+
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // LOGGINGDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/activecallback.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains ActiveCallback.h
+*
+*/
+
+
+
+#ifndef __ACTIVE_CALLBACK_H__
+#define __ACTIVE_CALLBACK_H__
+
+#include <e32base.h>
+
+class MActiveCallback
+/**
+ * @internalComponent
+ * @test
+ *
+ * Asynchronus completion callback
+ */
+	{
+public:
+	/**
+	 * Method from which CActiveCallback informs the user RunL call
+	 *
+	 * @param	aActive - the object that the RunL has completed on
+	 * @param	aIndex - asynchronous command index
+	 *
+	 * @leave	system wide error
+	 */
+	virtual void	RunL(CActive* aActive, TInt aIndex) = 0;
+
+	/**
+	 * Method from which CActiveCallback informs the user DoCancel call
+	 *
+	 * @param	aActive - the object that the RunL has completed on
+	 * @param	aIndex - asynchronous command index
+	 *
+	 * @leave	system wide error
+	 */
+	virtual void	DoCancel(CActive* aActive, TInt aIndex) = 0;
+	};
+
+class CActiveCallback : public CActive
+/**
+ * @internalComponent
+ * @test
+ *
+ * @see		CActive
+ *
+ * Test Active Notification class
+ *
+ */
+	{
+public:
+	IMPORT_C virtual ~CActiveCallback();
+	IMPORT_C static CActiveCallback*	NewL(MActiveCallback& aCallback, TInt aPriority=EPriorityStandard);
+	IMPORT_C static CActiveCallback*	NewLC(MActiveCallback& aCallback, TInt aPriority=EPriorityStandard);
+
+	IMPORT_C void	Activate( TInt aIndex );
+	IMPORT_C void	KickState();
+	IMPORT_C void	RunL();
+	IMPORT_C void	DoCancel();
+
+protected:
+	IMPORT_C CActiveCallback(MActiveCallback& aCallback, TInt aPriority);
+	IMPORT_C void	ConstructL();
+
+private:
+	/**
+	* This is internal and not intended for use.
+	*/
+	MActiveCallback&	iCallback;
+	TInt				iIndex;
+	};
+
+#endif /* __ACTIVE_CALLBACK_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/blockitems.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains BlockItems.h
+*
+*/
+
+
+
+#ifndef __BLOCK_ITEMS_H__
+#define __BLOCK_ITEMS_H__
+
+#include <e32base.h>
+
+const TInt	KTEFMaxNameLength		= 255;
+typedef	TBuf<KTEFMaxNameLength>		TTEFSectionName;
+typedef	TBuf<KTEFMaxNameLength>		TTEFFunction;
+typedef	TBuf<KTEFMaxNameLength>		TTEFObjectType;
+
+enum TTEFBlockItemType
+/**
+ * @internalComponent
+ * @test
+ *
+ * Types of block item
+ *
+ * ETEFNull
+ * - undefined type
+ *
+ * ETEFCreateObject
+ * - create an object
+ *
+ * ETEFRestoreObject
+ * - restore an object from the shared area
+ *
+ * ETEFCommand
+ * - execute a command on an object
+ *
+ * ETEFStore
+ * - store the object in shared area
+ *
+ * ETEFOutstanding
+ * - wait for all outstandign requests to complete
+ *
+ * ETEFDelay
+ * - delay all processing
+ *
+ * ETEFAsyncDelay
+ * - delay but keep asynchronus operations running during delay.
+ *
+ * ETEFSharedActiveScheduler
+ * - use active schedular from shared data
+ *
+ * ETEFStoreActiveScheduler
+ * - store active schedular in shared data
+ */
+	{
+	ETEFNull		 = 0,
+	ETEFCreateObject,
+	ETEFRestoreObject,
+	ETEFCommand,
+	ETEFStore,
+	ETEFOutstanding,
+	ETEFDelay,
+	ETEFAsyncDelay,
+	ETEFSharedActiveScheduler,
+	ETEFStoreActiveScheduler
+	};
+
+class TTEFCommand
+/**
+ * @internalComponent
+ * @test
+ */
+	{
+public:
+	TTEFSectionName		iObject;
+	TTEFFunction		iFunction;
+	};
+
+class TTEFBlockItem
+/**
+ * @internalComponent
+ * @test
+ */
+	{
+public:
+	TTEFBlockItem()
+	:	iItemType(ETEFNull)
+	,	iExpectedError(0)
+	,	iExpectedAsyncError(0)
+	,	iError(0)
+	,	iAsyncError(0)
+	,	iTime(0)
+	,	iExecuted(EFalse) {}
+
+	TTEFBlockItemType	iItemType;
+	TTEFObjectType		iObjectType;
+	TTEFCommand			iCommand;
+	TTEFSectionName		iSection;
+	TInt				iExpectedError;
+	TInt				iExpectedAsyncError;
+	TInt				iError;
+	TInt				iAsyncError;
+	TInt				iTime;
+	TBool				iExecuted;
+	};
+
+/**
+ * @internalComponent
+ * @test
+ */
+typedef	CArrayFixFlat<TTEFBlockItem>	TTEFItemArray;
+
+/**
+ * @internalComponent
+ * @test
+ */
+typedef	TPckgBuf<TTEFBlockItem>			TTEFItemPkgBuf;
+
+class MSharedData
+/**
+ * @internalComponent
+ * @test
+ *
+ * Access to the shared data
+ */
+	{
+public:
+	/*
+	 * Create and active scheduler in the shared data
+	 *
+	 * @leave	system wide error
+	 */
+	virtual void	CreateActiveSchedulerL() =0;
+
+	/*
+	 * Delete the active scheduler in the shared data
+	 *
+	 * @leave	system wide error
+	 */
+	virtual void	DeleteActiveSchedulerL() =0;
+
+	/*
+	 * Get an object in the shared data and own it.
+	 * As owner you will be resonsible for it's deletion.
+	 *
+	 * @param	aName - name of object to own
+	 *
+	 * @return	the obeject
+	 *
+	 * @leave	system wide error
+	 */
+	virtual TAny*	GetObjectAndOwnL(const TDesC& aName) =0;
+
+	/*
+	 * Put an object in the shared data and disown it.
+	 * The shared data becomes will be resonsible for it's deletion.
+	 *
+	 * @param	aName - name of object to own
+	 * @param	aAny - the object
+	 * @param	aCleanupOperation - Operation to delete the object if still in shared data on exit
+	 *
+	 * @leave	system wide error
+	 */
+	virtual void	PutAndDisownL(const TDesC& aName, TAny* aAny, TCleanupOperation aCleanupOperation) =0;
+	};
+
+#endif // __BLOCK_ITEMS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/commandprocessor.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CommandProcessor.h
+*
+*/
+
+
+
+#ifndef __COMMAND_PROCESSOR_H__
+#define __COMMAND_PROCESSOR_H__
+
+#include <e32base.h>
+
+class MCommandProcessorCallback
+/**
+ * @internalComponent
+ * @test
+ *
+ * Test timer completion callback
+ */
+	{
+public:
+	/**
+	* Method from which CCommandProcessor informs the user RunL call
+	*
+	* @leave	system wide error
+	*/
+	virtual void	NextCommandL() = 0;
+	};
+
+class CCommandProcessor : public CActive
+/**
+ * @internalComponent
+ * @test
+ *
+ * @see		CActive
+ *
+ * Test Active Notification class
+ *
+ */
+	{
+public:
+	IMPORT_C virtual ~CCommandProcessor();
+	IMPORT_C static CCommandProcessor*	NewL(MCommandProcessorCallback& aCallback, TInt aPriority=EPriorityStandard);
+	IMPORT_C static CCommandProcessor*	NewLC(MCommandProcessorCallback& aCallback, TInt aPriority=EPriorityStandard);
+
+	IMPORT_C void	Activate();
+	IMPORT_C void	KickState();
+	void			RunL();
+	void			DoCancel();
+
+protected:
+	CCommandProcessor(MCommandProcessorCallback& aCallback, TInt aPriority);
+
+private:
+	void	ConstructL();
+
+private:
+	/**
+	* This is internal and not intended for use.
+	*/
+	MCommandProcessorCallback&	iCallback;
+	};
+
+#endif /* __COMMAND_PROCESSOR_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/dataaccess.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains DataAccess.h
+*
+*/
+
+
+
+#ifndef __DATA_ACCESS_H__
+#define __DATA_ACCESS_H__
+
+#include <test/testexecutestepbase.h>
+
+#include <test/datawrapper.h>
+
+class MDataAccess
+/**
+ * @internalComponent
+ * @test
+ *
+ * Data access interface
+ */
+	{
+public:
+	/**
+	 * Read a boolean value from the configuration file.
+	 *
+	 * @param	aSectName - Section name in the config file
+	 * @param	aKeyName - text name for the value in the config file
+	 * @param	aResult - value found in config file. ETrue is represented by the case insensitive string "true"
+	 *
+	 * @return	ETrue if the section/key name was found
+	 */
+	virtual TBool			GetBoolFromConfig(const TDesC&  aSectName, const TDesC& aKeyName, TBool& aResult) =0;
+
+	/**
+	 * Read an integer value from the configuration file.
+	 *
+	 * @param	aSectName - Section name in the config file
+	 * @param	aKeyName - text name for the value in the config file
+	 * @param	aResult - value found in config file. ETrue is represented by the case insensitive string "true"
+	 *
+	 * @return	ETrue if the section/key name was found
+	 */
+	virtual TBool			GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) =0;
+
+	/**
+	 * Read a string value from the configuration file.
+	 *
+	 * @param	aSectName - Section name in the config file
+	 * @param	aKeyName - text name for the value in the config file
+	 * @param	aResult - value found in config file. ETrue is represented by the case insensitive string "true"
+	 *
+	 * @return	ETrue if the section/key name was found
+	 */
+	virtual TBool			GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult) =0;
+
+	/**
+	 * Read a hexidecimal value from the configuration file.
+	 *
+	 * @param	aSectName - Section name in the config file
+	 * @param	aKeyName - text name for the value in the config file
+	 * @param	aResult - value found in config file. ETrue is represented by the case insensitive string "true"
+	 *
+	 * @return	ETrue if the section/key name was found
+	 */
+	virtual TBool			GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) =0;
+
+	/**
+	 * Write an integer value to the configuration file.
+	 *
+	 * @param	aSectName - Section name in the config file
+	 * @param	aKeyName - text name for the value in the config file
+	 * @param	aValue - value to write into the config file.
+	 *
+	 * @return	ETrue if successful
+	 */
+	virtual TBool			WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue) =0;
+
+	/**
+	 * Write a string value to the configuration file.
+	 *
+	 * @param	aSectName - Section name in the config file
+	 * @param	aKeyName - text name for the value in the config file
+	 * @param	aValue - value to write into the config file.
+	 *
+	 * @return	ETrue if successful
+	 */
+	virtual TBool			WriteStringToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TPtrC& aValue) =0;
+
+	/**
+	 * Write a boolean value to the configuration file.
+	 *
+	 * @param	aSectName - Section name in the config file
+	 * @param	aKeyName - text name for the value in the config file
+	 * @param	aValue - value to write into the config file.
+	 *
+	 * @return	ETrue if successful
+	 */
+	virtual TBool			WriteBoolToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TBool& aValue) =0;
+
+	/**
+	 * Write a hexidecimal value to the configuration file.
+	 *
+	 * @param	aSectName - Section name in the config file
+	 * @param	aKeyName - text name for the value in the config file
+	 * @param	aValue - value to write into the config file.
+	 *
+	 * @return	ETrue if successful
+	 */
+	virtual TBool			WriteHexToConfig(const TDesC&  aSectName, const TDesC& aKeyName, const TInt& aValue) =0;
+
+	/**
+	 * Updates the data to the shared data name passed either in Copy Mode/Append Mode
+	 *
+	 * @param	aShareName - global shared memory name
+	 * @param	aSharedDataVal - data to write
+	 * @param	aModeCopy - copy or append data
+	 *
+	 * @leave	system wide error
+	 */
+	virtual void			WriteSharedDataL(const TDesC& aShareName, TDesC& aSharedDataVal, TModeCopy aModeCopy) =0;
+
+	/**
+	 * Read data from the shared data name passed
+	 *
+	 * @param	aShareName - global shared memory name
+	 * @param	aSharedDataVal - data read
+	 *
+	 * @leave	system wide error
+	 */
+	virtual void			ReadSharedDataL(const TDesC& aShareName, TDes& aSharedDataVal) =0;
+
+	/**
+	 * Read name of data dictionary entry from configuration file and return the data wrapper
+	 *
+	 * @param	aSectionName - section in configuration file to read name of dictionary entry
+	 *
+	 * @leave	KErrBadName - name not found in configuration file
+	 * @leave	KErrNotFound - entry not found in dictinary
+	 *
+	 * @return	Data wrapper for the object
+	 */
+	virtual CDataWrapper*	GetDataWrapperL(const TDesC& aSectionName) =0;
+
+	/**
+	 * Read name of data dictionary entry from configuration file and return the data wrapper
+	 *
+	 * @param	aSectionName - section in configuration file to read name of dictionary entry
+	 *
+	 * @leave	KErrBadName - name not found in configuration file
+	 * @leave	KErrNotFound - entry not found in dictinary
+	 *
+	 * @return	The object stored in the data wrapper
+	 */
+	virtual TAny*			GetDataObjectL(const TDesC& aSectionName) =0;
+
+	/**
+	 * Read name of data dictionary entry from configuration file set the data wrappers object
+	 *
+	 * @param	aSectionName - section in configuration file to read name of dictionary entry
+	 * @param	aObject - object to set in the data wrapper
+	 *
+	 * @leave	KErrBadName - name not found in configuration file
+	 * @leave	KErrNotFound - entry not found in dictinary
+	 */
+	virtual void			SetDataObjectL(const TDesC& aSectionName, TAny* aObject) =0;
+
+	/**
+	 * Get the logger
+	 *
+	 * @see		CTestExecuteLogger
+	 *
+	 * @return	the logger
+	 */
+	virtual CTestExecuteLogger&	Logger() =0;
+	};
+
+#endif // __DATA_ACCESS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/datadictionary.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains DataDictionary.h
+*
+*/
+
+
+
+#ifndef __DATA_DICTIONARY_H__
+#define __DATA_DICTIONARY_H__
+
+#include <e32base.h>
+#include <e32hashtab.h>
+
+/**
+ * Data dictionary maximum name size
+ */
+const TInt									KMaxDataDictionaryNameSize = 256;
+
+/**
+ * Defines a modifiable buffer descriptor to contain the name of an entry in the dictionary
+ */
+typedef TBuf<KMaxDataDictionaryNameSize>	TDataDictionaryName;
+
+class CDataWrapper;
+
+class CDataDictionary : public CBase
+/**
+ * @internalAll
+ * @test
+ *
+ * @see		CBase
+ *
+ * This dictionary associates a name with a data wrapper object.
+ * Maintenance of the dictionary is perfomed by the methods AddDataL and DeleteDataL.
+ */
+	{
+private:
+	/**
+	 * @internalAll
+	 * @test
+	 *
+	 * Data dictionary storage area
+	 */
+	typedef RHashMap<TDataDictionaryName, CDataWrapper*>		RDataStore;
+	typedef THashMapIter<TDataDictionaryName, CDataWrapper*>	TDataIter;
+
+public:
+	CDataDictionary();
+	virtual ~CDataDictionary();
+
+	void			AddDataL(const TDataDictionaryName& aName, CDataWrapper* aData);
+	void			DeleteDataL(const TDataDictionaryName& aName);
+	void			SetCurrentDataL(const TDataDictionaryName& aName);
+	CDataWrapper*	GetDataL(const TDataDictionaryName& aName);
+	TAny*			CurrentObject();
+	TAny*			GetObjectL(const TDesC& aName);
+	void			SetObjectL(const TDataDictionaryName& aName, TAny* aObject);
+	void			Empty();
+	TInt			Outstanding(const TDesC& aName, TBool& aMoreToDo);
+
+private:
+	static TUint32	Hash(const TDataDictionaryName& aName);
+	static TBool	Identity(const TDataDictionaryName& aName1, const TDataDictionaryName& aName2);
+
+private:
+	RDataStore		iStore;
+	CDataWrapper*	iCurrentObject;
+	};
+
+#endif // __DATA_DICTIONARY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/datawrapper.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains DataWrapper.h
+*
+*/
+
+
+
+#ifndef __DATA_WRAPPER_H__
+#define __DATA_WRAPPER_H__
+
+#include <e32def.h>
+#include <e32cmn.h>
+
+#include <test/datadictionary.h>
+#include <test/dataaccess.h>
+#include <test/tefresult.h>
+#include <test/activecallback.h>
+#include <test/testblockcontroller.h>
+#include <test/blockitems.h>
+
+
+class CDataWrapper : public CBase, public MActiveCallback, public MDataAccess, public MTEFResult
+/**
+ * @publishedPartner
+ * @test
+ *
+ * @see		CBase
+ * @see		MActiveCallback
+ * @see		MDataAccess
+ * @see		MTEFResult
+ *
+ * Wrapper for an object in the data dictionary
+ */
+	{
+public:
+	IMPORT_C virtual				~CDataWrapper();
+
+	/**
+	 * Execute a command on the object
+	 *
+	 * @param	aCommand - command to execute
+	 * @param	aSection - section with data for command
+	 * @param	aAsyncErrorIndex - command index
+	 *
+	 * @see		TTEFFunction
+	 * @see		TTEFSectionName
+	 *
+	 * @leave	system wide error
+	 *
+	 * @return	ETrue if the command is processed, EFalse if not
+	 */
+	IMPORT_C virtual TBool			DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) = 0;
+
+	/**
+	 * Get the object that the wrapper contains
+	 *
+	 * @return	The object that the wrapper contains. NULL if it does not contain one.
+	 */
+	virtual TAny*					GetObject() = 0;
+
+	inline virtual TCleanupOperation	CleanupOperation();
+	inline virtual void					SetObjectL(TAny* aObject);
+	inline virtual void					DisownObjectL();
+	IMPORT_C void						SetTestBlockController(CTestBlockController* aTestBlockController);
+	IMPORT_C void						SetDataDictionary(CDataDictionary* aDataDictionary);
+	inline virtual void					InitialiseL();
+
+	inline void						IncOutstanding();
+	inline void						DecOutstanding();
+	inline TBool					Outstanding();
+
+	// MDataAccess implementation
+	IMPORT_C virtual TBool			GetBoolFromConfig(const TDesC&  aSectName, const TDesC& aKeyName, TBool& aResult);
+	IMPORT_C virtual TBool			GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
+	IMPORT_C virtual TBool			GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
+	IMPORT_C virtual TBool			GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
+	IMPORT_C virtual TBool			WriteBoolToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TBool& aValue);
+	IMPORT_C virtual TBool			WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue);
+	IMPORT_C virtual TBool			WriteStringToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TPtrC& aValue);
+	IMPORT_C virtual TBool			WriteHexToConfig(const TDesC&  aSectName, const TDesC& aKeyName, const TInt& aValue);
+	IMPORT_C virtual void			ReadSharedDataL(const TDesC& aShareName, TDes& aSharedDataVal);
+	IMPORT_C virtual void			WriteSharedDataL(const TDesC& aShareName, TDesC& aSharedDataVal, TModeCopy aModeCopy = ESetText);
+	IMPORT_C virtual CDataWrapper*	GetDataWrapperL(const TDesC& aSectionName);
+	IMPORT_C virtual TAny*			GetDataObjectL(const TDesC& aSectionName);
+	IMPORT_C virtual void			SetDataObjectL(const TDesC& aSectionName, TAny* aObject);
+	IMPORT_C virtual CTestExecuteLogger&	Logger();
+
+	// MActiveCallback implementation
+	IMPORT_C virtual void			RunL(CActive* aActive, TInt aIndex);
+	IMPORT_C virtual void			DoCancel(CActive* aActive, TInt aIndex);
+
+	// MTEFResult implementation
+	IMPORT_C virtual void			SetError(const TInt aError);
+	IMPORT_C virtual void			SetAsyncError(const TInt aIndex, const TInt aError);
+	IMPORT_C virtual void			SetBlockResult(const TVerdict aResult);
+	IMPORT_C virtual TVerdict		BlockResult();
+
+protected:
+	IMPORT_C CDataWrapper();
+
+private:
+	CDataDictionary*		iDataDictionary;
+	CTestBlockController*	iTestBlockController;
+	TInt					iOutstanding;
+	};
+
+#include <test/datawrapper.inl>
+
+#endif // __DATA_WRAPPER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/datawrapper.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains inline methods of CDataWrapper
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+
+#ifndef __DATA_WRAPPER_INL_
+#define __DATA_WRAPPER_INL_
+
+/**
+ * Get the operation to cleanup the object returned by GetObject
+ *
+ * @see		TCleanupOperation
+ *
+ * @return	The cleanup operation. NULL if there is not one defined for the object.
+ */
+inline TCleanupOperation CDataWrapper::CleanupOperation()	{ return NULL; }
+
+/**
+ * Set the object that the wrapper contains
+ *
+ * @param	aObject - the object that the wrapper contains.
+ *
+ * @leave	KErrNotSupported if this operation is not supported
+ */
+inline void	 CDataWrapper::SetObjectL(TAny* /*aObject*/)	{ User::Leave(KErrNotSupported); }
+
+/**
+ * Removes the object that the wrapper contains. A subsequent call to
+ * GetObject should return NULL until SetObject is called.
+ *
+ * @param	aObject - the object that the wrapper contains.
+ *
+ * @leave	KErrNotSupported if this operation is not supported
+ */
+inline void	 CDataWrapper::DisownObjectL()			{ User::Leave(KErrNotSupported); }
+
+/**
+ * Increment the number of outstanding async calls that are active
+ */
+inline void	 CDataWrapper::IncOutstanding()			{ iOutstanding++; }
+
+/**
+ * Decrement the number of outstanding async calls that are active
+ */
+inline void  CDataWrapper::DecOutstanding()			{ iOutstanding--; }
+
+/**
+ * Query if there are any outstanding async calls that are active.
+ *
+ * @return	ETrue if there are any oustnading active async calls.
+ */
+inline TBool CDataWrapper::Outstanding()			{ return iOutstanding>0; }
+
+/**
+ * Initialse the wrapper
+ *
+ * @leave	system wide error
+ */
+inline void  CDataWrapper::InitialiseL()			{}
+
+#endif // ___DATA_WRAPPER_INL_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/serialwriter.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file
+ @Serial Writer header file
+ @internalTechnology
+*/
+
+#ifndef SERIALWRITER_H
+#define SERIALWRITER_H
+
+#include <d32comm.h> // RBusDevComm
+#include <e32base.h>
+
+NONSHARABLE_CLASS(CSerialWriter) 
+	{
+	public:
+		static CSerialWriter* NewL();
+		~CSerialWriter();
+	public:
+		TInt Settings(const TInt& aPortNumber);
+		TInt Write(const TDesC8& aData);
+		//Decoration methods 	
+		TInt WriteDecorated(const TDesC& aText, TInt aSeverity = 0) ;
+		TInt WriteDecorated(const TDesC8& aText, TInt aSeverity= 0)	; 
+	private:
+		void AddSeverity(TDes8& aLogBuffer, const TInt& aSeverity);
+		void AddTime(TDes8& aLogBuffer) ; 
+		CSerialWriter();
+		void ConstructL();
+		TInt Connect();
+	    TInt Config();
+		TInt Disconnect();
+	private:
+		RBusDevComm iComm;
+	    TBool 		iReady;
+		TInt 		iPortNum;
+	};
+	
+	
+#endif // SERIALWRITER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefconst.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TEFConst.h
+*/
+
+#ifndef __TEFCONST_H__
+#define __TEFCONST_H__
+#include <e32def.h>
+
+// Non exported files access only
+const TInt KTEFMaxTaskExitCategory=80;
+const TInt KTEFMaxSharedArraySize=10;
+const TInt KTEFSharedDataSize=1024;
+const TInt KTEFMinOomParamLength=4;
+const TInt KTEFMaxScriptLineLength=512;
+const TInt KTEFErrInvalidRelPath=-30003;
+
+_LIT(KTEFLoadSuiteCommand,"LOAD_SUITE");
+_LIT(KTEFLoadServerCommand,"LOAD_SERVER");
+_LIT(KTEFLoadSuiteSharedData,"-SharedData");
+_LIT(KTEFConcurrentCommand,"CONCURRENT");
+_LIT(KTEFConsecutiveCommand,"CONSECUTIVE");
+_LIT(KTEFPrintCommand,"PRINT");
+_LIT(KTEFRunUtilsCommand,"RUN_UTILS");
+_LIT(KTEFRunUtilsMakeReadWrite,"MakeReadWrite");
+_LIT(KTEFRunUtilsCopyFile,"CopyFile");
+_LIT(KTEFRunUtilsMkDir,"MkDir");
+_LIT(KTEFRunUtilsDeleteFile,"DeleteFile");
+_LIT(KTEFRunUtilsDelete,"Delete");
+_LIT(KTEFRunScriptCommand,"RUN_SCRIPT");
+_LIT(KTEFCedCommand,"CED");
+_LIT(KTEFDelayCommand,"DELAY");
+_LIT(KTEFBreakErrorOnCommand,"BREAK_ERROR_ON");
+_LIT(KTEFBreakErrorOffCommand,"BREAK_ERROR_OFF");
+_LIT(KTEFPauseCommand,"PAUSE");
+_LIT(KTEFPrefixCommand, "PREFIX");
+_LIT(KTEFRemovePrefixCommand, "REMOVE_PREFIX");
+_LIT(KTEFSharedDataCommand, "SHARED_DATA");
+_LIT(KTEFStartRepeat,"START_REPEAT");
+_LIT(KTEFEndRepeat,"END_REPEAT");
+_LIT(KTEFColon, ":");
+_LIT(KTEFSharedDataNum, "shared_data_num");
+_LIT(KTEFSharedName, "shared_name_");
+_LIT(KTEFErrorReadingIni,"Error reading INI file");
+_LIT(KTEFSharedDataCommandRepeated,"SHARED_DATA Command is already in use");
+_LIT(KTEFErrInCreatingSharedObjects, "Unable to create shared object specified");
+_LIT(KTEFErrShareNameNotInIni, "The name of shared object %d is not specified in the ini");
+_LIT(KTEFErrNumberOfShareNotInIni, "The number of shared objects is not specified in the ini");
+_LIT(KTEFMaxNumberOfSharedObjectsReached, "Number of shared objects exceeded maximum allowable limit");
+_LIT(KTEFOom, "!OOM");
+_LIT(KTEFDeleteDirectory,"DeleteDirectory");
+_LIT(KTEFSetUpParam, "!Setup=");
+_LIT(KTEFIniExtension, ".ini");
+_LIT(KTEFDotSlash, ".\\");
+_LIT(KTEFOneUp,"..\\");
+
+// Test Block specific script commands
+_LIT(KTEFStartTestBlock,"START_TEST_BLOCK");
+_LIT(KTEFEndTestBlock,"END_TEST_BLOCK");
+_LIT(KTEFCreateObject,"CREATE_OBJECT");
+_LIT(KTEFRestoreObject,"RESTORE_OBJECT");
+_LIT(KTEFCommand,"COMMAND");
+_LIT(KTEFStore,"STORE");
+_LIT(KTEFOutstanding,"OUTSTANDING");
+_LIT(KTEFDelay,"DELAY");
+_LIT(KTEFAsyncDelay,"ASYNC_DELAY");
+_LIT(KTEFSharedActiveScheduler,"SHARED_ACTIVE_SCHEDULER");
+_LIT(KTEFStoreActiveScheduler,"STORE_ACTIVE_SCHEDULER");
+_LIT(KTEFCreateActiveScheduler,"!CreateScheduler=");
+_LIT(KTEFReuseActiveScheduler,"!ReuseScheduler=");
+_LIT(KTEFDeleteActiveScheduler,"!DeleteScheduler=");
+_LIT(KTEFAsyncError,"!AsyncError=");
+_LIT(KTEFErrorResult," Error=");
+_LIT(KTEFAsyncErrorResult," AsyncError=");
+_LIT(KTEFComment,"//");
+
+// Following set of literals are defined for version logging feature
+_LIT(KTEFConsoleHelpMessage1, "\n\n\ntestexecute <scriptfilepath>\\<scripfilename>[.script] [-d] [-slf]\
+							   \n\t: Executes the scriptfile with optional modes for JustInTime debugging or separate log files");
+_LIT(KTEFConsoleHelpMessage2, "\n\ntestexecute <scripfilename>[.script] [-d] [-slf]\
+							   \n\t: Script file path can be avoided when the defaultscriptdir entry is provided in testexecute.ini");
+_LIT(KTEFConsoleHelpMessage3, "\n\ntestexecute [-help/-v]\
+							   \n\t: Run TestExecute with optional modes to display list of help options and the version number");
+_LIT(KTEFConsoleHelpMessage4, "\n\n\n\n-help   : For displaying the help options available for using TestExecute framework\
+							   \n\n-v      : For displaying the version of the TestExecute framework");
+_LIT(KTEFConsoleHelpMessage5, "\n\n-slf    : For printing the messages for each of the tests in separate log files\
+							   \n\n-d      : For enabling just in time debug mode while execution");
+_LIT(KTEFInvalidCommandSetMessage, "Invalid set of Command line arguments\
+									\n\nType testexecute -help to learn about usages");
+
+_LIT(KTEFVersionMessage, "\nTEF Version : ");
+_LIT(KTEFVersionMessageXML, "TEF_VERSION");
+
+_LIT(KTEFTestSynopsisHTM, "\nTEST SYNOPSIS:");
+_LIT(KTEFTestSynopsisXML, "TEST_SYNOPSIS");
+
+_LIT(KTEFCountMessageHTM, " COUNT : ");
+_LIT(KTEFCountMessageXML, "_COUNT");
+
+_LIT(KTEFNewLine, "\n");
+_LIT(KTEFEnterKeyMessage, "\n\nEnter a key to Exit");
+_LIT(KTEFEndOfLine,"\r\n");
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefexportconst.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,281 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TEFExportConst.h
+ @publishedPartner
+ @test 
+*/
+
+#ifndef __TEF_EXPORT_CONST_H__
+#define __TEF_EXPORT_CONST_H__
+#include <e32def.h>
+
+// Logger Macros
+#define INFO_PRINTF1(p1)							Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1))
+#define INFO_PRINTF2(p1, p2)						Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2))
+#define INFO_PRINTF3(p1, p2, p3)					Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3))
+#define INFO_PRINTF4(p1, p2, p3, p4)				Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4))
+#define INFO_PRINTF5(p1, p2, p3, p4, p5)			Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5))
+#define INFO_PRINTF6(p1, p2, p3, p4, p5, p6)		Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5), (p6))
+#define INFO_PRINTF7(p1, p2, p3, p4, p5, p6, p7)	Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2), (p3), (p4), (p5), (p6), (p7))
+
+#define WARN_PRINTF1(p1)							Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1)) 
+#define WARN_PRINTF2(p1, p2)						Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2)) 
+#define WARN_PRINTF3(p1, p2, p3)					Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3)) 
+#define WARN_PRINTF4(p1, p2, p3, p4)				Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3), (p4)) 
+#define WARN_PRINTF5(p1, p2, p3, p4, p5)			Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3), (p4), (p5)) 
+#define WARN_PRINTF6(p1, p2, p3, p4, p5, p6)		Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3), (p4), (p5), (p6)) 
+#define WARN_PRINTF7(p1, p2, p3, p4, p5, p6, p7)	Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, (p1), (p2), (p3), (p4), (p5), (p6), (p7)) 
+
+#define ERR_PRINTF1(p1)								Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1)) 
+#define ERR_PRINTF2(p1, p2)							Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2)) 
+#define ERR_PRINTF3(p1, p2, p3)						Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3)) ;
+#define ERR_PRINTF4(p1, p2, p3, p4)					Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3), (p4)) 
+#define ERR_PRINTF5(p1, p2, p3, p4, p5)				Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3), (p4), (p5)) 
+#define ERR_PRINTF6(p1, p2, p3, p4, p5, p6)			Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3), (p4), (p5), (p6)) 
+#define ERR_PRINTF7(p1, p2, p3, p4, p5, p6, p7)		Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrErr, (p1), (p2), (p3), (p4), (p5), (p6), (p7))
+
+// Literals
+// From TestExecuteLog.h
+_LIT(KTestExecuteLogServerName,"TestExecuteLogEngine");
+_LIT(KTestExecuteLogPath,"?:\\Logs\\TestExecute\\");
+_LIT(KTestExecuteScheduleTestLogCompatibilityNameFile,"LogFileName.Txt");
+_LIT(KTestExecuteName,"TestExecute");
+_LIT8(KTestExecuteName8,"TestExecute");
+
+_LIT(KTestExecutePIPSLogServerName,"testexecutepipslogengine");
+
+// From TestExecuteClient.h
+_LIT(KTestExecuteCommandLineFlagDebugMode,"-d");
+_LIT(KTestExecuteCommandLineFlagSeparateLogFileMode,"-slf");
+_LIT(KTestExecuteCommandLineFlagGraphicalWindowServer,"-gws");
+_LIT(KTestExecuteCommandLineFlagIncludeSelectiveCases,"-tci");
+_LIT(KTestExecuteCommandLineFlagExcludeSelectiveCases,"-tcx");
+_LIT(KTestExecuteCommandLineFlagPipe,"-pipe");
+
+// From TestExecuteServerUtils.h
+_LIT(KNull,"");
+_LIT(KPanicEquals,"P=");
+_LIT(KErrorEquals,"E=");
+
+// From TEFUnit.h
+_LIT( KTEFAssertFailedEquals, "AssertEquals Failed");
+_LIT( KTEFAssertFailedNull, "AssertNull Failed");
+_LIT( KTEFAssertFailedNotNull, "AssertNotNull Failed");
+_LIT( KTEFAssertFailedSame, "AssertSame Failed");
+_LIT( KTEFAssertFailedNotSame, "AssertNotSame Failed");
+_LIT( KTEFAssertFailedTrue, "AssertTrue Failed" );
+_LIT( KTEFAssertFailedFalse, "AssertFalse Failed");
+
+// Constants
+// From TestExecuteLog.h
+const TInt KMaxTestExecuteLogFilePath = 256;
+const TInt KMaxTestExecuteLogLineLength = 512;
+const TInt KTestExecuteLoggerMajorVersion = 1;
+const TInt KTestExecuteLoggerMinorVersion = 1;
+const TInt KTestExecuteLoggerBuildVersion = 1;
+
+// From TestExecuteStepBase.h
+// this error number for test server leave a err num which conflict with system wide error.
+//	example: when doteststepL {uesr::leave(KErrServerBusy);}
+//			 testexecute will take this as test server is busy;
+//			 in fact, this is not because doteststepL() has runned, not busy at all.
+//			 we have to make the return value + offset(30000)
+const TInt KErrTEFBaseErrorZero = -30000; 
+const TInt KErrTestExecuteInUse = KErrTEFBaseErrorZero + KErrInUse;
+const TInt KErrTestExecuteServerBusy = KErrTEFBaseErrorZero + KErrServerBusy; 
+
+// From TestExecuteClient.h
+const TInt KTestExecuteMajorVersionNumber=1;
+const TInt KTestExecuteMinorVersionNumber=1;
+const TInt KTestExecuteBuildVersionNumber=1;
+const TInt KMaxTestExecuteNameLength = 80;
+const TInt KMaxTestExecuteCommandLength = 256;
+const TInt KMaxTestStepNameLength = 256;
+
+// From TestExecuteServerUtils.h
+const TInt KErrorStepResult = 0;
+
+// From TEFUnit.h
+const int KErrTEFUnitPass = 0;
+const int KErrTEFUnitFail = 106;
+const int KErrTEFUnitInconclusive = 107;
+const int KErrTEFUnitTestSuiteError = 108;
+const int KErrTEFUnitAbort = 109;
+const int KErrTEFUnitIgnore = 110;
+
+// Enumerations
+enum TModeCopy
+	{
+	ESetText  = 1,
+	EAppendText = 2
+	};
+
+enum TVerdict
+	{
+	EPass =0,			
+	EFail = 106,
+	EInconclusive,
+	ETestSuiteError,
+	EAbort,
+	EIgnore,
+	ESkippedSelectively
+	};
+
+enum TLoggerOptions
+	{
+	ELogHTMLOnly,
+	ELogXMLOnly,
+	ELogBoth
+	};
+
+enum TLoggerChannels
+	{
+	EFile,
+	ESerial,
+	EBoth
+	};
+
+enum TTestSetupState
+	{
+	ESetupNone = 0,
+	ESetupOomServer = 1,
+	ESetupLast = 100
+	};
+
+// Logging level
+enum TLogSeverity{ESevrErr  = 1,ESevrHigh, ESevrWarn,ESevrMedium, ESevrInfo, ESevrLow, ESevrAll};
+
+// export as well as non-exported files access
+const TInt KTEFAsciiExclamation=33;
+const TInt KTEFMinPanicStringParamLength=13;
+const TInt KTEFMinPanicCodeParamLength=11;
+const TInt KTEFMinErrorParamLength=7;
+const TInt KTEFMinSetupParamLength=7;
+const TInt KTEFMinResultParamLength=8;
+const TInt KTEFMinHeapParamLength=6;
+const TInt KTEFZeroValue=0;
+const TInt KTEFOneValue=1;
+const TInt KTEFMaxVerdictLength = 128;
+const TInt KTEFCommandCountsStructSize = 9;
+const TInt KTEFCommandsCountPlusOne = KTEFCommandCountsStructSize + 1;
+const TInt KTEFMaxPanicStringLength = KMaxExitCategoryName; // 16 is Max length for User::Panic()
+
+// OS version number
+const TInt KOsVersionCount = 6;
+
+_LIT(KTEFTestExecuteResultSummaryFile,"TestResults.htm");
+_LIT(KTEFResultString,"RESULT");
+_LIT(KTEFRunTestStepCommand,"RUN_TEST_STEP");
+_LIT(KTEFRunErrorStepResultCommand,"RUN_ERROR_STEP_RESULT");
+_LIT(KTEFRunPanicStepCommand,"RUN_PANIC_STEP");
+_LIT(KTEFRunTestStepResultCommand,"RUN_TEST_STEP_RESULT");
+_LIT(KTEFRunPanicStepResultCommand,"RUN_PANIC_STEP_RESULT");
+_LIT(KTEFRunProgramCommand,"RUN_PROGRAM");
+_LIT(KTEFRunWSProgramCommand,"RUN_WS_PROGRAM");
+_LIT(KTEFStartTestCaseCommand, "START_TESTCASE");
+_LIT(KTEFEndTestCaseCommand, "END_TESTCASE");
+_LIT(KTEFStartSyncTestCaseCommand, "START_SYNCHRONISED_TESTCASE");
+_LIT(KTEFEndSyncTestCaseCommand, "END_SYNCHRONISED_TESTCASE");
+_LIT(KTEFPanicString,"!PanicString=");
+_LIT(KTEFPanicCode,"!PanicCode=");
+_LIT(KTEFError,"!Error=");
+_LIT(KTEFHeap,"!Heap=");
+_LIT(KTEFSpace, " ");
+_LIT(KTEFNull, "");
+_LIT(KTEFEquals, "=");
+_LIT(KTEFScriptExtension,".script");
+_LIT(KTEFCfgExtension,".tcs");
+_LIT(KTEFHtmlKey, "HTML");
+_LIT(KTEFDefaultScriptPath,"DefaultScriptDir");
+_LIT(KTEFJustInTimeDebug,"JustInTimeDebug");
+_LIT(KTEFSystemStarter, "SystemStarter");
+_LIT(KTEFRemotePanicDetection, "RemotePanicDetection");
+_LIT(KTEFEnableIniAccessLog, "EnableIniAccessLog");
+_LIT(KTEFEnableTestsCountLog, "EnableTestsCountLog");
+_LIT(KTEFLogSeverityKey, "LogLevel");
+_LIT(KTEFLogMode, "LogMode");
+_LIT(KTEFStringFormat,"%S");
+_LIT(KTEFSlash, "\\");
+_LIT(KTEFLogChannel, "LogChannel");
+_LIT(KTEFOutputPort, "output_port");
+_LIT(KTEFWaitForLoggingTime, "WaitForLoggingTime");
+
+_LIT(KTEFResultPass,"PASS");
+_LIT(KTEFResultSkippedSelectively,"SKIPPED_SELECTIVELY");
+_LIT(KTEFResultFail,"FAIL");
+_LIT(KTEFResultTag,"***Result");
+_LIT(KTEFResult,"!Result=");
+
+// export only
+const TInt KTEFTestExecuteParamLength=30;
+const TInt KTEFMinPanicStringLength=2;
+
+_LIT(KTEFResultPanic,"PANIC");
+_LIT(KTEFResultUnexecuted, "UNEXECUTED");
+_LIT(KTEFTestCaseResultTag,"***TestCaseResult");
+_LIT(KTEFCommentedCommands,"COMMENTED OUT COMMAND'S");
+_LIT(KTEFTestCaseSummary, "TEST_CASE_SUMMARY");
+_LIT(KTEFTestStepSummary, "TEST_STEP_BLOCK_SUMMARY");
+_LIT(KTEFRunProgramSummary, "RUN_PROGRAM_SUMMARY");
+_LIT(KTEFRunScriptSummary, "RUN_SCRIPT_SUMMARY:");
+_LIT(KTEFScriptExecuted, "EXECUTED_SCRIPTS");
+_LIT(KTEFFailedOpen, "FAILED_TO_OPEN");
+_LIT(KTEFOpenQuotes,"\"");
+_LIT(KTEFSpaceEquals," = ");
+_LIT(KTEFSection, "TestExecute");
+_LIT(KTEFXmlKey, "XML");
+_LIT(KTEFEqualsInteger," = %d");
+_LIT(KTEFIniReadInteger,"INI READ : %S %S %S %d");
+_LIT(KTEFIniReadString,"INI READ : %S %S %S %S");
+_LIT(KTEFIniWriteInteger,"INI WRITE : %S %S %S %d");
+_LIT(KTEFIniWriteString,"INI WRITE : %S %S %S %S");
+_LIT(KTEFDefaultPath,"?:\\system\\data\\testexecute.ini");
+_LIT(KTEFAlternatePath,"z:\\system\\data\\testexecute.ini");
+_LIT(KTEFComma,",");
+
+_LIT(KTEFResultInconclusive,"INCONCLUSIVE");
+_LIT(KTEFResultAbort,"ABORT");
+_LIT(KTEFResultUnknown,"UNKNOWN");
+_LIT(KTEFFontLightBlue, "<font size=2 color=00AFFF>");
+_LIT(KTEFFontGreen,"<font size=2 color=00AF00>");
+_LIT(KTEFFontRed,"<font size=2 color=FF0000>");
+_LIT(KTEFFontBlue,"<font size=2 color=0000FF>");
+_LIT(KTEFFontGrey,"<font size=2 color=C0C0C0>");
+_LIT(KTEFFontEnd,"</font>");
+_LIT(KTEFTestCaseDefault, "NOTESTCASE");
+
+_LIT(KTEFDefaultSysDrive, "DefaultSysDrive");
+_LIT(KTEFSysDrive, "${SYSDRIVE}");
+_LIT(KTEFIniSysDrive, "SYSDRIVE");
+_LIT(KTEFLegacySysDrive, "C:");
+_LIT(KTEFWrapperPluginDll, "WrapperUtilsPlugin.dll");
+_LIT(KTEFTabulator, "\t");
+// the simplified summary file. in case of out-of-memory.
+_LIT(KTEFTestExecuteResultSimplifiedSummaryFile,"TestResults.txt");
+_LIT8(KLoggerNotEnoughMemory8, "Not enough memory to perform logging...");
+_LIT(KTEFIniReadInt64,"INI READ : %S %S %S %ld");
+_LIT(KTEFIniWriteInt64,"INI WRITE : %S %S %S %ld");
+_LIT(KTEFPanicStringTooLong,"Expected panic string %S\"%S\" (in script) was TOO LONG.");
+_LIT(KTEFPanicStringErrorInfo,"Keep the panic string length to 16 characters or less. Please Refer to User::Panic() in SDL for more information.");
+_LIT(KTEFExpectedPanicString,"Expected panic string was \"%S\" (in script)");
+_LIT(KTEFReceivedPanicString,"Received panic string was \"%S\"(in code)");
+_LIT(KTEFWarnPanicString,"The actual length of the received panic string is 16 characters, which is possibly truncated. User::Panic will only pass through the first 16 characters of the panic string, the test result may not be reliable. Ensure this is 16 characters or less or it will be truncated.");
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefresult.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains TEFResult.h
+*
+*/
+
+
+
+#ifndef __TEF_RESULT_H__
+#define __TEF_RESULT_H__
+
+class MTEFResult
+/**
+ * @internalComponent
+ * @test
+ *
+ * Test error handling
+ */
+	{
+public:
+	/*
+	 * Set the error
+	 *
+	 * @param	- aError the error to set
+	 */
+	virtual void		SetError(const TInt aError) =0;
+
+	/*
+	 * Set the asynchronus error
+	 *
+	 * @param	aIndex - block index that the error belongs to
+	 * @param	aError - the error to set
+	 */
+	virtual void		SetAsyncError(const TInt aIndex, const TInt aError) =0;
+
+	/*
+	 * Set the block result
+	 *
+	 * @param	aResult - the result to set
+	 *
+	 * @see		TVerdict
+	 */
+	virtual void		SetBlockResult(const TVerdict aResult) =0;
+
+	/*
+	 * Get the block result
+	 *
+	 * @return	the result
+	 *
+	 * @see		TVerdict
+	 */
+	virtual TVerdict	BlockResult() =0;
+	};
+
+#endif // __TEF_RESULT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefscriptutils.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TEFScriptUtils.h
+*/
+
+#if !(defined __TEF_SCRIPT_UTILS_H__)
+#define __TEF_SCRIPT_UTILS_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include <test/tefexportconst.h>
+
+struct TCommandForCounting
+/**
+@internalComponent
+@test
+*/
+	{
+	TBuf<KMaxTestExecuteNameLength> iCommandName;
+	TInt iCommandCount;
+	};
+
+class CScriptPreProcess : public CBase
+/**
+@internalComponent
+@test
+*/
+	{
+	public:
+	CScriptPreProcess(const TDesC& aScriptFilePath, TPtrC aCommandList[KTEFCommandCountsStructSize]);
+	~CScriptPreProcess();
+	TInt CountNoOfOccurences();
+	inline TInt GetStructSize(){return iStructSize;};
+	void RetrieveValues(TInt& aIndex, TDes& aCommandName, TInt& aCommandCount);	
+	
+	//private:
+	void CreateScriptDataFromScriptFileL();
+	TBool GetNextScriptLine();
+	void UpdateCommandCounts();
+	
+	private:
+	TBuf<KMaxTestExecuteCommandLength> iScriptFilePath;
+	TInt iStructSize;
+	// Update the array size from TEFExportConst.h whenever the number of commands to count varies
+	TCommandForCounting iCommandsAndCounts[KTEFCommandCountsStructSize];
+	HBufC16* iScriptData;
+	TLex iScriptLex;
+	TPtrC iCurrentScriptLine;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefshareddata.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TEFSharedData.h
+*/
+#if !(defined __TEF_SHARED_DATA_H__)
+#define __TEF_SHARED_DATA_H__
+#include <e32std.h>
+
+const TInt KMaxSharedObjectNameSize=30;
+
+template <class T>
+class CTEFSharedData : public CBase
+/**
+* @internalComponent
+* @test
+*/
+	{
+public:
+	inline CTEFSharedData();
+	inline ~CTEFSharedData();
+	inline static CTEFSharedData<T>* NewL(T*& aPtr, const TInt aLength, const TDesC& aName);
+	inline static CTEFSharedData<T>* NewLC(T*& aPtr, const TInt aLength, const TDesC& aName);
+	inline static CTEFSharedData<T>* NewL(T*& aPtr, const TDesC& aName);
+	inline static CTEFSharedData<T>* NewLC(T*& aPtr, const TDesC& aName);
+
+	inline T* Ptr();
+	inline void EnterCriticalSection();
+	inline void ExitCriticalSection();
+
+private:
+	inline void ConstructL(T*& aPtr, const TInt aLength, const TDesC& aName);
+	inline void ConstructL(T*& aPtr, const TDesC& aName);
+	inline void SetNameL( const TDesC& aName );
+
+private:
+	T* iPtr;
+	RChunk iSharedDataChunk;
+	RMutex iMutex;
+	TBuf<KMaxSharedObjectNameSize> iSharedChunkName;
+	TBuf<KMaxSharedObjectNameSize> iSharedMutexName;
+	};
+
+#include <test/tefshareddata.inl>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefshareddata.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2005-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:  
+* Template class implementation for creating RChunk object with memory for sharing data
+* Construction of template object for sharing data requires
+* Name for RChunk memory, size of data and null pointer of the object type to be shared
+* Construction of template class for accessing the shared data requires
+* Name for RChunk memory and null pointer of the object type already shared
+*
+*/
+
+
+
+/**
+ @file TEFSharedData.inl
+ @prototype
+ @test
+*/
+
+template <class T>
+inline CTEFSharedData<T>::CTEFSharedData()
+/**
+ * Constructor
+ */
+	: iPtr(NULL)
+	{
+	// Intialising member data
+	iSharedChunkName.Zero();
+	iSharedMutexName.Zero();
+	}
+
+template <class T>
+inline CTEFSharedData<T>* CTEFSharedData<T>::NewL(T*& aPtr, const TInt aLength, const TDesC& aName)
+/**
+ * Updates the null pointer with address of RChunk base for user to copy data
+ * Two phase construction
+ *
+ * @param	aPtr - Address of null pointer to object that needs to be shared as a global chunk
+ * @param	aLength - Size to be allocated in RChunk base for the object to be shared
+ * @param	aName - Descriptor containing the name to be assigned to the global chunk
+ *
+ * @leave	system wide error
+ *
+ * @return	Instance of the TEFSharedData template class object
+ */
+	{
+	CTEFSharedData<T>* self=CTEFSharedData<T>::NewLC(aPtr,aLength,aName);
+	CleanupStack::Pop();
+	return self;
+	}
+
+template <class T>
+inline CTEFSharedData<T>* CTEFSharedData<T>::NewL(T*& aPtr, const TDesC& aName)
+/**
+ * Updates the null pointer with address of RChunk base for user to update data
+ * Two phase construction
+ *
+ * @param	aPtr - Address of null pointer to object that is shared in a global chunk
+ * @param	aName - Descriptor containing the name assigned to the global chunk
+ *
+ * @leave	system wide error
+ *
+ * @return	Instance of the TEFSharedData template class object
+ */
+	{
+	CTEFSharedData<T>* self=CTEFSharedData<T>::NewLC(aPtr,aName);
+	CleanupStack::Pop();
+	return self;
+	}
+
+template <class T>
+inline CTEFSharedData<T>* CTEFSharedData<T>::NewLC(T*& aPtr, const TInt aLength, const TDesC& aName)
+/**
+ * Updates the null pointer with address of RChunk base for user to copy data
+ * Two phase construction
+ *
+ * @param	aPtr - Address of null pointer to object that needs to be shared as a global chunk
+ * @param	aLength - Size to be allocated in RChunk base for the object to be shared
+ * @param	aName - Descriptor containing the name to be assigned to the global chunk
+ *
+ * @leave	system wide error
+ *
+ * @return	Instance of the TEFSharedData template class object and pushes to CleanupStack
+ */
+	{
+	CTEFSharedData<T>* self=new (ELeave) CTEFSharedData<T>();
+	CleanupStack::PushL(self);
+	self->ConstructL(aPtr,aLength,aName);
+	return self;
+	}
+
+template <class T>
+inline CTEFSharedData<T>* CTEFSharedData<T>::NewLC(T*& aPtr, const TDesC& aName)
+/**
+ * Updates the null pointer with address of RChunk base for user to update data
+ * Two phase construction
+ *
+ * @param	aPtr - Address of null pointer to object that is shared in a global chunk
+ * @param	aName - Descriptor containing the name assigned to the global chunk
+ *
+ * @leave	system wide error
+ *
+ * @return	Instance of the TEFSharedData template class object and pushes to CleanupStack
+ */
+	{
+	CTEFSharedData<T>* self=new (ELeave) CTEFSharedData<T>();
+	CleanupStack::PushL(self);
+	self->ConstructL( aPtr, aName );
+	return self;
+	}
+
+template <class T>
+inline void CTEFSharedData<T>::ConstructL(T*& aPtr, const TInt aLength, const TDesC& aName)
+/**
+ * Opens up a handle and retrieves base address of the created chunk memory to iPtr
+ * Updates the null pointer with address of RChunk base for user to copy data
+ *
+ * @param	aPtr - Address of null pointer to object that needs to be shared in a global chunk
+ * @param	aLength - Size to be allocated in RChunk base for the object to be shared
+ * @param	aName - Descriptor containing the name to be assigned to the global chunk
+ *
+ * @leave	system wide error
+ */
+	{
+	iSharedChunkName.Zero();
+	iSharedChunkName.Copy(_L("TEF"));
+	iSharedChunkName.Append(aName);
+
+	iSharedMutexName.Zero();
+	iSharedMutexName.Copy(_L("TEFMutex"));
+	iSharedMutexName.Append(aName);
+
+	TInt error = KErrNone;
+	error = iSharedDataChunk.CreateGlobal(iSharedChunkName, aLength, aLength + 1);
+	if( error == KErrAlreadyExists )
+		{
+		// Chunk memory already created by another process
+		// Open a handle to already created global chunk
+		error = iSharedDataChunk.OpenGlobal(iSharedChunkName,EFalse);
+		if( error != KErrNone )
+			{
+			User::Leave(error);
+			}
+		// Open a mutex handle to existing global chunk
+		error = iMutex.OpenGlobal(iSharedMutexName);
+		if( error != KErrNone )
+			{
+			User::Leave(error);
+			}
+
+		// If we have looked up a shared RChunk we will need to update it
+		//  with the object passed into the constructor
+		T* baseAddress = (T*)iSharedDataChunk.Base();
+		iPtr = baseAddress;
+		aPtr = iPtr;
+		}
+	else if( error == KErrNone )
+		{
+		// Global chunk created by current process
+		// Copy the object to be shared to Chunks base address
+		T* baseAddress = (T*)iSharedDataChunk.Base();
+		iPtr = baseAddress;
+		aPtr = iPtr;
+		// Create a mutex object for the newly created global chunk
+		error = iMutex.CreateGlobal(iSharedMutexName);
+		if( error != KErrNone )
+			{
+			User::Leave(error);
+			}
+		}
+	else
+		{
+		User::Leave(error);
+		}
+    }
+
+template <class T>
+inline void CTEFSharedData<T>::ConstructL(T*& aPtr, const TDesC& aName)
+/**
+ * Opens up a handle and retrieves base address of the created chunk memory to iPtr
+ * Updates the null pointer with address of RChunk base for user to update data
+ *
+ * @param	aPtr - Address of null pointer to object type shared in a global chunk
+ * @param	aName - Descriptor containing the name assigned to the global chunk
+ *
+ * @leave	system wide error
+ */
+	{
+	SetNameL( aName );
+	aPtr = Ptr();
+    }
+
+
+template <class T>
+inline T* CTEFSharedData<T>::Ptr()
+/**
+ * @return - Pointer to the base of the RChunk object memory in heap
+ */
+	{
+	// Since we are using RChunk::Close() the pointer will always be valid
+	// The shared RChunk can not have been deleted as it is a reference counting object
+	return iPtr;
+	}
+
+template <class T>
+inline void CTEFSharedData<T>::SetNameL( const TDesC& aName )
+/**
+ * Opens up a handle to the existing chunk & retrieves the base address to iPtr
+ *
+ * @param aName - Name of the global chunk memory for a shared object
+ */
+	{
+	// Check to see if we already have a handle to a shared RChunk
+	if( iPtr != NULL )
+		{
+		// Close this before searching for the new one
+		TInt handle = 0;
+		handle = iSharedDataChunk.Handle();
+		if(handle != 0)
+			{
+			iPtr = NULL;
+			iMutex.Close();
+			iSharedDataChunk.Close();
+			}
+		}
+
+	// Now search for and open the new shared RChunk
+	iSharedChunkName.Zero();
+	iSharedChunkName.Copy(_L("TEF"));
+	iSharedChunkName.Append(aName);
+
+	iSharedMutexName.Zero();
+	iSharedMutexName.Copy(_L("TEFMutex"));
+	iSharedMutexName.Append(aName);
+
+	TInt error = KErrNone;
+	// Open a handle to a existing chunk memory
+	error = iSharedDataChunk.OpenGlobal(iSharedChunkName,EFalse);
+	if( error == KErrNone )
+		{
+		// Open a mutex handle for the chunk memory
+		error = iMutex.OpenGlobal(iSharedMutexName);
+		if( error == KErrNone )
+			{
+			// Retrieve base address of chunk memory & assign it to iPtr
+			T* baseAddress = reinterpret_cast<T*>(iSharedDataChunk.Base());
+			iPtr = baseAddress;
+			}
+		}
+
+	if( error != KErrNone )
+		{
+		User::Leave(error);
+		}
+	}
+
+template <class T>
+inline void CTEFSharedData<T>::EnterCriticalSection()
+/**
+ * Establishes a lock to global chunk access
+ * Makes other proces to wait for a signal
+ */
+	{
+	iMutex.Wait();
+	}
+
+template <class T>
+inline void CTEFSharedData<T>::ExitCriticalSection()
+/**
+ * Releases the lock to global chunk access
+ * Signals for a process to establish a lock
+ */
+	{
+	iMutex.Signal();
+	}
+
+template <class T>
+inline CTEFSharedData<T>::~CTEFSharedData()
+/**
+ * Destructor
+ */
+	{
+	// Cleanup everything.
+	TInt handle = 0;
+	// Checks for an existing handle to the global chunk
+	// Ensures global objects are not closed already by another process
+	handle = iMutex.Handle();
+	if (handle != 0)
+		{
+		iMutex.Close();
+		}
+
+	handle = iSharedDataChunk.Handle();
+	if (handle != 0)
+		{
+		iSharedDataChunk.Close();
+		}
+	iPtr = NULL;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/teftestreport.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,486 @@
+/*
+* 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: This file contains the header file of the CTestReport.
+*
+*/
+
+#ifndef TEF_TEST_REPORT_H
+#define TEF_TEST_REPORT_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+const TInt KTEFMaxResultDes = 128; // Maximum test result description length
+typedef TBuf<KTEFMaxResultDes> TTEFResultDes;
+
+// Different StifLogger presentations types.
+enum TTEFTestReportLoggerType
+    {
+    ETEFTestReportLoggerType_Txt,       // txt file logging
+    ETEFTestReportLoggerType_Data,      // data file logging(e.g. web page downloading )
+    ETEFTestReportLoggerType_Html       // html file logging
+    };
+
+// Different StifLogger output modules.
+enum TTEFTestReportOutput
+    {
+    ETEFTestReportOutput_File,      // File logging
+    ETEFTestReportOutput_RDebug     // RDebug logging
+    };
+
+// TTestCaseInfo defines the information for test case execution.
+class TTEFTestCaseInfo
+    {
+    public:
+        // Default test case priority values
+        enum TPriority
+            {    
+            EPriorityLow = -100,
+            EPriorityNormal = 0,
+            EPriorityHigh = 100,
+            };
+
+    public:
+
+        /**
+        * Default constructor of TTestCaseInfo.
+        */
+        inline TTEFTestCaseInfo()
+        {
+        iCaseNumber = -1;
+        iTitle.Zero();
+        iTimeout = 0;
+        iPriority = EPriorityNormal;
+        };
+
+    public:
+
+        // Test case number.
+        TInt iCaseNumber;
+        // Test case title.
+        TName iTitle;
+        // Test Case Timeout ( 0 == No timeout )
+        TTimeIntervalMicroSeconds iTimeout; 
+        // Test case priority
+        TInt iPriority;
+
+    };
+
+// TTestResult defines the test case result information.
+class TTEFTestResult 
+    {
+    public:
+
+        /**
+        * Default constructor of TTestResult.
+        */
+        inline TTEFTestResult()
+        {
+            iResult = 0;
+            iResultDes.Zero();
+        };
+
+        /**
+        * Sets result and result description of the test case.
+        */
+        inline void SetResult( TInt aResultCode, const TDesC& aResultDes )
+        {
+            iResult = aResultCode;
+            // If description is too length then cut.
+            if( aResultDes.Length() > KTEFMaxResultDes )
+                {
+                iResultDes = aResultDes.Left( KTEFMaxResultDes );
+                }
+            else
+                {
+                iResultDes = aResultDes;
+                }
+        };
+
+    public:
+
+        // Test case result as Symbian OS error code.
+        TInt iResult;
+        // Descriptive test case result.
+        TTEFResultDes iResultDes;
+    };
+
+// TTestInfo defines the information for test case and Test Module.
+class TTEFTestInfo 
+    {
+    public:
+        inline TTEFTestInfo()
+        {
+            iModuleName.Zero();
+            iConfig.Zero();
+        };
+    public:
+        // The name of Test Module.
+        TName iModuleName;
+        // Test case info for test case execution.
+        TTEFTestCaseInfo iTestCaseInfo;
+        // Config file to be used.
+        TFileName iConfig;
+    };
+
+// TFullTestResult defines the full test case result information.
+class TTEFFullTestResult
+    {
+    public:
+        inline TTEFFullTestResult()
+        {
+            iStartTime=0;
+            iEndTime=0;
+        };
+
+        enum TCaseExecutionResult
+        {
+            ECaseOngoing,
+            ECaseExecuted,
+            ECaseCancelled,
+            ECaseErrorFromModule,
+            ECaseLeave,
+            ECasePanic,
+            ECaseException,
+            ECaseTimeout,
+            ECaseSuicided,
+        };
+
+    public:
+        // Test case result.
+        TTEFTestResult iTestResult;
+        // Timestamp when test case was started.
+        TTime iStartTime;
+        // Timestamp when test case was ended.
+        TTime iEndTime;
+        
+        // Test result type
+        TCaseExecutionResult iCaseExecutionResultType;      
+        // Test result code
+        TInt iCaseExecutionResultCode;
+    };
+
+        
+// Struct to Test report settings
+class TTEFTestReportSettings
+    {
+    public:
+        
+        TTEFTestReportSettings(){ iCreateTestReport = ETrue;
+                                iPath = NULL;
+                                iName = NULL;
+                                iFormat = ETEFTestReportLoggerType_Txt;
+                                iOutput = ETEFTestReportOutput_File;
+                                iOverwrite = ETrue; 
+                                iXML = EFalse;
+                             }
+
+       ~TTEFTestReportSettings(){ delete iPath; delete iName; }
+
+    public:
+
+        TBool                   iCreateTestReport; // Test report creation mode
+        HBufC*                  iPath;             // Test report path
+        HBufC*                  iName;             // Test report name
+        TTEFTestReportLoggerType iFormat;          // Test report file type
+        TTEFTestReportOutput    iOutput;           // Test report output
+        TBool                   iOverwrite;        // Test report overwrite
+        TBool                   iXML;              // Test report in xml format
+
+    };
+
+
+// DESCRIPTION
+// Class used to store version information of test module.
+// iTestModuleName field keeps name of test module dll
+// iVersion keeps version of test module dll
+        
+    struct TTEFTestModuleVersionInfo
+    {
+        TFileName iTestModuleName;
+        TInt iMajor;
+        TInt iMinor;
+        TInt iBuild;
+    };
+
+    
+// CONSTANTS
+// Maximum length for date or time definitions 'Thursday 06th November 2003'
+const TInt KMaxDateAndTimeStamp = 30;
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+// None
+
+// DESCRIPTION
+// CTEFTestReport is a class that can generate different test reports.
+class CTEFTestReport
+        : public CBase
+    {
+    public:     // Enumerations
+
+        // TTestReportMode defines the mode of test report
+        enum TTestReportMode
+            {
+            ETestReportBlank = 0x00000000,
+            ETestReportSummary = 0x00000001,
+            ETestReportEnvironment = 0x00000002,
+            ETestReportCases = 0x00000004,
+            ETestReportFull = ETestReportSummary | ETestReportEnvironment | ETestReportCases
+            };
+
+        // TTestReportOutput defines the type of test report output
+        enum TTestReportOutput
+            {
+            ETestReportNone = 0x00000000,
+            ETestReportDebug = 0x00000001,
+            ETestReportPlainText = 0x00000002,
+            ETestReportHtml = 0x00000004,
+            ETestReportAll = ETestReportDebug | ETestReportPlainText | ETestReportHtml
+            };
+
+        enum TStyle
+            {
+            ENoStyle    = 0x00000,  // No style parameter
+            EBold       = 0x00001,  // Bold
+            ECursive    = 0x00002,  // Cursive
+            EUnderline  = 0x00004,  // Underline
+            EBlue       = 0x00008,  // Blue
+            EGreen      = 0x00010,  // Green
+            ERed        = 0x00020,  // Red
+            EImportant  = 0x00040,  // Important (Line will starts a 'IMPORTANT' text)
+            EWarning    = 0x00080,  // Warning (Line will starts a 'WARNING' text)
+            EError      = 0x00100   // Error (Line will starts a 'ERROR' text)
+            };
+        
+    public:     // Structured classes
+
+        /**
+        *  TTestReportHeader includes header information for test report.
+        *
+        */
+        struct THwInfo
+            {
+            TInt iManufacturer;
+            TInt iMachineUid;
+            TInt iModel;
+            TInt iHwRev;
+            TInt iCpu;
+            TInt iCpuSpeed;
+            TInt iLanguage;
+            };
+
+        struct TSwInfo
+            {
+            TInt iSwRev;
+            TInt iSwBuild;
+            };
+
+        struct TMemoryInfo
+            {
+            TInt iRAM;
+            TInt iRAMFree;
+            };
+
+        class TTestHWInfo
+            {
+            public: // New functions
+                TTestHWInfo();
+
+            public: // Data
+                // HW Info
+                THwInfo         iHwInfo;
+                // SW Info
+                TSwInfo         iSwInfo;
+                // Memory Info
+                TMemoryInfo     iMemoryInfo;
+            };
+
+        /**
+        *  TTestCaseSummary includes information for summary of test cases.
+        */
+        class TTestCaseSummary
+            {
+            public:     // New functions
+                TTestCaseSummary();
+
+            public:     // Data
+                // Test Info
+                TTEFTestInfo           iTestInfo;
+                // Test Result
+                TTEFFullTestResult     iFullTestResult;
+            };
+
+        /**
+        *  TTestSummary includes information for test report summary.
+        */
+        class TTestSummary
+            {
+            public:     // New functions
+                TTestSummary( const TName& aName );
+
+            public:     // Data
+                // Name (e.g. test module name )
+                const TName     iName;
+                // Count of passed test cases
+                TInt            iPassedCases;
+                // Count of failed test cases
+                TInt            iFailedCases;
+                // Count of crashed cases
+                TInt            iCrashedCases;
+                // Count of timed out cases
+                TInt            iTimeoutCases;
+            };
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTEFTestReport* NewL( TTEFTestReportSettings& aTestReportSettings,
+                                  const TTestReportMode aReportMode );
+        
+        /**
+        * Destructor.
+        */
+        ~CTEFTestReport();
+        
+    public:     // New functions
+        
+        /**
+        * Add test case result.
+        */
+        void AddTestCaseResultL( const TTEFTestInfo& aTestInfo,
+                                 const TTEFFullTestResult& aTestResult,
+                                 const TInt aError );
+
+        /**
+        * Generate result reports.
+        */
+        void GenerateReportL();
+        
+        /**
+        * Update result reports.
+        */
+        void UpdateReportSummaryL();
+        
+        /**
+         * Adds version of test module to RPointerArray
+         */
+        void AddTestModuleVersion(TTEFTestModuleVersionInfo& aVersion);
+
+    public:     // Functions from base classes
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(  TTEFTestReportSettings& aTestReportSettings );
+
+        /**
+        * Default C++ constructor.
+        */
+        CTEFTestReport( const TTestReportMode aReportMode );
+        
+        /**
+        * Write result file header.
+        */
+        void WriteHeaderL();
+        
+        /**
+        * Write result file trailer.
+        */
+        void WriteTrailerL();
+        
+        /**
+        * Write data to file.
+        */
+        void WriteLineL( TRefByValue<const TDesC> aStr,... );
+        
+        /**
+        * Write delimiter line.
+        */
+        void WriteDelimiterL( const TDesC& aDelimiter, TInt aCount );
+        
+        /**
+        * Adds needed tags to get valid xml file.
+        */
+        void CloseXMLTagsInUnfinishedFileL(void);
+
+    public:     // Data
+    
+    protected:  // Data
+
+    private:    // Data
+
+        // Report file handles
+        RFs                             iFs;
+        RFile                           iFile;
+        TTEFTestReportLoggerType        iFormat;
+        TTEFTestReportOutput            iOutput;
+    
+        // Report Mode
+        TTestReportMode                 iReportMode;
+
+        // Report HW info
+        TTestHWInfo                     iReportHWInfo;
+
+        // Total summary
+        TTestSummary*                   iTotalSummary;
+
+        // Test summary array
+        RPointerArray<TTestSummary>     iTestSummaries;
+        
+        // Summary start position
+        TInt                            iSummaryPos;
+        
+        // Versions of test modules position
+        TInt                            iModulesVersionsPos;
+        
+        // Test modules versions
+        RPointerArray<TTEFTestModuleVersionInfo> iTestModulesVersionsInfo;
+
+        // Will report be written in xml format 
+        TBool                           iXML;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif // TEF_TEST_REPORT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/teftimer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CTEFTimer
+*
+*/
+
+
+
+#ifndef __TEF_TIMER_H__
+#define __TEF_TIMER_H__
+
+#include <e32base.h>
+
+class MTEFTimerCallback
+/**
+ * @internalComponent
+ * @test
+ *
+ * Timer completion callback
+ */
+	{
+public:
+	/**
+	 * Method from which CTEFTimer informs the user that the timer has completed
+	 */
+	virtual void	TimerCompleted() = 0;
+	};
+
+class CTEFTimer : public CTimer
+/**
+ * @internalComponent
+ * @test
+ *
+ * @see		CTimer
+ * Timer help class
+ */
+	{
+public:
+	IMPORT_C static CTEFTimer*	NewL(MTEFTimerCallback& aCallback, TInt aPriority = EPriorityStandard);
+
+protected:
+	CTEFTimer(MTEFTimerCallback& aCallback, TInt aPriority);
+
+	void				ConstructL();
+
+	virtual void		RunL();
+
+private:
+	MTEFTimerCallback&	iCallback;
+	};
+
+#endif // __TEF_TIMER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/tefutils.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TEFUtils.h
+*/
+
+#if !(defined __TEF_UTILS_H__)
+#define __TEF_UTILS_H__
+
+class CWrapperUtilsPlugin;
+
+class TEFUtils
+/**
+ * @internalComponent
+ * @test
+ *
+ * Utility functions
+ */
+{
+public:
+	IMPORT_C static CWrapperUtilsPlugin* WrapperPluginNew(RLibrary& aLibrary); 
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testblockcontroller.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains TestBlockController.h
+*
+*/
+
+
+
+#ifndef __TEST_BLOCK_CONTROLLER_H__
+#define __TEST_BLOCK_CONTROLLER_H__
+
+#include <e32def.h>
+#include <e32cmn.h>
+
+#include <test/datadictionary.h>
+#include <test/testexecutestepbase.h>
+#include <test/activecallback.h>
+#include <test/tefresult.h>
+#include <test/commandprocessor.h>
+#include <test/blockitems.h>
+#include <test/teftimer.h>
+
+class CTestBlockController : public CTestStep, public MTEFResult, public MTEFTimerCallback, public MCommandProcessorCallback
+/**
+ * @publishedPartner
+ * @test
+ *
+ * @see		CTestStep
+ * @see		MTEFResult
+ * @see		MTEFTimerCallback
+ * @see		MCommandProcessorCallback
+ */
+	{
+public:
+	IMPORT_C 						CTestBlockController();
+	IMPORT_C virtual				~CTestBlockController();
+	IMPORT_C void					SetBlockArray( TTEFItemArray* aBlockArray );
+	IMPORT_C void					SetSharedData( MSharedData* aSharedData );
+
+	IMPORT_C virtual CDataWrapper*	CreateDataL( const TDesC& aData ) =0;
+
+	// CTestStep implementations
+	IMPORT_C virtual TVerdict		doTestStepPreambleL();
+	IMPORT_C virtual TVerdict		doTestStepL();
+	IMPORT_C virtual TVerdict		doTestStepPostambleL();
+
+	// MTEFResult implementation
+	IMPORT_C virtual void			SetError(const TInt aError);
+	IMPORT_C virtual void			SetAsyncError(const TInt aIndex, const TInt aError);
+	IMPORT_C virtual void			SetBlockResult(const TVerdict aResult);
+	IMPORT_C virtual TVerdict		BlockResult();
+
+	// MTEFTimerCallback implementation
+	IMPORT_C virtual void			TimerCompleted();
+
+	// MCommandProcessorCallback implementation
+	IMPORT_C virtual void			NextCommandL();
+
+protected:
+	IMPORT_C void					StartCommands();
+	IMPORT_C virtual TBool			DoCommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex);
+
+	inline	void					CreateObjectL(TTEFBlockItem& aCommand);
+	inline	void					RestoreObjectL(TTEFBlockItem& aCommand);
+	inline	void					StoreL(TTEFBlockItem& aCommand);
+	inline	void					StoreActiveScheduler(TTEFBlockItem& aCommand);
+	inline	void					CommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex);
+
+private:
+	class CBlockActiveScheduler : public CActiveScheduler
+		{
+	public:
+		IMPORT_C 				CBlockActiveScheduler(CTestBlockController& aTestStep);
+		IMPORT_C virtual		~CBlockActiveScheduler();
+		IMPORT_C virtual void	Error(TInt aError) const;
+
+	private:
+		CTestStep& iTestStep;
+		};
+
+	TTEFItemArray*				iBlockArray;
+	CDataDictionary				iDataDictionary;
+	CCommandProcessor*			iCommandProcessor;
+	CActiveScheduler*			iActiveScheduler;
+	CTEFTimer*					iTimer;
+	CPeriodic*					iPeriodic;
+	TBool						iAsyncTimer;
+	TBool						iTimerActive;
+	TInt						iCommandIndex;
+	TInt						iAsyncCount;
+	MSharedData*				iSharedData;
+	TBool						iDeleteSharedScheduler;
+
+	// Helper methods
+	IMPORT_C void				StartTimer(const TTEFBlockItem& aCommand);
+	IMPORT_C void				CancelTimer();
+
+	// CPerodic callback
+	IMPORT_C static TBool		OutstandingCallback( TAny* aAny );
+	IMPORT_C void				OutstandingCallback();
+
+	inline void					IncAsyncCount();
+	inline void					DecAsyncCount();
+	};
+
+#include <test/testblockcontroller.inl>
+
+#endif // __TEST_BLOCK_CONTROLLER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testblockcontroller.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains TestBlockController.inl
+* This contains CTestBlockController inline methods
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+#ifndef __TEST_BLOCK_CONTROLLER_INL_
+#define __TEST_BLOCK_CONTROLLER_INL_
+
+/**
+ * Increment the number of active async operations
+ */
+inline void	CTestBlockController::IncAsyncCount() { ++iAsyncCount; }
+
+/**
+ * Decrement the number of active async operations
+ */
+inline void	CTestBlockController::DecAsyncCount() { --iAsyncCount; }
+
+#endif // __TEST_BLOCK_CONTROLLER_INL_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecuteclient.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TestExecuteClient.h
+*/
+
+#if !(defined __TESTEXECUTE_CLIENT_H__)
+#define __TESTEXECUTE_CLIENT_H__
+
+#include <e32base.h>
+#include <test/tefexportconst.h>
+#include <test/blockitems.h>
+
+enum
+	{
+	EConnectServer,
+	EOpenTestStep,
+	ERunTestStep,
+	EAbortTestStep,
+	ECloseTestStep,
+	EOpenTestBlock,
+	ERunTestBlock
+	};
+
+class RTestServ : public RSessionBase
+/**
+@publishedPartner
+@test
+*/
+	{
+public:
+	IMPORT_C TInt Connect(const TDesC& aServerName, TBool aDebugMode = EFalse);
+	IMPORT_C const TDesC& ServerName() const;
+protected:
+private:
+	RLibrary iLibrary;
+	TBuf<KMaxTestExecuteNameLength> iServerName;
+	TVersion Version() const;
+	};
+
+class RTestSession : public RSubSessionBase
+/**
+@publishedPartner
+@test
+*/
+	{
+public:
+	IMPORT_C TInt Open(RTestServ& aServ, const TDesC& aStepName, TBool aSharedData = EFalse);
+	IMPORT_C void RunTestStep(const TDesC& aCommandString, TDes& aPanicString, TRequestStatus& aStatus);
+	IMPORT_C TInt AbortTestStep();
+	IMPORT_C void Close();
+	IMPORT_C TInt Open(RTestServ& aServ, TBool aSharedData = EFalse);
+	IMPORT_C void RunTestBlock(const TDesC& aCommandString, TDes& aPanicString, TDes8& aBlockArray, TRequestStatus& aStatus);
+	inline	RTestSession() : iBlockArrayPtr((TUint8*)(NULL),0) {}
+	
+protected:
+private:
+	TPtr8	iBlockArrayPtr;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecutelogbase.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TestExecuteLogBase.h
+*/
+
+#if !(defined __TESTEXECUTE_LOG_BASE_H__)
+#define __TESTEXECUTE_LOG_BASE_H__
+
+#include <e32base.h>
+#include <test/testexecutelog.h>
+#include <test/testexecutepipslog.h>
+#include <test/rfilelogger.h>
+#include <test/blockitems.h>
+
+// Abstract base class for all logging operations for TEF
+class MTestExecuteLogBase
+/**
+@internalComponent
+@test
+*/
+	{
+public:
+	virtual ~MTestExecuteLogBase() {};
+	IMPORT_C virtual void InitialiseLoggingL(const TDesC& aScriptFilePath, TBool aSeparateLogFileMode, TInt aLogLevel) = 0;
+	IMPORT_C virtual void TerminateLoggingL(const TInt aCommentedCommandsCount, const TInt aRemotePanicsCount, const TInt aRunScriptFailCount) = 0;
+	IMPORT_C virtual void LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt,...) = 0;
+	IMPORT_C virtual void LogTestCaseResult(const TDesC& aFile, TInt aLine, TInt aSeverity, const TDesC& aCommand, const TDesC& aTestCaseName, TVerdict aResult) = 0;
+	IMPORT_C virtual void LogToXml(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aCommandName, const TInt aNumberOfParams, TExtraLogField* aLogFields) = 0;
+	IMPORT_C virtual void LogToXml(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aCommandName) = 0;
+	IMPORT_C virtual void PrintCurrentScriptLine(TDes& aCurrentScriptLine) = 0;
+	IMPORT_C virtual void LogResult(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,const TDesC& aScriptFile,TInt aSeverity) = 0;
+	IMPORT_C virtual TVerdict LogBlock( TTEFItemArray* aItemArray, const TInt aScriptLineNumber ) = 0;
+	IMPORT_C virtual void SetLoggerOptions(TInt aLogMode) = 0;
+	IMPORT_C virtual TInt Connect() = 0;
+	IMPORT_C virtual void Close() = 0;
+	IMPORT_C virtual RTestExecuteLogServ& HtmlLogger() = 0;
+	IMPORT_C virtual RTestExecutePIPSLogServ& PIPSLogger() = 0;
+	IMPORT_C virtual RFileFlogger& XmlLogger() = 0;
+	IMPORT_C virtual TInt ShareAuto() = 0;
+	IMPORT_C virtual void Write(const TDesC& aLogBuffer) = 0;
+	IMPORT_C virtual void WriteFormat(TRefByValue<const TDesC> aFmt,...) = 0;
+	IMPORT_C virtual void Write(const TDesC8& aLogBuffer) = 0;
+	IMPORT_C virtual void WriteFormat(TRefByValue<const TDesC8> aFmt,...) = 0;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecutelogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,189 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TestExecuteLogger.h
+*/
+
+#if !(defined __TESTEXECUTE_LOGGER_H__)
+#define __TESTEXECUTE_LOGGER_H__
+
+#include <e32base.h>
+#include <e32cons.h>
+#include <f32file.h>
+#include <test/testexecutelogbase.h>
+#include <iniparser.h>
+#include <test/blockitems.h>
+#include <test/tefscriptutils.h>
+#include <test/teftestreport.h>
+
+class CSerialWriter;
+/**
+ * @internalComponent
+ * @test
+ */
+class CTestExecuteIniData : public CBase
+	{
+public:
+	IMPORT_C CTestExecuteIniData();
+	IMPORT_C ~CTestExecuteIniData();
+	IMPORT_C static CTestExecuteIniData* NewL();
+	IMPORT_C static CTestExecuteIniData* NewLC();
+	IMPORT_C void ConstructL();
+	IMPORT_C void ExtractValuesFromIni();
+	IMPORT_C void GetKeyValueFromIni(const TDesC& aKeyName, TDes& aValue);
+	IMPORT_C void GetKeyValueFromIni(const TDesC& aKeyName, TInt& aValue);
+	IMPORT_C CTestExecuteIniData(TDriveName& aSysDrive);
+	IMPORT_C static CTestExecuteIniData* NewL(TDriveName& aSysDrive);
+	IMPORT_C static CTestExecuteIniData* NewLC(TDriveName& aSysDrive);
+private:
+	CIniData* iConfigData;
+	TPtrC iHtmlLogPath;
+	TPtrC iXmlLogPath;
+	TPtrC iDefaultScriptDirectory;
+	TInt iLogSeverity;
+	TInt iLoggerOptions;
+	TInt iJustInTime;
+	TInt iRemotePanicDetection;
+	TInt iEnableIniAccessLog;
+	TInt iEnableTestsCountLog;
+	TInt iEnableSystemStarter;
+	TInt iLoggerChannel;
+	TInt iPortNumber;
+	TDriveName iDefaultSysDrive;
+	TPtrC iIniSysDriveName;
+	TInt iWaitForLoggingTime;
+	};
+
+/**
+ * Override of base class virtual for TEF logger implementation
+ * @internalComponent
+ * @test
+ */
+class CTestExecuteLogger : public MTestExecuteLogBase
+	{
+public:
+	IMPORT_C CTestExecuteLogger(TLoggerOptions aLogOptions=ELogHTMLOnly);
+	IMPORT_C ~CTestExecuteLogger();
+	IMPORT_C void LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt,...);
+	IMPORT_C void LogToXml(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aCommandName, const TInt aNumberOfParams, TExtraLogField* aLogFields);
+	IMPORT_C void LogToXml(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aCommandName);
+	IMPORT_C void InitialiseLoggingL(const TDesC& aScriptFilePath, TBool aSeparateLogFileMode, TInt aLogLevel);
+	
+	IMPORT_C void TerminateLoggingL(const TInt aCommentedCommandsCount, const TInt aRemotePanicsCount, const TInt aRunScriptFailCount);
+	IMPORT_C void LogTestCaseResult(const TDesC& aFile, TInt aLine, TInt aSeverity, const TDesC& aCommand, const TDesC& aTestCaseName, TVerdict aResult = EPass);
+	IMPORT_C void PrintCurrentScriptLine(TDes& aCurrentScriptLine);
+	IMPORT_C void LogResult(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,const TDesC& aScriptFile,TInt aSeverity);
+	IMPORT_C TVerdict LogBlock( TTEFItemArray* aItemArray, const TInt aScriptLineNumber );
+	IMPORT_C void SetLoggerOptions(TInt aLogMode);
+	IMPORT_C TInt Connect();
+	IMPORT_C void Close();
+	inline RTestExecuteLogServ& HtmlLogger() { return iHtmlLogger; };
+	inline RTestExecutePIPSLogServ& PIPSLogger() { return iPIPSLogger; };
+	inline RFileFlogger& XmlLogger() { return iXmlLogger; };
+	IMPORT_C TInt ShareAuto();
+
+	// Legacy methods provided for backwards compatibility
+	// These only log to the html log file
+	IMPORT_C void Write(const TDesC& aLogBuffer);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC> aFmt,...);
+	IMPORT_C void Write(const TDesC8& aLogBuffer);
+	IMPORT_C void WriteFormat(TRefByValue<const TDesC8> aFmt,...);
+	IMPORT_C static CTestExecuteLogger* NewL(TLoggerOptions aLogOptions=ELogHTMLOnly);
+	IMPORT_C static CTestExecuteLogger* NewLC(TLoggerOptions aLogOptions=ELogHTMLOnly);
+	IMPORT_C void SetLoggerChannel(TInt aLogChannel);
+	IMPORT_C void SetPipeName(TPtrC& aPipeName) ;
+	void OpenSerialPortL(const TInt aPortNumber);
+protected:
+	// parse the script string(!PanicString)
+	TBool ParsePaincStringFromScriptCommandLine(const TDesC& aCommandStr,TLex& aScriptLineParamLex,TDes& aTEFPanicString);
+private:
+	// Connects to the HTML log client session and creating the logs with initial tags for logging
+	void InitialiseHTMLLoggingL(const TDesC& aLogFilePath, TInt aLogLevel, const TInt& aEnableCommandCount, CScriptPreProcess& aScriptPreProcess);
+	void InitialisePIPSLoggingL(TInt aLogLevel, const TInt& aEnableCommandCount, CScriptPreProcess& aScriptPreProcess);
+	// Connects to the XML log client session and creates the logs in the path passed in
+	// Also sets in the default threshold for log level
+	void InitialiseXMLLoggingL(const TDesC& aLogFilePath, TInt aLogLevel, const TInt& aEnableCommandCount, CScriptPreProcess& aScriptPreProcess);
+	void TerminateHTMLLoggingL(RFile* aLogFile, const TInt aCommentedCommandsCount, const TInt aRemotePanicsCount, const TInt aRunScriptFailCount);
+	void TerminateXMLLoggingL(const TInt aCommentedCommandsCount, const TInt aRemotePanicsCount, const TInt aRunScriptFailCount);
+	TVerdict LogHTMLBlockL( const TTEFItemArray& aItemArray );
+	TVerdict LogXMLBlock( const TTEFItemArray& aItemArray, const TInt aScriptLineNumber );
+	void InitialiseSerialLoggingL(TInt aLogLevel, const TInt& aEnableCommandCount, CScriptPreProcess& aScriptPreProcess, TInt portNumber);	
+	void LogTestCaseResultSerialL(const TDesC& aFile, TInt aLine, TInt aSeverity, const TDesC& aCommand, const TDesC& aTestCaseName, TVerdict aResult = EPass);
+	void LogResultSerialL(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,const TDesC& aScriptFile);
+	void LogResultFileL(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,const TDesC& aScriptFile, TInt aSeverity);
+	void LoggingTestCaseResultToSummaryResultL( const TDesC &aLogFileDir,const TDesC &aLogFileName,const TDesC8 &aResultBuf);
+	// Initialise Test Report. This report output as STF's test report format.
+	void InitialiseTestReportL(const TDesC& aTEFTestReportFileName);
+	// Add case result to test report
+	void AddTestReportL(const TDesC& aTestCaseName, TTime aCaseStartTime, TTime aCaseEndTime, TVerdict aResult);
+	
+private:
+	// HTML Log client session
+	RTestExecuteLogServ iHtmlLogger;
+	RTestExecutePIPSLogServ iPIPSLogger;
+	// XML Log client session
+	RFileFlogger iXmlLogger;
+	TInt iLoggerOptions;
+	// Member variables to perform TerminateLogging
+	// Set up some vars for the test step result types
+	TInt iPassCount;
+	TInt iFailCount;
+	TInt iAbortCount;
+	TInt iUnknownCount;
+	TInt iInconclusiveCount;
+	TInt iPanicCount;
+	TInt iUnexecutedCount;
+
+	// Set up some vars for the RUN_PROGRAM result types
+	TBool iRunProgramUsed;
+	TInt iRunProgramPassCount;
+	TInt iRunProgramFailCount;
+	TInt iRunProgramAbortCount;
+	TInt iRunProgramUnknownCount;
+	TInt iRunProgramInconclusiveCount;
+	TInt iRunProgramPanicCount;
+	TInt iRunProgramUnexecutedCount;
+
+	// Set up some vars for the testcase result types
+	TBool iTestCasesUsed;
+	TInt iTestCasePassCount;
+	TInt iTestCaseFailCount;
+	TInt iTestCaseInconclusiveCount;
+	
+	// Log file paths for HTML & XML
+	TBuf<KMaxTestExecuteNameLength> iHtmlLogPath;
+	TBuf<KMaxTestExecuteNameLength> iXmlLogPath;
+	TInt iRemotePanic; // Flag to retrieve status of Remote Panic Detection from testexecute.ini
+	TInt iRunScriptCommandCount; // Count of number of RUN_SCRIPT commands in the main script executed
+	CSerialWriter *iSerialWriter ; 
+	TInt iPortNumber ; 
+	TInt iLoggerChannel;
+	TInt iTestCaseSkippedCount;
+	TBool iPIPSExists ; 
+	
+	// Log test report
+	TTEFTestReportSettings iTestReportSettings;
+	CTEFTestReport* iTestReport;
+	TInt iCaseNumber;
+	TTime iCaseStartTime;
+	TTime iCaseEndTime;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecuteserverbase.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestServer which is the base class for all test servers
+*
+*/
+
+
+
+/**
+ @file TestExecuteServerBase.h
+*/
+#if (!defined __TESTEXECUTE_SERVER_BASE_H__)
+#define __TESTEXECUTE_SERVER_BASE_H__
+
+#include <e32base.h>
+#include <test/testexecutestepbase.h>
+
+class CTestServer : public CServer2
+/**
+@publishedPartner
+@test
+*/
+	{
+public:
+	IMPORT_C virtual ~CTestServer();
+	IMPORT_C CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
+	IMPORT_C virtual void ConstructL(const TDesC& aName);
+	void StartLoggerL();
+
+	/**
+	 * Creates the test step.
+	 *
+	 * @param aStepName - test step name to run.
+	 *
+	 * @return - A CTestStep derived instance
+	 */
+	virtual CTestStep* CreateTestStep(const TDesC& aStepName) = 0;
+
+	void SessionClosed();
+	TInt64& RandSeed() {return iSeed;};
+	inline CTestExecuteLogger& Logger() {return iLogger;};
+	inline const TDesC& Name() const {return iServerName;};
+	inline TBool LoggerStarted() { return iLoggerStarted; };
+protected:
+	IMPORT_C CTestServer();
+	inline void IncSessionCount() {++iSessionCount;};
+protected:
+private:
+	TInt64	iSeed;
+	TInt	iSessionCount;
+	CTestExecuteLogger iLogger;
+	TBool iLoggerStarted;
+	TBuf<KMaxTestExecuteNameLength> iServerName;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecuteserverutils.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2005-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:  
+* Definitions of classes local to TestExecuteUtils
+*
+*/
+
+
+
+/**
+ @file TestExecuteServerUtils.h
+*/
+
+#if (!defined __SERVER_UTILS_H__)
+#define __SERVER_UTILS_H__
+#include <test/testexecuteserverbase.h>
+#include <test/testexecutestepbase.h>
+
+class CActiveBase : public CActive
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	inline 	TRequestStatus& Status();
+	inline 	void SetActive();
+	inline	void Kick();
+	inline	void Prime();
+	inline	void Complete(TInt aCode);
+	inline	virtual ~CActiveBase();
+	inline  TDes& Error();
+	inline TBool& TimedOut();
+protected:
+	inline	CActiveBase();
+	TBuf<KMaxTestExecuteNameLength> iError;
+	TBool iTimeOut;
+	};
+
+class CControlBase : public CActiveBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	inline CControlBase(CTestServer& aServer);
+	inline void DoCancel();
+	virtual void Stop() =0;
+	inline CTestServer& Server();
+	inline TDes& Args();
+	inline RMessage2& Message();
+	inline RThread& WorkerThread();
+private:
+	CTestServer&						iServer;
+	RMessage2							iMessage;
+	RThread								iWorkerThread;
+	TBuf<KMaxTestExecuteCommandLength>	iArgs;
+	};
+	
+	
+class CStepControlBase : public CControlBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	inline CStepControlBase(CTestServer& aServer);
+	virtual void StartL(const RMessage2& aMessage,const TDesC& aStepArgs) = 0;
+	inline TDes& StepName();
+private:
+	RMessage2 iMessage;
+	RThread iWorkerThread;
+	TBuf<KMaxTestStepNameLength> iStepName;
+	};
+
+class CBlockControlBase : public CControlBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	inline CBlockControlBase(CTestServer& aServer);
+	~CBlockControlBase();
+	virtual void StartL(const RMessage2& aMessage,const TDesC& aArgs, const TDesC8& aBlockArrayPtr) = 0;
+	virtual TTEFItemArray*	BlockArray() const;
+
+protected:
+	virtual void			CreateBlockArrayL( const TDesC8& aBlockArrayPtr );
+	virtual HBufC8*			CreateBlockArrayPckgLC();
+	
+private:
+	TTEFItemArray*						iBlockArray;
+	RMessage2							iMessage;
+	RThread								iWorkerThread;
+	TBuf<KMaxTestExecuteCommandLength>	iBlockArgs;
+	};
+
+class CStepControl : public CStepControlBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	CStepControl(CTestServer& aServer, const TDesC& aStepName);
+	void RunL();
+	void StartL(const RMessage2& aMessage,const TDesC& aStepArgs);
+	void Stop();
+	~CStepControl();
+private:
+	};
+
+class CBlockControl : public CBlockControlBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	CBlockControl(CTestServer& aServer);
+	void RunL();
+	void StartL(const RMessage2& aMessage,const TDesC& aArgs, const TDesC8& aBlockArrayPtr);
+	void Stop();
+	~CBlockControl();
+	};
+
+class CWorkerMonitor;
+class CWorkerControl;
+class CPersistentStepControl : public CStepControlBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	CPersistentStepControl(CTestServer& aServer);
+	virtual ~CPersistentStepControl();
+	void StartL(const RMessage2& aMessage,const TDesC& aStepArgs);
+	void RunL();
+	void Stop();
+	inline void ChildCompletion();
+private:
+	CWorkerControl* iWorkerControl;
+	CWorkerMonitor* iWorkerMonitor;
+	TBool iInitialised;
+	};
+
+class CBlockWorkerControl;
+class CPersistentBlockControl : public CBlockControlBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	CPersistentBlockControl(CTestServer& aServer);
+	virtual ~CPersistentBlockControl();
+	void StartL(const RMessage2& aMessage,const TDesC& aArgs, const TDesC8& aBlockArrayPtr);
+	void RunL();
+	void Stop();
+	inline void ChildCompletion();
+
+private:
+	CBlockWorkerControl* 	iWorkerControl;
+	CWorkerMonitor* 		iWorkerMonitor;
+	TBool					iInitialised;
+	};
+
+class CWorkerMonitor : public CActiveBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	inline CWorkerMonitor(TRequestStatus& aParentStatus);
+	inline virtual ~CWorkerMonitor();
+	inline void RunL();
+	inline void DoCancel();
+private:
+	TRequestStatus& iParentStatus;
+	};
+
+class CWorkerControl : public CActiveBase
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	inline CWorkerControl(CTestServer& aServer,TRequestStatus& aParentStatus);
+	inline ~CWorkerControl();
+	inline void RunL();
+	inline void DoCancel();
+	inline TRequestStatus& WorkerStatus();
+	inline RThread& ControllerThread();
+	inline RSemaphore& Semaphore();
+	inline CTestServer& Server();
+	inline TInt& Result();
+	inline TPtrC& Args();
+	inline TPtrC& StepName();
+	inline TDes& PersistentError();
+	//defect 116046
+	inline void SetCleanupPtr(CTrapCleanup* aCleanup);
+	inline void Cleanup();
+	//END defect 116046
+private:
+	CTestServer& iServer;
+	TRequestStatus& iParentStatus;
+	RSemaphore iSemaphore;
+	TRequestStatus iWorkerStatus;
+	RThread iControllerThread;
+	TPtrC iArgs;
+	TPtrC iStepName;
+	TInt iResult;
+	TBuf<KMaxTestExecuteNameLength> iPersistentError;
+	//defect 116046
+	CTrapCleanup* iCleanup;
+	//END defect 116046
+	};
+
+class CBlockWorkerControl : public CWorkerControl
+/**
+@internalTechnology
+@test
+*/
+	{
+public:
+	inline CBlockWorkerControl(CTestServer& aServer,TRequestStatus& iParentStatus );
+	inline ~CBlockWorkerControl();
+	inline void				SetBlockArray( TTEFItemArray* aBlockArray );
+	inline TTEFItemArray*	BlockArray() const;
+
+private:
+	TTEFItemArray*			iBlockArray;
+	};
+	
+class CTestSession : public CSession2
+/**
+@publishedPartner
+@test
+*/
+	{
+public:
+	IMPORT_C CTestSession();
+	IMPORT_C virtual ~CTestSession();
+	IMPORT_C virtual void ServiceL(const RMessage2& aMessage);
+private:
+	CPersistentStepControl*		iPersistentStepControl;
+	CPersistentBlockControl*	iPersistentBlockControl;
+	TTEFItemArray*				iBlockArray;
+	};
+
+#include <test/testexecuteserverutils.inl>
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecuteserverutils.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+
+inline TRequestStatus& CActiveBase::Status()
+	{
+	return iStatus;
+	}
+
+inline void CActiveBase::SetActive()
+	{
+	if (!IsActive())
+		CActive::SetActive();
+	}
+
+inline void CActiveBase::Kick()
+	{
+	Prime();
+	Complete(KErrNone);
+	}
+
+inline void CActiveBase::Prime()
+	{
+	iStatus = KRequestPending;
+	if (!IsActive())
+		CActive::SetActive();
+	}
+
+inline void CActiveBase::Complete(TInt aCode)
+	{
+	TRequestStatus* status = &iStatus;
+	User::RequestComplete(status, aCode);
+	}
+
+inline CActiveBase::CActiveBase() :
+	CActive(EPriorityStandard)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+inline CActiveBase::~CActiveBase()
+	{
+	}
+
+inline TDes& CActiveBase::Error()
+	{
+	return iError;
+	}
+
+inline TBool& CActiveBase::TimedOut()
+	{
+	return iTimeOut;
+	}
+
+///////
+
+inline CControlBase::CControlBase(CTestServer& aServer) :
+	iServer(aServer)
+	{
+	}
+
+inline CTestServer& CControlBase::Server()
+	{
+	return iServer;
+	}
+
+inline TDes& CControlBase::Args()
+	{
+	return iArgs;
+	}
+
+inline RMessage2& CControlBase::Message()
+	{
+	return iMessage;
+	}
+
+inline RThread& CControlBase::WorkerThread()
+	{
+	return iWorkerThread;
+	}
+
+inline void CControlBase::DoCancel()
+	{
+	}
+
+///////
+
+inline void CPersistentStepControl::ChildCompletion()
+	{
+	Complete(KErrNone);
+	}
+
+///////
+
+inline void CPersistentBlockControl::ChildCompletion()
+	{
+	Complete(KErrNone);
+	}
+
+///////
+
+inline CWorkerMonitor::CWorkerMonitor(TRequestStatus& aParentStatus) :
+	iParentStatus(aParentStatus)
+	{
+	}
+
+inline CWorkerMonitor::~CWorkerMonitor()
+	{
+	}
+
+inline void CWorkerMonitor::RunL()
+	{
+	TRequestStatus* status = &iParentStatus;
+	User::RequestComplete(status, KErrNone);
+	}
+
+inline void CWorkerMonitor::DoCancel()
+	{
+	}
+
+///////
+
+inline CWorkerControl::CWorkerControl(CTestServer& aServer,
+		TRequestStatus& aParentStatus) :
+	iServer(aServer), iParentStatus(aParentStatus)
+	{
+	}
+
+inline CWorkerControl::~CWorkerControl()
+	{
+	}
+
+inline void CWorkerControl::RunL()
+	{
+	TRequestStatus* status = &iParentStatus;
+	User::RequestComplete(status, KErrNone);
+	}
+
+inline void CWorkerControl::DoCancel()
+	{
+	}
+
+inline TRequestStatus& CWorkerControl::WorkerStatus()
+	{
+	return iWorkerStatus;
+	}
+
+inline RThread& CWorkerControl::ControllerThread()
+	{
+	return iControllerThread;
+	}
+
+inline RSemaphore& CWorkerControl::Semaphore()
+	{
+	return iSemaphore;
+	}
+
+inline CTestServer& CWorkerControl::Server()
+	{
+	return iServer;
+	}
+
+inline TInt& CWorkerControl::Result()
+	{
+	return iResult;
+	}
+
+inline TPtrC& CWorkerControl::Args()
+	{
+	return iArgs;
+	}
+
+inline TPtrC& CWorkerControl::StepName()
+	{
+	return iStepName;
+	}
+
+inline TDes& CWorkerControl::PersistentError()
+	{
+	return iPersistentError;
+	}
+
+//defect 116046
+inline void CWorkerControl::SetCleanupPtr(CTrapCleanup* aCleanup)
+	{
+	iCleanup = aCleanup;
+	}
+
+inline void CWorkerControl::Cleanup()
+	{
+	if (iCleanup)
+		delete iCleanup;
+	iCleanup = NULL;
+	}
+//END defect 116046
+
+///////
+
+inline CBlockWorkerControl::CBlockWorkerControl(CTestServer& aServer,
+		TRequestStatus& aParentStatus) :
+	CWorkerControl(aServer, aParentStatus)
+	{
+	}
+
+inline CBlockWorkerControl::~CBlockWorkerControl()
+	{
+	}
+
+inline void CBlockWorkerControl::SetBlockArray(TTEFItemArray* aBlockArray)
+	{
+	iBlockArray = aBlockArray;
+	}
+
+inline TTEFItemArray* CBlockWorkerControl::BlockArray() const
+	{
+	return iBlockArray;
+	}
+
+///////
+
+inline CStepControlBase::CStepControlBase(CTestServer& aServer) :
+	CControlBase(aServer)
+	{
+	}
+
+inline TDes& CStepControlBase::StepName()
+	{
+	return iStepName;
+	}
+
+///////
+
+inline CBlockControlBase::CBlockControlBase(CTestServer& aServer) :
+	CControlBase(aServer), iBlockArray(NULL)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testexecutestepbase.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2005-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:  
+* This contains CTestStep which is the base class for all test steps.
+*
+*/
+
+
+
+/**
+ @file TestExecuteStepBase.h
+*/
+#if (!defined __TESTEXECUTE_STEP_BASE_H__)
+#define __TESTEXECUTE_STEP_BASE_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include <iniparser.h>
+#include <test/testexecutelogger.h>
+#include <test/testexecuteclient.h>
+#include <test/tefshareddata.h>
+#include <test/testshareddata.h>
+
+class CTestStep : public CBase
+/**
+@publishedPartner
+@test
+*/
+	{
+public:
+	// Destructor
+	IMPORT_C virtual ~CTestStep();
+
+	// Get methods to read values from the ini file
+	IMPORT_C TBool GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult);
+	IMPORT_C TBool GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
+	IMPORT_C TBool GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
+
+	// Set a user-friendly test step name referred for a test step object from the script file
+	IMPORT_C void SetTestStepName(const TDesC& aStepName);
+
+	IMPORT_C TBool GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
+	
+	// Set the actual test step error obtained to execution of test step to compare the expected error with the actual
+	IMPORT_C void SetTestStepError(const TInt& aErrorCode);
+
+	// Write methods to write values into ini file
+	IMPORT_C TBool WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue);
+	IMPORT_C TBool WriteStringToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TPtrC& aValue);
+	IMPORT_C TBool WriteBoolToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TBool& aValue);
+	IMPORT_C TBool WriteHexToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue);
+
+	//Updates the data to the shared data name passed either in Copy Mode/Append Mode
+	IMPORT_C void WriteSharedDataL(const TDesC& aShareName, TDesC& aSharedDataVal, TModeCopy aModeCopy = ESetText);
+	//Reads the data from the specified shared data object
+	IMPORT_C void ReadSharedDataL(const TDesC& aShareName, TDes& aSharedDataVal);
+
+	// Initialise the test step during cnstruction
+	void InitialiseL(const TDesC& aStepArgs, const TDesC& aServerName, TBool& aSharedDataMode);
+
+	// Initialises logger instance for the test step
+	void SetLoggerL();
+
+	// Closes the logger instance for the test step
+	void CloseLogger();
+
+	// Returns the section name specified in the script file for the current test step execution
+	inline TDes& ConfigSection() {return iSection;};
+
+	// Set the result of test step execution  to one of the TVerdict enum codes
+	inline void SetTestStepResult(TVerdict aVerdict) {iTestStepResult = aVerdict;};
+
+	// Returns the test step result at any point during execution of test step
+	inline TVerdict TestStepResult() const {return iTestStepResult;};
+
+	// Logger interface used for constructing result strings to be fed for the logger instance
+	inline CTestExecuteLogger& Logger() {return *iLogger;};
+
+	// Returns the user-friendly test step name
+	inline const TDesC& TestStepName() const {return iTestStepName;};
+
+	// Returns any error code set during the test step execution
+	inline const TInt& TestStepError() const {return iTestStepError;};
+
+	// Returns the boolean true of !OOM option is set from the script file, false otherwise
+	inline TBool& ShouldRunOOMTest() {return iOOMRequestStatus;};
+
+	// Returns true if test server is loaded using -SharedData mode from the script file
+	inline TBool& IsSharedDataMode() {return iSharedDataMode;};
+
+	// Returns the loop index of the current loop if the test runs within a START_REPEAT/EN_REPEAT block
+	// Returns -1 if test is not within a loop
+	inline TInt GetLoopIndex() {return iLoopIndex;};
+
+	// Returns the setup value set using !Setup TEF parameter within the script file
+	// Returns a value 0 if !Setup TEF parameter is not used
+	inline TInt GetSetupState() {return iSetupParamValue;};
+
+	// Returns the drive name from which the current script file is executed
+	inline TDriveName ScriptDriveName() { return iScriptDriveName;};
+
+	// Returns reference to the iEnableIniAccessLog bool which can be used by tests to switch off ini access logging on the run
+	inline TBool& IniAccessLog() { return iEnableIniAccessLog; };
+
+	// Returns the default system drive letter provided by call to RFs::GetSystemDrive()
+	inline TDriveName GetSystemDrive() { return iSystemDriveForTest; };
+
+	// Test Step virtuals - Test Implementation methods
+	IMPORT_C virtual enum TVerdict	doTestStepL() = 0;
+	IMPORT_C virtual enum TVerdict	doTestStepPreambleL();
+	IMPORT_C virtual enum TVerdict	doTestStepPostambleL();
+
+	// Setting simulated OOM and testing whether the code under test reached the simulated failure
+	IMPORT_C virtual void SetHeapFailNext(TInt aFailureIndex);
+	IMPORT_C virtual void ResetHeapFailNext();
+	IMPORT_C virtual TBool CheckForHeapFailNext();
+	
+	// LEGACY methods
+	IMPORT_C void testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine);
+	IMPORT_C void testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine, TBool IgnoreStepResult);
+	IMPORT_C void testBooleanTrueL(TBool aCondition, const TText8* aFile, TInt aLine);
+	IMPORT_C void testBooleanTrueL(TBool aCondition, const TText8* aFile, TInt aLine, TBool IgnoreStepResult);
+	IMPORT_C void testBooleanTrueWithErrorCode(TBool aCondition, TInt aErrorCode, const TText8* aFile, TInt aLine );
+	IMPORT_C void testBooleanTrueWithErrorCode(TBool aCondition, TInt aErrorCode, const TText8* aFile, TInt aLine, TBool IgnoreStepResult);
+	IMPORT_C void testBooleanTrueWithErrorCodeL(TBool aCondition, TInt aErrorCode,
+													const TText8* aFile, TInt aLine );
+	IMPORT_C void testBooleanTrueWithErrorCodeL(TBool aCondition, TInt aErrorCode,
+													const TText8* aFile, TInt aLine, TBool IgnoreStepResult );
+	IMPORT_C void TestCheckPointCompareL(TInt aVal, TInt aExpectedVal, const TDesC& aText, const TText8* aFile, TInt aLine);
+
+	// Retrieve the server name
+	IMPORT_C const TDesC& GetServerName() const;
+
+	// Retrieve the test case name/id
+	IMPORT_C TBool TestCaseName(TDes& aTestCaseName);
+
+protected:
+	IMPORT_C CTestStep();
+public:
+	IMPORT_C TBool GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt64& aResult);
+	IMPORT_C TBool WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt64& aValue);
+private:
+	void LoadConfigFileL(const TDesC& aFilePath);
+private:
+	CTestExecuteLogger*					iLogger;
+	TVerdict							iTestStepResult;
+	TBuf<KMaxTestExecuteNameLength>		iSection;
+	CIniData*							iConfigData;
+	TBuf<KMaxTestStepNameLength>	    iTestStepName;		// Name of the test step
+	TBuf<KMaxTestExecuteNameLength>		iServerName;		// Name of the test server
+	TInt								iTestStepError;		// Expected Test step Error
+	HBufC*								iIniFileName;		// Name of the inifile to be use for logging.
+	TBool								iOOMRequestStatus;	// Status of OOM request from user
+	TBool								iEnableIniAccessLog;// Testexecute.ini entry for logging INI access
+	TBool								iSharedDataMode;	// Flag representing -SharedData server mode
+	TInt								iSetupParamValue;	// TEFParameter !Setup value set in the script
+	TInt								iLoopIndex;			// Loop index of the current loop if test runs within a START_REPEAT
+	TBuf<KMaxTestExecuteNameLength>		iTestCaseID;		// Name/ID of the test case in which the current test step executes
+	TDriveName							iScriptDriveName;	// Drive name from where the script file is executed
+	TDriveName							iSystemDrive;		// Default System Drive name
+	TDriveName							iSystemDriveForTest;// System Drive name for Test artifacts
+
+	// Use this buffer when allocating additional memory for the class in future
+	// To avoid breaks with other depdenant comps
+	TBuf<KMaxTestStepNameLength>		iReserved4Future1;
+	TBuf<KMaxTestStepNameLength>		iReserved4Future2;
+	TBuf<KMaxTestStepNameLength>		iReserved4Future3;
+	TBuf<KMaxTestStepNameLength>		iReserved4Future4;
+	};
+
+// LEGACY
+// Autotest macros mapped to CTestStep functions
+
+// Check a boolean is true
+#define TESTL(a) testBooleanTrueL((a), (TText8*)__FILE__, __LINE__) 
+#define TEST(a)  testBooleanTrue((a), (TText8*)__FILE__, __LINE__) 
+
+// Versions that will always log irrespective of testcase pass
+#define TEST1L(a, b) testBooleanTrueL((a), (TText8*)__FILE__, __LINE__, (b) ) 
+#define TEST1(a, b)  testBooleanTrue((a), (TText8*)__FILE__, __LINE__, (b) ) 
+
+// Check a boolean is true if not return error code b
+#define TESTE(a, b) testBooleanTrueWithErrorCode((a), (b), (TText8*)__FILE__, __LINE__) 
+#define TESTEL(a, b) testBooleanTrueWithErrorCodeL((a), (b), (TText8*)__FILE__, __LINE__)  
+
+// Versions that will always log irrespective of testcase pass
+#define TESTE1(a, b, c) testBooleanTrueWithErrorCode((a), (b), (TText8*)__FILE__, __LINE__, (c) ) 
+#define TESTE1L(a, b, c) testBooleanTrueWithErrorCodeL((a), (b), (TText8*)__FILE__, __LINE__, (c) )  
+
+#define TEST_CHECKL(p1, p2, p3) TestCheckPointCompareL((p1), (p2), (p3), (TText8*)__FILE__, __LINE__)	
+// Leave error code
+#define TEST_ERROR_CODE 84	
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testserver2.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains TestServer2.h
+*
+*/
+
+
+
+#ifndef __TEST_SERVER_2_H__
+#define __TEST_SERVER_2_H__
+
+#include <test/testexecuteserverbase.h>
+#include <test/blockitems.h>
+#include <test/activecallback.h>
+#include <test/testblockcontroller.h>
+#include <test/datadictionary.h>
+
+class CTestServer2 : public CTestServer, public MSharedData
+/**
+ * @publishedPartner
+ * @test
+ *
+ * @see		CTestServer
+ * @see		MSharedData
+ *
+ * Test server that includes test block processing
+ */
+	{
+private:
+	struct TDataElement
+		{
+		TAny*				iAny;
+		TCleanupOperation	iCleanupOperation;
+		};
+	typedef RHashMap<TDataDictionaryName, TDataElement>		RDataStore;
+	typedef THashMapIter<TDataDictionaryName, TDataElement>	TDataIter;
+
+public:
+	IMPORT_C				CTestServer2();
+	IMPORT_C virtual		~CTestServer2();
+	IMPORT_C void			ConstructL();
+
+	/**
+	 * Create a test block
+	 *
+	 * @see		CTestBlockController
+	 */
+	IMPORT_C virtual CTestBlockController*	CreateTestBlock() =0;
+
+	// CTestServer implementation
+	IMPORT_C virtual CTestStep*				CreateTestStep(const TDesC& aStepName);
+
+	// MSharedData implementation
+	IMPORT_C virtual void	CreateActiveSchedulerL();
+	IMPORT_C virtual void	DeleteActiveSchedulerL();
+	IMPORT_C virtual TAny*	GetObjectAndOwnL(const TDesC& aName);
+	IMPORT_C virtual void	PutAndDisownL(const TDesC& aName, TAny* aAny, TCleanupOperation aCleanupOperation);
+
+private:
+	static TUint32	Hash(const TDataDictionaryName& aName);
+	static TBool	Identity(const TDataDictionaryName& aName1, const TDataDictionaryName& aName2);
+
+private:
+	RDataStore			iStore;
+	CActiveScheduler*	iActiveScheduler;
+	};
+
+#endif // __TEST_SERVER_2_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testshareddata.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2005-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:  
+* Demonstrate a container class with data objects
+* This class object is shared using the CTEFSharedData template object
+*
+*/
+
+
+
+/**
+ @file TestSharedData.h
+*/
+
+#if !(defined __TEST_SHARED_DATA_H__)
+#define __TEST_SHARED_DATA_H__
+#include "e32std.h"
+
+// Constant
+const TInt KMaxSharedDataLength = 255;
+
+class CTestSharedData : public CBase
+
+/**
+ * Demonstrate a container class with data objects
+ * This class object is shared using the CTEFSharedData template object
+
+ @internalComponent
+ @test
+*/
+ 	{
+public:
+	CTestSharedData();
+	~CTestSharedData();
+	// Initializes the member variable
+	inline void Construct();
+	// Copies the values to member varible
+	inline void SetText(TDesC& aVal);
+	// Appends the text to member variable
+	inline void AppendText(TDesC& aVal);
+	// Reads the text from member varibale
+	inline void GetText(TDes& aVal);
+	// Returns the length of the text
+	inline TInt TextLength(){return User::StringLength(iText);}
+private:
+	// Member Variable
+	TText	iText[KMaxSharedDataLength];
+	};
+
+#include <test/testshareddata.inl>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testshareddata.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2005-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:  
+* Implementation of Test structured data class for sharing between process
+* Initialises the member variable with zero
+*
+*/
+
+
+
+/**
+ @file TestSharedData.cpp
+*/
+void CTestSharedData::Construct()
+	{
+	// Initialise the data member
+	for (TInt index = 0; index < KMaxSharedDataLength; index++)
+		{
+		iText[index] = 0;
+		}
+	}
+
+/**
+ * Copies the data input to the shared TText member for sharing
+ * @param aVal - Descriptor containing the string to be set to the member data
+ */
+void CTestSharedData::SetText(TDesC& aVal)
+	{
+	TInt length = aVal.Length();
+	if (length < KMaxSharedDataLength)
+		{
+		for (TInt index = 0; index < length; index++)
+			{
+			iText[index] = *(aVal.Mid(index,1).Ptr());
+			}
+		for (TInt nullIndex = length; nullIndex < KMaxSharedDataLength; nullIndex++)
+			{
+			iText[nullIndex] = 0;
+			}
+		}
+	else
+		{
+		User::Panic(_L("OutOfMemory"), KErrNoMemory);
+		}
+	}
+
+/**
+ * Appends the data input to the shared TText for sharing
+ * @param aVal - Descriptor containing the string to be appended to the member data
+ */
+void CTestSharedData::AppendText(TDesC& aVal)
+	{
+	TInt appendLength = aVal.Length();
+	TInt originalLength = User::StringLength(iText);;
+	TInt length = originalLength + appendLength;
+	if (length < KMaxSharedDataLength)
+		{
+		TInt midLocation = 0;
+		for (TInt index = originalLength; index < length; index++)
+			{
+			iText[index] = *(aVal.Mid(midLocation,1).Ptr());
+			midLocation++;
+			}
+		for (TInt nullIndex = length; nullIndex < KMaxSharedDataLength; nullIndex++)
+			{
+			iText[nullIndex] = 0;
+			}
+		}
+	else
+		{
+		User::Panic(_L("OutOfMemory"), KErrNoMemory);
+		}
+	}
+
+/**
+ * Copies the value within member data to the descriptor reference passed in
+ * @param aVal - Reference Descriptor which gets set with member data value
+ */
+void CTestSharedData::GetText(TDes& aVal)
+	{
+	TInt length = User::StringLength(iText);
+	TInt bufferLength = aVal.MaxLength();
+	if (bufferLength < length)
+		{
+		User::Panic(_L("OutOfMemory"), KErrNoMemory);
+		}
+
+	aVal.Zero();
+	for (TInt index = 0; index < length; index++)
+		{
+		aVal.Append(iText[index]);
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/version.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file Version.h
+*/
+
+#if !(defined __VERSION_H__)
+#define __VERSION_H__
+
+#include <e32base.h>
+
+/**
+@internalComponent
+@test
+
+To be updated with each submission done for the framework be it either a major realease/minor submissions/defect patches
+*/
+
+_LIT(KTEFProductVersion, "3.3.0001");
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/activecallback.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CActiveCallback
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+
+#include "activecallback.h"
+
+EXPORT_C CActiveCallback::~CActiveCallback()
+/**
+ * Destructor
+ */
+	{
+	Cancel();
+	}
+
+EXPORT_C CActiveCallback* CActiveCallback::NewL(MActiveCallback& aCallback, TInt aPriority)
+/**
+ * Two phase constructor that allocates and constructs
+ * a new Active object whos actions are performed by a callback
+ *
+ * @param	aCallback - object to inform on RunL.
+ * @param	aPriority - priority of active object.
+ *
+ * @see		MActiveCallback
+ *
+ * @leave	system wide error
+ *
+ * @return	New Callback active object.
+ */
+	{
+	CActiveCallback*	self=NewLC(aCallback, aPriority);
+	CleanupStack::Pop();
+	return self;
+	}
+
+EXPORT_C CActiveCallback* CActiveCallback::NewLC(MActiveCallback& aCallback, TInt aPriority)
+/**
+ * Two phase constructor that allocates and constructs
+ * a new Active object whos actions are performed by a callback
+ *
+ * @param	aCallback - object to inform on RunL.
+ * @param	aPriority - priority of active object.
+ *
+ * @see		MActiveCallback
+ *
+ * @leave	system wide error
+ *
+ * @return	New Callback active object.
+ */
+	{
+	CActiveCallback*	self=new(ELeave) CActiveCallback(aCallback, aPriority);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+EXPORT_C void CActiveCallback::Activate( TInt aIndex )
+/**
+ * Activate the object
+ *
+ * @param	aIndex - command index
+ */
+	{
+	iIndex = aIndex;
+	SetActive();
+	}
+
+EXPORT_C void CActiveCallback::KickState()
+/**
+ * Kick Start the object
+ */
+	{
+	TRequestStatus* status = &iStatus;
+	User::RequestComplete(status, KErrNone);
+	SetActive();
+	}
+
+EXPORT_C CActiveCallback::CActiveCallback(MActiveCallback& aCallback, TInt aPriority)
+/**
+ * Protected constructor with timer completion callback and priority.
+ *
+ * Called by two phase constructor.
+ *
+ * @param	aTestTimerCallback - object to inform on timer completion.
+ * @param	aPriority - priority of active object.
+ *
+ * @see		MActiveCallback
+ */
+:	CActive(aPriority)
+,	iCallback(aCallback)
+,	iIndex(0)
+	{
+	}
+
+EXPORT_C void CActiveCallback::ConstructL()
+/**
+ * This is internal and not intended for use.
+ *
+ * Second phase of two phase constructor.
+ *
+ * @leave	system wide error
+ */
+	{
+	CActiveScheduler::Add(this);
+	}
+
+EXPORT_C void CActiveCallback::RunL()
+/**
+ * Active object RunL implementation.
+ *
+ * Calls the MActiveCallback::RunL to inform user that the RunL has been reached.
+ *
+ * @see		MActiveCallback::RunL
+ * @leave	system wide error
+ */
+	{
+	iCallback.RunL(this,iIndex);
+	}
+
+EXPORT_C void CActiveCallback::DoCancel()
+/**
+ * Active object DoCancel implementation.
+ *
+ * Calls the MActiveCallback::DoCancel to inform user that the DoCancel has been reached.
+ *
+ * @see		MActiveCallback::DoCancel
+ */
+	{
+	iCallback.DoCancel(this,iIndex);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/commandprocessor.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CCommandProcessor
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+
+#include "commandprocessor.h"
+
+EXPORT_C CCommandProcessor::~CCommandProcessor()
+/**
+ * Destructor
+ */
+	{
+	Cancel();
+	}
+
+EXPORT_C CCommandProcessor* CCommandProcessor::NewL(MCommandProcessorCallback& aCallback, TInt aPriority)
+/**
+ * Two phase constructor that allocates and constructs
+ * a new Active object whos actions are performed by a callback
+ *
+ * @param	aCallback - object to inform on RunL.
+ * @param	aPriority - priority of active object.
+ *
+ * @leave	system wide error
+ *
+ * @see		MCommandProcessorCallback
+ *
+ * @return	New Callback active object.
+ */
+	{
+	CCommandProcessor*	self=NewLC(aCallback, aPriority);
+	CleanupStack::Pop();
+	return self;
+	}
+
+EXPORT_C CCommandProcessor* CCommandProcessor::NewLC(MCommandProcessorCallback& aCallback, TInt aPriority)
+/**
+ * Two phase constructor that allocates and constructs
+ * a new Active object whos actions are performed by a callback
+ *
+ * @param	aCallback - object to inform on RunL.
+ * @param	aPriority - priority of active object.
+ *
+ * @leave	system wide error
+ *
+ * @see		MCommandProcessorCallback
+ *
+ * @return	New Callback active object.
+ */
+	{
+	CCommandProcessor*	self=new(ELeave) CCommandProcessor(aCallback, aPriority);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+EXPORT_C void CCommandProcessor::Activate()
+/**
+ * Activate the object
+ */
+	{
+	SetActive();
+	}
+
+EXPORT_C void CCommandProcessor::KickState()
+/**
+ * Kick Start the object
+ */
+	{
+	TRequestStatus*	status = &iStatus;
+	User::RequestComplete(status, KErrNone);
+	SetActive();
+	}
+
+CCommandProcessor::CCommandProcessor(MCommandProcessorCallback& aCallback, TInt aPriority)
+/**
+ * Protected constructor with timer completion callback and priority.
+ *
+ * Called by two phase constructor.
+ *
+ * @param	aTestTimerCallback - object to inform on timer completion.
+ * @param	aPriority - priority of active object.
+ *
+ * @see		MCommandProcessorCallback
+ */
+:	CActive(aPriority)
+,	iCallback(aCallback)
+	{
+	}
+
+void CCommandProcessor::ConstructL()
+/**
+ * This is internal and not intended for use.
+ *
+ * Second phase of two phase constructor.
+ *
+ * @leave	system wide error
+ */
+	{
+	CActiveScheduler::Add(this);
+	}
+
+void CCommandProcessor::RunL()
+/**
+ * Active object RunL implementation.
+ *
+ * Calls the MCommandProcessorCallback::NextCommandL to inform user that the RunL has been reached.
+ *
+ * @leave	system wide error
+ */
+	{
+	iCallback.NextCommandL();
+	}
+
+void CCommandProcessor::DoCancel()
+/**
+ * Active object DoCancel implementation.
+ *
+ * Calls the MCommandProcessorCallback::DoCancel to inform user that the DoCancel has been reached.
+ */
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/datadictionary.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CDataDictionary
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+
+#include <e32std.h>
+
+#include "datadictionary.h"
+#include "datawrapper.h"
+
+TUint32 CDataDictionary::Hash(const TDataDictionaryName& aName)
+	{
+	return DefaultHash::Des16(aName);
+	}
+
+TBool CDataDictionary::Identity(const TDataDictionaryName& aName1, const TDataDictionaryName& aName2)
+	{
+	return aName1.Compare(aName2)==0;
+	}
+
+CDataDictionary::CDataDictionary()
+/**
+ * Constructor
+ */
+:	iStore(Hash, Identity)
+,	iCurrentObject(NULL)
+	{
+	}
+
+
+CDataDictionary::~CDataDictionary()
+/**
+ * Destructor
+ */
+	{
+	Empty();
+	}
+
+void CDataDictionary::AddDataL(const TDataDictionaryName& aName, CDataWrapper* aData)
+/**
+ * Add a data entry to the dictionary
+ *
+ * @param	aName - name of the dictionary entry
+ * @param	aData - the data to add. The dictionary becomes owner of the object
+ *			and is responsble for it's deletion
+ *
+ * @see		TDataDictionaryName
+ * @see		CDataWrapper
+ *
+ * @leave	KErrAlreadyExists if the dictionary entry aName, or aData already exists.
+ * @leave	KErrNoMemory if memory could not be allocated to store the copies of aName and aData.
+ * @leave	system wide errors
+ */
+	{
+	//	Ensure name does not already exist
+	if ( iStore.Find(aName) != NULL )
+		{
+		User::Leave(KErrAlreadyExists);
+		}
+
+	//	Ensure data does not already exist
+	TDataIter	iter(iStore);
+	iter.Reset();
+	for ( CDataWrapper*const * data=iter.NextValue(); data!=NULL; data=iter.NextValue() )
+		{
+		if ( aData == *data )
+			{
+			User::Leave(KErrAlreadyExists);
+			}
+		}
+
+	iStore.InsertL(aName, aData);
+	if ( iCurrentObject == NULL )
+		{
+		iCurrentObject=aData;
+		}
+	}
+
+void CDataDictionary::DeleteDataL(const TDataDictionaryName& aName)
+/**
+ * Delete a data entry from the dictionary
+ *
+ * @param	aName - name of the dictionary entry
+ *
+ * @see		TDataDictionaryName
+ *
+ * @leave	KErrNotFound if the dictionary entry aName is not found
+ */
+	{
+	//	Ensure name already exist
+	CDataWrapper**	wrapper=iStore.Find(aName);
+
+	if ( wrapper != NULL )
+		{
+		delete* wrapper;
+		iStore.Remove(aName);
+		}
+	else
+		{
+		User::Leave(KErrNotFound);
+		}
+	}
+
+void CDataDictionary::SetCurrentDataL(const TDataDictionaryName& aName)
+/**
+ * Set the current active dictionary entry
+ *
+ * @param	aName - name of the dictionary entry
+ *
+ * @see		TDataDictionaryName
+ *
+ * @leave	KErrNotFound if the dictionary entry aName is not found
+ */
+	{
+	//	Ensure name already exist
+	CDataWrapper**	wrapper=iStore.Find(aName);
+
+	if ( wrapper != NULL )
+		{
+		iCurrentObject=*wrapper;
+		}
+	else
+		{
+		User::Leave(KErrNotFound);
+		}
+	}
+
+CDataWrapper* CDataDictionary::GetDataL(const TDataDictionaryName& aName)
+/**
+ * Get an object in the dictionary
+ *
+ * @param	aName - name of the dictionary entry
+ *
+ * @see		TDataDictionaryName
+ *
+ * @leave	KErrNotFound if the dictionary entry aName is not found
+ *
+ * @return	The data object found
+ */
+	{
+	//	Ensure name already exist
+	CDataWrapper**	ret=iStore.Find(aName);
+
+	if ( ret == NULL )
+		{
+		User::Leave(KErrNotFound);
+		}
+
+	return *ret;
+	}
+
+TAny* CDataDictionary::GetObjectL(const TDesC& aName)
+/**
+ * Get an object in the dictionary
+ *
+ * @param	aName - name of the dictionary entry
+ *
+ * @return	The object found
+ *
+ * @leave	KErrNotFound if the dictionary entry aName is not found
+ */
+	{
+	//	Ensure name already exist
+	CDataWrapper**	wrapper=iStore.Find(aName);
+	TAny*			ret=NULL;
+
+	if ( wrapper != NULL )
+		{
+		ret=(*wrapper)->GetObject();
+		}
+	else
+		{
+		User::Leave(KErrNotFound);
+		}
+
+	return ret;
+	}
+
+void CDataDictionary::Empty()
+/**
+ * Empty the object dictionary
+ */
+	{
+	TDataIter	iter(iStore);
+	iter.Reset();
+	for ( CDataWrapper*const * data=iter.NextValue(); data!=NULL; data=iter.NextValue() )
+		{
+		delete *data;
+		}
+	iStore.Close();
+
+	iCurrentObject=NULL;
+	}
+
+TInt CDataDictionary::Outstanding(const TDesC& aName, TBool& aMoreToDo)
+/**
+ * Delegates to a data object to see if
+ *  it has any outstanding requests
+ *
+ * @param	aName - Name of the dictionary entry
+ *
+ * @leave	KErrNotFound if the dictionary entry aName is not found
+ *
+ * @return	ETrue if there are any outstanding requests
+ */
+	{
+	TInt	retCode=KErrNone;
+
+	aMoreToDo=EFalse;
+	if ( aName.Compare(KTEFNull)==0 )
+		{
+		TDataIter	iter(iStore);
+		iter.Reset();
+		for ( CDataWrapper*const * data=iter.NextValue(); (data!=NULL) && (!aMoreToDo); data=iter.NextValue() )
+			{
+			aMoreToDo = (*data)->Outstanding();
+			}
+		}
+	else
+		{
+		//	Ensure name already exist
+		CDataWrapper**	wrapper=iStore.Find(aName);
+
+		if ( wrapper != NULL )
+			{
+			aMoreToDo = (*wrapper)->Outstanding();
+			}
+		else
+			{
+			retCode=KErrNotFound;
+			}
+		}
+
+	return retCode;
+	}
+
+TAny* CDataDictionary::CurrentObject()
+/**
+ * Get the object of the current active dictionary entry
+ *
+ * @return	The object that the current data wraps
+ */
+	{
+	return iCurrentObject ? iCurrentObject->GetObject() : NULL;
+	}
+
+/**
+ * Set an object in the dictionary
+ *
+ * @param	aName - name of the dictionary entry
+ * @param	aObject - object that the wrapper is testing
+ *
+ * @see		TDataDictionaryName
+ *
+ * @leave	KErrNotFound if the dictionary entry aName is not found
+ * @leave	KErrNotSupported if the the function is not supported
+ */
+void CDataDictionary::SetObjectL(const TDataDictionaryName& aName, TAny* aObject)
+	{
+	GetDataL(aName)->SetObjectL(aObject);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/datawrapper.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,240 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CDataWrapper
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+
+#include "datawrapper.h"
+
+_LIT(KDictionaryName,			"name");
+
+EXPORT_C CDataWrapper::CDataWrapper()
+/**
+ * Constructor
+ */
+:	iDataDictionary(NULL)
+,	iTestBlockController(NULL)
+,	iOutstanding(0)
+	{
+	}
+
+EXPORT_C CDataWrapper::~CDataWrapper()
+/**
+ * Destructor
+ */
+	{
+	}
+
+EXPORT_C void CDataWrapper::SetTestBlockController(CTestBlockController* aTestBlockController)
+/**
+ * Set the test block controller
+ *
+ * @param	aTestBlockController - the controller
+ *
+ * @see		CTestBlockController
+ */
+	{
+	iTestBlockController = aTestBlockController;
+	}
+
+EXPORT_C void CDataWrapper::SetDataDictionary(CDataDictionary* aDataDictionary)
+/**
+ * Set the data dictionary
+ *
+ * @param	aDataDictionary - the data dictionary
+ *
+ * @see		CDataDictionary
+ */
+	{
+	iDataDictionary = aDataDictionary;
+	}
+
+// MDataAccess implementation
+EXPORT_C TBool CDataWrapper::GetBoolFromConfig(const TDesC&  aSectName, const TDesC& aKeyName, TBool& aResult)
+	{
+	return iTestBlockController?iTestBlockController->GetBoolFromConfig(aSectName, aKeyName, aResult):EFalse;
+	}
+
+EXPORT_C TBool CDataWrapper::GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult)
+	{
+	return iTestBlockController?iTestBlockController->GetIntFromConfig(aSectName, aKeyName, aResult):EFalse;
+	}
+
+EXPORT_C TBool CDataWrapper::GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult)
+	{
+	return iTestBlockController?iTestBlockController->GetStringFromConfig(aSectName, aKeyName, aResult):EFalse;
+	}
+
+EXPORT_C TBool CDataWrapper::GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult)
+	{
+	return iTestBlockController?iTestBlockController->GetHexFromConfig(aSectName, aKeyName, aResult):EFalse;
+	}
+
+EXPORT_C TBool CDataWrapper::WriteBoolToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TBool& aValue)
+	{
+	return iTestBlockController?iTestBlockController->WriteBoolToConfig(aSectName, aKeyName, aValue):EFalse;
+	}
+
+EXPORT_C TBool CDataWrapper::WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue)
+	{
+	return iTestBlockController?iTestBlockController->WriteIntToConfig(aSectName, aKeyName, aValue):EFalse;
+	}
+
+EXPORT_C TBool CDataWrapper::WriteStringToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TPtrC& aValue)
+	{
+	return iTestBlockController?iTestBlockController->WriteStringToConfig(aSectName, aKeyName, aValue):EFalse;
+	}
+
+EXPORT_C TBool CDataWrapper::WriteHexToConfig(const TDesC&  aSectName, const TDesC& aKeyName, const TInt& aValue)
+	{
+	return iTestBlockController?iTestBlockController->WriteHexToConfig(aSectName, aKeyName, aValue):EFalse;
+	}
+
+EXPORT_C void CDataWrapper::ReadSharedDataL(const TDesC& aShareName, TDes& aSharedDataVal)
+	{
+	if( iTestBlockController )
+		{
+		iTestBlockController->ReadSharedDataL(aShareName, aSharedDataVal);
+		}
+	}
+
+EXPORT_C void CDataWrapper::WriteSharedDataL(const TDesC& aShareName, TDesC& aSharedDataVal, TModeCopy aModeCopy)
+	{
+	if( iTestBlockController )
+		{
+		iTestBlockController->WriteSharedDataL( aShareName, aSharedDataVal, aModeCopy );
+		}
+	}
+
+EXPORT_C CTestExecuteLogger& CDataWrapper::Logger()
+	{
+	return iTestBlockController->Logger();
+	}
+
+EXPORT_C CDataWrapper* CDataWrapper::GetDataWrapperL(const TDesC& aSectionName)
+	{
+	CDataWrapper* dataWrapper = NULL;
+	if( iDataDictionary )
+		{
+		// Lookup the dictionary name in the ini file
+		TPtrC dictionaryName;
+		TBool res = GetStringFromConfig(aSectionName, KDictionaryName, dictionaryName );
+		if( KErrNone != res )
+			{
+			// Retrieve the object from the dictionary
+			dataWrapper = iDataDictionary->GetDataL(dictionaryName);
+			}
+		else
+			{
+			User::Leave( KErrBadName );
+			}
+		}
+	return dataWrapper;
+	}
+
+EXPORT_C TAny* CDataWrapper::GetDataObjectL(const TDesC& aSectionName)
+	{
+	TAny* dataObject = NULL;
+	if( iDataDictionary )
+		{
+		// Lookup the dictionary name in the ini file
+		TPtrC dictionaryName;
+		TBool res = GetStringFromConfig(aSectionName, KDictionaryName, dictionaryName );
+		if( KErrNone != res )
+			{
+			// Retrieve the object from the dictionary
+			dataObject = iDataDictionary->GetObjectL(dictionaryName);
+			}
+		else
+			{
+			User::Leave( KErrBadName );
+			}
+		}
+	return dataObject;
+	}
+
+EXPORT_C void CDataWrapper::SetDataObjectL(const TDesC& aSectionName, TAny* aObject)
+	{
+	if( iDataDictionary )
+		{
+		// Lookup the dictionary name in the ini file
+		TPtrC dictionaryName;
+		TBool res = GetStringFromConfig(aSectionName, KDictionaryName, dictionaryName );
+		if( KErrNone != res )
+			{
+			// Set the object in the wrapper
+			iDataDictionary->SetObjectL(dictionaryName, aObject);
+			}
+		else
+			{
+			User::Leave( KErrBadName );
+			}
+		}
+	}
+
+// MTEFResult implementation
+EXPORT_C void CDataWrapper::SetError(const TInt aError)
+	{
+	if( iTestBlockController )
+		{
+		iTestBlockController->SetError( aError );
+		}
+	}
+
+EXPORT_C void CDataWrapper::SetAsyncError(const TInt aIndex, const TInt aError)
+	{
+	if( iTestBlockController )
+		{
+		iTestBlockController->SetAsyncError( aIndex, aError );
+		}
+	}
+
+EXPORT_C void CDataWrapper::SetBlockResult(const TVerdict aResult)
+	{
+	if( iTestBlockController )
+		{
+		iTestBlockController->SetBlockResult( aResult );
+		}
+	}
+
+EXPORT_C TVerdict CDataWrapper::BlockResult()
+	{
+	return iTestBlockController->BlockResult();
+	}
+
+// MActiveCallback implementation
+EXPORT_C void CDataWrapper::RunL(CActive* /*aActive*/, TInt /*aIndex*/)
+	{
+	// This should never be called, if it has been then warn the user!
+	//  They need to implement this function when using CActiveCallback's
+	//  and handle the request completion!
+	SetBlockResult( EFail );
+	}
+
+EXPORT_C void CDataWrapper::DoCancel(CActive* /*aActive*/, TInt /*aIndex*/)
+	{
+	// This should never be called, if it has been then warn the user!
+	//  They need to implement this function when using CActiveCallback's
+	//  and handle the request cancellation!
+	SetBlockResult( EFail );
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/serialwriter.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,240 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#include <e32std.h>
+#include "serialwriter.h"
+#include "tefconst.h"
+#include <test/tefexportconst.h>
+
+#if defined (__WINS__)
+_LIT(KPddDev, "ECDRV.PDD");
+#else
+_LIT(KPddDev, "EUART1");
+#endif
+
+#if defined (__WINS__)
+_LIT(KLddDev, "ECOMM.LDD");
+#else
+_LIT(KLddDev, "ECOMM");
+#endif
+
+
+/**
+Creates an instance of CSerialWriter object
+@return a pointer to the new created CSerialWriter Object
+@leave KErrNoMemory if no memory
+*/
+ CSerialWriter* CSerialWriter::NewL()
+	{
+	CSerialWriter *me = new (ELeave) CSerialWriter;
+	CleanupStack::PushL(me);
+	me->ConstructL();
+	CleanupStack::Pop();
+	return me;
+	}
+
+/**
+Public Destructor
+*/
+CSerialWriter::~CSerialWriter()
+	{
+    Disconnect();
+	}
+
+//default constructor
+CSerialWriter::CSerialWriter()
+	{
+	}
+
+void CSerialWriter::ConstructL()
+	{
+	iReady = EFalse;
+	
+    TInt err = User::LoadPhysicalDevice(KPddDev);
+    if(err!=KErrNone && err!=KErrAlreadyExists)
+        User::Leave(err);
+
+    err = User::LoadLogicalDevice(KLddDev);
+    if(err!=KErrNone && err!=KErrAlreadyExists)
+        User::Leave(err);
+ 	}
+
+TInt CSerialWriter::Connect()
+    {
+    if(!iReady)
+        {
+        TInt err = KErrNone;
+        err = iComm.Open(iPortNum);
+        if(err!=KErrNone)
+        	{
+       		iReady = EFalse;
+            return err;
+        	}
+        	else
+		        iReady = ETrue;
+        }
+    return KErrNone;
+    }
+
+TInt CSerialWriter::Config()
+    {
+    TInt err = KErrNone;
+    if(iReady)
+        {
+        TCommConfig2 cfgBuf;
+        TCommConfigV02& cfg = cfgBuf();
+        iComm.Config(cfgBuf);
+        cfg.iRate = EBps115200;// default EBps9600;
+        cfg.iDataBits = EData8;// default EData8;
+        cfg.iStopBits = EStop1;// default EStop1;
+        cfg.iParity = EParityNone;// default EParityNone;
+        cfg.iHandshake = 0;// default KConfigObeyCTS;
+        cfg.iParityError = KConfigParityErrorFail;
+        cfg.iFifo = EFifoEnable;// default EFifoEnable;
+        cfg.iSpecialRate = 0;// default 0;
+        cfg.iTerminatorCount = 0;// default 0;
+        cfg.iXonChar = 0x11;// default 0x11; // XON
+        cfg.iXoffChar = 0x13;// default 0x13; // XOFF
+        cfg.iParityErrorChar = 0;// default 0;
+        cfg.iSIREnable = ESIRDisable;// default ESIRDisable;
+        cfg.iSIRSettings = 0;// no default
+        
+        err = iComm.SetConfig(cfgBuf);
+        if(err!=KErrNone && err!=KErrInUse)
+            {
+            iReady = EFalse;
+            return(err);
+            }
+        }
+    
+    return err;
+    }
+
+TInt CSerialWriter::Disconnect()
+    {
+    if(iReady)
+        {
+	    iReady = EFalse;
+        iComm.Close();
+        }
+    return KErrNone;
+    }
+
+TInt CSerialWriter::Write(const TDesC8& aData)
+	{
+	TInt err = KErrNone;
+	
+	if(iReady)
+		{
+		TRequestStatus writeStatus;
+	    iComm.Write(writeStatus, aData);
+    	User::WaitForRequest(writeStatus);
+    	err = writeStatus.Int();  	
+		}
+
+   	return err;
+	}
+
+void CSerialWriter::AddTime(TDes8& aLogBuffer)
+	{
+	TTime now;
+	now.UniversalTime();
+	TDateTime dateTime = now.DateTime();
+	_LIT8(KFormat,"%02d:%02d:%02d:%03d ");
+	// add the current time 
+	aLogBuffer.Append(KTEFNewLine) ; 
+	aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000)); 
+	}
+
+void CSerialWriter::AddSeverity(TDes8& aLogBuffer, const TInt& aSeverity)
+	{
+	if (aSeverity < 1) 
+		{
+		return;
+		}
+
+	_LIT(KErr,"ERROR - ");
+	_LIT(KHigh,"HIGH - ");
+	_LIT(KWarn,"WARN - ");
+	_LIT(KMedium,"MEDIUM - ");
+	_LIT(KInfo,"INFO - ");
+	_LIT(KLow,"LOW - ");
+
+	if(aSeverity == ESevrErr)
+		aLogBuffer.Append(KErr);
+	else if(aSeverity == ESevrHigh)
+		aLogBuffer.Append(KHigh);
+	else if(aSeverity == ESevrWarn)
+		aLogBuffer.Append(KWarn);
+	else if(aSeverity == ESevrMedium)
+		aLogBuffer.Append(KMedium);
+	else if (aSeverity == ESevrInfo)
+		aLogBuffer.Append(KInfo);
+	else if(aSeverity == ESevrLow)
+		aLogBuffer.Append(KLow);
+	else //if(aSeverity == ESevrAll)
+		aLogBuffer.Append(KInfo);
+
+	}
+
+
+/**
+Decorates the logs with Current Time and Severity 
+@returns Error code if any during writing
+@leave KErrNoMemory if no memory
+*/
+TInt CSerialWriter::WriteDecorated(const TDesC8& aText, TInt aSeverity)	
+{
+	TInt ret = KErrNone; 	
+	HBufC8* buffer = HBufC8::New(aText.Length()+30);
+	if(buffer)
+		{
+		TPtr8 ptr(buffer->Des());
+		AddTime(ptr);
+		AddSeverity(ptr,aSeverity) ; 
+		ptr.Append(aText);
+		// Ignore error for the time being. Could do an ASSERT
+		ret = Write(ptr) ; 
+		delete buffer;
+		}
+	return ret ; 	
+}
+
+/**
+  Overloaded for TDesC
+  @returns Error code if any during writing
+  @leave KErrNoMemory if no memory
+  */
+  TInt CSerialWriter::WriteDecorated(const TDesC& aText, TInt aSeverity)
+  {
+  	TPtrC8 representation((TUint8*)(&aText)->Ptr(), (&aText)->Size());
+  	return WriteDecorated(representation,  aSeverity )	;
+  }
+
+
+TInt CSerialWriter::Settings(const TInt& aPortNumber)
+	{
+	  	iPortNum = aPortNumber ; 
+	  	Disconnect();
+	  	TInt err = Connect();
+	  	if(err != KErrNone)
+	  		return err;
+	  	err = Config();
+	  	return err;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/tefscriptutils.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2005-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:  
+* Implementation for utitity class used for parsing script files
+* Collect details on counts of test steps and test cases in a script file
+*
+*/
+
+
+
+/**
+ @file TEFScriptUtils.cpp
+*/
+
+#include "tefscriptutils.h"
+
+/**
+ * CScriptPreProcess(const TDesC aScriptFilePath, TCommandForCounting* aCommandsAndCounts, TInt aStructSize) - Constructor
+ * Overloaded constructor used for collecting the script file path along with the structure array and size for storing count values
+ * @param aScriptFilePath - Path of the script file to be loaded for reading
+ * @param aCommandsAndCounts - Pointer to array of TCommandForCounting structures for collecting counts of commands
+ * @param aStructSize - Integer value representing the size of the structure array passed in
+ */
+CScriptPreProcess::CScriptPreProcess(const TDesC& aScriptFilePath, TPtrC aCommandList[KTEFCommandCountsStructSize])
+: iScriptFilePath(aScriptFilePath), iStructSize(KTEFCommandCountsStructSize), iScriptData(NULL)
+	{
+	for (TInt index=0; index < iStructSize; index++)
+		{
+		iCommandsAndCounts[index].iCommandName.Copy(aCommandList[index]);
+		iCommandsAndCounts[index].iCommandCount = KTEFZeroValue;
+		}
+	}
+
+/**
+ * ~CScriptPreProcess() - Destructor
+ * Deallocates heap allocation if done
+ */
+CScriptPreProcess::~CScriptPreProcess()
+	{
+	if (iScriptData != 0)
+		{
+		delete iScriptData;
+		}
+	}
+
+/**
+ * CountNoOfOccurences()
+ * Member function used for parsing each of the script line
+ * Updates the structure array for any command of interest found during parsing
+ * @return TInt - Return system-wide error codes
+ */
+TInt CScriptPreProcess::CountNoOfOccurences()
+	{
+	// Construct the buffer with contents of script file
+	TRAPD(err,CreateScriptDataFromScriptFileL());
+	if (err != KErrNone)
+		{
+		// Return the error value, if the we fail to retieve the script file contents
+		return err;
+		}
+	
+	TBool statusOfWhile=ETrue;
+	while (statusOfWhile)
+		{
+		// Get the individual script line contents until EOF
+		statusOfWhile=GetNextScriptLine();
+
+		// If the script line is available, parse it and update the command counts in the structure array, if any
+		if (statusOfWhile)
+			{
+			UpdateCommandCounts();
+			}
+		}
+	// Return KErrNone if the process is completed safely
+	return KErrNone;
+	}
+
+/**
+ * CreateScriptDataFromScriptFileL()
+ * Funtion used to copy the contents of the script file to a buffer for reading
+ */
+void CScriptPreProcess::CreateScriptDataFromScriptFileL()
+	{
+	// Create a file session and connect
+	RFs fS;
+	User::LeaveIfError(fS.Connect());
+	CleanupClosePushL(fS);
+
+	// Create a file object and try to open the script file for reading
+	RFile scriptFile;
+	User::LeaveIfError(scriptFile.Open(fS,iScriptFilePath,EFileRead | EFileShareAny));
+	CleanupClosePushL(scriptFile);
+
+	// Extract the size of the script file and create a heap buffer to the particular size
+	TInt fileSize;
+	User::LeaveIfError(scriptFile.Size(fileSize));
+
+	// Create a 16bit heap buffer
+	iScriptData = HBufC::NewL(fileSize);
+
+	// Create a 8 bit heap buffer for temporily copying the contents of the script file from the file object
+	HBufC8* narrowData = HBufC8::NewL(fileSize);
+	CleanupStack::PushL(narrowData);
+	TPtr8 narrowPtr=narrowData->Des();
+	// Read the file into an 8bit heap buffer
+	User::LeaveIfError(scriptFile.Read(narrowPtr));
+
+	TPtr widePtr(iScriptData->Des());
+	// Copy it to the 16bit buffer
+	widePtr.Copy(narrowData->Des());
+
+	// Cleanup all heap allocations
+	CleanupStack::PopAndDestroy(narrowData);
+	CleanupStack::Pop(2);
+
+	// Close the file object and file session
+	scriptFile.Close();
+	fS.Close();
+
+	// Set up the instance token parser
+	iScriptLex = iScriptData->Des();
+	}
+
+/**
+ * GetNextScriptLine()
+ * Funtion used to retrieve individual script line and store them to a member buffer for parsing
+ * @return TBool - Returns EFalse if the cursor position reaches end of file. ETrue otherwise
+ */
+TBool CScriptPreProcess::GetNextScriptLine()
+	{
+	// Place the lex marker for the next read
+	while(!iScriptLex.Eos())
+		{
+		// Peek and place the cursor position to the end of line
+		TChar peek = iScriptLex.Peek();
+		if(peek == '\n')
+			{
+			iScriptLex.Inc();
+			break;
+			}
+		else
+			{
+			iScriptLex.Inc();
+			}
+		}
+	
+	// Store the current line to a member variable
+	iCurrentScriptLine.Set(iScriptLex.MarkedToken());
+	iScriptLex.Mark();
+	// Replace the remainder of the script contents into the original buffer
+	// This is done to enable retrieving of next line during successive calls to the same function
+	iScriptLex.Assign(iScriptLex.RemainderFromMark());
+
+	// Check for end of file and return status accordingly
+	if(iCurrentScriptLine.Length() || !iScriptLex.Eos())
+		{
+		return ETrue;
+		}
+	else
+		{
+		return EFalse;
+		}
+	}
+
+/**
+ * UpdateCommandCounts()
+ * Funtion used to parse the script line and update the the command struture with incrementing counts within the structure array
+ */
+void CScriptPreProcess::UpdateCommandCounts()
+	{
+	// Copy the current script line contents to a TLex for parsing
+	TLex scriptLine(iCurrentScriptLine);
+
+	// Extract the first token from the current script line lex
+	TPtrC commandName(scriptLine.NextToken());
+
+	// Run through a loop and check if the first token of the current script line
+	// matches the command names provided in the structure array
+	// If it matches any of the commands in array, increment the counter correspondingly
+	for (TInt index=0;index<iStructSize;index++)
+		{
+		if (iCommandsAndCounts[index].iCommandName.CompareF(commandName) == 0)
+			{
+			iCommandsAndCounts[index].iCommandCount++;
+			}
+		}
+	}
+
+/**
+ * RetrieveCount(TInt& aIndex, TDes& aCommandName, TInt& aCommandCount)
+ * Funtion used to retrieve individual command counts from the structure array and store them to reference parameters
+ * @param aIndex - TInt value representing the aray index whose details needs to be fetched
+ * @param aCommandName - Reference to a buffer used to retrieve the command whose count is being updated
+ * @param aCount - Reference to TInt descriptor used to retrieve the counts of the command from script file
+ */
+void CScriptPreProcess::RetrieveValues(TInt& aIndex, TDes& aCommandName, TInt& aCommandCount)
+	{
+	aCommandName.Copy(iCommandsAndCounts[aIndex].iCommandName);
+	aCommandCount = iCommandsAndCounts[aIndex].iCommandCount;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/teftestreport.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1400 @@
+/*
+* 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: This module contains implementation of CTEFTestReport 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <f32file.h>
+#include <hal.h>
+#include "teftestreport.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+const TInt KMaxLenEol = 6;
+const TInt KMaxReportData = 256;
+typedef TBuf<KMaxReportData> TPrintInfo;
+const TInt KSummaryLineEndLen = 12;
+_LIT( KSummaryLineEnd,  "            ");
+
+// XML Tags (alphabetically)
+_LIT(KXMLCaseNumberTag,          "<CaseNumber>");
+_LIT(KXMLCaseNumberTagEnd,       "</CaseNumber>");
+_LIT(KXMLCaseTitleTag,           "<Title>");
+_LIT(KXMLCaseTitleTagEnd,        "</Title>");
+_LIT(KXMLConfigFileTag,          "<Config>");
+_LIT(KXMLConfigFileTagEnd,       "</Config>");
+_LIT(KXMLCpuSpeedTag,            "<CPUSpeed>");
+_LIT(KXMLCpuSpeedTagEnd,         "</CPUSpeed>");
+_LIT(KXMLCpuTag,                 "<CPU>");
+_LIT(KXMLCpuTagEnd,              "</CPU>");
+_LIT(KXMLCrashedTag,             "<Crashed>");
+_LIT(KXMLCrashedTagEnd,          "</Crashed>");
+_LIT(KXMLDateTag,                "<Date>");
+_LIT(KXMLDateTagEnd,             "</Date>");
+_LIT(KXMLDllSummaryTag,          "<Dlls>");
+_LIT(KXMLDllSummaryTagEnd,       "</Dlls>");
+_LIT(KXMLDllTag,                 "<Dll>");
+_LIT(KXMLDllTagEnd,              "</Dll>");
+_LIT(KXMLEndTimeTag,             "<EndTime>");
+_LIT(KXMLEndTimeTagEnd,          "</EndTime>");
+_LIT(KXMLEnvironmentInfoTag,     "<EnvironmentInfo>");
+_LIT(KXMLEnvironmentInfoTagEnd,  "</EnvironmentInfo>");
+_LIT(KXMLExecutionResultTag,     "<ExecutionResultCode>");
+_LIT(KXMLExecutionResultTagEnd,  "</ExecutionResultCode>");
+_LIT(KXMLFailedTag,              "<Failed>");
+_LIT(KXMLFailedTagEnd,           "</Failed>");
+_LIT(KXMLFileNameTag,            "<FileName>");
+_LIT(KXMLFileNameTagEnd,         "</FileName>");
+_LIT(KXMLHardwareInfoTag,        "<HardwareInfo>");
+_LIT(KXMLHardwareInfoTagEnd,     "</HardwareInfo>");
+_LIT(KXMLHwRevisionTag,          "<HwRevision>");
+_LIT(KXMLHwRevisionTagEnd,       "</HwRevision>");
+_LIT(KXMLLanguageTag,            "<Language>");
+_LIT(KXMLLanguageTagEnd,         "</Language>");
+_LIT(KXMLMachineUidTag,          "<MachineUID>");
+_LIT(KXMLMachineUidTagEnd,       "</MachineUID>");
+_LIT(KXMLManufacturerTag,        "<Manufacturer>");
+_LIT(KXMLManufacturerTagEnd,     "</Manufacturer>");
+_LIT(KXMLMemoryInfoTag,          "<MemoryInfo>");
+_LIT(KXMLMemoryInfoTagEnd,       "</MemoryInfo>");
+_LIT(KXMLModelTag,               "<Model>");
+_LIT(KXMLModelTagEnd,            "</Model>");
+_LIT(KXMLModuleNameTag,          "<ModuleName>");
+_LIT(KXMLModuleNameTagEnd,       "</ModuleName>");
+_LIT(KXMLModuleSummaryTag,       "<Modules>");
+_LIT(KXMLModuleSummaryTagEnd,    "</Modules>");
+_LIT(KXMLModuleTag,              "<Module>");
+_LIT(KXMLModuleTagEnd,           "</Module>");
+_LIT(KXMLPassedTag,              "<Passed>");
+_LIT(KXMLPassedTagEnd,           "</Passed>");
+_LIT(KXMLRamFreeTag,             "<RAMFree>");
+_LIT(KXMLRamFreeTagEnd,          "</RAMFree>");
+_LIT(KXMLRamTag,                 "<RAM>");
+_LIT(KXMLRamTagEnd,              "</RAM>");
+_LIT(KXMLResultDescrTag,         "<ResultDescription>");
+_LIT(KXMLResultDescrTagEnd,      "</ResultDescription>");
+_LIT(KXMLResultTag,              "<Result>");
+_LIT(KXMLResultTagEnd,           "</Result>");
+_LIT(KXMLSoftwareInfoTag,        "<SoftwareInfo>");
+_LIT(KXMLSoftwareInfoTagEnd,     "</SoftwareInfo>");
+_LIT(KXMLStartTimeTag,           "<StartTime>");
+_LIT(KXMLStartTimeTagEnd,        "</StartTime>");
+_LIT(KXMLSwBuildTag,             "<SwBuild>");
+_LIT(KXMLSwBuildTagEnd,          "</SwBuild>");
+_LIT(KXMLSwRevisionTag,          "<SwRevision>");
+_LIT(KXMLSwRevisionTagEnd,       "</SwRevision>");
+_LIT(KXMLTestCasesSummaryTag,    "<TestCasesSummary>");
+_LIT(KXMLTestCasesSummaryTagEnd, "</TestCasesSummary>");
+_LIT(KXMLTestCasesTag,           "<TestCases>");
+_LIT(KXMLTestCasesTagEnd,        "</TestCases>");
+_LIT(KXMLTestCaseTag,            "<TestCase>");
+_LIT(KXMLTestCaseTagEnd,         "</TestCase>");
+_LIT(KXMLTestReportTag,          "<TestReport>");
+_LIT(KXMLTestReportTagEnd,       "</TestReport>");
+_LIT(KXMLTestResultTag,          "<ResultCode>");
+_LIT(KXMLTestResultTagEnd,       "</ResultCode>");
+_LIT(KXMLTimeoutedTag,           "<Timeout>");
+_LIT(KXMLTimeoutedTagEnd,        "</Timeout>");
+_LIT(KXMLTimeTag,                "<Time>");
+_LIT(KXMLTimeTagEnd,             "</Time>");
+_LIT(KXMLTotalTag,               "<Total>");
+_LIT(KXMLTotalTagEnd,            "</Total>");
+_LIT(KXMLVersionTag,             "<Version>");
+_LIT(KXMLVersionTagEnd,          "</Version>");
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: CTEFTestReport
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: const TTestReportMode aReportMode: in: Report mode
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTEFTestReport::CTEFTestReport( const TTestReportMode aReportMode ):
+    iReportMode( aReportMode ) 
+    {
+    iXML = EFalse;
+    iReportHWInfo = TTestHWInfo();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: CTEFTestReportSettings& aTestReportSettings: in: Report settings
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation for iTotalSummary fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::ConstructL( TTEFTestReportSettings& aTestReportSettings )
+    {
+    // Create summary for all test cases
+    _LIT( KName, "All test cases" );
+    iTotalSummary = new ( ELeave ) TTestSummary( KName() );
+
+    User::LeaveIfError( iFs.Connect() );
+    
+    TPtrC path;
+    path.Set( aTestReportSettings.iPath->Des() );
+    TPtrC name;
+    name.Set( aTestReportSettings.iName->Des() );
+
+    iFormat = aTestReportSettings.iFormat;
+    iOutput = aTestReportSettings.iOutput;
+    iXML = aTestReportSettings.iXML;
+    
+    // XML format can be used only when report is of txt file type.
+    if(iFormat != ETEFTestReportLoggerType_Txt && iOutput != ETEFTestReportOutput_File && iXML)
+        {
+        RDebug::Print(_L("Stif: XML report is available only when TestReportFormat is TXT and TestReportOutput is FILE"));
+        iXML = EFalse;
+        }
+    
+    if( iOutput == ETEFTestReportOutput_File )
+        {
+        iFs.MkDirAll( path );
+        
+        HBufC* pathAndFileBuf = HBufC::NewLC( path.Length() + name.Length() + 5 );
+        TPtr pathAndFile(pathAndFileBuf->Des() );
+        pathAndFile.Append( path );
+        pathAndFile.Append( name );
+
+        if(iXML)
+            {
+            pathAndFile.Append( _L(".xml") );
+            }
+        else
+            {
+            if( ( iFormat == ETEFTestReportLoggerType_Html ) && 
+                ( iOutput == ETEFTestReportOutput_File ) )
+                {
+                pathAndFile.Append( _L(".html") );
+                }
+            else 
+                {
+                pathAndFile.Append( _L(".txt") );
+                }
+            }
+        
+        if( aTestReportSettings.iOverwrite )
+            {
+            User::LeaveIfError( iFile.Replace( iFs, 
+                           pathAndFile,
+                           EFileWrite | EFileStreamText | EFileShareAny ) );
+            }
+        else
+            {
+            TInt fileOpen = iFile.Open( iFs, 
+                                        pathAndFile, 
+                                        EFileWrite | EFileStreamText | EFileShareAny );
+            if( fileOpen == KErrNotFound )
+                {
+                User::LeaveIfError( 
+                    iFile.Create( iFs, 
+                                  pathAndFile, 
+                                  EFileWrite | EFileStreamText | EFileShareExclusive ) );
+                }
+            else if( fileOpen == KErrNone )
+                {
+                TInt endPosOfFile = 0;
+                User::LeaveIfError( iFile.Seek( ESeekEnd, endPosOfFile ) );
+                }
+            else
+                {
+                User::Leave( fileOpen );
+                }
+            }
+       
+        CleanupStack::PopAndDestroy( pathAndFileBuf );
+        }
+            
+    WriteHeaderL();
+    
+    // Add temporarily closing tags to keep valid xml structure
+    CloseXMLTagsInUnfinishedFileL();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTEFTestReportSettings& aTestReportSettings: in: Report settings
+                const TTestReportMode aReportMode: in: Report mode
+    
+    Return Values: CTEFTestReport* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTEFTestReport* CTEFTestReport::NewL( TTEFTestReportSettings& aTestReportSettings,
+                                const TTestReportMode aReportMode )
+    {
+    CTEFTestReport* self = new ( ELeave ) CTEFTestReport( aReportMode );
+    CleanupStack::PushL( self );
+    self->ConstructL( aTestReportSettings );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: ~CTEFTestReport
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTEFTestReport::~CTEFTestReport()
+    {
+    // Reset and destroy arrays
+    iTestSummaries.ResetAndDestroy();
+    delete iTotalSummary;
+    if( iOutput != ETEFTestReportOutput_RDebug )
+        {
+        // Delete file
+        iFile.Close();
+        iFs.Close();
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: AddTestCaseResultL
+
+    Description: Add new test case result.
+
+    Parameters: const TTestInfo& aTestInfo: in: TTestInfo: Test info
+                const TFullTestResult& aTestResult: in: TTestResult: Testresult
+                const TInt aError: in: Symbian OS error: Additional error code
+
+    Return Values: None
+
+    Errors/Exceptions: Leave is iReportGenerated is generated
+                       Leave if summary creation fails
+                       Leave if summary adding fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::AddTestCaseResultL( const TTEFTestInfo& aTestInfo,
+                                        const TTEFFullTestResult& aTestResult,
+                                        const TInt aError )
+    {
+    // Create summary for this test case
+    TTestCaseSummary summary;
+    
+    summary.iTestInfo = aTestInfo;
+    summary.iFullTestResult = aTestResult;
+
+    TBool passed( EFalse );
+    TBool crashed( EFalse );
+    TBool timeout( EFalse );
+    if( ( aError == KErrNone ) && 
+         ( summary.iFullTestResult.iCaseExecutionResultType == TTEFFullTestResult::ECaseExecuted ) &&
+         ( KErrNone == summary.iFullTestResult.iTestResult.iResult ) )
+        {
+        passed = ETrue;
+        }
+    else if( summary.iFullTestResult.iCaseExecutionResultType == TTEFFullTestResult::ECaseTimeout )
+        {
+        timeout = ETrue;
+        }
+    else if( ( summary.iFullTestResult.iCaseExecutionResultCode != KErrNone )
+            || ( summary.iFullTestResult.iCaseExecutionResultType == TTEFFullTestResult::ECasePanic )
+            || ( summary.iFullTestResult.iCaseExecutionResultType == TTEFFullTestResult::ECaseException ) )
+        {
+        crashed = ETrue;
+        }
+
+    if ( iReportMode & ETestReportCases )
+        {
+        // Print summary to file
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCaseTag);
+            WriteLineL(_L("%S%S%S"), &KXMLModuleNameTag, &summary.iTestInfo.iModuleName, &KXMLModuleNameTagEnd);
+            if(summary.iTestInfo.iConfig != KNullDesC)
+                {
+                WriteLineL(_L("%S%S%S"), &KXMLConfigFileTag, &summary.iTestInfo.iConfig, &KXMLConfigFileTagEnd);
+                }
+            WriteLineL(_L("%S%d%S"), &KXMLCaseNumberTag, summary.iTestInfo.iTestCaseInfo.iCaseNumber, &KXMLCaseNumberTagEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLCaseTitleTag, &summary.iTestInfo.iTestCaseInfo.iTitle, &KXMLCaseTitleTagEnd);
+            }
+        else
+            {
+            WriteLineL( _L("[%S][%S][%d] Title:[%S]"),
+                &summary.iTestInfo.iModuleName,
+                &summary.iTestInfo.iConfig,
+                summary.iTestInfo.iTestCaseInfo.iCaseNumber,
+                &summary.iTestInfo.iTestCaseInfo.iTitle );
+            }
+
+        const TInt KTimeFieldLength = 30;
+        TBuf<KTimeFieldLength> startTime;
+        TBuf<KTimeFieldLength> endTime;
+        _LIT(KDateString4,"%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B");
+        summary.iFullTestResult.iStartTime.FormatL(
+            startTime,KDateString4 );
+        summary.iFullTestResult.iEndTime.FormatL(
+            endTime,KDateString4 );
+            
+        // Result description needs max length 0x80(Must be same as
+        // TResultDes length) + specific characters see below.
+        TBuf<KMaxReportData> printBuf2;
+        TInt code = ENoStyle;
+        if( ( summary.iFullTestResult.iCaseExecutionResultType 
+            != TTEFFullTestResult::ECasePanic ) &&
+            ( summary.iFullTestResult.iCaseExecutionResultCode 
+            == KErrNone ) )
+            {
+            printBuf2.AppendFormat( _L("\tResult: %d [%S]"),
+                summary.iFullTestResult.iTestResult.iResult,
+                &summary.iFullTestResult.iTestResult.iResultDes );
+
+            if ( KErrNone == 
+                 summary.iFullTestResult.iTestResult.iResult )
+                {
+                printBuf2.AppendFormat( _L(" ==> PASSED"));
+                }
+            else
+                {
+                code = ERed;
+                printBuf2.AppendFormat( _L(" ==> FAILED"));
+                }
+            }
+        else
+            {
+            code = ERed;
+            printBuf2.AppendFormat( _L("\tCaseExecutionResult: %S with %d"),
+                &summary.iFullTestResult.iTestResult.iResultDes,
+                summary.iFullTestResult.iCaseExecutionResultCode );
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S%S%S"), &KXMLStartTimeTag, &startTime, &KXMLStartTimeTagEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLEndTimeTag, &endTime, &KXMLEndTimeTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLTestResultTag, summary.iFullTestResult.iTestResult.iResult, &KXMLTestResultTagEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLResultDescrTag, &summary.iFullTestResult.iTestResult.iResultDes, &KXMLResultDescrTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLExecutionResultTag, summary.iFullTestResult.iCaseExecutionResultCode, &KXMLExecutionResultTagEnd);
+            }
+        else
+            {
+            WriteLineL( _L("\tStartTime: %S, EndTime: %S"),
+                &startTime,
+                &endTime );
+            WriteLineL( printBuf2, code );
+            WriteDelimiterL( _L( "- " ), 10 );
+            WriteLineL( _L( "" ) );
+            }
+        }
+        
+    // Add test summary
+    // Check if the module already exists for this test case
+    TTestSummary* moduleSummary = NULL;
+    TInt count = iTestSummaries.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if ( iTestSummaries[i]->iName == aTestInfo.iModuleName )
+            {
+            moduleSummary = iTestSummaries[i];
+            break;
+            }
+        }
+    
+    if( moduleSummary == NULL )
+        {
+        // Create new module array
+        moduleSummary = new ( ELeave ) TTestSummary( aTestInfo.iModuleName );
+        User::LeaveIfError( iTestSummaries.Append( moduleSummary ) );
+        }
+
+    if( passed )
+        {
+        moduleSummary->iPassedCases++;
+        iTotalSummary->iPassedCases++;
+        if(iXML && (iReportMode & ETestReportCases))
+            {
+            WriteLineL(_L("%SPASSED%S"), &KXMLResultTag, &KXMLResultTagEnd);
+            }
+        }
+    else if( timeout )
+        {
+        moduleSummary->iTimeoutCases++;
+        iTotalSummary->iTimeoutCases++;
+        if(iXML && (iReportMode & ETestReportCases))
+            {
+            WriteLineL(_L("%STIMEOUT%S"), &KXMLResultTag, &KXMLResultTagEnd);
+            }
+        }
+    else if( crashed ||
+           ( aError != KErrNone ) )
+        {
+        moduleSummary->iCrashedCases++;
+        iTotalSummary->iCrashedCases++;
+        if(iXML && (iReportMode & ETestReportCases))
+            {
+            WriteLineL(_L("%SCRASHED%S"), &KXMLResultTag, &KXMLResultTagEnd);
+            }
+        }
+    else
+        {
+        moduleSummary->iFailedCases++;
+        iTotalSummary->iFailedCases++;
+        if(iXML && (iReportMode & ETestReportCases))
+            {
+            WriteLineL(_L("%SFAILED%S"), &KXMLResultTag, &KXMLResultTagEnd);
+            }
+        }
+
+    if(iXML && (iReportMode & ETestReportCases))
+        {
+        WriteLineL(_L("%S"), &KXMLTestCaseTagEnd);
+        }
+
+    // Add temporarily closing tags to keep valid xml structure
+    CloseXMLTagsInUnfinishedFileL();
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: WriteHeaderL
+
+    Description: Write test report header.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::WriteHeaderL()
+    {
+    if( ( iFormat == ETEFTestReportLoggerType_Html ) && 
+        ( iOutput == ETEFTestReportOutput_File ) )
+        {        
+        // Html start tags to whole page and header section
+        iFile.Write(
+            _L8( "\n<html>\n<head>\n<title>TestReport</title>\n</head>\n\n\n<body>\n" ) );
+        }
+    
+    if(iXML)
+        {
+        WriteLineL(_L("<?xml version=\"1.0\" ?>"));
+        WriteLineL(_L("%S"), &KXMLTestReportTag);            
+        }
+    else
+        {
+        WriteDelimiterL( _L( "***" ), 25 );
+        }
+
+    // Generate date and time
+    TTime time;
+    time.HomeTime();
+    TBuf<30> date;
+    TBuf<30> clock;
+    // Date
+    _LIT( KDate, "%E%D%X%N%Y %1 %2 %3" );
+    time.FormatL( date, KDate );
+    // Time
+    _LIT( KClock,"%-B%:0%J%:1%T%:2%S%:3%+B" );
+    time.FormatL( clock,KClock );
+    // Add date and time
+    if(iXML)
+        {
+        WriteLineL(_L("%S%S%S"), &KXMLDateTag, &date, &KXMLDateTagEnd);
+        WriteLineL(_L("%S%S%S"), &KXMLTimeTag, &clock, &KXMLTimeTagEnd);
+        }
+    else
+        {
+        WriteLineL( _L( "%S" ), &date );
+        WriteLineL( _L( "%S" ), &clock );
+        }
+    
+    if ( iReportMode & ETestReportSummary )
+        {
+        if( iOutput == ETEFTestReportOutput_File )
+            {
+            // Get current file position
+            iSummaryPos = 0;
+            User::LeaveIfError( iFile.Seek( ESeekCurrent, iSummaryPos ) );
+            }
+        // Generate Summary to Report
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTag);
+            WriteLineL(_L("%S%S%S"), &KXMLPassedTag, &KXMLPassedTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLFailedTag, &KXMLFailedTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLTimeoutedTag, &KXMLTimeoutedTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLCrashedTag, &KXMLCrashedTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLTotalTag, &KXMLTotalTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTagEnd);
+            }
+        else
+            {
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL(_L("SUMMARY:") );
+            WriteLineL(_L("\tPassed cases: %S"), &KSummaryLineEnd );
+            WriteLineL(_L("\tFailed cases: %S"), &KSummaryLineEnd );
+            WriteLineL(_L("\tTimeout cases: %S"), &KSummaryLineEnd );
+            WriteLineL(_L("\tCrashed cases: %S"), &KSummaryLineEnd );
+            WriteLineL(_L("\tTotal cases: %S"), &KSummaryLineEnd );
+            WriteLineL( _L( "" ));
+            }   
+        }
+
+    if ( iReportMode & ETestReportEnvironment )
+        {
+        const TInt KMegaByte = 1024*1024;
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLEnvironmentInfoTag);
+            WriteLineL(_L("%S"), &KXMLHardwareInfoTag);
+            WriteLineL(_L("%S0x%x%S"), &KXMLManufacturerTag, iReportHWInfo.iHwInfo.iManufacturer, &KXMLManufacturerTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLMachineUidTag, iReportHWInfo.iHwInfo.iMachineUid, &KXMLMachineUidTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLModelTag, iReportHWInfo.iHwInfo.iModel, &KXMLModelTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLHwRevisionTag, iReportHWInfo.iHwInfo.iHwRev, &KXMLHwRevisionTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLCpuTag, iReportHWInfo.iHwInfo.iCpu, &KXMLCpuTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLCpuSpeedTag, iReportHWInfo.iHwInfo.iCpuSpeed/1000, &KXMLCpuSpeedTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLLanguageTag, iReportHWInfo.iHwInfo.iLanguage, &KXMLLanguageTagEnd);
+            WriteLineL(_L("%S"), &KXMLHardwareInfoTagEnd);
+            WriteLineL(_L("%S"), &KXMLSoftwareInfoTag);
+            WriteLineL(_L("%S0x%x%S"), &KXMLSwRevisionTag, iReportHWInfo.iSwInfo.iSwRev, &KXMLSwRevisionTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLSwBuildTag, iReportHWInfo.iSwInfo.iSwBuild, &KXMLSwBuildTagEnd);
+            WriteLineL(_L("%S"), &KXMLSoftwareInfoTagEnd);
+            WriteLineL(_L("%S"), &KXMLMemoryInfoTag);
+            WriteLineL(_L("%S%d%S"), &KXMLRamTag, iReportHWInfo.iMemoryInfo.iRAM/KMegaByte, &KXMLRamTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLRamFreeTag, iReportHWInfo.iMemoryInfo.iRAMFree/KMegaByte, &KXMLRamFreeTagEnd);
+            WriteLineL(_L("%S"), &KXMLMemoryInfoTagEnd);            
+            WriteLineL(_L("%S"), &KXMLEnvironmentInfoTagEnd);            
+            }
+        else
+            {
+            // HW Info
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL( _L("ENVIRONMENT INFO:") );
+            WriteLineL( _L("HW Info:") );
+    
+            WriteLineL(
+                _L("\tManufacturer: 0x%x, MachineUid: 0x%x, Model: 0x%x "),
+                    iReportHWInfo.iHwInfo.iManufacturer,
+                    iReportHWInfo.iHwInfo.iMachineUid,
+                    iReportHWInfo.iHwInfo.iModel );
+            WriteLineL(
+                _L("\tHW Rev: 0x%x, CPU: 0x%x, CPU Speed: %d MHz "),
+                    iReportHWInfo.iHwInfo.iHwRev,
+                    iReportHWInfo.iHwInfo.iCpu,
+                    iReportHWInfo.iHwInfo.iCpuSpeed/1000 );
+            WriteLineL(_L("\tLanguage: %d "),
+                iReportHWInfo.iHwInfo.iLanguage );
+    
+            // SW Info
+            WriteLineL(_L("SW Info:") );
+            WriteLineL(_L("\tSW Rev: 0x%x, SW Build: 0x%x"),
+                iReportHWInfo.iSwInfo.iSwRev,
+                iReportHWInfo.iSwInfo.iSwBuild );
+    
+            // Memory Info
+            WriteLineL(_L("Memory Info:") );
+            WriteLineL(_L("\tRAM: %d MB, RAM Free: %d MB"),
+                ( iReportHWInfo.iMemoryInfo.iRAM/KMegaByte ),
+                ( iReportHWInfo.iMemoryInfo.iRAMFree/KMegaByte ) );
+    
+            WriteLineL( _L( "" ) );
+            }
+        }
+        
+    if ( iReportMode & ETestReportCases )
+        {
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesTag);
+            }
+        else
+            {
+            // Generate Test Cases to Report
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL( _L("TESTCASE SUMMARY:") );
+            }
+        }
+
+    if ( iReportMode == ETestReportBlank )
+        {
+        if(!iXML)
+            {
+            WriteLineL( _L( "") );
+            WriteLineL( _L( "'Empty' configuration given in initialization file's [Engine_Defaults] section" ) );
+            WriteLineL( _L( "No test report created" ) );
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: WriteTrailerL
+
+    Description: Write test report trailer.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::WriteTrailerL()
+    {
+    if(iXML && (iReportMode & ETestReportCases))
+        {
+        WriteLineL(_L("%S"), &KXMLTestCasesTagEnd);
+        }
+
+    if ( iReportMode & ETestReportSummary )
+        {
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLModuleSummaryTag);            
+            }
+        else
+            {
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL(_L("TESTMODULE SUMMARIES:") );
+            }
+        // Generate module related reports
+        for ( TInt k = 0; k < iTestSummaries.Count(); k++ )
+            {
+            if(iXML)
+                {
+                WriteLineL(_L("%S"), &KXMLModuleTag);
+                WriteLineL(_L("%S%S%S"), &KXMLModuleNameTag, &iTestSummaries[k]->iName, &KXMLModuleNameTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLPassedTag, iTestSummaries[k]->iPassedCases, &KXMLPassedTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLFailedTag, iTestSummaries[k]->iFailedCases, &KXMLFailedTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLTimeoutedTag, iTestSummaries[k]->iTimeoutCases, &KXMLTimeoutedTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLCrashedTag, iTestSummaries[k]->iCrashedCases, &KXMLCrashedTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLTotalTag, iTestSummaries[k]->iPassedCases + iTestSummaries[k]->iFailedCases + iTestSummaries[k]->iTimeoutCases + iTestSummaries[k]->iCrashedCases, &KXMLTotalTagEnd);
+                WriteLineL(_L("%S"), &KXMLModuleTagEnd);
+                }
+            else
+                {
+                WriteLineL(_L("Module: [%S]"),
+                    &iTestSummaries[k]->iName );
+                WriteLineL(_L("\tPassed cases: %d"),
+                    iTestSummaries[k]->iPassedCases );
+                WriteLineL(_L("\tFailed cases: %d"),
+                    iTestSummaries[k]->iFailedCases );
+                WriteLineL(_L("\tTimeout cases: %d"),
+                    iTestSummaries[k]->iTimeoutCases );
+                WriteLineL(_L("\tCrashed cases: %d"),
+                    iTestSummaries[k]->iCrashedCases );
+                TInt moduleTotal = iTestSummaries[k]->iPassedCases +
+                    iTestSummaries[k]->iFailedCases +
+                    iTestSummaries[k]->iTimeoutCases +
+                    iTestSummaries[k]->iCrashedCases;
+                WriteLineL(_L("\tTotal cases: %d"), moduleTotal );
+                WriteLineL( _L( "" ) );
+                }
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLModuleSummaryTagEnd);            
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLDllSummaryTag);            
+            }
+        else
+            {
+            WriteDelimiterL(_L( "-- " ), 25 );
+            WriteLineL(_L("TEST MODULES VERSIONS:"));
+            }
+
+        // Generate test module versions info
+        for( TInt i = 0; i < iTestModulesVersionsInfo.Count(); i++ )
+            {
+            TTEFTestModuleVersionInfo* versionInfo = (TTEFTestModuleVersionInfo*)iTestModulesVersionsInfo[i];
+            if(iXML)
+                {
+                WriteLineL(_L("%S"), &KXMLDllTag);
+                WriteLineL(_L("%S%S%S"), &KXMLFileNameTag, &(versionInfo->iTestModuleName), &KXMLFileNameTagEnd);
+                WriteLineL(_L("%S%d.%d.%d%S"), &KXMLVersionTag, versionInfo->iMajor, versionInfo->iMinor, versionInfo->iBuild, &KXMLVersionTagEnd);
+                WriteLineL(_L("%S"), &KXMLDllTagEnd);
+                }
+            else
+                {
+                WriteLineL(_L("%S %d.%d.%d"), &(versionInfo->iTestModuleName), versionInfo->iMajor, versionInfo->iMinor, versionInfo->iBuild);
+                }
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLDllSummaryTagEnd);            
+            }
+        }
+    
+    if(!iXML)
+        {
+        WriteLineL( _L( "" ) );
+        }
+    
+    if( ( iFormat == ETEFTestReportLoggerType_Html ) && 
+        ( iOutput == ETEFTestReportOutput_File ) )
+        {        
+        // Html start tags to whole page and header section
+        iFile.Write(
+            _L8( "\n\n\n</html>\n</body>\n\n\n" ) );
+        }
+
+    if(iXML)
+        {
+        WriteLineL(_L("%S"), &KXMLTestReportTagEnd);            
+        }
+    }
+            
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: UpdateReportSummaryL
+
+    Description: Updates the test report summary.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::UpdateReportSummaryL()
+    {
+    TInt currentPos = 0;
+    // Add numeric information to summary
+    if ( iReportMode & ETestReportSummary )
+        {
+        // Go to the summary start position of the file
+        if( iOutput == ETEFTestReportOutput_File )
+            {
+            User::LeaveIfError(iFile.Seek(ESeekCurrent, currentPos));//Get current position
+            User::LeaveIfError( iFile.Seek( ESeekStart, iSummaryPos ) );
+            }
+        TBuf<KSummaryLineEndLen> numStr;        
+        // Generate Summary to Report
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTag);
+            }
+        else
+            {
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL(_L("SUMMARY:") );
+            }
+        numStr.Num( iTotalSummary->iPassedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLPassedTag, &numStr, &KXMLPassedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tPassed cases: %S"), &numStr );
+            }
+        
+        numStr.Num( iTotalSummary->iFailedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLFailedTag, &numStr, &KXMLFailedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tFailed cases: %S"), &numStr );
+            }
+            
+        numStr.Num( iTotalSummary->iTimeoutCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLTimeoutedTag, &numStr, &KXMLTimeoutedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tTimeout cases: %S"), &numStr );
+            }
+        
+        numStr.Num( iTotalSummary->iCrashedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLCrashedTag, &numStr, &KXMLCrashedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tCrashed cases: %S"), &numStr );
+            }
+        
+        TInt total = iTotalSummary->iPassedCases +
+            iTotalSummary->iFailedCases +
+            iTotalSummary->iTimeoutCases +
+            iTotalSummary->iCrashedCases;
+        numStr.Num( total );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLTotalTag, &numStr, &KXMLTotalTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tTotal cases: %S"), &numStr );
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTagEnd);
+            }
+
+        if(iOutput == ETEFTestReportOutput_File)
+            {
+            User::LeaveIfError(iFile.Seek(ESeekStart, currentPos));
+            }
+        }
+    }
+            
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: GenerateReportL
+
+    Description: Generate the test report.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::GenerateReportL()
+    {
+    WriteTrailerL();
+    
+    // Add numeric information to summary
+    if ( iReportMode & ETestReportSummary )
+        {
+        // Go to the summary start position of the file
+        if( iOutput == ETEFTestReportOutput_File )
+            {
+            User::LeaveIfError( iFile.Seek( ESeekStart, iSummaryPos ) );
+            }
+        TBuf<KSummaryLineEndLen> numStr;
+        // Generate Summary to Report
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTag);
+            }
+        else
+            {
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL(_L("SUMMARY:") );
+            }
+
+        numStr.Num( iTotalSummary->iPassedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLPassedTag, &numStr, &KXMLPassedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tPassed cases: %S"), &numStr );
+            }
+
+        numStr.Num( iTotalSummary->iFailedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLFailedTag, &numStr, &KXMLFailedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tFailed cases: %S"), &numStr );
+            }
+        
+        numStr.Num( iTotalSummary->iTimeoutCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLTimeoutedTag, &numStr, &KXMLTimeoutedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tTimeout cases: %S"), &numStr );
+            }
+        
+        numStr.Num( iTotalSummary->iCrashedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLCrashedTag, &numStr, &KXMLCrashedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tCrashed cases: %S"), &numStr );
+            }
+        
+        TInt total = iTotalSummary->iPassedCases +
+            iTotalSummary->iFailedCases +
+            iTotalSummary->iTimeoutCases +
+            iTotalSummary->iCrashedCases;
+        numStr.Num( total );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLTotalTag, &numStr, &KXMLTotalTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tTotal cases: %S"), &numStr );
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTagEnd);
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: WriteLine
+
+    Description: Write line to file.
+
+    Parameters: TRefByValue<const TDesC> aStr: in: test to print
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::WriteLineL( TRefByValue<const TDesC> aStr,... )
+    {
+    
+    VA_LIST list;
+    VA_START( list, aStr );
+    TPrintInfo line;
+
+    // Parse parameters
+    line.AppendFormatList( aStr, list, NULL );
+    
+    if( iOutput == ETEFTestReportOutput_RDebug )
+        {
+        // RDebug output
+        RDebug::Print( line );
+        return;
+        }
+    
+    HBufC8* buf = HBufC8::NewLC( line.Length() + KMaxLenEol );
+    TPtr8 ptr( buf->Des() );
+    ptr.Copy( line );    
+            
+    if( ( iFormat == ETEFTestReportLoggerType_Html ) && 
+        ( iOutput == ETEFTestReportOutput_File ) )
+        {
+        // Html output, add linefeed
+        ptr.Append( _L8("<BR>\r\n") );
+        }
+    else 
+        {
+        // Default: Text format to file
+        // Add linefeed
+        ptr.Append( _L8("\r\n") );
+        }
+    
+    // Write to file    
+    iFile.Write( ptr );
+    CleanupStack::PopAndDestroy( buf );
+    
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: WriteDelimiter
+
+    Description: Write delimiter line to file.
+
+    Parameters: const TDesC& aDelimiter: in: delimiter mark
+                TInt aCount: in: number of delimiters written
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::WriteDelimiterL( const TDesC& aDelimiter, TInt aCount )
+    {
+    
+     if( iOutput == ETEFTestReportOutput_RDebug )
+        {
+        // RDebug output
+        // Nothing is printed
+        return;
+        }
+    
+    HBufC8* buf = HBufC8::NewLC( aDelimiter.Length() );
+    TPtr8 ptr( buf->Des() );
+    ptr.Copy( aDelimiter );    
+    
+    for( TInt i = 0; i<aCount; i++ )
+        {
+        // Write to file    
+        iFile.Write( ptr );
+        }
+    CleanupStack::PopAndDestroy( buf );
+    
+    TBuf8<KMaxLenEol> linefeed;        
+    if( ( iFormat == ETEFTestReportLoggerType_Html ) && 
+        ( iOutput == ETEFTestReportOutput_File ) )
+        {
+        // Html output, add linefeed
+        linefeed.Append( _L8("<BR>\r\n") );
+        }
+    else 
+        {
+        // Default: Text format to file
+        // Add linefeed
+        linefeed.Append( _L8("\r\n") );
+        }
+     // Write to file    
+    iFile.Write( linefeed );
+    
+    }        
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: TTestReportHeader::TTestReportHeader
+
+    Description: Constructor of TTestReportHeader
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTEFTestReport::TTestHWInfo::TTestHWInfo()
+    {
+    // Initialize, fills a specified block of data with binary zeroes
+    Mem::FillZ( this, sizeof( CTEFTestReport::TTestHWInfo ) );
+
+    // Get HW Info
+    HAL::Get( HALData::EManufacturer, iHwInfo.iManufacturer );
+    HAL::Get( HALData::EMachineUid, iHwInfo.iMachineUid );
+    HAL::Get( HALData::EManufacturerHardwareRev, iHwInfo.iHwRev );
+    HAL::Get( HALData::EModel, iHwInfo.iModel );
+    HAL::Get( HALData::ECPU, iHwInfo.iCpu );
+    HAL::Get( HALData::ECPUSpeed, iHwInfo.iCpuSpeed );
+    HAL::Get( HALData::ELanguageIndex, iHwInfo.iLanguage );
+
+    // Get SW Info
+    HAL::Get( HALData::EManufacturerSoftwareRev, iSwInfo.iSwRev );
+    HAL::Get( HALData::EManufacturerSoftwareBuild, iSwInfo.iSwBuild );
+
+    // Memory Info
+    HAL::Get( HALData::EMemoryRAM, iMemoryInfo.iRAM );
+    HAL::Get( HALData::EMemoryRAMFree, iMemoryInfo.iRAMFree );
+
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: TTestSummary::TTestSummary
+
+    Description: Constructor of TTestSummary.
+
+    Parameters: const TName& aName: in: Name of summary
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTEFTestReport::TTestSummary::TTestSummary( const TName& aName ) :
+    iName( aName ),
+    iPassedCases( 0 ),
+    iFailedCases( 0 ),
+    iCrashedCases( 0 ),
+    iTimeoutCases( 0 )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: AddTestModuleVersion
+    
+    Description: Method adds version of a test module to the list of versions
+                 that will be printed when stif is stopped.
+                 
+    Parameters: TTEFTestModuleVersionInfo aVersion : object contains information about version and
+                name of test module.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+-------------------------------------------------------------------------------
+*/
+
+void CTEFTestReport::AddTestModuleVersion(TTEFTestModuleVersionInfo& aVersion)
+    {
+    for(TInt i = 0; i < iTestModulesVersionsInfo.Count(); i++)
+        {
+        if( aVersion.iTestModuleName == iTestModulesVersionsInfo[i]->iTestModuleName )
+            {
+            return;
+            }
+        }
+    
+    TTEFTestModuleVersionInfo* testModuleVersionInfo = new (ELeave) TTEFTestModuleVersionInfo;
+    testModuleVersionInfo->iMajor = aVersion.iMajor;
+    testModuleVersionInfo->iMinor = aVersion.iMinor;
+    testModuleVersionInfo->iBuild = aVersion.iBuild;
+    testModuleVersionInfo->iTestModuleName = aVersion.iTestModuleName;
+    
+    TInt res = iTestModulesVersionsInfo.Append(testModuleVersionInfo);
+    if( res != KErrNone )
+        {
+        delete testModuleVersionInfo;
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: TTestCaseSummary::TTestCaseSummary
+
+    Description: Constructor of TTestCaseSummary.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTEFTestReport::TTestCaseSummary::TTestCaseSummary()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTEFTestReport
+
+    Method: CloseXMLTagsInUnfinishedFileL
+
+    Description: Adds needed tags to get valid xml file.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Seek operations may cause leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTEFTestReport::CloseXMLTagsInUnfinishedFileL(void)
+    {
+    // For xml file keep current position in file.
+    if(iXML)
+        {
+        TInt currentPos = 0;
+        User::LeaveIfError(iFile.Seek(ESeekCurrent, currentPos));
+        
+        // Add closing tags to get valid xml file
+        WriteLineL(_L("%S"), &KXMLTestCasesTagEnd);
+        WriteLineL(_L("%S"), &KXMLTestReportTagEnd);
+        
+        // Move back to previous position
+        User::LeaveIfError(iFile.Seek(ESeekStart, currentPos));
+        }
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/teftimer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CTEFTimer
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+
+#include "teftimer.h"
+
+EXPORT_C CTEFTimer* CTEFTimer::NewL(MTEFTimerCallback& aCallback, TInt aPriority)
+/**
+ * Two phase constructor
+ *
+ * @param	aCallback - owner to notify on completion of timer
+ * @param	aPriority - priority of CActive
+ *
+ * @see		MTEFTimerCallback
+ */
+	{
+	CTEFTimer*	ret=new (ELeave) CTEFTimer(aCallback, aPriority);
+	CleanupStack::PushL(ret);
+	ret->ConstructL();
+	CleanupStack::Pop(ret);
+	return ret;
+	}
+
+CTEFTimer::CTEFTimer(MTEFTimerCallback& aCallback, TInt aPriority)
+/**
+ * Constructor
+ *
+ * @param	aCallback - owner to notify on completion of timer
+ * @param	aPriority - priority of CActive
+ *
+ * @see		MTEFTimerCallback
+ */
+:	CTimer(aPriority)
+,	iCallback(aCallback)
+	{
+
+	}
+
+void CTEFTimer::ConstructL()
+/**
+ * Second phase constructor
+ *
+ * @leave	system wide error
+ */
+	{
+	CTimer::ConstructL();
+	CActiveScheduler::Add(this);
+	}
+
+void CTEFTimer::RunL()
+	{
+	iCallback.TimerCompleted();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/tefutils.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TEFUtils.cpp
+*/
+
+#include <e32base.h>
+#include <f32file.h>
+#include <test/tefexportconst.h>
+#include "tefutils.h"
+
+EXPORT_C CWrapperUtilsPlugin* TEFUtils::WrapperPluginNew(RLibrary& aLibrary)
+	{
+	const TInt KDllNameLength = 32;
+	TInt pluginErr = KErrGeneral;
+	CWrapperUtilsPlugin* plugin = NULL;
+	TInt index = KOsVersionCount;
+	TBuf<KDllNameLength> wrapperDllName;
+	_LIT(wrapperDllNameFormat, "WrapperUtilsPlugin%d.dll");
+	pluginErr = aLibrary.Load(_L("WrapperUtilsPlugin.dll"));
+	while (KErrNone != pluginErr && index != 0)
+		{
+		wrapperDllName.Format(wrapperDllNameFormat, index);
+		pluginErr = aLibrary.Load(wrapperDllName); //KTEFWrapperPluginDll
+		--index;
+		}
+	
+	if (pluginErr == KErrNone)
+		{
+		TLibraryFunction newl;
+		newl = aLibrary.Lookup(1);
+		TRAP(pluginErr, plugin = (CWrapperUtilsPlugin*)newl());
+		if (KErrNone != pluginErr)
+			{
+			aLibrary.Close();
+			}
+		}
+	
+	return plugin;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testblockcontroller.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,577 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CTestBlockController
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+
+#include "testblockcontroller.h"
+#include "datawrapper.h"
+
+_LIT(KName,				"name");
+
+
+// Errors
+_LIT(KErrNotExist,			"Object does not exist.");
+_LIT(KErrNoCleanup,			"Object does not have a cleanup operation.");
+_LIT(KErrNoName,			"No name provided.");
+_LIT(KErrNoFunction,		"No function provided.");
+_LIT(KErrSharedData,		"Test server needs to be loaded in -SharedData mode.");
+_LIT(KErrCmdUnknown,		"Unknown command.");
+_LIT(KErrWrapperCreate,		"Can't create an object wrapper of type %S");
+_LIT(KErrBlockCorrupt,		"Corrupt block of commands.");
+_LIT(KErrActiveSched,		"Active Scheduler, error = %d");
+_LIT(KErrSharedMode,		"-SharedData mode required.");
+_LIT(KErrSchedulerLoc,		"SHARED_ACTIVE_SCHEDULER command must be first in block.");
+_LIT(KLocalScheduler,		"Creating a local active scheduler.");
+_LIT(KSharedScheduler,		"Creating a shared active scheduler.");
+_LIT(KSharedServer,			"Error accessing the test server.");
+_LIT(KErrOutstanding,		"Outstanding failed with error %d.");
+
+// Defaults
+const TInt				KDefaultDelay		= 1000000;
+const TInt				KDefaultInterval	= 1000000;
+
+EXPORT_C CTestBlockController::CTestBlockController()
+/**
+ * Constructor
+ */
+:	iBlockArray(NULL)
+,	iCommandProcessor(NULL)
+,	iActiveScheduler(NULL)
+,	iTimer(NULL)
+,	iPeriodic(NULL)
+,	iAsyncTimer(EFalse)
+,	iTimerActive(EFalse)
+,	iCommandIndex(0)
+,	iAsyncCount(0)
+,	iSharedData(NULL)
+,	iDeleteSharedScheduler(ETrue)
+	{
+	}
+
+EXPORT_C CTestBlockController::~CTestBlockController()
+/**
+ * Destructor
+ */
+	{
+	if( iTimer )
+		{
+		delete iTimer;
+		iTimer=NULL;
+		}
+
+	if( iPeriodic )
+		{
+		delete iPeriodic;
+		iPeriodic=NULL;
+		}
+
+	if( iCommandProcessor )
+		{
+		delete iCommandProcessor;
+		iCommandProcessor=NULL;
+		}
+
+	if( iActiveScheduler )
+		{
+		delete iActiveScheduler;
+		iActiveScheduler=NULL;
+		}
+
+	if( IsSharedDataMode() && iDeleteSharedScheduler && iSharedData)
+		{
+		TRAP_IGNORE(iSharedData->DeleteActiveSchedulerL());
+		}
+
+	}
+
+EXPORT_C TVerdict CTestBlockController::doTestStepPreambleL()
+	{
+	TVerdict	ret = CTestStep::doTestStepPreambleL();
+
+	if( !iSharedData )
+		{
+		ERR_PRINTF1(KSharedServer);
+		User::Leave(KErrBadHandle);
+		}
+
+	// Test for a persistent active scheduler command
+	if( ETEFSharedActiveScheduler == iBlockArray->At(iCommandIndex).iItemType )
+		{
+		if( IsSharedDataMode() )
+			{
+			INFO_PRINTF1(KSharedScheduler);
+			iSharedData->CreateActiveSchedulerL();
+			}
+		else
+			{
+			iBlockArray->At(iCommandIndex).iError = KErrNotSupported;
+			ERR_PRINTF1(KErrSharedMode);
+
+			// Create a new active scheduler
+			INFO_PRINTF1(KLocalScheduler);
+			iDeleteSharedScheduler = EFalse;
+			iActiveScheduler=new (ELeave) CBlockActiveScheduler(*this);
+			CActiveScheduler::Install(iActiveScheduler);
+			}
+		iBlockArray->At(iCommandIndex).iExecuted = ETrue;
+		iCommandIndex++;
+		}
+	else
+		{
+		if( IsSharedDataMode() )
+			{
+			// Ensure there is no persistent active scheduler if in -SharedData mode
+			iSharedData->DeleteActiveSchedulerL();
+			}
+
+		// Create a new active scheduler
+		INFO_PRINTF1(KLocalScheduler);
+		iDeleteSharedScheduler = EFalse;
+		iActiveScheduler=new (ELeave) CBlockActiveScheduler(*this);
+		CActiveScheduler::Install(iActiveScheduler);
+		}
+
+	iCommandProcessor=CCommandProcessor::NewL(*this);
+	iTimer=CTEFTimer::NewL(*this);
+	iPeriodic=CPeriodic::NewL(CActive::EPriorityStandard);
+
+	return ret;
+	}
+
+EXPORT_C TVerdict CTestBlockController::doTestStepL()
+	{
+	//	Execute oommands
+	StartCommands();
+	CActiveScheduler::Start();
+
+	return TestStepResult();
+	}
+
+EXPORT_C TVerdict CTestBlockController::doTestStepPostambleL()
+	{
+	iDataDictionary.Empty();
+	return TestStepResult();
+	}
+
+EXPORT_C void CTestBlockController::SetBlockArray( TTEFItemArray* aBlockArray )
+	{
+	iBlockArray = aBlockArray;
+	}
+
+EXPORT_C void CTestBlockController::SetSharedData( MSharedData* aSharedData )
+	{
+	iSharedData = aSharedData;
+	}
+
+EXPORT_C void CTestBlockController::SetError(const TInt aError)
+	{
+	iBlockArray->At(iCommandIndex).iError = aError;
+	}
+
+EXPORT_C void CTestBlockController::SetAsyncError(const TInt aIndex, const TInt aError)
+	{
+	iBlockArray->At(aIndex).iAsyncError = aError;
+	}
+
+EXPORT_C void CTestBlockController::SetBlockResult(const TVerdict aResult)
+	{
+	SetTestStepResult(aResult);
+	}
+
+EXPORT_C TVerdict CTestBlockController::BlockResult()
+	{
+	return TestStepResult();
+	}
+
+EXPORT_C TBool CTestBlockController::DoCommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex)
+	{
+	TBool			synchronous	= ETrue;
+
+	if( ETEFCreateObject==aCommand.iItemType )
+		{
+		CreateObjectL(aCommand);
+		}
+	else if( ETEFRestoreObject==aCommand.iItemType )
+		{
+		RestoreObjectL(aCommand);
+		}
+	else if( ETEFStore==aCommand.iItemType )
+		{
+		StoreL(aCommand);
+		}
+	else if( ETEFDelay==aCommand.iItemType )
+		{
+		User::After(aCommand.iTime?aCommand.iTime:KDefaultDelay );
+		}
+	else if( ETEFAsyncDelay==aCommand.iItemType )
+		{
+		synchronous=EFalse;
+		StartTimer(aCommand);
+		}
+	else if( ETEFOutstanding==aCommand.iItemType )
+		{
+		synchronous=EFalse;
+		iPeriodic->Start(	0,
+							aCommand.iTime?aCommand.iTime:KDefaultInterval,
+							TCallBack(OutstandingCallback,this));
+		}
+	else if( ETEFSharedActiveScheduler==aCommand.iItemType )
+		{
+		aCommand.iError = KErrNotSupported;
+		ERR_PRINTF1(KErrSchedulerLoc);
+		}
+	else if( ETEFStoreActiveScheduler==aCommand.iItemType )
+		{
+		StoreActiveScheduler(aCommand);
+		}
+	else if( ETEFCommand==aCommand.iItemType )
+		{
+		CommandL(aCommand, aAsyncErrorIndex);
+		}
+	else
+		{
+		ERR_PRINTF1(KErrCmdUnknown);
+		aCommand.iError = KErrNotSupported;
+		}
+
+	// Update the iExecuted flag
+	aCommand.iExecuted = ETrue;
+
+	return synchronous;
+	}
+
+
+void CTestBlockController::CreateObjectL(TTEFBlockItem& aCommand)
+	{
+	// Retrieve the object name from the ini file
+	TPtrC	name;
+	if( GetStringFromConfig(aCommand.iSection, KName, name) &&
+		0 != aCommand.iSection.Compare(KTEFNull) )
+		{
+		// Create the wrapper
+		CDataWrapper*	data = CreateDataL(aCommand.iObjectType);
+		if( NULL != data)
+			{
+			CleanupStack::PushL(data);
+			data->SetTestBlockController(this);
+			data->SetDataDictionary(&iDataDictionary);
+			data->InitialiseL();
+			// Add it to the dictionary with the lookup name provided
+			iDataDictionary.AddDataL(name, data);
+			CleanupStack::Pop(data);
+			}
+		else
+			{
+			aCommand.iError = KErrNotFound;
+			ERR_PRINTF2( KErrWrapperCreate, &name );
+			}
+		}
+	else
+		{
+		ERR_PRINTF1(KErrNoName);
+		aCommand.iError = KErrNotFound;
+		}
+	}
+
+void CTestBlockController::RestoreObjectL(TTEFBlockItem& aCommand)
+	{
+	if( IsSharedDataMode() )
+		{
+		// Retrieve the object name from the ini file
+		TPtrC	name;
+		if( 0 != aCommand.iSection.Compare(KTEFNull) &&
+			GetStringFromConfig(aCommand.iSection, KName, name) )
+			{
+			// Create the wrapper
+			CDataWrapper*	data = CreateDataL(aCommand.iObjectType);
+
+			if( NULL != data)
+				{
+				CleanupStack::PushL(data);
+				data->SetTestBlockController(this);
+				data->SetDataDictionary(&iDataDictionary);
+				data->InitialiseL();
+
+				// Add it to the dictionary with the lookup name provided
+				iDataDictionary.AddDataL(name, data);
+
+				// Retrieve the object from the persistent store
+				TAny*	object = NULL;
+				TRAPD( err, object = iSharedData->GetObjectAndOwnL(name) );
+				if( KErrNone == err )
+					{
+					CleanupStack::PushL(object);
+					// Update the object contained within the wrapper
+					iDataDictionary.SetObjectL(name, object);
+					CleanupStack::Pop(object);
+					}
+				else
+					{
+					ERR_PRINTF1(KErrNotExist);
+					iDataDictionary.DeleteDataL(name);
+					aCommand.iError = KErrNotFound;
+					}
+				CleanupStack::Pop(data);
+				}
+			else
+				{
+				aCommand.iError = KErrNotFound;
+				ERR_PRINTF2( KErrWrapperCreate, &name );
+				}
+			}
+		else
+			{
+			ERR_PRINTF1(KErrNoName);
+			aCommand.iError = KErrNotFound;
+			}
+		}
+	else
+		{
+		ERR_PRINTF1(KErrSharedData);
+		aCommand.iError = KErrNotSupported;
+		}
+	}
+
+void CTestBlockController::StoreL(TTEFBlockItem& aCommand)
+	{
+	if( IsSharedDataMode() )
+		{
+		// Retrieve the object name from the ini file
+		TPtrC	name;
+		if( 0 != aCommand.iSection.Compare(KTEFNull) &&
+			GetStringFromConfig(aCommand.iSection, KName, name) )
+			{
+			// Lookup the wrapper
+			CDataWrapper*	data = iDataDictionary.GetDataL( name );
+
+			// Retrieve the object being wrapped
+			TAny*			object = data->GetObject();
+			if ( object!=NULL )
+				{
+				// Add it to the persistent store
+				TCleanupOperation	operation=data->CleanupOperation();
+				if ( operation!=NULL )
+					{
+					iSharedData->PutAndDisownL(name, object, operation);
+					data->DisownObjectL();
+					}
+				else
+					{
+					ERR_PRINTF1(KErrNoCleanup);
+					aCommand.iError = KErrNotFound;
+					}
+				}
+			else
+				{
+				ERR_PRINTF1(KErrNotExist);
+				aCommand.iError = KErrNotFound;
+				}
+			}
+		else
+			{
+			ERR_PRINTF1(KErrNoName);
+			SetTestStepResult(EFail);
+			}
+		}
+	else
+		{
+		ERR_PRINTF1(KErrSharedData);
+		aCommand.iError = KErrNotSupported;
+		}
+	}
+
+void CTestBlockController::StoreActiveScheduler(TTEFBlockItem& aCommand)
+	{
+	if( IsSharedDataMode() )
+		{
+		// Don't delete the persistent active scheduler
+		iDeleteSharedScheduler = EFalse;
+		}
+	else
+		{
+		aCommand.iError = KErrNotSupported;
+		ERR_PRINTF1(KErrSharedMode);
+		}
+	}
+
+void CTestBlockController::CommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex)
+	{
+	// Retrieve the object name from the ini file
+	TPtrC	name;
+	if( 0 != aCommand.iCommand.iObject.Compare(KTEFNull) &&
+		GetStringFromConfig(aCommand.iCommand.iObject, KName, name) )
+		{
+		CDataWrapper*	data = iDataDictionary.GetDataL(name);
+		if( data!=NULL )
+			{
+			TBool cmdExists = EFalse;
+			TRAPD(err, cmdExists = data->DoCommandL(aCommand.iCommand.iFunction, aCommand.iSection, aAsyncErrorIndex));
+			if (KErrNone != err)
+				{
+				ERR_PRINTF4(_L("Command \"%S\" of the object \"%S\" leaves with error code %d"), &aCommand.iCommand.iFunction, &aCommand.iCommand.iObject, err);
+				aCommand.iError = err;
+				SetBlockResult(EFail);
+				}
+			else if( !cmdExists )
+				{
+				ERR_PRINTF1(KErrNoFunction);
+				aCommand.iError = KErrNotFound;
+				}
+			}
+		else
+			{
+			ERR_PRINTF1(KErrNotExist);
+			aCommand.iError = KErrNotFound;
+			}
+		}
+	else
+		{
+		ERR_PRINTF1(KErrNoName);
+		aCommand.iError = KErrNotFound;
+		}
+	}
+
+EXPORT_C void CTestBlockController::StartTimer(const TTEFBlockItem& aCommand)
+	{
+	iTimer->After(aCommand.iTime?aCommand.iTime:KDefaultDelay);
+	}
+
+EXPORT_C void CTestBlockController::CancelTimer()
+	{
+	if ( iTimerActive )
+		{
+		iTimer->Cancel();
+		}
+	}
+
+EXPORT_C void CTestBlockController::TimerCompleted()
+	{
+	if( iAsyncTimer )
+		{
+		DecAsyncCount();
+		}
+	iTimerActive=EFalse;
+	StartCommands();
+	}
+
+EXPORT_C TBool CTestBlockController::OutstandingCallback( TAny* aAny )
+	{
+	CTestBlockController* self = STATIC_CAST(CTestBlockController*,aAny);
+	if( self )
+		{
+		self->OutstandingCallback();
+		}
+	return EFalse;
+	}
+
+EXPORT_C void CTestBlockController::OutstandingCallback()
+	{
+	TBool			ok=ETrue;
+	TTEFBlockItem&	block=iBlockArray->At(iCommandIndex-1);
+
+	TPtrC			name(KTEFNull);
+	if( 0 != block.iSection.Compare(KTEFNull)  )
+		{
+		if ( !GetStringFromConfig(block.iSection, KName, name) )
+			{
+			block.iError = KErrNotFound;
+			ERR_PRINTF1(KErrNoName);
+			ERR_PRINTF1(block.iSection);
+			ok=EFalse;
+			}
+		}
+
+	if ( ok )
+		{
+		TBool	moreToDo;
+		TInt	err=iDataDictionary.Outstanding(name, moreToDo);
+		if( err!=KErrNone )
+			{
+			block.iError = err;
+			ERR_PRINTF2(KErrOutstanding, err);
+			}
+		if ( !moreToDo )
+			{
+			iPeriodic->Cancel();
+			DecAsyncCount();
+			StartCommands();
+			}
+		}
+	}
+
+EXPORT_C CTestBlockController::CBlockActiveScheduler::CBlockActiveScheduler(CTestBlockController& aTestStep)
+:	CActiveScheduler()
+,	iTestStep(aTestStep)
+	{
+	}
+
+EXPORT_C CTestBlockController::CBlockActiveScheduler::~CBlockActiveScheduler()
+	{
+	}
+
+EXPORT_C void CTestBlockController::CBlockActiveScheduler::Error(TInt aError) const
+	{
+	if ( KErrNone != aError )
+		{
+		iTestStep.ERR_PRINTF2(KErrActiveSched, aError);
+		iTestStep.SetTestStepResult(EFail);
+		}
+	CActiveScheduler::Error(aError);
+	}
+
+EXPORT_C void CTestBlockController::StartCommands()
+	{
+	iCommandProcessor->KickState();
+	}
+
+EXPORT_C void CTestBlockController::NextCommandL()
+	{
+	if( iBlockArray )
+		{
+		if( iCommandIndex < iBlockArray->Count() )
+			{
+			TInt synchronous = EFalse;
+			synchronous = DoCommandL(iBlockArray->At(iCommandIndex), iCommandIndex);
+			if( synchronous )
+				{
+				StartCommands();
+				}
+			else
+				{
+				IncAsyncCount();
+				}
+			iCommandIndex++;
+			}
+		else
+			{
+			CActiveScheduler::Stop();
+			}
+		}
+	else
+		{
+		ERR_PRINTF1(KErrBlockCorrupt);
+		SetTestStepResult(EFail);
+		CActiveScheduler::Stop();
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testclient.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2005-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:  
+* Implementation of the RTestServ and RTestSession API's
+*
+*/
+
+
+
+/**
+ @file TestClient.cpp
+*/
+#include <test/testexecuteclient.h>
+#include <test/testexecutestepbase.h>
+
+TVersion RTestServ::Version() const
+	{
+	return(TVersion(KTestExecuteMajorVersionNumber,KTestExecuteMinorVersionNumber,KTestExecuteBuildVersionNumber));
+	}
+
+
+EXPORT_C TInt RTestServ::Connect(const TDesC& aServerName, TBool aDebugMode)
+/**
+ * @param aServerName - Human readable name of the test server
+ * @param aDebugMode - Set to true for just in time debugging
+ * @return int - Standard error codes
+ * Secure version of the API call. Expects the server binary to be
+ * ServerXXX.exe
+ */
+	{
+	if(aServerName.Length() > iServerName.MaxLength())
+		return KErrTooBig;
+	iServerName = aServerName;
+	// Assume the server is already running and attempt to create a session
+	// 4 message slots
+	TInt err = CreateSession(aServerName,Version(),-1);
+	if(err == KErrNotFound || err == KErrServerTerminated)
+		{
+		// Server not running
+		// Construct the server binary name
+		TBuf<KMaxTestExecuteNameLength> serverFile;
+		RProcess server;
+		_LIT(KEmpty,"");
+		_LIT(KExe,".exe");
+
+		serverFile.Copy(aServerName);
+		serverFile.Append(KExe);
+		err = server.Create(serverFile,KEmpty);
+		if(err != KErrNone)
+			return err;
+		// Synchronise with the server
+		TRequestStatus reqStatus;
+		server.Rendezvous(reqStatus);
+
+		// Set just in time debugging for the process
+		if(aDebugMode)
+			server.SetJustInTime(ETrue);
+		else
+			server.SetJustInTime(EFalse);
+
+		// Start the test harness
+		server.Resume();
+		// Server will call the reciprocal static synchronise call
+		User::WaitForRequest(reqStatus);
+		server.Close();
+		if(reqStatus.Int() != KErrNone)
+			return reqStatus.Int();
+		// Create the root server session
+		err = CreateSession(aServerName,Version(),-1);
+		}
+	return err;
+	}
+
+EXPORT_C const TDesC& RTestServ::ServerName() const
+/**
+ * @return - The human readable server name
+ */
+	{
+	return iServerName;
+	}
+
+///////
+EXPORT_C TInt RTestSession::Open(RTestServ& aServ, const TDesC& aStepName, TBool aSharedData)
+/**
+ * @param aServ - Reference to the root server session
+ * @param aStepName - Reference to the name of the test step owned by the server
+ * @return Standard error codes
+ * Secure and Non-secure variants
+ * Synchronously open a server test step session
+ */
+	{
+	if(aStepName.Length() > KMaxTestStepNameLength)
+		return KErrTooBig;
+	TIpcArgs args;
+	args.Set(0,&aStepName);
+	args.Set(1,aSharedData);
+	return CreateSubSession(aServ,EOpenTestStep,args);
+	}
+
+EXPORT_C TInt RTestSession::Open(RTestServ& aServ, TBool aSharedData)
+/**
+ * @param aServ - Reference to the root server session
+ * @param aStepName - Reference to the name of the test step owned by the server
+ * @return Standard error codes
+ * Secure and Non-secure variants
+ * Synchronously open a server test step session
+ */
+	{
+	TIpcArgs args;
+	args.Set(1,aSharedData);
+	return CreateSubSession(aServ,EOpenTestBlock,args);
+	}
+	
+EXPORT_C void RTestSession::RunTestStep(const TDesC& aCommandString, TDes& aPanicString, TRequestStatus& aStatus)
+/**
+ *
+ * @param aCommandString - The arguments to the RUN_TEST_STEP command
+ * @return aPanicString  - If the test step panics, this member is set up with the panic string
+ * @param aStatus - For completion to the caller
+ * Secure and Non-secure variants
+ * Send the RUN_TEST_STEP arguments to the test server
+ */
+	{
+	if(aCommandString.Length() > KMaxTestExecuteCommandLength)
+		{
+		TRequestStatus* status = &aStatus;
+		User::RequestComplete(status,KErrTooBig);
+		}
+	TIpcArgs args;
+	args.Set(0,&aCommandString);
+	args.Set(1,&aPanicString);
+	SendReceive(ERunTestStep,args,aStatus);
+	}
+
+EXPORT_C void RTestSession::RunTestBlock(const TDesC& aCommandString, TDes& aPanicString, TDes8& aBlockArray, TRequestStatus& aStatus)
+/**
+ *
+ * @param aCommandString - The arguments to the test block command
+ * @return aPanicString  - If the test step panics, this member is set up with the panic string
+ * @param aStatus - For completion to the caller
+ * Secure and Non-secure variants
+ * Send the RUN_TEST_STEP arguments to the test server
+ */
+	{
+	if(aCommandString.Length() > KMaxTestExecuteCommandLength)
+		{
+		TRequestStatus* status = &aStatus;
+		User::RequestComplete(status,KErrTooBig);
+		}
+	TIpcArgs args;
+	args.Set(0,&aCommandString);
+	args.Set(1,&aPanicString);
+	args.Set(2,&aBlockArray);
+	
+	SendReceive(ERunTestBlock,args,aStatus);
+	}
+
+EXPORT_C TInt RTestSession::AbortTestStep()
+/**
+ *
+ * @return - Standard Epoc error codes 
+ * Secure and Non-secure variants
+ * Synchronous abort of the the test step
+ */
+	{
+	return SendReceive(EAbortTestStep);
+	}
+
+EXPORT_C void RTestSession::Close()
+	{
+	CloseSubSession(ECloseTestStep);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testexecutelogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4156 @@
+/*
+* Copyright (c) 2005-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:  
+* Interface class which exposes methods to TestExecute to mediate calls to HTML and XML log client sessions
+* Includes construction of console which was previosly within the testexecute.cpp
+* Includes methods for initialising log creation & writing initial and end up tags and results summary
+*
+*/
+
+
+
+/**
+ @file TestExecuteLogger.cpp
+*/
+
+#include "testexecutelogger.h"
+#include "version.h"
+#include "tefconst.h"
+#include "serialwriter.h"
+#include "logging.h"
+#include <test/wrapperutilsplugin.h>
+#include <test/tefutils.h>
+
+
+_LIT8(KHtmlBegin8,"<html><body><pre>\n");
+_LIT8(KHtmlEnd8,"</pre></body></html>\n");
+_LIT(KHtmlBegin16,"<html><body><pre>");
+_LIT(KHtmlEnd16,"</pre></body></html>");
+
+// Test Block XML literals
+_LIT(KObjectType,		"OBJECT_TYPE");
+_LIT(KObjectSection,	"OBJECT_SECTION");
+_LIT(KSection,			"SECTION");
+_LIT(KFunctionName,		"FUNCTION_NAME");
+_LIT(KDelay,			"DELAY");
+_LIT(KInterval,			"INTERVAL");
+_LIT(KEErrorCode,		"EXPECTED_ERROR_CODE");
+_LIT(KErrorCode,		"ERROR_CODE");		
+_LIT(KEAsyncErrorCode,	"EXPECTED_ASYNC_ERROR_CODE");
+_LIT(KAsyncErrorCode,	"ASYNC_ERROR_CODE");
+_LIT(KBadCommand,		"BAD_COMMAND");
+
+/**
+ * Logging Test result information to html formatted file and, at same time, 
+ * a simplified test file. 
+ * The html file is TEF traditional log result file used to acting as TestDB.
+ * The simplified file is used to enable super amount test cases.
+ * @param aLogFileDir - Directory of log file, usually @ testexecute.ini 
+ * 							HTML 	= ${SYSDRIVE}\logs\testexecute\ 
+ * @param aLogFileName - name of log file. 
+ * @param aResultBuf -  log result this is buffer of log.
+ * 
+ * @internalComponent
+ */
+void CTestExecuteLogger::LoggingTestCaseResultToSummaryResultL( const TDesC &aLogFileDir,const TDesC &aLogFileName,const TDesC8 &aResultBuf)
+	{
+	RFs fS;
+	User::LeaveIfError(fS.Connect());
+	CleanupClosePushL(fS);
+
+	TBuf<KMaxTestExecuteNameLength> resultFileName(aLogFileDir);
+	resultFileName.Append(aLogFileName);
+	RFile logFile;
+	User::LeaveIfError(logFile.Open(fS,resultFileName, EFileWrite | EFileRead | EFileShareAny));
+	CleanupClosePushL(logFile);
+
+	TInt pos=0;
+	(void)logFile.Seek(ESeekEnd, pos);
+	(void)logFile.Write(aResultBuf);
+
+	// Closing of objects
+	CleanupStack::Pop(&logFile);
+	logFile.Close();
+	CleanupStack::Pop(&fS);
+	fS.Close();
+	}
+
+
+/**
+ * @param aLogOptions - One of the 3 enum values for HTML, XML and both HTML & XML logging
+ * Constructor
+ * Initialises HTML & XML objects for logging
+ */
+EXPORT_C CTestExecuteLogger::CTestExecuteLogger(TLoggerOptions aLogOptions) : 
+	iLoggerOptions(aLogOptions),
+	iSerialWriter(NULL),
+	iPIPSExists(false),
+	iTestReport(NULL),
+	iCaseNumber(0),
+	iCaseStartTime(0),
+	iCaseEndTime(0)
+	{
+	}
+
+/**
+ * Destructor
+ */
+EXPORT_C CTestExecuteLogger::~CTestExecuteLogger()
+	{
+	}
+
+/**
+ * @param aFile - Name of the file that intiates the LogExtra call
+ * @param aLine - Line number within the file that initiates the call
+ * @param aSeverity - One of the 4 enum values indicating the severity of the message to be logged
+ * @param aFmt - Format string that indicates the number & type of inputs required for the variable argument call
+ * Function displays the message in the log based on the number of inputs followed by the format string
+ */
+EXPORT_C void CTestExecuteLogger::LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,TRefByValue<const TDesC> aFmt,...)
+	{
+	// Create a variable list and collect the arguments into it
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+
+	if(iLoggerChannel == EFile || iLoggerChannel == EBoth)
+		{
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			{
+			// Call the Html log client interface for logging into html log
+			HtmlLogger().LogExtra(aFile, aLine, aSeverity, aFmt, aList);
+			}
+		if (iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth)
+			{
+			// Call the Xml log client interface for logging into xml log
+			XmlLogger().Log(aFile, aLine, RFileFlogger::TLogSeverity(aSeverity), aFmt, aList);
+			}
+		if(iPIPSExists)
+			{
+			PIPSLogger().LogExtra(aFile, aLine, aSeverity, aFmt, aList);
+			}
+		}
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)
+		{
+		HBufC* buffer = HBufC::New(KMaxTestExecuteLogLineLength*2);
+		if (buffer)
+			{
+			TPtr ptr(buffer->Des());
+			ptr.AppendFormatList(aFmt, aList);
+			iSerialWriter->WriteDecorated(ptr);
+			delete buffer;
+			}
+		}	
+	
+	VA_END(aList); 	
+	}
+
+EXPORT_C TInt CTestExecuteLogger::ShareAuto()
+	{
+	if(iPIPSExists)
+		{
+		PIPSLogger().ShareAuto();
+		}
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		{
+		return HtmlLogger().ShareAuto();
+		}
+	return KErrNone;
+	}
+
+EXPORT_C void CTestExecuteLogger::Write(const TDesC& aLogBuffer)
+	{
+	if(iLoggerChannel == EFile || iLoggerChannel == EBoth)
+		{
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			{
+			HtmlLogger().Write(aLogBuffer);
+			}
+		}
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)	
+		{
+		iSerialWriter->WriteDecorated(aLogBuffer) ; 
+		}
+	if(iPIPSExists)
+		{
+		PIPSLogger().Write(aLogBuffer);
+		}
+	}
+
+EXPORT_C void CTestExecuteLogger::WriteFormat(TRefByValue<const TDesC> aFmt,...)
+	{
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	if(iLoggerChannel == EFile || iLoggerChannel == EBoth)
+		{
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			{
+			HtmlLogger().WriteFormat(aFmt, aList);
+			}
+		}
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)
+		{
+		HBufC* buffer = HBufC::New(KMaxTestExecuteLogLineLength*2);
+		if (buffer)
+			{
+			TPtr ptr(buffer->Des());
+			ptr.AppendFormatList(aFmt, aList);
+			iSerialWriter->WriteDecorated(ptr);
+			delete buffer;
+			}
+		}
+	if(iPIPSExists)
+		{
+		PIPSLogger().WriteFormat(aFmt, aList);
+		}
+		
+	VA_END(aList);
+	}
+
+EXPORT_C void CTestExecuteLogger::Write(const TDesC8& aLogBuffer)
+	{
+	if(iLoggerChannel == EFile || iLoggerChannel == EBoth)
+		{
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			{
+			HtmlLogger().Write(aLogBuffer);
+			}
+		}
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)
+		{
+		iSerialWriter->WriteDecorated(aLogBuffer) ; 
+		}
+	if(iPIPSExists)
+		{
+		PIPSLogger().Write(aLogBuffer);
+		}
+	}
+
+EXPORT_C void CTestExecuteLogger::WriteFormat(TRefByValue<const TDesC8> aFmt,...)
+	{
+	// Set up a Variable argument list and call private method
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	if(iLoggerChannel == EFile || iLoggerChannel == EBoth)
+	{
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			{
+			HtmlLogger().WriteFormat(aFmt, aList);
+			}
+	}
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)
+		{
+		HBufC8* buffer = HBufC8::New(KMaxTestExecuteLogLineLength*2);
+		if (buffer)
+			{
+			TPtr8 ptr(buffer->Des());
+			ptr.AppendFormatList(aFmt, aList);
+			iSerialWriter->WriteDecorated(ptr);
+			delete buffer;
+			}
+		}
+	if(iPIPSExists)
+		{
+		PIPSLogger().WriteFormat(aFmt, aList);
+		}
+	VA_END(aList); 
+	}
+
+/**
+ * @param aFile - Name of the file that intiates the LogExtra call
+ * @param aLine - Line number within the file that initiates the call
+ * @param aSeverity - One of the 4 enum values indicating the severity of the message to be logged
+ * @param aCommandName - Name of the command whose fields are logged with the call to the function
+ * @param aNumberOfParams - Represents the size of the structure array being passed in to the function
+ * @param aLogFields - Pointer to the structure array passed in, that contains the field name & their values
+ * Logs the command name along with their field names and values corresponding to each of them
+ * The array should be passed in with structures for holding each of the field name/value pairs
+ */
+EXPORT_C void CTestExecuteLogger::LogToXml(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aCommandName, const TInt aNumberOfParams, TExtraLogField* aLogFields)
+	{
+	if((iLoggerChannel == EFile || iLoggerChannel == EBoth)
+		&&(iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth))
+		{
+		XmlLogger().Log(aFile, aLine, RFileFlogger::TLogSeverity(aSeverity), aNumberOfParams, aLogFields, KTEFStringFormat, &aCommandName);
+		}
+	}
+
+/**
+ * @param aFile - Name of the file that intiates the LogExtra call
+ * @param aLine - Line number within the file that initiates the call
+ * @param aSeverity - One of the 4 enum values indicating the severity of the message to be logged
+ * @param aCommandName - Name of the command whose fields are logged with the call to the function
+ * Logs the command name alone for those that does not have any valid fields for logging
+ */
+EXPORT_C void CTestExecuteLogger::LogToXml(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aCommandName)
+	{
+	if((iLoggerChannel == EFile || iLoggerChannel == EBoth)
+		&&(iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth))
+			{
+			XmlLogger().Log(aFile, aLine, RFileFlogger::TLogSeverity(aSeverity), KTEFStringFormat, &aCommandName);
+			}
+	}
+	
+/**
+ * @param aScriptFilePath - Relative path where the script file is placed
+ * @param aSeparateLogFileMode - Flag that is switched on for separate file for logging, off otherwise
+ * @param aLogLevel - Indicates the default threshold level for logging messages within the XML log
+ * Initialises the logging for both HTML and XML, creating the directory path & files and adding initial tags for the logs
+ */
+EXPORT_C void CTestExecuteLogger::InitialiseLoggingL(const TDesC& aScriptFilePath, TBool aSeparateLogFileMode, TInt aLogLevel)
+	{
+	// Check to see if the plugin wrapper around the GetSystemDrive is loadable
+	// If yes, then instantiate the wrapper object and obtain the default system drive
+	// Else, use the hardcoded default drive as c:
+	TDriveName defaultSysDrive(KTEFLegacySysDrive);
+	RFs fileServer;
+	TVersionName version(fileServer.Version().Name());
+	
+	RLibrary pluginLibrary;
+	CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary);
+	
+	if (plugin!=NULL)
+		{
+		TDriveUnit driveUnit(plugin->GetSystemDrive());
+		defaultSysDrive.Copy(driveUnit.Name());
+		delete plugin;
+		pluginLibrary.Close();
+		}
+
+	// Create a object of Cinidata for parsing ini files
+	CTestExecuteIniData* parseTestExecuteIni = NULL;
+	TBuf<KMaxTestExecuteNameLength> htmlLogPath;
+	TBuf<KMaxTestExecuteNameLength> xmlLogPath;
+	TInt logLevel(aLogLevel);
+	TInt enableCommandsCountLogging;
+	TInt outPort;
+	
+	TRAPD(err,parseTestExecuteIni = CTestExecuteIniData::NewL(defaultSysDrive));
+	if (err == KErrNone)
+		{
+		CleanupStack::PushL(parseTestExecuteIni);
+		parseTestExecuteIni->ExtractValuesFromIni();
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFHtmlKey, htmlLogPath);
+		iHtmlLogPath.Copy(htmlLogPath);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFXmlKey, xmlLogPath);
+		iXmlLogPath.Copy(xmlLogPath);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFRemotePanicDetection, iRemotePanic);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFEnableTestsCountLog, enableCommandsCountLogging);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFLogChannel, iLoggerChannel);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFOutputPort, outPort);
+		CleanupStack::PopAndDestroy(parseTestExecuteIni);
+		}
+	else
+		{
+		TBuf<KMaxTestExecuteNameLength> testExecuteLogPath(KTestExecuteLogPath);
+		testExecuteLogPath.Replace(0, 2, defaultSysDrive);
+		iHtmlLogPath.Copy(testExecuteLogPath);
+		iXmlLogPath.Copy(testExecuteLogPath);
+		iRemotePanic = 0;
+		enableCommandsCountLogging = KTEFOneValue;
+		}
+
+    RFs fS;
+    User::LeaveIfError(fS.Connect());
+    CleanupClosePushL(fS);
+    // Create the path arrived above
+    err = fS.MkDirAll(iHtmlLogPath);
+    if(err != KErrNone && err != KErrAlreadyExists)
+        User::Leave(err); // Leave if unable to create the HTML log path
+    err = fS.MkDirAll(iXmlLogPath);
+    if(err != KErrNone && err != KErrAlreadyExists)
+        User::Leave(err); // Leave if unable to create the XML log path
+
+    // Delete any existing KTestExecuteScheduleTestLogCompatibilityNameFile
+    TBuf<KMaxTestExecuteNameLength> scheduleTestLogFileNameFile(iHtmlLogPath);
+    scheduleTestLogFileNameFile.Append(KTestExecuteScheduleTestLogCompatibilityNameFile);
+    (void)fS.Delete(scheduleTestLogFileNameFile);
+    TBuf<KMaxTestExecuteNameLength> loggerFile;
+    // Set up for separate log files as a safeguard
+    _LIT(KScriptEngine,"ScriptEngine");
+    loggerFile.Copy(KScriptEngine);
+    
+    // HTML format
+    _LIT(KHtmExtension,".htm");
+    // XML format
+    _LIT(KXmlExtension,".xml");
+    
+    if(!aSeparateLogFileMode)
+        {
+        // Extract the log file name from the full script file path
+        // For example - z:\somefolder\somefile.script
+        // We try and extract "somefile".
+        _LIT(KTEFScriptExtension,".script");
+        TInt offset = aScriptFilePath.Find(KTEFScriptExtension);
+        if(offset != KErrNotFound)
+            {
+            // Loop back to isolate \somefile.script
+            TInt i = offset-1;
+            for(;i;i--)
+                {
+                if(aScriptFilePath[i] == '\\')
+                    break;
+                }
+            if(i)
+                {
+                // Get rid of the '\'
+                i++;
+                // For defect 116013, check the name length+path length. If bigger than 80 then leave KErrTooBig
+                if (offset-i+iHtmlLogPath.Length()+KHtmExtension().Length() > KMaxTestExecuteNameLength
+                    || offset-i+iHtmlLogPath.Length()+KXmlExtension().Length() > KMaxTestExecuteNameLength)
+                    {
+                    User::Leave(KErrTooBig);
+                    }
+                // END defect 116013
+                // Isolated somefile.script
+                TInt j(0);
+                // Chop off the ".script"
+                loggerFile.SetLength(offset-i);
+                for(;i<offset;i++,j++)
+                    loggerFile[j]=aScriptFilePath[i];
+                RFile file;
+                CleanupClosePushL(file);
+                // Create KTestExecuteScheduleTestLogCompatibilityNameFile
+                User::LeaveIfError(file.Create(fS,scheduleTestLogFileNameFile,EFileShareAny | EFileWrite));
+                TBuf8<KMaxTestExecuteNameLength> loggerFile8;
+                loggerFile8.Copy(loggerFile);
+                // Write "somefile"
+                User::LeaveIfError(file.Write(loggerFile8));
+                CleanupStack::Pop(&file);
+                file.Close();
+                }
+            }
+        }
+
+    // Construct the full path for HTML
+    TBuf<KMaxTestExecuteNameLength> loggerHtmlFilePath(iHtmlLogPath);
+    loggerHtmlFilePath.Append(loggerFile);
+    loggerHtmlFilePath.Append(KHtmExtension);
+    // Construct the full path for XML
+    TBuf<KMaxTestExecuteNameLength> loggerXmlFilePath(iXmlLogPath);
+    loggerXmlFilePath.Append(loggerFile);
+    loggerXmlFilePath.Append(KXmlExtension);
+
+    // Delete the log files if it exists
+    (void)fS.Delete(loggerHtmlFilePath);
+    (void)fS.Delete(loggerXmlFilePath);
+
+    // Delete the summary file if it exists
+    TBuf<KMaxTestExecuteNameLength> resultSummary(iHtmlLogPath);
+    resultSummary.Append(KTEFTestExecuteResultSummaryFile);
+    (void)fS.Delete(resultSummary);
+    RFile file;
+    // Create a summary file and write the html tags
+    User::LeaveIfError(file.Create(fS,resultSummary, EFileShareAny | EFileWrite));
+    CleanupClosePushL(file);
+    User::LeaveIfError(file.Write(KHtmlBegin8));
+    CleanupStack::Pop(&file);
+    file.Close();
+    
+    // Delete the simplified summary file
+    TBuf<KMaxTestExecuteNameLength> resultSimplifiedSummaryFile(iHtmlLogPath);
+    resultSimplifiedSummaryFile.Append(KTEFTestExecuteResultSimplifiedSummaryFile);
+    (void)fS.Delete(resultSimplifiedSummaryFile);
+    // Create the brand-new simplified summary file
+    User::LeaveIfError(file.Create(fS,resultSimplifiedSummaryFile, EFileShareAny | EFileWrite));
+    file.Close();		
+    
+    CleanupStack::Pop(&fS);
+    fS.Close();
+    
+    // Connect to HTML and XML log client session
+    User::LeaveIfError(Connect());
+
+	// Update the array of commands for any additions to commands count
+	// Also update the KTEFCommandCountsStructSize from the TEFExportConst.h for array size
+	TPtrC commandList[KTEFCommandCountsStructSize] =
+		{
+		TPtrC(KTEFRunScriptCommand),
+		TPtrC(KTEFStartTestCaseCommand),
+		TPtrC(KTEFRunTestStepCommand),
+		TPtrC(KTEFRunTestStepResultCommand),
+		TPtrC(KTEFRunPanicStepCommand),
+		TPtrC(KTEFRunPanicStepResultCommand),
+		TPtrC(KTEFRunProgramCommand),
+		TPtrC(KTEFRunWSProgramCommand),
+		TPtrC(KTEFStartTestBlock)
+		};
+	
+	iRunScriptCommandCount = 0;
+	// Create an instance of the script pre-processor to extract count details of commands listed in array defined above
+	CScriptPreProcess scriptPreProcess(aScriptFilePath, commandList);
+	
+	// enableCommandsCountLogging is a flag which is updated based on the configuration done in testexecute.ini
+	// The script should be pre-processed only if the flag is set to ON in testexecute.ini
+	// The flag is set to OFF by default
+	if (enableCommandsCountLogging == KTEFOneValue)
+		{
+		// Start pre-processing and updates the counts in the structure array
+		scriptPreProcess.CountNoOfOccurences();
+		}
+	
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)		
+			{
+			InitialiseSerialLoggingL(logLevel, enableCommandsCountLogging, scriptPreProcess,outPort);	
+			}
+		if(iLoggerChannel == EFile || iLoggerChannel == EBoth)		
+			{
+			if (iLoggerOptions == ELogHTMLOnly)
+				{
+				// Call Initilise routine for HTML logging
+				// Also need to pass in the status of the enableCommandsCountLogging and the pre-processor object
+				InitialiseHTMLLoggingL(loggerHtmlFilePath, logLevel, enableCommandsCountLogging, scriptPreProcess);
+				}
+			else if (iLoggerOptions == ELogXMLOnly)
+				{
+				// Call Initilise routine for XML logging
+				// Also need to pass in the status of the enableCommandsCountLogging and the pre-processor object
+				InitialiseXMLLoggingL(loggerXmlFilePath, logLevel, enableCommandsCountLogging, scriptPreProcess);
+				}
+			else
+				{
+				// Call Initilise routine for HTML & XML logging
+				// Also need to pass in the status of the enableCommandsCountLogging and the pre-processor object
+				InitialiseHTMLLoggingL(loggerHtmlFilePath, logLevel, enableCommandsCountLogging, scriptPreProcess);
+				InitialiseXMLLoggingL(loggerXmlFilePath, logLevel, enableCommandsCountLogging, scriptPreProcess);
+				}
+			}
+		if(iPIPSExists)
+			{
+			InitialisePIPSLoggingL(logLevel, enableCommandsCountLogging, scriptPreProcess) ;
+			}
+		
+	//Initialise test report.
+	InitialiseTestReportL(loggerFile);
+	}
+
+
+
+EXPORT_C void CTestExecuteLogger::SetPipeName(TPtrC& aPipeName) 
+
+	{
+	User::LeaveIfError(PIPSLogger().CreateLog(aPipeName));
+	}
+/**
+ * Connects to the HTML log client session and creating the logs with initial tags for logging
+ * @param aLogFilePath - Relative path that is arrived after retrieving the path from the user through testexecute.ini
+ * @param aEnableCommandCount - Integer value representing the status of the EnableTestsCountLog option in the testexecute.ini
+ * @param aScriptPreProcess - Reference to the script pre-processor object used for retrieving values from structure array for logging
+ * @leave - If the logger instance is not able to create the HTML log file
+ */
+void CTestExecuteLogger::InitialisePIPSLoggingL( TInt aLogLevel, const TInt& aEnableCommandCount, CScriptPreProcess& aScriptPreProcess)
+	{
+
+	PIPSLogger().SetLogLevel(TLogSeverity(aLogLevel));
+	PIPSLogger().Write(KHtmlBegin16); // Write initial HTML tags
+	// Introduce a new information block called TEST SCRIPT SYNOPSIS
+	// To display synopsis of the script file and to display the TEF version
+	const TInt KTEFSynopsisStringMaxLength = 512;
+	TBuf<KTEFSynopsisStringMaxLength> lineBuf(KTEFFontLightBlue);
+	lineBuf.Append(KTEFTestSynopsisHTM);
+	lineBuf.Append(KTEFFontEnd);
+	lineBuf.Append(KTEFVersionMessage);
+	lineBuf.Append(KTEFProductVersion);
+	lineBuf.Append(KTEFNewLine);
+
+	// If EnableTestsCountLog is set to ON, append the command and count details to the log file during intialisation
+	if (aEnableCommandCount == KTEFOneValue)
+		{
+		TInt index;
+		// Run a loop for the structure array size
+		for (index=0;index<aScriptPreProcess.GetStructSize();index++)
+			{
+			TBuf<KMaxTestExecuteNameLength> commandName;
+			TInt commandCount;
+			// Retrieve the command name and count at each array index
+			aScriptPreProcess.RetrieveValues(index, commandName, commandCount);
+
+			// Append the command name and details to the synopsis block for logging
+			if (commandCount > KTEFZeroValue)
+				{
+				if (commandName.CompareF(KTEFRunScriptCommand) == 0)
+					{
+					iRunScriptCommandCount = commandCount;
+					}
+				lineBuf.Append(commandName);
+				lineBuf.Append(KTEFCountMessageHTM);
+				lineBuf.AppendNum(commandCount);
+				lineBuf.Append(KTEFNewLine);
+				}
+			}
+		}
+	// Write a time and date header
+	_LIT(KStarted,"*** TestExecute Started ");
+		
+	lineBuf.Append(KTEFNewLine);
+	lineBuf.Append(KTEFFontGreen);
+	lineBuf.Append(KStarted);
+
+	TTime now;
+	now.UniversalTime();
+	TDateTime dateTime = now.DateTime();
+	_LIT(KFormat,"%02d/%02d/%04d %02d:%02d:%02d:%03d ***");
+	// add the current time and date 
+	lineBuf.AppendFormat(KFormat,
+		dateTime.Day()+1,
+		dateTime.Month()+1,
+		dateTime.Year(),
+		dateTime.Hour(),
+		dateTime.Minute(),
+		dateTime.Second(),
+		(dateTime.MicroSecond()/1000) );
+	lineBuf.Append(KTEFFontEnd);
+	PIPSLogger().Write(lineBuf); // Append initial header message & time of logging at the start
+	
+	}
+/**
+ * Connects to the HTML log client session and creating the logs with initial tags for logging
+ * @param aLogFilePath - Relative path that is arrived after retrieving the path from the user through testexecute.ini
+ * @param aEnableCommandCount - Integer value representing the status of the EnableTestsCountLog option in the testexecute.ini
+ * @param aScriptPreProcess - Reference to the script pre-processor object used for retrieving values from structure array for logging
+ * @leave - If the logger instance is not able to create the HTML log file
+ */
+void CTestExecuteLogger::InitialiseHTMLLoggingL(const TDesC& aLogFilePath, TInt aLogLevel, const TInt& aEnableCommandCount, CScriptPreProcess& aScriptPreProcess)
+	{
+	// Connect to the file logger server and create the log file we've just constructed
+	// This will be c:\logs\testexecute\somefile.htm or c:\logs\scriptengine.htm 
+	
+	// Create the log file in the specified path with overwrite mode on
+	User::LeaveIfError(HtmlLogger().CreateLog(aLogFilePath,RTestExecuteLogServ::ELogModeOverWrite));
+	HtmlLogger().SetLogLevel(TLogSeverity(aLogLevel));
+
+	HtmlLogger().Write(KHtmlBegin16); // Write initial HTML tags
+
+	// Introduce a new information block called TEST SCRIPT SYNOPSIS
+	// To display synopsis of the script file and to display the TEF version
+	const TInt KTEFSynopsisStringMaxLength = 512;
+	TBuf<KTEFSynopsisStringMaxLength> lineBuf(KTEFFontLightBlue);
+	lineBuf.Append(KTEFTestSynopsisHTM);
+	lineBuf.Append(KTEFFontEnd);
+	lineBuf.Append(KTEFVersionMessage);
+	lineBuf.Append(KTEFProductVersion);
+	lineBuf.Append(KTEFNewLine);
+
+	// If EnableTestsCountLog is set to ON, append the command and count details to the log file during intialisation
+	if (aEnableCommandCount == KTEFOneValue)
+		{
+		TInt index;
+		// Run a loop for the structure array size
+		for (index=0;index<aScriptPreProcess.GetStructSize();index++)
+			{
+			TBuf<KMaxTestExecuteNameLength> commandName;
+			TInt commandCount;
+			// Retrieve the command name and count at each array index
+			aScriptPreProcess.RetrieveValues(index, commandName, commandCount);
+
+			// Append the command name and details to the synopsis block for logging
+			if (commandCount > KTEFZeroValue)
+				{
+				if (commandName.CompareF(KTEFRunScriptCommand) == 0)
+					{
+					iRunScriptCommandCount = commandCount;
+					}
+				lineBuf.Append(commandName);
+				lineBuf.Append(KTEFCountMessageHTM);
+				lineBuf.AppendNum(commandCount);
+				lineBuf.Append(KTEFNewLine);
+				}
+			}
+		}
+
+	// Write a time and date header
+	_LIT(KStarted,"*** TestExecute Started ");
+		
+	lineBuf.Append(KTEFNewLine);
+	lineBuf.Append(KTEFFontGreen);
+	lineBuf.Append(KStarted);
+
+	TTime now;
+	now.UniversalTime();
+	TDateTime dateTime = now.DateTime();
+	_LIT(KFormat,"%02d/%02d/%04d %02d:%02d:%02d:%03d ***");
+	// add the current time and date 
+	lineBuf.AppendFormat(KFormat,
+		dateTime.Day()+1,
+		dateTime.Month()+1,
+		dateTime.Year(),
+		dateTime.Hour(),
+		dateTime.Minute(),
+		dateTime.Second(),
+		(dateTime.MicroSecond()/1000) );
+	lineBuf.Append(KTEFFontEnd);
+	HtmlLogger().Write(lineBuf); // Append initial header message & time of logging at the start
+	}
+
+/**
+ * Connects to the XML log client session and creates the logs in the path passed in
+ * Also sets in the default threshold for log level
+ * @param aLogFilePath - Relative path that is arrived after retrieving the path from the user through testexecute.ini
+ * @param aLogLevel - Indicates the default threshold level for logging messages within the XML log
+ * @param aEnableCommandCount - Integer value representing the status of the EnableTestsCountLog option in the testexecute.ini
+ * @param aScriptPreProcess - Reference to the script pre-processor object used for retrieving values from structure array for logging
+ * @leave - If the logger instance is not able to create the HTML log file
+ */
+void CTestExecuteLogger::InitialiseXMLLoggingL(const TDesC& aLogFilePath, TInt aLogLevel, const TInt& aEnableCommandCount, CScriptPreProcess& aScriptPreProcess)
+	{
+	// Create the log file for XML logging & open it in overwrite mode for writing the results
+	User::LeaveIfError(XmlLogger().CreateLog(aLogFilePath,RFileFlogger::ELogModeOverWrite));
+	// Accept and set the default threshold log level for the XML logging from the user
+	XmlLogger().SetLogLevel(RFileFlogger::TLogSeverity(aLogLevel));
+
+	if (aEnableCommandCount == KTEFOneValue)
+		{
+		// Create an array of TLogField structure of size equal to the number of commands counted
+		TExtraLogField logField[KTEFCommandsCountPlusOne];
+
+		// The first structure array holds the TEF version information
+		logField[0].iLogFieldName.Copy(KTEFVersionMessageXML);
+		logField[0].iLogFieldValue.Copy(KTEFProductVersion);
+
+		TInt index;
+		TInt actualStructSize=KTEFOneValue;
+		// Run through a loop for all the array indices
+		for (index=0;index<aScriptPreProcess.GetStructSize();index++)
+			{
+			TBuf<KMaxTestExecuteNameLength> commandName;
+			TInt commandCount;
+			// Retrieve the command names and counts for each array index
+			aScriptPreProcess.RetrieveValues(index, commandName, commandCount);
+
+			// Append the command name and counts details to the TExtraLogField array created already
+			if (commandCount > KTEFZeroValue)
+				{
+				if (commandName.CompareF(KTEFRunScriptCommand) == 0)
+					{
+					iRunScriptCommandCount = commandCount;
+					}
+				logField[actualStructSize].iLogFieldName.Copy(commandName);
+				logField[actualStructSize].iLogFieldName.Append(KTEFCountMessageXML);
+				logField[actualStructSize].iLogFieldValue.AppendNum(commandCount);
+				actualStructSize++;
+				}
+			}
+		
+		// Pass in the updated TExtraLogField array along with a message block name
+		// To construct a new XML message block during the XML logging initialisation
+		LogToXml(((TText8*)__FILE__),__LINE__,RFileFlogger::TLogSeverity(ESevrHigh),KTEFTestSynopsisXML,actualStructSize,logField);
+		}
+	else
+		{
+		// Create an array of TLogField structure of size equal to the number of result categories for test steps
+		TExtraLogField logField[KTEFOneValue];
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[0].iLogFieldName.Copy(_L("TEF_VERSION"));
+		logField[0].iLogFieldValue.Copy(KTEFProductVersion);
+		
+		LogToXml(((TText8*)__FILE__),__LINE__,RFileFlogger::TLogSeverity(ESevrHigh),KTEFTestSynopsisXML,KTEFOneValue,logField);
+		}
+	}
+
+void CTestExecuteLogger::OpenSerialPortL(const TInt aPortNumber)
+	{
+	if(iSerialWriter == NULL)
+		{
+		iSerialWriter = CSerialWriter::NewL();
+		}
+	iPortNumber = 	aPortNumber; 
+	iSerialWriter->Settings(iPortNumber) ; 
+	}
+/**
+ * Instantiates the Serial Logger and passes start log header
+ * @param aLogLevel - Indicates the default threshold level for logging messages within the XML log
+ * @param aEnableCommandCount - Integer value representing the status of the EnableTestsCountLog option in the testexecute.ini
+ * @param aScriptPreProcess - Reference to the script pre-processor object used for retrieving values from structure array for logging
+ * @param aPortNumber - Port to be used for serial logging.
+ * @leave - If the logger instance is not successful
+ */
+void CTestExecuteLogger::InitialiseSerialLoggingL(TInt /*aLogLevel*/, const TInt& aEnableCommandCount, CScriptPreProcess& aScriptPreProcess,TInt aPortNumber)
+	{
+	OpenSerialPortL(aPortNumber);
+	// Introduce a new information block called TEST SCRIPT SYNOPSIS
+	// To display synopsis of the script file and to display the TEF version
+	const TInt KTEFSynopsisStringMaxLength = 512;
+	TBuf<KTEFSynopsisStringMaxLength> lineBuf(KTEFTestSynopsisHTM);
+	lineBuf.Append(KTEFVersionMessage);
+	lineBuf.Append(KTEFProductVersion);
+	lineBuf.Append(KTEFNewLine);
+
+	// If EnableTestsCountLog is set to ON, append the command and count details to the log file during intialisation
+	if (aEnableCommandCount == KTEFOneValue)
+		{
+		TInt index;
+		// Run a loop for the structure array size
+		for (index=0;index<aScriptPreProcess.GetStructSize();index++)
+			{
+			TBuf<KMaxTestExecuteNameLength> commandName;
+			TInt commandCount;
+			// Retrieve the command name and count at each array index
+			aScriptPreProcess.RetrieveValues(index, commandName, commandCount);
+
+			// Append the command name and details to the synopsis block for logging
+			if (commandCount > KTEFZeroValue)
+				{
+				if (commandName.CompareF(KTEFRunScriptCommand) == 0)
+					{
+					iRunScriptCommandCount = commandCount;
+					}
+				lineBuf.Append(commandName);
+				lineBuf.Append(KTEFCountMessageHTM);
+				lineBuf.AppendNum(commandCount);
+				lineBuf.Append(KTEFNewLine);
+				}
+			}
+		}
+	_LIT(KStarted,"*** TestExecute Started ");
+	lineBuf.Append(KTEFNewLine);
+	lineBuf.Append(KStarted);
+	iSerialWriter->WriteDecorated(lineBuf) ; 
+	}
+
+/**
+ * @param aCommentedCommandsCount - Integer descriptor containing the counts
+ *									of commented commands in the script for logging
+ * Terminate Logging routine
+ * Responsible for closing the objects created for logging and also to close the log client sessions
+ * Also appends final end up tags for the logs
+ */
+EXPORT_C void CTestExecuteLogger::TerminateLoggingL(const TInt aCommentedCommandsCount, const TInt aRemotePanicsCount, const TInt aRunScriptFailCount)
+	{
+	RFs fS;
+	User::LeaveIfError(fS.Connect());
+	CleanupClosePushL(fS);
+
+	// Delete the KTestExecuteScheduleTestLogCompatibilityNameFile
+	// May not exist but who cares
+	TBuf<KMaxTestExecuteNameLength> scheduleTestLogFileNameFile(iHtmlLogPath);
+	scheduleTestLogFileNameFile.Append(KTestExecuteScheduleTestLogCompatibilityNameFile);
+	(void)fS.Delete(scheduleTestLogFileNameFile);
+	// Open the result summary file
+	TBuf<KMaxTestExecuteNameLength> resultFileName(iHtmlLogPath);
+	//load simpifiled log results in case of out-of-memory
+	resultFileName.Append(KTEFTestExecuteResultSimplifiedSummaryFile);
+	RFile logFile;
+	User::LeaveIfError(logFile.Open(fS,resultFileName, EFileWrite | EFileRead | EFileShareAny));
+	CleanupClosePushL(logFile);
+	TInt fileSize;
+	// Read the complete result summary file onto the heap
+	// It wont be that large
+	User::LeaveIfError(logFile.Size(fileSize));
+	HBufC* resultData = HBufC::NewLC(fileSize);
+	HBufC8* resultData8 = HBufC8::NewLC(fileSize);	
+	TPtr8 ptrData8(resultData8->Des());
+	User::LeaveIfError(logFile.Read(ptrData8));
+	TPtr ptrData(resultData->Des());
+	ptrData.Copy(ptrData8);
+	logFile.Close();
+	CleanupStack::PopAndDestroy(resultData8);
+
+	// Set up some vars for the test step result types
+	iPassCount=0;
+	iFailCount=0;
+	iAbortCount=0;
+	iUnknownCount=0;
+	iInconclusiveCount=0;
+	iPanicCount=0;
+	iUnexecutedCount=0;
+
+	// Set up some vars for the RUN_PROGRAM result types
+	iRunProgramUsed=EFalse;
+	iRunProgramPassCount=0;
+	iRunProgramFailCount=0;
+	iRunProgramAbortCount=0;
+	iRunProgramUnknownCount=0;
+	iRunProgramInconclusiveCount=0;
+	iRunProgramPanicCount=0;
+	iRunProgramUnexecutedCount=0;
+
+	// Set up some vars for the testcase result types
+	iTestCasesUsed=EFalse;
+	iTestCasePassCount=0;
+	iTestCaseFailCount=0;
+	iTestCaseSkippedCount=0;
+	iTestCaseInconclusiveCount=0;
+
+	// We loop through looking for the ***Result test step &
+	// testcase ***TestCaseResult tokens
+	// The result code will be the token after the '='
+	_LIT(KEquality,"=");
+
+	TLex lex(ptrData);
+
+	while (!lex.Eos())
+		{
+		// Find the ***Result keywords to retrieve the test step summary results
+
+		TPtrC token(lex.NextToken());
+
+		if(token==KTEFRunProgramCommand || token==KTEFRunWSProgramCommand)
+			{
+			iRunProgramUsed = ETrue;
+			TPtrC token(lex.NextToken());
+			while(token != KTEFResultTag)
+				token.Set(lex.NextToken());
+			if (lex.NextToken() != KEquality)
+				continue;
+			token.Set(lex.NextToken());
+			if(token == KTEFResultAbort)
+				iRunProgramAbortCount++;
+			else if(token == KTEFResultFail)
+				iRunProgramFailCount++;
+			else if(token == KTEFResultPass)
+				iRunProgramPassCount++;
+			else if(token == KTEFResultInconclusive)
+				iRunProgramInconclusiveCount++;
+			else if(token == KTEFResultPanic)
+				iRunProgramPanicCount++;
+			else if (token == KTEFResultUnexecuted)
+				iRunProgramUnexecutedCount++;
+			else
+				iRunProgramUnknownCount++;
+			}
+		else if(token == KTEFResultTag)
+			{
+			if (lex.NextToken() != KEquality)
+				continue;
+			TPtrC token(lex.NextToken());
+			if(token == KTEFResultAbort)
+				iAbortCount++;
+			else if(token == KTEFResultFail)
+				iFailCount++;
+			else if(token == KTEFResultPass)
+				iPassCount++;
+			else if(token == KTEFResultInconclusive)
+				iInconclusiveCount++;
+			else if(token == KTEFResultPanic)
+				iPanicCount++;
+			else if (token == KTEFResultUnexecuted)
+				iUnexecutedCount++;
+			else
+				iUnknownCount++;
+			}
+		else
+			{
+			if (token == KTEFTestCaseResultTag) // Find the ***TestCaseResult keywords to retrieve the test case summary results
+				{
+				iTestCasesUsed = ETrue;		
+				if (lex.NextToken() != KEquality)
+					continue;
+				TPtrC token(lex.NextToken());
+				if(token == KTEFResultPass)
+					iTestCasePassCount++;
+				else if(token == KTEFResultFail)
+					iTestCaseFailCount++;
+				else if(token == KTEFResultSkippedSelectively)
+					iTestCaseSkippedCount++;
+				else
+					iTestCaseInconclusiveCount++;
+				}
+			}
+		}
+	// Cleanup heap memory
+	CleanupStack::PopAndDestroy(resultData);
+	
+	//summary save to test result to "TestResults.htm" 
+	resultFileName.Copy(iHtmlLogPath);
+	resultFileName.Append(KTEFTestExecuteResultSummaryFile);
+	User::LeaveIfError(logFile.Open(fS,resultFileName, EFileWrite | EFileRead | EFileShareAny));
+	TInt pos=0;
+	(void)logFile.Seek(ESeekEnd, pos);
+	if(iLoggerChannel == EFile || iLoggerChannel == EBoth)
+		{
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			{
+			TerminateHTMLLoggingL(&logFile, aCommentedCommandsCount, aRemotePanicsCount, aRunScriptFailCount);	
+			}
+		if (iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth)
+			{
+			TerminateXMLLoggingL(aCommentedCommandsCount, aRemotePanicsCount, aRunScriptFailCount);
+			}
+		}	
+	// Cleanup/Close allocated objects
+	Close();
+	CleanupStack::Pop(&logFile);
+	logFile.Close();
+	CleanupStack::Pop(&fS);
+	fS.Close();
+	
+	// Test report output
+    if( iTestReport )
+        {
+        iTestReport->GenerateReportL();
+        }
+	}
+
+
+
+/**
+ * @param aLogFile - Pointer to the file object for appending end up tags for HTML log result
+ * @param aCommentedCommandsCount - Integer descriptor containing the counts
+ *									of commented commands in the script for logging
+ * Called by the Termination routine based on the logger options set by the user for HTML specific log results
+ */
+void CTestExecuteLogger::TerminateHTMLLoggingL(RFile* aLogFile, const TInt aCommentedCommandsCount, const TInt aRemotePanicsCount, const TInt aRunScriptFailCount)
+	{
+	// Construct a summary buffer
+	// And write it to the logger file and the result summary file
+	TBuf<KMaxTestExecuteLogLineLength> summaryLine;
+	summaryLine.Append(KTEFFontLightBlue);
+
+	if (iTestCasesUsed)
+		{
+		_LIT(KTEFTestSummary,"TEST STEP SUMMARY:");
+		summaryLine.Append(KTEFTestSummary);
+		}
+	else
+		{
+		_LIT(KSummary,"SUMMARY:");
+		summaryLine.Append(KSummary);	
+		}
+
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	TBuf8<KMaxTestExecuteLogLineLength> summaryLine8;
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+	summaryLine.Zero();
+	summaryLine.Append(KTEFFontGreen);
+	summaryLine.Append(KTEFResultPass);
+	summaryLine.AppendFormat(KTEFEqualsInteger,iPassCount);
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+	
+	summaryLine.Zero();
+	summaryLine.Append(KTEFFontRed);
+	summaryLine.Append(KTEFResultFail);
+	summaryLine.AppendFormat(KTEFEqualsInteger,iFailCount);
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+	summaryLine.Zero();
+	summaryLine.Append(KTEFFontBlue);
+	summaryLine.Append(KTEFResultAbort);
+	summaryLine.AppendFormat(KTEFEqualsInteger,iAbortCount);
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+	summaryLine.Zero();
+	summaryLine.Append(KTEFFontBlue);
+	summaryLine.Append(KTEFResultPanic);
+	summaryLine.AppendFormat(KTEFEqualsInteger,iPanicCount);
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+	summaryLine.Zero();
+	summaryLine.Append(KTEFFontBlue);
+	summaryLine.Append(KTEFResultInconclusive);
+	summaryLine.AppendFormat(KTEFEqualsInteger,iInconclusiveCount);
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+	
+	summaryLine.Zero();
+	summaryLine.Append(KTEFFontBlue);
+	summaryLine.Append(KTEFResultUnknown);
+	summaryLine.AppendFormat(KTEFEqualsInteger,iUnknownCount);
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+	summaryLine.Zero();
+	summaryLine.Append(KTEFFontBlue);
+	summaryLine.Append(KTEFResultUnexecuted);
+	summaryLine.AppendFormat(KTEFEqualsInteger,iUnexecutedCount);
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+	summaryLine.Zero();
+	summaryLine.Append(KTEFFontBlue);
+	summaryLine.Append(KTEFCommentedCommands);
+	summaryLine.AppendFormat(KTEFEqualsInteger,aCommentedCommandsCount);
+	summaryLine.Append(KTEFFontEnd);
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(summaryLine);
+	summaryLine8.Copy(summaryLine);
+	summaryLine8.Append(KTEFEndOfLine);
+	User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+	if (iRemotePanic != 0)
+		{
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontBlue);
+		_LIT(KTEFSystemPanics, "SYSTEM PANICS COUNT");
+		summaryLine.Append(KTEFSystemPanics);
+		summaryLine.AppendFormat(KTEFEqualsInteger,aRemotePanicsCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+		}
+
+	if(iRunProgramUsed)
+		{
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontLightBlue);
+		_LIT(KTEFTestCaseSummary, "RUN_PROGRAM SUMMARY:");
+		summaryLine.Append(KTEFTestCaseSummary);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		TBuf8<KMaxTestExecuteLogLineLength> summaryLine8;
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+	
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontGreen);
+		summaryLine.Append(KTEFResultPass);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iRunProgramPassCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+	
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontRed);
+		summaryLine.Append(KTEFResultFail);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iRunProgramFailCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontBlue);
+		summaryLine.Append(KTEFResultAbort);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iRunProgramAbortCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontBlue);
+		summaryLine.Append(KTEFResultPanic);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iRunProgramPanicCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontBlue);
+		summaryLine.Append(KTEFResultInconclusive);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iRunProgramInconclusiveCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+	
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontBlue);
+		summaryLine.Append(KTEFResultUnknown);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iRunProgramUnknownCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontBlue);
+		summaryLine.Append(KTEFResultUnexecuted);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iRunProgramUnexecutedCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+		}
+
+	if (iTestCasesUsed)
+		{
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontLightBlue);
+		_LIT(KTEFTestCaseSummary, "TEST CASE SUMMARY:");
+		summaryLine.Append(KTEFTestCaseSummary);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		TBuf8<KMaxTestExecuteLogLineLength> summaryLine8;
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontGreen);
+		summaryLine.Append(KTEFResultPass);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iTestCasePassCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+	
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontRed);
+		summaryLine.Append(KTEFResultFail);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iTestCaseFailCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontGrey);
+		summaryLine.Append(KTEFResultSkippedSelectively);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iTestCaseSkippedCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontBlue);
+		summaryLine.Append(KTEFResultInconclusive);
+		summaryLine.AppendFormat(KTEFEqualsInteger,iTestCaseInconclusiveCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+		}
+
+	if (iRunScriptCommandCount > 0)
+		{
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontLightBlue);
+		summaryLine.Append(KTEFRunScriptSummary);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		TBuf8<KMaxTestExecuteLogLineLength> summaryLine8;
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontGreen);
+		summaryLine.Append(KTEFScriptExecuted);
+		TInt executedCount = iRunScriptCommandCount - aRunScriptFailCount;
+		summaryLine.AppendFormat(KTEFEqualsInteger,executedCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+	
+		summaryLine.Zero();
+		summaryLine.Append(KTEFFontRed);
+		summaryLine.Append(KTEFFailedOpen);
+		summaryLine.AppendFormat(KTEFEqualsInteger,aRunScriptFailCount);
+		summaryLine.Append(KTEFFontEnd);
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			HtmlLogger().Write(summaryLine);
+		summaryLine8.Copy(summaryLine);
+		summaryLine8.Append(KTEFEndOfLine);
+		User::LeaveIfError(aLogFile->Write(summaryLine8));
+		}
+
+	User::LeaveIfError(aLogFile->Write(KHtmlEnd8));
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		HtmlLogger().Write(KHtmlEnd16); // Write the summary results to the HTML log file
+
+	}
+
+/**
+ * @param aCommentedCommandsCount - Integer descriptor containing the counts
+ *									of commented commands in the script for logging
+ * Called by the Termination routine based on the logger options set by the user for HTML specific log results
+ * Appends the XML tags for displaying the summary results for the test cases and test steps executed
+ * Closes the session with XML log client session
+ */
+void CTestExecuteLogger::TerminateXMLLoggingL(const TInt aCommentedCommandsCount, const TInt aRemotePanicsCount, const TInt aRunScriptFailCount)
+	{
+	TBuf<KMaxTestExecuteCommandLength> fieldValue;
+	TBuf<KMaxTestExecuteCommandLength> commandName;
+
+	// Create an array of TLogField structure of size equal to the number of result categories for test steps
+	TExtraLogField logField[9];
+
+	// The first member of the structure stores the field name
+	// The second one holds the value for the particular field
+	logField[0].iLogFieldName.Copy(KTEFResultPass);
+	fieldValue.Copy(KNull);
+	fieldValue.AppendNum(iPassCount);
+	logField[0].iLogFieldValue.Copy(fieldValue);
+	
+	// The first member of the structure stores the field name
+	// The second one holds the value for the particular field
+	logField[1].iLogFieldName.Copy(KTEFResultFail);
+	fieldValue.Copy(KNull);
+	fieldValue.AppendNum(iFailCount);
+	logField[1].iLogFieldValue.Copy(fieldValue);
+
+	// The first member of the structure stores the field name
+	// The second one holds the value for the particular field
+	logField[2].iLogFieldName.Copy(KTEFResultAbort);
+	fieldValue.Copy(KNull);
+	fieldValue.AppendNum(iAbortCount);
+	logField[2].iLogFieldValue.Copy(fieldValue);
+
+	// The first member of the structure stores the field name
+	// The second one holds the value for the particular field
+	logField[3].iLogFieldName.Copy(KTEFResultUnknown);
+	fieldValue.Copy(KNull);
+	fieldValue.AppendNum(iUnknownCount);
+	logField[3].iLogFieldValue.Copy(fieldValue);
+
+	// The first member of the structure stores the field name
+	// The second one holds the value for the particular field
+	logField[4].iLogFieldName.Copy(KTEFResultInconclusive);
+	fieldValue.Copy(KNull);
+	fieldValue.AppendNum(iInconclusiveCount);
+	logField[4].iLogFieldValue.Copy(fieldValue);
+
+	// The first member of the structure stores the field name
+	// The second one holds the value for the particular field
+	logField[5].iLogFieldName.Copy(KTEFResultPanic);
+	fieldValue.Copy(KNull);
+	fieldValue.AppendNum(iPanicCount);
+	logField[5].iLogFieldValue.Copy(fieldValue);
+
+	// The first member of the structure stores the field name
+	// The second one holds the value for the particular field
+	logField[6].iLogFieldName.Copy(KTEFResultUnexecuted);
+	fieldValue.Copy(KNull);
+	fieldValue.AppendNum(iUnexecutedCount);
+	logField[6].iLogFieldValue.Copy(fieldValue);
+
+	_LIT(KTEFCommentedCommands,"COMMENTED_COMMANDS");
+	logField[7].iLogFieldName.Copy(KTEFCommentedCommands);
+	fieldValue.Copy(KNull);
+	fieldValue.AppendNum(aCommentedCommandsCount);
+	logField[7].iLogFieldValue.Copy(fieldValue);
+
+	if (iRemotePanic != 0)
+		{
+		_LIT(KTEFSystemPanics, "SYSTEMPANICS");
+		logField[8].iLogFieldName.Copy(KTEFSystemPanics);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(aRemotePanicsCount);
+		logField[8].iLogFieldValue.Copy(fieldValue);
+
+		commandName.Copy(KTEFTestStepSummary);
+
+		// Call the Logger().LogToXml routine which handles XML logging for individual commands
+		// Takes in the command name, number of fields and the struture array
+		LogToXml(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrHigh, commandName, 9, logField);
+		}
+	else
+		{
+		commandName.Copy(KTEFTestStepSummary);
+
+		// Call the Logger().LogToXml routine which handles XML logging for individual commands
+		// Takes in the command name, number of fields and the struture array
+		LogToXml(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrHigh, commandName, 8, logField);
+		}
+
+	if (iRunProgramUsed)
+		{
+		// Create an array of TLogField structure of size equal to the number of result categories for run program logging
+		TExtraLogField logField[7];
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[0].iLogFieldName.Copy(KTEFResultPass);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iRunProgramPassCount);
+		logField[0].iLogFieldValue.Copy(fieldValue);
+		
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[1].iLogFieldName.Copy(KTEFResultFail);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iRunProgramFailCount);
+		logField[1].iLogFieldValue.Copy(fieldValue);
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[2].iLogFieldName.Copy(KTEFResultAbort);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iRunProgramAbortCount);
+		logField[2].iLogFieldValue.Copy(fieldValue);
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[3].iLogFieldName.Copy(KTEFResultUnknown);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iRunProgramUnknownCount);
+		logField[3].iLogFieldValue.Copy(fieldValue);
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[4].iLogFieldName.Copy(KTEFResultInconclusive);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iRunProgramInconclusiveCount);
+		logField[4].iLogFieldValue.Copy(fieldValue);
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[5].iLogFieldName.Copy(KTEFResultPanic);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iRunProgramPanicCount);
+		logField[5].iLogFieldValue.Copy(fieldValue);
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[6].iLogFieldName.Copy(KTEFResultUnexecuted);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iRunProgramUnexecutedCount);
+		logField[6].iLogFieldValue.Copy(fieldValue);
+		
+		commandName.Copy(KTEFRunProgramSummary);
+
+		// Call the Logger().LogToXml routine which handles XML logging for individual commands
+		// Takes in the command name, number of fields and the struture array
+		LogToXml(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrHigh, commandName, 7, logField);
+		}
+	
+	if (iTestCasesUsed)
+		{
+		// Create a TLogField structure array
+		// Size of array equals to number of fields to be displayed
+		TExtraLogField logField[3];
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[0].iLogFieldName.Copy(KTEFResultPass);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iTestCasePassCount);
+		logField[0].iLogFieldValue.Copy(fieldValue);
+		
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[1].iLogFieldName.Copy(KTEFResultFail);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iTestCaseFailCount);
+		logField[1].iLogFieldValue.Copy(fieldValue);
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[1].iLogFieldName.Copy(KTEFResultSkippedSelectively);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iTestCaseSkippedCount);
+		logField[1].iLogFieldValue.Copy(fieldValue);
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[2].iLogFieldName.Copy(KTEFResultInconclusive);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(iTestCaseInconclusiveCount);
+		logField[2].iLogFieldValue.Copy(fieldValue);
+
+		commandName.Copy(KTEFTestCaseSummary);
+
+		// Call the Logger().LogToXml routine which handles XML logging for individual commands
+		// Takes in the command name, number of fields and the struture array
+		LogToXml(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrHigh, commandName, 3, logField);
+		}
+
+	if (iRunScriptCommandCount > 0)
+		{
+		// Create a TLogField structure array
+		// Size of array equals to number of fields to be displayed
+		TExtraLogField logField[2];
+
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[0].iLogFieldName.Copy(KTEFScriptExecuted);
+		fieldValue.Copy(KNull);
+		TInt runScriptPassCount = iRunScriptCommandCount - aRunScriptFailCount;
+		fieldValue.AppendNum(runScriptPassCount);
+		logField[0].iLogFieldValue.Copy(fieldValue);
+		
+		// The first member of the structure stores the field name
+		// The second one holds the value for the particular field
+		logField[1].iLogFieldName.Copy(KTEFFailedOpen);
+		fieldValue.Copy(KNull);
+		fieldValue.AppendNum(aRunScriptFailCount);
+		logField[1].iLogFieldValue.Copy(fieldValue);
+
+		commandName.Copy(KTEFRunScriptSummary);
+
+		// Call the Logger().LogToXml routine which handles XML logging for individual commands
+		// Takes in the command name, number of fields and the struture array
+		LogToXml(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrHigh, commandName, 2, logField);
+		}
+	}
+
+/**
+ * @param aFile - Name of the file that intiated the call
+ * @param aLine - Line number within the file that initiates the call
+ * @param aSeverity - One of the 4 enum values indicating the severity of the message to be logged
+ * @param aCommand - Name of the command whose fields are logged with the call to the function
+ * @param aResult - Result of the test case for logging
+ * Logs the name of the test case and the result corresponding to each START_TESTCASE/END_TESTCASE pairs
+ * This function branches out of the main one for logging over serial. 
+ * This is done to avoid complexity in original code.
+ */
+void CTestExecuteLogger::LogTestCaseResultSerialL(const TDesC& aFile, TInt aLine, TInt aSeverity, const TDesC& aCommand, const TDesC& aTestCaseName, TVerdict aResult)
+	{
+	
+	_LIT(KTEFSpace, " ");
+	_LIT(KCommand, "Command = ");
+	_LIT(KLineNumber,"Line = %d");
+	if (aCommand == KTEFStartTestCaseCommand || aCommand == KTEFEndTestCaseCommand
+		|| aCommand == KTEFStartSyncTestCaseCommand || aCommand == KTEFEndSyncTestCaseCommand )
+		{
+		
+		// Create a heap buffer to hold the log string for HTML
+		HBufC* resultBuffer = HBufC::NewLC(KMaxTestExecuteCommandLength*3);
+		TPtr ptr(resultBuffer->Des());
+		HBufC* simplifiedResultBuf = HBufC::NewLC(KMaxTestExecuteCommandLength*2);
+		TPtr simplifiedPtr(simplifiedResultBuf->Des());
+		simplifiedPtr.Zero();
+
+		// Appends remainder of the information required for logging
+		ptr.Append(aFile);
+		ptr.Append(KTEFSpace);
+		ptr.AppendFormat(KLineNumber,aLine);
+		ptr.Append(KTEFSpace);
+		ptr.Append(KCommand);
+		ptr.Append(aCommand);
+		simplifiedPtr.Append(aCommand);
+		ptr.Append(KTEFSpace);
+		simplifiedPtr.Append(KTEFSpace);
+		ptr.Append(aTestCaseName);
+		simplifiedPtr.Append(aTestCaseName);
+		ptr.Append(KTEFSpace);
+		simplifiedPtr.Append(KTEFSpace);
+
+		TBuf<KMaxTestExecuteCommandLength> resultTmpBuf;
+		resultTmpBuf.Zero();
+		// Append ***TestCaseResult only in case of END_TESTCASE command with result of the test case
+		if (aCommand == KTEFEndTestCaseCommand || aCommand == KTEFEndSyncTestCaseCommand 
+			|| aResult==ESkippedSelectively) //append for when command is start_test_case 
+											 //but this is being skipped selectively
+			{
+			resultTmpBuf.Append(KTEFTestCaseResultTag);
+			resultTmpBuf.Append(KTEFSpaceEquals);
+			if (aResult == EPass)
+				{
+				resultTmpBuf.Append(KTEFResultPass);
+				}
+			else if (aResult == EFail)
+				{
+				resultTmpBuf.Append(KTEFResultFail);
+				}
+			else if(aResult==ESkippedSelectively)
+				{
+				resultTmpBuf.Append(KTEFResultSkippedSelectively);
+				}
+			else
+				{
+				resultTmpBuf.Append(KTEFResultInconclusive);
+				}
+			ptr.Append(resultTmpBuf);
+			simplifiedPtr.Append(resultTmpBuf);
+			}
+
+		ptr.Append(KTEFSpace);
+		simplifiedPtr.Append(KTEFSpace);
+		// Copy the 16 bit heap descriptor value to 8 bit descriptor using a TPtr pointer to 8 bit heap descriptor
+		HBufC8* resultBuffer8 = HBufC8::NewLC(ptr.Length()+2);
+		TPtr8 ptr8(resultBuffer8->Des());
+		ptr8.Copy(ptr);
+		ptr8.Append(KTEFEndOfLine); // Append new line & carriage return for the log string
+		
+		//the result summary file HTML 
+		LoggingTestCaseResultToSummaryResultL(iHtmlLogPath,KTEFTestExecuteResultSummaryFile,ptr8);
+		//the result summary file simplified text
+		//re-use result buffer
+		ptr8.Copy(simplifiedPtr);
+		ptr8.Append(KTEFEndOfLine); 
+		LoggingTestCaseResultToSummaryResultL(iHtmlLogPath,KTEFTestExecuteResultSimplifiedSummaryFile,ptr8);
+		CleanupStack::PopAndDestroy(resultBuffer8);
+		// Create objects of RFs & RFile for opening the result summary file for logging
+
+		TInt bytesCopied = 0;
+
+		while(bytesCopied < ptr.Length())
+			{
+			TInt bytesToCopy = ptr.Length() - bytesCopied;
+			if(bytesToCopy > KMaxTestExecuteLogLineLength)
+				{
+				bytesToCopy = KMaxTestExecuteLogLineLength;
+				}
+			TPtrC tmp(&ptr[bytesCopied],bytesToCopy);
+			bytesCopied += bytesToCopy;
+			iSerialWriter->WriteDecorated(tmp, aSeverity);
+			}
+		// Cleanup heap allocations
+		CleanupStack::PopAndDestroy(simplifiedResultBuf);
+		CleanupStack::PopAndDestroy(resultBuffer);
+		}
+	}
+
+/**
+ * @param aFile - Name of the file that intiated the call
+ * @param aLine - Line number within the file that initiates the call
+ * @param aSeverity - One of the 4 enum values indicating the severity of the message to be logged
+ * @param aCommand - Name of the command whose fields are logged with the call to the function
+ * @param aResult - Result of the test case for logging
+ * Logs the name of the test case and the result corresponding to each START_TESTCASE/END_TESTCASE pairs
+ */
+EXPORT_C void CTestExecuteLogger::LogTestCaseResult(const TDesC& aFile, TInt aLine, TInt aSeverity, const TDesC& aCommand, const TDesC& aTestCaseName, TVerdict aResult)
+	{
+
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)
+		{
+		LogTestCaseResultSerialL(aFile, aLine, aSeverity, aCommand, aTestCaseName, aResult);
+		}
+	if(iLoggerChannel != EFile && iLoggerChannel != EBoth)
+		{
+		return ; 
+		}
+
+	_LIT(KTEFSpace, " ");
+	_LIT(KCommand, "Command = ");
+	_LIT(KLineNumber,"Line = %d");
+
+	if (aCommand == KTEFStartTestCaseCommand || aCommand == KTEFEndTestCaseCommand
+		|| aCommand == KTEFStartSyncTestCaseCommand || aCommand == KTEFEndSyncTestCaseCommand )
+		{
+		// Create a heap buffer to hold the log string for HTML
+		HBufC* resultBuffer = HBufC::NewLC(KMaxTestExecuteCommandLength*3);
+		TPtr ptr(resultBuffer->Des());
+		HBufC* simplifiedResultBuf = HBufC::NewLC(KMaxTestExecuteCommandLength*2);
+		TPtr simplifiedPtr(simplifiedResultBuf->Des());
+		simplifiedPtr.Zero();
+		
+		// Colour of the HTML result is controlled by the result of the command
+		// Anyway, the START_TESTCASE has no result attached with it & hence is always set to PASS
+		if (aResult == EPass)
+			{
+			// Log the message in Green
+			ptr.Append(KTEFFontGreen);
+			}
+		else if (aResult == EFail)
+			{
+			// Log the message in Red
+			ptr.Append(KTEFFontRed);
+			}
+		else if(aResult == ESkippedSelectively)
+			{
+			ptr.Append(KTEFFontGrey);
+			}
+		else
+			{
+			// Log the message in Blue
+			ptr.Append(KTEFFontBlue);
+			}
+
+		// Appends remainder of the information required for logging
+		ptr.Append(aFile);
+		ptr.Append(KTEFSpace);
+		ptr.AppendFormat(KLineNumber,aLine);
+		ptr.Append(KTEFSpace);
+		ptr.Append(KCommand);
+		ptr.Append(aCommand);
+		simplifiedPtr.Append(aCommand);
+		ptr.Append(KTEFSpace);
+		simplifiedPtr.Append(KTEFSpace);
+		ptr.Append(aTestCaseName);
+		simplifiedPtr.Append(aTestCaseName);
+		ptr.Append(KTEFSpace);
+		simplifiedPtr.Append(KTEFSpace);
+
+		TBuf<KMaxTestExecuteCommandLength> resultTmpBuf;
+		resultTmpBuf.Zero();
+		// Append ***TestCaseResult only in case of END_TESTCASE command with result of the test case
+		if (aCommand == KTEFEndTestCaseCommand || aCommand == KTEFEndSyncTestCaseCommand 
+			|| aResult==ESkippedSelectively) //append for when command is start_test_case 
+											 //but this is being skipped selectively
+			{
+			resultTmpBuf.Append(KTEFTestCaseResultTag);
+			resultTmpBuf.Append(KTEFSpaceEquals);
+			if (aResult == EPass)
+				{
+				resultTmpBuf.Append(KTEFResultPass);
+				}
+			else if (aResult == EFail)
+				{
+				resultTmpBuf.Append(KTEFResultFail);
+				}
+			else if(aResult==ESkippedSelectively)
+				{	
+				resultTmpBuf.Append(KTEFResultSkippedSelectively);	
+				}
+			else
+				{
+				resultTmpBuf.Append(KTEFResultInconclusive);
+				}
+			ptr.Append(resultTmpBuf);
+			simplifiedPtr.Append(resultTmpBuf);
+			}
+
+		ptr.Append(KTEFSpace);
+		ptr.Append(KTEFFontEnd);
+		
+		// Copy the 16 bit heap descriptor value to 8 bit descriptor using a TPtr pointer to 8 bit heap descriptor
+		HBufC8* resultBuffer8 = HBufC8::NewLC(ptr.Length()+2);
+		TPtr8 ptr8(resultBuffer8->Des());
+		ptr8.Copy(ptr);
+		ptr8.Append(KTEFEndOfLine); // Append new line & carriage return for the log string
+	
+		// Create objects of RFs & RFile for opening the result summary file for logging
+		LoggingTestCaseResultToSummaryResultL(iHtmlLogPath,KTEFTestExecuteResultSummaryFile,ptr8);
+
+		ptr8.Copy(simplifiedPtr);
+		ptr8.Append(KTEFEndOfLine);
+		LoggingTestCaseResultToSummaryResultL(iHtmlLogPath,KTEFTestExecuteResultSimplifiedSummaryFile,ptr8);
+		
+		
+		CleanupStack::PopAndDestroy(resultBuffer8);
+		CleanupStack::PopAndDestroy(simplifiedResultBuf);
+
+		if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+			{
+			TInt bytesCopied = 0;
+
+			while(bytesCopied < ptr.Length())
+				{
+				TInt bytesToCopy = ptr.Length() - bytesCopied;
+				if(bytesToCopy > KMaxTestExecuteLogLineLength)
+					{
+					bytesToCopy = KMaxTestExecuteLogLineLength;
+					}
+				TPtrC tmp(&ptr[bytesCopied],bytesToCopy);
+				bytesCopied += bytesToCopy;
+				HtmlLogger().Write(tmp); // Write results to HTML log file
+				if(iPIPSExists)
+					{
+					PIPSLogger().Write(tmp); 
+					}
+				}
+			}
+
+		// Cleanup heap allocations
+		CleanupStack::PopAndDestroy(resultBuffer);	
+	
+        if (iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth)
+            {
+            _LIT(KTEFTestCaseName,"TESTCASENAME");
+            _LIT(KTEFSyncTestCaseName,"SYNCTESTCASENAME");
+            _LIT(KTEFTestCaseResult,"RESULT");
+            
+            if (aCommand == KTEFStartTestCaseCommand || aCommand == KTEFStartSyncTestCaseCommand )
+                {
+                // Create a TExtraLogField object and set the TestCaseName for Logging
+                TExtraLogField logField[1];
+                if( aCommand == KTEFStartSyncTestCaseCommand )
+                    {
+                    logField[0].iLogFieldName.Copy(KTEFSyncTestCaseName); // Sync Test Case Name
+                    }
+                else
+                    {
+                    logField[0].iLogFieldName.Copy(KTEFTestCaseName); // Test Case Name
+                    }
+                logField[0].iLogFieldValue.Copy(aTestCaseName);
+    
+                // Log the command name along with the field-value pairs
+                XmlLogger().Log(((TText8*)__FILE__), aLine, RFileFlogger::TLogSeverity(aSeverity), 1, logField, KTEFStringFormat, &aCommand);
+                }
+    
+            // If the command is END_TESTCASE, an extra RESULT field also needs to be logged
+            else if (aCommand == KTEFEndTestCaseCommand || aCommand == KTEFEndSyncTestCaseCommand)
+                {
+                // Create a TExtraLogField object and set the TestCaseName & Result fields for Logging
+                TExtraLogField logField[2];
+                if( aCommand == KTEFEndSyncTestCaseCommand )
+                    {
+                    logField[0].iLogFieldName.Copy(KTEFSyncTestCaseName); // Sync Test Case Name
+                    }
+                else
+                    {
+                    logField[0].iLogFieldName.Copy(KTEFTestCaseName); // Test Case Name
+                    }
+    
+                logField[0].iLogFieldValue.Copy(aTestCaseName);
+    
+                logField[1].iLogFieldName.Copy(KTEFTestCaseResult); // Test Case Result
+    
+                // Set the result value based on the aResult parameter being passed in
+                if (aResult == EPass)
+                    {
+                    logField[1].iLogFieldValue.Copy(KTEFResultPass);
+                    }
+                else if (aResult == EFail)
+                    {
+                    logField[1].iLogFieldValue.Copy(KTEFResultFail);
+                    }
+                else if(aResult == ESkippedSelectively)
+                    {
+                        logField[1].iLogFieldValue.Copy(KTEFResultSkippedSelectively);
+                    }
+                else
+                    {
+                    logField[1].iLogFieldValue.Copy(KTEFResultInconclusive);
+                    }
+    
+                // Log the command name along with the field-value pairs & Result
+                XmlLogger().Log(((TText8*)__FILE__), aLine, RFileFlogger::TLogSeverity(aSeverity), 2, logField, KTEFStringFormat, &aCommand);
+                }
+            }
+        
+        // if case start marker START_TESTCASE
+         if (aCommand.CompareF(KTEFStartTestCaseCommand) == 0 || aCommand.CompareF(KTEFStartSyncTestCaseCommand) == 0)
+             {
+             // Record test case start time.
+             iCaseStartTime.UniversalTime();
+             }
+         // if case end marker END_TESTCASE
+         else
+             {
+             // Record test case end time.
+             iCaseEndTime.UniversalTime();
+             //add test case result to TEFTestReport.
+             AddTestReportL(aTestCaseName, iCaseStartTime, iCaseEndTime, aResult);
+             }
+         }
+	}
+
+/**
+ * @param aCurrentScriptLine - Reference to a descriptor that holds the current script line
+ * @param aScriptFile - Name of the file where the current script file exists
+ * Prints the current script line
+ */
+EXPORT_C void CTestExecuteLogger::PrintCurrentScriptLine(TDes& aCurrentScriptLine)
+	{
+	TInt length = aCurrentScriptLine.Length();
+	(aCurrentScriptLine[length - 2] == '\r') ? (aCurrentScriptLine.SetLength(length - 2)) : (aCurrentScriptLine.SetLength(length - 1));
+			
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)
+		{
+		iSerialWriter->WriteDecorated(aCurrentScriptLine) ; 
+		}
+	if(		(iLoggerChannel == EFile || iLoggerChannel == EBoth)
+		&& (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth))
+		{
+		// Log the current script line to Html result log
+		HtmlLogger().WriteFormat(KTEFStringFormat,&aCurrentScriptLine);
+		}
+	if(iPIPSExists)
+		{
+		PIPSLogger().WriteFormat(KTEFStringFormat,&aCurrentScriptLine);
+		}
+	}
+
+LOCAL_C TVerdict SetExpectedResult(TLex aResultValue)
+	{
+	TInt expectedResult;
+	TInt err = aResultValue.Val(expectedResult);
+	if (err != KErrNone)
+		{
+		TBuf <KTEFMaxVerdictLength> tempString(aResultValue.NextToken());
+		tempString.UpperCase();
+		if (tempString.CompareF(KTEFResultFail) == KTEFZeroValue)
+			{
+			expectedResult = EFail;
+			}
+		else if(tempString.CompareF(KTEFResultInconclusive) == KTEFZeroValue)
+			{
+			expectedResult = EInconclusive;
+			}
+		else if(tempString.CompareF(KTEFResultAbort) == KTEFZeroValue)
+			{
+			expectedResult = EAbort;
+			}
+		else if(tempString.CompareF(KTEFResultPass) == KTEFZeroValue)
+			{
+			expectedResult = EPass;
+			}
+		else
+			{
+			expectedResult = EInconclusive;
+			}
+		}
+	return TVerdict(expectedResult);
+	}
+
+/**
+ * @param aResult - Result of execution of test steps for logging
+ * @param aPanicString - Reference descriptor containing the panic string if the test step results in a panic
+ * @param aScriptLineNumber - Line number within the script file where the RUN_TEST_STEP command is available
+ * @param aCommand - Command name being being executed (RUN_TEST_STEP & variants)
+ * @param aScriptFile - Name of the script file being used for execution
+ * @param aSeverity - One of the 4 enum values indicating the severity of the message to be logged
+ * Responsible for logging results for the RUN_TEST_STEP command/variants
+ */
+void CTestExecuteLogger::LogResultSerialL(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,const TDesC& aScriptFile)
+	{
+	
+	HBufC* resultBuffer = HBufC::NewLC(KMaxTestExecuteCommandLength*3);
+	TPtr ptr(resultBuffer->Des());
+	TLex scriptLineLex(aCommand);
+	TLex scriptLineParamLex(aCommand);
+	TLex xmlLogCommandParseLex(aCommand);
+	TPtrC command(scriptLineLex.NextToken());
+	TBool showPanicResult(ETrue);
+	TBool showActualResult(EFalse);
+	TBool showPanicInfo(EFalse);
+	TVerdict actualResult(aResult);
+	TVerdict actualPanic(aResult);
+	TInt expectedPanicCode(0);
+	TInt expectedReturnCode(EPass);
+	TPtrC expectedPanicStringLex(KNull);
+	TPtrC expectedErrorStringLex(KNull);
+	
+	// Newly added variables for implementing !Params for TEF
+	TVerdict tefResult(EPass);
+	TBuf<KTEFTestExecuteParamLength> tefError(KNull);
+	TBuf<KMaxTestExecuteCommandLength> tefPanicString(KNull);
+	TBuf<KTEFTestExecuteParamLength> tefPanicCode(KNull);
+	TBool paramExistence(EFalse);
+	TPtrC panicString;
+	TPtrC errorString;
+	TPtrC defaultStr(KNull);
+	/// Start of defect Fix : defect 037262
+
+	// RUN_TEST_STEP_RESULT
+	// RUN_PANIC_STEP_RESULT
+	//
+	// Check that the expected result meets that of the  actual result.
+	// 
+	// RUN_TEST_STEP_RESULT will return :
+	// 
+	// PASS if the expected result meets the actual result
+	// FAIL if expected result was not the same as actual, the actual result is also displayed
+	// PANIC if the testcode panicked.
+	//
+	// RUN_PANIC_STEP_RESULT will return :
+	//
+	// PASS if Testcode panicked and expected/actual panic code/ strings match
+	// PANIC if TestCode panicked but the expected/actual panic code/ strings differ
+	// FAIL if Testcode did not panic, the actual result is also displayed
+	//
+	// RUN_PANIC_STEP will will now return : (for defect 039749)
+	// PASS if Testcode panicked irrespective of panic code/ strings, the code & strings are displayed
+	// FAIL if Testcode did not panic, the actual result is also displayed
+	
+	if (aPanicString.Length() >= KTEFMinPanicStringLength && aPanicString.Mid(0,KTEFMinPanicStringLength).CompareF(KErrorEquals) == KTEFZeroValue)
+		{
+	 	errorString.Set(aPanicString.Mid(KTEFMinPanicStringLength));
+	 	panicString.Set(KNull);
+	 	}
+	else if (aPanicString.Length() >= KTEFMinPanicStringLength && aPanicString.Mid(0,KTEFMinPanicStringLength).CompareF(KPanicEquals) == KTEFZeroValue)
+		{
+		panicString.Set(aPanicString.Mid(KTEFMinPanicStringLength));
+		defaultStr.Set(panicString);
+		errorString.Set(KNull);
+		}
+	
+	if(command == KTEFRunTestStepCommand && aResult!= EIgnore)
+		{
+		TInt firstChar;
+		TPtrC commandStr(scriptLineParamLex.NextToken());
+		while(!scriptLineParamLex.Eos())
+			{
+			TInt err(0);
+			scriptLineParamLex.SkipSpace();
+			commandStr.Set(scriptLineParamLex.NextToken());
+			firstChar = commandStr[0];
+			// 33 is the ascii value for "!". Used here for confirming switches
+			if (firstChar == KTEFAsciiExclamation)
+				{
+				if (commandStr.Length() >= KTEFMinErrorParamLength && commandStr.Mid(0,KTEFMinErrorParamLength).CompareF(KTEFError) == KTEFZeroValue)
+					{
+					if(command == KTEFRunTestStepCommand)
+						{
+						paramExistence = ETrue;
+						command.Set(KTEFRunErrorStepResultCommand);
+						TRAP(err,tefError.Copy(commandStr.Mid(KTEFMinErrorParamLength)));
+						if (err)
+							tefError.Copy(KNull);
+						defaultStr.Set(errorString);
+						}
+					}
+				else if (commandStr.Length() >= KTEFMinResultParamLength && commandStr.Mid(0,KTEFMinResultParamLength).CompareF(KTEFResult) == KTEFZeroValue)
+					{
+					if (command == KTEFRunTestStepCommand)
+						{
+						paramExistence = ETrue;
+						command.Set(KTEFRunTestStepResultCommand);
+						TLex resultVal(commandStr.Mid(KTEFMinResultParamLength));
+						tefResult = SetExpectedResult(resultVal);
+						}
+					}
+				else if (commandStr.Length() >= KTEFMinPanicCodeParamLength && commandStr.Mid(0,KTEFMinPanicCodeParamLength).CompareF(KTEFPanicCode) == KTEFZeroValue)
+					{
+					if(command == KTEFRunTestStepCommand)
+						{
+						paramExistence = ETrue;
+						command.Set(KTEFRunPanicStepResultCommand);
+						TRAP(err,tefPanicCode.Copy(commandStr.Mid(KTEFMinPanicCodeParamLength)));
+						if (err)
+							tefPanicCode.Copy(KNull);
+						defaultStr.Set(panicString);
+						}
+					else if(command == KTEFRunPanicStepResultCommand && tefPanicString.Length() != KTEFZeroValue)
+						{
+						TRAP(err,tefPanicCode.Copy(commandStr.Mid(KTEFMinPanicCodeParamLength)));
+						if (err)
+							tefPanicCode.Copy(KNull);
+						defaultStr.Set(panicString);
+						}
+					}
+				else if (commandStr.Length() >= KTEFMinPanicStringParamLength && commandStr.Mid(0,KTEFMinPanicStringParamLength).CompareF(KTEFPanicString) == KTEFZeroValue)
+					{
+					if(command == KTEFRunTestStepCommand)
+						{
+						paramExistence = ETrue;
+						command.Set(KTEFRunPanicStepResultCommand);
+						TRAP(err,tefPanicString.Copy(commandStr.Mid(KTEFMinPanicStringParamLength)));
+						if (err)
+							tefPanicString.Copy(KNull);
+						else
+							{
+							if (tefPanicString.Mid(0,1) == KTEFOpenQuotes)
+								tefPanicString.Copy(tefPanicString.Mid(1,tefPanicString.Length()-2));
+							}
+						defaultStr.Set(panicString);
+						}
+					else if(command == KTEFRunPanicStepResultCommand && tefPanicString.Length() != KTEFZeroValue)
+						{
+						TRAP(err,tefPanicString.Copy(commandStr.Mid(KTEFMinPanicStringParamLength)));
+						if (err)
+							tefPanicString.Copy(KNull);
+						else
+							{
+							if (tefPanicString.Mid(0,1) == KTEFOpenQuotes)
+								tefPanicString.Copy(tefPanicString.Mid(1,tefPanicString.Length()-2));
+							}
+						defaultStr.Set(panicString);
+						}
+					}
+				}
+			else
+				break;
+			}
+		}
+
+	if (aResult!= EIgnore)
+		{
+		if ((command == KTEFRunTestStepResultCommand) && (defaultStr.Length() == KTEFZeroValue))
+			{
+			// Pickout the expected returncode value
+			TLex expectedReturnCodeLex(scriptLineLex.NextToken());
+			TInt err;
+			if (paramExistence)
+				{
+				expectedReturnCode = tefResult;
+				err = 0;
+				}
+			else
+				err = expectedReturnCodeLex.Val(expectedReturnCode);
+			if (err == KTEFZeroValue)
+				{
+				if (expectedReturnCode == aResult)
+					{
+					aResult = EPass;
+					}
+				else
+					{
+					aResult				= EFail;
+					showActualResult	= ETrue;
+					}
+				}
+			}
+		else if (command == KTEFRunPanicStepResultCommand)
+			{
+			if (defaultStr.Length()) // we have indeed panicked
+				{
+				// Pickout the expected panic code value
+				// not necessarily 0, 106-110,  but any integer value set by test step
+				TLex expectedPanicCodeLex(scriptLineLex.NextToken());
+				//TInt expectedPanicCode;
+				TInt err;
+				if (paramExistence)
+					{
+					if (tefPanicCode.Length())
+						{
+						TLex PanicCodeLex(tefPanicCode);
+						err = PanicCodeLex.Val(expectedPanicCode);
+						}
+					else
+						{
+						expectedPanicCode = aResult;
+						err = 0;
+						}
+					}
+				else
+					err = expectedPanicCodeLex.Val(expectedPanicCode);
+
+				if (err == KTEFZeroValue)
+					{
+					if (expectedPanicCode == aResult)
+						{
+						//TPtrC expectedPanicStringLex;
+						// Now check ALSO that the panic string is identical.
+						if (paramExistence)
+							{
+								if (tefPanicString.Length())
+									expectedPanicStringLex.Set(tefPanicString);
+								else
+									expectedPanicStringLex.Set(defaultStr);
+							}
+						else
+							expectedPanicStringLex.Set(scriptLineLex.NextToken());
+						if (expectedPanicStringLex == defaultStr)
+							{
+							// Pretend its not a Panic
+							aResult			= EPass;
+							showPanicResult	= EFalse;
+							}
+						else
+							{
+							aResult			= EFail;
+							showPanicInfo	= ETrue;
+							showPanicResult	= EFalse;
+							}
+						}
+					else
+						{
+						aResult			= EFail;
+						showPanicInfo	= ETrue;
+						showPanicResult	= EFalse;
+						}
+					}
+				}
+			else
+				{
+				// we haven't panicked, we were looking for one, so this is a FAIL.
+				aResult				= EFail;
+				showPanicResult		= EFalse;
+				showActualResult	= ETrue;
+				}
+			}
+		else if (command == KTEFRunPanicStepCommand)
+			{
+			if (defaultStr.Length()) // we have indeed panicked
+				{
+				// Pretend its not a Panic
+				aResult			= EPass;
+				showPanicInfo	= ETrue;
+				showPanicResult = EFalse;
+				}
+			else
+				{
+				// we haven't panicked, we were looking for one, so this is a FAIL.
+				aResult				= EFail;
+				showPanicResult		= EFalse;
+				showActualResult	= ETrue;
+				}
+			}
+		else if (command == KTEFRunErrorStepResultCommand && paramExistence)
+			{
+			if (defaultStr.Length())
+				{
+				// Pickout the expected returncode value
+				//TPtrC expectedErrorStringLex;
+				expectedErrorStringLex.Set(tefError);
+			
+				if (expectedErrorStringLex == defaultStr)
+					{
+					// Pretend its not Error
+					aResult = EPass;
+					showPanicResult		= EFalse;
+					}
+				else
+					{
+					aResult				= EFail;
+					showPanicResult		= EFalse;
+					showPanicInfo		= ETrue;
+					}
+				}
+			else
+				{
+				// We haven't got any error, so this is a FAIL
+				aResult				= EFail;
+				showPanicResult		= EFalse;
+				showActualResult	= ETrue;
+				}
+			}
+		else if (errorString.Length())
+			{
+			aResult				= EFail;
+			defaultStr.Set(errorString);
+			showPanicResult		= EFalse;
+			showPanicInfo		= ETrue;
+			}
+		}
+
+	// End of bulk of defect defect 037262, fix also includes references to showPanicResult below
+	// allowing expected Panics to show as Passes + printing of actualResult.
+	ptr.Append(aScriptFile);
+	_LIT(KLineNumber," Line = %d");
+	ptr.AppendFormat(KLineNumber,aScriptLineNumber);
+	_LIT(KCommand," Command = ");
+	ptr.Append(KCommand);
+	ptr.Append(aCommand);
+	ptr.Trim();
+	_LIT(KTEFSpace," ");
+	ptr.Append(KTEFSpace);
+
+	_LIT(KCode," Code = %d ");
+	if (showActualResult)
+		{
+		_LIT(KActualResult, "Returned: ");
+		ptr.Append(KActualResult);
+		if(actualResult == EPass)
+			ptr.Append(KTEFResultPass);
+		else if(actualResult == EFail)
+			ptr.Append(KTEFResultFail);
+		else if(actualResult == EInconclusive)
+			ptr.Append(KTEFResultInconclusive);
+		else if(actualResult == EAbort || aResult == KErrAbort)
+			ptr.Append(KTEFResultAbort);
+		else 
+			{
+			// Log the error code
+			ptr.Append(KTEFResultUnknown);
+			ptr.AppendFormat(KCode,(TInt)actualResult);
+			}
+		ptr.Append(KTEFSpace);
+		}
+
+	if (showPanicInfo)
+		{
+		if (errorString.Length())
+			{
+			TLex errorValue(defaultStr);
+			TInt errorInt;
+			errorValue.Val(errorInt);
+			ptr.AppendFormat(KCode,(TInt)errorInt);
+			ptr.Append(KTEFSpace);			
+			}
+		else
+			{
+			ptr.AppendFormat(KCode,(TInt)actualPanic);
+			ptr.Append(KTEFSpace);
+			ptr.Append(defaultStr);
+			ptr.Append(KTEFSpace);
+			}
+		}
+
+	ptr.Append(KTEFResultTag);
+	ptr.Append(KTEFSpaceEquals);
+
+	if ((defaultStr.Length()) && showPanicResult)
+		{
+		ptr.Append(KTEFResultPanic);
+		_LIT(KHyphen," - ");
+		ptr.Append(KHyphen);
+		ptr.Append(defaultStr);
+		ptr.AppendFormat(KCode,(TInt)aResult);
+		}
+	else if(aResult == EPass)
+		ptr.Append(KTEFResultPass);
+	else if(aResult == EFail)
+		ptr.Append(KTEFResultFail);
+	else if(aResult == EInconclusive)
+		ptr.Append(KTEFResultInconclusive);
+	else if(aResult == EAbort || aResult == KErrAbort)
+		ptr.Append(KTEFResultAbort);
+	else if (aResult == EIgnore)
+		ptr.Append(KTEFResultUnexecuted);
+	else
+		{
+		// Log the error code
+		ptr.Append(KTEFResultUnknown);
+		ptr.AppendFormat(KCode,(TInt)aResult);
+		}
+	ptr.Append(KTEFSpace);
+
+	HBufC8* resultBuffer8 = HBufC8::NewLC(ptr.Length()+2);
+	TPtr8 ptr8(resultBuffer8->Des());
+	ptr8.Copy(ptr);
+	ptr8.Append(KTEFEndOfLine);
+	
+	LoggingTestCaseResultToSummaryResultL(iHtmlLogPath,KTEFTestExecuteResultSummaryFile,ptr8);
+	
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		{
+		TInt bytesCopied = 0;
+
+		while(bytesCopied < ptr.Length())
+			{
+			TInt bytesToCopy = ptr.Length() - bytesCopied;
+			if(bytesToCopy > KMaxTestExecuteLogLineLength)
+				{
+				bytesToCopy = KMaxTestExecuteLogLineLength;
+				}
+			TPtrC tmp(&ptr[bytesCopied],bytesToCopy);
+			bytesCopied += bytesToCopy;
+			iSerialWriter->WriteDecorated(tmp);
+			}
+		}
+	CleanupStack::PopAndDestroy(resultBuffer8);
+	CleanupStack::PopAndDestroy(resultBuffer);
+	}
+
+/**
+ * @param aResult - Result of execution of test steps for logging
+ * @param aPanicString - Reference descriptor containing the panic string if the test step results in a panic
+ * @param aScriptLineNumber - Line number within the script file where the RUN_TEST_STEP command is available
+ * @param aCommand - Command name being being executed (RUN_TEST_STEP & variants)
+ * @param aScriptFile - Name of the script file being used for execution
+ * @param aSeverity - One of the 4 enum values indicating the severity of the message to be logged
+ * Responsible for logging results for the RUN_TEST_STEP command/variants
+ */
+void CTestExecuteLogger::LogResultFileL(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,const TDesC& aScriptFile, TInt aSeverity)
+	{
+	HBufC* resultBuffer = HBufC::NewLC(KMaxTestExecuteCommandLength*3);
+	TPtr ptr(resultBuffer->Des());
+	HBufC* simplifiedResultBuf = HBufC::NewLC(KMaxTestExecuteCommandLength*3);
+	TPtr simplifiedPtr(simplifiedResultBuf->Des());
+	TLex scriptLineLex(aCommand);
+	TLex scriptLineParamLex(aCommand);
+	TLex xmlLogCommandParseLex(aCommand);
+	TPtrC command(scriptLineLex.NextToken());
+	TBool showPanicResult(ETrue);
+	TBool showActualResult(EFalse);
+	TBool showPanicInfo(EFalse);
+	TBool isARealPanic(EFalse); //PDEF117769
+	TVerdict actualResult(aResult);
+	TVerdict actualPanic(aResult);
+	TInt expectedPanicCode(0);
+	TInt expectedReturnCode(EPass);
+	TPtrC expectedPanicStringLex(KNull);
+	TPtrC expectedErrorStringLex(KNull);
+	
+	// Newly added variables for implementing !Params for TEF
+	TVerdict tefResult(EPass);
+	TBuf<KTEFTestExecuteParamLength> tefError(KNull);
+	// using 256 because in script this parameter could be very long
+	TBuf<KMaxTestExecuteCommandLength> tefPanicString(KNull); 
+	TBuf<KTEFTestExecuteParamLength> tefPanicCode(KNull);
+	TBool paramExistence(EFalse);
+	TPtrC panicString;
+	TPtrC errorString;
+	TPtrC defaultStr(KNull);
+	/// Start of defect Fix : defect 037262
+
+	// RUN_TEST_STEP_RESULT
+	// RUN_PANIC_STEP_RESULT
+	//
+	// Check that the expected result meets that of the  actual result.
+	// 
+	// RUN_TEST_STEP_RESULT will return :
+	// 
+	// PASS if the expected result meets the actual result
+	// FAIL if expected result was not the same as actual, the actual result is also displayed
+	// PANIC if the testcode panicked.
+	//
+	// RUN_PANIC_STEP_RESULT will return :
+	//
+	// PASS if Testcode panicked and expected/actual panic code/ strings match
+	// PANIC if TestCode panicked but the expected/actual panic code/ strings differ
+	// FAIL if Testcode did not panic, the actual result is also displayed
+	//
+	// RUN_PANIC_STEP will will now return : (for defect 039749)
+	// PASS if Testcode panicked irrespective of panic code/ strings, the code & strings are displayed
+	// FAIL if Testcode did not panic, the actual result is also displayed
+
+	if (aPanicString.Length() >= KTEFMinPanicStringLength && aPanicString.Mid(0,KTEFMinPanicStringLength).CompareF(KErrorEquals) == KTEFZeroValue)
+		{
+	 	errorString.Set(aPanicString.Mid(KTEFMinPanicStringLength));
+	 	panicString.Set(KNull);
+	 	}
+	else if (aPanicString.Length() >= KTEFMinPanicStringLength && aPanicString.Mid(0,KTEFMinPanicStringLength).CompareF(KPanicEquals) == KTEFZeroValue)
+		{
+		panicString.Set(aPanicString.Mid(KTEFMinPanicStringLength));
+		defaultStr.Set(panicString);
+		errorString.Set(KNull);
+		isARealPanic = ETrue;//PDEF117769
+		if (panicString.Length() == KTEFMaxPanicStringLength ) 
+			{
+			//TEF not know whether the panic string is being turncated.
+			//if received panic string == 16, TEF will give warning info to log.
+			LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, KTEFWarnPanicString );
+			}
+		}
+	
+	//PDEF117769
+	// the panic code (110) is SAME with define of EIgnore(110)
+	// When Panic 110 really happens, the defect code will take this situation as EIgnore.
+	// Solution is get the panic string when panic happens, then compare with expected panic string.
+	// aPanicString.Length() > 0, when panic really happens.
+	// So an extra condition at last.
+	if((command == KTEFRunTestStepCommand || command == KTEFEndTestBlock) && (aResult!= EIgnore || isARealPanic ))	
+		{
+		TInt firstChar;
+		TPtrC commandStr(scriptLineParamLex.NextToken());
+		while(!scriptLineParamLex.Eos())
+			{
+			TInt err(0);
+			scriptLineParamLex.SkipSpace();
+			commandStr.Set(scriptLineParamLex.NextToken());
+			if( commandStr.Length()>0 )
+				{
+				firstChar = commandStr[0];
+				// 33 is the ascii value for "!". Used here for confirming switches
+				if (firstChar == KTEFAsciiExclamation)
+					{
+					if (commandStr.Length() >= KTEFMinErrorParamLength && commandStr.Mid(0,KTEFMinErrorParamLength).CompareF(KTEFError) == KTEFZeroValue)
+						{
+						if(command == KTEFRunTestStepCommand || command == KTEFEndTestBlock)
+							{
+							paramExistence = ETrue;
+							command.Set(KTEFRunErrorStepResultCommand);
+							TRAP(err,tefError.Copy(commandStr.Mid(KTEFMinErrorParamLength)));
+							if (err)
+								tefError.Copy(KNull);
+							defaultStr.Set(errorString);
+							}
+						}
+					else if (commandStr.Length() >= KTEFMinResultParamLength && commandStr.Mid(0,KTEFMinResultParamLength).CompareF(KTEFResult) == KTEFZeroValue)
+						{
+						if (command == KTEFRunTestStepCommand || command == KTEFEndTestBlock)
+							{
+							paramExistence = ETrue;
+							command.Set(KTEFRunTestStepResultCommand);
+							TLex resultVal(commandStr.Mid(KTEFMinResultParamLength));
+							tefResult = SetExpectedResult(resultVal);
+							}
+						}
+					else if (commandStr.Length() >= KTEFMinPanicCodeParamLength && commandStr.Mid(0,KTEFMinPanicCodeParamLength).CompareF(KTEFPanicCode) == KTEFZeroValue)
+						{
+						if(command == KTEFRunTestStepCommand || command == KTEFEndTestBlock)
+							{
+							paramExistence = ETrue;
+							command.Set(KTEFRunPanicStepResultCommand);
+							TRAP(err,tefPanicCode.Copy(commandStr.Mid(KTEFMinPanicCodeParamLength)));
+							if (err)
+								tefPanicCode.Copy(KNull);
+							defaultStr.Set(panicString);
+							}
+						//PDEF117769
+						else if( command == KTEFRunPanicStepResultCommand )
+							{
+							TRAP(err,tefPanicCode.Copy(commandStr.Mid(KTEFMinPanicCodeParamLength)));
+							if (err)
+								tefPanicCode.Copy(KNull);
+							defaultStr.Set(panicString);
+							}
+						}
+					else if (commandStr.Length() >= KTEFMinPanicStringParamLength && commandStr.Mid(0,KTEFMinPanicStringParamLength).CompareF(KTEFPanicString) == KTEFZeroValue)
+						{
+						if(command == KTEFRunTestStepCommand || command == KTEFEndTestBlock)
+							{
+							paramExistence = ETrue;
+							command.Set(KTEFRunPanicStepResultCommand);
+							
+							ParsePaincStringFromScriptCommandLine(commandStr,scriptLineParamLex,tefPanicString);							
+							defaultStr.Set(panicString);
+							}
+						//PDEF117769
+						else if(command == KTEFRunPanicStepResultCommand)
+							{
+							ParsePaincStringFromScriptCommandLine(commandStr,scriptLineParamLex,tefPanicString);
+							defaultStr.Set(panicString);
+							}
+
+						// print out the panic string in panic dialog
+						// this make easier to user check what happened, when panic string compare fail.
+						if (isARealPanic && tefPanicString.Compare(panicString))
+							{
+							LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, KTEFExpectedPanicString, &tefPanicString);							
+							LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, KTEFReceivedPanicString, &panicString);
+							}
+						}
+					}
+				}
+			else
+				break;
+			}
+		}
+	
+	//PDEF117769
+	// See more detail above
+	if (aResult!= EIgnore || isARealPanic )
+		{
+		if ((command == KTEFRunTestStepResultCommand) && (defaultStr.Length() == KTEFZeroValue))
+			{
+			// Pickout the expected returncode value
+			TLex expectedReturnCodeLex(scriptLineLex.NextToken());
+			TInt err;
+			if (paramExistence)
+				{
+				expectedReturnCode = tefResult;
+				err = 0;
+				}
+			else
+				err = expectedReturnCodeLex.Val(expectedReturnCode);
+			if (err == KTEFZeroValue)
+				{
+				if (expectedReturnCode == aResult)
+					{
+					aResult = EPass;
+					}
+				else
+					{
+					aResult				= EFail;
+					showActualResult	= ETrue;
+					}
+				}
+			}
+		else if (command == KTEFRunPanicStepResultCommand)
+			{
+			//PDEF117769 start
+			if ( isARealPanic ) // if panic really happens aPanicString !=0 (or >=2)
+										 // we have indeed panicked
+			//PDEF117769 end
+				{
+				// Pickout the expected panic code value
+				// not necessarily 0, 106-110,  but any integer value set by test step
+				TLex expectedPanicCodeLex(scriptLineLex.NextToken());
+				//TInt expectedPanicCode;
+				TInt err;
+				if (paramExistence)
+					{
+					if (tefPanicCode.Length())
+						{
+						TLex PanicCodeLex(tefPanicCode);
+						err = PanicCodeLex.Val(expectedPanicCode);
+						}
+					else
+						{
+						expectedPanicCode = aResult;
+						err = 0;
+						}
+					}
+				else
+					err = expectedPanicCodeLex.Val(expectedPanicCode);
+
+				if (err == KTEFZeroValue)
+					{
+					if (expectedPanicCode == aResult)
+						{
+						//TPtrC expectedPanicStringLex;
+						// Now check ALSO that the panic string is identical.
+						if (paramExistence)
+							{
+								if (tefPanicString.Length())
+									expectedPanicStringLex.Set(tefPanicString);
+								else
+									expectedPanicStringLex.Set(defaultStr);
+							}
+						else
+							{
+							expectedPanicStringLex.Set(scriptLineLex.NextToken());
+							if (expectedPanicStringLex.Left(1) == KTEFOpenQuotes)
+								{
+								if (expectedPanicStringLex.Right(1) != KTEFOpenQuotes)
+									{
+									TBuf<KTEFTestExecuteParamLength> concatPanicString(expectedPanicStringLex.Mid(1,expectedPanicStringLex.Length()-1));
+									TBool panicStringCompleted(EFalse);
+									while(!scriptLineLex.Eos() && !panicStringCompleted)
+										{
+										TPtrC panicStringExt(scriptLineLex.NextToken());
+										concatPanicString.Append(KTEFSpace);
+										if(panicStringExt.Right(1) == KTEFOpenQuotes)
+											{
+											panicStringCompleted = ETrue;
+											concatPanicString.Append(panicStringExt.Mid(0, panicStringExt.Length()-1));
+											}
+										else
+											concatPanicString.Append(panicStringExt);
+										}
+									expectedPanicStringLex.Set(concatPanicString);
+									}
+								else
+									expectedPanicStringLex.Set(expectedPanicStringLex.Mid(1,expectedPanicStringLex.Length()-2));
+								}
+							}
+						//PDEF117769 
+						if ( (expectedPanicStringLex.Length() == KTEFZeroValue && defaultStr.Length() == KTEFZeroValue ) || expectedPanicStringLex == defaultStr )
+							{
+							// Pretend its not a Panic
+							aResult			= EPass;
+							showPanicResult	= EFalse;
+							}
+						else
+							{
+							aResult			= EFail;
+							showPanicInfo	= ETrue;
+							showPanicResult	= EFalse;
+							}
+						}
+					else
+						{
+						aResult			= EFail;
+						showPanicInfo	= ETrue;
+						showPanicResult	= EFalse;
+						}
+					}
+				}
+			else
+				{
+				// we haven't panicked, we were looking for one, so this is a FAIL.
+				aResult				= EFail;
+				showPanicResult		= EFalse;
+				showActualResult	= ETrue;
+				}
+			}
+		else if (command == KTEFRunPanicStepCommand)
+			{
+			if ( isARealPanic )  // we have indeed panicked
+				{
+				// Pretend its not a Panic
+				aResult			= EPass;
+				showPanicInfo	= ETrue;
+				showPanicResult = EFalse;
+				}
+			else
+				{
+				// we haven't panicked, we were looking for one, so this is a FAIL.
+				aResult				= EFail;
+				showPanicResult		= EFalse;
+				showActualResult	= ETrue;
+				}
+			}
+		else if (command == KTEFRunErrorStepResultCommand && paramExistence)
+			{
+			if (defaultStr.Length())
+				{
+				// Pickout the expected returncode value
+				//TPtrC expectedErrorStringLex;
+				expectedErrorStringLex.Set(tefError);
+			
+				if (expectedErrorStringLex == defaultStr)
+					{
+					// Pretend its not Error
+					aResult = EPass;
+					showPanicResult		= EFalse;
+					}
+				else
+					{
+					aResult				= EFail;
+					showPanicResult		= EFalse;
+					showPanicInfo		= ETrue;
+					}
+				}
+			else
+				{
+				// We haven't got any error, so this is a FAIL
+				aResult				= EFail;
+				showPanicResult		= EFalse;
+				showActualResult	= ETrue;
+				}
+			}
+		else if (errorString.Length())
+			{
+			aResult				= EFail;
+			defaultStr.Set(errorString);
+			showPanicResult		= EFalse;
+			showPanicInfo		= ETrue;
+			}
+		}
+
+	// End of bulk of defect defect 037262, fix also includes references to showPanicResult below
+	// allowing expected Panics to show as Passes + printing of actualResult.
+
+	// Construct result tags for HTML logging
+	if ((defaultStr.Length()) && showPanicResult)
+		ptr.Append(KTEFFontBlue);
+	else if(aResult == EPass)
+		ptr.Append(KTEFFontGreen);
+	else if (aResult == EFail)
+		ptr.Append(KTEFFontRed);
+	else
+		ptr.Append(KTEFFontBlue);
+	ptr.Append(aScriptFile);
+	_LIT(KLineNumber," Line = %d");
+	ptr.AppendFormat(KLineNumber,aScriptLineNumber);
+	_LIT(KCommand," Command = ");
+	ptr.Append(KCommand);	
+	ptr.Append(aCommand);
+	ptr.Trim();
+	simplifiedPtr.Append(aCommand);
+	simplifiedPtr.Trim();
+	ptr.Append(KTEFSpace);
+	simplifiedPtr.Append(KTEFSpace);
+	
+	_LIT(KCode," Code = %d ");
+
+	TBuf<KMaxTestExecuteCommandLength> resultTmpBuf;
+	resultTmpBuf.Zero();
+	if (showActualResult)
+		{
+		_LIT(KActualResult, "Returned: ");
+		resultTmpBuf.Copy(KActualResult);
+		if(actualResult == EPass)
+			resultTmpBuf.Append(KTEFResultPass);
+		else if(actualResult == EFail)
+			resultTmpBuf.Append(KTEFResultFail);
+		else if(actualResult == EInconclusive)
+			resultTmpBuf.Append(KTEFResultInconclusive);
+		else if(actualResult == EAbort || aResult == KErrAbort)
+			resultTmpBuf.Append(KTEFResultAbort);
+		else 
+			{
+			// Log the error code
+			resultTmpBuf.Append(KTEFResultUnknown);
+			resultTmpBuf.AppendFormat(KCode,(TInt)actualResult);
+			}
+		resultTmpBuf.Append(KTEFSpace);
+		}
+	ptr.Append(resultTmpBuf);
+	simplifiedPtr.Append(resultTmpBuf);
+	
+	if (showPanicInfo)
+		{
+		if (errorString.Length())
+			{
+			TLex errorValue(defaultStr);
+			TInt errorInt;
+			errorValue.Val(errorInt);
+			ptr.AppendFormat(KCode,(TInt)errorInt);
+			ptr.Append(KTEFSpace);			
+			}
+		else
+			{
+			ptr.AppendFormat(KCode,(TInt)actualPanic);
+			ptr.Append(KTEFSpace);
+			ptr.Append(defaultStr);
+			ptr.Append(KTEFSpace);
+			}
+		}
+
+	ptr.Append(KTEFResultTag);
+	simplifiedPtr.Append(KTEFResultTag);
+	ptr.Append(KTEFSpaceEquals);
+	simplifiedPtr.Append(KTEFSpaceEquals);
+	
+	resultTmpBuf.Zero();
+	if ((defaultStr.Length()) && showPanicResult)
+		{
+		resultTmpBuf.Append(KTEFResultPanic);
+		_LIT(KHyphen," - ");
+		resultTmpBuf.Append(KHyphen);
+		resultTmpBuf.Append(defaultStr);
+		resultTmpBuf.AppendFormat(KCode,(TInt)aResult);
+		}
+	else if(aResult == EPass)
+		resultTmpBuf.Append(KTEFResultPass);
+	else if(aResult == EFail)
+		resultTmpBuf.Append(KTEFResultFail);
+	else if(aResult == EInconclusive)
+		resultTmpBuf.Append(KTEFResultInconclusive);
+	else if(aResult == EAbort || aResult == KErrAbort)
+		resultTmpBuf.Append(KTEFResultAbort);
+	else if (aResult == EIgnore)
+		resultTmpBuf.Append(KTEFResultUnexecuted);
+	else
+		{
+		// Log the error code
+		resultTmpBuf.Append(KTEFResultUnknown);
+		resultTmpBuf.AppendFormat(KCode,(TInt)aResult);
+		}
+	ptr.Append(resultTmpBuf);
+	simplifiedPtr.Append(resultTmpBuf);
+	
+	ptr.Append(KTEFSpace);
+	simplifiedPtr.Append(KTEFSpace);
+	ptr.Append(KTEFFontEnd);
+
+	HBufC8* resultBuffer8 = HBufC8::NewLC(ptr.Length()+2);
+	TPtr8 ptr8(resultBuffer8->Des());
+	ptr8.Copy(ptr);
+	ptr8.Append(KTEFEndOfLine);
+
+	// Only log the START_TEST_BLOCK command to the results file if it has failed
+	//  and therefore the END_TEST_BLOCK command may not be logged.
+	if( 0 != command.Compare(KTEFStartTestBlock) ||
+		(0 == command.Compare(KTEFStartTestBlock) && EPass != aResult) )
+		{
+		LoggingTestCaseResultToSummaryResultL(iHtmlLogPath,KTEFTestExecuteResultSummaryFile,ptr8);
+		//re-use result buffer
+		ptr8.Zero();
+		ptr8.Copy(simplifiedPtr);
+		ptr8.Append(KTEFEndOfLine);
+		LoggingTestCaseResultToSummaryResultL(iHtmlLogPath,KTEFTestExecuteResultSimplifiedSummaryFile,ptr8);
+		}
+		
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		{
+		TInt bytesCopied = 0;
+
+		while(bytesCopied < ptr.Length())
+			{
+			TInt bytesToCopy = ptr.Length() - bytesCopied;
+			if(bytesToCopy > KMaxTestExecuteLogLineLength)
+				{
+				bytesToCopy = KMaxTestExecuteLogLineLength;
+				}
+			TPtrC tmp(&ptr[bytesCopied],bytesToCopy);
+			bytesCopied += bytesToCopy;
+			HtmlLogger().Write(tmp);
+			if(iPIPSExists)
+				{
+				PIPSLogger().Write(tmp);
+				}
+			}
+		}
+
+	CleanupStack::PopAndDestroy(resultBuffer8);
+	CleanupStack::PopAndDestroy(simplifiedResultBuf);
+	CleanupStack::PopAndDestroy(resultBuffer);
+
+	// Construct tags for XML logging
+	if (iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth)
+		{
+		_LIT(KTimeout,"TIMEOUT");
+		_LIT(KProgramName,"PROGRAMNAME");
+		_LIT(KServerName,"SERVERNAME");
+		_LIT(KStepName,"TESTSTEPNAME");
+		_LIT(KIniFile,"INIFILENAME");
+		_LIT(KTEFSection,"SECTIONNAME");
+		_LIT(KEResult,"EXPECTEDRESULT");
+		_LIT(KAResult,"ACTUALRESULT");
+		_LIT(KEPanicCode,"EXPECTEDPANICCODE");
+		_LIT(KAPanicCode,"PANICCODE");
+		_LIT(KEPanicString,"EXPECTEDPANICSTRING");
+		_LIT(KAPanicString,"PANICSTRING");
+		_LIT(KEErrorCode,"EXPECTEDERRORCODE");
+		_LIT(KAErrorCode,"ERRORCODE");
+		_LIT(KHeapSize,"HEAPSIZE");
+		_LIT(KMaximumHeapSize,"0x100000");
+
+		TPtrC panicCodeExpected;
+		TPtrC panicStringExpected;
+		
+		TBuf<KMaxTestExecuteCommandLength> taskHeapSize(KMaximumHeapSize);
+		
+		TBuf<KMaxTestExecuteCommandLength> fieldName;
+		TBuf<KMaxTestExecuteCommandLength> fieldValue;
+		TBuf8<KMaxTestExecuteCommandLength> string1;
+		TBuf8<KMaxTestExecuteCommandLength> string2;
+		
+		TPtrC commandName(xmlLogCommandParseLex.NextToken()); // Collect the command name from current script line
+
+		if(commandName == KTEFRunTestStepResultCommand)
+			{
+			// Mark the position to the timeout token within the current script line
+			xmlLogCommandParseLex.NextToken();
+			xmlLogCommandParseLex.SkipSpace();
+			xmlLogCommandParseLex.Mark();
+			}
+
+		else if(commandName == KTEFRunPanicStepResultCommand)
+			{
+			// Mark the position to the timeout token within the current script line
+			// Also retrieve the expected panic code & strings
+			panicCodeExpected.Set(xmlLogCommandParseLex.NextToken());
+			panicStringExpected.Set(xmlLogCommandParseLex.NextToken());
+			xmlLogCommandParseLex.SkipSpace();
+			xmlLogCommandParseLex.Mark();
+			}
+		else if(commandName == KTEFRunTestStepCommand || commandName == KTEFEndTestBlock || commandName == KTEFStartTestBlock )
+			{
+			// Mark the position to the timeout token within the current script line
+			// The !TEF parameters are to be neglected if there are any
+			TInt firstChar;
+			TPtrC commandStr;
+
+			while(!xmlLogCommandParseLex.Eos())
+				{
+				xmlLogCommandParseLex.SkipSpace();
+				xmlLogCommandParseLex.Mark();			
+				commandStr.Set(xmlLogCommandParseLex.NextToken());
+				if( commandStr.Length()>0 )
+					{
+					firstChar = commandStr[0];
+					// 33 is the ascii value for "!". Used here for confirming switches
+					if (firstChar != KTEFAsciiExclamation)
+						{
+						break;
+						}
+					else
+						{
+						if (commandStr.Length() >= KTEFMinHeapParamLength && commandStr.Mid(0,KTEFMinHeapParamLength).CompareF(KTEFHeap) == KTEFZeroValue)
+							taskHeapSize.Copy(commandStr.Mid(KTEFMinHeapParamLength));
+						}
+					}
+				else
+					{
+					break;
+					}
+				}
+			}
+	
+		TLex lexTimeout;
+		// We need to skip the timeout if it's there.
+		if(commandName == KTEFRunTestStepCommand || commandName == KTEFStartTestBlock)
+			lexTimeout=xmlLogCommandParseLex.MarkedToken();
+		else
+			lexTimeout=xmlLogCommandParseLex.NextToken();
+		TInt timeout;
+		TPtrC serverName;
+
+		// Extract the timeout value and server name
+		if(lexTimeout.Val(timeout) != KErrNone)
+			{
+			if (commandName == KTEFRunProgramCommand)
+				{
+				serverName.Set(lexTimeout.NextToken());
+				}
+			else
+				{
+				// No timeout so use the second token
+				serverName.Set(xmlLogCommandParseLex.MarkedToken());
+				}
+			const TInt KDefaultTimeoutSeconds=120;
+			timeout=KDefaultTimeoutSeconds;
+			}
+		else
+			{
+			// Timeout value there
+			serverName.Set(xmlLogCommandParseLex.NextToken());
+			}
+			
+		TBuf<KMaxTestExecuteCommandLength> timeoutString;
+		timeoutString.AppendNum(timeout); // Convert the integral timeout to its equivalent string
+		TPtrC stepName;
+		if( commandName != KTEFStartTestBlock && commandName != KTEFEndTestBlock )
+			{
+			stepName.Set( xmlLogCommandParseLex.NextToken() ); // Extract the step name
+			}
+		TPtrC iniName(xmlLogCommandParseLex.NextToken()); // Extract the ini file name
+		TPtrC sectionName(xmlLogCommandParseLex.NextToken()); // Extract the section name
+		
+		TExtraLogField logField[15];
+		TInt index = 0;
+		
+		if( commandName != KTEFEndTestBlock )
+			{
+			logField[index].iLogFieldName.Copy(KTimeout);
+			logField[index].iLogFieldValue.Copy(timeoutString);
+			index++;
+			}
+
+		if(commandName == KTEFRunProgramCommand || commandName == KTEFRunWSProgramCommand)
+			{
+			logField[index].iLogFieldName.Copy(KProgramName);
+			logField[index].iLogFieldValue.Copy(serverName);
+			index++;
+			}
+		else if( commandName != KTEFEndTestBlock )
+			{
+			logField[index].iLogFieldName.Copy(KServerName);
+			logField[index].iLogFieldValue.Copy(serverName);
+			index++;
+			}
+
+		if (commandName != KTEFRunProgramCommand && commandName != KTEFRunWSProgramCommand &&
+			commandName != KTEFEndTestBlock && commandName != KTEFStartTestBlock )
+			{
+			logField[index].iLogFieldName.Copy(KStepName);
+			logField[index].iLogFieldValue.Copy(stepName);
+			index++;
+
+			logField[index].iLogFieldName.Copy(KTEFSection);
+			logField[index].iLogFieldValue.Copy(sectionName);
+			index++;
+			}
+		
+		if (commandName != KTEFRunProgramCommand && commandName != KTEFRunWSProgramCommand &&
+			commandName != KTEFEndTestBlock )
+			{
+			logField[index].iLogFieldName.Copy(KIniFile);
+			logField[index].iLogFieldValue.Copy(iniName);
+			index++;
+			}
+			
+		if (commandName == KTEFRunTestStepResultCommand)
+			{
+			fieldValue.Copy(KNull);
+			fieldValue.AppendNum(expectedReturnCode);
+			logField[index].iLogFieldName.Copy(KEResult);
+			logField[index].iLogFieldValue.Copy(fieldValue);
+			index++;
+
+			fieldValue.Copy(KNull);
+			fieldValue.AppendNum(actualResult);
+			logField[index].iLogFieldName.Copy(KAResult);
+			logField[index].iLogFieldValue.Copy(fieldValue);
+			index++;
+			}
+
+		if (commandName == KTEFRunPanicStepResultCommand || commandName == KTEFEndTestBlock )
+			{
+			if (defaultStr.Length()) // we have indeed panicked
+				{
+				fieldValue.Copy(KNull);
+				fieldValue.AppendNum(expectedPanicCode);
+				logField[index].iLogFieldName.Copy(KEPanicCode);
+				logField[index].iLogFieldValue.Copy(fieldValue);
+				index++;
+
+				fieldValue.Copy(KNull);
+				fieldValue.AppendNum(actualPanic);
+				logField[index].iLogFieldName.Copy(KAPanicCode);
+				logField[index].iLogFieldValue.Copy(fieldValue);
+				index++;
+
+				if (expectedPanicCode == actualPanic)
+					{
+					fieldValue.Copy(expectedPanicStringLex);
+					logField[index].iLogFieldName.Copy(KEPanicString);
+					logField[index].iLogFieldValue.Copy(fieldValue);
+					index++;
+
+					fieldValue.Copy(defaultStr);
+					logField[index].iLogFieldName.Copy(KAPanicString);
+					logField[index].iLogFieldValue.Copy(fieldValue);
+					index++;
+					}
+				}
+			}
+		
+		if (commandName == KTEFRunErrorStepResultCommand)
+			{
+			if (errorString.Length()) // Error has occured
+				{
+				logField[index].iLogFieldName.Copy(KEErrorCode);
+				logField[index].iLogFieldValue.Copy(tefError);
+				index++;
+				
+				logField[index].iLogFieldName.Copy(KAErrorCode);
+				logField[index].iLogFieldValue.Copy(errorString);
+				index++;
+				}
+			}
+			
+		logField[index].iLogFieldName.Copy(KHeapSize);
+		logField[index].iLogFieldValue.Copy(taskHeapSize);
+		index++;
+
+		if ((defaultStr.Length()) && showPanicResult)
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultPanic);
+			index++;
+
+			_LIT(KTEFPanicString, "PANICSTRING");
+			logField[index].iLogFieldName.Copy(KTEFPanicString);
+			logField[index].iLogFieldValue.Copy(defaultStr);
+			index++;
+
+			_LIT(KTEFPanicCode, "PANICCODE");
+			logField[index].iLogFieldName.Copy(KTEFPanicCode);
+			logField[index].iLogFieldValue.AppendNum(aResult);
+			index++;
+			}
+		else if(aResult == EPass)
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultPass);
+			index++;
+			}
+		else if(aResult == EFail)
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultFail);
+			index++;
+			}
+		else if(aResult == EAbort || aResult == KErrAbort)
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultAbort);
+			index++;
+			}
+		else if (aResult == EIgnore)
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultUnexecuted);
+			index++;
+			}
+		else if(aResult == EInconclusive)
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultInconclusive);
+			index++;
+			}
+		else
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			TBuf<KMaxTestExecuteNameLength> fieldValue(KTEFResultUnknown);
+			fieldValue.Append(KTEFSpaceEquals);
+			fieldValue.AppendNum(aResult);
+			logField[index].iLogFieldValue.Copy(fieldValue);
+			index++;
+			}
+
+		// Log the commmand name along with field-value pairs
+		XmlLogger().Log(((TText8*)__FILE__), aScriptLineNumber, RFileFlogger::TLogSeverity(aSeverity), index, logField, KTEFStringFormat, &commandName);
+		}
+	}
+
+/**
+ * @param aResult - Result of execution of test steps for logging
+ * @param aPanicString - Reference descriptor containing the panic string if the test step results in a panic
+ * @param aScriptLineNumber - Line number within the script file where the RUN_TEST_STEP command is available
+ * @param aCommand - Command name being being executed (RUN_TEST_STEP & variants)
+ * @param aScriptFile - Name of the script file being used for execution
+ * @param aSeverity - One of the 4 enum values indicating the severity of the message to be logged
+ * Responsible for logging results for the RUN_TEST_STEP command/variants
+ */
+EXPORT_C void CTestExecuteLogger::LogResult(TVerdict aResult, const TDesC& aPanicString, TInt aScriptLineNumber,const TDesC& aCommand,const TDesC& aScriptFile, TInt aSeverity)
+	{
+	if((ESerial == iLoggerChannel) || (EBoth == iLoggerChannel  ))
+		{
+		TRAP_IGNORE( LogResultSerialL(aResult, aPanicString, aScriptLineNumber,aCommand,aScriptFile) );
+		}
+	if(  (EFile == iLoggerChannel ) 
+		|| (EBoth== iLoggerChannel ) )
+		{
+		TRAP_IGNORE( LogResultFileL(aResult, aPanicString, aScriptLineNumber,aCommand,aScriptFile, aSeverity) ); 
+		}
+	}
+
+EXPORT_C TVerdict CTestExecuteLogger::LogBlock( TTEFItemArray* aItemArray, const TInt aScriptLineNumber )
+	{
+	TVerdict	result = EPass;
+	
+	// HTML specific block logging
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		{
+		result = LogHTMLBlockL( *aItemArray );
+		}
+
+	// XML specific block logging
+	if (iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth)
+		{
+		result = LogXMLBlock( *aItemArray, aScriptLineNumber );
+		}
+
+	return result;
+	}
+
+TVerdict CTestExecuteLogger::LogHTMLBlockL( const TTEFItemArray& aItemArray )
+	{
+	TVerdict		result = EPass;
+	TInt			numCommands = aItemArray.Count();
+	
+	// Iterate through the item array and verify all of the error codes
+	for( TInt i = 0 ; i<numCommands ; i++ )
+		{
+		TVerdict	err = EPass;
+		// Check the error code is correct
+		TBuf<KMaxTestExecuteCommandLength*2> blockLine;
+
+		// Log the block command
+		// Set the correct coolour for the HTML
+		if( !aItemArray.At(i).iExecuted )
+			{
+			err = EInconclusive;
+			blockLine += KTEFFontBlue;
+			}
+		else if( aItemArray.At(i).iError != aItemArray.At(i).iExpectedError
+				 || aItemArray.At(i).iAsyncError != aItemArray.At(i).iExpectedAsyncError )
+			{
+			err = EFail;
+			blockLine += KTEFFontRed;
+			}
+		else
+			{
+			blockLine += KTEFFontGreen;
+			}
+
+		switch( aItemArray.At(i).iItemType )
+			{
+			case ETEFCreateObject:
+				{
+				blockLine += KTEFCreateObject;
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iObjectType;
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iSection;
+				}
+				break;
+			case ETEFRestoreObject:
+				{
+				blockLine += KTEFRestoreObject;
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iObjectType;
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iSection;
+				}
+				break;
+			case ETEFCommand:
+				{
+				blockLine += KTEFCommand;
+				blockLine += KTEFSpace;
+				blockLine += KTEFError;
+				blockLine.AppendNum( aItemArray.At(i).iExpectedError );
+				blockLine += KTEFSpace;
+				blockLine += KTEFAsyncError;
+				blockLine.AppendNum( aItemArray.At(i).iExpectedAsyncError );
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iCommand.iObject;
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iCommand.iFunction;
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iSection;
+				}
+				break;
+			case ETEFStore:
+				{
+				blockLine += KTEFStore;
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iSection;
+				}
+				break;
+			case ETEFOutstanding:
+				{
+				blockLine += KTEFOutstanding;
+				blockLine += KTEFSpace;
+				blockLine.AppendNum( aItemArray.At(i).iTime );
+				blockLine += KTEFSpace;
+				blockLine += aItemArray.At(i).iSection;
+				}
+				break;
+			case ETEFDelay:
+				{
+				blockLine += KTEFDelay;
+				blockLine += KTEFSpace;
+				blockLine.AppendNum( aItemArray.At(i).iTime );
+				}
+				break;
+			case ETEFAsyncDelay:
+				{
+				blockLine += KTEFAsyncDelay;
+				blockLine += KTEFSpace;
+				blockLine.AppendNum( aItemArray.At(i).iTime );
+				}
+				break;		
+			case ETEFSharedActiveScheduler:
+				{
+				blockLine += KTEFSharedActiveScheduler;
+				}
+				break;
+			case ETEFStoreActiveScheduler:
+				{
+				blockLine += KTEFStoreActiveScheduler;
+				}
+				break;
+
+			default:
+				{
+				blockLine += _L("Bad Command.");
+				result = EFail;
+				err = EFail;
+				}
+				break;
+			}
+		
+		// Append an extra space for clearer logging.
+		blockLine += KTEFSpace;
+		
+		// Log the block command
+		if( !aItemArray.At(i).iExecuted )
+			{
+			err = EInconclusive;
+			// If a command has failed then the overall block has failed
+			result = EFail;
+			}
+		else if( aItemArray.At(i).iError != aItemArray.At(i).iExpectedError
+				 || aItemArray.At(i).iAsyncError != aItemArray.At(i).iExpectedAsyncError )
+			{
+			blockLine += KTEFErrorResult;
+			blockLine.AppendNum(aItemArray.At(i).iError);
+			blockLine += KTEFAsyncErrorResult;
+			blockLine.AppendNum(aItemArray.At(i).iAsyncError);
+			err = EFail;
+			// If a command has failed then the overall block has failed
+			result = EFail;
+			}
+
+		// Append the result
+		blockLine += KTEFSpace;
+		blockLine += KTEFResultTag;
+		blockLine += KTEFSpace;
+		blockLine += KTEFEquals;
+		blockLine += KTEFSpace;
+		if( EPass == err )
+			{
+			blockLine += KTEFResultPass;
+			}
+		else if( EFail == err )
+			{
+			blockLine += KTEFResultFail;
+			}
+		else
+			{
+			blockLine += KTEFResultInconclusive;
+			}
+
+		// Terminate the html line
+		blockLine += KTEFSpace;
+		blockLine += KTEFFontEnd;
+
+		HBufC8* resultBuffer8 = HBufC8::NewLC(blockLine.Length()+2);
+		TPtr8 ptr8(resultBuffer8->Des());
+		ptr8.Copy(blockLine);
+
+		// Write to the log file
+		HtmlLogger().Write(ptr8);
+		if(iPIPSExists)
+			{
+			PIPSLogger().Write(ptr8);
+			}
+		CleanupStack::PopAndDestroy(resultBuffer8);
+		}
+		
+	return result;
+	}
+	
+TVerdict CTestExecuteLogger::LogXMLBlock( const TTEFItemArray& aItemArray, const TInt aScriptLineNumber )
+	{
+	TVerdict		result = EPass;
+	TInt			numCommands = aItemArray.Count();
+	
+	for( TInt i = 0 ; i<numCommands ; i++ )
+		{
+		TInt index = 0;
+		TExtraLogField			logField[8];
+		TBuf<KTEFMaxNameLength>	command;
+		
+		switch( aItemArray.At(i).iItemType )
+			{
+			case ETEFCreateObject:
+				{
+				command = KTEFCreateObject;
+				logField[index].iLogFieldName.Copy(KObjectType);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iObjectType);
+				index++;
+				logField[index].iLogFieldName.Copy(KObjectSection);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iSection);			
+				index++;
+				}
+				break;
+			case ETEFRestoreObject:
+				{
+				command = KTEFRestoreObject;
+				logField[index].iLogFieldName.Copy(KObjectType);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iObjectType);
+				index++;
+				logField[index].iLogFieldName.Copy(KObjectSection);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iSection);			
+				index++;
+				}
+				break;
+			case ETEFCommand:
+				{
+				command = KTEFCommand;
+				logField[index].iLogFieldName.Copy(KEErrorCode);
+				logField[index].iLogFieldValue.AppendNum(aItemArray.At(i).iExpectedError);
+				index++;
+				logField[index].iLogFieldName.Copy(KEAsyncErrorCode);
+				logField[index].iLogFieldValue.AppendNum(aItemArray.At(i).iExpectedAsyncError);
+				index++;
+				logField[index].iLogFieldName.Copy(KErrorCode);
+				logField[index].iLogFieldValue.AppendNum(aItemArray.At(i).iError);
+				index++;
+				logField[index].iLogFieldName.Copy(KAsyncErrorCode);
+				logField[index].iLogFieldValue.AppendNum(aItemArray.At(i).iAsyncError);
+				index++;
+				logField[index].iLogFieldName.Copy(KObjectSection);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iCommand.iObject);
+				index++;
+				logField[index].iLogFieldName.Copy(KFunctionName);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iCommand.iFunction);
+				index++;
+				logField[index].iLogFieldName.Copy(KSection);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iSection);
+				index++;
+				}
+				break;
+			case ETEFStore:
+				{
+				command = KTEFStore;
+				logField[index].iLogFieldName.Copy(KObjectSection);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iSection);
+				index++;
+				}
+				break;
+			case ETEFOutstanding:
+				{
+				command = KTEFOutstanding;
+				logField[index].iLogFieldName.Copy(KInterval);
+				logField[index].iLogFieldValue.AppendNum(aItemArray.At(i).iTime);
+				index++;
+				logField[index].iLogFieldName.Copy(KSection);
+				logField[index].iLogFieldValue.Copy(aItemArray.At(i).iSection);
+				index++;
+				}
+				break;
+			case ETEFDelay:
+				{
+				command = KTEFDelay;
+				logField[index].iLogFieldName.Copy(KDelay);
+				logField[index].iLogFieldValue.AppendNum(aItemArray.At(i).iTime);
+				index++;
+				}
+				break;
+			case ETEFAsyncDelay:
+				{
+				command = KTEFAsyncDelay;
+				logField[index].iLogFieldName.Copy(KDelay);
+				logField[index].iLogFieldValue.AppendNum(aItemArray.At(i).iTime);
+				index++;
+				}
+				break;
+			default:
+				{
+				command = KBadCommand;
+				}
+				break;
+			}
+
+		// Set the correct result for the XML
+		if( !aItemArray.At(i).iExecuted )
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultInconclusive);
+			index++;
+			// If a command has failed then the overall block has failed
+			result = EFail;
+			}
+		else if( aItemArray.At(i).iError != aItemArray.At(i).iExpectedError
+				 || aItemArray.At(i).iAsyncError != aItemArray.At(i).iExpectedAsyncError )
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultFail);
+			index++;
+			// If a command has failed then the overall block has failed
+			result = EFail;
+			}
+		else
+			{
+			logField[index].iLogFieldName.Copy(KTEFResultString);
+			logField[index].iLogFieldValue.Copy(KTEFResultPass);
+			index++;
+			}
+	
+		// Call the Xml log client interface for logging into xml log
+		// Log the commmand name along with field-value pairs
+		XmlLogger().Log(((TText8*)__FILE__), aScriptLineNumber, RFileFlogger::ESevrHigh, index, logField, KTEFStringFormat, &command);
+		}
+	
+	return result;
+	}
+
+/**
+ * @param aLogMode - Integer descriptor containing either of the 3 enum values
+ *                   ELogHTMLOnly(0)/ELogXMLOnly(1)/ELogBoth(2)
+ * Responsible for setting the logger options for the logger object based on user request
+ */
+EXPORT_C void CTestExecuteLogger::SetLoggerOptions(TInt aLogMode)
+	{
+	iLoggerOptions = TLoggerOptions(aLogMode);
+	}
+
+/**
+ * @param aLogChannel - Integer descriptor containing either of the 3 enum values
+ * Responsible for setting the logger Channel 
+ */
+EXPORT_C void CTestExecuteLogger::SetLoggerChannel(TInt aLogChannel)
+	{
+	iLoggerChannel = aLogChannel ; 
+	}
+
+/**
+ * @return - System wide errors
+ * Connects to the HTML & XML logger client sessions
+ */
+EXPORT_C TInt CTestExecuteLogger::Connect()
+	{
+	TInt err = KErrNone;
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		{
+		// Call the Html log client interface for logging into html log
+		err = HtmlLogger().Connect();
+		}
+
+	if ((iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth) && err == KErrNone)
+		{
+		err = XmlLogger().Connect();
+		}
+	
+	//TRAPD(errPIP, PIPSLogger().Connect()) ;
+	TInt errPIP = PIPSLogger().Connect() ; 
+	iPIPSExists = (errPIP == KErrNone)?  true : false ; 
+
+	return err;
+	}
+
+/**
+ * Closes the connection with HTML & XML logger client sessions
+ */
+EXPORT_C void CTestExecuteLogger::Close()
+	{
+
+	if(iLoggerChannel == ESerial || iLoggerChannel == EBoth)
+		{
+		//iSerialWriter->UnlockResources();
+		delete iSerialWriter;
+		iSerialWriter = NULL;
+		}	
+	if (iLoggerOptions == ELogHTMLOnly || iLoggerOptions == ELogBoth)
+		{
+		// defect 116046
+  		THandleInfo info;
+  		HtmlLogger().HandleInfo(&info);
+  		if (0 != info.iNumOpenInThread)
+  			{
+  			HtmlLogger().Close();
+  			}
+  		// END defect 116046
+		}
+	if (iLoggerOptions == ELogXMLOnly || iLoggerOptions == ELogBoth)
+		{
+		XmlLogger().Close();
+		}
+	if(iPIPSExists)
+		{
+		PIPSLogger().Close();
+		}
+	if(iTestReport)
+	    {
+        delete iTestReport;
+        iTestReport = NULL;
+	    }	
+	}
+
+/**
+ * Two phase Construction
+ */
+EXPORT_C CTestExecuteLogger* CTestExecuteLogger::NewL(TLoggerOptions aLogOptions)
+	{
+	CTestExecuteLogger* self = CTestExecuteLogger::NewLC(aLogOptions);
+	CleanupStack::Pop();
+	return self;
+	}
+
+/**
+ * Two phase Construction
+ */
+EXPORT_C CTestExecuteLogger* CTestExecuteLogger::NewLC(TLoggerOptions aLogOptions)
+	{
+	CTestExecuteLogger* self = new(ELeave) CTestExecuteLogger(aLogOptions);
+	CleanupStack::PushL(self);
+	//self->ConstructL(); //if in future the contructor is expected to do anything.
+	return self;
+	}
+
+
+/**
+ * @param aCommandStr - Current script command line, this string started form !PanicString.
+ * @param aScriptLineParamLex - Current script line Lexer. This parameter will be used when exit this function, 
+ *                              so aScriptLineParamLex must moved to the next parameter.
+ * @param aTEFPanicString - The parse result . return the string in after !PanicString= .
+ *                          EX1: !PanicString=STRING            restult is:STRING, return ETrue
+ *                          EX2: !PanicString="STRING"          restult is:STRING, return ETrue
+ *                          EX3: !PanicString="STRING panic"    restult is:STRING panic, return ETrue
+ *                          EX4: !PanicString=STRING panic      restult is:STRING, return EFalse
+ *                          EX5: !PanicString="STRING panic     restult is:STRING panic, return EFalse
+ * @return - parse result of the funtion.
+ *  protected:
+ *  This fuction is being added for DEF120600.
+ */
+TBool CTestExecuteLogger::ParsePaincStringFromScriptCommandLine(const TDesC& aCommandStr,TLex& aScriptLineParamLex,TDes& aTEFPanicString)
+    {
+    TInt err(0);
+    TBool panicStringCompleted(ETrue);// if the string are complexed within "" or just one word, this flag will be ture
+    TRAP(err,aTEFPanicString.Copy(aCommandStr.Mid(KTEFMinPanicStringParamLength))); 
+    if (err)
+        {
+        aTEFPanicString.Copy(KNull);
+        panicStringCompleted = EFalse;
+        }
+    else
+        {
+        if (aTEFPanicString.Left(1) == KTEFOpenQuotes)
+            {
+            panicStringCompleted = EFalse;
+            if (aTEFPanicString.Right(1) != KTEFOpenQuotes)
+                {
+                aTEFPanicString.Copy(aTEFPanicString.Mid(1,aTEFPanicString.Length()-1));
+                while(!aScriptLineParamLex.Eos() && !panicStringCompleted)
+                    {
+                    aScriptLineParamLex.Mark();
+                    TPtrC spaceBegin( aScriptLineParamLex.RemainderFromMark() ); 
+                    TPtrC panicStringExt(aScriptLineParamLex.NextToken());
+                    TInt span = spaceBegin.Find(panicStringExt);
+                    
+                    // append the white space to the end of the expected panic string
+                    if (aTEFPanicString.MaxLength() >= aTEFPanicString.Length() + span )
+                        {
+                        aTEFPanicString.Append(spaceBegin.Left(span).Ptr(),span);// append write spaces to the panic string 
+                        }
+                    else
+                        {
+                        // this string too large
+                        panicStringCompleted = EFalse;
+                        break;
+                        }
+                    if(panicStringExt.Right(1) == KTEFOpenQuotes)
+                        {
+                        aTEFPanicString.Append(panicStringExt.Mid(0, panicStringExt.Length()-1));
+                        panicStringCompleted = ETrue;
+                        }
+                    else
+                        {
+                        aTEFPanicString.Append(panicStringExt);
+                        }
+                    }
+                }
+            else
+                {
+                aTEFPanicString.Copy(aTEFPanicString.Mid(1,aTEFPanicString.Length()-2));
+                panicStringCompleted = ETrue;
+                }
+            }
+        if (aTEFPanicString.Length()>KTEFMaxPanicStringLength)
+            {
+            // warnning panic string too long 
+            LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, KTEFPanicStringTooLong, &KTEFPanicString, &aTEFPanicString  );
+            LogExtra(((TText8*)__FILE__), __LINE__, ESevrWarn, KTEFPanicStringErrorInfo);
+            }
+        }
+    return panicStringCompleted;
+    }
+/**
+ * Initialise Test Report. This report output as STF's test report format.
+ */
+void CTestExecuteLogger::InitialiseTestReportL(const TDesC& aTEFTestReportFileName)
+    {
+    // Test report settings initialization
+    _LIT(KTestReport,"[TestReport]");
+    TFileName reportFileName;
+    reportFileName.Append(aTEFTestReportFileName);
+    reportFileName.Append(KTestReport);
+    iTestReportSettings.iCreateTestReport = ETrue;
+    _LIT( KTestReportPath, "\\logs\\testexecute\\");
+    iTestReportSettings.iPath = KTestReportPath().AllocL();
+    iTestReportSettings.iName = reportFileName.AllocL();
+    iTestReportSettings.iFormat = ETEFTestReportLoggerType_Txt;
+    iTestReportSettings.iOutput = ETEFTestReportOutput_File;
+    iTestReportSettings.iOverwrite = ETrue;
+    iTestReportSettings.iXML = ETrue;
+    // Test report initialization
+    TRAPD(err_testreport, iTestReport = 
+                CTEFTestReport::NewL( iTestReportSettings, CTEFTestReport::ETestReportFull  ));
+        if(err_testreport!=KErrNone)
+            {
+            iTestReport = NULL;
+            __RDEBUG( (_L("Test report creation failed with error: %d, test report not created."),err_testreport) );
+            __RDEBUG( (_L("Check your testreport settings from testframework.ini file (e.g. TestReportFilePath).") ) );
+            WriteFormat(_L("Test report creation failed with error: %d, test report not created."),err_testreport);
+            Write( _L("Check your testreport settings from testframework.ini file (e.g. TestReportFilePath).") );
+            }
+    }
+
+/**
+ * Add case result to test report
+ */
+void CTestExecuteLogger::AddTestReportL(const TDesC& aTestCaseName, 
+                                        TTime aCaseStartTime,  
+                                        TTime aCaseEndTime, 
+                                        TVerdict aResult)
+    {
+    // Add test case retult to test report.
+    
+    // Create test case info.
+    iCaseNumber++;
+    TTEFTestCaseInfo testCaseInfo;
+    testCaseInfo.iCaseNumber = iCaseNumber;
+    testCaseInfo.iTitle.Append(aTestCaseName);
+    testCaseInfo.iTimeout = 0;
+    testCaseInfo.iPriority = TTEFTestCaseInfo::EPriorityNormal;
+        
+    // Create test info
+    _LIT(KTEFTestModuleName, "TEFTestModul");
+    _LIT(KNA, "NA");
+    TTEFTestInfo testInfo;
+    testInfo.iModuleName.Append(KTEFTestModuleName);
+    testInfo.iTestCaseInfo = testCaseInfo;
+    testInfo.iConfig.Append(KNA);
+    
+    // Create full test result.   
+    TTEFFullTestResult fullTestResult;
+    TTEFTestResult testResult;    
+    _LIT(KPass, "Pass");
+    _LIT(KFail, "Fail");
+    _LIT(KInconclusive, "Inconclusive");
+    _LIT(KTestSuiteError, "TestSuiteError");
+    _LIT(KAbort, "Abort");
+    _LIT(KIgnore, "Ignore");
+    _LIT(KSkippedSelectively, "SkippedSelectively");     
+    _LIT(KUnknownResult, "UnknownResult");
+    switch(aResult)
+        {
+        case EPass:
+            {
+            testResult.SetResult(KErrNone, KPass);
+            break;
+            }
+        case EFail:
+            {
+            testResult.SetResult(KErrGeneral, KFail);
+            break;
+            }
+        case EInconclusive:
+            {
+            testResult.SetResult(KErrGeneral, KInconclusive);
+            break;
+            }
+        case ETestSuiteError:
+            {
+            testResult.SetResult(KErrGeneral, KTestSuiteError);
+            break;
+            }
+        case EAbort:
+            {
+            testResult.SetResult(KErrGeneral, KAbort);
+            break;
+            }
+        case EIgnore:
+            {
+            testResult.SetResult(KErrNone, KIgnore);
+            break;
+            }
+        case ESkippedSelectively:
+            {
+            testResult.SetResult(KErrNone, KSkippedSelectively);
+            break;
+            }              
+        default:
+            testResult.SetResult(KErrGeneral, KUnknownResult);
+            break; 
+        }   
+    fullTestResult.iTestResult = testResult;
+    fullTestResult.iStartTime = aCaseStartTime;
+    fullTestResult.iEndTime = aCaseEndTime;
+    fullTestResult.iCaseExecutionResultCode = KErrNone;
+    fullTestResult.iCaseExecutionResultType = TTEFFullTestResult::ECaseExecuted;
+
+    // Create test report.
+    if(iTestReport)
+        {
+        iTestReport->AddTestCaseResultL( testInfo, fullTestResult, KErrNone );
+        iTestReport->UpdateReportSummaryL();
+        }        
+    }
+
+
+//////////////////////////////////////////////////////
+// Methods implementation for CTestExecuteIniData used
+// For parsing the testexecute.ini
+//////////////////////////////////////////////////////
+
+/**
+ * Constructor
+ */
+EXPORT_C CTestExecuteIniData::CTestExecuteIniData() : 
+iHtmlLogPath(KNull),
+iXmlLogPath(KNull),
+iDefaultScriptDirectory(KNull),
+iLogSeverity(RFileFlogger::ESevrAll),
+iLoggerOptions(TLoggerOptions(ELogHTMLOnly)),
+iJustInTime(KTEFZeroValue),
+iRemotePanicDetection(KTEFZeroValue),
+iEnableIniAccessLog(KTEFOneValue),
+iEnableTestsCountLog(KTEFOneValue),
+iEnableSystemStarter(KTEFOneValue),
+iLoggerChannel(TLoggerChannels(EFile)),
+iPortNumber(KTEFZeroValue),
+iDefaultSysDrive(KTEFLegacySysDrive),
+iIniSysDriveName(KTEFIniSysDrive)
+	{
+	iConfigData = NULL;
+	}
+
+/**
+ * Two phase Construction
+ */
+EXPORT_C CTestExecuteIniData* CTestExecuteIniData::NewL()
+	{
+	CTestExecuteIniData* self = CTestExecuteIniData::NewLC();
+	CleanupStack::Pop();
+	return self;
+	}
+
+/**
+ * Two phase Construction
+ */
+EXPORT_C CTestExecuteIniData* CTestExecuteIniData::NewLC()
+	{
+	CTestExecuteIniData* self = new(ELeave) CTestExecuteIniData();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+EXPORT_C CTestExecuteIniData::CTestExecuteIniData(TDriveName& aSysDrive) : 
+iHtmlLogPath(KNull),
+iXmlLogPath(KNull),
+iDefaultScriptDirectory(KNull),
+iLogSeverity(RFileFlogger::ESevrAll),
+iLoggerOptions(TLoggerOptions(ELogHTMLOnly)),
+iJustInTime(KTEFZeroValue),
+iRemotePanicDetection(KTEFZeroValue),
+iEnableIniAccessLog(KTEFOneValue),
+iEnableTestsCountLog(KTEFOneValue),
+iEnableSystemStarter(KTEFOneValue),
+iLoggerChannel(TLoggerChannels(EFile)),
+iPortNumber(KTEFZeroValue),
+iDefaultSysDrive(aSysDrive),
+iIniSysDriveName(KTEFIniSysDrive)
+	{
+	iConfigData = NULL;
+	}
+
+/**
+ * Two phase Construction
+ */
+EXPORT_C CTestExecuteIniData* CTestExecuteIniData::NewL(TDriveName& aSysDrive)
+	{
+	CTestExecuteIniData* self = CTestExecuteIniData::NewLC(aSysDrive);
+	CleanupStack::Pop();
+	return self;
+	}
+
+/**
+ * Two phase Construction
+ */
+EXPORT_C CTestExecuteIniData* CTestExecuteIniData::NewLC(TDriveName& aSysDrive)
+	{
+	CTestExecuteIniData* self = new(ELeave) CTestExecuteIniData(aSysDrive);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+/**
+ * ConstructL
+ */
+EXPORT_C void CTestExecuteIniData::ConstructL()
+	{
+	TBuf<KMaxTestExecuteNameLength> iniDefaultPath(KTEFDefaultPath);
+	iniDefaultPath.Replace(0, 2, iDefaultSysDrive);
+	TRAPD(err,iConfigData = CIniData::NewL(iniDefaultPath, iDefaultSysDrive));
+	if (err != KErrNone)
+		{
+		TRAP(err,iConfigData = CIniData::NewL(KTEFAlternatePath, iDefaultSysDrive));
+		if (err != KErrNone)
+			{
+			User::Leave(err);
+			}
+		}
+	}
+
+/**
+ * Destructor
+ */
+EXPORT_C CTestExecuteIniData::~CTestExecuteIniData()
+	{
+	if (iConfigData != NULL)
+		{
+		delete iConfigData;
+		}
+	}
+
+/**
+ * Extracts the values for all the keys within testexecute.ini
+ * And stores it into member variables for the class
+ */
+EXPORT_C void CTestExecuteIniData::ExtractValuesFromIni()
+	{
+	TBuf<KMaxTestExecuteNameLength> testExecuteLogPath(KTestExecuteLogPath);
+	testExecuteLogPath.Replace(0, 2, iDefaultSysDrive);
+
+	if (!iConfigData->FindVar(KTEFSection, KTEFHtmlKey, iHtmlLogPath))
+		{
+		iHtmlLogPath.Set(testExecuteLogPath);
+		}
+	if (iHtmlLogPath.Compare(KNull) == 0)
+		{
+		iHtmlLogPath.Set(testExecuteLogPath);
+		}
+	if (!iConfigData->FindVar(KTEFSection, KTEFXmlKey, iXmlLogPath))
+		{
+		iXmlLogPath.Set(testExecuteLogPath);
+		}
+	if (iXmlLogPath.Compare(KNull) == 0)
+		{
+		iXmlLogPath.Set(testExecuteLogPath);
+		}
+	if (!iConfigData->FindVar(KTEFSection, KTEFDefaultSysDrive, iIniSysDriveName))
+		{
+		iIniSysDriveName.Set(KTEFIniSysDrive);
+		}
+	TPtrC stringValue;
+	if (iConfigData->FindVar(KTEFSection, KTEFDefaultScriptPath,stringValue))
+		{
+		iDefaultScriptDirectory.Set(stringValue);
+		}
+	TInt intValue = KTEFZeroValue;
+	if (iConfigData->FindVar(KTEFSection, KTEFJustInTimeDebug,intValue))
+		{
+		iJustInTime = intValue;
+		}
+	intValue = KTEFZeroValue;
+	if (iConfigData->FindVar(KTEFSection, KTEFOutputPort,intValue))
+		{
+		iPortNumber = intValue;
+		}	
+	
+	if (!iConfigData->FindVar(KTEFSection, KTEFWaitForLoggingTime, iWaitForLoggingTime))
+		{
+		iWaitForLoggingTime = 5;
+		}
+	
+	if(iConfigData->FindVar(KTEFSection, KTEFLogSeverityKey, stringValue))
+		{
+		_LIT(KBasic,"BASIC");
+		_LIT(KMedium,"MEDIUM");
+		_LIT(KFull,"FULL");
+		if (stringValue.CompareF(KBasic) == 0)
+			iLogSeverity = RFileFlogger::ESevrHigh;
+		else if (stringValue.CompareF(KMedium) == 0)
+			iLogSeverity = RFileFlogger::ESevrMedium;
+		else if (stringValue.CompareF(KFull) == 0)
+			iLogSeverity = RFileFlogger::ESevrTEFUnit;
+		else
+			iLogSeverity = RFileFlogger::ESevrAll;
+		}
+
+	stringValue.Set(KNull);
+	if(iConfigData->FindVar(KTEFSection, KTEFLogMode, stringValue))
+		{
+		_LIT(KLogBoth, "BOTH");
+		_LIT(KLogXml, "XML");
+		if (stringValue.CompareF(KLogBoth) == 0)
+			iLoggerOptions = TLoggerOptions(ELogBoth);
+		else if (stringValue.CompareF(KLogXml) == 0)
+			iLoggerOptions = TLoggerOptions(ELogXMLOnly);
+		else
+			iLoggerOptions = TLoggerOptions(ELogHTMLOnly);
+		}
+
+	stringValue.Set(KNull);
+	if(iConfigData->FindVar(KTEFSection, KTEFLogChannel, stringValue))
+		{
+		_LIT(KLogFile, "File");
+		_LIT(KLogSerial, "Serial");
+		if (stringValue.CompareF(KLogFile) == 0)
+			iLoggerChannel = TLoggerChannels(EFile);
+		else if (stringValue.CompareF(KLogSerial) == 0)
+			iLoggerChannel = TLoggerChannels(ESerial);
+		else
+			iLoggerChannel = TLoggerChannels(EBoth);
+		}
+
+	stringValue.Set(KNull);
+	if (iConfigData->FindVar(KTEFSection, KTEFRemotePanicDetection, stringValue))
+		{
+		_LIT(KPanicDetectionOn,"ON");
+		_LIT(KPanicDetectionOne,"1");
+		if (stringValue.CompareF(KPanicDetectionOn) == 0 || stringValue.CompareF(KPanicDetectionOne) == 0)
+			iRemotePanicDetection = 1;
+		else
+			iRemotePanicDetection = 0;
+		}
+		
+	stringValue.Set(KNull);
+	if (iConfigData->FindVar(KTEFSection, KTEFEnableIniAccessLog, stringValue))
+		{
+		_LIT(KEnableIniAccessLogOff,"OFF");
+		_LIT(KEnableIniAccessLogZero,"0");
+		if (stringValue.CompareF(KEnableIniAccessLogOff) == 0 || stringValue.CompareF(KEnableIniAccessLogZero) == 0)
+			iEnableIniAccessLog = 0;
+		else
+			iEnableIniAccessLog = 1;
+		}
+
+	stringValue.Set(KNull);
+	if (iConfigData->FindVar(KTEFSection, KTEFEnableTestsCountLog, stringValue))
+		{
+		_LIT(KEnableTestsCountLogOff,"OFF");
+		_LIT(KEnableTestsCountLogZero,"0");
+		if (stringValue.CompareF(KEnableTestsCountLogOff) == 0 || stringValue.CompareF(KEnableTestsCountLogZero) == 0)
+			iEnableTestsCountLog = 0;
+		else
+			iEnableTestsCountLog = 1;
+		}
+
+	stringValue.Set(KNull);
+	if (iConfigData->FindVar(KTEFSection, KTEFSystemStarter, stringValue))
+		{
+		_LIT(KEnableSystemStarterOff,"OFF");
+		_LIT(KEnableSystemStarterZero,"0");
+		if (stringValue.CompareF(KEnableSystemStarterOff) == 0 || stringValue.CompareF(KEnableSystemStarterZero) == 0)
+			iEnableSystemStarter = 0;
+		else
+			iEnableSystemStarter = 1;
+		}
+
+	}
+
+/**
+ * @param aKeyName - Reference to string descriptor containing the name of the key within ini
+ * @param aValue - Reference to string descriptor to store the value for the key in return
+ * Copies the value for the key name input to the reference aValue string descriptor passed in
+ */
+EXPORT_C void CTestExecuteIniData::GetKeyValueFromIni(const TDesC& aKeyName, TDes& aValue)
+	{
+	if (aKeyName.Compare(KTEFHtmlKey) == 0)
+		{
+		aValue.Copy(iHtmlLogPath);
+		}
+	else if (aKeyName.Compare(KTEFXmlKey) == 0)
+		{
+		aValue.Copy(iXmlLogPath);
+		}
+	else if (aKeyName.Compare(KTEFDefaultScriptPath) == 0)
+		{
+		aValue.Copy(iDefaultScriptDirectory);
+		}
+	else if (aKeyName.Compare(KTEFDefaultSysDrive) == 0)
+		{
+		aValue.Copy(iIniSysDriveName);
+		}
+	else
+		{
+		aValue.Copy(KNull);
+		}
+	}
+
+/**
+ * @param aKeyName - Reference to string descriptor containing the name of the key within ini
+ * @param aValue - Reference to integer descriptor to store the value for the key in return
+ * Copies the value for the key name input to the reference aValue integer descriptor passed in
+ */
+EXPORT_C void CTestExecuteIniData::GetKeyValueFromIni(const TDesC& aKeyName, TInt& aValue)
+	{
+	if (aKeyName.Compare(KTEFLogSeverityKey) == 0)
+		{
+		aValue = iLogSeverity;
+		}
+	else if (aKeyName.Compare(KTEFLogMode) == 0)
+		{
+		aValue = iLoggerOptions;
+		}
+	else if (aKeyName.Compare(KTEFLogChannel) == 0)
+		{
+		aValue = iLoggerChannel;
+		}
+	else if (aKeyName.Compare(KTEFOutputPort) == 0)
+		{
+		aValue = iPortNumber;
+		}
+	else if (aKeyName.Compare(KTEFJustInTimeDebug) == 0)
+		{
+		aValue = iJustInTime;
+		}
+	else if (aKeyName.Compare(KTEFRemotePanicDetection) == 0)
+		{
+		aValue = iRemotePanicDetection;
+		}
+	else if (aKeyName.Compare(KTEFEnableIniAccessLog) == 0)
+		{
+		aValue = iEnableIniAccessLog;
+		}
+	else if (aKeyName.Compare(KTEFEnableTestsCountLog) == 0)
+		{
+		aValue = iEnableTestsCountLog;
+		}
+	else if (aKeyName.Compare(KTEFSystemStarter) == 0)
+		{
+		aValue = iEnableSystemStarter;
+		}
+	else if (aKeyName.CompareF(KTEFWaitForLoggingTime) == 0)
+		{
+		aValue = iWaitForLoggingTime;
+		}
+	else
+		{
+		aValue = KTEFZeroValue;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testserver2.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2005-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:  
+* @file
+* This contains CTestServer2
+*
+*/
+
+
+
+/**
+ @prototype
+ @test
+*/
+
+//	User Includes
+#include "testserver2.h"
+
+TUint32 CTestServer2::Hash(const TDataDictionaryName& aName)
+	{
+	return DefaultHash::Des16(aName);
+	}
+
+TBool CTestServer2::Identity(const TDataDictionaryName& aName1, const TDataDictionaryName& aName2)
+	{
+	return aName1.Compare(aName2)==0;
+	}
+
+EXPORT_C CTestServer2::CTestServer2()
+/*
+ * Constructor
+ */
+:	CTestServer()
+,	iStore(Hash, Identity)
+,	iActiveScheduler(NULL)
+	{
+	}
+
+EXPORT_C CTestServer2::~CTestServer2()
+/*
+ * Destructor
+ */
+	{
+	TDataIter	iter(iStore);
+	iter.Reset();
+	for ( const TDataElement* data=iter.NextValue(); data!=NULL; data=iter.NextValue() )
+		{
+		data->iCleanupOperation(data->iAny);
+		}
+	iStore.Close();
+
+	if( iActiveScheduler )
+		{
+		delete iActiveScheduler;
+		iActiveScheduler=NULL;
+		}
+	}
+
+EXPORT_C void CTestServer2::ConstructL()
+/*
+ * Second phase of construction
+ */
+	{
+	RProcess	handle = RProcess();
+	TParsePtrC	serverName(handle.FileName());
+	CTestServer::ConstructL(serverName.Name());
+	}
+
+// MTEFCallback::MSharedData implementation
+EXPORT_C void CTestServer2::CreateActiveSchedulerL()
+	{
+	if( iActiveScheduler==NULL )
+		{
+		iActiveScheduler=new (ELeave) CActiveScheduler();
+		CActiveScheduler::Install(iActiveScheduler);
+		}
+	}
+
+// MTEFCallback::MSharedData implementation
+EXPORT_C void CTestServer2::DeleteActiveSchedulerL()
+	{
+	if( iActiveScheduler )
+		{
+		delete iActiveScheduler;
+		iActiveScheduler=NULL;
+		}
+	}
+
+// MTEFCallback::MSharedData implementation
+EXPORT_C TAny* CTestServer2::GetObjectAndOwnL(const TDesC& aName)
+	{
+	TDataElement*	element=iStore.Find(aName);
+	TAny*			ret=NULL;
+
+	if ( element != NULL )
+		{
+		ret=element->iAny;
+		iStore.Remove(aName);
+		}
+	else
+		{
+		User::Leave(KErrNotFound);
+		}
+
+	return ret;
+	}
+
+// MTEFCallback::MSharedData implementation
+EXPORT_C void CTestServer2::PutAndDisownL(const TDesC& aName, TAny* aAny, TCleanupOperation aCleanupOperation)
+	{
+	TDataElement*	element=iStore.Find(aName);
+	//	Ensure name does not already exist
+	if ( element!=NULL )
+		{
+		User::Leave(KErrAlreadyExists);
+		}
+
+	TDataIter	iter(iStore);
+	iter.Reset();
+	for ( const TDataElement* data=iter.NextValue(); data!=NULL; data=iter.NextValue() )
+		{
+		if ( aAny == data->iAny )
+			{
+			User::Leave(KErrAlreadyExists);
+			}
+		}
+
+	TDataElement	newElement={aAny, aCleanupOperation};
+	iStore.InsertL(aName, newElement);
+	}
+
+
+// CTestServer implementation
+EXPORT_C CTestStep* CTestServer2::CreateTestStep(const TDesC& /*aStepName*/)
+	{
+	CTestStep* step = NULL;
+	return step;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/testserverbase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1482 @@
+/*
+* Copyright (c) 2005-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:  
+* Implementation of the following classes
+* CTestServer
+* n x  CTestSession Maps to RTestServ session)
+* n x  CStepControl or CPersistentStepControl (Maps to RTestSession)
+* CTestStep (1 to 1 mapping with parent)
+* CTestServer
+* Derives CServer
+* Test servers derive from this and implement the CreateTestStep() pure virtual
+* CTestSession
+* Derives CSharableSession
+* Implements the ServiceL() pure virtual and creates CStepControl object(s)
+* when a test step is opened.
+* Implements the MSessionNotify interface for callbacks from CStepControl when
+* a test step completes.
+* CStepControl
+* Derives CActive
+* Runs a test step instance in its own thread and heap
+* CTestStep
+* Derives CBase
+* Test Servers derive test steps from this
+*
+*/
+
+
+
+/**
+ @file TestClient.cpp
+*/
+
+#include "testexecuteserverbase.h"
+#include "testserver2.h"
+#include "testexecuteserverutils.h"
+#include "testexecuteclient.h"
+#include <e32math.h>
+#include <test/wrapperutilsplugin.h>
+#include <test/tefutils.h>
+
+const TUint KDefaultHeapSize = 0x100000;
+
+//> @internalComponent
+// see the impletation below.
+void SytemWideErrToTefErr(TInt &aErr);
+/**
+ * Constructor
+ */
+EXPORT_C CTestServer::CTestServer() : CServer2(EPriorityStandard)
+,	iSeed(0)
+,	iSessionCount(0)
+	{
+	// Random seed for unique thread id's
+	iSeed = (TInt)this;
+	// Default is not to allow Server Logging
+	iLoggerStarted = EFalse;
+	}
+
+/**
+ * Destructor
+ */
+EXPORT_C CTestServer::~CTestServer()
+	{
+	if (iLoggerStarted)
+		{
+		// Shut down the Servers' logger instance.
+		Logger().Close();
+		}
+	}
+
+/**
+ * @param aName - Reference to the Server name
+ * StartL + initiate server logging
+ * Servers can StartL themselves or call this to gain server logging.
+ */
+EXPORT_C void CTestServer::ConstructL(const TDesC& aName)
+	 {
+	 StartL(aName);
+	 StartLoggerL();
+	 iServerName = aName;
+	 }
+
+/**
+ * Will extract the script logfile name from the temporary file 'LogFileName.txt'
+ * (assuming no ScheduleTest compatible logging) and then opens a logging session
+ * to that file. If ScheduleTest logging is in effect then we will open ScriptEngine.htm
+ * instead as the file to log to.
+ */	 
+void CTestServer::StartLoggerL()
+	{
+	TDriveName defaultSysDrive(KTEFLegacySysDrive);
+	RFs fileServer;
+	TVersionName version(fileServer.Version().Name());
+	
+	RLibrary pluginLibrary;
+	CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary);
+	
+	if (plugin!=NULL)
+		{
+		TDriveUnit driveUnit(plugin->GetSystemDrive());
+		defaultSysDrive.Copy(driveUnit.Name());
+		delete plugin;
+		pluginLibrary.Close();
+		}
+
+	CTestExecuteIniData* parseTestExecuteIni = NULL;
+	TBuf<KMaxTestExecuteNameLength> resultFilePath;
+	TBuf<KMaxTestExecuteNameLength> xmlFilePath;
+	TInt logMode;
+	TInt logLevel;
+
+	TRAPD(err,parseTestExecuteIni = CTestExecuteIniData::NewL(defaultSysDrive));
+	if (err == KErrNone)
+		{
+		CleanupStack::PushL(parseTestExecuteIni);
+		parseTestExecuteIni->ExtractValuesFromIni();
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFHtmlKey, resultFilePath);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFXmlKey, xmlFilePath);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFLogMode, logMode);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFLogSeverityKey, logLevel);
+		}
+	else
+		{
+		TBuf<KMaxTestExecuteNameLength> testExecuteLogPath(KTestExecuteLogPath);
+		testExecuteLogPath.Replace(0, 2, defaultSysDrive);
+		resultFilePath.Copy(testExecuteLogPath);
+		xmlFilePath.Copy(testExecuteLogPath);
+		logMode = TLoggerOptions(ELogHTMLOnly);
+		logLevel = RFileFlogger::TLogSeverity(ESevrAll);
+		}
+	Logger().SetLoggerOptions(logMode);
+
+	// Initialise a handle to the file logger
+	User::LeaveIfError(Logger().Connect());
+	RFs fS;
+	User::LeaveIfError(fS.Connect());
+	CleanupClosePushL(fS);
+	RFile file;
+	TBuf<KMaxTestExecuteNameLength> xmlLogFile(xmlFilePath);
+	TBuf<KMaxTestExecuteNameLength> logFile;
+	TBuf<KMaxTestExecuteNameLength> logFileNameFile(resultFilePath);
+	logFileNameFile.Append(KTestExecuteScheduleTestLogCompatibilityNameFile);
+	if(file.Open(fS,logFileNameFile,EFileRead | EFileShareAny) != KErrNone)
+		{
+		// If LogFileName.txt is not present then we are using ScheduleTest
+		// compliant logging, any logging issued by the server will therefore
+		// go to ScriptEngine.htm
+		_LIT(KScriptEngine,"ScriptEngine");
+		logFile.Copy(KScriptEngine);
+		}
+	else
+		{
+		CleanupClosePushL(file);
+		TBuf8<KMaxTestExecuteNameLength> logFile8;
+		TInt fileSize;
+		User::LeaveIfError(file.Size(fileSize));
+		User::LeaveIfError(file.Read(logFile8,fileSize));
+		logFile.Copy(logFile8);
+		CleanupStack::Pop(&file);
+		file.Close();
+		}
+	
+	xmlLogFile.Append(logFile);
+	_LIT(KXmlExtension,".xml");
+	xmlLogFile.Append(KXmlExtension);
+	_LIT(KHtmExtension,".htm");
+	logFile.Append(KHtmExtension);
+	TBuf<KMaxTestExecuteLogFilePath> logFilePath(resultFilePath);
+	logFilePath.Append(logFile);
+	CleanupStack::Pop(&fS);
+	fS.Close();
+	
+	if (logMode == 0 || logMode == 2)
+		{
+		User::LeaveIfError(Logger().HtmlLogger().CreateLog(logFilePath,RTestExecuteLogServ::ELogModeAppend));
+		Logger().HtmlLogger().SetLogLevel(TLogSeverity(logLevel));
+		}
+		
+	if (logMode == 1 || logMode == 2)
+		{
+		User::LeaveIfError(Logger().XmlLogger().CreateLog(xmlLogFile,RFileFlogger::ELogModeAppend));
+		Logger().XmlLogger().SetLogLevel(RFileFlogger::TLogSeverity(logLevel));
+		}
+	
+	User::LeaveIfError( Logger().ShareAuto() );
+	iLoggerStarted = ETrue;
+	if (parseTestExecuteIni != NULL)
+		{
+		CleanupStack::PopAndDestroy(parseTestExecuteIni);
+		}
+	}
+	
+/**
+ * Last one out switch off the lights
+ * Stop the active sheduler and hence the server, if this is the last session
+ */	 
+void CTestServer::SessionClosed()
+	{
+	iSessionCount--;
+	if (iSessionCount == 0)
+		CActiveScheduler::Stop();
+	}
+
+/**
+ * @param RMessage - RMessage for the session open
+ * Secure version
+ */
+EXPORT_C CSession2* CTestServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
+	{
+	CTestSession* session = new (ELeave) CTestSession();
+	CONST_CAST(CTestServer*,this)->iSessionCount++;
+	return session;
+	}
+
+/**
+ * Constructor
+ */
+EXPORT_C CTestSession::CTestSession()
+:	iPersistentStepControl(NULL)
+,	iPersistentBlockControl(NULL)
+,	iBlockArray(NULL)
+	{
+	}
+
+/**
+ * Destructor
+ */
+EXPORT_C CTestSession::~CTestSession()
+	{
+	if( iBlockArray )
+		{
+		delete iBlockArray;
+		iBlockArray = NULL;
+		}	
+	
+	CTestServer* p=(CTestServer*) Server();
+	
+	//delete the persistent step
+	if(iPersistentStepControl)
+		delete iPersistentStepControl;
+	//delete the persistent block
+	if(iPersistentBlockControl)
+		delete iPersistentBlockControl;
+	// Shuts Down the server if this is the last open session
+	p->SessionClosed();
+	}
+
+/**
+ * @param aMessage - Function and data for the session
+ * Session was created by pure virtual CTestServer::NewSessionL()
+ * Message Functions defined in TestExecuteClient.h
+ * 
+ * EOpenTestStep - Creates a new subsession
+ * ERunTestStep - Executes the test step asynchronously
+ * EAbortTestStep - Kill()'s the executing test step
+ * ECloseTestStep - Free's the resource
+ *
+ * Secure and non-secure variants
+ * There are two modes of operation:
+ * Test step is opened with the shared data boolean set to FALSE:
+ *		Create a new CStepControl instance and hence a new thread in its own heap
+ *		Consecutive or Concurrent operation
+ * Test step is opened with the shared data boolean set to TRUE:
+ *		Create a CPersistentStepControl and keep reusing it, and its thread
+ *		Consecutive operation only
+ */
+EXPORT_C void CTestSession::ServiceL(const RMessage2& aMessage)
+	{
+	switch(aMessage.Function())
+		{
+		case EOpenTestStep :
+			{
+			// Open the test step
+			// Buffer size policed on the client side
+			TBuf<KMaxTestStepNameLength> stepName;
+			// Read the step name from the descriptor
+			TBool sharedData;
+			aMessage.ReadL(0,stepName);
+			// Find out what mode we're working in
+			sharedData = aMessage.Int1();
+			// Both types derive from base class and implement pure virtuals
+			CControlBase* stepControl = NULL;
+			if(sharedData)
+				{
+				// Shared data mode
+				// Create the instance if it doesn't exist
+				if(!iPersistentStepControl)
+					iPersistentStepControl = new (ELeave)CPersistentStepControl(*(CTestServer*)Server());
+				stepControl = iPersistentStepControl;
+				iPersistentStepControl->StepName() = stepName;
+				}
+			else
+				{
+				// Default operation. Create a new instance
+				stepControl = new (ELeave)CStepControl(*(CTestServer*)Server(),stepName);
+				}
+			// We pass back the address of the CStepControl class which is passed to
+			// us in all calls on the subsession in Message 3
+			TPtrC8 stepRef(REINTERPRET_CAST(TUint8*,&stepControl),sizeof(TInt));
+			aMessage.Write(3,stepRef);
+			aMessage.Complete(KErrNone);
+			}
+			break;
+		case EOpenTestBlock :
+			{
+			// Open the test block
+			// Buffer size policed on the client side
+			TBuf<KMaxTestExecuteNameLength> stepName;
+
+			// Find out what mode we're working in
+			TBool sharedData = aMessage.Int1();
+			// Both types derive from base class and implement pure virtuals
+			CBlockControlBase* blockControl = NULL;
+			if(sharedData)
+				{
+				// Shared data mode
+				// Create the instance if it doesn't exist
+				if(!iPersistentBlockControl)
+					iPersistentBlockControl = new (ELeave)CPersistentBlockControl(*(CTestServer*)Server());
+				blockControl = iPersistentBlockControl;
+				}
+			else
+				{
+				// Default operation. Create a new instance
+				blockControl = new (ELeave)CBlockControl(*(CTestServer*)Server());
+				}
+			// We pass back the address of the CStepControl class which is passed to
+			// us in all calls on the subsession in Message 3
+			TPtrC8 blockRef(REINTERPRET_CAST(TUint8*,&blockControl),sizeof(TInt));
+			aMessage.Write(3,blockRef);
+			aMessage.Complete(KErrNone);
+			}
+			break;
+		case ERunTestStep :
+			{
+			// Execute the test step
+			// Buffer size policed on client side
+			// Message 0 contains the test step arguments
+			// Message 1 contains a descriptor for the panic string, if the test step panics
+			TBuf<KMaxTestExecuteCommandLength> stepArgs;
+			aMessage.ReadL(0,stepArgs);
+						
+			// Get the address of our CStepControl object
+			CStepControlBase* stepControl = REINTERPRET_CAST(CStepControlBase*,aMessage.Int3());
+			// Kick off the test step
+			// Message completed when the test step completes
+			// StartL() is mode dependent pure virtual
+			TRAPD(err,stepControl->StartL(aMessage, stepArgs));
+			if(err)
+				// Complete now if we can't start the test step
+				// Client has possibly called run before waiting for last completion
+				aMessage.Complete(err);
+			}
+			break;
+		case ERunTestBlock :
+			{
+			// Execute the test step
+			// Buffer size policed on client side
+			// Message 0 contains the test step arguments
+			// Message 1 contains a descriptor for the panic string, if the test step panics
+			TBuf<KMaxTestExecuteCommandLength> blockArgs;
+			aMessage.ReadL(0,blockArgs);
+						
+			// Get the test block of commands
+			HBufC8*	itemArray = HBufC8::NewLC( aMessage.GetDesMaxLengthL(2) );
+			TPtr8	itemArrayPtr( itemArray->Des() );
+			aMessage.ReadL( 2, itemArrayPtr );
+
+			// Get the address of our CStepControl object
+			CBlockControlBase* blockControl = REINTERPRET_CAST(CBlockControlBase*,aMessage.Int3());
+			// Kick off the test step
+			// Message completed when the test step completes
+			// StartL() is mode dependent pure virtual
+			TRAPD(err,blockControl->StartL(aMessage, blockArgs, itemArrayPtr ));
+			if(err)
+				// Complete now if we can't start the test step
+				// Client has possibly called run before waiting for last completion
+				aMessage.Complete(err);
+			
+			CleanupStack::PopAndDestroy( itemArray );
+			}
+			break;
+		case EAbortTestStep :
+			{
+			CControlBase* control = REINTERPRET_CAST(CControlBase*,aMessage.Int3());
+			// Stop is mode dependent pure virtual
+			control->Stop();
+			// Complete synchronously
+			aMessage.Complete(KErrNone);
+			break;
+			}
+		case ECloseTestStep :
+			{
+			CControlBase* control = REINTERPRET_CAST(CControlBase*,aMessage.Int3());
+			// Only delete if we are in non-shared data mode
+			if(	control != iPersistentStepControl &&
+				control != iPersistentBlockControl )
+				{
+				delete control;
+				}
+			aMessage.Complete(KErrNone);
+			}
+			break;
+		default:
+			break;
+		}
+	}
+
+/**
+ * @param aServer - Reference to the CTestServer base class
+ * @param aStepName - The test step name
+ * The Non-Shared data step control implementation
+ */
+CStepControl::CStepControl(CTestServer& aServer, const TDesC& aStepName) :
+	CStepControlBase(aServer)
+	{
+	StepName() = aStepName;
+	}
+
+/**
+ * Thread completion
+ */
+void CStepControl::RunL()
+	{
+	// Error value if set in the test step will be saved in the Message()
+	if (Error() != KNull)
+		{
+		TBuf<KMaxTestExecuteNameLength> errorParam(KErrorEquals);
+		errorParam.Append(Error());
+		Message().Write(1,errorParam);
+		}
+
+	// If the thread panicked, pick up the panic string and return it to the client
+	// Overwrites the error value previously saved in Message()
+	if(WorkerThread().ExitType() == EExitPanic)
+		{
+		TBuf<KMaxTestExecuteNameLength> panicParam(KPanicEquals);
+		panicParam.Append(WorkerThread().ExitCategory());
+		Message().Write(1,panicParam);
+		}
+
+
+	
+	if (WorkerThread().ExitType() == EExitPanic)
+		{
+		TInt err = WorkerThread().ExitReason();
+		SytemWideErrToTefErr(err);
+		Message().Complete(err);
+		}
+	else
+		{
+		if (iStatus.Int() == KErrAbort && TimedOut())
+			{
+			if (Server().LoggerStarted())
+				{
+				Server().ERR_PRINTF1(_L("TEST IS ABOUT TO ABORT DUE TO TEF TIMEOUT"));				
+				}
+			}
+		// iStatus.Int() is the same as the thread ExitReason
+		Message().Complete(iStatus.Int());
+		}
+	
+	// Close thread handle
+	WorkerThread().Close();
+	}
+
+/**
+ * Destructor
+ */
+CStepControl::~CStepControl()
+	{
+	}
+
+/**
+ * Step Execution module which is wrapped within UHEAP macros to trap memory leaks during execution
+ * @param aStepControl - Is a generic type of class T passed as template parameter. Either CStepControl/CWorkerControl
+ * for normal execution mode and persistant thread mode for concurrent execution of steps respectively
+ * @param aStep - Object derived from CTestStep class for execution of test steps both in normal mode and persistent mode
+ */
+template<class T>
+void ThreadStepExecutionL(T* aStepControl, CTestStep* aStep)
+	{
+	TInt loop = 0;
+	TBool simulateOOM = EFalse; //ShouldRunOOMTest();
+
+	FOREVER
+		{
+		TInt errRun = KErrNone;
+
+		// Call the CTestStep virtuals 
+		aStep->doTestStepPreambleL();
+			
+		// count cells so we can know how many we leaked
+		TInt cellsStart = User::CountAllocCells();
+		
+		if (simulateOOM)
+			{
+			__UHEAP_MARK;
+	
+			// set allocator to fail on the loop'th alloc
+			aStep->SetHeapFailNext(loop);
+			}
+		
+		aStepControl->TimedOut() = ETrue;
+		TRAP(errRun, aStep->doTestStepL());
+		if (errRun != KErrNone && !simulateOOM)
+			{
+			if (errRun == KErrAbort)
+				{
+				aStepControl->TimedOut() = EFalse;
+				}
+			aStep->doTestStepPostambleL();
+			User::Leave(errRun);
+			}
+			
+		TBool finishedCorrectly = EFalse;
+		// cancel the alloc failures
+		if (simulateOOM)
+			{
+			if ((errRun == KErrNone) && (loop >= 1))
+				{
+				// claims to have finished correctly, and we're not failing every alloc
+				finishedCorrectly = aStep->CheckForHeapFailNext();
+				}
+			aStep->ResetHeapFailNext();
+			}
+		
+		aStep->doTestStepPostambleL();
+		
+		TInt cellsEnd = User::CountAllocCells();
+			
+		if (cellsStart < cellsEnd && simulateOOM)
+			{
+			// leaked.
+			TInt leakedCells = cellsEnd - cellsStart;
+			if (aStepControl->Server().LoggerStarted())
+				{
+				aStepControl->Server().ERR_PRINTF3(_L("On loop number %d we leaked %d cells. About to cause panic."),loop,leakedCells);				
+				}
+			aStep->SetTestStepResult(EFail);
+			}
+			
+		if (simulateOOM)
+			{
+			// panic on leak (alloc nnnnnnnn)
+			__UHEAP_MARKEND;
+			}
+	
+		// check to see if we finished all OOM testing successfully
+		if ((errRun == KErrNone) && (simulateOOM) && (finishedCorrectly))
+			{
+			// test completed successfully, or the User::Leave(KErrNoMemory) was trapped by something else. 
+			// Need a cunning solution here. Hmm. Testing to see if the next alloc call fails won't work:
+			//    eg, if a test has 3 allocs, heap currently set to fail every 2nd, this would be number 4,
+			//    and if 2 was masked then we would think we are done.
+			//
+			// Fix PDEF115450, remove the line 			aStep->SetTestStepResult(EPass); and modify the information
+			// to "Out of memory test completed after %d iterations."
+			if (aStepControl->Server().LoggerStarted())
+				{
+				aStepControl->Server().INFO_PRINTF2(_L("Out of memory test completed after %d iterations."),loop);
+				}
+			break;
+			}
+
+		// check to see if we should run OOM testing.
+		if (++loop == 1)
+			{
+			// first go.
+			if (!aStep->ShouldRunOOMTest())
+				break;
+			else
+				{
+				if (aStepControl->Server().LoggerStarted())
+					{
+					aStepControl->Server().INFO_PRINTF1(_L("Test passed. About to run Out of Memory testing."));					
+					}
+				simulateOOM = ETrue;
+				aStep->IniAccessLog() = EFalse;
+				}
+			}
+		}
+	}
+
+/**
+ * @param aStepControl - Pointer to the step control object which kicked us off
+ * The thread code. Just drops through with no reuse.
+ */
+void ThreadFuncL(CStepControl* aStepControl)
+	{
+	// Call the server pure virtual to get a step instance
+	CTestStep* step = CONST_CAST(CTestServer&,aStepControl->Server()).CreateTestStep(aStepControl->StepName());
+	if(!step)
+		User::Leave(KErrNotFound);
+	CleanupStack::PushL(step);
+	// Set up the step base class members
+	TBool sharedData = EFalse;
+	step->InitialiseL(aStepControl->Args(), aStepControl->Server().Name(), sharedData);
+
+	ThreadStepExecutionL(aStepControl, step);
+
+	// Return Error value set in test step to log result for comparison
+	if (step->TestStepError() != 0)
+		aStepControl->Error().Num(step->TestStepError());
+	// EPass is 0
+	// All the rest should be TRAP'd
+	if(step->TestStepResult())
+		User::Leave(step->TestStepResult());
+	CleanupStack::PopAndDestroy(step);
+ 	}
+
+/**
+ * @param aParam - Pointer to a CStepControl object
+ * The thread entry method
+ */
+TInt ThreadFunc(TAny* aParam)
+	{
+	// Create the thread's cleanup stack
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(!cleanup)
+		return KErrNoMemory;
+	// Trap it and return the error code to the OS
+	TRAPD(err, ThreadFuncL(REINTERPRET_CAST(CStepControl*,aParam)));
+	SytemWideErrToTefErr(err);
+	delete cleanup;
+	cleanup = NULL;
+	return err;
+	}
+
+/**
+ * @param aMessage - Keep a reference for async completion
+ * @param aStepArgs - The RUN_TEST_STEP arguments
+ * Secure and non-secure variants
+ * Kick off the test step in its own thread
+ * Pure virtual implementation
+ */
+void CStepControl::StartL(const RMessage2& aMessage, const TDesC& aStepArgs)
+	{
+	if(IsActive())
+		User::Leave(KErrInUse);
+	Message() = aMessage;
+	Args().Copy(aStepArgs);
+	TBuf<8> heapSizeBuf(KNull);
+	TUint heapSize(0);
+	aMessage.ReadL(1,heapSizeBuf);
+	aMessage.Write(1,KNull);
+	TLex heapSizeLex;
+	
+	if (heapSizeBuf.Length() >=3)
+		{
+		if ( heapSizeBuf.Mid(0,2).CompareF(_L("0x")) == 0 )
+			{
+			heapSizeLex.Assign(heapSizeBuf.Mid(2));
+			}
+		else
+			{
+			heapSizeLex.Assign(heapSizeBuf);
+			}
+		heapSizeLex.Val(heapSize,EHex);
+		}
+		
+	TBuf<50> threadName;
+	// Unique thread name guaranteed if we use the this pointer plus a random number
+	// whose seed was initialised to the address of the CTestServer object
+	_LIT(KWorker,"Worker%d %d");
+	threadName.Format(KWorker,(TInt)this,Math::Rand(CONST_CAST(CTestServer&,Server()).RandSeed()));
+	// Create with own heap so system cleans up if we kill it
+	const TUint KMaxHeapSize = 0x100000;
+	const TUint KMinSize = KMinHeapSize;
+	if (heapSize < KMinSize)
+		heapSize = KMaxHeapSize;			///< Allow a 1Mb max heap
+
+	User::LeaveIfError(WorkerThread().Create(threadName, ThreadFunc, KDefaultStackSize + 0x1000,KMinHeapSize, heapSize,this, EOwnerProcess));
+	// Prime ready for completion
+	SetActive();
+	// Use the appropriate variant call to get the thread exit
+	WorkerThread().Logon(iStatus);
+	WorkerThread().Resume();
+	}
+
+/**
+ * Kill the thread if it's still running
+ * The async completion will be picked up as normal with a KErrAbort status
+ * Pure virtual implementation
+ */
+void CStepControl::Stop()
+	{
+	if(IsActive())
+		WorkerThread().Kill(KErrAbort);
+	}
+
+/**
+ * @param aStepControl - Pointer to the step control object.
+ * The test step thread.
+ * We reuse this thread so the test steps can store persistent data in the
+ * CTestServer derived class
+ * The thread synchronises with its creator via the CWorkerControl class
+ * Implementation of the shared data mode control object
+ */
+void PersistentThreadFuncL(CWorkerControl* aControl)
+	{
+	// Thread entry is sync'd with a semaphore
+	// Caller will Wait on this
+	// Also set our main sync treq to pending.
+	// It's completed to let us go in and execute the test step code.
+	aControl->WorkerStatus() = KRequestPending;
+	aControl->Semaphore().Signal();
+	// Go into the main test step execution loop
+	for(;;)
+		{
+		User::WaitForRequest(aControl->WorkerStatus());
+		// Check
+		if(aControl->WorkerStatus().Int() == KErrAbort)
+			User::Leave(KErrAbort);
+		CTestStep* step = CONST_CAST(CTestServer&,aControl->Server()).CreateTestStep(aControl->StepName());
+		if(!step)
+			User::Leave(KErrNotFound);
+		CleanupStack::PushL(step);
+		// Set up the step base class members
+		TBool sharedData = ETrue;
+		step->InitialiseL(aControl->Args(), aControl->Server().Name(), sharedData);
+
+		ThreadStepExecutionL(aControl, step);
+
+		// Pick up the final result
+		// Set it in the controlling class
+		aControl->Result() = step->TestStepResult();
+		TBuf<KMaxTestExecuteNameLength> lError;
+		if (step->TestStepError() != 0)
+			{
+			lError.Num(step->TestStepError());
+			if (lError != KNull)
+				{
+				lError.Insert(0,KErrorEquals);
+				aControl->PersistentError().Copy(lError);
+				}
+			}
+		CleanupStack::PopAndDestroy(step);
+		// Set our status for the wait at the top of the loop
+		aControl->WorkerStatus() = KRequestPending;
+		// Signal the status that our creator will be waiting on
+		// Creator's thread handle in the control class
+		TRequestStatus* status = &aControl->Status();
+		aControl->ControllerThread().RequestComplete(status,KErrNone);
+		}
+ 	}
+
+/**
+ * @param aParam - Pointer to a CTestStep control object
+ * The thread entry method
+ */
+TInt PersistentThreadFunc(TAny* aParam)
+	{
+	// Create the thread's cleanup stack
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	
+	if(!cleanup)
+		return KErrNoMemory;
+	// Trap it and return the error code to the OS
+	//defect 116046
+	CWorkerControl* workControl = REINTERPRET_CAST(CWorkerControl*,aParam);
+	workControl->SetCleanupPtr(cleanup);
+	TRAPD(err, PersistentThreadFuncL(workControl));
+	//END defect 116046
+	SytemWideErrToTefErr(err);
+	delete cleanup;
+	cleanup = NULL;
+	return err;
+	}
+
+/**
+ * @param aServer - Reference to the CTestServer derived class
+ * Constructor
+ */
+CPersistentStepControl::CPersistentStepControl(CTestServer& aServer) :
+	CStepControlBase(aServer),
+	iInitialised(EFalse)
+	{ 
+	}
+
+/**
+ * @param aMessage - Client's message for completion
+ * @param aStepArgs - Arguments to the RUN_xxx_STEP_COMMAND's
+ * Implementation of base class pure virtual.
+ * Necessarily complex because of thread reuse. Instantiates 2 classes:
+ * WorkerMonitor class and WorkerControl class
+ * WorkerMonitor picks up thread exit and WorkerControl picks up test step
+ * return value.
+ */
+void CPersistentStepControl::StartL(const RMessage2& aMessage,const TDesC& aStepArgs)
+	{
+	if(IsActive())
+		User::Leave(KErrInUse);
+	Message() = aMessage;
+	Args().Copy(aStepArgs);
+	// Check to see if we're reusing the worker thread and classes
+	if(!iInitialised)
+		{
+		// Need to construct the monitor and controller classes
+		// They are both constructed with a reference to our iStatus
+		// Either of them can complete us. We check their Active flags in our RunL()
+		iWorkerControl = new (ELeave) CWorkerControl(Server(),iStatus);		
+		// The worker thread needs our thread handle to RequestComplete us
+		User::LeaveIfError(iWorkerControl->ControllerThread().Duplicate(RThread()));
+		// Worker thread entry is sync'd with a semaphore.
+		User::LeaveIfError(iWorkerControl->Semaphore().CreateLocal(0));
+		TBuf<50> threadName;
+		// Unique thread name guaranteed if we use the this pointer plus a random number
+		// whose seed was initialised to the address of the CTestServer object
+		// Create in our heap.
+		_LIT(KWorker,"Worker%d %d");
+		threadName.Format(KWorker,(TInt)this,Math::Rand(CONST_CAST(CTestServer&,Server()).RandSeed()));
+		User::LeaveIfError(WorkerThread().Create(threadName,PersistentThreadFunc, KDefaultStackSize + 0x1000,NULL,iWorkerControl, EOwnerProcess));
+		iWorkerMonitor = new (ELeave) CWorkerMonitor(iStatus);
+		}
+	// Worker thread needs the step arguments and the step name
+	iWorkerControl->Args().Set(Args());
+	iWorkerControl->StepName().Set(StepName());
+	// Set this object ready for completion by either the monitor or controller objects
+	Prime();
+	// Set the child monitor and control objects ready for completion
+	iWorkerMonitor->SetActive();
+	iWorkerControl->Prime();
+	// Use the monitor object to pick up thread exit
+	// This should only happen for panic, leave and abort following the Stop() call
+	WorkerThread().Rendezvous(iWorkerMonitor->Status());
+	if(!iInitialised)
+		{
+		// Start the thread and sync up via the semaphore
+		WorkerThread().Resume();
+		iWorkerControl->Semaphore().Wait();
+		iWorkerControl->Semaphore().Close();
+		iInitialised = ETrue;
+		}
+	// Worker thread will be at the top of its loop waiting to execute
+	// the test step virtuals.
+	// Issue the request then it will drop through
+	TRequestStatus* status = &iWorkerControl->WorkerStatus();
+	WorkerThread().RequestComplete(status,KErrNone);
+	}
+
+/**
+ * Destructor
+ */
+CPersistentStepControl::~CPersistentStepControl()
+	{
+	// Only need to clean up in the initialised state
+	if(!iInitialised)
+		return;
+
+	// Check both objects
+	// Neither of them should be active, but just in case
+	if(iWorkerMonitor->IsActive())
+		{
+		// Cancelling means we don't get stray events
+		WorkerThread().RendezvousCancel(iWorkerMonitor->Status());
+		// Need to cancel the objeect itself
+		iWorkerMonitor->Cancel();
+		}
+	if(iWorkerControl->IsActive())
+		{
+		// Complete the request then cancel
+		TRequestStatus* status = &iWorkerControl->Status();
+		User::RequestComplete(status,KErrNone);
+		iWorkerControl->Cancel();
+		}
+
+	// The worker thread will currently be blocked on its TRequestStatus at the top
+	// of its loop.
+	// Signal the status with KErrAbort and the thread will check this value and leave.
+	// If we Kill the thread then the cleanup stack for the thread is orphaned.
+	// PersistentThreadFuncL() TRAP's the leave.
+	// We logon and catch the thread exit.
+	TRequestStatus status = KRequestPending;
+	WorkerThread().Rendezvous(status);
+	TRequestStatus* workerStatus = &iWorkerControl->WorkerStatus();
+	WorkerThread().RequestComplete(workerStatus,KErrAbort);
+	User::WaitForRequest(status);
+	// Close both handles
+	WorkerThread().Close();				
+	iWorkerControl->ControllerThread().Close();
+
+	delete iWorkerControl;
+	delete iWorkerMonitor;
+	}
+
+/**
+ * Necessarily complex because of the two sources of completion
+ * We can tell which one completed us by checking their iActive members
+ */
+void CPersistentStepControl::RunL()
+	{
+	if (iWorkerControl->PersistentError() != KNull)
+		{
+		TBuf<KMaxTestExecuteNameLength> errorParam;
+		errorParam.Copy(iWorkerControl->PersistentError()); // Error Value returned as Panic Result
+		Message().Write(1,errorParam);
+		iWorkerControl->PersistentError().Copy(KNull);
+		}
+	TInt ret = KErrNone;
+	// Check which of the child objects completed us
+	if(!iWorkerMonitor->IsActive())
+		{
+		// Unexpected exit from the worker thread
+		iInitialised = EFalse;// this also make ~CPersistentStepControl not to delete twice.
+		// Pick up the exit reason and panic code if it exists
+		if(WorkerThread().ExitType() == EExitPanic)
+			{
+			TBuf<KMaxTestExecuteNameLength> panicParam(KPanicEquals);
+				panicParam.Append(WorkerThread().ExitCategory()); // Panic Value returned as Result
+
+			//START defect 116046, Cleanup memories.
+			//iWorkerControl->Cleanup();
+			//END defect 116046
+				
+			Message().Write(1,panicParam);
+			}
+			
+		ret = WorkerThread().ExitReason();
+		
+		if (WorkerThread().ExitType() == EExitPanic)
+			{
+			SytemWideErrToTefErr(ret);
+			}		
+		if (ret == KErrAbort && iWorkerControl->TimedOut())
+			{
+			if (Server().LoggerStarted())
+				{
+				Server().ERR_PRINTF1(_L("TEST IS ABOUT TO ABORT DUE TO TEF TIMEOUT"));				
+				}
+			}
+
+		// We need to complete and cancel the other request so we don't have stray events
+		TRequestStatus* status = &iWorkerControl->Status();
+		User::RequestComplete(status,KErrNone);
+		iWorkerControl->Cancel();
+		// Free the resource in the worker control object
+		iWorkerControl->ControllerThread().Close();
+		WorkerThread().Close();
+		delete iWorkerControl;
+		iWorkerControl = NULL;
+		delete iWorkerMonitor;
+		iWorkerMonitor = NULL;
+		// Next time in to StartL() we create them from cleana
+		}
+	else if(!iWorkerControl->IsActive())
+		{
+		// Normal test step completion
+		// We can reuse the thread next time into StartL()
+		// The thread will be blocking on iWorkerStatus
+		// We need to cancel the other object
+		WorkerThread().RendezvousCancel(iWorkerMonitor->Status());
+		iWorkerMonitor->Cancel();
+		// Retrieve the test result
+		ret = iWorkerControl->Result();
+		SytemWideErrToTefErr(ret);
+		}
+	else
+		// Unexpected
+		{
+		ret = iStatus.Int();
+		}
+	// Complete back to the client
+	Message().Complete(ret);
+	}
+
+/**
+ * Abort due to timeout
+ * The worker monitor object will pick up the thread exit
+ */
+void CPersistentStepControl::Stop()
+	{
+	if(iWorkerMonitor->IsActive())
+		{
+		WorkerThread().Kill(KErrAbort);
+		}
+	}
+
+
+CBlockControlBase::~CBlockControlBase()
+	{
+	if( iBlockArray )
+		{
+		delete iBlockArray;
+		iBlockArray = NULL;	
+		}
+	}
+	
+TTEFItemArray* CBlockControlBase::BlockArray() const
+	{
+	return iBlockArray;
+	}
+
+void CBlockControlBase::CreateBlockArrayL( const TDesC8& aBlockArrayPckg )
+	{
+	if( iBlockArray )
+		{
+		delete iBlockArray;
+		iBlockArray = NULL;
+		}
+	
+	TTEFItemPkgBuf	itemPckgBuf;
+	TInt count = aBlockArrayPckg.Size()/itemPckgBuf.Size();
+	iBlockArray = new (ELeave) TTEFItemArray( count );
+	TInt pos = 0;
+	for( TInt i=0; i<count; i++ )
+		{
+		itemPckgBuf.Copy(aBlockArrayPckg.Mid(pos, itemPckgBuf.Size()));
+		pos += itemPckgBuf.Size();
+		iBlockArray->AppendL( itemPckgBuf() );
+		}
+	}
+	
+HBufC8* CBlockControlBase::CreateBlockArrayPckgLC()
+	{
+	TInt count = iBlockArray->Count();
+	TTEFItemPkgBuf	itemPckgBuf;
+	HBufC8* blockArrayPckg = HBufC8::NewLC( count * itemPckgBuf.Size() );
+	TPtr8	ptr( blockArrayPckg->Des() );
+	for( TInt i=0; i<count; i++ )
+		{
+		itemPckgBuf = iBlockArray->At(i);
+		ptr.Append( itemPckgBuf );
+		}
+	
+	return blockArrayPckg;
+	}
+
+CBlockControl::CBlockControl(CTestServer& aServer)
+:	CBlockControlBase(aServer)
+	{
+	}
+	
+CBlockControl::~CBlockControl()
+	{
+	}
+
+void CBlockControl::RunL()
+	{
+	// Write back the test block
+	HBufC8*	blockArrayPckg = CreateBlockArrayPckgLC();
+	TPtr8	blockArrayPtr(blockArrayPckg->Des());
+	Message().WriteL( 2, blockArrayPtr );
+	CleanupStack::PopAndDestroy(blockArrayPckg);
+	
+	// If the thread panicked, pick up the panic string and return it to the client
+	// Overwrites the error value previously saved in Message()
+	if(WorkerThread().ExitType() == EExitPanic)
+		{
+		TBuf<KMaxTestExecuteNameLength> panicParam(KPanicEquals);
+		TPtrC	panicCat = WorkerThread().ExitCategory(); // Panic Value returned as Result
+		if( panicCat.Length() == 0 )
+			{
+			panicParam.Append(_L("NULL"));
+			}
+		panicParam.Append( panicCat );
+		Message().Write(1,panicParam);
+		}
+
+	if (WorkerThread().ExitType() == EExitPanic)
+		{
+		TInt err = WorkerThread().ExitReason();
+		SytemWideErrToTefErr(err);
+		Message().Complete(err);
+		}
+	else
+		{
+		if (iStatus.Int() == KErrAbort && TimedOut())
+			{
+			if (Server().LoggerStarted())
+				{
+				Server().ERR_PRINTF1(_L("TEST IS ABOUT TO ABORT DUE TO TEF TIMEOUT"));				
+				}
+			}
+		// iStatus.Int() is the same as the thread ExitReason
+		Message().Complete(iStatus.Int());
+		}
+	
+	// Close thread handle
+	WorkerThread().Close();
+	}
+
+
+void ThreadBlockFuncL(CBlockControl* aBlockControl)
+	{
+	// Call the server pure virtual to get a step instance
+	CTestBlockController* block = REINTERPRET_CAST(CTestServer2&,aBlockControl->Server()).CreateTestBlock();
+	if(!block)
+		{
+		User::Leave(KErrNotFound);
+		}
+	CleanupStack::PushL(block);
+
+	// Set up the block base class members
+	TBool sharedData = EFalse;
+	block->InitialiseL(aBlockControl->Args(), aBlockControl->Server().Name(), sharedData);
+	block->SetBlockArray(aBlockControl->BlockArray());
+	block->SetSharedData( REINTERPRET_CAST(CTestServer2*, &aBlockControl->Server() ));
+
+	ThreadStepExecutionL(aBlockControl, block);
+
+	// All the rest should be TRAP'd
+	if( block->TestStepResult() )
+		{
+		User::Leave( block->TestStepResult() );
+		}
+	
+	CleanupStack::PopAndDestroy(block);
+ 	}
+
+TInt ThreadBlockFunc(TAny* aParam)
+	{
+	// Create the thread's cleanup stack
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(!cleanup)
+		return KErrNoMemory;
+	// Trap it and return the error code to the OS
+	TRAPD(err, ThreadBlockFuncL(REINTERPRET_CAST(CBlockControl*,aParam)));
+	SytemWideErrToTefErr(err);
+	delete cleanup;
+	cleanup = NULL;
+	return err;
+	}
+
+void CBlockControl::StartL(const RMessage2& aMessage,const TDesC& aArgs, const TDesC8& aBlockArrayPckg)
+	{
+	if(IsActive())
+		{
+		User::Leave(KErrInUse);
+		}
+
+	Message() = aMessage;
+	Args().Copy(aArgs);
+	TBuf<8> heapSizeBuf(KNull);
+	TUint heapSize(0);
+	aMessage.ReadL(1,heapSizeBuf);
+	aMessage.Write(1,KNull);
+	TLex heapSizeLex;
+	
+	if (heapSizeBuf.Length() >=3)
+		{
+		if ( heapSizeBuf.Mid(0,2).CompareF(_L("0x")) == 0 )
+			{
+			heapSizeLex.Assign(heapSizeBuf.Mid(2));
+			}
+		else
+			{
+			heapSizeLex.Assign(heapSizeBuf);
+			}
+		heapSizeLex.Val(heapSize,EHex);
+		}
+
+	// Set the BlockArray so it can be passed and used by the TestBlockController
+	CreateBlockArrayL( aBlockArrayPckg );
+	
+	// Unique thread name guaranteed if we use the this pointer plus a random number
+	// whose seed was initialised to the address of the CTestServer object
+	TBuf<50> threadName;
+	_LIT(KWorker,"Worker%d %d");
+	threadName.Format(KWorker,(TInt)this,Math::Rand(CONST_CAST(CTestServer&,Server()).RandSeed()));
+
+	// Create with own heap so system cleans up if we kill it
+	if( (TInt)heapSize < KMinHeapSize )
+		{
+		heapSize = KDefaultHeapSize;			///< Allow a 1Mb max heap
+		}
+
+	User::LeaveIfError(WorkerThread().Create(threadName, ThreadBlockFunc, KDefaultStackSize + 0x1000,KMinHeapSize, heapSize, this, EOwnerProcess));
+
+	// Prime ready for completion
+	SetActive();
+	// Use the appropriate variant call to get the thread exit
+	WorkerThread().Logon(iStatus);
+	WorkerThread().Resume();
+	}
+	
+void CBlockControl::Stop()
+	{
+	if(IsActive())
+		{
+		WorkerThread().Kill(KErrAbort);
+		}
+	}
+	
+CPersistentBlockControl::CPersistentBlockControl(CTestServer& aServer)
+:	CBlockControlBase(aServer)
+,	iWorkerControl(NULL)
+,	iWorkerMonitor(NULL)
+,	iInitialised(EFalse)
+	{ 
+	}
+	
+CPersistentBlockControl::~CPersistentBlockControl()
+	{
+
+	// Only need to clean up in the initialised state
+	if(!iInitialised)
+		return;
+
+	// Check both objects
+	// Neither of them should be active, but just in case
+	if(iWorkerMonitor->IsActive())
+		{
+		// Cancelling means we don't get stray events
+		WorkerThread().RendezvousCancel(iWorkerMonitor->Status());
+		// Need to cancel the objeect itself
+		iWorkerMonitor->Cancel();
+		}
+	if(iWorkerControl->IsActive())
+		{
+		// Complete the request then cancel
+		TRequestStatus* status = &iWorkerControl->Status();
+		User::RequestComplete(status,KErrNone);
+		iWorkerControl->Cancel();
+		}
+
+	// The worker thread will currently be blocked on its TRequestStatus at the top
+	// of its loop.
+	// Signal the status with KErrAbort and the thread will check this value and leave.
+	// If we Kill the thread then the cleanup stack for the thread is orphaned.
+	// PersistentThreadFuncL() TRAP's the leave.
+	// We logon and catch the thread exit.
+	TRequestStatus status = KRequestPending;
+	WorkerThread().Rendezvous(status);
+	TRequestStatus* workerStatus = &iWorkerControl->WorkerStatus();
+	WorkerThread().RequestComplete(workerStatus,KErrAbort);
+	User::WaitForRequest(status);
+	// Close both handles
+	WorkerThread().Close();				
+	iWorkerControl->ControllerThread().Close();
+
+	delete iWorkerControl;
+	delete iWorkerMonitor;
+	}
+
+void PersistentThreadBlockFuncL(CBlockWorkerControl* aControl)
+	{
+	// Thread entry is sync'd with a semaphore
+	// Caller will Wait on this
+	// Also set our main sync treq to pending.
+	// It's completed to let us go in and execute the test step code.
+	aControl->WorkerStatus() = KRequestPending;
+	aControl->Semaphore().Signal();
+	// Go into the main test step execution loop
+	for(;;)
+		{
+		User::WaitForRequest(aControl->WorkerStatus());
+		// Check
+		if(aControl->WorkerStatus().Int() == KErrAbort)
+			User::Leave(KErrAbort);
+		CTestBlockController* block = REINTERPRET_CAST(CTestServer2&, aControl->Server()).CreateTestBlock();
+		if(!block)
+			User::Leave(KErrNotFound);
+		CleanupStack::PushL(block);
+		// Set up the step base class members
+		TBool sharedData = ETrue;
+		block->InitialiseL(aControl->Args(), aControl->Server().Name(), sharedData);
+		
+		block->SetBlockArray( aControl->BlockArray() );
+		block->SetSharedData( REINTERPRET_CAST(CTestServer2*, &aControl->Server()) );
+
+		ThreadStepExecutionL(aControl, block);
+
+		// Pick up the final result
+		// Set it in the controlling class
+		aControl->Result() = block->TestStepResult();
+		TBuf<KMaxTestExecuteNameLength> lError;
+		if (block->TestStepError() != 0)
+			lError.Num(block->TestStepError());
+		if (lError != KNull)
+			{
+			lError.Insert(0,KErrorEquals);
+			aControl->PersistentError().Copy(lError);
+			}
+		CleanupStack::PopAndDestroy(block);
+		// Set our status for the wait at the top of the loop
+		aControl->WorkerStatus() = KRequestPending;
+		// Signal the status that our creator will be waiting on
+		// Creator's thread handle in the control class
+		TRequestStatus* status = &aControl->Status();
+		aControl->ControllerThread().RequestComplete(status,KErrNone);
+		}
+ 	}
+ 
+TInt PersistentThreadBlockFunc(TAny* aParam)
+	{
+	// Create the thread's cleanup stack
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(!cleanup)
+		return KErrNoMemory;
+	// Trap it and return the error code to the OS
+	TRAPD(err, PersistentThreadBlockFuncL(REINTERPRET_CAST(CBlockWorkerControl*,aParam)));
+	SytemWideErrToTefErr(err);
+	delete cleanup;
+	cleanup = NULL;
+	return err;
+	}
+ 	
+void CPersistentBlockControl::StartL(const RMessage2& aMessage,const TDesC& aStepArgs, const TDesC8& aBlockArrayPckg)
+	{
+	if(IsActive())
+		User::Leave(KErrInUse);
+	Message() = aMessage;
+	Args().Copy(aStepArgs);
+	
+	// Set the BlockArray so it can be passed and used by the TestBlockController
+	// Set the BlockArray so it can be passed and used by the TestBlockController
+	CreateBlockArrayL( aBlockArrayPckg );
+	
+	// Check to see if we're reusing the worker thread and classes
+	if(!iInitialised)
+		{
+		// Need to construct the monitor and controller classes
+		// They are both constructed with a reference to our iStatus
+		// Either of them can complete us. We check their Active flags in our RunL()
+		iWorkerControl = new (ELeave) CBlockWorkerControl(Server(),iStatus);
+		// The worker thread needs our thread handle to RequestComplete us
+		User::LeaveIfError(iWorkerControl->ControllerThread().Duplicate(RThread()));
+		// Worker thread entry is sync'd with a semaphore.
+		User::LeaveIfError(iWorkerControl->Semaphore().CreateLocal(0));
+		TBuf<50> threadName;
+		// Unique thread name guaranteed if we use the this pointer plus a random number
+		// whose seed was initialised to the address of the CTestServer object
+		// Create in our heap.
+		_LIT(KWorker,"Worker%d %d");
+		threadName.Format(KWorker,(TInt)this,Math::Rand(CONST_CAST(CTestServer&,Server()).RandSeed()));
+		User::LeaveIfError(WorkerThread().Create(threadName,PersistentThreadBlockFunc, KDefaultStackSize + 0x1000,NULL,iWorkerControl, EOwnerProcess));
+		iWorkerMonitor = new (ELeave) CWorkerMonitor(iStatus);
+		}
+
+	// Set the Block Array
+	iWorkerControl->SetBlockArray( BlockArray() );
+	
+	// Worker thread needs the step arguments and the step name
+	iWorkerControl->Args().Set(Args());
+
+	// Set this object ready for completion by either the monitor or controller objects
+	Prime();
+	// Set the child monitor and control objects ready for completion
+	iWorkerMonitor->SetActive();
+	iWorkerControl->Prime();
+	// Use the monitor object to pick up thread exit
+	// This should only happen for panic, leave and abort following the Stop() call
+	WorkerThread().Rendezvous(iWorkerMonitor->Status());
+	if(!iInitialised)
+		{
+		// Start the thread and sync up via the semaphore
+		WorkerThread().Resume();
+		iWorkerControl->Semaphore().Wait();
+		iWorkerControl->Semaphore().Close();
+		iInitialised = ETrue;
+		}
+	// Worker thread will be at the top of its loop waiting to execute
+	// the test step virtuals.
+	// Issue the request then it will drop through
+	TRequestStatus* status = &iWorkerControl->WorkerStatus();
+	WorkerThread().RequestComplete(status,KErrNone);
+	}
+	
+void CPersistentBlockControl::RunL()
+	{
+	// Write back the test block
+	HBufC8*	blockArrayPckg = CreateBlockArrayPckgLC();
+	TPtr8	blockArrayPtr(blockArrayPckg->Des());
+	Message().WriteL( 2, blockArrayPtr );
+	CleanupStack::PopAndDestroy(blockArrayPckg);
+	
+	if (iWorkerControl->PersistentError() != KNull)
+		{
+		TBuf<KMaxTestExecuteNameLength> errorParam;
+		errorParam.Copy(iWorkerControl->PersistentError()); // Error Value returned as Panic Result
+		Message().Write(1,errorParam);
+		iWorkerControl->PersistentError().Copy(KNull);
+		}
+	TInt ret = KErrNone;
+	// Check which of the child objects completed us
+	if(!iWorkerMonitor->IsActive())
+		{
+		// Unexpected exit from the worker thread
+		iInitialised = EFalse;// this also make ~CPersistentBlockControl not to delete twice.
+		// Pick up the exit reason and panic code if it exists
+		if(WorkerThread().ExitType() == EExitPanic)
+			{
+			TBuf<KMaxTestExecuteNameLength> panicParam(KPanicEquals);
+			TPtrC	panicCat = WorkerThread().ExitCategory(); // Panic Value returned as Result
+			if( panicCat.Length() == 0 )
+				{
+				panicParam.Append(_L("NULL"));
+				}
+			panicParam.Append( panicCat );
+			Message().Write(1,panicParam);
+			}
+			
+		ret = WorkerThread().ExitReason();
+		
+		if (WorkerThread().ExitType() == EExitPanic)
+			{
+			SytemWideErrToTefErr(ret);
+			}
+		if (ret == KErrAbort && iWorkerControl->TimedOut())
+			{
+			if (Server().LoggerStarted())
+				{
+				Server().ERR_PRINTF1(_L("TEST IS ABOUT TO ABORT DUE TO TEF TIMEOUT"));				
+				}
+			}
+
+		// We need to complete and cancel the other request so we don't have stray events
+		TRequestStatus* status = &iWorkerControl->Status();
+		User::RequestComplete(status,KErrNone);
+		iWorkerControl->Cancel();
+		// Free the resource in the worker control object
+		iWorkerControl->ControllerThread().Close();
+		WorkerThread().Close();
+		delete iWorkerControl;
+		iWorkerControl = NULL;
+		delete iWorkerMonitor;
+		iWorkerMonitor = NULL;
+		// Next time in to StartL() we create them from cleana
+		}
+	else if(!iWorkerControl->IsActive())
+		{
+		// Normal test step completion
+		// We can reuse the thread next time into StartL()
+		// The thread will be blocking on iWorkerStatus
+		// We need to cancel the other object
+		WorkerThread().RendezvousCancel(iWorkerMonitor->Status());
+		iWorkerMonitor->Cancel();
+		// Retrieve the test result
+		ret = iWorkerControl->Result();
+		SytemWideErrToTefErr(ret);
+		}
+	else
+		// Unexpected
+		{
+		ret = iStatus.Int();
+		}
+	// Complete back to the client
+	Message().Complete(ret);
+	}
+
+void CPersistentBlockControl::Stop()
+	{
+	if(iWorkerMonitor->IsActive())
+		{
+		WorkerThread().Kill(KErrAbort);
+		}
+	}
+
+/**
+ * //> @internalComponent
+ * @param aErr - Reference to the error number
+ * this delling with Leave or set result  error number conflict with sys wide numbers[-1,-49]
+ */
+void SytemWideErrToTefErr(TInt &aErr)
+{
+    switch (aErr)
+    	{
+    	case KErrInUse:
+    		{
+    		aErr = KErrTestExecuteInUse;
+    		}
+    		break;
+    	case KErrServerBusy:
+    		{
+    		aErr = KErrTestExecuteServerBusy;
+    		}
+    		break;
+    	};
+    return;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/src/teststepbase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,941 @@
+/*
+* Copyright (c) 2005-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:  
+* Contains the CTestStep base class implementation
+*
+*/
+
+
+
+/**
+ @file TestStepBase.cpp
+*/
+
+#include "testexecutestepbase.h"
+
+/**
+ * Default virtual implementation for pre-processing  within test steps
+ * Virtual - May be overidden by subclass
+ * @return One of TVerdict enum values defined
+ */
+EXPORT_C enum TVerdict CTestStep::doTestStepPreambleL(void)
+	{
+	SetTestStepResult(EPass);
+	SetTestStepError(0);
+	return TestStepResult();
+	}
+
+/**
+ * Default virtual implementation for post-processing within test steps
+ * Virtual - May be overidden by subclass
+ * @return One of TVerdict enum values defined
+ */
+EXPORT_C enum TVerdict CTestStep::doTestStepPostambleL(void)
+	{
+	return TestStepResult();
+	}
+
+/**
+ * Sets the current heap's to fail upon the subsequent "aFailureIndex" attempt
+ * Virtual - may be overridden by derived test step
+ * @param aFailureIndex - Index within heap allocation table that needs to be failed
+ */
+EXPORT_C void CTestStep::SetHeapFailNext(TInt aFailureIndex)
+	{
+	if (aFailureIndex >= 0)
+		{
+		__UHEAP_FAILNEXT(aFailureIndex);
+		}
+	}
+
+/**
+ * Resets the the current heap's simulated "fail next" mode (if active)
+ * Virtual - may be overridden by derived test step
+ */
+EXPORT_C void CTestStep::ResetHeapFailNext()
+	{
+	__UHEAP_RESET;
+	}
+
+/**
+ * Tests whether the current heap is in "fail next" mode. Used to check whether 
+ * the code-under-test has "consumed" the simulated failure when OOM looping.
+ * Virtual - may be overridden by derived test step
+ * @return Boolean true if code has comsumed a simulated failure, false otherwise
+ */
+EXPORT_C TBool CTestStep::CheckForHeapFailNext()
+	{
+	TBool finishedCorrectly(EFalse);
+	TInt* myInt = new TInt;
+	if (myInt == NULL)
+		finishedCorrectly = ETrue; // NULL means no memory
+	delete myInt;
+	return finishedCorrectly;
+	}
+
+/**
+ * Destructor
+ * Only heap resource is the Ini file data
+ */
+EXPORT_C CTestStep::~CTestStep()
+	{
+	CloseLogger();
+	delete iConfigData;
+	delete iIniFileName;
+	delete iLogger ; 
+	}
+
+/**
+ * Constructor
+ */
+EXPORT_C CTestStep::CTestStep()
+	{
+	// current logger can't using to log infomation.
+	// because SetLoggerL must called before write logs.
+	// the initial operation codes at SetLoggerL()
+	iLogger = new CTestExecuteLogger();
+	}
+
+/**
+ * Called by server base code that loads the test step
+ * Can be called multiple times for any loaded test step instance.
+ * Sets up the instance variables
+ * @param aStepArgs - The arguments to the RUN_TEST_STEP command
+ * @param aServerName - Name of the server that requested initialisation of its test step object
+ * @param aSharedDataMode - Boolean true or false indicating the mode in which the test step is running
+ * @Leave system wide errors
+ */
+void CTestStep::InitialiseL(const TDesC& aStepArgs, const TDesC& aServerName, TBool& aSharedDataMode)
+	{
+	// Assume pass
+	iTestStepResult = EPass;
+	iSharedDataMode = aSharedDataMode;
+	iSection.SetLength(0);
+	// In the case of re-initialise we need to free the existing resource
+	if(iIniFileName)
+		{
+		delete iIniFileName;
+		iIniFileName = NULL;
+		}
+	if(iConfigData)
+		{
+		delete iConfigData;
+		iConfigData = NULL;
+		}
+
+	TLex lex(aStepArgs);
+
+	// Extract the first token for OOM request status
+	TPtrC oomRequestString(lex.NextToken());
+	_LIT(KTEFOomOff,"OOM=0");
+	if (oomRequestString.CompareF(KTEFOomOff) == 0)
+		{
+		// Not required to run OOM tests if OOM=0
+		iOOMRequestStatus = EFalse;
+		}
+	else
+		{
+		// Required to run OOM tests if OOM=1
+		iOOMRequestStatus = ETrue;
+		}
+
+	// Extract the second token for !Setup value
+	TLex setupParamValue(lex.NextToken().Mid(7));
+	TInt err = setupParamValue.Val(iSetupParamValue);
+	if (err != KErrNone)
+		{
+		iSetupParamValue = TTestSetupState(ESetupNone);
+		}
+	
+	// Extract the third token from aStepArgs for loop index
+	TLex loopIndex(lex.NextToken());
+	loopIndex.Val(iLoopIndex);
+
+	iTestCaseID.Copy(lex.NextToken());
+
+	TPtrC path(lex.NextToken());
+	iScriptDriveName.Copy(path);
+
+	path.Set(lex.NextToken());
+	iSystemDrive.Copy(path);
+
+	path.Set(lex.NextToken());
+	iSystemDriveForTest.Copy(path);
+	
+	// Set the logger instance
+	//before SetLogger(). iSystemDrive is needed, because SetLogger() will using iSystemDrive
+	//before LoadConfigFileL(). SetLogger() is needed, because LoadConfigFileL() may needs write logs.
+	SetLoggerL();
+	// Get the ini file name if any
+	TPtrC configFile(lex.NextToken());
+	if(configFile.Length())
+		{
+		LoadConfigFileL(configFile);
+		TPtrC iniSection(lex.NextToken());
+		// In the case of re-initialise zero the old one
+		ConfigSection().SetLength(0);
+		// Get the ini section name if any
+		if(iniSection.Length() && iniSection.Length() <= ConfigSection().MaxLength())
+			ConfigSection().Copy(iniSection);
+		}
+	// Set the inifile name.
+	iIniFileName = configFile.AllocL();
+	// Set the server name
+	iServerName = aServerName;
+	}
+
+/**
+ * Creates a Cinidata instance for the ini file path specified for a particular test step
+ * @param aFilePath - Full pathname of the ini file
+ * @Leave system wide errors
+ */
+void CTestStep::LoadConfigFileL(const TDesC& aFilePath)
+	{
+	if(!aFilePath.Length())
+		User::Leave(KErrNotFound);
+
+		// Pass the system drive letter finalised to the Cinidata construction
+		// So, that the ini files can be expanded for the ${SYSDRIVE} variables
+		TRAPD(err,iConfigData = CIniData::NewL(aFilePath, GetSystemDrive()));		
+		if(err != KErrNone)
+			{
+			//defect 121613: TEF will report ini file too large
+			ERR_PRINTF3(_L("Leave when loading %S . Error Code = %d"),&aFilePath,err);
+			// This is a hit message to user to split ini file to smaller one
+			if (err == KErrNoMemory ) // -4
+				{
+				_LIT(KTEFLOADINIFILENOENOUGHMEM,"The configuration file is too large that TEF don't have enough memory to load. Please consider split the configuration file into smaller one or load the file in your own test codes.");
+				INFO_PRINTF1(KTEFLOADINIFILENOENOUGHMEM);
+				}
+			User::Leave(err);
+			}
+	}
+
+/**
+ * Reads the value present from the test steps ini file within the mentioned section name and key name
+ * Copies the value to the TBool reference passed in
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aResult - The value of the boolean
+ * @return TBool - ETrue for found, EFalse for not found 
+ */
+EXPORT_C TBool CTestStep::GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult) 
+	{
+	TPtrC result;
+	if(!iConfigData)
+		return EFalse;
+	if(!iConfigData->FindVar(aSectName, aKeyName, result))
+		return EFalse;
+	_LIT(KTrue,"true");
+	if (result.FindF(KTrue) == KErrNotFound) 
+		aResult = EFalse;
+	else
+		aResult = ETrue;
+
+	if (iEnableIniAccessLog)
+		{
+		INFO_PRINTF5(KTEFIniReadInteger,iIniFileName, &aSectName, &aKeyName , aResult);
+		}
+	return(ETrue);
+	}
+
+/**
+ * Reads the value present from the test steps ini file within the mentioned section name and key name
+ * Copies the value to the TInt reference passed in
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aResult - The value of the integer
+ * @return TBool - ETrue for found, EFalse for not found 
+ */
+EXPORT_C TBool CTestStep::GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) 
+	{
+	if(!iConfigData)
+		return EFalse;
+	if(!iConfigData->FindVar(aSectName, aKeyName, aResult))
+		return EFalse;
+	if (iEnableIniAccessLog)
+		{
+		INFO_PRINTF5(KTEFIniReadInteger,iIniFileName, &aSectName, &aKeyName , aResult);
+		}
+	return ETrue;
+	}
+/**
+ * Reads the value present from the test steps ini file within the mentioned section name and key name
+ * Copies the value to the TInt64 reference passed in
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aResult - The value of the 64-bit integer
+ * @return TBool - ETrue for found, EFalse for not found 
+ */
+EXPORT_C TBool CTestStep::GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt64& aResult)
+	{
+	if(!iConfigData)
+		return EFalse;
+	if(!iConfigData->FindVar(aSectName, aKeyName, aResult))
+		return EFalse;
+	if (iEnableIniAccessLog)
+		{
+		INFO_PRINTF5(KTEFIniReadInt64,iIniFileName, &aSectName, &aKeyName , aResult);
+		}
+	return ETrue;
+	}
+	
+/**
+ * Reads the value present from the test steps ini file within the mentioned section name and key name
+ * Copies the value to the TPtrC reference passed in
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aResult - Reference to the string on the heap
+ * @return TBool - ETrue for found, EFalse for not found 
+ */
+EXPORT_C TBool CTestStep::GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult) 
+	{
+	if(!iConfigData)
+		return EFalse;
+	if(!iConfigData->FindVar(aSectName, aKeyName, aResult))
+		return EFalse;
+	if (iEnableIniAccessLog)
+		{
+		INFO_PRINTF5(KTEFIniReadString,iIniFileName, &aSectName, &aKeyName , &aResult);
+		}
+	return ETrue;
+	}
+
+/**
+ * Reads the value present from the test steps ini file within the mentioned section name and key name
+ * Copies the value to the TInt reference passed in
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aResult - The integer value of the Hex input
+ * @return TBool - ETrue for found, EFalse for not found 
+ */	
+EXPORT_C TBool CTestStep::GetHexFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TInt& aResult)
+	{
+	TPtrC result;
+	if(!iConfigData)
+		return EFalse;
+	if(!iConfigData->FindVar(aSectName, aKeyName, result))
+		return EFalse;
+	TLex lex(result);
+	TInt err = lex.Val((TUint &)aResult, EHex);
+	if(err)
+		return EFalse;
+	if (iEnableIniAccessLog)
+		{
+		INFO_PRINTF5(KTEFIniReadInteger,iIniFileName, &aSectName, &aKeyName , aResult);
+		}
+	return(ETrue);
+	}
+
+/**
+ * Writes the integer value  passed in to the test steps ini file under the section and key name mentioned
+ * Creates a new section or key name if it does not existing already
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aValue - Reference to the integer to be written on to the test steps ini file
+ * @return TBool - ETrue for found, EFalse for not found 
+ */
+EXPORT_C TBool CTestStep::WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue)
+	{
+	TBuf<KMaxTestExecuteNameLength> value;
+	TBool retVal(ETrue);
+	TInt err(KErrNone);
+	value.AppendNum(aValue);
+			
+	if(!iConfigData)
+		{
+		retVal = EFalse;
+		}
+	else if(iConfigData->SetValue(aSectName,aKeyName,value)==KErrNotFound)
+		{
+		err = iConfigData->AddValue(aSectName,aKeyName,value);
+		}
+	
+	if(retVal && KErrNone==err)
+		{
+		TRAP(err, iConfigData->WriteToFileL());
+		if (iEnableIniAccessLog)
+			{
+			if (KErrNone == err)
+				{
+				INFO_PRINTF5(KTEFIniWriteInteger,iIniFileName, &aSectName, &aKeyName , aValue);
+				}
+			}
+		}
+
+	if (!retVal || KErrNone!=err)
+		{
+		retVal = EFalse;
+		if (iEnableIniAccessLog)
+			{
+			_LIT(KWriteIntegerError, "Error occurs when writing integer to file, error code=%d");
+			ERR_PRINTF2(KWriteIntegerError, err);
+			}
+		}
+	return retVal;
+	}
+/**
+ * Writes the 64-bit integer value  passed in to the test steps ini file under the section and key name mentioned
+ * Creates a new section or key name if it does not existing already
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aValue - Reference to the 64-bit integer to be written on to the test steps ini file
+ * @return TBool - ETrue for found, EFalse for not found 
+ */
+EXPORT_C TBool CTestStep::WriteIntToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt64& aValue)
+	{
+	TBuf<KMaxTestExecuteNameLength> value;
+	TBool retVal(ETrue);
+	TInt err(KErrNone);
+	value.AppendNum(aValue);
+			
+	if(!iConfigData)
+		{
+		retVal = EFalse;
+		}
+	else if(iConfigData->SetValue(aSectName,aKeyName,value)==KErrNotFound)
+		{
+		err = iConfigData->AddValue(aSectName,aKeyName,value);
+		}
+	
+	if(retVal && KErrNone==err)
+		{
+		TRAP(err, iConfigData->WriteToFileL());
+		if (iEnableIniAccessLog)
+			{
+			if (KErrNone == err)
+				{
+				INFO_PRINTF5(KTEFIniWriteInt64,iIniFileName, &aSectName, &aKeyName , aValue);
+				}
+			}
+		}
+
+	if (!retVal || KErrNone!=err)
+		{
+		retVal = EFalse;
+		if (iEnableIniAccessLog)
+			{
+			_LIT(KWriteIntegerError, "Error occurs when writing integer to file, error code=%d");
+			ERR_PRINTF2(KWriteIntegerError, err);
+			}
+		}
+	return retVal;	
+	}
+
+/**
+ * Writes the string value  passed in to the test steps ini file under the section and key name mentioned
+ * Creates a new section or key name if it does not existing already
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aValue - Reference to the string to be written on to the test steps ini file
+ * @return TBool - ETrue for found, EFalse for not found 
+ */
+EXPORT_C TBool CTestStep::WriteStringToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TPtrC& aValue)
+	{
+	TBool retVal(ETrue);
+	TInt err(KErrNone);
+			
+	if(!iConfigData)
+		{
+		retVal = EFalse;
+		}
+	else if(iConfigData->SetValue(aSectName,aKeyName,aValue)==KErrNotFound)
+		{
+		err = iConfigData->AddValue(aSectName,aKeyName,aValue);
+		}
+	
+	if(retVal && KErrNone==err)
+		{
+		TRAP(err, iConfigData->WriteToFileL());
+		if (iEnableIniAccessLog)
+			{
+			if (KErrNone == err)
+				{
+				INFO_PRINTF5(KTEFIniWriteString,iIniFileName, &aSectName, &aKeyName , &aValue);
+				}
+			}
+		}
+
+	if (!retVal || KErrNone!=err)
+		{
+		retVal = EFalse;
+		if (iEnableIniAccessLog)
+			{
+			_LIT(KWriteIntegerError, "Error occurs when writing string to file, error code=%d");
+			ERR_PRINTF2(KWriteIntegerError, err);
+			}
+		}
+	return retVal;
+	}
+	
+/**
+ * Writes the boolean value  passed in to the test steps ini file under the section and key name mentioned
+ * Creates a new section or key name if it does not existing already
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aValue - Reference to the boolean value to be written onto the test steps ini file
+ * @return TBool - ETrue for found, EFalse for not found 
+ */	
+EXPORT_C TBool CTestStep::WriteBoolToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TBool& aValue)
+	{
+	TBuf<KMaxTestExecuteNameLength> value;
+	TBool retVal(ETrue);
+	TInt err(KErrNone);
+	if(aValue==1)
+		{
+		_LIT(KTrue,"True");
+		value.Append(KTrue);
+		}
+	else if(aValue==0) 
+		{
+		_LIT(KFalse,"False");
+		value.Append(KFalse);
+		}
+	else 
+		{
+		return(EFalse);
+		}
+		
+	if(!iConfigData)
+		{
+		retVal = EFalse;
+		}
+	else if(iConfigData->SetValue(aSectName,aKeyName,value)==KErrNotFound)
+		{
+		err = iConfigData->AddValue(aSectName,aKeyName,value);
+		}
+	
+	if(retVal && KErrNone==err)
+		{
+		TRAP(err, iConfigData->WriteToFileL());
+		if (iEnableIniAccessLog)
+			{
+			if (KErrNone == err)
+				{
+				INFO_PRINTF5(KTEFIniWriteInteger,iIniFileName, &aSectName, &aKeyName , aValue);
+				}
+			}
+		}
+
+	if (!retVal || KErrNone!=err)
+		{
+		retVal = EFalse;
+		if (iEnableIniAccessLog)
+			{
+			_LIT(KWriteIntegerError, "Error occurs when writing bool to file, error code=%d");
+			ERR_PRINTF2(KWriteIntegerError, err);
+			}
+		}
+	return retVal;
+	}
+	
+/**
+ * Writes the hex equivalent of the integer value  passed in to the test steps ini file 
+ * under the section and key name mentioned
+ * Creates a new section or key name if it does not existing already
+ * @param aSectName - Section within the test steps ini file
+ * @param aKeyName - Name of a key within a section
+ * @return aValue - Reference to the integer equivalent of the hex value to be written onto the test steps ini file
+ * @return TBool - ETrue for found, EFalse for not found 
+ */	
+EXPORT_C TBool CTestStep::WriteHexToConfig(const TDesC& aSectName, const TDesC& aKeyName, const TInt& aValue)
+	{
+	TBuf<KMaxTestExecuteNameLength> value;
+	TBool retVal(ETrue);
+	TInt err(KErrNone);
+	value.Num(aValue,EHex);
+	
+	if(!iConfigData)
+		{
+		retVal = EFalse;
+		}
+	else if(iConfigData->SetValue(aSectName,aKeyName,value)==KErrNotFound)
+		{
+		iConfigData->AddValue(aSectName,aKeyName,value);
+		}
+	
+	if(retVal && KErrNone==err)
+		{
+		TRAP(err, iConfigData->WriteToFileL());
+		if (iEnableIniAccessLog)
+			{
+			if (KErrNone == err)
+				{
+				INFO_PRINTF5(KTEFIniWriteInteger,iIniFileName, &aSectName, &aKeyName , aValue);
+				}
+			}
+		}
+
+	if (!retVal || KErrNone!=err)
+		{
+		retVal = EFalse;
+		if (iEnableIniAccessLog)
+			{
+			_LIT(KWriteIntegerError, "Error occurs when writing hex to file, error code=%d");
+			ERR_PRINTF2(KWriteIntegerError, err);
+			}
+		}
+	return retVal;
+	}
+
+/**
+ * Updates the data to the shared data name passed either in Copy Mode/Append Mode
+ * @param aShareName - Shared data name to be written
+ * @param aSharedDataVal - Descriptor value to be used for updating the shared data
+ * @param aModeCopy - Enum value indicating the descriptor value to be overwritten/appended
+ * @Leave system wide errors
+ */
+EXPORT_C void CTestStep::WriteSharedDataL(const TDesC& aShareName, TDesC& aSharedDataVal, TModeCopy aModeCopy)
+	{
+	CTestSharedData* sharedObject = NULL;
+	CTEFSharedData<CTestSharedData>* sharedData1 = CTEFSharedData<CTestSharedData>::NewLC(sharedObject, aShareName);
+	sharedData1->EnterCriticalSection();
+	switch(aModeCopy)
+		{
+		case ESetText:
+			{
+			sharedObject->SetText(aSharedDataVal);
+			break;
+			}
+		case EAppendText:
+			{
+			sharedObject->AppendText(aSharedDataVal);
+			break;
+			}
+		default:
+			break;
+		}
+	sharedData1->ExitCriticalSection();
+	CleanupStack::PopAndDestroy(sharedData1);
+	}
+
+/**
+ * Reads the data from the specified shared data object
+ * Copies it to the reference descriptor passed in
+ * @param aShareName - Shared Data Name to be read
+ * @param aSharedDataVal - Descriptor reference passed in for reading the data from shared data
+ * @Leave system wide errors
+ */
+EXPORT_C void CTestStep::ReadSharedDataL(const TDesC& aShareName, TDes& aSharedDataVal)
+	{
+	CTestSharedData* sharedObject = NULL;
+	CTEFSharedData<CTestSharedData>* sharedData1 = CTEFSharedData<CTestSharedData>::NewLC(sharedObject, aShareName);
+	sharedData1->EnterCriticalSection();
+	sharedObject->GetText(aSharedDataVal);
+	sharedData1->ExitCriticalSection();
+	CleanupStack::PopAndDestroy(sharedData1);
+	}
+
+/**
+ * Sets the test step class with a user-friendly name to be referred from the script file
+ * @param aStepName - Name of the test step
+ */
+EXPORT_C void CTestStep::SetTestStepName(const TDesC& aStepName)
+	{
+	iTestStepName.Copy(aStepName);
+	}
+
+/**
+ * Used to set the actual error value within the test step object
+ * @param aStepError - Test Step Error
+ */
+EXPORT_C void CTestStep::SetTestStepError(const TInt& aStepError)
+	{
+	iTestStepError = aStepError;
+	if (aStepError < 0)
+		SetTestStepResult(EFail);
+	}
+
+/**
+ * Initialise the File Logger server
+ * Secure and Non-secure variants
+ * @Leave system wide errors
+ */
+void CTestStep::SetLoggerL()
+	{
+	if(iLogger)
+		{
+		CloseLogger();
+		delete iLogger  ;
+		iLogger = NULL;
+		}
+	TRAPD(err1,iLogger = CTestExecuteLogger::NewL());
+	if(err1 != KErrNone)
+		{
+		User::Leave(err1);
+		}
+
+	// Create a cinidata object for parsing the testexecute.ini
+	CTestExecuteIniData* parseTestExecuteIni = NULL;
+	TBuf<KMaxTestExecuteNameLength> resultFilePath;
+	TBuf<KMaxTestExecuteNameLength> xmlFilePath;
+	TInt logMode;
+	TInt loggerChannel ; 
+	TInt logLevel;
+	TInt ChanneloutPort;// serial port
+	
+	TRAPD(err,parseTestExecuteIni = CTestExecuteIniData::NewL(iSystemDrive));
+	if (err == KErrNone)
+		{
+		CleanupStack::PushL(parseTestExecuteIni);
+		parseTestExecuteIni->ExtractValuesFromIni();
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFHtmlKey, resultFilePath);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFXmlKey, xmlFilePath);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFLogMode, logMode);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFLogSeverityKey, logLevel);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFEnableIniAccessLog, iEnableIniAccessLog);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFLogChannel, loggerChannel);
+		parseTestExecuteIni->GetKeyValueFromIni(KTEFOutputPort,ChanneloutPort);
+		}
+	else
+		{
+		TBuf<KMaxTestExecuteNameLength> testExecuteLogPath(KTestExecuteLogPath);
+		testExecuteLogPath.Replace(0, 2, iSystemDrive);
+		resultFilePath.Copy(testExecuteLogPath);
+		xmlFilePath.Copy(testExecuteLogPath);
+		logMode = TLoggerOptions(ELogHTMLOnly);
+		logLevel = RFileFlogger::TLogSeverity(ESevrAll);
+		iEnableIniAccessLog = ETrue;
+		}
+	Logger().SetLoggerOptions(logMode);
+	Logger().SetLoggerChannel(loggerChannel) ; 
+	if( loggerChannel == ESerial || loggerChannel == EBoth)		
+		{
+		//InitialiseLoggingL
+		Logger().OpenSerialPortL(ChanneloutPort);
+		}
+	
+	// Initialise a handle to the file logger
+	User::LeaveIfError(Logger().Connect());
+	RFs fS;
+	User::LeaveIfError(fS.Connect());
+	CleanupClosePushL(fS);
+	RFile file;
+	TBuf<KMaxTestExecuteNameLength> xmlLogFile(xmlFilePath);
+	TBuf<KMaxTestStepNameLength> logFile;
+	TBuf<KMaxTestExecuteNameLength> logFileNameFile(resultFilePath);
+	logFileNameFile.Append(KTestExecuteScheduleTestLogCompatibilityNameFile);
+	if(file.Open(fS,logFileNameFile,EFileRead | EFileShareAny) != KErrNone)
+		{
+		// For the old flogger we have to create an individual file
+		logFile.Copy(iTestStepName);
+		_LIT(KTxtExtension,".txt");
+		logFile.Append(KTxtExtension);
+		logMode = TLoggerOptions(0);
+		Logger().SetLoggerOptions(logMode);
+		}
+	else
+		{
+		CleanupClosePushL(file);
+		TBuf8<KMaxTestExecuteNameLength> logFile8;
+		TInt fileSize;
+		User::LeaveIfError(file.Size(fileSize));
+		User::LeaveIfError(file.Read(logFile8,fileSize));
+		logFile.Copy(logFile8);
+		xmlLogFile.Append(logFile);
+		_LIT(KXmlExtension,".xml");
+		xmlLogFile.Append(KXmlExtension);
+		_LIT(KHtmExtension,".htm");
+		logFile.Append(KHtmExtension);
+		CleanupStack::Pop(&file);
+		file.Close();
+		}
+	TBuf<KMaxTestExecuteLogFilePath> logFilePath(resultFilePath);
+	logFilePath.Append(logFile);
+	CleanupStack::Pop(&fS);
+	fS.Close();
+	
+	if (logMode == 0 || logMode == 2)
+		{
+		TRAPD(err1,Logger().HtmlLogger().CreateLog(logFilePath,RTestExecuteLogServ::ELogModeAppend));
+		if(err1 != KErrPathNotFound)
+			{
+			User::LeaveIfError(err1) ;
+			}
+		else
+			{
+			// if its other than an htm file , ignore it
+			_LIT(KHtmExtension,".htm");
+			if(logFilePath.Find(KHtmExtension)>-1)
+				{
+				User::LeaveIfError(err1) ;
+				}
+			}
+
+		Logger().HtmlLogger().SetLogLevel(TLogSeverity(logLevel));
+		}
+	if (logMode == 1 || logMode == 2)
+		{
+		User::LeaveIfError(Logger().XmlLogger().CreateLog(xmlLogFile,RFileFlogger::ELogModeAppend));
+		Logger().XmlLogger().SetLogLevel(RFileFlogger::TLogSeverity(logLevel));
+		}
+	if (parseTestExecuteIni != NULL)
+		{
+		CleanupStack::PopAndDestroy(parseTestExecuteIni);
+		}
+	}
+
+/**
+ * Just close our handle to Flogger
+ */
+void CTestStep::CloseLogger()
+	{
+	Logger().Close();
+//	if(iLogger)
+//		{
+//		delete iLogger;
+//		iLogger = NULL;
+//		}
+	}
+
+///////
+// LEGACY methods from scheduletest & autotest
+///////
+EXPORT_C void CTestStep::testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine)
+///< TEST(a)
+	{
+	if(TestStepResult() == EPass && !aCondition)			// If not true, change to fail!
+		{
+		SetTestStepResult(EFail);
+		_LIT(KMessage,"ERROR: Test Failed");
+		Logger().LogExtra(aFile, aLine, ESevrErr,KMessage);
+		}
+	}
+
+EXPORT_C void CTestStep::testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine, TBool aIgnoreStepResult)
+///< TEST(a)
+	{
+	if (aIgnoreStepResult)
+		{
+		if (!aCondition)
+			{
+			SetTestStepResult(EFail);
+			_LIT(KMessage,"ERROR: Test Failed");
+			Logger().LogExtra(aFile, aLine, ESevrErr,KMessage);
+			}
+		}
+	else
+		{
+		testBooleanTrue(aCondition, aFile, aLine);
+		}
+	}
+
+EXPORT_C void CTestStep::testBooleanTrueL(TBool aCondition, const TText8* aFile, TInt aLine)
+///< TESTL(a)
+	{
+	testBooleanTrue(aCondition, aFile, aLine);
+	if(!aCondition)
+		User::Leave(TEST_ERROR_CODE);	// leave with standard error code
+	}
+
+EXPORT_C void CTestStep::testBooleanTrueL(TBool aCondition, const TText8* aFile, TInt aLine, TBool aIgnoreStepResult)
+///< TESTL(a)
+	{
+	testBooleanTrue(aCondition, aFile, aLine, aIgnoreStepResult);
+	if(!aCondition)
+		User::Leave(TEST_ERROR_CODE);	// leave with standard error code
+	}
+
+EXPORT_C void CTestStep::testBooleanTrueWithErrorCodeL(TBool aCondition, TInt aErrorCode, const TText8* aFile, TInt aLine)
+///< TESTEL(a,b)
+	{
+	testBooleanTrueWithErrorCode(aCondition, aErrorCode, aFile, aLine);
+	if(!aCondition)
+		User::Leave(aErrorCode);
+	}
+
+EXPORT_C void CTestStep::testBooleanTrueWithErrorCodeL(TBool aCondition, TInt aErrorCode, const TText8* aFile, TInt aLine, TBool aIgnoreStepResult)
+///< TESTEL(a,b)
+	{
+	testBooleanTrueWithErrorCode(aCondition, aErrorCode, aFile, aLine, aIgnoreStepResult);
+	if(!aCondition)
+		User::Leave(aErrorCode);
+	}
+
+EXPORT_C void CTestStep::testBooleanTrueWithErrorCode(TBool aCondition, TInt aErrorCode, const TText8* aFile, TInt aLine)
+///< TESTE(a,b)
+	{
+	if(TestStepResult() == EPass && !aCondition)			// If not true, change to fail!
+		{
+		SetTestStepResult(EFail);
+		_LIT(KMessage,"Test Failed with error [%d]");
+		//START defect 116178
+		Logger().LogExtra(aFile, aLine, ESevrErr, KMessage, aErrorCode);
+		//END defect 116178
+		}
+	}
+
+EXPORT_C void CTestStep::testBooleanTrueWithErrorCode(TBool aCondition, TInt aErrorCode, const TText8* aFile, TInt aLine, TBool aIgnoreStepResult)
+///< TESTE(a,b)
+	{
+	if (aIgnoreStepResult)
+		{
+		if(!aCondition)			
+			{
+			SetTestStepResult(EFail);
+			_LIT(KMessage,"Test Failed with error [%d]");
+		//	START defect 116178
+			Logger().LogExtra(aFile, aLine, ESevrErr, KMessage, aErrorCode);
+		//	END defect 116178
+			}
+		}
+	else
+		{
+		testBooleanTrueWithErrorCode(aCondition, aErrorCode, aFile, aLine);
+		}
+	}
+
+EXPORT_C void CTestStep::TestCheckPointCompareL(TInt aVal,TInt aExpectedVal, const TDesC& aText, const TText8* aFile,TInt aLine)
+	{
+	if(aVal != aExpectedVal)
+		{
+		// decode formated data for display on console
+		TBuf <KMaxTestExecuteLogLineLength> LineBuf;
+		_LIT(KMessage,"FAILED test:  Val = %d Exp Val = %d %S");
+		LineBuf.AppendFormat(KMessage,aVal,aExpectedVal,&aText);
+		// send the data to the log system via the suite
+		Logger().LogExtra((TText8*)aFile, aLine, ESevrErr, LineBuf );
+		User::Leave(aVal);
+		}
+	}
+
+/**
+ * Returns the server name that instantiated the test step
+ * @return TDesC - CTestServer name
+ */
+EXPORT_C const TDesC& CTestStep::GetServerName() const
+	{
+	return iServerName;
+	}
+
+/**
+ * TestCaseName
+ * Returns boolean true if testcase name is available, false otherwise.
+ * Updates the TDes& to the testcase name if available, blank string otherwise.
+ * @param aTestCaseName - TDes reference to update the test case name
+ * @return TBool - Boolean value indicating presense of test case name
+ */
+EXPORT_C TBool CTestStep::TestCaseName(TDes& aTestCaseName)
+	{
+	if (iTestCaseID.CompareF(KTEFTestCaseDefault) == 0)
+		{
+		aTestCaseName.Copy(KTEFNull);
+		return EFalse;
+		}
+	else
+		{
+		aTestCaseName.Copy(iTestCaseID);
+		return ETrue;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/test/group/testexecuteloggingtest.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+SMPSAFE
+
+TARGET      testexecuteloggingtest.exe
+TARGETTYPE  exe
+UID             0x100039CE 0x101F778D
+VENDORID 0x70000001
+
+SOURCEPATH  ../src
+SOURCE		testexecuteloggingtest.cpp
+
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/test
+
+LIBRARY     	euser.lib
+LIBRARY			testexecuteutils.lib flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/test/src/testexecuteloggingtest.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2005-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:  
+* Unit test for TestExecuteUtils , CTestExecuteLogger
+* Code for logging over serial connection
+* please make sure the logging channel is set to 'Serial' or Both 
+* in the testexecute.ini file for this code to be able to cover the 
+* serial logging code...
+*
+*/
+
+
+
+/**
+ @file TestExecuteLoggingTest.cpp
+*/
+#include <testexecutelogger.h>
+#include <e32cons.h>
+
+_LIT(K16BitText,"This is a short line of 16 Bit Text");
+_LIT8(K8BitText,"This is a short line of  8 Bit Text");
+_LIT(K16BitFormatText,"This is a short line of 16 Bit Format Text int = %d string = %S");
+_LIT8(K8BitFormatText,"This is a short line of  8 Bit Format Text int = %d string = %S");
+_LIT(K16BitString,"The String16");
+_LIT8(K8BitString,"The String8");
+
+
+LOCAL_C void TestWorkAPIsL(CTestExecuteLogger& aLogger,CConsoleBase*& aConsole)
+{
+
+	aConsole->Write(_L("Testing logger.Write(16BitText) \r\n"));
+	aLogger.Write(K16BitText);
+	
+	aConsole->Write(_L("Testing logger.Write(8BitText) \r\n"));
+	aLogger.Write(K8BitText);
+
+	aConsole->Write(_L("Testing logger.WriteFormat(16BitText) \r\n"));
+	TBuf<20> buf16(K16BitString);
+	aLogger.WriteFormat(K16BitFormatText,16,&buf16);
+
+	aConsole->Write(_L("Testing logger.WriteFormat(8BitText) \r\n"));
+	TBuf8<20> buf8(K8BitString);
+	aLogger.WriteFormat(K8BitFormatText,8,&buf8);
+
+	aConsole->Write(_L("Testing logger.LogExtra() \r\n"));
+	aLogger.LogExtra(((TText8*)__FILE__), __LINE__,ESevrInfo,K16BitFormatText,1,&buf16);
+
+	aConsole->Write(_L("Testing logger.PrintCurrentScriptLine() \r\n"));
+	TBuf<30> output(_L("Testing PrintCurrentScriptLine")) ; 
+	aLogger.PrintCurrentScriptLine(output) ; 
+	
+	aConsole->Write(_L("Testing logger.LogTestCaseResult() \r\n"));
+	TBuf<30> file(_L("TestExcuteLoggingTest.cpp"));
+	TInt lineNo(68) ; 
+	TBuf<20> testCsNm(_L("TestCaseSomething"));
+	aLogger.LogTestCaseResult(file, lineNo, ESevrInfo, KTEFEndTestCaseCommand, testCsNm);
+
+	aConsole->Write(_L("Testing logger.LogResult() \r\n"));
+	TBuf<30> panicStringbuf(_L("Panic string")) ; 
+	TBuf<30> fileRes(_L("TestExcuteLoggingTest.cpp"));
+	TInt lineNum(70) ; 
+	TInt severity(RFileFlogger::ESevrHigh) ; 
+
+	aLogger.LogResult(EPass,panicStringbuf,lineNum,KTEFRunTestStepCommand,fileRes,RFileFlogger::ESevrHigh);
+}
+
+
+LOCAL_C void MainL()
+	{
+	_LIT(KTitle,"TestExecuteLogger Test Code for serial logging");
+	CConsoleBase* console = Console::NewL(KTitle,TSize(KConsFullScreen,KConsFullScreen));
+	CleanupStack::PushL(console);
+	CTestExecuteLogger logger;
+
+	TInt logLevel =1  ;
+	TBool separateLogFiles(EFalse); 
+	_LIT(KScriptPath,"E:\\plattest\\Selective.script");
+	TPtrC scriptFilePath(KScriptPath);
+
+	console->Write(_L("logger.InitialiseLoggingL next2 \n")) ; 
+	logger.InitialiseLoggingL(scriptFilePath, separateLogFiles, logLevel);
+	
+	console->Write(_L("post logger.InitialiseLoggingL next \n"));
+	TestWorkAPIsL(logger, console)	;
+	
+	console->Write(_L("attempting TerminateLoggingL \n")) ; 
+	logger.TerminateLoggingL(3, 4, 3); //suggested by todays fortune cookie...
+
+	console->Write(_L("Done testing, press a key to finish \n")) ; 
+	console->Getch() ; 
+	CleanupStack::PopAndDestroy(console);	
+	}
+
+// Entry point for all Epoc32 executables
+// See PSP Chapter 2 Getting Started
+GLDEF_C TInt E32Main()
+	{
+	// Heap balance checking
+	// See PSP Chapter 6 Error Handling
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAPD(err,MainL());
+	_LIT(KPanic,"LoggingTest");
+	__ASSERT_ALWAYS(!err, User::Panic(KPanic,err));
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/bwins/demoipsuiteu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewServer@@YAHXZ @ 1 NONAME ; int __cdecl NewServer(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,40 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+..\scripts\demoipsuite.script		\epoc32\release\wins\udeb\z\demoipsuite\demoipsuite.script
+..\scripts\demoipsuite.script		\epoc32\release\wins\urel\z\demoipsuite\demoipsuite.script
+..\scripts\demoipsuite.script		\epoc32\release\winscw\udeb\z\demoipsuite\demoipsuite.script
+..\scripts\demoipsuite.script		\epoc32\release\winscw\urel\z\demoipsuite\demoipsuite.script
+
+..\testdata\demoipsuite.ini	\epoc32\release\wins\udeb\z\demoipsuite\demoipsuite.ini
+..\testdata\demoipsuite.ini	\epoc32\release\wins\urel\z\demoipsuite\demoipsuite.ini
+..\testdata\demoipsuite.ini	\epoc32\release\winscw\udeb\z\demoipsuite\demoipsuite.ini
+..\testdata\demoipsuite.ini	\epoc32\release\winscw\urel\z\demoipsuite\demoipsuite.ini
+
+..\testdata\demoipsuite.cfg	\epoc32\release\wins\udeb\z\demoipsuite\demoipsuite.cfg
+..\testdata\demoipsuite.cfg	\epoc32\release\wins\urel\z\demoipsuite\demoipsuite.cfg
+..\testdata\demoipsuite.cfg	\epoc32\release\winscw\udeb\z\demoipsuite\demoipsuite.cfg
+..\testdata\demoipsuite.cfg	\epoc32\release\winscw\urel\z\demoipsuite\demoipsuite.cfg
+
+.\demoipsuite.iby   		\epoc32\rom\include\demoipsuite.iby
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+//demoipsuite.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/group/demoipsuite.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,31 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __DEMO_IP_SUITE_IBY__
+#define __DEMO_IP_SUITE_IBY__
+
+//#include <testexecute.iby>
+
+
+file=ABI_DIR\BUILD_DIR\DEBUG_DIR\demoipsuite.exe		SHARED_LIB_DIR\demoipsuite.exe
+
+
+
+data=\epoc32\release\winscw\udeb\z\demoipsuite\demoipsuite.ini demoipsuite\demoipsuite.ini
+data=\epoc32\release\winscw\udeb\z\demoipsuite\demoipsuite.script demoipsuite\demoipsuite.Script
+data=\epoc32\release\winscw\udeb\z\demoipsuite\demoipsuite.cfg demoipsuite\demoipsuite.cfg
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/group/demoipsuite.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+SMPSAFE
+
+TARGET      demoipsuite.exe
+TARGETTYPE  exe
+UID             0x100039CE 0x101F7784
+VENDORID 0x70000001
+
+SOURCEPATH  ../src
+SOURCE		ipsuiteserver.cpp
+SOURCE		ipsuitestepbase.cpp
+SOURCE		tcpstep.cpp
+SOURCE		udpstep.cpp
+	
+
+USERINCLUDE   ../src
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/test
+
+LIBRARY     euser.lib
+LIBRARY		testexecuteutils.lib 
+LIBRARY		testexecutelogclient.lib 
+LIBRARY		insock.lib
+LIBRARY		esock.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/scripts/demoipsuite.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2005-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: 
+//
+PRINT Run all Demo IP Suite Tests
+
+//
+LOAD_SUITE DemoIPSuite
+//
+RUN_UTILS MakeDir ${SYSDRIVE}\DemoIPSuite\
+RUN_UTILS MakeReadWrite ${SYSDRIVE}\DemoIPSuite\DemoIPSuite.ini
+RUN_UTILS CopyFile z:\DemoIPSuite\DemoIPSuite.ini ${SYSDRIVE}\DemoIPSuite\DemoIPSuite.ini 
+RUN_TEST_STEP 100	DemoIPSuite DemoTCPStep ${SYSDRIVE}\DemoIPSuite\DemoIPSuite.ini SectionOne
+RUN_TEST_STEP 100	DemoIPSuite DemoUDPStep ${SYSDRIVE}\DemoIPSuite\DemoIPSuite.ini SectionTwo
+RUN_TEST_STEP 100	DemoIPSuite DemoUDPStep ${SYSDRIVE}\DemoIPSuite\DemoIPSuite.ini SectionTwo
+RUN_TEST_STEP 100	DemoIPSuite DemoUDPStep ${SYSDRIVE}\DemoIPSuite\DemoIPSuite.ini SectionTwo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuitedefs.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file IPSuiteDefs.h
+*/
+
+// Keys in the configuration ini file
+_LIT(KDemoSuiteIPAddress,"Ip_Addr");
+_LIT(KDemoSuiteTestData,"Test_Data");
+_LIT(KDemoSuiteIPPort,"Port");
+
+// For test step panics
+_LIT(KDemoIPSuitePanic,"DemoIPSuite");
+enum TDemoSuitePanicCodes{ETCPDataCorrupt = 1,EUDPDataCorrupt};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuiteserver.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2005-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:  
+* Example file/test code to demonstrate how to develop a TestExecute Server
+* Developers should take this project as a template and substitute their own
+* code at the __EDIT_ME__ tags
+* for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
+* in the process of the client. The client initialises the server by calling the
+* one and only ordinal.
+*
+*/
+
+
+
+/**
+ @file IPSuiteServer.cpp
+*/
+
+// __EDIT_ME__ Include your own server header file and step header file(s) here
+#include "ipsuiteserver.h"
+#include "tcpstep.h"
+#include "udpstep.h"
+
+// __EDIT_ME__ - Substitute the name of your test server 
+_LIT(KServerName,"DemoIPSuite");
+// __EDIT_ME__ - Use your own server class name
+CDemoIPSuite* CDemoIPSuite::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+	{
+// __EDIT_ME__ - Use your own server class name
+	CDemoIPSuite * server = new (ELeave) CDemoIPSuite();
+	CleanupStack::PushL(server);
+	// CServer base class call
+	server->StartL(KServerName);
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+
+// Secure variants much simpler
+// Just an E32Main and a MainL()
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().DataCaging(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler* sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+// __EDIT_ME__ - Use your own server class name
+	CDemoIPSuite* server = NULL;
+	// Create the CTestServer derived server
+	TRAPD(err,server = CDemoIPSuite::NewL());
+	if(!err)
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	delete server;
+	delete sched;
+	}
+
+
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
+
+
+// __EDIT_ME__ - Use your own server class name
+CTestStep* CDemoIPSuite::CreateTestStep(const TDesC& aStepName)
+/**
+ * @return - A CTestStep derived instance
+ * Secure and non-secure variants
+ * Implementation of CTestServer pure virtual
+ */
+	{
+	CTestStep* testStep = NULL;
+	// __EDIT_ME__ - Create your own test steps here
+	// This server creates just two steps but create as many as you want
+	// They are created "just in time" when the worker thread is created
+	#if !(defined TEF_LITE)
+	if(aStepName == KDemoTCPStep)
+		testStep = new CTCPStep();
+	else if(aStepName == KDemoUDPStep)
+		testStep = new CUDPStep();
+	#endif
+	return testStep;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuiteserver.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file IPSuiteServer.h
+*/
+// __EDIT_ME__ Create your own class definition based on this
+#if (!defined __IP_SUITE_SERVER_H__)
+#define __IP_SUITE_SERVER_H__
+#include <testexecuteserverbase.h>
+
+class CDemoIPSuite : public CTestServer
+	{
+public:
+	static CDemoIPSuite* NewL();
+	// Base class pure virtual override
+	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
+private:
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuitestepbase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file IPSuiteStepBase.cpp
+*/
+
+#include "ipsuitestepbase.h"
+#include "ipsuitedefs.h"
+
+// Device driver constants
+#if (defined __WINS__)
+_LIT(KPdd,"ECDRV");
+#else
+_LIT(KPdd,"EUART1");
+#endif
+_LIT(KLdd,"ECOMM");
+
+TVerdict CIPSuiteStepBase::doTestStepPreambleL()
+/**
+ * @return - TVerdict
+ * Implementation of CTestStep base class virtual
+ * Do all initialisation common to derived classes in here.
+ * Just leave if there are any errors here as there's no point in
+ * trying to run a test step if anything fails.
+ * The leave will be picked up by the framework.
+ */
+	{
+	// For the emulator and 2 box solutions we need to load the
+	// physical device drivers
+	// Leave if there are any errors
+	TInt ret = KErrNone;
+	ret = User::LoadPhysicalDevice(KPdd);
+	if(ret != KErrNone && ret != KErrAlreadyExists)
+		User::Leave(ret);
+	ret = User::LoadLogicalDevice(KLdd);
+	if(ret != KErrNone && ret != KErrAlreadyExists)
+		User::Leave(ret);
+
+	// Read the ini file to get the destination IP address and the data
+	TPtrC IPAddr;
+	TPtrC configWriteData;
+	TInt port = 7;
+	if(!GetStringFromConfig(ConfigSection(),KDemoSuiteIPAddress, IPAddr) ||
+	   !GetStringFromConfig(ConfigSection(),KDemoSuiteTestData,configWriteData) ||
+	   !GetIntFromConfig(ConfigSection(),KDemoSuiteIPPort,port)
+		)
+		// Leave if there's any error.
+		User::Leave(KErrNotFound);
+	// Connect to the socket server
+	User::LeaveIfError(iServer.Connect());
+
+	// Set the ip address class
+	// Could read the port from the ini file
+	iDestAddr.Input(IPAddr);
+	iDestAddr.SetPort(port);
+
+	// Set up the read and write buffers
+	iReadData = HBufC8::NewMaxL(configWriteData.Length());
+	iWriteData = HBufC8::NewMaxL(configWriteData.Length());
+	iWriteData->Des().Copy(configWriteData);	
+
+	SetTestStepResult(EPass);
+	return TestStepResult();
+	}
+
+CIPSuiteStepBase::~CIPSuiteStepBase()
+	{
+	iServer.Close();
+	delete iReadData;
+	delete iWriteData;
+	}
+
+CIPSuiteStepBase::CIPSuiteStepBase()
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/ipsuitestepbase.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file IPSuiteStepBase.h
+*/
+
+#if (!defined __IP_SUITE_STEP_BASE__)
+#define __IP_SUITE_STEP_BASE__
+#include <testexecutestepbase.h>
+#if !(defined TEF_LITE)
+#include <in_sock.h>
+#include <es_sock.h>
+#endif
+class CIPSuiteStepBase : public CTestStep
+	{
+public:
+	virtual ~CIPSuiteStepBase();
+	CIPSuiteStepBase();
+	virtual TVerdict doTestStepPreambleL();
+protected:
+	HBufC8*		iReadData;
+	HBufC8*		iWriteData;
+	#if !(defined TEF_LITE)
+	RSocketServ iServer;
+	TInetAddr	iDestAddr;
+	#endif
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/tcpstep.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2005-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:  
+* Example CTestStep derived implementation
+*
+*/
+
+
+
+/**
+ @file TCPStep.cpp
+*/
+#include "tcpstep.h"
+#include "ipsuitedefs.h"
+
+CTCPStep::~CTCPStep()
+/**
+ * Destructor
+ */
+	{
+	}
+
+CTCPStep::CTCPStep()
+/**
+ * Constructor
+ */
+	{
+	// **MUST** call SetTestStepName in the constructor as the controlling
+	// framework uses the test step name immediately following construction to set
+	// up the step's unique logging ID.
+	SetTestStepName(KDemoTCPStep);
+	}
+
+TVerdict CTCPStep::doTestStepL()
+/**
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ * Our implementation only gets called if the base class doTestStepPreambleL() did
+ * not leave. That being the case, the current test result value will be EPass.
+ */
+	{
+	RSocket socket;
+	User::LeaveIfError(socket.Open(iServer, KAfInet, KSockStream, KProtocolInetTcp));
+	CleanupClosePushL(socket);
+
+	TRequestStatus status;
+	socket.Connect(iDestAddr,status);
+	User::WaitForRequest(status);
+	User::LeaveIfError(status.Int());
+	
+	TBuf<50> IPAddrBuf;
+	iDestAddr.Output(IPAddrBuf);
+	_LIT(KSendDataMessage,"Send Data to %S Port = %d Length = %d");
+	INFO_PRINTF4(KSendDataMessage,&IPAddrBuf,iDestAddr.Port(),iWriteData->Des().Length());
+	
+	TPtr8 writeDataDes(iWriteData->Des());
+	socket.Write(writeDataDes,status);
+	User::WaitForRequest(status);
+	User::LeaveIfError(status.Int());
+
+	// For TCP only. We can check to see if the server has the ACK'd the data using
+	// an Ioctl on the socket
+	socket.Ioctl(KIoctlTcpNotifyDataSent,status, 0, KSolInetTcp);
+	User::WaitForRequest(status);
+	User::LeaveIfError(status.Int());
+
+	_LIT(KSentDataMessage,"Data Sent");
+	INFO_PRINTF1(KSentDataMessage);
+
+	// Use Recv in this case
+	// The status is not completed until the descriptor is full
+	// or there is a socket error/timeout -22
+	TPtr8 readDataDes(iReadData->Des());
+	socket.Recv(readDataDes,0,status);
+	User::WaitForRequest(status);
+	User::LeaveIfError(status.Int());
+
+	_LIT(KRecvDataMessage,"Data Received Length = %d");
+	INFO_PRINTF2(KRecvDataMessage,readDataDes.Length());
+
+	// The receive data should always match the sent
+	// Try deliberately corrupting the send or receive descriptor and
+	// the panic will be picked up in the script engine
+	__ASSERT_ALWAYS(readDataDes == writeDataDes,User::Panic(KDemoIPSuitePanic,ETCPDataCorrupt));
+
+	socket.Close();
+
+	CleanupStack::Pop(1);			// Server and Socket Handles
+	
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/tcpstep.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file TCPStep.h
+*/
+#if (!defined __TCP_STEP_H__)
+#define __TCP_STEP_H__
+#include <testexecutestepbase.h>
+#if !(defined TEF_LITE)
+#include <in_sock.h>
+#include <es_sock.h>
+#endif
+#include "ipsuitestepbase.h"
+
+// __EDIT_ME__ - Create your own test step definition
+class CTCPStep : public CIPSuiteStepBase
+	{
+public:
+	CTCPStep();
+	~CTCPStep();
+	virtual TVerdict doTestStepL();
+private:
+	};
+
+// EDIT_ME__ - Use your own class step name
+_LIT(KDemoTCPStep,"DemoTCPStep");
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/udpstep.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-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:  
+* Example CTestStep derived implementation
+*
+*/
+
+
+
+/**
+ @file UDPStep.cpp
+*/
+#include "udpstep.h"
+#include "ipsuitedefs.h"
+
+CUDPStep::~CUDPStep()
+/**
+ * Destructor
+ */
+	{
+	}
+
+CUDPStep::CUDPStep()
+/**
+ * Constructor
+ */
+	{
+	// **MUST** call SetTestStepName in the constructor as the controlling
+	// framework uses the test step name immediately following construction to set
+	// up the step's unique logging ID.
+	SetTestStepName(KDemoUDPStep);
+	}
+
+TVerdict CUDPStep::doTestStepL()
+/**
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ * Our implementation only gets called if the base class doTestStepPreambleL() did
+ * not leave. That being the case, the current test result value will be EPass.
+ */
+	{
+
+	RSocket socket;
+	User::LeaveIfError(socket.Open(iServer, KAfInet, KSockDatagram, KProtocolInetUdp));
+	CleanupClosePushL(socket);
+
+	// Get the IP Address into a 16 bit descriptor to print it
+	TBuf<50> IPAddrBuf;
+	iDestAddr.Output(IPAddrBuf);
+	_LIT(KSendDataMessage,"Send Data to %S Port = %d Length = %d");
+	TPtr8 writeDataDes(iWriteData->Des());
+	INFO_PRINTF4(KSendDataMessage,&IPAddrBuf,iDestAddr.Port(),writeDataDes.Length());
+
+	TRequestStatus status;
+	socket.SendTo(writeDataDes,iDestAddr, 0,status);
+	User::WaitForRequest(status);
+	User::LeaveIfError(status.Int());
+
+	_LIT(KSentDataMessage,"Data Sent");
+	INFO_PRINTF1(KSentDataMessage);
+
+	// Use RecvFrom in this case
+	// The status is not completed until the descriptor is full
+	// or there is a socket error/timeout -22
+	TPtr8 readDataDes(iReadData->Des());
+	socket.RecvFrom(readDataDes,iDestAddr, 0, status);
+	User::WaitForRequest(status);
+	User::LeaveIfError(status.Int());
+
+	_LIT(KRecvDataMessage,"Data Received Length = %d");
+	INFO_PRINTF2(KRecvDataMessage,readDataDes.Length());
+
+	// The receive data should always match the sent
+	// Try deliberately corrupting the send or receive descriptor and
+	// the panic will be picked up in the script engine
+	__ASSERT_ALWAYS(readDataDes == writeDataDes,User::Panic(KDemoIPSuitePanic,EUDPDataCorrupt));
+
+	socket.Close();
+
+	CleanupStack::Pop(1);			// Server and Socket Handles
+
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/src/udpstep.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file UDPStep.h
+*/
+#if (!defined __UDP_STEP_H__)
+#define __UDP_STEP_H__
+#include <TestExecuteStepBase.h>
+#if !(defined TEF_LITE)
+#include <in_sock.h>
+#include <es_sock.h>
+#endif
+#include "ipsuitestepbase.h"
+
+// __EDIT_ME__ - Create your own test step definition
+class CUDPStep : public CIPSuiteStepBase
+	{
+public:
+	CUDPStep();
+	~CUDPStep();
+	virtual TVerdict doTestStepL();
+private:
+	};
+// EDIT_ME__ - Use your own class step name
+_LIT(KDemoUDPStep,"DemoUDPStep");
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/testdata/demoipsuite.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1763 @@
+//
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+############################################################
+## AUTO-GENERATED CONFIGURATION FILE
+## CommDB Database Dump Utility
+## 1.1
+############################################################
+
+############################################################
+## Network
+## 
+[Network]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=Intranet
+	FIELD_COUNT=1
+END_ADD
+
+
+############################################################
+## ModemBearer
+## 
+[ModemBearer]
+ADD_TEMPLATE
+	Name=Default Modem
+	Agent=CSD.agt
+	IfName=PPP
+	PortName=COMM::0
+	TSYName=MM
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=115200
+	Handshaking=0
+	SpecialRate=0
+	XonChar=0
+	XoffChar=0
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=AT
+	DataInitString=AT
+	FaxInitString=AT
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=30
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=30
+	FIELD_COUNT=67
+END_TEMPLATE
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=Null Modem 115200bps
+	Agent=CSD.agt
+	IfName=PPP
+	PortName=COMM::0
+	TSYName=MM
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=115200
+	Handshaking=52
+	SpecialRate=0
+	XonChar=0
+	XoffChar=0
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=AT
+	DataInitString=AT
+	FaxInitString=AT
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=TRUE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=30
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=30
+	FIELD_COUNT=67
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=US Robotics Sportster
+	Agent=CSD.agt
+	IfName=PPP
+	PortName=COMM::0
+	TSYName=MM
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=57600
+	Handshaking=244
+	SpecialRate=0
+	XonChar=0
+	XoffChar=0
+	FaxClassPref=AUTO
+	SpeakerPref=AFTERDIALUNTILANSWER
+	SpeakerVolPref=QUIET
+	ModemInitString=AT&F1
+	DataInitString=AT
+	FaxInitString=AT&d2
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=30
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=30
+	FIELD_COUNT=67
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=Dacom Surfer
+	Agent=CSD.agt
+	IfName=PPP
+	PortName=COMM::0
+	TSYName=MM
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=57600
+	Handshaking=244
+	SpecialRate=0
+	XonChar=0
+	XoffChar=0
+	FaxClassPref=AUTO
+	SpeakerPref=AFTERDIALUNTILANSWER
+	SpeakerVolPref=QUIET
+	ModemInitString=AT&F
+	DataInitString=AT
+	FaxInitString=AT&d2
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=6
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=10
+	FIELD_COUNT=67
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=GSM Mobile Phone via Infrared
+	Agent=CSD.agt
+	IfName=PPP
+	PortName=IRCOMM::0
+	TSYName=MM
+	CSYName=IRCOMM
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=115200
+	Handshaking=196
+	SpecialRate=0
+	XonChar=17
+	XoffChar=19
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=ATZ
+	DataInitString=AT
+	FaxInitString=AT
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=6
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=10
+	FIELD_COUNT=67
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 6
+	Name=GSM Mobile Phone via Serial
+	Agent=CSD.agt
+	IfName=PPP
+	PortName=COMM::0
+	TSYName=MM
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=19200
+	Handshaking=196
+	SpecialRate=0
+	XonChar=17
+	XoffChar=19
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=ATZ
+	DataInitString=AT
+	FaxInitString=AT
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=6
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=10
+	FIELD_COUNT=67
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 7
+	Name=GPRS Ericsson R520m via IR
+	Agent=PSD.agt
+	IfName=PPP
+	PortName=IRCOMM::0
+	TSYName=MM
+	CSYName=IRCOMM
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=115200
+	Handshaking=4
+	SpecialRate=0
+	XonChar=17
+	XoffChar=19
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=ATZ
+	DataInitString=AT
+	FaxInitString=AT
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=6
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=10
+	FIELD_COUNT=67
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 8
+	Name=GPRS Ericsson R520m/T68i via Serial
+	Agent=PSD.agt
+	IfName=PPP
+	PortName=COMM::0
+	TSYName=MM
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=19200
+	Handshaking=4
+	SpecialRate=0
+	XonChar=17
+	XoffChar=19
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=ATZ
+	DataInitString=AT
+	FaxInitString=AT
+	IspInitString=*99***1#
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=180
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=180
+	FIELD_COUNT=68
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 9
+	Name=GPRS Motorola Mobile Phone via Serial
+	Agent=PSD.agt
+	IfName=PPP
+	PortName=COMM::0
+	TSYName=MM
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=57600
+	Handshaking=4
+	SpecialRate=0
+	XonChar=17
+	XoffChar=19
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=ATZ
+	DataInitString=AT
+	FaxInitString=AT
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=6
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=10
+	FIELD_COUNT=67
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 10
+	Name=WinTunnel Modem
+	Agent=null.agt
+	IfName=PPP
+	PortName=COMM::6
+	TSYName=MM
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=115200
+	Handshaking=52
+	SpecialRate=0
+	XonChar=0
+	XoffChar=0
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=AT
+	DataInitString=AT
+	FaxInitString=AT
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=FALSE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=30
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=30
+	FIELD_COUNT=67
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 11
+	Name=Null Modem 115200bps
+	Agent=CSD.agt
+	IfName=PPP
+	PortName=COMM::1
+	TSYName=MM2
+	CSYName=ECUART
+	DataBits=8
+	StopBits=1
+	Parity=NONE
+	Rate=115200
+	Handshaking=52
+	SpecialRate=0
+	XonChar=0
+	XoffChar=0
+	FaxClassPref=AUTO
+	SpeakerPref=NEVER
+	SpeakerVolPref=QUIET
+	ModemInitString=AT
+	DataInitString=AT
+	FaxInitString=AT
+	DialPauseLength=S8=
+	SpeakerVolContorlLow=L0
+	SpeakerVolControlMedium=L1
+	SpeakerVolControlHigh=L2
+	SpeakerAlwaysOff=M0
+	SpeakerOnUntilCarrier=M1
+	SpeakerAlwaysOn=M2
+	SpeakerOnAfterUntilCarrier=M3
+	DialToneWaitModifier=W
+	CallProgress1=X1
+	CallProgress2=X2
+	CallProgress3=X3
+	CallProgress4=X4
+	EchoOff=E0
+	VerboseText=V1
+	QuietOn=Q1
+	QuietOff=Q0
+	DialCommandStateModifier=;
+	OnLine=O
+	ResetConfiguration=Z
+	ReturnToFactoryDefs=&F
+	DCDOnDuringLink=&C1
+	DTRHangUp=&D2
+	DSRAlwaysOn=&S0
+	RTSCTSHandshake=&K3
+	XonXoffHandshake=&K4
+	EscapeCharacter=+
+	EscapeGuardPeriod=S12
+	NoDialTone=NO DIAL TONE
+	Busy=BUSY
+	NoAnswer=NO ANSWER
+	Carrier=CARRIER
+	Connect=CONNECT
+	CompressionClass5=COMPRESSION:CLASS 5
+	CompressionV42bis=COMPRESSION:V.42 bis
+	CompressionNone=COMPRESSION:NONE
+	ProtocolLAPD=PROTOCOL:LAPD
+	ProtocolALT=PROTOCOL:ALT
+	ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR
+	ProtocolNone=PROTOCOL:NONE
+	MessageCentreNumber=+44123456789
+	MessageValidityPeriod=1440
+	MessageDeliveryReport=TRUE
+	MinimumSignalLevel=9905
+	LastSocketActivityTimeout=30
+	LastSessionClosedTimeout=180
+	LastSocketClosedTimeout=30
+	FIELD_COUNT=67
+END_ADD
+
+############################################################
+## LANBearer
+## 
+[LANBearer]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=Assabet on-board Ethernet
+	Agent=nullagent.agt
+	IfName=ethint
+	LDDName=not used
+	PDDName=not used
+	LastSocketActivityTimeout=-1
+	LastSessionClosedTimeout=-1
+	LastSocketClosedTimeout=-1
+	FIELD_COUNT=8
+END_ADD
+
+
+############################################################
+## Location
+## 
+[Location]
+ADD_TEMPLATE
+	Name=Default Location
+	IntlPrefixCode=+
+	NatPrefixCode=0
+	NatCode=44
+	Mobile=TRUE
+	UsePulseDial=FALSE
+	WaitForDialTone=FALSE
+	PauseAfterDialout=0
+	FIELD_COUNT=8
+END_TEMPLATE
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=Office
+	IntlPrefixCode=00
+	NatPrefixCode=0
+	NatCode=44
+	AreaCode=171
+	DialOutCode=9,
+	Mobile=FALSE
+	UsePulseDial=FALSE
+	WaitForDialTone=FALSE
+	PauseAfterDialout=0
+	FIELD_COUNT=10
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=Office Direct Dial
+	IntlPrefixCode=00
+	NatPrefixCode=0
+	NatCode=44
+	AreaCode=171
+	Mobile=FALSE
+	UsePulseDial=FALSE
+	WaitForDialTone=FALSE
+	PauseAfterDialout=0
+	FIELD_COUNT=9
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=Mobile
+	IntlPrefixCode=+
+	NatPrefixCode=0
+	NatCode=44
+	Mobile=TRUE
+	UsePulseDial=FALSE
+	WaitForDialTone=FALSE
+	PauseAfterDialout=0
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=Home
+	IntlPrefixCode=00
+	NatPrefixCode=0
+	NatCode=44
+	AreaCode=181
+	Mobile=FALSE
+	UsePulseDial=TRUE
+	WaitForDialTone=TRUE
+	PauseAfterDialout=0
+	FIELD_COUNT=9
+END_ADD
+
+
+############################################################
+## Chargecard
+## 
+[Chargecard]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=Dummy BT Chargecard
+	AccountNumber=144,12345678
+	Pin=0000
+	LocalRule=HG
+	NatRule=HFG
+	IntlRule=HEFG
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=Dummy Mercury Chargecard
+	AccountNumber=0500800800,,12345678
+	Pin=****
+	LocalRule=HG
+	NatRule=J,K,0FG
+	IntlRule=HEFG
+	FIELD_COUNT=6
+END_ADD
+
+
+############################################################
+## GlobalSettings
+## 
+[GlobalSettings]
+ADD_SECTION
+	WAPAccessPoint=1
+	RedialAttempts=3
+	SmsBearer=1
+	SmsReceiveMode=2
+	GPRSAttachMode=1
+	AcceptIncomingGprs=1
+	GPRSClassCBearer=GSM
+	ConnectionAttempts=2
+	ModemForDataAndFax=2
+	ModemForPhoneServicesAndSMS=2
+	LocationForDataAndFax=2
+	LocationForPhoneServicesAndSMS=2
+	DefaultNetwork=1
+	BearerAvailabilityCheckTSY=mm
+	FIELD_COUNT=14
+END_ADD
+
+
+############################################################
+## DialOutISP
+## 
+[DialOutISP]
+ADD_TEMPLATE
+	Name=Default Dial Out ISP
+	DialResolution=TRUE
+	UseLoginScript=FALSE
+	PromptForLogin=TRUE
+	DisplayPCT=FALSE
+	IfPromptForAuth=TRUE
+	IfCallbackEnabled=FALSE
+	CallbackTimeout=0
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	BearerService=0
+	BearerProtocol=0
+	RlpVersion=0
+	IwfToMs=0
+	MsToIwf=0
+	AckTimer=0
+	RetransmissionAttempts=0
+	ResequencePeriod=0
+	V42Compression=0
+	V42Codewords=0
+	V42MaxLength=0
+	Asymmetry=0
+	UserInitUpgrade=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=28
+END_TEMPLATE
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=NT RAS
+	Description=Test
+	Type=INTERNETONLY
+	DialResolution=TRUE
+	UseLoginScript=TRUE
+	LoginScript=CHARMAP \[windows-1252\]\nLOOP 10\n{\nSEND "CLIENT"+<0x0d>\nWAIT 3\n{\n"SERVER" OK\n}\n}\nEXIT KErrNoAnswer$\n\nOK:\nEXIT\n
+	PromptForLogin=FALSE
+	DisplayPCT=FALSE
+	IfNetworks=ip,ip6
+	IfPromptForAuth=FALSE
+	IfAuthName=RasUser
+	IfAuthPass=pass
+	AuthRetries=0
+	IfCallbackEnabled=FALSE
+	CallbackTimeout=0
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	BearerName=ASYNCHRONOUS
+	BearerSpeed=UNSPECIFIED
+	BearerCE=UNSPECIFIED
+	BearerType=CSD
+	ChannelCoding=UNSPECIFIED
+	AIUR=UNSPECIFIED
+	RequestedTimeSlots=0
+	MaximumTimeSlots=0
+	BearerService=0
+	BearerProtocol=0
+	RlpVersion=0
+	IwfToMs=0
+	MsToIwf=0
+	AckTimer=0
+	RetransmissionAttempts=0
+	ResequencePeriod=0
+	V42Compression=0
+	V42Codewords=0
+	V42MaxLength=0
+	Asymmetry=0
+	UserInitUpgrade=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=43
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=ISP01
+	Description=PlaceHolder for ISP01
+	Type=INTERNETONLY
+	DialResolution=TRUE
+	UseLoginScript=FALSE
+	PromptForLogin=FALSE
+	DisplayPCT=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=TRUE
+	IfAuthName=xxx
+	IfAuthPass=yyy
+	AuthRetries=0
+	IfCallbackEnabled=FALSE
+	CallbackTimeout=0
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	BearerService=0
+	BearerProtocol=0
+	RlpVersion=0
+	IwfToMs=0
+	MsToIwf=0
+	AckTimer=0
+	RetransmissionAttempts=0
+	ResequencePeriod=0
+	V42Compression=0
+	V42Codewords=0
+	V42MaxLength=0
+	Asymmetry=0
+	UserInitUpgrade=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=34
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=ISP02
+	Description=PlaceHolder for ISP02
+	Type=INTERNETONLY
+	DialResolution=TRUE
+	UseLoginScript=FALSE
+	PromptForLogin=FALSE
+	DisplayPCT=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=TRUE
+	IfAuthName=xxx
+	IfAuthPass=yyy
+	AuthRetries=0
+	IfCallbackEnabled=FALSE
+	CallbackTimeout=0
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	BearerService=0
+	BearerProtocol=0
+	RlpVersion=0
+	IwfToMs=0
+	MsToIwf=0
+	AckTimer=0
+	RetransmissionAttempts=0
+	ResequencePeriod=0
+	V42Compression=0
+	V42Codewords=0
+	V42MaxLength=0
+	Asymmetry=0
+	UserInitUpgrade=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=34
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=ISP03
+	Description=PlaceHolder for ISP03
+	Type=INTERNETONLY
+	DialResolution=TRUE
+	UseLoginScript=FALSE
+	PromptForLogin=FALSE
+	DisplayPCT=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=TRUE
+	IfAuthName=xxx
+	IfAuthPass=yyy
+	AuthRetries=0
+	IfCallbackEnabled=FALSE
+	CallbackTimeout=0
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	BearerService=0
+	BearerProtocol=0
+	RlpVersion=0
+	IwfToMs=0
+	MsToIwf=0
+	AckTimer=0
+	RetransmissionAttempts=0
+	ResequencePeriod=0
+	V42Compression=0
+	V42Codewords=0
+	V42MaxLength=0
+	Asymmetry=0
+	UserInitUpgrade=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=34
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 6
+	Name=ISP04
+	Description=PlaceHolder for ISP04
+	Type=INTERNETONLY
+	DialResolution=TRUE
+	UseLoginScript=FALSE
+	PromptForLogin=FALSE
+	DisplayPCT=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=TRUE
+	IfAuthName=xxx
+	IfAuthPass=yyy
+	AuthRetries=0
+	IfCallbackEnabled=FALSE
+	CallbackTimeout=0
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	BearerService=0
+	BearerProtocol=0
+	RlpVersion=0
+	IwfToMs=0
+	MsToIwf=0
+	AckTimer=0
+	RetransmissionAttempts=0
+	ResequencePeriod=0
+	V42Compression=0
+	V42Codewords=0
+	V42MaxLength=0
+	Asymmetry=0
+	UserInitUpgrade=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=34
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 7
+	Name=ISP05
+	Description=PlaceHolder for ISP05
+	Type=INTERNETONLY
+	DialResolution=TRUE
+	UseLoginScript=FALSE
+	PromptForLogin=FALSE
+	DisplayPCT=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=TRUE
+	IfAuthName=xxx
+	IfAuthPass=yyy
+	AuthRetries=0
+	IfCallbackEnabled=FALSE
+	CallbackTimeout=0
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	BearerService=0
+	BearerProtocol=0
+	RlpVersion=0
+	IwfToMs=0
+	MsToIwf=0
+	AckTimer=0
+	RetransmissionAttempts=0
+	ResequencePeriod=0
+	V42Compression=0
+	V42Codewords=0
+	V42MaxLength=0
+	Asymmetry=0
+	UserInitUpgrade=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=34
+END_ADD
+
+
+############################################################
+## DialInISP
+## 
+[DialInISP]
+ADD_TEMPLATE
+	Name=Default Dial In ISP
+	UseLoginScript=FALSE
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=9
+END_TEMPLATE
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=Dial In ISP01
+	UseLoginScript=FALSE
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableIPHeaderComp=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	EnableSWComp=FALSE
+	UseEdge=FALSE
+	FIELD_COUNT=9
+END_ADD
+
+
+############################################################
+## OutgoingGPRS
+## 
+[OutgoingGPRS]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=GPRS01
+	APN=gprs01APNPlaceHolder
+	PDPType=IPV4
+	ReqPrecedence=0
+	ReqDelay=0
+	ReqReliability=0
+	ReqPeakThroughput=0
+	ReqMeanThroughput=0
+	MinPrecedence=0
+	MinDelay=0
+	MinReliability=0
+	MinPeakThroughput=0
+	MinMeanThroughput=0
+	DataCompression=FALSE
+	HeaderCompression=FALSE
+	GprsUseEdge=FALSE
+	AnonymousAccess=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=FALSE
+	AuthRetries=1
+	IpDNSAddrFromServer=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	IpAddrFromServer=TRUE
+	GprsAccessPointType=0
+	QosWarningTimeout=0
+	FIELD_COUNT=26
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=GPRS02
+	APN=gprs02APNPlaceHolder
+	PDPType=IPV4
+	ReqPrecedence=0
+	ReqDelay=0
+	ReqReliability=0
+	ReqPeakThroughput=0
+	ReqMeanThroughput=0
+	MinPrecedence=0
+	MinDelay=0
+	MinReliability=0
+	MinPeakThroughput=0
+	MinMeanThroughput=0
+	DataCompression=FALSE
+	HeaderCompression=FALSE
+	GprsUseEdge=FALSE
+	AnonymousAccess=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=FALSE
+	AuthRetries=1
+	IpDNSAddrFromServer=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	IpAddrFromServer=TRUE
+	GprsAccessPointType=0
+	QosWarningTimeout=0
+	FIELD_COUNT=26
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=GPRS03
+	APN=gprs03APNPlaceHolder
+	PDPType=IPV4
+	ReqPrecedence=0
+	ReqDelay=0
+	ReqReliability=0
+	ReqPeakThroughput=0
+	ReqMeanThroughput=0
+	MinPrecedence=0
+	MinDelay=0
+	MinReliability=0
+	MinPeakThroughput=0
+	MinMeanThroughput=0
+	DataCompression=FALSE
+	HeaderCompression=FALSE
+	GprsUseEdge=FALSE
+	AnonymousAccess=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=FALSE
+	AuthRetries=1
+	IpDNSAddrFromServer=FALSE
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	IpAddrFromServer=TRUE
+	GprsAccessPointType=0
+	QosWarningTimeout=0
+	FIELD_COUNT=26
+END_ADD
+
+
+############################################################
+## IncomingGPRS
+## 
+[IncomingGPRS]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=Incoming GPRS Settings PlaceHolder
+	APN=Test
+	PDPType=IPV4
+	ReqPrecedence=1
+	ReqDelay=1
+	ReqReliability=1
+	ReqPeakThroughput=1
+	ReqMeanThroughput=1
+	MinPrecedence=1
+	MinDelay=1
+	MinReliability=1
+	MinPeakThroughput=1
+	MinMeanThroughput=1
+	DataCompression=FALSE
+	HeaderCompression=FALSE
+	GprsUseEdge=FALSE
+	AnonymousAccess=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=FALSE
+	IfAuthName=RasUser
+	IfAuthPass=pass
+	AuthRetries=1
+	IpDNSAddrFromServer=TRUE
+	IpNameServer1=0.0.0.0
+	IpNameServer2=0.0.0.0
+	EnableLCPExtension=FALSE
+	DisablePlainTextAuth=FALSE
+	PDPAddress=0.0.0.0
+	IpAddrFromServer=TRUE
+	FIELD_COUNT=29
+END_ADD
+
+
+############################################################
+## DefaultGPRS
+## 
+[DefaultGPRS]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=Dummy Default GPRS Settings
+	Usage=1
+	APN=Access point name
+	PDPType=IPV6
+	PDPAddress=www.wid.com
+	Precedence=1
+	Delay=1
+	Reliability=1
+	PeakThroughput=1
+	MeanThroughput=1
+	MinPrecedence=1
+	MinDelay=1
+	MinReliability=1
+	MinPeakThroughput=1
+	MinMeanThroughput=1
+	DataCompression=TRUE
+	HeaderCompression=TRUE
+	GprsUseEdge=FALSE
+	AnonymousAccess=TRUE
+	FIELD_COUNT=19
+END_ADD
+
+
+############################################################
+## CDMA2000PacketServiceTable
+## 
+[CDMA2000PacketServiceTable]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=test name cdma2000
+	IwfName=Test2000
+	ServiceOption=HIGHSPEEDCDMA2000DATA
+	PdpType=IPV4
+	ReqFwdPriority=PRIORITY04
+	ReqRevPriority=PRIORITY04
+	ReqFwdBitrate=32KBPS
+	ReqRevBitrate=32KBPS
+	ReqFwdLoss=LOSS1
+	ReqRevLoss=LOSS1
+	ReqFwdMaxdelay=40MS
+	ReqRevMaxdelay=40MS
+	MinFwdBitrate=32KBPS
+	MinRevBitrate=32KBPS
+	AccptFwdLoss=LOSS2
+	AccptRevLoss=LOSS2
+	AccptFwdMaxdelay=120MS
+	AccptRevMaxdelay=120MS
+	DataCompression=FALSE
+	HeaderCompression=FALSE
+	AnonymousAccess=FALSE
+	IfNetworks=ip
+	IfPromptForAuth=FALSE
+	IfAuthName=RasUser
+	IfAuthPass=pass
+	AuthRetries=1
+	IpNetMask=0.255.255.255
+	IpGateway=10.0.0.1
+	IpAddrFromServer=TRUE
+	IpDNSAddrFromServer=TRUE
+	EnableLCPExtension=TRUE
+	DisablePlainTextAuth=TRUE
+	ApType=2
+	QosWarningTimeout=1000000
+	RlpMode=TRANSPARENT
+	CDMAMobileIP=FALSE
+	CDMAMobileIPTimeout=10000000
+	FIELD_COUNT=37
+END_ADD
+
+
+############################################################
+## DefaultCDMA2000SettingsTable
+## 
+[DefaultCDMA2000SettingsTable]
+
+############################################################
+## LANService
+## 
+[LANService]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=Ethernet
+	IfNetworks=ip,ip6
+	IpNetMask=255.255.255.0
+	IpGateway=194.72.6.1
+	IpAddrFromServer=TRUE
+	IpAddr=192.168.0.100
+	IpDNSAddrFromServer=FALSE
+	IpNameServer1=194.72.6.51
+	IpNameServer2=194.72.6.52
+	FIELD_COUNT=9
+END_ADD
+
+
+############################################################
+## IAP
+## 
+[IAP]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=NT RAS with Null Modem
+	IAPService=2
+	IAPServiceType=DialOutISP
+	IAPBearer=2
+	IAPBearerType=ModemBearer
+	IAPNetwork=1
+	IAPNetworkWeighting=0
+	Location=2
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=CSD IAP PlaceHolder01
+	IAPService=3
+	IAPServiceType=DialOutISP
+	IAPBearer=2
+	IAPBearerType=ModemBearer
+	IAPNetwork=1
+	IAPNetworkWeighting=0
+	Location=2
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=CSD IAP PlaceHolder02
+	IAPService=4
+	IAPServiceType=DialOutISP
+	IAPBearer=2
+	IAPBearerType=ModemBearer
+	IAPNetwork=1
+	IAPNetworkWeighting=0
+	Location=2
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=GPRS IAP PlaceHolder01
+	IAPService=1
+	IAPServiceType=OutgoingGPRS
+	IAPBearer=8
+	IAPBearerType=ModemBearer
+	IAPNetwork=1
+	IAPNetworkWeighting=0
+	Location=4
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=GPRS IAP PlaceHolder02
+	IAPService=2
+	IAPServiceType=OutgoingGPRS
+	IAPBearer=8
+	IAPBearerType=ModemBearer
+	IAPNetwork=1
+	IAPNetworkWeighting=0
+	Location=4
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 6
+	Name=WinTunnel on Epoc Com1
+	IAPService=2
+	IAPServiceType=DialOutISP
+	IAPBearer=11
+	IAPBearerType=ModemBearer
+	IAPNetwork=1
+	IAPNetworkWeighting=0
+	Location=2
+	FIELD_COUNT=8
+END_ADD
+
+
+############################################################
+## ConnectionPreferences
+## 
+[ConnectionPreferences]
+ADD_SECTION
+	Ranking=0
+	Direction=OUTGOING
+	DialogPref=DONOTPROMPT
+	BearerSet=CSD
+	IAP=1
+	FIELD_COUNT=5
+END_ADD
+
+ADD_SECTION
+	Ranking=1
+	Direction=OUTGOING
+	DialogPref=DONOTPROMPT
+	BearerSet=CSD
+	IAP=1
+	FIELD_COUNT=5
+END_ADD
+
+
+############################################################
+## BTDeviceTable
+## 
+[BTDeviceTable]
+
+############################################################
+## BTSecurityTable
+## 
+[BTSecurityTable]
+
+############################################################
+## BTDefaultTable
+## 
+[BTDefaultTable]
+
+############################################################
+## Proxies
+## 
+[Proxies]
+ADD_SECTION
+# COMMDB_ID = 1
+	ISP=2
+	ProxyServiceType=DialOutISP
+	UseProxyServer=TRUE
+	ProxyServerName=www.dummyproxy.com
+	ProtocolName=http
+	PortNumber=80
+	Exceptions=www.dummyproxy.com/exception
+	FIELD_COUNT=7
+END_ADD
+
+
+############################################################
+## AgentLookup
+## 
+[AgentLookup]
+
+############################################################
+## WAPAccessPoint
+## 
+[WAPAccessPoint]
+ADD_TEMPLATE
+	Name=Default Dial In ISP
+	CurrentBearer=WAPIPBearer
+	FIELD_COUNT=2
+END_TEMPLATE
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=Dummy WAP Settings
+	CurrentBearer=WAPIPBearer
+	StartPage=www.wapstart.com
+	FIELD_COUNT=3
+END_ADD
+
+
+############################################################
+## WAPIPBearer
+## 
+[WAPIPBearer]
+ADD_TEMPLATE
+	AccessPointId=0
+	IAP=0
+	WSPOption=CONNECTIONLESS
+	Security=FALSE
+	ProxyPortNumber=0
+	FIELD_COUNT=5
+END_TEMPLATE
+
+ADD_SECTION
+# COMMDB_ID = 2
+	AccessPointId=2
+	GatewayAddress=www.wapgateway.com
+	IAP=2
+	WSPOption=CONNECTIONORIENTED
+	Security=FALSE
+	ProxyPortNumber=1
+	FIELD_COUNT=6
+END_ADD
+
+
+############################################################
+## WAPSMSBearer
+## 
+[WAPSMSBearer]
+ADD_TEMPLATE
+	AccessPointId=0
+	WSPOption=CONNECTIONLESS
+	Security=FALSE
+	FIELD_COUNT=3
+END_TEMPLATE
+
+ADD_SECTION
+# COMMDB_ID = 2
+	AccessPointId=2
+	GatewayAddress=+4412345678901
+	ServiceCentreAddress=+442071234567
+	WSPOption=CONNECTIONORIENTED
+	Security=FALSE
+	FIELD_COUNT=5
+END_ADD
+
+
+############################################################
+## SecureSocketTable
+## 
+[SecureSocketTable]
+ADD_SECTION
+# COMMDB_ID = 1
+	ProtocolName=ssl3.0
+	ProtoLibrary=ssladaptor.dll
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	ProtocolName=tls1.0
+	ProtoLibrary=ssladaptor.dll
+	FIELD_COUNT=2
+END_ADD
+
+
+############################################################
+## BTPersistTable
+## 
+[BTPersistTable]
+############################################################
+## ERROR
+## AccessTypeTable
+############################################################
+############################################################
+## ERROR
+## Error opening table
+############################################################
+############################################################
+## ERROR
+## Unable to find the specified object or missing required field values
+############################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/workshop/demoipsuite/testdata/demoipsuite.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,9 @@
+[SectionOne]
+Ip_Addr=10.0.0.10
+Port=7
+Test_Data=11111122221111111111111111111111
+
+[SectionTwo]
+Ip_Addr=10.0.0.10
+Port=7
+Test_Data=3333333333333444444444444444445555555555555555
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/bwins/wrapperutilsplugin1u.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateWrapperInstanceL@@YAPAVCWrapperUtilsPlugin@@XZ @ 1 NONAME ; class CWrapperUtilsPlugin * CreateWrapperInstanceL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/bwins/wrapperutilsplugin5u.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateWrapperInstanceL@@YAPAVCWrapperUtilsPlugin@@XZ @ 1 NONAME ; class CWrapperUtilsPlugin * CreateWrapperInstanceL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/eabi/wrapperutilsplugin1u.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,9 @@
+EXPORTS
+	_Z22CreateWrapperInstanceLv @ 1 NONAME
+	_ZTI15CFileServPlugin @ 2 NONAME ; #<TI>#
+	_ZTI15CSysStartPlugin @ 3 NONAME ; #<TI>#
+	_ZTV15CFileServPlugin @ 4 NONAME ; #<VT>#
+	_ZTV15CSysStartPlugin @ 5 NONAME ; #<VT>#
+	_ZTI19CWrapperUtilsPlugin @ 6 NONAME ; #<TI>#
+	_ZTV19CWrapperUtilsPlugin @ 7 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/eabi/wrapperutilsplugin5u.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,8 @@
+EXPORTS
+	_Z22CreateWrapperInstanceLv @ 1 NONAME
+	_ZTI15CFileServPlugin @ 2 NONAME
+	_ZTI15CSysStartPlugin @ 3 NONAME
+	_ZTI19CWrapperUtilsPlugin @ 4 NONAME
+	_ZTV15CFileServPlugin @ 5 NONAME
+	_ZTV15CSysStartPlugin @ 6 NONAME
+	_ZTV19CWrapperUtilsPlugin @ 7 NONAME
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,26 @@
+//
+// Copyright (c) 2005-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:  
+// Component description file
+//
+
+PRJ_EXPORTS
+..\inc\wrapperutilsplugin.h		\epoc32\include\test\wrapperutilsplugin.h
+.\wrapperutilsplugin.iby		\epoc32\rom\include\wrapperutilsplugin.iby
+
+..\inc\fileservplugin.h \epoc32\include\test\fileservplugin.h
+..\inc\sysstartplugin.h \epoc32\include\test\sysstartplugin.h
+
+PRJ_MMPFILES
+wrapperutilsplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/group/wrapperutilsplugin.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,26 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __WRAPPER_UTILS_PLUGIN_IBY__
+#define __WRAPPER_UTILS_PLUGIN_IBY__
+
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+file=ABI_DIR\BUILD_DIR\wrapperutilsplugin5.dll	SHARED_LIB_DIR\wrapperutilsplugin.dll
+#else
+file=ABI_DIR\BUILD_DIR\wrapperutilsplugin1.dll	SHARED_LIB_DIR\wrapperutilsplugin.dll
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/group/wrapperutilsplugin.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+TARGET wrapperutilsplugin5.dll
+CAPABILITY	All -TCB
+#else
+TARGET wrapperutilsplugin1.dll
+CAPABILITY	All
+#endif
+TARGETTYPE dll
+
+APP_LAYER_SYSTEMINCLUDE
+
+UID		0x1000008d 0x10210D36
+VENDORID	0x70000001
+
+SOURCEPATH	../src
+SOURCE		wrapperutilsplugin.cpp fileservplugin.cpp SysStartPlugin.cpp
+
+USERINCLUDE 	../inc
+
+LIBRARY euser.lib efsrv.lib
+
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+LIBRARY ssmcmn.lib
+#else
+LIBRARY domaincli.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/inc/fileservplugin.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#ifndef _FILESERVPLUGIN__
+#define _FILESERVPLUGIN__
+
+#include <f32file.h>
+
+_LIT(KDefaultSysDrive, "C:");
+
+class CFileServPlugin : public CBase
+	{
+public:
+	static CFileServPlugin* NewL();
+
+	CFileServPlugin();
+
+	// Destructor	
+	~CFileServPlugin();
+
+	virtual TDriveNumber GetSystemDrive();
+	};  
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/inc/sysstartplugin.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#if !defined(__SYSSTARTPLUGIN_H__)
+#define __SYSSTARTPLUGIN_H__
+
+#include <e32base.h>
+#include <f32file.h>
+
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+#include <ssm/ssmstateawaresession.h>
+
+class TSsmState;
+
+class CSysStartPlugin : public CBase, public MStateChangeNotificationSubscriber
+#else
+#include <domainmember.h>
+class CSysStartPlugin : public CDmDomain
+#endif
+	{
+public:
+	virtual void WaitForSystemStartL();
+	static CSysStartPlugin* NewL();
+	virtual ~CSysStartPlugin();
+	
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+public: // from MStateChangeNotificationSubscriber
+	virtual void StateChanged(TSsmState aSsmState);
+	
+private:
+	CSsmStateAwareSession* iStateAwareSession;
+#else
+	virtual void RunL();
+#endif
+protected:
+	CSysStartPlugin();
+	void ConstructL();
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/inc/wrapperutilsplugin.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#ifndef _CWrapperUtilsPlugin__
+#define _CWrapperUtilsPlugin__
+
+#include <f32file.h>
+
+class CWrapperUtilsPlugin : public CBase
+/**
+@internalComponent
+@test
+*/
+	{
+public:
+	virtual void WaitForSystemStartL();
+	virtual TDriveNumber GetSystemDrive();
+	};  
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/src/fileservplugin.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#include <e32std.h>
+#include "fileservplugin.h"
+
+CFileServPlugin* CFileServPlugin::NewL()
+	{
+	CFileServPlugin* self = new(ELeave) CFileServPlugin();
+	return self;
+	}
+
+CFileServPlugin::CFileServPlugin()
+	{
+	}
+
+CFileServPlugin::~CFileServPlugin()
+	{
+	
+	}
+
+TDriveNumber CFileServPlugin::GetSystemDrive()
+	{
+	TDriveNumber defaultSysDrive(EDriveC);
+	RFs fileServer;
+	TVersionName version(fileServer.Version().Name());
+	if (fileServer.Version().iMajor >= 2 &&
+		fileServer.Version().iBuild >= 1100)
+		{
+		_LIT(KFileSrvDll, "efsrv.dll");
+
+		RLibrary pluginLibrary;
+		TInt pluginErr = pluginLibrary.Load(KFileSrvDll);
+
+		if (pluginErr == KErrNone)
+			{
+			typedef TDriveNumber(*fun1)();
+			fun1 sysdrive;
+
+	#ifdef __EABI__
+			sysdrive = (fun1)pluginLibrary.Lookup(336);
+	#else
+			sysdrive = (fun1)pluginLibrary.Lookup(304);
+	#endif
+			defaultSysDrive = sysdrive();
+			}
+		pluginLibrary.Close();
+		}
+	
+	return defaultSysDrive;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/src/sysstartplugin.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#include <e32std.h>
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+#include <ssm/ssmstate.h>
+#include <ssm/ssmsubstates.hrh>
+#include <ssm/ssmdomaindefs.h>
+#include <test/sysstartplugin.h>
+
+CSysStartPlugin::CSysStartPlugin()
+#else
+#include <startup.hrh>
+#include <startupdomaindefs.h>
+#include <test/sysstartplugin.h>
+
+CSysStartPlugin::CSysStartPlugin() : CDmDomain(KDmHierarchyIdStartup, KAppServicesDomain3)
+#endif
+	{
+	
+	}
+
+/**
+ * Destructor
+ * Frees the resources located in second-phase constructor
+ */
+CSysStartPlugin::~CSysStartPlugin()
+	{
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+	if (iStateAwareSession)
+		{
+		delete iStateAwareSession;
+		}
+#endif
+	}
+
+/**
+ * Creates, and returns a pointer to CSysStartPlugin object, leave on failure
+ * @param aName - Path and name of the ini file to be parsed
+ * @return A pointer to the CSysStartPlugin object
+ */
+CSysStartPlugin* CSysStartPlugin::NewL()
+	{
+	CSysStartPlugin* self = new(ELeave) CSysStartPlugin();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop();
+	return self;
+	}
+
+void CSysStartPlugin::ConstructL()
+	{
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+	iStateAwareSession = CSsmStateAwareSession::NewL(KSM2AppServicesDomain3);
+	iStateAwareSession->AddSubscriberL(*this);
+	}
+
+void CSysStartPlugin::StateChanged(TSsmState aSsmState)
+	{
+	//if (ESsmNormal==aSsmState.MainState() && ESsmNormalSubState==aSsmState.SubState())
+	if (aSsmState.Int() >= ESsmStartupSubStateNonCritical)
+		{
+		CActiveScheduler::Stop();
+		}
+#else
+	CDmDomain::ConstructL();
+#endif
+	}
+
+void CSysStartPlugin::WaitForSystemStartL()
+	{
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+	TSsmState state = iStateAwareSession->State();
+	if (state.Int() < ESsmStartupSubStateNonCritical)
+		{
+		CActiveScheduler::Start();
+		}
+	}
+#else
+	TDmDomainState state = GetState();
+	if (state < EStartupStateNonCritical)
+		{
+		RequestTransitionNotification();
+		CActiveScheduler::Start();
+		}
+	}
+	
+void CSysStartPlugin::RunL()
+	{
+	TDmDomainState state = GetState();
+	if (state >= EStartupStateNonCritical)
+		{
+		CActiveScheduler::Stop();
+		}
+	else
+		{
+		RequestTransitionNotification();
+		}
+	}
+	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/src/wrapperutilsplugin.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#include <e32std.h>
+#include <test/fileservplugin.h>
+#include <test/sysstartplugin.h>
+#include "wrapperutilsplugin.h"
+
+EXPORT_C CWrapperUtilsPlugin* CreateWrapperInstanceL()
+	{
+	return new (ELeave) CWrapperUtilsPlugin;
+	}
+
+void CWrapperUtilsPlugin::WaitForSystemStartL()
+	{
+	CSysStartPlugin* plugin = CSysStartPlugin::NewL();
+	plugin->WaitForSystemStartL();
+	delete plugin;
+	}
+
+TDriveNumber CWrapperUtilsPlugin::GetSystemDrive()
+	{
+	TDriveNumber driveNumber = EDriveC;
+	CFileServPlugin* plugin = NULL;
+	TRAPD(err, plugin = CFileServPlugin::NewL());
+	if (KErrNone == err)
+		{
+		driveNumber = plugin->GetSystemDrive();
+		delete plugin;
+		}
+	
+	return driveNumber;
+	}
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/group/Bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_EXPORTS
+//tefwrapper.iby CORE_IBY_EXPORT_PATH(tools/,tefwrapper.iby)
+tefwrapper.iby \epoc32\rom\include\core\tools\tefwrapper.iby 
+
+PRJ_MMPFILES
+tefwrapper.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/group/tefwrapper.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __TEFWRAPPER_IBY__
+#define __TEFWRAPPER_IBY__
+
+file=ABI_DIR\BUILD_DIR\testexecute2.exe            SHARED_LIB_DIR\testexecute2.exe
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/group/tefwrapper.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+SMPSAFE
+
+#include <platform_paths.hrh>
+
+TARGET        testexecute2.exe
+TARGETTYPE    exe
+UID           0x2002BC99
+VENDORID 0x70000001
+
+OS_LAYER_SYSTEMINCLUDE
+
+//SOURCEPATH    .
+SOURCE        ..\src\main.cpp
+SOURCE        ..\src\wrapperapplication.cpp
+SOURCE        ..\src\utils.cpp
+
+USERINCLUDE   ..\inc
+
+LIBRARY       euser.lib
+LIBRARY       efsrv.lib
+//LIBRARY       estor.lib 
+//LIBRARY       bafl.lib 
+
+CAPABILITY    None
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/inc/utils.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#ifndef UTILS_H_
+#define UTILS_H_
+
+#include <e32std.h>
+
+class RFs;
+
+class Utils 
+	{
+	public:
+		enum TErrCode 
+			{
+			EErrNone = 100,
+			EErrVersion,
+			EErrHelp,
+			EErrFileNotFound, 
+			EErrBadParam
+			};
+	
+	public:
+		static TBool FileExists( RFs&, const TDesC& );
+		static void DeleteFile( RFs&, const TDesC& );
+		static void MkDir( RFs&, const TDesC& );
+	};
+
+#endif	// UTILS_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/inc/wrapperapplication.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#ifndef TTEFWRAPPERAPPLICATION_H_
+#define TTEFWRAPPERAPPLICATION_H_
+
+#include <e32std.h>
+#include <f32file.h>
+
+const TInt KFileNameLength( 255 );
+
+//class CAppLauncher;
+class CConsoleBase;
+
+class CTefWrapperApplication : public CBase
+{
+public:
+	static CTefWrapperApplication* NewL();
+	static CTefWrapperApplication* NewLC();
+	~CTefWrapperApplication();
+
+public:
+	void ParseCommandLineL();
+	void WriteConfigFileL();
+	void ExecuteL();
+	void DeleteConfigFile();
+
+private:
+	CTefWrapperApplication();
+	void ConstructL();
+	
+private:	
+	TBool IsScriptFile( const TDesC& );
+	void WriteLineL( const TDesC&, const TDesC& );
+	void WriteLineL( const TDesC&, const TDesC&, const TDesC& );
+	void GetConfigFileName( TDes& );
+	void PrintHelpMessage();
+
+private:
+	TBool iIsDebug;
+	TBool iIsSlf;
+	TBool iIsTcx;
+	TBool iIsTci;
+	TBool iHasScript;
+	TBool iIsTcsPair;
+	
+	CConsoleBase* iConsole;
+	
+	TBuf<KFileNameLength> iTciParam;
+	TBuf<KFileNameLength> iTcxParam;
+	TBuf<KFileNameLength> iScriptFileName;
+	TBuf<KFileNameLength> iCfgFileName;
+	
+private:
+	RFs iFs;
+	//RFile iFile;
+//	CAppLauncher* iAppLauncher;
+};
+
+#endif	// TTEFWRAPPERAPPLICATION_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/src/main.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2005-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:  
+* Main log server engine.
+* Process log requests from multiple clients simultaneously.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+
+#include "utils.h"
+#include "wrapperapplication.h"
+
+_LIT( KConsoleTitle, "TestExecute2" );
+CConsoleBase* console;
+
+LOCAL_C void startTEFTestL() 
+	{
+
+	CTefWrapperApplication* app = CTefWrapperApplication::NewLC();
+	
+	app->ParseCommandLineL();
+	app->WriteConfigFileL();
+	app->ExecuteL();
+	app->DeleteConfigFile();
+	
+	CleanupStack::PopAndDestroy( app );
+	}
+	
+LOCAL_C void callTEFTestL()
+	{
+	console = Console::NewL( KConsoleTitle,TSize( KConsFullScreen,KConsFullScreen ) );
+	
+	TRAPD( error, startTEFTestL() );
+	switch( error )
+		{
+		case Utils::EErrBadParam:
+			console->Printf( _L("Bad Params Input.\n") );
+			console->Getch();
+			break;
+		case Utils::EErrFileNotFound:
+			console->Printf( _L("Script file not found.\n") );
+			console->Getch();
+			break;
+		case Utils::EErrHelp:
+		case Utils::EErrVersion:
+			console->Printf( _L("Press any key to continue...\n") );
+			console->Getch();
+		}
+		
+	delete console;
+	}
+	
+GLDEF_C TInt E32Main()
+	{
+	__UHEAP_MARK;
+	
+	CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
+		
+	TRAPD( error, callTEFTestL() ); 
+	
+	
+	delete cleanup; // destroy clean-up stack
+	__UHEAP_MARKEND;
+	return error; 
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/src/utils.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005-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:  
+* Main log server engine.
+* Process log requests from multiple clients simultaneously.
+*
+*/
+
+
+
+#include "utils.h"
+
+#include <f32file.h>
+
+TBool Utils::FileExists( RFs& aFs, const TDesC& aFileName )
+	{
+	TBool ret = EFalse;
+	TUint att;
+	TInt retValue = aFs.Att( aFileName, att );
+	if( KErrNone == retValue )
+		{
+		ret = ETrue;
+		}
+	/*else if( KErrNotFound == retValue ) 
+		{
+		ret = EFalse;
+		}
+	else if( KErrPathNotFound == retValue )
+		{
+		ret = EFalse;
+		}*/
+		
+	return ret;
+	}
+
+void Utils::DeleteFile( RFs& aFs, const TDesC& aFileName )
+	{
+	if ( FileExists( aFs, aFileName ) )
+		{
+		aFs.Delete( aFileName );
+		}
+	}
+
+void Utils::MkDir( RFs& aFs, const TDesC& aDir )
+	{
+	if ( !FileExists( aFs, aDir ) )
+		{
+		aFs.MkDir( aDir );
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/tefwrapper/src/wrapperapplication.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,363 @@
+/*
+* Copyright (c) 2005-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:  
+* Main log server engine.
+* Process log requests from multiple clients simultaneously.
+*
+*/
+
+
+
+#include <e32math.h>
+#include <e32cons.h>
+
+#include "utils.h"
+#include "wrapperapplication.h"
+//#include "applauncher.h"
+
+_LIT( KScriptFileExt, ".script" );
+
+const TInt KExtLength( 7 );
+extern CConsoleBase* console;
+
+CTefWrapperApplication::CTefWrapperApplication() 
+				: iIsDebug( EFalse), iIsSlf( EFalse ), 
+				  iIsTcx( EFalse ), iIsTci( EFalse ), iHasScript( EFalse )
+	{
+	}
+	
+CTefWrapperApplication* CTefWrapperApplication::NewLC()
+	{
+	CTefWrapperApplication* self = new (ELeave) CTefWrapperApplication;
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	
+	return self;
+	}
+	
+CTefWrapperApplication* CTefWrapperApplication::NewL()
+	{
+	CTefWrapperApplication* self = CTefWrapperApplication::NewLC();
+	CleanupStack::Pop( self );
+	
+	return self;
+	}
+	
+void CTefWrapperApplication::ConstructL()
+	{
+	User::LeaveIfError( iFs.Connect() );
+	//iConsole = Console::NewL( KConsoleTitle, TSize( KConsFullScreen, KConsFullScreen ) );
+	//iAppLauncher = CAppLauncher::NewL();
+	}
+	
+CTefWrapperApplication::~CTefWrapperApplication()
+	{
+	iFs.Close();
+	//delete iConsole;
+	//delete iAppLauncher;
+	}
+
+TBool CTefWrapperApplication::IsScriptFile( const TDesC& aFileName )
+	{
+	TBool ret = EFalse;
+	TBuf<KFileNameLength> scriptFile = aFileName;
+	scriptFile.LowerCase();
+	
+	if ( scriptFile.Right(KExtLength) == KScriptFileExt ) 
+		{
+		ret = ETrue;
+		}
+		
+	return ret;
+	}
+
+void CTefWrapperApplication::PrintHelpMessage()
+	{
+	console->Printf( _L("testexecute2 Version : 0.1\r\n\r\n") );
+	console->Printf( _L("testexecute2 <scriptfilepath>\\<scriptfilename> [-d] [-slf]\r\n\r\n") );
+	console->Printf( _L("            : Executes the scriptfile with optional modes for JustInTime debugging or sepqrate log files\r\n\r\n\r\n") );
+	console->Printf( _L("testexecute2 [-h/--help/-v]\r\n\r\n") );
+	console->Printf( _L("            : Run testexecute2 with optional modes to display list of help options and the version numer\r\n\r\n") );
+	console->Printf( _L("-h/--help   : For displaying the help options available for using testexecute2 framework\r\n\r\n") );
+	console->Printf( _L("-v          : For displaying the version of the testexecute2 framework\r\n\r\n") );
+	console->Printf( _L("-slf        : For printing the messages for each of the tests in separate log files\r\n\r\n") );
+	console->Printf( _L("-d          : For enableing just in time debug mode while execution\r\n\r\n") );
+	}
+void CTefWrapperApplication::ParseCommandLineL()
+	{
+	// todo : handle tcs and tcsdata. 
+	
+	_LIT( KDebugMode, "-d" );
+    _LIT( KSlfTag, "-slf" );
+    _LIT( KTciFlag, "-tci" );
+    _LIT( KTcxFlag, "-tcx" );
+    _LIT( KHelp, "-h" );
+    _LIT( KHelpMsg, "--help" );
+    _LIT( KVer, "-v" );
+    
+    const TInt length = User().CommandLineLength();
+    if ( length == 0 )
+    	{
+    	PrintHelpMessage();
+        User::Leave( Utils::EErrHelp );
+    	}
+    	
+    HBufC* cmdLine = HBufC::NewLC( length );
+    TPtr ptr = cmdLine->Des();
+	User().CommandLine( ptr );
+	
+	TLex lex( ptr );
+
+	// Parse the command line
+    while ( !lex.Eos() )
+        {
+        TPtrC tmpPtr = lex.NextToken();
+        
+		if ( IsScriptFile( tmpPtr )) 
+			{
+			// Script=xxxx.script
+			iScriptFileName = tmpPtr;
+			if ( Utils::FileExists( iFs, iScriptFileName ) )
+				{
+				iHasScript = ETrue;
+				}
+			else 
+				{
+				User::Leave( Utils::EErrFileNotFound );
+				}
+			}
+        else if ( tmpPtr == KDebugMode )// Check -d 
+            {
+            // Debug = ON / Debug = OFF
+            iIsDebug = ETrue;
+            }
+        else if ( tmpPtr == KSlfTag )	// Check -slf 
+            {
+            // SeparateLog = OFF / SeparateLog = ON
+            iIsSlf = ETrue;
+            }
+        else if ( tmpPtr == KTciFlag )	// Check -tci
+            {
+            TPtrC tmpTciParam = lex.NextToken();
+            iTciParam = tmpTciParam;
+            iIsTci = ETrue;
+            }
+        else if ( tmpPtr == KTcxFlag )	// Check tcx
+            {
+            TPtrC tmpTcxParam = lex.NextToken();
+            iTcxParam = tmpTcxParam;
+            iIsTcx = ETrue;
+            }
+        else if ( (tmpPtr == KHelp)||(tmpPtr == KHelpMsg) ) 
+        	{
+        	PrintHelpMessage();
+        	User::Leave( Utils::EErrHelp );
+        	}
+        else if ( tmpPtr == KVer )
+        	{
+        	console->Printf( _L("testexecute2 Version : 0.1\r\n\r\n") );
+        	User::Leave( Utils::EErrVersion );
+        	}
+        else 
+        	{
+            User::Leave( Utils::EErrBadParam );
+            }
+        } // while
+        
+    if ( !iHasScript )
+    	{
+    	User::Leave( KErrNotFound );
+    	}
+    	
+    if ( iIsTci || iIsTcx )
+    	{
+    	TBool r = EFalse;
+    	if ( iTciParam.Length() != 0 )
+    		{
+    		r = ETrue;
+    		}
+    		
+    	if ( iTcxParam.Length() != 0 )
+    		{
+    		r = ETrue;
+    		}
+
+    	if( !r )
+    		{
+    		User::Leave( KErrNotFound );
+    		}
+    	}
+        
+    // Destroy command line buffer
+    CleanupStack::PopAndDestroy( cmdLine );
+	}
+	
+void CTefWrapperApplication::WriteLineL( const TDesC& aFileName, const TDesC& aString )
+	{
+	_LIT( KCR, "\r\n" );
+    
+    RFile file;
+    if ( Utils::FileExists( iFs, aFileName ) )
+        {
+        User::LeaveIfError( file.Open( iFs, aFileName, EFileWrite ) );
+        }
+    else 
+    	{
+    	User::LeaveIfError( file.Create( iFs, aFileName, EFileWrite ) );
+    	}
+    
+    CleanupClosePushL( file );
+    
+    TBuf8<KFileNameLength> strLine;
+    strLine.Copy( aString );
+    strLine.Append( KCR );
+    
+    TInt pos = 0;
+    file.Size( pos );
+    /*RFileWriteStream writeStream( file, pos );
+    writeStream.PushL();
+    writeStream.WriteL( strLine );
+    writeStream.CommitL();
+    writeStream.Pop();
+    writeStream.Release();*/
+    
+    file.Write( pos, strLine );
+    file.Close();
+
+    CleanupStack::PopAndDestroy( &file );
+	}
+	
+void CTefWrapperApplication::WriteLineL( const TDesC& aFileName, const TDesC& aKey, const TDesC& aValue )
+	{
+	_LIT( KAssignOpr, "=" );
+	TBuf<KFileNameLength> strLine;
+	strLine.Append( aKey );
+	strLine.Append( KAssignOpr );
+	strLine.Append( aValue );
+	
+	WriteLineL( aFileName, strLine );
+	}
+	
+void CTefWrapperApplication::GetConfigFileName( TDes& aConfigFileName )
+	{
+	_LIT( KFormatString, "c:\\testframework\\stf_%x.cfg" );
+	_LIT( KTestFrameWork, "c:\\testframework\\" );
+    
+    TTime theTime;
+    theTime.UniversalTime();
+	TInt64 randSeed( theTime.Int64() ); 
+	TInt number( Math::Rand( randSeed ) );
+	aConfigFileName.Format( KFormatString, number );
+    
+    // check if the specific dir exists. 
+    if ( !Utils::FileExists( iFs, iCfgFileName ) )
+        {
+        Utils::MkDir( iFs, KTestFrameWork );
+        }
+	}
+	
+void CTefWrapperApplication::WriteConfigFileL()
+	{
+	_LIT( KSectionBegin, "[New_TEFTest]" );
+    _LIT( KSectionEnd, "[End_TEFTest]" );
+    _LIT( KTcs, "Tcs" );
+    _LIT( KInclude, "Include" );
+    _LIT( KExclude, "Exclude" );
+    _LIT( KDebug, "Debug" );
+    _LIT( KOn, "ON" );
+    _LIT( KOff, "OFF" );
+    _LIT( KSeparateLog, "SeparateLog" );
+    _LIT( KPipe, "Pipe" );
+    _LIT( KScript, "Script" );
+    _LIT( KTcsData, "TcsData" );
+	
+	GetConfigFileName( iCfgFileName );
+    WriteLineL( iCfgFileName, KSectionBegin );
+    
+    // write tcs flag. 
+    if ( iIsTci || iIsTcx )
+        {
+        WriteLineL( iCfgFileName, KTcs, iIsTci?KInclude:KExclude );
+        }
+    
+    // write debug flag. 
+    if( iIsDebug )
+    	{
+    	WriteLineL( iCfgFileName, KDebug, KOn );
+    	}
+    else 
+    	{
+    	WriteLineL( iCfgFileName, KDebug, KOff );
+    	}
+    
+    // write slf flag. 
+    if( iIsSlf )
+    	{
+    	WriteLineL( iCfgFileName, KSeparateLog, KOn );
+    	}
+    else 
+    	{
+    	WriteLineL( iCfgFileName, KSeparateLog, KOff );
+    	}
+    
+    // write Pipe=OFF. 	// handle pipe section. 
+    WriteLineL( iCfgFileName, KPipe, KOff );
+    
+    // write script file. 
+    WriteLineL( iCfgFileName, KScript, iScriptFileName );
+    
+    // write tcs
+    if ( iIsTci || iIsTcx )
+        {
+        WriteLineL( iCfgFileName, KTcsData, iIsTci?iTciParam:iTcxParam );
+        }
+    
+    // write Section End. 
+    WriteLineL( iCfgFileName, KSectionEnd );
+}
+
+void CTefWrapperApplication::ExecuteL()
+	{
+	_LIT( KAtsInterface, "atsinterface.exe" );
+	_LIT( KAtsInterfaceArgs, "-testmodule TEFTestModule -config " );
+		
+	TBuf<KFileNameLength> strArgs;
+	strArgs.Copy( KAtsInterfaceArgs );
+	strArgs.Append( iCfgFileName );
+	
+	RProcess proc;
+	proc.Create( KAtsInterface, strArgs );
+	TRequestStatus status;
+	proc.Logon( status );
+	proc.Resume();
+	
+	//iAppLauncher->ExecuteL( KAtsInterface, strArgs );
+	//User::WaitForRequest( iAppLauncher->iStatus );
+	
+	User::WaitForRequest( status );
+	proc.Close();
+    if ( KErrNone != status.Int() )
+        {
+        console->Printf( _L("Launch TEF Test Module failed.\n") );
+        User::LeaveIfError( status.Int() );
+        }
+	}
+
+void CTefWrapperApplication::DeleteConfigFile()
+	{
+	if ( Utils::FileExists( iFs, iCfgFileName ) )
+        {
+        Utils::DeleteFile( iFs, iCfgFileName );
+        }
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/bwins/rfileloggerclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,12 @@
+EXPORTS
+	??0RFileFlogger@@QAE@XZ @ 1 NONAME ; RFileFlogger::RFileFlogger(void)
+	??1RFileFlogger@@QAE@XZ @ 2 NONAME ; RFileFlogger::~RFileFlogger(void)
+	?Close@RFileFlogger@@QAEXXZ @ 3 NONAME ; void RFileFlogger::Close(void)
+	?Connect@RFileFlogger@@QAEHXZ @ 4 NONAME ; int RFileFlogger::Connect(void)
+	?CreateLog@RFileFlogger@@QAEHABVTDesC16@@W4TLogMode@1@@Z @ 5 NONAME ; int RFileFlogger::CreateLog(class TDesC16 const &, enum RFileFlogger::TLogMode)
+	?Log@RFileFlogger@@QAAXPBEHW4TLogSeverity@1@HPAUTExtraLogField@@V?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 6 NONAME ; void RFileFlogger::Log(unsigned char const *, int, enum RFileFlogger::TLogSeverity, int, struct TExtraLogField *, class TRefByValue<class TDesC16 const >, ...)
+	?Log@RFileFlogger@@QAAXPBEHW4TLogSeverity@1@V?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 7 NONAME ; void RFileFlogger::Log(unsigned char const *, int, enum RFileFlogger::TLogSeverity, class TRefByValue<class TDesC16 const >, ...)
+	?Log@RFileFlogger@@QAEXPBEHW4TLogSeverity@1@HPAUTExtraLogField@@V?$TRefByValue@$$CBVTDesC16@@@@QAPAC@Z @ 8 NONAME ; void RFileFlogger::Log(unsigned char const *, int, enum RFileFlogger::TLogSeverity, int, struct TExtraLogField *, class TRefByValue<class TDesC16 const >, signed char * * const)
+	?Log@RFileFlogger@@QAEXPBEHW4TLogSeverity@1@V?$TRefByValue@$$CBVTDesC16@@@@QAPAC@Z @ 9 NONAME ; void RFileFlogger::Log(unsigned char const *, int, enum RFileFlogger::TLogSeverity, class TRefByValue<class TDesC16 const >, signed char * * const)
+	?SetLogLevel@RFileFlogger@@QAEXW4TLogSeverity@1@@Z @ 10 NONAME ; void RFileFlogger::SetLogLevel(enum RFileFlogger::TLogSeverity)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/eabi/rfileloggerclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,14 @@
+EXPORTS
+	_ZN12RFileFlogger11SetLogLevelENS_12TLogSeverityE @ 1 NONAME
+	_ZN12RFileFlogger3LogEPKhiNS_12TLogSeverityE11TRefByValueIK7TDesC16ESt9__va_list @ 2 NONAME
+	_ZN12RFileFlogger3LogEPKhiNS_12TLogSeverityE11TRefByValueIK7TDesC16Ez @ 3 NONAME
+	_ZN12RFileFlogger3LogEPKhiNS_12TLogSeverityEiP14TExtraLogField11TRefByValueIK7TDesC16ESt9__va_list @ 4 NONAME
+	_ZN12RFileFlogger3LogEPKhiNS_12TLogSeverityEiP14TExtraLogField11TRefByValueIK7TDesC16Ez @ 5 NONAME
+	_ZN12RFileFlogger5CloseEv @ 6 NONAME
+	_ZN12RFileFlogger7ConnectEv @ 7 NONAME
+	_ZN12RFileFlogger9CreateLogERK7TDesC16NS_8TLogModeE @ 8 NONAME
+	_ZN12RFileFloggerC1Ev @ 9 NONAME
+	_ZN12RFileFloggerC2Ev @ 10 NONAME
+	_ZN12RFileFloggerD1Ev @ 11 NONAME
+	_ZN12RFileFloggerD2Ev @ 12 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_EXPORTS
+..\inc\rfilelogger.h				\epoc32\include\test\rfilelogger.h
+..\inc\rfileloggermacro.h			\epoc32\include\test\rfileloggermacro.h
+..\group\rfilelogger.iby		\epoc32\rom\include\rfilelogger.iby
+PRJ_MMPFILES
+rfileloggerserver.mmp
+rfileloggerclient.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/filelogger.mrp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2005-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:
+#
+
+component	ana_testfw_testexecmdw_filelogger
+source		/src/tools/ana/testfw/testexecmdw/filelogger
+exports		/src/tools/ana/testfw/testexecmdw/filelogger/group
+binary		/src/tools/ana/testfw/testexecmdw/filelogger/group	all
+notes_source    /src/tools/ana/testfw/testexecmdw/filelogger/group/release.txt
+
+
+#  == IPR section auto-inserted from distribution.policy files  ==
+ipr T 
+
+# == end auto-inserted section ==
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/release.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5 @@
+NOTESRC_RELEASER
+Nokia Corporation.
+
+NOTESRC_RELEASE_REASON
+filelogger release.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/rfilelogger.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __ET_RFile_LOGGER_IBY__
+#define __ET_RFile_LOGGER_IBY__
+
+file=ABI_DIR\DEBUG_DIR\rfileloggerclient.dll		Sys\Bin\rfileloggerclient.dll
+file=ABI_DIR\DEBUG_DIR\rfileloggerserver.exe		Sys\Bin\rfileloggerserver.exe
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/rfileloggerclient.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description: 
+// Conditional includes for All capabilities
+//
+
+// Uncomment these lines for an All Capability build
+//#if !defined (TEF_ALL_CAP)
+//#define TEF_ALL_CAP
+//#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/rfileloggerclient.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+
+SMPSAFE
+
+#include "rfileloggerclient.cfg"
+
+TARGET      rfileloggerclient.dll
+CAPABILITY All
+TARGETTYPE  dll
+UID             0x1000008d 0x102089CB
+VENDORID 0x70000001
+
+//CAPABILITY ReadSystemData WriteSystemData ReadUserData WriteUserData PhoneNetwork //LocalNetwork
+
+SOURCEPATH  ../src
+SOURCE      client.cpp
+
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/test
+USERINCLUDE   ../inc
+
+LIBRARY		euser.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/group/rfileloggerserver.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005-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:  
+* Using relative paths for sourcepath and user includes
+*
+*/
+#include <platform_paths.hrh>
+SMPSAFE
+
+TARGET      rfileloggerserver.exe
+CAPABILITY All -Tcb
+TARGETTYPE  exe
+UID             0x1000007A 0x102089CA
+VENDORID 0x70000001
+
+APP_LAYER_SYSTEMINCLUDE
+
+//CAPABILITY
+
+SOURCEPATH  ../src
+SOURCE      server.cpp
+SOURCE		main.cpp
+
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/test
+USERINCLUDE   ../src
+
+LIBRARY		euser.lib
+LIBRARY		efsrv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/inc/rfilelogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file RFileLogger.h
+*/
+
+#if !(defined __ET_RFILELOGGER_H__)
+#define __ET_RFILELOGGER_H__
+
+#include <e32base.h>
+
+const TInt KMaxSizOfTag=128;
+const TInt KMaxSizOfString = 256;
+const TInt KMaxFilename = 50;
+
+// *** Maintaince warning: the constant designed
+// used on both server side and client side. Any change shoud be
+// checked on both side
+_LIT(KMessageFormat," - %d - %S - %d - ");
+
+_LIT(KSeperation," - ");
+_LIT8(KSeperation8," - ");
+_LIT(KTagSeperation,"LogFieldsRequiredBeingAddedToAboveLogMessage");
+_LIT(KTagSeperationEnd,"\t\t\t\t\t\t"); // make them invisible
+_LIT(KTagSeperation8,"LogFieldsRequiredBeingAddedToAboveLogMessage");
+_LIT(KTagSeperationEnd8,"\t\t\t\t\t\t"); // make them invisible
+// *** End of Maintaince warning
+
+
+//#if !(defined __FILELOGGER_UREL)
+_LIT(KFileLogrerServerName,"RFileLoggerServer");
+const TInt KMaxLoggerFilePath = 256;
+const TInt KMaxLoggerLineLength = 512;
+
+const TInt KRFileLoggerMajorVersion = 1;
+const TInt KRFileLoggerMinorVersion = 1;
+const TInt KRFileLoggerBuildVersion = 1;
+
+struct TExtraLogField
+	{
+	TBuf<KMaxSizOfTag> iLogFieldName;
+	TBuf<KMaxSizOfString> iLogFieldValue;
+	};
+/**
+ * RFileLoggerBody - class to provide internal data for the client side
+ *
+ * This class contains all data members which would otherwise be in the
+ * RFileLogger class. They are instead in this file since that because
+ * CreateSession is a protected member of RSessionBase, so we must derive
+ *from it and provide a means to call this via pass-through inline functions.
+ */
+class RFileLoggerBody : public RSessionBase
+{
+public:
+	inline TInt DoCreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots);
+	inline TInt DoSendReceive(TInt aFunction,const TIpcArgs& aArgs) const;
+	inline TInt DoSendReceive(TInt aFunction) const;
+
+	
+};
+
+inline TInt RFileLoggerBody::DoCreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots)
+	{
+	return CreateSession(aServer,aVersion,aAsyncMessageSlots);
+	}
+
+inline TInt RFileLoggerBody::DoSendReceive(TInt aFunction,const TIpcArgs& aArgs) const
+	{
+	return SendReceive(aFunction,aArgs);
+	}
+
+inline TInt RFileLoggerBody::DoSendReceive(TInt aFunction) const
+	{
+	return SendReceive(aFunction);
+	}
+
+class RFileFlogger
+/**
+@internalComponent
+@test
+*/
+	{
+public:
+	enum TLogMode{ELogModeAppend,ELogModeOverWrite};
+	// Logging level
+	enum TLogSeverity{ESevrErr  = 1,ESevrHigh, ESevrWarn, ESevrMedium, ESevrInfo, ESevrLow, ESevrTEFUnit, ESevrAll};
+	enum TLogCommand{ECreateLog,EWriteLog};
+
+	enum TLogType{EXml,ETxt};
+	
+	IMPORT_C RFileFlogger();
+	IMPORT_C ~RFileFlogger();
+	
+
+	IMPORT_C TInt Connect(); 
+	IMPORT_C TInt CreateLog(const TDesC& aLogFilePath,TLogMode aMode);
+	IMPORT_C void Log(const TText8* aFile, TInt aLine, TLogSeverity aSeverity, TRefByValue<const TDesC> aFmt,...);
+	IMPORT_C void Log(const TText8* aFile, TInt aLine, TLogSeverity aSeverity, TInt arraylength, TExtraLogField* aLogFields, TRefByValue<const TDesC> aFmt,...);
+
+	IMPORT_C void SetLogLevel(TLogSeverity aloglevel); 
+	IMPORT_C void Close();
+	IMPORT_C void Log(const TText8* aFile, TInt aLine, TLogSeverity aSeverity,TRefByValue<const TDesC> aFmt, VA_LIST aList);
+	IMPORT_C void Log(const TText8* aFile, TInt aLine, TLogSeverity aSeverity, TInt arraylength, TExtraLogField* aLogFields, TRefByValue<const TDesC> aFmt, VA_LIST aList);	
+
+private:
+	void GetCPPModuleName(TDes& aModuleName, const TText8* aCPPFileName);
+	void WriteL(const TDesC& aLogBuffer);
+	void WriteL(TDes8& aLogBuffer);
+	void AddTime(TDes8& aTime);
+
+	RFileLoggerBody* ilogbody;
+
+	TLogSeverity iloglevel;
+	TBool iLogfileTag;
+
+
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/inc/rfileloggermacro.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file RFileLoggermacro.h
+ @publishedPartner
+ @test  
+*/
+
+#if !(defined __ET_RFILELOGGERMACRO_H__)
+#define __ET_RFILELOGGERMACRO_H__
+
+#include <rfilelogger.h>
+#ifdef _DEBUG
+	#ifndef __FILELOGGER_ACTIVE
+		#define __FILELOGGER_ACTIVE
+	#endif
+#endif
+
+#if defined (__FILELOGGER_ACTIVE ) || defined (SWTRACE_ACTIVE)
+#define __FLOG_DECLARATION_MEMBER		RFileFlogger __logger__
+//------------
+#define __FLOG_CONNECT				__logger__.Connect()
+
+#define __FLOG_CREATE(alogfilepath,amode)	__logger__.CreateLog((alogfilepath),(amode))
+
+#define __FLOG_CLOSE				__logger__.Close()
+
+#define __FLOG_SETLOGLEVEL(aloglevel)		__logger__.SetLogLevel((aloglevel))
+
+
+//--------
+#define __FLOG_INFO1(p1)							__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (p1))
+#define __FLOG_INFO2(p1, p2)						__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (p1), (p2))
+#define __FLOG_INFO3(p1, p2, p3)					__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (p1), (p2), (p3))
+#define __FLOG_INFO4(p1, p2, p3, p4)				__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (p1), (p2), (p3), (p4))
+#define __FLOG_INFO5(p1, p2, p3, p4, p5)			__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (p1), (p2), (p3), (p4), (p5))
+#define __FLOG_INFO6(p1, p2, p3, p4, p5, p6)		__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (p1), (p2), (p3), (p4), (p5), (p6))
+#define __FLOG_INFO7(p1, p2, p3, p4, p5, p6, p7)	__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (p1), (p2), (p3), (p4), (p5), (p6), (p7))
+
+#define __FLOG_WARN1(p1)							__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (p1))
+#define __FLOG_WARN2(p1, p2)						__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (p1), (p2))
+#define __FLOG_WARN3(p1, p2, p3)					__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (p1), (p2), (p3))
+#define __FLOG_WARN4(p1, p2, p3, p4)				__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (p1), (p2), (p3), (p4))
+#define __FLOG_WARN5(p1, p2, p3, p4, p5)			__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (p1), (p2), (p3), (p4), (p5))
+#define __FLOG_WARN6(p1, p2, p3, p4, p5, p6)		__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (p1), (p2), (p3), (p4), (p5), (p6))
+#define __FLOG_WARN7(p1, p2, p3, p4, p5, p6, p7)	__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (p1), (p2), (p3), (p4), (p5), (p6), (p7))
+
+#define __FLOG_ERR1(p1)								__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (p1))
+#define __FLOG_ERR2(p1, p2)							__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (p1), (p2))
+#define __FLOG_ERR3(p1, p2, p3)						__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (p1), (p2), (p3)) ;
+#define __FLOG_ERR4(p1, p2, p3, p4)					__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (p1), (p2), (p3), (p4))
+#define __FLOG_ERR5(p1, p2, p3, p4, p5)				__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (p1), (p2), (p3), (p4), (p5))
+#define __FLOG_ERR6(p1, p2, p3, p4, p5, p6)			__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (p1), (p2), (p3), (p4), (p5), (p6))
+#define __FLOG_ERR7(p1, p2, p3, p4, p5, p6, p7)		__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (p1), (p2), (p3), (p4), (p5), (p6), (p7))
+
+// for extra log fields
+#define __FLOG_EXTRA_INFO1(length, extra, p1)							__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (length), (extra), (p1))
+#define __FLOG_EXTRA_INFO2(length, extra, p1, p2)						__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (length), (extra), (p1), (p2))
+#define __FLOG_EXTRA_INFO3(length, extra, p1, p2, p3)					__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (length), (extra), (p1), (p2), (p3))
+#define __FLOG_EXTRA_INFO4(length, extra, p1, p2, p3, p4)				__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (length), (extra), (p1), (p2), (p3), (p4))
+#define __FLOG_EXTRA_INFO5(length, extra, p1, p2, p3, p4, p5)			__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (length), (extra), (p1), (p2), (p3), (p4), (p5))
+#define __FLOG_EXTRA_INFO6(length, extra, p1, p2, p3, p4, p5, p6)		__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (length), (extra), (p1), (p2), (p3), (p4), (p5), (p6))
+#define __FLOG_EXTRA_INFO7(length, extra, p1, p2, p3, p4, p5, p6, p7)	__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrInfo, (length), (extra), (p1), (p2), (p3), (p4), (p5), (p6), (p7))
+
+#define __FLOG_EXTRA_WARN1(length, extra, p1)							__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (length), (extra), (p1))
+#define __FLOG_EXTRA_WARN2(length, extra, p1, p2)						__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (length), (extra), (p1), (p2))
+#define __FLOG_EXTRA_WARN3(length, extra, p1, p2, p3)					__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (length), (extra), (p1), (p2), (p3))
+#define __FLOG_EXTRA_WARN4(length, extra, p1, p2, p3, p4)				__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (length), (extra), (p1), (p2), (p3), (p4))
+#define __FLOG_EXTRA_WARN5(length, extra, p1, p2, p3, p4, p5)			__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (length), (extra), (p1), (p2), (p3), (p4), (p5))
+#define __FLOG_EXTRA_WARN6(length, extra, p1, p2, p3, p4, p5, p6)		__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (length), (extra), (p1), (p2), (p3), (p4), (p5), (p6))
+#define __FLOG_EXTRA_WARN7(length, extra, p1, p2, p3, p4, p5, p6, p7)	__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrWarn, (length), (extra), (p1), (p2), (p3), (p4), (p5), (p6), (p7))
+
+#define __FLOG_EXTRA_ERR1(length, extra, p1)								__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (length), (extra), (p1))
+#define __FLOG_EXTRA_ERR2(length, extra, p1, p2)							__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (length), (extra), (p1), (p2))
+#define __FLOG_EXTRA_ERR3(length, extra, p1, p2, p3)						__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (length), (extra), (p1), (p2), (p3)) ;
+#define __FLOG_EXTRA_ERR4(length, extra, p1, p2, p3, p4)					__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (length), (extra), (p1), (p2), (p3), (p4))
+#define __FLOG_EXTRA_ERR5(length, extra, p1, p2, p3, p4, p5)				__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (length), (extra), (p1), (p2), (p3), (p4), (p5))
+#define __FLOG_EXTRA_ERR6(length, extra, p1, p2, p3, p4, p5, p6)			__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (length), (extra), (p1), (p2), (p3), (p4), (p5), (p6))
+#define __FLOG_EXTRA_ERR7(length, extra, p1, p2, p3, p4, p5, p6, p7)		__logger__.Log(((TText8*)__FILE__), __LINE__, RFileFlogger::ESevrErr, (length), (extra), (p1), (p2), (p3), (p4), (p5), (p6), (p7))
+
+#else
+#define __FILELOG_DECLARATION_MEMBER
+//------------
+#define __FLOG_CONNECT
+
+#define __FLOG_CREATE(alogfilepath,amode)
+
+#define __FLOG_CLOSE
+
+//--------
+#define __FLOG_INFO1(p1)
+#define __FLOG_INFO2(p1, p2)
+#define __FLOG_INFO3(p1, p2, p3)
+#define __FLOG_INFO4(p1, p2, p3, p4)
+#define __FLOG_INFO5(p1, p2, p3, p4, p5)
+#define __FLOG_INFO6(p1, p2, p3, p4, p5, p6)
+#define __FLOG_INFO7(p1, p2, p3, p4, p5, p6, p7)
+
+#define __FLOG_WARN1(p1)
+#define __FLOG_WARN2(p1, p2)
+#define __FLOG_WARN3(p1, p2, p3)
+#define __FLOG_WARN4(p1, p2, p3, p4)
+#define __FLOG_WARN5(p1, p2, p3, p4, p5)
+#define __FLOG_WARN6(p1, p2, p3, p4, p5, p6)
+#define __FLOG_WARN7(p1, p2, p3, p4, p5, p6, p7)
+
+#define __FLOG_ERR1(p1)
+#define __FLOG_ERR2(p1, p2)
+#define __FLOG_ERR3(p1, p2, p3)
+#define __FLOG_ERR4(p1, p2, p3, p4)
+#define __FLOG_ERR5(p1, p2, p3, p4, p5)
+#define __FLOG_ERR6(p1, p2, p3, p4, p5, p6)
+#define __FLOG_ERR7(p1, p2, p3, p4, p5, p6, p7)
+
+// for extra log fields
+#define __FLOG_EXTRA_INFO1(length, extra, p1)
+#define __FLOG_EXTRA_INFO2(length, extra, p1, p2)
+#define __FLOG_EXTRA_INFO3(length, extra, p1, p2, p3)
+#define __FLOG_EXTRA_INFO4(length, extra, p1, p2, p3, p4)
+#define __FLOG_EXTRA_INFO5(length, extra, p1, p2, p3, p4, p5)
+#define __FLOG_EXTRA_INFO6(length, extra, p1, p2, p3, p4, p5, p6)
+#define __FLOG_EXTRA_INFO7(length, extra, p1, p2, p3, p4, p5, p6, p7)
+
+#define __FLOG_EXTRA_WARN1(length, extra, p1)
+#define __FLOG_EXTRA_WARN2(length, extra, p1, p2)
+#define __FLOG_EXTRA_WARN3(length, extra, p1, p2, p3)
+#define __FLOG_EXTRA_WARN4(length, extra, p1, p2, p3, p4)
+#define __FLOG_EXTRA_WARN5(length, extra, p1, p2, p3, p4, p5)
+#define __FLOG_EXTRA_WARN6(length, extra, p1, p2, p3, p4, p5, p6)
+#define __FLOG_EXTRA_WARN7(length, extra, p1, p2, p3, p4, p5, p6, p7)
+
+#define __FLOG_EXTRA_ERR1(length, extra, p1)
+#define __FLOG_EXTRA_ERR2(length, extra, p1, p2)
+#define __FLOG_EXTRA_ERR3(length, extra, p1, p2, p3)
+#define __FLOG_EXTRA_ERR4(length, extra, p1, p2, p3, p4)
+#define __FLOG_EXTRA_ERR5(length, extra, p1, p2, p3, p4, p5)
+#define __FLOG_EXTRA_ERR6(length, extra, p1, p2, p3, p4, p5, p6)
+#define __FLOG_EXTRA_ERR7(length, extra, p1, p2, p3, p4, p5, p6, p7)
+
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/client.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,397 @@
+/*
+* Copyright (c) 2005-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:  
+* Source file for the client api
+*
+*/
+
+
+
+/**
+ @file Client.cpp
+*/
+#include <rfilelogger.h>
+
+
+//_LIT8(KxmlHeader,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n");
+
+
+// EKA1 requires DLL entry point
+//
+// RFileLogger class definition
+//
+
+EXPORT_C RFileFlogger::RFileFlogger() : ilogbody(NULL)
+/**
+ * Create a new flogger client interface object with an empty body.
+ * @internalTechnology 
+ */
+	{
+	iLogfileTag=FALSE;
+	}
+
+EXPORT_C RFileFlogger::~RFileFlogger()
+/**
+ * Destructor
+ * @internalTechnology 
+ */
+	{}
+
+
+
+EXPORT_C TInt RFileFlogger::Connect()
+/**
+ * @return int - Standard error codes
+ * EKA2 all variants and EKA1 target.
+ * Server is an exe
+ */
+	{
+	// Sanity check to make sure it's not been called multiple times
+	if (ilogbody)
+		{
+		return KErrAlreadyExists;
+		}
+	ilogbody = new RFileLoggerBody;
+	if(!ilogbody)
+		return KErrNoMemory;
+
+	TVersion version(KRFileLoggerMajorVersion,KRFileLoggerMinorVersion,KRFileLoggerBuildVersion);
+	// Assume the server is already running and attempt to create a session
+	
+	TInt err = ilogbody->DoCreateSession(KFileLogrerServerName,version,8);
+	if(err== KErrServerTerminated)
+	{
+		User::After(1000000); // OS need time to close previous server properly
+		err = ilogbody->DoCreateSession(KFileLogrerServerName,version,8);
+	}
+
+	if(err == KErrNotFound)
+		{
+		// Server not running
+		// Construct the server binary name
+		_LIT(KEmpty,"");
+		// EKA2 is simple
+		// No path required
+		TBuf<32> serverFile;
+		serverFile.Copy(KFileLogrerServerName);
+		_LIT(KExe,".exe");
+		serverFile.Append(KExe);
+		RProcess server;
+		err = server.Create(serverFile,KEmpty);
+		if(err != KErrNone)
+			return err;
+		// Synchronise with the server
+		TRequestStatus reqStatus;
+		server.Rendezvous(reqStatus);
+		server.Resume();
+		// Server will call the reciprocal static synchronise call
+		User::WaitForRequest(reqStatus);
+		server.Close();
+		if(reqStatus.Int() != KErrNone)
+			return reqStatus.Int();
+		// Create the root server session
+		err = ilogbody->DoCreateSession(KFileLogrerServerName,version,8);
+		}
+		if (err != KErrNone)
+		{  // some other problem, kill the logbody and clean the mamory
+			delete ilogbody;
+			ilogbody=NULL;
+		}
+		else
+		{   // Makes the session shared among all threads in the process
+			err = ilogbody->ShareAuto();
+		}
+
+
+	return err;
+	}
+
+///////
+EXPORT_C TInt RFileFlogger::CreateLog(const TDesC& aLogFilePath, TLogMode aMode)
+/**
+ * @param aLogFilePath - Full path and filename of the log file
+ * @param aMode - Overwrite or Append
+ * Makes synchronous call to the log server to create a log session
+ */
+	{
+	iloglevel = ESevrAll; //ELogNone;
+
+	if(aLogFilePath.Length() > KMaxLoggerFilePath)
+		return KErrTooBig;
+
+	TIpcArgs args;
+	args.Set(0,&aLogFilePath);
+	args.Set(1,aMode);
+    TInt err = ilogbody->DoSendReceive(ECreateLog,args);
+    return err; 
+
+	}
+
+EXPORT_C void RFileFlogger::Log(const TText8* aFile, TInt aLine, TLogSeverity aSeverity, TRefByValue<const TDesC> aFmt,...)
+/**
+ * @param aFile - Source file name
+ * @param aLine - Source file line number
+ * @param aSeverity - ERR, WARN, INFO
+ * @param aFmt - UNICODE format string
+ */
+	{
+	// Set up a Variable argument list and call private method
+	if (aSeverity>iloglevel && aSeverity != ESevrTEFUnit) 
+		{
+		return;
+		}
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	Log(aFile, aLine, aSeverity, aFmt, aList);
+	VA_END(aList); 
+
+	}
+EXPORT_C void RFileFlogger::Log(const TText8* aFile, TInt aLine, TLogSeverity aSeverity,TInt arraylength, TExtraLogField* aLogFields, TRefByValue<const TDesC> aFmt,...)
+/**
+ * @param aFile - Source file name
+ * @param aLine - Source file line number
+ * @param aSeverity - ERR, WARN, INFO
+ * @param aFmt - UNICODE format string
+ */
+	{
+	// Set up a Variable argument list and call private method
+	if (aSeverity>iloglevel && aSeverity != ESevrTEFUnit) 
+		{
+		return;
+		}
+	VA_LIST aList;
+	VA_START(aList, aFmt);
+	Log(aFile, aLine, aSeverity, arraylength, aLogFields, aFmt, aList);
+	VA_END(aList); 
+	}
+
+
+void RFileFlogger::AddTime(TDes8& aLogBuffer)
+	{
+	TTime now;
+	now.UniversalTime();
+	TDateTime dateTime = now.DateTime();
+	_LIT8(KFormat,"%02d:%02d:%02d:%03d");
+	// add the current time. 
+/*--------- Maintaince Warning for aLogBuffer -----------------------------------
+******* the fomat of below string is sensible to server.  
+******* Adding any string to the aLogBuffer has to be checked 
+******* in code on server side 
+--------------------------------------------------------------------------------*/
+	aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000)); 
+/*--------------- End of Maintaince Warning  ----------------*/
+	}
+
+EXPORT_C void RFileFlogger::Log(const TText8* aFile, TInt aLine, TLogSeverity aSeverity, TRefByValue<const TDesC> aFmt, VA_LIST aList)
+	{
+	if (aSeverity>iloglevel && aSeverity != ESevrTEFUnit) 
+		{
+		return;
+		}
+
+	TInt arraylength = 0;
+	TExtraLogField* aLogFields =NULL;	
+	Log(aFile, aLine, aSeverity, arraylength, aLogFields, aFmt, aList);
+	}
+
+EXPORT_C void RFileFlogger::Log(const TText8* aFile, TInt aLine, TLogSeverity aSeverity,TInt arraylength, TExtraLogField* aLogFields, TRefByValue<const TDesC> aFmt, VA_LIST aList)
+/**
+ * @param aFile - Source file name
+ * @param aLine - Source file line number
+ * @param aSeverity - ERR, WARN, INFO
+ * @param arraylength
+ * @param aLogFields
+ * @param aFmt - UNICODE format string
+ * @param aList - Variable argument list
+ *
+ * Format a log output line
+ */
+ 	{
+	if (aSeverity>iloglevel && aSeverity != ESevrTEFUnit) 
+		{
+		return;
+		}
+
+	if (aSeverity == ESevrTEFUnit)
+		{
+		aSeverity = ESevrInfo;
+		}
+/*----- Maintaince Warning for this section: -----------------------------------
+******* the fomat of below string is very sensible to server Server 
+******* defomating these string with the understanding of this 
+******* perticular format. Any change made here should be checked 
+******* in code on server side 
+--------------------------------------------------------------------------------*/
+	// Create a filename string
+	TBuf16<KMaxFilename> fileName;
+	GetCPPModuleName(fileName, aFile);  
+	// Create a buffer for formatting
+	HBufC* buffer = HBufC::NewLC(KMaxLoggerLineLength*2);
+	if(!buffer)
+		return;  // no memory
+	TPtr ptr(buffer->Des());
+	_LIT(KEnd,"\r\n");
+	_LIT(KErr,"ERROR");
+	_LIT(KHigh,"HIGH");
+	_LIT(KWarn,"WARN");
+	_LIT(KMedium,"MEDIUM");
+	_LIT(KInfo,"INFO");
+	_LIT(KLow,"LOW");
+//	ptr.Append(KTypeTagBeging);
+	ptr.Append(KSeperation);
+	if(aSeverity == ESevrErr)
+		ptr.Append(KErr);
+	else if(aSeverity == ESevrHigh)
+		ptr.Append(KHigh);
+	else if(aSeverity == ESevrWarn)
+		ptr.Append(KWarn);
+	else if(aSeverity == ESevrMedium)
+		ptr.Append(KMedium);
+	else if (aSeverity == ESevrInfo)
+		ptr.Append(KInfo);
+	else if(aSeverity == ESevrLow)
+		ptr.Append(KLow);
+	else //if(aSeverity == ESevrAll)
+		ptr.Append(KInfo);
+	// Add the thread id -------- read CIniData to decide the level of details
+	ptr.AppendFormat(KMessageFormat,(TInt)(RThread().Id()),&fileName, aLine);
+	ptr.AppendFormatList(aFmt, aList);
+	if(arraylength>0)  // trust user providing correct number with actual arrary length
+	{
+		_LIT(KTab,"\t");
+		// presuming the following string is hardly being apart of log message from users
+		// and no carrige return and line feed in their log field name and field value
+		ptr.Append(KEnd);
+		ptr.Append(KTagSeperation);
+		ptr.Append(KTab);
+		ptr.AppendNum(TInt64(arraylength));
+		TInt loopValue(arraylength);
+		while(loopValue)
+		{
+			ptr.Append(KEnd);
+			ptr.Append(aLogFields->iLogFieldName);
+			ptr.Append(KTab);
+			ptr.Append(aLogFields->iLogFieldValue);
+			loopValue--; // Decrement the looping until all fields are exhausted
+			aLogFields++; // Increment the pointer address to access sucessive array index values			
+		}
+		ptr.Append(KEnd);
+		ptr.Append(KTagSeperationEnd);
+
+	}
+/*----------------- End of Maintaince warning section --------------------------*/
+	TRAP_IGNORE(WriteL(ptr));
+	CleanupStack::PopAndDestroy(buffer);
+
+	}
+
+
+void RFileFlogger::WriteL(const TDesC& aLogBuffer)
+/**
+ * @param aLogBuffer - UNICODE buffer
+ */
+	{
+	HBufC8* buffer = HBufC8::NewLC(aLogBuffer.Length()+100);
+	if(!buffer)
+		return;  // no memory
+	TPtr8 ptr(buffer->Des());
+	AddTime(ptr);
+	ptr.Append(aLogBuffer);
+	TRAP_IGNORE(WriteL(ptr));
+	
+	CleanupStack::PopAndDestroy(buffer);
+	}
+
+void RFileFlogger::WriteL(TDes8& aLogBuffer)
+/**
+ * @param aLogBuffer - pre-formatted narrow buffer
+ * 
+ * Synchronous write to the server
+ */
+	{
+	_LIT8(KEnd,"\r\n");
+	// Check to see if there's room to add CRLF
+	if(aLogBuffer.Length()+2 > aLogBuffer.MaxLength())
+		{
+		HBufC8* buffer = HBufC8::NewLC(aLogBuffer.Length()+2);
+		if(!buffer)
+			return;  // no memory
+		TPtr8 ptr(buffer->Des());
+		ptr.Copy(aLogBuffer);
+		TBuf8<4> tempBuf(_L8("\r\n"));
+		if (aLogBuffer.Mid(aLogBuffer.Length()-2,2).CompareF(tempBuf) != 0)
+			ptr.Append(KEnd);
+		TIpcArgs args;
+		args.Set(0,&ptr);
+		args.Set(1,ptr.Length());
+		User::LeaveIfError(ilogbody->DoSendReceive(EWriteLog,args));
+		CleanupStack::PopAndDestroy(buffer);
+		}
+	else
+		{
+		TBuf8<4> tempBuf(_L8("\r\n"));
+		if (aLogBuffer.Mid(aLogBuffer.Length()-2,2).CompareF(tempBuf) != 0)
+			aLogBuffer.Append(KEnd);
+		TIpcArgs args;
+		args.Set(0,&aLogBuffer);
+		args.Set(1,aLogBuffer.Length());
+		User::LeaveIfError(ilogbody->DoSendReceive(EWriteLog,args));
+		}
+	}
+
+void RFileFlogger::GetCPPModuleName(TDes& aModuleName, const TText8* aCPPFileName)
+/**
+ * @return aModuleName - Filename in descriptor
+ * @param aCppFileName - Filename
+ * Borrowed from scheduletest
+ */
+	{
+	TPtrC8 fileNamePtrC8(aCPPFileName);
+	// We do our own filename munging here; TParse can't help us since that's
+	// expressly for EPOC filepaths and here we've got whatever the build system is
+	// At present Win32 and Unix directory delimiters are supported
+	TInt lastDelimiter = Max(fileNamePtrC8.LocateReverse('\\'), fileNamePtrC8.LocateReverse('/'));
+	if(lastDelimiter >= 0 && lastDelimiter < fileNamePtrC8.Length() - 1)
+		{
+		// Found a delimiter which isn't trailing; update the ptr to start at the next char
+		TInt fileNameLen = Min(KMaxFilename, fileNamePtrC8.Length() - (lastDelimiter + 1));
+		fileNamePtrC8.Set(aCPPFileName + lastDelimiter + 1, fileNameLen);
+		}
+	else
+		{
+		// Didn't find a delimiter; take as much of the right-end of the name as fits
+		fileNamePtrC8.Set(aCPPFileName + Max(0, fileNamePtrC8.Length() - KMaxFilename), Min(fileNamePtrC8.Length(), KMaxFilename));
+		}
+	aModuleName.Copy(fileNamePtrC8);
+	}
+
+
+
+EXPORT_C void RFileFlogger::SetLogLevel(TLogSeverity aloglevel)
+	{
+	iloglevel=aloglevel;
+	}
+
+
+EXPORT_C void RFileFlogger::Close()
+	{
+  	if(ilogbody)
+  		{
+		ilogbody->Close();
+		delete ilogbody;
+		ilogbody = NULL;
+  		}
+	}
+
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/main.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005-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:  
+* Server entry points
+* EKA1 & EKA2
+* EKA1 & WINS is a DLL. All others are exe's
+*
+*/
+
+
+
+/**
+ @file Main.cpp
+*/
+#include <rfilelogger.h>
+#include "server.h"
+
+// Emulator EKA1 is the only DLL case
+
+// EKA2 all variats & EKA1 target only
+// E32Main calls MainL()
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+	// Leave Platform security hooks in place
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().SecureApi(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler* sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CLogServer* server = NULL;
+	// Create the sever
+	TRAPD(err,server = CLogServer::NewL());
+	if(!err)
+		{
+		// Client Synchronisation different for EKA1 and EKA2
+		// EKA2 really simple. Client blocks on reciprocal Rendezvous call
+		RProcess::Rendezvous(KErrNone);
+		// Go into the Active scheduler
+		sched->Start();
+		}
+	// Free the server class
+	delete server;
+	delete sched;
+	}
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Process entry point. Called by client using RProcess API
+ */
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/server.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,552 @@
+/*
+* Copyright (c) 2005-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:  
+* Main log server engine.
+* Process log requests from multiple clients simultaneously.
+*
+*/
+
+
+
+/**
+ @file server.cpp
+*/
+#include "server.h"
+
+CLogServer* CLogServer::NewL()
+/**
+ * @return - Instance of the log server
+ */
+	{
+	CLogServer * server = new (ELeave) CLogServer();
+	CleanupStack::PushL(server);
+	server->ConstructL();
+	// CServer base class call
+	server->StartL(KFileLogrerServerName);
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+void CLogServer::ConstructL()
+/**
+ * Second phase construction
+ */
+	{
+	User::LeaveIfError(Fs().Connect());
+	}
+
+
+CLogServer::CLogServer() : CServer2(EPriorityStandard,ESharableSessions)
+/**
+ * Constructor
+ */
+	{
+	}
+
+CLogServer::~CLogServer()
+/**
+ * Destructor
+ */
+	{
+	// Close the array of control structures
+	LogControl().Close();
+	Fs().Close();
+	}
+
+
+CSession2* CLogServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
+/**
+ * @param RMessage - RMessage for the session open
+ */
+	{
+	// Just create the session
+	CLogSession* session = new (ELeave) CLogSession();
+	return session;
+	}
+
+void CLogServer::ControlComplete(CLogFileControl& aControl)
+/**
+ * @param aControl - Logfile control class reference
+ *
+ * Checks to see if this control session can be removed 
+ */
+	{
+	// Check session count and the data buffers on the queue 
+	if(aControl.SessionCount() || !aControl.QueueEmpty())
+		return;
+
+	// There are no subsessions mapped to the logfile control class and
+	// no data buffers on its write queue
+	// Loop through the server's control array and remove it then delete it
+	TInt i;
+	for(i=0;i<LogControl().Count();i++)
+		{
+		if(&aControl == LogControl()[i])
+			{
+			// Done
+			LogControl().Remove(i);
+			delete &aControl;
+			break;
+			}
+		}
+	// If it's the last one then exit the server
+	if(!LogControl().Count())
+		CActiveScheduler::Stop();
+	}
+
+
+///////
+
+CLogSession::CLogSession()
+/**
+ * Constructor
+ */
+	{
+	}
+
+CLogSession::~CLogSession()
+/**
+ * Destructor
+ */
+	{
+	// Check for null
+	// Session close without a createlog call leaves iControl null
+	if(!iControl)
+		return;
+	// A logfile control structure can have multiple server sessions
+	// decrement its server session count
+	iControl->RemoveSession();
+	CLogServer* p=(CLogServer*) Server();
+	// Shuts Down the server if this is the last open session
+	p->ControlComplete(*iControl);
+	}
+
+void CLogSession::ServiceL(const RMessage2& aMessage)
+/**
+ * @param aMessage - Function and data for the session
+ */
+	{
+	switch(aMessage.Function())
+		{
+		// API CreateLog() call
+		case RFileFlogger::ECreateLog :
+			{
+			// Sanity check to make sure it's not been called multiple times
+			if(iControl)
+				{
+				aMessage.Complete(KErrInUse);
+				break;
+				}
+			// Get the filepath
+			// size policed on the client side
+			TBuf<KMaxLoggerFilePath> logFilePath;
+			// Read it
+			aMessage.ReadL(0,logFilePath);
+			// Get the log mode in the second argument
+			RFileFlogger::TLogMode logMode;
+			logMode = (RFileFlogger::TLogMode)aMessage.Int1();
+			// Get a pointer to the parent server
+			CLogServer* server=(CLogServer*) Server();
+			// For compare's convert the whole path to lower case
+			logFilePath.LowerCase();
+			// Get rid of leading and trailing spaces.
+			logFilePath.Trim();
+						
+			// Loop the through the server's logfile control class list
+			// to see if there's a match.
+			TInt i;
+			for(i=0;i<server->LogControl().Count();i++)
+				{
+				if(server->LogControl()[i]->LogFile() == logFilePath)
+					// This file's already in open so we don't have to open it
+					break;
+				}
+			TInt err = KErrNone;
+			// Check the count
+			if(i < server->LogControl().Count())
+				// Map this session to an existing logfile control class in the list
+				iControl = server->LogControl()[i];
+			else
+				{
+				// Create a new logfile control class
+				// creates/opens the logfile
+				TRAP(err,iControl = CLogFileControl::NewL(*server,logFilePath,logMode));
+				if(!err)
+					{  // nancy
+					// find out the type of output format and assign to this new created control
+					TInt error = logFilePath.Find(_L(".xml"));
+					if(error==KErrNotFound) iControl->SetLogType(CLogFileControl::ETxt);
+					else iControl->SetLogType(CLogFileControl::EXml);					
+					// end nancy
+					// Append it to the logfile control class list
+					server->LogControl().Append(iControl);					
+					}
+				}
+			if(!err)
+				// Increment its session count
+				iControl->AddSession();
+			aMessage.Complete(err);
+			}
+			break;
+		// One of the API write calls
+		case RFileFlogger::EWriteLog :
+			{
+			// Sanity check
+			if(!iControl)
+				{
+				aMessage.Complete(KErrNotFound);
+				break;
+				}
+			// Data can be any size
+			// Get the length from second argument
+			TInt bufferLength = aMessage.Int1();
+			// Get a heap buffer of the right size
+			HBufC8* buffer = HBufC8::NewLC(bufferLength);
+			TPtr8 ptr(buffer->Des());
+			// read the data
+			aMessage.ReadL(0,ptr);			
+			// Get a buffer control class contructed with the heap data
+			// takes ownership
+			CLogBuffer* logBuffer = new (ELeave) CLogBuffer(*buffer);
+			CleanupStack::Pop(buffer);
+			// Add it to the logfile control class buffer queue
+			iControl->AddLogBuffer(*logBuffer);
+			if(!iControl->IsActive())
+				// AO is idle, kick into life
+				iControl->Kick();
+			aMessage.Complete(KErrNone);
+			}
+			break;
+
+		default:
+			break;
+		}
+	}
+
+///////
+
+CLogFileControl* CLogFileControl::NewL(CLogServer& aParent, const TDesC& aLogFilePath,RFileFlogger::TLogMode aMode)
+/**
+ * @param aParent - Server reference for callback
+ * @param aLogFilePath - Full path and filename of the logfile
+ * @param aMode - Overwrite or Append
+ *
+ * First phase construction for logfile control class
+ */
+	{
+	CLogFileControl* self = new (ELeave) CLogFileControl(aParent,aLogFilePath);
+	CleanupStack::PushL(self);
+	self->ConstructL(aMode);
+	CleanupStack::Pop();
+	return self;
+	}
+
+CLogFileControl::CLogFileControl(CLogServer& aParent,const TDesC& aLogFilePath) :
+	iParent(aParent),
+	iLogFileName(aLogFilePath),
+	iTransmitted(EFalse)
+/**
+ * @param aParent - Server reference for callback
+ * @param aLogFilePath - Full path and filename of the logfile
+ *
+ * Constructor - Safe initialisation
+ */
+	{
+	iQueue.SetOffset(CLogBuffer::LinkOffset());
+	}
+
+void CLogFileControl::ConstructL(RFileFlogger::TLogMode aMode)
+/**
+ * @param aMode - Overwrite or Append
+ *
+ * Second phase construction - Create or open the logfile
+ */
+	{
+	if(aMode == RFileFlogger::ELogModeOverWrite)
+		// In overwrite mode replace
+		User::LeaveIfError(iLogFile.Replace(iParent.Fs(),iLogFileName,EFileWrite));
+	else
+		{
+		// For append try open then replace
+		TInt err = iLogFile.Open(iParent.Fs(),iLogFileName,EFileWrite);
+		if(err != KErrNone)
+			// Bomb out if replace fails
+			User::LeaveIfError(iLogFile.Replace(iParent.Fs(),iLogFileName,EFileWrite));
+		else
+			{
+			// Open worked. Position at EOF
+			TInt pos;
+			iLogFile.Size(pos);
+			User::LeaveIfError(iLogFile.Seek(ESeekEnd,pos));
+			}
+		}
+	}
+
+CLogFileControl::~CLogFileControl()
+/**
+ * Destructor
+ * The server maintains a list of these classes and will not destruct one if there
+ * is data on its queue
+ * Destructor just closes the file handle.
+ */
+	{
+	iLogFile.Close();
+	}
+
+void CLogFileControl::RunL()
+/**
+ * Main File writing pump
+ * Called on write completion or Kick() by the session that accepts the data
+ */
+	{
+#if (defined _DEBUG)
+	_LIT(KPanic,"LogEng RunL()");
+#endif
+	__ASSERT_DEBUG(iStatus.Int() == KErrNone,User::Panic(KPanic,iStatus.Int()));
+	// Check to see if this is the result of write completion
+	if(iTransmitted)
+		{
+		// Write completed
+		// Remove the buffer at the head of the queue and free it
+		CLogBuffer* buffer = iQueue.First();
+		iQueue.Remove(*buffer);
+		delete buffer;
+		}
+	// Check to see if there's more on the queue
+	if(!iQueue.IsEmpty())
+		{
+		// There is so write the head of the queue
+		CLogBuffer* buffer = iQueue.First();	
+		SetActive();
+		// Set the flag to say we've transmitted
+		iTransmitted = ETrue;
+
+//  ------------------------------------
+		if(iLogFormat==ETxt)  WriteTxt(buffer->Buf());
+		else WriteXml(buffer->Buf());
+		} 
+	else
+		{
+		// Nothing on the queue
+		iTransmitted = EFalse;
+		// Call into the server to check if this resource can be freed
+		iParent.ControlComplete(*this);
+		}
+	}
+
+void CLogFileControl::WriteXml(const TDesC8 &aDes)
+/**
+ * @param aDes - send a aDes string in xml format to a log file
+ */
+	{
+/*--------- Maintaince Warning:  -----------------------------------
+******* the fomat of below is sensible from client original format.  
+******* Any change should match actual string formated from client. 
+******* Double check the code on client side 
+
+* The current assumtion of format:
+* First string values are seperated by sign " - " and extra pair of fields are
+* seperated from main log message  by long unusual string "LogFieldsRequiredBeingAddedToAboveLogMessage"
+* The \t used to seperate field name and field value and \r\n used to seperate
+* each other from those pairs of field
+* \t\t\t\t\t\t is used to end of whole string
+--------------------------------------------------------------------------------*/
+		_LIT8(KxmlHeader,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<LOGFILE>");
+		//The order of variables:
+		// time 		- aTime
+		// Severity 	- aSeverity
+		// Thread 		- aThread
+		// Filename 	- aFilename
+		// Linenumber 	- aLinenumber
+		// Text 		- aText
+		
+		// Start of string retrive/deformating 
+		HBufC8* pBuf1 = HBufC8::NewL(KMaxLoggerLineLength*2); //(aDes.Length()+200);
+		if(!pBuf1)
+			{
+			return; // no memory 
+			}
+		TPtr8 aPtr(pBuf1->Des());  // used for searching
+		TPtr8 alogbuf(pBuf1->Des());  //used for final log
+		aPtr.Append(aDes);
+		TPtrC8 SearchBuf;
+		TInt aCount[8]; 
+		aCount[0]=0;
+		TInt posI(0);
+
+// retrive log message:
+		// Retrive common part of log message:
+		for(TInt i = 1; i<6; i++)
+			{
+			SearchBuf.Set(aPtr.Mid(posI));
+			aCount[i]=SearchBuf.Find(KSeperation8)+posI;
+			posI=aCount[i]+3;
+			if(aCount[i]<aCount[i-1])	return; // wrong format string from client
+			}
+		// seperating common log message and extra log fields will be easy for future maintaince.
+		TLogField8* alogField = new TLogField8[6];  // the common part of log message for both 
+								  					// with and without extra log fields
+		if(!alogField) return; // no memory
+
+		TLogField8* extralogField=NULL; // only applied to extra log fields
+
+		TInt alength=0;  // a length of array of extra log fields
+
+		alogField[0].iLogTag8.Copy(_L8("TIME"));
+		alogField[1].iLogTag8.Copy(_L8("SEVERITY"));
+		alogField[2].iLogTag8.Copy(_L8("THREAD"));
+		alogField[3].iLogTag8.Copy(_L8("FILENAME"));
+		alogField[4].iLogTag8.Copy(_L8("LINENUMBER"));
+		alogField[5].iLogTag8.Copy(_L8("TEXT"));
+			
+		alogField[0].iLogValue8.Copy(aPtr.Mid(aCount[0],aCount[1]-aCount[0]));
+		for(TInt i=1; i<5; i++)
+			{
+			alogField[i].iLogValue8.Copy(aPtr.Mid(aCount[i]+3,aCount[i+1]-aCount[i]-3));				
+			}
+
+		SearchBuf.Set(aPtr.Mid(posI));
+		aCount[6]=SearchBuf.Find(_L8("LogFieldsRequiredBeingAddedToAboveLogMessage"))+posI; 
+		if(aCount[6]<posI)  // no addtional fields. Find return value is KErrNotFound or >0
+			{
+			TInt currentLength = alogField[5].iLogValue8.Length() ;
+			//this sentence will append the log info without buffer limit.
+			TInt newAppendLength = aDes.Length()-aCount[5]-5;
+			//The max length for log buff in this
+			TInt bufferLeft = alogField[5].iLogValue8.MaxLength() - currentLength;
+			// get the smaller one between the two
+			TInt enabledLength = bufferLeft > newAppendLength ? newAppendLength : bufferLeft ;
+			alogField[5].iLogValue8.Copy(aPtr.Mid(aCount[5]+3,enabledLength));
+			//alogField[5].iLogValue8.Copy(aPtr.Mid(aCount[5]+3,aDes.Length()-aCount[5]-5));
+			}
+		else
+		{
+			alogField[5].iLogValue8.Copy(aPtr.Mid(aCount[5]+3,aCount[6]-aCount[5]-5));
+			posI=aCount[6]+45;  //45 is from the length of long string and a tab
+			SearchBuf.Set(aPtr.Mid(posI));
+			aCount[7]=SearchBuf.Find(_L8("\r\n"))+posI;
+			TLex8 lex(aPtr.Mid(posI,aCount[7]-posI));  // get the length
+			TInt err=lex.Val(alength); 
+			if (err)	alength=0; // ignor the extra log fields. Let the log go
+
+			// Retrive the extra log fields
+			extralogField = new TLogField8[alength];
+			if(!extralogField) return; // no memory
+			for(TInt i=0; i<alength; i++)
+				{
+				aCount[6]=aCount[7]+2;
+				SearchBuf.Set(aPtr.Mid(aCount[6]));
+				aCount[7]=SearchBuf.Find(_L8("\t"))+aCount[6];
+				extralogField[i].iLogTag8.Copy(aPtr.Mid(aCount[6],aCount[7]-aCount[6]));
+				aCount[6]=aCount[7]+1;
+				SearchBuf.Set(aPtr.Mid(aCount[6]));
+				aCount[7]=SearchBuf.Find(_L8("\r\n"))+aCount[6];
+				extralogField[i].iLogValue8.Copy(aPtr.Mid(aCount[6],aCount[7]-aCount[6]));
+				}
+		}
+			
+			// Start to organize an XML format: 			
+			TInt afileSize;
+			_LIT(KLogMutex, "LoggingServerMutex");
+			RMutex mutex;
+			TInt r = mutex.CreateGlobal(KLogMutex);
+			if(r==KErrAlreadyExists)
+				r = mutex.OpenGlobal(KLogMutex);  
+			
+			if(!r)	mutex.Wait();  // if still failed, let logging go 
+									//without bother the mutex
+			  
+			iLogFile.Size(afileSize);
+			if(afileSize<12) // 12 is from charters of "\r\n</LOGFILE>" 
+						//It shoud happened once at the beginning of the file
+						// such as overwrite mode
+				{
+				afileSize=12; // used for lock position
+    			alogbuf.Copy(KxmlHeader);
+				}
+			alogbuf.Append(_L8("\r\n<MESSAGE>\r\n"));
+			for(TInt i=0; i<6; i++)
+				{
+				alogbuf.Append(_L8("  <"));
+				alogbuf.Append(alogField[i].iLogTag8);
+				alogbuf.Append(_L8(">"));
+				alogbuf.Append(alogField[i].iLogValue8);
+				alogbuf.Append(_L8("</"));
+				alogbuf.Append(alogField[i].iLogTag8);
+				alogbuf.Append(_L8(">\r\n"));				
+				}
+			for(TInt i=0; i<alength; i++)  
+				{
+				alogbuf.Append(_L8("  <"));
+				alogbuf.Append(extralogField[i].iLogTag8);
+				alogbuf.Append(_L8(">"));
+				alogbuf.Append(extralogField[i].iLogValue8);
+				alogbuf.Append(_L8("</"));
+				alogbuf.Append(extralogField[i].iLogTag8);
+				alogbuf.Append(_L8(">\r\n"));				
+				}
+			
+    		alogbuf.Append(_L8("</MESSAGE>"));
+    		alogbuf.Append(_L8("\r\n</LOGFILE>"));
+    		
+    		iLogFile.Write(afileSize-12,alogbuf,iStatus);
+    		iLogFile.Flush();							
+			
+			if(!r)	
+				{
+				mutex.Signal();
+				mutex.Close();				
+				} 
+				
+		if(extralogField) delete[] extralogField;
+		delete[] alogField;	
+		delete pBuf1;
+
+	}
+
+void CLogFileControl::WriteTxt(const TDesC8 &aDes)
+/**
+ * @param aDes - send a aDes string in xml format to a log file
+ */
+	{
+/*--------- Maintaince Warning for aLogBuffer -----------------------------------
+******* the fomat of below is sensible from client original format.  
+******* Any change should match actual string formated from client. 
+******* Double check the code on client side 
+
+* The current assumtion of format:
+* First string values are seperated by sign " - " and extra pair of fields are
+* seperated from main log message  by long unusual string "LogFieldsRequiredBeingAddedToAboveLogMessage"
+* The \t used to seperate field name and field value and \r\n used to seperate
+* each other from those pairs of field
+--------------------------------------------------------------------------------*/
+	iLogFile.Write(aDes,iStatus);
+	}
+///////
+CLogBuffer::CLogBuffer(HBufC8& aLogBuffer) : iLogBuffer(aLogBuffer)
+/**
+ * @param aLogBuffer - Heap descriptor. This class takes ownership
+ * Constructor
+ */
+	{
+	}
+
+CLogBuffer::~CLogBuffer()
+/**
+ * Destructor
+ * This class owns a heap buffer so just free it
+ */
+	{
+	delete &iLogBuffer;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/server.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file Server.h
+*/
+
+#if (!defined __ET_RFILELOGGER_SERVER_H__)
+#define __ET_RFILELOGGER_SERVER_H__
+#include <e32base.h>
+#include <f32file.h>
+#include <rfilelogger.h>
+
+
+class CActiveBase : public CActive
+	{
+public:
+	inline 	TRequestStatus& Status();
+	inline 	void SetActive();
+	inline	void Kick();
+	inline	void Prime();
+	inline	void Complete(TInt aCode);
+	inline	virtual ~CActiveBase();
+protected:
+	inline	CActiveBase();
+	};
+
+class CLogBuffer : public CBase
+	{
+public:
+	CLogBuffer(HBufC8& aBuffer);
+	~CLogBuffer();
+	inline const TDesC8& Buf();
+	inline static TInt LinkOffset();
+private:
+	TSglQueLink iLink;
+	HBufC8& iLogBuffer;
+	};
+
+class CLogServer;
+class CLogFileControl : public CActiveBase
+	{
+public:
+	enum TLogFormat{ETxt=10,EXml};
+	
+	static CLogFileControl* NewL(CLogServer& aParent, const TDesC& aLogFilePath,RFileFlogger::TLogMode aMode);
+	~CLogFileControl();
+	void RunL();
+	inline void AddLogBuffer(CLogBuffer& aBuffer);
+	inline const TDesC& LogFile();
+	inline void DoCancel();
+	inline void AddSession();
+	inline void RemoveSession();
+	inline TInt SessionCount() const;
+	inline TBool QueueEmpty() const;
+	void SetLogType(TLogFormat aLogFormat)
+	{
+		iLogFormat=aLogFormat;
+	};
+
+private:
+	void ConstructL(RFileFlogger::TLogMode aMode);
+	CLogFileControl(CLogServer& aParent, const TDesC& aLogFilePath);
+	void WriteTxt(const TDesC8 &aDes);
+	void WriteXml(const TDesC8 &aDes);
+	
+	struct TLogField8
+	{
+	TBuf8<KMaxSizOfTag> iLogTag8;
+	TBuf8<KMaxSizOfString*2> iLogValue8;	
+	};
+
+private:
+	CLogServer& iParent;
+	TBuf<KMaxLoggerFilePath> iLogFileName;
+	RFile iLogFile;
+	TSglQue<CLogBuffer> iQueue;
+	TInt iSessionCount;
+	TBool iTransmitted;
+	TLogFormat iLogFormat;
+	};
+
+class CLogServer : public CServer2
+	{
+public:
+	static CLogServer* NewL();
+	~CLogServer();
+	void ControlComplete(CLogFileControl& aControl);
+	
+	inline RPointerArray<CLogFileControl>& LogControl();
+	inline RFs& Fs();
+
+	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
+	void SessionClosed();
+private:
+	CLogServer();
+	void ConstructL();
+private:
+	RFs iFs;
+	RPointerArray<CLogFileControl> iControl;
+	};
+
+class CLogSession : public CSession2
+	{
+public:
+	inline const CLogServer& LogServer() const;
+	CLogSession();
+	~CLogSession();
+	void ServiceL(const RMessage2& aMessage);
+private:
+	CLogFileControl* iControl;
+	};
+
+#include "Server.inl"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/src/server.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+
+inline TRequestStatus& CActiveBase::Status()
+	{return iStatus;}
+
+inline void CActiveBase::SetActive()
+	{
+	if(!IsActive())
+		CActive::SetActive();
+	}
+
+inline void CActiveBase::Kick()
+	{
+	Prime();
+	Complete(KErrNone);
+	}
+
+inline void CActiveBase::Prime()
+	{
+	iStatus = KRequestPending;
+	if(!IsActive())
+		CActive::SetActive();
+	}
+
+inline void CActiveBase::Complete(TInt aCode)
+	{
+	TRequestStatus* status = &iStatus;
+	User::RequestComplete(status,aCode);
+	}
+
+inline	CActiveBase::CActiveBase() : CActive(EPriorityStandard)
+	{CActiveScheduler::Add(this);}
+
+inline CActiveBase::~CActiveBase()
+	{}
+
+///////
+inline const TDesC& CLogFileControl::LogFile()
+	{return iLogFileName;}
+
+inline void CLogFileControl::DoCancel()
+	{}
+
+inline void CLogFileControl::AddSession()
+	{iSessionCount++;}
+
+inline void CLogFileControl::RemoveSession()
+	{iSessionCount--;}
+
+inline TInt CLogFileControl::SessionCount() const
+	{return iSessionCount;}
+
+inline TBool CLogFileControl::QueueEmpty() const
+	{return iQueue.IsEmpty();}
+
+inline void CLogFileControl::AddLogBuffer(CLogBuffer& aBuffer)
+	{iQueue.AddLast(aBuffer);}
+
+///////
+inline RPointerArray<CLogFileControl>& CLogServer::LogControl()
+	{return iControl;}
+
+inline RFs& CLogServer::Fs()
+	{return iFs;}
+
+///////
+inline const TDesC8& CLogBuffer::Buf()
+	{return iLogBuffer;} 
+
+inline TInt CLogBuffer::LinkOffset()
+	{return _FOFF(CLogBuffer,iLink);}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+PRJ_TESTEXPORTS
+..\scripts\te_rfileloggersuite.script		\epoc32\release\wins\udeb\z\testdata\scripts\te_rfileloggersuite.script
+..\scripts\te_rfileloggersuite.script		\epoc32\release\wins\urel\z\testdata\scripts\te_rfileloggersuite.script
+..\scripts\te_rfileloggersuite.script		\epoc32\release\winscw\udeb\z\testdata\scripts\te_rfileloggersuite.script
+..\scripts\te_rfileloggersuite.script		\epoc32\release\winscw\urel\z\testdata\scripts\te_rfileloggersuite.script
+
+..\testdata\te_rfileloggersuite.ini	\epoc32\release\wins\udeb\z\testdata\configs\te_rfileloggersuite.ini
+..\testdata\te_rfileloggersuite.ini	\epoc32\release\wins\urel\z\testdata\configs\te_rfileloggersuite.ini
+..\testdata\te_rfileloggersuite.ini	\epoc32\release\winscw\udeb\z\testdata\configs\te_rfileloggersuite.ini
+..\testdata\te_rfileloggersuite.ini	\epoc32\release\winscw\urel\z\testdata\configs\te_rfileloggersuite.ini
+
+
+.\te_rfileloggersuite.iby   		\epoc32\rom\include\te_rfileloggersuite.iby
+
+
+PRJ_TESTMMPFILES
+te_rfileloggersuite.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/group/te_rfileloggersuite.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,26 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __TE_RFILELOGGER_SUITE_IBY__
+#define __TE_RFILELOGGER_SUITE_IBY__
+
+#include <testexecute.iby>
+
+file=ABI_DIR\DEBUG_DIR\te_rfileloggersuite.exe		system\bin\te_rfileloggersuite.exe
+data=EPOCROOT##epoc32\release\winscw\udeb\z\testdata\configs\te_rfileloggersuite.ini testdata\configs\te_rfileloggersuite.ini
+data=EPOCROOT##epoc32\release\winscw\udeb\z\testdata\scripts\te_rfileloggersuite.script testdata\scripts\te_rfileloggersuite.script
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/group/te_rfileloggersuite.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+SMPSAFE
+
+
+          TARGET      te_rfileloggersuite.exe
+          TARGETTYPE  exe
+          UID             0x1000007A 0x102089CD
+
+//Please add any change under here
+SOURCEPATH  ../src
+SOURCE	              te_rfileloggersuiteserver.cpp
+SOURCE	              te_rfileloggersuitestepbase.cpp
+SOURCE              addfield_logstep.cpp
+SOURCE              conn_closestep.cpp
+	
+
+USERINCLUDE   ../src
+
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/test
+
+//Please add your system include under here. 
+
+LIBRARY         euser.lib
+LIBRARY		testexecuteutils.lib 
+LIBRARY		testexecutelogclient.lib 
+
+//Please add your libraries under here.
+LIBRARY rfileloggerclient.lib
+
+
+CAPABILITY ALL -Tcb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/scripts/te_rfileloggersuite.script	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2005-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: 
+//
+PRINT Run all te_RFileLogger Suite Tests
+
+//
+LOAD_SUITE te_RFileLoggerSuite
+//
+//Please add or make change of you test steps, here is sample only:
+
+
+CONCURRENT  
+// Seems only 4 threads allowed from TEF. Here is the maximum:
+RUN_TEST_STEP 100 te_RFileLoggerSuite addfield_logStep z:\testdata\configs\te_RFileLoggerSuite.ini Section0
+RUN_TEST_STEP 100 te_RFileLoggerSuite addfield_logStep z:\testdata\configs\te_RFileLoggerSuite.ini Section0
+RUN_TEST_STEP 100 te_RFileLoggerSuite addfield_logStep z:\testdata\configs\te_RFileLoggerSuite.ini Section0
+RUN_TEST_STEP 100 te_RFileLoggerSuite addfield_logStep z:\testdata\configs\te_RFileLoggerSuite.ini Section0
+
+CONSECUTIVE
+RUN_TEST_STEP 100 te_RFileLoggerSuite conn_closeStep z:\testdata\configs\te_RFileLoggerSuite.ini Section1
+
+PRINT Complate_te_RFileLogger_Tests
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/addfield_logstep.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,245 @@
+/*
+* Copyright (c) 2005-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:  
+* Example CTestStep derived implementation
+*
+*/
+
+
+
+/**
+ @file addfield_logStep.cpp
+*/
+#include "addfield_logstep.h"
+#include "te_rfileloggersuitedefs.h"
+
+_LIT(K16BitText,"This is a short line of 16 Bit Text");
+_LIT(K16BitFormatText,"logger string int = %d,  string = %S");
+_LIT(K16BitString,"The String16");
+
+Caddfield_logStep::~Caddfield_logStep()
+/**
+ * Destructor
+ */
+	{
+	}
+
+Caddfield_logStep::Caddfield_logStep()
+/**
+ * Constructor
+ */
+	{
+	// **MUST** call SetTestStepName in the constructor as the controlling
+	// framework uses the test step name immediately following construction to set
+	// up the step's unique logging ID.
+	SetTestStepName(Kaddfield_logStep);
+	}
+
+TVerdict Caddfield_logStep::doTestStepPreambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	CTe_RFileLoggerSuiteStepBase::doTestStepPreambleL();
+		SetTestStepResult(EPass);
+	return TestStepResult();
+	}
+
+
+TVerdict Caddfield_logStep::doTestStepL()
+/**
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ * Our implementation only gets called if the base class doTestStepPreambleL() did
+ * not leave. That being the case, the current test result value will be EPass.
+ */
+	{
+	
+	if(TestStepResult()==EFail) return TestStepResult();
+	INFO_PRINTF1(_L("AddField test and logging test")); 
+
+	// OS needs time to shutdown the server in case being connected previous test
+	// The delay means we get server terminated from the OS
+//	
+	RFileFlogger ilogger;
+	TInt err=ilogger.Connect();
+	if(err)
+	{
+		INFO_PRINTF2(_L("Connect() failed. err = %d"),err);
+		SetTestStepResult(EFail);
+		return TestStepResult();
+	}
+	err=ilogger.CreateLog(KLogFile1,RFileFlogger::ELogModeAppend);
+//	err=ilogger.CreateLog(KLogFile1,RFileFlogger::ELogModeOverWrite);
+	//ELogModeAppend
+	if(!err)
+	{
+		INFO_PRINTF1(_L("xml format file open passed and test start"));
+	}
+	else  
+	{
+		ERR_PRINTF2(_L("error value = %d"),err);
+		SetTestStepResult(EFail);
+		return TestStepResult();
+
+	}
+
+	TBuf<20> buf16(K16BitString);
+	TInt n=0;
+	ilogger.SetLogLevel(RFileFlogger::ESevrAll);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrHigh, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrMedium, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrLow, K16BitFormatText,n++,&buf16);
+
+	INFO_PRINTF1(_L("test ESevrErr"));
+	ilogger.SetLogLevel(RFileFlogger::ESevrErr);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+
+	INFO_PRINTF1(_L("test log with add fileds"));
+	TInt aLength = 2;
+	TExtraLogField logField[2];
+	logField[0].iLogFieldName.Copy(_L("SUITE_NAME"));
+	logField[0].iLogFieldValue.Copy(_L("SUITE_VALUE"));
+	logField[1].iLogFieldName.Copy(_L("TEST_NAME"));
+	logField[1].iLogFieldValue.Copy(_L("TEST_VALUE"));
+	
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrErr, aLength, logField, K16BitFormatText,n++,&buf16);
+
+
+	INFO_PRINTF1(_L("test ESevrWarn"));
+	n=0;
+	ilogger.SetLogLevel(RFileFlogger::ESevrWarn);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrErr, K16BitFormatText,n++,&buf16);
+
+	INFO_PRINTF1(_L("test ESevrInfo"));
+	n=0;
+	ilogger.SetLogLevel(RFileFlogger::ESevrInfo);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrErr, K16BitFormatText,n++,&buf16);
+
+	INFO_PRINTF1(_L("test ESevrAll"));
+	n=0;
+	ilogger.SetLogLevel(RFileFlogger::ESevrAll);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrErr, K16BitFormatText,n++,&buf16);
+// txt log test
+	ilogger.Close();
+	err=ilogger.Connect();
+	if(err)
+	{
+		INFO_PRINTF2(_L("Connect() failed. err = %d"),err);
+		SetTestStepResult(EFail);
+		return TestStepResult();
+	}
+	INFO_PRINTF1(_L("RFileFlogger::ELogModeAppend test ..."));
+	err=ilogger.CreateLog(KLogFiletxt,RFileFlogger::ELogModeAppend);
+	if(!err)
+	{
+	    INFO_PRINTF1(_L("RFileFlogger::ELogModeAppend testing is fine"));
+		INFO_PRINTF1(_L("txt format file open passed and test start"));
+	}
+	else  
+	{
+		ERR_PRINTF2(_L("error value = %d"),err);
+		SetTestStepResult(EFail);
+		return TestStepResult();
+
+	}
+
+	n=0;
+	ilogger.SetLogLevel(RFileFlogger::ESevrAll);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrHigh, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrMedium, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrLow, K16BitFormatText,n++,&buf16);
+
+	INFO_PRINTF1(_L("test ESevrErr"));
+	ilogger.SetLogLevel(RFileFlogger::ESevrErr);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+
+	INFO_PRINTF1(_L("test log with add fileds"));
+    aLength = 2;
+	logField[0].iLogFieldName.Copy(_L("SUITE_NAME"));
+	logField[0].iLogFieldValue.Copy(_L("SUITE_VALUE"));
+	logField[1].iLogFieldName.Copy(_L("TEST_NAME"));
+	logField[1].iLogFieldValue.Copy(_L("TEST_VALUE"));
+	
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrErr, aLength, logField, K16BitFormatText,n++,&buf16);
+
+	
+	INFO_PRINTF1(_L("test ESevrWarn"));
+	n=0;
+	ilogger.SetLogLevel(RFileFlogger::ESevrWarn);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrErr, K16BitFormatText,n++,&buf16);
+
+	INFO_PRINTF1(_L("test ESevrInfo"));
+	n=0;
+	ilogger.SetLogLevel(RFileFlogger::ESevrInfo);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrErr, K16BitFormatText,n++,&buf16);
+
+	INFO_PRINTF1(_L("test ESevrAll"));
+	n=0;
+	ilogger.SetLogLevel(RFileFlogger::ESevrAll);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrAll, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrInfo, K16BitFormatText,n++,&buf16);
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrWarn, K16BitFormatText,n++,&buf16);
+
+	ilogger.Log(((TText8*)__FILE__), __LINE__,RFileFlogger::ESevrErr, K16BitFormatText,n++,&buf16);
+
+
+	ilogger.Close();
+	
+	INFO_PRINTF1(_L("test finished"));
+	
+	return TestStepResult();
+	}
+
+
+
+TVerdict Caddfield_logStep::doTestStepPostambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/addfield_logstep.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file addfield_logStep.h
+*/
+#if (!defined __ADDFIELD_LOG_STEP_H__)
+#define __ADDFIELD_LOG_STEP_H__
+#include <testexecutestepbase.h>
+#include "te_rfileloggersuitestepbase.h"
+
+class Caddfield_logStep : public CTe_RFileLoggerSuiteStepBase
+	{
+public:
+	Caddfield_logStep();
+	~Caddfield_logStep();
+	virtual TVerdict doTestStepPreambleL();
+	virtual TVerdict doTestStepL();
+	virtual TVerdict doTestStepPostambleL();
+
+// Please add/modify your class members here:
+private:
+	};
+
+_LIT(Kaddfield_logStep,"addfield_logStep");
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/conn_closestep.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2005-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:  
+* Example CTestStep derived implementation
+*
+*/
+
+
+
+/**
+ @file conn_closeStep.cpp
+*/
+#include "conn_closestep.h"
+#include "te_rfileloggersuitedefs.h"
+
+Cconn_closeStep::~Cconn_closeStep()
+/**
+ * Destructor
+ */
+	{
+	}
+
+Cconn_closeStep::Cconn_closeStep()
+/**
+ * Constructor
+ */
+	{
+	// **MUST** call SetTestStepName in the constructor as the controlling
+	// framework uses the test step name immediately following construction to set
+	// up the step's unique logging ID.
+	SetTestStepName(Kconn_closeStep);
+	}
+
+TVerdict Cconn_closeStep::doTestStepPreambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	CTe_RFileLoggerSuiteStepBase::doTestStepPreambleL();
+	return TestStepResult();
+	}
+
+
+TVerdict Cconn_closeStep::doTestStepL()
+/**
+ * @return - TVerdict code
+ * Override of base class pure virtual
+ * Our implementation only gets called if the base class doTestStepPreambleL() did
+ * not leave. That being the case, the current test result value will be EPass.
+ */
+	{
+	if(TestStepResult()==EFail) return TestStepResult();
+	TInt err;
+	INFO_PRINTF1(_L("1.  Connect test ..."));
+	RFileFlogger ilogger;  
+	err=ilogger.Connect();
+	if(err!=KErrNone) 
+	{
+		ERR_PRINTF2(_L("Connect error. The error number = %d"),err);
+		SetTestStepResult(EFail);
+		return TestStepResult();
+	}
+	else  INFO_PRINTF1(_L("Connect test passed"));
+	err=ilogger.Connect();
+	INFO_PRINTF1(_L("2.  Connect again test after connected"));
+	if(err==KErrAlreadyExists)
+	{
+		INFO_PRINTF2(_L("Test pass. Return value = %d as expected"),err);
+	}
+	else  
+	{
+		ERR_PRINTF2(_L("Failed. the error = %d"), err);
+		SetTestStepResult(EFail);
+		return TestStepResult();
+
+	}
+	INFO_PRINTF1(_L("3.  Close test..."));
+	ilogger.Close();
+	err=ilogger.Connect();
+	if(!err)
+	{
+		INFO_PRINTF1(_L("Close test passed"));
+	}
+	else  
+	{
+		ERR_PRINTF2(_L("Close error value = %d"),err);
+		SetTestStepResult(EFail);
+		return TestStepResult();
+
+	}
+	INFO_PRINTF1(_L("4.  CreateLog test..."));	
+	err=ilogger.CreateLog(KLogFile1,RFileFlogger::ELogModeAppend);
+	if(!err)
+	{
+		INFO_PRINTF1(_L("CreateLog test passed"));
+	}
+	else  
+	{
+		ERR_PRINTF2(_L("CreateLog error value = %d"),err);
+		SetTestStepResult(EFail);
+		return TestStepResult();
+
+	}
+	ilogger.Close();
+
+	return TestStepResult();
+	}
+
+
+
+TVerdict Cconn_closeStep::doTestStepPostambleL()
+/**
+ * @return - TVerdict code
+ * Override of base class virtual
+ */
+	{
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/conn_closestep.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file conn_closeStep.h
+*/
+#if (!defined __CONN_CLOSE_STEP_H__)
+#define __CONN_CLOSE_STEP_H__
+#include <testexecutestepbase.h>
+#include "te_rfileloggersuitestepbase.h"
+
+class Cconn_closeStep : public CTe_RFileLoggerSuiteStepBase
+	{
+public:
+	Cconn_closeStep();
+	~Cconn_closeStep();
+	virtual TVerdict doTestStepPreambleL();
+	virtual TVerdict doTestStepL();
+	virtual TVerdict doTestStepPostambleL();
+
+// Please add/modify your class members here:
+private:
+	};
+
+_LIT(Kconn_closeStep,"conn_closeStep");
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuitedefs.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005-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:  
+* This file define all the common values thoughout your test project
+*
+*/
+
+
+
+/**
+ @file Te_RFileLoggerSuiteDefs.h
+*/
+#if (!defined __TE_RFILELOGGER_SUITEDEFS_H__)
+#define __TE_RFILELOGGER_SUITEDEFS_H__
+
+// Please modify below value with your project and must match with your configuration ini file which is required to be modified as well
+_LIT(KLogFile1,"c:\\RFileLoggerTest.xml");
+_LIT(KLogFiletxt,"c:\\RFileLoggerTest.txt");
+
+// For test step panics
+_LIT(KTe_RFileLoggerSuitePanic,"Te_RFileLoggerSuite");
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuiteserver.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2005-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:  
+* for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
+* in the process of the client. The client initialises the server by calling the
+* one and only ordinal.
+*
+*/
+
+
+
+/**
+ @file Te_RFileLoggerSuiteServer.cpp
+*/
+
+#include "te_rfileloggersuiteserver.h"
+#include "addfield_logstep.h"
+#include "conn_closestep.h"
+
+_LIT(KServerName,"Te_RFileLoggerSuite");
+CTe_RFileLoggerSuite* CTe_RFileLoggerSuite::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+	{
+	CTe_RFileLoggerSuite * server = new (ELeave) CTe_RFileLoggerSuite();
+	CleanupStack::PushL(server);
+	// CServer base class call which can be either StartL or ConstructL,
+	// the later will permit Server Logging.
+
+	server->StartL(KServerName);
+	//server->ConstructL(KServerName);
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+
+// Secure variants much simpler
+// For EKA2, just an E32Main and a MainL()
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+	// Leave the hooks in for platform security
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().DataCaging(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler* sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CTe_RFileLoggerSuite* server = NULL;
+	// Create the CTestServer derived server
+	TRAPD(err,server = CTe_RFileLoggerSuite::NewL());
+	if(!err)
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	delete server;
+	delete sched;
+	}
+
+
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAPD(err,MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
+
+
+CTestStep* CTe_RFileLoggerSuite::CreateTestStep(const TDesC& aStepName)
+/**
+ * @return - A CTestStep derived instance
+ * Secure and non-secure variants
+ * Implementation of CTestServer pure virtual
+ */
+	{
+	CTestStep* testStep = NULL;
+	// They are created "just in time" when the worker thread is created
+	// More test steps can be added below 
+              if(aStepName == Kaddfield_logStep)
+                            testStep = new Caddfield_logStep();
+              else if(aStepName == Kconn_closeStep)
+                            testStep = new Cconn_closeStep();
+
+	return testStep;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuiteserver.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file Te_RFileLoggerSuiteServer.h
+*/
+
+#if (!defined __TE_RFILELOGGER_SERVER_H__)
+#define __TE_RFILELOGGER_SERVER_H__
+#include <testexecuteserverbase.h>
+
+
+class CTe_RFileLoggerSuite : public CTestServer
+	{
+public:
+	static CTe_RFileLoggerSuite* NewL();
+	// Base class pure virtual override
+	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
+
+// Please Add/modify your class members
+private:
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuitestepbase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file Te_RFileLoggerSuiteStepBase.cpp
+*/
+
+#include "te_rfileloggersuitestepbase.h"
+#include "te_rfileloggersuitedefs.h"
+
+// Device driver constants
+
+TVerdict CTe_RFileLoggerSuiteStepBase::doTestStepPreambleL()
+/**
+ * @return - TVerdict
+ * Implementation of CTestStep base class virtual
+ * It is used for doing all initialisation common to derived classes in here.
+ * Make it being able to leave if there are any errors here as there's no point in
+ * trying to run a test step if anything fails.
+ * The leave will be picked up by the framework.
+ */
+	{
+
+	SetTestStepResult(EPass);
+	return TestStepResult();
+	}
+
+TVerdict CTe_RFileLoggerSuiteStepBase::doTestStepPostambleL()
+/**
+ * @return - TVerdict
+ * Implementation of CTestStep base class virtual
+ * It is used for doing all after test treatment common to derived classes in here.
+ * Make it being able to leave
+ * The leave will be picked up by the framework.
+ */
+	{
+
+	return TestStepResult();
+	}
+
+CTe_RFileLoggerSuiteStepBase::~CTe_RFileLoggerSuiteStepBase()
+	{
+	}
+
+CTe_RFileLoggerSuiteStepBase::CTe_RFileLoggerSuiteStepBase()
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuitestepbase.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+/**
+ @file Te_RFileLoggerSuiteStepBase.h
+*/
+
+#if (!defined __TE_RFILELOGGER_STEP_BASE__)
+#define __TE_RFILELOGGER_STEP_BASE__
+#include <testexecutestepbase.h>
+#include <rfilelogger.h>
+// Please add your include here if you have 
+
+/****************************************************************************
+* The reason to have a new step base is that it is very much possible
+* that the all individual test steps have project related common variables 
+* and members 
+* and this is the place to define these common variable and members.
+* 
+****************************************************************************/
+class CTe_RFileLoggerSuiteStepBase : public CTestStep
+	{
+public:
+	virtual ~CTe_RFileLoggerSuiteStepBase();
+	CTe_RFileLoggerSuiteStepBase();
+	virtual TVerdict doTestStepPreambleL(); 
+	virtual TVerdict doTestStepPostambleL();
+
+//Please add your class members which will be common to all individual test steps:
+protected:
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/testdata/te_rfileloggersuite.ini	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,10 @@
+
+[Section0]
+TheString=addfield_logStep
+TheInt=0
+TheBool=False
+
+[Section1]
+TheString=conn_closeStep
+TheInt=1
+TheBool=True
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/test/src/testlogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2005-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:  
+* Neil Taylor
+* System Includes
+*
+*/
+
+
+
+#include <e32base.h>
+#include <e32cons.h>
+
+#include <test/rfilelogger.h>
+
+/********************************************************************************
+ * Externally available test functions
+ * TInt CreateTextTest(void)
+ * TInt CreateXMLTest(void)
+ * TInt AppendXMLTest(void)
+ ********************************************************************************/
+
+static TInt WriteTextTest(RFileFlogger& logger);
+static TInt LogLevelTest(RFileFlogger& logger);
+static TInt LogAdditionalFieldsTest(RFileFlogger& logger);
+
+TInt CreateTextTest(void)
+{
+	TInt	err =	KErrNone;
+
+	RFileFlogger	logger;
+
+	err =	logger.Connect( );
+	err =	logger.CreateLog( _L("C:\\logs\\logger.txt"), RFileFlogger::ELogModeOverWrite );
+
+	WriteTextTest( logger );
+	LogLevelTest( logger );
+	LogAdditionalFieldsTest( logger );
+
+	logger.Close( );
+
+	return ( err );
+}
+
+TInt CreateXMLTest(void)
+{
+	TInt	err =	KErrNone;
+
+	RFileFlogger	logger;
+
+	err =	logger.Connect( );
+	err =	logger.CreateLog( _L("C:\\logger.xml"), RFileFlogger::ELogModeOverWrite );
+
+	WriteTextTest( logger );
+	LogLevelTest( logger );
+	LogAdditionalFieldsTest( logger );
+
+	logger.Close( );
+
+	return ( err );
+}
+
+TInt AppendXMLTest(void)
+{
+	TInt	err =	KErrNone;
+
+	RFileFlogger	logger;
+
+	err =	logger.Connect( );
+	err =	logger.CreateLog( _L("C:\\logger.xml"), RFileFlogger::ELogModeAppend );
+
+	WriteTextTest( logger );
+
+	logger.Close( );
+
+	return ( err );
+}
+
+TInt WriteTextTest(RFileFlogger& logger)
+{
+	TInt	err =	KErrNone;
+
+	logger.Log( ((TText8*)(__FILE__)), __LINE__, RFileFlogger::ESevrWarn, _L("This is a warning.") );
+
+	return ( err );
+}
+
+TInt LogLevelTest(RFileFlogger& logger)
+{
+	TInt	err =	KErrNone;
+
+	logger.SetLogLevel( RFileFlogger::ESevrAll );
+	logger.Log( ((TText8*)(__FILE__)), __LINE__, RFileFlogger::ESevrInfo, _L("This is the first info log.") );
+	logger.SetLogLevel( RFileFlogger::ESevrErr );
+	logger.Log( ((TText8*)(__FILE__)), __LINE__, RFileFlogger::ESevrInfo, _L("This is the second info log.") );
+	logger.SetLogLevel( RFileFlogger::ESevrAll );
+	logger.Log( ((TText8*)(__FILE__)), __LINE__, RFileFlogger::ESevrInfo, _L("This is the third info log.") );
+
+	return ( err );
+}
+
+TInt LogAdditionalFieldsTest(RFileFlogger& logger)
+{
+	TInt	err =	KErrNone;
+
+	TExtraLogField	fields[2];
+
+	fields[0].iLogFieldName =	_L("Animal");
+	fields[0].iLogFieldValue =	_L("Rabbit");
+	fields[1].iLogFieldName =	_L("City");
+	fields[1].iLogFieldValue =	_L("London");
+
+	logger.Log( ((TText8*)(__FILE__)), __LINE__, RFileFlogger::ESevrInfo, 2, fields, _L("This is %d fields."), 2 );
+
+	return ( err );
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/bwins/iniparseru.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,18 @@
+EXPORTS
+	??0CIniData@@IAE@ABVTDesC16@@@Z @ 1 NONAME ; CIniData::CIniData(class TDesC16 const &)
+	??0CIniData@@IAE@XZ @ 2 NONAME ; CIniData::CIniData(void)
+	??1CIniData@@UAE@XZ @ 3 NONAME ; CIniData::~CIniData(void)
+	?AddValue@CIniData@@QAEHABVTDesC16@@00@Z @ 4 NONAME ; int CIniData::AddValue(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?AddValue@CIniData@@QAEHABVTDesC16@@0@Z @ 5 NONAME ; int CIniData::AddValue(class TDesC16 const &, class TDesC16 const &)
+	?ConstructL@CIniData@@IAEXABVTDesC16@@@Z @ 6 NONAME ; void CIniData::ConstructL(class TDesC16 const &)
+	?FindVar@CIniData@@QAEHABVTDesC16@@0AAH@Z @ 7 NONAME ; int CIniData::FindVar(class TDesC16 const &, class TDesC16 const &, int &)
+	?FindVar@CIniData@@QAEHABVTDesC16@@0AAVTPtrC16@@@Z @ 8 NONAME ; int CIniData::FindVar(class TDesC16 const &, class TDesC16 const &, class TPtrC16 &)
+	?FindVar@CIniData@@QAEHABVTDesC16@@AAH@Z @ 9 NONAME ; int CIniData::FindVar(class TDesC16 const &, int &)
+	?FindVar@CIniData@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 10 NONAME ; int CIniData::FindVar(class TDesC16 const &, class TPtrC16 &)
+	?NewL@CIniData@@SAPAV1@ABVTDesC16@@0@Z @ 11 NONAME ; class CIniData * CIniData::NewL(class TDesC16 const &, class TDesC16 const &)
+	?NewL@CIniData@@SAPAV1@ABVTDesC16@@@Z @ 12 NONAME ; class CIniData * CIniData::NewL(class TDesC16 const &)
+	?SetValue@CIniData@@QAEHABVTDesC16@@00@Z @ 13 NONAME ; int CIniData::SetValue(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?SetValue@CIniData@@QAEHABVTDesC16@@0@Z @ 14 NONAME ; int CIniData::SetValue(class TDesC16 const &, class TDesC16 const &)
+	?WriteToFileL@CIniData@@QAEXXZ @ 15 NONAME ; void CIniData::WriteToFileL(void)
+	?FindVar@CIniData@@QAEHABVTDesC16@@0AA_J@Z @ 16 NONAME ; int CIniData::FindVar(class TDesC16 const &, class TDesC16 const &, long long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/eabi/iniparseru.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,24 @@
+EXPORTS
+	_ZN8CIniData10ConstructLERK7TDesC16 @ 1 NONAME
+	_ZN8CIniData12WriteToFileLEv @ 2 NONAME
+	_ZN8CIniData4NewLERK7TDesC16 @ 3 NONAME
+	_ZN8CIniData4NewLERK7TDesC16S2_ @ 4 NONAME
+	_ZN8CIniData7FindVarERK7TDesC16R7TPtrC16 @ 5 NONAME
+	_ZN8CIniData7FindVarERK7TDesC16Ri @ 6 NONAME
+	_ZN8CIniData7FindVarERK7TDesC16S2_R7TPtrC16 @ 7 NONAME
+	_ZN8CIniData7FindVarERK7TDesC16S2_Ri @ 8 NONAME
+	_ZN8CIniData8AddValueERK7TDesC16S2_ @ 9 NONAME
+	_ZN8CIniData8AddValueERK7TDesC16S2_S2_ @ 10 NONAME
+	_ZN8CIniData8SetValueERK7TDesC16S2_ @ 11 NONAME
+	_ZN8CIniData8SetValueERK7TDesC16S2_S2_ @ 12 NONAME
+	_ZN8CIniDataC1ERK7TDesC16 @ 13 NONAME
+	_ZN8CIniDataC1Ev @ 14 NONAME
+	_ZN8CIniDataC2ERK7TDesC16 @ 15 NONAME
+	_ZN8CIniDataC2Ev @ 16 NONAME
+	_ZN8CIniDataD0Ev @ 17 NONAME
+	_ZN8CIniDataD1Ev @ 18 NONAME
+	_ZN8CIniDataD2Ev @ 19 NONAME
+	_ZTI8CIniData @ 20 NONAME ; #<TI>#
+	_ZTV8CIniData @ 21 NONAME ; #<VT>#
+	_ZN8CIniData7FindVarERK7TDesC16S2_Rx @ 22 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2005-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:  
+// Reads configuration from ini files for test programs
+//
+
+/**
+ @file
+*/
+
+
+PRJ_EXPORTS
+..\inc\iniparser.h \epoc32\include\iniparser.h
+.\iniparser.iby   	\epoc32\rom\include\iniparser.iby
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+iniparser.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/inifileparser.mrp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2005-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:
+#
+
+component	ana_testfw_testexecmdw_inifileparser
+source		/src/tools/ana/testfw/testexecmdw/inifileparser
+exports		/src/tools/ana/testfw/testexecmdw/inifileparser/group
+binary		/src/tools/ana/testfw/testexecmdw/inifileparser/group	all
+notes_source    /src/tools/ana/testfw/testexecmdw/inifileparser/group/release.txt
+
+
+#  == IPR section auto-inserted from distribution.policy files  ==
+ipr T 
+
+# == end auto-inserted section ==
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/iniparser.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description: 
+// Conditional includes for All capabilities
+//
+
+// Uncomment these lines for an All Capability build
+//#if !defined (TEF_ALL_CAP)
+//#define TEF_ALL_CAP
+//#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/iniparser.iby	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2005-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: 
+//
+
+#ifndef __INIPARSER_IBY__
+#define __INIPARSER_IBY__
+
+file=ABI_DIR\DEBUG_DIR\iniparser.dll	sys\bin\iniparser.dll
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/iniparser.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+#include "iniparser.cfg"
+
+TARGET			iniparser.dll
+
+CAPABILITY All
+
+APP_LAYER_SYSTEMINCLUDE
+
+
+TARGETTYPE		dll
+UID    			0x1000008d 0x10210D51
+VENDORID 0x70000001
+SOURCEPATH		../src
+SOURCE			iniparser.cpp
+USERINCLUDE		../inc
+SYSTEMINCLUDE	/epoc32/include
+LIBRARY			efsrv.lib euser.lib
+
+#if defined(WINS)
+#elif defined(GCC32)
+DEFFILE			..\arm4\iniparser.def
+#else
+DEFFILE			..\eabi\iniparser.def
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/group/release.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5 @@
+NOTESRC_RELEASER
+Nokia Corporation.
+
+NOTESRC_RELEASE_REASON
+inifileparser release.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/inc/iniparser.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2005-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: 
+*
+*/
+
+
+
+#if !defined(__INIPARSER_H__)
+#define __INIPARSER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+
+_LIT(KUseSystemDrive, "$:");
+
+class CIniData : public CBase 
+/**
+ *
+ * @publishedPartner
+ * @test
+ *
+ * Defines the interface to acess to ini data file
+ *
+ * The basic functions, FindVar(), SetValue(), AddValue() and WriteToFileL()
+ * Compulsory to call WriteToFileL() after calling any SetValue() or AddValue()
+ */
+	{
+public:
+	// Constructor, pass in name of ini file to open
+	// Default search path is 'c:\system\data' on target filesystem
+	// ie. 'NewL(_L("c:\\system\\data\\ttools.ini"))' is equivalent
+	// to 'NewL(_L("ttools.ini"))'
+	IMPORT_C static CIniData* NewL(const TDesC& aName);
+	IMPORT_C virtual ~CIniData();
+
+	IMPORT_C TBool FindVar(const TDesC &aKeyName,	// Key to look for
+						TPtrC &aResult);			// Buffer to store value
+
+	IMPORT_C TBool FindVar(const TDesC &aKeyName, 	// Key to look for
+						TInt &aResult);				// Int ref to store result
+
+	IMPORT_C TBool FindVar(const TDesC &aSection,	// Section to look under
+						const TDesC &aKeyName,		// Key to look for
+						TPtrC &aResult);			// Buffer to store result
+
+	IMPORT_C TBool FindVar(const TDesC &aSection,	// Section to look under
+						const TDesC &aKeyName,		// Key to look for
+						TInt &aResult);				// Int ref to store result
+
+	IMPORT_C TInt SetValue(const TDesC& aKeyName,// Key to look for
+						const TDesC& aValue);  // aValue being modified
+	IMPORT_C TInt SetValue(const TDesC& aSection, // Section to look under
+						const TDesC& aKeyName,  // Key to look for
+						const TDesC& aValue);  // aValue being modified
+	IMPORT_C TInt AddValue(const TDesC& aSection,  // Section to look under
+						const TDesC& aKeyName,   // Key to look for
+						const TDesC& aValue);   // aValue being modified
+	IMPORT_C TInt AddValue(const TDesC& aKeyName,   // Key to look for
+						const TDesC& aValue);  // aValue being modified
+	IMPORT_C void WriteToFileL();
+	// Overloaded NewL() added to recieve optional system drive letter from the user
+	// And expand ${SYSDRIVE} variable. Else, the variable expands to RFs::GetSystemDrive()
+	IMPORT_C static CIniData* NewL(const TDesC& aName, const TDesC& aSysDrive);
+protected:
+	IMPORT_C CIniData();
+	IMPORT_C CIniData(const TDesC& aSysDrive);
+	IMPORT_C void ConstructL(const TDesC& aName);
+public:
+	IMPORT_C TBool FindVar(const TDesC &aSection,	// Section to look under
+						const TDesC &aKeyName,		// Key to look for
+						TInt64 &aResult);			// Int64 ref to store result
+
+private:
+	void UpdateVariablesL();
+	TBool FindVar(const TDesC &aSectName,const TDesC &aKeyName,TPtrC &aResult, TPtr& aIniDataPtr);
+private:
+	HBufC* iName;
+	HBufC* iToken;
+	HBufC* iIniData;
+	TPtr iPtr;
+	TPtr iPtrExpandedVars;
+	TDriveName iDefaultSysDrive;
+	TDriveName iSysDrive;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/inifileparser/src/iniparser.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,688 @@
+/*
+* Copyright (c) 2005-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:  
+* CINIDATA.CPP
+*
+*/
+
+
+
+#include <e32std.h>
+#include "iniparser.h"
+
+// Default directory to look for INI file
+_LIT(KIniFileDir,"\\System\\Data\\");
+_LIT(KIniSysDrive, "${SYSDRIVE}");
+_LIT(KLegacySysDrive, "C:");
+
+// Constant Value changed for defect047130 fix
+const TInt KTokenSize=256;
+
+enum TIniPanic
+	{
+	ESectionNameTooBig,
+	EKeyNameTooBig,
+	};
+
+#ifndef EKA2
+////////////////////////////////////////////////////////////////////////////////
+//
+// DLL entry point
+//
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)	
+
+	{
+	return (KErrNone);
+	}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+void Panic(TIniPanic aPanic)
+	{
+	_LIT(CIniData,"CIniData");
+	User::Panic(CIniData,aPanic);
+	}
+
+/**
+ * Updates ${SYSDRIVE} variables in the ini file buffer
+ * To the system drive set during object constrcution
+ */
+void CIniData::UpdateVariablesL()
+	{
+	if (iIniData != NULL)
+		{
+		//prevent re-allocating to copy the same data again
+		TPtr temp(iIniData->Des()) ; 
+		if(iPtr.Compare(temp) != 0)
+			{
+			delete iIniData;
+			iIniData = NULL ; 
+			}
+		}
+	// if iIniData was never allocated or just deleted...
+	if(iIniData == NULL)
+		{
+		iIniData = iPtr.AllocL();
+		}
+		
+	iPtrExpandedVars.Set(iIniData->Des());
+	
+	if(iPtrExpandedVars.FindF(KIniSysDrive) == KErrNotFound)
+		return;
+
+	while ( iPtrExpandedVars.Find(KIniSysDrive) != KErrNotFound )
+		{
+		TInt offset = iPtrExpandedVars.Find(KIniSysDrive);
+		iPtrExpandedVars.Replace(offset, 11, iSysDrive);
+		}
+	}
+
+/**
+ * Constructor
+ */
+EXPORT_C CIniData::CIniData() 
+	: iPtr(NULL,0), iPtrExpandedVars(NULL,0)
+	{
+	__DECLARE_NAME(_S("CIniData"));
+	iSysDrive.Copy(KLegacySysDrive);
+	}
+
+/**
+ * Overloaded constructor
+ * Takes in the system drive letter to overwrite
+ */
+EXPORT_C CIniData::CIniData(const TDesC& aSysDrive) 
+	: iPtr(NULL,0), iPtrExpandedVars(NULL,0)
+	{
+	__DECLARE_NAME(_S("CIniData"));
+	if ( aSysDrive.Length() == 2 )
+		iSysDrive.Copy(aSysDrive);
+	}
+
+/**
+ * Destructor
+ * Frees the resources located in second-phase constructor
+ */
+EXPORT_C CIniData::~CIniData()
+	{
+	if( iIniData != NULL )
+		delete iIniData;
+	delete (TText*)iPtr.Ptr();
+	delete iToken;
+	delete iName;
+	}
+
+/**
+ * Creates, and returns a pointer to CIniData object, leave on failure
+ * @param aName - Path and name of the ini file to be parsed
+ * @return A pointer to the CiniData object
+ */
+EXPORT_C CIniData* CIniData::NewL(const TDesC& aName)
+	{
+	CIniData* p=new(ELeave) CIniData();
+	CleanupStack::PushL(p);
+	p->ConstructL(aName);
+	CleanupStack::Pop();
+	return p;
+	}
+
+/**
+ * Creates, and returns a pointer to CIniData object, leave on failure
+ * @param aName - Path and name of the ini file to be parsed
+ * @param aSysDrive - Drive letter to overwrite the default system drive
+ * @return A pointer to the CiniData object
+ */
+EXPORT_C CIniData* CIniData::NewL(const TDesC& aName, const TDesC& aSysDrive)
+	{
+	CIniData* p=new(ELeave) CIniData(aSysDrive);
+	CleanupStack::PushL(p);
+	p->ConstructL(aName);
+	CleanupStack::Pop();
+	return p;
+	}
+
+/**
+ * Second-phase constructor.
+ * The function attempts to allocate a buffer and Read file's contents into iPtr
+ * @param aName the name of the file which contains the ini data
+ * @leave One of the system-wide error codes
+ */
+EXPORT_C void CIniData::ConstructL(const TDesC& aName)
+	{
+ 	// Allocate space for token
+	iToken=HBufC::NewL(KTokenSize+2);	// 2 extra chars for [tokenName]
+
+	// Connect to file server
+	TAutoClose<RFs> fs;
+	User::LeaveIfError(fs.iObj.Connect());
+	fs.PushL();
+
+	// Find file, given name
+	TFindFile ff(fs.iObj);
+	TFileName iniFileDir(KLegacySysDrive);
+	iniFileDir.Append(KIniFileDir);
+	User::LeaveIfError(ff.FindByDir(aName, iniFileDir));
+	iName=ff.File().AllocL();
+
+	// Open file
+	TAutoClose<RFile> file;
+	TInt size;
+	User::LeaveIfError(file.iObj.Open(fs.iObj,*iName,EFileStreamText|EFileShareReadersOrWriters));
+	file.PushL();
+
+	// Get file size and read in
+	User::LeaveIfError(file.iObj.Size(size));
+	TText* data=(TText*)User::AllocL(size);
+	iPtr.Set(data, size/sizeof(TText), size/sizeof(TText));
+	TPtr8 dest((TUint8*)data, 0, size);
+	User::LeaveIfError(file.iObj.Read(dest));
+	TUint8* ptr = (TUint8*)data;
+
+	//
+	// This is orderred as FEFF assuming the processor is Little Endian
+	// The data in the file is FFFE.		PRR 28/9/98
+	//
+	if(size>=(TInt)sizeof(TText) && iPtr[0]==0xFEFF)
+	{
+		// UNICODE Text file so lose the FFFE
+		Mem::Copy(ptr, ptr+sizeof(TText), size-sizeof(TText));
+		iPtr.Set(data, size/sizeof(TText)-1, size/sizeof(TText)-1);
+	}
+	else if(size)
+	{
+		// NON-UNICODE so convert to UNICODE
+		TText* newdata = (TText*)User::AllocL(size*sizeof(TText));
+		iPtr.Set(newdata, size, size);
+		TInt i;
+		for(i=0 ; i<size ; ++i)
+			iPtr[i]=ptr[i];
+		delete data;
+	}
+
+	// Create a duplicate of the iPtr
+	// Expand all ${SYSDRIVE} entries to system drive letter
+	UpdateVariablesL();
+
+	file.Pop();
+	fs.Pop();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Find a text value from given aKeyName regardless the section in the ini data file
+ * @param aKeyName Key being searched for
+ * @param aResult On return, contains the text result 
+ * @return ETrue if found, otherwise EFalse
+ */
+EXPORT_C TBool CIniData::FindVar(const TDesC &aKeyName, TPtrC &aResult)
+{
+	// Call with no section, so starts at beginning
+	if (FindVar((TDesC&)KNullDesC , aKeyName, aResult))
+		return(ETrue);
+	else
+		return(EFalse);
+}
+
+/**
+ * Find a text value from given aKeyName and aSecName in the ini data file
+ * @param aSectName Section containing key
+ * @param aKeyName Key being searched for in aSectName
+ * @param aResult On return, contains the text result 
+ * @return ETrue if found, otherwise EFalse
+ */
+EXPORT_C TBool CIniData::FindVar(const TDesC &aSectName,const TDesC &aKeyName,TPtrC &aResult)
+	{
+	__ASSERT_DEBUG(aSectName.Length()<=KTokenSize,Panic(ESectionNameTooBig));
+	__ASSERT_DEBUG(aKeyName.Length()<=KTokenSize,Panic(EKeyNameTooBig));
+
+	return FindVar(aSectName,aKeyName,aResult, iPtrExpandedVars);
+	}
+
+/**
+ * Find a text value from given aKeyName and aSecName in the provided ini data pointer
+ * @param aSectName Section containing key
+ * @param aKeyName Key being searched for in aSectName
+ * @param aResult On return, contains the text result 
+ * @param aIniDataPtr ini data pointer to be used to find the value
+ * @return ETrue if found, otherwise EFalse
+ */
+TBool CIniData::FindVar(const TDesC &aSectName,const TDesC &aKeyName,TPtrC &aResult, TPtr& aIniDataPtr)
+	{
+	TInt posStartOfSection(0);
+	TInt posEndOfSection(aIniDataPtr.Length()); // Default to the entire length of the ini data
+	TPtrC SearchBuf;
+
+	// If we have a section, set pos to section start
+	TInt posI(0);	// Position in internal data Buffer
+	if( aSectName.Length() > 0 )
+		{
+		TBool FoundSection(false);
+		while ( ! FoundSection )
+			{
+			// Move search buffer to next area of interest
+			SearchBuf.Set(aIniDataPtr.Mid(posI));
+
+			// Make up token "[SECTIONNAME]", to search for
+			TPtr sectionToken=iToken->Des();
+			_LIT(sectionTokenFmtString,"[%S]");
+			sectionToken.Format(sectionTokenFmtString,&aSectName);
+
+			// Search for next occurrence of aSectName
+			TInt posSB = SearchBuf.Find(sectionToken);
+
+			if (posSB==KErrNotFound)
+				return(EFalse);
+
+			// Check this is at beginning of line (ie. non-commented)
+			// ie. Check preceding char was LF
+			if(posSB>0)
+				{
+				// Create a Buffer, starting one char before found subBuf
+				TPtrC CharBefore(SearchBuf.Right(SearchBuf.Length()-posSB+1));
+				// Check first char is end of prev
+				if(CharBefore[0] == '\n')
+					{
+					FoundSection = ETrue;		// found
+					posI = posI + posSB;
+					}
+				else
+					{
+					posI = posI + posSB + 1;	// try again
+					}
+				}
+			else
+				{
+				FoundSection = ETrue;
+				}
+
+			}	// while ( ! FoundSection ) 
+
+		// Set start of section, after section name, (incl '[' and ']')
+		posStartOfSection = posI + aSectName.Length() + 2;
+
+		// Set end of section, by finding begin of next section or end
+		SearchBuf.Set(aIniDataPtr.Mid(posI));
+		_LIT(nextSectionBuf,"\n[");
+		TInt posSB = SearchBuf.Find(nextSectionBuf);
+		if(posSB != KErrNotFound)
+			{
+			posEndOfSection = posI + posSB;
+			}
+		else
+			{
+			posEndOfSection = aIniDataPtr.Length();
+			}
+
+		}	// if( aSectName.Length() > 0 )
+
+	// Look for key in ini file data Buffer
+	posI = posStartOfSection;
+	TBool FoundKey(false);
+	while ( ! FoundKey )
+		{
+		// Search for next occurrence of aKeyName
+		SearchBuf.Set(aIniDataPtr.Mid(posI,posEndOfSection-posI));
+		TInt posSB = SearchBuf.Find(aKeyName);
+
+		// If not found, return
+		if (posSB==KErrNotFound)
+			return(EFalse);
+
+		// Check this is at beginning of line (ie. non-commented)
+		// ie. Check preceding char was CR or LF
+		if(posSB>0)
+			{
+			// Create a Buffer, starting one char before found subBuf
+			TPtrC CharBefore(SearchBuf.Right(SearchBuf.Length()-posSB+1));
+			// Check if the first char is end of prev and also check 
+			// if the token found is not a substring of another string  
+			TBool beginningOK = ((CharBefore[0] == '\n') || (CharBefore[0] == ' ') || (CharBefore[0] == '\t'));
+			TBool endingOK = ((CharBefore[aKeyName.Length()+1] == '=') || (CharBefore[aKeyName.Length()+1] == ' ') || (CharBefore[aKeyName.Length()+1] == '\t'));
+			if (beginningOK && endingOK)
+				{
+				FoundKey = ETrue;
+				posI = posI + posSB;
+				}
+			else
+				{
+				posI = posI + posSB + 1;
+				}
+			}
+		else
+			{
+			FoundKey = ETrue;
+			}
+		}	// while ( ! FoundKey )
+
+	// Set pos, to just after '=' sign
+	SearchBuf.Set(aIniDataPtr.Mid(posI));
+	TInt posSB = SearchBuf.Locate('=');
+	if(posSB==KErrNotFound)		// Illegal format, should flag this...
+		return(EFalse);
+
+	// Identify start and end of data (EOL or EOF)
+	posI = posI + posSB + 1;	// 1 char after '='
+	TInt posValStart = posI;
+	TInt posValEnd;
+	SearchBuf.Set(aIniDataPtr.Mid(posI));
+	posSB = SearchBuf.Locate('\n');
+	if(posSB!=KErrNotFound)
+		{
+     		// ini file uses LF for EOL 
+            posValEnd = posI + posSB; 
+		}
+	else
+		{
+		posValEnd = aIniDataPtr.Length();
+		}
+
+	// Check we are still in the section requested
+	if( aSectName.Length() > 0 )
+		{
+		if( posValEnd > posEndOfSection )
+			{
+			return(EFalse);
+			}
+		}
+	// Parse Buffer from posn of key
+	// Start one space after '='
+	TLex lex(aIniDataPtr.Mid(posValStart, posValEnd-posValStart));
+	lex.SkipSpaceAndMark();		// Should be at the start of the data
+	aResult.Set(lex.MarkedToken().Ptr(),posValEnd-posValStart - lex.Offset() );
+
+	TInt filterOffset;
+	
+	// Mark the offset value to the end of the value string
+	filterOffset = aResult.Length() - 1;
+
+	// Loop from end of the value string marked by the offset fetched by above process
+    // And check to see if there is spaces, tabs or carriage returns
+	while(filterOffset >= 0 &&
+		(aResult[filterOffset] == '\t' ||
+         aResult[filterOffset] == ' ' ||
+         aResult[filterOffset] == '\r'))
+		{
+		// If found, reduce the offset by 1 for every space and tab during the while loop
+		filterOffset--;
+		}
+
+	// The final offset value indicating end of actual value
+	// within the ini data is set to the result string reference passed in
+	aResult.Set(aResult.Mid(0,filterOffset + 1));
+
+	return(ETrue);
+	}
+
+/**
+ * Find an integer value from given aKeyName regardless the section in the ini data file
+ * @param aKeyName Key being searched for
+ * @param aResult On return, contains the TInt result 
+ * @return ETrue if found, otherwise EFalse
+ */
+EXPORT_C TBool CIniData::FindVar(const TDesC &aKeyName, TInt &aResult)
+	{
+	TPtrC ptr(NULL,0);
+	if (FindVar(aKeyName,ptr))
+		{
+		TLex lex(ptr);
+		if (lex.Val(aResult)==KErrNone)
+			return(ETrue);
+		}
+	return(EFalse);
+	}
+
+/**
+ * Find an integer value from given aKeyName and aSecName in the ini data file
+ * @param aSectName Section containing key
+ * @param aKeyName Key being searched for  in aSectName
+ * @param aResult On return, contains TInt result 
+ * @return ETrue if found, otherwise EFalse
+ */
+EXPORT_C TBool CIniData::FindVar(const TDesC &aSection,const TDesC &aKeyName,TInt &aResult)
+	{
+	TPtrC ptr(NULL,0);
+	if (FindVar(aSection,aKeyName,ptr))
+		{
+		TLex lex(ptr);
+		if (lex.Val(aResult)==KErrNone)
+			return(ETrue);
+		}
+	return(EFalse);
+	}
+/**
+ * Find an 64-bit integer value from given aKeyName and aSecName in the ini data file
+ * @param aSectName Section containing key
+ * @param aKeyName Key being searched for  in aSectName
+ * @param aResult On return, contains TInt64 result 
+ * @return ETrue if found, otherwise EFalse
+ */
+EXPORT_C TBool CIniData::FindVar(const TDesC &aSection,	// Section to look under
+					const TDesC &aKeyName,		// Key to look for
+					TInt64 &aResult)			// Int64 ref to store result
+	{
+	TPtrC ptr(NULL,0);
+	if (FindVar(aSection,aKeyName,ptr))
+		{
+		TLex lex(ptr);
+		if (lex.Val(aResult)==KErrNone)
+			return(ETrue);
+		}
+	return(EFalse);
+	}
+/**
+ * Set a text value to given aKeyName and aSecName in the ini data file
+ * @param aSectName Section containing key
+ * @param aKeyName Key being set  in aSectName
+ * @param aValue A text value set for the aKeyName in section ASecName
+ * @return KErrNone if sucessful, otherwise system error
+ */
+EXPORT_C TInt CIniData::SetValue(const TDesC& aSection,const TDesC& aKeyName,const TDesC& aValue)
+	{
+	// First find the variable - this gives us a descriptor into the
+	// ini data giving the bound of the item that has got to be replaced.
+	TPtrC ptr;
+	
+	if (!FindVar(aSection, aKeyName, ptr, iPtr))
+		return KErrNotFound;
+	
+	TInt pos = ptr.Ptr()-iPtr.Ptr();
+	TInt size = iPtr.Length()+aValue.Length()-ptr.Length();
+
+	if (size>iPtr.MaxLength())
+		{
+		size = size * sizeof(TText);
+		TText* newdata = (TText*)User::ReAlloc((TUint8*)iPtr.Ptr(), size); 
+		if (newdata == 0)
+			return KErrNoMemory;
+
+		iPtr.Set(newdata, iPtr.Length(), iPtr.Length()>size/(TInt)sizeof(TText)?iPtr.Length():size/(TInt)sizeof(TText));
+		}
+	iPtr.Replace(pos, ptr.Length(), aValue);
+	return(KErrNone);
+	}
+
+/**
+ * Set a text value to given aKeyName regardless of the section in the ini data file
+ * @param aKeyName Key being searched for
+ * @param aValue A text value set for the aKeyName 
+ * @return KErrNone if sucessful, otherwise system error
+ */
+EXPORT_C TInt CIniData::SetValue(const TDesC& aKeyName,const TDesC& aValue)
+	{
+	// Call with no section, so starts at beginning
+	return SetValue((TDesC&)KNullDesC, aKeyName, aValue);
+	}
+
+/**
+ * Add key aKeyName to end of ini data file
+ * @param aKeyName aKeyName Key being added
+ * @param aValue Text value assigned to the aKeyName
+ * @return KErrNone if sucessful, otherwise system error
+ */
+EXPORT_C TInt CIniData::AddValue(const TDesC& aKeyName,const TDesC& aValue)
+	{
+		// Call with no section, so starts at beginning
+		return AddValue((TDesC&)KNullDesC, aKeyName, aValue);
+	}
+
+/**
+ * Add key aKeyName to section aSectName
+ * @param aSectName Section
+ * @param aKeyName Key being added to section aSectName
+ * @param aValue A text value added to the aKeyName 
+ * @return KErrNone if sucessful, otherwise system error
+ */
+EXPORT_C TInt CIniData::AddValue(const TDesC& aSectName,const TDesC& aKeyName,const TDesC& aValue)
+	{
+	// The request will be denied if the variable exists. 
+	// 
+	// If the variable is not there then making an implementation.
+	// If the Section name existed in the ini file then just append it 
+	// to this section otherwise append the section, key name and 
+	// variable at the end of the ini file.
+	TPtrC ptr;
+	
+	if (FindVar(aSectName, aKeyName, ptr))  
+		return KErrAlreadyExists;  // an key name exists, 
+								// not allow to add value again to same key
+		/////////////////////////////
+	TPtr insertSection =iToken->Des();
+	TInt size;
+		
+	TInt posEndOfSection(iPtr.Length()); // Default to the entire length of the ini data
+	TPtrC SearchBuf;
+
+	// If there is a section, set pos to section start
+	TInt posI(0);	// Initiate to 0. Position in internal data Buffer
+	TInt posSB(0);  
+	if( aSectName.Length() > 0 )
+		{
+		TBool FoundSection(false);
+		while ( ! FoundSection )
+			{
+			// Move search buffer to next area of interest
+			SearchBuf.Set(iPtr.Mid(posI));
+
+			// Make up token "[SECTIONNAME]", to search for
+			TPtr sectionToken=iToken->Des();
+			_LIT(sectionTokenFmtString,"[%S]");
+			sectionToken.Format(sectionTokenFmtString,&aSectName);
+
+			// Search for next occurrence of aSectName
+			posSB = SearchBuf.Find(sectionToken);
+
+			// If not found, return
+			if (posSB==KErrNotFound)
+			{
+				FoundSection = ETrue; //Stop while searching
+				_LIT(insertSectionfmt,"\r\n[%S]\r\n%S = %S\r\n");  //if there is no section existed
+				insertSection.Format(insertSectionfmt,&aSectName,&aKeyName, &aValue);
+			}
+			
+
+			// Check this is at beginning of line (ie. non-commented)
+			// ie. Check preceding char was LF
+			if(posSB>=0)
+				{
+				// Create a Buffer, starting one char before found subBuf
+				TPtrC CharBefore(SearchBuf.Right(SearchBuf.Length()-posSB+1));
+				// Check first char is end of prev
+				if(CharBefore[0] == '\n' or posSB == 0)
+					{
+					FoundSection = ETrue;		// found
+					posI = posI + posSB;
+					_LIT(insertSectionfmt,"\r\n%S = %S\r\n");  //if there is no section existed
+					insertSection.Format(insertSectionfmt,&aKeyName, &aValue);
+					}
+				else
+					{
+					posI = posI + posSB + 1;	// try again
+					}
+				}
+			else
+				{
+				FoundSection = ETrue; //found at the beginning of the search buffer
+				}
+
+			}	// while ( ! FoundSection ) 
+			
+			// Set start of section, after section name, (incl '[' and ']')
+			if(posSB!=KErrNotFound)
+			{
+
+				// Set end of section, by finding begin of next section or end
+				SearchBuf.Set(iPtr.Mid(posI));
+				_LIT(nextSectionBuf,"\n[");
+				TInt posSB = SearchBuf.Find(nextSectionBuf);
+				if(posSB != KErrNotFound)
+					{
+					posEndOfSection = posI + posSB+1;  //insert it between \n and [
+					}
+				else
+					{
+					posEndOfSection = iPtr.Length();
+					}			
+			}
+
+		}	// if( aSectName.Length() > 0 )
+		
+	// append/insert here
+	size = (iPtr.Length()+ insertSection.Length())*sizeof(TText);
+	if (size>iPtr.MaxLength())
+		{
+		TText* newdata = (TText*)User::ReAlloc((TUint8*)iPtr.Ptr(), size); 
+		if (newdata == 0)
+			return KErrNoMemory;
+
+		iPtr.Set(newdata, iPtr.Length(), size/(TInt)sizeof(TText));
+		}
+
+	iPtr.Insert(posEndOfSection,insertSection);
+	return(KErrNone);
+	}
+	
+	
+/**
+ * A method used to flush the data in the buffer to the file given in second-phase constructor
+ */
+EXPORT_C void CIniData::WriteToFileL()
+	{
+
+#ifndef __WINC__
+
+	TAutoClose<RFs> fs;
+	User::LeaveIfError(fs.iObj.Connect());
+	fs.PushL();
+
+	TAutoClose<RFile> file;
+	User::LeaveIfError(file.iObj.Replace(fs.iObj,*iName,EFileStreamText|EFileShareExclusive));
+	file.PushL();
+	
+	// convert 16 bits to 8 bits stream
+
+	HBufC8* buf8 = HBufC8::NewL(iPtr.Length());
+	TPtr8 ptr8(buf8->Des());
+	ptr8.Copy(iPtr);
+	User::LeaveIfError(file.iObj.Write(ptr8));
+
+	delete buf8;
+
+	// Refresh the iPtrExpandedVars with the new written ini file content
+	// Repeat the process of expanding the ${SYSDRIVE}
+	UpdateVariablesL();
+
+	file.Pop();
+	fs.Pop();
+#endif
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/Bmarm/TESTCOMBINERU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/Bwins/TESTCOMBINERU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestCombiner@@XZ @ 1 NONAME ; class CTestCombiner * __cdecl LibEntryL(void)
+	??1TScriptObject@@UAE@XZ @ 2 NONAME ABSENT ; TScriptObject::~TScriptObject(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/eabi/testcombineru.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/group/TestCombiner.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,53 @@
+/*
+* 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: MMP file for STIF Test Framework's TestCombiner.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET      	testcombiner.dll
+TARGETTYPE  	dll
+
+CAPABILITY	ALL -TCB
+VENDORID 	0x101FB657
+SECUREID        0x102073DF
+
+DEFFILE     	testcombiner.def
+
+LIBRARY     	euser.lib
+LIBRARY		stiftestinterface.lib
+LIBRARY		stiftestserver.lib
+LIBRARY         efsrv.lib 
+LIBRARY         stiftestengine.lib
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          TestCombiner.cpp 
+SOURCE          TestCombinerUtils.cpp 
+SOURCE          TestCase.cpp 
+SOURCE          TestCaseNotify.cpp 
+SOURCE          TestKeywords.cpp
+//--PYTHON-- begin
+SOURCE          StifPythonFunComb.cpp
+//--PYTHON-- end
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/group/TestCombinerExample.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,94 @@
+[Test]
+title complete
+run demomodule Demo.cfg 1 testid=demo ini=ini.txt expect=0
+pause demo
+resume demo
+complete demo
+[Endtest]
+
+[Test]
+title complete and rerun
+run demomodule Demo.cfg 1 testid=demo expect=0
+pause demo
+resume demo
+complete demo
+run demomodule Demo.cfg 1
+[Endtest]
+
+[Test]
+title cancel
+run demomodule Demo.cfg 1 testid=demo ini=ini.txt expect=-3
+pause demo time=2000
+cancel demo
+[Endtest]
+
+[Test]
+title double
+run demomodule Demo.cfg 1 testid=demo10 ini=ini.txt expect=-3
+run demomodule Demo.cfg 1 testid=demo20 ini=ini.txt
+pause demo10
+pause demo20
+resume demo10
+cancel demo10
+resume demo20
+[Endtest]
+
+[Test]
+title timer2
+run timermodule Demo.cfg 0 testid=t1 expect=-2
+run timermodule Demo.cfg 1 testid=t2
+pause t1
+complete t2
+resume t1
+[Endtest]
+
+[Test]
+title pause t1 5 sec
+run timermodule Demo.cfg 0 testid=t1 expect=-2
+run timermodule Demo.cfg 1 testid=t2
+pause t1 time=5000
+[Endtest]
+
+[Test]  
+title test TestCombiner state events
+request demo
+set demo state=1
+wait demo
+release demo 
+unset demo
+[Endtest]
+
+[Test]  
+title test TestCombiner indication event set
+set demo
+[Endtest]
+
+[Test]  
+title test TestCombiner indication event req-wait-rel
+request demo
+wait demo
+release demo 
+[Endtest]
+
+[Test]  
+title wait TestModuleState1 event (testmodule/TestCombiner combined)
+request TestModuleState1
+run testmodule ex.cfg 18
+wait TestModuleState1
+release TestModuleState1
+[Endtest]
+
+[Test]  
+title multiple wait TestModuleIndication1 event (testmodule/TestCombiner combined)
+request TestModuleIndication1
+run testmodule ex.cfg 20
+wait TestModuleIndication1
+wait TestModuleIndication1
+wait TestModuleIndication1
+wait TestModuleIndication1
+wait TestModuleIndication1
+wait TestModuleIndication1
+release TestModuleIndication1
+[Endtest]
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*	Build information for STIF Test Framework's TestCombiner.
+*/
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+	
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	TestCombiner.mmp
+
+PRJ_TESTMMPFILES
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/inc/Logging.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,76 @@
+/*
+* 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: This file contains Logging macros for test combiner
+*
+*/
+
+#ifndef LOGGINGDEFS_H
+#define LOGGINGDEFS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+
+// CONSTANTS
+const TUint KError              = 0x1;
+const TUint KInit               = 0x2;
+const TUint KPrint              = 0x4;
+const TUint KMessage            = 0x10;
+const TUint KFunction           = 0x20;
+const TUint KVerbose            = 0x40;
+const TUint KAlways             = 0xFFFFFFFF;
+const TUint KDebugLevel         = ( KPrint | KError | KMessage );
+
+// MACROS
+#define __TRACING_ENABLED
+
+#ifdef __TRACING_ENABLED
+
+     // Disable conditional expression is constant -warning
+    #pragma warning( disable : 4127 )
+
+    // General tracing function
+    #define __TRACE(level,p) if ( ( (level) & KDebugLevel ) && LOGGER )\
+                                          {LOGGER->Log p;}
+              
+    // Direct RDebug::Print                            
+    #define __RDEBUG(p) if( KVerbose & KDebugLevel ){ RDebug::Print p ; } 
+
+
+     // Log function name
+    #define __TRACEFUNC() if( ( KFunction & KDebugLevel ) && LOGGER ){\
+                                const char* f = __FUNCTION__;\
+                                 TPtrC8 F((const unsigned char*)f);\
+                                 LOGGER->Log(F);}
+
+#else // __TRACING_ENABLED
+     // No tracing
+    #define __TRACE(level,p)
+    #define __RDEBUG(p)
+    #define __TRACEFUNC()
+#endif // __TRACING_ENABLED
+
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // LOGGINGDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/inc/StifPythonFunComb.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* 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: This file contains the header of additional functions 
+* needed for Python support and used in PythonScripter, TestEngine 
+* and TestCombiner.
+*
+*/
+
+#ifndef STIFPYTHONFUNCOMB_H
+#define STIFPYTHONFUNCOMB_H
+
+//  INCLUDES
+#include <E32Base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+TInt GetNewIndexForThreadL(void);
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+// None
+
+#endif        // STIFPYTHONFUNCOMB_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCase.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,593 @@
+/*
+* 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: This file contains the header file of the CTCTestCase 
+* and TTCTestModule.
+*
+*/
+
+#ifndef TESTCASE_H
+#define TESTCASE_H
+
+//  INCLUDES
+#include <E32Base.h>
+#include <stifinternal/TestServerClient.h>
+#include <StifTestModule.h>
+#include "TestCaseNotify.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestCombiner;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestCase is a parent class for the test case runner in TestCombiner.
+NONSHARABLE_CLASS(CTestCase)
+    :public CActive
+    {
+    public: // Enumerations
+        enum TTestCaseStatus
+            {
+            ETestCaseIdle,
+            ETestCaseRunning,
+            ETestCaseCompleted
+            };
+        
+        enum TCaseType
+            {
+            ECaseLocal,
+            ECaseRemote,
+            };
+
+    private: // Enumerations
+
+    public: // Destructor
+        /**
+        * Destructor.
+        */
+        virtual ~CTestCase();
+
+    public: // New functions
+        /**
+        * Calls SetActive() from CActive.
+        */
+        virtual void StartL();
+        
+        /**
+        * Get state of the test case.
+        */
+        TTestCaseStatus State(){ return iState; }
+                
+        /**
+        * Get reference to TestId.
+        */
+        const TDesC& TestId(){ return *iTestId; }
+
+        /**
+        * Get expected result.
+        */
+        TInt ExpectedResult(){ return iExpectedResult; }
+
+        /**
+        * Get expected result category.
+        */
+        TFullTestResult::TCaseExecutionResult
+            ExpectedResultCategory(){ return iExpectedResultCategory; }
+
+        /**
+        * Get test case type.
+        */
+        TCaseType Type(){ return iType; }
+
+        //--PYTHON-- begin
+        /**
+        * Get TestModule.
+        */
+        CTCTestModule* TestModule(void){ return iTestModule; }
+        //--PYTHON-- end
+
+        /**
+        * Checks state and additional conditions
+        */
+        virtual TBool IsCompletelyFinished(void);
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+    protected: // New functions
+
+        /**
+        * Completes testcase.
+        */
+        virtual void Complete( TInt aError );
+
+    protected: // Constructors
+        /**
+        * C++ default constructor.
+        */
+        CTestCase( CTestCombiner* testCombiner,
+                   TInt aExpectedResult,
+                   TFullTestResult::TCaseExecutionResult aCategory,
+                   TCaseType aType,
+                   CTCTestModule* aModule ); //--PYTHON--
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TDesC& aTestId );
+
+    private:
+
+    public:  // Data
+
+        // Test case result
+        TFullTestResult         iResult;
+
+    protected: // Data
+        // Test case type
+        TCaseType               iType;
+
+        // Backpointer
+        CTestCombiner*          iTestCombiner;
+
+        // Internal state
+        TTestCaseStatus         iState;
+
+        // Unique test id
+        HBufC*                  iTestId;
+
+        // Expected result for the test case
+        TInt                    iExpectedResult;
+
+        // Expected result category
+        TFullTestResult::TCaseExecutionResult iExpectedResultCategory;
+
+    private: // Data
+        //--PYTHON-- begin
+        CTCTestModule*			iTestModule;
+        //--PYTHON-- end
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+        friend class CTestRunner;
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTCTestCase handles the running of a single testcase in TestCombiner.
+
+NONSHARABLE_CLASS(CTCTestCase)
+    :public CTestCase
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CTCTestCase* NewL( CTestCombiner* testCombiner,
+                                  TDesC& aModuleName,
+                                  TDesC& aTestId,
+                                  TInt aExpectedResult,
+                                  TFullTestResult::TCaseExecutionResult
+                                        aCategory,
+                                  CTCTestModule* aModule ); //--PYTHON--
+
+        /**
+        * Destructor.
+        */
+        ~CTCTestCase();
+
+    public: // New functions
+        /**
+        * Calls SetActive() from CActive.
+        */
+        void StartL();
+
+        /**
+        * Get reference to ModuleName.
+        */
+        const TDesC& ModuleName(){ return *iModuleName; }
+
+        /**
+        * Get reference to RTestExecution.
+        */
+        RTestExecution& TestExecution(){ return iTestExecution; }
+
+        /**
+        * Get reference to event array.
+        */
+        RPointerArray<CTestEventNotify>& EventArray(){ return iEventArray; }
+
+        /**
+        * Get reference to state event array.
+        */
+        RPointerArray<TEventIf>& StateEventArray(){ return iStateEventArray; }
+
+         /**
+        * Final complete of the testcase.
+        */
+        void Complete2();
+
+        /**
+        * Checks state and progress notifier
+        */
+        TBool IsCompletelyFinished(void);
+
+    public: // Functions from base classes
+
+    protected: // New functions
+
+    protected: // Functions from base classes
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CTCTestCase( CTestCombiner* testCombiner,
+                     TInt aExpectedResult,
+                     TFullTestResult::TCaseExecutionResult aCategory,
+                     CTCTestModule* aModule ); //--PYTHON--
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TDesC& aModuleName, TDesC& aTestId );
+
+        /**
+        * Start complete the testcase(Complete2 make the final complete).
+        */
+        void Complete( TInt aError );
+
+    public:  // Data
+        // Test case result package
+        TFullTestResultPckg iResultPckg;
+
+    protected: // Data
+
+    private: // Data
+
+        // Progress notifier
+        CTestProgressNotifier*  iProgress;
+
+        // Event notifier
+        CTestEventNotifier*     iEvent;
+
+        // Module name
+        HBufC*                  iModuleName;
+
+        // Handle to test case execution
+        RTestExecution          iTestExecution;
+
+        // Event array for events requested by test case
+        RPointerArray<CTestEventNotify> iEventArray;
+
+        // Event array for state events set by test case
+        RPointerArray<TEventIf>         iStateEventArray;
+        
+        // Command notifier
+        CTestCommandNotifier*    iCommand;
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+
+    };
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Testcase starting information
+NONSHARABLE_CLASS(CRemoteTestCase)
+    :public CTestCase
+    {
+
+    public: // Enumerations
+        enum TRemoteState
+            {
+            ECaseIdle,
+            ECaseRunSent,
+            ECaseRunning,
+            ECasePauseSent,
+            ECasePaused,
+            ECaseResumeSent,
+            ECaseCancelSent,
+            ECaseCancelled,
+            ECaseCompleted,
+            };
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CRemoteTestCase* NewL( CTestCombiner* testCombiner,
+                                      TDesC& aTestId,
+                                      TInt aExpectedResult,
+                                      TFullTestResult::TCaseExecutionResult
+                                            aCategory );
+
+        /**
+        * Destructor.
+        */
+        ~CRemoteTestCase();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+    protected: // New functions
+
+    protected: // Functions from base classes
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CRemoteTestCase( CTestCombiner* testCombiner,
+                         TInt aExpectedResult,
+                         TFullTestResult::TCaseExecutionResult aCategory );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TDesC& aTestId );
+
+    public:  // Data
+        // Remote slave state
+        TRemoteState    iRemoteState;
+
+        // Slave identifier
+        TUint32         iSlaveId;
+
+        // Free slave after completed
+        TBool           iFreeSlave;
+
+    protected: // Data
+
+    private: // Data
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CRemoteSendReceive handles the running of an asynchronous 'sendreveive'
+// in TestCombiner.
+// Note: If want to improve sendreceive for allowing use like 'run'
+// then this must inherit from CActive
+NONSHARABLE_CLASS(CRemoteSendReceive) :public CBase
+    {
+    public: // Enumerations
+
+    public: // Enumerations
+        enum TRemoteState
+            {
+            ECaseSend,
+            ECaseCompleted,
+            };
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CRemoteSendReceive* NewL( CTestCombiner* aTestCombiner );
+
+        /**
+        * Destructor.
+        */
+        ~CRemoteSendReceive();
+
+    public: // Constructors and destructor
+
+    public: // New functions
+
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected: // Functions from base classes
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CRemoteSendReceive( CTestCombiner* aTestCombiner );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:  // Data
+
+       // Remote slave state
+        TRemoteState    iRemoteState;
+
+        // Slave identifier
+        TUint32         iSlaveId;
+
+    protected: // Data
+
+    private: // Data
+
+        // Backpointer
+        CTestCombiner*      iTestCombiner;
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+
+    };
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+// TTCTestModule encapsulates information about loaded test module.
+
+NONSHARABLE_CLASS(CTCTestModule)
+    :public CBase
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CTCTestModule* NewL( CTestCombiner* testCombiner,
+                                    TDesC& aModule,
+                                    TDesC& aIni,
+                                    const TDesC& aConfigFile );
+
+        /**
+        * Destructor.
+        */
+        ~CTCTestModule();
+
+    public: // Constructors and destructor
+
+    public: // New functions
+         /**
+         * Get module name.
+         */
+         const TDesC& ModuleName(){ return *iModuleName; }
+
+         /**
+         * Get module inifile name.
+         */
+         const TDesC& IniFile(){ return *iIniFile; }
+
+         /**
+        * Get reference to RTestServer.
+        */
+        RTestServer& TestServer(){ return iTestServer; }
+
+        /**
+        * Get reference to RTestModule.
+        */
+        RTestModule& TestModule(){ return iTestModule; }
+
+        /**
+        * Get test cases from module.
+        */
+        void GetTestCasesForCombiner(const TDesC& aConfigFile);
+
+        /**
+        * Get index of given test case.
+        */
+        TInt GetCaseNumByTitle(TDesC& aTitle, TInt& aCaseNum);
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected: // Functions from base classes
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CTCTestModule( CTestCombiner* testCombiner );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TDesC& aModule,
+                         TDesC& aIni,
+                         const TDesC& aConfigFile );
+
+    public:  // Data
+
+    protected: // Data
+
+    private: // Data
+        // Backpointer
+        CTestCombiner*      iTestCombiner;
+        
+        // Module name
+        HBufC*              iModuleName;
+        // Module initialization file
+        HBufC*              iIniFile;
+
+        // Handle to test server
+        RTestServer         iTestServer;
+        // Handle to module 
+        RTestModule         iTestModule;
+        
+        // Error notifier
+        CTestErrorNotifier* iErrorPrinter;
+
+        // Array of test cases used to find test case number by title
+        CFixedFlatArray<TTestCaseInfo>* iTestCases;
+
+    public: // Friend classes
+
+    protected: // Friend classes
+
+    private: // Friend classes
+
+    };
+    
+#endif        // TESTCASE_H  
+                
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCaseNotify.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,531 @@
+/*
+* 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: This file contains the header file of
+* the CTestProgressNotifier and the CTestEventNotifier.
+*
+*/
+
+#ifndef TEST_CASE_NOTIFY_H
+#define TEST_CASE_NOTIFY_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <stifinternal/TestServerClient.h>
+#include "TestCombiner.h"
+#include "StifCommand.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestProgressNotifier is an active object used for notifications called from
+// Test Module using the RTestExecution API.
+NONSHARABLE_CLASS(CTestProgressNotifier)
+    :public CActive
+    {
+    public: // Enumerations
+        
+    private: // Enumerations
+        // TTestProgressStatus defines the status of notification
+        enum TTestProgressStatus
+            {
+            ETestProgressIdle,
+            ETestProgressPending,
+            ETestProgressCompleted
+            };
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CTestProgressNotifier* NewL( CTestCombiner* aTestCombiner, 
+                                            CTCTestCase* aTestCase );
+          
+        /**
+        * Destructor.
+        */
+        ~CTestProgressNotifier();
+        
+        /**
+        * Checks is UI print progress finished.
+        */
+        TBool IsPrintProgressFinished();
+          
+    public: // New functions
+          
+    public: // Functions from base classes
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel.
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+          
+    protected: // New functions
+        
+    protected: // Functions from base classes
+        
+    private:
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestProgressNotifier( CTestCombiner* aTestCombiner, 
+                               CTCTestCase* aTestCase );
+
+        /**
+        * Start progress notifier.
+        */
+         void StartL();
+
+    public: // Data
+     
+    protected: // Data
+    
+    private: // Data
+        // Pointer to CTestCombiner
+        CTestCombiner*      iTestCombiner;
+          
+        // Pointer to CTCTestCase 
+        CTCTestCase*         iTestCase;
+
+        // Internal state
+        TTestProgressStatus iState;
+
+        // Test Progress
+        TTestProgress       iProgress;
+        TTestProgressPckg   iProgressPckg;
+
+        // Indication for UI print process
+        TBool               iIsPrintProcessFinished;
+
+    public: // Friend classes
+    
+    protected: // Friend classes
+    
+    private: // Friend classes
+    
+    };     
+    
+// DESCRIPTION
+// CTestErrorNotifier is an active object used for notifications called from
+// Test Module using the RTestExecution API.
+NONSHARABLE_CLASS(CTestErrorNotifier)
+    :public CActive
+    {
+    public: // Enumerations
+        
+    private: // Enumerations
+        // TTestProgressStatus defines the status of notification
+        enum TTestErrorStatus
+            {
+            ETestErrorIdle,
+            ETestErrorPending,
+            ETestErrorCompleted
+            };
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CTestErrorNotifier* NewL( CTestCombiner* aTestCombiner, 
+                                         CTCTestModule* aTestModule );
+          
+        /**
+        * Destructor.
+        */
+        ~CTestErrorNotifier();
+          
+    public: // New functions
+          
+    public: // Functions from base classes
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel.
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+          
+    protected: // New functions
+        
+    protected: // Functions from base classes
+        
+    private:
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestErrorNotifier( CTestCombiner* aTestCombiner, 
+                            CTCTestModule* aTestModule );
+
+        /**
+        * Start progress notifier.
+        */
+         void StartL();
+
+    public: // Data
+     
+    protected: // Data
+    
+    private: // Data
+        // Pointer to CTestCombiner
+        CTestCombiner*      iTestCombiner;
+          
+        //Pointer to CTCTestCase 
+        CTCTestModule*         iTestModule;
+
+        // Internal state
+        TTestErrorStatus iState;
+
+        // Test Progress
+        TErrorNotification       iError;
+        TErrorNotificationPckg   iErrorPckg;
+
+    public: // Friend classes
+    
+    protected: // Friend classes
+    
+    private: // Friend classes
+    
+    };     
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestEventNotify is an active object used to get event notify from
+// Test Server.
+NONSHARABLE_CLASS(CTestEventNotify)
+    :public CActive
+    {
+    public: // Enumerations
+    
+    private: // Enumerations
+        // TTestEventStatus defines the status of notification
+        enum TTestEventNotifyStatus
+            {
+            ETestEventNotifyIdle,
+            ETestEventNotifyPending,
+            ETestEventNotifyCompleted
+            };
+
+    public:  // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CTestEventNotify* NewL( CTestCombiner* aTestCombiner,
+                                       CTCTestCase* aTestCase,
+                                       TEventIf& aEvent );
+          
+        /**
+        * Destructor.
+        */
+        ~CTestEventNotify();
+          
+    public: // New functions     
+          
+        TEventIf& Event(){ return iEvent; };
+        
+    public: // Functions from base classes
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel.
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+          
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+    
+    private:
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TEventIf& aEvent );
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestEventNotify( CTestCombiner* aTestCombiner, 
+                          CTCTestCase* aTestCase );
+        
+
+    public:    //Data
+     
+    protected:  // Data
+ 
+    private:     // Data
+        // Pointer to CTestCombiner
+        CTestCombiner* iTestCombiner;
+        
+        // Pointer CTestCase
+        CTCTestCase* iTestCase;
+
+        // Internal state
+        TTestEventNotifyStatus iState;
+
+        // Event interface
+        TEventIf iEvent;
+        TEventIfPckg iEventPckg;
+
+    public:      // Friend classes
+
+    protected:  // Friend classes
+
+    private:     // Friend classes
+
+    };
+    
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestEventNotifier is an active object used for event notify from
+// Test Module using the RTestExecution API.
+NONSHARABLE_CLASS(CTestEventNotifier)
+    :public CActive
+    {
+    public: // Enumerations
+    
+    private: // Enumerations
+        // TTestEventStatus defines the status of notification
+        enum TTestEventStatus
+            {
+            ETestEventIdle,
+            ETestEventPending,
+            ETestEventCompleted,
+            ETestEventWaitUnset
+            };
+
+    public:  // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CTestEventNotifier* NewL( CTestCombiner* aTestCombiner, 
+                                         CTCTestCase* aTestCase  );
+          
+        /**
+        * Destructor.
+        */
+        ~CTestEventNotifier();
+          
+    public: // New functions     
+          
+    public: // Functions from base classes
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel.
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+          
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+    
+    private:
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestEventNotifier( CTestCombiner* aTestCombiner, 
+                            CTCTestCase* aTestCase );
+
+        /**
+        * StartL starts the CTestEventNotifier active object.
+        */
+        void StartL();
+
+    public:    //Data
+     
+    protected:  // Data
+ 
+    private:     // Data
+        // Pointer to CTestCombiner
+        CTestCombiner* iTestCombiner;
+
+        // Pointer CTestCase
+        CTCTestCase* iTestCase;
+
+        // Internal state
+        TTestEventStatus iState;
+
+        // Event interface
+        TEventIf iEvent;
+        TEventIfPckg iEventPckg;
+
+    public:      // Friend classes
+
+    protected:  // Friend classes
+
+    private:     // Friend classes
+
+    };
+
+// DESCRIPTION
+// CTestCommandNotifier is an active object used for command notify from
+// Test Module using the RTestExecution API.
+NONSHARABLE_CLASS(CTestCommandNotifier): public CActive
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+        // None
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestCommandNotifier* NewL(CTestCombiner* aTestCombiner, CTCTestCase* aTestCase);
+
+        /**
+        * Destructor.
+        */
+        ~CTestCommandNotifier();
+
+    public:     // New functions
+
+        /**
+        * StartL starts the CTestCommandNotifier active object.
+        */
+        void Start();
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError(TInt aError);
+
+    protected:      // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestCommandNotifier(CTestCombiner* aTestCombiner, CTCTestCase* aTestCase);
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to CTestCombiner
+        CTestCombiner*     iTestCombiner;
+
+        // Pointer to CTCTestCase
+        CTCTestCase*       iTestCase;
+
+        // Command to be sent
+        TCommand                        iCommand;
+        TCommandPckg                    iCommandPckg;
+        TBuf8<KMaxCommandParamsLength2> iParamsPckg;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+    };
+
+#endif // TEST_CASE_NOTIFY_H
+     
+                
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCombiner.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,872 @@
+/*
+* 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: This file contains the header file of the 
+* TestCombiner module of STIF Test Framework.
+*
+*/
+
+#ifndef TESTCOMBINER_H
+#define TESTCOMBINER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+#include <StifParser.h>
+#include <StifLogger.h>
+#include <StifTestEventInterface.h>
+#include <StifTestModule.h>
+#include <stifinternal/TestServerClient.h>
+#include "TestKeywords.h"
+#include "TestCombinerEvent.h" 
+#include "TestCombinerUtils.h" 
+#include "STIFMeasurement.h"
+
+// CONSTANTS
+// Printing priorities
+const TInt KPrintPriExec = 400;
+const TInt KPrintPriLow  = 300;
+const TInt KPrintPriNorm = 200;
+const TInt KPrintPriHigh = 100;
+// Log dir and file
+_LIT( KTestCombinerLogDir, "\\Logs\\TestFramework\\TestCombiner\\" );
+_LIT( KTestCombinerLogFile, "TestCombiner.txt" );
+_LIT( KTestCombinerLogFileWithTitle, "TestCombiner_[%S].txt" );
+// Configuration file tags
+_LIT( KTestStartTag, "[Test]" );
+_LIT( KTestEndTag, "[Endtest]" );
+// Define tags
+_LIT( KDefineStartTag, "[Define]" );
+_LIT( KDefineEndTag, "[Enddefine]" );
+// Initialization tags
+_LIT( KInitStartTag, "[Init]" );
+_LIT( KInitEndTag, "[Endinit]" );
+_LIT( KInitRcpTimeout, "rcptimeout" );
+
+// Remote protocol timeout 
+const TInt KRemoteProtocolTimeout = 30000000;
+// Remote protocol Master id
+const TUint32 KRemoteProtocolMasterId = 0xdeadbeef;
+
+// Loop counter macro
+_LIT( KLoopCounter, "LOOP_COUNTER" );
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestRunner;
+class CTestCase;
+class CTCTestCase;
+class CRemoteTestCase;
+class CTCTestModule;
+class CRemoteTimer;
+class CRemoteReceiver;
+class CRemoteSendReceive;
+class TTestMeasurement;
+    
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestCombiner contains the Test Module interface of TestCombiner 
+// for STIF Test Framework
+
+NONSHARABLE_CLASS(CTestCombiner) 
+    :public CTestModuleBase
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CTestCombiner* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CTestCombiner();
+
+    public: // New functions
+        /**
+        * Test Case completion from CTCTestCase.
+        */
+        void Complete( CTestCase* aTestCase, TInt aError=KErrNone );
+
+        /**
+        * Set event request pending.
+        */
+         void SetEventPendingL( TEventIf aEvent );
+
+        /**
+        * Handles timeouts.
+        */
+        void RemoteTimeout();
+
+        /**
+        * Handles responce received from slave
+        */
+        void ReceiveResponse( TDesC& aMsg );
+
+    public: // Functions from base classes
+        /**
+        * Test module initialization.
+        */ 
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * GetTestCasesL is used to inquire testcases. 
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case specified 
+        * by aTestCase. 
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aConfig, 
+                           TTestResult& aResult );
+
+    protected: // New functions
+
+    protected: // Functions from base classes
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CTestCombiner();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * GetTestCaseL gets the specified test case section 
+        * from the configfile.
+        */
+        CStifSectionParser* GetTestCaseL( TInt aCaseNumber, 
+                                            const TFileName& aConfig );
+
+        /**
+        * RunTestL runs the testcase specified in section.
+        */
+        void RunTestL();
+      
+        /**
+        * StartTestL starts a specified testcase from another test module.
+        */
+        TInt StartTestL( CStartInfo& aStartInfo );
+
+        /**
+        * GetTestModuleL returns a specified test module description.
+        */
+        CTCTestModule* GetTestModuleL( TDesC& aModule,
+                                       TDesC& aIniFile,
+                                       const TDesC& aConfigFile  );
+
+        /**
+        * Gets a testcase identified with testid from test case array.
+        */
+        CTestCase* GetTest( TDesC& aTestId );
+     
+        /**
+        * Gets a running testcase identified with testid from test case array.
+        */
+        CTestCase* GetRunningTest( TDesC& aTestId );
+        
+        /**
+        * Gets a testcase identified with testid from test case array.
+        */
+        CTCTestCase* GetLocalTest( TDesC& aTestId );
+     
+        /**
+        * Gets a running testcase identified with testid from test case array.
+        */
+        CTCTestCase* GetLocalRunningTest( TDesC& aTestId );
+
+        /**
+        * Gets a testcase identified with aSlaveId from slave array.
+        */
+        CRemoteTestCase* GetRemoteTest( TDesC& aTestId );
+
+        /**
+        * Gets a testcase identified with aSlaveId from slave array.
+        */
+        CRemoteTestCase* GetRemoteTest( TUint32 aSlaveId );
+        
+        CRemoteTestCase* GetRemoteTestRunSent( TUint32 aSlaveId );
+        /**
+        * Gets a running testcase identified with aSlaveId from slave array.
+        */
+        CRemoteTestCase* GetRunningRemoteTest( TUint32 aSlaveId );
+
+        /**
+        * Gets a testcase running on slave with aSlaveDevId.
+        */
+        CRemoteTestCase* GetRemoteRunningTestOnSlave( TUint32 aSlaveDevId );
+
+        /**
+        * Gets a correct CRemoteSendReceive object on slave with aSlaveId.
+        */
+        CRemoteSendReceive* GetRemoteSendReceive( TUint32 aSlaveId );        
+
+        /**
+        * Get running slave.
+        */
+        CSlaveInfo* CTestCombiner::GetSlave( TUint32 aSlaveId );
+        CSlaveInfo* CTestCombiner::GetSlave( TDesC& aSlaveName );
+
+        /**
+        * Check requested events and send unset to first requested.
+        */
+        TBool UnsetEvent( TEventIf& aEvent, TRequestStatus& aStatus );
+
+        /**
+        * Read initialization from file.
+        */
+        void ReadInitializationL( const TDesC& aIniFile );
+
+        /**
+        * Executes measurement script line.
+        */
+        void ExecuteMeasurementL( CStifItemParser* aItem );
+
+        /**
+        * Starts measurement.
+        */
+        void StartMeasurementL( const TDesC& aType, CStifItemParser* aItem );
+
+        /**
+        * Stops measurementplugin's measurement.
+        */
+        void StopMeasurementL( const TDesC& aType );
+        
+        /**
+        * Returns new index for test module controller.
+        * This number is appended to module controller name.
+        * This method is used when option to run every test case in separate
+        * process is set to on.                        
+        */
+        TInt GetIndexForNewTestModuleController(void);
+       
+        /**
+        * Append to TC's result description (if possible due to length)
+        * limitation provided text in [] brackets.
+        */
+        void AppendTestResultToResultDes(TDes& aResultDescr, const TDesC& aTestCaseResultDescr);
+
+
+    public:     // Data
+        // Logger 
+        CStifLogger*                    iLog;
+
+    protected:  // Data
+          
+    private:    // Data
+        // Test case array of running/runned test cases 
+        RPointerArray<CTestCase>        iTestCases;
+
+        // SendReceive array(asynchronous sendreveive)
+        RPointerArray<CRemoteSendReceive> iSendReceive;
+
+        // Array of test modules
+        RPointerArray<CTCTestModule>    iTestModules;
+
+        // TestId of the waited (by complete keyword) test case 
+        TName                           iWaitTestCase;
+
+        // Flag to indicate that activescheduler is started    
+        TBool                           iSchedulerActive;
+
+        // Number of currently running test cases
+        TInt                            iRunningTests;
+
+        // Test case result of the TestCombiner
+        TInt                            iResult;
+
+        // Error code in case when execution of script fails
+        TInt                            iScriptFailed;
+        
+        // Error description in case when execution of script fails
+        TName                           iScriptFailedDescription;
+        
+        // Sectionparser for the current testcase
+        CStifSectionParser*             iSectionParser;
+
+        // Pointer to used testrunner
+        CTestRunner*                    iTestRunner;
+
+        // Pointer to used testrunner
+        CRemoteReceiver*                iRemoteReceiver;
+
+        // Event for async NotifyEvent
+        TEventIf                        iEvent;
+        TEventIfPckg                    iEventPckg;
+
+        RPointerArray<TEventTc>         iEventArray;
+
+         // Predefined values are listed here
+        RPointerArray<CDefinedValue>    iDefined;
+
+        // CSlaveInfo 
+        RPointerArray<CSlaveInfo>       iSlaveArray;
+
+        // Remote protocol timeout
+        TInt                            iRemoteTimeout;
+
+        // Variable for abortimmediately keyword @js
+        TBool                           iCancelIfError;
+
+        // Number of the failed test case, needed when using 
+        // abortimmediately keyword @js
+        TInt                            iFailedTestCase;
+
+        // CStifTestMeasurement object
+        RPointerArray<TTestMeasurement> iTestMeasurementArray;
+
+        // Indicate that loop is used in test case file.
+        // This is used for reseting and allowing allocated id's etc.
+        // (E.g. testid values can be same in loop).
+        TBool                           iLoopIsUsed;
+        RArray<TAny*>                   iLoopAllocationArray;
+
+        // Standard Logger 
+        CStifLogger*                    iStdLog;
+
+        // Test case Logger 
+        CStifLogger*                    iTCLog;
+
+        // Flag which says if test case title should be appended to the
+        // log file name. This is read from SettingServer
+        TBool                               iAddTestCaseTitleToLogName;
+        
+        // Counter for created TCModuleControllers
+        TInt                            iIndexTestModuleControllers;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+        friend class CTestRunner;
+        friend class CTestEventNotifier;
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestRunner parses the TestCombiner configuration file and 
+// runs a testcase. CTestRunner is the friend of CTestCombiner
+// and uses its private member variables directly.
+
+NONSHARABLE_CLASS(CTestRunner) 
+    :public CActive
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+        enum TRunnerState{
+            ERunnerIdle,
+            ERunnerRunning,
+            ERunnerWaitTestCase,
+            ERunnerWaitEvent,
+            ERunnerWaitUnset,
+            ERunnerWaitTimeout,
+            ERunnerCancel,
+            ERunnerError,
+            ERunnerAllocate,
+            ERunnerFree,
+            ERunnerRemote,
+            ERunnerReady,
+            };
+
+    public:  // Constructors and destructor  
+        /**
+        * Two-phased constructor.
+        */
+        static CTestRunner* NewL( CTestCombiner* aTestCombiner );
+
+        /**
+        * Destructor.
+        */
+        ~CTestRunner();
+
+    public: // New functions
+        /**
+        * Calls SetActive() from CActive.
+        */
+        void SetRunnerActive();
+
+        /**
+        * Handles received response from slave.
+        */
+        TBool ReceiveResponseL( TDesC& aMsg );
+
+        /**
+        * Cancel testcases.
+        */
+        void CancelTestCases();
+
+    public: // Functions from base classes     
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel.
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CTestRunner( CTestCombiner* aTestCombiner );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Executes one script line.
+        */
+        TBool ExecuteLineL( CStifItemParser* aItem );
+
+        /**
+        * Executes run script line.
+        */
+        TBool ExecuteRunL( CStifItemParser* aItem );
+
+        /**
+        * Parses run parameters.
+        */
+        void ParseRunParamsL( CStifItemParser* aItem, CStartInfo& aStartInfo );
+
+        /**
+        * Executes test control script line.
+        */
+        TBool ExecuteTestCtlL( CStifItemParser* aItem, 
+                               TTCKeywords::TKeywords aKeyword );
+                               
+        /**
+        * Executes pause in combiner
+        */
+        TBool ExecuteCombinerPauseL( CStifItemParser* aItem );
+
+        /**
+        * Executes pause script line.
+        */
+        TBool ExecutePauseL( CStifItemParser* aItem, CTestCase* aTestCase );
+
+        /**
+        * Executes complete script line.
+        */
+        TBool ExecuteCompleteL( CStifItemParser* aItem, CTestCase* aTestCase );
+
+        /**
+        * Executes event set script line.
+        */
+        TBool ExecuteEventSetL( CStifItemParser* aItem );
+
+        /**
+        * Executes event unset script line.
+        */
+        TBool ExecuteEventUnsetL( CStifItemParser* aItem );
+
+        /**
+        * Executes event control command.
+        */
+        TBool ExecuteEventCtlL( CStifItemParser* aItem, 
+                                TTCKeywords::TKeywords aKeyword );
+
+        /**
+        * Executes allocate script line.
+        */
+        TBool ExecuteAllocateL( CStifItemParser* aItem );
+
+        /**
+        * Executes free script line.
+        */
+        TBool ExecuteFreeL( CStifItemParser* aItem );
+
+        /**
+        * Frees slave.
+        */
+        void ExecuteFreeL( CSlaveInfo* aSlave );
+
+        /**
+        * Executes remote script line.
+        */
+        TBool ExecuteRemoteL( CStifItemParser* aItem );
+
+        /**
+        * Executes remote run script line.
+        */
+        TBool ExecuteRemoteRunL( CStifItemParser* aItem, CSlaveInfo* aSlave,
+                                 HBufC *aSetUnsetEvent = NULL,
+                                 TInt aCaseNumber = 0 );
+
+        /**
+        * Executes remote test control script line.
+        */
+        TBool ExecuteRemoteTestCtlL( CStifItemParser* aItem, 
+                                     CTestCase* aTestCase, 
+                                     TInt aCmd  );
+
+        /**
+        * Executes remote event control script line.
+        */
+        TBool ExecuteRemoteEventCtlL( CStifItemParser* aItem, 
+                                      CSlaveInfo* aSlave, 
+                                      TInt aCmd  );
+                                      
+        /**
+        * Executes remote event set unset line
+        */
+        TBool ExecuteRemoteSetUnsetEventL( CStifItemParser* aItem,
+                                      CSlaveInfo* aSlave,
+                                      TInt aCmd  );
+
+        /**
+        * Executes asynchronous remote sendreceive control script line.
+        */
+        TBool ExecuteRemoteSendReceiveL( CStifItemParser* aItem, 
+                                      CSlaveInfo* aSlave );
+
+        /**
+        * Executes remote unknown control script line.
+        */
+        TBool ExecuteRemoteUnknownL( CStifItemParser* aItem, 
+                                     CSlaveInfo* aSlave,
+                                     TDesC& aCommand );
+        /**
+        * Handles received run responses from slave.
+        */
+        TBool ReceiveResponseRunL( CStifTFwIfProt& aMsg );
+
+        /**
+        * Handles received test control responses from slave.
+        */
+        TBool ReceiveResponseTestCtlL( CStifTFwIfProt& aMsg );
+
+        /**
+        * Handles received Event system control responses from slave.
+        */
+        TBool ReceiveResponseEventCtlL( CStifTFwIfProt& aMsg );
+
+        /**
+        * Handles received asynchronous sendreceive responses from slave.
+        */
+        TBool ReceiveResponseSendReceiveL( CStifTFwIfProt& aMsg );
+
+        /**
+        * Handles received responses for unspecified commands from slave.
+        */
+        TBool ReceiveResponseUnknownL( CStifTFwIfProt& aMsg );
+
+        /**
+        * Check unset event we are waiting.
+        */
+        TBool CheckUnsetEvent();
+
+        /**
+        * Parses optional argument.
+        */
+        void ParseOptArgL( const TDesC& aOptArg, TPtrC& aArg, TPtrC& aVal);
+
+        /**
+        * Preprocess hardcoded values in test case.
+        */                    
+        CStifItemParser* PreprocessLineL( TDesC& line );
+
+        /**
+        * Checks if aWord is defined value.
+        */                    
+        TInt CheckDefined( TPtrC& aWord );
+
+        /**
+        * Handle the loop keyword operations.
+        */                    
+        void ExecuteLoopL( CStifItemParser* aItem );
+
+        /**
+        * Handle the endloop keyword operations.
+        */                    
+        TBool ExecuteEndLoopL();
+
+    public:     //Data
+
+    protected:  // Data
+
+    private:    // Data
+        // Runner state
+        TRunnerState                iState;
+
+        // Backpointer to CTestCombiner
+        CTestCombiner*              iTestCombiner;
+
+        // Event system control
+        TEventIf                    iEvent;
+
+        // Pause timer
+        RTimer                      iPauseTimer;
+        TName                       iPausedTestCase;
+        TInt                        iPauseTime;
+        
+        // Pause combiner timer
+        RTimer                      iPauseCombTimer;
+        TInt                        iPauseCombRemainingTime;
+
+        // Temporary line buffer 
+        HBufC*                      iLine;
+
+        // Remote control protocol timer
+        CRemoteTimer*               iRemoteTimer;
+
+        // Loop times, counter and start position
+        TInt                    iLoopTimes;
+        TInt                    iLoopCounter;
+        TInt                    iLoopStartPos;
+        TBuf<10>                iLoopCounterDes;
+        TInt                    iEndLoopStartPos;
+
+        // Loop passlimit (endurance) feature
+        TInt                    iPasslimit;
+        TBool                   iPasslimitEnabled;
+        TInt                    iPassedIterationCnt;
+        
+        // Loop (timed loop option)
+        TBool                   iTimedLoop;
+        TTime                   iStartTime;
+        TTimeIntervalMicroSeconds iExpectedLoopTime;
+
+		// Message displayed when leave occurs during script parsing
+		TBuf<256> iRunErrorMessage;
+    public:      // Friend classes
+
+    protected:  // Friend classes
+
+    private:     // Friend classes
+        friend class CTestCombiner;
+
+    };
+
+// CLASS DECLARATION
+typedef TBuf<0x200> TRemoteProtMsg;
+
+// DESCRIPTION
+// CTestRemoteReceiver handles remote protocol receiving
+NONSHARABLE_CLASS(CRemoteReceiver) 
+    :public CActive
+    {
+    public: // Enumerations
+         
+    private: // Enumerations
+        enum TReceiverState
+            {
+            EReceiverIdle,
+            EReceiverPending,
+            };
+
+    public:  // Constructors and destructor  
+        /**
+        * Two-phased constructor.
+        */
+        static CRemoteReceiver* NewL( CTestCombiner* aTestCombiner );
+
+        /**
+        * Destructor.
+        */
+        ~CRemoteReceiver();
+
+    public: // New functions
+        /**
+        * Calls SetActive() from CActive.
+        */
+        void Start();
+
+    public: // Functions from base classes     
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel.
+        */
+        void DoCancel();
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CRemoteReceiver( CTestCombiner* aTestCombiner );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:     //Data
+
+    protected:  // Data
+
+    private:    // Data
+        // Runner state
+        TReceiverState              iState;
+
+        // Backpointer to CTestCombiner
+        CTestCombiner*              iTestCombiner;
+
+        // Remote protocol message
+        TRemoteProtMsg              iRemoteMsg;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CRemoteTimer handles remote protocol timeouts
+NONSHARABLE_CLASS(CRemoteTimer) 
+    :public CActive
+    {
+    public: // Enumerations
+         
+    private: // Enumerations
+        enum TTimerState
+            {
+            ETimerIdle,
+            ETimerPending,
+            };
+
+    public:  // Constructors and destructor  
+        /**
+        * Two-phased constructor.
+        */
+        static CRemoteTimer* NewL( CTestCombiner* aTestCombiner );
+
+        /**
+        * Destructor.
+        */
+        ~CRemoteTimer();
+
+    public: // New functions
+        /**
+        * Starts timer.
+        */
+        void SetTimerActive( TTimeIntervalMicroSeconds32 anInterval );
+
+    public: // Functions from base classes     
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel.
+        */
+        void DoCancel();
+
+    protected:  // New functions
+          
+    protected:  // Functions from base classes
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CRemoteTimer( CTestCombiner* aTestCombiner );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:     //Data
+     
+    protected:  // Data
+
+    private:    // Data
+        // Runner state
+        TTimerState     iState;
+
+        // Backpointer to CTestCombiner
+        CTestCombiner*  iTestCombiner;
+
+        // Pause timer
+        RTimer          iTimer;
+
+    public:      // Friend classes
+
+    protected:  // Friend classes
+
+    private:     // Friend classes
+
+    };
+
+
+// DESCRIPTION
+// TTestMeasurement contains test measurement module information
+class TTestMeasurement
+    {
+    public: 
+        TTestMeasurement(){ iMeasurement = NULL; };
+        ~TTestMeasurement(){ delete iMeasurement; };
+
+    public:
+
+    public:
+        // "object" name given in test case file.
+        TName                   iName;
+        // MSTIFTestInterference object.
+        CSTIFTestMeasurement*  iMeasurement;
+
+    private:
+
+    };
+
+#endif        // TESTCOMBINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCombinerEvent.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,137 @@
+/*
+* 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: This file contains the header file of the event 
+* interface.
+*
+*/
+
+#ifndef TESTCOMBINEREVENT_H
+#define TESTCOMBINEREVENT_H
+
+//  INCLUDES
+#include <StifTestEventInterface.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+class CLogger;
+class CStifLogger;
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+// Interface class for the test system.
+class TEventTc
+    :public TEventIf
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        /**
+        * C++ default constructor.
+        */
+        TEventTc( CStifLogger* aLogger );
+        
+        /**
+        * C++ parametric constructor.
+        */
+        TEventTc( TName& aEventName, CStifLogger* aLogger );
+  
+        /**
+        * C++ destructor.
+        */
+        ~TEventTc();
+
+    public: // New functions
+        
+        /**
+        * Set request status member.
+        */
+        void SetRequestStatus( TRequestStatus* aStatus );
+        
+        /**
+        * Set event pending.
+        */
+        void SetEvent( TEventType aEventType );
+        
+        /**
+        * Wait event.
+        */
+        void WaitEvent( TRequestStatus& aStatus );
+        
+    private: // New functions
+        /**
+        * Complete request status member.
+        */
+        void Complete( TInt aError );
+
+    public: // Functions from base classes
+        // None
+        
+    protected:  // New functions
+        // None
+        
+    protected:  // Functions from base classes
+        // None
+        
+    private:
+        // None
+        
+    public:   //Data
+        // None
+        
+    protected:  // Data
+        // None
+        
+    private:    // Data
+        /**
+        * Request status.
+        */
+        TRequestStatus* iReq; 
+        
+        /**
+        * Logger.
+        */ 
+        CStifLogger*  iLogger;
+                        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+    };
+
+#endif      // TESTCOMBINEREVENT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/inc/TestCombinerUtils.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,243 @@
+/*
+* 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: This file contains the header file of the 
+* TestCombinerUtils.
+*
+*/
+
+#ifndef TESTCOMBINERUTILS_H
+#define TESTCOMBINERUTILS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include <StifTestInterface.h>
+
+#include "TestCombinerEvent.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+    
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Testcase starting information
+NONSHARABLE_CLASS(CStartInfo)
+    :public CBase
+    {
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CStartInfo* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CStartInfo();
+            
+    public: // New functions
+        /**
+        * Set module name.
+        */
+        void SetModuleNameL( TDesC& aModule, TInt aExtLength=0 );
+            
+        /**
+        * Set initialization file name.
+        */
+        void SetIniFileL( TDesC& aIni );
+            
+        /**
+        * Set configuration file name.
+        */
+        void SetConfigL( TDesC& aConfig );
+            
+        /**
+        * Set test identifier.
+        */
+        void SetTestIdL( TDesC& aTestId );
+
+        /**
+        * Delete module name buffer for creating new module name.
+        */
+        void DeleteModuleName();
+        
+        /**
+        * Set test case title.
+        */
+        void SetTitleL(TDesC& aTitle);
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CStartInfo();
+                    
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+                
+    public:
+        TPtr    iModule;
+        TPtrC   iIniFile;
+        TPtrC   iConfig;
+        TPtrC   iTestId;
+        TInt    iCaseNum;
+        TInt    iExpectedResult;
+        TFullTestResult::TCaseExecutionResult iCategory;
+        TInt    iTimeout;
+        TPtrC   iTitle;
+        
+    private:
+        HBufC*  iModuleBuf;
+        HBufC*  iIniFileBuf;
+        HBufC*  iConfigBuf;
+        HBufC*  iTestIdBuf;
+        HBufC*  iTitleBuf;
+    
+    };
+    
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Slave information structure
+NONSHARABLE_CLASS(CSlaveInfo)
+    :public CBase
+    {
+    public:
+        enum TSlaveState
+            {
+            ESlaveIdle,
+            ESlaveReserveSent,
+            ESlaveReserved,
+            ESlaveReleaseSent,
+            ESlaveReleased,
+            };        
+            
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CSlaveInfo* NewL( TDesC& aName, TUint32 aMaster );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CSlaveInfo();
+            
+    public:            
+        
+        /**
+        * Get event name requested from slave.
+        */    
+        TEventTc* GetEvent( TDesC& aEventName );
+        
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CSlaveInfo( TUint32 aMaster );
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TDesC& aName );
+        
+    public:
+        TInt    iState;
+
+        TPtrC   iName;
+        TUint32 iMasterId;
+        TUint32 iSlaveDevId;
+        
+        RPointerArray<TEventTc>         iEvents;
+        
+    private:
+        HBufC*  iNameBuf;
+        
+    };     
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Predefined value entry
+NONSHARABLE_CLASS(CDefinedValue)
+    :public CBase
+    {
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CDefinedValue* NewL( TDesC& aName, TDesC& aValue );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CDefinedValue();
+
+    public: // New functions
+        /**
+        * Returns define name.
+        */
+        TDesC& Name();
+        
+        /**
+        * Returns define value.
+        */
+        TDesC& Value();
+        
+        /**
+        * Returns new define value.
+        */
+        void SetValueL( TDesC& aValue );
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CDefinedValue();
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TDesC& aName, TDesC& aValue );
+        
+    private: // Data
+        // Define name
+        HBufC* iNameBuf;
+        TPtrC  iName;
+
+        // Define value
+        HBufC* iValueBuf;
+        TPtrC  iValue;
+
+    };
+    
+#endif        // TESTCOMBINERUTILS_H
+                
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/inc/TestKeywords.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,185 @@
+/*
+* 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: This file contains the keywords for the TestCombiner 
+* module.
+*
+*/
+
+#ifndef TESTKEYWORDS_H
+#define TESTKEYWORDS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <StifTestInterface.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+typedef TPtrC (*KeywordFunc)( TInt aKeyword );
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Test Combiner Keyword class
+class TTCKeywords 
+    {
+    public: // Enumerations
+        // Keyword enum
+        enum TKeywords
+            {
+            ETitle,
+            ERun,
+            ECancel,
+            EPause,
+            EResume,
+            EComplete,
+            ERequest,
+            EWait,
+            ERelease,
+            ESet,
+            EUnset,
+            ETimeout,
+            EPriority,
+            EPrint,
+            EAllocate,
+            EFree,
+            ERemote,
+            ESendReceive,
+            ECancelIfError,
+            EMeasurement,
+            ELoop,
+            EEndLoop,
+            EPauseCombiner,  
+            };
+
+        // run keyword optional arguments
+        enum TRunOptArgs
+            {
+            EExpect,
+            ETestid,
+            EIni,
+            ECategory,
+            ECaseTimeout,
+            ECaseTitle,
+            };
+
+        // pause keyword optional arguments
+        enum TPauseOptArgs
+            {
+            ETime,
+            };
+
+        // event keywords optional arguments
+        enum TEventOptArgs
+            {
+            EState,
+            };
+
+        // priorities
+        enum TPriority
+            {
+            EPriHigh,
+            EPriNormal,
+            EPriLow,
+            };
+
+    private: // Enumerations
+
+    public: // Constructors and destructor
+
+    public: // Constructors and destructor
+
+    public: // New functions
+
+        /**
+        * Returns a string desrciptor corresponding to keyword number. 
+        */
+        static TPtrC Keyword( TInt aKeyword );
+
+        /**
+        * Returns a string desrciptor corresponding to run keyword 
+        * optional argument number. 
+        */
+        static TPtrC RunOptArg( TInt aArg );
+
+        /**
+        * Returns a string desrciptor corresponding to pause keyword 
+        * optional argument number. 
+        */
+        static TPtrC PauseOptArg( TInt aArg );
+
+        /**
+        * Returns a string desrciptor corresponding to event keywords 
+        * optional argument number. 
+        */
+        static TPtrC EventOptArg( TInt aArg );
+
+        /**
+        * Returns a string desrciptor corresponding to priority 
+        * enum value. 
+        */
+        static TPtrC Priority( TInt aArg );
+
+        /**
+        * Returns a keyword enum corresponding to keyword 
+        * string descriptor. 
+        */
+        static TInt Parse( TDesC& aKeyword, KeywordFunc aFunc );
+
+        /**
+        * Returns result category description. 
+        */
+        static TPtrC ResultCategory( TInt aArg );
+
+        /**
+        * Returns result category type. 
+        */
+        static TFullTestResult::TCaseExecutionResult 
+            GetResultCategory( TDesC& aCategory );
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+    public:     // Data
+     
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif        // TESTKEYWORDS_H  
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/src/StifPythonFunComb.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,74 @@
+/*
+* 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: This file contains StifPythonFunComb implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include "StifPythonFunComb.h"
+#include <e32svr.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 ===============================
+
+// -----------------------------------------------------------------------------
+// GetNewIndexForThreadL
+// Function countss all threads named like pythonscripter* and returns index for
+// the new thread for pythonscripter.
+// -----------------------------------------------------------------------------
+TInt GetNewIndexForThreadL(void)
+	{
+	TInt max_index = 0;
+	// * as a wildcard for the name search
+	_LIT(KFindAll, "pythonscripter*");
+
+	// default RThread object, has a handle of the current thread
+	RThread thread;
+	TFullName fullName;
+	TFindThread finder(KFindAll);
+
+	while(finder.Next(fullName) == KErrNone)
+		{
+		max_index++;
+		}
+	return max_index;
+	}
+//
+// ============================ MEMBER FUNCTIONS ===============================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/src/TestCase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1177 @@
+/*
+* 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: This module contains the implementation of 
+* CTestCase class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "TestCombiner.h"
+#include "TestCase.h"
+#include "TestCaseNotify.h"
+#include "Logging.h"
+#include "StifPython.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iTestCombiner->iLog
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCase
+
+     Method: CTestCase
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+
+     Parameters: CTestCombiner* testCombiner: in: Backpointer to CTestCombiner
+                 TDesC& aModuleName: in: name of the used test module
+                 TDesC& aTestId: in: TestId for testcase
+                 TInt aExpectedResult: in: expected result for the testcase
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+
+CTestCase::CTestCase( CTestCombiner* testCombiner,
+                      TInt aExpectedResult,
+                      TFullTestResult::TCaseExecutionResult aCategory,
+                      TCaseType aType,
+                      CTCTestModule* aModule ): //--PYTHON
+    CActive(  CActive::EPriorityStandard ),
+    iType( aType ),
+    iTestCombiner( testCombiner ),
+    iState( ETestCaseIdle ),
+    iExpectedResult( aExpectedResult ),
+    iExpectedResultCategory( aCategory ),
+    iTestModule( aModule ) //--PYTHON
+    {
+    
+    CActiveScheduler::Add( this );   
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCase
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.     
+
+     Parameters: TDesC& aTestId: in: Test identifier
+
+     Return Values: None.
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CTestCase::ConstructL( TDesC& aTestId )
+    {
+    __ASSERT_ALWAYS( aTestId.Length() < KMaxFileName, User::Leave( KErrArgument ) );
+    iTestId = aTestId.AllocL();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCase
+
+     Method: ~CTestCase
+
+     Description: Destructor
+     
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+     
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/     
+
+CTestCase::~CTestCase()
+    {    
+
+    Cancel();    
+    delete iTestId;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCase
+
+     Method: RunL
+
+     Description: Derived from CActive. Handles the completed testcase.
+
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if completed with error. 
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CTestCase::RunL()
+    {
+    __TRACE( KMessage, ( _L("CTestCase::RunL: [%d] "), iStatus.Int() ));
+    
+    Complete( iStatus.Int() );
+
+    __TRACE( KMessage, ( _L( "CTestCase::RunL: Testcase completed" )));
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCase
+
+     Method: DoCancel
+
+     Description: Derived from CActive, handles the Cancel.
+
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCase::DoCancel()
+    {
+    __TRACE( KMessage, ( _L("CTestCase::DoCancel")));
+    
+    TRequestStatus* rs = &iStatus;
+    User::RequestComplete( rs, KErrCancel );
+    Complete( KErrCancel );
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCase
+
+     Method: Start
+
+     Description: Start progress and event notifiers and set CTestCase active.
+  
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCase::StartL()
+    {
+
+    iState = ETestCaseRunning;
+    iStatus = KRequestPending;
+    SetActive();
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCase
+
+     Method: Complete
+
+     Description: Completes testcase to CTestCombiner.
+  
+     Parameters: TInt aError: in: Completion error
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCase::Complete( TInt aError )
+    {
+
+    __TRACE( KMessage, ( _L("CTestCase::Complete: %d "), aError ));
+    iState = ETestCaseCompleted;
+    
+    iTestCombiner->Complete( this, aError );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCase
+
+     Method: IsCompletelyFinished
+
+     Description: Checks state.
+
+     Parameters: None
+
+     Return Values: TBool.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestCase::IsCompletelyFinished(void)
+    {
+    TBool result = (iState == CTestCase::ETestCaseCompleted);
+    return result;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CTCTestCase class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: CTCTestCase
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+
+     Parameters: CTestCombiner* testCombiner: in: Backpointer to CTestCombiner
+                 TDesC& aModuleName: in: name of the used test module
+                 TDesC& aTestId: in: TestId for testcase
+                 TInt aExpectedResult: in: expected result for the testcase
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+CTCTestCase::CTCTestCase( CTestCombiner* testCombiner,
+                          TInt aExpectedResult,
+                          TFullTestResult::TCaseExecutionResult aCategory,
+                          CTCTestModule* aModule ): //--PYTHON
+    CTestCase( testCombiner, aExpectedResult, aCategory, ECaseLocal, aModule ), //--PYTHON
+    iResultPckg( iResult )
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.     
+
+     Parameters: None. 
+
+     Return Values: None.
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CTCTestCase::ConstructL( TDesC& aModuleName,
+                              TDesC& aTestId )
+    {
+    __ASSERT_ALWAYS( aModuleName.Length() < KMaxFileName, User::Leave( KErrArgument ) );
+    CTestCase::ConstructL( aTestId );
+    iModuleName = aModuleName.AllocL();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+
+     Parameters: CTestCombiner* testCombiner: in: Backpointer to CTestCombiner
+
+     Return Values: CTCTestCase*: pointer to new CTCTestCase object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+CTCTestCase* CTCTestCase::NewL( CTestCombiner* testCombiner,
+                                TDesC& aModuleName,
+                                TDesC& aTestId,
+                                TInt aExpectedResult,
+                                TFullTestResult::TCaseExecutionResult
+                                    aCategory,
+                                CTCTestModule* aModule ) //--PYTHON
+    {
+    CTCTestCase* self = new (ELeave) CTCTestCase( testCombiner,
+                                                   aExpectedResult,
+                                                   aCategory,
+                                                   aModule ); //--PYTHON
+     
+    CleanupStack::PushL( self );
+    self->ConstructL( aModuleName, aTestId );
+    CleanupStack::Pop();
+    return self;
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: ~CTCTestCase
+
+     Description: Destructor
+     
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+     
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/     
+
+CTCTestCase::~CTCTestCase()
+    {    
+    Cancel();
+    
+    delete iEvent;
+    
+    // Unset all set events
+    TInt count = iStateEventArray.Count();
+    TInt i = 0;
+    for( i = 0; i < count; i++ )
+        {
+		if( iStateEventArray[i] != NULL )
+			{
+			iStateEventArray[i]->SetType( TEventIf::EUnsetEvent );
+			}
+		if( iTestCombiner != NULL )
+			{
+			iTestCombiner->TestModuleIf().Event( *iStateEventArray[i] );
+			}
+        }
+    iStateEventArray.ResetAndDestroy();
+    iStateEventArray.Close();
+    
+    // to be sure..
+    count = iEventArray.Count();
+    TEventIf event;
+    for( i = 0; i < count; i++ )
+        {
+        event.Copy( iEventArray[i]->Event() );
+        event.SetType( TEventIf::ERelEvent );
+		if( iTestCombiner != NULL )
+			{
+			iTestCombiner->TestModuleIf().Event( event );
+			}
+        }
+
+
+    iEventArray.ResetAndDestroy();
+    iEventArray.Close();
+    
+    delete iProgress;
+    delete iModuleName;
+    
+    delete iCommand;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: DoCancel
+
+     Description: Derived from CActive, handles the Cancel.
+
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTCTestCase::DoCancel()
+    {
+    __TRACE( KMessage, ( _L("CTCTestCase::DoCancel")));
+    iTestExecution.CancelAsyncRequest( ETestExecutionRunTestCase );
+    Complete( KErrCancel );
+     
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: Start
+
+     Description: Start progress and event notifiers and set CTCTestCase active.
+  
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTCTestCase::StartL()
+    {
+    iProgress = CTestProgressNotifier::NewL( iTestCombiner, this );
+    iEvent = CTestEventNotifier::NewL( iTestCombiner, this );
+    iCommand = CTestCommandNotifier::NewL(iTestCombiner, this);
+    iState = ETestCaseRunning;
+    SetActive();
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: Complete
+
+     Description: Start complete the testcase to CTestCombiner (Complete2 make
+                  the final complete).
+  
+     Parameters: TInt aError: in: Completion error
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTCTestCase::Complete( TInt aError )
+    {
+    if( iState == ETestCaseRunning )
+        {
+        // Testcase is in running state, complete and delete notifiers
+        if( aError != KErrNone )
+            {
+            iResult.iTestResult.iResult = aError;
+            }
+            
+        iState = ETestCaseCompleted;
+        __TRACE( KMessage, ( _L("CTCTestCase::Complete: %d "), aError ));
+        
+        }
+
+	if( iProgress->IsPrintProgressFinished() )
+        {
+        // Print process is finished to UI => make final complete of
+        // the test case
+		Complete2();
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: Complete2
+
+     Description: Testcase final complete to CTestCombiner.
+  
+     Parameters: None
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTCTestCase::Complete2()
+    {
+ 	// to be sure..
+    TInt count = iEventArray.Count();
+    TEventIf event;
+    for( TInt i = 0; i < count; i++ )
+        {
+        event.Copy( iEventArray[0]->Event() );
+        event.SetType( TEventIf::ERelEvent );
+        CTestEventNotify* eventEntry = iEventArray[0];
+        iEventArray.Remove( 0 );
+        delete eventEntry;
+        iTestCombiner->TestModuleIf().Event( event );
+        }
+      
+    iEventArray.ResetAndDestroy();
+    iEventArray.Close();
+    
+    delete iEvent;
+    iEvent = NULL;
+    delete iProgress;
+    iProgress = NULL;
+    delete iCommand;
+    iCommand = NULL;
+
+    iTestCombiner->Complete( this );
+
+    // Close execution handle
+    iTestExecution.Close();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestCase
+
+     Method: IsCompletelyFinished
+
+     Description: Checks state and progress notifier.
+
+     Parameters: None
+
+     Return Values: TBool.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CTCTestCase::IsCompletelyFinished(void)
+    {
+    TBool result = (iState == CTCTestCase::ETestCaseCompleted);
+	if(iProgress)
+	    {
+		result = result && (iProgress->IsPrintProgressFinished());
+		}
+    return result;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CRemoteTestCase class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTestCase
+
+     Method: CRemoteTestCase
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+
+     Parameters: CTestCombiner* testCombiner: in: Backpointer to CTestCombiner
+                 TInt aExpectedResult: in: expected result for the testcase
+                 TFullTestResult::TCaseExecutionResult aCategory: in: 
+                    result category
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+CRemoteTestCase::CRemoteTestCase( CTestCombiner* testCombiner,
+                          TInt aExpectedResult,
+                          TFullTestResult::TCaseExecutionResult aCategory ):
+    CTestCase( testCombiner, aExpectedResult, aCategory, ECaseRemote, NULL ), //--PYTHON
+    iRemoteState( ECaseIdle ),
+    iFreeSlave( EFalse ) 
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTestCase
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.     
+
+     Parameters: None. 
+
+     Return Values: None.
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CRemoteTestCase::ConstructL( TDesC& aTestId )
+    {
+    CTestCase::ConstructL( aTestId );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTestCase
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+
+     Parameters: CTestCombiner* testCombiner: in: Backpointer to CTestCombiner
+
+     Return Values: CRemoteTestCase*: pointer to new CRemoteTestCase object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+CRemoteTestCase* CRemoteTestCase::NewL( CTestCombiner* testCombiner,
+                                TDesC& aTestId, 
+                                TInt aExpectedResult,
+                                TFullTestResult::TCaseExecutionResult 
+                                    aCategory )
+    {
+    CRemoteTestCase* self = new (ELeave) CRemoteTestCase( testCombiner, 
+                                                   aExpectedResult,
+                                                   aCategory );
+     
+    CleanupStack::PushL( self );
+    self->ConstructL( aTestId );
+    CleanupStack::Pop();
+    return self;
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTestCase
+
+     Method: ~CRemoteTestCase
+
+     Description: Destructor
+     
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+     
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/     
+
+CRemoteTestCase::~CRemoteTestCase()
+    {        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CTCTestModule class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestModule
+
+     Method: CTCTestModule
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+
+     Parameters: TDesC& aModule: in: module name
+                 TDesC& aIni: in: inifile name
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTCTestModule::CTCTestModule( CTestCombiner* testCombiner ):
+    iTestCombiner( testCombiner )
+    {
+    iTestCases = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestModule
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.     
+
+     Parameters: TDesC& aModule: in: Module name.
+                 TDesC& aIni: in: Inifile name.
+                 const TDesC& aConfigFile: in: Test case(config) file name. 
+
+     Return Values: None.
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CTCTestModule::ConstructL( TDesC& aModule,
+                                TDesC& aIni,
+                                const TDesC& aConfigFile )
+    {
+    __TRACE( KMessage, ( _L("CTCTestModule::ConstructL [%S]"), &aModule));
+    
+    __ASSERT_ALWAYS( aModule.Length() < KMaxFileName, User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( aIni.Length() < KMaxFileName, User::Leave( KErrArgument ) );
+    iModuleName = aModule.AllocL();
+    iIniFile = aIni.AllocL();
+    
+    TFileName ini = *iIniFile;
+    // Open handles
+    __TRACE( KMessage, ( _L("CTCTestModule: Server connect")));    
+    User::LeaveIfError( iTestServer.Connect( ModuleName(), aConfigFile ) ); 
+    __TRACE( KMessage, ( _L("CTCTestModule: Module open")));
+    User::LeaveIfError( iTestModule.Open( iTestServer, ini ) );
+    
+    iErrorPrinter = CTestErrorNotifier::NewL( iTestCombiner, this );
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestModule
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+
+     Parameters: None
+     
+     Return Values: TDesC& aModule: in: Module name.
+                    TDesC& aIni: in: Inifile name.
+                    const TDesC& aConfigFile: in: Test case(config) file name.
+     
+     Errors/Exceptions: Leaves if ConstructL leaves
+                        Leaves if memory allocation fails
+                        Leaves if illegal arguments are given
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+CTCTestModule* CTCTestModule::NewL( CTestCombiner* testCombiner,
+                                    TDesC& aModule, 
+                                    TDesC& aIni,
+                                    const TDesC& aConfigFile )
+    {
+    CTCTestModule* self = new (ELeave) CTCTestModule( testCombiner );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aModule, aIni, aConfigFile );
+    CleanupStack::Pop();
+
+    return self;
+     
+    }
+
+/*
+
+-------------------------------------------------------------------------------
+
+     Class: CTCTestModule
+
+     Method: ~CTCTestModule
+
+     Description: Destructor
+     
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+     
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/     
+
+CTCTestModule::~CTCTestModule()
+    {
+    __TRACE( KMessage, ( _L("CTCTestModule::~CTCTestModule [%S]"), iModuleName));
+    
+    // delete error printer
+    delete iErrorPrinter;
+    // Close handles
+    if( iTestServer.Handle() != 0 )
+        {
+        iTestModule.Close();
+        iTestServer.Close();
+        }
+    delete iModuleName;
+    delete iIniFile;
+    delete iTestCases;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestModule
+
+     Method: GetTestCasesForCombiner
+
+     Description: Get array of test cases (used to find test case number by title)
+     
+     Parameters:    const TDesC& aConfigFile: in: config file name.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+     
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTCTestModule::GetTestCasesForCombiner(const TDesC& aConfigFile)
+    {
+    __TRACE(KMessage, (_L("Going to enumerate test cases for TestCombiner")));
+    TName configFile(aConfigFile);
+
+    // Enumerate test cases
+    TCaseCount caseCount;
+    TRequestStatus status;
+    iTestModule.EnumerateTestCases(configFile, caseCount, status);
+    User::WaitForRequest(status);
+
+    // Check that enumerate succeeded
+    if(status != KErrNone)
+        {
+        __TRACE(KMessage, (_L("Enumerating test cases from module returned error. Status %d."), status.Int()));
+        return;
+    	}
+    __TRACE(KMessage, (_L("Enumeration for TestCombiner returned %d cases"), caseCount()));
+
+    // Get test cases to buffer
+    iTestCases = CFixedFlatArray<TTestCaseInfo>::NewL(caseCount());
+
+    TInt ret = iTestModule.GetTestCases(*iTestCases);
+    if(ret != KErrNone)
+        {
+        __TRACE(KMessage, (_L("Getting test cases from module returned error %d."), ret));
+        return;
+        }
+
+    __TRACE(KMessage, (_L("Test cases for TestCombiner have been enumerated")));
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTCTestModule
+
+     Method: GetCaseNumByTitle
+
+     Description: Finds test case index by title
+
+     Parameters:    TDesC& aTitle: in: test case title.
+                    TInt& aCaseNum: in out: test case index
+
+     Return Values: KErrNone if everything is ok
+                    KErrNotFound if there is no such test case
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTCTestModule::GetCaseNumByTitle(TDesC& aTitle, TInt& aCaseNum)
+    {
+    for(TInt i = 0; i < iTestCases->Count(); i++)
+        {
+        if((*iTestCases)[i].iTitle == aTitle)
+            {
+            aCaseNum = i;
+            //TestScripter relies on 1-based indexing
+            if((iModuleName->Find(KTestScripterName) != KErrNotFound) || (iModuleName->Find(KPythonScripter) != KErrNotFound) || (iModuleName->Find(KTestCombinerName) != KErrNotFound))
+                aCaseNum++;
+            return KErrNone;
+            }
+        }
+    
+    return KErrNotFound;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CRemoteSendReceive class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteSendReceive
+
+     Method: CRemoteSendReceive
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+
+     Parameters: 
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteSendReceive::CRemoteSendReceive( CTestCombiner* aTestCombiner  ) :
+    iTestCombiner( aTestCombiner )
+    {
+    // None
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteSendReceive
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.     
+
+     Parameters: None. 
+
+     Return Values: None.
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteSendReceive::ConstructL()
+    {
+    // None
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteSendReceive
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+
+     Parameters: 
+
+     Return Values: CRemoteTestCase*: pointer to new CRemoteTestCase object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteSendReceive* CRemoteSendReceive::NewL( CTestCombiner* aTestCombiner )
+    {
+    CRemoteSendReceive* self = new (ELeave) CRemoteSendReceive( aTestCombiner );
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteSendReceive
+
+     Method: ~CRemoteSendReceive
+
+     Description: Destructor
+     
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+     
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/     
+CRemoteSendReceive::~CRemoteSendReceive()
+    {
+    // None
+
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/src/TestCaseNotify.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1617 @@
+/*
+* 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: This module contains implementation of 
+* CTestProgressNotifier class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "TestCombiner.h"
+#include "TestCase.h"
+#include "TestCaseNotify.h"
+#include "Logging.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iTestCombiner->iLog
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: CTestProgressNotifier
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+CTestProgressNotifier::CTestProgressNotifier( CTestCombiner* aTestCombiner, 
+                                              CTCTestCase* aTestCase ) : 
+    CActive( CActive::EPriorityStandard ),
+    iTestCombiner( aTestCombiner ),
+    iTestCase( aTestCase ),
+    iState( ETestProgressIdle ),
+    iProgressPckg( iProgress ),
+    iIsPrintProcessFinished( EFalse )
+    {
+    CActiveScheduler::Add( this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves if StartL leaves
+     
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestProgressNotifier::ConstructL()
+    {
+    StartL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+     
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to TestCombiner
+                 CTCTestCase* aTestCase: in: Pointer to used CTCTestCase
+     
+     Return Values: CTestProgressNotifier* : pointer to created object
+
+     Errors/Exceptions: Leaves if ConstructL leaves or memory allocation fails
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+CTestProgressNotifier* CTestProgressNotifier::NewL( CTestCombiner* aTestCombiner, 
+                                                    CTCTestCase* aTestCase )
+    {
+    CTestProgressNotifier* self = 
+        new ( ELeave ) CTestProgressNotifier( aTestCombiner, aTestCase );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: ~CTestProgressNotifier
+
+     Description: Destructor
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/     
+CTestProgressNotifier::~CTestProgressNotifier()
+    {
+    __TRACE( KMessage, ( _L("~CTestProgressNotifier") ));
+    Cancel();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: StartL
+
+     Description: Start ProgressNotifier
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves if allready pending
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestProgressNotifier::StartL()
+    {
+    // Check that this request is not pending!!
+    if( iState == ETestProgressPending )
+        {
+        User::Leave( KErrGeneral );
+        }
+        
+    iState = ETestProgressPending;
+    iTestCase->TestExecution().NotifyProgress( iProgressPckg, iStatus );
+    SetActive();
+
+    } 
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: RunL
+
+     Description: RunL handles completed requests.
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestProgressNotifier::RunL()
+    {
+
+    iState = ETestProgressCompleted;
+
+    // Check that request was successful or completed with acceptable error
+    // KErrEof is acceptable error and it means that the test case will not
+    // send progresses anymore (because it is closed)
+    if ( KErrNone == iStatus.Int() )
+        {
+        TStifInfoName desc( iProgress.iDescription );
+
+        // Append testid if possible
+        if( ( iTestCase->TestId().Length() > 0 ) &&
+            ( desc.MaxLength() > 
+            ( desc.Length() + iTestCase->TestId().Length() + 1 ) ) )
+            {
+            desc.Append( _L("_") );
+            desc.Append( iTestCase->TestId() );
+            }
+          // Append module name if possible
+        else if( desc.MaxLength() > 
+            ( desc.Length() + iTestCase->ModuleName().Length() + 1 ) )
+            {
+            desc.Append( _L("_") );
+            desc.Append( iTestCase->ModuleName() );
+            }
+
+        // Forward printing to engine
+        iTestCombiner->TestModuleIf().Printf( iProgress.iPosition, 
+                                                desc, 
+                                                iProgress.iText );
+          
+        // Set request pending again
+        StartL();
+        }
+    else if ( KErrEof != iStatus.Int() )
+        {
+        // Leave, error will be handled in RunError
+        User::Leave( iStatus.Int() );
+        }
+	
+	if( KErrEof == iStatus.Int()  )
+		{
+        // KErrEof indicates that all print process to UI is completed.
+        iIsPrintProcessFinished = ETrue;
+		if(iTestCase->State() == CTestCase::ETestCaseCompleted )
+			{
+            // Test case is completed so do final complete.
+			iTestCase->Complete2();	
+			}
+		
+		}
+        
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: DoCancel
+
+     Description: Cancel active request
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestProgressNotifier::DoCancel()
+    {
+    switch ( iState )
+        {
+        case ETestProgressPending:
+            iTestCase->TestExecution().CancelAsyncRequest( ETestExecutionNotifyProgress );
+            break;
+        case ETestProgressIdle:
+        case ETestProgressCompleted:
+        default:
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestProgressNotifier, "CTestProgressNotifier" );
+            User::Panic( KTestProgressNotifier, KErrGeneral );
+            break;
+        }
+    iState = ETestProgressIdle;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: RunError
+
+     Description: Handle errors. Should newer come here so we return error.
+
+     Parameters: TInt aError: in: Symbian OS error: Error code
+     
+     Return Values: Symbian OS error value
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+TInt CTestProgressNotifier::RunError( TInt aError )
+    {
+    return aError;
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestProgressNotifier
+
+     Method: IsPrintProgressFinished
+
+     Description: Indicates is print process to UI finished
+
+     Parameters: None
+     
+     Return Values: TBool: ETrue indicates that print process is finished,
+     					   EFalse indicates that print process is not finished
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+TBool CTestProgressNotifier::IsPrintProgressFinished()
+    {
+    return iIsPrintProcessFinished;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     DESCRIPTION
+
+     This module contains implementation of CTestErrorNotifier class member
+     functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestErrorNotifier
+
+     Method: CTestErrorNotifier
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+CTestErrorNotifier::CTestErrorNotifier( CTestCombiner* aTestCombiner, 
+                                        CTCTestModule* aTestModule ) : 
+    CActive( CActive::EPriorityStandard ),
+    iTestCombiner( aTestCombiner ),
+    iTestModule( aTestModule ),
+    iState( ETestErrorIdle ),
+    iErrorPckg( iError )
+    {
+    CActiveScheduler::Add( this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestErrorNotifier
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves if StartL leaves
+     
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestErrorNotifier::ConstructL()
+    {
+    StartL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestErrorNotifier
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+     
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to TestCombiner
+                 CTCTestModule* aTestModule: in: Pointer to used CTCTestModule
+     
+     Return Values: CTestErrorNotifier* : pointer to created object
+
+     Errors/Exceptions: Leaves if ConstructL leaves or memory allocation fails
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+CTestErrorNotifier* CTestErrorNotifier::NewL( CTestCombiner* aTestCombiner, 
+                                              CTCTestModule* aTestModule )
+    {
+    CTestErrorNotifier* self = 
+        new ( ELeave ) CTestErrorNotifier( aTestCombiner, aTestModule );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestErrorNotifier
+
+     Method: ~CTestErrorNotifier
+
+     Description: Destructor
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/     
+CTestErrorNotifier::~CTestErrorNotifier()
+    {
+    __TRACE( KMessage, ( _L("~CTestErrorNotifier") ));
+    Cancel();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestErrorNotifier
+
+     Method: StartL
+
+     Description: Start ProgressNotifier
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves if allready pending
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestErrorNotifier::StartL()
+    {
+    // Check that this request is not pending!!
+    if( iState == ETestErrorPending )
+        {
+        User::Leave( KErrGeneral );
+        }
+        
+    iState = ETestErrorPending;
+    iTestModule->TestModule().ErrorNotification( iErrorPckg, iStatus );
+    SetActive();
+
+    } 
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestErrorNotifier
+
+     Method: RunL
+
+     Description: RunL handles completed requests.
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestErrorNotifier::RunL()
+    {
+
+    iState = ETestErrorCompleted;
+
+    // Check that request was successful or completed with acceptable error
+    // KErrEof is acceptable error and it means that the test case will not
+    // send progresses anymore (because it is closed)
+    if ( KErrNone == iStatus.Int() )
+        {
+              
+        // Forward printing to engine
+        iTestCombiner->TestModuleIf().Printf( iError.iPriority, 
+                                              iError.iModule, 
+                                              iError.iText );
+          
+        // Set request pending again
+        StartL();
+        }
+    else if ( KErrEof != iStatus.Int() )
+        {
+        // Leave, error will be handled in RunError
+        User::Leave( iStatus.Int() );
+        }
+          
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestErrorNotifier
+
+     Method: DoCancel
+
+     Description: Cancel active request
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestErrorNotifier::DoCancel()
+    {
+    switch ( iState )
+        {
+        case ETestErrorPending:
+            iTestModule->TestModule().CancelAsyncRequest( ETestModuleErrorNotification );
+            break;
+        case ETestErrorIdle:
+        case ETestErrorCompleted:
+        default:
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestErrorNotifier, "CTestErrorNotifier" );
+            User::Panic( KTestErrorNotifier, KErrGeneral );
+            break;
+        }
+    iState = ETestErrorIdle;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestErrorNotifier
+
+     Method: RunError
+
+     Description: Handle errors. Should newer come here so we return error.
+
+     Parameters: TInt aError: in: Symbian OS error: Error code
+     
+     Return Values: Symbian OS error value
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+TInt CTestErrorNotifier::RunError( TInt /*aError*/ )
+    {
+    
+    // Ignore error, stop error note forwarding
+    return KErrNone;
+     
+    }
+     
+     
+/*
+-------------------------------------------------------------------------------
+
+     DESCRIPTION
+
+     This module contains implementation of CTestEventNotify class member
+     functions. Handles requested events from test modules below.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotify
+
+     Method: CTestEventNotify
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to TestCombiner
+                 CTCTestCase* aTestCase: in: Pointer to used CTCTestCase
+                 
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+CTestEventNotify::CTestEventNotify( CTestCombiner* aTestCombiner, 
+                                    CTCTestCase* aTestCase ) : 
+    CActive( CActive::EPriorityStandard ),
+    iTestCombiner( aTestCombiner ),
+    iTestCase( aTestCase ),
+    iState( ETestEventNotifyIdle ),
+    iEventPckg( iEvent )
+    {
+    CActiveScheduler::Add( this );
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotify
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+void CTestEventNotify::ConstructL( TEventIf& aEvent )
+    {
+    iEvent.Copy( aEvent );
+    
+    iEvent.SetType( TEventIf::EWaitEvent );
+    iState = ETestEventNotifyPending;
+    iTestCombiner->TestModuleIf().Event( iEvent, iStatus );
+    SetActive();
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotify
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+     
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to TestCombiner
+                 CTCTestCase* aTestCase: in: Pointer to used CTCTestCase
+     
+     Return Values: CTestEventNotify* : pointer to created object
+
+     Errors/Exceptions: Leaves if ConstructL leaves or memory allocation fails
+     
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+CTestEventNotify* CTestEventNotify::NewL( CTestCombiner* aTestCombiner, 
+                                          CTCTestCase* aTestCase,
+                                          TEventIf& aEvent )
+    {
+    CTestEventNotify* self = 
+        new ( ELeave ) CTestEventNotify( aTestCombiner, aTestCase );
+    CleanupStack::PushL( self );
+    self->ConstructL( aEvent );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotify
+
+     Method: ~CTestEventNotify
+
+     Description: Destructor
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/     
+CTestEventNotify::~CTestEventNotify()
+    {
+    __TRACE( KMessage, ( _L("~CTestEventNotify") ));
+     
+    Cancel();
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotify
+
+     Method: RunL
+
+     Description: Handles completed event wait
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error.
+
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+
+void CTestEventNotify::RunL()
+    {
+    __TRACE( KMessage, ( _L("CTestEventNotify::RunL(%d): %d, %d"), 
+        this, iStatus.Int(), iState ) );
+    User::LeaveIfError( iStatus.Int() );
+
+    switch( iState )
+        {
+        case ETestEventNotifyPending:
+            {     
+            // Forward event set/unset
+            iEvent.SetType( TEventIf::ESetEvent );
+            iState = ETestEventNotifyCompleted;
+            User::LeaveIfError(
+                iTestCase->TestExecution().NotifyEvent( iEventPckg, iStatus ) );
+            SetActive();
+            }
+            break;
+        case ETestEventNotifyCompleted:
+            // Enable wait again
+            iEvent.SetType( TEventIf::ESetWaitPending );
+            iState = ETestEventNotifyPending;
+            iTestCombiner->TestModuleIf().Event( iEvent, iStatus );
+            SetActive();
+            break;
+        default:          
+            User::LeaveIfError( KErrGeneral );
+            break;
+        }
+    __TRACE( KMessage, ( _L("CTestEventNotify::RunL(%d) done: %d"), 
+        this, iState ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotify
+
+     Method: DoCancel
+
+     Description: Handle Cancel
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+     
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+
+void CTestEventNotify::DoCancel()
+    {
+    __TRACE( KMessage, ( _L("CTestEventNotify::DoCancel")));
+ 
+    _LIT( KTestEventNotify, "CTestEventNotify" );
+    switch ( iState )
+        {
+        case ETestEventNotifyPending:
+            {
+            TInt ret = 
+                iTestCombiner->TestModuleIf().CancelEvent( iEvent, &iStatus );
+            if( ret != KErrNone )
+                {
+                __TRACE( KMessage, ( _L("CTestEventNotify::DoCancel(%d) not pending: %d"), 
+                    this, ret ) );
+                }
+            }
+            break;
+        case ETestEventNotifyCompleted:            
+            iTestCase->TestExecution().
+                CancelAsyncRequest( ETestExecutionNotifyEvent );
+            break;
+        case ETestEventNotifyIdle:
+        default:
+            // DoCancel called in wrong state => Panic
+            User::Panic( KTestEventNotify, KErrGeneral );
+            break;
+        }
+     
+    iState = ETestEventNotifyIdle;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotify
+
+     Method: RunError
+
+     Description: Handle error. Should newer come here so we return error.
+
+     Parameters: TInt aError: in: error from CActive
+     
+     Return Values: Symbian OS error value
+     
+     Errors/Exceptions: None
+     
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+
+TInt CTestEventNotify::RunError( TInt aError )
+    {
+    __TRACE( KMessage, ( _L("CTestEventNotify::RunError")));
+ 
+    return aError;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     DESCRIPTION
+
+     This module contains implementation of CTestEventNotifier class member
+     functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotifier
+
+     Method: CTestEventNotifier
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to TestCombiner
+                 CTCTestCase* aTestCase: in: Pointer to used CTCTestCase
+                 
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+CTestEventNotifier::CTestEventNotifier( CTestCombiner* aTestCombiner, 
+                                        CTCTestCase* aTestCase ) : 
+    CActive( CActive::EPriorityStandard ),
+    iTestCombiner( aTestCombiner ),
+    iTestCase( aTestCase ),
+    iState( ETestEventIdle ),
+    iEventPckg( iEvent )
+    {
+    CActiveScheduler::Add( this );
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotifier
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+void CTestEventNotifier::ConstructL( )
+    {
+    StartL();
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotifier
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+     
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to TestCombiner
+                 CTCTestCase* aTestCase: in: Pointer to used CTCTestCase
+     
+     Return Values: CTestEventNotifier* : pointer to created object
+
+     Errors/Exceptions: Leaves if ConstructL leaves or memory allocation fails
+     
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+CTestEventNotifier* CTestEventNotifier::NewL( CTestCombiner* aTestCombiner, 
+                                              CTCTestCase* aTestCase  )
+    {
+    CTestEventNotifier* self = 
+        new ( ELeave ) CTestEventNotifier( aTestCombiner, aTestCase );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotifier
+
+     Method: ~CTestEventNotifier
+
+     Description: Destructor
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/     
+CTestEventNotifier::~CTestEventNotifier()
+    {
+    __TRACE( KMessage, ( _L("~CTestEventNotifier") ));
+     
+    
+     
+    Cancel();
+     
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotifier
+
+     Method: StartL
+
+     Description: Start active object
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leave if already pending
+
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+void CTestEventNotifier::StartL()
+    {
+    // Check that this request is not pending!!
+    if( iState == ETestEventPending )
+        {
+        User::Leave( KErrGeneral );
+        }
+        
+    iEvent.SetType( TEventIf::EEnable );
+    iState = ETestEventPending;
+    __TRACE( KMessage, ( _L("Set event pending %d"), this ) );
+    iTestCase->TestExecution().NotifyEvent( iEventPckg, iStatus );
+    SetActive();
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotifier
+
+     Method: RunL
+
+     Description: Handles completed event request
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error.
+
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+
+void CTestEventNotifier::RunL()
+    {
+    __TRACE( KMessage, ( _L("CTestEventNotifier::RunL(%d): %d, %d"), 
+        this, iStatus.Int(), iState ) );
+
+    User::LeaveIfError( iStatus.Int() );
+    
+    switch( iState )
+        {
+        case ETestEventPending:
+        case ETestEventWaitUnset:
+            {  
+            iState = ETestEventCompleted;
+            
+            switch( iEvent.Type() )
+                {
+                case TEventIf::ERelEvent:
+                    {
+                    // Remove from requested events list
+                    TInt count = iTestCase->EventArray().Count();
+                    TInt ind = 0;
+                    for( ; ind < count; ind++)
+                        { 
+                          if( iTestCase->EventArray()[ind]->Event().Name() == iEvent.Name() )
+                              {
+                              __RDEBUG( ( _L("TC CTestEventNotifier(RelEvent) %S"), 
+                                  &iEvent.Name() ));
+                              CTestEventNotify* event = iTestCase->EventArray()[ind];
+                              iTestCase->EventArray().Remove( ind );
+                              delete event;
+                              break;
+                              }
+                          }
+                    if( ind == count )
+                        {
+                        User::Leave( KErrNotFound );
+                        }
+                    }
+                    break; 
+                case TEventIf::EUnsetEvent:
+                    {
+                    __RDEBUG( ( _L("TC CTestEventNotifier(UnsetEvent) %S"), 
+                                  &iEvent.Name() ));
+                    TInt count = iTestCase->StateEventArray().Count();
+                    for( TInt i=0; i<count; i++ )
+                        {
+                        if( iTestCase->StateEventArray()[i]->Name() == iEvent.Name() )
+                            {
+                            TEventIf* event = iTestCase->StateEventArray()[i];
+                            iTestCase->StateEventArray().Remove(i);
+                            delete event;
+                            break;
+                            }
+                        }
+                                  
+                    if( iTestCombiner->UnsetEvent( iEvent, iStatus ) )
+                        {
+                         // Event request is pending from modules below test 
+                         // combiner, stay waiting
+                        iState = ETestEventWaitUnset;
+                        // Wait for unset to complete 
+                        SetActive();
+                        return;
+                        }
+                    }
+                    break;
+                case TEventIf::EReqEvent:
+                    // Do nothing
+                    __RDEBUG( ( _L("TC CTestEventNotifier(ReqEvent) %S"), 
+                                  &iEvent.Name() ));
+                    break;
+                case TEventIf::ESetEvent: 
+                    // Do nothing
+                    __RDEBUG( ( _L("TC CTestEventNotifier(SetEvent) %S"), 
+                                  &iEvent.Name() ));
+                    break;
+                default:
+                    User::Leave( KErrArgument );
+                    break;
+                }   
+                            
+            // Forward event request
+            iTestCombiner->TestModuleIf().Event( iEvent, iStatus );
+            SetActive();
+            
+            }
+            break;
+        case ETestEventCompleted:
+            __RDEBUG( ( _L("TC CTestEventNotifier(Complete)")));
+            switch( iEvent.Type() )
+                {
+                case TEventIf::EReqEvent:
+                    {
+                    // Store requested events
+                    CTestEventNotify* event = 
+                        CTestEventNotify::NewL( iTestCombiner, iTestCase, iEvent );
+                    CleanupStack::PushL( event ); 
+                    User::LeaveIfError( iTestCase->EventArray().Append( event ) );
+                    CleanupStack::Pop( event ); 
+                    }
+                    break;
+                case TEventIf::ESetEvent: 
+                    if( iEvent.EventType() == TEventIf::EState )
+                        {
+                        TEventIf* event = new( ELeave )TEventIf;
+                        CleanupStack::PushL( event );
+                        event->Copy( iEvent );
+                        User::LeaveIfError( iTestCase->StateEventArray().Append( event ) ); 
+                        CleanupStack::Pop( event );
+                        }
+                    break;
+                case TEventIf::ERelEvent: 
+                case TEventIf::EUnsetEvent:
+                    // Do nothing
+                    break;
+                default:
+                    User::Leave( KErrArgument );
+                    break;
+                }
+       
+            // Enable request again
+            StartL();
+            break;
+        default:          
+            User::LeaveIfError( KErrGeneral );
+            break;
+        }
+    __TRACE( KMessage, ( _L("CTestEventNotifier::RunL(%d) done: %d"), 
+        this, iState ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotifier
+
+     Method: DoCancel
+
+     Description: Handle Cancel
+
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+     
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+
+void CTestEventNotifier::DoCancel()
+    {
+    __TRACE( KMessage, ( _L("CTestEventNotifier::DoCancel")));
+    _LIT( KTestEventNotifier, "CTestEventNotifier" );
+    
+    switch ( iState )
+        {
+        case ETestEventPending:
+            iTestCase->TestExecution().
+                CancelAsyncRequest( ETestExecutionNotifyEvent );
+            break;
+        case ETestEventCompleted:            
+            {
+            TInt ret = iTestCombiner->TestModuleIf().CancelEvent( iEvent, &iStatus );
+            if( ret != KErrNone )
+                {
+                __TRACE( KMessage, ( _L("CTestEventNotifier::DoCancel(%d) not pending: %d"), 
+                    this, ret ) );
+                }
+            }
+			User::WaitForRequest( iStatus );
+            break;
+        case ETestEventIdle:
+        default:
+            // DoCancel called in wrong state => Panic
+            User::Panic( KTestEventNotifier, KErrGeneral );
+            break;
+        }
+     
+    iState = ETestEventIdle;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestEventNotifier
+
+     Method: RunError
+
+     Description: Handle error. Should newer come here so we return error.
+
+     Parameters: TInt aError: in: error from CActive
+     
+     Return Values: Symbian OS error value
+     
+     Errors/Exceptions: None
+     
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+
+TInt CTestEventNotifier::RunError( TInt aError )
+    {
+    __TRACE( KMessage, ( _L("CTestEventNotifier::RunError")));
+    
+     switch( iState )
+        {
+        case ETestEventPending:
+        case ETestEventWaitUnset:
+            // Either the event request is cancelled or some 
+            // unknown error occurred. We go idle state.
+            iState = ETestEventIdle;
+            break;
+        
+        case ETestEventCompleted:
+            // Error in event command, forward it to the test module
+            iEvent.SetType( TEventIf::EEnable );
+            iState = ETestEventPending;
+            __TRACE( KMessage, ( _L("Cmd error %d"), this ) );
+            iTestCase->TestExecution().NotifyEvent( iEventPckg, iStatus, aError );
+            SetActive();
+            break;
+        default:          
+            __TRACE( KMessage, ( _L("Illegal state %d"), this ) );
+            return aError;
+        }
+     
+    return KErrNone;
+    
+    }
+    
+// ================= MEMBER FUNCTIONS =========================================
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: CTestCommandNotifier
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: CTestCombiner* aTestCombiner: in: Pointer to TestCombiner
+                CTCTestCase* aTestCase: in: Pointer to test case
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCommandNotifier::CTestCommandNotifier(CTestCombiner* aTestCombiner, 
+                                           CTCTestCase* aTestCase):
+    CActive(CActive::EPriorityStandard),
+    iTestCombiner(aTestCombiner),
+    iTestCase(aTestCase),
+    iCommandPckg(iCommand)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCommandNotifier::ConstructL( )
+    {
+    __TRACE(KMessage, (_L("CTestCommandNotifier::ConstructL (combiner)")));
+    Start();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestCombiner* aTestCombiner: in: Pointer to TestCombiner
+                CTCTestCase* aTestCase: in: Pointer to test case
+
+    Return Values: CTestCommandNotifier* : pointer to created object
+
+    Errors/Exceptions: Leaves if construction of CTestCommandNotifier fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCommandNotifier* CTestCommandNotifier::NewL(CTestCombiner* aTestCombiner, 
+                                                 CTCTestCase* aTestCase)
+    {
+    CTestCommandNotifier* self = new (ELeave) CTestCommandNotifier(aTestCombiner, aTestCase);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: ~CTestCommandNotifier
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCommandNotifier::~CTestCommandNotifier()
+    {
+    __TRACE(KMessage, (_L("CTestEventNotifier::~CTestEventNotifier (combiner)")));
+    Cancel();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: StartL
+
+    Description: Start active object
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCommandNotifier::Start()
+    {
+    __TRACE(KMessage, (_L("CTestEventNotifier::StartL (combiner)")));
+
+    TInt res = iTestCase->TestExecution().NotifyCommand2(iCommandPckg, iParamsPckg, iStatus, KErrNone);
+    SetActive();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone
+                       Leaves if iState is not ETestEventPending
+                       Leaves if some leaving method called here leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCommandNotifier::RunL()
+    {
+    __TRACE(KMessage, (_L("CTestCommandNotifier::RunL (combiner): iStatus=[%d]"), iStatus.Int()));
+
+    User::LeaveIfError(iStatus.Int());
+
+    switch(iCommand)
+        {
+        case EStopExecution:
+            {
+            __TRACE(KMessage, (_L("CTestCommandNotifier::RunL (combiner): StopExecution command received")));
+            TStopExecutionCommandParams par;
+            TStopExecutionCommandParamsPckg parPack(par);
+            parPack.Copy(iParamsPckg);
+            __TRACE(KMessage, (_L("CTestCommandNotifier::RunL(combiner): propagating stop execution [%d][%d]"), par.iType, par.iCode));
+            iTestCombiner->TestModuleIf().StopExecution(par.iType, par.iCode);
+            }
+            break;
+
+        case ESendTestModuleVersion:
+            {
+            __TRACE(KMessage, (_L("CTestCommandNotifier::RunL (combiner): SendTestModuleVersion command received")));
+            TSendTestModuleVesionCommandParams params;
+            TSendTestModuleVesionCommandParamsPckg paramsPack(params);
+            paramsPack.Copy(iParamsPckg);
+
+            __TRACE(KMessage, (_L("CTestCommandNotifier::RunL(combiner): propagating module version [%d][%d][%d][%S]"), params.iMajor, params.iMinor, params.iBuild, &params.iTestModuleName));
+            TVersion moduleVersion(params.iMajor, params.iMinor, params.iBuild);
+            
+            TBool newVersionOfMethod = ETrue;
+            iTestCombiner->TestModuleIf().SendTestModuleVersion(moduleVersion, params.iTestModuleName, newVersionOfMethod);
+            }
+            break;
+
+        default:
+            __TRACE(KError, (_L("CTestCommandNotifier::RunL (combiner): Unknown command [%d]."), iCommand));
+        }
+
+    // Set request again
+    Start();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCommandNotifier::DoCancel()
+    {
+    __TRACE(KMessage, (_L( "CTestEventNotifier::DoCancel (combiner)")));
+
+    iTestCase->TestExecution().CancelAsyncRequest(ETestExecutionNotifyCommand);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: RunError
+
+    Description: Handle errors.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCommandNotifier::RunError(TInt aError)
+    {
+    __TRACE(KError, (CStifLogger::ERed, _L("CTestCommandNotifier::RunError %d (combiner)"), aError));
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/src/TestCombiner.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,6648 @@
+/*
+* 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: This module contains the implementation of 
+* CTestCombiner class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestEventInterface.h>
+#include <StifLogger.h>
+#include "TestCombiner.h"
+#include "TestKeywords.h"
+#include "TestCase.h"
+#include "TestCombinerEvent.h"
+#include "Logging.h"
+//--PYTHON-- begin
+#include "StifPython.h"
+#include "StifPythonFunComb.h"
+//--PYTHON-- end
+#include "SettingServerClient.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+_LIT( KTestRunner, "CTestRunner" );
+_LIT( KRemoteTimer, "CRemoteTimer" );
+_LIT( KRemoteReceiver, "CRemoteReceiver" );
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iLog
+
+// LOCAL CONSTANTS AND MACROS
+_LIT(KTitle, "title");
+_LIT(KTimeout, "timeout");
+_LIT(KPriority, "priority");
+
+//printing macros
+ _LIT( KExecute, "Execute");
+ 
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: CTestCombiner
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTestCombiner::CTestCombiner(): 
+    iSchedulerActive( EFalse ),
+    iRunningTests( 0 ), 
+    iResult( KErrNone ),
+    iEventPckg( iEvent ),
+    iRemoteTimeout( KRemoteProtocolTimeout ),
+    iCancelIfError( EFalse ),
+    iFailedTestCase( 0 ),
+    iLoopIsUsed( EFalse )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::ConstructL()
+    {
+    // TRAPed to avoid crashing if logfile creation fails,
+    // so we can run test without logging to file
+    TRAPD( err, iStdLog = CStifLogger::NewL( KTestCombinerLogDir, 
+                                      KTestCombinerLogFile );
+        );
+    if( err != KErrNone )
+        {
+        iStdLog = NULL;
+        __RDEBUG( (_L("Creating logfile failed") ) );
+        }  
+    iLog = iStdLog;
+
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Close Setting server session
+    settingServer.Close();
+
+    iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle;
+
+    iIndexTestModuleControllers = 1;
+    
+    __TRACE( KPrint, ( _L("New TestCombiner") ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters:    None
+
+     Return Values: CTestCombiner*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTestCombiner* CTestCombiner::NewL()
+    {
+     
+    CTestCombiner* self = new (ELeave) CTestCombiner();
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: ~CTestCombiner
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTestCombiner::~CTestCombiner()
+    {
+    iLoopAllocationArray.Reset();
+    iLoopAllocationArray.Close();
+    iLoopIsUsed = EFalse;
+
+    iTestCases.ResetAndDestroy();
+    iTestModules.ResetAndDestroy();
+    iEventArray.ResetAndDestroy();
+    iSlaveArray.ResetAndDestroy();
+    iSendReceive.ResetAndDestroy();
+
+    iTestCases.Close();
+    iTestModules.Close();
+    iEventArray.Close();
+    iSlaveArray.Close();
+    iSendReceive.Close();
+
+    // Stop all remaining measurement modules
+    const TInt count_meas = iTestMeasurementArray.Count();
+    for( TInt b = 0; b < count_meas; b++ )
+        {
+        iTestMeasurementArray[b]->iMeasurement->Stop();
+        }
+    iTestMeasurementArray.ResetAndDestroy();
+    iTestMeasurementArray.Close();
+
+    delete iSectionParser;
+    delete iRemoteReceiver;
+    delete iTestRunner;
+
+    iLog = NULL;
+    delete iStdLog;
+    iStdLog = NULL;
+    delete iTCLog;
+    iTCLog = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: InitL
+
+     Description: InitL is used to initialize the Test Module.
+
+     Parameters: const TFileName& aIniFile: in: Initialization file
+                 TBool aFirstTime: in: First time flag 
+
+     Return Values: Symbian OS error code
+
+     Errors/Exceptions: Leaves if ReadInitializationL leaves
+
+     Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCombiner::InitL( TFileName& aIniFile, 
+                           TBool /*aFirstTime*/ )
+    {
+
+    __TRACEFUNC();
+
+    if( aIniFile.Length() > 0 )
+        {
+        // Read initialization from test case file
+        ReadInitializationL( aIniFile );
+        }
+    
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetTestCases
+
+     Description: GetTestCases is used to inquired test cases
+
+     Parameters:    const TFileName& aConfigFile: in: Config file name
+                    RPointerArray<RTestEngine::TTestCaseInfo>& aTestCases: out: 
+                          Array of TestCases 
+
+     Return Values: KErrNone: Success
+                    KErrNotFound: Testcases not found
+
+     Errors/Exceptions: Leaves if CStifParser::NewL leaves
+                        Leaves if CStifParser::SectionL leaves
+                        Leaves if CStifParser::NextSectionL leaves
+                        Leaves if memory allocation fails
+
+     Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCombiner::GetTestCasesL( const TFileName& aConfigFile, 
+                                   RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+    __TRACEFUNC();
+
+    if( aConfigFile.Length() == 0 )
+        {
+        __TRACE( KError, (_L("No test case script file given") ) );
+        __RDEBUG( (_L("No test case script file given") ) );
+        return KErrNotFound;
+        }
+
+    CStifParser* parser = NULL;
+    TRAPD( err, parser = 
+        CStifParser::NewL( _L(""), aConfigFile, CStifParser::ECStyleComments ) );
+    if( err != KErrNone )
+        {
+        __TRACE( KError, (_L("Test case script file not found") ) );
+        __RDEBUG( (_L("Test case script file not found") ) );
+        return KErrNotFound;
+        }
+    CleanupStack::PushL( parser );
+    CStifSectionParser* section;
+    TPtrC tmp;
+    TInt index = 0;
+    TInt ret = KErrNone;
+
+    section = parser->SectionL( KTestStartTag, KTestEndTag );
+    if( section == NULL )
+        {
+        ret = KErrNotFound;
+        }
+    else
+        {    
+        while( section )
+            {
+            CleanupStack::PushL( section );
+             
+            if( section->GetLine( KTitle,  tmp, ENoTag ) == KErrNone )
+                 {
+                 if( tmp.Length() > KMaxName )
+                    {
+                    tmp.Set( tmp.Left( KMaxName ) );
+                    }                    
+                 TTestCaseInfo* tc = new ( ELeave ) TTestCaseInfo();
+                 CleanupStack::PushL( tc );
+                 __TRACE( KVerbose, (_L("TestCase: %S"), &tmp));
+                 tc->iTitle.Copy( tmp );
+                 tc->iCaseNumber = ++index;
+                 CStifItemParser* item = section->GetItemLineL( KTimeout );
+                 if( item )
+                    {
+                    TInt timeout; // In milliseconds
+                    ret = item->GetInt( KTimeout, timeout ); 
+                    if( ret != KErrNone )
+                        {
+                        __TRACE( KError, (_L("Illegal timeout")));
+                        User::Leave( ret ); 
+                        }
+                    tc->iTimeout = (TInt64)timeout*1000;
+                    __TRACE( KMessage, (_L("Timeout: %i"), tc->iTimeout.Int64() ));
+                    }
+                 item = section->GetItemLineL( KPriority );
+                 if( item )
+                    {
+                    ret = item->GetInt( KPriority, tc->iPriority ); 
+                    if( ret != KErrNone )
+                        {
+                        TPtrC priority;
+                        ret = item->GetString( KPriority, priority );
+                        if( ret != KErrNone )
+                            {
+                            __TRACE( KError, (_L("Illegal priority")));
+                            User::Leave( ret ); 
+                            }
+                        switch( TTCKeywords::Parse( priority, 
+                                                    TTCKeywords::Priority ) )
+                            {
+                            case TTCKeywords::EPriHigh:
+                                tc->iPriority = TTestCaseInfo::EPriorityHigh;
+                                break;
+                            case TTCKeywords::EPriNormal:
+                                tc->iPriority = TTestCaseInfo::EPriorityNormal;
+                                break;
+                            case TTCKeywords::EPriLow:
+                                tc->iPriority = TTestCaseInfo::EPriorityLow;
+                                break;
+                            default:
+                                __TRACE( KError, (_L("Illegal priority")));
+                                User::Leave( KErrArgument ); 
+                            }
+                        }
+                    __TRACE( KMessage, (_L("Priority: %i"), tc->iPriority ));
+                    }
+
+                 aTestCases.Append(tc);
+                 CleanupStack::Pop( tc );
+                 }
+            CleanupStack::PopAndDestroy( section );
+            section = parser->NextSectionL( KTestStartTag, KTestEndTag );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( parser );
+
+    __TRACE( KPrint, (  _L( "Configfile '%S', testcases %d" ),
+        &aConfigFile, index ));
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: RunTestCaseL
+
+     Description: Run a specified testcase.
+
+     RunTestCaseL is used to run an individual test case specified 
+     by aTestCase. 
+
+     Parameters:    const TInt aCaseNumber: in: Testcase number 
+                    const TFileName& aConfig: in: Configuration file name
+                    TTestResult& aResult: out; test case result
+
+     Return Values: KErrNone: Test case started succesfully.
+                    KErrNotFound: Testcase not found
+                    KErrUnknown: Unknown TestCombiner error
+                    Any other SymbianOS error
+
+     Errors/Exceptions: Leaves if GetTestCaseL leaves
+                        Leaves if RunTestL leaves
+                        Leaves if memory allocation fails
+
+     Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCombiner::RunTestCaseL( const TInt aCaseNumber, 
+                                  const TFileName& aConfig, 
+                                  TTestResult& aResult )
+    {
+    __TRACEFUNC();
+
+    __TRACE( KMessage, (_L("***Testcase started***")));
+
+    //Open new log file with test case title in file name
+    if(iAddTestCaseTitleToLogName)
+        {
+        //Close test case log if exists
+        if(iTCLog)
+            {
+            delete iTCLog;
+            iTCLog = NULL;
+            }
+        TFileName logFileName;
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        
+        logFileName.Format(KTestCombinerLogFileWithTitle, &title);
+        iTCLog = CStifLogger::NewL(KTestCombinerLogDir, logFileName);
+        iLog = iTCLog;
+        }
+
+    /* 
+    * Allow memory leaks, because Defines are leaved untouched 
+    * after test case execution. Real memory leaks are detected with 
+    * UHEAP macros.
+    */
+    TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksMem );
+    
+    // Read initialization from test case file
+    ReadInitializationL( aConfig );
+
+    __UHEAP_MARK;
+        
+    iSectionParser = GetTestCaseL( aCaseNumber, aConfig );
+
+    // Check parsing result
+    if( iSectionParser == NULL )
+        {
+        __TRACE( KError, (_L("***Parsing testcase failed***")));
+        __UHEAP_MARKEND;
+        return KErrNotFound;
+        }
+
+    CActiveScheduler* activeScheduler = 
+        new ( ELeave ) CActiveScheduler();
+    CleanupStack::PushL( activeScheduler );
+    CActiveScheduler::Install( activeScheduler );
+
+    // Resetting these variables to normal state @js             
+    iFailedTestCase = 0;    
+    iCancelIfError = EFalse;
+    iScriptFailed = KErrNone;
+    iScriptFailedDescription.Copy(KNullDesC);
+
+    // Run the given testcase described in iSectionParser section
+    RunTestL();
+
+    CleanupStack::PopAndDestroy( activeScheduler );
+
+    delete iSectionParser;
+    iSectionParser = NULL;
+
+    TInt ret = KErrNone;
+    // Check if test case starting failed
+    if( iResult != KErrNone )
+        {
+        TestModuleIf().Printf( KPrintPriHigh, _L("Result"), _L("Starting FAILED [%d]"), iResult);
+         __TRACE( KError, (_L("***Starting testcase FAILED***")));
+        ret = iResult;
+        aResult.iResult = -2;
+        aResult.iResultDes = _L("Testcase script execution failed");
+        }
+    else if(iScriptFailed != KErrNone)
+        {
+        TestModuleIf().Printf( KPrintPriHigh, _L("Result"), _L("Script execution FAILED"));
+        __TRACE( KError, (_L("***Script execution FAILED***")));
+        aResult.iResult = iScriptFailed;
+        if(iScriptFailedDescription != KNullDesC)
+            {
+            aResult.iResultDes.Copy(iScriptFailedDescription);
+            }
+        else
+            {
+            aResult.iResultDes = _L("Testcase script execution failed");
+            }
+        }
+    else
+        {
+        __TRACE( KPrint, (_L("***Testcase completed***")));
+              
+        // Testcombiner succeeded to start all testcases, 
+        // check individual testcase results
+        TInt count = iTestCases.Count();
+        TInt i = iFailedTestCase;
+        // iFailedTestCase is either 0 or the number of failed test case if 
+        // canceliferror was given and a test case has failed
+
+        for(; i < count; i++ )
+            {
+            // All cases should be completed now
+            if( iTestCases[i]->State() != CTCTestCase::ETestCaseCompleted )
+                {
+                // This is some unknown internal TestCombiner error
+                // Should not happen
+                __TRACE( KError, (_L("TestCase (%S) not completed"), 
+                    &iTestCases[i]->TestId() ));
+                ret = KErrUnknown;
+                break;
+                }
+
+            // Interpret execution result type from returned result
+            TInt executionResult = TFullTestResult::ECaseExecuted; // Ok
+            if( iTestCases[i]->iResult.iCaseExecutionResultType >= 
+                TFullTestResult::ECaseLeave )
+                {
+                // Some abnormal execution result type
+                executionResult = iTestCases[i]->iResult.iCaseExecutionResultType;
+                }
+
+            // Check expected execution result type
+            if( executionResult != iTestCases[i]->ExpectedResultCategory() ) 
+                {
+                // expected and returned result types differ
+                aResult.iResult = KErrGeneral;
+                aResult.iResultDes.Copy( _L("Test case completed with ") );
+                aResult.iResultDes.Append( 
+                    TTCKeywords::ResultCategory( 
+                    iTestCases[i]->iResult.iCaseExecutionResultType ));
+                aResult.iResultDes.Append( _L(" and expected was ") );
+                aResult.iResultDes.Append( 
+                    TTCKeywords::ResultCategory( 
+                    iTestCases[i]->ExpectedResultCategory() ));
+                AppendTestResultToResultDes(aResult.iResultDes, iTestCases[i]->iResult.iTestResult.iResultDes);
+                __TRACE( KPrint, ( _L( "%S"), &aResult.iResultDes ) );
+                break;
+                }
+
+            // Check normal test result
+            if( iTestCases[i]->ExpectedResultCategory() == 
+                TFullTestResult:: ECaseExecuted )
+                {
+                // Normal completion, check result
+                if( iTestCases[i]->iResult.iTestResult.iResult != 
+                      iTestCases[i]->ExpectedResult() )
+                    {
+                     __TRACE( KPrint, ( _L( "Test failed, expect(%d) != result(%d)"), 
+                         iTestCases[i]->ExpectedResult(),
+                         iTestCases[i]->iResult.iTestResult.iResult ));
+                    // We return the first error result as aResult
+                    if( iTestCases[i]->iResult.iTestResult.iResult != KErrNone )
+                        {
+                        aResult = iTestCases[i]->iResult.iTestResult;
+                        }
+                    else
+                        {
+                        aResult.iResult = KErrGeneral;
+                        aResult.iResultDes.Copy( _L("Test case completed with KErrNone and expected "));
+                        aResult.iResultDes.AppendNum( iTestCases[i]->ExpectedResult() );
+                        AppendTestResultToResultDes(aResult.iResultDes, iTestCases[i]->iResult.iTestResult.iResultDes);
+                        }
+                    break;
+                    }
+                }
+            else 
+                {
+                // Abnormal completion, i.e. panic, leave, exception or timeout
+                if( iTestCases[i]->iResult.iCaseExecutionResultCode != 
+                      iTestCases[i]->ExpectedResult() )
+                    {
+                    __TRACE( KPrint, ( _L( "Test failed, expect errorcode(%d) != result(%d)"), 
+                         iTestCases[i]->ExpectedResult(),
+                         iTestCases[i]->iResult.iCaseExecutionResultCode ) );
+                    // We return the first error result as aResult
+                    aResult = iTestCases[i]->iResult.iTestResult;
+                    // override result with real error code
+                    aResult.iResult = iTestCases[i]->iResult.iCaseExecutionResultCode;
+                    break;
+                    }
+                }
+            }
+        if( i == count )
+            {
+            TestModuleIf().Printf( KPrintPriHigh, _L("Result"), _L("PASSED"));
+            __TRACE( KPrint, (_L("***Test case result: PASSED***")));
+            aResult.iResult = KErrNone;
+            aResult.iResultDes.Copy( _L("Test case succeeded") );
+            }
+        else
+            {
+            TestModuleIf().Printf( KPrintPriHigh, _L("Result"), _L("FAILED"));        
+            __TRACE( KPrint, (_L("***Test case result: FAILED***")));
+            }
+        }
+
+    // Release all pending event requests
+    TEventIf event( TEventIf::ERelEvent );
+    TInt eventCount = iEventArray.Count();
+    for( TInt ind=0; ind < eventCount; ind++ )
+        {
+        event.SetName( iEventArray[ind]->Name() );
+        TestModuleIf().Event( event );
+        }
+
+    iLoopAllocationArray.Reset();
+    iLoopAllocationArray.Close();
+    iLoopIsUsed = EFalse;
+
+    // Delete all completed and checked testcases
+    // Do not change the deletion order of events and test cases!!!
+    iEventArray.ResetAndDestroy();
+    iTestCases.ResetAndDestroy();
+    iTestModules.ResetAndDestroy();
+    iSlaveArray.ResetAndDestroy();
+
+    iSendReceive.ResetAndDestroy();
+
+    // Stop all remaining measurement modules
+    const TInt count_meas = iTestMeasurementArray.Count();
+    for( TInt b = 0; b < count_meas; b++ )
+        {
+        iTestMeasurementArray[b]->iMeasurement->Stop();
+        }
+    iTestMeasurementArray.ResetAndDestroy();
+    iTestMeasurementArray.Close();
+
+    __UHEAP_MARKEND;
+
+    //If log was replaced then restore it
+    if(iAddTestCaseTitleToLogName)
+        {
+        iLog = iStdLog;
+        delete iTCLog;
+        iTCLog = NULL;
+        }
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetTestCaseL
+
+     Description: Get specified test case section from configfile.
+
+     Parameters:    const TInt aCaseNumber: in: Test case number
+                    const TFileName& aConfig: in: Configfile name 
+
+     Return Values: CSectionParser*: pointer to test case section
+
+     Errors/Exceptions: Leaves if CStifParser::NewL leaves
+                        Leaves if CStifParser::SectionL leaves
+                        Leaves if memory allocation fails
+
+     Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifSectionParser* CTestCombiner::GetTestCaseL( const TInt aCaseNumber, 
+                                             const TFileName& aConfig )
+    {
+    __TRACEFUNC();
+    CStifParser* parser = 
+        CStifParser::NewL( _L(""), aConfig, CStifParser::ECStyleComments );
+    CleanupStack::PushL( parser );
+
+    CStifSectionParser* section = 
+        parser->SectionL( KTestStartTag, KTestEndTag, aCaseNumber );
+
+    CleanupStack::PopAndDestroy( parser );
+    return section;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: ReadInitializationL
+
+     Description: Read initialization from file.
+
+     Parameters:    const TDesC& aIniFile: in: File that contains initialization
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::ReadInitializationL( const TDesC& aIniFile )
+    {
+    CStifParser* parser = NULL; 
+
+    // Open file
+    TRAPD( err, parser = 
+        CStifParser::NewL( _L(""), aIniFile, CStifParser::ECStyleComments ) );
+    if( ( err == KErrNone ) && parser )
+        {
+        CleanupStack::PushL( parser );
+        __TRACE( KMessage, (_L("Read initialization from [%S]"),
+            &aIniFile ) );
+        
+        // Read initialization parameters 
+        CStifSectionParser* section = parser->SectionL( KInitStartTag,
+                                                        KInitEndTag );
+        if( section  )
+            {
+            CleanupStack::PushL( section );
+            __TRACE( KMessage, (_L("Read initializations")) );
+
+            // Read RCP timeout            
+            CStifItemParser* item = section->GetItemLineL( KInitRcpTimeout );
+            if( item != NULL )
+                {
+                __TRACE( KMessage, (_L("Got RCP timeout definition")) );
+                CleanupStack::PushL( item );
+                
+                TInt value;
+                if( item->GetInt( KInitRcpTimeout, value ) 
+                        != KErrNone )
+                    {
+                    __TRACE( KError, (_L("No RCP timeout value given")) );
+                    User::Leave( KErrGeneral );                    
+                    } 
+                // Change from seconds to milliseconds
+                iRemoteTimeout = value*1000*1000;
+                CleanupStack::PopAndDestroy( item );
+                }
+
+            CleanupStack::PopAndDestroy( section );
+            }
+           
+        // Read defines
+        section = parser->SectionL( KDefineStartTag, KDefineEndTag );
+        while(section)
+            {
+            CleanupStack::PushL( section );
+            __TRACE( KMessage, (_L("Read defines")) );
+
+            TPtrC name;
+            TPtrC value;
+            CStifItemParser* item = section->GetItemLineL( _L("") );
+            while( item )
+                {
+                CleanupStack::PushL( item );
+                
+                if( item->GetString( _L(""), name ) != KErrNone )
+                    {
+                    __TRACE( KError, (_L("No define name given")) );
+                    User::Leave( KErrGeneral );
+                    } 
+                if( item->Remainder( value ) != KErrNone )
+                    {
+                    __TRACE( KError, (_L("No define value given")) );
+                    User::Leave( KErrGeneral );
+                    } 
+                TInt count = iDefined.Count();
+                TInt i = 0;
+                for( ; i < count; i++ )
+                    {
+                    if( iDefined[i]->Name() == name )
+                        {
+                        __TRACE( KMessage, (_L("Update define %S:%S"), &name, &value ) );
+                        // Update existing
+                        iDefined[i]->SetValueL( value );
+                        break;
+                        }
+                    }
+                if( i == count) 
+                    {
+                    // New define, store it
+                    CDefinedValue* define = CDefinedValue::NewL( name, value );
+                    CleanupStack::PushL( define );
+                    User::LeaveIfError( iDefined.Append( define ) );
+                    CleanupStack::Pop( define );
+                    }
+
+                CleanupStack::PopAndDestroy( item );
+                item = section->GetNextItemLineL();
+                }
+            CleanupStack::PopAndDestroy( section );
+            section = parser->NextSectionL(KDefineStartTag, KDefineEndTag);
+            }
+        CleanupStack::PopAndDestroy( parser );
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: RunTestL
+
+     Description: Run a testcase specified by iSectionParser.
+
+     Parameters:    None
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if CSectionParser::GetItemLineL leaves
+                        Leaves if CTestRunner::NewL leaves
+                        Leaves if memory allocation fails                                
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::RunTestL()
+    {
+    __TRACEFUNC();
+    iResult = KErrNone;
+
+    TPtrC line;
+    // "title" keyword must be in the first line
+    User::LeaveIfError( iSectionParser->GetLine( KTitle, line, ENoTag ) );
+     
+    iTestRunner = CTestRunner::NewL( this ); 
+    iRemoteReceiver = CRemoteReceiver::NewL( this );
+    iRemoteReceiver->Start();
+
+    __TRACE( KMessage, (_L("Run: %S"), &line));
+    
+    TestModuleIf().Printf( KPrintPriNorm, _L("Run"), _L("%S"), &line);
+    // Rest of the job is done by test runner
+    iTestRunner->SetRunnerActive();
+
+    // Start activeScheduler looping testcase lines
+    iSchedulerActive = ETrue;
+    __TRACE( KMessage, (_L("Start CActiveScheduler")));
+    CActiveScheduler::Current()->Start();
+
+    TestModuleIf().Printf( KPrintPriNorm, _L("Executed"), _L("%S"), &line);
+    __TRACE( KMessage, (_L("Executed: %S"), &line));
+        
+    delete iRemoteReceiver;
+    iRemoteReceiver = NULL;
+    delete iTestRunner;
+    iTestRunner = NULL;
+
+    }     
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetTestModuleL
+
+     Description: Load testmodule if not already loaded, otherwise return
+                  description of the loaded testmodule.
+
+     Parameters:    TDesC& aModule: in: Module name.
+                    TDesC& aIniFile: in: Ini file name.
+                    const TDesC& aConfigFile: in: Test case(config) file name.
+     
+     Return Values: CTCTestModule*: pointer to testmodules description
+     
+     Errors/Exceptions: Leaves if CTCTestModule::NewL leaves
+                        Leaves if RPointerArray::Append fails  
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CTCTestModule* CTestCombiner::GetTestModuleL( TDesC& aModule,
+                                              TDesC& aIniFile,
+                                              const TDesC& aConfigFile )
+    {
+    __TRACEFUNC();
+    TInt count = iTestModules.Count();
+    TInt i, j;
+    TInt counttc;
+    TInt running;
+    TBool newWay = EFalse;
+    
+    __TRACE(KMessage, (_L("Find test module for [%S]"), &aModule));
+
+    //Name for new module controller
+    TName newModuleName = aModule;
+
+    //Check if it is python case or UITestingSupport or SeparateProcesses mode
+    newWay = (aModule.Find(KPythonScripter) == 0)
+             || (TestModuleIf().UITesting() && aModule.Find(KTestScripterName) == 0)
+             || (TestModuleIf().SeperateProcesses()); 
+
+    if(newWay)
+        {
+        __TRACE(KMessage, (_L("TCTestModule operating mode: exclusive")));
+
+        //Find module of given name
+        __TRACE(KMessage, (_L("Looking for module [%S]"), &aModule));
+        if( TestModuleIf().UITesting() && aModule.Find(KTestScripterName) == 0)
+            {
+            __TRACE(KMessage, (_L("UITestingSupport option is on. New module controller will be created always")));
+            }
+        else
+            {
+            for(i = 0; i < count; i++)
+                {
+                TPtrC modName = iTestModules[i]->ModuleName();
+                if(modName.Find(aModule) == 0)
+                    {
+                    //Check if there is running test case
+                    counttc = iTestCases.Count();
+                    running = 0;
+                    for(j = 0; j < counttc; j++)
+                        {
+                        if(iTestCases[j]->TestModule() == iTestModules[i] && iTestCases[j]->State() != CTestCase::ETestCaseCompleted)
+                            {
+                            //We have found at least one running test case. There is no reason to find any more,
+                            //because there shouldn't be because test module may run only one python scripter test case.
+                            running++;
+                            __TRACE(KMessage, (_L("Module controller found [%S], but it has running test cases"), &modName));
+                            break;
+                            }
+                        }
+                    if(running == 0)
+                        {
+                        __TRACE(KMessage, (_L("Free module controller has been found [%S]"), &modName));
+                        return iTestModules[i];
+                        }
+                    }
+                }
+            }
+        //Update name of new module to be created
+        newModuleName.AppendFormat(_L("@%d_"), GetIndexForNewTestModuleController());
+        newModuleName.LowerCase();
+        }
+    else
+        {
+        __TRACE(KMessage, (_L("TCTestModule operating mode: normal")));
+        for(i = 0; i < count; i++)
+            {
+            if(iTestModules[i]->ModuleName() == aModule)
+                {
+                // Found test module, return description
+                __TRACE(KMessage, (_L("Module controller [%S] found"), &aModule));
+                return iTestModules[i];
+                }
+            }
+        }
+
+    __TRACE(KMessage, (_L("Creating new test module controller [%S] with ini [%S]"), &newModuleName, &aIniFile));
+    CTCTestModule* module = CTCTestModule::NewL(this, newModuleName, aIniFile, aConfigFile);
+    CleanupStack::PushL(module);
+
+    //Enumerate test cases
+    module->GetTestCasesForCombiner(aConfigFile);
+
+    //Append new module to list
+    User::LeaveIfError(iTestModules.Append(module));
+    CleanupStack::Pop(module);
+
+    //Log some info
+    if(newWay)
+        {    
+        __TRACE(KMessage, (_L("Module [%S] added to list. Currently there are following controllers of [%S] type:"), &newModuleName, &aModule));
+        j = 1;
+        for(i = 0; i < iTestModules.Count(); i++)
+            {
+            if(iTestModules[i]->ModuleName().Find(aModule) == 0)
+                {
+                __TRACE(KMessage, (_L("    %d. [%S]"), j, &iTestModules[i]->ModuleName()));
+                j++;
+                }
+            }
+        }
+
+    if( iLoopIsUsed )
+        {
+        User::LeaveIfError( iLoopAllocationArray.Append( module ) );
+        }
+
+    return module;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetTest
+
+     Description: Get test case from testcase array.
+
+     Parameters:    TDesC& aTestId: in: TestId for testcase
+     
+     Return Values: CTCTestCase*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTestCase* CTestCombiner::GetTest( TDesC& aTestId )
+    {
+    __TRACEFUNC();
+    // TestId is not mandatory, so length may be zero
+    if( aTestId.Length() == 0 )
+        {
+        return NULL;
+        }
+
+    TInt count = iTestCases.Count();
+    for( TInt i=0; i < count; i++ )
+        {
+        if( iTestCases[i]->TestId() == aTestId )
+            {
+            // Found testcase with specified TestId
+            return iTestCases[i];
+            }
+        }
+    // Test case with aTestId not found
+    return NULL;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetRunningTest
+
+     Description: Get running test case.
+
+     Parameters: TDesC& aTestId: in: TestId for testcase
+     
+     Return Values: CTCTestCase*: running testcase
+                    NULL: Testcase with aTestId not running 
+
+     Errors/Exceptions: None
+
+     Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCase* CTestCombiner::GetRunningTest( TDesC& aTestId )
+    {
+    __TRACEFUNC();
+     
+    CTestCase* test = GetTest( aTestId );
+    if( test ) 
+        {
+        if( test->State() == CTestCase::ETestCaseRunning )
+            {
+            return test;
+            }
+        else
+            {
+             __TRACE( KMessage, (_L("GetTest: Searched task (%S) not running (%i)"), 
+                &aTestId, test->State() ));
+            }
+        }
+
+    return NULL;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetLocalTest
+
+     Description: Get local test case from testcase array.
+
+     Parameters:    TDesC& aTestId: in: TestId for testcase
+     
+     Return Values: CTCTestCase*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned 
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CTCTestCase* CTestCombiner::GetLocalTest( TDesC& aTestId )
+    {
+    __TRACEFUNC();
+    CTestCase* testCase = GetTest( aTestId );
+    if( testCase )
+        {    
+        if( testCase->Type() != CTestCase::ECaseLocal )
+            {
+            __TRACE( KMessage, (_L("GetLocalTest: Searched task (%S) not local"), 
+                      &aTestId ));
+            return NULL;
+            }
+        }
+    return ( CTCTestCase* ) testCase;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetLocalRunningTest
+
+     Description:  Get local running test case.
+
+     Parameters:    TDesC& aTestId: in: TestId for testcase
+     
+     Return Values: CTCTestCase*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned 
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CTCTestCase* CTestCombiner::GetLocalRunningTest( TDesC& aTestId )
+    {
+    __TRACEFUNC();
+    CTestCase* testCase = GetRunningTest( aTestId );
+    if( testCase )
+        {    
+        if( testCase->Type() != CTestCase::ECaseLocal )
+            {
+            __TRACE( KMessage, (_L("GetLocalRunningTest: Searched task (%S) not local"), 
+                      &aTestId ));
+            return NULL;
+            }
+        }
+        
+    return ( CTCTestCase* ) testCase;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetRemoteTest
+
+     Description: Get local test case from testcase array.
+
+     Parameters:    TDesC& aTestId: in: TestId for testcase
+     
+     Return Values: CTCTestCase*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned 
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteTestCase* CTestCombiner::GetRemoteTest( TDesC& aTestId )
+    {
+    __TRACEFUNC();
+    CTestCase* testCase = GetTest( aTestId );
+    if( testCase )
+        {    
+        if( testCase->Type() != CTestCase::ECaseRemote )
+            {
+            __TRACE( KMessage, (_L("GetRemoteTest: Searched task (%S) not remote"), 
+                      &aTestId ));
+            return NULL;
+            }
+        }
+        
+    return ( CRemoteTestCase* ) testCase;
+    
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetRemoteTest
+
+     Description: Get remote test case from slave array.
+
+     Parameters:    TUint32 aSlaveId: in: Slave id for testcase
+     
+     Return Values: TCaseInfo*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned 
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteTestCase* CTestCombiner::GetRemoteTest( TUint32 aSlaveId )
+    {
+    
+    __TRACEFUNC();
+    
+    // Check all remote testcases
+    TInt caseCount = iTestCases.Count(); 
+    CRemoteTestCase* testCase = NULL;
+    for( TInt caseInd = 0; caseInd < caseCount; caseInd++ )
+        {
+        if( iTestCases[caseInd]->Type() == CTestCase::ECaseRemote )
+            {
+            testCase = ( CRemoteTestCase* )iTestCases[caseInd];
+            if( testCase->iSlaveId == aSlaveId )
+                {
+                return testCase;
+                }
+            }
+        }
+    
+    return NULL;
+        
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetRemoteTestRunSent
+
+     Description: Get remote test case from slave array
+
+     Parameters:    TUint32 aSlaveId: in: Slave id for testcase
+
+     Return Values: TCaseInfo*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned 
+
+     Errors/Exceptions: None
+
+     Status: Draft @js
+    
+-------------------------------------------------------------------------------
+*/
+    
+CRemoteTestCase* CTestCombiner::GetRemoteTestRunSent( TUint32 aSlaveId )
+    {
+    
+    __TRACEFUNC();
+    
+    // Check all remote testcases
+    TInt caseCount = iTestCases.Count(); 
+    CRemoteTestCase* testCase = NULL;
+    for( TInt caseInd = 0; caseInd < caseCount; caseInd++ )
+        {
+        if( iTestCases[caseInd]->Type() == CTestCase::ECaseRemote )
+            {
+            testCase = ( CRemoteTestCase* )iTestCases[caseInd];
+            
+            if( testCase->iRemoteState != CRemoteTestCase::ECaseRunSent )
+                {
+                continue;
+                }
+            if( testCase->iSlaveId == aSlaveId )
+                {
+                return testCase;
+                }
+            }
+        }
+    
+    return NULL;
+        
+    }       
+  
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetRemoteTest
+
+     Description: Get remote test case from slave array.
+
+     Parameters:    TUint32 aSlaveId: in: Slave id for testcase
+     
+     Return Values: TCaseInfo*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned 
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteTestCase* CTestCombiner::GetRunningRemoteTest( TUint32 aSlaveId )
+    {
+    
+    __TRACEFUNC();
+    
+    // Check all remote testcases
+    TInt caseCount = iTestCases.Count(); 
+    CRemoteTestCase* testCase = NULL;
+    for( TInt caseInd = 0; caseInd < caseCount; caseInd++ )
+        {
+        if( ( iTestCases[caseInd]->Type() == CTestCase::ECaseRemote ) &&
+            ( iTestCases[caseInd]->State() == CTestCase::ETestCaseRunning ) )
+            {
+            testCase = ( CRemoteTestCase* )iTestCases[caseInd];
+            
+            if( ( testCase->iRemoteState != CRemoteTestCase::ECaseRunSent ) &&
+                ( testCase->iRemoteState != CRemoteTestCase::ECaseRunning ) && 
+                ( testCase->iRemoteState != CRemoteTestCase::ECaseCancelled ))
+                {
+                //User::Leave( KErrGeneral ); 
+                continue;                       
+                }
+                
+            if( testCase->iSlaveId == aSlaveId )
+                {
+                return testCase;
+                }
+            }
+        }
+    
+    return NULL;
+        
+    }   
+
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetRemoteTestSlave
+
+     Description: Get remote test case running on slave
+
+     Parameters:    TUint32 aSlaveDevId: in: Slave id for testcase
+     
+     Return Values: CRemoteTestCase*: running/runned testcase
+                    NULL: Testcase with aTestId not running/runned 
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteTestCase* CTestCombiner::GetRemoteRunningTestOnSlave( 
+                                                    TUint32 aSlaveDevId )
+    {
+    
+    __TRACEFUNC();
+    
+    // Check all remote testcases
+    TInt caseCount = iTestCases.Count(); 
+    CRemoteTestCase* testCase = NULL;
+    for( TInt caseInd = 0; caseInd < caseCount; caseInd++ )
+        {
+        if( ( iTestCases[caseInd]->Type() == CTestCase::ECaseRemote ) &&
+            ( iTestCases[caseInd]->State() == CTestCase::ETestCaseRunning ) )
+            {
+            testCase = ( CRemoteTestCase* )iTestCases[caseInd];
+            if( DEVID( testCase->iSlaveId ) == DEVID( aSlaveDevId ) )
+                {
+                return testCase;
+                }
+            }
+        }
+    
+    return NULL;
+        
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetRemoteTestSlave
+
+     Description: Gets a correct CRemoteSendReceive object on slave with
+                  aSlaveId.
+
+     Parameters:    TUint32 aSlaveId: in: Slave id CRemoteSendReceive object
+     
+     Return Values: CRemoteSendReceive*: Current CRemoteSendReceive object.
+                    NULL: CRemoteSendReceive object do not exist or found.
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteSendReceive* CTestCombiner::GetRemoteSendReceive( TUint32 aSlaveId )
+    {
+    __TRACEFUNC();
+    
+    for( TInt sr = 0; sr < iSendReceive.Count(); sr++ )
+        {
+        if( iSendReceive[sr]->iSlaveId == aSlaveId )
+            {
+            return iSendReceive[sr];
+            }
+        }
+
+    return NULL;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetSlave
+
+     Description: Get remote slave.
+
+     Parameters:    TUint32 aSlaveId: in: Slave id 
+     
+     Return Values: CSlaveInfo*: reserved slave
+                    NULL: slave with aSlaveId not reserved 
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CSlaveInfo* CTestCombiner::GetSlave( TUint32 aSlaveId )
+    {
+    
+    __TRACEFUNC();
+    
+    TInt count = iSlaveArray.Count();
+    for( TInt index = 0; index < count; index++ )
+        {
+        if( DEVID( iSlaveArray[index]->iSlaveDevId ) == DEVID( aSlaveId) )
+            {
+            return iSlaveArray[index];
+            }
+        }
+    
+    return NULL;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: GetSlave
+
+     Description: Get remote slave.
+
+     Parameters:    TDesC& aSlaveName: in: Slave name 
+     
+     Return Values: CSlaveInfo*: reserved slave
+                    NULL: slave with aSlaveId not reserved 
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CSlaveInfo* CTestCombiner::GetSlave( TDesC& aSlaveName )
+    {
+    
+    __TRACEFUNC();
+
+    TInt count = iSlaveArray.Count();
+    for( TInt index = 0; index < count; index++ )
+        {
+        if( iSlaveArray[index]->iName == aSlaveName )
+            {
+            return iSlaveArray[index];
+            }
+        }
+    
+    return NULL;
+    
+    }        
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: StartTestL
+
+     Description: Start specified test case from testmodule.
+
+     Parameters:    CStartInfo& aStartInfo: in: Test case information
+     
+     Return Values: KErrNone: Testcase started
+                    KErrAlreadyExists: testcase with same aTestId is already 
+                                       running
+                    Any other SymbianOS errorcode
+
+     Errors/Exceptions: Leaves if CTCTestCase::NewL leaves
+                        Leaves if arguments are illegal
+                        Leaves if GetTestModuleL leaves
+                        Leaves if CTestExecution::Open fails
+                        Leaves if CTCTestCase::StartL leaves
+                        Leaves if RPointerArray::Append fails
+
+     Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCombiner::StartTestL(  CStartInfo& aStartInfo )
+    {
+    __TRACEFUNC();
+    // Check that TestId is unique.
+    if( GetTest( aStartInfo.iTestId ) != NULL )
+        {
+        // If loop testing is ongoing, allow already defined testid.
+        if( iLoopIsUsed )
+            {
+            __TRACE( KVerbose, ( _L("StartTestL: TestId (%S) already in use. Loop allows already defined TestId"), 
+             &aStartInfo.iTestId ));
+            }
+        else
+            {
+            __TRACE( KError, ( _L("StartTestL: TestId (%S) already in use"), 
+                 &aStartInfo.iTestId ));
+            return KErrAlreadyExists;
+            }
+        }
+
+    __ASSERT_ALWAYS( aStartInfo.iModule.Length() < KMaxFileName, 
+        User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( aStartInfo.iIniFile.Length() < KMaxFileName, 
+        User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( aStartInfo.iConfig.Length() < KMaxFileName, 
+        User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( aStartInfo.iTestId.Length() < KMaxName, 
+        User::Leave( KErrArgument ) );
+
+    __TRACE( KMessage, ( _L("Call GetTestModuleL") ));
+
+    // Load Test Module
+    CTCTestModule* module = NULL;
+    if( (aStartInfo.iModule.Find( KTestScripterName ) != KErrNotFound) 
+        || (aStartInfo.iModule.Find( KPythonScripter ) != KErrNotFound)
+        || (aStartInfo.iModule.Find( KTestCombinerName ) != KErrNotFound) 
+        )
+        {
+        // TestScripter in use. Give config file for parsing STIF Settings.
+        module = GetTestModuleL( aStartInfo.iModule,
+                                 aStartInfo.iIniFile,
+                                 aStartInfo.iConfig );
+        }
+    else
+        {
+        module = GetTestModuleL( aStartInfo.iModule,
+                                 aStartInfo.iIniFile,
+                                 KNullDesC );
+        }
+
+    __TRACE( KMessage, ( _L("Create CTCTestCase") ));
+
+    CTCTestCase* tc = 
+        CTCTestCase::NewL( this, 
+                           aStartInfo.iModule, 
+                           aStartInfo.iTestId, 
+                           aStartInfo.iExpectedResult, 
+                           aStartInfo.iCategory,
+                           module ); //--PYTHON--
+
+    CleanupStack::PushL( tc );
+    
+    //If name of testcase was given, find testcase number
+    if(aStartInfo.iTitle != KNullDesC)
+        {
+        __TRACE(KMessage, (_L("Trying to find test case entitled \"%S\""), &aStartInfo.iTitle));
+        aStartInfo.iCaseNum = -1;
+        TInt ret = module->GetCaseNumByTitle(aStartInfo.iTitle, aStartInfo.iCaseNum);
+        if(ret != KErrNone)
+            {
+            __TRACE(KError, (_L("Couldn't find test case entitled \"%S\". Error %d"), &aStartInfo.iTitle, ret));
+            }
+        else
+            {
+            __TRACE(KMessage, (_L("Found test case entitled \"%S\". Case num %d"), &aStartInfo.iTitle, aStartInfo.iCaseNum));
+            }
+        }
+
+    __TRACE( KMessage, ( _L("Open TestExecution") ));
+    
+    User::LeaveIfError( tc->TestExecution().Open( module->TestServer(), 
+                                                  aStartInfo.iCaseNum, 
+                                                  aStartInfo.iConfig ) );
+
+    __TRACE( KMessage, ( _L("Start testcase runner") ));
+
+      // Enable testcase control before calling RunTestCase
+    tc->StartL();
+
+    __TRACE( KMessage, 
+        ( _L("Start: testid(%S), module(%S), ini(%S), config(%S), case(%d), expect(%d/%d), timeout(%d)"), 
+        &aStartInfo.iTestId, &aStartInfo.iModule, &aStartInfo.iIniFile, 
+        &aStartInfo.iConfig, aStartInfo.iCaseNum, aStartInfo.iExpectedResult, 
+        aStartInfo.iCategory, aStartInfo.iTimeout ));
+
+    TestModuleIf().Printf( KPrintPriLow, _L("Start"),
+        _L("testid(%S), module(%S), ini(%S), config(%S), case(%d), expect(%d)"), 
+         &aStartInfo.iTestId, &aStartInfo.iModule, &aStartInfo.iIniFile, 
+         &aStartInfo.iConfig, aStartInfo.iCaseNum, aStartInfo.iExpectedResult );
+
+    tc->TestExecution().RunTestCase( tc->iResultPckg, tc->iStatus );
+
+    iRunningTests++;
+
+    User::LeaveIfError( iTestCases.Append( tc ) );
+    if( iLoopIsUsed )
+        {
+        User::LeaveIfError( iLoopAllocationArray.Append( tc ) );
+        }
+    CleanupStack::Pop( tc );
+
+    return KErrNone;
+
+}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: Complete
+
+     Description: Handle completed test case.
+
+     Parameters:    CTCTestCase* aTestCase: in: Test case to complete
+
+     Return Values: None.
+
+     Errors/Exceptions: None
+
+     Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::Complete( CTestCase* aTestCase, TInt aError )
+    {
+    __TRACEFUNC();
+    
+    if( aError != KErrNone )
+        {
+        iResult = aError;
+        }
+
+    TInt count = iTestCases.Count();
+    TInt i = 0;
+    for(; i < count; i++ )
+        {
+        if( iTestCases[i] == aTestCase )
+            {
+            // Test Case completed
+            __TRACE( KPrint, (  _L( "Complete: %S result: %d, execution result: %d, expected: %d"), 
+                 &aTestCase->TestId(), aTestCase->iResult.iTestResult.iResult, 
+                 aTestCase->iResult.iCaseExecutionResultCode, aTestCase->ExpectedResult()  ));
+            TestModuleIf().Printf( KPrintPriLow, _L("Complete"),
+                _L( "%S results: test(%d) exe(%d) expect(%d)"), 
+                 &aTestCase->TestId(), aTestCase->iResult.iTestResult.iResult,
+                 aTestCase->iResult.iCaseExecutionResultCode, aTestCase->ExpectedResult() );
+            iRunningTests--;
+            break;
+            }
+        }
+    if( i == count )
+        {
+        __TRACE( KError, (_L("CTestCombiner::Complete: Test case not found!!")));
+        }
+
+    // Check if we were waiting this case to complete
+    if( ( iWaitTestCase.Length() > 0 ) && 
+        ( iWaitTestCase == aTestCase->TestId() ) )
+        {
+        // We were waiting this case to complete 
+        // Now we can proceed executing the testcase
+        __TRACE( KMessage, (_L("TestCase was waiting, set runner active")));
+        iTestRunner->SetRunnerActive();
+        iWaitTestCase.Zero();
+        
+     //return; - return removed due to STIF-509 CancelIfError won't work when used together with complete command
+     
+        }
+    else if( aTestCase->Type() == CTestCase::ECaseRemote )
+        {
+        __TRACE( KMessage, (_L("CTestCombiner::Complete: Remote case complete")));
+        // Completed testcase was remote case,
+        // check if slave should be freed
+        CRemoteTestCase* remote = ( CRemoteTestCase* )aTestCase;
+        if( remote->iFreeSlave )
+            {
+            CSlaveInfo* slave = GetSlave( remote->iSlaveId );
+            if( slave )
+                {
+                // Free slave now
+                TRAPD( err, iTestRunner->ExecuteFreeL( slave ) );
+                // Continue if freeing fails
+                if( err == KErrNone )
+                    {
+                    __TRACE( KMessage, (_L("Complete: Freeing slave")));
+                    return;
+                    }
+                else
+                    {
+                    __TRACE( KError, (_L("Complete: Freeing slave failed")));
+                    }
+                }
+            else 
+                {
+                __TRACE( KError, (_L("Complete: Slave not found")));
+                }
+            }
+        }
+
+    // If running test is 0, active scheduler is active and CTestRunner is
+    // ready then stop active scheduler.(Operations continue from 
+    // CTestCombiner::RunTestL() after active scheduler start).
+    if( ( iRunningTests == 0 ) &&
+          iSchedulerActive &&
+        ( iTestRunner->iState == CTestRunner::ERunnerReady ) )
+        {
+        // This was last running testcase, so we can stop 
+        // activescheduler
+        __TRACE( KMessage, (_L("All TestCases completed, stop CActiveScheduler")));
+        CActiveScheduler::Current()->Stop();
+        iSchedulerActive = EFalse;
+        }
+    else 
+        {
+        __TRACE( KMessage, 
+            (_L("CTestCombiner::Complete: %d test cases running"), iRunningTests ));
+        __TRACE( KMessage, 
+            (_L("CTestCombiner::Complete: active %d"), iSchedulerActive ));
+        if(iSchedulerActive)    
+            {             
+            __TRACE( KMessage, 
+                (_L("CTestCombiner::Complete: state %d"), iTestRunner->iState ));
+            }
+        }
+
+    // Checking if user wants to skip the rest of the execution in case of error @js
+    if(iCancelIfError && iSchedulerActive)    
+        {
+        
+    // Cancel event if it was waiting event
+       if(iTestRunner->iEvent.Name() != KNullDesC && iTestRunner->iEvent.Type() == TEventIf::EWaitEvent)
+           {
+           TestModuleIf().CancelEvent(iTestRunner->iEvent, &iTestRunner->iStatus);
+           }
+
+        // Interpret execution result type from returned result
+        TInt executionResult = TFullTestResult::ECaseExecuted; // Ok
+        if( (aTestCase->iResult.iCaseExecutionResultType >= 
+            TFullTestResult::ECaseLeave ))
+            {
+            __TRACE( KMessage, (_L("The test case ended with error!")));
+
+            // Some abnormal execution result type
+            executionResult = iTestCases[i]->iResult.iCaseExecutionResultType;
+            }
+
+         // Check expected execution result type
+        if( executionResult != aTestCase->ExpectedResultCategory() ) 
+            {
+            // expected and returned result types differ
+            __TRACE( KMessage, (_L("The test case has wrong result category!")));
+            // There was an error and we must stop test case execution
+            iFailedTestCase = i;
+            iRunningTests--;
+            __TRACE( KMessage, (_L("Stopping the CActiveScheduler.")));
+            CActiveScheduler::Current()->Stop();
+            iSchedulerActive = EFalse;
+            }
+
+        // Check normal test result if activescheduler is still up & running
+        if( iSchedulerActive )
+            {
+            if( aTestCase->ExpectedResultCategory() == 
+            TFullTestResult:: ECaseExecuted)
+                {
+                // Normal completion, check result
+                if( iTestCases[i]->iResult.iTestResult.iResult != 
+                    iTestCases[i]->ExpectedResult() )
+                    { 
+                    __TRACE( KMessage, (_L("Result category is not what was expected!")));
+                    // There was an error and we must stop test case execution
+                    iFailedTestCase = i;
+                    iRunningTests = 0; //The whole test is stopped. Reset value of running tests.
+                    //This line caused that variable value to be -1. Test could not finish. //iRunningTests--;
+                    __TRACE( KMessage, (_L("Stopping the CActiveScheduler.")));
+                    CActiveScheduler::Current()->Stop();
+                    iSchedulerActive = EFalse;
+                    }
+                }
+            else 
+                {
+                // Abnormal completion, i.e. panic, leave, exception or timeout
+                if( aTestCase->iResult.iCaseExecutionResultCode != 
+                    aTestCase->ExpectedResult())
+                    {
+                    __TRACE( KMessage, (_L("The test case has abnormal completion!")));
+                    // There was an error and we must stop test case execution
+                    iFailedTestCase = i;
+                    iRunningTests--;
+                    __TRACE( KMessage, (_L("Stopping the CActiveScheduler.")));
+                    CActiveScheduler::Current()->Stop();
+                    iSchedulerActive = EFalse;
+                    }
+                }
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: NotifyEvent
+
+     Description: Asynchronous event command interface
+     
+     Check requested events and send unset to first requested
+     
+     Parameters: TEventIf& aEvent: in: Event command 
+                TRequestStatus& aStatus: in: TRequestStatus used in 
+                                                          asynchronous command 
+     
+     Return Values: ETrue: asynchronous command given
+                          EFalse: asyncronous command not given
+
+     Errors/Exceptions: None
+     
+     Status: Proposal
+     
+-------------------------------------------------------------------------------
+*/
+TBool CTestCombiner::UnsetEvent( TEventIf& aEvent, 
+                                 TRequestStatus& aStatus )
+    {
+    
+    __TRACE( KMessage, ( _L("CTestCombiner::NotifyEvent")));    
+    
+    // First check TestCombiner events
+    TInt eventCount = iEventArray.Count();
+    for( TInt i = 0; i < eventCount; i++ )
+        {
+        if( aEvent.Name() == iEventArray[i]->Name() )
+            {
+            __TRACE( KMessage, (  
+                _L( "Set unset pending for testcombiner's %S event"),  
+                    &aEvent.Name()  ));
+            iEventArray[i]->SetRequestStatus( &aStatus );
+            return ETrue;
+            }
+        }
+    
+    // Check all local testcases
+    TInt caseCount = iTestCases.Count(); 
+    TInt eventInd;
+    CTCTestCase* testCase = NULL;
+    for( TInt caseInd = 0; caseInd < caseCount; caseInd++ )
+        {
+        if( iTestCases[caseInd]->Type() == CTestCase::ECaseLocal )
+            {
+            testCase = ( CTCTestCase* )iTestCases[caseInd];
+            eventCount = testCase->EventArray().Count();
+             
+             // Check all requested events
+            for( eventInd = 0; eventInd < eventCount; eventInd++)
+                {
+                const TName& eventName = 
+                    testCase->EventArray()[eventInd]->Event().Name();
+                if( eventName == aEvent.Name() )
+                    {
+                      // Event request is pending, send control command
+                    iEvent.Copy( aEvent );
+                    __TRACE( KMessage, (  
+                        _L( "Set unset pending for client's %S event"),  
+                        &aEvent.Name()  ));
+                    testCase->TestExecution().NotifyEvent( iEventPckg, 
+                                                             aStatus );
+                    return ETrue;
+                    }
+                }
+            }
+        }
+     
+    return EFalse;
+     
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: ReceiveResponse
+
+     Description: Handles responce received from slave
+  
+     Parameters:    None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::ReceiveResponse( TDesC& aMsg )
+    {
+    
+    __TRACEFUNC();
+    
+    TBool continueTask = ETrue;
+    TRAPD( err, continueTask = iTestRunner->ReceiveResponseL( aMsg ) );
+        
+    // We start receiver again, even in error situation
+    iRemoteReceiver->Start();
+
+    if( err != KErrNone )
+        {
+        __TRACE( KError, ( _L("CTestCombiner::ReceiveResponse ERROR")));
+        iResult = err;
+        if( iTestRunner->IsActive() )
+            {
+            iTestRunner->Cancel();
+            }
+        else
+            {
+            iTestRunner->CancelTestCases();
+            }
+        return;
+        }
+        
+    if( continueTask && !iTestRunner->IsActive() )
+        {
+        iTestRunner->SetRunnerActive();
+        }
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: RemoteTimeout
+
+     Description: Handles timeouts.
+  
+     Parameters:    None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::RemoteTimeout()
+    {
+    
+    __TRACEFUNC();
+    
+    iResult = KErrTimedOut;
+    if( iTestRunner->IsActive() )
+        {
+        __TRACE( KError, (_L("Remote timeout, Cancel runner")));
+        iTestRunner->Cancel();
+        }
+    else
+        {
+        __TRACE( KError, (_L("Remote timeout, Cancel test cases")));
+        iTestRunner->CancelTestCases();
+        }
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: ExecuteMeasurementL
+
+     Description: Executes measurement script line.
+  
+     Parameters: CStifItemParser* aItem: in: parsed line
+     
+     Return Values: TBool: in no error ETrue returned
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::ExecuteMeasurementL( CStifItemParser* aItem )
+    {
+    __TRACEFUNC();
+    
+     __TRACEFUNC();
+    TPtrC type;
+    TPtrC command;
+
+    // Get command
+    if( aItem->GetNextString( command ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'measurement' command" ) ) );
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+    // Get name
+    if( aItem->GetNextString( type ) != KErrNone )
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown argument for 'measurement' type" ) ) );
+        User::Leave( KErrArgument ); // Error in parsing => Leave
+        }
+
+    // Verify measurement type
+    if( !( type == KParamMeasurement01 ||
+                type == KParamMeasurement02 ||
+                type == KParamMeasurement03 ||
+                type == KParamMeasurement04 ||
+                type == KParamMeasurement05 ||
+                type == KParamMeasurementBappea ) )
+
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown measurement type:[%S]" ), &type ) );
+        User::Leave( KErrArgument ); // Error in types => Leave
+        }
+
+    // Verify command
+   if( command == _L( "start" ) )
+        {
+        // START measurement's process
+        __TRACE( KMessage, ( _L( "Start 'measurement' with '%S'"), &type ) );
+        StartMeasurementL( type, aItem );
+        }
+    else if( command == _L( "stop" ) )
+        {
+        // STOP measurement's process
+        __TRACE( KMessage, ( _L( "'Stop 'measurement' with '%S'"), &type ) );
+        StopMeasurementL( type );
+        }
+    else
+        {
+        __TRACE( KError, ( 
+            _L( "Unknown command for 'measurement' command:[%S] or type:[%S]" ), &command, &type ) );
+        User::Leave( KErrArgument ); // Error in commands => Leave
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: StartMeasurementL
+
+     Description: 
+  
+     Parameters: const TDesC& aType: in: Plugin type.
+                 CStifItemParser* aItem: in: Item object for parsing.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves is bappea start or timed operation fails.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::StartMeasurementL( const TDesC& aType,
+                                           CStifItemParser* aItem )
+    {
+    __TRACEFUNC();
+
+    CSTIFTestMeasurement* testMeasurement = NULL;
+
+    // Get Measurement configuration info
+    TPtrC configurationInfo( KNullDesC() );
+    if( aItem->Remainder( configurationInfo ) != KErrNone )
+        {
+        __TRACE( KInit, ( 
+            _L( "Using default path and file name for measurement configure" ) ) );
+        } 
+
+    if( aType == KParamMeasurement01 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    this, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin01,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurement02 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    this, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin02,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurement03 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    this, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin03,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurement04 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    this, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin04,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurement05 )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    this, 
+                    CSTIFTestMeasurement::KStifMeasurementPlugin05,
+                    configurationInfo );
+        }
+    else if( aType == KParamMeasurementBappea )
+        {
+        testMeasurement = CSTIFTestMeasurement::NewL( 
+                    this, 
+                    CSTIFTestMeasurement::KStifMeasurementBappeaProfiler,
+                    configurationInfo );
+        }
+    else
+        {
+        __TRACE( KError, ( _L( "Unknown plugin[%S] for 'measurement'" ), &aType ) );
+        User::Leave( KErrArgument );
+        }
+
+   // Start test measurement
+    TInt start_ret( KErrNone );
+    start_ret = testMeasurement->Start();
+    if( start_ret != KErrNone )
+        {
+        delete testMeasurement;
+        __TRACE( KError, ( 
+            _L( "CTestCombiner::StartMeasurementL(): Measurement Start() fails:[%d]" ), start_ret ) );
+        User::Leave( start_ret );
+        }
+
+    TTestMeasurement* object = new (ELeave) TTestMeasurement();
+    object->iName = aType;
+    object->iMeasurement = testMeasurement;
+
+    // Array for handling test measurement between different objects
+    TInt ret = iTestMeasurementArray.Append( object );
+    if( ret != KErrNone )
+        {
+        delete object;
+        __TRACE( KError, ( 
+            _L( "CTestCombiner::StartMeasurementL(): iTestMeasurementArray.Append fails:[%d]" ), ret ) );
+        User::Leave( ret );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: StopMeasurementL
+
+     Description: Stops test measurement.
+  
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::StopMeasurementL( const TDesC& aType )
+    {
+    __TRACEFUNC();
+
+    TInt count = iTestMeasurementArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iTestMeasurementArray[i]->iName == aType )
+            {
+            // Found measurement module, stop
+            iTestMeasurementArray[i]->iMeasurement->Stop();
+            // Delete data
+            delete iTestMeasurementArray[i];
+            // Remove pointer to deleted data(Append())
+            iTestMeasurementArray.Remove( i );
+            // iTestMeasurementArray can contain only one type of measurement
+            // so we can break when type is removed.
+            break;
+            }
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestCombiner
+
+     Method: AppendTestResultToResultDes
+
+     Description: Append to TC's result description (if possible due to length) 
+                  limitation provided text in [] brackets.
+  
+     Parameters: None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestCombiner::AppendTestResultToResultDes(TDes& aResultDescr, const TDesC& aTestCaseResultDescr)
+    {
+    if(aTestCaseResultDescr != KNullDesC)
+        {
+        _LIT(KAdditionalInfo, " [%S]");
+        TInt len = aResultDescr.Length() + KAdditionalInfo().Length() + aTestCaseResultDescr.Length();
+
+        if(len > KStifMaxResultDes)
+            {
+            len = KStifMaxResultDes - aResultDescr.Length() - KAdditionalInfo().Length();
+            if(len > 0)
+                {
+                TPtrC descr = aTestCaseResultDescr.Mid(0, len); 
+                aResultDescr.AppendFormat(KAdditionalInfo, &descr);
+                }
+            }
+        else
+            {
+            aResultDescr.AppendFormat(KAdditionalInfo, &aTestCaseResultDescr);
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCombiner
+
+    Method: GetIndexForNewTestModuleController
+
+    Description: Returns new index for test module controller.
+                 This number is appended to module controller name.
+                 This method is used when option to run every test case in 
+                 separate process is set to on.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCombiner::GetIndexForNewTestModuleController(void)
+    {
+    return iIndexTestModuleControllers++;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CTestRunner class 
+    member functions. CTestRunner is used to execute TestCombiner testcase by 
+    CTestCombiner.
+
+-------------------------------------------------------------------------------
+*/
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iTestCombiner->iLog
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: CTestRunner
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to CTestCombiner
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTestRunner::CTestRunner( CTestCombiner* aTestCombiner ): 
+    CActive(  CActive::EPriorityLow ), // Executed with lowest priority 
+    iState( ERunnerIdle ),
+    iTestCombiner( aTestCombiner )
+    {
+    CActiveScheduler::Add( this );
+    __TRACEFUNC();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ConstructL()
+    {
+    TInt ret;
+    
+    ret = iPauseTimer.CreateLocal();
+    if(ret != KErrNone)
+        {
+        __TRACE( KError, (_L("Unable to create RTimer: iPauseTimer [%d] "), ret));
+        User::Leave(ret);
+        }
+        
+    ret = iPauseCombTimer.CreateLocal();
+    if(ret != KErrNone)
+        {
+        __TRACE( KError, (_L("Unable to create RTimer: iPauseCombTimer [%d] "), ret));
+        User::Leave(ret);
+        }
+    
+    iRemoteTimer = CRemoteTimer::NewL( iTestCombiner );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to CTestCombiner
+
+     Return Values: CTestRunner*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+
+CTestRunner* CTestRunner::NewL( CTestCombiner* aTestCombiner )
+    {
+    CTestRunner* self = new (ELeave) CTestRunner( aTestCombiner );
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ~CTestRunner
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/     
+
+CTestRunner::~CTestRunner()
+    {
+    __TRACEFUNC();
+    Cancel();
+    
+    delete iRemoteTimer;
+    iRemoteTimer = 0;
+    
+    delete iLine;
+    iLine = 0;
+    
+    iPauseTimer.Close();
+    
+    iPauseCombTimer.Close();
+         
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: RunL
+
+     Description: Derived from CActive, handles testcase execution.
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::RunL()
+    {
+    __TRACEFUNC();
+    __TRACE( KMessage, (_L("CTestRunner::RunL: [%d] "), iStatus.Int() ));
+     
+    User::LeaveIfError( iStatus.Int() );
+
+    if( ( iTestCombiner == NULL ) || 
+        ( iTestCombiner->iSectionParser == NULL ) )
+        {
+        User::Leave( KErrGeneral );
+        }
+        
+    TBool continueTask = EFalse;
+    
+    // Check if there is still some time for combiner pause and we need to 
+    // continue pausing
+    if(iPauseCombRemainingTime > 0)
+        {           
+        // Maximum time for one RTimer::After request                   
+        TInt maximumTime = KMaxTInt / 1000;                       
+        
+        __TRACE( KMessage, (_L("CTestRunner::RunL: Going to reissue PauseCombiner request ") ) );           
+        __TRACE( KMessage, (_L("CTestRunner::RunL: iRemainingTimeValue = %d"), iPauseCombRemainingTime ) );        
+        
+        if( iPauseCombRemainingTime < maximumTime )
+            {                           
+            iPauseCombTimer.After(iStatus, (iPauseCombRemainingTime * 1000));
+            iPauseCombRemainingTime = 0;
+            }
+        else
+            {            
+            iPauseCombRemainingTime -= maximumTime;
+            iPauseCombTimer.After(iStatus, (maximumTime * 1000));        
+            }     
+            
+        SetActive();
+        return;
+        }     
+ 
+    // Handling runner states
+    switch( iState )
+        {
+        case ERunnerWaitTimeout:
+            {
+            __TRACE( KMessage, (_L("Resume %S"), &iPausedTestCase));
+            iTestCombiner->TestModuleIf().Printf( KPrintPriExec, 
+                KExecute, _L("Resume %S"), &iPausedTestCase);
+             // Get running testcase identified with testid
+            CTestCase* testCase = iTestCombiner->GetRunningTest( iPausedTestCase ); 
+            if( testCase == NULL ) User::Leave( KErrNotFound );
+            iPausedTestCase.Zero();
+            if( testCase->Type() == CTestCase::ECaseLocal )
+                {
+                CTCTestCase* localTestCase = ( CTCTestCase* )testCase;
+                // Resume execution
+                User::LeaveIfError( localTestCase->TestExecution().Resume() );
+                continueTask = ETrue;
+                }
+            else // ECaseRemote
+                {
+                CRemoteTestCase* remoteTestCase = ( CRemoteTestCase* )testCase;
+                // Resume execution
+                if( ExecuteRemoteTestCtlL( NULL, 
+                                           remoteTestCase, 
+                                           TTCKeywords::EResume ) )
+                    {
+                    continueTask = ETrue;
+                    }
+                }               
+            }
+            break;
+        case ERunnerWaitUnset:
+            iState = ERunnerIdle;
+
+            // Check Unset event 
+            if( !CheckUnsetEvent() )
+                {
+                // Got event and unset has not completed 
+                // Should never come here
+                User::Panic( KTestRunner, KErrGeneral );
+                 }
+            break;
+                         
+        case ERunnerRunning:
+            {
+            iState = ERunnerIdle;
+            
+            // Get next execution line from configuration section
+            iEndLoopStartPos = iTestCombiner->iSectionParser->GetPosition();
+            TPtrC line;
+            if( iTestCombiner->iSectionParser->GetNextLine( line ) == KErrNone )
+                {
+                // Got new execution line 
+                __TRACE( KMessage, (_L("CTestRunner got line")));
+        
+                CStifItemParser* item = PreprocessLineL( line );
+            
+                if( item )
+                    {     
+                     // Got new execution line 
+                    CleanupStack::PushL( item ); 
+                      
+                    // Execute script line 
+                    if( ExecuteLineL( item ) )
+                        {
+                          __TRACE( KMessage, (_L("RunL: continueTask")));
+                         // Set CTestRunner active again to perform 
+                         // next execution line
+                         // from testcase section 
+                        continueTask = ETrue;
+                        }
+                    CleanupStack::PopAndDestroy( item );
+                    }
+                }
+            else 
+                {
+                // No more execution lines in testcase section
+                __TRACE( KMessage, 
+                    (_L("CTestRunner::RunL: Testcase script done (%d running)"), 
+                        iTestCombiner->iRunningTests));
+ 
+                if( ( iTestCombiner->iRunningTests == 0 ) &&
+                    iTestCombiner->iSchedulerActive )
+                    {
+                    __TRACE( KMessage, 
+                        (_L("RunL: All TestCases done, stop CActiveScheduler")));                     
+                    CActiveScheduler::Current()->Stop();
+                    iTestCombiner->iSchedulerActive = EFalse;
+                    }
+                // Now testcase section is executed, 
+                // so CTestRunner has done its job and stops
+                iState = ERunnerReady;
+
+                //If we're inside loop, then we have error
+                if(iTestCombiner->iLoopIsUsed)
+                    {
+                    __TRACE(KError, (_L("Endloop keyword not found. Cannot finish test case properly.")));
+                    iTestCombiner->iResult = KErrGeneral;
+                    }
+                }
+            }
+            break;
+        case ERunnerAllocate:
+        case ERunnerFree:
+        case ERunnerRemote:
+        default:
+            __TRACE( KError, 
+                (_L("CTestRunner::RunL: Entered in illegal state(%d)"), iState ));
+            User::Panic( KTestRunner, KErrGeneral );  
+            break;
+        }   
+    if( continueTask )
+        {
+        SetRunnerActive();
+        }
+           
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: DoCancel
+
+     Description: Derived from CActive handles the Cancel
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::DoCancel()
+    {
+    __TRACEFUNC();
+    __TRACE( KMessage, (_L("CTestRunner::DoCancel")));
+    iTestCombiner->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), _L("DoCancel"));
+    
+    iPauseCombTimer.Cancel();
+    
+    switch( iState )
+        {
+        case ERunnerWaitTimeout:
+            iPauseTimer.Cancel();
+            break;
+        case ERunnerWaitUnset:
+            break;             
+        case ERunnerRunning:
+            break;
+        case ERunnerAllocate:
+        case ERunnerFree:
+        case ERunnerRemote:
+            // Cancel remote test cases
+            break;
+        default:
+            __TRACE( KError, 
+                (_L("CTestRunner::DoCancel: Entered in illegal state(%d)"), iState ));
+            User::Panic( KTestRunner, KErrGeneral );  
+            break;
+        }                  
+    
+    // Cancel all testcases
+    CancelTestCases();
+         
+    iState = ERunnerCancel;
+      
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: RunError
+
+     Description: Derived from CActive handles errors from active handler.
+  
+     Parameters:    TInt aError: in: error from CActive
+     
+     Return Values: KErrNone: success
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestRunner::RunError( TInt aError )
+    {
+    __TRACEFUNC();
+    __TRACE( KMessage, (_L("CTestRunner::RunError %d"), aError));
+        
+    if ( iRunErrorMessage.Length() != 0 )
+    	{
+    	iTestCombiner->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+	            _L("RunError : %S"), &iRunErrorMessage );  
+	    iRunErrorMessage = KNullDesC;
+    	}
+    else
+    	{
+    	iTestCombiner->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), 
+	            _L("RunError"));        	
+    	}    
+    
+    iState = ERunnerError;
+        
+    // Return error from here
+    iTestCombiner->iResult = aError;
+
+    CancelTestCases();
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: PreprocessLineL
+
+     Description: Preprocesses script line
+  
+     Parameters:  TPtrC& line: in: script line
+                  CStifItemParser*& aItem: out: New CStifItemParser for script
+                  line.
+                    
+     Return Values: HBufC* pointer if new memory that has been allocated
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/        
+CStifItemParser* CTestRunner::PreprocessLineL( TDesC& line )
+    {
+    
+    CStifItemParser* item = NULL;
+    TPtrC tmp;
+    TInt len = 0;
+        
+    // Decide how long buffer should be allocated
+    if( line.Length() < KMaxName/2 )
+        {
+        len = KMaxName;
+        }
+    else 
+        {
+        len = line.Length() + KMaxName;
+        }
+    delete iLine;
+    iLine = 0;
+    iLine = HBufC::NewL( len );
+    TPtr parsedLine( iLine->Des() );
+    len = 0;
+    
+    item = CStifItemParser::NewL( line, 0, line.Length() );
+    CleanupStack::PushL( item);
+    
+    TInt ret = item->GetString( _L(""), tmp );
+    while( ret == KErrNone )
+        {
+        len += CheckDefined( tmp );
+        if( ( parsedLine.Length() + tmp.Length() + 1 ) > parsedLine.MaxLength() )
+            {
+            // Allocate bigger buffer
+            HBufC* tmpBuf = HBufC::NewL( parsedLine.MaxLength() + KMaxName );
+            CleanupStack::PushL( tmpBuf );
+            TPtrC ptr( iLine->Des() );
+            parsedLine.Set( tmpBuf->Des() );
+            parsedLine.Copy( ptr );
+            delete iLine;
+            iLine = tmpBuf;
+            CleanupStack::Pop( tmpBuf );
+            } 
+        parsedLine.Append( tmp );        
+        parsedLine.Append( _L(" ") );        
+        ret = item->GetNextString( tmp );
+        }
+        
+    CleanupStack::PopAndDestroy( item );
+    
+    item = CStifItemParser::NewL( parsedLine, 0, parsedLine.Length() );
+    
+    return item;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: CheckDefined
+
+     Description: Check if aWord is some defined word
+  
+     Parameters:  TPtrC& aWord: inout: Parsed word, defined or original returned
+
+     Return Values: TInt: Length difference between new and old word
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestRunner::CheckDefined( TPtrC& aWord )
+    {
+    TInt len = 0;
+
+    // KLoopCounter word changing to current loop count value.
+    if( aWord == KLoopCounter )
+        {
+        iLoopCounterDes.Zero();
+        iLoopCounterDes.AppendNum( iLoopCounter );
+        len = iLoopCounterDes.Length() - aWord.Length();
+        aWord.Set( iLoopCounterDes );
+        return len;
+        }
+
+    TInt count = iTestCombiner->iDefined.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iTestCombiner->iDefined[i]->Name() == aWord )
+            { 
+            len = iTestCombiner->iDefined[i]->Value().Length() - aWord.Length();
+            aWord.Set( iTestCombiner->iDefined[i]->Value() );
+            break;
+            }
+        }
+    return len;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteLineL
+
+     Description: Executes script line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    TTCKeywords::TKeywords aKeyword: in: keyword index
+
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteLineL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgUnknownKeyword, "Unknown or illegal keyword %S" );
+    _LIT( KErrMsgMeasurementInvalidArgument, "Measurement : Invalid argument" );
+    TBool continueTask = ETrue;
+    TPtrC tmp;
+
+    TPtrC keywordItem;
+    // Get first word from line, i.e. keyword
+    User::LeaveIfError( aItem->GetString( _L(""), keywordItem ) );
+    // Parse keyword
+    TInt keyword = TTCKeywords::Parse( keywordItem, TTCKeywords::Keyword );
+        
+    switch( keyword )
+        {
+        // Test case execution control cases
+        case TTCKeywords::EPauseCombiner:
+        	continueTask = ExecuteCombinerPauseL( aItem );
+        	break;
+        case TTCKeywords::ERun:
+            continueTask = ExecuteRunL( aItem );
+            break;
+        case TTCKeywords::EPause:
+        case TTCKeywords::EComplete:
+        case TTCKeywords::ECancel:
+        case TTCKeywords::EResume:
+            continueTask = ExecuteTestCtlL( aItem, (TTCKeywords::TKeywords)keyword );
+            break;
+
+        // Event control cases
+        case TTCKeywords::ESet:
+              continueTask = ExecuteEventSetL( aItem );
+            break;
+        case TTCKeywords::EUnset:
+              continueTask = ExecuteEventUnsetL( aItem );
+            break;
+        case TTCKeywords::ERequest:
+        case TTCKeywords::EWait:
+        case TTCKeywords::ERelease:
+            continueTask = ExecuteEventCtlL( aItem, (TTCKeywords::TKeywords)keyword );
+            break;
+        case TTCKeywords::EPrint:
+            {
+            TName buf;
+            while( aItem->GetNextString( tmp ) == KErrNone )
+                {
+                if( buf.Length() + tmp.Length() >= buf.MaxLength() )
+                    {
+                    break;
+                    }
+                buf.Append( tmp );
+                buf.Append( _L(" ") );
+                }
+
+            __TRACE( KMessage, (_L("Test: %S"), &buf ));
+            iTestCombiner->TestModuleIf().Printf( KPrintPriHigh, 
+                _L("Test"), 
+                _L("%S"), &buf);
+           }
+           break;
+        case TTCKeywords::EAllocate:
+            continueTask = ExecuteAllocateL( aItem );
+            break;
+        case TTCKeywords::EFree:
+            continueTask = ExecuteFreeL( aItem );
+            break;
+        case TTCKeywords::ERemote:
+            continueTask = ExecuteRemoteL( aItem );
+            break;
+        case TTCKeywords::ETimeout:
+        case TTCKeywords::EPriority:
+            // not used here
+            break;
+        case TTCKeywords::ECancelIfError:
+            // @js
+            iTestCombiner->iCancelIfError = ETrue;
+            break;
+        case TTCKeywords::EMeasurement:
+            TRAPD( retErr, iTestCombiner->ExecuteMeasurementL( aItem ) );
+        	if ( retErr == KErrArgument )
+        		{
+        		iRunErrorMessage = KErrMsgMeasurementInvalidArgument;
+        		}
+        	if ( retErr != KErrNone )
+        		{
+        		User::Leave( retErr );
+        		}
+            break;
+        case TTCKeywords::ELoop:
+            ExecuteLoopL( aItem );
+            iTestCombiner->iLoopIsUsed = ETrue;
+            break;
+        case TTCKeywords::EEndLoop:
+            continueTask = ExecuteEndLoopL();
+            break;
+        case TTCKeywords::ETitle:
+            // title has been handled already, this is duplicate
+        default:
+            {
+              __TRACE( KError, (_L("Unknown or illegal keyword") ) );
+            // Unknown or illegal keyword
+            iRunErrorMessage.Format( KErrMsgUnknownKeyword, &keywordItem );
+            User::Leave( KErrGeneral );
+            }
+            break;
+        }
+
+    __TRACE( KMessage, (_L("RunL: TestCase line executed")));
+
+    return continueTask;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteRunL
+
+     Description: Executes run line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteRunL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgCaseRunError, "Run : %S[case=%d] run error" );
+    __TRACE( KMessage, (_L("Run")));
+    iTestCombiner->TestModuleIf().Printf( KPrintPriExec, KExecute, _L("Run"));
+    
+    CStartInfo* startInfo = CStartInfo::NewL();
+    CleanupStack::PushL( startInfo );
+
+    ParseRunParamsL( aItem, *startInfo );
+             
+    // Start new case with configurations parsed above                
+    
+    iRunErrorMessage.Format( KErrMsgCaseRunError, &startInfo->iModule, startInfo->iCaseNum );
+    User::LeaveIfError( 
+        iTestCombiner->StartTestL( *startInfo ) );
+    iRunErrorMessage = KNullDesC;
+    
+    CleanupStack::PopAndDestroy( startInfo );
+        
+    return ETrue;
+    
+}
+
+ 
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ParseRunParamsL
+
+     Description: Parses run parameters
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CStartInfo& aStartInfo: out: Parsed information
+     
+     Return Values: None
+     
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ParseRunParamsL( CStifItemParser* aItem,
+                                    CStartInfo& aStartInfo )
+    {
+    _LIT( KErrMsgRunTestmoduleNameNotDefined, "Run : Testmodule name is not defined " );
+    _LIT( KErrMsgRunCfgFileNotDefined, "Run : Testmodule configuration file is not defined" );
+    _LIT( KErrMsgRunTestcaseNumberNotDefined, "Run : Testcase number is not defined or has invalid value" );
+    _LIT( KErrMsgRunCfgFileNameToLong, "Run : TestScripter test case file(config)'s name is too long. Current length[%d], allowed max length[%d]. Cannot continue" );
+    _LIT( KErrMsgRunInvalidExpectValue, "Run : Invalid expected result value" );
+    _LIT( KErrMsgRunUnknownOrIllegalCategory, "Run : Unknown or illegal result category" );
+    _LIT( KErrMsgRunInvalidTimeoutValue, "Run: Invalid testcase timeout value" );
+    _LIT( KErrMsgRunUnknowOrIllegalKeyword, "Run: Unknown or illegal keyword %S" );
+    
+    TPtrC tmp;
+    TInt ret = KErrNone;
+
+    // Get mandatory run arguments
+    // Testmodule name
+    ret = aItem->GetNextString( tmp );
+    if ( ret != KErrNone )
+    	{
+    	iRunErrorMessage = KErrMsgRunTestmoduleNameNotDefined;
+    	User::Leave( ret );
+    	}
+    
+    aStartInfo.SetModuleNameL( tmp );
+    __TRACE( KMessage, (_L("module: %S"), &aStartInfo.iModule ));
+    
+    // Configuration file
+    ret = aItem->GetNextString( tmp );
+    if ( ret != KErrNone )
+    	{
+    	iRunErrorMessage = KErrMsgRunCfgFileNotDefined;
+    	User::Leave( ret );
+    	}
+    
+    TFileName cfgFileName( tmp );
+    TStifUtil::CorrectFilePathL( cfgFileName );    
+    aStartInfo.SetConfigL( cfgFileName );
+    
+    __TRACE( KMessage, (_L("config: %S"), &aStartInfo.iConfig ));
+
+    // Check is TestScripter
+    if( aStartInfo.iModule.Find( KTestScripterName ) != KErrNotFound )
+        {
+        // TestScripter name is format: 'testscripter_testcasefilename'
+
+        TParse parse;
+        parse.Set( aStartInfo.iConfig, NULL, NULL );
+
+        // Maximum length of TestScripter's name(Max limitation from
+        // CTestModuleController creation)
+        TInt maximumLength = KMaxName - ( KTestScripterNameLength + 1 );
+
+        TFileName testScripterAndTestCaseFile; // InitL() takes TFileName
+        testScripterAndTestCaseFile.Copy( KTestScripterName );
+        testScripterAndTestCaseFile.Append( _L( "_" ) );
+        if( parse.Name().Length() < maximumLength )
+            {
+            testScripterAndTestCaseFile.Append( parse.Name() );
+            }
+        else
+            {
+            __TRACE( KInit, ( CStifLogger::ERed,
+                _L( "TestScripter test case file(config)'s name is too long. Current length[%d], allowed max length[%d]. Cannot continue" ),
+                parse.Name().Length(), maximumLength ) );
+            iRunErrorMessage.Format( KErrMsgRunCfgFileNameToLong, parse.Name().Length(), maximumLength );
+            User::Leave( KErrArgument );
+            }
+// ----
+        aStartInfo.DeleteModuleName(); // Delete old name buffer for new one
+        aStartInfo.SetModuleNameL( testScripterAndTestCaseFile );
+        }
+
+    // Testcase number
+    ret = aItem->GetInt( tmp, aStartInfo.iCaseNum );
+    if ( ret != KErrNone )
+    	{
+    	iRunErrorMessage = KErrMsgRunTestcaseNumberNotDefined;
+    	User::Leave( ret );
+    	}
+    
+    __TRACE( KMessage, (_L("testcasenum: %d"), aStartInfo.iCaseNum ) );
+     
+    // Set mode of item parser to be able to read titles with spaces inside
+    aItem->SetParsingType(CStifItemParser::EQuoteStyleParsing);
+
+    // Get optional run arguments
+    while( aItem->GetNextString( tmp ) == KErrNone )
+        {
+        TPtrC val;   
+        TPtrC arg;
+        ParseOptArgL( tmp, arg, val );
+        CheckDefined( val );
+              
+        // Parse optional argument
+        switch( TTCKeywords::Parse( arg, TTCKeywords::RunOptArg ) )
+            {
+            case TTCKeywords::EExpect:
+                {
+                TLex ptr( val );
+                ret = ptr.Val( aStartInfo.iExpectedResult );
+                if ( ret != KErrNone )
+                	{
+                	iRunErrorMessage = KErrMsgRunInvalidExpectValue;
+                    User::Leave( ret );
+                	}
+                __TRACE( KMessage, (_L("expect=%d"), aStartInfo.iExpectedResult));
+                }
+                break;
+            case TTCKeywords::ETestid:
+				{
+                aStartInfo.SetTestIdL( val );
+                __TRACE( KMessage, (_L("TestId=%S"), &val));
+				}
+                break;
+            case TTCKeywords::EIni:
+				{
+                __TRACE( KMessage, (_L("ini=%S"), &val));
+	        	TFileName iniFileName( val );
+	        	TStifUtil::CorrectFilePathL( iniFileName );
+	            aStartInfo.SetIniFileL( iniFileName );
+				}
+                break;
+            case TTCKeywords::ECategory:
+				{
+                __TRACE( KMessage, (_L("category=%S"), &val));
+                aStartInfo.iCategory = TTCKeywords::GetResultCategory( val );
+                if( aStartInfo.iCategory == TFullTestResult::ECaseOngoing )
+                    {
+                    __TRACE( KError, (_L("Unknown or illegal result category")));
+                    //Unknown or illegal category
+                    iRunErrorMessage = KErrMsgRunUnknownOrIllegalCategory;
+                    User::Leave( KErrGeneral );
+                    }
+				}
+                break;
+            case TTCKeywords::ECaseTimeout:
+                {
+                TLex ptr( val );
+                ret = ptr.Val( aStartInfo.iTimeout );
+                if ( ret != KErrNone )
+                	{
+                	iRunErrorMessage = KErrMsgRunInvalidTimeoutValue;
+                    User::Leave( ret );
+                	}
+                __TRACE( KMessage, (_L("timeout=%d"), aStartInfo.iTimeout ) );
+                }
+                break;
+           	case TTCKeywords::ECaseTitle:
+           	    {
+                __TRACE( KMessage, (_L("case title=%S"), &val));
+                aStartInfo.SetTitleL(val);
+                break;
+           	    }
+            default:
+				{
+                __TRACE( KError, (_L("Unknown or illegal keyword")));
+                //Unknown or illegal keyword
+                iRunErrorMessage.Format( KErrMsgRunUnknowOrIllegalKeyword, &arg );
+                User::Leave( KErrGeneral );
+				}
+            }
+        }             
+    } 
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteTestCtlL
+
+     Description: Executes script line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    TTCKeywords::TKeywords aKeyword: in: keyword index
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteTestCtlL( CStifItemParser* aItem, 
+                                    TTCKeywords::TKeywords aKeyword )
+    {
+    _LIT( KErrMsgTestIdNotDefined, "%S : testid is not defined" );
+    _LIT( KErrMsgTestCaseNotFound, "%S : Test case %S not found" );
+    TBool continueTask = ETrue;
+    TPtrC tmp;
+    
+    TInt ret = KErrNone;
+
+	TPtrC keywordStr = TTCKeywords::Keyword( aKeyword );
+
+    // Parse testid
+    ret = aItem->GetNextString( tmp );
+    if( ret != KErrNone )
+    	{
+    	iRunErrorMessage.Format( KErrMsgTestIdNotDefined, &keywordStr );
+        User::Leave( ret );            	
+    	}
+
+    // Get testcase identified with testid
+    CTestCase* testCase = iTestCombiner->GetTest( tmp ); 
+    if( testCase == NULL )
+        {
+        __TRACE( KError, (_L("ExecuteTestCtlL: Test case %S not found"), 
+            &tmp));
+        iRunErrorMessage.Format( KErrMsgTestCaseNotFound, &keywordStr, &tmp );
+        User::Leave( KErrNotFound );
+        }  
+                              
+    switch( aKeyword )
+        {
+        // Test case execution control cases
+        case TTCKeywords::EPause:
+            continueTask = ExecutePauseL( aItem, testCase );
+            break;
+        case TTCKeywords::EComplete:
+            continueTask = ExecuteCompleteL( aItem, testCase );
+            break;
+        case TTCKeywords::ECancel:
+            __TRACE( KMessage, (_L("Cancel %S"), &tmp));
+            iTestCombiner->TestModuleIf().Printf( KPrintPriExec, 
+                KExecute, _L("Cancel %S"), &tmp);
+            if( testCase->Type() == CTestCase::ECaseRemote )
+                {
+                continueTask = 
+                    ExecuteRemoteTestCtlL( aItem, testCase, aKeyword ); 
+                }
+            else 
+                {
+                if( testCase->State() != CTestCase::ETestCaseRunning )
+                    {
+                    __TRACE( KMessage, (_L("Cancelled task (%S) not running (%i)"), 
+                        &tmp, testCase->State() )); 
+                    User::Leave( KErrNotFound );                   
+                    }
+                CTCTestCase* test = ( CTCTestCase* )testCase;
+                // Cancel local testcase
+                test->TestExecution().CancelAsyncRequest( ETestExecutionRunTestCase );
+                }
+            break;
+        case TTCKeywords::EResume:
+            {
+            __TRACE( KMessage, (_L("Resume %S"), &tmp));
+            iTestCombiner->TestModuleIf().Printf( KPrintPriExec, 
+                KExecute, _L("Resume %S"), &tmp);
+            if( testCase->Type() == CTestCase::ECaseRemote )
+                {
+                continueTask = 
+                    ExecuteRemoteTestCtlL( aItem, testCase, aKeyword ); 
+                }
+            else 
+                {
+                if( testCase->State() != CTestCase::ETestCaseRunning )
+                    {
+                    __TRACE( KMessage, (_L("Resumed task (%S) not running (%i)"), 
+                        &tmp, testCase->State() )); 
+                    User::Leave( KErrNotFound );                   
+                    }
+                CTCTestCase* test = ( CTCTestCase* )testCase;
+                // Resume execution
+                User::LeaveIfError( test->TestExecution().Resume() );
+                }
+            }
+            break;
+            
+        default:
+            // Should never come here
+            User::Leave( KErrGeneral );
+            break;
+        }      
+    
+    return continueTask;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteCombinerPauseL
+
+     Description: Executes causes pause in TestCombiner
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                         
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteCombinerPauseL( CStifItemParser* aItem )
+{
+	_LIT( KErrMsgPauseTimeoutNotDefined, "PauseCombiner : No timeout value given or value has invalid format" );
+	_LIT( KErrMsgPauseTimeoutNotPositive, "PauseCombiner : Timeout value can't be <0" );
+
+    TBool continueTask = EFalse;
+    TInt pauseTime;
+    TInt ret = KErrNone;
+    
+    // Parse testid
+    ret = aItem->GetNextInt( pauseTime );
+    if ( ret != KErrNone )
+    	{
+    	iRunErrorMessage = KErrMsgPauseTimeoutNotDefined;
+        User::Leave( ret );    	
+    	}
+
+    if( pauseTime < 0 )
+        {
+        __TRACE( KError, (_L("CTestRunner::ExecuteCombinerPauseL: Given pause value < 0")));
+        iRunErrorMessage = KErrMsgPauseTimeoutNotPositive;
+        User::Leave( KErrArgument );
+        }    
+    
+    
+    // Maximum time for one RTimer::After request
+    TInt maximumTime = KMaxTInt / 1000;
+
+    // Check if pause value is suitable for RTimer::After
+    if(pauseTime < maximumTime)
+        {
+        iPauseCombTimer.After(iStatus, pauseTime * 1000);
+        iPauseCombRemainingTime = 0;
+        }
+    else
+        {
+        // Given pause value after multiplication with 1000 is
+        // larger than KMaxTInt, so we need to split it and 
+        // re-request After with remaining value from RunL
+
+        iPauseCombRemainingTime = pauseTime - maximumTime;
+        iPauseCombTimer.After(iStatus, maximumTime * 1000);
+        }
+
+    SetActive();
+
+    __TRACE(KMessage, (_L("Executing pause, time=[%d]"), pauseTime));
+    
+    iState = ERunnerRunning;
+    
+    return continueTask;
+}
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecutePauseL
+
+     Description: Executes pause line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CTestCase* aTestcase: in: test case
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecutePauseL( CStifItemParser* aItem,
+                                    CTestCase* aTestcase )
+    {
+    _LIT( KErrMsgPauseUnknownKeyword, "Pause : Unknown or illegal keyword %S" );
+    _LIT( KErrMsgPauseTimeInvalidValue, "Pause : Pause time is not defined or has invalid value" );
+    _LIT( KErrMsgPauseTimeNotPositive, "Pause : Pause time can't be <0" );
+    TBool continueTask = ETrue;
+
+    // Get optional pause arguments
+    TPtrC tmp;
+    iPauseTime = 0;
+    while( aItem->GetNextString( tmp ) == KErrNone )
+        {
+        TPtrC val;   
+        TPtrC arg;
+        ParseOptArgL( tmp, arg, val );
+        CheckDefined( val );
+              
+        // Parse optional argument
+        switch( TTCKeywords::Parse( arg, TTCKeywords::PauseOptArg ) )
+            {
+            case TTCKeywords::ETime:
+                {
+                TLex ptr( val );
+                TInt ret = KErrNone;
+                ret = ptr.Val( iPauseTime );
+                if ( ret != KErrNone )
+                	{
+                	iRunErrorMessage = KErrMsgPauseTimeInvalidValue;
+                	User::Leave( ret );
+                	}                
+                if ( iPauseTime < 0 )
+                	{
+                	iRunErrorMessage = KErrMsgPauseTimeNotPositive;
+                	User::Leave( KErrArgument );                	
+                	}
+                __TRACE( KMessage, (_L("time=%d"), iPauseTime ));
+                }
+                break;
+            default:
+                __TRACE( KError, (_L("Unknown or illegal keyword")));
+                //Unknown or illegal keyword
+                iRunErrorMessage.Format( KErrMsgPauseUnknownKeyword, &arg );
+                User::Leave( KErrGeneral );
+            }
+        }             
+    
+    // Store paused testcase id if timeout was given as pause argument 
+    if( iPauseTime != 0 )
+        {
+        iPausedTestCase.Copy( aTestcase->TestId() );
+        }
+    
+    if( aTestcase->Type() == CTestCase::ECaseRemote )
+        {
+        return ExecuteRemoteTestCtlL( aItem, aTestcase, TTCKeywords::EPause );
+        }
+    if( aTestcase->State() != CTestCase::ETestCaseRunning )
+        {
+        __TRACE( KMessage, (_L("Paused task (%S) not running (%i)"), 
+            &aTestcase->TestId(), aTestcase->State() )); 
+        User::Leave( KErrNotFound );                   
+        }
+    CTCTestCase* test = ( CTCTestCase* )aTestcase;
+    
+    // Pause execution
+    User::LeaveIfError( test->TestExecution().Pause() );
+    
+    // Resume paused case if timeout was given 
+    if( iPauseTime != 0 )
+        {
+        continueTask = EFalse;
+        iState = ERunnerWaitTimeout;
+        iPauseTimer.After( iStatus, iPauseTime*1000 );
+        SetActive();         
+        }
+        
+    return continueTask;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteCompleteL
+
+     Description: Executes complete line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CTestCase* aTestcase: in: test case
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteCompleteL( CStifItemParser* /* aItem */, 
+                                     CTestCase* aTestcase )
+    {
+    TBool ret = ETrue;
+    
+    if( aTestcase->State() == CTestCase::ETestCaseCompleted )
+         {
+         // Requested testcase is completed already,
+         // proceed testcase execution
+          __TRACE( KMessage, (_L("Already completed")));
+         }
+    else if( aTestcase->State() == CTCTestCase::ETestCaseRunning )
+         {
+         // Wait testcase to complete                    
+         iTestCombiner->iWaitTestCase.Copy( aTestcase->TestId() );
+         // Stop testcase execution until testcase completed 
+         ret = EFalse;
+         iState = ERunnerWaitTestCase;
+         }
+    else
+        {
+        // This should newer happen
+        User::Leave( KErrGeneral );
+        }
+        
+    return ret;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteEventSetL
+
+     Description: Executes event set line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteEventSetL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgSetEventNameNotDefined, "Set : event name is not defined" );
+    _LIT( KErrMsgSetUnknownOrIllegalKeyword, "Set :Unknown or illegal keyword %S" );
+    _LIT( KErrMsgSetStateInvalidValue, "Set : State value is not defined or has invalid format" );
+    TPtrC tmp;
+    TPtrC eventName;
+    TInt ret = KErrNone;
+    
+    // Get event name
+    ret = aItem->GetNextString( eventName );
+    if( ret != KErrNone )
+    	{
+    	iRunErrorMessage = KErrMsgSetEventNameNotDefined;
+        User::Leave( ret );        
+    	}
+    __TRACE( KMessage, (_L("Set %S"), &eventName));
+    iTestCombiner->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+        _L("Set %S"), &eventName);
+    iEvent.SetName( eventName );
+    iEvent.SetType( TEventIf::ESetEvent );
+
+    // Get optional set arguments
+    while( aItem->GetNextString( tmp ) == KErrNone )
+        {
+        TPtrC val;   
+        TPtrC arg;
+        ParseOptArgL( tmp, arg, val );
+        CheckDefined( val );
+              
+        // Parse optional set argument
+        switch( TTCKeywords::Parse( arg, TTCKeywords::EventOptArg ) )
+            {
+            case TTCKeywords::EState:
+                {
+                TLex ptr( val );
+                TInt tmpVal = 0;
+                ret = ptr.Val( tmpVal );
+                if ( ret != KErrNone )
+                	{
+                	iRunErrorMessage = KErrMsgSetStateInvalidValue;
+                	User::Leave( ret );
+                	}
+                
+                // Only value 1 has special meaning, others are ignored
+                if( tmpVal == 1 )
+                    {
+                     __TRACE( KMessage, (_L("State event")));
+                     iEvent.SetEventType( TEventIf::EState );
+                    }
+                }
+                break;
+            default:
+                __TRACE( KError, (_L("Unknown or illegal keyword")));
+                //Unknown or illegal keyword
+                iRunErrorMessage.Format( KErrMsgSetUnknownOrIllegalKeyword, &arg );
+                User::Leave( KErrGeneral );
+            }
+        }      
+
+    // Set event
+    // New event system implementation
+    iTestCombiner->TestModuleIf().Event(iEvent);
+    
+    return ETrue;
+    
+/* OLD EVENT IMPLEMENTATION
+    iTestCombiner->TestModuleIf().Event( iEvent, iStatus );
+    iState = ERunnerRunning;
+    SetActive();
+            
+    return EFalse;
+*/
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteEventUnsetL
+
+     Description: Executes event unset line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteEventUnsetL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgUnsetEventNameNotDefined, "Unset : Event name is not defined" );
+    TPtrC eventName;
+    TInt ret = KErrNone;
+    // Get event name
+    ret = aItem->GetNextString( eventName );
+    if ( ret != KErrNone )
+    	{
+    	iRunErrorMessage = KErrMsgUnsetEventNameNotDefined;
+    	User::Leave( ret );        
+    	}
+    
+    __TRACE( KMessage, (_L("Unset %S"), &eventName));
+    iTestCombiner->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+        _L("Unset %S"), &eventName);
+    iEvent.Set( TEventIf::EUnsetEvent, eventName, TEventIf::EState );
+    
+    // Check if trying to unset an event that is requested 
+    // by testcombiner (otherwise testcombiner would deadlock)
+    TInt count = iTestCombiner->iEventArray.Count();
+    TInt ind = 0;
+    for(; ind < count; ind++ )
+        {
+        if( eventName == iTestCombiner->iEventArray[ind]->Name() )
+            {
+            User::Leave( KErrInUse );
+            }
+        }
+        
+    // New Event System implementation
+    iTestCombiner->TestModuleIf().Event(iEvent);
+    
+    return ETrue;
+
+/* OLD EVENT IMPLEMENTATION
+    // Check if some testmodule below 
+    // has event request pending
+    if( iTestCombiner->UnsetEvent( iEvent, 
+                                   iStatus ) == EFalse )
+        {
+        // If they haven't requested event,
+        // then check others above
+        iTestCombiner->TestModuleIf().Event( iEvent, iStatus );
+        iState = ERunnerRunning;
+        SetActive();
+            
+        }
+    else
+        {
+        // Some testmodule below has requested the event
+        // Wait unset to complete
+        SetActive();
+        __TRACE( KPrint, ( _L("Unset: Start" ) ) );
+        iState = ERunnerWaitUnset;
+        // Stop execution until unset has completed
+        }
+
+    return EFalse;
+*/
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteLineL
+
+     Description: Executes script line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    TTCKeywords::TKeywords aKeyword: in: keyword index
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteEventCtlL( CStifItemParser* aItem, 
+                                     TTCKeywords::TKeywords aKeyword )
+    {
+    _LIT( KErrMsgEventNameNotDefined, "%S : Event name is not defined" );
+//    _LIT( KErrMsgEequestEventAlreadyExist, "Request : Requested event %S already exists" );
+//    _LIT( KErrMsgWaitEventNotRequested, "Wait :Waited event %S is not requested" );
+//    _LIT( KErrMsgReleaseEventNotRequested, "Release : Released event %S is not requested" );
+    
+    TBool continueTask = ETrue;
+    TPtrC eventName;
+    TInt ret = KErrNone;
+    TPtrC keywordStr = TTCKeywords::Keyword( aKeyword );
+    // Get event name
+    ret = aItem->GetNextString( eventName );
+    if ( ret != KErrNone )
+    	{
+    	iRunErrorMessage.Format( KErrMsgEventNameNotDefined, &keywordStr );
+    	User::Leave( ret );
+    	}
+
+    //New event system implementation
+    switch(aKeyword)
+        {
+        case TTCKeywords::ERequest:
+            __TRACE(KMessage, (_L("Request event [%S]"), &eventName));
+            iTestCombiner->TestModuleIf().Printf(KPrintPriExec, KExecute, _L("Request event [%S]"), &eventName);
+
+            iEvent.SetName(eventName);
+            iEvent.SetType(TEventIf::EReqEvent);        
+            iTestCombiner->TestModuleIf().Event(iEvent);
+            break;
+
+        case TTCKeywords::ERelease:
+            __TRACE(KMessage, (_L("Release event [%S]"), &eventName));
+            iTestCombiner->TestModuleIf().Printf(KPrintPriExec, KExecute, _L("Release event [%S]"), &eventName);
+
+            iEvent.SetName(eventName);
+            iEvent.SetType(TEventIf::ERelEvent);        
+            iTestCombiner->TestModuleIf().Event(iEvent);
+            break;
+
+        case TTCKeywords::EWait:
+            __TRACE(KMessage, (_L("Wait for event [%S]"), &eventName));
+            iTestCombiner->TestModuleIf().Printf(KPrintPriExec, KExecute, _L("Wait for event [%S]"), &eventName);
+
+            iEvent.SetName(eventName);
+            iEvent.SetType(TEventIf::EWaitEvent);
+            iTestCombiner->TestModuleIf().Event(iEvent, iStatus);
+            iState = ERunnerRunning;
+            SetActive();
+            continueTask = EFalse;
+            break;
+
+        default:
+            __TRACE( KError, (_L("Illegal keyword") ) );
+            User::Leave( KErrGeneral );
+            break;
+        }
+
+    return continueTask;
+        
+/* OLD EVENT IMPLEMENATION    
+    TInt count = iTestCombiner->iEventArray.Count();
+    TInt ind = 0;
+    for(; ind < count; ind++ )
+        {
+        if( eventName == iTestCombiner->iEventArray[ind]->Name() )
+            {
+            break;
+            }
+        }
+                    
+    switch( aKeyword )
+        {
+        case TTCKeywords::ERequest:
+            {
+            __TRACE( KMessage, (_L("Request %S"), &eventName));
+            iTestCombiner->TestModuleIf().Printf( KPrintPriExec, 
+                KExecute, _L("Request %S"), &eventName);
+                
+            // Check that event is not already requested           
+            if( ind < count )
+                {
+                __TRACE( KError, (_L("Requested event %S already exists"), 
+                    &eventName));
+                iRunErrorMessage.Format( KErrMsgEequestEventAlreadyExist, &eventName );
+                User::Leave( KErrAlreadyExists );
+                }
+                
+            // Add event to event array
+            iEvent.SetName( eventName );
+            iEvent.SetType( TEventIf::EReqEvent );
+            TEventTc* event = new (ELeave) TEventTc( iTestCombiner->iLog );
+            CleanupStack::PushL( event );
+            event->Copy( iEvent );
+            User::LeaveIfError( iTestCombiner->iEventArray.Append( event ));
+            if( iTestCombiner->iLoopIsUsed )
+                {
+                User::LeaveIfError( iTestCombiner->iLoopAllocationArray.Append( event ) );
+                }
+            CleanupStack::Pop( event );
+            
+            // Request event
+            iTestCombiner->TestModuleIf().Event( iEvent, iStatus );
+            iState = ERunnerRunning;
+            SetActive();
+            continueTask = EFalse;
+            }
+            break;
+        case TTCKeywords::EWait:
+              {
+            __TRACE( KMessage, (_L("Wait %S"), &eventName));
+            iTestCombiner->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+                _L("Wait %S"), &eventName);
+
+            // Check that event is requested           
+            if( ind == count )
+                {
+                __TRACE( KError, (_L("Waited event %S is not requested"), 
+                    &eventName));
+                iRunErrorMessage.Format( KErrMsgWaitEventNotRequested, &eventName );
+                User::Leave( KErrNotFound );
+                }            
+            iEvent.SetName( eventName );    
+            iEvent.SetType( TEventIf::EWaitEvent );     
+            // Wait event
+            iTestCombiner->TestModuleIf().Event( iEvent, iStatus );
+            iState = ERunnerRunning;
+            SetActive();
+            continueTask = EFalse;
+            }
+            break;
+        case TTCKeywords::ERelease:
+            {
+            __TRACE( KMessage, (_L("Release %S"), &eventName));
+            iTestCombiner->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+                _L("Release %S"), &eventName);
+            // Check that event is requested           
+            if( ind == count )
+                {
+                __TRACE( KError, (_L("Released event %S is not requested"), 
+                    &eventName));
+                iRunErrorMessage.Format( KErrMsgReleaseEventNotRequested, &eventName );
+                User::Leave( KErrNotFound );
+                }            
+            // Remove event from array
+            TEventTc* event = iTestCombiner->iEventArray[ind];
+            iTestCombiner->iEventArray.Remove( ind );
+            delete event;
+            iEvent.SetName( eventName );
+            iEvent.SetType( TEventIf::ERelEvent );
+            
+            // Release event
+            iTestCombiner->TestModuleIf().Event( iEvent, iStatus );
+            iState = ERunnerRunning;
+            SetActive();
+            continueTask = EFalse;
+            }
+            break;
+        default:
+            {
+              __TRACE( KError, (_L("Illegal keyword") ) );
+            
+            // Unknown or illegal keyword
+            User::Leave( KErrGeneral );
+            }
+            break;
+     
+        }
+    return continueTask;
+*/
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteAllocateL
+
+     Description: Executes allocate line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteAllocateL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgAllocateSlaveTypeNotDefined, "Allocate : Slave type was not given for allocate" );
+    _LIT( KErrMsgAllocateSlaveNameNotDefined, "Allocate : Slave name is not defined" );
+    _LIT( KErrMsgAllocateSlaveAlreadyAllocated, "Allocate : Slave with name %S already allocated" );
+    __TRACE( KMessage, (_L("Allocate")));
+       
+    TPtrC type;
+    TPtrC name;
+    // Get slave type
+    TInt ret = aItem->GetNextString( type );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave type was not given for allocate")));
+        iRunErrorMessage = KErrMsgAllocateSlaveTypeNotDefined;
+        User::Leave( KErrArgument );
+        }
+    
+    // Get slave name
+    ret = aItem->GetNextString( name );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave name was not given for allocate")));
+        iRunErrorMessage = KErrMsgAllocateSlaveNameNotDefined;
+        User::Leave( KErrArgument );
+        }
+
+    iTestCombiner->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+        _L("Allocate %S"), &name );
+        
+    __TRACE( KMessage, (_L("Allocate %S [name: %S]"), &type, &name));
+    
+    if( iTestCombiner->GetSlave( name ) )
+        {
+        __TRACE( KError, (_L("Slave with name %S already allocated"), 
+            &name ) );
+        iRunErrorMessage.Format( KErrMsgAllocateSlaveAlreadyAllocated, &name );
+        User::Leave( KErrAlreadyExists );
+        } 
+        
+    CSlaveInfo* slave = CSlaveInfo::NewL( name, KRemoteProtocolMasterId );
+    CleanupStack::PushL( slave );
+    User::LeaveIfError( iTestCombiner->iSlaveArray.Append( slave ) );
+    if( iTestCombiner->iLoopIsUsed )
+        {
+        User::LeaveIfError( iTestCombiner->iLoopAllocationArray.Append( slave ) );
+        }
+    CleanupStack::Pop( slave );
+
+    CStifTFwIfProt* req = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( req );
+    req->CreateL();
+    
+    // Reserve message
+    User::LeaveIfError(
+        req->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgReserve ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError(
+        req->AppendId( slave->iMasterId ) );
+    // DstId, broacast id
+    User::LeaveIfError(
+        req->AppendId( slave->iSlaveDevId ) );
+    // Slave type
+    User::LeaveIfError( req->Append( type ) );
+
+    User::LeaveIfError( 
+        iTestCombiner->TestModuleIf().RemoteSend( req->Message() ) );
+        
+    iState = ERunnerAllocate;
+    slave->iState = CSlaveInfo::ESlaveReserveSent;
+
+    // Start timer    
+    iRemoteTimer->SetTimerActive( iTestCombiner->iRemoteTimeout );
+
+    CleanupStack::PopAndDestroy( req );
+
+    return EFalse;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteFreeL
+
+     Description: Executes free line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteFreeL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgFreeSlaveNameNotDefined, "Free : Slave name is not defined" );
+    _LIT( KErrMsgFreeSlaveNotFound, "Free : Slave %S not found" );
+    _LIT( KErrMsgFreeSlaveReserved, "Free : Slave %S in illegal state %d, cannot be released" );
+    __TRACE( KMessage, (_L("Free")));
+    
+    TPtrC name;    
+    // Get slave name
+    TInt ret = aItem->GetNextString( name );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave name was not given for free")));
+        iRunErrorMessage = KErrMsgFreeSlaveNameNotDefined;
+        User::Leave( KErrArgument );
+        }
+
+    iTestCombiner->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+        _L("Free %S"), &name );
+        
+    __TRACE( KMessage, (_L("Free %S"), &name ) );
+    
+    CSlaveInfo* slave = iTestCombiner->GetSlave( name );
+    if( slave == NULL )
+        {
+        __TRACE( KError, (_L("Slave %S not found"), &name ));
+        iRunErrorMessage.Format( KErrMsgFreeSlaveNotFound, &name );
+        User::Leave( KErrNotFound );
+        }
+    if( slave->iState != CSlaveInfo::ESlaveReserved )
+        {
+        __TRACE( KError, (_L("Slave %S in illegal state %d, cannot be released"), 
+            &name, slave->iState ));
+        iRunErrorMessage.Format( KErrMsgFreeSlaveReserved, &name, slave->iState );
+        User::Leave( KErrGeneral );
+        } 
+        
+    ExecuteFreeL( slave );
+    
+    return EFalse;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteFreeL
+
+     Description: Executes free line
+  
+     Parameters:    CSlaveInfo* aSlave: in: slave info
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ExecuteFreeL( CSlaveInfo* aSlave )
+    {    
+    
+    CRemoteTestCase* testCase = 
+        iTestCombiner->GetRemoteRunningTestOnSlave( aSlave->iSlaveDevId );
+          
+    if( testCase )
+        {
+        __TRACE( KMessage, 
+            (_L("Postpone free until testcases completed")));
+        // Test cases still running on slave,
+        // Free slave after test case has completed
+        testCase->iFreeSlave = ETrue;
+        return;
+        }
+    
+    CStifTFwIfProt* req = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( req );
+    req->CreateL();
+    
+    // Release message
+    User::LeaveIfError( 
+        req->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRelease ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError( 
+        req->AppendId( aSlave->iMasterId ) );
+    // DstId is device broadcast
+    User::LeaveIfError( 
+        req->AppendId( SETID( DEVID( aSlave->iSlaveDevId ), 0 ) ) );
+    
+    User::LeaveIfError( 
+        iTestCombiner->TestModuleIf().RemoteSend( req->Message() ) );
+        
+    iState = ERunnerFree;
+    aSlave->iState = CSlaveInfo::ESlaveReleaseSent;
+
+    // Start timer    
+    iRemoteTimer->SetTimerActive( iTestCombiner->iRemoteTimeout );
+   
+    CleanupStack::PopAndDestroy( req );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteRemoteL
+
+     Description: Executes remote line
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteRemoteL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgRemoteSlaveNameNotDefined, "Remote : Slave name is not defined" );
+    _LIT( KErrMsgRemoteSlaveNotFound, "Remore : Slave %S not found" );
+    _LIT( KErrMsgRemoteIllegalState, "Remote : Slave %S in illegal state %d, cannot send remote call" );
+    _LIT( KErrMsgRemoteCommandNotDefined, "Slave command name was not given for remote" );
+    TPtrC name;    
+    TPtrC command;    
+    // Get slave name
+    TInt ret = aItem->GetNextString( name );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave name was not given for remote")));
+        iRunErrorMessage = KErrMsgRemoteSlaveNameNotDefined;
+        User::Leave( KErrArgument );
+        }
+        
+    __TRACE( KMessage, (_L("Remote command to %S"), &name));
+    
+    CSlaveInfo* slave = iTestCombiner->GetSlave( name );
+    if( slave == NULL )
+        {
+        __TRACE( KError, (_L("Slave %S not found"), &name ));
+        iRunErrorMessage.Format( KErrMsgRemoteSlaveNotFound, &name );
+        User::Leave( KErrArgument );
+        }
+    if( slave->iState != CSlaveInfo::ESlaveReserved )
+        {
+        __TRACE( KError, (_L("Slave %S in illegal state %d, cannot send remote call"), 
+            &name, slave->iState ));
+        iRunErrorMessage.Format( KErrMsgRemoteIllegalState, &name, slave->iState );
+        User::Leave( KErrNotReady );
+        } 
+        
+    // Get remote command name
+    ret = aItem->GetNextString( command );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Slave command name was not given for remote")));
+        iRunErrorMessage = KErrMsgRemoteCommandNotDefined;
+        User::Leave( KErrArgument );
+        }
+
+    iTestCombiner->TestModuleIf().Printf( KPrintPriExec, KExecute, 
+        _L("remote %S %S"), &name, &command );
+
+    __TRACE( KPrint, (_L("remote %S %S"), &name, &command ) );
+
+    // Parse command name
+    TInt key = TTCKeywords::Parse( command, TTCKeywords::Keyword );    
+    TBool continueTask = ETrue;
+    
+    switch( key )
+        {
+        // Test case starting
+        case TTCKeywords::ERun:
+            continueTask = ExecuteRemoteRunL( aItem, slave );
+            break;
+                   
+        // Event control cases
+        case TTCKeywords::ERequest:
+        case TTCKeywords::EWait:
+        case TTCKeywords::ERelease:
+            continueTask = ExecuteRemoteEventCtlL( aItem, slave, key );
+            break;
+
+        case TTCKeywords::ESet:
+        case TTCKeywords::EUnset:
+            continueTask = ExecuteRemoteSetUnsetEventL(aItem, slave, key);
+			break;
+        // asynchronous 'sendreceive'
+        case TTCKeywords::ESendReceive:
+            continueTask = ExecuteRemoteSendReceiveL( aItem, slave );
+            break;
+
+        default:
+            // Some unknown remote command, forward as such 
+            continueTask = ExecuteRemoteUnknownL( aItem, slave, command );
+            break;
+        }
+    
+    return continueTask;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteRemoteRunL
+
+     Description: Handles remote run 
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CSlaveInfo* aSlave: in: slave info
+                    HBufC *aSetUnsetEvent: in: data needed for startInfo
+                    TInt aCaseNumber: in: data needed for startInfo
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution and wait response
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteRemoteRunL( CStifItemParser* aItem,
+                                        CSlaveInfo* aSlave,
+                                        HBufC *aSetUnsetEvent,
+                                        TInt aCaseNumber )
+    {
+    
+    CStifTFwIfProt* req = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( req );
+    req->CreateL();
+    
+    CStartInfo* startInfo = CStartInfo::NewL();
+    CleanupStack::PushL( startInfo );
+    //if aSetUnsetEvent is given, then get start info from this argument
+    if(aSetUnsetEvent != NULL)
+    	{
+    	TBuf<10> tmpModuleName;
+    	tmpModuleName.Copy(_L("suevent"));
+    	startInfo->SetModuleNameL(tmpModuleName);
+    	startInfo->SetConfigL(*aSetUnsetEvent);
+    	startInfo->iCaseNum = aCaseNumber;
+    	}
+    else
+    	{
+    ParseRunParamsL( aItem, *startInfo );   
+}
+    
+    if( iTestCombiner->GetTest( startInfo->iTestId ) )
+        {
+        /*        
+        __TRACE( KError, (_L("´Slave test running already with testid %S"), 
+            &startInfo->iTestId  ) );
+        */
+        User::Leave( KErrAlreadyExists );
+        }
+        
+    CRemoteTestCase* remote = 
+        CRemoteTestCase::NewL( iTestCombiner, 
+                               startInfo->iTestId,
+                               startInfo->iExpectedResult,
+                               startInfo->iCategory ); 
+    
+    CleanupStack::PushL( remote );
+        
+    // Remote message
+    User::LeaveIfError( 
+        req->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError( req->AppendId( aSlave->iMasterId ) );
+    // DstId is device broadcast
+    User::LeaveIfError( 
+        req->AppendId( SETID( DEVID( aSlave->iSlaveDevId ), 0 ) ) );
+    // Run command
+    User::LeaveIfError( 
+        req->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRun ) );
+    // Run parameters
+    User::LeaveIfError(
+        req->Append( CStifTFwIfProt::RunParams, 
+                CStifTFwIfProt::ERunModule, 
+                startInfo->iModule ) );
+    User::LeaveIfError(
+        req->Append( CStifTFwIfProt::RunParams, 
+                CStifTFwIfProt::ERunTestcasenum, 
+                startInfo->iCaseNum ));
+    if( startInfo->iIniFile.Length() > 0 )
+        {
+        // Initialization file
+        __TRACE( KMessage, (_L("ini: %S"), &startInfo->iIniFile ));     
+        User::LeaveIfError(
+            req->Append( CStifTFwIfProt::RunParams, 
+                    CStifTFwIfProt::ERunInifile, 
+                    startInfo->iIniFile ) );
+        }
+    if( startInfo->iConfig.Length() > 0 )
+        {
+        // Initialization file
+        __TRACE( KMessage, (_L("config: %S"), &startInfo->iConfig ));     
+        User::LeaveIfError(
+            req->Append( CStifTFwIfProt::RunParams, 
+                    CStifTFwIfProt::ERunTestcasefile, 
+                    startInfo->iConfig ));
+        } 
+    //Title (must be given between quotation marks in case of any spaces inside
+    if( startInfo->iTitle.Length() > 0 )
+        {
+        __TRACE(KMessage, (_L("title: %S"), &startInfo->iTitle));
+        TName tit;
+        tit.Format(_L("\"title=%S\""), &startInfo->iTitle);
+        User::LeaveIfError(req->Append(tit));
+        }
+    
+    User::LeaveIfError(
+        iTestCombiner->TestModuleIf().RemoteSend( req->Message() ) );
+        
+    remote->iRemoteState = CRemoteTestCase::ECaseRunSent;
+    remote->iSlaveId = aSlave->iSlaveDevId;
+    remote->StartL();
+    User::LeaveIfError( iTestCombiner->iTestCases.Append( remote ) );
+    if( iTestCombiner->iLoopIsUsed )
+        {
+        User::LeaveIfError( iTestCombiner->iLoopAllocationArray.Append( remote ) );
+        }
+    CleanupStack::Pop( remote );
+    
+    CleanupStack::PopAndDestroy( startInfo );
+    
+    iTestCombiner->iRunningTests++;
+    
+    // Start timer    
+    iRemoteTimer->SetTimerActive( iTestCombiner->iRemoteTimeout );
+
+    iState = ERunnerRemote;
+
+    CleanupStack::PopAndDestroy( req );
+
+    return EFalse;
+         
+    }
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteRemoteTestCtlL
+
+     Description: Handles remote testcase controlling
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CTestCase* aTestCase: in: test case
+                    TInt aCmd: in: remote command 
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution and wait response
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteRemoteTestCtlL( CStifItemParser* /* aItem */, 
+                                          CTestCase* aTestCase, 
+                                          TInt aCmd )
+    {
+    
+    CRemoteTestCase* caseInfo = ( CRemoteTestCase* ) aTestCase;
+    
+    CStifTFwIfProt* req = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( req );
+    req->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        req->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    //req->AppendId( ( TUint32 ) this );
+    User::LeaveIfError(
+        req->AppendId( KRemoteProtocolMasterId ));
+    // DstId, i.e.slave id
+    User::LeaveIfError(
+        req->AppendId( caseInfo->iSlaveId ));
+    
+    switch( aCmd )
+        {
+        case TTCKeywords::EPause:
+            if( caseInfo->iRemoteState != CRemoteTestCase::ECaseRunning )
+                {
+                __TRACE( KError, (_L("Test case with testid %S not running"), 
+                    &aTestCase->TestId() ));
+                User::Leave( KErrGeneral );
+                }
+            // Pause command
+            User::LeaveIfError(
+                req->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdPause ) );
+            caseInfo->iRemoteState = CRemoteTestCase::ECasePauseSent;
+            break;
+        case TTCKeywords::EResume:
+            if( caseInfo->iRemoteState != CRemoteTestCase::ECasePaused )
+                {
+                __TRACE( KError, (_L("Test case with testid %S not paused"), 
+                    &aTestCase->TestId() ));
+                User::Leave( KErrGeneral );
+                }
+            // Resume command
+            User::LeaveIfError( 
+                req->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdResume ));
+            caseInfo->iRemoteState = CRemoteTestCase::ECaseResumeSent;
+            break;            
+        case TTCKeywords::ECancel:
+            if( ( caseInfo->iRemoteState != CRemoteTestCase::ECaseRunning ) &&
+                ( caseInfo->iRemoteState != CRemoteTestCase::ECasePaused ) )
+                {
+                __TRACE( KError, (_L("Test case with testid %S not running"),
+                    &aTestCase->TestId() ));
+                User::Leave( KErrGeneral );
+                }
+            // Cancel command
+            User::LeaveIfError( 
+                req->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdCancel ));    
+            caseInfo->iRemoteState = CRemoteTestCase::ECaseCancelSent;
+            break;      
+        case TTCKeywords::EComplete:
+            if( caseInfo->iRemoteState == CRemoteTestCase::ECaseCompleted )
+                {
+                __TRACE( KError, (_L("Test case with testid %S already completed"), 
+                    &aTestCase->TestId() ));
+                CleanupStack::PopAndDestroy( req );
+                return ETrue;
+                }
+            else
+                {
+                iTestCombiner->iWaitTestCase = aTestCase->TestId();
+                CleanupStack::PopAndDestroy( req );
+                return EFalse;
+                }    
+        default:
+            // Should never come here
+            User::Leave( KErrGeneral );            
+        }
+    
+    User::LeaveIfError( 
+        iTestCombiner->TestModuleIf().RemoteSend( req->Message() ) );
+
+    // Start timer    
+    iRemoteTimer->SetTimerActive( iTestCombiner->iRemoteTimeout );
+            
+    iState = ERunnerRemote;
+    
+    CleanupStack::PopAndDestroy( req );
+    
+    return EFalse;
+   
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteRemoteEventCtlL
+
+     Description: Handles remote event controlling
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CSlaveInfo* aSlave: in: slave info
+                    TInt aCmd: in: remote command 
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution and wait response
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteRemoteEventCtlL( CStifItemParser* aItem, 
+                                           CSlaveInfo* aSlave, 
+                                           TInt aCmd )
+    {
+    
+    TPtrC eventName;
+    // Get event name
+    TInt ret = aItem->GetNextString( eventName );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, (_L("Event name was not given for remote")));
+        User::Leave( KErrArgument );
+        }
+    
+    if( aCmd == TTCKeywords::EWait )
+        {
+        TEventTc* event = aSlave->GetEvent( eventName );
+        if( event == NULL )
+            {
+            __TRACE( KError, (_L("Waited event %S not requested"), 
+                &eventName  ) );
+            User::Leave( KErrNotFound );
+            }
+        iState = ERunnerRunning;
+        SetActive();
+        event->WaitEvent( iStatus );
+        // Execution continue if waited event is set or after it is set       
+        return EFalse;
+        }
+    
+    CStifTFwIfProt* req = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( req );
+    
+    req->CreateL();
+    // Remote message
+    User::LeaveIfError( 
+        req->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ));
+    // Srcid. i.e. master id
+    User::LeaveIfError( req->AppendId( aSlave->iMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( req->AppendId( aSlave->iSlaveDevId ) );
+           
+    switch( aCmd )
+        {       
+        // Event control cases
+        case TTCKeywords::ERequest:
+            {
+            TEventTc* event = aSlave->GetEvent( eventName );
+            if( event != NULL )
+                {
+                __TRACE( KError, (_L("Event %S already requested"), 
+                    &eventName  ) );
+                User::Leave( KErrNotFound );
+                }
+            event = new( ELeave ) TEventTc( (TName&)eventName, 
+                                             iTestCombiner->iLog );
+            CleanupStack::PushL( event );
+            User::LeaveIfError( aSlave->iEvents.Append( event ) );
+            CleanupStack::Pop( event );
+            // Request event
+            User::LeaveIfError( 
+                req->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest ));  
+            }
+            break;
+                        
+        case TTCKeywords::ERelease:
+            {
+            TEventIf* event = NULL;
+            TInt count = aSlave->iEvents.Count();
+            TInt i = 0;
+            for( ; i < count; i++ )
+                {
+                if( aSlave->iEvents[i]->Name() == eventName )
+                    {
+                    event = aSlave->iEvents[i];
+                    break;
+                    }
+                }
+            if( event == NULL )
+                {
+                __TRACE( KError, (_L("Event not found %S"), 
+                    &eventName  ) );
+                User::Leave( KErrNotFound );
+                }
+                                                  
+            aSlave->iEvents.Remove(i);
+            delete event;
+            // Release event
+            User::LeaveIfError(
+                req->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRelease ));  
+            }
+            break;
+        /*
+        case TTCKeywords::ESet:
+        	{
+        		__TRACE( KPrint, (_L("JIRA51 CTestRunner::ExecuteRemoteEventCtlL case ESet")));
+	            User::LeaveIfError(req->Append(CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdSetEvent));
+        		break;
+        	}
+       	case TTCKeywords::EUnset:
+        	{
+        		__TRACE( KPrint, (_L("JIRA51 CTestRunner::ExecuteRemoteEventCtlL case EUnset")));
+	            User::LeaveIfError(req->Append(CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdUnsetEvent));
+        		break;
+        	}
+        */
+        default:
+             // Should never come here
+            User::Leave( KErrGeneral );            
+        }
+        
+    // Event name
+    User::LeaveIfError( req->Append( eventName ) );  
+    
+	if(aCmd == TTCKeywords::ESet)
+		{
+ 		TPtrC stateEvent;
+		TInt ret = aItem->GetNextString(stateEvent);
+		if(ret == KErrNotFound) //indication event - add indicate keyword to message
+			{
+	            User::LeaveIfError(req->Append(CStifTFwIfProt::EventType, TEventIf::EIndication));
+			}
+		else if(ret == KErrNone) //possibly state event
+			{
+			if(stateEvent.Compare(_L("state")) == 0) //state event - add state keyword to message
+				{
+	            User::LeaveIfError(req->Append(CStifTFwIfProt::EventType, TEventIf::EState));
+				}
+			else //syntax error in the line
+				{
+		        __TRACE(KError, (_L("Unknown keyword %S"), &stateEvent));
+				}
+			}
+		else //syntax error in the line
+			{
+	        __TRACE(KError, (_L("Unknown keyword (2) %S"), &stateEvent));
+			}
+		}
+    User::LeaveIfError( 
+        iTestCombiner->TestModuleIf().RemoteSend( req->Message() ) );
+                
+    // Start timer    
+    iRemoteTimer->SetTimerActive( iTestCombiner->iRemoteTimeout );
+
+    iState = ERunnerRemote;
+    
+    CleanupStack::PopAndDestroy( req );
+    
+    return EFalse;
+    
+    }    
+
+TBool CTestRunner::ExecuteRemoteSetUnsetEventL(CStifItemParser* aItem,
+                                               CSlaveInfo* aSlave,
+                                               TInt aCmd)
+	{
+	TPtrC eventName;
+	// Get event name
+	TInt ret = aItem->GetNextString(eventName);
+	if(ret != KErrNone)
+		{
+		__TRACE(KError, (_L("Event name was not given for remote")));
+		User::Leave(KErrArgument);
+		}
+	// Check if this is a state set, indication set, or unset command
+	TInt caseNumber = -1;
+	if(aCmd == TTCKeywords::ESet)
+		{
+ 		TPtrC stateEvent;
+		TInt ret = aItem->GetNextString(stateEvent);
+		if(ret == KErrNotFound) //indication event - add indicate keyword to message
+			{
+			caseNumber = 1;
+			}
+		else if(ret == KErrNone) //possibly state event
+			{
+			if(stateEvent.Compare(_L("state")) == 0) //state event - add state keyword to message
+				{
+				caseNumber = 0;
+				}
+			else //syntax error in the line
+				{
+				__TRACE(KError, (_L("Unknown keyword %S"), &stateEvent));
+				}
+			}
+		else //syntax error in the line
+			{
+			}
+		}
+	else //TTCKeyword::EUnset
+		{
+		caseNumber = 2;
+		}
+
+	if(caseNumber == -1)
+		{
+			__TRACE(KError, _L("Should never occur"));
+		}
+	// Build new descriptor with command to run hardcoded suevent test case on remote phone
+	HBufC* cmd = HBufC::NewL(100);
+	CleanupStack::PushL(cmd);
+	TPtr cmdPtr(cmd->Des());
+	cmdPtr.Copy(eventName);
+	// Run remotely test case
+RDebug::Print(_L("CTestRunner::ExecuteRemoteSetUnsetEventL calling ExecuteRemoteRun"));
+	TBool retval = ExecuteRemoteRunL(aItem, aSlave, cmd, caseNumber);
+	// Clean data
+	CleanupStack::PopAndDestroy(cmd);
+RDebug::Print(_L("CTestRunner::ExecuteRemoteSetUnsetEventL end"));
+	return retval;
+    }
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteRemoteSendReceiveL
+
+     Description: Handles asynchronous remote sendreceive controlling
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CSlaveInfo* aSlave: in: slave info
+
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution and wait response
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteRemoteSendReceiveL( CStifItemParser* aItem, 
+                                           CSlaveInfo* aSlave )
+    {
+    CStifTFwIfProt* req = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( req );
+    
+    // Create CRemoteSendReceive object for taking sendreceive information to
+    // save for later use.
+    CRemoteSendReceive* remoteSendReceive = 
+        CRemoteSendReceive::NewL( iTestCombiner );
+    
+    CleanupStack::PushL( remoteSendReceive );
+
+    req->CreateL();
+    // Remote message
+    User::LeaveIfError(
+        req->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError( req->AppendId( aSlave->iMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( req->AppendId( aSlave->iSlaveDevId ) );
+    // Run command
+    User::LeaveIfError( req->Append( 
+        CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdSendReceive ) );
+    // asynchronous sendreceive's parameters    
+    TPtrC tmp;    
+
+    while( aItem->GetNextString( tmp ) == KErrNone )
+        {        
+        // Append parameters
+        User::LeaveIfError( req->Append( tmp ) );  
+        }
+    
+    User::LeaveIfError( 
+        iTestCombiner->TestModuleIf().RemoteSend( req->Message() ) );
+
+    remoteSendReceive->iRemoteState = CRemoteSendReceive::ECaseSend;
+    remoteSendReceive->iSlaveId = aSlave->iSlaveDevId;
+
+    // Take CRemoteSendReceive object to save in array. This can be used in
+    // TestCombiner when handling responses.
+    User::LeaveIfError( 
+            iTestCombiner->iSendReceive.Append( remoteSendReceive ) );
+    if( iTestCombiner->iLoopIsUsed )
+        {
+        User::LeaveIfError( 
+            iTestCombiner->iLoopAllocationArray.Append( remoteSendReceive ) );
+        }
+    CleanupStack::Pop( remoteSendReceive );
+
+    // Start timer    
+    iRemoteTimer->SetTimerActive( iTestCombiner->iRemoteTimeout );
+
+    iState = ERunnerRemote;
+    
+    CleanupStack::PopAndDestroy( req );
+    
+    // Return EFalse=>start waiting response...
+    return EFalse;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteRemoteUnknownL
+
+     Description: Forwards messages as such
+  
+     Parameters:    CStifItemParser* aItem: in: script line
+                    CSlaveInfo* aSlave: in: slave info
+                    TInt aCmd: in: remote command 
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution and wait response
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteRemoteUnknownL( CStifItemParser* aItem, 
+                                          CSlaveInfo* aSlave,
+                                          TDesC& aCommand )
+    {
+    
+    CStifTFwIfProt* req = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( req );
+    
+    req->CreateL();
+    // Remote message
+    User::LeaveIfError(
+        req->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote ) );
+    // Srcid. i.e. master id
+    User::LeaveIfError( req->AppendId( aSlave->iMasterId ) );
+    // DstId, i.e.slave device id
+    User::LeaveIfError( req->AppendId( aSlave->iSlaveDevId ) );
+    
+    // Append command name
+    User::LeaveIfError( req->Append( aCommand ) );
+    
+    TPtrC tmp;         
+    while( aItem->GetNextString( tmp ) == KErrNone )
+        {        
+        // Append parameters
+        User::LeaveIfError( req->Append( tmp ) );  
+        }
+    
+    User::LeaveIfError( 
+        iTestCombiner->TestModuleIf().RemoteSend( req->Message() ) );
+                
+    // Start timer    
+    iRemoteTimer->SetTimerActive( iTestCombiner->iRemoteTimeout );
+
+    iState = ERunnerRemote;
+    
+    CleanupStack::PopAndDestroy( req );
+    
+    return EFalse;
+    
+    }    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ReceiveResponseL
+
+     Description: Handles responce received from slave
+  
+     Parameters:    TDesC& aMsg: in: message
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ReceiveResponseL( TDesC& aMsg )
+    {
+    __TRACE( KMessage, (_L("ReceiveResponse")));
+    
+    iRemoteTimer->Cancel();
+    
+    CStifTFwIfProt* msg = CStifTFwIfProt::NewL();
+    CleanupStack::PushL( msg );
+    TRAPD( err, msg->SetL( aMsg ); );
+    if( err != KErrNone )
+        {
+        __TRACE( KError, (_L("Response parsing failed")));
+        User::Leave( err );
+        }
+    
+    // Check protocol identifiers
+    if( ( msg->SrcDevId() == 0 ) ||
+        ( msg->DstDevId() == 0 ) ||
+        ( msg->DstTestId() == 0 ) )
+        {
+        __TRACE( KError, (_L("Illegal deviceid received")));
+        User::Leave( KErrGeneral );
+        }
+    
+    // This is master, cannot receive anything else but responses
+    if( msg->iMsgType != CStifTFwIfProt::EMsgResponse )
+        {
+        __TRACE( KError, (_L("Illegal message received %d"), 
+            msg->iMsgType ));
+        User::Leave( KErrGeneral );        
+        }
+        
+    TBool continueTask = ETrue;
+    switch( msg->iRespType )
+        {
+        case CStifTFwIfProt::EMsgReserve:
+            {
+            __TRACE( KMessage, (_L("ReceiveResponse Reserve")));
+            if( iState != ERunnerAllocate )
+                {
+                __TRACE( KError, (_L("Response reserve received in illegal state %d"), 
+                    iState ));
+                User::Leave( KErrGeneral );    
+                }
+            // Check protocol Src test id
+            if( msg->SrcTestId() != 0 )
+                {
+                __TRACE( KError, (_L("Illegal deviceid received")));
+                User::Leave( KErrGeneral );
+                }
+            if( msg->iResult != KErrNone )
+                {
+                __TRACE( KError, (_L("Response with error %d"), msg->iResult ));
+                User::Leave( msg->iResult );
+                }
+            CSlaveInfo* slave = NULL;
+            TInt count = iTestCombiner->iSlaveArray.Count();
+            for( TInt index = 0; index < count; index++ )
+                {
+                slave = iTestCombiner->iSlaveArray[index];
+                if( ( slave->iSlaveDevId == 0 ) &&
+                    ( slave->iState ==  CSlaveInfo::ESlaveReserveSent ) )
+                    {
+                    break;
+                    }
+                slave = NULL;
+                }
+            if( slave == NULL )
+                {
+                User::Leave( KErrNotFound );
+                }
+            slave->iSlaveDevId = msg->SrcId();
+            slave->iState = CSlaveInfo::ESlaveReserved;
+            __TRACE( KMessage, (_L("Slave allocated succesfully, continue execution")));
+            }
+            break;
+        case CStifTFwIfProt::EMsgRelease:
+            {
+            __TRACE( KMessage, (_L("ReceiveResponse Release")));
+            if( iState != ERunnerFree )
+                {
+                __TRACE( KError, (_L("Response release received in illegal state %d"), 
+                    iState ));
+                User::Leave( KErrGeneral );    
+                }
+            // Check protocol Src test id
+            if( msg->SrcTestId() != 0 )
+                {
+                __TRACE( KError, (_L("Illegal deviceid received")));
+                User::Leave( KErrGeneral );
+                }                
+            if( msg->iResult != KErrNone )
+                {
+                __TRACE( KError, (_L("Response with error %d"), msg->iResult ));
+                User::Leave( msg->iResult );
+                }
+
+            CSlaveInfo* slave = iTestCombiner->GetSlave( msg->SrcId() );
+            if( slave == NULL )
+                {
+                User::Leave( KErrNotFound );
+                }
+            slave->iState = CSlaveInfo::ESlaveReleased;
+            __TRACE( KMessage, (_L("Slave freed succesfully, continue execution")));
+            }            
+            break;
+        case CStifTFwIfProt::EMsgRemote:
+            {         
+            __TRACE( KMessage, (_L("ReceiveResponse Remote")));
+            switch( msg->iCmdType )
+                {
+                case CStifTFwIfProt::ECmdRun:
+                    continueTask = ReceiveResponseRunL( *msg );
+                    break;
+                case CStifTFwIfProt::ECmdPause:
+                case CStifTFwIfProt::ECmdResume:
+                case CStifTFwIfProt::ECmdCancel:
+                    continueTask = ReceiveResponseTestCtlL( *msg );
+                    break;
+                case CStifTFwIfProt::ECmdRequest:
+                case CStifTFwIfProt::ECmdRelease:
+                case CStifTFwIfProt::ECmdSetEvent:
+                case CStifTFwIfProt::ECmdUnsetEvent:
+                    continueTask = ReceiveResponseEventCtlL( *msg );                    
+                    break;
+                case CStifTFwIfProt::ECmdSendReceive:
+                    continueTask = ReceiveResponseSendReceiveL( *msg );                    
+                    break;
+                default:
+                    continueTask = ReceiveResponseUnknownL( *msg );                    
+                    break;
+                }
+            }            
+            break;
+        default:
+            User::Leave( KErrGeneral );
+        } 
+               
+    
+    CleanupStack::PopAndDestroy( msg );    
+    return continueTask;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ReceiveResponseRunL
+
+     Description: Handles response for run received from slave
+  
+     Parameters:    CStifTFwIfProt& aMsg: in: protocol message parser
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/    
+TBool CTestRunner::ReceiveResponseRunL( CStifTFwIfProt& aMsg )
+    {
+
+    TPtrC tmp = CStifTFwIfProt::RunStatus(aMsg.iRunStatus); 
+    __TRACE( KMessage, (_L("ReceiveResponse Remote Run %S"), &tmp ));
+
+    TBool continueTask = ETrue; 
+    switch( aMsg.iRunStatus )
+        {
+        case CStifTFwIfProt::ERunStarted:
+            {
+            // Locate testcase    
+            CRemoteTestCase* tcase = 
+                iTestCombiner->GetRemoteTestRunSent( GETDEVID( aMsg.SrcId() ) );
+            if( tcase == NULL ) 
+                {
+                __TRACE( KError, (_L("Testcase not found")));
+                User::Leave( KErrNotFound );        
+                }
+            tcase->iSlaveId = aMsg.SrcId();
+
+            tcase->iRemoteState = CRemoteTestCase::ECaseRunning;
+            }
+            break;
+        case CStifTFwIfProt::ERunError:
+        case CStifTFwIfProt::ERunReady:
+            {
+            // Locate testcase    
+            CRemoteTestCase* tcase = 
+                iTestCombiner->GetRunningRemoteTest( aMsg.SrcId() );
+            if( tcase == NULL ) 
+                {
+                __TRACE( KError, (_L("Testcase not found")));
+                User::Leave( KErrNotFound );        
+                }
+
+            switch( aMsg.iResultCategory )
+                {
+                case CStifTFwIfProt::EResultNormal:
+                    tcase->iResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECaseExecuted;
+                    tcase->iResult.iTestResult.iResult = aMsg.iResult;
+                    tcase->iResult.iCaseExecutionResultCode = 0;
+                    break;
+                case CStifTFwIfProt::EResultPanic:
+                    tcase->iResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECasePanic;
+                    tcase->iResult.iTestResult.iResult = KErrGeneral;
+                    tcase->iResult.iCaseExecutionResultCode = aMsg.iResult;
+                    break;
+                case CStifTFwIfProt::EResultException:
+                    tcase->iResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECaseException;
+                    tcase->iResult.iTestResult.iResult = KErrGeneral;
+                    tcase->iResult.iCaseExecutionResultCode = aMsg.iResult;
+                    break;
+                case CStifTFwIfProt::EResultTimeout:
+                    tcase->iResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECaseTimeout;                
+                    tcase->iResult.iTestResult.iResult = KErrGeneral;
+                    tcase->iResult.iCaseExecutionResultCode = aMsg.iResult;
+                    break;
+                case CStifTFwIfProt::EResultLeave:
+                    tcase->iResult.iCaseExecutionResultType = 
+                        TFullTestResult::ECaseLeave;                
+                    tcase->iResult.iTestResult.iResult = KErrGeneral;
+                    tcase->iResult.iCaseExecutionResultCode = aMsg.iResult;
+                    break;
+                default:
+                    User::Leave( KErrGeneral );
+                }
+                    
+            if( ( tcase->iRemoteState == CRemoteTestCase::ECaseCancelled ) ||
+                ( tcase->iRemoteState == CRemoteTestCase::ECaseRunSent ) )
+                {
+                // Complete for cancelled testcase or error for run request, 
+                // set runner active again
+                continueTask = ETrue; 
+                }
+            else
+                {
+                // Continued from Complete in state ECaseRunning
+                continueTask = EFalse; 
+                }
+                
+            tcase->iRemoteState = CRemoteTestCase::ECaseCompleted;
+
+        __TRACE( KMessage, (_L("ReceiveResponse Remote Run rq comp")));
+            
+            TRequestStatus* rs = &tcase->iStatus;
+            // Complete testcase
+            User::RequestComplete( rs, KErrNone );
+            
+            }
+            break;
+        default:
+            // Should never come here
+            User::Leave( KErrGeneral );    
+        }        
+    
+    return continueTask;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ReceiveResponseTestCtlL
+
+     Description: Handles responses for test control commands 
+        received from slave
+  
+     Parameters:    CStifTFwIfProt& aMsg: in: protocol message parser
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/    
+TBool CTestRunner::ReceiveResponseTestCtlL( CStifTFwIfProt& aMsg )
+    {
+
+    if( aMsg.iResult != KErrNone )
+        {
+        __TRACE( KError, (_L("Response with error %d"), aMsg.iResult ));
+        User::Leave( aMsg.iResult );
+        }
+    
+    // Locate testcase    
+    CRemoteTestCase* tcase = iTestCombiner->GetRemoteTest( aMsg.SrcId() );
+    if( tcase == NULL ) 
+        {
+        __TRACE( KError, (_L("Testcase not found")));
+        User::Leave( KErrNotFound );        
+        }
+    
+    TBool continueTask = ETrue;
+    
+    switch( aMsg.iCmdType )
+        {
+        case CStifTFwIfProt::ECmdPause:
+            __TRACE( KMessage, (_L("ReceiveResponse Remote Pause")));
+
+            if( tcase->iRemoteState != CRemoteTestCase::ECasePauseSent )
+                {
+                __TRACE( KError, (_L("Pause response received in illegal state")));
+                User::Leave( KErrGeneral );                        
+                }
+            tcase->iRemoteState = CRemoteTestCase::ECasePaused;
+            
+            // Start pause timer if timeout was given 
+            if( ( iPausedTestCase.Length() > 0 ) &&
+                ( iPauseTime != 0 ) )
+                {
+                continueTask = EFalse;
+                iState = ERunnerWaitTimeout;
+                iPauseTimer.After( iStatus, iPauseTime*1000 );
+                SetActive();         
+                }
+            break;
+        case CStifTFwIfProt::ECmdResume:
+            __TRACE( KMessage, (_L("ReceiveResponse Remote Resume")));
+
+            if( tcase->iRemoteState != CRemoteTestCase::ECaseResumeSent )
+                {
+                __TRACE( KError, (_L("Resume response received in illegal state")));
+                User::Leave( KErrGeneral );                        
+                }
+            tcase->iRemoteState = CRemoteTestCase::ECaseRunning;
+            break;
+        case CStifTFwIfProt::ECmdCancel:
+            __TRACE( KMessage, (_L("ReceiveResponse Remote Cancel")));
+
+            if( tcase->iRemoteState != CRemoteTestCase::ECaseCancelSent )
+                {
+                __TRACE( KError, (_L("Cancel response received in illegal state")));
+                User::Leave( KErrGeneral );                        
+                }
+            tcase->iRemoteState = CRemoteTestCase::ECaseCancelled;
+            // Need to wait Run response with KErrCancel
+            continueTask = EFalse;
+            // Start timer    
+            iRemoteTimer->SetTimerActive( iTestCombiner->iRemoteTimeout );
+            break;
+        default:
+            // Should never come here
+            User::Leave( KErrGeneral );
+        }
+    
+    return continueTask;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ReceiveResponseEventCtlL
+
+     Description: Handles responses for event system control commands 
+        received from slave
+  
+     Parameters:    CStifTFwIfProt& aMsg: in: protocol message parser
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution 
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ReceiveResponseEventCtlL( CStifTFwIfProt& aMsg )
+    {
+        
+    CSlaveInfo* slave = iTestCombiner->GetSlave( aMsg.SrcId() );
+    if( slave == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    TBool continueTask = ETrue;
+    switch( aMsg.iCmdType )
+        {
+        case CStifTFwIfProt::ECmdRequest:
+            {
+            __TRACE( KMessage, (_L("ReceiveResponse Request")));
+ 
+            TEventTc* event = slave->GetEvent( aMsg.iEventName );
+            if( event == NULL )
+                {
+                User::Leave( KErrNotFound );
+                }
+            switch( aMsg.iEventStatus )
+                {
+                case CStifTFwIfProt::EEventActive:
+                    __TRACE( KMessage, (_L("Event %S active"), &aMsg.iEventName ));
+                    break;
+                case CStifTFwIfProt::EEventSet:
+                    __TRACE( KMessage, (_L("Event %S set"), &aMsg.iEventName ));
+                    // Set event
+                    event->SetEvent( aMsg.iEventType );
+                    continueTask = EFalse;
+                    break;
+                case CStifTFwIfProt::EEventError:
+                    __TRACE( KMessage, (_L("Event %S error %d"), 
+                        &aMsg.iEventName, aMsg.iResult ));
+                    User::Leave( aMsg.iResult );
+                default:
+                    User::Leave( KErrGeneral );
+                }
+            }
+            break;
+        case CStifTFwIfProt::ECmdRelease:
+            __TRACE( KMessage, (_L("ReceiveResponse Release")));
+            if( aMsg.iResult != KErrNone )
+                {
+                __TRACE( KError, (_L("Response with error %d"), aMsg.iResult ));
+                User::Leave( aMsg.iResult );
+                }
+
+            // Everything ok, no need to do anything
+            break;
+        case CStifTFwIfProt::ECmdSetEvent:
+            __TRACE( KMessage, (_L("ReceiveResponse SetEvent")));
+            if( aMsg.iResult != KErrNone )
+                {
+                __TRACE( KError, (_L("Response with error %d"), aMsg.iResult ));
+                User::Leave( aMsg.iResult );
+                }
+
+            // Everything ok, no need to do anything
+            break;
+        case CStifTFwIfProt::ECmdUnsetEvent:
+            __TRACE( KMessage, (_L("ReceiveResponse Unset")));
+            if( aMsg.iResult != KErrNone )
+                {
+                __TRACE( KError, (_L("Response with error %d"), aMsg.iResult ));
+                User::Leave( aMsg.iResult );
+                }
+            // Everything ok, no need to do anything
+            break;
+        default:
+            // Should never come here
+            User::Leave( KErrGeneral );
+        }
+
+    return continueTask;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ReceiveResponseSendReceiveL
+
+     Description: Handles responses for asynchronous sendreceive commands 
+                  received from slave
+  
+     Parameters: CStifTFwIfProt& aMsg: in: protocol message parser
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution 
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ReceiveResponseSendReceiveL( CStifTFwIfProt& aMsg )
+    {
+        
+    TPtrC tmp = CStifTFwIfProt::RunStatus(aMsg.iRunStatus); 
+    __TRACE( KMessage, (
+        _L("ReceiveResponseSendReceiveL asynchronous Remote SendReceive %S"),
+        &tmp ) );
+
+    TBool continueTask = EFalse; 
+    switch( aMsg.iRunStatus )
+        {
+        case CStifTFwIfProt::ERunStarted:
+            {
+            // Locate CRemoteSendReceive object
+            CRemoteSendReceive* sendreceive = 
+                            iTestCombiner->GetRemoteSendReceive( GETDEVID(
+                            aMsg.SrcId() ) );
+            if( sendreceive == NULL ) 
+                {
+                __TRACE( KError, (_L("CRemoteSendReceive object not found")));
+                User::Leave( KErrNotFound );        
+                }
+            sendreceive->iRemoteState = CRemoteSendReceive::ECaseSend;
+
+            // continueTask is EFalse=>stop script file execution
+            break;
+            }
+        case CStifTFwIfProt::ERunError:
+        case CStifTFwIfProt::ERunReady:
+            {
+            if( aMsg.iResult != KErrNone )
+                    {
+                    __TRACE( KError, (_L("sendreceive response with error %d"), aMsg.iResult ));
+                    User::Leave( aMsg.iResult );
+                    }
+
+            // Locate CRemoteSendReceive object
+            CRemoteSendReceive* sendreceive = 
+                iTestCombiner->GetRemoteSendReceive( aMsg.SrcId() );
+            if( sendreceive == NULL ) 
+                {
+                __TRACE( KError, (_L("CRemoteSendReceive object not found")));
+                User::Leave( KErrNotFound );        
+                }
+
+            // continueTask is ETrue=>continue script file execution
+            continueTask = ETrue;
+              
+            sendreceive->iRemoteState = CRemoteSendReceive::ECaseCompleted;
+
+            __TRACE( KMessage, (
+                _L( "ReceiveResponseSendReceiveL asynchronous Remote SendReceive rq comp" ) ) );
+            break;
+            }
+        default:
+            {
+            // Should never come here
+            User::Leave( KErrGeneral );    
+            }
+        }
+    return continueTask;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ReceiveResponseUnknownL
+
+     Description: Handles responses for unspecified commands
+  
+     Parameters:    CStifTFwIfProt& aMsg: in: protocol message parser
+     
+     Return Values: ETrue: continue script file execution
+                    EFalse: stop script file execution 
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ReceiveResponseUnknownL( CStifTFwIfProt& aMsg )
+    {
+        
+    CSlaveInfo* slave = iTestCombiner->GetSlave( aMsg.SrcId() );
+    if( slave == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+    if( aMsg.iResult != KErrNone )
+        {
+        __TRACE( KError, (_L("Response with error %d"), aMsg.iResult ));
+        User::Leave( aMsg.iResult );
+        }
+    
+    return ETrue;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ParseOptArgL
+
+     Description: Parses optional argument 
+  
+     Parameters: const TDesC& aOptArg: in: 
+                    argument-value pair (format arg=value)
+                 TPtrC& aArg: out: parsed argument  
+                 TPtrC& aVal: out: parsed value
+     
+     Return Values: None
+
+     Errors/Exceptions: Leaves if parsing fails.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ParseOptArgL( const TDesC& aOptArg, TPtrC& aArg, TPtrC& aVal)
+    { 
+    _LIT( KErrMsgUnknownOrIllegalKeyword, "Unknown or illegal argument %S" );
+    _LIT( KErrMsgValueNotDefined, "Value of optional argument %S is not defined" );
+    TInt length = aOptArg.Length();
+    for( TInt i=0; i < length; i++) 
+        {
+        // find the '=' sign 
+        if( aOptArg[i] == '=' )
+            {
+            if( i+1 >= length )
+                {
+                __TRACE( KError, 
+                    (_L("Illegal optional argument(%S), no value"), 
+                    &aOptArg ));    
+				TPtrC tmp = aOptArg.Left( i );
+                iRunErrorMessage.Format( KErrMsgValueNotDefined, &tmp );
+                User::Leave( KErrArgument );
+                }
+            aArg.Set( aOptArg.Left( i ) );
+            aVal.Set( aOptArg.Mid( i+1 ) );
+            __TRACE( KMessage, (  _L( "arg '%S', val '%S'" ),
+                &aArg, &aVal ));        
+            return;
+            }
+        }
+    __TRACE( KError, (_L("Illegal optional argument(%S)"), &aOptArg ));    
+    iRunErrorMessage.Format( KErrMsgUnknownOrIllegalKeyword, &aOptArg );
+    User::Leave( KErrArgument );
+    
+    }     
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: CancelTestCases
+
+     Description: Cancels all running testcases
+  
+     Parameters:    None
+     
+     Return Values: None
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::CancelTestCases()
+    {
+    __TRACEFUNC();
+
+    TInt count = iTestCombiner->iTestCases.Count();
+    for( TInt i=0; i < count; i++ )
+        {
+        if( iTestCombiner->iTestCases[i]->State() == 
+            CTCTestCase::ETestCaseRunning )
+            {
+            iTestCombiner->iTestCases[i]->Cancel();
+            }
+        }
+        
+    if( ( iTestCombiner->iRunningTests == 0 ) &&
+        iTestCombiner->iSchedulerActive ) 
+        {
+        // Stop execution
+        CActiveScheduler::Current()->Stop();
+        iTestCombiner->iSchedulerActive = EFalse;
+        return;
+        }
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: SetRunnerActive
+
+     Description: Set CTestRunner active and complete.
+  
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::SetRunnerActive()
+     {
+     __TRACEFUNC();
+     
+     if( IsActive() )
+        {
+        __TRACE( KError, ( _L("Runner already active %d"), iState ));
+        User::Panic( KTestRunner, KErrInUse );
+        }
+ 
+     // Update state
+     iState = ERunnerRunning;
+ 
+     iStatus = KRequestPending;
+     TRequestStatus* rs = &iStatus;
+     SetActive();
+     User::RequestComplete( rs, KErrNone );
+     
+     }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: CheckUnsetEvent
+
+     Description: Check unset event.
+     
+     Parameters: None
+         
+     Return Values: ETrue: Unset event completed
+                    EFalse: No unset event pending
+
+     Errors/Exceptions: None
+
+     Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::CheckUnsetEvent()
+    {
+    if( iEvent.Name().Length() == 0 )
+        {
+        return EFalse;
+        }
+        
+    __TRACE( KMessage, (_L("Unset event completed") ));
+    // Check if some testmodule below has still event request pending
+    if( iTestCombiner->UnsetEvent( iEvent, iStatus ) == EFalse )
+        {
+         // No event request pending
+        // then check other testmodules (may block)
+        TInt res = iTestCombiner->TestModuleIf().Event( iEvent );
+        if( res != KErrNone )
+            {
+            iTestCombiner->iResult = res;
+            }
+            
+        __TRACE( KPrint, (_L("Unset: Complete") ) );
+        iEvent.SetName( _L("") );
+        // Proceed testcase section execution
+        SetRunnerActive();
+        }    
+    else
+        {
+        iState = ERunnerWaitUnset;
+        // Wait for unset to complete 
+        SetActive();
+        }
+         
+    return ETrue;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteLoopL
+
+     Description: Handle the loop keyword operations.
+
+     Parameters: CStifItemParser* aItem: in: Pointer to parsed item object.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestRunner::ExecuteLoopL( CStifItemParser* aItem )
+    {
+    _LIT( KErrMsgLoopNestedLoop, "Loop: Nested loops are not supported " );
+    _LIT( KErrMsgLoopInvalidLoopCountParam, "Loop: No loop count value given for loop or value has invalid format" );
+    _LIT( KErrMsgLoopUnknownUnexpectedOption, "Loop: Unknown or unexpected loop option");
+    _LIT( KErrMsgLoopPasslimitInvalidValue, "Loop: No passlimit value given for loop or value has invalid format" );
+    _LIT( KErrMsgLoopPasslimitNotInRange, "Loop: Passlimit value is lower than 0 or higher than loop count" );
+    __TRACEFUNC();
+
+    if( iLoopTimes != 0 )
+        {
+        __TRACE( KError, (_L("ExecuteLoopL: Nested loop are not supported")));
+        iRunErrorMessage = KErrMsgLoopNestedLoop;
+        User::Leave( KErrNotSupported );
+        }
+
+    iLoopTimes = 0;
+    iLoopCounter = 0;
+    iPasslimitEnabled = EFalse;
+    iTimedLoop = EFalse;
+    
+    if( aItem->GetNextInt( iLoopTimes ) != KErrNone )
+        {
+        __TRACE( KError, (_L("ExecuteLoopL: No loop count value given for loop")));
+        iRunErrorMessage = KErrMsgLoopInvalidLoopCountParam;
+        User::Leave( KErrArgument );
+        }
+    __TRACE( KMessage, (_L("ExecuteLoopL: Loop for %d times" ), iLoopTimes ) );
+
+    //Check loop options
+    TPtrC option;
+    TInt ret = aItem->GetNextString(option); 
+    if(ret == KErrNone)
+        {
+        if(option.Compare(_L("msec")) == 0) //time loop option
+            {
+            iTimedLoop = ETrue;
+            iStartTime.HomeTime();
+            iExpectedLoopTime = TInt64(iLoopTimes) * TInt64(1000); //convert to micro seconds
+            __TRACE(KMessage, (_L("ExecuteLoopL: Timed loop for %d msec" ), iLoopTimes));
+            
+            ret = aItem->GetNextString(option); //Get next option
+            }
+        }
+        
+    if(ret == KErrNone)
+        {
+        if(option.Compare(_L("passlimit")) == 0) //passlimit option
+            {
+            iPasslimit = 0;
+            if( aItem->GetNextInt( iPasslimit ) != KErrNone )
+                {
+                __TRACE( KError, ( _L( "ExecuteLoopL: No passlimit value given for loop." ) ) );
+                iRunErrorMessage = KErrMsgLoopPasslimitInvalidValue;
+                User::Leave( KErrArgument );
+                }
+            __TRACE( KMessage, ( _L( "ExecuteLoopL: Passlimit set on %d" ), iPasslimit ) );
+            //Check if passlimit has valid value
+            if(iPasslimit < 0 || (iPasslimit > iLoopTimes && !iTimedLoop))
+                {
+                __TRACE( KError, ( _L( "ExecuteLoopL: Passlimit value is lower than 0 or higher than loop count." ) ) );
+                iRunErrorMessage = KErrMsgLoopPasslimitNotInRange;
+                User::Leave( KErrArgument );
+                }
+            iPasslimitEnabled = ETrue;
+
+            ret = aItem->GetNextString(option); //Get next option
+            }
+        }
+        
+    if(ret == KErrNone)
+        {
+        __TRACE( KError, ( _L( "ExecuteLoopL: Unknown or unexpected loop option [%S]" ), &option ) );
+        iRunErrorMessage = KErrMsgLoopUnknownUnexpectedOption;
+        User::Leave( KErrNotSupported );
+        }
+
+	iPassedIterationCnt = 0;
+
+    iLoopStartPos = iTestCombiner->iSectionParser->GetPosition();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestRunner
+
+     Method: ExecuteEndLoopL
+
+     Description: Handle the endloop keyword operations.
+
+     Parameters: None.
+
+     Return Values: TBool: Boolean value for indicate can testing continue.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestRunner::ExecuteEndLoopL()
+    {
+    __TRACEFUNC();
+
+    // Fail test case if there was no loop started
+    if(iTestCombiner->iLoopIsUsed == EFalse)
+        {
+        __TRACE(KError, (_L("Encountered \'endloop\' without \'loop\'. Aborting test case.")));
+        iTestCombiner->iResult = KErrGeneral;
+        iState = ERunnerError;
+        CancelTestCases();
+        return ETrue; // Test case file parsing can be continue
+        }
+
+	TBool iterationFailed = EFalse; //Has last iteration failed (at least one of test cases has failed)
+
+    // First we check is all test cases that is set to run inside the loop
+    // completed. If not completed we wait until test case completes.
+    // Is some loop executions fails that is not allowed then loop execution
+    // will be stopped and error result is given to TestCombiner
+
+    for( TInt s = 0; s < iTestCombiner->iTestCases.Count(); s++ )
+        {
+        CTestCase* testCase = (CTestCase*)iTestCombiner->iTestCases[s]; 
+        if( testCase == NULL )
+            {
+            __TRACE( KError, (_L("ExecuteEndLoopL: CTestCase object not found") ) );
+            return ETrue;
+            }
+        // Check that testCase object is allocated inside the loop
+        TBool isLoopTestCase( EFalse );
+        for( TInt p = 0; p < iTestCombiner->iLoopAllocationArray.Count(); p++ )
+            {
+            if( iTestCombiner->iLoopAllocationArray[p] == testCase )
+                {
+                isLoopTestCase = ETrue;
+                break;
+                }
+            }
+        // testCase object is allocated inside loop
+        if( isLoopTestCase )
+            {
+            // Test case is completed
+            //if( testCase->State() == CTCTestCase::ETestCaseCompleted )
+            if(testCase->IsCompletelyFinished())
+                {
+                // Check normal test result
+                if( testCase->iExpectedResultCategory == TFullTestResult:: ECaseExecuted )
+                    {
+                    // Normal completion, check result
+                    if( testCase->iResult.iTestResult.iResult != testCase->iExpectedResult )
+                        {
+                        __TRACE( KPrint, ( _L( "Test failed, expect(%d) != result(%d)"), 
+                             testCase->iExpectedResult,
+                             testCase->iResult.iTestResult.iResult ));
+                        //If no passlimit is provided behave in old way
+                        if( !iPasslimitEnabled )
+                             {
+                            // We return the first error result as aResult
+                            if( testCase->iResult.iTestResult.iResult != KErrNone )
+                                {
+                                iTestCombiner->iScriptFailed = testCase->iResult.iCaseExecutionResultCode;
+                                iTestCombiner->iScriptFailedDescription.Copy(testCase->iResult.iTestResult.iResultDes);
+                                }
+                            else
+                                {
+                                iTestCombiner->iScriptFailed = testCase->iResult.iCaseExecutionResultCode;
+                                iTestCombiner->iScriptFailedDescription.Copy(_L("Test case has not finished with expected result (in loop)."));
+                                }
+
+                            iState = ERunnerError;
+                            CancelTestCases();
+                            return ETrue; // Test case file parsing can be continue
+                            }
+                        else
+                            {
+                            // Set flag that one of test cases has failed, so whole iteration is failed
+                            iterationFailed = ETrue;
+                            }
+                        }
+                    }
+                // Abnormal completion, i.e. panic, leave, exception or timeout
+                else 
+                    {
+                    if( testCase->iResult.iCaseExecutionResultCode != testCase->iExpectedResult )
+                        {
+                        __TRACE( KPrint, ( _L( "Test failed, expect errorcode(%d) != result(%d)"), 
+                             testCase->iExpectedResult,
+                             testCase->iResult.iCaseExecutionResultCode ) );
+                        //If no passlimit is provided behave in old way
+                        if( !iPasslimitEnabled )
+                            {
+                            // We return the first error result as aResult
+                            iTestCombiner->iScriptFailed = testCase->iResult.iCaseExecutionResultCode;
+                            iTestCombiner->iScriptFailedDescription.Copy(_L("Test case has not finished with expected execution error (in loop)."));
+
+                            iState = ERunnerError;
+                            // Return error from here
+                            CancelTestCases();
+                            return ETrue; // Test case file parsing can be continue
+                            }
+                        else
+                            {
+                            // Set flag that one of test cases has failed, so whole iteration is failed
+                            iterationFailed = ETrue;
+                            }
+                        }
+
+                    // Requested testcase is completed already,
+                    // proceed testcase execution
+                    __TRACE( KMessage, (_L("Already completed")));
+                    }
+                } // End "Test case is completed"
+            // Test case is running state, set to wait the test case complete
+            else if( testCase->State() == CTCTestCase::ETestCaseRunning )
+                 {
+                 // Wait testcase to complete. If no id there should generate
+                 // id that test case complete will be handled correctly
+                 if( testCase->TestId().Length() == 0 )
+                    {
+                    TPtrC generatedTestId( _L( "stif" ) );
+                    delete testCase->iTestId;
+                    testCase->iTestId = generatedTestId.Alloc();
+                    }
+                iTestCombiner->iWaitTestCase.Copy( testCase->TestId() );
+                 // Stop testcase execution until testcase completed 
+                 iState = ERunnerWaitTestCase;
+                // Go to beginning of the endloop
+                User::LeaveIfError(
+                    iTestCombiner->iSectionParser->SetPosition( iEndLoopStartPos ));
+
+                // Testing is ongoing, test case file parsing cannot
+                // be continue. Next line will be run when some AO
+                // will be complete and allow parsing to continue
+                return EFalse; 
+                }
+            else if(testCase->State() == CTCTestCase::ETestCaseCompleted)
+                {
+                // Go to beginning of the endloop
+                User::LeaveIfError(iTestCombiner->iSectionParser->SetPosition(iEndLoopStartPos));
+
+                // Testing is ongoing, test case file parsing cannot
+                // be continue. Next line will be run when some AO
+                // will be complete and allow parsing to continue
+                return ETrue;
+                }
+            else
+                {
+                // This should newer happen
+                __TRACE( KError, (_L("ExecuteEndLoopL: Illegal branch") ) );
+                }
+            }
+        } // end for-loop
+
+    iLoopCounter++;
+    __TRACE( KMessage, (_L("ExecuteLineL: Loop executed for %d times" ), 
+            iLoopCounter ) );
+
+    //If passlimit (endurance) is enabled, we must check if any of test case in this iteration has failed
+    if( iPasslimitEnabled && !iterationFailed )
+    	{
+    	iPassedIterationCnt++;
+    	}
+
+    TTime currTime;
+    currTime.HomeTime();
+    //if( iLoopCounter < iLoopTimes )
+    if(((!iTimedLoop) && (iLoopCounter < iLoopTimes)) //Normal loop
+       ||
+       iTimedLoop && (currTime.MicroSecondsFrom(iStartTime) < iExpectedLoopTime)) //Timed loop
+        {
+        // Go to beginning of the loop
+        User::LeaveIfError(
+            iTestCombiner->iSectionParser->SetPosition( iLoopStartPos ));
+        }
+    else
+        {
+        // End looping
+        if( iPasslimitEnabled )
+        	{
+	        __TRACE(KMessage, (_L("ExecuteLoopL: Loop executed. Iterations: %d, passed: %d, expected: %d"), iLoopCounter, iPassedIterationCnt, iPasslimit));
+        	}
+
+        iLoopCounter = 0;
+        iLoopTimes = 0;
+        iLoopStartPos = 0;
+        // Loop related initializations
+        iTestCombiner->iLoopIsUsed = EFalse;
+        //--LOOPBUG-- Do not zero counter because there could be some test cases run before the loop (Stif-83)
+        //--LOOPBUG-- iTestCombiner->iRunningTests = 0;
+
+        //If passlimit was given and number of passed test is less then expected, stop execution of combiner's test case
+        if( iPasslimitEnabled && iPassedIterationCnt < iPasslimit )
+        	{
+	        __TRACE( KMessage, ( _L( "ExecuteLoopL: Loop has failed (passlimit). Finishing with KErrCompletion." ) ) );
+            iTestCombiner->iScriptFailed = KErrCompletion;
+            iTestCombiner->iScriptFailedDescription = _L("Loop has not reached passlimit requirement.");
+            iState = ERunnerError;
+            CancelTestCases();
+            return ETrue; // Test case file parsing can be continue
+        	}
+        else if( iPasslimitEnabled && iPassedIterationCnt >= iPasslimit )
+        	{
+	        __TRACE( KMessage, ( _L( "ExecuteLoopL: Loop has passed (passlimit)" ) ) );
+        	}
+        iPassedIterationCnt = 0;
+        iPasslimit = 0;
+        iPasslimitEnabled = EFalse;
+        }
+
+    // Loop time is executed, free allocations that is allocated during loop
+    TInt a( 0 );
+    TInt b( 0 );
+
+    for( b = 0; b < iTestCombiner->iLoopAllocationArray.Count(); b++ )
+        {
+        //for( a = 0; a < iTestCombiner->iLoopAllocationArray.Count(); a++ )
+        for( a = 0; a < iTestCombiner->iTestCases.Count(); a++ )
+            {
+            if( a < iTestCombiner->iTestCases.Count() && iTestCombiner->iTestCases[a] == iTestCombiner->iLoopAllocationArray[b] )
+                {
+                delete iTestCombiner->iTestCases[a];
+                iTestCombiner->iTestCases.Remove( a );
+                }
+            }
+        }
+
+    for( b = 0; b < iTestCombiner->iLoopAllocationArray.Count(); b++ )
+        {
+        //for( a = 0; a < iTestCombiner->iLoopAllocationArray.Count(); a++ )
+        for( a = 0; a < iTestCombiner->iTestModules.Count(); a++ )
+            {
+            if( a < iTestCombiner->iTestModules.Count() && iTestCombiner->iTestModules[a] == iTestCombiner->iLoopAllocationArray[b] )
+                {
+                delete iTestCombiner->iTestModules[a];
+                iTestCombiner->iTestModules.Remove( a );
+                }
+            }
+        }
+
+    for( b = 0; b < iTestCombiner->iLoopAllocationArray.Count(); b++ )
+        {
+        //for( a = 0; a < iTestCombiner->iLoopAllocationArray.Count(); a++ )
+        for( a = 0; a < iTestCombiner->iEventArray.Count(); a++ )
+            {
+            if( a < iTestCombiner->iEventArray.Count() && iTestCombiner->iEventArray[a] == iTestCombiner->iLoopAllocationArray[b] )
+                {
+                delete iTestCombiner->iEventArray[a];
+                iTestCombiner->iEventArray.Remove( a );
+                }
+            }
+        }
+    for( b = 0; b < iTestCombiner->iLoopAllocationArray.Count(); b++ )
+        {
+        //for( a = 0; a < iTestCombiner->iLoopAllocationArray.Count(); a++ )
+        for( a = 0; a < iTestCombiner->iSlaveArray.Count(); a++ )
+            {
+            if( a < iTestCombiner->iSlaveArray.Count() && iTestCombiner->iSlaveArray[a] == iTestCombiner->iLoopAllocationArray[b] )
+                {
+                delete iTestCombiner->iSlaveArray[a];
+                iTestCombiner->iSlaveArray.Remove( a );
+                }
+            }
+        }
+    for( b = 0; b < iTestCombiner->iLoopAllocationArray.Count(); b++ )
+        {
+        //for( a = 0; a < iTestCombiner->iLoopAllocationArray.Count(); a++ )
+        for( a = 0; a < iTestCombiner->iSendReceive.Count(); a++ )
+            {
+            if( a < iTestCombiner->iSendReceive.Count() && iTestCombiner->iSendReceive[a] == iTestCombiner->iLoopAllocationArray[b] )
+                {
+                delete iTestCombiner->iSendReceive[a];
+                iTestCombiner->iSendReceive.Remove( a );
+                }
+            }
+        }
+
+    // Test operation can be continued
+    return ETrue; // Test case file parsing can be continue
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CRemoteTimer class 
+    member functions. 
+
+-------------------------------------------------------------------------------
+*/
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iTestRunner->iTestCombiner->iLog
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTimer
+
+     Method: CRemoteTimer
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: CTestRunner* aTestRunner: in: Backpointer to CTestRunner
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteTimer::CRemoteTimer( CTestCombiner* aTestCombiner ): 
+    CActive(  CActive::EPriorityLow ), // Executed with lowest priority 
+    iState( ETimerIdle ),
+    iTestCombiner( aTestCombiner )
+    {
+    CActiveScheduler::Add( this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTimer
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteTimer::ConstructL()
+    {
+    
+    iTimer.CreateLocal();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTimer
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to CTestCombiner
+
+     Return Values: CRemoteTimer*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+CRemoteTimer* CRemoteTimer::NewL(  CTestCombiner* aTestCombiner )
+    {
+    
+    CRemoteTimer* self = new (ELeave) CRemoteTimer( aTestCombiner );
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTimer
+
+     Method: ~CRemoteTimer
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/     
+
+CRemoteTimer::~CRemoteTimer()
+    {
+    
+    Cancel();
+    
+    iTimer.Close();
+         
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTimer
+
+     Method: RunL
+
+     Description: Derived from CActive, handles testcase execution.
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteTimer::RunL()
+    {
+        
+    if( iState != ETimerPending )
+        {
+        User::Panic( KRemoteTimer, KErrGeneral );
+        }
+    
+    if( iStatus.Int() != KErrNone )
+        {
+        User::Panic( KRemoteTimer, KErrDied );
+        }
+    
+    iState = ETimerIdle;
+    
+    iTestCombiner->RemoteTimeout();
+    
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTimer
+
+     Method: DoCancel
+
+     Description: Derived from CActive handles the Cancel
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteTimer::DoCancel()
+    {
+    iTimer.Cancel();
+    iState = ETimerIdle;
+      
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteTimer
+
+     Method: SetTimerActive
+
+     Description: Starts timer
+
+     Parameters:   TTimeIntervalMicroSeconds32 anInterval: in: Timeout
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteTimer::SetTimerActive( TTimeIntervalMicroSeconds32 anInterval )
+    {
+    if( iState != ETimerIdle )
+        {
+        User::Panic( KRemoteTimer, KErrGeneral );
+        }
+        
+    iState = ETimerPending;
+    
+    iTimer.After( iStatus, anInterval );
+    SetActive();         
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CRemoteReceiver class 
+    member functions. 
+
+-------------------------------------------------------------------------------
+*/
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iTestCombiner->iLog
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteReceiver
+
+     Method: CRemoteReceiver
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to CTestCombiner
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRemoteReceiver::CRemoteReceiver( CTestCombiner* aTestCombiner ): 
+    CActive(  CActive::EPriorityStandard ), 
+    iState( EReceiverIdle ),
+    iTestCombiner( aTestCombiner )
+    {
+    CActiveScheduler::Add( this );
+    __TRACEFUNC();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteReceiver
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteReceiver::ConstructL()
+    {
+    
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteReceiver
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters: CTestCombiner* aTestCombiner: in: Backpointer to CTestCombiner
+
+     Return Values: CRemoteReceiver*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+CRemoteReceiver* CRemoteReceiver::NewL( CTestCombiner* aTestCombiner )
+    {
+    CRemoteReceiver* self = new (ELeave) CRemoteReceiver( aTestCombiner );
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteReceiver
+
+     Method: ~CRemoteReceiver
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/     
+
+CRemoteReceiver::~CRemoteReceiver()
+    {
+    __TRACEFUNC();
+    Cancel();
+
+         
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteReceiver
+
+     Method: StartL
+
+     Description: Activates receiving.
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteReceiver::Start()
+    {
+    __TRACEFUNC();
+    __ASSERT_ALWAYS( iState == EReceiverIdle, 
+        User::Panic( KRemoteReceiver, KErrGeneral ) );
+    iState = EReceiverPending;
+    
+    iTestCombiner->TestModuleIf().RemoteReceive( iRemoteMsg, iStatus );        
+    SetActive();
+                 
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteReceiver
+
+     Method: RunL
+
+     Description: Derived from CActive, handles testcase execution.
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: Leaves on error situations.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteReceiver::RunL()
+    {
+    __TRACEFUNC();
+    
+    __ASSERT_ALWAYS( iState == EReceiverPending, 
+        User::Panic( KRemoteReceiver, KErrGeneral ) );
+    iState = EReceiverIdle;
+    
+    iTestCombiner->ReceiveResponse( iRemoteMsg );
+                 
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CRemoteReceiver
+
+     Method: DoCancel
+
+     Description: Derived from CActive handles the Cancel
+
+     Parameters:    None.
+
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CRemoteReceiver::DoCancel()
+    {
+    __TRACEFUNC();
+    
+    iTestCombiner->TestModuleIf().RemoteReceiveCancel();
+ 
+    }
+    
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+    
+     Function: LibEntryL
+
+     Description: Polymorphic Dll Entry Point
+
+     Parameters:    None.
+
+     Return Values: CTestCombiner*: pointer to new CTestCombiner
+
+     Errors/Exceptions: Leaves if NewL leaves.
+
+     Status: Approved
+     
+-------------------------------------------------------------------------------
+*/
+
+EXPORT_C CTestCombiner* LibEntryL()
+    {
+    return CTestCombiner::NewL();
+    }
+
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/src/TestCombinerUtils.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,965 @@
+/*
+* 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: This module contains the implementation of 
+* CStartInfo class member functions.
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <StifLogger.h>
+#include "TestCombinerUtils.h"
+#include "Logging.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iLog
+
+// LOCAL CONSTANTS AND MACROS
+// None
+ 
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: CStartInfo
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStartInfo::CStartInfo():
+    iModule(0,0),
+    iCaseNum(0),
+    iExpectedResult(0),
+    iTimeout(0),
+    iModuleBuf(0),
+    iIniFileBuf(0),
+    iConfigBuf(0),
+    iTestIdBuf(0),
+    iTitleBuf(0)
+    {
+
+    iCategory = TFullTestResult::ECaseExecuted; 
+
+    };
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CStartInfo::ConstructL()
+    {    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters:    None
+     
+     Return Values: CStartInfo*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStartInfo* CStartInfo::NewL()
+    {
+
+    CStartInfo* self = new (ELeave) CStartInfo();
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }    
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: ~CStartInfo
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/     
+CStartInfo::~CStartInfo()
+    {
+
+    delete iModuleBuf;
+    delete iIniFileBuf;
+    delete iConfigBuf;
+    delete iTestIdBuf;
+    delete iTitleBuf;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetModuleNameL
+
+     Description: Set module name.
+     
+     Parameters: TDesC& aModule: in: Module name 
+                 TInt aExtLength: in: Extra length reserved for buffer
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+ void CStartInfo::SetModuleNameL( TDesC& aModule, TInt aExtLength )
+    {
+
+    iModuleBuf = HBufC::NewL( aModule.Length() + aExtLength );
+    iModule.Set( iModuleBuf->Des() );
+    iModule.Append( aModule );
+    
+    // Remove optional '.DLL' from file name
+    iModule.LowerCase();
+    TParse parse;
+    parse.Set( iModule, NULL, NULL );
+    
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        iModule.Delete ( iModule.Length()-len, len );
+        }
+
+
+    };
+            
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetIniFileL
+
+     Description: Set initialization file name name.
+     
+     Parameters: TDesC& aIni: in: Initialization file name
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetIniFileL( TDesC& aIni )
+    {
+
+    iIniFileBuf = aIni.AllocL();
+    iIniFile.Set( iIniFileBuf->Des() );
+
+    };
+            
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetConfigL
+
+     Description: Set configuration file name name.
+     
+     Parameters: TDesC& aConfig: in: Configuration file name
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetConfigL( TDesC& aConfig )
+    {
+
+    iConfigBuf = aConfig.AllocL();
+    iConfig.Set( iConfigBuf->Des() );
+
+    };
+            
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetTestIdL
+
+     Description: Set test identifier.
+     
+     Parameters: TDesC& aTestId: in: test identifier
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetTestIdL( TDesC& aTestId )
+    {
+
+    iTestIdBuf = aTestId.AllocL();
+    iTestId.Set( iTestIdBuf->Des() );
+
+    };
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: DeleteModuleName
+
+     Description: Delete module name buffer for creating new module name.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::DeleteModuleName()
+    {
+    delete iModuleBuf;
+	iModuleBuf = NULL;
+    };
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStartInfo
+
+     Method: SetTitleL
+
+     Description: Set title.
+     
+     Parameters: TDesC& aTitle: in: Test case title
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/        
+void CStartInfo::SetTitleL(TDesC& aTitle)
+    {
+
+    iTitleBuf = aTitle.AllocL();
+    iTitle.Set(iTitleBuf->Des());
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CSlaveInfo class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CSlaveInfo
+
+     Method: CSlaveInfo
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: TUint32 aMaster: in: Master id
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CSlaveInfo::CSlaveInfo( TUint32 aMaster ):
+    iState(ESlaveIdle),
+    iMasterId(aMaster),
+    iSlaveDevId(0)
+    {
+    
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CSlaveInfo
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    TDesC& aName: in: Slave name
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CSlaveInfo::ConstructL( TDesC& aName )
+    {    
+
+    iNameBuf = aName.AllocL();
+    iName.Set( iNameBuf->Des() );
+            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CSlaveInfo
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters:    TDesC& aName: in: Slave name
+                    TUint32 aMaster: in: Master id
+
+     Return Values: CSlaveInfo*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CSlaveInfo* CSlaveInfo::NewL( TDesC& aName, TUint32 aMaster )
+    {
+
+    CSlaveInfo* self = new (ELeave) CSlaveInfo( aMaster);
+     
+    CleanupStack::PushL( self );
+    self->ConstructL( aName );
+    CleanupStack::Pop();
+
+    return self;
+
+    }    
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CSlaveInfo
+
+     Method: ~CSlaveInfo
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/     
+CSlaveInfo::~CSlaveInfo()
+    {
+    
+    iEvents.ResetAndDestroy();
+    iEvents.Close();
+    delete iNameBuf;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CSlaveInfo
+
+     Method: GetEvent
+
+     Description: Returns event with given name.
+
+     Parameters:  TDesC& aEventName: in; Event name
+
+     Return Values: TEventTc: Event structure
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TEventTc* CSlaveInfo::GetEvent( TDesC& aEventName )
+    {
+    
+    TInt count = iEvents.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( iEvents[i]->Name() == aEventName )
+            {
+            return iEvents[i];
+            }
+        }
+    return NULL;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CDefinedValue class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: CDefinedValue
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CDefinedValue::CDefinedValue()
+    {
+    }
+     
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    TDesC& aName: in: Define name
+                    TDesC& aValue: in: Define value
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CDefinedValue::ConstructL( TDesC& aName, TDesC& aValue )
+    {    
+
+    iNameBuf = aName.AllocLC();
+    iName.Set( iNameBuf->Des() );
+    iValueBuf = aValue.AllocLC();
+    iValue.Set( iValueBuf->Des() );
+    CleanupStack::Pop( iValueBuf );
+    CleanupStack::Pop( iNameBuf );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters:    TDesC& aName: in: Define name
+                    TDesC& aValue: in: Define value
+
+     Return Values: CDefinedValue*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CDefinedValue* CDefinedValue::NewL( TDesC& aName, TDesC& aValue )
+    {
+
+    CDefinedValue* self = new (ELeave) CDefinedValue();
+     
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aValue );
+    CleanupStack::Pop();
+
+    return self;
+
+    }    
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: ~CDefinedValue
+
+     Description: Destructor
+     
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/     
+CDefinedValue::~CDefinedValue()
+    {
+    
+    delete iValueBuf;
+    delete iNameBuf;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: SetValueL
+
+     Description: Set new define value
+
+     Parameters:    TDesC& aValue: in: Define value
+
+     Return Values: None
+
+     Errors/Exceptions: Leaves on error.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CDefinedValue::SetValueL( TDesC& aValue )
+    {
+    delete iValueBuf;
+    iValueBuf = 0;
+    iValueBuf = aValue.AllocLC();
+    iValue.Set( iValueBuf->Des() );
+    CleanupStack::Pop( iValueBuf );
+    
+    }
+
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: Name
+
+     Description: Returns define name.
+
+     Parameters:  None
+
+     Return Values: TDesC: Define name
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TDesC& CDefinedValue::Name()
+    { 
+    return iName; 
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+     Class: CDefinedValue
+
+     Method: Value
+
+     Description: Returns define value.
+
+     Parameters:  None
+
+     Return Values: TDesC: Define value
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TDesC& CDefinedValue::Value()
+    { 
+    return iValue; 
+    }    
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TEventTc class 
+    member functions. 
+
+-------------------------------------------------------------------------------
+*/
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iLogger
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTc
+
+     Method: TEventTc
+
+     Description: Default constructor
+
+     C++ default constructor can NOT contain any code, that
+     might leave.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TEventTc::TEventTc( CStifLogger* aLogger ):
+    iReq(NULL),
+    iLogger( aLogger )
+    {
+    __TRACE( KMessage, (_L("TEventTc::TEventTc") ) );
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTc
+
+     Method: TEventTc
+
+     Description: Parametric constructor
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+TEventTc::TEventTc( TName& aEventName, CStifLogger* aLogger ):
+    iReq(NULL),
+    iLogger( aLogger )
+    {
+    SetName( aEventName );
+    SetType( EReqEvent );
+    __TRACE( KMessage, (_L("TEventTc::TEventTc %S"), &aEventName ) );
+    __TRACE( KMessage, (_L("TEvent::SetType Req") ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTc
+
+     Method: ~TEventTc
+
+     Description: Destructor
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+TEventTc::~TEventTc()
+    { 
+    __TRACE( KMessage, (_L("TEventTc::~TEventTc %S"), &Name() ) );
+    Complete( KErrNone ); 
+    }
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTc
+
+     Method: SetRequestStatus
+
+     Description: Set request status member.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+void TEventTc::SetRequestStatus( TRequestStatus* aStatus )
+    { 
+    iReq = aStatus; 
+    *iReq = KRequestPending;
+    __TRACE( KMessage, (_L("TEventTc::SetRequestStatus %S"), &Name() ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTc
+
+     Method: Complete
+
+     Description: Complete request status member.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+void TEventTc::Complete( TInt aError )
+    { 
+    if( iReq )
+        { 
+        __TRACE( KMessage, (_L("TEventTc::Complete %S"), &Name() ) );
+        User::RequestComplete(iReq, aError ); 
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTc
+
+     Method: SetEvent
+
+     Description: Set event pending.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/ 
+void TEventTc::SetEvent( TEventType aEventType )
+    {
+    __TRACE( KMessage, (_L("TEventTc::SetEvent %S, type %d"),   
+        &Name(), aEventType ) );
+
+    SetEventType( aEventType );
+    if( iReq )
+        {
+        Complete( KErrNone );
+        if( EventType() == EState )
+            {
+            __TRACE( KMessage, (_L("TEvent::SetType Set") ) );
+            SetType( ESetEvent ) ;
+            }
+        }
+    else 
+        {
+        __TRACE( KMessage, (_L("TEvent::SetType Set") ) );
+        SetType( ESetEvent ) ;
+        }
+    }
+   
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventTc
+
+     Method: WaitEvent
+
+     Description: Wait event.
+     
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void TEventTc::WaitEvent( TRequestStatus& aStatus )
+    {
+    __TRACE( KMessage, (_L("TEventTc::WaitEvent %S"), &Name() ) );
+    SetRequestStatus( &aStatus );
+    if( Type() == ESetEvent )
+        {
+        Complete( KErrNone );
+        if( EventType() == EIndication )
+            {
+            __TRACE( KMessage, (_L("TEvent::SetType Req") ) );
+            SetType( EReqEvent );
+            }
+        }
+    }
+    
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfext/testmodules/testcombiner/src/TestKeywords.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,399 @@
+/*
+* 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: This module contains the implementation of 
+* TTCKeywords class member functions.
+*
+*/
+
+
+// INCLUDE FILES
+#include "TestKeywords.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 =======================================
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTCKeywords
+
+     Method: Keyword
+
+     Description: Returns a string desrciptor corresponding to keyword number. 
+
+     Parameters:    TKeywords aKeyword: in: keyword index.
+     
+     Return Values: TPtrC8: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Approved 
+    
+-------------------------------------------------------------------------------
+*/      
+TPtrC TTCKeywords::Keyword( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"title",
+        (TText*)L"run",
+        (TText*)L"cancel",
+        (TText*)L"pause",
+        (TText*)L"resume",
+        (TText*)L"complete",
+        (TText*)L"request",
+        (TText*)L"wait",
+        (TText*)L"release",
+        (TText*)L"set",
+        (TText*)L"unset",
+        (TText*)L"timeout",
+        (TText*)L"priority",
+        (TText*)L"print",
+        (TText*)L"allocate",
+        (TText*)L"free",
+        (TText*)L"remote",
+        (TText*)L"sendreceive",
+        (TText*)L"canceliferror",
+        (TText*)L"measurement",
+        (TText*)L"loop",
+        (TText*)L"endloop",
+        (TText*)L"pausecombiner",        
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTCKeywords
+
+     Method: RunOptArg
+
+     Description: Returns a string desrciptor corresponding to run keyword 
+                  optional argument number. 
+
+     Parameters:    TRunOptArgs aArg: in: run keyword optional argument index
+     
+     Return Values: TPtrC8: argument descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Approved 
+    
+-------------------------------------------------------------------------------
+*/
+TPtrC TTCKeywords::RunOptArg( TInt aArg )
+    {
+    static TText* const runOptArgs[] =
+        {
+        (TText*)L"expect",
+        (TText*)L"testid",
+        (TText*)L"ini",
+        (TText*)L"category",
+        (TText*)L"timeout",
+        (TText*)L"title",
+        };
+
+    if( aArg >= (TInt)(sizeof( runOptArgs )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          }
+
+    TPtrC arg( runOptArgs[ aArg ] );
+    return arg;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTCKeywords
+
+     Method: PauseOptArg
+
+     Description: Returns a string desrciptor corresponding to pause keyword 
+                      optional argument number. 
+
+     Parameters:    TPauseOptArgs aArg: in: argument index.
+     
+     Return Values: TPtrC8: argument descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Approved 
+    
+-------------------------------------------------------------------------------
+*/
+TPtrC TTCKeywords::PauseOptArg( TInt aArg )
+    {
+    static TText* const pauseOptArgs[] =
+        {
+        (TText*)L"time",
+        };
+    
+    if( aArg >= (TInt)(sizeof( pauseOptArgs )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC arg( pauseOptArgs[ aArg ] ); 
+    return arg;
+    
+    }
+      
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTCKeywords
+
+     Method: EventOptArg
+
+     Description: Returns a string desrciptor corresponding to event keywords 
+                      optional argument number. 
+
+     Parameters:    TEventOptArgs aArg: in: argument index.
+     
+     Return Values: TPtrC8: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Approved 
+    
+-------------------------------------------------------------------------------
+*/              
+TPtrC TTCKeywords::EventOptArg( TInt aArg )
+    {
+    static TText* const optArgs[] =
+        {
+        (TText*)L"state",
+        };
+    
+    if( aArg >= (TInt)(sizeof( optArgs )/sizeof(TText*)) )
+        {
+        TPtrC null;
+          return null;
+          } 
+    
+    TPtrC arg( optArgs[ aArg ] ); 
+    return arg;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTCKeywords
+
+     Method: ResultCategory
+
+     Description: Returns a string desrciptor corresponding to event keywords 
+                      optional argument number. 
+
+     Parameters:    TEventOptArgs aArg: in: argument index.
+     
+     Return Values: TPtrC8: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Approved 
+    
+-------------------------------------------------------------------------------
+*/              
+TPtrC TTCKeywords::Priority( TInt aArg )
+    {
+    static TText* const priority[] =
+        {
+        (TText*)L"high",
+        (TText*)L"normal",
+        (TText*)L"low",
+        };
+        
+    if( aArg >= (TInt)(sizeof( priority )/sizeof(TText*)) )
+        {
+        TPtrC null;
+        return null;
+        } 
+    
+    TPtrC arg( priority[ aArg ] ); 
+    return arg;
+    
+    }
+   
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTCKeywords
+
+     Method: Parse
+
+     Description: Returns a keyword enum corresponding to keyword 
+                      string descriptor.
+
+     Parameters:    TPtrC aKeyword: in: keyword descriptor.
+                    KeywordFunc aFunc: in: Function pointer to keyword parser 
+     
+     Return Values: TInt: keyword index
+                    KErrNotFound: keyword not found
+
+     Errors/Exceptions: None
+     
+     Status: Proposal 
+    
+-------------------------------------------------------------------------------
+*/
+TInt TTCKeywords::Parse( TDesC& aKeyword, KeywordFunc aFunc )
+    {
+    TInt ind;
+    for( ind = 0; aFunc( ind ).Length() > 0; ind++ )
+        {
+        if( aFunc( ind ) == aKeyword )
+            {
+            return ind;
+            }
+        }
+    return KErrNotFound;
+    };
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTCKeywords
+
+     Method: ResultCategory
+
+     Description: Returns a string desrciptor corresponding to result 
+        category number. 
+
+     Parameters:    TInt aArg: in: argument index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/              
+TPtrC TTCKeywords::ResultCategory( TInt aArg )
+    {
+    static TText* const category[] =
+        {
+        (TText*)L"ongoing",
+        (TText*)L"normal",
+        (TText*)L"cancelled",
+        (TText*)L"errorfrommodule",
+        (TText*)L"leave",
+        (TText*)L"panic",
+        (TText*)L"exception",
+        (TText*)L"timeout",
+        };
+        
+    if( aArg >= (TInt)(sizeof( category )/sizeof(TText*)) )
+        {
+        TPtrC null;
+        return null;
+        } 
+    
+    TPtrC arg( category[ aArg ] ); 
+    return arg;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: TTCKeywords
+
+     Method: ResultCategory
+
+     Description: Returns a string desrciptor corresponding to event keywords 
+                      optional argument number. 
+
+     Parameters:    TEventOptArgs aArg: in: argument index.
+     
+     Return Values: TPtrC8: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Proposal 
+    
+-------------------------------------------------------------------------------
+*/              
+TFullTestResult::TCaseExecutionResult 
+    TTCKeywords::GetResultCategory( TDesC& aCategory )
+    {
+    
+    TInt ind;
+    for( ind = 0; ResultCategory( ind ).Length() > 0; ind++ )
+        {
+        if( ResultCategory( ind ) == aCategory )
+            {
+            switch( ind )
+                {
+                case TFullTestResult::ECaseExecuted:
+                case TFullTestResult::ECaseLeave:
+                case TFullTestResult::ECasePanic:
+                case TFullTestResult::ECaseException:
+                case TFullTestResult::ECaseTimeout:
+                    return (TFullTestResult::TCaseExecutionResult)ind;
+                default:
+                    break;
+                }        
+            }
+        }      
+    return TFullTestResult::ECaseOngoing;    
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/atslogger/Bmarm/ATSLOGGERU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,38 @@
+EXPORTS
+	"_._10CAtsLogger" @ 1 NONAME R3UNUSED ; CAtsLogger::~CAtsLogger(void)
+	BeginTestCaseL__10CAtsLoggerRC7TDesC16iT1T1 @ 2 NONAME ; CAtsLogger::BeginTestCaseL(TDesC16 const &, int, TDesC16 const &, TDesC16 const &)
+	BeginTestCaseReportL__10CAtsLoggerRC7TDesC16T1RC5TTimeT1T1 @ 3 NONAME ; CAtsLogger::BeginTestCaseReportL(TDesC16 const &, TDesC16 const &, TTime const &, TDesC16 const &, TDesC16 const &)
+	BeginTestCaseReportL__10CAtsLoggerRC7TDesC16iRC5TTimeT1T1 @ 4 NONAME ; CAtsLogger::BeginTestCaseReportL(TDesC16 const &, int, TTime const &, TDesC16 const &, TDesC16 const &)
+	BeginTestReportL__10CAtsLogger @ 5 NONAME R3UNUSED ; CAtsLogger::BeginTestReportL(void)
+	BeginTestSetL__10CAtsLoggerRC7TDesC16N31 @ 6 NONAME ; CAtsLogger::BeginTestSetL(TDesC16 const &, TDesC16 const &, TDesC16 const &, TDesC16 const &)
+	CloseL__10CAtsLogger @ 7 NONAME R3UNUSED ; CAtsLogger::CloseL(void)
+	CommentL__10CAtsLoggerGt11TRefByValue1ZC7TDesC16e @ 8 NONAME ; CAtsLogger::CommentL(TRefByValue<TDesC16 const>,...)
+	CommentL__10CAtsLoggerRC7TDesC16 @ 9 NONAME R3UNUSED ; CAtsLogger::CommentL(TDesC16 const &)
+	ContinueAfterRebootL__10CAtsLogger @ 10 NONAME R3UNUSED ; CAtsLogger::ContinueAfterRebootL(void)
+	DebugL__10CAtsLoggerGt11TRefByValue1ZC7TDesC16e @ 11 NONAME ; CAtsLogger::DebugL(TRefByValue<TDesC16 const>,...)
+	DebugL__10CAtsLoggerRC7TDesC16 @ 12 NONAME R3UNUSED ; CAtsLogger::DebugL(TDesC16 const &)
+	DebugOutput__10CAtsLoggerRC7TDesC16 @ 13 NONAME R3UNUSED ; CAtsLogger::DebugOutput(TDesC16 const &)
+	EndTestCaseL__10CAtsLogger @ 14 NONAME R3UNUSED ; CAtsLogger::EndTestCaseL(void)
+	EndTestReportL__10CAtsLogger @ 15 NONAME R3UNUSED ; CAtsLogger::EndTestReportL(void)
+	EndTestSetL__10CAtsLogger @ 16 NONAME R3UNUSED ; CAtsLogger::EndTestSetL(void)
+	ErrorL__10CAtsLoggerGt11TRefByValue1ZC7TDesC16e @ 17 NONAME ; CAtsLogger::ErrorL(TRefByValue<TDesC16 const>,...)
+	ErrorL__10CAtsLoggerRC7TDesC16 @ 18 NONAME R3UNUSED ; CAtsLogger::ErrorL(TDesC16 const &)
+	ErrorMessage__10CAtsLoggerRCi @ 19 NONAME R3UNUSED ; CAtsLogger::ErrorMessage(int const &)
+	IsValid__10CAtsLogger @ 20 NONAME R3UNUSED ; CAtsLogger::IsValid(void)
+	NewL__10CAtsLoggerRC7TDesC16i @ 21 NONAME R3UNUSED ; CAtsLogger::NewL(TDesC16 const &, int)
+	RawLogL__10CAtsLoggerGt11TRefByValue1ZC7TDesC16e @ 22 NONAME ; CAtsLogger::RawLogL(TRefByValue<TDesC16 const>,...)
+	RawLogL__10CAtsLoggerRC7TDesC16 @ 23 NONAME R3UNUSED ; CAtsLogger::RawLogL(TDesC16 const &)
+	SaveForRebootL__10CAtsLogger @ 24 NONAME R3UNUSED ; CAtsLogger::SaveForRebootL(void)
+	SetDebugOutput__10CAtsLoggeri @ 25 NONAME R3UNUSED ; CAtsLogger::SetDebugOutput(int)
+	SetFullReporting__10CAtsLoggeri @ 26 NONAME R3UNUSED ; CAtsLogger::SetFullReporting(int)
+	SetIndentation__10CAtsLoggeri @ 27 NONAME R3UNUSED ; CAtsLogger::SetIndentation(int)
+	SetTestCaseResultL__10CAtsLoggerRC7TDesC16 @ 28 NONAME R3UNUSED ; CAtsLogger::SetTestCaseResultL(TDesC16 const &)
+	SetTestCaseResultL__10CAtsLoggeri @ 29 NONAME R3UNUSED ; CAtsLogger::SetTestCaseResultL(int)
+	TestCaseFailed__10CAtsLogger @ 30 NONAME R3UNUSED ; CAtsLogger::TestCaseFailed(void)
+	TestCaseNa__10CAtsLogger @ 31 NONAME R3UNUSED ; CAtsLogger::TestCaseNa(void)
+	TestCasePassed__10CAtsLogger @ 32 NONAME R3UNUSED ; CAtsLogger::TestCasePassed(void)
+	TestCaseSkipped__10CAtsLogger @ 33 NONAME R3UNUSED ; CAtsLogger::TestCaseSkipped(void)
+	WarningL__10CAtsLoggerGt11TRefByValue1ZC7TDesC16e @ 34 NONAME ; CAtsLogger::WarningL(TRefByValue<TDesC16 const>,...)
+	WarningL__10CAtsLoggerRC7TDesC16 @ 35 NONAME R3UNUSED ; CAtsLogger::WarningL(TDesC16 const &)
+	BeginTestCaseL__10CAtsLoggerRC7TDesC16N31 @ 36 NONAME ; CAtsLogger::BeginTestCaseL(TDesC16 const &, TDesC16 const &, TDesC16 const &, TDesC16 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/atslogger/Bwins/ATSLOGGERU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,38 @@
+EXPORTS
+	??1CAtsLogger@@UAE@XZ @ 1 NONAME ; CAtsLogger::~CAtsLogger(void)
+	?BeginTestCaseL@CAtsLogger@@QAEXABVTDesC16@@000@Z @ 2 NONAME ; void CAtsLogger::BeginTestCaseL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?BeginTestCaseL@CAtsLogger@@QAEXABVTDesC16@@H00@Z @ 3 NONAME ; void CAtsLogger::BeginTestCaseL(class TDesC16 const &, int, class TDesC16 const &, class TDesC16 const &)
+	?BeginTestCaseReportL@CAtsLogger@@QAEXABVTDesC16@@0ABVTTime@@00@Z @ 4 NONAME ; void CAtsLogger::BeginTestCaseReportL(class TDesC16 const &, class TDesC16 const &, class TTime const &, class TDesC16 const &, class TDesC16 const &)
+	?BeginTestCaseReportL@CAtsLogger@@QAEXABVTDesC16@@HABVTTime@@00@Z @ 5 NONAME ; void CAtsLogger::BeginTestCaseReportL(class TDesC16 const &, int, class TTime const &, class TDesC16 const &, class TDesC16 const &)
+	?BeginTestReportL@CAtsLogger@@QAEXXZ @ 6 NONAME ; void CAtsLogger::BeginTestReportL(void)
+	?BeginTestSetL@CAtsLogger@@QAEXABVTDesC16@@000@Z @ 7 NONAME ; void CAtsLogger::BeginTestSetL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?CloseL@CAtsLogger@@QAEXXZ @ 8 NONAME ; void CAtsLogger::CloseL(void)
+	?CommentL@CAtsLogger@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 9 NONAME ; void CAtsLogger::CommentL(class TRefByValue<class TDesC16 const >, ...)
+	?CommentL@CAtsLogger@@QAEXABVTDesC16@@@Z @ 10 NONAME ; void CAtsLogger::CommentL(class TDesC16 const &)
+	?ContinueAfterRebootL@CAtsLogger@@QAEXXZ @ 11 NONAME ; void CAtsLogger::ContinueAfterRebootL(void)
+	?DebugL@CAtsLogger@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 12 NONAME ; void CAtsLogger::DebugL(class TRefByValue<class TDesC16 const >, ...)
+	?DebugL@CAtsLogger@@QAEXABVTDesC16@@@Z @ 13 NONAME ; void CAtsLogger::DebugL(class TDesC16 const &)
+	?DebugOutput@CAtsLogger@@QAEXABVTDesC16@@@Z @ 14 NONAME ; void CAtsLogger::DebugOutput(class TDesC16 const &)
+	?EndTestCaseL@CAtsLogger@@QAEXXZ @ 15 NONAME ; void CAtsLogger::EndTestCaseL(void)
+	?EndTestReportL@CAtsLogger@@QAEXXZ @ 16 NONAME ; void CAtsLogger::EndTestReportL(void)
+	?EndTestSetL@CAtsLogger@@QAEXXZ @ 17 NONAME ; void CAtsLogger::EndTestSetL(void)
+	?ErrorL@CAtsLogger@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 18 NONAME ; void CAtsLogger::ErrorL(class TRefByValue<class TDesC16 const >, ...)
+	?ErrorL@CAtsLogger@@QAEXABVTDesC16@@@Z @ 19 NONAME ; void CAtsLogger::ErrorL(class TDesC16 const &)
+	?ErrorMessage@CAtsLogger@@SA?BVTPtrC16@@ABH@Z @ 20 NONAME ; class TPtrC16 const CAtsLogger::ErrorMessage(int const &)
+	?IsValid@CAtsLogger@@QAEHXZ @ 21 NONAME ; int CAtsLogger::IsValid(void)
+	?NewL@CAtsLogger@@SAPAV1@ABVTDesC16@@H@Z @ 22 NONAME ; class CAtsLogger * CAtsLogger::NewL(class TDesC16 const &, int)
+	?RawLogL@CAtsLogger@@QAAHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 23 NONAME ; int CAtsLogger::RawLogL(class TRefByValue<class TDesC16 const >, ...)
+	?RawLogL@CAtsLogger@@QAEHABVTDesC16@@@Z @ 24 NONAME ; int CAtsLogger::RawLogL(class TDesC16 const &)
+	?SaveForRebootL@CAtsLogger@@QAEXXZ @ 25 NONAME ; void CAtsLogger::SaveForRebootL(void)
+	?SetDebugOutput@CAtsLogger@@QAEXH@Z @ 26 NONAME ; void CAtsLogger::SetDebugOutput(int)
+	?SetFullReporting@CAtsLogger@@QAEXH@Z @ 27 NONAME ; void CAtsLogger::SetFullReporting(int)
+	?SetIndentation@CAtsLogger@@QAEXH@Z @ 28 NONAME ; void CAtsLogger::SetIndentation(int)
+	?SetTestCaseResultL@CAtsLogger@@QAEXABVTDesC16@@@Z @ 29 NONAME ; void CAtsLogger::SetTestCaseResultL(class TDesC16 const &)
+	?SetTestCaseResultL@CAtsLogger@@QAEXH@Z @ 30 NONAME ; void CAtsLogger::SetTestCaseResultL(int)
+	?TestCaseFailed@CAtsLogger@@QAEXXZ @ 31 NONAME ; void CAtsLogger::TestCaseFailed(void)
+	?TestCaseNa@CAtsLogger@@QAEXXZ @ 32 NONAME ; void CAtsLogger::TestCaseNa(void)
+	?TestCasePassed@CAtsLogger@@QAEXXZ @ 33 NONAME ; void CAtsLogger::TestCasePassed(void)
+	?TestCaseSkipped@CAtsLogger@@QAEXXZ @ 34 NONAME ; void CAtsLogger::TestCaseSkipped(void)
+	?WarningL@CAtsLogger@@QAAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 35 NONAME ; void CAtsLogger::WarningL(class TRefByValue<class TDesC16 const >, ...)
+	?WarningL@CAtsLogger@@QAEXABVTDesC16@@@Z @ 36 NONAME ; void CAtsLogger::WarningL(class TDesC16 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/atslogger/eabi/atsloggeru.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,42 @@
+EXPORTS
+	_ZN10CAtsLogger10TestCaseNaEv @ 1 NONAME
+	_ZN10CAtsLogger11DebugOutputERK7TDesC16 @ 2 NONAME
+	_ZN10CAtsLogger11EndTestSetLEv @ 3 NONAME
+	_ZN10CAtsLogger12EndTestCaseLEv @ 4 NONAME
+	_ZN10CAtsLogger12ErrorMessageERKi @ 5 NONAME
+	_ZN10CAtsLogger13BeginTestSetLERK7TDesC16S2_S2_S2_ @ 6 NONAME
+	_ZN10CAtsLogger14BeginTestCaseLERK7TDesC16S2_S2_S2_ @ 7 NONAME
+	_ZN10CAtsLogger14BeginTestCaseLERK7TDesC16iS2_S2_ @ 8 NONAME
+	_ZN10CAtsLogger14EndTestReportLEv @ 9 NONAME
+	_ZN10CAtsLogger14SaveForRebootLEv @ 10 NONAME
+	_ZN10CAtsLogger14SetDebugOutputEi @ 11 NONAME
+	_ZN10CAtsLogger14SetIndentationEi @ 12 NONAME
+	_ZN10CAtsLogger14TestCaseFailedEv @ 13 NONAME
+	_ZN10CAtsLogger14TestCasePassedEv @ 14 NONAME
+	_ZN10CAtsLogger15TestCaseSkippedEv @ 15 NONAME
+	_ZN10CAtsLogger16BeginTestReportLEv @ 16 NONAME
+	_ZN10CAtsLogger16SetFullReportingEi @ 17 NONAME
+	_ZN10CAtsLogger18SetTestCaseResultLERK7TDesC16 @ 18 NONAME
+	_ZN10CAtsLogger18SetTestCaseResultLEi @ 19 NONAME
+	_ZN10CAtsLogger20BeginTestCaseReportLERK7TDesC16S2_RK5TTimeS2_S2_ @ 20 NONAME
+	_ZN10CAtsLogger20BeginTestCaseReportLERK7TDesC16iRK5TTimeS2_S2_ @ 21 NONAME
+	_ZN10CAtsLogger20ContinueAfterRebootLEv @ 22 NONAME
+	_ZN10CAtsLogger4NewLERK7TDesC16i @ 23 NONAME
+	_ZN10CAtsLogger6CloseLEv @ 24 NONAME
+	_ZN10CAtsLogger6DebugLE11TRefByValueIK7TDesC16Ez @ 25 NONAME
+	_ZN10CAtsLogger6DebugLERK7TDesC16 @ 26 NONAME
+	_ZN10CAtsLogger6ErrorLE11TRefByValueIK7TDesC16Ez @ 27 NONAME
+	_ZN10CAtsLogger6ErrorLERK7TDesC16 @ 28 NONAME
+	_ZN10CAtsLogger7IsValidEv @ 29 NONAME
+	_ZN10CAtsLogger7RawLogLE11TRefByValueIK7TDesC16Ez @ 30 NONAME
+	_ZN10CAtsLogger7RawLogLERK7TDesC16 @ 31 NONAME
+	_ZN10CAtsLogger8CommentLE11TRefByValueIK7TDesC16Ez @ 32 NONAME
+	_ZN10CAtsLogger8CommentLERK7TDesC16 @ 33 NONAME
+	_ZN10CAtsLogger8WarningLE11TRefByValueIK7TDesC16Ez @ 34 NONAME
+	_ZN10CAtsLogger8WarningLERK7TDesC16 @ 35 NONAME
+	_ZN10CAtsLoggerD0Ev @ 36 NONAME
+	_ZN10CAtsLoggerD1Ev @ 37 NONAME
+	_ZN10CAtsLoggerD2Ev @ 38 NONAME
+	_ZTI10CAtsLogger @ 39 NONAME ; #<TI>#
+	_ZTV10CAtsLogger @ 40 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/atslogger/group/atsloggerdll.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -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: MMP file for STIF Test Framework's atslogger module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET         atslogger.dll
+TARGETTYPE     dll
+
+UID            0x101FE86F
+
+CAPABILITY	ALL -TCB
+VENDORID 	0x101FB657
+SECUREID        0x102073D9
+
+USERINCLUDE    ../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH	   ../src
+
+SOURCE         atslogger.cpp
+
+LIBRARY        euser.lib 
+LIBRARY        efsrv.lib
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/atslogger/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for ATS Logger.
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	atsloggerdll.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/atslogger/src/atslogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1117 @@
+/*
+* 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: This module contains the implementation of 
+* CAtsLogger class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "atslogger.h"
+
+CAtsLogger::CAtsLogger(const TDesC& aName) :
+	iReportStage(EUninitialized),
+	iName(aName),
+	iIndentLevel(0),
+	iRawLog(EFalse),
+	iXmlLog(EFalse),
+	iValid(EFalse),
+	iLineFeedDone(EFalse),
+	iInTestCase(EFalse),
+	iClosed(EFalse),
+	iFullReportingMode(ETrue),
+	iDoDebugOutput(EFalse),
+	iDoIndentation(ETrue)
+	{
+	}
+
+void CAtsLogger::ConstructL( TBool aAfterReboot )
+	{
+	TChar xmlDrive;
+	iXmlLog = CheckDirectoryL(KAtsLoggerXmlDirectory, xmlDrive);
+	TChar rawDrive;
+	iRawLog = CheckDirectoryL(KAtsLoggerRawDirectory, rawDrive);
+	if (iXmlLog)
+		{
+		iXmlLogFileName.Copy(_L("?:"));		
+		iXmlLogFileName.Append(KAtsLoggerXmlDirectory);
+		iXmlLogFileName.Append(iName);
+		iXmlLogFileName.Append(KAtsLoggerXmlSuffix);
+		iXmlLogFileName[0] = (TUint8)xmlDrive;
+		if( aAfterReboot )
+		    {
+		    User::LeaveIfError(OpenExistingFileL(iXmlLogFileName));
+		    }
+		else
+		    {
+		    User::LeaveIfError(ReplaceFileL(iXmlLogFileName));
+		    }
+		iValid = ETrue;
+		}
+	else
+		{
+		iValid = EFalse;
+		}
+	if (iRawLog)
+		{
+		iRawLogFileName.Copy(_L("?:"));		
+		iRawLogFileName.Append(KAtsLoggerRawDirectory);
+		iRawLogFileName.Append(iName);
+		iRawLogFileName.Append(KAtsLoggerRawSuffix);
+		iRawLogFileName[0] = (TUint8)rawDrive;
+		if( aAfterReboot )
+		    {
+		    User::LeaveIfError(OpenExistingFileL(iRawLogFileName));
+		    }
+		else
+		    {
+		    User::LeaveIfError(ReplaceFileL(iRawLogFileName));
+		    }
+		}
+	iXmlBuffer = CBufSeg::NewL(KAtsLoggerBufferSegmentGranularity);
+	iXmlBufferLength = 0;
+	}
+
+
+TBool CAtsLogger::CheckDirectoryL(const TDesC& aDirName, TChar& aDrive)
+	{
+	User::LeaveIfError(iRfs.Connect());
+	TDriveList driveList;
+	iRfs.DriveList(driveList);
+	TBool dirFound = EFalse;
+	TFileName dir;
+	for (TInt i = 0; i < driveList.Length() && !dirFound; i++)
+		{
+		TChar drive;
+		if (driveList[i] != 0)
+			{
+			iRfs.DriveToChar(i, drive);
+			dir.Copy(_L("?:"));
+			dir.Append(aDirName);
+			dir[0] = (TUint8)drive;
+			RDir rDir;
+			TInt error = rDir.Open(iRfs, dir, KEntryAttNormal);
+			if (error == KErrNone)
+				{
+				dirFound = ETrue;
+				aDrive = drive;
+				}
+			else 
+				{
+				dirFound = EFalse;
+				aDrive = '?';
+				}
+			rDir.Close();
+			}
+		}
+	iRfs.Close();
+	return dirFound;
+	}
+
+TInt CAtsLogger::ReplaceFileL(const TDesC& aFileName)
+	{
+	User::LeaveIfError(iRfs.Connect());
+	RFile file;
+	TInt err = file.Replace(iRfs, aFileName, EFileWrite | EFileShareAny);
+	file.Close();
+	iRfs.Close();
+	return err;
+	}
+	
+TInt CAtsLogger::OpenExistingFileL(const TDesC& aFileName)
+	{
+	User::LeaveIfError(iRfs.Connect());
+	RFile file;
+	TInt err = file.Open(iRfs, aFileName, EFileWrite | EFileShareAny);
+	file.Close();
+	iRfs.Close();
+	return err;
+	}
+	
+EXPORT_C CAtsLogger::~CAtsLogger()
+	{
+	if (!iClosed)
+		{
+		CloseL();
+		}
+	if (iXmlBuffer)
+		{
+		delete iXmlBuffer;
+		iXmlBuffer = NULL;
+		}
+	}
+
+EXPORT_C void CAtsLogger::CloseL()
+	{
+	if (iClosed)
+		{
+		return;
+		}
+	User::LeaveIfError(iRfs.Connect());
+	if (iXmlLog)
+		{
+		RFile file;
+		TInt err = file.Open(iRfs, iXmlLogFileName, EFileWrite | EFileShareAny);
+		if (err == KErrNone)
+			{
+			TInt fileSize = 0;
+			file.Size(fileSize);
+			file.Close();
+			if (fileSize == 0)
+				{
+				iRfs.Delete(iXmlLogFileName);
+				}
+			}
+		}
+	if (iRawLog)
+		{
+		RFile file;
+		TInt err = file.Open(iRfs, iRawLogFileName, EFileWrite | EFileShareAny);
+		if (err == KErrNone)
+			{
+			TInt fileSize = 0;
+			file.Size(fileSize);
+			file.Close();
+			if (fileSize == 0)
+				{
+				iRfs.Delete(iRawLogFileName);
+				}
+			}
+		}
+	iRfs.Close();
+	iClosed = ETrue;
+	}
+
+
+EXPORT_C CAtsLogger* CAtsLogger::NewL( const TDesC& aName,
+                                       TBool aAfterReboot )
+	{
+	__ASSERT_ALWAYS(aName.Length() > 0, User::Leave(KErrBadName));
+	RFs rfs;
+	User::LeaveIfError(rfs.Connect());
+	__ASSERT_ALWAYS(rfs.IsValidName(aName), User::Leave(KErrBadName));
+	rfs.Close();
+	CAtsLogger* self = new (ELeave) CAtsLogger(aName);
+	CleanupStack::PushL(self);
+	self->ConstructL( aAfterReboot );
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+EXPORT_C TBool CAtsLogger::IsValid()
+	{
+	return iValid;
+	}
+
+EXPORT_C void CAtsLogger::BeginTestReportL()
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(EBeginTestReport))
+			{
+			User::Leave(EBeginTestReport);
+			}
+		iReportStage = EBeginTestReport;
+		OpenTagIndentL(KAtsLoggerTagTestReport());
+		}
+	else
+		{
+		//iTestSet.iStartTime = TTime();
+		iTestSet.iStartTime.HomeTime();
+		}
+	}
+
+EXPORT_C void CAtsLogger::EndTestReportL()
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(EEndTestReport))
+			{
+			User::Leave(EEndTestReport);
+			}
+		iReportStage = EEndTestReport;
+		CloseTagIndentL(KAtsLoggerTagTestReport());
+		}
+	if (iDoDebugOutput)
+		{
+		WriteBufferToDebugPortL(iXmlBuffer);
+		}
+	if (iXmlLog && !iInTestCase && iXmlBufferLength > 0)
+		{
+		WriteBufferToFileL(iXmlBuffer, iXmlLogFileName);
+		}
+	iXmlBuffer->Reset();
+	iXmlBufferLength = 0;
+	}
+
+EXPORT_C void CAtsLogger::BeginTestSetL(const TDesC& aFactory,
+									    const TDesC& aComponent,
+									    const TDesC& aVersion,
+									    const TDesC& aDescription)
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(EBeginTestSet))
+			{
+			User::Leave(EBeginTestSet);
+			}
+		iReportStage = EBeginTestSet;
+		//iTestSet.iStartTime = TTime();
+		iTestSet.iStartTime.HomeTime();
+		TDateTime date(iTestSet.iStartTime.DateTime());
+		OpenTagIndentL(KAtsLoggerTagTestSet());
+		OpenTagIndentL(KAtsLoggerTagTestSetInit());
+		TagL(KAtsLoggerTagDescription(), aDescription);
+		HBufC* stamp;
+		stamp = FormatDateLC(date);
+		TagL(KAtsLoggerTagDate(), *stamp);
+		CleanupStack::PopAndDestroy(stamp);
+		TagL(KAtsLoggerTagFactory(), aFactory);
+		OpenTagIndentL(KAtsLoggerTagComponent());
+		TagL(KAtsLoggerTagName(), aComponent);
+		TagL(KAtsLoggerTagVersion(), aVersion);
+		CloseTagIndentL(KAtsLoggerTagComponent());
+		CloseTagIndentL(KAtsLoggerTagTestSetInit());
+		}
+	}
+
+EXPORT_C void CAtsLogger::SaveForRebootL()
+	{
+	if (iFullReportingMode)
+		{
+		iReportStage = EEndTestReport;
+		}
+	if (iDoDebugOutput)
+		{
+		WriteBufferToDebugPortL(iXmlBuffer);
+		}
+	if (iXmlLog && !iInTestCase && iXmlBufferLength > 0)
+		{
+		WriteBufferToFileL(iXmlBuffer, iXmlLogFileName);
+		}
+	iXmlBuffer->Reset();
+	iXmlBufferLength = 0;
+	}
+
+EXPORT_C void CAtsLogger::ContinueAfterRebootL()
+	{
+	if (iFullReportingMode)
+		{
+		iIndentLevel += 2;
+		iLineFeedDone = ETrue;
+		iReportStage = EBeginTestSet;
+		//iTestSet.iStartTime = TTime();
+		iTestSet.iStartTime.HomeTime();
+		}
+	}
+
+
+EXPORT_C void CAtsLogger::EndTestSetL()
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(EEndTestSet))
+			{
+			User::Leave(EEndTestSet);
+			}
+		iReportStage = EEndTestSet;
+		OpenTagIndentL(KAtsLoggerTagTestSetResult());
+		TTime current;
+		current.HomeTime();
+		HBufC* time;
+		time = FormatTimeLC(current.MicroSecondsFrom(iTestSet.iStartTime));
+		TagL(KAtsLoggerTagRunTime(), *time);
+		CleanupStack::PopAndDestroy(time);
+		CloseTagIndentL(KAtsLoggerTagTestSetResult());
+		CloseTagIndentL(KAtsLoggerTagTestSet());
+		}
+	}
+
+EXPORT_C void CAtsLogger::BeginTestCaseL(const TDesC& aId,
+									     const TDesC& aExpected,
+								    	 const TDesC& aInfo,
+										 const TDesC& aVersion)
+	{
+	TTime current;
+	current.HomeTime();	
+	BeginTestCaseReportL( aId, aExpected, current, aInfo, aVersion );
+	}
+
+EXPORT_C void CAtsLogger::BeginTestCaseL(const TDesC& aId,
+										 const TInt aExpected,
+										 const TDesC& aInfo,
+										 const TDesC& aVersion)
+	{
+		TBuf<16> res;
+		res.Format(_L("%d"), aExpected);
+		BeginTestCaseL(aId, res, aInfo, aVersion);
+	}
+	
+EXPORT_C void CAtsLogger::BeginTestCaseReportL( const TDesC& aId,
+										        const TDesC& aExpected,
+										        const TTime& aStartTime,
+										        const TDesC& aInfo,
+										        const TDesC& aVersion )
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(EBeginTestCase))
+			{
+			User::Leave(EBeginTestCase);
+			}
+		iReportStage = EBeginTestCase;
+	}		
+	
+	iTestCase.iStartTime = aStartTime;
+	
+	HBufC* time;
+	time = FormatTimeLC(aStartTime.MicroSecondsFrom(iTestSet.iStartTime));
+	OpenTagIndentL(KAtsLoggerTagTestCase(), KAtsLoggerTimeStamp(), *time);
+	CleanupStack::PopAndDestroy(time);
+	OpenTagIndentL(KAtsLoggerTagTestCaseInit());
+	TagL(KAtsLoggerTagVersion, aVersion);
+	TagL(KAtsLoggerTagId(), aId);
+	TagL(KAtsLoggerTagExpected(), aExpected, KAtsLoggerTagDescription(), aInfo);
+	CloseTagIndentL(KAtsLoggerTagTestCaseInit());
+	iTestCase.iStatus.Set(KAtsLoggerNa());
+	iInTestCase = ETrue;
+	}
+	
+EXPORT_C void CAtsLogger::BeginTestCaseReportL( const TDesC& aId,
+										        const TInt aExpected,
+										        const TTime& aStartTime,
+										        const TDesC& aInfo,
+										        const TDesC& aVersion )
+	{
+	TBuf<16> res;
+	res.Format(_L("%d"), aExpected);
+	BeginTestCaseReportL( aId, res, aStartTime, aInfo, aVersion );
+    }
+    
+EXPORT_C void CAtsLogger::EndTestCaseL()
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(EEndTestCase))
+			{
+			User::Leave(EEndTestCase);
+			}
+		iReportStage = EEndTestCase;
+	}
+	TTime current;
+	current.HomeTime();
+	OpenTagIndentL(KAtsLoggerTagTestCaseResult(), KAtsLoggerTagStatus(), iTestCase.iStatus);
+	if (iTestCase.iResult)
+		{
+		TagL(KAtsLoggerTagActual(), *iTestCase.iResult);
+		delete iTestCase.iResult;
+		iTestCase.iResult = NULL;
+		}
+	else
+		{
+		TagL(KAtsLoggerTagActual(), KAtsLoggerEmpty());
+		}
+	HBufC* time;
+	time = FormatTimeLC(current.MicroSecondsFrom(iTestCase.iStartTime));
+	TagL(KAtsLoggerTagRunTime(), *time);
+	CleanupStack::PopAndDestroy(time);
+	CloseTagIndentL(KAtsLoggerTagTestCaseResult());	
+	CloseTagIndentL(KAtsLoggerTagTestCase());
+	iInTestCase = EFalse;
+	if (iDoDebugOutput)
+		{
+		WriteBufferToDebugPortL(iXmlBuffer);
+		}
+	if (iXmlLog)
+		{
+		WriteBufferToFileL(iXmlBuffer, iXmlLogFileName);
+		}
+	iXmlBuffer->Reset();
+	iXmlBufferLength = 0;
+	}
+
+EXPORT_C void CAtsLogger::TestCasePassed()
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(ESetTestCaseVerdict))
+			{
+			User::Leave(ESetTestCaseVerdict);
+			}
+		iReportStage = ESetTestCaseVerdict;
+	}
+	iTestCase.iStatus.Set(KAtsLoggerPassed());
+	}
+
+EXPORT_C void CAtsLogger::TestCaseFailed()
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(ESetTestCaseVerdict))
+			{
+			User::Leave(ESetTestCaseVerdict);
+			}
+		iReportStage = ESetTestCaseVerdict;
+	}
+	iTestCase.iStatus.Set(KAtsLoggerFailed());
+	}
+
+EXPORT_C void CAtsLogger::TestCaseNa()
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(ESetTestCaseVerdict))
+			{
+			User::Leave(ESetTestCaseVerdict);
+			}
+		iReportStage = ESetTestCaseVerdict;
+	}
+	iTestCase.iStatus.Set(KAtsLoggerNa());
+	}
+
+EXPORT_C void CAtsLogger::TestCaseSkipped()
+	{
+	if (iFullReportingMode)
+		{
+		if (!IsTransitionLegal(ESetTestCaseVerdict))
+			{
+			User::Leave(ESetTestCaseVerdict);
+			}
+		iReportStage = ESetTestCaseVerdict;
+	}
+	iTestCase.iStatus.Set(KAtsLoggerSkipped());
+	}
+
+EXPORT_C void CAtsLogger::SetTestCaseResultL(const TDesC& aResult)
+	{
+	if (iTestCase.iResult)
+		{
+		delete iTestCase.iResult;
+		iTestCase.iResult = NULL;
+		}
+	HBufC* newResult = HBufC::NewL(aResult.Length());
+	
+	CleanupStack::PushL(newResult);
+	TPtr ptr(newResult->Des());
+	ptr.Copy(aResult);
+	CleanupStack::Pop(newResult);
+	
+	iTestCase.iResult = newResult;
+	}
+
+EXPORT_C void CAtsLogger::SetTestCaseResultL(const TInt aResult)
+	{
+	if (iTestCase.iResult)
+		{
+		delete iTestCase.iResult;
+		iTestCase.iResult = NULL;
+		}
+	HBufC* newResult = HBufC::NewL(16);
+		
+	CleanupStack::PushL(newResult);
+	TPtr ptr(newResult->Des());
+	ptr.Format(_L("%d"), aResult);
+	CleanupStack::Pop(newResult);
+	
+	iTestCase.iResult = newResult;
+	}
+
+EXPORT_C void CAtsLogger::DebugL(TRefByValue<const TDesC> aFmt,...)
+	{
+	VA_LIST list;
+	VA_START(list, aFmt);
+	TBuf<0x100> buf;
+	buf.AppendFormatList(aFmt, list, NULL);
+	DebugL(buf);
+	}
+
+EXPORT_C void CAtsLogger::DebugL(const TDesC& aMsg)
+	{
+	if (iInTestCase)
+		{
+		TimeStampedMessageL(KAtsLoggerTagDebug(), aMsg);
+		}
+	else
+		{
+		CommentL(aMsg);
+		}
+	}
+
+EXPORT_C void CAtsLogger::WarningL(TRefByValue<const TDesC> aFmt,...)
+	{
+	VA_LIST list;
+	VA_START(list, aFmt);
+	TBuf<0x100> buf;
+	buf.AppendFormatList(aFmt, list, NULL);
+	WarningL(buf);
+	}
+
+EXPORT_C void CAtsLogger::WarningL(const TDesC& aMsg)
+	{
+	if (iInTestCase)
+		{
+		TimeStampedMessageL(KAtsLoggerTagWarning(), aMsg);
+		}
+	else
+		{
+		CommentL(aMsg);
+		}
+	}
+
+EXPORT_C void CAtsLogger::ErrorL(TRefByValue<const TDesC> aFmt,...)
+	{
+	VA_LIST list;
+	VA_START(list, aFmt);
+	TBuf<0x100> buf;
+	buf.AppendFormatList(aFmt, list, NULL);
+	ErrorL(buf);
+	}
+
+EXPORT_C void CAtsLogger::ErrorL(const TDesC& aMsg)
+	{
+	if (iInTestCase)
+		{
+		TimeStampedMessageL(KAtsLoggerTagError(), aMsg);
+		}
+	else
+		{
+		CommentL(aMsg);
+		}
+	}
+
+EXPORT_C void CAtsLogger::CommentL(TRefByValue<const TDesC> aFmt,...)
+	{
+	VA_LIST list;
+	VA_START(list, aFmt);
+	TBuf<0x100> buf;
+	buf.AppendFormatList(aFmt, list, NULL);
+	CommentL(buf);
+	}
+
+EXPORT_C void CAtsLogger::CommentL(const TDesC& aMsg)
+	{
+	WriteL(KAtsLoggerCommentOpen());
+	WriteL(aMsg);
+	WriteL(KAtsLoggerCommentClose());
+	LineFeedL();
+	}
+
+EXPORT_C TInt CAtsLogger::RawLogL(TRefByValue<const TDesC> aFmt,...)
+	{
+	VA_LIST list;
+	VA_START(list, aFmt);
+	TBuf<0x100> buf;
+	buf.AppendFormatList(aFmt, list, NULL);
+	RawLogL(buf);
+	return KErrNone;
+	}
+
+EXPORT_C TInt CAtsLogger::RawLogL(const TDesC& aMsg)
+	{
+	if (iRawLog)
+		{
+		TBool lfStatus = iLineFeedDone;
+		iLineFeedDone = EFalse;
+		User::LeaveIfError(iRfs.Connect());
+		RFile file;
+		TInt err = file.Open(iRfs, iRawLogFileName, EFileWrite | EFileShareAny);
+		if (err == KErrNotFound)
+			{
+			User::LeaveIfError(file.Create(iRfs, iRawLogFileName, EFileWrite | EFileShareAny));
+			}
+		else
+			{
+			TInt pos = 0;
+			file.Seek(ESeekEnd, pos);
+			}
+		WriteL(aMsg, file);
+		file.Close();
+		iRfs.Close();
+		iLineFeedDone = lfStatus;
+		}
+	return KErrNone;
+	}
+
+EXPORT_C void CAtsLogger::DebugOutput(const TDesC& aMsg)
+	{
+	RDebug::Print(_L("%S"), &aMsg);
+	}
+
+EXPORT_C void CAtsLogger::SetFullReporting(TBool aFlag)
+	{
+	iFullReportingMode = aFlag;
+	}
+
+EXPORT_C void CAtsLogger::SetDebugOutput(TBool aFlag)
+	{
+	iDoDebugOutput = aFlag;
+	}
+
+EXPORT_C void CAtsLogger::SetIndentation(TBool aFlag)
+	{
+	iDoIndentation = aFlag;
+	}
+
+HBufC* CAtsLogger::FormatDateLC(TDateTime aDate)
+	{
+	HBufC* buf = HBufC::NewL(19);
+	CleanupStack::PushL(buf);
+	TPtr ptr(buf->Des());
+	ptr.Format(_L("%d-%02d-%02d %02d:%02d:%02d"), aDate.Year(),
+		                                          aDate.Month(),
+												  aDate.Day(),
+												  aDate.Hour(),
+												  aDate.Minute(),
+												  aDate.Second());	
+	return buf;
+	}
+
+HBufC* CAtsLogger::FormatTimeLC(TTimeIntervalMicroSeconds aTime)
+	{	
+    //@js<--remove--> TInt seconds1 = (aTime.Int64() / TInt64(1000000)).GetTInt();
+    TInt seconds = (I64INT(aTime.Int64()) / I64INT(TInt64(1000000)));
+	
+	TInt hours = seconds / (60*60);
+	TInt minutes = (seconds / 60) % 60;
+	seconds = (seconds) % 60;
+	HBufC* buf = HBufC::NewL(10);
+	CleanupStack::PushL(buf);
+	TPtr ptr(buf->Des());
+	ptr.Format(_L("%02d:%02d:%02d"), hours, minutes, seconds);
+	return buf;
+	}
+
+	
+void CAtsLogger::TimeStampedMessageL(const TDesC& aTag, const TDesC& aMsg)
+	{
+	TTime current;
+	current.HomeTime();
+	HBufC* time;
+	time = FormatTimeLC(current.MicroSecondsFrom(iTestSet.iStartTime));
+	TagL(aTag, aMsg, KAtsLoggerTimeStamp(), *time);
+	CleanupStack::PopAndDestroy(time);
+	}
+
+void CAtsLogger::OpenTagL(const TDesC& aTag)
+	{
+	WriteL(KAtsLoggerTagOpen());
+	WriteL(aTag);
+	WriteL(KAtsLoggerTagPost());
+	}
+
+void CAtsLogger::OpenTagL(const TDesC& aTag,
+						  const TDesC& aAttribute,
+						  const TDesC& aValue)
+	{
+	WriteL(KAtsLoggerTagOpen());
+	WriteL(aTag);
+	WriteL(KAtsLoggerSpace());
+	WriteL(aAttribute);
+	WriteL(KAtsLoggerAttr());
+	HBufC* encoded;
+	encoded = EncodeLC(aValue);
+	WriteL(encoded->Des());
+	CleanupStack::PopAndDestroy(encoded);
+	WriteL(KAtsLoggerAttrClose());
+	}
+
+void CAtsLogger::OpenTagIndentL(const TDesC& aTag)
+	{
+	OpenTagL(aTag);
+	LineFeedL();
+	iIndentLevel++;
+	}
+
+void CAtsLogger::OpenTagIndentL(const TDesC& aTag,
+							    const TDesC& aAttribute,
+							    const TDesC& aValue)
+	{
+	OpenTagL(aTag, aAttribute, aValue);
+	LineFeedL();
+	iIndentLevel++;
+	}
+
+void CAtsLogger::CloseTagL(const TDesC& aTag)
+	{
+	WriteL(KAtsLoggerTagClose());
+	WriteL(aTag);
+	WriteL(KAtsLoggerTagPost());
+	}
+
+void CAtsLogger::CloseTagIndentL(const TDesC& aTag)
+	{
+	iIndentLevel--;
+	CloseTagL(aTag);
+	LineFeedL();
+	}
+
+void CAtsLogger::TagL(const TDesC& aTag, const TDesC& aMsg)
+	{
+	OpenTagL(aTag);
+	HBufC* encoded;
+	encoded = EncodeLC(aMsg);
+	WriteL(encoded->Des());
+	CleanupStack::PopAndDestroy(encoded);
+	CloseTagL(aTag);
+	LineFeedL();
+	}
+
+void CAtsLogger::TagL(const TDesC& aTag,
+					  const TDesC& aMsg,
+					  const TDesC& aAttribute,
+					  const TDesC& aValue)
+	{
+	OpenTagL(aTag, aAttribute, aValue);
+	HBufC* encoded;
+	encoded = EncodeLC(aMsg);
+	WriteL(encoded->Des());
+	CleanupStack::PopAndDestroy(encoded);
+	CloseTagL(aTag);
+	LineFeedL();
+	}
+
+void CAtsLogger::LineFeedL()
+	{
+	WriteL(KAtsLoggerLf());
+	iLineFeedDone = ETrue;
+	}
+
+HBufC* CAtsLogger::EncodeLC(const TDesC& aMsg)
+	{
+	TInt length = aMsg.Length();
+	HBufC* buf = HBufC::NewL(length);
+	*buf = aMsg;
+	TPtr ptr(buf->Des());
+	TInt index = 0;
+	TInt offset = 0;
+	while (index < length)
+		{
+		TPtrC16 p;
+		switch (ptr[index + offset])
+			{
+			case '"':
+				p.Set(KAtsLoggerQuot().Ptr());
+				break;
+			case '\'':
+				p.Set(KAtsLoggerApos().Ptr());
+				break;
+			case '<':
+				p.Set(KAtsLoggerLt().Ptr());
+				break;
+			case '>':
+				p.Set(KAtsLoggerGt().Ptr());
+				break;
+			case '&':
+				p.Set(KAtsLoggerAmp().Ptr());
+				break;
+			default:
+				p.Set(KAtsLoggerEmpty().Ptr());
+				break;
+			}
+		if (p.Length() > 0)
+			{
+			TInt len = ptr.Length() + p.Length();
+			HBufC* tmp = buf;
+			CleanupStack::PushL(tmp);
+			buf = buf->ReAllocL(len);
+			CleanupStack::Pop(tmp);
+			tmp = NULL;
+			ptr.Set(buf->Des());
+			ptr.Replace(index + offset, 1, p);
+
+			// offset has to be decrement by one because
+			// we have replaced a char and index remains the
+			// same.
+			offset += p.Length() - 1;
+			}
+		else
+			{
+			index++;
+			}
+		}
+	CleanupStack::PushL(buf);
+	return buf;
+	}
+
+TInt CAtsLogger::BufferL(CBufBase* aBufBase, TInt& aLength, const TDesC& aBuf)
+	{
+	TInt length = aBuf.Length();
+	if (iDoIndentation && iLineFeedDone)
+		{
+		iLineFeedDone = EFalse;
+		TInt maxIndentLength = iIndentLevel * KAtsLoggerIndent8().Length();
+		TInt indentLength = KAtsLoggerIndent8().Length();
+		aBufBase->ExpandL(aLength, length + maxIndentLength);
+		for (TInt i = 0; i < iIndentLevel; i++)
+			{
+			aBufBase->Write(aLength + (i * indentLength), KAtsLoggerIndent8());
+			}
+		aLength += maxIndentLength;
+		}
+	else
+		{
+		aBufBase->ExpandL(aLength, length);
+		}
+	HBufC8* hBufC8;
+	hBufC8 = HBufC8::NewL(aBuf.Length());
+	CleanupStack::PushL(hBufC8);
+	TPtr8 ptr8(hBufC8->Des());
+	for (TInt i = 0; i < length; i++)
+		{
+		if (aBuf[i] != '\n' && aBuf[i] != '\r')
+			{
+			ptr8.Append((TInt8)(aBuf[i] & 0xff));
+			}
+		else
+			{
+			ptr8.Append((TInt8)('\n'));
+			}
+		}
+	aBufBase->Write(aLength, *hBufC8);
+	CleanupStack::PopAndDestroy(hBufC8);
+	aLength += length;
+	return KErrNone;
+	}
+
+TInt CAtsLogger::WriteBufferToFileL(CBufBase* aCBufBase, const TDesC& aFileName)
+	{
+	User::LeaveIfError(iRfs.Connect());
+	RFile file;
+	TInt err = file.Open(iRfs, aFileName, EFileWrite | EFileShareAny);
+	if (err == KErrNotFound)
+		{
+		User::LeaveIfError(file.Create(iRfs, aFileName, EFileWrite | EFileShareAny));
+		}
+	else
+		{
+		TInt pos = 0;
+		file.Seek(ESeekEnd, pos);
+		}
+	TInt i = 0;
+	TPtrC8 ptr = aCBufBase->Ptr(i);
+	while (ptr.Length() > 0)
+		{
+		file.Write(ptr, ptr.Length());
+		i += ptr.Length();
+		ptr.Set(aCBufBase->Ptr(i));
+		}
+	file.Close();
+	iRfs.Close();
+	return KErrNone;
+	}	
+
+TInt CAtsLogger::WriteBufferToDebugPortL(CBufBase* aCBufBase)
+	{
+	TInt i = 0;
+	TPtrC8 ptr = aCBufBase->Ptr(i);
+	while (ptr.Length() > 0)
+		{
+		TBuf<KAtsLoggerBufferSegmentGranularity> debug;
+		for (TInt j = 0; j < ptr.Length(); j++)
+			{
+			debug.AppendFormat(_L("%c"), ptr[j]);
+			}
+		DebugOutput(debug);
+		i += ptr.Length();
+		ptr.Set(aCBufBase->Ptr(i));
+		}
+	return KErrNone;
+	}	
+
+void CAtsLogger::WriteL(const TDesC& aMsg)
+	{
+	if (iXmlLog || iDoDebugOutput)
+		{
+		BufferL(iXmlBuffer, iXmlBufferLength, aMsg);
+		iXmlBuffer->Compress();
+		}
+	}
+
+void CAtsLogger::WriteL(const TDesC& aMsg, RFile& aFile)
+	{
+	if (iLineFeedDone)
+		{
+		iLineFeedDone = EFalse;
+		for (TInt i = 0; i < iIndentLevel; i++)
+			{
+			WriteL(KAtsLoggerIndent(), aFile);
+			}
+		}
+	HBufC8* hBufC8 = HBufC8::NewL(aMsg.Length());
+	CleanupStack::PushL(hBufC8);
+	TPtr8 ptr8(hBufC8->Des());
+	TInt length = aMsg.Length();
+	for (TInt i = 0; i < length; i++)
+		{
+		if (aMsg[i] != '\n' && aMsg[i] != '\r')
+			{
+			ptr8.Append((TInt8)(aMsg[i] & 0xff));
+			}
+		else
+			{
+			ptr8.Append((TInt8)('\n'));
+			}
+		}
+	TRequestStatus status;
+	aFile.Write(*hBufC8, length, status);
+	User::WaitForRequest(status);
+	CleanupStack::PopAndDestroy(hBufC8);
+	}
+
+TBool CAtsLogger::IsTransitionLegal(const TReportStage& aNewStage)
+	{
+	switch (iReportStage)
+		{
+		case EUninitialized:
+			return (aNewStage == EUninitialized || aNewStage == EBeginTestReport);
+		case EBeginTestReport:
+			return (aNewStage == EBeginTestSet || aNewStage == EEndTestReport);
+		case EBeginTestSet:
+			return (aNewStage == EBeginTestCase || aNewStage == EEndTestSet);
+		case EBeginTestCase:
+			return (aNewStage == ESetTestCaseVerdict);
+		case ESetTestCaseVerdict:
+			return (aNewStage == EEndTestCase);
+		case EEndTestCase:
+			return (aNewStage == EEndTestSet || aNewStage == EBeginTestCase);
+		case EEndTestSet:
+			return (aNewStage == EEndTestReport || aNewStage == EBeginTestSet);
+		case EEndTestReport:
+			return (aNewStage == EFinished);
+		case EFinished:
+		default:
+			break;
+		}
+	return EFalse;
+	}
+
+EXPORT_C const TPtrC CAtsLogger::ErrorMessage(const TInt& aError)
+	{
+	switch (aError)
+		{
+		case EUninitialized:
+			return _L("Invalid report stage transition to EUninitialized");
+		case EBeginTestReport:
+			return _L("Invalid report stage transition to EBeginTestReport");
+		case EBeginTestSet:
+			return _L("Invalid report stage transition to EBeginTestSet");
+		case EBeginTestCase:
+			return _L("Invalid report stage transition to EBeginTestCase");
+		case ESetTestCaseVerdict:
+			return _L("Invalid report stage transition to ESetTestCaseVerdict");
+		case EEndTestCase:
+			return _L("Invalid report stage transition to EEndTestCase");
+		case EEndTestSet:
+			return _L("Invalid report stage transition to EEndTestSet");
+		case EEndTestReport:
+			return _L("Invalid report stage transition to EEndTestReport");
+		case EFinished:
+			return _L("Invalid report stage transition to EFinished");
+		case KErrNone:
+			return _L("KErrNone");
+		case KErrNotFound:
+			return _L("KErrNotFound");
+		case KErrGeneral:
+			return _L("KErrGeneral");
+		case KErrCancel:
+			return _L("KErrCancel");
+		case KErrNoMemory:
+			return _L("KErrNoMemory");
+		case KErrNotSupported:
+			return _L("KErrNotSupported");
+		case KErrArgument:
+			return _L("KErrArgument");
+		case KErrTotalLossOfPrecision:
+			return _L("KErrTotalLossOfPrecision");
+		case KErrBadHandle:
+			return _L("KErrBadHandle");
+		case KErrOverflow:
+			return _L("KErrOverflow");
+		case KErrUnderflow:
+			return _L("KErrUnderflow");
+		case KErrAlreadyExists:
+			return _L("KErrAlreadyExists");
+		case KErrPathNotFound:
+			return _L("KErrPathNotFound");
+		case KErrDied:
+			return _L("KErrDied");
+		case KErrInUse:
+			return _L("KErrInUse");
+		case KErrServerTerminated:
+			return _L("KErrServerTerminated");
+		case KErrServerBusy:
+			return _L("KErrServerBusy");
+		case KErrCompletion:
+			return _L("KErrCompletion");
+		case KErrNotReady:
+			return _L("KErrNotReady");
+		case KErrUnknown:
+			return _L("KErrUnknown");
+		case KErrCorrupt:
+			return _L("KErrCorrupt");
+		case KErrAccessDenied:
+			return _L("KErrAccessDenied");
+		case KErrLocked:
+			return _L("KErrLocked");
+		case KErrWrite:
+			return _L("KErrWrite");
+		case KErrDisMounted:
+			return _L("KErrDisMounted");
+		case KErrEof:
+			return _L("KErrEof");
+		case KErrDiskFull:
+			return _L("KErrDiskFull");
+		case KErrBadDriver:
+			return _L("KErrBadDriver");
+		case KErrBadName:
+			return _L("KErrBadName");
+		case KErrCommsLineFail:
+			return _L("KErrCommsLineFail");
+		case KErrCommsFrame:
+			return _L("KErrCommsFrame");
+		case KErrCommsOverrun:
+			return _L("KErrCommsOverrun");
+		case KErrCommsParity:
+			return _L("KErrCommsParity");
+		case KErrTimedOut:
+			return _L("KErrTimedOut");
+		case KErrCouldNotConnect:
+			return _L("KErrCouldNotConnect");
+		case KErrCouldNotDisconnect:
+			return _L("KErrCouldNotDisconnect");
+		case KErrDisconnected:
+			return _L("KErrDisconnected");
+		case KErrBadLibraryEntryPoint:
+			return _L("KErrBadLibraryEntryPoint");
+		case KErrBadDescriptor:
+			return _L("KErrBadDescriptor");
+		case KErrAbort:
+			return _L("KErrAbort");
+		case KErrTooBig:
+			return _L("KErrTooBig");
+		case KErrDivideByZero:
+			return _L("KErrDivideByZero");
+		case KErrBadPower:
+			return _L("KErrBadPower");
+		case KErrDirFull:
+			return _L("KErrDirFull");
+		case KErrHardwareNotAvailable:
+			return _L("KErrHardwareNotAvailable");
+		default:
+			return _L("Unknown error to ATS logger.");
+		}
+	}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/event/Bmarm/SUEventU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/event/Bwins/SUEventU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+	??1TScriptObject@@UAE@XZ @ 3 NONAME ABSENT ; TScriptObject::~TScriptObject(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/event/eabi/SUEventu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/event/group/SUEvent.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,73 @@
+/*
+* 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: MMP file for STIF Test Framework's remote events module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET          SUEvent.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+
+//TARGETPATH      ?target_path
+DEFFILE         SUEvent.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          SUEvent.cpp
+SOURCE          SUEventCases.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/event/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,58 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+	
+	DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in \epoc32\include
+// Example: 
+/*
+\agnmodel\inc\AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+\agnmodel\group\agnmodel.mmp
+#if defined(MARM)
+\agnmodel\group\agsvexe.mmp
+#endif
+*/
+	SUEvent.mmp
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/event/inc/SUEvent.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,317 @@
+/*
+* 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: STIF remote events module declaration
+*
+*/
+
+#ifndef SUEVENT_H
+#define SUEVENT_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// Logging path
+_LIT( KSUEventLogPath, "\\logs\\testframework\\SUEvent\\" ); 
+// Log file
+_LIT( KSUEventLogFile, "SUEvent.txt" ); 
+
+#define GETPTR &
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CSUEvent;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+// A typedef for function that does the actual testing,
+// function is a type 
+// TInt CSUEvent::<NameOfFunction> ( TTestResult& aResult )
+typedef TInt (CSUEvent::* TestFunction)(TTestResult&, const TFileName&);
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText*    iCaseName;
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {
+        };
+
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  This a SUEvent class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CSUEvent) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor.
+        */
+        static CSUEvent* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSUEvent();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the 
+        *       SUEvent. It is called once for every instance of 
+        *       TestModuleSUEvent after its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of SUEvent.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from SUEvent. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& aFailureType, 
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        *
+        * User may add implementation for OOM test warning handling. Usually no
+        * implementation is required.           
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */); 
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        *
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSUEvent();
+
+        /**
+        * 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& );
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        /**
+        * Actual Hardcoded test case functions are listed below.
+        */
+
+        /**
+        * Printing test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+		TInt SetEventState(TTestResult& aResult, const TFileName& aEventName);
+		TInt SetEventIndication(TTestResult& aResult, const TFileName& aEventName);
+		TInt UnsetEvent(TTestResult& aResult, const TFileName& aEventName);
+		TInt WaitEvent(TTestResult& aResult, const TFileName& aEventName);
+		TInt SetEventIndicationHard(TTestResult& aResult, const TFileName& /*aEventName*/);
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+        // Pointer to logger
+        CStifLogger * iLog; 
+
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // SUEVENT_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/event/src/SUEvent.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,366 @@
+/*
+* 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: This file contains SUEvent implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include "SUEvent.h"
+#include <e32svr.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSUEvent::CSUEvent
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSUEvent::CSUEvent()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::ConstructL
+// Symbian 2nd phase constructor can leave.
+//
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CSUEvent::ConstructL()
+    {
+    iLog = CStifLogger::NewL( KSUEventLogPath, 
+                          KSUEventLogFile);
+
+    // Sample how to use logging
+    _LIT( KLogStart, "SUEvent logging starts!" );
+    iLog->Log( KLogStart );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSUEvent* CSUEvent::NewL()
+    {
+    CSUEvent* self = new (ELeave) CSUEvent;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CSUEvent::~CSUEvent()
+    {
+    delete iLog;
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CSUEvent::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation.
+// -----------------------------------------------------------------------------
+//
+TInt CSUEvent::GetTestCasesL(
+    const TFileName& /*aConfig*/,
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array
+    for( TInt i = 0; Case(i).iMethod != NULL; 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( Case(i).iCaseName );
+
+        // 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;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CSUEvent::RunTestCaseL( 
+    const TInt aCaseNumber,
+    const TFileName& aConfig,
+    TTestResult& aResult )
+    {
+
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    _LIT( KLogStartTC, "Starting testcase [%S]" );
+    iLog->Log( KLogStartTC, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;
+        execStatus  = ( this->*iMethod )( aResult, aConfig );
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+	RDebug::Print(_L(" CSUEvent::RunTestCaseL waiting"));
+
+	User::After(500000);
+	RDebug::Print(_L(" CSUEvent::RunTestCaseL running"));
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+// -----------------------------------------------------------------------------
+//
+TBool CSUEvent::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt aCaseNumber, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& aFirstMemFailure, 
+                                TInt& aLastMemFailure ) 
+    {
+    _LIT( KLogOOMTestQueryL, "CSUEvent::OOMTestQueryL" );
+    iLog->Log( KLogOOMTestQueryL );     
+
+    aFirstMemFailure = Case( aCaseNumber ).iFirstMemoryAllocation;
+    aLastMemFailure = Case( aCaseNumber ).iLastMemoryAllocation;
+
+    return Case( aCaseNumber ).iIsOOMTest;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: User may add implementation for OOM test environment initialization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CSUEvent::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: User may add implementation for OOM test warning handling. Usually no
+// implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CSUEvent::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSUEvent::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: User may add implementation for OOM test environment finalization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CSUEvent::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CSUEvent::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/event/src/SUEventCases.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,312 @@
+/*
+* 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: This file contains SUEvent module implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "SUEvent.h"
+#include <StifTestEventInterface.h>
+
+#include <e32svr.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSUEvent::Case
+// Returns a test case by number.
+//
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+// 
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// -----------------------------------------------------------------------------
+//
+const TCaseInfo CSUEvent::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /**
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    SUEvent.cpp file and to SUEvent.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g.
+        // CSUEvent::PrintTest. Otherwise the compiler
+        // gives errors.
+
+		//sets event as state event
+        ENTRY("SetEventState",			CSUEvent::SetEventState),
+        //sets event as indication event
+        ENTRY("SetEventIndication",		CSUEvent::SetEventIndication),
+        //unsets event
+        ENTRY("UnsetEvent",				CSUEvent::UnsetEvent),
+        //waits for evenr
+        ENTRY("WaitEvent",				CSUEvent::WaitEvent),
+        //sets event as indication in hard mode
+        ENTRY("SetEventIndicationHard",	CSUEvent::SetEventIndicationHard),
+        // Example how to use OOM functionality
+        //OOM_ENTRY( "Loop test with OOM", CSUEvent::LoopTest, ETrue, 2, 3),
+        //OOM_FUNCENTRY( CSUEvent::PrintTest, ETrue, 1, 3 ),
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) /
+                               sizeof( TCaseInfoInternal ) )
+        {
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+        }
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+//#0
+TInt CSUEvent::SetEventState(TTestResult& aResult, const TFileName& aEventName)
+    {
+//RDebug::Print(_L(" CSUEvent::SetEventState start event_name=%S (%d)"), &aEventName, RThread().Id().Id());
+	iLog->Log(_L("CSUEvent::SetEventState event=%S"), &aEventName);
+
+	//Set state event
+	TEventIf setEvent(TEventIf::ESetEvent, aEventName, TEventIf::EState);
+//RDebug::Print(_L(" CSUEvent::SetEventState call Event (%d)"), RThread().Id().Id());
+	TestModuleIf().Event(setEvent);
+	
+//RDebug::Print(_L(" CSUEvent::SetEventState call SetResult (%d)"), RThread().Id().Id());
+	aResult.SetResult(KErrNone, _L(""));
+
+//RDebug::Print(_L(" CSUEvent::SetEventState end (%d)"), RThread().Id().Id());
+    return KErrNone;
+    }
+
+//#1
+TInt CSUEvent::SetEventIndication(TTestResult& aResult, const TFileName& aEventName)
+    {
+//RDebug::Print(_L(" CSUEvent::SetEventIndication start event_name=%S (%d)"), &aEventName, RThread().Id().Id());
+	iLog->Log(_L("CSUEvent::SetEventIndication event=%S"), &aEventName);
+
+	//Set indication event
+	TEventIf setEvent(TEventIf::ESetEvent, aEventName, TEventIf::EIndication);
+//RDebug::Print(_L(" CSUEvent::SetEventIndication call Event (%d)"), RThread().Id().Id());
+	TestModuleIf().Event(setEvent);
+
+//RDebug::Print(_L(" CSUEvent::SetEventIndication call SetResult (%d)"), RThread().Id().Id());
+	aResult.SetResult(KErrNone, _L(""));
+//RDebug::Print(_L(" CSUEvent::SetEventIndication end (%d)"), RThread().Id().Id());
+    return KErrNone;
+    }
+
+//#2
+TInt CSUEvent::UnsetEvent(TTestResult& aResult, const TFileName& aEventName)
+    {
+RDebug::Print(_L("CSUEvent::UnsetEvent start event_name=%S"), &aEventName);
+	iLog->Log(_L("CSUEvent::UnsetEvent event=%S"), &aEventName);
+
+	//Unset event
+	TEventIf event(TEventIf::EUnsetEvent, aEventName, TEventIf::EState);
+RDebug::Print(_L("CSUEvent::UnsetEvent call Event"));
+	TestModuleIf().Event(event);
+
+RDebug::Print(_L("CSUEvent::UnsetEvent call SetResult"));
+	aResult.SetResult(KErrNone, _L(""));
+RDebug::Print(_L("CSUEvent::UnsetEvent end"));
+    return KErrNone;
+    }
+
+
+//#3
+TInt CSUEvent::WaitEvent(TTestResult& aResult, const TFileName& aEventName)
+    {
+//RDebug::Print(_L(" CSUEvent::WaitEvent start event name=%S (%d)"), &aEventName, RThread().Id().Id());
+	iLog->Log(_L("CSUEvent::WaitEvent event=%S"), &aEventName);
+
+	//Request, wait for, and release event
+//RDebug::Print(_L(" CSUEvent::WaitEvent set event request (%d)"), RThread().Id().Id());
+	TEventIf event(TEventIf::EReqEvent, aEventName, TEventIf::EState);
+//RDebug::Print(_L(" CSUEvent::WaitEvent call Event (%d)"), RThread().Id().Id());
+	TestModuleIf().Event(event);
+//RDebug::Print(_L(" CSUEvent::WaitEvent set event (%d)"), RThread().Id().Id());
+	event.SetType(TEventIf::EWaitEvent);
+//RDebug::Print(_L(" CSUEvent::WaitEvent call Event (%d)"), RThread().Id().Id());
+	TestModuleIf().Event(event);
+//RDebug::Print(_L(" CSUEvent::WaitEvent set event release (%d)"), RThread().Id().Id());
+	event.SetType(TEventIf::ERelEvent);
+//RDebug::Print(_L(" CSUEvent::WaitEvent call Event (%d)"), RThread().Id().Id());
+	TestModuleIf().Event(event);
+
+//RDebug::Print(_L(" CSUEvent::WaitEvent call SetResult (%d)"), RThread().Id().Id());
+	aResult.SetResult(KErrNone, _L(""));
+//RDebug::Print(_L(" CSUEvent::WaitEvent end (%d)"), RThread().Id().Id());
+    return KErrNone;
+    }
+
+
+//#4
+TInt CSUEvent::SetEventIndicationHard(TTestResult& aResult, const TFileName& /*aEventName*/)
+    {
+//RDebug::Print(_L(" CSUEvent::SetEventIndicationHard start (%d)"), RThread().Id().Id());
+	iLog->Log(_L("CSUEvent::SetEventIndicationHard"));
+
+	TBuf<20> eventName;
+	eventName.Copy(_L("event1"));
+	//Set indication event
+	TEventIf setEvent(TEventIf::ESetEvent, eventName, TEventIf::EIndication);
+//RDebug::Print(_L(" CSUEvent::SetEventIndicationHard call Event (%d)"), RThread().Id().Id());
+	TestModuleIf().Event(setEvent);
+
+//RDebug::Print(_L(" CSUEvent::SetEventIndicationHard call SetResult (%d)"), RThread().Id().Id());
+	aResult.SetResult(KErrNone, _L(""));
+//RDebug::Print(_L(" CSUEvent::SetEventIndicationHard end (%d)"), RThread().Id().Id());
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?classname::?member_function(
+   ?arg_type arg,
+   ?arg_type arg )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ?function_name implements...
+// ?implementation_description.
+// Returns: ?value_1: ?description
+//          ?value_n: ?description
+//                    ?description
+// -----------------------------------------------------------------------------
+//
+/*
+?type  ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg )  // ?description
+    {
+
+    ?code
+
+    }
+*/
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/bwins/stfeventsystemclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,22 @@
+EXPORTS
+	??1CAsyncEventList@@UAE@XZ @ 1 NONAME ; CAsyncEventList::~CAsyncEventList(void)
+	?AddAsyncEventL@CAsyncEventList@@QAEXPAVCAsyncEventActive@@@Z @ 2 NONAME ; void CAsyncEventList::AddAsyncEventL(class CAsyncEventActive *)
+	?Close@REventSystem@@AAEXXZ @ 3 NONAME ; void REventSystem::Close(void)
+	?Connect@REventSystem@@AAEHXZ @ 4 NONAME ; int REventSystem::Connect(void)
+	?IsPending@CAsyncEventActive@@QAEHXZ @ 5 NONAME ; int CAsyncEventActive::IsPending(void)
+	?NewL@CAsyncEventActive@@SAPAV1@H@Z @ 6 NONAME ; class CAsyncEventActive * CAsyncEventActive::NewL(int)
+	?NewL@CAsyncEventList@@SAPAV1@XZ @ 7 NONAME ; class CAsyncEventList * CAsyncEventList::NewL(void)
+	?ReleaseEventL@REventSystem@@QAEXABVTDesC16@@H@Z @ 8 NONAME ; void REventSystem::ReleaseEventL(class TDesC16 const &, int)
+	?RemoveAsyncEventL@CAsyncEventList@@QAEXPAVCAsyncEventActive@@@Z @ 9 NONAME ; void CAsyncEventList::RemoveAsyncEventL(class CAsyncEventActive *)
+	?RequestEventL@REventSystem@@QAEXABVTDesC16@@H@Z @ 10 NONAME ; void REventSystem::RequestEventL(class TDesC16 const &, int)
+	?SetEventL@REventSystem@@QAEXABVTDesC16@@@Z @ 11 NONAME ; void REventSystem::SetEventL(class TDesC16 const &)
+	?SetEventL@REventSystem@@QAEXABVTDesC16@@PAVTRequestStatus@@@Z @ 12 NONAME ; void REventSystem::SetEventL(class TDesC16 const &, class TRequestStatus *)
+	?SetIndicationEventL@REventSystem@@QAEXABVTDesC16@@@Z @ 13 NONAME ; void REventSystem::SetIndicationEventL(class TDesC16 const &)
+	?SetIndicationEventL@REventSystem@@QAEXABVTDesC16@@PAVTRequestStatus@@@Z @ 14 NONAME ; void REventSystem::SetIndicationEventL(class TDesC16 const &, class TRequestStatus *)
+	?StartL@CAsyncEventActive@@QAEXPAVTRequestStatus@@VTThreadId@@ABVTDesC16@@PAVCAsyncEventList@@@Z @ 15 NONAME ; void CAsyncEventActive::StartL(class TRequestStatus *, class TThreadId, class TDesC16 const &, class CAsyncEventList *)
+	?UnsetEventL@REventSystem@@QAEXABVTDesC16@@@Z @ 16 NONAME ; void REventSystem::UnsetEventL(class TDesC16 const &)
+	?UnsetEventL@REventSystem@@QAEXABVTDesC16@@PAVTRequestStatus@@@Z @ 17 NONAME ; void REventSystem::UnsetEventL(class TDesC16 const &, class TRequestStatus *)
+	?Version@REventSystem@@ABE?AVTVersion@@XZ @ 18 NONAME ; class TVersion REventSystem::Version(void) const
+	?WaitEventL@REventSystem@@QAEXABVTDesC16@@H@Z @ 19 NONAME ; void REventSystem::WaitEventL(class TDesC16 const &, int)
+	?RemoveInRequestedState@REventSystem@@QAEHH@Z @ 20 NONAME ; int REventSystem::RemoveInRequestedState(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/eabi/stfeventsystemclientu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,28 @@
+EXPORTS
+	_ZN12REventSystem10WaitEventLERK7TDesC16i @ 1 NONAME
+	_ZN12REventSystem11UnsetEventLERK7TDesC16 @ 2 NONAME
+	_ZN12REventSystem11UnsetEventLERK7TDesC16P14TRequestStatus @ 3 NONAME
+	_ZN12REventSystem13ReleaseEventLERK7TDesC16i @ 4 NONAME
+	_ZN12REventSystem13RequestEventLERK7TDesC16i @ 5 NONAME
+	_ZN12REventSystem19SetIndicationEventLERK7TDesC16 @ 6 NONAME
+	_ZN12REventSystem19SetIndicationEventLERK7TDesC16P14TRequestStatus @ 7 NONAME
+	_ZN12REventSystem22RemoveInRequestedStateEi @ 8 NONAME
+	_ZN12REventSystem5CloseEv @ 9 NONAME
+	_ZN12REventSystem7ConnectEv @ 10 NONAME
+	_ZN12REventSystem9SetEventLERK7TDesC16 @ 11 NONAME
+	_ZN12REventSystem9SetEventLERK7TDesC16P14TRequestStatus @ 12 NONAME
+	_ZN15CAsyncEventList14AddAsyncEventLEP17CAsyncEventActive @ 13 NONAME
+	_ZN15CAsyncEventList17RemoveAsyncEventLEP17CAsyncEventActive @ 14 NONAME
+	_ZN15CAsyncEventList4NewLEv @ 15 NONAME
+	_ZN15CAsyncEventListD0Ev @ 16 NONAME
+	_ZN15CAsyncEventListD1Ev @ 17 NONAME
+	_ZN15CAsyncEventListD2Ev @ 18 NONAME
+	_ZN17CAsyncEventActive4NewLEi @ 19 NONAME
+	_ZN17CAsyncEventActive6StartLEP14TRequestStatus9TThreadIdRK7TDesC16P15CAsyncEventList @ 20 NONAME
+	_ZN17CAsyncEventActive9IsPendingEv @ 21 NONAME
+	_ZNK12REventSystem7VersionEv @ 22 NONAME
+	_ZTI15CAsyncEventList @ 23 NONAME ; #<TI>#
+	_ZTI17CAsyncEventActive @ 24 NONAME ; #<TI>#
+	_ZTV15CAsyncEventList @ 25 NONAME ; #<VT>#
+	_ZTV17CAsyncEventActive @ 26 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#include <platform_paths.hrh>
+
+
+// Files to be exported
+PRJ_EXPORTS
+../inc/stfeventsystem.h       stfeventsystem.h
+../inc/stfasynceventlist.h    stfasynceventlist.h
+../inc/stfasynceventactive.h  stfasynceventactive.h
+
+// Project files
+PRJ_MMPFILES
+	eventsystemclient.mmp
+
+// Files to be exported for test purposes
+PRJ_TESTEXPORTS
+	// None
+
+// Project files for test programs
+PRJ_TESTMMPFILES
+	// None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/group/eventsystemclient.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,50 @@
+/*
+* 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: MMP file for STIF Test Framework's remote events module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+
+SMPSAFE
+TARGETTYPE DLL
+TARGET stfeventsystemclient.dll
+UID			 0x1000008d 0x2002BC9E
+
+CAPABILITY ALL -TCB
+
+OS_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE	 ..\inc
+
+
+LIBRARY		 euser.lib
+
+//#if defined (WINS)
+//#elif defined (GCC32)
+//DEFFILE ..\bmarm\stfeventsystemclient.def
+//#else 
+//DEFFILE ..\eabi\stfeventsystemclient.def
+//#endif
+
+//nostrictdef
+
+SOURCEPATH ..\src
+SOURCE      stfeventsystem.cpp
+SOURCE      stfasynceventactive.cpp
+SOURCE      stfasynceventlist.cpp
+
+// EOF
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/inc/stfasynceventactive.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef STFASYNCEVENTACTIVE_H_
+#define STFASYNCEVENTACTIVE_H_
+
+#include <e32base.h>
+
+#include <stfeventsystemdefs.h>
+#include "stfasynceventlist.h"
+#include <stfeventsystem.h>
+
+// This class defines active object which represents asynchronous request
+// to Event Server.
+// On RunL each objects deletes itself.
+class CAsyncEventActive: public CActive 
+    {
+    public:
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        IMPORT_C static CAsyncEventActive* NewL(const TInt aOwnerId);
+
+        /**
+        * Destructor.
+        */
+        ~CAsyncEventActive();
+
+        /** 
+        * Starts active object
+        */
+        IMPORT_C void StartL(TRequestStatus* aStatus, TThreadId aStatusThreadId, const TDesC& aEventName, CAsyncEventList* aAsyncEventList);
+        
+        /** 
+        * Checks if request to event server is in pending state
+        */
+        IMPORT_C TBool IsPending();
+
+    private:
+        /** 
+        * C++ default constructor.
+        */
+        CAsyncEventActive(const TInt aOwnerId);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Handles active object and deletes the object!
+        */
+        void RunL();
+
+        /** 
+        * DoCancel
+        */
+        void DoCancel();
+
+        /** 
+        * RunError
+        */
+        TInt RunError(TInt aError);
+        
+        /**
+        * Complete caller status with specified code
+        */
+        TInt CompleteCallerStatus(TInt aCode);
+
+
+    private:
+        // List of active objects
+        CAsyncEventList* iAsyncEventList;
+        
+        // Event name
+        HBufC* iEventName;
+        
+        // Event system client
+        REventSystem iEventSystem;
+        
+        // Status of caller
+        TRequestStatus *iCallerStatus;
+        
+        // If of thread which owns caller status
+        TThreadId iStatusThreadId;
+        
+        // Identifier of the owner of waiting event
+        const TInt iOwnerId;
+        
+    }; /* class CAsyncEventActive */
+    
+
+#endif /* STFASYNCEVENTACTIVE_H_ */
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/inc/stfasynceventlist.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef STFASYNCEVENTLIST_H_
+#define STFASYNCEVENTLIST_H_
+
+#include <e32base.h>
+
+#include <stfeventsystemdefs.h>
+
+class CAsyncEventActive;
+
+// This class defines list of asynchronous event calls.
+// It is planned that only wait events will be realised in a real asynchronous
+// way. All others will be synchronous, even they pretend to be asynchronous.
+class CAsyncEventList: public CBase 
+    {
+    public:
+        /**
+        * NewL is two-phased constructor.
+        */
+        IMPORT_C static CAsyncEventList* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CAsyncEventList();
+
+        /**
+        * Add active object to the list.
+        */
+        IMPORT_C void AddAsyncEventL(CAsyncEventActive* aAsyncEvent);
+        
+        /**
+        * Remove active object from the list.
+        */
+        IMPORT_C void RemoveAsyncEventL(CAsyncEventActive* aAsyncEvent);
+
+    private:
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Default C++ constructor.
+        */
+        CAsyncEventList();
+    
+        /**
+        * Cancel and remove all active objects from the list.
+        */
+        void CancelAllAsyncEvents();
+        
+        
+    private:
+        /**
+        * Array of all existing active objects waiting for asynchronous 
+        * completion.
+        */
+        RPointerArray<CAsyncEventActive> iAsyncEvents;
+
+    }; /* class CAsyncEventList */
+    
+
+#endif /* STFASYNCEVENTLIST_H_ */
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/inc/stfeventsystem.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef STFEVENTSYSTEM_H_
+#define STFEVENTSYSTEM_H_
+
+#include <e32base.h>
+
+#include <stfeventsystemdefs.h>
+#include <stfasynceventlist.h>
+
+class REventSystem: public RSessionBase 
+    {
+    public:            
+        // Wait for event
+        IMPORT_C void WaitEventL(const TDesC& aEventName, const TInt aOwner);
+        //IMPORT_C void CancelWaitEventL(const TDesC& aEventName, const TInt aOwner);
+        
+        // Request
+        IMPORT_C void RequestEventL(const TDesC& aEventName, const TInt aOwner);
+        
+        // Release
+        IMPORT_C void ReleaseEventL(const TDesC& aEventName, const TInt aOwner);
+        
+        // Set indication event
+        IMPORT_C void SetIndicationEventL(const TDesC& aEventName);
+        IMPORT_C void SetIndicationEventL(const TDesC& aEventName, TRequestStatus* aStatus);
+                
+        // State events
+        IMPORT_C void SetEventL(const TDesC& aEventName);
+        IMPORT_C void SetEventL(const TDesC& aEventName, TRequestStatus* aStatus);
+
+        IMPORT_C void UnsetEventL(const TDesC& aEventName);
+        IMPORT_C void UnsetEventL(const TDesC& aEventName, TRequestStatus* aStatus);
+        
+        // Cancel (remove) all requested events of given owner
+        IMPORT_C TInt RemoveInRequestedState(const TInt aOwner);
+                
+    private:
+        // Connect to event system
+        IMPORT_C TInt Connect();
+
+        // Close event system connection
+        IMPORT_C void Close();
+
+        // Return version
+        IMPORT_C TVersion Version() const;
+        
+        // Friends
+        friend class CAsyncEventActive;
+        
+    }; /* class REventSystem */
+    
+
+#endif /* STFEVENTSYSTEM_H_ */
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/src/stfasynceventactive.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#include <e32std.h>
+#include <e32svr.h>
+
+#include <stfeventsystemerrorcodes.h>
+#include "stfasynceventactive.h"
+#include <stfasynceventlist.h>
+
+
+// Implementation of asynchronous event Active Object
+
+/**
+* NewL is first phase of two-phased constructor.
+*/
+EXPORT_C CAsyncEventActive* CAsyncEventActive::NewL(const TInt aOwnerId)
+    {
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventActive::NewL()"));
+    CAsyncEventActive* self = new (ELeave) CAsyncEventActive(aOwnerId);
+    CleanupStack::PushL(self);
+
+    // Construct the object
+    self->ConstructL();
+
+    // Remove from cleanup stack
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+
+/** 
+* C++ default constructor.
+*/
+CAsyncEventActive::CAsyncEventActive(const TInt aOwnerId): CActive(CActive::EPriorityStandard), iOwnerId(aOwnerId)
+    {
+    CActiveScheduler::Add(this);
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::CAsyncEventActive() creating active object [%x]"), this);
+    }
+
+/**
+* By default Symbian OS constructor is private.
+*/
+void CAsyncEventActive::ConstructL()
+    {
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventActive::ConstructL()"));
+    }
+
+/**
+* Destructor.
+*/
+CAsyncEventActive::~CAsyncEventActive()
+    {
+    Cancel();
+    iEventSystem.Close();
+    delete iEventName;
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::~CAsyncEventActive() deleting active object [%x]"), this);
+    }
+
+/** 
+* Start active object.
+* If list is provided, active object will cooperate with it adding and deleting itself from the list.
+* Also active object will delete itself if it's on the list.
+*/
+EXPORT_C void CAsyncEventActive::StartL(TRequestStatus* aStatus, TThreadId aStatusThreadId, const TDesC& aEventName, CAsyncEventList* aAsyncEventList)
+    {
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::StartL() eventName=[%S]"), &aEventName);
+    // Check if list of asynchronous objects and event name are not set.
+    // It would mean that method StartL was already called.
+    __ASSERT_ALWAYS(iAsyncEventList == NULL, User::Panic(_L("CAsyncEventActive1"), EEventSystemListAlreadySet));
+    __ASSERT_ALWAYS(iEventName == NULL, User::Panic(_L("CAsyncEventActive2"), EEventSystemListAlreadySet));
+    
+    // Set caller's status and other data
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::StartL() registering status [%x]"), aStatus);
+    iCallerStatus = aStatus;
+    *iCallerStatus = KRequestPending;
+    iStatusThreadId = aStatusThreadId;
+    iAsyncEventList = aAsyncEventList;
+    iEventName = aEventName.AllocL();
+     
+    // Open connection to server
+    User::LeaveIfError(iEventSystem.Connect());
+    
+    // Add object to list
+    if(iAsyncEventList)
+        {
+        iAsyncEventList->AddAsyncEventL(this);
+        }
+    
+    // Call wait event
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::StartL() SendReceive eventName=[%S]"), iEventName);
+    TIpcArgs args(iEventName, iOwnerId);
+    iEventSystem.SendReceive(EEventSystemWaitEvent, args, iStatus);
+    
+    // Activate object    
+    SetActive();
+    }
+
+/**
+* Handles active object and deletes itself!
+*/
+void CAsyncEventActive::RunL()
+    {
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::RunL()"));
+    // Complete request from caller
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::RunL() completing status [%x] with [%d]"), iCallerStatus, iStatus.Int());
+    User::LeaveIfError(CompleteCallerStatus(iStatus.Int()));
+    
+    // Remove from list
+    if(iAsyncEventList)
+        {
+        iAsyncEventList->RemoveAsyncEventL(this);
+        iAsyncEventList = NULL;
+        }
+    
+    // Close connection to server, as it's not longer required
+    iEventSystem.Close();
+    }
+
+/** 
+* DoCancel
+*/
+void CAsyncEventActive::DoCancel()
+    {
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::DoCancel()"));
+
+    // Cancelling wait event on the event server
+    TIpcArgs args(iEventName, iOwnerId);
+    if(iEventSystem.Handle())
+        {
+        TInt ret = iEventSystem.SendReceive(EEventSystemCancelWaitEvent, args);
+        }
+
+    // Complete request from caller
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::DoCancel() completing (KErrCancel) status [%x]"), iCallerStatus);
+    CompleteCallerStatus(KErrCancel);
+
+    // Remove from list
+    if(iAsyncEventList)
+        {
+        iAsyncEventList->RemoveAsyncEventL(this);
+        iAsyncEventList = NULL;
+        }
+    }
+
+/** 
+* RunError
+*/
+TInt CAsyncEventActive::RunError(TInt aError)
+    {
+    RDebug::Print(_L("STF [ESC]: CAsyncEventActive::RunError() aError=[%d]"), aError);    
+    return aError;
+    }
+
+/**
+* Checks if request to event server is in pending state
+*/
+EXPORT_C TBool CAsyncEventActive::IsPending()
+    {
+    return (iCallerStatus != NULL);
+    }
+
+/**
+* Complete caller status with specified code
+*/
+TInt CAsyncEventActive::CompleteCallerStatus(TInt aCode)
+    {
+    RThread thread;
+    TInt ret = thread.Open(iStatusThreadId);
+    
+    if(ret == KErrNone)
+        {
+        thread.RequestComplete(iCallerStatus, aCode);
+        iCallerStatus = NULL;
+        thread.Close();
+        }
+        
+    return ret;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/src/stfasynceventlist.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#include <e32std.h>
+#include <e32svr.h>
+
+#include <stfeventsystemerrorcodes.h>
+#include "stfasynceventlist.h"
+#include <stfasynceventactive.h>
+
+
+// Implementation of list of asynchronous events
+
+/**
+*/
+EXPORT_C CAsyncEventList* CAsyncEventList::NewL()
+    {
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventList::NewL()"));
+    CAsyncEventList* self = new (ELeave) CAsyncEventList();
+    CleanupStack::PushL(self);
+
+    // Construct the object
+    self->ConstructL();
+
+    // Remove from cleanup stack
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+
+/**
+*/
+void CAsyncEventList::ConstructL()
+    {
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventList::ConstructL()"));
+    }
+
+/**
+*/
+CAsyncEventList::CAsyncEventList()
+    {
+    RDebug::Print(_L("STF [ESC]: CAsyncEventList::CAsyncEventList()"));
+    }
+
+/**
+*/
+EXPORT_C CAsyncEventList::~CAsyncEventList()
+    {
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventList::~CAsyncEventList() #1-start"));
+    CancelAllAsyncEvents();
+    iAsyncEvents.ResetAndDestroy();
+    iAsyncEvents.Close();
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventList::~CAsyncEventList() #1-end"));
+    }
+
+/**
+* Add active object to the list.
+*/
+EXPORT_C void CAsyncEventList::AddAsyncEventL(CAsyncEventActive* aAsyncEvent)
+    {
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventList::AddAsyncEventL()"));
+    if(iAsyncEvents.Find(aAsyncEvent) >= 0)
+        {
+        User::Leave(KErrAlreadyExists);
+        }
+    iAsyncEvents.AppendL(aAsyncEvent);
+    }
+        
+/**
+* Remove active object from the list.
+*/
+EXPORT_C void CAsyncEventList::RemoveAsyncEventL(CAsyncEventActive* aAsyncEvent)
+    {
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventList::RemoveAsyncEventL()"));
+    TInt index = iAsyncEvents.Find(aAsyncEvent);
+    //RDebug::Print(_L("STF [ESC]: CAsyncEventList::RemoveAsyncEventL() index=[%d]"), index);
+    if(index >= 0)
+        {
+        iAsyncEvents.Remove(index);
+        }
+    }
+
+/**
+* Cancel and remove all active objects from the list.
+*/
+void CAsyncEventList::CancelAllAsyncEvents()
+    {
+    RDebug::Print(_L("STF [ESC]: CAsyncEventList::CancelAllAsyncEvents()"));
+    while(iAsyncEvents.Count())
+        {
+        CAsyncEventActive* asyncEvent = iAsyncEvents[0];
+        asyncEvent->Cancel();
+        iAsyncEvents.Remove(0);
+        delete asyncEvent;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/client/src/stfeventsystem.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#include <e32std.h>
+#include <e32svr.h>
+
+#include <stfeventsystemdefs.h>
+#include "stfeventsystem.h"
+#include <stfasynceventactive.h>
+
+// Implementation of session class
+
+/**
+Connects to event server.
+*/
+EXPORT_C TInt REventSystem::Connect()
+    {
+    //RDebug::Print(_L("STF [ESC]: REventSystem::Connect start"));
+    TInt err;
+    
+    // Check if server is not running
+    err = CreateSession(KEventSystemServName, Version());
+    //RDebug::Print(_L("STF [ESC]: REventSystem::Connect session creation [%d]"), err);
+    
+    if(err == KErrNotFound) //Server is not yet started
+        {
+        RProcess p;
+        err = p.Create(KEventSystemServNameExe, KEventSystemServNameExe);
+        RDebug::Print(_L("STF [ESC]: REventSystem::Connect process creation [%d]"), err);
+        if(err == KErrNone)
+            {
+            p.Resume();
+            
+            TRequestStatus eventServerStartup;
+            p.Rendezvous(eventServerStartup);
+            User::WaitForRequest(eventServerStartup);
+            RDebug::Print(_L("STF [ESC]: REventSystem::Connect randezvous with server [%d]"), eventServerStartup.Int());
+            p.Close();
+
+            err = CreateSession(KEventSystemServName, Version());
+            //RDebug::Print(_L("STF [ESC]: REventSystem::Connect session creation [%d]"), err);
+            }
+        }
+    else if(err != KErrNone)
+        {
+        return err;
+        }
+    //RDebug::Print(_L("STF [ESC]: REventSystem::Connect end"));
+    return err; 
+    }
+
+/**
+Closes connection.
+*/
+EXPORT_C void REventSystem::Close()
+    {
+    //RDebug::Print(_L("STF [ESC]: REventSystem::Close()"));
+    if(Handle())
+        {
+        SendReceive(EEventSystemServCloseSession);
+        RHandleBase::Close();
+        }
+    //RDebug::Print(_L("STF [ESC]: REventSystem::Close end"));
+    }
+
+/**
+Returns version of event system.
+*/
+EXPORT_C TVersion REventSystem::Version(void) const
+    {
+    return TVersion(KEventSystemServMajorVersionNumber, KEventSystemServMinorVersionNumber, KEventSystemServBuildVersionNumber);
+    }
+
+/**
+Set indication event.
+*/
+EXPORT_C void REventSystem::SetIndicationEventL(const TDesC& aEventName)
+    {
+    SetIndicationEventL(aEventName, NULL);
+    }
+
+/**
+Set indication event.
+*/
+EXPORT_C void REventSystem::SetIndicationEventL(const TDesC& aEventName, TRequestStatus *aStatus)
+    {
+    RDebug::Print(_L("STF [ESC]: REventSystem::SetIndicationEventL"));
+    if(aStatus)
+        *aStatus = KRequestPending;
+
+    User::LeaveIfError(Connect());
+    TIpcArgs args(&aEventName);
+    TInt ret = SendReceive(EEventSystemSetIndicationEvent, args);
+    RDebug::Print(_L("STF [ESC]: REventSystem::SetIndicationEventL completed with [%d]"), ret);
+    Close();
+    
+    if(aStatus)
+        User::RequestComplete(aStatus, ret);
+
+    User::LeaveIfError(ret);
+    }
+
+/**
+Wait for event
+*/
+EXPORT_C void REventSystem::WaitEventL(const TDesC& aEventName, const TInt aOwner)
+    {    
+    RDebug::Print(_L("STF [ESC]: REventSystem::WaitEventL eventname=[%S]"), &aEventName);
+    User::LeaveIfError(Connect());
+    TIpcArgs args(&aEventName, aOwner);
+    TInt ret = SendReceive(EEventSystemWaitEvent, args);
+    RDebug::Print(_L("STF [ESC]: REventSystem::WaitEventL completed with [%d]"), ret);
+    Close();
+    User::LeaveIfError(ret);
+    }
+
+/**
+Set state event.
+*/
+EXPORT_C void REventSystem::SetEventL(const TDesC& aEventName)
+    {
+    SetEventL(aEventName, NULL);
+    }
+
+/**
+Request event
+*/
+EXPORT_C void REventSystem::RequestEventL(const TDesC& aEventName, const TInt aOwner)
+    {    
+    RDebug::Print(_L("STF [ESC]: REventSystem::RequestEventL eventname=[%S]"), &aEventName);
+    User::LeaveIfError(Connect());
+    TIpcArgs args(&aEventName, aOwner);
+    TInt ret = SendReceive(EEventSystemRequestEvent, args);
+    RDebug::Print(_L("STF [ESC]: REventSystem::RequestEventL completed with [%d]"), ret);
+    Close();
+    User::LeaveIfError(ret);
+    }
+
+/**
+Release event
+*/
+EXPORT_C void REventSystem::ReleaseEventL(const TDesC& aEventName, const TInt aOwner)
+    {    
+    RDebug::Print(_L("STF [ESC]: REventSystem::ReleaseEventL eventname=[%S]"), &aEventName);
+    User::LeaveIfError(Connect());
+    TIpcArgs args(&aEventName, aOwner);
+    TInt ret = SendReceive(EEventSystemReleaseEvent, args);
+    RDebug::Print(_L("STF [ESC]: REventSystem::ReleaseEventL completed with [%d]"), ret);
+    Close();
+    User::LeaveIfError(ret);
+    }
+
+/**
+Set state event.
+*/
+EXPORT_C void REventSystem::SetEventL(const TDesC& aEventName, TRequestStatus *aStatus)
+    {
+    RDebug::Print(_L("STF [ESC]: REventSystem::SetStateEventL eventname=[%S]"), &aEventName);
+    
+    if(aStatus)
+        *aStatus = KRequestPending;
+    
+    User::LeaveIfError(Connect());
+    TIpcArgs args(&aEventName);
+    TInt ret = SendReceive(EEventSystemSetEvent, args);
+    RDebug::Print(_L("STF [ESC]: REventSystem::SetStateEventL completed with [%d]"), ret);
+    Close();
+    
+    if(aStatus)
+        User::RequestComplete(aStatus, ret);
+        
+    User::LeaveIfError(ret);
+    }
+    
+/**
+Unset state event.
+*/
+EXPORT_C void REventSystem::UnsetEventL(const TDesC& aEventName)
+    {
+    UnsetEventL(aEventName, NULL);
+    }
+    
+/**
+Unset state event.
+*/
+EXPORT_C void REventSystem::UnsetEventL(const TDesC& aEventName, TRequestStatus* aStatus)
+    {
+    RDebug::Print(_L("STF [ESC]: REventSystem::UnsetStateEventL eventname=[%S]"), &aEventName);
+    
+    if(aStatus)
+        *aStatus = KRequestPending;
+            
+    User::LeaveIfError(Connect());
+    TIpcArgs args(&aEventName);
+    TInt ret = SendReceive(EEventSystemUnsetEvent, args);
+    RDebug::Print(_L("STF [ESC]: REventSystem::UnsetStateEventL completed with [%d]"), ret);
+    Close();
+    
+    if(aStatus)
+        User::RequestComplete(aStatus, ret);
+    
+    User::LeaveIfError(ret);
+    }
+
+/**
+Cancel (remove) all requested events of given owner.
+*/
+EXPORT_C TInt REventSystem::RemoveInRequestedState(const TInt aOwner)
+    {
+    RDebug::Print(_L("STF [ESC]: REventSystem::RemoveInRequestedState"));
+
+    User::LeaveIfError(Connect());
+    TIpcArgs args(aOwner);
+    TInt ret = SendReceive(EEventSystemRemoveInRequestedState, args);
+    RDebug::Print(_L("STF [ESC]: REventSystem::RemoveInRequestedState completed with [%d]"), ret);
+    Close();
+    
+    return ret;    
+    }
+    
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*	bld.inf Toplevel build information for STF framework.
+*/
+
+// STF Event System Server
+#include "../server/group/bld.inf"
+
+// STF Event System Client
+#include "../client/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#include <platform_paths.hrh>
+
+
+// Files to be exported
+PRJ_EXPORTS
+../inc/stfeventsystemdefs.h          stfeventsystemdefs.h
+../inc/stfeventsystemerrorcodes.h    stfeventsystemerrorcodes.h
+
+// Project files
+PRJ_MMPFILES
+eventsystemsrv.mmp
+
+// Files to be exported for test purposes
+PRJ_TESTEXPORTS
+	// None
+
+// Project files for test programs
+PRJ_TESTMMPFILES
+	// None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/group/eventsystemsrv.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,42 @@
+/*
+* 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: MMP file for STIF Test Framework's remote events module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+
+TARGETTYPE EXE
+TARGET stfeventsystemsrv.exe
+
+UID 0 0x2002BC9D
+
+OS_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE	 ..\inc
+
+SOURCEPATH	  ..\src
+SOURCE      main.cpp 
+SOURCE      eventsystemserver.cpp 
+SOURCE      eventsystemsession.cpp 
+SOURCE      waitingevent.cpp
+SOURCE      stateevent.cpp
+
+LIBRARY     euser.lib
+LIBRARY     efsrv.lib
+
+CAPABILITY ALL -TCB
+
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/inc/eventsystemserver.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef EVENTSYSTEMSERVER_H_
+#define EVENTSYSTEMSERVER_H_
+
+#include "stfeventsystemdefs.h"
+#include "waitingevent.h"
+#include "stateevent.h"
+
+// Constant values
+TInt const KShutdownDelay = 60000000; //Automatic shutdown delay: 60s
+
+// Class for shutting down server when inactive
+class CShutdown: public CTimer
+    {
+    public:
+        inline CShutdown();
+        inline void ConstructL();
+        inline void Start();
+        
+    private:
+        void RunL();
+    };
+
+// Main class of TestEngine server
+class CEventSystemServer : public CServer2
+    {
+    public:    
+        // Creats a new server object
+        static CEventSystemServer* NewL(CActive::TPriority aActiveObjectPriority);
+        static CEventSystemServer* NewLC(CActive::TPriority aActiveObjectPriority);
+
+        // Creates a new session with the server; the function implements 
+        // pure virtual function defined in class CServer2
+        CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const;
+        
+        // Adds session
+        void AddSession(void);
+
+        // Removes session
+        void RemoveSession(void);
+        
+    public :
+        // Constructor
+        CEventSystemServer(CActive::TPriority aActiveObjectPriority);
+    
+        // Second phase constructor
+        void ConstructL();
+
+        // Returns an object container, and guaranteed to produce object 
+        // containers with unique ids within the server.
+        // Called by a new session to create a container 
+        CObjectCon* NewContainerL();
+        
+        // Remove session object from container
+        void RemoveContainer(CObjectCon *aObj);
+    
+        // Destructor
+        ~CEventSystemServer();
+        
+        // Search for state event and give its index
+        TInt SearchForState(const TDesC& aEventName);
+        
+        // Search for waiting event, starting from aIndex
+        TBool SearchForWaiting(const TDesC& aEventName, const TInt aOwnerId, TInt& aIndex);
+        
+        // Search for waiting event, starting from aIndex
+        TBool SearchForWaiting(const TDesC& aEventName, TInt& aIndex);
+        
+        // List of waiting events
+        RPointerArray<CWaitingEvent> iWaitingEvents;
+
+        // State events container
+        RPointerArray<CStateEvent> iStateEvents;
+        
+    private:
+        // Panic class with given error code
+        void PanicClass(const TInt aErrorCode);
+        
+        // Check condition and start shudown timer.
+        void CheckAndStartShutdownTimer(void);
+        
+        // The server has an object container index that
+        // creates an object container for each session.
+        CObjectConIx* iContainerIndex;
+        
+        // Session counter
+        TInt iSessionCounter;
+        
+        // Shutdown object
+        CShutdown iShutdown;
+    };
+        
+
+#endif /* EVENTSYSTEMSERVER_H_ */
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/inc/eventsystemsession.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef EVENTSYSTEMSESSION_H_
+#define EVENTSYSTEMSESSION_H_
+
+#include <e32base.h>
+#include "waitingevent.h"
+
+
+// Session class of TestEngine server    
+class CEventSystemSession : public CSession2
+    {
+    public:
+        // Create the session
+        static CEventSystemSession* NewL();
+    
+    public:
+        // Constructor
+        CEventSystemSession();
+    
+        // Constructor
+        ~CEventSystemSession();
+
+        // Called by client/server framework after 
+        // session has been successfully created
+        void CreateL(); 
+        
+        // Service request
+        void ServiceL(const RMessage2& aMessage);
+
+    private:
+        // Handles message
+        void DispatchMessageL(const RMessage2& aMessage);
+        
+        // Closes the session
+        void CloseSession();
+
+        // Panics client
+        void PanicClient(const RMessage2& aMessage, const TInt aPanic) const;
+
+        // Set indication event
+        void SetIndicationEventL(const RMessage2& aMessage);
+        
+        // Set state event
+        void SetStateEventL(const RMessage2& aMessage);
+
+        // Unset state event
+        void UnsetStateEventL(const RMessage2& aMessage);
+
+        // Request event
+        void RequestEventL(const RMessage2& aMessage);
+        
+        // Release event
+        void ReleaseEventL(const RMessage2& aMessage);
+        
+        // Wait for event
+        void WaitForEventL(const RMessage2& aMessage);
+        
+        // Check if there is waiting event and complete if found
+        void CompleteWaitingEventsL(const TDesC& aEventName);
+
+        // Check list of requested events. If any of them is found, notify about event.
+        void NotifyRequestedEventsL(const TDesC& aEventName);
+
+        // Check list of state events. If any of them matches current waiting event, complete waiting event.
+        //TBool CompleteFromStateEventL(const TDesC& aEventName, const RMessage2& aMessage);
+        void CompleteFromStateEventL(CWaitingEvent* aEvent);
+
+        // Add state event in the state events array
+        void AddStateEventL(const TDesC& aEventName);
+
+        // Cancel waiting message from the same session
+        void CancelWaitingEventL(const RMessage2& aMessage);
+
+        // Remove (kind of release) all requested events.
+        void RemoveInRequestedStateL(const RMessage2& aMessage);
+
+    private:
+        // Object container for this session.
+        CObjectCon *iContainer;
+        
+        // Waiting event (this is used in case when test case gets cancelled)
+        CWaitingEvent *iWaitingEvent;
+        
+    }; /* CTestEngineSession */
+
+
+#endif /* EVENTSYSTEMSESSION_H_ */
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/inc/stateevent.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef STATEEVENT_H
+#define STATEEVENT_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+
+/**
+ *  CStateEvent - class representing state events 
+ * 
+ */
+class CStateEvent : public CBase
+    {
+    public:
+        // Destructor.
+        ~CStateEvent();
+
+        // Two-phased constructor.
+        static CStateEvent* NewL(const TDesC& aEventName);
+
+        // Two-phased constructor.
+        static CStateEvent* NewLC(const TDesC& aEventName);
+        
+        // Checks if event name is the same as provided in argument
+        TInt IsMatchingEvent(const TDesC& aEventName);
+        
+        // Set flag which says that event will be unset when matching event will be released
+        void NotifyToBeUnset(TBool aValue);
+
+        // Returns flag which says that event will be unset when matching waiting event will be released
+        bool IsToBeUnset();
+        
+    private:
+        // Constructor for performing 1st stage construction
+        CStateEvent();
+
+        // Constructor for performing 2nd stage construction
+        void ConstructL(const TDesC& aEventName);
+        
+    private:
+        // Event name
+        HBufC* iEventName;
+        
+        // Candidate to be unset as only matching event will be released
+        TBool iToBeUnset;
+        
+    };
+
+#endif // STATEEVENT_H
+
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/inc/stfeventsystemdefs.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef EVENTSYSTEMDEFS_H_
+#define EVENTSYSTEMDEFS_H_
+
+#include <e32base.h>
+
+
+// Server name    
+_LIT(KEventSystemServName, "STFEventSystemServ");
+_LIT(KEventSystemServNameExe, "stfeventsystemsrv.exe");
+
+// Server version. A version must be specifyed when creating a session with the server
+const TUint KEventSystemServMajorVersionNumber = 1;
+const TUint KEventSystemServMinorVersionNumber = 0;
+const TUint KEventSystemServBuildVersionNumber = 0;
+
+// Max length
+const TInt KMaxEventName = 50;
+const TInt KMaxEventMessage = 200;
+
+// Operation codes used in message passing between client and server
+enum TEventSystemServRqst
+    {
+    EEventSystemServCloseSession       = 1,
+    EEventSystemSetEvent               = 2,
+    EEventSystemUnsetEvent             = 3,
+    EEventSystemSetIndicationEvent     = 4,
+    EEventSystemWaitEvent              = 5,
+    EEventSystemCancelWaitEvent        = 6,
+    EEventSystemRequestEvent           = 7,
+    EEventSystemReleaseEvent           = 8,
+    EEventSystemRemoveInRequestedState = 9
+    };
+    
+
+#endif /* EVENTSYSTEMDEFS_H_ */
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/inc/stfeventsystemerrorcodes.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef STFEVENTSYSTEMERRORCODES_H_
+#define STFEVENTSYSTEMERRORCODES_H_
+
+    enum TEventSystemErrorCodes
+        {
+        EInvalidSessionCounter               = -1101,
+        EEventSystemVersionNotSupported      = -1102,
+        EEventSystemSessionUnknownMessage    = -1103,
+        EEventSystemSessionAlreadyWaiting    = -1104, //Session is already waiting for event and can't wait for another
+        EEventSystemListAlreadySet           = -1105,
+        EEventSystemNameAlreadySet           = -1106,
+        EEventSystemNotInRequestedState      = -1007, //Want to wait for event which is not in requested state
+        EEventSystemSessionNotDefined        = -1008,
+        EEventSystemNotRequested             = -1009, //Event was not requested
+        };
+
+
+#endif /* STFEVENTSYSTEMERRORCODES_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/inc/waitingevent.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef WAITINGEVENT_H
+#define WAITINGEVENT_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+
+/**
+ *  CWaitingEvent - class representing waiting events 
+ *  Object of that type is created when there was a request for the event.
+ *  After event is requested, it can wait for another event.
+ */
+class CWaitingEvent : public CBase
+    {
+    public:
+        // Destructor.
+        ~CWaitingEvent();
+
+        // Two-phased constructor.
+        static CWaitingEvent* NewL(const TDesC& aEventName, const TInt aCallerId);
+
+        // Two-phased constructor.
+        static CWaitingEvent* NewLC(const TDesC& aEventName, const TInt aCallerId);
+        
+        // Wait for event (allowed only if event is in requested state)
+        void WaitL(const RMessage2& aMessage, const CSession2* aSession);
+        
+        // Complete waiting event
+        void CompleteEventL();
+        
+        // Cancel event
+        void CancelEvent(void);
+        
+        // Checks if event name is the same as provided in argument
+        TInt IsMatchingEvent(const TDesC& aEventName, const TInt aCallerId);
+
+        // Checks if event name is the same as provided in argument
+        TInt IsMatchingEvent(const TDesC& aEventName);
+
+        // Checks if event's session is the same as provided in argument
+        TInt IsMatchingSession(const CSession2* aSession);
+        
+        // Give event name
+        const TDesC& EventName();
+        
+        // Check if event is in requested state
+        TInt IsRequested();
+        
+        // Check if event is waitng
+        TInt IsWaiting();
+        
+        // Notify requested event, that indicatin event 
+        void NotifyRequestedEventL();
+
+        // Give owner id 
+        TInt OwnerId();
+    private:
+        // Shows current state of the event
+        enum TEventState
+            {
+            EEventRequested,
+            EEventWaiting
+            };
+            
+        // Constructor for performing 1st stage construction
+        CWaitingEvent(const TInt aCallerId);
+
+        // Constructor for performing 2nd stage construction
+        void ConstructL(const TDesC& aEventName);
+        
+        // Panics the client
+        void PanicClient(const RMessage2& aMessage, const TInt aPanic) const;
+
+    private:
+        // Event name
+        HBufC* iEventName;
+        
+        // Owner id. The same named waiting event may be requested by different callers - so we need to distinguish them
+        const TInt iOwnerId;
+
+        // Message to complete with event
+        RMessage2* iMessage;
+        
+        // Session of the waiting event
+        CSession2* iSession;
+        
+        // State of the event
+        TEventState iState;
+        
+        // Defines if indication event was set in the moment when this waiting event was in requested state
+        TBool iEventSetWhenRequested;
+    };
+
+#endif // WAITINGEVENT_H
+
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/src/eventsystemserver.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#include <e32svr.h>
+
+#include <stfeventsystemerrorcodes.h>
+#include "eventsystemserver.h"
+#include "eventsystemsession.h"
+
+
+/**
+First phase construction
+*/
+CEventSystemServer* CEventSystemServer::NewL(CActive::TPriority aActiveObjectPriority)
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::NewL"));
+    CEventSystemServer* self = NewLC(aActiveObjectPriority);
+    CleanupStack::Pop();
+    return self;
+    }
+
+/**
+First phase construction
+*/
+CEventSystemServer* CEventSystemServer::NewLC(CActive::TPriority aActiveObjectPriority)
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::NewLC"));
+    CEventSystemServer* self = new (ELeave) CEventSystemServer(aActiveObjectPriority);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }    
+
+/**
+Creates and returns a new object container using the server's object container index.
+This is a service that is used by a session.
+*/
+CObjectCon* CEventSystemServer::NewContainerL()
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::NewContainerL"));
+    return iContainerIndex->CreateL();
+    }
+
+/**
+Removes session object from container.
+*/
+void CEventSystemServer::RemoveContainer(CObjectCon *aObj)
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::RemoveContainer aObj=[%x]"), aObj);
+    iContainerIndex->Remove(aObj);
+    }
+
+
+/**
+Constructor takes the server priority value. 
+
+The server is an active object, and the priority value is the priority
+of this active object.
+
+It passes the priority value to the base class in the Ctor list.
+By default, the session is not sharable, which is what we want here
+so no second parameter is passed to the CServer2 constructor.
+*/
+CEventSystemServer::CEventSystemServer(CActive::TPriority aActiveObjectPriority)
+    : CServer2(aActiveObjectPriority)
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::CEventSystemServer"));
+    }
+
+
+/**
+Second-phase constructor - creates the object container index.
+*/
+void CEventSystemServer::ConstructL()
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::ConstructL"));
+    StartL(KEventSystemServName);
+    iContainerIndex = CObjectConIx::NewL();
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::ConstructL created iContainerIndex=[%x]"), iContainerIndex);
+    iShutdown.ConstructL();
+    iShutdown.Start();
+    }
+
+
+/**
+Desctructor - deletes the object container index.
+*/
+CEventSystemServer::~CEventSystemServer()
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::~CEventSystemServer iContainerIndex=[%x]"), iContainerIndex);
+    delete iContainerIndex;
+    iWaitingEvents.ResetAndDestroy();
+    iWaitingEvents.Close();
+    iStateEvents.ResetAndDestroy();
+    iStateEvents.Close();
+    }
+
+
+/**
+Creates a new session with the server.
+*/
+CSession2* CEventSystemServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const
+    {
+    RDebug::Print(_L("STF [ESS]: CEventSystemServer::NewSessionL"));
+    // Check that the version is OK
+    TVersion version(KEventSystemServMajorVersionNumber, KEventSystemServMinorVersionNumber, KEventSystemServBuildVersionNumber);
+    if(!User::QueryVersionSupported(version, aVersion))
+        {
+        User::Leave(EEventSystemVersionNotSupported);
+        }
+    
+    // Create the session.
+    CSession2* session = new (ELeave) CEventSystemSession;
+
+    // Return session        
+    return session;
+    }
+
+/**
+Adds session.
+*/
+void CEventSystemServer::AddSession(void)
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::AddSession"));
+    iSessionCounter++;
+    RDebug::Print(_L("STF [ESS]: CEventSystemServer::AddSession iSessionCounter increased to %d"), iSessionCounter);
+    iShutdown.Cancel();
+    }
+    
+/**
+Closes session and starts shutdown timer in case no more sessions are opened.
+*/
+void CEventSystemServer::RemoveSession(void)
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemServer::RemoveSession"));
+    __ASSERT_ALWAYS((iSessionCounter > 0), PanicClass(EInvalidSessionCounter));
+    iSessionCounter--;
+    RDebug::Print(_L("STF [ESS]: CEventSystemServer::RemoveSession iSessionCounter decreased to %d"), iSessionCounter);
+    CheckAndStartShutdownTimer();
+    }
+
+/**
+Check condition and start shudown timer.
+*/
+void CEventSystemServer::CheckAndStartShutdownTimer(void)
+    {
+    RDebug::Print(_L("STF [ESS]: CEventSystemServer::CheckAndStartShutdownTimer counter=[%d] state count=[%d] waiting count=[%d]"), iSessionCounter, iStateEvents.Count(), iWaitingEvents.Count());
+    // Timer can be started if there is no connected session and there are no state events set
+    if(iSessionCounter == 0 && iStateEvents.Count() == 0 && iWaitingEvents.Count() == 0)
+        {
+        RDebug::Print(_L("STF [ESS]: starting shutdown timer"));
+        iShutdown.Start();
+        }
+    }
+
+/**
+Panic class with given error code.
+*/
+void CEventSystemServer::PanicClass(const TInt aErrorCode)
+    {
+    RDebug::Print(_L("STF [ESS]: Panic class CEventSystemServer [%x] with code [%d]"), this, aErrorCode);
+    _LIT(KMessage, "CEventSystemServer");
+    User::Panic(KMessage, aErrorCode);
+    }
+
+/**
+Search for state event and give its index.
+*/
+TInt CEventSystemServer::SearchForState(const TDesC& aEventName)
+    {
+    TInt i;
+    for(i = 0; i < iStateEvents.Count(); i++)
+        {
+        // Check if this event matches
+        if(iStateEvents[i]->IsMatchingEvent(aEventName))
+            {
+            return i;
+            }
+        }
+    return KErrNotFound;
+    }
+        
+/**
+Search for waiting event, starting from given index.
+aIndex will show found position and method return true.
+*/
+TBool CEventSystemServer::SearchForWaiting(const TDesC& aEventName, const TInt aOwnerId, TInt& aIndex)
+    {
+    if(aIndex < 0)
+        aIndex = 0;
+        
+    for(; aIndex < iWaitingEvents.Count(); aIndex++)
+        {
+        // Check if this event matches
+        if(iWaitingEvents[aIndex]->IsMatchingEvent(aEventName, aOwnerId))
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+/**
+Search for waiting event, starting from given index.
+aIndex will show found position and method return true.
+*/
+TBool CEventSystemServer::SearchForWaiting(const TDesC& aEventName, TInt& aIndex)
+    {
+    if(aIndex < 0)
+        aIndex = 0;
+        
+    for(; aIndex < iWaitingEvents.Count(); aIndex++)
+        {
+        // Check if this event matches
+        if(iWaitingEvents[aIndex]->IsMatchingEvent(aEventName))
+            {
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+/**
+Constructor of shutdown class.
+*/
+inline CShutdown::CShutdown(): CTimer(-1)
+    {
+    //RDebug::Print(_L("STF [ESS]: CShutdown::CShutdown"));
+    CActiveScheduler::Add(this);
+    }
+    
+/**
+2nd phase of object construction.
+*/
+inline void CShutdown::ConstructL()
+    {
+    //RDebug::Print(_L("STF [ESS]: CShutdown::ConstructL"));
+    CTimer::ConstructL();
+    }
+    
+/**
+Start shutdown timer.
+*/
+inline void CShutdown::Start()
+    {
+    RDebug::Print(_L("STF [ESS]: CShutdown::Start"));
+    After(KShutdownDelay);
+    }
+    
+/**
+Shutdown server.
+*/
+void CShutdown::RunL()
+    {
+    RDebug::Print(_L("STF [ESS]: CShutdown::RunL"));
+    CActiveScheduler::Stop();
+    }
+        
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/src/eventsystemsession.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,631 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#include <e32svr.h>
+
+#include <stfeventsystemerrorcodes.h>
+#include "eventsystemsession.h"
+#include "eventsystemserver.h"
+
+
+/**
+Constructor
+*/
+CEventSystemSession::CEventSystemSession()
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemSession::CEventSystemSession"));
+    }
+
+/**
+Destructor
+*/
+CEventSystemSession::~CEventSystemSession()
+    {
+    //RDebug::Print(_L("STF [ESS]: CEventSystemSession::~CEventSystemSession"));
+    // Check if there is waiting event registered 
+    if(iWaitingEvent)
+        {
+        RDebug::Print(_L("STF [ESS]: CEventSystemSession::~CEventSystemSession iWaitingEvent is defined, will be handled"));
+        TInt i;
+    
+        for(i = 0; i < ((CEventSystemServer*)Server())->iWaitingEvents.Count(); i++)
+            {
+            CWaitingEvent* event = ((CEventSystemServer*)Server())->iWaitingEvents[i];
+            // Check if this event matches
+            if(event == iWaitingEvent)
+                {
+                RDebug::Print(_L("STF [ESS]: CEventSystemSession::~CEventSystemSession iWaitingEvent found in the array"));
+                if(event->IsWaiting())
+                    {
+                    // Complete event and remove it from list of waiting events
+                    RDebug::Print(_L("STF [ESS]: CEventSystemSession::~CEventSystemSession iWaitingEvent in EEventWait state, cancelling"));
+                    event->CancelEvent();
+                    ((CEventSystemServer*)Server())->iWaitingEvents.Remove(i);
+                    RDebug::Print(_L("STF [ESS]: CEventSystemSession::~CEventSystemSession deleting iWaitingEvent"));
+                    delete event;
+                    event = NULL;
+                    iWaitingEvent = NULL;
+                    }
+                break;
+                }
+            }
+        }
+        
+    // Close session if not closed properly
+    if(iContainer)
+        {
+        CloseSession();
+        }
+    }
+
+
+/**
+Called by client/server framework after 
+session has been successfully created.
+
+In effect, a second-phase constructor.
+
+Creates:
+
+1. the object index
+2. the object container for this session.
+
+We are then ready for subsessions.
+*/
+void CEventSystemSession::CreateL()
+    {
+//    RDebug::Print(_L("STF [ESS]: CEventSystemSession::CreateL"));
+//        // Create new object index
+//        iTestCaseRunnerObjectIndex = CObjectIx::NewL();
+    
+    // Initialize the object container
+    // using the object container index in the server.
+    iContainer = ((CEventSystemServer*)Server())->NewContainerL();
+    
+    // Adds session (updates counter)
+    ((CEventSystemServer*)Server())->AddSession();
+    }
+
+
+/**
+Closes the session.
+
+It deletes the object index and object container.
+
+This could be done in the destructor, but it seems neater to do it here. 
+*/
+void CEventSystemSession::CloseSession()
+    {
+//    RDebug::Print(_L("STF [ESS]: CEventSystemSession::CloseSession"));
+    // Deletes the object index.
+//        delete iTestCaseRunnerObjectIndex;
+//        iTestCaseRunnerObjectIndex = NULL;
+    
+    // Deletes the object container
+    ((CEventSystemServer*)Server())->RemoveContainer(iContainer);
+    //delete iContainer; // RemoveContainer deletes the object
+    iContainer = NULL;
+    
+    // Removes session
+    ((CEventSystemServer*)Server())->RemoveSession();
+    }
+
+/**
+First line servicing of a client request.
+
+This function dispatches requests to the appropriate handler.
+Some messages are handled by the session itself, and are
+implemented as CCountSession member functions, while 
+other messages are handled by the subsession, and are
+implemented as CCountSubSession member functions.
+*/
+void CEventSystemSession::ServiceL(const RMessage2& aMessage)
+    {
+//    RDebug::Print(_L("STF [ESS]: CEventSystemSession::ServiceL"));
+    DispatchMessageL(aMessage);
+    }
+
+
+/**
+Called by ServiceL()
+
+It tests the function code and then delegates to
+the appropriate function.
+*/
+void CEventSystemSession::DispatchMessageL(const RMessage2& aMessage)
+    {
+//    RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL function=[%d] message=[%x]"), aMessage.Function(), &aMessage);
+    TInt err;
+
+    // First check for session-relative requests
+    switch(aMessage.Function())
+        {
+        // Session relevant commands
+        case EEventSystemServCloseSession:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemServCloseSession"));
+            CloseSession();
+            RDebug::Print(_L("STF [ESS]: Completing message EEventSystemServCloseSession"));
+            aMessage.Complete(KErrNone);
+            break;
+            
+        case EEventSystemSetEvent:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemSetEvent"));
+            TRAP(err, SetStateEventL(aMessage));
+            RDebug::Print(_L("STF [ESS]: Completing message EEventSystemSetEvent with [%d]"), err);
+            aMessage.Complete(err);
+            break;
+            
+        case EEventSystemUnsetEvent:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemUnsetEvent"));
+            TRAP(err, UnsetStateEventL(aMessage));
+            RDebug::Print(_L("STF [ESS]: Completing message EEventSystemUnsetEvent with [%d]"), err);
+            aMessage.Complete(err);
+            break;
+            
+        case EEventSystemSetIndicationEvent:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemSetIndicationEvent"));
+            TRAP(err, SetIndicationEventL(aMessage));
+            RDebug::Print(_L("STF [ESS]: Completing message EEventSystemSetIndicationEvent with [%d]"), err);
+            aMessage.Complete(err);
+            break;
+            
+        case EEventSystemWaitEvent:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemWaitEvent"));
+            TRAP(err, WaitForEventL(aMessage));
+            if(err != KErrNone)
+                {
+                RDebug::Print(_L("STF [ESS]: Completing message EEventSystemWaitEvent with [%d]"), err);
+                aMessage.Complete(err);
+                }
+            break;
+            
+        case EEventSystemCancelWaitEvent:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemCancelWaitEvent"));
+            TRAP(err, CancelWaitingEventL(aMessage));
+            if(err != KErrNone)
+                {
+                RDebug::Print(_L("STF [ESS]: Completing message EEventSystemCancelWaitEvent with [%d]"), err);
+                aMessage.Complete(err);
+                }
+            break;
+
+        case EEventSystemRequestEvent:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemRequestEvent"));
+            TRAP(err, RequestEventL(aMessage));
+            RDebug::Print(_L("STF [ESS]: Completing message EEventSystemRequestEvent with [%d]"), err);
+            aMessage.Complete(err);
+            break;
+
+        case EEventSystemReleaseEvent:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemReleaseEvent"));
+            TRAP(err, ReleaseEventL(aMessage));
+            RDebug::Print(_L("STF [ESS]: Completing message EEventSystemReleaseEvent with [%d]"), err);
+            aMessage.Complete(err);
+            break;
+
+        case EEventSystemRemoveInRequestedState:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL EEventSystemRemoveInRequestedState"));
+            TRAP(err, RemoveInRequestedStateL(aMessage));
+            RDebug::Print(_L("STF [ESS]: Completing message EEventSystemRemoveInRequestedState with [%d]"), err);
+            aMessage.Complete(err);
+            break;
+
+                    
+        default:
+            RDebug::Print(_L("STF [ESS]: CEventSystemSession::DispatchMessageL unknown function"));
+            PanicClient(aMessage, EEventSystemSessionUnknownMessage);
+        }
+    }
+
+/**
+Panics the client
+*/
+void CEventSystemSession::PanicClient(const RMessage2& aMessage, const TInt aPanic) const
+    {
+    RDebug::Print(_L("STF [ESS]: CEventSystemSession::PanicClient"));
+    _LIT(KMessage, "CEventSystemSession");
+    aMessage.Panic(KMessage, aPanic);
+    }
+
+
+/**
+Set indication event
+*/
+void CEventSystemSession::SetIndicationEventL(const RMessage2& aMessage)
+    {
+    // Get event data
+    RBuf eventName;
+    eventName.CreateL(KMaxEventName);
+    eventName.CleanupClosePushL();
+    aMessage.ReadL(0, eventName);
+    
+    RDebug::Print(_L("STF [ESS]: setting indication event [%S]"), &eventName);
+    
+    // Notify requested events
+    NotifyRequestedEventsL(eventName);
+    
+    // Complete waiting events
+    CompleteWaitingEventsL(eventName);
+    
+    // Clean data
+    CleanupStack::PopAndDestroy(&eventName);
+    }
+
+/**
+Request event
+*/
+void CEventSystemSession::RequestEventL(const RMessage2& aMessage)
+    {
+    // Get event data
+    RBuf eventName;
+    eventName.CreateL(KMaxEventName);
+    eventName.CleanupClosePushL();
+    aMessage.ReadL(0, eventName);
+    
+    TInt ownerId = aMessage.Int1();
+
+    // Check if event is not already requested
+    TInt i = 0;
+    if(((CEventSystemServer*)Server())->SearchForWaiting(eventName, ownerId, i))
+        {
+        RDebug::Print(_L("STF [ESS]: Requested event [%S] already exists, leaving"), &eventName);
+        User::Leave(KErrAlreadyExists);
+        }
+    
+    // Create waiting event - it's first state will be EEventRequested
+    RDebug::Print(_L("STF [ESS]: Waiting event registered [%S]"), &eventName);
+    iWaitingEvent = CWaitingEvent::NewL(eventName, ownerId);
+    ((CEventSystemServer*)Server())->iWaitingEvents.Append(iWaitingEvent);
+    
+    // Clean data
+    CleanupStack::PopAndDestroy(&eventName);
+    }
+
+/**
+Release event
+*/
+void CEventSystemSession::ReleaseEventL(const RMessage2& aMessage)
+    {
+    // Get event data
+    RBuf eventName;
+    eventName.CreateL(KMaxEventName);
+    eventName.CleanupClosePushL();
+    aMessage.ReadL(0, eventName);
+
+    TInt ownerId = aMessage.Int1();
+
+    // Check if event is requested
+    TInt i = 0;
+    if(((CEventSystemServer*)Server())->SearchForWaiting(eventName, ownerId, i))
+        {
+        CWaitingEvent* event = ((CEventSystemServer*)Server())->iWaitingEvents[i];
+        
+        // If event is waiting, cancel it
+        if(event->IsWaiting())
+            {
+            event->CancelEvent();
+            }
+
+        // Check if there is any candidate to be unset
+        TInt j = ((CEventSystemServer*)Server())->SearchForState(eventName);
+        if(j != KErrNotFound)
+            {
+            CStateEvent* state = ((CEventSystemServer*)Server())->iStateEvents[j];
+            if(state->IsToBeUnset())
+                {
+                ((CEventSystemServer*)Server())->iStateEvents.Remove(j);
+                delete state;
+                state = NULL;
+                }
+            }
+        
+        
+        // Delete waiting event
+        ((CEventSystemServer*)Server())->iWaitingEvents.Remove(i);
+        delete event;
+        event = NULL;
+        }
+    else // Event was not requested
+        {
+        RDebug::Print(_L("STF [ESS]: Event [%S] to be releases doesn't exist, leaving"), &eventName);
+        User::Leave(KErrNotFound);
+        }
+        
+    // Clean data
+    CleanupStack::PopAndDestroy(&eventName);
+    }
+
+/**
+Wait for event
+*/
+void CEventSystemSession::WaitForEventL(const RMessage2& aMessage)
+    {
+    __ASSERT_ALWAYS(iWaitingEvent == NULL, PanicClient(aMessage, EEventSystemSessionAlreadyWaiting));
+    
+    // Get event data
+    RBuf eventName;
+    eventName.CreateL(KMaxEventName);
+    eventName.CleanupClosePushL();
+    aMessage.ReadL(0, eventName);
+
+    TInt ownerId = aMessage.Int1();
+
+    // Check if event is requested
+    TInt i = 0;
+    if(((CEventSystemServer*)Server())->SearchForWaiting(eventName, ownerId, i))
+        {
+        CWaitingEvent* event = ((CEventSystemServer*)Server())->iWaitingEvents[i];
+        
+        // Set in waiting state
+        iWaitingEvent = event;
+        event->WaitL(aMessage, this);
+        CompleteFromStateEventL(event);
+        }
+    else
+        {
+        RDebug::Print(_L("STF [ESS]: Event [%S] not requested"), &eventName);
+        User::Leave(EEventSystemNotRequested);
+        }
+    
+    // Clean data
+    CleanupStack::PopAndDestroy(&eventName);
+    }
+
+/**
+Cancel waiting message from the same session
+*/
+void CEventSystemSession::CancelWaitingEventL(const RMessage2& aMessage)
+    {
+    // Get event data
+    RBuf eventName;
+    eventName.CreateL(KMaxEventName);
+    eventName.CleanupClosePushL();
+    aMessage.ReadL(0, eventName);
+
+    TInt ownerId = aMessage.Int1();
+
+    // Search for waiting events
+    TInt i = 0;
+    while(((CEventSystemServer*)Server())->SearchForWaiting(eventName, ownerId, i))
+        {
+        CWaitingEvent* event = ((CEventSystemServer*)Server())->iWaitingEvents[i];
+        if(event->IsMatchingSession(this))
+            {
+            // Complete event and remove it from list of waiting events
+            event->CancelEvent();
+            ((CEventSystemServer*)Server())->iWaitingEvents.Remove(i);
+            // Delete waiting event
+            delete event;
+            event = NULL;
+            break;
+            }
+        //Increase index, so SearchForWaiting will start searching with following entries
+        i++; 
+        }
+    aMessage.Complete(KErrNone);
+    
+    // Clean data
+    CleanupStack::PopAndDestroy(&eventName);
+    }
+
+/**
+Check list of waiting events. If any of them is found, complete it.
+*/
+void CEventSystemSession::CompleteWaitingEventsL(const TDesC& aEventName)
+    {
+    TInt i = 0;
+    while(((CEventSystemServer*)Server())->SearchForWaiting(aEventName, i))
+        {
+        CWaitingEvent* event = ((CEventSystemServer*)Server())->iWaitingEvents[i];
+        // Check if this event matches
+        if(event->IsWaiting())
+            {
+            // Complete event
+            event->CompleteEventL();
+            }
+        //Increase index, so SearchForWaiting will start searching with following entries
+        i++; 
+        }            
+    }
+
+/**
+Check list of requested events. If any of them is found, notify about event.
+*/
+void CEventSystemSession::NotifyRequestedEventsL(const TDesC& aEventName)
+    {
+    TInt i = 0;
+    while(((CEventSystemServer*)Server())->SearchForWaiting(aEventName, i))
+        {
+        CWaitingEvent* event = ((CEventSystemServer*)Server())->iWaitingEvents[i];
+        // Check if this event matches
+        if(event->IsRequested())
+            {
+            // Complete event
+            event->NotifyRequestedEventL();
+            }
+        //Increase index, so SearchForWaiting will start searching with following entries
+        i++; 
+        }            
+    }
+
+/**
+Check list of state events. If any of them matches current waiting event, complete waiting event.
+*/
+void CEventSystemSession::CompleteFromStateEventL(CWaitingEvent* aEvent)
+    {
+    TInt i = ((CEventSystemServer*)Server())->SearchForState(aEvent->EventName());
+    if(i != KErrNotFound)
+        {
+        RDebug::Print(_L("STF [ESS]: CEventSystemSession::CompleteFromStateEventL event [%S]"), &aEvent->EventName());
+        aEvent->CompleteEventL();
+        }
+    }
+    
+/**
+Set state event
+*/
+void CEventSystemSession::SetStateEventL(const RMessage2& aMessage)
+    {
+    // Get event data
+    RBuf eventName;
+    eventName.CreateL(KMaxEventName);
+    eventName.CleanupClosePushL();
+    aMessage.ReadL(0, eventName);
+
+    // Setting state event
+    RDebug::Print(_L("STF [ESS]: setting state event [%S]"), &eventName);
+    AddStateEventL(eventName);
+    
+    // Complete waiting events
+    CompleteWaitingEventsL(eventName);
+    
+    // Clean data
+    CleanupStack::PopAndDestroy(&eventName);
+    }
+
+/**
+Unset state event
+*/
+void CEventSystemSession::UnsetStateEventL(const RMessage2& aMessage)
+    {
+    // Get event data
+    RBuf eventName;
+    eventName.CreateL(KMaxEventName);
+    eventName.CleanupClosePushL();
+    aMessage.ReadL(0, eventName);
+
+    // Search for state event
+    TBool cannotBeUnset = EFalse;
+    CStateEvent* event = NULL;
+    
+    TInt i = ((CEventSystemServer*)Server())->SearchForState(eventName);
+    if(i != KErrNotFound)
+        {
+        // State event found, do further checking with requested events
+        event = ((CEventSystemServer*)Server())->iStateEvents[i];
+        TInt j = 0;
+        while(((CEventSystemServer*)Server())->SearchForWaiting(eventName, j))
+            {
+            CWaitingEvent* waiting = ((CEventSystemServer*)Server())->iWaitingEvents[j];
+            // If waiting event is in requested state, we can't unset our event, we can only mark it to be unset later
+            if(waiting->IsRequested())
+                {
+                // Set the flag
+                event->NotifyToBeUnset(ETrue);
+                cannotBeUnset = ETrue;
+                }
+            //Increase index, so SearchForWaiting will start searching with following entries
+            j++; 
+            }
+        }
+    else
+        {
+        // State event was not found
+        RDebug::Print(_L("STF [ESS]: unset: state event [%S] not set, leaving with [%d]"), &eventName, KErrNotFound);
+        User::Leave(KErrNotFound);
+        }
+
+    // Unsetting event because we have no found any requested events
+    if(!cannotBeUnset)
+        {
+        // Unsetting state event
+        RDebug::Print(_L("STF [ESS]: unsetting state event [%S]"), &eventName);
+        ((CEventSystemServer*)Server())->iStateEvents.Remove(i);
+        delete event;
+        event = NULL;
+        }
+    
+    // Clean data
+    CleanupStack::PopAndDestroy(&eventName);    
+    }
+
+/**
+Add state event in the state events array
+*/
+void CEventSystemSession::AddStateEventL(const TDesC& aEventName)
+    {
+    CStateEvent *event;
+
+    TInt i = ((CEventSystemServer*)Server())->SearchForState(aEventName);
+    if(i != KErrNotFound)
+        {
+        event = ((CEventSystemServer*)Server())->iStateEvents[i];
+        // Event found, leave (or not, if event was unset but could not be due to some not released wait)
+        if(event->IsToBeUnset())
+            {
+            // Reset the flag (equivalent to situation when theoretically unset event is set again)
+            event->NotifyToBeUnset(EFalse);
+            }
+        else
+            {
+            // Leave
+            RDebug::Print(_L("STF [ESS]: set: state event [%S] already set, leaving with [%d]"), &aEventName, KErrAlreadyExists);
+            User::Leave(KErrAlreadyExists);
+            }
+        }
+    else
+        {
+        // Event not found, add it
+        event = CStateEvent::NewL(aEventName);
+        ((CEventSystemServer*)Server())->iStateEvents.Append(event);
+        }
+    }
+
+
+/**
+Remove (like would be released) all requested events.
+Waiting events will be handled via destructor of opened session
+*/
+void CEventSystemSession::RemoveInRequestedStateL(const RMessage2& aMessage)
+    {
+    // Get event data
+    TInt ownerId = aMessage.Int0();
+    RDebug::Print(_L("STF [ESS]: Removing all requested events of owner [%d], count=[%d]"), ownerId, ((CEventSystemServer*)Server())->iWaitingEvents.Count());
+
+    // Check if event is requested
+    TInt i = 0;
+    while(i < ((CEventSystemServer*)Server())->iWaitingEvents.Count())
+        {
+        CWaitingEvent* event = ((CEventSystemServer*)Server())->iWaitingEvents[i];
+        
+        if(event->OwnerId() == ownerId && event->IsRequested())
+            {
+            // Check if there is any candidate to be unset
+            TInt j = ((CEventSystemServer*)Server())->SearchForState(event->EventName());
+            if(j != KErrNotFound)
+                {
+                CStateEvent* state = ((CEventSystemServer*)Server())->iStateEvents[j];
+                if(state->IsToBeUnset())
+                    {
+                    ((CEventSystemServer*)Server())->iStateEvents.Remove(j);
+                    delete state;
+                    state = NULL;
+                    }
+                }
+
+            // And remove and delete
+            ((CEventSystemServer*)Server())->iWaitingEvents.Remove(i);
+            delete event;
+            event = NULL;
+            }
+        else
+            {
+            i++;
+            }
+        }
+    }
+// EOF
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/src/main.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+
+//  Include Files  
+
+#include <e32base.h>
+#include <e32std.h>
+#include <e32svr.h>
+
+#include "stfeventsystemdefs.h"
+#include "eventsystemserver.h"
+
+//  Local Functions
+
+// TestEngine server starter
+LOCAL_C void RunEventSystemServerL()
+    {
+    RDebug::Print(_L("STF [ESS]: RunEventSystemServerL start"));
+    // Naming the server thread after the server helps to debug panics
+    User::LeaveIfError(RProcess::RenameMe(KEventSystemServName));
+    
+    // Create and install active scheduler
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL(scheduler);
+    CActiveScheduler::Install(scheduler);
+    
+    // Create TestEngine server and leave it on the cleanup stack
+    CEventSystemServer* eventSystemServer = CEventSystemServer::NewLC(CActive::EPriorityStandard);
+    
+    // Initialisation complete, now signal the client
+    RProcess::Rendezvous(KErrNone);
+    
+    // Ready to run
+    CActiveScheduler::Start();
+    
+    // Cleanup the server and scheduler
+    CleanupStack::PopAndDestroy(eventSystemServer);
+    CleanupStack::PopAndDestroy(scheduler);
+    RDebug::Print(_L("STF [ESS]: RunEventSystemServerL end"));
+    }
+
+//  Global Functions
+GLDEF_C TInt E32Main()
+    {
+    RDebug::Print(_L("STF [ESS]: E32Main of EventServer start"));
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    TInt r = KErrNoMemory;
+    if(cleanup)
+        {
+        TRAP(r, RunEventSystemServerL());
+        delete cleanup;
+        }
+    __UHEAP_MARKEND;
+    RDebug::Print(_L("STF [ESS]: E32Main of EventServer end result=[%d]"), r);
+    return r;
+    }
+
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/src/stateevent.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,91 @@
+/*
+* 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: 
+*
+*/
+
+#include <e32svr.h>
+#include "stateevent.h"
+
+
+/**
+ * Constructor for performing 1st stage construction
+ */
+CStateEvent::CStateEvent()
+    {
+    }
+
+/**
+ * Destructor.
+ */
+CStateEvent::~CStateEvent()
+    {
+    delete iEventName;
+    }
+
+/**
+ * Two-phased constructor.
+ */
+CStateEvent* CStateEvent::NewLC(const TDesC& aEventName)
+    {
+    CStateEvent* self = new (ELeave) CStateEvent();
+    CleanupStack::PushL(self);
+    self->ConstructL(aEventName);
+    return self;
+    }
+
+/**
+ * Two-phased constructor.
+ */
+CStateEvent* CStateEvent::NewL(const TDesC& aEventName)
+    {
+    CStateEvent* self = CStateEvent::NewLC(aEventName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+/**
+ * Constructor for performing 2nd stage construction
+ */
+void CStateEvent::ConstructL(const TDesC& aEventName)
+    {
+    iEventName = aEventName.AllocL();
+    iToBeUnset = EFalse;
+    }
+
+/**
+ * Checks if event name is the same as provided in argument
+ */
+TInt CStateEvent::IsMatchingEvent(const TDesC& aEventName)
+    {
+    return (aEventName.Compare(*iEventName) == 0) ? (1) : (0);
+    }
+
+/**
+ * Set flag which says that event will be unset when matching waiting event will be released
+ */
+void CStateEvent::NotifyToBeUnset(TBool aValue)
+    {
+    iToBeUnset = aValue;
+    }
+
+/**
+ * Returns flag which says that event will be unset when matching waiting event will be released
+ */
+bool CStateEvent::IsToBeUnset()
+    {
+    return iToBeUnset;
+    }
+    
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/eventsystem/server/src/waitingevent.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -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: 
+*
+*/
+
+#include <e32svr.h>
+#include <stfeventsystemerrorcodes.h>
+#include "waitingevent.h"
+
+
+/**
+ * Constructor for performing 1st stage construction
+ */
+CWaitingEvent::CWaitingEvent(const TInt aOwnerId): iOwnerId(aOwnerId)
+    {
+    RDebug::Print(_L("STF [ESS]: CWaitingEvent::CWaitingEvent() iOwnerId=[%d]"), iOwnerId);
+    }
+
+/**
+ * Destructor.
+ */
+CWaitingEvent::~CWaitingEvent()
+    {
+    RDebug::Print(_L("STF [ESS]: CWaitingEvent::~CWaitingEvent() iOwnerId=[%d]"), iOwnerId);
+    if(iMessage && iState == EEventWaiting)
+        {
+        RDebug::Print(_L("STF [ESS]: Cancelling event [%S] in destructor"), iEventName);
+        iMessage->Complete(KErrCancel);
+        delete iMessage;
+        }
+    delete iEventName;
+    }
+
+/**
+ * Two-phased constructor.
+ */
+CWaitingEvent* CWaitingEvent::NewLC(const TDesC& aEventName, const TInt aOwnerId)
+    {
+    //RDebug::Print(_L("STF [ESS]: CWaitingEvent::NewLC()"));
+    CWaitingEvent* self = new (ELeave) CWaitingEvent(aOwnerId);
+    CleanupStack::PushL(self);
+    self->ConstructL(aEventName);
+    return self;
+    }
+
+/**
+ * Two-phased constructor.
+ */
+CWaitingEvent* CWaitingEvent::NewL(const TDesC& aEventName, const TInt aOwnerId)
+    {
+    //RDebug::Print(_L("STF [ESS]: CWaitingEvent::NewL()"));
+    CWaitingEvent* self = CWaitingEvent::NewLC(aEventName, aOwnerId);
+    CleanupStack::Pop();
+    return self;
+    }
+
+/**
+ * Constructor for performing 2nd stage construction
+ */
+void CWaitingEvent::ConstructL(const TDesC& aEventName)
+    {
+    //RDebug::Print(_L("STF [ESS]: CWaitingEvent::ConstructL()"));
+    iEventName = aEventName.AllocL();
+    RDebug::Print(_L("STF [ESS]: Event [%S] is set state to [EEventRequested]"), iEventName);
+    iState = EEventRequested;
+    RDebug::Print(_L("STF [ESS]: Event [%S] is set iEventSetWhenRequested notification to [EFalse]"), iEventName);    
+    iEventSetWhenRequested = EFalse;
+    }
+
+/**
+ * Checks if event name is the same as provided in argument
+ */
+TInt CWaitingEvent::IsMatchingEvent(const TDesC& aEventName)
+    {
+    return (aEventName.Compare(*iEventName) == 0) ? (1) : (0);
+    }
+
+/**
+ * Checks if event name is the same as provided in argument
+ */
+TInt CWaitingEvent::IsMatchingEvent(const TDesC& aEventName, const TInt aOwnerId)
+    {
+    return (aEventName.Compare(*iEventName) == 0 && iOwnerId == aOwnerId) ? (1) : (0);
+    }
+
+/**
+ * Checks if event's session is the same as provided in argument
+ */
+TInt CWaitingEvent::IsMatchingSession(const CSession2* aSession)
+    {
+    return (aSession == iSession);
+    }
+
+/**
+ * Complete event
+ */
+void CWaitingEvent::CompleteEventL()
+    {
+    RDebug::Print(_L("STF [ESS]: CWaitingEvent::CompleteEventL(): Completing event [%S]"), iEventName);
+    if(iState == EEventWaiting)
+        {
+        iMessage->Complete(KErrNone);
+        delete iMessage;
+        iMessage = NULL;
+        RDebug::Print(_L("STF [ESS]: Event [%S] switches state to [EEventRequested]"), iEventName);
+        iState = EEventRequested;
+        if(iEventSetWhenRequested)
+            {
+            RDebug::Print(_L("STF [ESS]: Event [%S] switches iEventSetWhenRequested notification to [EFalse]"), iEventName);    
+            iEventSetWhenRequested = EFalse;
+            }
+        }
+    }
+    
+/**
+ * Cancel event (because i.e. test case is being cancelled)
+ */
+void CWaitingEvent::CancelEvent()
+    {
+    RDebug::Print(_L("STF [ESS]: CWaitingEvent::CancelEvent()"));
+    if(iMessage && iState == EEventWaiting)
+        {
+        iMessage->Complete(KErrCancel);
+        delete iMessage;
+        iMessage = NULL;
+        RDebug::Print(_L("STF [ESS]: Event [%S] switches state to [EEventRequested]"), iEventName);
+        iState = EEventRequested;
+        }
+    }
+
+/**
+ * Wait for event (allowed only if event is in requested state)
+ */
+void CWaitingEvent::WaitL(const RMessage2& aMessage, const CSession2* aSession)
+    {
+    __ASSERT_ALWAYS(aSession != NULL, PanicClient(aMessage, EEventSystemSessionNotDefined));
+
+    // Check if we can wait for event
+    if(iState != EEventRequested)
+        {
+        RDebug::Print(_L("STF [ESS]: CWaitingEvent::WaitL() Event not requested"));
+        User::Leave(EEventSystemNotInRequestedState);
+        }
+
+    // Set values
+    iMessage = new RMessage2(aMessage);
+    iSession = const_cast<CSession2*>(aSession);
+    
+    // Switch to real waiting
+    RDebug::Print(_L("STF [ESS]: Event [%S] switches state to [EEventWaiting]"), iEventName);
+    iState = EEventWaiting;
+    
+    // If indication event was set when this event was in requested state, complete immediately
+    if(iEventSetWhenRequested)
+         {
+         CompleteEventL();
+         }
+    }
+
+/**
+ * Give event name
+ */
+const TDesC& CWaitingEvent::EventName()
+    {
+    return *iEventName;
+    }
+
+/**
+ * Check if event is in requested state
+ */
+TInt CWaitingEvent::IsRequested()
+    {
+    return iState == EEventRequested;
+    }
+        
+/**
+ * Check if event is waitng
+ */
+TInt CWaitingEvent::IsWaiting()
+    {
+    return iState == EEventWaiting;
+    }
+
+/**
+Panics the client
+*/
+void CWaitingEvent::PanicClient(const RMessage2& aMessage, const TInt aPanic) const
+    {
+    RDebug::Print(_L("STF [ESS]: CWaitingEvent::PanicClient"));
+    _LIT(KMessage, "CEventSystemSession");
+    aMessage.Panic(KMessage, aPanic);
+    }
+
+// Notify requested event, that indicatin event 
+void CWaitingEvent::NotifyRequestedEventL()
+    {
+    if(!iEventSetWhenRequested)
+        {
+        RDebug::Print(_L("STF [ESS]: Event [%S] switches iEventSetWhenRequested notification to [ETrue]"), iEventName);    
+        iEventSetWhenRequested = ETrue;
+        }
+    }
+
+// Give owner id 
+TInt CWaitingEvent::OwnerId()
+    {
+    return iOwnerId;
+    }     
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,42 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STF framework.
+*/
+
+// STF Event System
+#include "../eventsystem/group/bld.inf"
+
+//STF Logger
+#include "../logger/group/bld.inf"
+
+// STF TestInterface
+#include "../testinterface/group/bld.inf"
+
+// STF TestServer
+#include "../testsrv/group/bld.inf"
+#include "../testsrvstarter/group/bld.inf"
+
+// ATS logger, which is used by TestEngine
+#include "../atslogger/group/bld.inf"
+
+// STF TestEngine
+#include "../testengine/group/bld.inf"
+
+// STF TestLib
+//#include "../testlib/group/bld.inf"
+
+// STF SU Event
+#include "../event/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLogger/inc/STFLoggerOverFlow.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+/*
+* 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: This file contains the header file of the 
+* TDesLoggerOverflowHandler and TDes8LoggerOverflowHandler.
+*
+*/
+
+#ifndef LOGGEROVERFLOW_H
+#define LOGGEROVERFLOW_H
+
+#include "STFLogger.h"
+
+
+// DESCRIPTION
+// TDesLoggerOverflowHandler is a STIF Test Framework StifLoggerBase class.
+// Class contains an over flow operations.
+class TDesSTFLoggerOverflowHandler 
+        :public TDes16Overflow
+    {
+    public:     // New functions
+        TDesSTFLoggerOverflowHandler( RSTFLogger* aLogger, TInt aOverFlowSource );
+        void Overflow( TDes16& aDes );
+
+    private:     // Data
+    	RSTFLogger* iLogger;
+        TInt iOverFlowSource;
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TDes8LoggerOverflowHandler is a STIF Test Framework StifLoggerBase class.
+// Class contains an over flow operations.
+class TDes8STFLoggerOverflowHandler 
+        :public TDes8Overflow
+    {
+    public:     // New functions
+
+        TDes8STFLoggerOverflowHandler( RSTFLogger* aLogger, TInt aOverFlowSource );
+        void Overflow( TDes8& aDes );
+
+    private:     // Data
+    	RSTFLogger* iLogger;
+        TInt iOverFlowSource;
+    };
+
+#endif      // LOGGEROVERFLOW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLogger/src/STFLogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,511 @@
+/*
+ * 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: 
+ * 
+ *
+ */
+
+//  Include Files  
+
+#include "STFLogger.h"	// RSTFLogger
+#include "STFLoggerCSCommon.h"
+#include "STFLoggerOverFlow.h"
+#include <hal.h> 
+#include "SettingServerClient.h"
+
+// Runs client-side and starts the separate server process
+static TInt StartTheServer()
+    {
+
+    //Ccheck server not already started
+    TFindServer findServer(KSTFLoggerServerBinaryName);
+    TFullName name;
+    if (findServer.Next(name) == KErrNone)
+        {
+        return KErrAlreadyExists;
+        }
+    RProcess server;
+    TInt r = server.Create(KSTFLoggerServerBinaryName, KNullDesC);
+    if (r != KErrNone)
+        return r;
+
+    TRequestStatus stat;
+    server.Rendezvous(stat);
+    if (stat != KRequestPending)
+        server.Kill(0); // abort startup
+    else
+        server.Resume(); // logon OK - start the server
+
+    User::WaitForRequest(stat); // wait for start or death
+
+    // Check the exit type.
+    // We can't use the 'exit reason' because if the server panicked this
+    // is set to the panic 'reason' (which may be '0' and cannot thus be distinguished
+    // from KErrNone)
+    r = server.ExitType();
+    if (EExitPanic == r)
+        r = KErrGeneral;
+    else
+        r = stat.Int();
+
+    server.Close(); // This is no longer needed
+    return r;
+    }
+
+//  Member Functions
+EXPORT_C TInt RSTFLogger::Connect()
+    {
+    TInt retry = 2;
+    for (;;)
+        {// Uses system-pool message slots
+        TInt r = CreateSession(KSTFLoggerServerName, TVersion(1, 0, 0));
+        if ((KErrNotFound != r) && (KErrServerTerminated != r))
+            return (r);
+        if (--retry == 0)
+            return (r);
+        r = StartTheServer();
+        if ((KErrNone != r) && (KErrAlreadyExists != r))
+            return (r);
+        }
+    }
+
+EXPORT_C TInt RSTFLogger::CreateL(const TDesC& aTestPath,
+        const TDesC& aTestFile, CStifLogger::TLoggerType aLoggerType,
+        CStifLogger::TOutput aOutput, TBool aOverWrite, TBool aWithTimeStamp,
+        TBool aWithLineBreak, TBool aWithEventRanking,
+        TBool aThreadIdToLogFile, TBool aCreateLogDir,
+        TInt aStaticBufferSize, TBool aUnicode)
+    {
+    if( KMaxName < aTestPath.Length() || KMaxName < aTestFile.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    // Handle to Setting server.
+    RSettingServer settingServer;
+    // Connect to the Setting server and create session
+    TInt ret = settingServer.Connect();
+    if (ret != KErrNone)
+        {
+        settingServer.Close();
+        return ret;
+        }
+    // Struct to StifLoggerBase settigs.
+    TLoggerSettings loggerSettings;
+    // Parse StifLoggerBase defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    settingServer.Close();
+    if (ret != KErrNone)
+        {
+        return ret;
+        }
+
+    TName testPath = aTestPath;
+    TName testFile = aTestFile;
+
+    // Take in use the overwrite parameters
+    OverwriteLoggerSettings(loggerSettings, testPath, testFile, aLoggerType,
+            aOutput, aOverWrite, aWithTimeStamp, aWithLineBreak,
+            aWithEventRanking, aThreadIdToLogFile, aCreateLogDir, aUnicode);
+    
+    RThread threadHandle;                   // A handle to a thread
+    TThreadId id = threadHandle.Id();       // Encapsulates the Id of a thread
+
+    TSTFLoggerCreateData loggerData(testPath, testFile, aLoggerType, aOutput,
+            aOverWrite, aWithTimeStamp, aWithLineBreak, aWithEventRanking,
+            aThreadIdToLogFile, aCreateLogDir, aStaticBufferSize, aUnicode, (TInt)id);
+    TPckg<TSTFLoggerCreateData> data(loggerData);
+    TIpcArgs args(&data);
+    return (SendReceive(ESTFLogger_CreateLogger, args));
+    }
+
+
+
+EXPORT_C TInt RSTFLogger::CreateL(const TDesC& aTestPath,
+        const TDesC& aTestFile, TLoggerSettings& aLoggerSettings)
+    {
+    TSTFLoggerCreateData loggerData;
+    loggerData.iTestPath = aTestPath;
+    loggerData.iTestFile = aTestFile;
+    loggerData.iOverWrite = aLoggerSettings.iOverwrite;
+    loggerData.iWithTimeStamp = aLoggerSettings.iTimeStamp;
+    loggerData.iWithLineBreak = aLoggerSettings.iLineBreak;
+    loggerData.iWithEventRanking = aLoggerSettings.iEventRanking;
+    loggerData.iThreadIdToLogFile = aLoggerSettings.iThreadId;
+    loggerData.iCreateLogDir = aLoggerSettings.iCreateLogDirectories;
+    loggerData.iStaticBufferSize = 0;
+    loggerData.iUnicode = aLoggerSettings.iUnicode;
+    TInt cpu(0);
+    HAL::Get(HALData::ECPU, cpu);
+
+    // HW environment
+    if (cpu == HALData::ECPU_ARM)
+        {
+        loggerData.iOutput = aLoggerSettings.iHardwareOutput;
+        loggerData.iLoggerType = aLoggerSettings.iHardwareFormat;
+        } // End of HW environment branch
+
+    // Wins environment ( cpu == HALData::ECPU_X86 )
+    else
+        {
+        loggerData.iOutput = aLoggerSettings.iEmulatorOutput;
+        loggerData.iLoggerType = aLoggerSettings.iEmulatorFormat;
+        } // End of WINS environment branch
+    
+    RThread threadHandle;                   // A handle to a thread
+    TThreadId id = threadHandle.Id();       // Encapsulates the Id of a thread
+    
+    loggerData.iThreadId = (TInt)id;
+
+    TPckg<TSTFLoggerCreateData> data(loggerData);
+    TIpcArgs args(&data);
+    return (SendReceive(ESTFLogger_CreateLogger, args));
+    }
+
+EXPORT_C TInt RSTFLogger::Log(const TDesC& aLogInfo)
+    {
+    return (Log(CStifLogger::ENoStyle, aLogInfo));
+    }
+
+EXPORT_C TInt RSTFLogger::Log(const TDesC8& aLogInfo)
+    {
+    return (Log(CStifLogger::ENoStyle, aLogInfo));
+    }
+
+EXPORT_C TInt RSTFLogger::Log(TInt aStyle, const TDesC& aLogInfo)
+    {
+    TIpcArgs args(aLogInfo.Length(), aStyle, &aLogInfo);
+    return (SendReceive(ESTFLogger_Log_TInt_TDesC, args));
+    }
+
+EXPORT_C TInt RSTFLogger::Log(TInt aStyle, const TDesC8& aLogInfo)
+    {
+    TIpcArgs args(aLogInfo.Length(), aStyle, &aLogInfo);
+    return (SendReceive(ESTFLogger_Log_TInt_TDesC8, args));
+    }
+
+EXPORT_C TInt RSTFLogger::Log(TRefByValue<const TDesC> aLogInfo, ...)
+    {
+    VA_LIST list;
+    VA_START( list, aLogInfo );
+    TLogInfo logInfo;
+
+    // Create overflow handler. If the log information size is over the
+    // KMaxLogData rest of the information will cut.
+    TDesSTFLoggerOverflowHandler overFlowHandler(this, 1);
+
+    // Parse parameters
+    logInfo.AppendFormatList(aLogInfo, list, &overFlowHandler);
+
+    // No text style info
+
+    return Log(CStifLogger::ENoStyle, logInfo);
+    }
+
+EXPORT_C TInt RSTFLogger::Log(TRefByValue<const TDesC8> aLogInfo, ...)
+    {
+    VA_LIST list;
+    VA_START( list, aLogInfo );
+    TLogInfo8 logInfo;
+
+    // Create overflow handler. If the log information size is over the
+    // KMaxLogData rest of the information will cut.
+    TDes8STFLoggerOverflowHandler overFlowHandler(this, 1);
+
+    // Parse parameters
+    logInfo.AppendFormatList(aLogInfo, list, &overFlowHandler);
+
+    // No text style info
+    return Log(CStifLogger::ENoStyle, logInfo);
+    }
+
+EXPORT_C TInt RSTFLogger::Log(TInt aStyle, TRefByValue<const TDesC> aLogInfo,
+        ...)
+    {
+    VA_LIST list;
+    VA_START( list, aLogInfo );
+    TLogInfo logInfo;
+
+    // Create overflow handler. If the log information size is over the
+    // KMaxLogData rest of the information will cut.
+    TDesSTFLoggerOverflowHandler overFlowHandler(this, 2);
+
+    // Parse parameters
+    logInfo.AppendFormatList(aLogInfo, list, &overFlowHandler);
+
+    return Log(aStyle, logInfo);
+    }
+
+EXPORT_C TInt RSTFLogger::Log(TInt aStyle,
+        TRefByValue<const TDesC8> aLogInfo, ...)
+    {
+    VA_LIST list;
+    VA_START( list, aLogInfo );
+    TLogInfo8 logInfo;
+
+    // Create overflow handler. If the log information size is over the
+    // KMaxLogData rest of the information will cut.
+    TDes8STFLoggerOverflowHandler overFlowHandler(this, 2);
+
+    // Parse parameters
+    logInfo.AppendFormatList(aLogInfo, list, &overFlowHandler);
+
+    return Log(aStyle, logInfo);
+    }
+
+EXPORT_C TInt RSTFLogger::WriteDelimiter(const TDesC& aDelimiter, TInt aCount)
+    {
+    TLogInfo delimiter;
+
+    // Create overflow handler. If the delimiter size expands over the
+    // KMaxLogData the TDesLoggerOverflowHandler will call.
+    TDesSTFLoggerOverflowHandler overFlowHandler(this, 3);
+
+    // Create a delimiter
+    for (TInt a = 0; a < aCount; a++)
+        {
+        // If delimiter creation keeps under the KMaxLogData.
+        // If not we use TDesLoggerOverflowHandler.
+        if ((a * aDelimiter.Length()) < KMaxLogData)
+            {
+            delimiter.Append(aDelimiter);
+            }
+        // KMaxLogData is exceeded
+        else
+            {
+            // If the title size is over the KMaxLogData default delimiter will
+            // use. Use normal overflowhandler to print overflow information.
+            TBuf<4> empty; // Not really used.
+            overFlowHandler.Overflow(empty);
+            delimiter.Copy(
+                    _L( "##################################################" ));
+            break;
+            }
+        }
+
+    // No text style info
+    return Log(CStifLogger::ENoStyle, delimiter);
+    }
+
+EXPORT_C TInt RSTFLogger::WriteDelimiter(const TDesC8& aDelimiter,
+        TInt aCount)
+    {
+    TLogInfo8 delimiter;
+
+    // Create overflow handler. If the delimiter size expands over the
+    // KMaxLogData the TDesLoggerOverflowHandler will call.
+    TDes8STFLoggerOverflowHandler overFlowHandler(this, 3);
+
+    // Create a delimiter
+    for (TInt a = 0; a < aCount; a++)
+        {
+        // If delimiter creation keeps under the KMaxLogData.
+        // If not we use TDesLoggerOverflowHandler.
+        if ((a * aDelimiter.Length()) < KMaxLogData)
+            {
+            delimiter.Append(aDelimiter);
+            }
+        // KMaxLogData is exceeded
+        else
+            {
+            // If the title size is over the KMaxLogData default delimiter will
+            // use. Use normal overflowhandler to print overflow information.
+            TBuf8<4> empty; // Not really used.
+            overFlowHandler.Overflow(empty);
+            delimiter.Copy(
+                    _L8( "##################################################" ));
+            break;
+            }
+        }
+
+    // No text style info
+    return Log(CStifLogger::ENoStyle, delimiter);
+    }
+
+EXPORT_C TInt RSTFLogger::SaveData(const TDesC& aData)
+    {
+    return Log(CStifLogger::ENoStyle, aData);
+    }
+
+EXPORT_C TInt RSTFLogger::SaveData(const TDesC8& aData)
+    {
+    return Log(CStifLogger::ENoStyle, aData);
+    }
+
+EXPORT_C TInt RSTFLogger::CreationResult(TInt& aResult)
+    {
+    TPckg<TInt> data(aResult);
+    TIpcArgs args(&data);
+    return (SendReceive(ESTFLogger_CreationResult, args));
+    }
+
+EXPORT_C TInt RSTFLogger::OutputType(CStifLogger::TOutput& aOutputType)
+    {
+    TPckg<CStifLogger::TOutput> data(aOutputType);
+    TIpcArgs args(&data);
+    return (SendReceive(ESTFLogger_OutputType, args));
+    }
+
+void RSTFLogger::OverwriteLoggerSettings(TLoggerSettings& aLoggerSettings,
+        TName& aTestPath, TName& aTestFile,
+        CStifLogger::TLoggerType& aLoggerType, CStifLogger::TOutput& aOutput,
+        TBool& aOverWrite, TBool& aWithTimeStamp, TBool& aWithLineBreak,
+        TBool& aWithEventRanking, TBool& aThreadIdToLogFile,
+        TBool& aCreateLogDir, TBool& aUnicode)
+    {
+    // Which environment is in use
+    TInt cpu(0);
+
+    // Indicator is file type remove acceptable operation
+    TBool removeFileType(EFalse);
+
+    // Get environment
+    HAL::Get(HALData::ECPU, cpu);
+
+    // HW environment
+    if (cpu == HALData::ECPU_ARM)
+        {
+        TInt pathLen = aTestPath.Length()
+                + aLoggerSettings.iHardwarePath.Length();
+
+        // Check that path overwrite setting is defined and length is legal
+        if (aLoggerSettings.iIsDefined.iHwPath && pathLen < KMaxName)
+            {
+            TName newPath;
+            newPath = aLoggerSettings.iHardwarePath;
+            // Check is '\' the last character
+            TInt ret(0);
+            ret = newPath.LocateReverse(92);
+            // Is '\' character founded
+            if (ret != KErrNotFound)
+                {
+                // Is '\' last character
+                if (ret == (newPath.Length() - 1))
+                    {
+                    // delete last '\'
+                    newPath.Delete((aLoggerSettings.iHardwarePath.Length()
+                            - 1), 1);
+                    }
+                }
+            // Removes drive letter if given and appends implemented path 
+            TParse parse;
+            parse.Set(aTestPath, NULL, NULL);
+            // Path() return value starts with '\'
+            newPath.Append(parse.Path());
+            aTestPath = newPath;
+            }
+        if (aLoggerSettings.iIsDefined.iHwFormat)
+            {
+            aLoggerType = aLoggerSettings.iHardwareFormat;
+            // Remove file type if it is set
+            removeFileType = ETrue;
+            }
+        if (aLoggerSettings.iIsDefined.iHwOutput)
+            {
+            aOutput = aLoggerSettings.iHardwareOutput;
+            }
+        }
+
+    // Wins environment ( cpu == HALData::ECPU_X86 )
+    else
+        {
+        TInt pathLen = aTestPath.Length()
+                + aLoggerSettings.iEmulatorPath.Length();
+
+        // Check that path overwrite setting is defined and length is legal
+        if (aLoggerSettings.iIsDefined.iPath && pathLen < KMaxName)
+            {
+            TName newPath;
+            newPath = aLoggerSettings.iEmulatorPath;
+            // Check is '\' the last character
+            TInt ret(0);
+            ret = newPath.LocateReverse(92);
+            // Is '\' character founded
+            if (ret != KErrNotFound)
+                {
+                // Is '\' last character
+                if (ret == (newPath.Length() - 1))
+                    {
+                    // delete last '\'
+                    newPath.Delete((aLoggerSettings.iEmulatorPath.Length()
+                            - 1), 1);
+                    }
+                }
+            // Removes drive letter if given and appends implemented path
+            TParse parse;
+            parse.Set(aTestPath, NULL, NULL);
+            // Path() return value starts with '\'
+            newPath.Append(parse.Path());
+            aTestPath = newPath;
+            }
+        if (aLoggerSettings.iIsDefined.iFormat)
+            {
+            aLoggerType = aLoggerSettings.iEmulatorFormat;
+            // Remove file type if it is set
+            removeFileType = ETrue;
+            }
+        if (aLoggerSettings.iIsDefined.iOutput)
+            {
+            aOutput = aLoggerSettings.iEmulatorOutput;
+            }
+        }
+
+    // Rest of the overwrite values
+    if (aLoggerSettings.iIsDefined.iOverwrite)
+        {
+        aOverWrite = aLoggerSettings.iOverwrite;
+        }
+    if (aLoggerSettings.iIsDefined.iTimeStamp)
+        {
+        aWithTimeStamp = aLoggerSettings.iTimeStamp;
+        }
+    if (aLoggerSettings.iIsDefined.iLineBreak)
+        {
+        aWithLineBreak = aLoggerSettings.iLineBreak;
+        }
+    if (aLoggerSettings.iIsDefined.iEventRanking)
+        {
+        aWithEventRanking = aLoggerSettings.iEventRanking;
+        }
+    if (aLoggerSettings.iIsDefined.iThreadId)
+        {
+        aThreadIdToLogFile = aLoggerSettings.iThreadId;
+        }
+    if (aLoggerSettings.iIsDefined.iCreateLogDir)
+        {
+        aCreateLogDir = aLoggerSettings.iCreateLogDirectories;
+        }
+    if (aLoggerSettings.iIsDefined.iUnicode)
+        {
+        aUnicode = aLoggerSettings.iUnicode;
+        }
+
+    // Remove file type if allowed and if file type is set to filename
+    if (removeFileType)
+        {
+        // Remove file type '.XXX' from file name if exist
+        if (aTestFile.Find(_L( "." )))
+            {
+            TParse parse;
+            parse.Set(aTestFile, NULL, NULL);
+            // Type length
+            TInt length(0);
+            // '.XXX'
+            length = parse.Ext().Length();
+            // Delete type
+            aTestFile.Delete(aTestFile.Length() - length, length);
+            }
+        }
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLogger/src/STFLoggerOverFlow.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,200 @@
+/*
+ * 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: This module contains implementation of 
+ * TDesLoggerOverflowHandler class member functions.
+ *
+ */
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "STFLoggerOverFlow.h"
+#include "LoggerTracing.h"
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: TDesLoggerOverflowHandler
+
+ Method: TDesLoggerOverflowHandler
+
+ Description: Default constructor
+
+ Parameters: CStifLoggerBase* aLogger: in: Pointer to CStifLoggerBase object
+ TInt aOverFlowSource: in: Over flow source
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+TDesSTFLoggerOverflowHandler::TDesSTFLoggerOverflowHandler(
+        RSTFLogger* aLogger, TInt aOverFlowSource)
+    {
+    iLogger = aLogger;
+    iOverFlowSource = aOverFlowSource;
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: TDesLoggerOverflowHandler
+
+ Method: Overflow
+
+ Description: Simple overflow handling(16 bit)
+
+ Parameters: TDes16 &aDes: in: Reference to over flow data
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+void TDesSTFLoggerOverflowHandler::Overflow(TDes16& aDes)
+    {
+    __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) );
+
+    // If overflow
+    TInt len(0);
+    len = aDes.Length();
+
+    // const TInt to TInt avoiding warnings
+    TInt maxLogData = KMaxLogData;
+    TInt maxTestFileName = KMaxFileName;
+
+    // Overflow: Log() without aStyle or Log() with aStyle
+    if ((iOverFlowSource == 1 || iOverFlowSource == 2) && maxLogData > 60)
+        {
+        // Log overflow info if info is in allowed limits
+        aDes[len - 2] = 13; // 13 or '\' in Symbian OS
+        aDes[len - 1] = 10; // 10 or 'n' in Symbian OS
+        // ~60
+        iLogger->Log(0,
+                _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!"));
+        }
+    // Overflow: WriteDelimiter()
+    if (iOverFlowSource == 3 && maxLogData > 70)
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Log(
+                0,
+                _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ));
+        }
+    // Overflow: StartHtmlPage()
+    if (iOverFlowSource == 4 && maxTestFileName > 70)
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Log(
+                0,
+                _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ));
+        }
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: TDes8OverflowHandler
+
+ Method: TDes8LoggerOverflowHandler
+
+ Description: Default constructor
+
+ Parameters: CStifLoggerBase* aLogger: in: Pointer to CStifLoggerBase object
+ TInt aOverFlowSource: in: Over flow source
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+TDes8STFLoggerOverflowHandler::TDes8STFLoggerOverflowHandler(
+        RSTFLogger* aLogger, TInt aOverFlowSource)
+    {
+    iLogger = aLogger;
+    iOverFlowSource = aOverFlowSource;
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: TDes8LoggerOverflowHandler
+
+ Method: Overflow
+
+ Description: Simple overflow handling(8 bit)
+
+ Parameters: TDes8 &aDes: in: Reference to over flow data
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+void TDes8STFLoggerOverflowHandler::Overflow(TDes8& aDes)
+    {
+    __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) );
+
+    // If overflow
+    TInt len(0);
+    len = aDes.Length();
+
+    // const TInt to TInt avoiding warnings
+    TInt maxLogData = KMaxLogData;
+    TInt maxTestFileName = KMaxFileName;
+
+    // Overflow: Log() without aStyle or Log() with aStyle
+    if ((iOverFlowSource == 1 || iOverFlowSource == 2) && maxLogData > 60)
+        {
+        // Log overflow info if info is in allowed limits
+        aDes[len - 2] = 13; // 13 or '\' in Symbian OS
+        aDes[len - 1] = 10; // 10 or 'n' in Symbian OS
+        // ~60
+        iLogger->Log(0,
+                _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!"));
+        }
+    // Overflow: WriteDelimiter()
+    if (iOverFlowSource == 3 && maxLogData > 70)
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Log(
+                0,
+                _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ));
+        }
+    // Overflow: StartHtmlPage()
+    if (iOverFlowSource == 4 && maxTestFileName > 70)
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Log(
+                0,
+                _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ));
+        }
+
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLogger/src/StifLogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,600 @@
+/*
+ * 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: This module contains implementation of CStifLogger 
+ * class member functions.
+ *
+ */
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "StifLogger.h"
+#include "STFLogger.h"
+#include "STFLoggerOverFlow.h"
+#include "SettingServerClient.h"
+
+CStifLogger::CStifLogger() :
+    iLogger(NULL)
+    {
+    }
+
+void CStifLogger::ConstructL(const TDesC& aTestPath, const TDesC& aTestFile,
+        TLoggerType aLoggerType, TOutput aOutput, TBool aOverWrite,
+        TBool aWithTimeStamp, TBool aWithLineBreak, TBool aWithEventRanking,
+        TBool aThreadIdToLogFile, TBool aCreateLogDir,
+        TInt aStaticBufferSize, TBool aUnicode)
+    {
+    TInt ret;
+    if(!iLogger)
+        {
+        iLogger = new (ELeave) RSTFLogger();
+        ret = iLogger->Connect();
+        if (ret)
+            {
+            User::Leave(ret);
+            }
+        }
+    ret = iLogger->CreateL(aTestPath, aTestFile, aLoggerType, aOutput,
+            aOverWrite, aWithTimeStamp, aWithLineBreak, aWithEventRanking,
+            aThreadIdToLogFile, aCreateLogDir, aStaticBufferSize, aUnicode);
+    if (ret)
+        {
+        User::Leave(ret);
+        }
+    }
+
+void CStifLogger::ConstructL(const TDesC& aTestPath, const TDesC& aTestFile,
+        TLoggerSettings& aLoggerSettings)
+    {
+
+    TInt ret;
+    if(!iLogger)
+        {
+        iLogger = new (ELeave) RSTFLogger();
+        ret = iLogger->Connect();
+        if (ret)
+            {
+            User::Leave(ret);
+            }
+        }
+    ret = iLogger->CreateL(aTestPath, aTestFile, aLoggerSettings);
+    if (ret)
+        {
+        User::Leave(ret);
+        }
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: NewL
+
+ Description: Two-phased constructor.
+
+ Parameters: const TDesC& aTestPath: in: Path to logged information
+ const TDesC& aTestFile: in: Log name for information
+ TLoggerType aLoggerType: in: Log file type(txt, html,
+ data)
+ TOutput aOutput: in: Output source(File)
+ TBool aOverWrite: in: Indicator to file overwrite
+ TBool aWithTimeStamp: in: Indicator to time stamp
+ TBool aWithLineBreak: in: Indicator to line break
+ TBool aWithEventRanking: in: Indicator to event ranking
+ TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+ end of the log file
+ TBool aCreateLogDir: in: Indicator to directory creation
+ TInt  aStaticBufferSize
+ TBool aUnicode: in: Indicator if file has to be in unicode format
+
+ Return Values: CStifLogger* logger: pointer to CStifLogger object
+
+ Errors/Exceptions: Leaves if aTestPath or aTestFile length is over KMaxName
+ Leaves if called serv.Connect() method fails
+ Leaves if called CHtmlLogger::NewL method fails
+ Leaves if called CDataLogger::NewL method fails
+ Leaves if called CTxtLogger::NewL method fails
+
+ Status: Proposal
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C CStifLogger* CStifLogger::NewL(const TDesC& aTestPath,
+        const TDesC& aTestFile, TLoggerType aLoggerType, TOutput aOutput,
+        TBool aOverWrite, TBool aWithTimeStamp, TBool aWithLineBreak,
+        TBool aWithEventRanking, TBool aThreadIdToLogFile,
+        TBool aCreateLogDir, TInt aStaticBufferSize, TBool aUnicode)
+    {
+    if( KMaxName < aTestPath.Length() || KMaxName < aTestFile.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    CStifLogger* self = new (ELeave) CStifLogger();
+    CleanupStack::PushL(self);
+
+    self->ConstructL(aTestPath, aTestFile, aLoggerType, aOutput, aOverWrite,
+            aWithTimeStamp, aWithLineBreak, aWithEventRanking,
+            aThreadIdToLogFile, aCreateLogDir, aStaticBufferSize, aUnicode);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: NewL
+
+ Description: Two-phased constructor.
+
+ TestEngine's and TestServer's are friend. For TestEngine's and
+ TestServer's StifLogger creation.
+
+ Parameters: const TDesC& aTestPath: in: Path to logged information
+ const TDesC& aTestFile: in: Log name for information
+ TLoggerSettings& aLoggerSettings: in: Struct for StifLogger
+ settigs
+
+ Return Values: CStifLogger* logger: pointer to CStifLogger object
+
+ Errors/Exceptions:  Leaves if called CHtmlLogger::NewL method fails
+ Leaves if called CDataLogger::NewL method fails
+ Leaves if called CTxtLogger::NewL method fails
+
+ Status: Proposal
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C CStifLogger* CStifLogger::NewL(const TDesC& aTestPath,
+        const TDesC& aTestFile, TLoggerSettings& aLoggerSettings)
+    {
+    CStifLogger* self = new (ELeave) CStifLogger();
+    CleanupStack::PushL(self);
+    self->ConstructL(aTestPath, aTestFile, aLoggerSettings);
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+
+CStifLogger::~CStifLogger()
+    {
+    if (iLogger)
+        {
+        iLogger->Close();
+        delete iLogger;
+        }
+    }
+
+void CStifLogger::OverwriteLoggerSettings(
+        TLoggerSettings& /*aLoggerSettings*/, TName& /*aTestPath*/,
+        TName& /*aTestFile*/, TLoggerType& /*aLoggerType*/,
+        TOutput& /*aOutput*/, TBool& /*aOverWrite*/,
+        TBool& /*aWithTimeStamp*/, TBool& /*aWithLineBreak*/,
+        TBool& /*aWithEventRanking*/, TBool& /*aThreadIdToLogFile*/,
+        TBool& /*aCreateLogDir*/, TBool& /*aUnicode*/)
+    {
+    //Keep nothing to do.
+    }
+
+EXPORT_C TInt CStifLogger::Log(const TDesC& aLogInfo)
+    {
+    // No text style info
+    return iLogger->Log(ENoStyle, aLogInfo);
+
+    }
+
+EXPORT_C TInt CStifLogger::Log(const TDesC8& aLogInfo)
+    {
+    // No text style info
+    return iLogger->Log(ENoStyle, aLogInfo);
+
+    }
+
+EXPORT_C TInt CStifLogger::Log(TInt aStyle, const TDesC& aLogInfo)
+    {
+    return iLogger->Log(aStyle, aLogInfo);
+
+    }
+
+EXPORT_C TInt CStifLogger::Log(TInt aStyle, const TDesC8& aLogInfo)
+    {
+    return iLogger->Log(aStyle, aLogInfo);
+
+    }
+
+EXPORT_C TInt CStifLogger::Log(TRefByValue<const TDesC> aLogInfo, ...)
+    {
+    VA_LIST list;
+    VA_START( list, aLogInfo );
+    TLogInfo logInfo;
+
+    TDesSTFLoggerOverflowHandler overFlowHandler(iLogger, 1);
+
+    // Parse parameters
+    logInfo.AppendFormatList(aLogInfo, list, &overFlowHandler);
+
+    // No text style info
+    return iLogger->Log(ENoStyle, logInfo);
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: Log
+
+ Description: Log a 8 bit information.
+
+ This log method accepts several parameters.
+
+ Parameters: TRefByValue<const TDesC8> aLogInfo: in: A templated class which 
+ encapsulates a reference to an object within a wrapper
+
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions:  TDes8LoggerOverflowHandler called if logged information is 
+ over KMaxLogData
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CStifLogger::Log(TRefByValue<const TDesC8> aLogInfo, ...)
+    {
+    VA_LIST list;
+    VA_START( list, aLogInfo );
+    TLogInfo8 logInfo;
+    // Create overflow handler. If the log information size is over the
+    // KMaxLogData rest of the information will cut.
+    TDes8STFLoggerOverflowHandler overFlowHandler(iLogger, 1);
+    // Parse parameters
+    logInfo.AppendFormatList(aLogInfo, list, &overFlowHandler);
+    // No text style info
+    return iLogger->Log(ENoStyle, logInfo);
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: Log
+
+ Description: Log a 16 bit information.
+
+ This log method accepts several parameters. There is also parameter to
+ styling text information e.g. text color.
+
+ Parameters: TInt aStyle: in: Logged text forming parameter
+ TRefByValue<const TDesC> aLogInfo: in: A templated class 
+ which encapsulates a reference to an object
+ within a wrapper
+
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions:  TDesOverflowHandler called if logged information is
+ over KMaxLogData
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CStifLogger::Log(TInt aStyle,
+        TRefByValue<const TDesC> aLogInfo, ...)
+    {
+    VA_LIST list;
+    VA_START( list, aLogInfo );
+    TLogInfo logInfo;
+
+    // Create overflow handler. If the log information size is over the
+    // KMaxLogData rest of the information will cut.
+    TDesSTFLoggerOverflowHandler overFlowHandler(iLogger, 2);
+
+    // Parse parameters
+    logInfo.AppendFormatList(aLogInfo, list, &overFlowHandler);
+
+    return iLogger->Log(aStyle, logInfo);
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: Log
+
+ Description: Log a 8 bit information.
+
+ This log method accepts several parameters. There is also parameter to
+ styling text information e.g. text color.
+
+ Parameters: TInt aStyle: in: Logged text forming parameter
+ TRefByValue<const TDesC8> aLogInfo: in: A templated class 
+ which encapsulates a reference to an object
+ within a wrapper
+
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions:  TDes8LoggerOverflowHandler called if logged information is
+ over KMaxLogData
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CStifLogger::Log(TInt aStyle,
+        TRefByValue<const TDesC8> aLogInfo, ...)
+    {
+    VA_LIST list;
+    VA_START( list, aLogInfo );
+    TLogInfo8 logInfo;
+
+    // Create overflow handler. If the log information size is over the
+    // KMaxLogData rest of the information will cut.
+    TDes8STFLoggerOverflowHandler overFlowHandler(iLogger, 2);
+
+    // Parse parameters
+    logInfo.AppendFormatList(aLogInfo, list, &overFlowHandler);
+
+    return iLogger->Log(aStyle, logInfo);
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: WriteDelimiter
+
+ Description: Log a 16 bit delimiter.
+
+ Log a delimiters required locations to the log information.
+ This will be used if parameters are not given when calling this method.
+
+ Parameters: const TDesC& aDelimiter: in: Logged delimiter(e.g. '#' or 'XO')
+ TInt aCount: in: Repeated count for delimiter
+
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions:  TDesLoggerOverflowHandler called if logged information
+ is over KMaxLogData.
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CStifLogger::WriteDelimiter(const TDesC& aDelimiter,
+        TInt aCount)
+    {
+    TLogInfo delimiter;
+
+    // Create overflow handler. If the delimiter size expands over the
+    // KMaxLogData the TDesLoggerOverflowHandler will call.
+    TDesSTFLoggerOverflowHandler overFlowHandler(iLogger, 3);
+
+    // Create a delimiter
+    for (TInt a = 0; a < aCount; a++)
+        {
+        // If delimiter creation keeps under the KMaxLogData.
+        // If not we use TDesLoggerOverflowHandler.
+        if ((a * aDelimiter.Length()) < KMaxLogData)
+            {
+            delimiter.Append(aDelimiter);
+            }
+        // KMaxLogData is exceeded
+        else
+            {
+            // If the title size is over the KMaxLogData default delimiter will
+            // use. Use normal overflowhandler to print overflow information.
+            TBuf<4> empty; // Not really used.
+            overFlowHandler.Overflow(empty);
+            delimiter.Copy(
+                    _L( "##################################################" ));
+            break;
+            }
+        }
+
+    // No text style info
+    return iLogger->Log(ENoStyle, delimiter);
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: WriteDelimiter
+
+ Description: Log a 8 bit delimiter.
+
+ Log a delimiters required locations to the log information.
+
+ Parameters: const TDesC8& aDelimiter: in: Logged delimiter
+ (e.g. '#' or 'XO')
+ TInt aCount: in: Repeated count for delimiter
+
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions:  TDes8LoggerOverflowHandler called if logged information is
+ over KMaxLogData.
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CStifLogger::WriteDelimiter(const TDesC8& aDelimiter,
+        TInt aCount)
+    {
+    TLogInfo8 delimiter;
+
+    // Create overflow handler. If the delimiter size expands over the
+    // KMaxLogData the TDesLoggerOverflowHandler will call.
+    TDes8STFLoggerOverflowHandler overFlowHandler(iLogger, 3);
+
+    // Create a delimiter
+    for (TInt a = 0; a < aCount; a++)
+        {
+        // If delimiter creation keeps under the KMaxLogData.
+        // If not we use TDesLoggerOverflowHandler.
+        if ((a * aDelimiter.Length()) < KMaxLogData)
+            {
+            delimiter.Append(aDelimiter);
+            }
+        // KMaxLogData is exceeded
+        else
+            {
+            // If the title size is over the KMaxLogData default delimiter will
+            // use. Use normal overflowhandler to print overflow information.
+            TBuf8<4> empty; // Not really used.
+            overFlowHandler.Overflow(empty);
+            delimiter.Copy(
+                    _L8( "##################################################" ));
+            break;
+            }
+        }
+
+    // No text style info
+    return iLogger->Log(ENoStyle, delimiter);
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: SaveData
+
+ Description: Save file or data( 16 bit ).
+
+ Used when is need to save file or data to storage e.g. web page.
+
+ Parameters: TDesC& aData: in: Data to be saved
+ 
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions:  None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CStifLogger::SaveData(TDesC& aData)
+    {
+    // No text style info
+    return iLogger->Log(ENoStyle, aData);
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: SaveData
+
+ Description: Save file or data( 8 bit ).
+
+ Used when is need to save file or data to storage e.g. web page.
+
+ Parameters: TDesC8& aData: in: Data to be saved
+ 
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions:  None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CStifLogger::SaveData(TDesC8& aData)
+    {
+    // No text style info
+    return iLogger->Log(ENoStyle, aData);
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: CreationResult
+
+ Description: Return StifLogger creation result.
+
+ Parameters: None
+ 
+ Return Values: StifLogger creation result
+
+ Errors/Exceptions:  None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CStifLogger::CreationResult()
+    {
+    TInt outputType;
+    iLogger->CreationResult(outputType);
+    return outputType;
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CStifLogger
+
+ Method: OutputType
+
+ Description: Get output type. Valid only if CreationResult returns KErrNone.
+
+ Parameters: TOutput& aOutput
+ 
+ Return Values: StifLogger creation result
+
+ Errors/Exceptions:  None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+EXPORT_C CStifLogger::TOutput CStifLogger::OutputType()
+    {
+
+    TOutput outputType;
+    iLogger->OutputType(outputType);
+    return outputType;
+
+    }
+
+EXPORT_C TInt CStifLogger::Send(TInt aStyle, const TDesC& aData)
+    {
+    return iLogger->Log(aStyle, aData);
+    }
+
+EXPORT_C TInt CStifLogger::Send(TInt aStyle, const TDesC8& aData)
+    {
+    return iLogger->Log(aStyle, aData);
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/group/STFLoggingServer.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,51 @@
+/*
+* 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: 
+* 
+*
+*/
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET		  	STFLoggingServer.exe
+TARGETTYPE	  	exe
+UID			 	0 0x2002BC9B
+
+CAPABILITY		ALL -TCB
+
+OS_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE	 	..\inc
+USERINCLUDE	 	..\..\common\inc
+
+SOURCEPATH	  ..\src
+SOURCE		  STFLogServer.cpp 
+SOURCE		  DataLogger.cpp 
+SOURCE		  FileOutput.cpp 
+SOURCE		  HtmlLogger.cpp 
+SOURCE		  LoggerOverFlow.cpp 
+SOURCE		  NullOutput.cpp 
+SOURCE		  Output.cpp 
+SOURCE		  RDebugOutput.cpp 
+SOURCE		  TxtLogger.cpp 
+SOURCE		  StifLoggerBase.cpp
+
+LIBRARY		 	euser.lib			// For TInt, etc.
+LIBRARY		 	efsrv.lib 			// For RFs file server
+LIBRARY         hal.lib     		// For logging (HAL)
+
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -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: 
+* 
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+STFLoggingServer.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/DataLogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,126 @@
+/*
+* 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: This file contains the header file of the CDataLogger.
+*
+*/
+
+#ifndef DATALOGGER_H
+#define DATALOGGER_H
+
+//  INCLUDES
+#include "StifLoggerBase.h"
+#include "FileOutput.h"
+#include "RDebugOutput.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class COutput;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CDataLogger is a STIF Test Framework StifLoggerBase class.
+// Class contains a file logging operations.
+
+class CDataLogger
+            :public CStifLoggerBase
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CDataLogger* NewL( const TDesC& aTestPath,
+                                    const TDesC& aTestFile,
+                                    CStifLogger::TLoggerType aLoggerType,
+                                    CStifLogger::TOutput aOutput,
+                                    TBool aOverWrite,
+                                    TBool aWithTimeStamp,
+                                    TBool aWithLineBreak,
+                                    TBool aWithEventRanking,
+                                    TBool aThreadIdToLogFile,
+                                    TBool aCreateLogDir,
+                                    TInt aStaticBufferSize,
+                                    TBool aUnicode,
+                                    TInt aThreadId);
+
+        /**
+        * Destructor.
+        */
+        ~CDataLogger();
+
+    public:     // New functions
+
+        /**
+        * Sent data to the output module. 16 bit. 
+        * aStyle parameter is not supporter in data logging.
+        */
+        TInt Send( TInt /*aStyle*/, const TDesC& aData );
+
+        /**
+        * Sent data to the output module. 8 bit.
+        * aStyle parameter is not supporter in data logging.
+        */
+        TInt Send( TInt /*aStyle*/, const TDesC8& aData );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CDataLogger( COutput* output );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // DATALOGGER_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/FileOutput.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,266 @@
+/*
+* 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: This file contains the header file of the CFileOutput.
+*
+*/
+
+#ifndef FILEOUTPUT_H
+#define FILEOUTPUT_H
+
+//  INCLUDES
+#include <f32file.h>
+
+#include "Output.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CFileOutput is a STIF Test Framework StifLoggerBase class.
+// Class contains a file logging operations.
+class CFileOutput 
+            :public COutput
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CFileOutput* NewL( const TDesC& aTestPath,
+                                    const TDesC& aTestFile,
+                                    CStifLogger::TLoggerType aLoggerType,
+                                    TBool aOverWrite,
+                                    TBool aWithTimeStamp,
+                                    TBool aWithLineBreak,
+                                    TBool aWithEventRanking,
+                                    TBool aThreadIdToLogFile,
+                                    TBool aCreateLogDir,
+                                    TInt  aStaticBufferSize,
+                                    TBool aUnicode,
+                                    TInt  aThreadId);
+
+        /**
+        * Destructor.
+        */
+        ~CFileOutput();
+
+    public:     // New functions
+
+        /**
+        * Create a directory.
+        */
+        void CreateDirectoryL( const TDesC& aTestPath );
+
+        /**
+        * Open an existing file.
+        */
+        void OpenExistingFileL( const TDesC& aTestPath,
+                                const TDesC& aTestFile );
+
+        /**
+        * Create a new file.
+        */
+        void CreateNewFileL( const TDesC& aTestPath, const TDesC& aTestFile );
+
+        /**
+        * Write log information or data to the file.
+        * 16 bit.
+        */
+        TInt Write( TBool aWithTimeStamp,
+                    TBool aWithLineBreak,
+                    TBool aWithEventRanking,
+                    const TDesC& aData );
+
+        /**
+        * Write log information or data to the file.
+        * 8 bit.
+        */
+        TInt Write( TBool aWithTimeStamp,
+                    TBool aWithLineBreak,
+                    TBool aWithEventRanking,
+                    const TDesC8& aData );
+
+        /**
+        * Add event ranking, specify number to line (1-byte version).
+        */
+        void EventRanking( TPtr8& aData );
+
+        /**
+        * Add event ranking, specify number to line (2-byte version).
+        */
+        void EventRanking( TPtr& aData );
+
+        /**
+        * Add date, time and line break to data (1-byte version).
+        */
+        void AddTimeStampToData( TPtr8& aData );
+
+        /**
+        * Add date, time and line break to data (2-byte version).
+        */
+        void AddTimeStampToData( TPtr& aData );
+
+        /**
+        * Get date and time.
+        */
+        void GetDateAndTime( TStifLoggerTimeStamp& aDataAndTime );
+
+        /**
+        * Make file type.
+        */
+        void FileType( const TDesC& aTestFile, TFileType& aFileType );
+
+        /**
+        * Generate thread id to test file name.
+        */
+        void TestFileWithThreadId( const TDesC& aTestFile,
+                                    TFileName& aNewTestFile );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CFileOutput( CStifLogger::TLoggerType aLoggerType,
+                        TBool aWithTimeStamp,
+                        TBool aWithLineBreak,
+                        TBool aWithEventRanking,
+                        TBool aThreadIdToLogFile,
+                        TInt  aThreadId);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aTestPath,
+                            const TDesC& aTestFile,
+                            TBool aOverWrite,
+                            TBool aCreateLogDir,
+                            TInt aStaticBufferSize,
+                            TBool aUnicode );
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        /**
+        * Log file directory name, file name and file type.
+        */
+        TFileName iFileAndDirName;
+
+        /**
+        * Indicates file type.
+        */
+        CStifLogger::TLoggerType iLoggerType;
+
+        /**
+        * Time stamp indicator.
+        */
+        TBool iWithTimeStamp;
+
+        /**
+        * Line break indicator.
+        */
+        TBool iWithLineBreak;
+
+        /**
+        * Event ranking indicator.
+        */
+        TBool iWithEventRanking;
+
+        /**
+        * Indicator to thread id adding to end of the log file
+        */
+        TBool iThreadIdToLogFile;
+
+        /**
+        * Indicator to thread id adding to end of the log file
+        */
+        TBool iCreateLogDir;
+
+        /**
+        * For the file handling
+        */
+        RFile iFile;
+
+        /**
+        * For the file session handling
+        */
+        RFs iFileSession;
+
+        /**
+        * Is file open indicator
+        */
+        TInt iIsFileOpen;
+
+       /**
+        * DataHBuf for logging purposes
+        */
+        HBufC8 * iDataHBuf8;
+
+		// @js
+        TInt iStaticBufferSize;
+
+       /**
+        * Determines if file has to be in unicode format
+        */
+        TBool iUnicode;
+
+       /**
+        * DataHBuf for logging purposes
+        */
+        HBufC16* iDataHBuf16;
+
+       /**
+        * Thread id of test case thread.
+        * Get from client side when creating logger.
+        */
+        TInt iThreadId;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // FILEOUTPUT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/HtmlLogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,149 @@
+/*
+* 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: This file contains the header file of the CHtmlLogger.
+*
+*/
+
+#ifndef HTMLLOGGER_H
+#define HTMLLOGGER_H
+
+//  INCLUDES
+#include "StifLoggerBase.h"
+#include "FileOutput.h"
+#include "RDebugOutput.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class COutput;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CHtmlLogger is a STIF Test Framework StifLoggerBase class.
+// Class contains a file logging operations.
+
+class CHtmlLogger
+            :public CStifLoggerBase
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtmlLogger* NewL( const TDesC& aTestPath,
+                                    const TDesC& aTestFile,
+                                    CStifLogger::TLoggerType aLoggerType,
+                                    CStifLogger::TOutput aOutput,
+                                    TBool aOverWrite,
+                                    TBool aWithTimeStamp,
+                                    TBool aWithLineBreak,
+                                    TBool aWithEventRanking,
+                                    TBool aThreadIdToLogFile,
+                                    TBool aCreateLogDir,
+                                    TInt aStaticBufferSize,
+                                    TBool aUnicode,
+                                    TInt aThreadId);
+
+        /**
+        * Destructor.
+        */
+        ~CHtmlLogger();
+
+    public:     // New functions
+
+        /**
+        * Initialize html page.
+        */
+        void StartHtmlPage( const TDesC& aTestFile, TBool aThreadIdToLogFile );
+
+        /**
+        * Finalize html page.
+        */
+        void EndHtmlPage();
+
+        /**
+        * Start style information logging.
+        */
+        void StyleStarting( TInt aStyle, TBool& aTimeStamp,
+                                TBool& aEventRanking );
+
+        /**
+        * End style information logging.
+        */
+        void StyleEnding( TInt aStyle );
+
+        /**
+        * Send style information and data to the output module.
+        * 16 bit.
+        */
+        TInt Send( TInt aStyle, const TDesC& aData );
+
+        /**
+        * Send style information and data to the output module.
+        * 8 bit.
+        */
+        TInt Send( TInt aStyle, const TDesC8& aData );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CHtmlLogger( COutput* output,
+                        const TDesC& aTestFile,
+                        TBool aThreadIdToLogFile );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // HTMLLOGGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/LoggerOverFlow.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,96 @@
+/*
+* 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: This file contains the header file of the 
+* TDesLoggerOverflowHandler and TDes8LoggerOverflowHandler.
+*
+*/
+
+#ifndef LOGGEROVERFLOW_H
+#define LOGGEROVERFLOW_H
+
+//  INCLUDES
+#include "StifLoggerBase.h"
+#include "Output.h"
+#include "RDebugOutput.h"
+
+// DESCRIPTION
+// TDesLoggerOverflowHandler is a STIF Test Framework StifLoggerBase class.
+// Class contains an over flow operations.
+
+class TDesLoggerOverflowHandler 
+        :public TDes16Overflow
+    {
+    public:     // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        TDesLoggerOverflowHandler( CStifLoggerBase* aLogger, TInt aOverFlowSource );
+
+        /**
+        * Simple overflow handling(16 bit)
+        */
+        void Overflow( TDes16& aDes );
+
+    public:     // Data
+
+        /**
+        * Pointer to CStifLoggerBase class object
+        */
+        CStifLoggerBase* iLogger;
+
+        /**
+        * Over flow source
+        */
+        TInt iOverFlowSource;
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TDes8LoggerOverflowHandler is a STIF Test Framework StifLoggerBase class.
+// Class contains an over flow operations.
+
+class TDes8LoggerOverflowHandler 
+        :public TDes8Overflow
+    {
+    public:     // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        TDes8LoggerOverflowHandler( CStifLoggerBase* aLogger, TInt aOverFlowSource );
+
+
+        /**
+        * Simple overflow handling(8 bit)
+        */
+        void Overflow( TDes8& aDes );
+
+    public:     // Data
+
+        /**
+        * Pointer to CStifLoggerBase class object
+        */
+        CStifLoggerBase* iLogger;
+
+        /**
+        * Over flow source
+        */
+        TInt iOverFlowSource;
+    };
+
+#endif      // LOGGEROVERFLOW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/NullOutput.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,120 @@
+/*
+* 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: This file contains the header file of the CNullOutput.
+*
+*/
+
+#ifndef NULLOUTPUT_H
+#define NULLOUTPUT_H
+
+//  INCLUDES
+#include "Output.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+// None
+
+// DESCRIPTION
+// CNullOutput is a STIF Test Framework StifLoggerBase class.
+// CNullOutput's methods purpose is to look like logging although it don't
+// do any logging operations.
+
+class CNullOutput 
+            :public COutput
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CNullOutput* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CNullOutput();
+
+    public:     // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        CNullOutput();
+
+        /**
+        * Write log information or data to the file.
+        * 16 bit.
+        */
+        TInt Write( TBool aWithTimeStamp,
+                    TBool aWithLineBreak,
+                    TBool aWithEventRanking,
+                    const TDesC& aData );
+
+        /**
+        * Write log information or data to the file.
+        * 8 bit.
+        */
+        TInt Write( TBool aWithTimeStamp,
+                    TBool aWithLineBreak,
+                    TBool aWithEventRanking,
+                    const TDesC8& aData );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // NULLOUTPUT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/Output.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,159 @@
+/*
+* 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: This file contains the header file of the COutput.
+*
+*/
+
+#ifndef OUTPUT_H
+#define OUTPUT_H
+
+//  INCLUDES
+
+#include "StifLoggerBase.h"
+#include "LoggerTracing.h"
+
+// CONSTANTS
+// Maximum length of the event ranking
+const TInt KMaxEventRanking = 5;
+
+// Maximum length of the space
+const TInt KMaxSpace = 1;
+
+// Maximum length of the HTML line break('<BR>' + '\n')
+const TInt KMaxHtmlLineBreak = 6;
+
+// Maximum length of the line break(13 or '\' and 10 or 'n' in Symbian OS)
+const TInt KMaxLineBreak = 2;
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// COutput is a STIF Test Framework StifLoggerBase class.
+// Class contains a file logging operations.
+
+class COutput
+        :public CBase
+    {
+    public:     // Enumerations
+            
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static COutput* NewL( const TDesC& aTestPath,
+                                const TDesC& aTestFile,
+                                CStifLogger::TLoggerType aLoggerType,
+                                CStifLogger::TOutput aOutput,
+                                TBool aOverWrite,
+                                TBool aWithTimeStamp,
+                                TBool aWithLineBreak,
+                                TBool aWithEventRanking,
+                                TBool aThreadIdToLogFile,
+                                TBool aCreateLogDir,
+                                TInt aStaticBufferSize,
+                                TBool aUnicode,
+                                TInt aThreadId);
+
+        /**
+        * Destructor.
+        */
+        virtual ~COutput();
+
+    public:     // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        COutput();
+
+        /**
+        * Pure virtual. Write log information or data to the file.
+        * 16 bit.
+        */
+        virtual TInt Write( TBool /* aWithTimeStamp */,
+                            TBool /* aWithTimeLineBreak */,
+                            TBool /* aWithEventRanking */,
+                            const TDesC& /* aData */ ) = 0;
+
+        /**
+        * Pure virtual. Write log information or data to the file.
+        * 8 bit.
+        */
+        virtual TInt Write( TBool /* aWithTimeStamp */,
+                            TBool /* aWithTimeLineBreak */,
+                            TBool /* aWithEventRanking */,
+                            const TDesC8& /* aData */ ) = 0;
+
+        /**
+        * Return output type.
+        */
+        inline TInt OutputCreationResult( CStifLogger::TOutput& aType )
+            { 
+            aType = iType;  
+            return iCreationResult; 
+            };
+            
+        /**
+        * Set output type.
+        */
+        inline void SetOutputCreationResult( TInt aResult, 
+                                                CStifLogger::TOutput aType )
+            { 
+            iType = aType;  
+            iCreationResult = aResult; 
+            };
+        
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+    public:     // Data
+
+    protected:  // Data
+        // Output type
+        CStifLogger::TOutput    iType;
+        TInt                    iCreationResult;
+
+    private:    // Data        
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // OUTPUT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/RDebugOutput.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,194 @@
+/*
+* 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: This file contains the header file of the CRDebugOutput.
+*
+*/
+
+#ifndef RDEBUGOUTPUT_H
+#define RDEBUGOUTPUT_H
+
+//  INCLUDES
+#include <f32file.h>
+
+#include "StifLoggerBase.h"
+#include "Output.h"
+#include "LoggerTracing.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CRDebugOutput is a STIF Test Framework StifLoggerBase class.
+// Class contains a RDebug logging operations.
+class CRDebugOutput 
+            :public COutput
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CRDebugOutput* NewL( const TDesC& /* aTestPath */,
+                                    const TDesC& /* aTestFile */,
+                                    CStifLogger::TLoggerType aLoggerType,
+                                    TBool /* aOverWrite */,
+                                    TBool aWithTimeStamp,
+                                    TBool aWithLineBreak,
+                                    TBool aWithEventRanking,
+                                    TBool /* aThreadIdToLogFile */,
+                                    TBool /* aCreateLogDir */,
+                                    TInt aStaticBufferSize );
+
+        /**
+        * Destructor.
+        */
+        ~CRDebugOutput();
+
+    public:     // New functions
+
+        /**
+        * Write RDebug information.
+        * 16 bit.
+        */
+        TInt Write( TBool aWithTimeStamp,
+                    TBool aWithLineBreak,
+                    TBool aWithEventRanking,
+                    const TDesC& aData );
+
+        /**
+        * Write RDebug information.
+        * 8 bit.
+        */
+        TInt Write( TBool aWithTimeStamp,
+                    TBool aWithLineBreak,
+                    TBool aWithEventRanking,
+                    const TDesC8& aData );
+
+        /**
+        * Event ranking and time stamp combimer.
+        */
+        void EventAndTimeCombiner( TPtr& aLogInfo,
+                                    TPtr& aData,
+                                    TBool aWithTimeStamp,
+                                    TBool aWithLineBreak,
+                                    TBool aWithEventRanking );
+
+        /**
+        * Add event ranking, specify number to line.
+        */
+        void EventRanking( TPtr& aData );
+                    
+        /**
+        * Add date, time and line break to data.
+        */
+        void AddTimeStampToData( TPtr& aData );
+
+        /**
+        * Get date and time.
+        */
+        void GetDateAndTime( TStifLoggerTimeStamp8& aDataAndTime );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CRDebugOutput( CStifLogger::TLoggerType aLoggerType,
+                        TBool aWithTimeStamp,
+                        TBool aWithLineBreak,
+                        TBool aWithEventRanking );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TInt aStaticBufferSize );
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        /**
+        * Data buffer
+        */
+        HBufC* iDataHBuf;
+
+        /**
+        * Indicates file type.
+        */
+        CStifLogger::TLoggerType iLoggerType;
+
+        /**
+        * Time stamp indicator.
+        */
+        TBool iWithTimeStamp;
+
+        /**
+        * Line break indicator.
+        */
+        TBool iWithLineBreak;
+
+        /**
+        * Event ranking indicator.
+        */
+        TBool iWithEventRanking;
+
+        /**
+        * DataHBuf for logging purposes
+        */      
+        HBufC * iDataHBuf1;      
+
+        /**
+        * DataHBuf for logging purposes
+        */      
+        HBufC * iDataHBuf2;      
+        
+        TInt iStaticBufferSize;
+       
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // RDEBUGOUTPUT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/STFLogServer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -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: 
+* 
+* 
+*/
+
+#ifndef __STFLOGGINGSERVER_H__
+#define __STFLOGGINGSERVER_H__
+
+//  Include Files
+
+#include <e32base.h>
+#include "STFLoggerCSCommon.h"
+#include "stifloggerbase.h"
+
+enum TServerPanic
+	{
+	EPanicBadDescriptor,
+	EPanicNotSupported
+	};
+
+void PanicClient(const RMessage2& aMessage,TServerPanic TMyPanic);
+
+const TInt KShutdownDelay=200000; // approx 2 seconds
+class CShutdown : public CTimer
+	{
+public:
+	inline CShutdown();
+	inline void ConstructL();
+	inline void Start();
+private:
+	void RunL();
+	};
+
+
+inline CShutdown::CShutdown()
+	:CTimer(-1)
+	{CActiveScheduler::Add(this);}
+inline void CShutdown::ConstructL()
+	{CTimer::ConstructL();}
+inline void CShutdown::Start()
+	{After(KShutdownDelay);}
+
+class CSTFLogServer : public CServer2
+	{
+	public:
+		static CServer2* NewLC();
+		void AddSession();
+		void RemoveSession();
+	private:
+		CSTFLogServer();
+		void ConstructL();
+		// From CServer2
+		virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; 
+	private:
+		TInt iSessionCount;
+		CShutdown iShutdown;		
+	};
+
+inline CSTFLogServer::CSTFLogServer()
+	:CServer2(CActive::EPriorityStandard)
+	{}
+
+class CSTFLogSession : public CSession2
+	{
+public:
+	CSTFLogSession();
+	void CreateL();
+public:
+	virtual void ServiceL(const RMessage2& aMessage); // From CSession2
+	virtual void ServiceError(const RMessage2& aMessage, TInt aError); // From CSession2
+private:
+	void CreateLogger(const RMessage2& aMessage);
+	void Log_TInt_TDesCL(const RMessage2& aMessage);
+	void Log_TInt_TDesC8L(const RMessage2& aMessage);
+	void CreationResult(const RMessage2& aMessage);
+	void OutputType(const RMessage2& aMessage);
+
+private:
+	~CSTFLogSession();
+private:
+	CStifLoggerBase* iLogger;
+	};
+
+inline CSTFLogSession::CSTFLogSession()
+	{}
+
+
+GLDEF_C TInt E32Main();
+
+#endif  // __STFLOGGINGSERVER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/StifLoggerBase.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,158 @@
+/*
+* 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: This file contains the header file of the 
+* CStifLoggerBase.
+*
+*/
+
+#ifndef STIFLOGGERBASE_H
+#define STIFLOGGERBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <StifLogger.h>
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CStifLoggerBase is a STIF Test Framework StifLogger class.
+// Class contains a file logging operations.
+
+class CStifLoggerBase 
+        :public CBase
+    {
+ 
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CStifLoggerBase* NewL( const TDesC& aTestPath,
+                                            const TDesC& aTestFile,
+                                            // Default logger type is .txt
+                                            CStifLogger::TLoggerType aLoggerType = CStifLogger::ETxt,
+                                            // By default output is file
+                                            CStifLogger::TOutput aOutput = CStifLogger::EFile,
+                                            // By default overwrite is used
+                                            TBool aOverWrite = ETrue,
+                                            // By default time stamp is used
+                                            TBool aWithTimeStamp = ETrue,
+                                            // By default line break is used
+                                            TBool aWithLineBreak = ETrue,
+                                            // By default even ranking is not
+                                            // used
+                                            TBool aWithEventRanking = EFalse,
+                                            // By default thread id is added
+                                            // after the log file
+                                            TBool aThreadIdToLogFile = ETrue,
+                                            // By default log directory will
+                                            // not create
+                                            TBool aCreateLogDir = EFalse,
+                                            // Static logger implementation is
+                                            // not yet permanent, may change 
+                                            TInt aStaticBufferSize = 0,
+                                            // By default files are not written
+                                            // in unicode format
+                                            TBool aUnicode = EFalse,
+                                            TInt aThreadId =0);
+        /**
+        * Destructor.
+        */
+        virtual ~CStifLoggerBase();
+
+    public:     // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        CStifLoggerBase();
+
+        /**
+        * Log a 16 bit information to some storage e.g. text file. There is
+        * also parameter to styling text information e.g. text color.
+        */
+        IMPORT_C TInt Log( TInt aStyle, const TDesC& aLogInfo );
+
+        /**
+        * Log a 8 bit information to some storage e.g. text file. There is
+        * also parameter to styling text information e.g. text color.
+        */
+        IMPORT_C TInt Log( TInt aStyle, const TDesC8& aLogInfo );
+
+        /**
+        * Get creation result.
+        */
+        IMPORT_C TInt CreationResult();
+
+        /**
+        * Get output type. Valid only if CreationResult returns KErrNone.
+        */
+        IMPORT_C CStifLogger::TOutput OutputType();
+
+        /**
+        * Pure virtual. Send style information and data to the output module.
+        * 16 bit.
+        */
+        virtual TInt Send( TInt /*aStyle*/, const TDesC& /*aData*/ ) = 0;
+
+        /**
+        * Pure virtual. Send style information and data to the output module.
+        * 8 bit.
+        */
+        virtual TInt Send( TInt /*aStyle*/, const TDesC8& /*aData*/ ) = 0;
+
+        /**
+        * Log 16 bit _LIT information to some storage e.g. text file.
+        */
+        template<TInt S> TInt Log( const TLitC<S>& aLogInfo )
+            { 
+            return Send( CStifLogger::ENoStyle, (TDesC&)aLogInfo );
+            };
+
+        /**
+        * Log 8 bit _LIT information to some storage e.g. text file.
+        */
+        template<TInt S> TInt Log( const TLitC8<S>& aLogInfo )
+            { 
+            return Send( CStifLogger::ENoStyle, (TDesC8&)aLogInfo );
+            };
+
+        /**
+        * Log 16 bit _LIT information to some storage e.g. text file. There is
+        * also parameter to styling text information e.g. text color.
+        */
+        template<TInt S> TInt Log( TInt aStyle, const TLitC<S>& aLogInfo )
+            { 
+            return Send( aStyle, (TDesC&)aLogInfo );
+            };
+
+        /**
+        * Log 8 bit _LIT information to some storage e.g. text file.  There is
+        * also parameter to styling text information e.g. text color.
+        */
+        template<TInt S> TInt Log( TInt aStyle, const TLitC8<S>& aLogInfo )
+            { 
+            return Send( aStyle, (TDesC8&)aLogInfo );
+            };
+
+    protected:  // Data
+        /**
+        * Output object.
+        */
+        COutput*    iOutput;        
+    };
+
+#endif      // STIFLOGGERBASE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/inc/TxtLogger.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,126 @@
+/*
+* 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: This file contains the header file of the CTxtLogger.
+*
+*/
+
+#ifndef TXTLOGGER_H
+#define TXTLOGGER_H
+
+//  INCLUDES
+#include "StifLoggerBase.h"
+#include "FileOutput.h"
+#include "RDebugOutput.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class COutput;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTxtLogger is a STIF Test Framework StifLoggerBase class.
+// Class contains a file logging operations.
+
+class CTxtLogger
+            :public CStifLoggerBase
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTxtLogger* NewL( const TDesC& aTestPath,
+                                    const TDesC& aTestFile,
+                                    CStifLogger::TLoggerType aLoggerType,
+                                    CStifLogger::TOutput aOutput,
+                                    TBool aOverWrite,
+                                    TBool aWithTimeStamp,
+                                    TBool aWithLineBreak,
+                                    TBool aWithEventRanking,
+                                    TBool aThreadIdToLogFile,
+                                    TBool aCreateLogDir,
+                                    TInt  aStaticBufferSize,
+                                    TBool aUnicode,
+                                    TInt aThreadId);
+
+        /**
+        * Destructor.
+        */
+        ~CTxtLogger();
+
+    public:     // New functions
+
+        /**
+        * Send style information and data to the output module.
+        * aStyle parameter is not supporter in txt printing.
+        */
+        TInt Send( TInt aStyle, const TDesC& aData );
+
+        /**
+        * Send style information and data to the output module.
+        * aStyle parameter is not supporter in txt printing.
+        */
+        TInt Send( TInt aStyle, const TDesC8& aData );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTxtLogger( COutput* output );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+    
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // TXTLOGGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/sis/STFLoggingServer_EKA2.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,39 @@
+;
+; Copyright (c) 2010 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: 
+;
+; Installation file for Symbian OS 9.x for generic console application
+; Installation file for STFLoggingServer EXE
+;
+; This is an auto-generated PKG file by Carbide.
+; This file uses variables specific to Carbide builds that will not work
+; on command-line builds. If you want to use this generated PKG file from the
+; command-line tools you will need to modify the variables with the appropriate
+; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
+;
+
+;
+; UID is the exe's UID
+;
+#{"STFLoggingServer EXE"},(0xE42482E1),1,0,0
+
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+"$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\STFLoggingServer.exe"		  -"!:\sys\bin\STFLoggingServer.exe"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/DataLogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,272 @@
+/*
+* 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: This module contains implementation of CDataLogger 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "DataLogger.h"
+#include "Output.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 =======================================
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDataLogger
+
+    Method: CDataLogger
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: COutput* output: in: Output source
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CDataLogger::CDataLogger( COutput* output )
+    {
+    	iOutput = output;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDataLogger
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CDataLogger::ConstructL()
+    {
+    //Nothing to do.
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDataLogger
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: const TDesC& aTestPath: in: Log path
+                const TDesC& aTestFile: in: Log filename
+                TLoggerType aLoggerType: in: File type
+                TOutput aOutput: in: Output source
+                TBool aOverWrite: in: For file overwrite
+                TBool aWithTimeStamp: in: For timestamp
+                TBool aWithLineBreak: in: For line break
+                TBool aWithEventRanking: in: For events ranking to file
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+                TBool aCreateLogDir: in: Indicator to directory creation
+                TInt  aStaticBufferSize
+                TBool aUnicode: not used: Indicator if file has to be in unicode format.
+
+    Return Values: CDataLogger*: pointer to CDataLogger object
+
+    Errors/Exceptions: Leaves if called COutput::NewL method fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CDataLogger* CDataLogger::NewL( const TDesC& aTestPath,
+                                const TDesC& aTestFile,
+                                CStifLogger::TLoggerType aLoggerType,
+                                CStifLogger::TOutput aOutput,
+                                TBool aOverWrite,
+                                TBool aWithTimeStamp,
+                                TBool aWithLineBreak,
+                                TBool aWithEventRanking,
+                                TBool aThreadIdToLogFile,
+                                TBool aCreateLogDir,
+                                TInt aStaticBufferSize,
+                                TBool /*aUnicode*/,
+                                TInt aThreadId)
+    {
+    __TRACE( KInfo, ( _L( "STIFLOGGER: Creating data logger" ) ) );
+
+    aWithTimeStamp = EFalse;    // Time stamp not allowed in data logging
+    aWithLineBreak = EFalse;    // Line break not allowed in data logging
+    aWithEventRanking = EFalse; // Event ranking not allowed in data logging
+
+    TBool aUnicode(EFalse); //For data type unicode is not allowed
+    // Create COutput object output
+    COutput* output = COutput::NewL( aTestPath,
+                                        aTestFile,
+                                        aLoggerType,
+                                        aOutput,
+                                        aOverWrite,
+                                        aWithTimeStamp,
+                                        aWithLineBreak,
+                                        aWithEventRanking,
+                                        aThreadIdToLogFile,
+                                        aCreateLogDir,
+                                        aStaticBufferSize,
+                                        aUnicode,
+                                        aThreadId);
+                                        
+    CleanupStack::PushL( output ); 
+
+	__ASSERT_ALWAYS( output != NULL, User::Leave( KErrNotFound ) );
+    // Create CDataLogger object dataLogger and bind to COutput
+    CDataLogger* dataLogger = new (ELeave) CDataLogger( output );
+    // DATA logger owns output object and it will be destroyed in STIFLogger
+    // destructor.
+    CleanupStack::Pop( output ); 
+
+    CleanupStack::PushL( dataLogger );
+    dataLogger->ConstructL();
+    CleanupStack::Pop( dataLogger );
+    
+    
+    return dataLogger;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDataLogger
+
+    Method: ~CDataLogger
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CDataLogger::~CDataLogger()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDataLogger
+
+    Method: Send
+
+    Description: Send style information and 16 bit data to the output module.
+
+    Parameters: TInt TStyle: in: Text forming
+                const TDesC& aData: in: Data to be logged
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDataLogger::Send( TInt /*TStyle*/, const TDesC& aData )
+    {
+    // No text styling implemented
+    return iOutput->Write( EFalse, ETrue, EFalse, aData );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDataLogger
+
+    Method: Send
+
+    Description: Send style information and 8 bit data to the output module.
+
+    Parameters: TInt TStyle: in: Text forming
+                const TDesC8& aData: in: Data to be logged
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDataLogger::Send( TInt /*TStyle*/, const TDesC8& aData )
+    {
+    // No text styling implemented
+    return iOutput->Write( EFalse, ETrue, ETrue, aData );
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/FileOutput.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1212 @@
+/*
+* 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: This module contains implementation of CFileOutput 
+* class member functions.
+*
+*/
+
+
+// INCLUDE FILES
+#include "FileOutput.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+//#define RDEBUG_FILEWRITECRASH(a) RDebug::Print(a)
+#define RDEBUG_FILEWRITECRASH(a)
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: CFileOutput
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: TLoggerType aLoggerType: in: File type
+                TBool aWithTimeStamp: in: For timestamp
+                TBool aWithLineBreak: in: For line break
+                TBool aWithEventRanking: in: For events ranking to file
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CFileOutput::CFileOutput( CStifLogger::TLoggerType aLoggerType,
+                            TBool aWithTimeStamp,
+                            TBool aWithLineBreak,
+                            TBool aWithEventRanking,
+                            TBool aThreadIdToLogFile,
+                            TInt aThreadId) :
+    COutput()
+    {
+    // Indicates file type
+    iLoggerType = aLoggerType;
+
+    // Time stamp indicator
+    iWithTimeStamp = aWithTimeStamp;
+
+    // Line break indicator
+    iWithLineBreak = aWithLineBreak;
+
+    // Log event ranking indicator
+    iWithEventRanking = aWithEventRanking;
+
+    // Indicator to thread id adding to end of the log file
+    iThreadIdToLogFile = aThreadIdToLogFile;
+
+    // Is file open indicator
+    iIsFileOpen = 0;
+
+    // Thread id of test case thread. Get from client side when creating logger.
+    iThreadId = aThreadId;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: const TDesC& aTestPath: in: Log path
+                const TDesC& aTestFile: in: Log filename
+                TBool aOverWrite: in: For file overwrite
+                TBool aCreateLogDir: in: Indicator to directory creation
+                TInt  aStaticBufferSize
+                TBool aUnicode: in: Indicator if file has to be in unicode format
+
+    Return Values: None
+
+    Errors/Exceptions:  Leaves if called CreateNewFileL method fails
+                        Leaves if called OpenExistingFileL method fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::ConstructL( const TDesC& aTestPath,
+                                const TDesC& aTestFile,
+                                TBool aOverWrite,
+                                TBool aCreateLogDir,
+                                TInt aStaticBufferSize,
+                                TBool aUnicode)
+    {
+    iUnicode = aUnicode;
+
+    // Open file session
+    User::LeaveIfError( iFileSession.Connect() );
+
+    // Create a log directory
+    if( aCreateLogDir )
+        {
+        CreateDirectoryL( aTestPath );
+        }
+
+    // Create a new file
+    if ( aOverWrite )
+        {
+        CreateNewFileL( aTestPath, aTestFile );
+        }
+    // Open an existing file
+    else 
+        {
+        OpenExistingFileL( aTestPath, aTestFile );
+        }
+        
+    if( aStaticBufferSize != 0)
+        {
+        iDataHBuf8 = HBufC8::NewL( aStaticBufferSize );
+        iDataHBuf16 = HBufC::NewL(aStaticBufferSize);
+        iStaticBufferSize = aStaticBufferSize;
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: const TDesC& aTestPath: in: Log path
+                const TDesC& aTestFile: in: Log filename
+                TLoggerType aLoggerType: in: File type
+                TBool aOverWrite: in: For file overwrite
+                TBool aWithTimeStamp: in: For timestamp
+                TBool aWithLineBreak: in: For line break
+                TBool aWithEventRanking: in: For events ranking to file
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+                TBool aCreateLogDir: in: Indicator to directory creation
+                TInt  aStaticBufferSize
+                TBool aUnicode: in: Indicator if file has to be in unicode format
+
+    Return Values: CFileOutput*: pointer to CFileOutput object
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CFileOutput* CFileOutput::NewL( const TDesC& aTestPath,
+                                const TDesC& aTestFile,
+                                CStifLogger::TLoggerType aLoggerType,
+                                TBool aOverWrite,
+                                TBool aWithTimeStamp,
+                                TBool aWithLineBreak,
+                                TBool aWithEventRanking,
+                                TBool aThreadIdToLogFile,
+                                TBool aCreateLogDir,
+                                TInt  aStaticBufferSize,
+                                TBool aUnicode,
+                                TInt  aThreadId)
+    {
+    // Create CFileOutput object fileWriter
+    CFileOutput* fileWriter = new (ELeave) CFileOutput( aLoggerType,
+                                                        aWithTimeStamp,
+                                                        aWithLineBreak,
+                                                        aWithEventRanking,
+                                                        aThreadIdToLogFile,
+                                                        aThreadId);
+
+    CleanupStack::PushL( fileWriter );
+    fileWriter->ConstructL( aTestPath, aTestFile, aOverWrite, aCreateLogDir, aStaticBufferSize,
+                            aUnicode );
+    CleanupStack::Pop( fileWriter );
+
+    return fileWriter;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: ~CFileOutput
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CFileOutput::~CFileOutput()
+    {
+    // Close file
+    iFile.Close();
+    // Close file session
+    iFileSession.Close();
+
+    delete iDataHBuf8;
+    delete iDataHBuf16;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: FileType
+
+    Description: Check file type.
+
+    Check is file type set with a aTestFile's name. If file type is not set
+    the type will set according to StifLogger's type.
+
+    Parameters: const TDesC& aTestFile: in: Log filename
+                TFileType& fileType: inout: Generated file type
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/    
+void CFileOutput::FileType( const TDesC& aTestFile,
+                            TFileType& aFileType )
+    {
+    TBool fileTypeIsSet( EFalse ); // File type indicator
+
+    // Check is file type set to aTestFile parameter
+    TInt ret = aTestFile.Find( _L( "." ) );
+    if( ret != KErrNotFound )
+        {
+        fileTypeIsSet = ETrue;
+        }
+    // If not, add thread id name if allowed
+    else if ( iThreadIdToLogFile )
+        {
+        // Thread id maximum length is 8 in hexadesimal format
+        // Construct unique thread name
+        aFileType.Append( _L("_") );
+
+        // Appends id in hexadesimal format             
+        aFileType.AppendFormat( _L( "%x" ), iThreadId );
+        }
+
+    // Add file type after the thread id name
+    if ( iLoggerType == CStifLogger::ETxt && !fileTypeIsSet )
+        {
+        // ".txt"
+        aFileType.Append( _L( "." ) );
+        aFileType.Append( _L( "txt" ) );
+        }
+    else if ( iLoggerType == CStifLogger::EHtml && !fileTypeIsSet )
+        {
+        // ".html"
+        aFileType.Append( _L( "." ) );
+        aFileType.Append( _L( "html" ) );
+        }
+    // EData file type comes from the aTestFile name. If not the file type 
+    // will be empty
+    else if ( iLoggerType == CStifLogger::EData )
+        {
+        aFileType.Append( _L( "" ) );
+        }
+    else
+        {
+        aFileType.Append( _L( "" ) );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: TestFileWithThreadId
+
+    Description: Generate thread id
+
+    Generate thread id name between the test file name and test file type.
+
+    Parameters: TDesC& aTestFile: in: Test file name
+                TFileName& aNewTestFile: inout: Generated test file name 
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::TestFileWithThreadId( const TDesC& aTestFile, 
+                                        TFileName& aNewTestFile )
+    {
+    for( TInt a = 0; a < aTestFile.Length(); a++ )
+        {
+        // Find a dot
+        if( aTestFile[a] == '.' )
+            {
+            TPtrC parsedFileType = aTestFile.Mid( a );  // Take rest of the 
+                                                        // aTestFile
+            aNewTestFile.Append( _L( "_" ) );
+
+            aNewTestFile.AppendFormat( _L( "%x" ), iThreadId );// Appends id in
+                                                        // hexadesimal format
+            aNewTestFile.Append( parsedFileType );
+            break;
+            }
+        // Dot not found yet
+        else
+            {
+            aNewTestFile.Append( aTestFile[a] );
+            }
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: CreateDirectoryL
+
+    Description: Create a log directory.
+
+    Method creates directory if not allready exist.
+
+    Parameters: const TDesC& aTestPath: in: Test path definition
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if directory creation fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::CreateDirectoryL( const TDesC& aTestPath )
+    {
+    __TRACE( KInfo, ( _L( "STIFLOGGER: Create a directory" ) ) );
+
+    TInt ret = iFileSession.MkDirAll( aTestPath );
+	if( ret != KErrNone && ret != KErrAlreadyExists )
+        {
+        __TRACE( KError, 
+            ( _L( "STIFLOGGER: Directory creation fails with error: %d" ), ret ) );
+		User::Leave( ret );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: OpenExistingFileL
+
+    Description: Open an existing file.
+
+    Method is used when is need for log new information after the existing
+    log file.
+
+    Parameters: const TDesC& aTestPath: in: Test path definition
+                const TDesC& aTestFile: in: Test file name
+
+    Return Values: None
+
+    Errors/Exceptions:  Leaves if path or file lengths are over KMaxFileName
+                        Leaves if file Replace method fails
+                        Leaves if file Open method fails
+                        Leaves if file path not found
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::OpenExistingFileL( const TDesC& aTestPath, 
+                                        const TDesC& aTestFile )
+    {
+    __TRACE( KInfo, ( _L( "STIFLOGGER: Opening an existing file for logging" ) ) );
+
+    // If path and file name lengths are over KMaxFileName(TFileName)
+    __ASSERT_ALWAYS(
+        ( aTestPath.Length() + aTestFile.Length() ) < KMaxFileName,
+        User::Leave( KErrArgument ) );
+
+    // Check file type and generate threat id name
+    TFileType fileType;
+    FileType( aTestFile, fileType );
+
+    // File directory name, file name and file type definitions
+    TPtrC dirNamePrt( aTestPath );
+    iFileAndDirName.Copy( dirNamePrt );
+
+    TInt isDotFound = aTestFile.Find( _L( "." ) );
+    // If dot is found and iThreadIdToLogFile is true
+    if( isDotFound != KErrNotFound && iThreadIdToLogFile )
+        {
+        TFileName testFileWithThreadId;
+        // Generate thread id name
+        TestFileWithThreadId( aTestFile, testFileWithThreadId );
+        iFileAndDirName.Insert( 
+            iFileAndDirName.Length(), testFileWithThreadId );
+        }
+    else
+        {
+        TPtrC txtPrt( fileType );
+        iFileAndDirName.Insert( iFileAndDirName.Length(), aTestFile );
+        iFileAndDirName.Insert( iFileAndDirName.Length(), txtPrt );
+        }
+
+    TInt ret( KErrNone );
+
+    iIsFileOpen =iFile.Open( iFileSession, iFileAndDirName,
+            EFileWrite | EFileStreamText |
+                    EFileShareAny );
+    if( iIsFileOpen == KErrNotFound )
+        {
+        ret =  iFile.Create( iFileSession, iFileAndDirName, 
+                                    EFileWrite | EFileStreamText |
+                                    EFileShareAny );
+        if(iUnicode && ret == KErrNone)
+            {
+            char FF = 0xFF;
+            char FE = 0xFE;
+            TBuf8<2> beg;
+            beg.Append(FF);
+            beg.Append(FE);
+            if(iFile.Write(beg) == KErrNone)
+                iFile.Flush();
+            }
+        }
+    else if( iIsFileOpen == KErrNone )
+        {
+        ret = KErrNone;
+        }
+    // Probably path not found
+    else
+        {
+        User::Leave( iIsFileOpen );
+        }
+
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: CreateNewFileL
+
+    Description: Create a new file.
+
+    Method creates new file to the log information.
+
+    Parameters: const TDesC& aTestPath: in: Test path definition
+                const TDesC& aTestFile: in: Test file name
+
+    Return Values: None
+
+    Errors/Exceptions:  Leaves if path or file lengths are over KMaxFileName
+                        Leaves if file server Connect method fails
+                        Leaves if file Replace method fails
+                        Leaves if file Open method fails
+                        Leaves if file path not found
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::CreateNewFileL( const TDesC& aTestPath,
+                                    const TDesC& aTestFile )
+    {
+    __TRACE( KInfo, ( _L( "STIFLOGGER: Create a new file for logging" ) ) );
+
+    // If path and file name lengths are over KMaxFileName(TFileName)
+    __ASSERT_ALWAYS(
+        ( aTestPath.Length() + aTestFile.Length() ) < KMaxFileName,
+        User::Leave( KErrArgument ) );
+
+    // Check file type and generate threat id name
+    TFileType fileType;
+    FileType( aTestFile, fileType );
+
+    // File directory name, file name and file type definitions
+    TPtrC dirNamePrt( aTestPath );
+    iFileAndDirName.Copy( dirNamePrt );
+
+    TInt isDotFound = aTestFile.Find( _L( "." ) );
+    // If dot is found and iThreadIdToLogFile is true
+    if( isDotFound != KErrNotFound && iThreadIdToLogFile )
+        {
+        TFileName testFileWithThreadId;
+        // Generate thread id name
+        TestFileWithThreadId( aTestFile, testFileWithThreadId );
+        iFileAndDirName.Insert( 
+            iFileAndDirName.Length(), testFileWithThreadId );
+        }
+    else
+        {
+        TPtrC txtPrt( fileType );
+        iFileAndDirName.Insert( iFileAndDirName.Length(), aTestFile );
+        iFileAndDirName.Insert( iFileAndDirName.Length(), txtPrt );
+        }
+
+    // Delete file if exist
+    iFileSession.Delete( iFileAndDirName );
+
+    TBool isOpen( EFalse );
+    TInt ret( KErrNone );
+
+    iIsFileOpen = iFileSession.IsFileOpen( iFileAndDirName, isOpen );
+    if( ( iIsFileOpen == KErrNotFound ) ||
+        ( iIsFileOpen == KErrNone ) )
+        {
+        ret = iFile.Replace( iFileSession, iFileAndDirName,
+                                    EFileWrite | EFileStreamText |
+                                    EFileShareAny );
+        if(iUnicode && ret == KErrNone)
+            {
+            char FF = 0xFF;
+            char FE = 0xFE;
+            TBuf8<2> beg;
+            beg.Append(FF);
+            beg.Append(FE);
+            if(iFile.Write(beg) == KErrNone)
+                iFile.Flush();
+            }
+        }
+    // Probably path not found
+    else
+        {
+        User::Leave( iIsFileOpen );
+        }
+
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: Write
+
+    Description: Write log information or data to the file. 16 bit.
+
+    Parameters: TBool aWithTimeStamp: in: Is time stamp flag used
+                TBool aWithLineBreak: in: Is line break flag used
+                TBool aWithEventRanking: in: Is event ranking flag used
+                const TDesC& aData: in: Logged or saved data
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFileOutput::Write( TBool aWithTimeStamp, TBool aWithLineBreak,
+                            TBool aWithEventRanking, const TDesC& aData )
+    {
+    TInt extraLength( 0 );  // Line and/or event required length
+
+    TPtr data16(0, 0);
+    TPtr8 data8(0, 0);
+
+    // Extra space calculation
+    if( iWithEventRanking && aWithEventRanking )
+        {
+        extraLength = extraLength + KMaxEventRanking + KMaxSpace;
+        }
+    if( ( iLoggerType == CStifLogger::EHtml ) && iWithLineBreak && aWithLineBreak )
+        {
+        extraLength = extraLength + KMaxHtmlLineBreak;
+        }
+    if( iWithLineBreak && aWithLineBreak )
+        {
+        extraLength = extraLength + KMaxLineBreak;
+        }
+    if( aWithTimeStamp && iWithTimeStamp )
+        {
+        extraLength = extraLength + KMaxTimeStamp;
+        }
+
+    // Calculated space
+    TInt space = aData.Length();
+
+    HBufC8* dataHBuf8 = NULL;
+    HBufC16* dataHBuf16 = NULL;
+
+    if(iDataHBuf8)
+        {
+        // We'll use HBufC created in ConstructL
+        data8.Set(iDataHBuf8->Des());
+        data16.Set(iDataHBuf16->Des());
+        data16.Copy(_L("")); // Initialize aData buffer
+        
+        if( (aData.Length() + extraLength) > iStaticBufferSize )
+            {
+             RDebug::Print(_L("Warning: buffer size too small, not able to log!"));
+             return KErrOverflow;
+            }        
+        }
+    else
+        {        
+        // We'll create a local HBufC, deleting it in the end of this method
+        dataHBuf8 = HBufC8::New( space + extraLength );
+        if(!dataHBuf8)
+            {
+            return KErrNoMemory;
+            }
+        dataHBuf16 = HBufC16::New(space + extraLength);
+        if(!dataHBuf16)
+            {
+            delete dataHBuf8;
+            return KErrNoMemory;
+            }
+        data8.Set(dataHBuf8->Des());
+        data16.Set(dataHBuf16->Des());
+        }
+
+    // Event ranking
+    if( iWithEventRanking && aWithEventRanking && !iWithTimeStamp )
+        {
+        EventRanking( data16 );      // Event ranking to data
+        data16.Append( aData );      // Unicode aData to normal text
+        }
+    // Time stamp
+    else if( iWithTimeStamp && aWithTimeStamp )
+        {
+        // With event ranking
+        if( iWithEventRanking && aWithEventRanking )
+            {
+            EventRanking( data16 );  // Event ranking to data
+            }
+        AddTimeStampToData( data16 );// Add time stamp
+        data16.Append( aData );      // Unicode aData to normal text
+        }
+    else
+        {
+        data16.Copy( aData );        // Unicode aData to normal text
+        }
+
+    // NOTE: If need some special line break do it with logging phase
+
+    // If html logging and line break is used add the line break.
+    if (( iLoggerType == CStifLogger::EHtml ) && iWithLineBreak && aWithLineBreak )
+        {
+        data16.Append( _L( "<BR>" ) );
+        data16.Append( _L( "\n" ) );  // To make html file more readable
+                                    // with text editor
+        }
+
+    // Other cases line break is normal '\n' if logging is used
+    else if( iWithLineBreak && aWithLineBreak )
+        {
+        data16.Append( 0x0D ); // 13 or '\' in Symbian OS
+        data16.Append( 0x0A ); // 10 or 'n' in Symbian OS
+        }
+
+    // Write the data to file
+    TInt tmp = 0;
+    if( iFile.Seek( ESeekEnd, tmp ) == KErrNone )
+        {
+        RDEBUG_FILEWRITECRASH(_L("iFile.Write 1 in"));
+        TPtrC8 dataToFile(0, 0);
+        if(iUnicode)
+            {
+            dataToFile.Set((TUint8 *)(data16.Ptr()), data16.Length() * 2);
+            }
+        else
+            {
+            data8.Copy(data16);
+            dataToFile.Set(data8);
+            }
+        if(iFile.Write(dataToFile) == KErrNone)
+            iFile.Flush();
+        RDEBUG_FILEWRITECRASH(_L("iFile.Write 1 out"));
+        }
+    if(!iDataHBuf8)
+        {
+        delete dataHBuf8;
+        dataHBuf8 = 0;
+        delete dataHBuf16;
+        dataHBuf16 = 0;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: Write
+
+    Description: Write log information or data to the file. 8 bit.
+
+    Parameters: TBool aWithTimeStamp: in: Is time stamp flag used
+                TBool aWithLineBreak: in: Is line break flag used
+                TBool aWithEventRanking: in: Is event ranking flag used
+                const TDesC8& aData: in: Logged or saved data
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFileOutput::Write( TBool aWithTimeStamp, TBool aWithLineBreak,
+                            TBool aWithEventRanking, const TDesC8& aData )
+    {
+    TInt extraLength( 0 );  // Line and/or event required length
+
+    TPtr data16(0, 0);
+    TPtr8 data8(0, 0);
+
+    // Extra space calculation
+    if( iWithEventRanking && aWithEventRanking )
+        {
+        extraLength = extraLength + KMaxEventRanking + KMaxSpace;
+        }
+    if( ( iLoggerType == CStifLogger::EHtml ) && iWithLineBreak && aWithLineBreak )
+        {
+        extraLength = extraLength + KMaxHtmlLineBreak;
+        }
+    if( iWithLineBreak && aWithLineBreak )
+        {
+        extraLength = extraLength + KMaxLineBreak;
+        }
+    if( aWithTimeStamp && iWithTimeStamp )
+        {
+        extraLength = extraLength + KMaxTimeStamp;
+        }
+
+    // aData straight to the file
+    if ( extraLength == 0 && !iUnicode)
+        {
+        // Write the data to file
+        TInt tmp = 0;
+        if( iFile.Seek( ESeekEnd, tmp ) == KErrNone )
+            {
+            RDEBUG_FILEWRITECRASH(_L("iFile.Write 2 in"));
+            if( iFile.Write( aData ) == KErrNone )
+                iFile.Flush();
+            RDEBUG_FILEWRITECRASH(_L("iFile.Write 2 out"));
+            }
+        return KErrNone;
+        }
+
+    // Calculated space
+    TInt space = aData.Length();
+    HBufC8* dataHBuf8 = NULL;
+    HBufC* dataHBuf16 = NULL;
+
+    if(iDataHBuf8)
+        {
+        // We'll use HBufC created in ConstructL
+        data8.Set(iDataHBuf8->Des());
+        data8.Copy(_L("")); // Initialize aData buffer
+        data16.Set(iDataHBuf16->Des());
+        
+        if( (aData.Length() + extraLength) > iStaticBufferSize )
+            {
+             RDebug::Print(_L("Warning: buffer size too small, not able to log!"));
+             return KErrOverflow;
+            }        
+        }
+    else
+        {        
+        // We'll create a local HBufC, deleting it in the end of this method
+        dataHBuf8 = HBufC8::New( space + extraLength );
+        if(!dataHBuf8)
+            {
+            return KErrNoMemory;
+            }
+        dataHBuf16 = HBufC16::New(space + extraLength);
+        if(!dataHBuf16)
+            {
+            delete dataHBuf8;
+            return KErrNoMemory;
+            }
+        data8.Set(dataHBuf8->Des());  // Memory allocation for data
+        data16.Set(dataHBuf16->Des());  // Memory allocation for data
+        }
+
+    // Event ranking
+    if( iWithEventRanking && aWithEventRanking && !iWithTimeStamp )
+        {
+        EventRanking( data8 );      // Event ranking to data
+        data8.Append( aData );      // Unicode aData to normal text
+        }
+    // Time stamp
+    else if( iWithTimeStamp && aWithTimeStamp )
+        {
+        // With event ranking
+        if( iWithEventRanking && aWithEventRanking )
+            {
+            EventRanking( data8 );  // Event ranking to data
+            }
+        AddTimeStampToData( data8 );// Add time stamp
+        data8.Append( aData );      // Unicode aData to normal text
+        }
+    else
+        {
+        data8.Copy( aData );        // Unicode aData to normal text
+        }
+
+    // NOTE: If need some special line break do it with logging phase
+
+    // If html logging and line break is used add the line break.
+    if ( ( iLoggerType == CStifLogger::EHtml ) && iWithLineBreak && aWithLineBreak )
+        {
+        data8.Append( _L( "<BR>" ) );
+        data8.Append( _L( "\n" ) );  // To make html file more readable
+                                    // with text editor
+        }
+
+    // Other cases line break is normal '\n' if logging is used
+    else if( iWithLineBreak && aWithLineBreak )
+        {
+        data8.Append( 0x0D ); // 13 or '\' in Symbian OS
+        data8.Append( 0x0A ); // 10 or 'n' in Symbian OS
+        }
+
+    // Write the data to file
+    TInt tmp = 0;
+    if( iFile.Seek( ESeekEnd, tmp ) == KErrNone )
+        {
+        RDEBUG_FILEWRITECRASH(_L("iFile.Write 3 in"));
+        TPtrC8 dataToFile(0, 0);
+        if(iUnicode)
+            {
+            data16.Copy(data8);
+            dataToFile.Set((TUint8 *)(data16.Ptr()), data16.Length() * 2);
+            }
+        else
+            {
+            dataToFile.Set(data8);
+            }
+        if(iFile.Write(dataToFile) == KErrNone)
+            iFile.Flush();
+        RDEBUG_FILEWRITECRASH(_L("iFile.Write 3 out"));
+        }
+    if(!iDataHBuf8)
+        {
+        delete dataHBuf8;
+        dataHBuf8 = 0;
+        delete dataHBuf16;
+        dataHBuf16 = 0;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: EventRanking
+
+    Description: For event ranking logging.
+
+    Parameters: TPtr& aData: inout: Data with event ranking
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::EventRanking( TPtr& aData )
+    {
+    // Returns the machine's current tick count.
+    TUint tick = User::TickCount();
+    tick &= 0xffff;
+    aData.AppendNum( tick );
+    aData.Append( _L( " " ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: EventRanking
+
+    Description: For event ranking logging.
+
+    Parameters: TPtr8& aData: inout: Data with event ranking
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::EventRanking( TPtr8& aData )
+    {
+    // Returns the machine's current tick count.
+    TUint tick = User::TickCount();
+    tick &= 0xffff;
+    aData.AppendNum( tick );
+    aData.Append( _L8( " " ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: AddTimeStampToData
+
+    Description: For date and time logging.
+
+    Parameters: TPtr& aData: inout: Data with time stamps
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::AddTimeStampToData( TPtr& aData )
+    {
+    TStifLoggerTimeStamp timeStamp;
+    GetDateAndTime( timeStamp );
+
+    TStifLoggerTimeStamp8 tStamp16;
+    tStamp16.Copy(timeStamp);
+
+    aData.Append( tStamp16 );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: AddTimeStampToData
+
+    Description: For date and time logging.
+
+    Parameters: TPtr8& aData: inout: Data with time stamps
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::AddTimeStampToData( TPtr8& aData )
+    {
+    TStifLoggerTimeStamp timeStamp;
+    GetDateAndTime( timeStamp );
+    aData.Append( timeStamp );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: GetDateAndTime
+
+    Description: For date and time logging.
+
+    Parameters: TStifLoggerTimeStamp& aDataAndTime: inout: Generated date and time
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CFileOutput::GetDateAndTime( TStifLoggerTimeStamp& aDataAndTime )
+    {
+    TInt num( 0 );
+    TInt microseconds( 0 );
+
+    // Append date
+    TTime time;
+    time.HomeTime();
+    TDateTime dateTime( time.DateTime() );
+
+    num = dateTime.Day() + 1;
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    // Append month
+    aDataAndTime.AppendNum( num );
+    aDataAndTime.Append( '.' );
+    num = 0;
+    num = dateTime.Month();
+    switch( num )
+        {
+        case EJanuary:      // 1
+            {
+             aDataAndTime.Append( _L( "Jan" ) );
+             break;
+            }
+        case EFebruary:     // 2
+            {
+             aDataAndTime.Append( _L( "Feb" ) );
+             break;
+            }
+        case EMarch:        // 3
+            {
+             aDataAndTime.Append( _L( "Mar" ) );
+             break;
+            }
+        case EApril:        // 4
+            {
+             aDataAndTime.Append( _L( "Apr" ) );
+             break;
+            }
+        case EMay:          // 5
+            {
+             aDataAndTime.Append( _L( "May" ) );
+             break;
+            }
+        case EJune:         // 6
+            {
+             aDataAndTime.Append( _L( "Jun" ) );
+             break;
+            }
+        case EJuly:         // 7
+            {
+             aDataAndTime.Append( _L( "Jul" ) );
+             break;
+            }
+        case EAugust:       // 8
+            {
+             aDataAndTime.Append( _L( "Aug" ) );
+             break;
+            }
+        case ESeptember:    // 9
+            {
+             aDataAndTime.Append( _L( "Sep" ) );
+             break;
+            }
+        case EOctober:      // 10
+            {
+             aDataAndTime.Append( _L( "Oct" ) );
+             break;
+            }
+        case ENovember:     // 11
+            {
+             aDataAndTime.Append( _L( "Nov" ) );
+             break;
+            }
+        case EDecember:     // 12
+            {
+             aDataAndTime.Append( _L( "Dec" ) );
+             break;
+            }
+        default:
+            {
+             aDataAndTime.Append( '-' );
+             break;
+            }
+        }
+   // Append year
+    aDataAndTime.Append( '.' );
+    aDataAndTime.AppendNum( dateTime.Year() );
+
+    // Append time
+    aDataAndTime.Append( ' ' );
+    num = dateTime.Hour();
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    aDataAndTime.AppendNum( num );
+    aDataAndTime.Append( ':' );
+    num = dateTime.Minute();
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    aDataAndTime.AppendNum( num );
+    aDataAndTime.Append( ':' );
+
+    num = dateTime.Second();                // Seconds
+    microseconds = dateTime.MicroSecond();  // Microseconds
+
+    // Seconds
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    aDataAndTime.AppendNum( num );
+
+    // Milliseconds
+    aDataAndTime.Append( '.' );
+    aDataAndTime.AppendNumFixedWidth( microseconds, EDecimal, 3 );
+
+    // NOTE: If you add more spaces etc. remember increment KMaxTimeStamp size!
+
+    if ( iLoggerType == CStifLogger::EHtml )
+        {
+        aDataAndTime.Append( _L("....") );
+        }
+    else
+        {
+        aDataAndTime.Append( _L("    ") );
+        }
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/HtmlLogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,573 @@
+/*
+* 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: This module contains implementation of CHtmlLogger 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "HtmlLogger.h"
+#include "Output.h"
+#include "LoggerTracing.h"
+#include "LoggerOverFlow.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: CHtmlLogger
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: COutput* output: in: Output source
+                const TDesC& aTestFile: in: Log filename
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CHtmlLogger::CHtmlLogger( COutput* output,
+                          const TDesC& aTestFile,
+                          TBool aThreadIdToLogFile )
+    {
+    iOutput = output;
+    StartHtmlPage( aTestFile, aThreadIdToLogFile );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CHtmlLogger::ConstructL()
+    {
+    //nothing to do.    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: const TDesC& aTestPath: in: Log path
+                const TDesC& aTestFile: in: Log filename
+                TLoggerType aLoggerType: in: File type
+                TOutput aOutput: in: Output source
+                TBool aOverWrite: in: For file overwrite
+                TBool aWithTimeStamp: in: For timestamp
+                TBool aWithLineBreak: in: For line break
+                TBool aWithEventRanking: in: For events ranking to file
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+                TBool aCreateLogDir: in: Indicator to directory creation
+                TInt  aStaticBufferSize
+                TBool aUnicode: in: Indicator if file has to be in unicode format
+
+    Return Values: CHtmlLogger*: pointer to CHtmlLogger object
+
+    Errors/Exceptions: Leaves if called COutput::NewL method fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CHtmlLogger* CHtmlLogger::NewL( const TDesC& aTestPath,
+                                const TDesC& aTestFile,
+                                CStifLogger::TLoggerType aLoggerType,
+                                CStifLogger::TOutput aOutput,
+                                TBool aOverWrite,
+                                TBool aWithTimeStamp,
+                                TBool aWithLineBreak,
+                                TBool aWithEventRanking,
+                                TBool aThreadIdToLogFile,
+                                TBool aCreateLogDir,
+                                TInt aStaticBufferSize,
+                                TBool aUnicode,
+                                TInt aThreadId)
+    {
+    
+    __TRACE( KInfo, ( _L( "STIFLOGGER: Creating html logger" ) ) );
+
+    // Create COutput object output
+    COutput* output = COutput::NewL( aTestPath,
+                                        aTestFile,
+                                        aLoggerType,
+                                        aOutput,
+                                        aOverWrite,
+                                        aWithTimeStamp,
+                                        aWithLineBreak,
+                                        aWithEventRanking,
+                                        aThreadIdToLogFile,
+                                        aCreateLogDir,
+                                        aStaticBufferSize,
+                                        aUnicode,
+                                        aThreadId);
+
+    CleanupStack::PushL( output ); 
+    __ASSERT_ALWAYS( output != NULL, User::Leave( KErrNotFound ) );
+    // Create CTxtLogger object htmlLogger and bind to COutput
+    CHtmlLogger* htmlLogger = new (ELeave) CHtmlLogger( output,
+                                                        aTestFile,
+                                                        aThreadIdToLogFile );
+    // HTML logger owns output object and it will be destroyed in STIFLogger
+    // destructor.
+    CleanupStack::Pop( output ); 
+    
+    CleanupStack::PushL( htmlLogger );
+    htmlLogger->ConstructL();
+    CleanupStack::Pop( htmlLogger );
+
+    return htmlLogger;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: ~CHtmlLogger
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CHtmlLogger::~CHtmlLogger()
+    {
+
+    EndHtmlPage();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: StartHtmlPage
+
+    Description: Initialize html page.
+
+    Parameters: const TDesC& aTestFile: in: Log filename
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+
+    Return Values: None
+
+    Errors/Exceptions:  TDesLoggerOverflowHandler called if logged data is 
+                        over KMaxFileName.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CHtmlLogger::StartHtmlPage( const TDesC& aTestFile,
+                                    TBool aThreadIdToLogFile )
+    {
+    TFileName title;
+
+    // Create overflow handler.
+    TDesLoggerOverflowHandler overFlowHandler( this, 4 );
+
+    // Title
+    if( aTestFile.Length() < KMaxFileName )
+        {
+        title.Append( aTestFile );
+        }    
+    else
+        {
+        // If the title size is over the KMaxFileName rest of the title
+        // will cut. Use normal overflowhandler to print overflow information.
+        TBuf<4> empty; // Not really used.
+        overFlowHandler.Overflow( empty );
+        TPtrC cuttedtitle = aTestFile.Left( KMaxFileName );
+        title.Append( cuttedtitle );
+        }        
+        
+    // Add Thread id to title if enough space and test file is given and 
+    // aThreadIdToLogFile is true
+    if( title.Length() <  ( KMaxFileName - 3 ) && aTestFile.Length() > 0 &&
+        aThreadIdToLogFile )
+        {
+        title.Append( _L( "_" ) );
+        RThread threadHandle;                   // A handle to a thread
+        TThreadId id = threadHandle.Id();       // Encapsulates the 
+                                                // Id of a thread
+        // Appends id in hexadesimal format                           
+        title.AppendFormat( _L( "%x" ), (TInt)id );   
+        }
+
+    // Html start tags to whole page and header section
+    iOutput->Write( EFalse, EFalse, EFalse,
+                    _L8( "\n<html>\n<head>\n<title>" ) );
+    // Html file title
+    iOutput->Write( EFalse, EFalse, EFalse, title );
+    // Html header section end tags and start tag to body section
+    iOutput->Write( EFalse, EFalse, EFalse,
+                    _L8( "</title>\n</head>\n\n\n<body>\n" ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: EndHtmlPage
+
+    Description: Finalize html page.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CHtmlLogger::EndHtmlPage()
+    {
+    // Html page and body section end tags
+    iOutput->Write( EFalse, EFalse, EFalse,
+                    _L8( "\n\n\n</html>\n</body>\n\n\n" ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: StyleStarting
+
+    Description: Start style information logging.
+
+    Parameters: TInt aStyle: in: Style information
+                TBool aTimeStamp: inout: Time stamp indicator
+                TBool aEventRanking: inout: Event ranking indicator
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CHtmlLogger::StyleStarting( TInt aStyle, TBool& aTimeStamp,
+                                    TBool& aEventRanking )
+    {
+    if ( 0x00020 <= aStyle ||       // ERed, 0x00020 => 32
+            0x00040 <= aStyle ||    // EImportant, 0x00040 => 64
+            0x00080 <= aStyle ||    // EWarning, 0x00080 => 128
+            0x00100 <= aStyle )     // EError, 0x00100 => 256
+        {
+        iOutput->Write( EFalse, EFalse, EFalse,
+                                        _L8( "<FONT COLOR='#FF0000'>" ) );
+        if ( 0x00100 <= aStyle )
+            {
+            iOutput->Write( aTimeStamp, EFalse, aEventRanking,
+                                        _L8( "ERROR..." ) );
+            aStyle -= 0x00100;
+            aTimeStamp = EFalse;    // Time stamp added no time stamp to the
+                                    // forward operations
+            aEventRanking = EFalse; // Event ranking added no event ranking
+                                    // to the forward operations
+            }
+        if ( 0x00080 <= aStyle )
+            {
+            iOutput->Write( aTimeStamp, EFalse, aEventRanking,
+                                        _L8( "WARNING..." ) );
+            aStyle -= 0x00080;
+            aTimeStamp = EFalse;    // Time stamp added no time stamp to the 
+                                    // forward operations
+            aEventRanking = EFalse; // Event ranking added no event ranking
+                                    // to the forward operations
+            }
+        if ( 0x00040 <= aStyle )
+            {
+            iOutput->Write( aTimeStamp, EFalse, aEventRanking,
+                                        _L8( "IMPORTANT..." ) );
+            aStyle -= 0x00040;
+            aTimeStamp = EFalse;    // Time stamp added no time stamp to the 
+                                    // forward operations
+            aEventRanking = EFalse; // Event ranking added no event ranking
+                                    // to the forward operations
+            }
+        if ( 0x00020 <= aStyle )
+            {
+            aStyle -= 0x00020;
+            }
+        }
+    // EGreen, 0x00010 => 16
+    if ( 0x00010 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse,
+                        _L8( "<FONT COLOR='#009900'>" ) );
+        aStyle -= 0x00010;
+        }
+    // EBlue, 0x00008 => 8
+    if ( 0x00008 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse,
+                        _L8( "<FONT COLOR='#3333FF'>" ) );
+        aStyle -= 0x00008;
+        }
+    // EUnderline, 0x00004 => 4
+    if ( 0x00004 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "<U>" ) );
+        aStyle -= 0x00004;
+        }
+    // ECursive, 0x00002 => 2
+    if ( 0x00002 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "<I>" ) );
+        aStyle -= 0x00002;
+        }
+    // EBold, 0x00001 => 1
+    if ( 0x00001 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "<B>" ) );
+        aStyle -= 0x00001;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: StyleEnding
+
+    Description: Ends style information logging.
+
+    Parameters: TInt aStyle: in: Style information
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CHtmlLogger::StyleEnding( TInt aStyle )
+    {
+    if ( 0x00020 <= aStyle ||       // ERed, 0x00020 => 32
+            0x00040 <= aStyle ||    // EImportant, 0x00040 => 64
+            0x00080 <= aStyle ||    // EWarning, 0x00080 => 128
+            0x00100 <= aStyle )     // EError, 0x00100 => 256
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "</FONT>" ) );
+        if ( 0x00100 <= aStyle )
+            {
+            aStyle -= 0x00100;
+            }
+        if ( 0x00080 <= aStyle )
+            {
+            aStyle -= 0x00080;
+            }
+        if ( 0x00040 <= aStyle )
+            {
+            aStyle -= 0x00040;
+            }
+        if ( 0x00020 <= aStyle )
+            {
+            aStyle -= 0x00020;
+            }
+        }
+    // EGreen, 0x00010 => 16
+    if ( 0x00010 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "</FONT>" ) );
+        aStyle -= 0x00010;
+        }
+    // EBlue, 0x00008 => 8
+    if ( 0x00008 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "</FONT>" ) );
+        aStyle -= 0x00008;
+        }
+    // EUnderline, 0x00004 => 4
+    if ( 0x00004 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "</U>" ) );
+        aStyle -= 0x00004;
+        }
+    // ECursive, 0x00002 => 2
+    if ( 0x00002 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "</I>" ) );
+        aStyle -= 0x00002;
+        }
+    // EBold, 0x00001 => 1
+    if ( 0x00001 <= aStyle )
+        {
+        iOutput->Write( EFalse, EFalse, EFalse, _L8( "</B>" ) );
+        aStyle -= 0x00001;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: Send
+
+    Description: Send style information and 16 bit data to the output module
+
+    Parameters: TInt TStyle: in: Text forming
+                const TDesC& aData: in: Data to be logged
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CHtmlLogger::Send( TInt aStyle, const TDesC& aData )
+    {
+    // Time stamp indicator
+    TBool timestamp( ETrue );
+    // Event ranking indicator
+    TBool eventranking( ETrue );
+
+    StyleStarting( aStyle, timestamp, eventranking );
+
+    TInt ret = iOutput->Write( timestamp, ETrue, eventranking, aData );
+
+    StyleEnding( aStyle );
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CHtmlLogger
+
+    Method: Send
+
+    Description: Send style information and 8 bit data to the output module
+
+    Parameters: TInt TStyle: in: Text forming
+                const TDesC8& aData: in: Data to be logged
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CHtmlLogger::Send( TInt aStyle, const TDesC8& aData )
+    {
+    // Time stamp indicator
+    TBool timestamp( ETrue );
+    // Event ranking indicator
+    TBool eventranking( ETrue );
+
+    StyleStarting( aStyle, timestamp, eventranking );
+
+    TInt ret = iOutput->Write( timestamp, ETrue, eventranking, aData );
+
+    StyleEnding( aStyle );
+
+    return ret;
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/LoggerOverFlow.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,192 @@
+/*
+* 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: This module contains implementation of 
+* TDesLoggerOverflowHandler class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "LoggerOverFlow.h"
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TDesLoggerOverflowHandler
+
+    Method: TDesLoggerOverflowHandler
+
+    Description: Default constructor
+
+    Parameters: CStifLoggerBase* aLogger: in: Pointer to CStifLoggerBase object
+                TInt aOverFlowSource: in: Over flow source
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TDesLoggerOverflowHandler::TDesLoggerOverflowHandler( CStifLoggerBase* aLogger,
+                                            TInt aOverFlowSource )
+    {
+    iLogger = aLogger;
+    iOverFlowSource = aOverFlowSource;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TDesLoggerOverflowHandler
+
+    Method: Overflow
+
+    Description: Simple overflow handling(16 bit)
+
+    Parameters: TDes16 &aDes: in: Reference to over flow data
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void TDesLoggerOverflowHandler::Overflow( TDes16& aDes )
+    {
+    __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) );
+
+    // If overflow
+    TInt len( 0 );
+    len = aDes.Length();
+
+    // const TInt to TInt avoiding warnings
+    TInt maxLogData = KMaxLogData;
+    TInt maxTestFileName = KMaxFileName;
+
+    // Overflow: Log() without aStyle or Log() with aStyle
+    if ( ( iOverFlowSource == 1 || iOverFlowSource == 2 )
+            &&  maxLogData > 60 )
+        {
+        // Log overflow info if info is in allowed limits
+        aDes[len-2] = 13;   // 13 or '\' in Symbian OS
+        aDes[len-1] = 10;   // 10 or 'n' in Symbian OS
+        // ~60
+        iLogger->Send( 0, _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!") );
+        }
+    // Overflow: WriteDelimiter()
+    if ( iOverFlowSource == 3 &&  maxLogData > 70 )
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Send( 0, _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ) );
+        }
+    // Overflow: StartHtmlPage()
+    if ( iOverFlowSource == 4 &&  maxTestFileName > 70 )
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Send( 0, _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ) );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TDes8OverflowHandler
+
+    Method: TDes8LoggerOverflowHandler
+
+    Description: Default constructor
+
+    Parameters: CStifLoggerBase* aLogger: in: Pointer to CStifLoggerBase object
+                TInt aOverFlowSource: in: Over flow source
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TDes8LoggerOverflowHandler::TDes8LoggerOverflowHandler( CStifLoggerBase* aLogger,
+                                                        TInt aOverFlowSource )
+    {
+    iLogger = aLogger;
+    iOverFlowSource = aOverFlowSource;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TDes8LoggerOverflowHandler
+
+    Method: Overflow
+
+    Description: Simple overflow handling(8 bit)
+
+    Parameters: TDes8 &aDes: in: Reference to over flow data
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void TDes8LoggerOverflowHandler::Overflow( TDes8& aDes )
+    {
+    __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) );
+
+    // If overflow
+    TInt len( 0 );
+    len = aDes.Length();
+
+    // const TInt to TInt avoiding warnings
+    TInt maxLogData = KMaxLogData;
+    TInt maxTestFileName = KMaxFileName;
+
+    // Overflow: Log() without aStyle or Log() with aStyle
+    if ( ( iOverFlowSource == 1 || iOverFlowSource == 2 )
+            &&  maxLogData > 60 )
+        {
+        // Log overflow info if info is in allowed limits
+        aDes[len-2] = 13;   // 13 or '\' in Symbian OS
+        aDes[len-1] = 10;   // 10 or 'n' in Symbian OS
+        // ~60
+        iLogger->Send( 0, _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!") );
+        }
+    // Overflow: WriteDelimiter()
+    if ( iOverFlowSource == 3 &&  maxLogData > 70 )
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Send( 0, _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ) );
+        }
+    // Overflow: StartHtmlPage()
+    if ( iOverFlowSource == 4 &&  maxTestFileName > 70 )
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Send( 0, _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ) );
+        }
+
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/NullOutput.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,232 @@
+/*
+* 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: This module contains implementation of CNullOutput 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "Output.h"
+#include "NullOutput.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CNullOutput
+
+    Method: CNullOutput
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CNullOutput::CNullOutput()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CNullOutput
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CNullOutput::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CNullOutput
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CNullOutput*: pointer to CNullOutput object
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CNullOutput* CNullOutput::NewL()
+    {
+    // Create CNullOutput object nullOutput
+    CNullOutput* nullOutput = new (ELeave) CNullOutput();
+
+    CleanupStack::PushL( nullOutput );
+    nullOutput->ConstructL();
+    CleanupStack::Pop( nullOutput );
+
+    return nullOutput;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CNullOutput
+
+    Method: ~CNullOutput
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CNullOutput::~CNullOutput()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CNullOutput
+
+    Method: Write
+
+    Description: Write log information or data to the file. 16 bit.
+
+    CNullOutput's Write() method purpose is to look like logging although it
+    don't do any logging operations.
+
+    Parameters: TBool aWithTimeStamp: in: Is time stamp flag used
+                TBool aWithLineBreak: in: Is line break flag used
+                TBool aWithEventRanking: in: Is event ranking flag used
+                const TDesC& aData: in: Logged or saved data
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CNullOutput::Write( TBool /* aWithTimeStamp */, 
+                            TBool /* aWithLineBreak */,
+                            TBool /* aWithEventRanking */,
+                            const TDesC& /* aData */ )
+    {
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CNullOutput
+
+    Method: Write
+
+    Description: Write log information or data to the file. 8 bit.
+
+    CNullOutput's Write() method purpose is to look like logging although it
+    don't do any logging operations.
+
+    Parameters: TBool aWithTimeStamp: in: Is time stamp flag used
+                TBool aWithLineBreak: in: Is line break flag used
+                TBool aWithEventRanking: in: Is event ranking flag used
+                const TDesC8& aData: in: Logged or saved data
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CNullOutput::Write(  TBool /* aWithTimeStamp */, 
+                            TBool /* aWithLineBreak */,
+                            TBool /* aWithEventRanking */,
+                            const TDesC8& /* aData */ )
+    {
+    return KErrNone;
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/Output.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,244 @@
+/*
+* 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: This module contains implementation of COutput 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "Output.h"
+#include "FileOutput.h"
+#include "NullOutput.h"
+#include "LoggerOverFlow.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: COutput
+
+    Method: COutput
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+COutput::COutput()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: COutput
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    NOTE: At the moment there is only one output module implemented
+
+    Parameters: const TDesC& aTestPath: in: Path to logged information
+                const TDesC& aTestFile: in: Log name for information
+                TLoggerType aLoggerType: in: Log file type
+                TOutput aOutput: in: Output source
+                TBool aOverWrite: in: Indicator to file overwrite
+                TBool aWithTimeStamp: in: Indicator to time stamp
+                TBool aWithLineBreak: in: Indicator to line break
+                TBool aWithEventRanking: in: Indicator to event ranking
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+                TBool aCreateLogDir: in: Indicator to directory creation
+                TInt  aStaticBufferSize
+                TBool aUnicode: in: Indicator if file has to be in unicode format
+
+    Return Values: COutput*: pointer to COutput object
+
+    Errors/Exceptions:  Leaves if called CFileOutput::NewL method fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+COutput* COutput::NewL( const TDesC& aTestPath,
+                        const TDesC& aTestFile,
+                        CStifLogger::TLoggerType aLoggerType,
+                        CStifLogger::TOutput aOutput,
+                        TBool aOverWrite,
+                        TBool aWithTimeStamp,
+                        TBool aWithLineBreak,
+                        TBool aWithEventRanking,
+                        TBool aThreadIdToLogFile,
+                        TBool aCreateLogDir,
+                        TInt aStaticBufferSize,
+                        TBool aUnicode,
+                        TInt aThreadId) 
+    {
+    if ( aOutput == CStifLogger::EFile )
+        {
+        CFileOutput* fileOutput = NULL;
+        // Create CFileOutput object fileOutput
+        TRAPD( err, fileOutput = CFileOutput::NewL( aTestPath,
+                                                    aTestFile,
+                                                    aLoggerType,
+                                                    aOverWrite,
+                                                    aWithTimeStamp,
+                                                    aWithLineBreak,
+                                                    aWithEventRanking,
+                                                    aThreadIdToLogFile,
+                                                    aCreateLogDir,
+                                                    aStaticBufferSize,
+                                                    aUnicode,
+                                                    aThreadId) );
+
+        // Probably path or file name is over allowed size
+        if ( err == KErrArgument )
+            {
+            User::Leave( KErrArgument );
+            return NULL; // Never return because leave above
+            }
+        // Not enough memory, @js
+        else if ( err == KErrNoMemory )
+            {
+            User::Leave( KErrNoMemory );
+            return NULL;
+            }                      
+        // If e.g. path not found so we create CNullOutput to avoiding leave
+        // operation. CNullOutput looks logging although it won't.
+        else if ( err != KErrNone )
+            {
+            CNullOutput* nullOutput = CNullOutput::NewL();
+            nullOutput->SetOutputCreationResult( err, aOutput );
+            return nullOutput;
+            }
+        // CFileOutput creation made succesfully
+        else
+            {
+            fileOutput->SetOutputCreationResult( err, aOutput );
+            return fileOutput;
+            }
+        }
+    else if ( aOutput == CStifLogger::ERDebug )
+        {
+        CRDebugOutput* rdebugOutput = NULL;
+        // Create CRDebugOutput object rdebugOutput
+        TRAPD( err, rdebugOutput = CRDebugOutput::NewL( aTestPath, 
+                                                        aTestFile,
+                                                        aLoggerType,
+                                                        aOverWrite,
+                                                        aWithTimeStamp,
+                                                        aWithLineBreak,
+                                                        aWithEventRanking,
+                                                        aThreadIdToLogFile,
+                                                        aCreateLogDir,
+                                                        aStaticBufferSize ) );
+
+        // Probably path or file name is over allowed size
+        if ( err == KErrArgument )
+            {
+            User::Leave( KErrArgument );
+            return NULL; // Never return because leave above
+            }
+        // If e.g. no memory so we create CNullOutput to avoiding leave
+        // operation. CNullOutput looks logging although it won't.
+        else if ( err != KErrNone )
+            {
+            CNullOutput* nullOutput = CNullOutput::NewL();
+            nullOutput->SetOutputCreationResult( err, aOutput );
+            return nullOutput;
+            }
+        // CRDebugOutput creation made succesfully
+        else
+            {
+            rdebugOutput->SetOutputCreationResult( err, aOutput );
+            return rdebugOutput;
+            }
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        return NULL; // Never return because leave above
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: COutput
+
+    Method: ~COutput
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+COutput::~COutput()
+    {
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/RDebugOutput.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,684 @@
+/*
+* 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: This module contains implementation of CRDebugOutput 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "Output.h"
+#include "RDebugOutput.h"
+#include "LoggerOverFlow.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 =======================================
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRDebugOutput
+
+    Method: CRDebugOutput
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: TLoggerType aLoggerType: in: File type
+                TBool aWithTimeStamp: in: For timestamp
+                TBool aWithLineBreak: in: For line break
+                TBool aWithEventRanking: in: For events ranking to file
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CRDebugOutput::CRDebugOutput( CStifLogger::TLoggerType aLoggerType,
+                                TBool aWithTimeStamp,
+                                TBool aWithLineBreak,
+                                TBool aWithEventRanking ) :
+    COutput()
+    {
+    // Indicates file type
+    iLoggerType = aLoggerType;
+
+    // Time stamp indicator
+    iWithTimeStamp = aWithTimeStamp;
+
+    // Line break indicator
+    iWithLineBreak = aWithLineBreak;
+
+    // Log event ranking indicator
+    iWithEventRanking = aWithEventRanking;
+
+    // Data buffer
+    iDataHBuf = NULL;
+    iDataHBuf1 = NULL;
+    iDataHBuf2 = NULL;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRDebugOutput
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CRDebugOutput::ConstructL( TInt aStaticBufferSize )
+    {
+    if( aStaticBufferSize != 0)
+        {
+        iDataHBuf1 = HBufC::NewL( aStaticBufferSize );      
+        iDataHBuf2 = HBufC::NewL( aStaticBufferSize );      
+        iStaticBufferSize = aStaticBufferSize;
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRDebugOutput
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: const TDesC& aTestPath: in: Log path
+                const TDesC& aTestFile: in: Log filename
+                TLoggerType aLoggerType: in: File type
+                TBool aOverWrite: in: For file overwrite
+                TBool aWithTimeStamp: in: For timestamp
+                TBool aWithLineBreak: in: For line break
+                TBool aWithEventRanking: in: For events ranking to file
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+                TBool aCreateLogDir: in: Indicator to directory creation
+
+    Return Values: CRDebugOutput*: pointer to CFileOutput object
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CRDebugOutput* CRDebugOutput::NewL( const TDesC& /* aTestPath */,
+                                    const TDesC& /* aTestFile */,
+                                    CStifLogger::TLoggerType aLoggerType,
+                                    TBool /* aOverWrite */,
+                                    TBool aWithTimeStamp,
+                                    TBool aWithLineBreak,
+                                    TBool aWithEventRanking,
+                                    TBool /* aThreadIdToLogFile */,
+                                    TBool /* aCreateLogDir */,
+                                    TInt aStaticBufferSize)
+    {
+    // Create CFileOutput object fileWriter
+    CRDebugOutput* rdebugWriter = new (ELeave) CRDebugOutput( 
+                                                        aLoggerType,
+                                                        aWithTimeStamp,
+                                                        aWithLineBreak,
+                                                        aWithEventRanking );
+
+    CleanupStack::PushL( rdebugWriter );
+    rdebugWriter->ConstructL( aStaticBufferSize );
+    CleanupStack::Pop( rdebugWriter );
+
+    return rdebugWriter;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRDebugOutput
+
+    Method: ~CRDebugOutput
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CRDebugOutput::~CRDebugOutput()
+    {
+    delete iDataHBuf1;
+    delete iDataHBuf2;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRDebugOutput
+
+    Method: Write
+
+    Description: Write log information or data to the file. 16 bit.
+
+    Parameters: TBool aWithTimeStamp: in: Is time stamp flag used
+                TBool aWithLineBreak: in: Is line break flag used
+                TBool aWithEventRanking: in: Is event ranking flag used
+                const TDesC& aData: in: Logged or saved data
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CRDebugOutput::Write( TBool aWithTimeStamp,
+                            TBool aWithLineBreak,
+                            TBool aWithEventRanking,
+                            const TDesC& aData )
+    {
+    TInt currentEndPos( 0 );        // Current position in aData parsing
+                                    // to partitions
+
+    // a logInfo size must be at least the minimumSpace size
+    TInt minimumSpace = ( KMaxTimeStamp + KMaxHtmlLineBreak + KMaxLineBreak +
+                            KMaxEventRanking + KMaxSpace );
+        
+    TPtr logInfo(0, 0);
+    HBufC* dataHBuf = NULL;    
+    
+    if(iDataHBuf1)                            
+        {
+        TInt messageLength = aData.Length() + minimumSpace;
+        if( messageLength > iStaticBufferSize )
+            {
+             RDebug::Print(_L("Warning: buffer size too small, not able to log!"));
+             return KErrOverflow;
+            }
+        // Using the HBufC created in ConstructL
+        logInfo.Set( iDataHBuf1->Des() ); // Memory allocation for data
+        
+        }
+    else
+        {
+        // Buffer size is minimum space plus aData(aData length may be 0 but
+        // time stamp is used)
+        if( ( aData.Length() + minimumSpace ) < ( KMaxLogData + minimumSpace ) )
+            {
+            dataHBuf = HBufC::New( aData.Length() + minimumSpace );
+            }
+        // Buffer size is over KMaxLogData
+        else
+            {
+            dataHBuf = HBufC::New( aData.Length() );
+            }
+        if(!dataHBuf)
+            {
+            return KErrNoMemory;
+            }
+        logInfo.Set( dataHBuf->Des() ); // Memory allocation for data
+        }
+
+    logInfo.Copy( aData );          // Copy data
+    
+    TPtr data( 0, 0 );
+
+    // Add time stamp and/or event ranking if required
+    EventAndTimeCombiner( logInfo, data, aWithTimeStamp,
+                            aWithLineBreak, aWithEventRanking );
+
+    while( data.Length() > currentEndPos )
+        {
+        // In this loop round data length is/under 254
+        if( ( data.Length() - currentEndPos ) <= KMaxRDebug )
+            {
+            // Current positions to rest of data position
+            logInfo = data.Mid( currentEndPos, ( data.Length() - currentEndPos ) );
+            // Prevent rdebug from parsing text string as formating string
+            RDebug::Print( _L( "%S" ), &logInfo );
+            }
+        // In this loop round data length is over 254
+        else
+            {
+            // Current positions to KMaxRDebug that includes space for ' ->'
+            logInfo = data.Mid( currentEndPos, KMaxRDebug );
+            // Prevent rdebug from parsing text string as formating string
+            RDebug::Print( _L( "%S ->" ), &logInfo );
+            }
+        currentEndPos = currentEndPos + KMaxRDebug;
+        }
+
+    delete dataHBuf;
+
+    if(!iDataHBuf2)
+        {
+        delete iDataHBuf;
+        iDataHBuf = NULL;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRDebugOutput
+
+    Method: Write
+
+    Description: Write log information or data to the file. 8 bit.
+
+    Parameters: TBool aWithTimeStamp: in: Is time stamp flag used
+                TBool aWithLineBreak: in: Is line break flag used
+                TBool aWithEventRanking: in: Is event ranking flag used
+                const TDesC8& aData: in: Logged or saved data
+
+    Return Values: TInt
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CRDebugOutput::Write( TBool aWithTimeStamp,
+                            TBool aWithLineBreak,
+                            TBool aWithEventRanking,
+                            const TDesC8& aData )
+    {
+    TInt currentEndPos( 0 );        // Current position in aData parsing
+                                    // to partitions
+    TPtr logInfo(0, 0);
+
+    // a logInfo size must be at least the minimumSpace size
+    TInt minimumSpace = ( KMaxTimeStamp + KMaxHtmlLineBreak + KMaxLineBreak +
+                            KMaxEventRanking + KMaxSpace );
+    HBufC* dataHBuf = NULL;
+    if(iDataHBuf1)                            
+        {
+        if( ( aData.Length() + minimumSpace ) > iStaticBufferSize )
+            {
+             RDebug::Print(_L("Warning: buffer size too small, not able to log!"));
+             return KErrOverflow;
+            }       
+        logInfo.Set( iDataHBuf1->Des() ); // Memory allocation for data
+        }
+    else
+        {
+        // 8 bit data to 16 bit because RDebug::Print don't support 8 bit printing
+        
+        // Buffer size is minimum space plus aData(aData length may be 0 but
+        // time stamp is used)
+        if( ( aData.Length() + minimumSpace ) < ( KMaxLogData + minimumSpace ) )
+            {
+            dataHBuf = HBufC::New( aData.Length() + minimumSpace );
+            }
+        // Buffer size is over KMaxLogData
+        else
+            {
+            dataHBuf = HBufC::New( aData.Length() );
+            }
+        if(!dataHBuf)
+            {
+            return KErrNoMemory;
+            }
+        logInfo.Set( dataHBuf->Des() ); // Memory allocation for data
+        }
+        
+    logInfo.Copy( aData );          // Copy data
+
+    TPtr data( 0, 0 );
+
+    // Add time stamp and/or event ranking if required
+    EventAndTimeCombiner( logInfo, data, aWithTimeStamp,
+                            aWithLineBreak, aWithEventRanking );
+    while( data.Length() > currentEndPos )
+        {
+        // In this loop round data length is/under 254
+        if( ( data.Length() - currentEndPos ) <= KMaxRDebug )
+            {
+            // Current positions to rest of data position
+            logInfo = data.Mid( currentEndPos, ( data.Length() - currentEndPos ) );
+            // Prevent rdebug from parsing text string as formating string
+            RDebug::Print( _L( "%S" ), &logInfo );
+            }
+        // In this loop round data length is over 254
+        else
+            {
+            // Current positions to KMaxRDebug that includes space for ' ->'
+            logInfo = data.Mid( currentEndPos, KMaxRDebug );
+            // Prevent rdebug from parsing text string as formating string
+            RDebug::Print( _L( "%S ->" ), &logInfo );
+            }
+        currentEndPos = currentEndPos + KMaxRDebug;
+        }
+
+    delete dataHBuf;
+
+    if(!iDataHBuf2)
+       {
+       delete iDataHBuf;
+       iDataHBuf = NULL;
+       }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRDebugOutput
+
+    Method: EventAndTimeCombiner    
+
+    Description: Event ranking and time stamp combimer.
+
+    Parameters: TLogInfo aLogInfo: inout: Overflowed data
+                TPtr8& aData: inout: Combined data
+                TBool aWithTimeStamp: in: Is time stamp flag used
+                TBool aWithLineBreak: in: Is line break flag used
+                TBool aWithEventRanking: in: Is event ranking flag used
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CRDebugOutput::EventAndTimeCombiner( TPtr& aLogInfo,
+                                            TPtr& aData,
+                                            TBool aWithTimeStamp,
+                                            TBool aWithLineBreak,
+                                            TBool aWithEventRanking )
+    {
+    TInt extraLength( 0 );
+
+    // Extra space calculation
+    if( iWithEventRanking && aWithEventRanking )
+        {
+        extraLength = extraLength + KMaxEventRanking + KMaxSpace;
+        }
+    if( ( iLoggerType == CStifLogger::EHtml ) && iWithLineBreak && aWithLineBreak )
+        {
+        extraLength = extraLength + KMaxHtmlLineBreak;
+        }
+    if( iWithLineBreak && aWithLineBreak )
+        {
+        extraLength = extraLength + KMaxLineBreak;
+        }
+    if( aWithTimeStamp && iWithTimeStamp )
+        {
+        extraLength = extraLength + KMaxTimeStamp;
+        }
+
+    // Calculated space
+    TInt space = aLogInfo.Length();
+
+    if(iDataHBuf2)                            
+        {
+        aData.Set( iDataHBuf2->Des() );  // Memory allocation for data
+        aData.Copy( _L("") ); // Initialize aData buffer
+        }
+    else
+    {        
+        iDataHBuf = HBufC::New( space + extraLength );
+        if(!iDataHBuf)
+            {
+            return;
+            }
+        aData.Set( iDataHBuf->Des() );  // Memory allocation for data
+    }
+
+    // Event ranking
+    if( iWithEventRanking && aWithEventRanking && !iWithTimeStamp )
+        {
+        EventRanking( aData );          // Event ranking to data
+        aData.Append( aLogInfo );       // Unicode aData to normal text
+        }
+    // Time stamp
+    else if( iWithTimeStamp && aWithTimeStamp )
+        {
+        // With event ranking
+        if( iWithEventRanking && aWithEventRanking )
+            {
+            EventRanking( aData );      // Event ranking to data
+            }
+        AddTimeStampToData( aData );    // Add time stamp
+        aData.Append( aLogInfo );       // Unicode aData to normal text
+        }
+    else
+        {
+        aData.Copy( aLogInfo );         // Unicode aData to normal text
+        }
+
+    // NOTE: If need some special line break do it with logging phase
+
+    // If html logging and line break is used add the line break.
+    if ( ( iLoggerType == CStifLogger::EHtml ) && iWithLineBreak && aWithLineBreak )
+        {
+        aData.Append( _L( "<BR>" ) );
+        aData.Append( _L( "\n" ) );  // To make html file more readable
+                                    // with text editor
+        }
+
+    // Other cases line break is normal '\n' if logging is used
+    else if( iWithLineBreak && aWithLineBreak )
+        {
+        aData.Append( 0x0D ); // 13 or '\' in Symbian OS
+        aData.Append( 0x0A ); // 10 or 'n' in Symbian OS
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: EventRanking
+
+    Description: For event ranking logging.
+
+    Parameters: TPtr8& aData: inout: Data with event ranking
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CRDebugOutput::EventRanking( TPtr& aData )
+    {
+    // Returns the machine's current tick count.
+    TUint tick = User::TickCount();
+    tick &= 0xffff;
+    aData.AppendNum( tick );
+    aData.Append( _L( " " ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: DateAndTime
+
+    Description: For date and time logging.
+
+    Parameters: TPtr8& aData: inout: Data with time stamps
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CRDebugOutput::AddTimeStampToData( TPtr& aData )
+    {
+    TStifLoggerTimeStamp8 timeStamp;
+    GetDateAndTime( timeStamp );
+    aData.Append( timeStamp );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileOutput
+
+    Method: GetDateAndTime
+
+    Description: For date and time logging.
+
+    Parameters: TStifLoggerTimeStamp& aDataAndTime: inout: Generated date and time
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CRDebugOutput::GetDateAndTime( TStifLoggerTimeStamp8& aDataAndTime )
+    {
+    TInt num( 0 );
+    TInt microseconds( 0 );
+
+    // Append date
+    TTime time;
+    time.HomeTime();
+    TDateTime dateTime( time.DateTime() );
+
+    num = dateTime.Day() + 1;
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    // Append month
+    aDataAndTime.AppendNum( num );  
+    num = dateTime.Month() + 1;     // returns enum
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    aDataAndTime.AppendNum( num );
+    aDataAndTime.AppendNum( dateTime.Year() );
+
+    // Append time
+    aDataAndTime.Append( ' ' );
+    num = dateTime.Hour();
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    aDataAndTime.AppendNum( num );
+    num = dateTime.Minute();
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    aDataAndTime.AppendNum( num );
+
+    num = dateTime.Second();
+    microseconds = dateTime.MicroSecond();  // Microseconds
+
+    // Seconds
+    if( num < 10 )
+        {
+        aDataAndTime.Append( '0' );
+        }
+    aDataAndTime.AppendNum( num );
+
+   // Milliseconds
+    aDataAndTime.Append( '.' );
+    aDataAndTime.AppendNumFixedWidth( microseconds, EDecimal, 3 );
+
+    // NOTE: If you add more spaces etc. remember increment KMaxTimeStamp size!
+
+    if ( iLoggerType == CStifLogger::EHtml )
+        {
+        aDataAndTime.Append( _L("....") );
+        }
+    else
+        {
+        aDataAndTime.Append( _L("    ") );
+        }
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/STFLogServer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,270 @@
+/*
+* 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: 
+* 
+*
+*/
+
+//  Include Files  
+#include <e32base.h>
+#include <f32file.h> 
+#include "STFLogServer.h"
+#include "STFLoggerCSCommon.h"
+
+
+// Called by the CServer framework
+void CSTFLogSession::CreateL()
+	{
+	CSTFLogServer* server = static_cast<CSTFLogServer*>(const_cast<CServer2*>(Server()));
+	ASSERT(server);
+	server->AddSession();
+	iLogger = NULL;
+	}
+
+CSTFLogSession::~CSTFLogSession()
+	{
+	CSTFLogServer* server = static_cast<CSTFLogServer*>(const_cast<CServer2*>(Server()));
+	ASSERT(server);
+	server->RemoveSession();
+	
+	if(iLogger)
+	    {
+        delete iLogger;
+        iLogger = 0;
+	    }
+	}
+
+// Handle a client request
+// Leaves are handled by CHerculeanSession::ServiceError()
+void CSTFLogSession::ServiceL(const RMessage2& aMessage)
+	{
+	switch (aMessage.Function())
+		{
+		case (ESTFLogger_CreateLogger):
+			CreateLogger(aMessage);
+			break;
+		case (ESTFLogger_Log_TInt_TDesC):
+			Log_TInt_TDesCL(aMessage);
+			break;
+		case (ESTFLogger_Log_TInt_TDesC8):
+			Log_TInt_TDesC8L(aMessage);
+			break;
+		case (ESTFLogger_CreationResult):
+			CreationResult(aMessage);
+			break;
+		case (ESTFLogger_OutputType):
+			OutputType(aMessage);
+			break;
+		default:
+			PanicClient(aMessage,EPanicNotSupported);
+		break;
+		}
+	}
+
+// Handles leaves from CSTFLogSession::ServiceL()
+// A bad descriptor error implies a badly programmed client, so panic it
+// Report other errors to the client by completing the outstanding request with the error
+
+void CSTFLogSession::ServiceError(const RMessage2& aMessage, TInt aError)
+	{
+	if (KErrBadDescriptor==aError)
+		PanicClient(aMessage,EPanicBadDescriptor);
+	else
+		aMessage.Complete(aError);
+	}
+
+
+void CSTFLogSession::CreateLogger(const RMessage2& aMessage)
+    {
+    TSTFLoggerCreateData loggerCreateData;
+    TPckg<TSTFLoggerCreateData> pckgData(loggerCreateData);
+    aMessage.Read(0,pckgData);
+    TInt err;
+    if(!iLogger)
+        {
+        TRAP(err, iLogger = CStifLoggerBase::NewL( loggerCreateData.iTestPath,
+                                                loggerCreateData.iTestFile,
+                                                loggerCreateData.iLoggerType,
+                                                loggerCreateData.iOutput,
+                                                loggerCreateData.iOverWrite,
+                                                loggerCreateData.iWithTimeStamp,
+                                                loggerCreateData.iWithLineBreak,
+                                                loggerCreateData.iWithEventRanking,
+                                                loggerCreateData.iThreadIdToLogFile,
+                                                loggerCreateData.iCreateLogDir,
+                                                loggerCreateData.iStaticBufferSize,
+                                                loggerCreateData.iUnicode,
+                                                loggerCreateData.iThreadId) );
+        }
+    aMessage.Complete(err); 
+    }
+
+void CSTFLogSession::Log_TInt_TDesCL(const RMessage2& aMessage)
+	{
+	if(!iLogger)
+		{
+		aMessage.Complete(KErrBadHandle);
+		}
+	else
+		{
+		TInt length = aMessage.Int0();
+		TInt style = aMessage.Int1();
+		RBuf buf;
+		buf.CleanupClosePushL();
+		buf.Create(length);
+		aMessage.Read(2, buf);
+		TInt err = iLogger->Log(style, buf);	
+		CleanupStack::PopAndDestroy(&buf);
+		aMessage.Complete(err);
+		}
+	}
+void CSTFLogSession::Log_TInt_TDesC8L(const RMessage2& aMessage)
+	{
+	if(!iLogger)
+		{
+		aMessage.Complete(KErrBadHandle);
+		}
+	else
+		{
+		TInt length = aMessage.Int0();
+		TInt style = aMessage.Int1();
+		RBuf8 buf8;
+		buf8.CleanupClosePushL();
+		buf8.Create(length);
+		aMessage.Read(2, buf8);
+		TInt err = iLogger->Log(style, buf8);	
+		CleanupStack::PopAndDestroy(&buf8);
+		aMessage.Complete(err);
+		}
+	}
+
+void CSTFLogSession::CreationResult(const RMessage2& aMessage)
+	{
+	if(!iLogger)
+		{
+		aMessage.Complete(KErrBadHandle);
+		}
+	else
+		{
+		TInt result;
+		TPckg<TInt> creationResult(result);
+		result = iLogger->CreationResult();
+		
+		aMessage.Write(0,creationResult);
+		aMessage.Complete(KErrNone);
+		}
+	
+	}
+void CSTFLogSession::OutputType(const RMessage2& aMessage)
+	{
+	if(!iLogger)
+		{
+		aMessage.Complete(KErrBadHandle);
+		}
+	else
+		{
+		CStifLogger::TOutput outputType;
+		TPckg<CStifLogger::TOutput> type(outputType);
+		outputType = iLogger->OutputType();
+		
+		aMessage.Write(0,type);
+		aMessage.Complete(KErrNone);
+		}
+	}
+
+CServer2* CSTFLogServer::NewLC()
+	{
+	CSTFLogServer* self=new(ELeave) CSTFLogServer;
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+// Starts the server and constructs the shutdown object, starting the timer to ensure that
+// the server will exit even if the starting client connection fails
+void CSTFLogServer::ConstructL()
+	{
+	StartL(KSTFLoggerServerName);
+	iShutdown.ConstructL();
+	iShutdown.Start();
+	}
+
+// Example doesn't bother checking the version
+CSession2* CSTFLogServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
+	{
+	return new(ELeave) CSTFLogSession();
+	}
+// Cancel the shutdown timer now, the new session is connected
+void CSTFLogServer::AddSession()
+	{
+	++iSessionCount;
+	iShutdown.Cancel();  // Cancel any outstanding shutdown timer
+	}
+
+// Decrement the session counter and start the shutdown timer if the last client has disconnected
+void CSTFLogServer::RemoveSession()
+	{
+	if (--iSessionCount==0)
+		iShutdown.Start();
+	}
+
+// Initiates server exit when the timer expires
+void CShutdown::RunL()
+	{
+	CActiveScheduler::Stop();
+	}
+
+void PanicClient(const RMessage2& aMessage,TServerPanic aPanic)
+	{
+	_LIT(KPanic,"STFLoggingServer");
+	aMessage.Panic(KPanic,aPanic);
+	}
+
+// Initialize and run the server
+static void RunTheServerL()
+	{// First create and install the active scheduler
+	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+	CleanupStack::PushL(scheduler);
+	CActiveScheduler::Install(scheduler);
+
+	// create the server
+	CSTFLogServer::NewLC();
+	
+	// Naming the server thread after the server helps to debug panics
+	User::LeaveIfError(User::RenameThread(KSTFLoggerServerName));
+	
+	RProcess::Rendezvous(KErrNone);
+
+	// Enter the wait loop
+	CActiveScheduler::Start();
+	
+	// Exited - cleanup the server and scheduler
+	CleanupStack::PopAndDestroy(2, scheduler);
+	}
+
+// Server process entry-point
+TInt E32Main()
+	{
+	__UHEAP_MARK; // Heap checking
+	
+	CTrapCleanup* cleanup=CTrapCleanup::New();
+	TInt r=KErrNoMemory;
+	if (cleanup)
+		{
+		TRAP(r,RunTheServerL());
+		delete cleanup;
+		}
+	__UHEAP_MARKEND;
+	return r;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/StifLoggerBase.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,314 @@
+/*
+* 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: This module contains implementation of CStifLoggerBase 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "StifLoggerBase.h"
+#include "TxtLogger.h"
+#include "HtmlLogger.h"
+#include "DataLogger.h"
+#include "LoggerTracing.h"
+#include "LoggerOverFlow.h"
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifLoggerBase
+
+    Method: CStifLoggerBase
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifLoggerBase::CStifLoggerBase()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifLoggerBase
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: const TDesC& aTestPath: in: Path to logged information
+                const TDesC& aTestFile: in: Log name for information
+                TLoggerType aLoggerType: in: Log file type(txt, html,
+                                             data)
+                TOutput aOutput: in: Output source(File)
+                TBool aOverWrite: in: Indicator to file overwrite
+                TBool aWithTimeStamp: in: Indicator to time stamp
+                TBool aWithLineBreak: in: Indicator to line break
+                TBool aWithEventRanking: in: Indicator to event ranking
+                TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+                                              end of the log file
+                TBool aCreateLogDir: in: Indicator to directory creation
+                TInt  aStaticBufferSize
+                TBool aUnicode: in: Indicator if file has to be in unicode format
+
+    Return Values: CStifLoggerBase* logger: pointer to CStifLoggerBase object
+
+    Errors/Exceptions: Leaves if aTestPath or aTestFile length is over KMaxName
+                       Leaves if called serv.Connect() method fails
+                       Leaves if called CHtmlLogger::NewL method fails
+                       Leaves if called CDataLogger::NewL method fails
+                       Leaves if called CTxtLogger::NewL method fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifLoggerBase* CStifLoggerBase::NewL( const TDesC& aTestPath,
+                                            const TDesC& aTestFile,
+                                            CStifLogger::TLoggerType aLoggerType,
+                                            CStifLogger::TOutput aOutput,
+                                            TBool aOverWrite,
+                                            TBool aWithTimeStamp,
+                                            TBool aWithLineBreak,
+                                            TBool aWithEventRanking,
+                                            TBool aThreadIdToLogFile,
+                                            TBool aCreateLogDir,
+                                            TInt  aStaticBufferSize,
+                                            TBool aUnicode,
+                                            TInt aThreadId)
+    {
+    if( KMaxName < aTestPath.Length() || KMaxName < aTestFile.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+
+
+
+    // Html file logging
+    if ( aLoggerType == CStifLogger::EHtml )
+        {
+        // Create CHtmlLogger object logger
+        CHtmlLogger* logger = CHtmlLogger::NewL( aTestPath,
+                                                    aTestFile,
+                                                    aLoggerType,
+                                                    aOutput,
+                                                    aOverWrite,
+                                                    aWithTimeStamp,
+                                                    aWithLineBreak,
+                                                    aWithEventRanking,
+                                                    aThreadIdToLogFile,
+                                                    aCreateLogDir,
+                                                    aStaticBufferSize,
+                                                    aUnicode,
+                                                    aThreadId);
+        return (CStifLoggerBase*)logger;
+        }
+    // Data file
+    else if ( aLoggerType == CStifLogger::EData )
+        {
+        // Create CDataLogger object logger
+        CDataLogger* logger = CDataLogger::NewL( aTestPath,
+                                                    aTestFile,
+                                                    aLoggerType,
+                                                    aOutput,
+                                                    aOverWrite,
+                                                    aWithTimeStamp,
+                                                    aWithLineBreak,
+                                                    aWithEventRanking,
+                                                    aThreadIdToLogFile,
+                                                    aCreateLogDir,
+                                                    aStaticBufferSize,
+                                                    aUnicode,
+                                                    aThreadId);
+        return (CStifLoggerBase*)logger;
+        }
+    // For default: text file logging
+    else
+        {
+        // Create CTxtLogger object logger
+        CTxtLogger* logger = CTxtLogger::NewL( aTestPath,
+                                                aTestFile,
+                                                aLoggerType,
+                                                aOutput,
+                                                aOverWrite,
+                                                aWithTimeStamp,
+                                                aWithLineBreak,
+                                                aWithEventRanking,
+                                                aThreadIdToLogFile,
+                                                aCreateLogDir,
+                                                aStaticBufferSize,
+                                                aUnicode,
+                                                aThreadId);
+        return (CStifLoggerBase*)logger;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifLoggerBase
+
+    Method: ~CStifLoggerBase
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifLoggerBase::~CStifLoggerBase()
+    {
+
+    if(iOutput)
+        {
+        delete iOutput;
+        iOutput = 0;
+        }
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifLoggerBase
+
+    Method: Log
+
+    Description: Log a 16 bit information.
+
+    There is also parameter to styling text information e.g. text color.
+
+    Parameters: TInt aStyle: in: Logged text forming parameter
+                const TDesC aLogInfo: in: 16 bit data to be logged
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions:  None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifLoggerBase::Log( TInt aStyle, const TDesC& aLogInfo )
+    {
+    return Send( aStyle, aLogInfo );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifLoggerBase
+
+    Method: Log
+
+    Description: Log a 8 bit information.
+
+    There is also parameter to styling text information e.g. text color.
+
+    Parameters: TInt aStyle: in: Logged text forming parameter
+                const TDesC8 aLogInfo: in: 8 bit data to be logged
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions:  None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifLoggerBase::Log( TInt aStyle, const TDesC8& aLogInfo )
+    {
+    return Send( aStyle, aLogInfo );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifLoggerBase
+
+    Method: CreationResult
+
+    Description: Return StifLoggerBase creation result.
+
+    Parameters: None
+    
+    Return Values: StifLoggerBase creation result
+
+    Errors/Exceptions:  None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifLoggerBase::CreationResult()
+    {
+     
+    CStifLogger::TOutput outputType;
+    return iOutput->OutputCreationResult( outputType );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifLoggerBase
+
+    Method: OutputType
+
+    Description: Get output type. Valid only if CreationResult returns KErrNone.
+
+    Parameters: TOutput& aOutput
+    
+    Return Values: StifLoggerBase creation result
+
+    Errors/Exceptions:  None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifLogger::TOutput CStifLoggerBase::OutputType()
+    {
+    
+    CStifLogger::TOutput outputType;
+    iOutput->OutputCreationResult( outputType );
+    return outputType;
+    
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLoggingServer/src/TxtLogger.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,316 @@
+/*
+ * 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: This module contains implementation of CTxtLogger 
+ * class member functions
+ *
+ */
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "TxtLogger.h"
+#include "Output.h"
+#include "LoggerTracing.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CTxtLogger
+
+ Method: CTxtLogger
+
+ Description: Default constructor
+
+ C++ default constructor can NOT contain any code, that
+ might leave.
+
+ Parameters: COutput* output: in: Output source
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+CTxtLogger::CTxtLogger(COutput* output)
+    {
+
+    iOutput = output;
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CTxtLogger
+
+ Method: ConstructL
+
+ Description: Symbian OS second phase constructor
+
+ Symbian OS default constructor can leave.
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+void CTxtLogger::ConstructL()
+    {
+    //Nothing to do.
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CTxtLogger
+
+ Method: NewL
+
+ Description: Two-phased constructor.
+
+ Parameters: const TDesC& aTestPath: in: Log path
+ const TDesC& aTestFile: in: Log filename
+ TLoggerType aLoggerType: in: File type
+ TOutput aOutput: in: Output source
+ TBool aOverWrite: in: For file overwrite
+ TBool aWithTimeStamp: in: For timestamp
+ TBool aWithLineBreak: in: For line break
+ TBool aWithEventRanking: in: For events ranking to file
+ TBool aThreadIdToLogFile: in: Indicator to thread id adding to
+ end of the log file
+ TBool aCreateLogDir: in: Indicator to directory creation
+ TInt  aStaticBufferSize
+ TBool aUnicode: in: Indicator if file has to be in unicode format
+
+ Return Values: CTxtLogger*: pointer to CTxtLogger object
+
+ Errors/Exceptions: Leaves if called COutput::NewL method fails
+
+ Status: Proposal
+
+ -------------------------------------------------------------------------------
+ */
+CTxtLogger* CTxtLogger::NewL(const TDesC& aTestPath, const TDesC& aTestFile,
+        CStifLogger::TLoggerType aLoggerType, CStifLogger::TOutput aOutput,
+        TBool aOverWrite, TBool aWithTimeStamp, TBool aWithLineBreak,
+        TBool aWithEventRanking, TBool aThreadIdToLogFile,
+        TBool aCreateLogDir, TInt aStaticBufferSize, TBool aUnicode, TInt aThreadId)
+    {
+    __TRACE( KInfo, ( _L( "STIFLOGGER: Creating txt logger" ) ) );
+
+    // Create COutput object output
+    COutput* output = COutput::NewL(aTestPath, aTestFile, aLoggerType,
+            aOutput, aOverWrite, aWithTimeStamp, aWithLineBreak,
+            aWithEventRanking, aThreadIdToLogFile, aCreateLogDir,
+            aStaticBufferSize, aUnicode, aThreadId);
+
+    CleanupStack::PushL(output);
+    __ASSERT_ALWAYS( output != NULL, User::Leave( KErrNotFound ) );
+    // Create CTxtLogger object txtLogger and bind to COutput
+    CTxtLogger* txtLogger = new (ELeave) CTxtLogger(output);
+    // TXT logger owns output object and it will be destroyed in STIFLogger
+    // destructor.
+    CleanupStack::Pop(output);
+
+    CleanupStack::PushL(txtLogger);
+    txtLogger->ConstructL();
+    CleanupStack::Pop(txtLogger);
+
+    return txtLogger;
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CTxtLogger
+
+ Method: ~CTxtLogger
+
+ Description: Destructor
+
+ Parameters: None
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+CTxtLogger::~CTxtLogger()
+    {
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CTxtLogger
+
+ Method: Send
+
+ Description: Send style information and 16 bit data to the output module.
+
+ Parameters: TInt TStyle: in: Text forming
+ const TDesC& aData: in: Data to be logged
+
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+TInt CTxtLogger::Send(TInt aStyle, const TDesC& aData)
+    {
+    // Time stamp indicator
+    TBool timestamp(ETrue);
+    // Event ranking indicator
+    TBool eventranking(ETrue);
+
+    // Only EError, EWarning and EImportant styles are supporter in txt logging
+    if (0x00100 <= aStyle) // EError, 0x00100 => 256
+        {
+        iOutput->Write(timestamp, EFalse, eventranking, _L( "ERROR    " ));
+        aStyle -= 0x00100;
+        timestamp = EFalse; // Time stamp added no time stamp to the
+        // forward operations
+        eventranking = EFalse; // Event ranking added no event ranking to the
+        // forward operations
+        }
+    if (0x00080 <= aStyle) // EWarning, 0x00080 => 128
+        {
+        iOutput->Write(timestamp, EFalse, eventranking, _L( "WARNING    " ));
+        aStyle -= 0x00080;
+        timestamp = EFalse; // Time stamp added no time stamp to the 
+        // forward operations
+        eventranking = EFalse; // Event ranking added no event ranking to the
+        // forward operations
+        }
+    if (0x00040 <= aStyle) // EImportant, 0x00040 => 64
+        {
+        iOutput->Write(timestamp, EFalse, eventranking, _L( "IMPORTANT    " ));
+        aStyle -= 0x00040;
+        timestamp = EFalse; // Time stamp added no time stamp to the 
+        // forward operations
+        eventranking = EFalse; // Event ranking added no event ranking to the
+        // forward operations
+        }
+
+    return iOutput->Write(timestamp, ETrue, eventranking, aData);
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: CTxtLogger
+
+ Method: Send
+
+ Description: Send style information and 8 bit data to the output module.
+
+ Parameters: TInt TStyle: in: Text forming
+ const TDesC8& aData: in: Data to be logged
+
+ Return Values: TInt: Symbian error code.
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+TInt CTxtLogger::Send(TInt aStyle, const TDesC8& aData)
+    {
+    // Time stamp indicator
+    TBool timestamp(ETrue);
+    // Event ranking indicator
+    TBool eventranking(ETrue);
+
+    // Only EError, EWarning and EImportant styles are supporter in txt logging
+    if (0x00100 <= aStyle) // EError, 0x00100 => 256
+        {
+        iOutput->Write(timestamp, EFalse, eventranking, _L8( "ERROR    " ));
+        aStyle -= 0x00100;
+        timestamp = EFalse; // Time stamp added no time stamp to the
+        // forward operations
+        eventranking = EFalse; // Event ranking added no event ranking to the
+        // forward operations
+        }
+    if (0x00080 <= aStyle) // EWarning, 0x00080 => 128
+        {
+        iOutput->Write(timestamp, EFalse, eventranking, _L8( "WARNING    " ));
+        aStyle -= 0x00080;
+        timestamp = EFalse; // Time stamp added no time stamp to the 
+        // forward operations
+        eventranking = EFalse; // Event ranking added no event ranking to the
+        // forward operations
+        }
+    if (0x00040 <= aStyle) // EImportant, 0x00040 => 64
+        {
+        iOutput->Write(timestamp, EFalse, eventranking, _L8( "IMPORTANT    " ));
+        aStyle -= 0x00040;
+        timestamp = EFalse; // Time stamp added no time stamp to the 
+        // forward operations
+        eventranking = EFalse; // Event ranking added no event ranking to the
+        // forward operations
+        }
+
+    return iOutput->Write(timestamp, ETrue, eventranking, aData);
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/common/inc/LoggerTracing.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,47 @@
+/*
+* 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: This file contains the tracing operations for the 
+* CStifLoggerBase and COutput.
+*
+*/
+
+#ifndef LOGGERTRACING_H
+#define LOGGERTRACING_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32debug.h> 
+
+// CONSTANTS
+const TUint KError           = 0x1;
+const TUint KInfo            = 0x2;
+const TUint KAlways          = 0xFFFFFFFF;
+const TUint KDebugLevel      = ( KError );
+
+// MACROS
+#ifdef _DEBUG
+#define __TRACING_ENABLED
+#endif
+
+#ifdef __TRACING_ENABLED
+// Disable conditional expression is constant -warning
+#pragma warning( disable : 4127 )
+#define __TRACE(level,p) if ( (level) & KDebugLevel) { RDebug::Print p ;}
+#else
+#define __TRACE(level,p);
+#endif
+
+#endif // LOGGERTRACING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/common/inc/STFLoggerCSCommon.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef STFLOGGERCSCOMMON_H__
+#define STFLOGGERCSCOMMON_H__
+
+#include <stiflogger.h>
+
+_LIT(KSTFLoggerServerName,"STFLoggingServer");// The server's identity within the client-server framework
+_LIT(KSTFLoggerServerBinaryName,"STFLoggingServer"); // The name of the server binary (dll or exe) 
+
+
+
+enum TSTFLoggerFunction
+	{
+	ESTFLogger_CreateLogger,	
+	ESTFLogger_Log_TInt_TDesC,
+	ESTFLogger_Log_TInt_TDesC8,
+	ESTFLogger_CreationResult,
+	ESTFLogger_OutputType
+	};
+
+
+class TSTFLoggerCreateData
+	{
+public:
+	TSTFLoggerCreateData();
+	TSTFLoggerCreateData(const TDesC& aTestPath,
+			            const TDesC& aTestFile,
+			            CStifLogger::TLoggerType aLoggerType,
+			            CStifLogger::TOutput aOutput,
+			            TBool aOverWrite,
+			            TBool aWithTimeStamp,
+			            TBool aWithLineBreak,
+			            TBool aWithEventRanking,
+			            TBool aThreadIdToLogFile,
+			            TBool aCreateLogDir,
+			            TInt  aStaticBufferSize,
+			            TBool aUnicode,
+			            TInt  aThreadId);
+
+public:
+	TPath iTestPath;
+	TFileName iTestFile;
+    CStifLogger::TLoggerType iLoggerType;
+    CStifLogger::TOutput iOutput;
+    TBool iOverWrite;
+    TBool iWithTimeStamp;
+    TBool iWithLineBreak;
+    TBool iWithEventRanking;
+    TBool iThreadIdToLogFile;
+    TBool iCreateLogDir;
+    TInt  iStaticBufferSize;
+    TBool iUnicode;
+    TInt  iThreadId;
+	};
+
+inline TSTFLoggerCreateData::TSTFLoggerCreateData():
+                                                    iLoggerType(CStifLogger::ETxt),
+                                                    iOutput(CStifLogger::EFile),
+                                                    iOverWrite(ETrue),
+                                                    iWithTimeStamp(ETrue),
+                                                    iWithLineBreak(ETrue),
+                                                    iWithEventRanking(EFalse),
+                                                    iThreadIdToLogFile(ETrue),
+                                                    iCreateLogDir(EFalse),
+                                                    iStaticBufferSize(0),
+                                                    iUnicode(EFalse),
+                                                    iThreadId(0)
+	{
+	};
+
+inline TSTFLoggerCreateData::TSTFLoggerCreateData(const TDesC& aTestPath,
+										        const TDesC& aTestFile,
+										        CStifLogger::TLoggerType aLoggerType,
+										        CStifLogger::TOutput aOutput,
+										        TBool aOverWrite,
+										        TBool aWithTimeStamp,
+										        TBool aWithLineBreak,
+										        TBool aWithEventRanking,
+										        TBool aThreadIdToLogFile,
+										        TBool aCreateLogDir,
+										        TInt aStaticBufferSize,
+										        TBool aUnicode,
+										        TInt aThreadId):
+                                                                  iTestPath(aTestPath),
+                                                                  iTestFile (aTestFile),
+                                                                  iLoggerType (aLoggerType),
+                                                                  iOutput (aOutput),
+                                                                  iOverWrite (aOverWrite),
+                                                                  iWithTimeStamp (aWithTimeStamp),
+                                                                  iWithLineBreak (aWithLineBreak),
+                                                                  iWithEventRanking (aWithEventRanking),
+                                                                  iThreadIdToLogFile (aThreadIdToLogFile),
+                                                                  iCreateLogDir (aCreateLogDir),
+                                                                  iStaticBufferSize (aStaticBufferSize),
+                                                                  iUnicode (aUnicode),
+                                                                  iThreadId (aThreadId)
+										        
+	{
+	}
+
+
+#endif // STFLOGGERCSCOMMON_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -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: 
+* 
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+//STFLoggingServer
+#include "../stfloggingserver/group/bld.inf"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/parser/inc/ParserTracing.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,47 @@
+/*
+* 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: This file contains the tracing operations for the 
+* CStifParser, CStifSectionParser and CStifItemParser
+*
+*/
+
+#ifndef STIFPARSERTRACING_H
+#define STIFPARSERTRACING_H
+
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+const TUint KError           = 0x1;
+const TUint KInfo            = 0x2;
+const TUint KAlways          = 0xFFFFFFFF;
+const TUint KDebugLevel      = ( KError );
+
+// MACROS
+#ifdef _DEBUG
+#define __TRACING_ENABLED
+#endif
+
+#ifdef __TRACING_ENABLED
+// Disable conditional expression is constant -warning
+#pragma warning( disable : 4127 )
+#define __TRACE(level,p) if ( (level) & KDebugLevel) { RDebug::Print p ;}
+#else
+#define __TRACE(level,p);
+#endif
+
+#endif // STIFPARSERTRACING_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/parser/inc/StifFileParser.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,238 @@
+/*
+* 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: This file contains the header file of the CStifFileParser.
+*
+*/
+
+#ifndef STIF_FILE_PARSER_H
+#define STIF_FILE_PARSER_H
+
+//  INCLUDES
+#include <f32file.h>
+#include <e32std.h>
+#include <e32base.h>
+#include "cstackdeprecated.h"
+#include <StifTestModule.h>
+#include "StifParser.h"
+
+// CONSTANTS
+_LIT(KIncludeKeyword, "INCLUDE");
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CStifFileParser is a STIF Test Framework StifParser class.
+// Class contains a configuration file parsing operations without loading it into memory.
+
+
+NONSHARABLE_CLASS (CStifFileParser) : public CBase
+{
+    public:     // Enumerations
+		// Indication what kind of char sequence is to be found
+        enum TWhatToFind
+      	{
+        	EStart,             // '//' or '/*' or '"' signs
+        	EQuota,             // '"' sign
+        	EEndOfComment       // '*/' sequence
+    	};
+
+		// Indication if beginning or end of section is to be found
+        enum TSectionFind
+        {
+        	ESectionStart,
+        	ESectionEnd
+        };
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * Creating parser with given handle to file. For default all
+        * information will be parsed(ENoComments).
+        */
+        static CStifFileParser* NewL(RFs& aFs,
+                                     RFile &aFile,
+                                     TBool aIsUnicode,
+                                     CStifParser::TCommentType aCommentType = CStifParser::ENoComments);
+
+        /**
+        * Destructor.
+        */
+        ~CStifFileParser();
+
+    public:     // New functions
+
+        /**
+        * Open and read configuration source and parses a required section.
+        * This method will parse next section after the earlier section if
+        * aSeeked parameter is equal 1.
+        * If configuration file includes several sections with both start and
+        * end tags so aSeeked parameter seeks the required section. The aSeeked
+        * parameters indicates section that will be parsed.
+        * If start tag is not given, returned section begins from the beginning of
+        * the file. If end tag is not given, returned sections ends at the end of
+        * the file.
+        * If section is not found and first occurence of section is seeked, function
+        * will return NULL, but if second (or further) occurence is seeked, function
+        * will leave with KErrNotFound (for compability with CStifParser::NextSectionL
+		* reason).
+        */
+		HBufC* NextSectionL(const TDesC& aStartTag,
+                            const TDesC& aEndTag,
+                            TInt& aOffset,
+                            TInt aSeeked = 1,TBool aIsHasEndTag=ETrue);
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CStifFileParser(CStifParser::TCommentType aCommentType);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(RFs& aFs,
+                        RFile &aFile,
+                        TBool aIsUnicode);
+
+        /**
+        * Reads configuration source and returns a complete line.
+        * This method will return also and end of line sequence.
+        */
+		TBool ReadLineL(TPtr& aLineBuffer,
+		                TPtr& aEndOfLineBuffer);
+
+        /**
+        * Parses a given line and removes all c-style comments from it (and #-style comments).
+        * Result is passed in destination buffer.
+        */
+		void ReplaceCommentsLineL(TPtr& aSrcBufPtr,
+		                          TPtr& aDstBufPtr,
+								  TWhatToFind& aFind);
+
+        /**
+        * Parses a given line and removes all #-style comments.
+        * Result is passed in destination buffer.
+        */
+	 	void ReplaceHashCommentsLineL(TPtr& aSrcBufPtr,
+ 	                                  TPtr& aDstBufPtr);
+
+        /**
+        * Closes all files on file stack and clears the stack.
+        */
+ 	    void ClearFileStack(void);
+
+        /**
+        * Pops RFile handle from file stack and sets correct current file handle.
+        */
+        void PopFromFileStack(void);
+
+        /**
+        * Opens file and pushes it to stack.
+        */
+        void PushFileToStackL(const TDesC& aFileName);
+
+        /**
+        * Deletes all descriptors assigned to array and empties array.
+        */
+        void ClearSectionLinesArray(void);
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        /**
+        * For file opening.
+        */
+        RFs         iFileServer;
+
+        /**
+        * For file opening. This is the first (base) file. Later other files may be opened if
+        * they are included to base one.
+        */
+        RFile       iBaseFile;
+
+        /**
+        * Comment type's indication.
+        */
+        CStifParser::TCommentType iCommentType;
+
+        /**
+        * Flag indicating if file is unicode.
+        */
+        TBool       iIsUnicode;
+        
+        /**
+        * How many bytes per char in file (2 for unicode, 1 for non-unicode).
+        */
+        TInt 		iBytesPerChar;
+        
+        /**
+        * Handle to file which is currently read.
+        */
+        RFile*      iCurrentFile;
+
+        /**
+        * Stack of opened files (it does not contain base file).
+        */
+        CStackDeprecated<RFile, EFalse>* iFileStack;
+
+        /**
+        * Array of lines belonging to seeked section.
+        */
+		RPointerArray<HBufC> iSectionLines;
+
+		/**
+		* Array of already included files (to avoid loop in includes).
+		*/
+		RPointerArray<HBufC> iFileNames;
+
+		/**
+		* Buffer with eol sequence. Filled when include found and used after last line of inlcuded file.
+		*/
+		TBuf<2>     iEolBuf;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+};
+
+#endif      // STIF_FILE_PARSER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/parser/inc/cstackdeprecated.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2000-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: 
+*
+*/
+
+// CStackDeprecated class was part of Symbian enviroment(as a CStack.h), but now it is deprecated. 
+
+#ifndef __CSTACKDEPRECATED_H__
+#define __CSTACKDEPRECATED_H__
+
+#include <e32base.h>
+
+#pragma warning (disable : 4127) // conditional expression is constant
+
+
+/**	
+	@file
+	@publishedAll
+	@released
+*/
+
+
+template <class T, TBool StackOwnsEntry>
+class CStackDeprecated : /*protected CArrayPtrSeg<T>*/ public CArrayPtrSeg<T>
+	{
+public:
+	inline CStackDeprecated();
+	inline ~CStackDeprecated();
+
+	inline void Clear();		
+	inline TBool IsEmpty() const;
+	inline void PushL(T* aItem);
+	inline T* Pop();
+	inline T* Head() const;
+	inline T* Last() const;		
+	};
+
+#include "cstackdeprecated.inl"
+
+#pragma warning ( default : 4127 ) // conditional expression is constant
+
+#endif // __CSTACK_HDEPRECATED__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/parser/inc/cstackdeprecated.inl	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2000 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: 
+*
+*/
+
+
+#ifndef __CSTACKDEPRECATED_INL__
+#define __CSTACKDEPRECATED_INL__
+
+// constants
+const TInt KStackGranularity=32;
+
+enum TCStackPanic
+	{
+	ECStackErrStackIsEmpty,
+	ECStackDeleteWhenNotOwner,
+	ECStackPopsWhenOwner
+	};
+
+_LIT(KCStackPanicName, "CStackDeprecated");
+
+inline void Panic(TCStackPanic aPanic)
+	{
+	User::Panic(KCStackPanicName, aPanic);
+	}
+
+//
+// CStack
+//
+
+template <class T, TBool StackOwnsEntry>
+inline CStackDeprecated<T, StackOwnsEntry>::CStackDeprecated()
+: CArrayPtrSeg<T>(KStackGranularity)
+	{
+	this->Reset();
+	}
+
+template <class T, TBool StackOwnsEntry>
+inline CStackDeprecated<T, StackOwnsEntry>::~CStackDeprecated()
+	{ 
+	Clear();
+	}
+
+template <class T, TBool StackOwnsEntry>
+inline void CStackDeprecated<T, StackOwnsEntry>::Clear() 
+	{ 
+	if (StackOwnsEntry) 
+		this->ResetAndDestroy(); 
+	else 
+		this->Reset(); 
+	}
+
+template <class T, TBool StackOwnsEntry>
+inline TBool CStackDeprecated<T, StackOwnsEntry>::IsEmpty() const 
+	{ 
+	return this->Count()==0;
+	}
+
+template <class T, TBool StackOwnsEntry>
+inline void CStackDeprecated<T, StackOwnsEntry>::PushL(T* aItem) 
+	{
+	if (StackOwnsEntry)
+		CleanupStack::PushL(aItem); 
+	this->AppendL(aItem); 
+	if (StackOwnsEntry)
+		CleanupStack::Pop();
+	}
+
+template <class T, TBool StackOwnsEntry>
+inline T* CStackDeprecated<T, StackOwnsEntry>::Pop() 
+	{
+	__ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty));
+	T* item=Head(); 
+	this->Delete(this->Count()-1);
+	return item;
+	}
+
+template <class T, TBool StackOwnsEntry>
+inline T* CStackDeprecated<T, StackOwnsEntry>::Head() const 
+	{
+	__ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty));
+	return this->At(this->Count()-1);
+	}
+
+template <class T, TBool StackOwnsEntry>
+inline T* CStackDeprecated<T, StackOwnsEntry>::Last() const 
+	{
+	__ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty));
+	return this->At(0);
+	}
+	
+
+#endif // __CSTACKDEPRECATED_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/parser/src/StifFileParser.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,941 @@
+/*
+* 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: This module contains implementation of CStifParser 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "StifFileParser.h"
+#include "StifTestInterface.h"
+#include "ParserTracing.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: CStifFileParser
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: TCommentType aCommentType: in: Comment type's indication
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifFileParser::CStifFileParser(CStifParser::TCommentType aCommentType)
+	{
+    iCommentType = aCommentType;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Sets variables.
+
+    Parameters: RFs& aFs:        in: Handle to valid file server
+                RFile& aFile:    in: Handle to the source file
+                TBool aIsUnicode in: Is file in unicode format
+
+    Return Values: None
+
+    Errors/Exceptions:  None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifFileParser::ConstructL(RFs& aFs,
+                                 RFile& aFile,
+                                 TBool aIsUnicode)
+	{
+	//Initialization
+	iFileServer = aFs;
+	iBaseFile = aFile;
+	iCurrentFile = &aFile;
+	iIsUnicode = aIsUnicode;
+	iBytesPerChar = iIsUnicode ? 2 : 1;
+
+	//Create file stack (INCLUDE feature)
+	iFileStack = new (ELeave) CStackDeprecated<RFile, EFalse>;
+
+	//Add base file to file names array
+	TFileName fn;
+	iCurrentFile->FullName(fn);
+	HBufC* newFile = fn.AllocLC();
+	User::LeaveIfError(iFileNames.Append(newFile));
+	CleanupStack::Pop(newFile);
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Starting creating parser with path and file information.
+
+    Parameters: RFs& aFs:                  in: Handle to file server
+                RFile& aFile:              in: Source path definition
+                TBool aIsUnicode           in: Is file in unicode format
+                TCommentType aCommentType: in: Comment type's indication
+
+    Return Values: CStifFileParser* : pointer to CStifFileParser object
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CStifFileParser* CStifFileParser::NewL(RFs& aFs,
+                                       RFile& aFile,
+                                       TBool aIsUnicode,
+                                       CStifParser::TCommentType aCommentType)
+	{
+    // Create CStifParser object
+    CStifFileParser* parser = new (ELeave) CStifFileParser(aCommentType);
+
+    CleanupStack::PushL(parser);
+    parser->ConstructL(aFs, aFile, aIsUnicode);
+    CleanupStack::Pop(parser);
+
+    return parser;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: ~CStifFileParser
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CStifFileParser::~CStifFileParser()
+	{
+	//Close file stack
+	ClearFileStack();
+	delete iFileStack;
+
+	//Close section lines array
+	ClearSectionLinesArray();
+	iSectionLines.Close();
+	
+	//Close fila names array
+	while(iFileNames.Count() > 0)
+		{
+		delete iFileNames[0];
+		iFileNames.Remove(0);
+		}
+	iFileNames.Close();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: ReadLineL
+
+    Description: Reads line from source file
+
+    Parameters: TPtr& aLineBuffer:      in: Descriptor in which line loads
+                TPtr& aEndOfLineBuffer: in: Descriptor in which end of line sequence is loaded (0x0A or 0x0D 0x0A)
+
+    Return Values: TBool: determines whether line was readed or not
+
+    Errors/Exceptions:  Leaves if seek command leaves
+    					Leaves if buffer is too small
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CStifFileParser::ReadLineL(TPtr& aLineBuffer,
+                                 TPtr& aEndOfLineBuffer)
+	{
+	//Variables
+	TBuf8<128> buf8;
+	TBuf16<128> buf16;
+	TPtrC16 buf;
+	TInt pos;
+	TInt offset;
+	TChar char0x0A = 0x000A;
+	TChar char0x0D = 0x000D;
+
+	TBuf<1> b0x0A;
+	b0x0A.Append(char0x0A);
+
+	//Reset buffers
+	aLineBuffer.Zero();
+	aEndOfLineBuffer.Zero();
+
+	//Read from source
+	User::LeaveIfError(iCurrentFile->Read(buf8));
+	buf16.Copy(buf8);
+	if(iIsUnicode)
+		buf.Set((TUint16 *)(buf8.Ptr()), buf8.Length() / 2);
+	else
+		buf.Set(buf16.Ptr(), buf16.Length());
+
+	while(buf.Length())
+		{
+		//Search for end of line char
+		pos = buf.Find(b0x0A);
+
+		//If found, append readed data to output descriptor and move back file offset to correct position
+		if(pos >= 0)
+			{
+			offset = -((buf.Length() - pos - 1) * iBytesPerChar);
+			User::LeaveIfError(iCurrentFile->Seek(ESeekCurrent, offset));
+			buf.Set(buf.Ptr(), pos + 1);
+			aLineBuffer.Append(buf);
+			break;
+			}
+		//Otherwise, append whole buffer to output descriptor
+		else
+			{
+			aLineBuffer.Append(buf);
+			}
+		//Read next part of data
+		User::LeaveIfError(iCurrentFile->Read(buf8));
+		buf16.Copy(buf8);
+		if(iIsUnicode)
+			{
+			buf.Set((TUint16 *)(buf8.Ptr()), buf8.Length() / 2);
+			}
+		else
+			{
+			buf.Set(buf16.Ptr(), buf16.Length());
+			}
+		}
+
+	//Set correct end of line buffer
+	if(buf.Length() > 1)
+		{
+		if(buf[buf.Length() - 2] == char0x0D)
+			{
+			aEndOfLineBuffer.Append(char0x0D);
+			}
+		}
+	if(buf.Length() > 0)
+		{
+		if(buf[buf.Length() - 1] == char0x0A)
+			{
+			aEndOfLineBuffer.Append(char0x0A);
+			}
+		else
+			{
+			aEndOfLineBuffer.Zero();
+			}
+		}
+	if(aEndOfLineBuffer.Length())
+		{
+		aLineBuffer.SetLength(aLineBuffer.Length() - aEndOfLineBuffer.Length());
+		}
+
+	//If no data was found, try to get previous file from stack
+	if(aLineBuffer.Length() + aEndOfLineBuffer.Length() == 0)
+		{
+		//Pop file from stack. If stack is empty, then we achieved end of base file
+		if(!iFileStack->IsEmpty())
+			{
+			PopFromFileStack();
+			aEndOfLineBuffer.Copy(iEolBuf);
+			return aEndOfLineBuffer.Length();
+			}
+		}
+	//Check if this is include line
+	else
+		{
+		if(aLineBuffer.Find(KIncludeKeyword) == 0)
+			{
+			TFileName fn;
+			TLex lex(aLineBuffer);
+
+			fn.Copy(lex.NextToken()); //get INCLUDE keyword
+			fn.Copy(lex.NextToken()); //get cfg file name
+			if(fn.Length() > 0)
+				{
+				TStifUtil::CorrectFilePathL( fn );
+				PushFileToStackL(fn);
+				iEolBuf.Copy(aEndOfLineBuffer);
+				}
+			else
+				{
+				__TRACE(KError, (_L("No filename was given after INCLUDE. Ignoring")));
+				}
+
+			//Read next line
+			return ReadLineL(aLineBuffer, aEndOfLineBuffer);
+			}
+		}
+	
+	return aLineBuffer.Length() + aEndOfLineBuffer.Length();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: ReplaceCommentsLineL
+
+    Description: Replaces comments with spaces from line and copy it to destination buffer
+
+    Parameters: TPtr& aSrcBufPtr:        in:  Source line with comments
+                TPtr& aDstBufPtr:       out:  Destination line without comments
+                TWhatToFind& aFind:  in out:  Determines what method currently is looking for
+
+    Return Values: None
+
+    Errors/Exceptions:  None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifFileParser::ReplaceCommentsLineL(TPtr& aSrcBufPtr,
+                                           TPtr& aDstBufPtr,
+										   TWhatToFind& aFind)
+	{
+	//Variables
+	TLex lex(aSrcBufPtr);
+	TChar ch;
+	TChar chSpace(' ');
+	TChar chSlash('/');
+	TChar chQuota('\"');
+	TChar chMulti('*');
+	TChar chHash('#');
+
+	//Clean buffer
+	aDstBufPtr.Zero();
+
+	while(!lex.Eos())
+		{
+		ch = lex.Get();
+
+		//If the end of line, exit
+		if(!ch)
+			{
+			break;
+			}
+
+		//We're looking for start od quoted text or comment
+		if(aFind == EStart)
+			{
+			//Special character readed
+			if(ch == chQuota)
+				{
+				aFind = EQuota;
+				aDstBufPtr.Append(chSpace);
+				}
+			//Possible start of comment
+			else if(ch == chSlash)
+				{
+				//Comment to the end of line found
+				if(lex.Peek() == chSlash)
+					{
+					break;
+					}
+				//Beginning of a comment found
+				else if(lex.Peek() == chMulti)
+					{
+					aFind = EEndOfComment;
+					ch = lex.Get();
+					aDstBufPtr.Append(chSpace);
+					aDstBufPtr.Append(chSpace);
+					}
+				//No start of comment - add read slash
+				else
+					{
+					aDstBufPtr.Append(ch);
+					}
+				}
+			//Start of hash comment (to the end of line)
+			else if(ch == chHash)
+				{
+				break;
+				}
+			//Append readed character to the destination buffer
+			else
+				{
+				aDstBufPtr.Append(ch);
+				}
+			}
+		//We're looking for the end of quoted text
+		else if(aFind == EQuota)
+			{
+			if(ch == chQuota)
+				{
+				aFind = EStart;
+				aDstBufPtr.Append(chSpace);
+				}
+			else
+				{
+				aDstBufPtr.Append(chSpace);
+				}
+			}
+		//We're looking for the end of comment
+		else if(aFind == EEndOfComment)
+			{
+			//It may be the end of a comment
+			if(ch == chMulti)
+				{
+				ch = lex.Peek();
+				//It is the end of a comment
+				if(ch == chSlash)
+					{
+					aFind = EStart;
+					ch = lex.Get();
+					aDstBufPtr.Append(chSpace);
+					aDstBufPtr.Append(chSpace);
+					}
+				//It is not the end of a comment, add this character to the destinaton buffer
+				else
+					{
+					aDstBufPtr.Append(chSpace);
+					}
+				}
+			//It is not the end of a comment, add this character to the destinaton buffer
+			else
+				{
+				aDstBufPtr.Append(chSpace);
+				}
+			}
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: ReplaceHashCommentsLineL
+
+    Description: Copy line to destination buffer and deletes #-style comments
+
+    Parameters: TPtr& aSrcBufPtr:     in:  Source line with comments
+                TPtr& aDstBufPtr:    out: Destination line without comments
+
+    Return Values: None
+
+    Errors/Exceptions:  None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifFileParser::ReplaceHashCommentsLineL(TPtr& aSrcBufPtr,
+                                               TPtr& aDstBufPtr)
+	{
+	//Variables
+	TLex lex(aSrcBufPtr);
+	TChar ch;
+	TChar chHash('#');
+
+	//Prepare destination buffer
+	aDstBufPtr.Zero();
+
+	//Copy source line to destination until # char is found
+	while(!lex.Eos())
+		{
+		ch = lex.Get();
+
+		//If the end of line, exit
+		if(!ch)
+			{
+			break;
+			}
+
+		if(ch == chHash)
+			{
+			break;
+			}
+		else
+			{
+			aDstBufPtr.Append(ch);
+			}
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: NextSectionL
+
+    Description: Finds n-th (aSeeked) section in file starting from m-th (aOffset) position
+
+    Parameters: const TDesc& aStartTag: in:     Starting tag of a section
+                const TDesc& aEndTag:   in:     Ending tag of a section
+                TInt& aOffset:          in out: Current offset in file (*)
+                TInt aSeeked:           in:     Which section is to be found
+    
+    Notification: aOffset has different meaning than before adding INCLUDE functionality.
+                  If it has 0 value, that means that we need to remove files stack and go
+                  back to base file to the beginning. Otherwise we don't change current
+                  file read-handler position.
+
+    Return Values: HBufC *: address of a descriptor containing section. Section is returned without tags.
+                            Caller must take care about the freeing descriptor.
+
+    Errors/Exceptions:  Leaves if aSeeked is less than 1 or aOffset is negative
+    					Leaves if seek command leaves
+    					Leaves if cannot allocate buffers
+    					Leaves if cannot allocate section
+    					Leaves if length of readed line exceeds KMaxLineLength constant
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+HBufC* CStifFileParser::NextSectionL(const TDesC& aStartTag,
+                                     const TDesC& aEndTag,
+                                     TInt& aOffset,
+                                     TInt aSeeked,TBool aIsHasEndTag)
+	{
+	// Check arguments
+	if(aSeeked < 1)
+		{		
+		User::Leave(KErrArgument);
+		}
+	if(aOffset < 0)
+		{		
+		User::Leave(KErrArgument);
+		}
+
+	TInt foundSection = 0;
+	TInt ret;
+
+	// Alloc buffers to read line
+	const TInt KMaxLineLength = 4096; //If length of readed line exceeds this constant, method will leave
+
+	HBufC* buf = HBufC::NewL(KMaxLineLength);
+	CleanupStack::PushL(buf);
+	TPtr bufPtr(buf->Des());
+
+	HBufC* withoutCommentsBuf = HBufC::NewL(KMaxLineLength);
+	CleanupStack::PushL(withoutCommentsBuf);
+	TPtr withoutCommentsBufPtr(withoutCommentsBuf->Des());
+
+	HBufC* endOfLine = HBufC::NewL(2);  //After reading a line it contains 0D0A or 0A or null (how readed line is ended)
+	CleanupStack::PushL(endOfLine);
+	TPtr endOfLinePtr(endOfLine->Des());
+
+	//Set valid position in file
+	//but only if offset shows to 0. Otherwise keep previus position
+	if(aOffset == 0)
+		{
+		User::LeaveIfError(iBaseFile.Seek(ESeekStart, aOffset));
+		ClearFileStack();
+		aOffset = 1;
+		}
+
+	//Prepare to read lines
+	TBool validSectionBeginFound = EFalse;
+	TBool validSectionEndFound = EFalse;
+	TSectionFind whatToFindSection = ESectionStart;
+	//If no start tag is given start to find end tag immediatly
+	if(aStartTag.Length() == 0)
+		{
+		foundSection++;
+		whatToFindSection = ESectionEnd;
+		validSectionBeginFound = ETrue;
+		}
+	if(aEndTag.Length() == 0&&aIsHasEndTag)
+		{
+		validSectionEndFound = ETrue;
+		}
+	
+	TWhatToFind whatToFind = EStart;
+
+	//Perform reading file
+	while(ReadLineL(bufPtr, endOfLinePtr))
+		{
+		if(iCommentType == CStifParser::ECStyleComments)
+			{				
+			ReplaceCommentsLineL(bufPtr, withoutCommentsBufPtr, whatToFind);
+			}
+		else
+			{
+			ReplaceHashCommentsLineL(bufPtr, withoutCommentsBufPtr);
+			}
+			if(whatToFindSection == ESectionStart)
+			{
+			//Find in line star tag (if start tag is not given, behave like we've found it)
+			if(aStartTag.Length() == 0)
+				{
+				ret = 0;
+				}
+			else
+				{
+				ret = withoutCommentsBuf->Find(aStartTag);
+				}
+			//If found remember position, move offset of file to actual position
+			if(ret >= 0)
+				{
+				whatToFindSection = ESectionEnd;
+				TInt offset = -(bufPtr.Length() + endOfLinePtr.Length() - ret - aStartTag.Length()) * iBytesPerChar;
+				User::LeaveIfError(iCurrentFile->Seek(ESeekCurrent, offset));
+
+				whatToFind = EStart; //reset marker, because if we've found tag, we couldn't be in the middle of comment or quota
+				foundSection++;
+				//Add this line to section lines array
+				if(foundSection == aSeeked)
+					{
+					validSectionBeginFound = ETrue;
+					}
+				continue;
+				}
+			}
+		else if(whatToFindSection == ESectionEnd)
+			{
+			//Find in line end tag (if end tag is not given, behave like we've found it)
+			if(aEndTag.Length() == 0&&aIsHasEndTag)
+				{
+				ret = KErrNotFound;
+				}
+			else
+				{
+				if(aIsHasEndTag)
+				    {
+				    ret = withoutCommentsBuf->Find(aEndTag);
+				    }
+				else
+				    {
+				    ret = withoutCommentsBuf->Find(_L("["));
+				    }
+				
+				}
+				//If found check if this is the one we're looking for
+			if(ret >= 0)
+				{
+				whatToFindSection = ESectionStart;
+				TInt offset = -(bufPtr.Length() + endOfLinePtr.Length() - ret - aEndTag.Length()) * iBytesPerChar;
+				User::LeaveIfError(iCurrentFile->Seek(ESeekCurrent, offset));
+
+				whatToFind = EStart; //reset marker, because if we've found tag, we couldn't be in the middle of comment or quota
+				if(foundSection == aSeeked)
+					{
+					//Add this line to section lines array
+					HBufC* line = HBufC::NewLC(bufPtr.Length());
+					TPtr linePtr(line->Des());
+					linePtr.Copy(bufPtr.MidTPtr(0, ret));
+					User::LeaveIfError(iSectionLines.Append(line));
+					CleanupStack::Pop(line);
+					validSectionEndFound = ETrue;
+					break;
+					}
+				else
+					{
+					continue;
+					}
+				}
+			else
+				{
+				//If we're in section we are looking for, add line to array
+				if(foundSection == aSeeked)
+					{
+					HBufC* line = HBufC::NewLC(bufPtr.Length() + endOfLinePtr.Length());
+					TPtr linePtr(line->Des());
+					linePtr.Copy(bufPtr);
+					linePtr.Append(endOfLinePtr);
+					User::LeaveIfError(iSectionLines.Append(line));
+					CleanupStack::Pop(line);
+					}
+				}
+			}
+		}
+	if(!aIsHasEndTag)
+	    {
+	    validSectionEndFound = ETrue;
+	    }
+	//Clean data
+	CleanupStack::PopAndDestroy(endOfLine);
+	CleanupStack::PopAndDestroy(withoutCommentsBuf);
+	CleanupStack::PopAndDestroy(buf);
+	
+	//Load into section if found
+	HBufC* section = NULL;
+
+	if(validSectionBeginFound && validSectionEndFound)
+		{
+		//Count amount of memory needed for section
+		TInt i;
+		TInt size = 0;
+		for(i = 0; i < iSectionLines.Count(); i++)
+			size += iSectionLines[i]->Length();
+		
+		//Copy section from array to buffer
+		section = HBufC::NewL(size);
+		CleanupStack::PushL(section);
+		TPtr sectionPtr(section->Des());
+
+		for(i = 0; i < iSectionLines.Count(); i++)
+			sectionPtr.Append(*iSectionLines[i]);
+
+		ClearSectionLinesArray();
+		
+		//Clean local data
+		CleanupStack::Pop(section);
+		
+		return section;
+		}
+	
+	ClearSectionLinesArray();
+
+	//If section was not found, then for compability with CSectionParser leave when not first section was seeking, return NULL when first section was seeking
+	if(foundSection != aSeeked)
+		{
+		if( aSeeked - foundSection > 1)
+			{			
+			User::Leave(KErrNotFound);
+			}
+		}
+
+    return section;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: ClearFileStack
+
+    Description: Closes all files on file stack and clears the stack
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions:  None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifFileParser::ClearFileStack(void)
+	{
+	while(!iFileStack->IsEmpty())
+		{
+		PopFromFileStack();
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: PopFromFileStack
+
+    Description: Pops RFile handle from file stack and sets correct current file handle
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions:  None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifFileParser::PopFromFileStack(void)
+	{
+	if(!iFileStack->IsEmpty())
+		{
+		//Pop from stack
+		iCurrentFile = iFileStack->Pop();
+
+		TFileName fn;
+		iCurrentFile->FullName(fn);
+
+		//And remove from file names array
+		for(TInt i = iFileNames.Count() - 1; i >= 0; i--)
+			{
+			if(fn.CompareF(iFileNames[i]->Des()) == KErrNone)
+				{
+				delete iFileNames[i];
+				iFileNames.Remove(i);
+				break;
+				}
+			}
+		__TRACE(KInfo, (_L("Closing file [%S]"), &fn));
+
+		//Close file
+		iCurrentFile->Close();
+		delete iCurrentFile;
+
+		//Set correct current file
+		if(iFileStack->IsEmpty())
+			{
+			iCurrentFile = &iBaseFile; //base file, because stack is empty
+			}
+		else
+			{
+			iCurrentFile = iFileStack->Last();
+			}
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: PushFileToStack
+
+    Description: Opens file and pushes it to stack
+
+    Parameters: TDesc& aFileName   in: name of file to open and add to stack
+
+    Return Values: None
+
+    Errors/Exceptions:  None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifFileParser::PushFileToStackL(const TDesC& aFileName)
+	{
+
+	//First check if file is not already included
+	for(TInt i = 0; i < iFileNames.Count(); i++)
+		{
+		if(aFileName.CompareF(iFileNames[i]->Des()) == KErrNone)
+			{
+			__TRACE(KError, (_L("File [%S] was already included. Ignoring"), &aFileName));
+			return;
+			}
+		}
+
+	//Open and add file to stack
+	RFile *nf = new RFile();
+
+	__TRACE(KInfo, (_L("Including file [%S]"), &aFileName));
+	TInt r = nf->Open(iFileServer, aFileName, EFileRead | EFileShareAny);
+	if(r == KErrNone)
+		{
+		//Add to stack
+		iFileStack->PushL(nf);
+
+		//And add to file names array
+		HBufC* newFile = aFileName.AllocLC();
+		User::LeaveIfError(iFileNames.Append(newFile));
+		CleanupStack::Pop(newFile);
+
+		//Set valid pointer of current file
+		iCurrentFile = nf;
+		}
+	else
+		{
+		__TRACE(KError, (_L("Could not open file [%S]. Error %d. Ignoring"), &aFileName, r));
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifFileParser
+
+    Method: ClearSectionLinesArray
+
+    Description: Deletes all descriptors assigned to array and empties array
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions:  None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifFileParser::ClearSectionLinesArray(void)
+	{
+	while(iSectionLines.Count() > 0)
+		{
+		delete iSectionLines[0];
+		iSectionLines.Remove(0);
+		}
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/parser/src/StifItemParser.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1285 @@
+/*
+* 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: This module contains implementation of CStifItemParser 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "StifItemParser.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 =======================================
+// None
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CStifItemParser class member
+    functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: CStifItemParser
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: TPtrC aSection: in: Parsed section
+                TInt aStartPos: in: Start point of parsing
+                TInt aLength: in: Length of parsed section
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifItemParser::CStifItemParser( TPtrC aSection,
+                                    TInt aStartPos,
+                                    TInt aLength ) :
+    iItemLineSection( aSection.Mid( aStartPos, aLength ) ),
+    iItemSkipAndMarkPos( 0 ),
+    iGetMethodsIndicator( EFalse ),
+    iParsingType( CStifItemParser::ENormalParsing ) // Mode ON
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CStifItemParser::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: TPtrC aSection: in: Parsed section
+                TInt aStartPos: in: Start point of parsing
+                TInt aLength: in: Length of parsed section
+
+    Return Values: CStifItemParser*: pointer to CStifItemParser object
+
+    Errors/Exceptions:  Leaves if memory allocation fails
+                        Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifItemParser* CStifItemParser::NewL( TPtrC aSection,
+                                                    TInt aStartPos,
+                                                    TInt aLength )
+    {
+    CStifItemParser* item = new (ELeave) CStifItemParser( aSection, aStartPos,
+                                                            aLength );
+
+    CleanupStack::PushL( item );
+    item->ConstructL();
+    CleanupStack::Pop( item );
+
+    return item;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: ~CStifItemParser
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/    
+CStifItemParser::~CStifItemParser()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: ParseStartAndEndPos
+
+    Description: Start and end position parser.
+                 Handles also quote feature parsing. EQuoteStyleParsing
+                 option removes correctly setted quotes(" and ").
+
+    Parameters: TPtrC aSection: in: Parsed section
+                const TDesC& aStartTag: in: Start tag of parsing
+                TInt& aStartPos: inout: Start point of parsing
+                TInt& aEndPos: inout: End point of parsing
+                TInt& aLength: inout: Length of parsed section
+                TInt& aExtraEndPos: inout: Used if end position needs to
+                                           set, e.g. used in quote cases.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+
+TInt CStifItemParser::ParseStartAndEndPos( TPtrC aSection,
+                                        const TDesC& aStartTag,
+                                        TInt& aStartPos,
+                                        TInt& aEndPos,
+                                        TInt& aLength,
+                                        TInt& aExtraEndPos )
+    {
+    aStartPos = 0;
+    aEndPos = 0;
+    aExtraEndPos = 0; // Normally this is 0    
+    
+    RBuf tag( aStartTag.AllocL() );
+    // Remove whitespaces at the begining and end of the tag
+    tag.Trim();
+    
+    // Create parser
+    TLex lex( aSection );
+    // Move parsing pointer to position from which parsing will start 
+    lex.SkipAndMark( iItemSkipAndMarkPos );
+    
+    TBool tagWithEqualMark = EFalse;
+    
+    // Check if tag is defined
+    if ( tag.Length() != 0 )
+    	{
+    	// Check if tag contains '=' character at the end.
+    	// If tag is "=" then we treat it as normal tag (not as tag with '=' 
+    	// character).
+        if ( ( tag.Length() > 1 ) && ( tag.Right( 1 ) == _L("=") ) )
+        	{
+        	// Tag contains '=' character. Remove '=' so only clean tag remains. 
+        	tagWithEqualMark = ETrue;
+        	tag.SetLength( tag.Length() - 1 );
+        	tag.Trim();
+        	}
+
+		// Search for specified tag in parsed text
+		while( !lex.Eos() )
+			{
+			lex.SkipSpaceAndMark();
+			TPtrC token = lex.NextToken();
+			if ( tagWithEqualMark ) 
+				{
+				if ( ( token == tag ) && ( !lex.Eos() ) ) // "tag = val" or "tag =val" 
+					{
+					lex.SkipSpaceAndMark();
+					TPtrC val = lex.NextToken();
+					lex.UnGetToMark();
+					if ( val == _L("=") ) // "tag = val"
+						{
+						lex.Inc();
+						break;
+						}
+					else	// "tag =val"
+						{
+						if ( val.Left( 1 ) == _L("=") )
+							{
+							// Skip "=" character.
+							lex.Inc();
+							break;
+							}
+						else // We didn't find any variation of "tag="
+							{
+							lex.UnGetToMark();
+							}
+						}
+					}
+				else // "tag=val" or "tag= val"
+					{
+					// It handles both situations
+					if ( ( token.Find( tag ) == 0 ) && ( token.Find( _L("=") ) == tag.Length() ) )
+						{
+						lex.UnGetToMark();
+						lex.SkipAndMark( tag.Length() + 1 );
+						lex.SkipSpace();
+						break;
+						}
+					}
+				}
+			else
+				{
+				// Tag without '=' character. Just compare.
+    			if ( token == tag )
+    				{
+    				break;
+    				}
+				}
+			}
+		
+		// Check if we are at the end of parsed text
+		if ( lex.Eos() )
+			{
+			// We are at the end of parsed text. Eaven if we found tag its value
+			// is not defined.
+			tag.Close();
+			return KErrNotFound;
+			}
+    		    	
+    	}
+    
+    tag.Close();       
+
+	if( iParsingType == CStifItemParser::ENormalParsing )
+		{
+        TPtrC ptr = lex.NextToken();
+        aEndPos = lex.Offset();             // End position
+        aStartPos = aEndPos - ptr.Length(); // Start position    		
+		}
+	else
+		{
+		lex.SkipSpaceAndMark();		
+		TPtrC token = lex.NextToken();
+		lex.UnGetToMark();
+		
+		if ( token.Length() == 0 )
+			{
+			return KErrNotFound;
+			}
+		
+		if ( token.Left( 1 ) == _L("\"") )
+			{
+			lex.Inc();
+			aStartPos = lex.Offset();
+			
+			TBool foundEndingQuoteMark = false;
+			while( !lex.Eos() )
+				{
+				if ( lex.Get() == '"' ) 
+					{
+					foundEndingQuoteMark = ETrue;
+					break;;
+					}
+				}
+
+			if ( foundEndingQuoteMark )
+				{
+				aEndPos = lex.Offset() - 1;
+				if ( aEndPos > aStartPos )
+					{
+					aExtraEndPos = 1;
+					}
+				else
+					{
+					aStartPos--;
+					aEndPos++;
+					}
+				}
+			else
+				{
+				lex.UnGetToMark();
+				aStartPos = lex.Offset();
+	            TPtrC ptr = lex.NextToken();
+	            aEndPos = lex.Offset();             // End position	            
+				}			
+			}
+		else
+			{
+            TPtrC ptr = lex.NextToken();
+            aEndPos = lex.Offset();             // End position
+            aStartPos = aEndPos - ptr.Length(); // Start position    		
+			}
+		}
+
+    aLength = ( aEndPos - aStartPos );      
+    
+    // aStartPos is negative (0 is allowed) or length is negative
+    if( ( aLength <= 0 ) && ( iParsingType == CStifItemParser::ENormalParsing ) )
+        {
+        return KErrNotFound;
+        }
+    
+    return KErrNone;    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetString
+
+    Description: Get a string.
+
+    Search an item from the section and return everything after the item until
+    separator cut the parsing.
+    If start tag is empty the first string will be parsed and returned.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TPtrC& aString: inout: Parsed string
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetString( const TDesC& aTag, TPtrC& aString )
+    {
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+
+    iItemSkipAndMarkPos = 0;
+    TInt ret = ParseStartAndEndPos( iItemLineSection, aTag, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret)
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos + extraEndPos;
+
+    // Take string
+    aString.Set( (TUint16*)&iItemLineSection[startPos], length );
+
+    // Indicator that GetString has been used
+    iGetMethodsIndicator = ETrue;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetNextString
+
+    Description: Get a next string.
+
+    Get next string until separator cut the parsing. GetString or GetInt or
+    GetChar must be called before call GetNextString method.
+
+    Parameters: TPtrC& aString: inout: Parsed string
+    
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetNextString( TPtrC& aString )
+    {
+    // GetString(), GetInt() or GetChar() is not called
+    if ( !iGetMethodsIndicator )
+        {
+        return KErrNotReady;
+        }
+
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+    TInt ret = ParseStartAndEndPos( iItemLineSection, KNullDesC, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret)
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos + extraEndPos;
+
+    // Take string
+    aString.Set( (TUint16*)&iItemLineSection[startPos], length );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetNextString
+
+    Description: Get a next string with tag.
+
+    Get next string with tag until separator cut the parsing. If start tag is
+    empty the next string will be parsed and returned.
+    GetString or GetInt or GetChar must be called before call GetNextString
+    method.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TPtrC& aString: inout: Parsed string
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetNextString( const TDesC& aTag,
+                                                TPtrC& aString )
+    {
+    // GetString(), GetInt() or GetChar() is not called
+    if ( !iGetMethodsIndicator )
+        {
+        return KErrNotReady;
+        }
+
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+    TInt ret = ParseStartAndEndPos( iItemLineSection, aTag, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret)
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos + extraEndPos;
+
+    // Take string
+    aString.Set( (TUint16*)&iItemLineSection[startPos], length );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetInt
+
+    Description: Get a integer.
+
+    Search an item from the section and return integer after the item until 
+    separator cut the parsing.
+    If start tag is empty the first integer will be parsed and returned.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TInt& aInteger: inout: Parsed integer
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetInt( const TDesC& aTag, TInt& aInteger )
+    {
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+
+    iItemSkipAndMarkPos = 0;
+    TInt ret = ParseStartAndEndPos( iItemLineSection, aTag, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos;
+
+    // Indicator that GetInt has been used
+    iGetMethodsIndicator = ETrue;
+
+    // Take integer
+    TLex lex( iItemLineSection );
+    // Mark to current position of parsing
+    lex.SkipAndMark( startPos );
+    lex.SkipSpace();
+    return lex.Val( aInteger );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetNextInt
+
+    Description: Get a next integer.
+
+    Get next integer until separator cut the parsing and returns it.
+    GetString or GetInt or GetChar must be called before call GetNextInt
+    method.
+
+    Parameters: TInt& aInteger: inout: Parsed integer
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetNextInt( TInt& aInteger )
+    {
+    // GetString(), GetInt() or GetChar() is not called
+    if ( !iGetMethodsIndicator )
+        {
+        return KErrNotReady;
+        }
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+    TInt ret = ParseStartAndEndPos( iItemLineSection, KNullDesC, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos;
+
+    // Take integer
+    TLex lex( iItemLineSection );
+    // Mark to current position of parsing
+    lex.SkipAndMark( startPos );
+    lex.SkipSpace();
+    return lex.Val( aInteger );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetNextInt
+
+    Description: Get a next integer with tag.
+
+    Get next integer with tag until separator cut the parsing. If start tag is
+    empty the next integer will be parsed and returned.
+    GetString or GetInt or GetChar must be called before call GetNextInt
+    method.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TInt& aInteger: inout: Parsed integer
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetNextInt( const TDesC& aTag, TInt& aInteger )
+    {
+    // GetString(), GetInt() or GetChar() is not called
+    if ( !iGetMethodsIndicator )
+        {
+        return KErrNotReady;
+        }
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+    TInt ret = ParseStartAndEndPos( iItemLineSection, aTag, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos;
+
+    // Take integer
+    TLex lex( iItemLineSection );
+    // Mark to current position of parsing
+    lex.SkipAndMark( startPos );
+    lex.SkipSpace();
+    return lex.Val( aInteger );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetInt
+
+    Description: Get a integer.
+
+    Search an item from the section and return integer after the item until 
+    separator cut the parsing.
+    If start tag is empty the first integer will be parsed and returned.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TUint& aInteger: inout: Parsed integer
+                TRadix aRadix: in: Convert a number into different
+                presentation. For default: EDecimal.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetInt( const TDesC& aTag,
+                                        TUint& aInteger,
+                                        TRadix aRadix )
+    {
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+
+    iItemSkipAndMarkPos = 0;
+    TInt ret = ParseStartAndEndPos( iItemLineSection, aTag, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos;
+
+    // Indicator that GetInt has been used
+    iGetMethodsIndicator = ETrue;
+
+    // Take integer
+    TLex lex( iItemLineSection );
+    // Mark to current position of parsing
+    lex.SkipAndMark( startPos );
+    lex.SkipSpace();
+    // NOTE: If parsed integer is e.g. '-1' and aRadix is EDesimal the lex will
+    // return error code -2(KErrGeneral). Main reason is for this new TUint
+    // method that cast operation does not work in above case and -2 returned.
+    // In this case use GetInt method that reference type is TInt.
+    return lex.Val( aInteger, aRadix );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetNextInt
+
+    Description: Get a next integer.
+
+    Get next integer until separator cut the parsing and returns it.
+    GetString or GetInt or GetChar must be called before call GetNextInt
+    method.
+
+    Parameters: TUint& aInteger: inout: Parsed integer
+                TRadix aRadix: in: Convert a number into different
+                presentation. For default: EDecimal.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetNextInt( TUint& aInteger,
+                                            TRadix aRadix )
+    {
+    // GetString(), GetInt() or GetChar() is not called
+    if ( !iGetMethodsIndicator )
+        {
+        return KErrNotReady;
+        }
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+    TInt ret = ParseStartAndEndPos( iItemLineSection, KNullDesC, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos;
+
+    // Take integer
+    TLex lex( iItemLineSection );
+    // Mark to current position of parsing
+    lex.SkipAndMark( startPos );
+    lex.SkipSpace();
+    // NOTE: If parsed integer is e.g. '-1' and aRadix is EDesimal the lex will
+    // return error code -2(KErrGeneral). Main reason is for this new TUint
+    // method that cast operation does not work in above case and -2 returned.
+    // In this case use GetNextInt method that reference type is TInt.
+    return lex.Val( aInteger, aRadix );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetNextInt
+
+    Description: Get a next integer with tag.
+
+    Get next integer with tag until separator cut the parsing. If start tag is
+    empty the next integer will be parsed and returned.
+    GetString or GetInt or GetChar must be called before call GetNextInt
+    method.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TUint& aInteger: inout: Parsed integer
+                TRadix aRadix: in: Convert a number into different
+                presentation. For default: EDecimal.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetNextInt( const TDesC& aTag,
+                                            TUint& aInteger,
+                                            TRadix aRadix )
+    {
+    // GetString(), GetInt() or GetChar() is not called
+    if ( !iGetMethodsIndicator )
+        {
+        return KErrNotReady;
+        }
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+    TInt ret = ParseStartAndEndPos( iItemLineSection, aTag, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = endPos;
+
+    // Take integer
+    TLex lex( iItemLineSection );
+    // Mark to current position of parsing
+    lex.SkipAndMark( startPos );
+    lex.SkipSpace();
+    // NOTE: If parsed integer is e.g. '-1' and aRadix is EDesimal the lex will
+    // return error code -2(KErrGeneral). Main reason is for this new TUint
+    // method that cast operation does not work in above case and -2 returned.
+    // In this case use GetNextInt method that reference type is TInt.
+    return lex.Val( aInteger, aRadix );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetChar
+
+    Description: Get a character.
+
+    Search an item from the section and return character after the item.
+    If start tag is empty the first character will be parsed and returned.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TChar& aCharacter: inout: Parsed character
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetChar( const TDesC& aTag, TChar& aCharacter )
+    {
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+
+    iItemSkipAndMarkPos = 0;
+    TInt ret = ParseStartAndEndPos( iItemLineSection, aTag, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = startPos + 1;
+
+    // Take character
+    aCharacter = iItemLineSection[startPos];
+
+    // Indicator that GetChar has been used
+    iGetMethodsIndicator = ETrue;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetNextChar
+
+    Description: Get a next character.
+
+    Get next character and returns it.
+    GetString or GetInt or GetChar must be called before call GetNextChar
+    method.
+
+    Parameters: TChar& aCharacter: inout: Parsed character
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetNextChar( TChar& aCharacter )
+    {
+    // GetString(), GetInt() or GetChar() is not called
+    if ( !iGetMethodsIndicator )
+        {
+        return KErrNotReady;
+        }
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+    TInt ret = ParseStartAndEndPos( iItemLineSection, KNullDesC, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = startPos + 1;
+
+    // Take character
+    aCharacter = iItemLineSection[startPos];
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetNextChar
+
+    Description: Get a next character with tag.
+
+    Get next character with tag until separator cut the parsing. If start tag
+    is empty the next character will be parsed and returned.
+    GetString or GetInt or GetChar must be called before call GetNextChar
+    method.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TChar& aCharacter: inout: Parsed character
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetNextChar( const TDesC& aTag,
+                                            TChar& aCharacter )
+    {
+    // GetString(), GetInt() or GetChar() is not called
+    if ( !iGetMethodsIndicator )
+        {
+        return KErrNotReady;
+        }
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    TInt extraEndPos( 0 );
+    TInt ret = ParseStartAndEndPos( iItemLineSection, aTag, startPos,
+                                    endPos, length, extraEndPos );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    // Current position for forward parsing operations
+    iItemSkipAndMarkPos = startPos + 1;
+
+    // Take character
+    aCharacter = iItemLineSection[startPos];
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: Remainder
+
+    Description: Get remaining strings in parsed line.
+                 
+                 Note: This method does not support the quote(TParsingType)
+                 feature, only GetString and GetNextString methods include
+                 support.
+
+    Parameters: TPtrC& aString: inout: Parsed string
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::Remainder( TPtrC& aString )
+    {
+    
+    if ( 0 == iItemLineSection.Length() )
+        {
+        // Probably parsering is failed
+        return KErrNotFound;
+        }
+
+    if( iItemLineSection.Length() <= iItemSkipAndMarkPos )
+        {
+        // Nothing to parse, check here to avoid lex's crash
+        return KErrNotFound;
+        }
+
+    // Skip space
+    TLex lex( iItemLineSection );
+    lex.SkipAndMark( iItemSkipAndMarkPos );
+    lex.SkipSpace();
+    
+    if( lex.Eos() )
+        {
+        // Remaining are only spaces. To avoid Set()'s panic
+        return KErrNotFound;
+        }
+
+    // Take string
+    aString.Set( (TUint16*)&iItemLineSection[ lex.Offset() ], 
+                 iItemLineSection.Length() - lex.Offset() );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: SetParsingType
+
+    Description: Parsing type can be given when parsing string(GetString and
+                 GetNextString). Please see TParsingType enumeration for more
+                 inforamtion.
+
+    Parameters: CStifItemParser::TParsingType aType: in: Sets a parsing type.
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::SetParsingType( 
+                                    CStifItemParser::TParsingType aType )
+    {
+    iParsingType = aType;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: ParsingType
+
+    Description: Get current parsing type. Please see TParsingType enumeration
+                 for more inforamtion.
+
+    Parameters: None
+
+    Return Values: CStifItemParser::TParsingType: Current parsing type.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifItemParser::TParsingType CStifItemParser::ParsingType()
+    {
+    return iParsingType;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifItemParser
+
+    Method: GetValueOf
+
+    Description: retrieve kay value pair
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifItemParser::GetValueOf(const TDesC& aKey, TDes& aValue)
+    {
+    TPtrC temp;
+    TInt err;
+    err=GetNextString(temp);
+    if(temp.Find(aKey)!=KErrNone)
+        return KErrNotFound;
+    TInt index=temp.Find(_L("="));
+    if(index==KErrNotFound)
+        {
+        err=GetNextString(temp);
+        if(temp.Find(_L("="))==KErrNotFound)
+            {
+            return KErrNotFound;
+            }
+        
+        
+        }
+    err=GetNextString(temp);
+    aValue.Copy(temp);
+    return err;
+    
+    }
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/parser/src/StifParser.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1015 @@
+/*
+* 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: This module contains implementation of CStifParser 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "StifParser.h"
+#include "ParserTracing.h"
+#include "StifFileParser.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: CStifParser
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: TCommentType aCommentType: in: Comment type's indication
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CStifParser::CStifParser( TCommentType aCommentType ) :
+    iBuffer( 0, 0 )
+    {
+    iCommentType = aCommentType;
+
+    iParsingMode = EFileParsing;
+
+    iIsUnicode = EFalse;
+    
+    iFileParser = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Connecting and opening configuration file if path and file information is 
+    given. If path and file information is not given and information is given 
+    in buffer then create parser according to the buffer.
+    
+    Parameters: const TDesC& aPath: in: Source path definition
+                const TDesC& aConfig: in: Configuration filename
+                const TDesC& aBuffer: in: Buffer of the parsed information
+
+    Return Values: None
+
+    Errors/Exceptions:  Leaves if called Connect method fails
+                        Leaves if called SetSessionPath method fails
+                        Leaves if called Open method fails
+                        Leaves if HBufC::NewL operation leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifParser::ConstructL( const TDesC& aPath,
+                                const TDesC& aConfig,
+                                const TDesC& aBuffer)
+    {
+    if( aPath == KNullDesC && aConfig == KNullDesC && aBuffer != KNullDesC )
+        {
+        // Set mode
+        iParsingMode = EBufferParsing;
+
+        // Construct modifiable heap-based descriptor.
+        iBufferTmp = HBufC::NewL( aBuffer.Length() );
+        //iBuffer = iBufferTmp->Des();
+        iBuffer.Set( iBufferTmp->Des() );
+        // Copy content
+        iBuffer.Copy( aBuffer );
+        }
+
+    else
+        {
+        User::LeaveIfError( iFileServer.Connect() );
+    
+        __TRACE( KInfo, ( _L( "STIFPARSER: Open configfile '%S%S'" ),
+                &aPath, &aConfig ) );
+                
+        User::LeaveIfError( iFileServer.SetSessionPath( aPath ) );
+        User::LeaveIfError( iFile.Open( 
+                            iFileServer, aConfig, EFileRead | EFileShareAny ) );
+
+        //Check whether the file is unicoded
+        __TRACE(KInfo, (_L("STIFPARSER: Check if the file is unicode")));
+        _LIT(KUnicode, "#UNICODE");
+        const TInt KUnicodeLength(8 * 2 + 2); //times two, because we want to read unicode string using 8bit descriptor
+                                              //two characters more because on some systems FEFF is always added on the beginning of unicode file
+        TInt size(0);
+
+        User::LeaveIfError(iFile.Size(size));
+
+        if(size >= KUnicodeLength)
+            {
+            TBuf8<KUnicodeLength> buf;
+
+            User::LeaveIfError(iFile.Read(0, buf));
+            TPtrC16 bufuni((TUint16 *)(buf.Ptr()), buf.Length() / 2);
+            if(bufuni.Find(KUnicode) != KErrNotFound)
+                {
+                iIsUnicode = ETrue;
+                __TRACE(KInfo, (_L("STIFPARSER: File is unicode")));
+                }
+            }
+        
+        //Create file parser object
+        iFileParser = CStifFileParser::NewL(iFileServer, iFile, iIsUnicode, iCommentType);
+        }
+
+    iOffset = 0;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Starting creating parser with path and file information.
+
+    Parameters: const TDesC& aPath: in: Source path definition
+                const TDesC& aConfig: in: Configuration filename
+                TCommentType aCommentType: in: Comment type's indication
+
+    Return Values: CStifParser* : pointer to CStifParser object
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifParser* CStifParser::NewL( const TDesC& aPath,
+                                            const TDesC& aConfig,
+                                            TCommentType aCommentType )
+    {
+    __TRACE( KInfo, ( _L( "STIFPARSER: Debug information is used" ) ) );
+
+    // Create CStifParser object
+    CStifParser* parser = new (ELeave) CStifParser( aCommentType );
+
+    CleanupStack::PushL( parser );
+    parser->ConstructL( aPath, aConfig );
+    CleanupStack::Pop( parser );
+
+    return parser;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Starting creating parser with buffer information.
+
+    Parameters: const TDesC& aBuffer: in: Buffer of the parsed informations
+                TCommentType aCommentType: in: Comment type's indication
+
+    Return Values: CStifParser* : pointer to CStifParser object
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifParser* CStifParser::NewL( const TDesC& aBuffer,
+                                            TCommentType aCommentType )
+    {
+    __TRACE( KInfo, ( _L( "STIFPARSER: Debug information is used" ) ) );
+
+    // Create CStifParser object
+    CStifParser* parser = new (ELeave) CStifParser( aCommentType );
+
+    CleanupStack::PushL( parser );
+    // No path and file name informations. Buffer is given
+    parser->ConstructL( KNullDesC, KNullDesC, aBuffer );
+    CleanupStack::Pop( parser );
+
+    return parser;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: ~CStifParser
+
+    Description: Destructor
+
+    Close file and the fileserver handles.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/    
+EXPORT_C CStifParser::~CStifParser()
+    {
+
+    if( iParsingMode == EBufferParsing )
+        {
+        delete iBufferTmp;
+        }
+    else
+        {
+        delete iFileParser;
+        iFile.Close();
+        iFileServer.Close();
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: SectionL
+
+    Description: Parses sections from configuration files.
+
+    Open and read configuration source and parses a required section.
+    If start tag is empty the parsing starts beginning of the configuration
+    file. If end tag is empty the parsing goes end of configuration file.
+    This method starts always from beginning of configuration file and parses
+    first section if aSeeked parameters is not given.
+    If configuration file includes several sections with both start and end
+    tags so aSeeked parameter seeks the required section. The aSeeked
+    parameters indicates section that will be parsed.
+
+    Parameters: const TDesC& aStartTag: in: Indicates a start tag for parsing
+                const TDesC& aEndTag: in: Indicates an end tag for parsing
+                TInt aSeeked: in: a seeked section which will be parsed
+
+    Return Values:  See NextSectionL() method
+
+    Errors/Exceptions:  See NextSectionL() method
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifSectionParser* CStifParser::SectionL( const TDesC& aStartTag,
+                                                    const TDesC& aEndTag,
+                                                    TInt aSeeked )
+    {
+    iOffset = 0;
+    return NextSectionL( aStartTag, aEndTag, aSeeked ,ETrue);
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: NextSectionL
+
+    Description: Parses sections from configuration files.
+
+    Open and read configuration source and parses a required section.
+    If start tag is empty the parsing starts beginning of the configuration
+    file. If end tag is empty the parsing goes end of configuration file.
+    This method will parse next section after the earlier section if aSeeked
+    parameter is not given.
+    If configuration file includes several sections with both start and end
+    tags so aSeeked parameter seeks the required section. The aSeeked
+    parameters indicates section that will be parsed.
+
+    Parameters: const TDesC& aStartTag: in: Indicates a start tag for parsing
+                const TDesC& aEndTag: in: Indicates an end tag for parsing
+                TInt aSeeked: in: a seeked section which will be parsed
+
+    Return Values:  CStifSectionParser* : pointer to CStifSectionParser object
+                    NULL will return if NextSectionFileL (or NextSectionMemoryL) returns NULL
+
+    Errors/Exceptions:  Leaves if NextSectionFileL leaves
+                        Leaves if NextSectionMemoryL leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifSectionParser* CStifParser::NextSectionL( const TDesC& aStartTag,
+                                                        const TDesC& aEndTag,
+                                                        TInt aSeeked  )
+    {
+	//If parsing mode is set to file, we parse directly in the file
+	if(iParsingMode == EFileParsing)
+		{
+		return NextSectionFileL(aStartTag, aEndTag, aSeeked,ETrue );
+		}
+
+	//If parsing mode is set to buffer, process in old way
+    return NextSectionMemoryL(aStartTag, aEndTag, aSeeked,ETrue );
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: SectionL
+
+    Description: Parses sections from configuration files.
+
+    Open and read configuration source and parses a required section.
+    If start tag is empty the parsing starts beginning of the configuration
+    file. If end tag is empty the parsing goes end of configuration file.
+    This method starts always from beginning of configuration file and parses
+    first section if aSeeked parameters is not given.
+    If configuration file includes several sections with both start and end
+    tags so aSeeked parameter seeks the required section. The aSeeked
+    parameters indicates section that will be parsed.
+
+    Parameters: const TDesC& aStartTag: in: Indicates a start tag for parsing
+                const TDesC& aEndTag: in: Indicates an end tag for parsing
+                TInt aSeeked: in: a seeked section which will be parsed
+
+    Return Values:  See NextSectionL() method
+
+    Errors/Exceptions:  See NextSectionL() method
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+    EXPORT_C CStifSectionParser* CStifParser::SectionL( const TDesC& aStartTag,
+                                                    const TDesC& aEndTag,
+                                                    TInt aSeeked,TBool aIsHasEndTag )
+    {
+    iOffset = 0;
+    return NextSectionL( aStartTag, aEndTag, aSeeked ,aIsHasEndTag);
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: NextSectionL
+
+    Description: Parses sections from configuration files.
+
+    Open and read configuration source and parses a required section.
+    If start tag is empty the parsing starts beginning of the configuration
+    file. If end tag is empty the parsing goes end of configuration file.
+    This method will parse next section after the earlier section if aSeeked
+    parameter is not given.
+    If configuration file includes several sections with both start and end
+    tags so aSeeked parameter seeks the required section. The aSeeked
+    parameters indicates section that will be parsed.
+
+    Parameters: const TDesC& aStartTag: in: Indicates a start tag for parsing
+                const TDesC& aEndTag: in: Indicates an end tag for parsing
+                TInt aSeeked: in: a seeked section which will be parsed
+
+    Return Values:  CStifSectionParser* : pointer to CStifSectionParser object
+                    NULL will return if NextSectionFileL (or NextSectionMemoryL) returns NULL
+
+    Errors/Exceptions:  Leaves if NextSectionFileL leaves
+                        Leaves if NextSectionMemoryL leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+    EXPORT_C CStifSectionParser* CStifParser::NextSectionL( const TDesC& aStartTag,
+                                                        const TDesC& aEndTag,
+                                                        TInt aSeeked,TBool aIsHasEndTag  )
+    {
+    //If parsing mode is set to file, we parse directly in the file
+    if(iParsingMode == EFileParsing)
+        {
+        return NextSectionFileL(aStartTag, aEndTag, aSeeked,aIsHasEndTag );
+        }
+
+    //If parsing mode is set to buffer, process in old way
+    return NextSectionMemoryL(aStartTag, aEndTag, aSeeked,aIsHasEndTag );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: NextSectionMemoryL
+
+    Description: Parses sections from configuration files.
+
+    Open and read configuration source and parses a required section.
+    If start tag is empty the parsing starts beginning of the configuration
+    file. If end tag is empty the parsing goes end of configuration file.
+    This method will parse next section after the earlier section if aSeeked
+    parameter is not given.
+    If configuration file includes several sections with both start and end
+    tags so aSeeked parameter seeks the required section. The aSeeked
+    parameters indicates section that will be parsed.
+
+    Parameters: const TDesC& aStartTag: in: Indicates a start tag for parsing
+                const TDesC& aEndTag: in: Indicates an end tag for parsing
+                TInt aSeeked: in: a seeked section which will be parsed
+
+    Return Values:  CStifSectionParser* : pointer to CStifSectionParser object
+                    NULL will return if file size or aSeeked is not positive
+                    NULL will return if start tag is not found
+                    NULL will return if end tag is not found
+                    NULL will return if parsed section length is not positive
+
+    Errors/Exceptions:  Leaves if called Size method fails
+                        Leaves if HBufC::NewLC method leaves
+                        Leaves if called Read method fails
+                        Leaves if CStifSectionParser::NewL methods leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CStifSectionParser* CStifParser::NextSectionMemoryL( const TDesC& aStartTag,
+                                                 	 const TDesC& aEndTag,
+                                                     TInt aSeeked, TBool /*aIsHasEndTag*/ )
+    {
+    TInt size( 0 );
+    // Parser is created straight with data
+    if( iParsingMode == EBufferParsing )
+        {
+        size = iBuffer.Length();
+        }
+    // Parser is created with path and file informations
+    else
+        {
+        User::LeaveIfError( iFile.Size( size ) );
+        }
+
+    // size or aSeeked cannot be 0 or negetive
+    if( size <= 0 || aSeeked <= 0)
+        {
+        __TRACE(
+            KInfo, ( _L( "STIFPARSER: NextSectionL method returns a NULL" ) ) );
+        return NULL;
+        }
+
+    const TInt tmpSize = 128;//--UNICODE-- KMaxName; // 128 - set to even value, because KMaxName may change in the future
+    TInt offset( 0 ); // Offset value to parts reading
+
+    // Construct modifiable heap-based descriptor. tmp to CleanupStack
+    HBufC* tmp = HBufC::NewLC( size );
+    TPtr wholeSection = tmp->Des();
+
+    // Construct modifiable heap-based descriptor. tmp2 to CleanupStack
+    HBufC8* tmp2 = HBufC8::NewLC( tmpSize );    // 128
+    TPtr8 buf = tmp2->Des();
+
+    // Construct modifiable heap-based descriptor. tmp3 to CleanupStack
+    HBufC* tmp3 = HBufC::NewLC( tmpSize );      // 128
+    TPtr currentSection = tmp3->Des();
+
+    // Parser is created straight with data
+    if( iParsingMode == EBufferParsing )
+        {
+        // If 8 bit copy changes to 16
+        wholeSection.Copy( iBuffer );
+        }
+    // Parser is created with path and file informations
+    else
+        {
+        TPtrC16 currentSectionUnicode;
+        do // Read data in parts(Maximum part size is KMaxName)
+            {
+            // Read data
+            User::LeaveIfError( iFile.Read( offset, buf, tmpSize ) );
+
+            // If file is unicode convert differently
+            if(iIsUnicode)
+                {
+                // 8 bit to 16 with unicode conversion - simply point to byte array as to double-byte array
+                currentSectionUnicode.Set((TUint16 *)(buf.Ptr()), buf.Length() / 2);
+                // Appends current section to whole section
+                wholeSection.Append( currentSectionUnicode );
+                }
+            else
+                {
+                // 8 bit to 16
+                currentSection.Copy( buf );
+                // Appends current section to whole section
+                wholeSection.Append( currentSection );
+                }
+
+            offset += tmpSize;
+
+            } while( offset < size );
+        }
+
+    CleanupStack::PopAndDestroy( tmp3 );
+    CleanupStack::PopAndDestroy( tmp2 );
+
+    // User wants section without c-style comments
+    if( iCommentType == ECStyleComments )
+        {
+        ParseCommentsOff( wholeSection );
+        }
+
+    TLex lex( wholeSection );
+    lex.SkipAndMark( iOffset );
+
+    // For the required section length and positions
+    TInt length( 0 );
+    TInt lengthStartPos( 0 );
+    TInt lengthEndPos( 0 );
+    TBool eos( EFalse );
+    TInt tagCount( 1 );
+
+    // Check is aStartTag given
+    if ( aStartTag.Length() == 0 )
+        {
+        // Skip line break, tabs, spaces etc.
+        lex.SkipSpace();
+        lengthStartPos = lex.Offset();
+        }
+    else
+        {
+        // While end of section
+        while ( !lex.Eos() )
+            {
+            TPtrC ptr = lex.NextToken();
+            // Start of the section is found and correct section
+            if ( ptr == aStartTag && tagCount == aSeeked )
+                {
+                lengthStartPos = lex.Offset();
+                break;
+                }
+            // Start tag is found but not correct section
+            else if ( ptr == aStartTag )
+                {
+                tagCount++;
+                }
+            }
+        }
+
+    // If we are end of section lex.Eos() and eos will be ETrue
+    eos = lex.Eos();
+
+    // Seeked section is not found
+    if ( tagCount != aSeeked )
+        {
+        __TRACE( KInfo, ( _L(
+            "STIFPARSER: NextSectionL method: Seeked section is not found" ) ) );
+        CleanupStack::PopAndDestroy( tmp );
+        User::Leave( KErrNotFound );
+        }
+
+    // Check is aEndTag given
+    if ( aEndTag.Length() == 0 )
+        {
+        lengthEndPos = wholeSection.Length();
+        }
+    else
+        {
+        // While end of section
+        while ( !lex.Eos() )
+            {
+            TPtrC ptr = lex.NextToken();
+            // End tag of the section is found
+            if ( ptr == aEndTag )
+                {
+                lengthEndPos = lex.Offset();
+                // Because Offset() position is after the aEndTag
+                lengthEndPos -= aEndTag.Length();
+                break;
+                }
+            }
+        }
+
+    // If we are end of section and lengthEndPos is 0
+    if ( lengthEndPos == 0 )
+        {
+        // lex.Eos() and eos will be ETrue
+        eos = lex.Eos();
+        }
+
+    // The length includes spaces and end of lines
+    length = ( lengthEndPos - lengthStartPos );
+
+    CStifSectionParser* section = NULL;
+
+    // If eos is true or length is negative
+    if ( eos || length <= 0  )
+        {
+        __TRACE(
+            KInfo, ( _L( "STIFPARSER: NextSectionL method returns a NULL" ) ) );
+        }
+    else
+        {
+        // Make CStifSectionParser object and alloc required length
+        section = CStifSectionParser::NewL( length );
+        CleanupStack::PushL( section );
+
+        // Copy required data to the section object
+        section->SetData( wholeSection, lengthStartPos, length );
+
+        //iOffset += lengthEndPos + aEndTag.Length();
+        iOffset = lex.Offset();
+
+        CleanupStack::Pop( section );
+        }
+    CleanupStack::PopAndDestroy( tmp );
+
+    return section;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: NextSectionFileL
+
+    Description: Parses sections from configuration files.
+
+    Open and read configuration source and parses a required section.
+    If start tag is empty the parsing starts beginning of the configuration
+    file. If end tag is empty the parsing goes end of configuration file.
+    This method will parse next section after the earlier section if aSeeked
+    parameter is not given.
+    If configuration file includes several sections with both start and end
+    tags so aSeeked parameter seeks the required section. The aSeeked
+    parameters indicates section that will be parsed.
+
+    Parameters: const TDesC& aStartTag: in: Indicates a start tag for parsing
+                const TDesC& aEndTag: in: Indicates an end tag for parsing
+                TInt aSeeked: in: a seeked section which will be parsed
+
+    Return Values:  CStifSectionParser* : pointer to CStifSectionParser object
+                    NULL will return if file size or aSeeked is not positive
+                    NULL will return if start tag is not found
+                    NULL will return if end tag is not found
+                    NULL will return if parsed section length is not positive
+
+    Errors/Exceptions:  Leaves if called Size method fails
+                        Leaves if HBufC::NewLC method leaves
+                        Leaves if called Read method fails
+                        Leaves if CStifSectionParser::NewL methods leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CStifSectionParser* CStifParser::NextSectionFileL( const TDesC& aStartTag,
+                                                   const TDesC& aEndTag,
+                                                   TInt aSeeked ,TBool aIsHasEndTag )
+    {
+	HBufC *bufSection = iFileParser->NextSectionL(aStartTag, aEndTag, iOffset, aSeeked,aIsHasEndTag);
+
+	if(bufSection)
+		{
+		CleanupStack::PushL(bufSection);
+		TPtr bufSectionPtr(bufSection->Des());
+
+		if(iCommentType == ECStyleComments)
+			{
+			ParseCommentsOff(bufSectionPtr);
+			}
+
+		// Make CStifSectionParser object and alloc required length
+		CStifSectionParser* section = CStifSectionParser::NewL(bufSection->Length());
+		CleanupStack::PushL(section);
+
+		// Copy required data to the section object
+		section->SetData(bufSectionPtr, 0, bufSection->Length());
+
+		// Clean
+		CleanupStack::Pop(section);
+		CleanupStack::PopAndDestroy(bufSection);
+
+		return section;
+		}
+
+	return NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifParser
+
+    Method: ParseCommentsOff
+
+    Description: Convert a section without comments.
+
+    Parameters: TPtr& aBuf: inout: section to parsed
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CStifParser::ParseCommentsOff( TPtr& aBuf )
+    {
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+    enum TSearchType
+        {
+        ENormalSearch,          // Search a '//' or a '/*'
+        ECStyleSlashs,          // Search is '//'
+        ECStyleSlashAndAsterisk,// Search is '/*'
+        EDoRemove,              // Remove comment
+        };
+
+    TSearchType searchType( ENormalSearch );
+
+    TLex lex( aBuf );
+
+    // Remove comments
+    do
+        {
+        switch( searchType )
+            {
+            case ENormalSearch:
+                {
+                if( lex.Get() == '/' )
+                    {
+                    // Peek next character( '/' )
+                    if( lex.Peek() == '/' )
+                        {
+                        startPos = lex.Offset();
+                        startPos--;
+                        lex.Inc();
+                        searchType = ECStyleSlashs;
+                        }
+                    // Peek next character( '*' )
+                    else if( lex.Peek() == '*' )
+                        {
+                        startPos = lex.Offset();
+                        startPos--;
+                        lex.Inc();
+                        searchType = ECStyleSlashAndAsterisk;
+                        }
+                    }
+                break;
+                }
+            case ECStyleSlashs:
+                {
+                // Peek next character(10 or '\n' in UNIX style )
+                if( lex.Peek() == 0x0A )
+                    {
+                    // Don't remove line break!!( Else this fails:
+                    // 1st line:"this is parsed text 1"
+                    // 2nd line:"this is parsed text 2 // this is comments"
+                    // 1st and 2nd lines will be together and following
+                    // operations may fail)
+                    endPos = lex.Offset();
+                    searchType = EDoRemove;
+                    break;
+                    }
+
+                // Peek next character(13 or '\r' in Symbian OS)
+                if ( lex.Peek() == 0x0D )
+                    {
+                    // Increment the lex position
+                    lex.Inc();
+                    // Peek next character(10 or '\n' in Symbian OS)
+                    if ( lex.Peek() == 0x0A )
+                        {
+                        // Don't remove line break!!( Else this fails:
+                        // 1st line:"this is parsed text 1"
+                        // 2nd line:"this is parsed text 2 // this is comments"
+                        // 1st and 2nd lines will be together and following
+                        // operations may fail)
+                        endPos = lex.Offset();
+                        endPos = endPos - 1; // Two line break characters
+                        searchType = EDoRemove;
+                        break;
+                        }
+                    // 0x0A not found, decrement position
+                    lex.UnGet();
+                    }
+                // Increment the lex position
+                lex.Inc();
+                // Take current end position
+                endPos = lex.Offset();
+                break;
+                }
+
+            case ECStyleSlashAndAsterisk:
+                {
+                // Peek next character( '*' )
+                if ( lex.Peek() == '*' )
+                    {
+                    // Increment the lex position
+                    lex.Inc();
+                    // Peek next character( '/')
+                    if ( lex.Peek() == '/' )
+                        {
+                        // End of the section is found and increment the lex position
+                        lex.Inc();
+                        endPos = lex.Offset();
+                        searchType = EDoRemove;
+                        break;
+                        }
+                    // '/' not found, decrement position
+                    lex.UnGet();
+                    }
+                // Increment the lex position
+                lex.Inc();
+
+                // Take current end position
+                endPos = lex.Offset();
+                break;
+                }
+            default:
+                {
+                searchType = ENormalSearch;
+                break;
+                }
+
+            } // End of switch
+
+            // Remove comment
+            if( searchType == EDoRemove )
+                {
+                length = endPos - startPos;
+                aBuf.Delete( startPos, length );
+                lex = aBuf;
+                searchType = ENormalSearch;
+                }
+
+        } while ( !lex.Eos() );
+
+    // If comment is started and configure file ends to eof we remove
+    // comments althougt there are no end of line or '*/' characters
+    if( searchType == ECStyleSlashs || searchType == ECStyleSlashs )
+        {
+        length = lex.Offset() - startPos;
+        aBuf.Delete( startPos, length );
+        }
+
+    HandleSpecialMarks( aBuf );
+
+    }
+
+//
+//-----------------------------------------------------------------------------
+//
+//    Class: CStifParser
+//
+//    Method: HandleSpecialMarks
+//
+//    Description: Handles special marks.( '\/\/', '\/\*' and '*/\/' ). This
+//         		   is used when ECStyleComments comment type is used.
+//
+//    Parameters: TPtr& aBuf: inout: section to parsed
+//
+//    Return Values: None
+//
+//    Errors/Exceptions: None
+//
+//    Status: Proposal
+//
+//-----------------------------------------------------------------------------
+//
+void CStifParser::HandleSpecialMarks( TPtr& aBuf )
+    {
+    TLex lex( aBuf );
+    TInt firstPos( 0 );
+    TInt secondPos( 0 );
+
+    //        // => \/\/ => //
+    //        /* => \/\* => /*
+    //        */ => \*\/ => */
+  
+    do
+        {
+        firstPos = lex.Offset();
+        TChar get = lex.Get();
+        // Check is '\'
+        if( get == '\\' ) 
+            {
+            // Peek next character( '/' )
+            if( lex.Peek() == '/' )
+                {
+                lex.Inc();
+                secondPos = lex.Offset();
+                // Peek next character( '\' )
+                if( lex.Peek() == '\\' )
+                    {
+                    lex.Inc();
+                    // Peek next character( '/' )
+                    if( lex.Peek() == '/' )
+                        {
+                        // Delete mark '\/\/' and replace this with '//'
+                        aBuf.Delete( secondPos, 1 );
+                        aBuf.Delete( firstPos, 1 );
+                        lex = aBuf;
+                        }
+                    // Peek next character( '/' )
+                    else if( lex.Peek() == '*' )
+                        {
+						// Delete mark '\/\*' and replace this with '/*'                        
+                        aBuf.Delete( secondPos, 1 );
+                        aBuf.Delete( firstPos, 1 );
+                        lex = aBuf;
+                        }
+                    }
+                }
+            // Peek next character( '/' )
+            else if( lex.Peek() == '*' )
+                {
+                lex.Inc();
+                secondPos = lex.Offset();
+                // Peek next character( '\' )
+                if( lex.Peek() == '\\' )
+                    {
+                    lex.Inc();
+                    // Peek next character( '/' )
+                    if( lex.Peek() == '/' )
+                        {
+                        // Delete mark '\*\/' and replace this with '*\'
+                        aBuf.Delete( secondPos, 1 );
+                        aBuf.Delete( firstPos, 1 );
+                        lex = aBuf;
+                        }
+                    }
+                }
+            }
+        firstPos = 0;
+        secondPos = 0;
+        } while ( !lex.Eos() );
+
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/parser/src/StifSectionParser.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1107 @@
+/*
+* 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: This module contains implementation of 
+* CStifSectionParser class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "StifSectionParser.h"
+#include "ParserTracing.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: CStifSectionParser
+
+    Description: Default constructor.
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: const TInt aLength: in: Parsed section length
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifSectionParser::CStifSectionParser( const TInt aLength ) :
+    iSection( 0, 0 ),
+    iLength( aLength ),
+    iSkipAndMarkPos( 0 ),
+    iLineIndicator( EFalse )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor.
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions:  Leaves if iLength is negative
+                        Leaves if called NewL method fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CStifSectionParser::ConstructL()
+    {
+    // Construct modifiable heap-based descriptor
+    iHBufferSection = HBufC::NewL( iLength );
+    iSection.Set(iHBufferSection->Des());
+
+    iSubOffset = 0;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: const TInt aLength: in: Parsed section length
+
+    Return Values: CStifSectionParser* : pointer to CStifSectionParser object
+
+    Errors/Exceptions:  Leaves if section length is negative
+                        Leaves if construction fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifSectionParser* CStifSectionParser::NewL( const TInt aLength )
+    {
+    __TRACE( KInfo, ( _L( "STIFPARSER: Create a section" ) ) );
+    __ASSERT_ALWAYS( aLength > 0, User::Leave( KErrArgument ) );
+
+    CStifSectionParser* item = new (ELeave) CStifSectionParser( aLength );
+
+    CleanupStack::PushL( item );
+    item->ConstructL();
+    CleanupStack::Pop( item );
+
+    return item;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: ~CStifSectionParser
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/    
+CStifSectionParser::~CStifSectionParser()
+    {
+    __TRACE( KInfo, ( _L( "STIFPARSER: Call destructor '~CStifSectionParser'" ) ) );
+
+    delete iHBufferSection;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: ParseStartAndEndPos
+
+    Description: Start and end position parser.
+
+    Parameters: TPtrC aSection: in: Parsed section
+                const TDesC& aStartTag: in: Start tag of parsing
+                TTagToReturnValue aTagIndicator: in: Will aStartTag included to
+                the returned values
+                TInt& aStartPos: inout: Start point of parsing
+                TInt& aEndPos: inout: End point of parsing
+                TInt& aLength: inout: Length of parsed section
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifSectionParser::ParseStartAndEndPos( TPtrC aSection,
+                                            const TDesC& aStartTag,
+                                            TTagToReturnValue aTagIndicator,
+                                            TInt& aStartPos,
+                                            TInt& aEndPos,
+                                            TInt& aLength )
+    {
+    TLex lex( aSection );
+    lex.SkipAndMark( iSkipAndMarkPos );
+
+    // Check is aStartTag given
+    if ( aStartTag.Length() == 0 )
+        {
+        // Skip line break, tabs, spaces etc.
+        lex.SkipSpace();
+        aStartPos = lex.Offset();
+        }
+    else
+        {
+        // While end of section and aStartTag is given
+        while ( !lex.Eos() )
+            {
+            lex.SkipSpace();
+            TPtrC line = SubstractLine( lex.Remainder() );
+            TInt tagStartPos = 0;
+            TInt tagEndPos = 0;
+            if ( FindTag( line, aStartTag, tagStartPos, tagEndPos ) == KErrNone )
+            	{
+            	if ( aTagIndicator == ETag )
+            		{
+            		aStartPos = lex.Offset();
+            		}
+            	else
+            		{
+            		aStartPos = lex.Offset() + tagEndPos;
+            		if ( line.Length() - tagEndPos == 0 )
+            			{
+            			return KErrNotFound;
+            			}
+            		}
+            	break;
+            	}
+                
+            GotoEndOfLine( lex );
+            }
+        }
+
+    // End tag parsing starts and if we are end of the section
+    if( lex.Eos() )
+        {
+        return KErrNotFound;
+        }
+
+    // "Delete" white spaces(includes line break) 
+    aEndPos = GotoEndOfLine( lex );
+    // Position where start next parsing.(End position, includes white spaces)
+    iSkipAndMarkPos = lex.Offset();
+    // The length includes spaces and end of lines
+    aLength = ( aEndPos - aStartPos );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: SubstractLine
+
+    Description: Substracts line from selected text
+
+    Parameters: TPtrC& aText: in: text.
+
+    Return Values: TPtrC: Substracted line.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TPtrC CStifSectionParser::SubstractLine( const TPtrC& aText )
+	{
+	TLex lex( aText );
+	
+	while( !lex.Eos() )
+		{
+		if ( lex.Get() == 0x0A ) // "\n" character. Unix style
+			{
+			break;
+			}		
+		}
+	
+	return aText.Left( lex.Offset() );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: FindTag
+
+    Description: Searches for selected tag in text
+
+    Parameters: const TPtrC& aText: in: text,
+				const TPtrC& aTag: in: tag,
+				TInt& aStartPos: out: tag start position,
+				TInt& aEndPos: out: tag end position.
+
+    Return Values: TInt: KErrNone, if tag was found. KErrNotFound if it was not found. 
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifSectionParser::FindTag( const TDesC& aText, const TDesC& aTag, TInt& aStartPos, TInt& aEndPos ) {
+	TBool tagWithEqualChar = EFalse;
+
+	HBufC* tagBuf = NULL;
+	TRAPD( err, tagBuf = aTag.AllocL() );
+	if ( err != KErrNone )
+		{
+		return err;
+		}
+
+	RBuf tag( tagBuf );
+	tag.Trim();
+	if ( tag.Right( 1 ) == _L("=") )
+		{
+		tagWithEqualChar = ETrue;
+		tag.SetLength( tag.Length() - 1 );
+		}
+	
+	TLex lex(aText);
+	lex.SkipSpaceAndMark();
+	TInt startPos = lex.Offset();
+	TPtrC token = lex.NextToken(); 
+	
+	
+	if ( !tagWithEqualChar )
+		{
+		if ( token == tag )
+			{
+			aStartPos = startPos;
+			lex.SkipSpace();
+			aEndPos = lex.Offset();
+			tag.Close();
+			return KErrNone;
+			}
+		}
+	else
+		{
+		lex.UnGetToMark();
+		TPtrC remText = lex.Remainder();
+		if ( remText.Find( tag ) == 0 )
+			{
+			lex.SkipAndMark( tag.Length() );
+			lex.SkipSpaceAndMark();
+			if ( !lex.Eos() )
+				{
+				if ( lex.Get() == '=' )
+					{
+					aStartPos = startPos;
+					lex.SkipSpace();					
+					aEndPos = lex.Offset();
+					tag.Close();
+					return KErrNone;
+					}
+				}
+			}
+		}
+	
+	tag.Close();
+	return KErrNotFound;
+}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: GotoEndOfLine
+
+    Description: Goes end of the line.
+
+    Parameters: TLex& lex: inout: Parsed line.
+
+    Return Values: TInt: Last item's end position.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifSectionParser::GotoEndOfLine( TLex& lex )
+    {
+    // End position of the last token(Initialized with current position)
+    TInt lastItemPosition( lex.Offset() );
+
+    // LINE BREAK NOTE:
+    // Line break in SOS, WIN:  '\r\n'
+    // Line break in UNIX:      '\n'
+
+    do
+        {
+        // Peek next character(10 or '\n' in UNIX style )
+        if( lex.Peek() == 0x0A )
+            {
+            lex.Inc();
+            break;
+            }
+
+        // Peek next character(13 or '\r' in Symbian OS)
+        if ( lex.Peek() == 0x0D )
+            {
+            // Increment the lex position
+            lex.Inc();
+            // Peek next character(10 or '\n' in Symbian OS)
+            if ( lex.Peek() == 0x0A )
+                {
+                // End of the section is found and increment the lex position
+                lex.Inc();
+                break;
+                }
+            // 0x0A not found, decrement position
+            lex.UnGet();
+            }
+        // Peek for tabulator(0x09) and space(0x20)
+        else if ( lex.Peek() == 0x09 || lex.Peek() == 0x20 )
+            {
+            // Increment the lex position
+            lex.Inc();
+            continue;
+            }
+        
+        // If white spaces not found take next token
+        lex.NextToken();
+        lastItemPosition = lex.Offset();    
+        
+        } while ( !lex.Eos() );
+        
+    return lastItemPosition;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: GetItemLineL
+
+    Description: Parses a line for items parsing.
+
+    If start tag is empty the parsing starts beging of the section.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point.
+                TTagToReturnValue aTagIndicator: in: Will aTag included to the
+                returned object(For default the tag will be added)
+
+    Return Values:  CStifItemParser* : pointer to CStifItemParser object
+                    NULL will return if ParseStartAndEndPos() method returns -1
+                    NULL will return if length is 0 or negative
+                    NULL will return if iStartPos is 0
+
+    Errors/Exceptions: Leaves if called CStifItemParser::NewL method fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifItemParser* CStifSectionParser::GetItemLineL( const TDesC& aTag,
+                                            TTagToReturnValue aTagIndicator )
+    {
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+
+    // Indicator that GetItemLineL has been used
+    iLineIndicator = ETrue;
+
+    iSkipAndMarkPos = 0;
+
+    TInt ret = ParseStartAndEndPos( iSection, aTag, aTagIndicator,
+                                    startPos, endPos, length );
+
+    // No parsing found
+    if ( KErrNone != ret || length <= 0 || startPos < 0 )
+        {
+        __TRACE( 
+            KInfo, ( _L( "STIFPARSER: GetItemLineL method returns a NULL" ) ) );
+        return NULL;
+        }
+
+    CStifItemParser* line = CStifItemParser::NewL(
+                                            iSection, startPos, length );
+
+    return line;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: GetNextItemLineL
+
+    Description: Parses a next line for items parsing.
+
+    Parameters: None
+
+    Return Values:  CStifItemParser* : pointer to CStifItemParser object
+                    NULL will return if iLineIndicator is false
+                    NULL will return if ParseStartAndEndPos() method returns -1
+                    NULL will return if length is 0 or negative
+                    NULL will return if iStartPos is 0
+
+    Errors/Exceptions: Leaves if called CStifItemParser::NewL method fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifItemParser* CStifSectionParser::GetNextItemLineL()
+    {
+    // GetLine() or GetItemLineL() method is not called
+    if ( !iLineIndicator )
+        {
+        __TRACE( KInfo, 
+            ( _L( "STIFPARSER: GetNextItemLineL method returns a NULL" ) ) );
+        return NULL;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+
+    // tagIndicator has no meaning in this method
+    TTagToReturnValue tagIndicator( ETag );
+
+    TInt ret = ParseStartAndEndPos( iSection, KNullDesC, tagIndicator,
+                                    startPos, endPos, length );
+
+    // No parsing found
+    if ( KErrNone != ret || length <= 0 || startPos < 0 )
+        {
+        __TRACE( KInfo, 
+            ( _L( "STIFPARSER: GetNextItemLineL method returns a NULL" ) ) );
+        return NULL;
+        }
+
+    CStifItemParser* line = CStifItemParser::NewL(
+                                            iSection, startPos, length );
+
+    return line;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: GetNextItemLineL
+
+    Description: Parses a next line for items parsing with a tag.
+
+    If start tag is empty the parsing starts beging of the section.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TTagToReturnValue aTagIndicator: in: Will aTag included to the
+                returned object(For default the tag will be added)
+
+    Return Values:  CStifItemParser* : pointer to CStifItemParser object
+                    NULL will return if iLineIndicator is false
+                    NULL will return if ParseStartAndEndPos() method returns -1
+                    NULL will return if length is 0 or negative
+                    NULL will return if iStartPos is 0
+
+    Errors/Exceptions: Leaves if called CStifItemParser::NewL method fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifItemParser* CStifSectionParser::GetNextItemLineL(
+                                            const TDesC& aTag,
+                                            TTagToReturnValue aTagIndicator )
+    {
+    // GetLine() or GetItemLineL() method is not called
+    if ( !iLineIndicator )
+        {
+        __TRACE( KInfo, 
+            ( _L( "STIFPARSER: GetNextItemLineL method returns a NULL" ) ) );
+        return NULL;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+
+    TInt ret = ParseStartAndEndPos( iSection, aTag, aTagIndicator,
+                                    startPos, endPos, length );
+    // No parsing found
+    if ( KErrNone != ret || length <= 0 || startPos < 0 )
+        {
+        __TRACE( KInfo, 
+            ( _L( "STIFPARSER: GetNextItemLineL method returns a NULL" )  ) );
+        return NULL;
+        }
+
+    CStifItemParser* line = CStifItemParser::NewL(
+                                            iSection, startPos, length );
+
+    return line;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: SubSectionL
+
+    Description: Parses sub sections from the main section.
+
+    If start tag is empty the parsing starts begin of the section.
+    If end tag is empty the parsing goes end of section.
+    This method starts always from beginning of parsed section and parses
+    first subsection if aSeeked parameters is not given.
+    If parsed section includes several subsections with both start and end
+    tags so aSeeked parameter seeks the required subsection. The aSeeked
+    parameters indicates subsection that will be parsed.
+
+    Parameters: const TDesC& aStartTag: in: Indicates parsing start point
+                const TDesC& aEndTag: in: Indicates parsing end point
+                TInt aSeeked: in: a seeked subsection which will be parsed
+
+    Return Values:  CStifItemParser* : pointer to CStifItemParser object
+                    NULL will return if end tag is not found
+                    NULL will return if length is 0 or negative
+                    NULL will return if lengthStart is 0
+
+    Errors/Exceptions: Leaves if called CStifSectionParser::NewL method fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifSectionParser* CStifSectionParser::SubSectionL( 
+                                                        const TDesC& aStartTag,
+                                                        const TDesC& aEndTag,
+                                                        TInt aSeeked )
+    {
+    
+    iSubOffset = 0;
+    return NextSubSectionL( aStartTag, aEndTag, aSeeked );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: SubSectionL
+
+    Description: Parses subsections from the main section.
+
+    If start tag is empty the parsing starts begin of the section.
+    If end tag is empty the parsing goes end of section.
+    This method will parse next subsection after the earlier subsection if
+    aSeeked parameter is not given.
+    If parser section includes several subsections with both start and end
+    tags so aSeeked parameter seeks the required subsection. The aSeeked
+    parameter indicates subsection that will be parsed.
+
+    Parameters: const TDesC& aStartTag: in: Indicates parsing start point
+                const TDesC& aEndTag: in: Indicates parsing end point
+                TInt aSeeked: in: a seeked subsection which will be parsed
+
+    Return Values:  CStifItemParser* : pointer to CStifItemParser object
+                    NULL will return if end tag is not found
+                    NULL will return if length is 0 or negative
+                    NULL will return if lengthStart is 0
+
+    Errors/Exceptions: Leaves if called CStifSectionParser::NewL method fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifSectionParser* CStifSectionParser::NextSubSectionL( 
+                                                    const TDesC& aStartTag,
+                                                    const TDesC& aEndTag,
+                                                    TInt aSeeked )
+    {
+    
+    TLex lex( iSection );
+
+    lex.SkipAndMark( iSubOffset );
+
+    // Get the required sub section length
+    TInt length( 0 );
+    TInt lengthStartPos( 0 );
+    TInt lengthEndPos( 0 );
+    TBool eos( EFalse );
+    TInt tagCount( 1 );
+
+    // Check is aStartTag given
+    if ( aStartTag.Length() == 0 )
+        {
+        // Skip line break, tabs, spaces etc.
+        lex.SkipSpace();
+        lengthStartPos = lex.Offset();
+        }
+    else
+        {
+        // While end of section and aStartTag is given
+        while ( !lex.Eos() )
+            {
+            TPtrC ptr = lex.NextToken();
+            // Start of the section is found and correct section
+            if ( ptr == aStartTag && tagCount == aSeeked )
+                {
+                // Start position
+                lengthStartPos = lex.Offset();
+                break;
+                }
+            // Start tag is found but not correct section
+            else if ( ptr == aStartTag )
+                {
+                tagCount++;
+                }
+            }
+        }
+
+    // If we are end of section lex.Eos() and eos will be ETrue
+    eos = lex.Eos();
+
+    // Seeked section is not found
+    if ( tagCount != aSeeked )
+        {
+        __TRACE( KInfo, ( _L( "STIFPARSER: NextSubSectionL method: Seeked subsection is not found" ) ) );
+        User::Leave( KErrNotFound );
+        }
+
+    // Check is aEndTag given
+    if ( aEndTag.Length() == 0 )
+        {
+        lengthEndPos = iSection.MaxLength();
+        }
+    else
+        {
+        // While end of section and aEndTag is given
+        while ( !lex.Eos() )
+            {
+            TPtrC ptr = lex.NextToken();
+            // End tag of the section is found
+            if ( ptr == aEndTag )
+                {
+                // End position
+                lengthEndPos = lex.Offset();
+                // Because Offset() position is after the aEndTag
+                lengthEndPos -= aEndTag.Length();
+                break;
+                }
+            }
+        }
+
+    // If we are end of section and lengthEndPos is 0
+    if ( lengthEndPos == 0 )
+        {
+        // lex.Eos() and eos will be ETrue
+        eos = lex.Eos();
+        }
+
+    // The length includes spaces and end of lines
+    length = ( lengthEndPos - lengthStartPos );
+
+    CStifSectionParser* section = NULL;
+
+    // If eos is true or length is negative
+    if ( eos || length <= 0  ) 
+        {
+        __TRACE( KInfo, 
+            ( _L( "STIFPARSER: SubSectionL method returns a NULL" ) ) );
+        }    
+    else
+        {
+        // Position where start next parsing.(End position,
+        // includes white spaces)
+        iSubOffset = lex.Offset();
+        
+        // Make CStifSectionParser object and alloc required length
+        section = CStifSectionParser::NewL( length );
+        CleanupStack::PushL( section );
+
+        // Copy required data to the section object
+        section->SetData( iSection, lengthStartPos, length );
+
+        CleanupStack::Pop( section );
+        }
+
+    return section;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: GetLine
+
+    Description: Get a line.
+
+    Search an item from the section and return rest of the line. If start tag 
+    is empty the parsing starts beging of the section.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TPtr& aLine: inout: Parsed line
+                TTagToReturnValue aTagIndicator: in: Will aTag included to the
+                returned value(For default the tag will be added)
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifSectionParser::GetLine( const TDesC& aTag,
+                                            TPtrC& aLine,
+                                            TTagToReturnValue aTagIndicator )
+    {
+    TInt ret( KErrNone );
+
+    if ( 0 == iSection.Length() )
+        {
+        return KErrNotFound;
+        }
+
+    // Indicator that GetLine has been used
+    iLineIndicator = ETrue;
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+
+    iSkipAndMarkPos = 0;
+
+    ret = ParseStartAndEndPos( iSection, aTag, aTagIndicator,
+                                startPos, endPos, length );
+
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    aLine.Set( &iSection[startPos], length );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: GetNextLine
+
+    Description: Get a line
+
+    Search an item from the section and return rest of the line.
+
+    Parameters: TPtr& aLine: inout: Parsed line
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifSectionParser::GetNextLine( TPtrC& aLine )
+    {
+    TInt ret( KErrNone );
+
+    // GetLine() or GetItemLineL() method is not called
+    if ( !iLineIndicator )
+        {
+        return KErrNotReady;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+
+    // tagIndicator has no meaning in this method
+    TTagToReturnValue tagIndicator( ETag );
+
+    ret = ParseStartAndEndPos( iSection, KNullDesC, tagIndicator,
+                                startPos, endPos, length );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    aLine.Set( &iSection[startPos], length );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: GetNextLine
+
+    Description: Get a line with tag
+
+    Search a next line with the required tag from the section. If start tag
+    is empty the parsing starts beging of the section.
+
+    Parameters: const TDesC& aTag: in: Indicates parsing start point
+                TPtr& aLine: inout: Parsed line
+                TTagToReturnValue aTagIndicator: in: Will aTag included to the
+                returned value(For default the tag will be added)
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifSectionParser::GetNextLine( const TDesC& aTag, TPtrC& aLine,
+                                            TTagToReturnValue aTagIndicator )
+    {
+    TInt ret( KErrNone );
+
+    // GetLine() or GetItemLineL() method is not called
+    if ( !iLineIndicator )
+        {
+        return KErrNotReady;
+        }
+
+    TInt startPos( 0 );
+    TInt endPos( 0 );
+    TInt length( 0 );
+
+    ret = ParseStartAndEndPos( iSection, aTag, aTagIndicator,
+                                startPos, endPos, length );
+    if ( KErrNone != ret )
+        {
+        // Nothing to parse
+        return ret;
+        }
+
+    aLine.Set( &iSection[startPos], length );
+
+    return KErrNone;
+
+    }
+
+ /*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: GetPosition
+
+    Description: Get current position.
+
+    Returns current parsing position, which
+    can be used as parameter for SetPosition afterwards to go back
+    to old parsing position.
+
+    Parameters: None
+    
+    Return Values: TInt: Current parsing position.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifSectionParser::GetPosition()
+    {
+    
+    return iSkipAndMarkPos;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: SetPosition
+
+    Description: Set current position.
+                
+    SetPosition can be used to set parsing position, e.g. to rewind 
+    back to some old position retrieved with GetPosition.
+    
+    Parameters: TInt aPos: in: new parsing position.
+    
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifSectionParser::SetPosition( TInt aPos )  
+    {
+    
+    if( aPos < 0 || aPos >= iSection.Length() )
+        {
+        return KErrArgument;
+        }
+        
+    iSkipAndMarkPos = aPos;    
+    
+    return KErrNone;
+    
+    }        
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: SetData
+
+    Description: Create a section.
+
+    Parameters: const TPtr aData: in: Data to be parsed
+                TInt aStartPos: in: Indicates parsing start position
+                TInt aLength: in: Indicates length of parsed section
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CStifSectionParser::SetData( TPtr aData,
+                                    TInt aStartPos,
+                                    TInt aLength )
+    {
+    iSection.Copy( aData.Mid( aStartPos, aLength ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifSectionParser
+
+    Method: Des
+
+    Description: Returns a section.
+
+    Parameters: None
+
+    Return Values: const TPtrC: Returns a current section
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+const TPtrC CStifSectionParser::Des()
+    {
+    return (TPtrC)iSection;
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/BWINS/STIFTESTENGINEU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,63 @@
+EXPORTS
+	??0RSettingServer@@QAE@XZ @ 1 NONAME ; RSettingServer::RSettingServer(void)
+	??1CSTIFTestFrameworkSettings@@UAE@XZ @ 2 NONAME ; CSTIFTestFrameworkSettings::~CSTIFTestFrameworkSettings(void)
+	??1CTestModuleList@@UAE@XZ @ 3 NONAME ; CTestModuleList::~CTestModuleList(void)
+	?AddCfgFile@CTestModuleInfo@@QAEHAAVTDesC16@@@Z @ 4 NONAME ; int CTestModuleInfo::AddCfgFile(class TDesC16 &)
+	?AddConfigFile@RTestEngine@@QAEHABV?$TBuf@$0IA@@@ABV?$TBuf@$0BAA@@@@Z @ 5 NONAME ; int RTestEngine::AddConfigFile(class TBuf<128> const &, class TBuf<256> const &)
+	?AddTestCaseResultToTestReport@RTestEngine@@QAEHABVTTestInfo@@ABVTFullTestResult@@H@Z @ 6 NONAME ; int RTestEngine::AddTestCaseResultToTestReport(class TTestInfo const &, class TFullTestResult const &, int)
+	?AddTestModule@CTestModuleList@@QAEHAAVTDesC16@@@Z @ 7 NONAME ; int CTestModuleList::AddTestModule(class TDesC16 &)
+	?AddTestModule@RTestEngine@@QAEHABV?$TBuf@$0IA@@@ABV?$TBuf@$0BAA@@@@Z @ 8 NONAME ; int RTestEngine::AddTestModule(class TBuf<128> const &, class TBuf<256> const &)
+	?CancelAsyncRequest@RTestCase@@QAEHW4TTestCaseAsyncRequest@1@@Z @ 9 NONAME ; int RTestCase::CancelAsyncRequest(enum RTestCase::TTestCaseAsyncRequest)
+	?CancelAsyncRequest@RTestEngine@@QAEHW4TTestEngineAsyncRequest@1@@Z @ 10 NONAME ; int RTestEngine::CancelAsyncRequest(enum RTestEngine::TTestEngineAsyncRequest)
+	?Close@RSettingServer@@QAEXXZ @ 11 NONAME ; void RSettingServer::Close(void)
+	?Close@RTestCase@@QAEXXZ @ 12 NONAME ; void RTestCase::Close(void)
+	?Close@RTestEngine@@QAEXXZ @ 13 NONAME ; void RTestEngine::Close(void)
+	?Connect@RSettingServer@@QAEHXZ @ 14 NONAME ; int RSettingServer::Connect(void)
+	?Connect@RTestEngine@@QAEHXZ @ 15 NONAME ; int RTestEngine::Connect(void)
+	?Count@CTestModuleList@@QAEHXZ @ 16 NONAME ; int CTestModuleList::Count(void)
+	?CountCfgFiles@CTestModuleInfo@@QAEHXZ @ 17 NONAME ; int CTestModuleInfo::CountCfgFiles(void)
+	?EnumerateTestCases@RTestEngine@@QAEXAAV?$TPckgBuf@H@@AAVTRequestStatus@@@Z @ 18 NONAME ; void RTestEngine::EnumerateTestCases(class TPckgBuf<int> &, class TRequestStatus &)
+	?ErrorNotification@RTestEngine@@QAEXAAV?$TPckg@VTErrorNotification@@@@AAVTRequestStatus@@@Z @ 19 NONAME ; void RTestEngine::ErrorNotification(class TPckg<class TErrorNotification> &, class TRequestStatus &)
+	?Event@RTestEngine@@QAEXAAV?$TPckg@VTEventIf@@@@AAVTRequestStatus@@@Z @ 20 NONAME ; void RTestEngine::Event(class TPckg<class TEventIf> &, class TRequestStatus &)
+	?GetBooleanSettingsL@CSTIFTestFrameworkSettings@@QAEHPAVCStifSectionParser@@VTPtrC16@@AAH@Z @ 21 NONAME ; int CSTIFTestFrameworkSettings::GetBooleanSettingsL(class CStifSectionParser *, class TPtrC16, int &)
+	?GetCfgFileName@CTestCaseFileInfo@@QAEHAAVTDes16@@@Z @ 22 NONAME ; int CTestCaseFileInfo::GetCfgFileName(class TDes16 &)
+	?GetCfgFileName@CTestModuleInfo@@QAEHHAAVTDes16@@@Z @ 23 NONAME ; int CTestModuleInfo::GetCfgFileName(int, class TDes16 &)
+	?GetFileSetting@CSTIFTestFrameworkSettings@@QAEHPAVCStifSectionParser@@VTPtrC16@@AAV3@@Z @ 24 NONAME ; int CSTIFTestFrameworkSettings::GetFileSetting(class CStifSectionParser *, class TPtrC16, class TPtrC16 &)
+	?GetFormatL@CSTIFTestFrameworkSettings@@QAEHPAVCStifSectionParser@@VTPtrC16@@AAW4TLoggerType@CStifLogger@@@Z @ 25 NONAME ; int CSTIFTestFrameworkSettings::GetFormatL(class CStifSectionParser *, class TPtrC16, enum CStifLogger::TLoggerType &)
+	?GetFormatL@CSTIFTestFrameworkSettings@@QAEHPAVCStifSectionParser@@VTPtrC16@@AAW4TLoggerType@CStifLogger@@AAH@Z @ 26 NONAME ; int CSTIFTestFrameworkSettings::GetFormatL(class CStifSectionParser *, class TPtrC16, enum CStifLogger::TLoggerType &, int &)
+	?GetIniFileName@CTestModuleInfo@@QAEHAAVTDes16@@@Z @ 27 NONAME ; int CTestModuleInfo::GetIniFileName(class TDes16 &)
+	?GetLoggerSettings@RSettingServer@@QAEHAAUTLoggerSettings@@@Z @ 28 NONAME ; int RSettingServer::GetLoggerSettings(struct TLoggerSettings &)
+	?GetModule@CTestModuleList@@QAEPAVCTestModuleInfo@@AAVTDesC16@@@Z @ 29 NONAME ; class CTestModuleInfo * CTestModuleList::GetModule(class TDesC16 &)
+	?GetModule@CTestModuleList@@QAEPAVCTestModuleInfo@@H@Z @ 30 NONAME ; class CTestModuleInfo * CTestModuleList::GetModule(int)
+	?GetModuleName@CTestModuleInfo@@QAEHAAVTDes16@@@Z @ 31 NONAME ; int CTestModuleInfo::GetModuleName(class TDes16 &)
+	?GetOutputL@CSTIFTestFrameworkSettings@@QAEHPAVCStifSectionParser@@VTPtrC16@@AAW4TOutput@CStifLogger@@@Z @ 32 NONAME ; int CSTIFTestFrameworkSettings::GetOutputL(class CStifSectionParser *, class TPtrC16, enum CStifLogger::TOutput &)
+	?GetOverwriteL@CSTIFTestFrameworkSettings@@QAEHPAVCStifSectionParser@@VTPtrC16@@AAH@Z @ 33 NONAME ; int CSTIFTestFrameworkSettings::GetOverwriteL(class CStifSectionParser *, class TPtrC16, int &)
+	?GetReportModeL@CSTIFTestFrameworkSettings@@QAEHPAVCStifSectionParser@@VTPtrC16@@AAI@Z @ 34 NONAME ; int CSTIFTestFrameworkSettings::GetReportModeL(class CStifSectionParser *, class TPtrC16, unsigned int &)
+	?GetTestCases@RTestEngine@@QAEHAAV?$CFixedFlatArray@VTTestInfo@@@@@Z @ 35 NONAME ; int RTestEngine::GetTestCases(class CFixedFlatArray<class TTestInfo> &)
+	?GetUncheckedCfgFile@CTestModuleList@@QAEPAVCTestCaseFileInfo@@XZ @ 36 NONAME ; class CTestCaseFileInfo * CTestModuleList::GetUncheckedCfgFile(void)
+	?LoadConfiguration@RTestEngine@@QAEHABV?$TBuf@$0BAA@@@@Z @ 37 NONAME ; int RTestEngine::LoadConfiguration(class TBuf<256> const &)
+	?LoadLoggerSettingsFromIniFile@RSettingServer@@QAEHAAUTLoggerSettings@@ABVTDesC16@@H@Z @ 38 NONAME ; int RSettingServer::LoadLoggerSettingsFromIniFile(struct TLoggerSettings &, class TDesC16 const &, int)
+	?NewL@CSTIFTestFrameworkSettings@@SAPAV1@XZ @ 39 NONAME ; class CSTIFTestFrameworkSettings * CSTIFTestFrameworkSettings::NewL(void)
+	?NewL@CTestModuleList@@SAPAV1@PAVCStifLogger@@@Z @ 40 NONAME ; class CTestModuleList * CTestModuleList::NewL(class CStifLogger *)
+	?NotifyProgress@RTestCase@@QAEXAAV?$TPckg@VTTestProgress@@@@AAVTRequestStatus@@@Z @ 41 NONAME ; void RTestCase::NotifyProgress(class TPckg<class TTestProgress> &, class TRequestStatus &)
+	?NotifyRemoteMsg@RTestCase@@QAEHAAVTDes8@@W4TStifCommand@@@Z @ 42 NONAME ; int RTestCase::NotifyRemoteMsg(class TDes8 &, enum TStifCommand)
+	?NotifyRemoteType@RTestCase@@QAEXAAV?$TPckg@W4TStifCommand@@@@AAV?$TPckg@H@@AAVTRequestStatus@@@Z @ 43 NONAME ; void RTestCase::NotifyRemoteType(class TPckg<enum TStifCommand> &, class TPckg<int> &, class TRequestStatus &)
+	?Open@RTestCase@@QAEHAAVRTestEngine@@ABV?$TPckg@VTTestInfo@@@@@Z @ 44 NONAME ; int RTestCase::Open(class RTestEngine &, class TPckg<class TTestInfo> const &)
+	?OpenLoggerSession@RTestEngine@@QAEHAAUTLoggerSettings@@@Z @ 45 NONAME ; int RTestEngine::OpenLoggerSession(struct TLoggerSettings &)
+	?Pause@RTestCase@@QAEHXZ @ 46 NONAME ; int RTestCase::Pause(void)
+	?RemoveConfigFile@RTestEngine@@QAEHABV?$TBuf@$0IA@@@ABV?$TBuf@$0BAA@@@@Z @ 47 NONAME ; int RTestEngine::RemoveConfigFile(class TBuf<128> const &, class TBuf<256> const &)
+	?RemoveTestModule@RTestEngine@@QAEHABV?$TBuf@$0IA@@@@Z @ 48 NONAME ; int RTestEngine::RemoveTestModule(class TBuf<128> const &)
+	?Resume@RTestCase@@QAEHXZ @ 49 NONAME ; int RTestCase::Resume(void)
+	?RunTestCase@RTestCase@@QAEXAAV?$TPckg@VTFullTestResult@@@@AAVTRequestStatus@@@Z @ 50 NONAME ; void RTestCase::RunTestCase(class TPckg<class TFullTestResult> &, class TRequestStatus &)
+	?SetAttribute@RTestEngine@@QAEHW4TAttribute@@ABVTDesC16@@@Z @ 51 NONAME ; int RTestEngine::SetAttribute(enum TAttribute, class TDesC16 const &)
+	?SetChecked@CTestCaseFileInfo@@QAEXXZ @ 52 NONAME ; void CTestCaseFileInfo::SetChecked(void)
+	?SetIniFile@CTestModuleInfo@@QAEHAAVTDesC16@@@Z @ 53 NONAME ; int CTestModuleInfo::SetIniFile(class TDesC16 &)
+	?SetLoggerOutputPath@RSettingServer@@QAEHABVTDesC16@@@Z @ 54 NONAME ; int RSettingServer::SetLoggerOutputPath(class TDesC16 const &)
+	?StartNewSettingServer@@YAHXZ @ 55 NONAME ; int StartNewSettingServer(void)
+	?Version@RSettingServer@@QBE?AVTVersion@@XZ @ 56 NONAME ; class TVersion RSettingServer::Version(void) const
+	?Version@RTestEngine@@QBE?AVTVersion@@XZ @ 57 NONAME ; class TVersion RTestEngine::Version(void) const
+	?ResetLoggerSettings@RSettingServer@@QAEHXZ @ 58 NONAME ; int RSettingServer::ResetLoggerSettings(void)
+	?UpdateEngineConfiguration@RTestEngine@@QAEHAAVTDesC16@@@Z @ 59 NONAME ; int RTestEngine::UpdateEngineConfiguration(class TDesC16 &)
+	?UpdateLogConfiguration@RTestEngine@@QAEHAAVTDesC16@@@Z @ 60 NONAME ; int RTestEngine::UpdateLogConfiguration(class TDesC16 &)
+	?LoadLoggerSettingsFromCommandLine@RSettingServer@@QAEHAAVTDesC16@@@Z @ 61 NONAME ; int RSettingServer::LoadLoggerSettingsFromCommandLine(class TDesC16 &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/eabi/StifTestEngineu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,80 @@
+EXPORTS
+	_Z21StartNewSettingServerv @ 1 NONAME
+	_ZN11RTestEngine12GetTestCasesER15CFixedFlatArrayI9TTestInfoE @ 2 NONAME
+	_ZN11RTestEngine12SetAttributeE10TAttributeRK7TDesC16 @ 3 NONAME
+	_ZN11RTestEngine13AddConfigFileERK4TBufILi128EERKS0_ILi256EE @ 4 NONAME
+	_ZN11RTestEngine13AddTestModuleERK4TBufILi128EERKS0_ILi256EE @ 5 NONAME
+	_ZN11RTestEngine16RemoveConfigFileERK4TBufILi128EERKS0_ILi256EE @ 6 NONAME
+	_ZN11RTestEngine16RemoveTestModuleERK4TBufILi128EE @ 7 NONAME
+	_ZN11RTestEngine17ErrorNotificationER5TPckgI18TErrorNotificationER14TRequestStatus @ 8 NONAME
+	_ZN11RTestEngine17LoadConfigurationERK4TBufILi256EE @ 9 NONAME
+	_ZN11RTestEngine17OpenLoggerSessionER15TLoggerSettings @ 10 NONAME
+	_ZN11RTestEngine18CancelAsyncRequestENS_23TTestEngineAsyncRequestE @ 11 NONAME
+	_ZN11RTestEngine18EnumerateTestCasesER8TPckgBufIiER14TRequestStatus @ 12 NONAME
+	_ZN11RTestEngine29AddTestCaseResultToTestReportERK9TTestInfoRK15TFullTestResulti @ 13 NONAME
+	_ZN11RTestEngine5CloseEv @ 14 NONAME
+	_ZN11RTestEngine5EventER5TPckgI8TEventIfER14TRequestStatus @ 15 NONAME
+	_ZN11RTestEngine7ConnectEv @ 16 NONAME
+	_ZN14RSettingServer17GetLoggerSettingsER15TLoggerSettings @ 17 NONAME
+	_ZN14RSettingServer19ResetLoggerSettingsEv @ 18 NONAME
+	_ZN14RSettingServer19SetLoggerOutputPathERK7TDesC16 @ 19 NONAME
+	_ZN14RSettingServer29LoadLoggerSettingsFromIniFileER15TLoggerSettingsRK7TDesC16i @ 20 NONAME
+	_ZN14RSettingServer5CloseEv @ 21 NONAME
+	_ZN14RSettingServer7ConnectEv @ 22 NONAME
+	_ZN14RSettingServerC1Ev @ 23 NONAME
+	_ZN14RSettingServerC2Ev @ 24 NONAME
+	_ZN15CTestModuleInfo10AddCfgFileER7TDesC16 @ 25 NONAME
+	_ZN15CTestModuleInfo10SetIniFileER7TDesC16 @ 26 NONAME
+	_ZN15CTestModuleInfo13CountCfgFilesEv @ 27 NONAME
+	_ZN15CTestModuleInfo13GetModuleNameER6TDes16 @ 28 NONAME
+	_ZN15CTestModuleInfo14GetCfgFileNameEiR6TDes16 @ 29 NONAME
+	_ZN15CTestModuleInfo14GetIniFileNameER6TDes16 @ 30 NONAME
+	_ZN15CTestModuleList13AddTestModuleER7TDesC16 @ 31 NONAME
+	_ZN15CTestModuleList19GetUncheckedCfgFileEv @ 32 NONAME
+	_ZN15CTestModuleList4NewLEP11CStifLogger @ 33 NONAME
+	_ZN15CTestModuleList5CountEv @ 34 NONAME
+	_ZN15CTestModuleList9GetModuleER7TDesC16 @ 35 NONAME
+	_ZN15CTestModuleList9GetModuleEi @ 36 NONAME
+	_ZN15CTestModuleListD0Ev @ 37 NONAME
+	_ZN15CTestModuleListD1Ev @ 38 NONAME
+	_ZN15CTestModuleListD2Ev @ 39 NONAME
+	_ZN17CTestCaseFileInfo10SetCheckedEv @ 40 NONAME
+	_ZN17CTestCaseFileInfo14GetCfgFileNameER6TDes16 @ 41 NONAME
+	_ZN26CSTIFTestFrameworkSettings10GetFormatLEP18CStifSectionParser7TPtrC16RN11CStifLogger11TLoggerTypeE @ 42 NONAME
+	_ZN26CSTIFTestFrameworkSettings10GetFormatLEP18CStifSectionParser7TPtrC16RN11CStifLogger11TLoggerTypeERi @ 43 NONAME
+	_ZN26CSTIFTestFrameworkSettings10GetOutputLEP18CStifSectionParser7TPtrC16RN11CStifLogger7TOutputE @ 44 NONAME
+	_ZN26CSTIFTestFrameworkSettings13GetOverwriteLEP18CStifSectionParser7TPtrC16Ri @ 45 NONAME
+	_ZN26CSTIFTestFrameworkSettings14GetFileSettingEP18CStifSectionParser7TPtrC16RS2_ @ 46 NONAME
+	_ZN26CSTIFTestFrameworkSettings14GetReportModeLEP18CStifSectionParser7TPtrC16Rj @ 47 NONAME
+	_ZN26CSTIFTestFrameworkSettings19GetBooleanSettingsLEP18CStifSectionParser7TPtrC16Ri @ 48 NONAME
+	_ZN26CSTIFTestFrameworkSettings4NewLEv @ 49 NONAME
+	_ZN26CSTIFTestFrameworkSettingsD0Ev @ 50 NONAME
+	_ZN26CSTIFTestFrameworkSettingsD1Ev @ 51 NONAME
+	_ZN26CSTIFTestFrameworkSettingsD2Ev @ 52 NONAME
+	_ZN9RTestCase11RunTestCaseER5TPckgI15TFullTestResultER14TRequestStatus @ 53 NONAME
+	_ZN9RTestCase14NotifyProgressER5TPckgI13TTestProgressER14TRequestStatus @ 54 NONAME
+	_ZN9RTestCase15NotifyRemoteMsgER5TDes812TStifCommand @ 55 NONAME
+	_ZN9RTestCase16NotifyRemoteTypeER5TPckgI12TStifCommandERS0_IiER14TRequestStatus @ 56 NONAME
+	_ZN9RTestCase18CancelAsyncRequestENS_21TTestCaseAsyncRequestE @ 57 NONAME
+	_ZN9RTestCase4OpenER11RTestEngineRK5TPckgI9TTestInfoE @ 58 NONAME
+	_ZN9RTestCase5CloseEv @ 59 NONAME
+	_ZN9RTestCase5PauseEv @ 60 NONAME
+	_ZN9RTestCase6ResumeEv @ 61 NONAME
+	_ZNK11RTestEngine7VersionEv @ 62 NONAME
+	_ZNK14RSettingServer7VersionEv @ 63 NONAME
+	_ZTI14CLoggerSetting @ 64 NONAME ; #<TI>#
+	_ZTI14CSettingServer @ 65 NONAME ; #<TI>#
+	_ZTI15CTestModuleInfo @ 66 NONAME ; #<TI>#
+	_ZTI15CTestModuleList @ 67 NONAME ; #<TI>#
+	_ZTI17CTestCaseFileInfo @ 68 NONAME ; #<TI>#
+	_ZTI26CSTIFTestFrameworkSettings @ 69 NONAME ; #<TI>#
+	_ZTV14CLoggerSetting @ 70 NONAME ; #<VT>#
+	_ZTV14CSettingServer @ 71 NONAME ; #<VT>#
+	_ZTV15CTestModuleInfo @ 72 NONAME ; #<VT>#
+	_ZTV15CTestModuleList @ 73 NONAME ; #<VT>#
+	_ZTV17CTestCaseFileInfo @ 74 NONAME ; #<VT>#
+	_ZTV26CSTIFTestFrameworkSettings @ 75 NONAME ; #<VT>#
+	_ZN11RTestEngine22UpdateLogConfigurationER7TDesC16 @ 76 NONAME
+	_ZN11RTestEngine25UpdateEngineConfigurationER7TDesC16 @ 77 NONAME
+	_ZN14RSettingServer33LoadLoggerSettingsFromCommandLineER7TDesC16 @ 78 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/group/TestEngine.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,55 @@
+/*
+* 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: MMP file for STIF Test Framework's TestEngine module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+#include        "../../../inc/STIFConfiguration.mmh"
+
+TARGET          StifTestEngine.dll
+TARGETTYPE      dll
+
+UID             0x1000008D 0x101FB3DF
+
+CAPABILITY      ALL -TCB
+VENDORID        0x101FB657
+SECUREID        0x102073E0
+
+DEFFILE         StifTestEngine.def
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+
+SOURCE          TestEngineClient.cpp
+SOURCE          SettingServerClient.cpp
+SOURCE          SettingServer.cpp
+SOURCE          SettingServerSession.cpp
+SOURCE          STIFTestFrameworkSettings.cpp
+SOURCE          TestModuleInfo.cpp
+SOURCE			TestEngineUtils.cpp
+
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         stiftestinterface.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/group/TestEngineSrv.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,57 @@
+/*
+* 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: MMP file for STIF Test Framework's TestEngine module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+#include        "../../../inc/STIFConfiguration.mmh"
+SMPSAFE
+
+TARGET		  STFTestEngineSrv.exe
+TARGETTYPE	  exe
+UID			 0 0x2002BC9C
+
+CAPABILITY      ALL -TCB
+//VENDORID        0x101FB657
+//SECUREID        0x102073E0
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+//SOURCE          TestEngineClient.cpp
+SOURCE          TestEngineServer.cpp
+SOURCE          TestEngine.cpp
+SOURCE          TestCaseController.cpp
+SOURCE          TestModuleController.cpp
+SOURCE          TestReport.cpp
+SOURCE          TestCaseTimeout.cpp
+SOURCE          STIFTestFrameworkSettings.cpp
+SOURCE          StifPythonFunEng.cpp
+
+LIBRARY         euser.lib
+LIBRARY         hal.lib                 // For logging (HAL)
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY         stiftestserver.lib
+LIBRARY         efsrv.lib
+LIBRARY         atslogger.lib
+
+EPOCHEAPSIZE    0x10000 0x400000
+EPOCSTACKSIZE   0x8000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STIF TestEngine.
+*/
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+	TestEngine.mmp
+	TestEngineSrv.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/Logging.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,70 @@
+/*
+* 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: This file contains logging macros for test engine.
+*
+*/
+
+#ifndef LOGGINGDEFS_H
+#define LOGGINGDEFS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+const TUint KError           = 0x1;
+const TUint KInit            = 0x2;
+const TUint KVerbose         = 0x4;
+const TUint KAlways          = 0xFFFFFFFF;
+const TUint KDebugLevel      = ( KInit | KError );
+
+// MACROS
+#define __TRACING_ENABLED
+
+// Define USE_LOGGER to use logger for logging
+#define USE_LOGGER
+
+#ifdef __TRACING_ENABLED
+
+    // Disable conditional expression is constant -warning
+    #pragma warning( disable : 4127 )
+
+    // Using logger
+    #if defined (USE_LOGGER)
+    #define __TRACE(level,p) if ( (level) & KDebugLevel) { LOGGER->Log p; }
+    #else
+    #define __TRACE(level,p);
+    #endif
+
+    #define __RDEBUG(x) if( KVerbose & KDebugLevel){ RDebug::Print x ; }
+
+#else
+    // No tracing
+    #define __TRACE(level,p);
+    
+    #define __RDEBUG(x)
+
+#endif
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // LOGGINGDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/STIFTestFrameworkSettings.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,154 @@
+/*
+* 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: This file contains the header file of the 
+* CSTIFTestFrameworkSettings.
+*
+*/
+
+#ifndef STIFTESTFRAMEWORKSETTINGS_H
+#define STIFTESTFRAMEWORKSETTINGS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <StifLogger.h>
+#include <StifParser.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CSTIFTestFrameworkSettings is a STIF Test Framework Test Engine class.
+// Class contains different operations of settings parsing from Test Framework
+// initíalization file.
+
+class CSTIFTestFrameworkSettings 
+        :public CBase
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CSTIFTestFrameworkSettings* NewL();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CSTIFTestFrameworkSettings();
+
+    public:     // New functions
+
+        /**
+        * Get report mode settings from STIF TestFramework's ini file.
+        */
+        IMPORT_C TInt GetReportModeL( CStifSectionParser* aSectionParser,
+                                                TPtrC aTag,
+                                                TUint& aSetting );
+
+        /**
+        * Get file settings from STIF TestFramework's ini file.
+        */
+        IMPORT_C TInt GetFileSetting( CStifSectionParser* aSectionParser,
+                                                TPtrC aTag,
+                                                TPtrC& aSetting );
+
+        /**
+        * Get format setting from STIF TestFramework's ini file.
+        */
+        IMPORT_C TInt GetFormatL( CStifSectionParser* aSectionParser,
+                                        TPtrC aTag,
+                                        CStifLogger::TLoggerType& aLoggerType );
+
+        /**
+        * Get output setting from STIF TestFramework's ini file.
+        */
+        IMPORT_C TInt GetOutputL( CStifSectionParser* aSectionParser,
+                                        TPtrC aTag,
+                                        CStifLogger::TOutput& aOutput );
+
+        /**
+        * Get boolean type of settings from STIF TestFramework's ini file.
+        */
+        IMPORT_C TInt GetBooleanSettingsL( CStifSectionParser* aSectionParser,
+                                            TPtrC aTag,
+                                            TBool& aOverwrite );
+
+        /**
+        * Get file creation mode setting from STIF TestFramework's ini file.
+        */
+        IMPORT_C TInt GetOverwriteL( CStifSectionParser* aSectionParser,
+                                                TPtrC aTag,
+                                                TBool& aOverwrite );
+
+        /**
+        * Get format setting from STIF TestFramework's ini file.
+        */
+        IMPORT_C TInt GetFormatL( CStifSectionParser* aSectionParser,
+                                        TPtrC aTag,
+                                        CStifLogger::TLoggerType& aLoggerType,
+                                        TBool &aXML );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSTIFTestFrameworkSettings();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // STIFTESTFRAMEWORKSETTINGS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/SettingServer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,286 @@
+/*
+* 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: This file contains the header file of the 
+* CSettingServer.
+*
+*/
+
+#ifndef SETTING_SERVER_H
+#define SETTING_SERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifLogger.h>
+#include "Logging.h"
+#include "TestEngineClient.h"
+#include "SettingServerClientServer.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CSettingServer is a server class.
+class CSettingServer
+    :public CServer2 // Inter Process Communication version 2 is used(EKA2)
+    {
+    public: // Enumerations
+        enum { ESettingServerSchedulerPriority = CActive::EPriorityHigh };
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CSettingServer* NewL( const TName& aName );
+
+        /**
+        * Destructor of CSettingServer.
+        */
+        ~CSettingServer();
+
+    public: // New functions
+
+        /**
+        * ThreadFunction is used to create new thread.
+        */
+        static TInt ThreadFunction( TAny* aStarted );       
+
+        /**
+        * PanicServer panics the CSettingServer
+        */
+        static void PanicServer( const TSettingServerPanic aPanic );
+
+        /**
+        * Return pointer to the Logger(iSettingServerLogger)
+        */
+        CStifLogger* CSettingServer::Logger();
+
+    public: // Functions from base classes
+
+        /**
+        * NewSessionL creates new CSettingServer session.
+        */
+        CSession2* NewSessionL( const TVersion &aVersion,
+                                    const RMessage2& aMessage ) const;
+        /**
+        * Open session
+        */
+        void OpenSession();
+
+        /**
+        * Close session
+        */
+        void CloseSession();
+
+        
+        void ResetLoggerSettings();
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CSettingServer();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+
+        // NOTE:
+        // There is one CSettingServer and may be many CLoggerSetting sessions
+        // so variables are defined here and are available to all sessions.
+
+        // Logger overwrite settings
+        TLoggerSettings         iLoggerSettings;
+
+        // Includes inifile name and path information
+        TFileName               iIniFile;
+            
+        TBool                   iDefaultSettings;
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Session counter
+        TInt                    iSessions;
+
+        // Logger instance
+        CStifLogger*            iSettingServerLogger;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// CLoggerSetting is a session class.
+// Session for the CSettingServer server, to a single client-side session
+// a session may own any number of CCounter objects
+
+class CLoggerSetting
+    :public CSession2
+    {    
+    public:
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+
+        /**
+        * Construct a clean-up server session
+        */
+        static CLoggerSetting* NewL( CSettingServer* aServer );
+
+        /**
+        * Destructor
+        */
+        virtual ~CLoggerSetting();
+
+    public: // New functions
+
+        /**
+        * Dispatch message
+        */
+        TInt DispatchMessageL( const RMessage2& aMessage,
+                                TBool& aIsMessageSync );
+
+        /**
+        * Close the session to CSettingpServer.
+        */
+        TInt CloseSession( /*const RMessage& aMessage*/ );
+
+        /**
+        * Read Logger setting from initialization file. Mainly use from
+        * TestEngine side.
+        */
+        TInt LoadLoggerSettingsFromIniFile( const RMessage2& aMessage );
+        /**
+        * Read Logger setting from Command Line . Mainly use from
+        * TestEngine side.
+        */
+        TInt LoadLoggerSettingsFromCommandLine( const RMessage2& aMessage  );
+
+        /**
+        * Get Logger settings. Mainly use from Logger side.
+        */
+        TInt GetLoggerSettings( const RMessage2& aMessage );
+
+        /**
+        * 
+        */
+        TInt SetLoggerOutputPath( const RMessage2& aMessage );
+
+        /**
+        * 
+        */
+        TInt ResetLoggerSettings( const RMessage2& aMessage );        
+        
+        /**
+        * PanicClient panics the user of CLoggerSetting
+        */
+        void PanicClient( TInt aPanic, const RMessage2& aMessage ) const;
+
+    public: // Functions from base classes
+
+        /**
+        * ServiceL handles the messages to CSettingServer
+        */
+        virtual void ServiceL( const RMessage2& aMessage );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+    private:
+        TInt UpdateLoggerSettings(TDesC& aKey,TDesC& aValue);
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CLoggerSetting();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CSettingServer* aServer );
+
+        /**
+        * Real resource reservation routine
+        */
+        TInt ReserveInternalL( const RMessage2& aMessage );
+
+        /**
+        * Read Logger default parameters for initialization file.
+        */
+        TInt ReadLoggerDefaults();
+
+    public:     // Data
+        // None
+   
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to "parent"
+        CSettingServer*         iSettingServer;
+
+        // Indication for reading logger defaults from initialization file.
+        TBool                   iReadOrUpdateLoggerDefaults;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif // SETTING_SERVER_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/SettingServerClientServer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,81 @@
+/*
+* 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: This file contains the header file of the 
+* CSettingServer.
+*
+*/
+
+#ifndef SETTINGSERVERCLIENTSERVER_H
+#define SETTINGSERVERCLIENTSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// The server version.
+// A version must be specified when creating a session with the server.
+const TUint KSettingServerMajorVersionNumber=0;
+const TUint KSettingServerMinorVersionNumber=1;
+const TUint KSettingServerVersionNumber=1;
+
+// Server heap size
+const TUint KDefaultHeapSize = 0x10000;     // 64 K
+const TUint KMaxHeapSize     = 0x20000;     // 128 K 
+
+// MACROS
+// none
+
+// DATA TYPES
+
+// Panic reasons
+enum TSettingServerPanic
+    {
+    EBadRequest,
+    EBadDescriptor,
+    EMainSchedulerError,
+    ESvrCreateServer,
+    ECreateTrapCleanup,
+    ENoStartupInformation,
+    ETooManyCloseSessions,
+    EPopFromEmptyStack
+    };
+
+// Opcodes used in message passing between client and server
+enum TSettingServerRequests
+    {
+    // RSettingServer requests
+    ESettingServerCloseSession,
+
+    // RLoggerSetting requests
+    ELoadLoggerSettingsFromIniFile,
+    ELoadLoggerSettingsFromCommandLine,
+    EGetLoggerSettings,
+
+    // e.g. SetAttribute requests
+    ESetLoggerOutputPath,
+    
+    // Reset logger settings to default value
+    EResetLoggerSettings,
+    };
+
+// Struct to pass parameters to server thread
+struct TThreadStartSetting
+    {
+    TFileName  iName;         // Server name
+    RThread    iServerThread; // The server thread
+    RSemaphore iStarted;      // Startup syncronisation semaphore   
+    TInt       iStartupResult;// Start-up result
+    };
+
+#endif /* SETTINGSERVERCLIENTSERVER_H */
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/StifPythonFunEng.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* 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: This file contains the header of additional 
+* functions needed for Python support and used in PythonScripter, 
+* TestEngine and TestCombiner.
+*
+*/
+
+#ifndef STIFPYTHONFUNENG_H
+#define STIFPYTHONFUNENG_H
+
+//  INCLUDES
+#include <E32Base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+TInt GetNewIndexForThreadL(void);
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+// None
+
+#endif        // STIFPYTHONFUNENG_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestCallBack.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,113 @@
+/*
+* 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: This file contains the header file of the 
+* CTestCallBack class.
+*
+*/
+
+#ifndef TESTCALLBACK_H
+#define TESTCALLBACK_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Simple class for callbacks.
+
+class CCallBack 
+    :public CAsyncCallBack
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * C++ constructor.
+        */
+        //CCallBack( TInt aPriority ):CAsyncCallBack( aPriority ) {}
+
+        /**
+        * C++ constructor.
+        */
+        CCallBack( TCallBack& aCallBack, TInt aPriority ):
+            CAsyncCallBack( aCallBack, aPriority ) {}
+
+        /**
+        * C++ destructor.
+        */
+        ~CCallBack(){ Cancel(); }
+
+    public: // New functions
+        /**
+        * Return reference to TRequestStatus member.
+        */
+        TRequestStatus& Status(){ return iStatus; }
+
+        /**
+        * Set CCallBack active.
+        */
+        void SetActive()
+            { 
+            iStatus = KRequestPending; 
+            CActive::SetActive(); 
+            };
+
+    public: // Functions from base classes
+
+        /**
+        * Handle completion.
+        */
+        void RunL(){ iCallBack.CallBack(); }
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // TESTCALLBACK_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestCaseController.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,907 @@
+/*
+* 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: This file contains the header file of the 
+* CTestCaseController, the CTestProgressNotifier and the 
+* CTestEventNotifier.
+*
+*/
+
+#ifndef TEST_CASE_CONTROLLER_H
+#define TEST_CASE_CONTROLLER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <stifinternal/TestServerClient.h>
+#include <atslogger.h>
+#include "TestEngine.h"
+#include "TestCallBack.h"
+
+#include "StifHWReset.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+typedef CStifHWReset*( *CTestInterfaceFactory )();
+
+// FORWARD DECLARATIONS
+class CTestModuleController;
+class CTestReport;
+class CTestCaseTimeout;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestCaseController is an active object used for running the test case
+// using the RTestExecution API.
+class CTestCaseController
+        : public CActive
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+
+        // TTestCaseStatus defines the status of test case
+        enum TTestCaseStatus
+            {
+            ETestCaseIdle,
+            ETestCaseRunning,
+            ETestCaseCompleted,
+            ETestCaseTimeout,
+            ETestCaseSuicided, //test case has killed itself
+            };
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestCaseController* NewL( CTestEngine* aEngine,
+            CTestReport* aTestReport,
+            CAtsLogger& aAtsLogger,
+            RTestExecution aTestExecution, 
+            const TTestInfo& aTestInfo );
+
+        /**
+        * Destructor.
+        */
+        ~CTestCaseController();
+
+    public:     // New functions
+
+        /**
+        * StartL starts the CTestCaseController active object.
+        */
+        void StartL( const RMessage2& aMessage );
+
+        /**
+        * Timeouts a testcase
+        */
+        void Timeout();
+
+        /**
+        * Kills a testcase
+        */
+        void Suicide(TStopExecutionType aType, TInt aCode);
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+        
+        /**
+        * Get testcase info(test module, config file, test case, etc).
+        */
+        void GetTestCaseInfo( TTestInfo& aTestInfo );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestCaseController( CTestEngine* aEngine, 
+                             CTestReport* aTestReport,
+                             CAtsLogger& aAtsLogger,
+                             RTestExecution aTestExecution,
+                             const TTestInfo& aTestInfo );
+        
+        /**
+        * Generates XML log about the test case.
+        */
+        void GenerateXmlLogL();
+
+    public:     // Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to CTestEngine
+        CTestEngine*        iEngine;
+
+        // Pointer to Test Report
+        CTestReport*        iTestReport;
+
+        // Handle to RTestExecution
+        RTestExecution      iTestExecution;
+
+        // Pointer to timeout handler
+        CTestCaseTimeout*    iTimeout;
+
+        // Test Info
+        TTestInfo           iTestInfo;
+
+        // Internal state
+        TTestCaseStatus     iState;
+
+        // Test Result
+        TFullTestResult     iResult;
+        TFullTestResultPckg iResultPckg;
+
+        // Message to be completed when case is finished
+        RMessage2            iMessage;
+
+        // AtsLogger
+        CAtsLogger&         iAtsLogger;
+
+        // RDebug logging for testcase status
+        CStifLogger*        iRDebugLogger;
+
+        // Stop execution type
+        TStopExecutionType  iStopExecutionType;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+
+        friend class CTestRemoteCmdNotifier;
+
+    };
+
+// DESCRIPTION
+// CTestProgressNotifier is an active object used for notifications called from
+// Test Module using the RTestExecution API.
+class CTestProgressNotifier
+        : public CActive
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+
+        // TTestProgressStatus defines the status of notification
+        enum TTestProgressStatus
+            {
+            ETestProgressIdle,
+            ETestProgressPending,
+            ETestProgressCompleted
+            };
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestProgressNotifier* NewL( CTestEngine* aEngine, 
+                             RTestExecution aTestExecution );
+
+        /**
+        * Destructor.
+        */
+        ~CTestProgressNotifier();
+
+    public:     // New functions
+
+        /**
+        * StartL starts the CTestProgressNotifier active object.
+        */
+        void StartL( const RMessage2& aMessage );
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestProgressNotifier( CTestEngine* aEngine, 
+                               RTestExecution aTestExecution );
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to CTestEngine
+        CTestEngine*        iEngine;
+
+        // Handle to RTestExecution
+        RTestExecution      iTestExecution;
+
+        // Internal state
+        TTestProgressStatus iState;
+
+        // Test Progress
+        TTestProgress       iProgress;
+        TTestProgressPckg   iProgressPckg;
+
+        // Message to be completed when notification is completed
+        RMessage2           iMessage;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// CTestEventNotifier is an active object used for event notify from
+// Test Module using the RTestExecution API.
+class CTestEventNotifier
+        : public CActive
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+
+        // TTestEventStatus defines the status of notification
+        enum TTestEventStatus
+            {
+            ETestEventIdle,
+            ETestEventPending,
+            ETestEventCompleted
+            };
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestEventNotifier* NewL( CTestEngine* aEngine,  
+            RTestExecution aTestExecution );
+
+        /**
+        * Destructor.
+        */
+        ~CTestEventNotifier();
+        
+    public:     // New functions
+
+        /**
+        * StartL starts the CTestEventNotifier active object.
+        */
+        void Start();
+
+        /**
+        * For event control.
+        */
+        void CtlEvent( const TEventIf& aEvent, TRequestStatus& aStatus );
+
+		/**
+		* Check if CtlEvent should be called
+		*/
+        TBool CheckCtlEvent( const TEventIf& aEvent );
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:      // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestEventNotifier( CTestEngine* aEngine,
+             RTestExecution aTestExecution);
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to CTestEngine
+        CTestEngine* iEngine;
+
+        // Handle to RTestExecution
+        RTestExecution iTestExecution;
+
+        // Internal state
+        TTestEventStatus iState;
+
+        // Event interface
+        TEventIf iEvent;
+        TEventIfPckg iEventPckg;
+        TEventIf iEventNotify;
+        TEventIfPckg iEventNotifyPckg;
+
+        // Event array
+        RPointerArray<HBufC> iEventArray;
+
+        // Associated event controller
+        CTestEventController* iController;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// CTestEventController is used for event controlling from
+// TestEngine.
+class CTestEventController
+        : public CBase
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestEventController* NewL( CTestEngine* aEngine,
+                                           const TEventIf& aEvent,
+                                           TRequestStatus* aStatus );
+  
+        static CTestEventController* NewL( CTestEngine* aEngine,
+                                           const TEventIf& aEvent,
+                                           RMessage2& aMessage );
+
+        /**
+        * Destructor.
+        */
+        ~CTestEventController();
+
+    public:     // New functions
+        /**
+        * Event complete.
+        */ 
+        void EventComplete();
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( TRequestStatus* aStatus );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( RMessage2& aMessage );
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestEventController( CTestEngine* aEngine, const TEventIf& aEvent );
+
+        /**
+        * Check all events.
+        */ 
+        TBool CheckEventsL();
+
+        /**
+        * Check client events.
+        */ 
+        TBool CheckClientEventsL();
+
+        /**
+        * Check testcase events.
+        */ 
+        TBool CheckTestcaseEventsL(); 
+
+        /**
+        * Callback for event controller.
+        */ 
+        static TInt EventCallBack( TAny* aTestEventController );
+
+    public:     // Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to CTestEngine
+        CTestEngine*    iEngine;
+
+        // Either of these is completed when ready
+        // If aRequestStatus exists, it is completed,
+        // otherwise aMessage is completed.
+        TRequestStatus* iRequestStatus;
+        RMessage2        iMessage;
+
+        // Event interface
+        TEventIf iEvent;
+        TEventIfPckg iEventPckg;
+
+        // Number of active event commands
+        TInt iActiveEventCmds;
+        
+        RPointerArray<CCallBack> iEventCallBacks;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// CTestCaseTimeout is used for time controlling
+class CTestCaseTimeout
+        : public CActive
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+        // None
+         
+    public:     // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestCaseTimeout* NewL( CTestCaseController* aCase,
+                     TTimeIntervalMicroSeconds aTimeout );
+
+        /**
+        * Destructor.
+        */
+        ~CTestCaseTimeout();
+        
+    public:     // New functions
+        
+        /**
+        * Starts timeout counting
+        */
+        void Start();
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(CTestCaseController* aCase,
+               TTimeIntervalMicroSeconds aTimeout );
+
+        /**
+        * C++ constructor.
+        */
+        CTestCaseTimeout();
+
+    public:     // Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CTestCaseController* iCase;
+        TTimeIntervalMicroSeconds iTimeout;
+        RTimer iTimer;
+        
+        // Storage for testcase timeout.
+        TTime iTestCaseTimeout;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+    
+// DESCRIPTION
+// CTestProgressNotifier is an active object used for notifications called from
+// Test Module using the RTestExecution API.
+class CTestRemoteCmdNotifier
+        : public CActive
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+
+        // TTestProgressStatus defines the status of notification
+        enum TTestProgressStatus
+            {
+            ETestProgressIdle,
+            ETestProgressPending,
+            ETestProgressCompleted
+            };
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestRemoteCmdNotifier* NewL( CTestEngine* aEngine, 
+                             RTestExecution aTestExecution ,
+                             CTestCaseController* aTestCaseController,
+                             CAtsLogger& aAtsLogger );
+
+        /**
+        * Destructor.
+        */
+        ~CTestRemoteCmdNotifier();
+
+    public:     // New functions
+
+        /**
+        * StartL starts the CTestRemoteCmdNotifier active object.
+        */
+        //void StartL( const RMessage& aMessage );
+
+        /**
+        * EnableReceive prepares to start active object
+        */
+        void EnableReceive( const RMessage2& aMessage );
+
+        /**
+        * GetReceivedMsg get received message.
+        */
+        void GetReceivedMsg( const RMessage2& aMessage );
+
+        /**
+        * Start starts the CTestCaseController active object.
+        */
+        void Start( const RMessage2& aMessage );
+
+        /**
+        * CancelReq cancels the request.
+        */
+        void CancelReq();
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestRemoteCmdNotifier( CTestEngine* aEngine, 
+                               RTestExecution aTestExecution,
+                               CTestCaseController* aTestCaseController,
+                               CAtsLogger& aAtsLogger );
+
+        /**
+        * Loads dynamically reset module.
+        */
+        TInt DynamicResetModule( CTestModuleIf::TRebootType aResetType );
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to CTestEngine
+        CTestEngine*        iEngine;
+
+        // Handle to RTestExecution
+        RTestExecution      iTestExecution;
+
+        // Internal state
+        TTestProgressStatus iState;
+
+        // Remote command's definition
+        TStifCommand          iRemoteType;
+        TStifCommandPckg      iRemoteTypePckg;
+                
+        TInt                    iMsgSize;              
+        TPckg<TInt>             iMsgSizePckg;              
+
+        // Message to be completed when notification is completed
+        RMessage2           iMessage;
+        
+        HBufC8*             iReceivedMsg;
+
+        TInt                iRebootCode;
+        TName               iRebootName;
+
+        // Pointer to CTestCaseController
+        CTestCaseController* iTestCaseController;
+
+        TBool               iMessageAvail;
+        
+        CAtsLogger&         iAtsLogger;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// CTestCommandNotifier is an active object used for command notify from
+// Test Module using the RTestExecution API.
+// It was created to allow test case to kill itself.
+class CTestCommandNotifier: public CActive
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+        // None
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestCommandNotifier* NewL(CTestEngine* aEngine, RTestExecution aTestExecution);
+
+        /**
+        * Destructor.
+        */
+        ~CTestCommandNotifier();
+
+    public:     // New functions
+
+        /**
+        * StartL starts the CTestCommandNotifier active object.
+        */
+        void Start();
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError(TInt aError);
+
+    protected:      // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parametric C++ constructor.
+        */
+        CTestCommandNotifier(CTestEngine* aEngine, RTestExecution aTestExecution);
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to CTestEngine
+        CTestEngine*     iEngine;
+
+        // Handle to RTestExecution
+        RTestExecution   iTestExecution;
+
+        // Command to be sent
+        TCommand                        iCommand;
+        TCommandPckg                    iCommandPckg;
+        TBuf8<KMaxCommandParamsLength2>  iParamsPckg;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+#endif // TEST_CASE_CONTROLLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestEngine.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,784 @@
+/*
+* 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: This file contains the header file of the CTestEngine.
+*
+*/
+
+#ifndef TEST_ENGINE_H
+#define TEST_ENGINE_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifLogger.h>
+#include <StifParser.h>
+#include <stifinternal/TestServerClient.h>
+#include <TestEngineClient.h>
+#include "TestEngineCommon.h"
+#include "TestEngineEvent.h"
+#include "STIFTestFrameworkSettings.h"
+#include "SettingServerClient.h"
+#include "STIFMeasurement.h"
+#include "TestModuleInfo.h"
+
+// CONSTANTS
+// Heap sizes needed for creating server thread.
+const TUint KTestEngineMinHeapSize = 0x10000;
+const TUint KTestEngineMaxHeapSize = 0x100000;
+
+// MACROS
+// None
+
+
+class CRebootParams
+    :public CBase
+    {
+    public:     // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CRebootParams* NewL();
+
+        /**
+        * Destructor of CTestEngineServer.
+        */
+        ~CRebootParams();
+        
+        // Setters
+        void SetTestModuleNameL( const TDesC& aName ); 
+        void SetTestCaseFileNameL( const TDesC& aName ); 
+        void SetTestCaseTitleL( const TDesC& aName ); 
+        void SetTestCaseStateL( const TDesC& aName ); 
+
+     
+     private:    // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CRebootParams();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+        
+      public: // Data
+        TInt iCaseNumber;
+        TInt iStateCode;
+
+        TPtrC iTestModule;
+        TPtrC iTestCaseFile;
+        TPtrC iTestCaseTitle;
+        TPtrC iStateName;
+              
+      private: // Data   
+        HBufC* iTestModuleBuf;
+        HBufC* iTestCaseFileBuf;
+        HBufC* iTestCaseTitleBuf;
+        HBufC* iStateNameBuf;
+        
+    };
+
+// FUNCTION PROTOTYPES
+// None
+
+// DESCRIPTION
+// Class used to store version information of test module.
+// iTestModuleName field keeps name of test module dll
+// iVersion keeps version of test module dll
+        
+    struct TTestModuleVersionInfo
+    {
+    	TFileName iTestModuleName;
+    	TInt iMajor;
+    	TInt iMinor;
+    	TInt iBuild;
+    };
+
+// DESCRIPTION
+// CTestEngine is a session class.
+// Session for the CTestEngineServer server, to a single client-side session
+// a session may own any number of CCounter objects
+
+class CTestCase;
+class CTestEventController;
+class CTestModuleController;
+class CTestEngineServer;
+class CTestReport;
+
+class CTestEngine
+        : public CSession2
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CTestEngine* NewL( CTestEngineServer* aServer );
+
+        /**
+         * Destructor.
+         */
+        ~CTestEngine();
+                
+        /**
+        * Leave with notify
+        */
+        void LeaveWithNotifyL( TInt aCode, const TDesC& aText );
+
+        /**
+        * If error leave with notify
+        */
+        void LeaveIfErrorWithNotify( TInt aCode, const TDesC& aText );
+
+        /**
+        * Leave with notify
+        */
+        void LeaveWithNotifyL( TInt aCode );
+
+        /**
+        * If error leave with notify
+        */
+        void LeaveIfErrorWithNotify( TInt aCode );
+
+        /**
+        * Close the session to CTestEngineServer.
+        */
+        void CloseSession();
+
+    public:     // New functions
+
+        /**
+        * PanicClient panics the user of CTestEngine ( RTestEngine user )
+        */
+        void PanicClient( TTestEnginePanic aPanic, const RMessage2& aMessage ) const;
+
+        /**
+        * NumResources is used to provide reserver resources to client.
+        */
+        void NumResources( const RMessage2& aMessage );
+
+        /**
+        * Return the number of resources owned by the session. 
+        * Required by CSession if derived class implements resource
+        * mark-start and mark-end protocol.
+        */
+        TInt CountResources();
+
+        /**
+        * Callback to inform that enumeration of test cases is completed
+        */
+        void EnumerationCompleted( TInt aCount, TInt aError = KErrNone );
+
+
+        /**
+        * Callback to check state event status.
+        */
+        TBool IsStateEventAndSet( const TName& aEventName );
+
+        /**
+        * Callback to control events.
+        */
+        CTestEventController* CtlEventL( const TEventIf& aEvent, 
+                                         TRequestStatus& aStatus );
+
+        /**
+        * Return the pointer to CStifLogger owned by CTestEngineServer
+        */
+        CStifLogger* Logger();
+
+        /**
+        * Return testcases.
+        */
+        RPointerArray<CTestCase>& TestCaseArray(){ return iTestCaseArray; }
+
+        /**
+        * Return client events.
+        */
+        RPointerArray<TEventMsg>& ClientEvents(){ return iClientEvents; }
+
+        /**
+        * ErrorPrint print errors. This version is used to print engine own
+        * errors.
+        */
+        void ErrorPrint( const TInt aPriority, 
+                         TPtrC aError );
+
+        /**
+        * ErrorPrint print errors. This version is used to forward errors.
+        */
+        void ErrorPrint( TErrorNotificationPckg aError );
+
+        /**
+        * Write the Reboot related information to file.
+        */
+        TInt WriteRebootParams( TTestInfo& aTestInfo,
+                                TInt& aCode, TDesC& aName );
+
+        /**
+        * Read the Reboot related information from the file.
+        */
+        TInt ReadRebootParams( TTestInfo& aTestInfo, 
+                               TDes& aStateDes,
+                               TInt& aState );
+
+        /**
+        * Pause all test case(s) which are/is running.
+        */
+        void PauseAllTestCases();
+        
+        /**
+        * Flush ATS logger buffers.
+        */ 
+        void FlushAtsLogger();
+        
+        /**
+        * Get device reset module's DLL name.
+        */
+        TPtrC GetDeviceResetDllName();
+
+        /**
+        * Get measurements related information. Returns is measurement disable.
+        */
+        TInt StifMeasurement();
+        
+        /**
+        * For Recovering from serious testmodulecrash situations (KErrserverTerminated (-15))
+        * Clones TestModuleController
+        */
+        void TestModuleCrash( CTestModuleController* aTestModuleController );
+
+        /**
+        * Executes command received from test case.
+        * It was created to allow test case to kill itself.
+        */
+        void ExecuteCommandL(TCommand aCommand, TDesC8& aParamsPckg);
+
+        /**
+        * Returns new index for test module controller.
+        * This number is appended to module controller name.
+        * This method is used when option to run every test case in separate
+        * process is set to on.                        
+        */
+        TInt GetIndexForNewTestModuleController(void);
+
+        /**
+        * Return free module controller specified by given parameter.
+        * If it can't be found, new one will be created.                        
+        */
+        CTestModuleController* GetFreeOrCreateModuleControllerL(TTestInfo& aTestInfo,
+                                                                CTestModuleController** aRealModuleController);
+        TBool UITesting();
+        
+        TBool SeparateProcesses();
+
+    public:     // Functions from base classes
+
+        /**
+        * ServiceL handles the messages to CTestEngineServer
+        */
+        virtual void ServiceL( const RMessage2& aMessage );
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CTestEngine();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CTestEngineServer* aServer );
+
+        /**
+        * DispatchMessageL handles the messages to CTestEngineServer
+        */
+        void DispatchMessageL( const RMessage2& aMessage );
+
+        /**
+        * Get module controller by name
+        */
+        CTestModuleController* ModuleControllerByName(
+                                                const TName& aModuleName );
+
+        void SetTestEngineDefaultSettings();
+
+        /**
+        * Initialize the Test Engine.
+        */
+        void LoadConfigurationL( const RMessage2& aMessage );
+        /**
+         * Update Log Configuration.
+         */
+        void UpdateLogConfigurationL( const RMessage2& aMessage );
+        /**
+         * Update Engine Configuration .
+         */
+        void UpdateEngineConfigurationL( const RMessage2& aMessage );
+
+        /**
+        * Parse Test Engine defaults from STIF initialization
+        * file.
+        */
+        void ReadEngineDefaultsL( CStifParser* aParser,
+                                    CSTIFTestFrameworkSettings* aSettings );
+        /**
+        * Parse Test Engine defaults from command line.
+        * 
+        */
+        void ReadEngineFromCommandLineL(const TDesC& aCommand);
+
+        /**
+        * Parse Test modules and module information from STIFTestFramework
+        * initialization file.
+        */
+        void ReadTestModulesL( CStifParser* aParser );
+
+        /**
+        * 
+        */
+        void TestModuleConfigFileL( CTestModuleController* aModule,
+                                        CStifSectionParser* aSectionParser,
+                                        TDesC& aTag );
+
+        /**
+        * Sets attributes to Test Framework
+        */
+        void SetAttributeL( const RMessage2& aMessage );
+
+        /**
+        * Adds new Test Module
+        */
+        void AddTestModuleL( const RMessage2& aMessage );
+
+        /**
+        * Removes Test Module
+        */
+        TInt RemoveTestModuleL( const RMessage2& aMessage );
+        
+        /**
+        * Close Test Engine
+        */
+        void CloseTestEngineL();
+
+        /**
+        * Adds new config file to Test Module
+        */
+        void AddConfigFileL( const RMessage2& aMessage );
+
+        /**
+        * Removes config file from test module
+        */
+        void RemoveConfigFileL( const RMessage2& aMessage );
+        
+        /**
+        * Enumerates test cases
+        */
+        void EnumerateTestCasesL( const RMessage2& aMessage );
+
+        /**
+        * Get test cases
+        */
+        void GetTestCasesL( const RMessage2& aMessage );
+
+        /**
+        * Cancel outstanding asynchronous request
+        */
+        void CancelAsyncRequest( const RMessage2& aMessage );
+
+        /**
+        * Event system control.
+        */
+        void EventControlL( const RMessage2& aMessage );
+
+        /**
+        * Update state event list.
+        */ 
+        void UpdateEventL( const TEventIf& aEvent );
+
+        /**
+        * Handles error notifications
+        */
+        void HandleErrorNotificationL( const RMessage2& iMessage );
+
+        /**
+        * Get Logger's overwrite parameters
+        */
+        void LoggerSettings( const RMessage2& iMessage );
+
+        /**
+        * Close logger settings
+        */
+        void CloseLoggerSettings();
+
+        /**
+        * Process error queue.
+        */
+        void ProcessErrorQueue();
+
+        /**
+        * Resolve the correct CTestCase object
+        */
+        CTestCase* TestCaseByHandle( TUint aHandle, const RMessage2& aMessage );
+
+        /**
+        * Create CTestCase subsession.
+        */
+        void NewTestCaseL( const RMessage2& aMessage );
+
+        /**
+        * Destroy the created CTestCase subsession.
+        * Cannot fail - can panic client.
+        */
+        void DeleteTestCase( TUint aHandle );
+     
+        /**
+        * Parse the Reboot related information from the file.
+        */
+        TInt ParseRebootParamsL();
+
+        /**
+        * Set measurements related information, enable measurement.
+        */
+        TInt EnableStifMeasurement( const TDesC& aInfoType );
+
+        /**
+        * Set measurements related information, disable measurement.
+        */
+        TInt DisableStifMeasurement( const TDesC& aInfoType );
+
+        /**
+        * Parse and search for module info and fill list of modules.
+        */
+        void ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd);
+
+        /**
+        * Add test case info to test report.
+        */
+        TInt AddTestCaseToTestReport(const RMessage2& aMessage);
+        
+        
+        /**
+        * CreateTestReport
+        */
+        CTestReport* RetrieveTestReport();
+        
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+        // Test module array
+        RPointerArray<CTestModuleController> iModules;
+
+        // Object container for this session
+        CObjectCon*                 iContainer;
+
+        // Object index which stores objects (CTestCase instances)
+        // for this session
+        CObjectIx*                  iTestCases;
+        
+        // Array of CTestCase instances
+        RPointerArray<CTestCase>    iTestCaseArray;
+
+        // Pointer to owning server
+        CTestEngineServer*          iTestEngineServer;
+
+        // Device reset module's DLL name(Reboot)
+        HBufC*                      iDeviceResetDllName;
+
+        // Total number of resources allocated
+        TInt                        iResourceCount;
+
+        // Test Engine's initialization file
+        HBufC*                      iIniFile;
+
+        // Test Report
+        CTestReport*                iTestReport;
+        // Test Report Mode
+        TUint                       iReportMode;
+        // Test Report Output Type
+        TUint                       iReportOutput;        
+        
+        // Test report settings
+        CTestReportSettings*         iTestReportSettings;        
+        
+        // RMessage for ongoing operation
+        RMessage2                   iEnumerationMessage;
+
+        // Test case count used in EnumerateTestCases
+        TInt                        iCaseCount;
+        // Error code used in EnumerateTestCases
+        TInt                        iEnumError;
+
+        // Tell if message can be completed
+        TBool                       iComplete;
+
+        // Error code for complete of message
+        TInt                        iReturn;
+
+        // State event Array
+        RPointerArray<HBufC>        iStateEvents;
+        
+        // Client event Array
+        RPointerArray<TEventMsg>    iClientEvents;
+
+        // Number of enumerated test modules currently
+        TInt                        iEnumerateModuleCount;
+
+        // RMessage for error notifications
+        TBool                       iErrorMessageAvailable;
+        RMessage2                   iErrorMessage;
+        RArray<TErrorNotification>    iErrorQueue;
+
+        // Reboot path definition
+        HBufC*                      iRebootPath;
+        // Reboot file name definition
+        HBufC*                      iRebootFilename;
+        // Reboot default path definition
+        TPtrC                       iRebootDefaultPath;
+        // Reboot default file name definition
+        TPtrC                       iRebootDefaultFilename;
+
+        // Handle to Setting server.
+        RSettingServer              iSettingServer;
+        
+        CRebootParams*              iRebootParams;
+        TBool                       iIsTestReportGenerated;
+
+        // For indication is measurement disable
+        TInt                        iDisableMeasurement;
+        
+        // Default timeout value. 0 - no timeout value
+        TInt64                      iDefaultTimeout;
+
+        // Counter for created TestModuleControllers
+        TInt                        iIndexTestModuleControllers;
+        
+        // Is this UI testing?
+        // If yes, then Test Engine works in a specific way.
+        // It creates new process for every test scripter's test case
+        // and deletes it after test case has finished.
+        TBool                       iUITestingSupport;
+
+        // Should every test case be executed in separate process?
+        // This option is similar to iUITestingSupport, however
+        // it does not delete the process after test case is finished.
+        TBool                       iSeparateProcesses;
+        
+        //RPointerArray of versions of test modules
+        RPointerArray<TTestModuleVersionInfo> iTestModulesVersionInfo;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+    
+// DESCRIPTION
+// CTestCase represents a subsession object in the CTestEngineServer.
+// A session may own any number of CTestCase objects
+
+class CTestProgressNotifier;
+class CTestCaseController;
+class CTestEventNotifier;
+class CTestRemoteCmdNotifier;
+class CTestCommandNotifier;
+class CTestCase
+        : public CObject
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CTestCase* NewL( CTestEngine* aEngine,
+            CTestModuleController* aModuleController,
+            CTestReport* aTestReport,
+            TTestInfo& aTestInfo,
+            CTestModuleController* aRealModuleController);
+
+        /**
+        * Destructor of CTestCase.
+        */
+        ~CTestCase();
+
+        /**
+        * Close Test Case.
+        */
+        void CloseTestCase();
+
+    public:     // New functions
+
+        /**
+        * Run test case.
+        */
+        void RunTestCaseL( const RMessage2& aMessage );
+
+        /**
+        * Suspend the test case execution.
+        */
+        TInt Pause();
+
+        /**
+        * Resume the suspended test case execution.
+        */
+        TInt Resume();
+
+        /**
+        * Notify progress from Test Module.
+        */
+        void NotifyProgressL( const RMessage2& aMessage );
+
+        /**
+        * Notify remote commands from Test Module.
+        */
+        void NotifyRemoteTypeL( const RMessage2& aMessage );
+
+        /**
+        * Notify remote commands from Test Module.
+        */
+        void NotifyRemoteMsgL( const RMessage2& aMessage );
+        
+        /**
+        * Cancel outstanding asynchronous request.
+        */
+        void CancelAsyncRequest( const RMessage2& aMessage );
+
+        /**
+        * Return the name of Test Module.
+        */
+        const TDesC& ModuleName();
+
+        /**
+        * For event control.
+        */
+        void CtlEvent( const TEventIf& aEvent, TRequestStatus& aStatus );
+
+		/**
+		* Check if CtlEvent should be called
+		*/
+        TBool CheckCtlEvent( const TEventIf& aEvent );
+
+        /**
+        * Executes command received from test case.
+        */
+        void ExecuteCommandL(TCommand aCommand, TDesC8& aParamsPckg);
+        
+        /**
+        * Return module controller and real module controller.
+        */
+        CTestModuleController* GetModuleControllers(CTestModuleController** aRealModuleController);
+        
+        /**
+        * Set new module controller for test case (only in case when original controller crashed).
+        */
+        void ResetModuleController(CTestModuleController* aModuleController);
+
+        /**
+        * Set new real module controller for test case (only in case when original controller crashed).
+        */
+        void ResetRealModuleController(CTestModuleController* aRealModuleController);
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CTestCase( CTestEngine* aEngine,
+            CTestModuleController* aModuleController,
+            TTestInfo& aTestInfo,
+            CTestModuleController* aRealModuleController);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CTestReport* aTestReport, TTestInfo& aTestInfo );
+
+        /**
+        * Return the pointer to CStifLogger owned by CTestEngineServer
+        */
+        CStifLogger* Logger();
+
+    public:     // Data
+    
+    protected:  // Data
+
+        // Session owning us
+        CTestEngine*            iTestEngine;
+
+    private:    // Data
+
+        // Test Module
+        CTestModuleController*  iTestModule;
+
+        // Test case controller
+        CTestCaseController*    iTestCaseController;
+
+        // Notifier for print
+        CTestProgressNotifier*  iTestCasePrint;
+
+        // Notifier for event
+        CTestEventNotifier*     iTestCaseEvent;
+
+        // Notifier for remote commands
+        CTestRemoteCmdNotifier* iTestCaseRemoteCmd;
+
+        // Handle to RTestServer
+        RTestServer             iTestServer;
+
+        // Handle to RTestExecution
+        RTestExecution          iTestExecution;
+
+        // Notifier for commands
+        CTestCommandNotifier*   iTestCaseCommand;
+        
+        // Real Test Module (when test module controller is testscripter)
+        CTestModuleController*  iRealModuleController;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif // TEST_ENGINE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestEngineClientServer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,87 @@
+/*
+* 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: This file contains the header file of the CTestEngine.
+*
+*/
+
+#ifndef TESTENGINECLIENTSERVER_H
+#define TESTENGINECLIENTSERVER_H
+
+//  INCLUDES
+//#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+// none
+
+// Server name
+_LIT( KTestEngineServerName, "TestFrameworkEngine" );
+_LIT( KTestEngineServerExe,"STFTestEngineSrv.exe");      // EXE name
+const TUid KTestEngineServerUid3 = {0x2002BC9C};
+
+// The server version.
+// A version must be specified when creating a session with the server.
+const TUint KTestEngineMajorVersionNumber = 0;
+const TUint KTestEngineMinorVersionNumber = 2;
+const TUint KTestEngineBuildVersionNumber = 1;
+
+// MACROS
+// None
+
+// DATA TYPES
+// Opcodes used in message passing between client and server
+enum TTestEngineRequests
+    {
+    // RTestEngine requests
+    ETestEngineLoadConfiguration,
+    ETestEngineUpdateLogConfiguration,
+    ETestEngineUpdateEngineConfiguration,
+    ETestEngineSetAttribute,
+    ETestEngineAddTestModule,
+    ETestEngineRemoveTestModule,
+    ETestEngineAddConfigFile,
+    ETestEngineRemoveConfigFile,
+    ETestEngineEnumerateTestCases,
+    ETestEngineGetTestCases,    
+    ETestEngineCancelAsyncRequest,
+    ETestEngineEvent,
+    ETestEngineErrorNotification,
+    ETestEngineLoggerSettings,
+    ETestEngineReportTestCase, //Add info about executed test case to test report. Used by reboot mechanism
+
+    // RTestCase requests
+    ETestCaseCreateSubSession,
+    ETestCaseCloseSubSession,
+    ETestCaseRunTestCase,
+    ETestCasePause,
+    ETestCaseResume,
+    ETestCaseNotifyProgress,
+    ETestCaseNotifyRemoteType,
+    ETestCaseNotifyRemoteMsg,
+    ETestCaseCancelAsyncRequest,
+    ETestCaseNotifyCommand,
+    };
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+// None
+
+#endif /* TESTENGINECLIENTSERVER_H */
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestEngineCommon.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,77 @@
+/*
+* 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: This file contains the header file of the CTestEngine.
+*
+*/
+
+#ifndef TESTENGINECOMMON_H
+#define TESTENGINECOMMON_H
+
+//  INCLUDES
+#include <StifLogger.h>
+
+// DATA TYPES
+
+// Panic reasons
+enum TTestEnginePanic
+    {
+    EBadRequest,
+    EBadDescriptor,
+    EMainSchedulerError,
+    ESvrCreateServer,
+    ECreateTrapCleanup,
+    EBadSubsessionHandle,
+    ENoStartupInformation,
+    EInvalidModuleName,
+    EReqPending,
+    EDoCancelDisorder,
+    ECancelAsyncIPCError,
+    EEventPanic
+    };
+
+// Struct to Test report settings
+class CTestReportSettings
+    {
+    public:
+    
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CTestReportSettings* NewL();
+
+
+       ~CTestReportSettings();
+       
+    private:
+       CTestReportSettings();
+       /**
+       * By default Symbian OS constructor is private.
+       */
+       void ConstructL();
+
+    public:
+
+        TBool                   iCreateTestReport; // Test report creation mode
+        HBufC*                  iPath;             // Test report path
+        HBufC*                  iName;             // Test report name
+        CStifLogger::TLoggerType iFormat;          // Test report file type
+        CStifLogger::TOutput    iOutput;           // Test report output
+        TBool                   iOverwrite;        // Test report overwrite
+        TBool                   iXML;              // Test report in xml format
+
+    };
+
+#endif /* TESTENGINECOMMON_H */
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestEngineEvent.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,145 @@
+/*
+* 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: This file contains the header file of the event 
+* interface.
+*
+*/
+
+#ifndef TESTENGINEEVENT_H
+#define TESTENGINEEVENT_H
+
+//  INCLUDES
+#include <StifTestEventInterface.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+// None
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Interface class for the test system.
+class TEventMsg
+    :public TEventIf
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+        // None
+
+    public:     // Constructors and destructor
+        /**
+        * C++ default constructor.
+        */
+        TEventMsg();
+
+        /**
+        * C++ destructor.
+        */
+        ~TEventMsg();
+
+    public:     // New functions
+        
+        /**
+        * Set event.
+        */
+        void Set( TEventType aEventType );
+
+        /**
+        * Wait event.
+        */
+        void Wait( const RMessage2& aMessage );
+            
+        /**
+        * Cancel pending Wait.
+        */
+        void CancelWait();
+             
+        /**
+        * Release event. Unset released.
+        */
+        void Release();
+        
+        /**
+        * Unset event. Blocks until Release is called.
+        */
+        void Unset( TRequestStatus& aStatus );
+        
+    public:     // Functions from base classes
+        // None
+        
+    protected:  // New functions
+        // None
+        
+    protected:  // Functions from base classes
+        // None
+        
+    private:
+        // None
+        
+    public:     //Data
+        // None
+        
+    protected:  // Data
+        // None
+        
+    private:    // Data
+        /**
+        * Wait RMessage
+        */
+        RMessage2 iWaitMsg;
+        
+        /**
+        * Wait pending
+        */
+        TBool iWaitPending;
+        
+        /**
+        * StateEventPending.
+        */ 
+        TBool iStateEventPending;
+        
+        /**
+        * Unset status.
+        */ 
+        TRequestStatus* iStatus;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+    };
+
+#endif      // TESTENGINEEVENT_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestEngineServer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,178 @@
+/*
+* 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: This file contains the header file of the CTestEngine.
+*
+*/
+
+#ifndef TESTENGINESERVER_H
+#define TESTENGINESERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "TestEngineCommon.h"
+
+// FORWARD DECLARATIONS
+class CTestEngineServerAutoShutdown;
+class CStifLogger;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestEngineServer is a server class.
+// Contains an object container index which provides subsessions with object
+// containers.
+class CTestEngineServer
+        : public CServer2
+    {
+    public:     // Enumerations
+        enum { ETestEngineServerPriority = CActive::EPriorityHigh };
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CTestEngineServer* NewL();
+
+        /**
+        * Destructor of CTestEngineServer.
+        */
+        ~CTestEngineServer();
+
+    public:     // New functions
+        /**
+        * Return object container, guaranteed to produce object containers with
+        * unique ids within the server.
+        */
+        CObjectCon* NewContainerL();
+
+        /**
+        * Delete container.
+        */
+        void DeleteContainer( CObjectCon* aContainer );
+
+        /**
+        * Inform Server that session is closed.
+        */
+        void SessionClosed();
+
+        /**
+        * PanicServer panics the CTestEngineServer
+        */
+        static void PanicServer( TTestEnginePanic aPanic );
+
+        void SetLoggerSettings( const TLoggerSettings& aLoggerSettings );
+        
+        const TLoggerSettings& GetLoggerSettings() const;
+                
+        /**
+        * Return the pointer to iLogger
+        */
+        CStifLogger* Logger();
+
+    public:     // Functions from base classes
+
+        /**
+        * NewSessionL creates new CTestEngineServer session.
+        */
+        CSession2* NewSessionL( const TVersion &aVersion,
+                                const RMessage2& aMessage ) const;
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CTestEngineServer();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+        void InitLoggerSettings();
+        
+        void InitLoggerL();
+    public:     // Data
+        
+    protected:  // Data
+
+    private:    // Data
+        // The server has an object container index which
+        // creates an object container for each session
+        CObjectConIx*           iContainerIndex; 
+
+        // Container count
+        TInt                    iSessionCount;
+        
+        // Auto shutdown timer used to shutdown TestEngine server after specified 
+        // time when last TestEngine session have been closed
+        CTestEngineServerAutoShutdown* iAutoShutdownTimer;
+
+        // Logger instance
+        CStifLogger*            iLogger;
+        
+        // Logger overwrite settings
+        TLoggerSettings         iLoggerSettings;
+        
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+
+// DESCRIPTION
+// CTestEngineServerAutoShutdown is timer class used to stop active scheduler after specified time
+class CTestEngineServerAutoShutdown : public CTimer
+    {
+    public:
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CTestEngineServerAutoShutdown* NewL();
+
+        /**
+         * Starts timer countdown.
+         */
+        void Start();
+    private:
+        /** 
+        * C++ default constructor.
+        */
+        CTestEngineServerAutoShutdown();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+        
+        
+        /**
+        * See CActive::RunL
+        */
+        void RunL();
+    };        
+        
+#endif /* TESTENGINESERVER_H */
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestEngineUtils.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#ifndef TESTENGINEUTILS_H_
+#define TESTENGINEUTILS_H_
+
+#include <e32base.h>
+#include <StifLogger.h>
+class CStifParser;
+
+class TTestEngineUtils
+    {
+public:
+    static TInt ParseLoggerDefaults( CStifParser* aParser, TLoggerSettings& aLoggerSettings, CStifLogger* aLogger  );
+    };
+
+#endif /* TESTENGINEUTILS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestModuleController.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,686 @@
+/*
+* 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: This file contains the header file of the 
+* CTestModuleController.
+*
+*/
+
+#ifndef TEST_MODULE_CONTROLLER_H
+#define TEST_MODULE_CONTROLLER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <atslogger.h>
+#include <StifTestInterface.h>
+#include <stifinternal/TestServerClient.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestEngine;
+class CBufferArray;
+class CTestScripterController;
+class CTestModuleController;
+
+// CLASS DECLARATION
+// None
+
+// CErrorPrinter is an active object which handles the execute test case
+// asynchronous request.
+class CErrorPrinter : public CActive
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CErrorPrinter* NewL( CTestEngine* aTestEngine );
+
+        /**
+        * Destructor of CErrorPrinter.
+        */
+        virtual ~CErrorPrinter();
+
+        /**
+        * Start
+        */
+        TInt StartL( RTestModule& aEngine );
+
+    public:     // New functions
+        // None
+
+    protected:  // New functions
+        // None
+
+    private:
+        /** 
+        * C++ default constructor.
+        */
+        CErrorPrinter();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CTestEngine* aEngine );
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:    // Functions from base classes
+       // None
+
+    public:     // Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestEngine*           iEngine;     // Pointer to main console
+
+         TErrorNotification     iError;      // Error notification
+         TErrorNotificationPckg iErrorPckg;  // Error package
+         RTestModule            iServer;     // Handle to TestModule
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CServerStateHandler class is an active object that handles server state
+// e.g. KErrServerTerminated
+NONSHARABLE_CLASS( CServerStateHandler )
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CServerStateHandler* NewL( CTestEngine* aTestEngine, CTestModuleController* aTestModuleController );
+
+        /**
+        * Destructor of CServerStateHandler.
+        */
+        virtual ~CServerStateHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        TInt StartL( RTestServer& aServer );
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CServerStateHandler( CTestEngine* aTestEngine, CTestModuleController* aTestModuleController );
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CTestEngine*           iEngine;          // Pointer to TestEngine
+        RThread                iServerThread;   // Handle to TestServer thread
+        CTestModuleController*  iTestModuleController;  //Pointer to TestModuleController
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// CTestModuleController is an active object used for controlling the test
+// module using the RTestModule API.
+
+class CTestModuleController
+        : public CActive 
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+
+    protected:    // Enumerations
+
+        // TTestModuleStatus defines the status of test module
+        enum TTestModuleStatus
+            {
+            ETestModuleIdle,
+            ETestModuleEnumerateCases,
+            ETestModuleEnumerateCasesCompleted,
+            };
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModuleController* NewL( CTestEngine* aEngine,
+                                            const TName& aName,
+                                            TBool aAfterReboot,
+                                            TBool aCreateTestScripterCont = EFalse,
+                                            CTestScripterController* aTestScripterController = NULL );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTestModuleController();
+
+    public:     // New functions
+
+        /**
+        * StartEnumerateL starts the CTestModuleController active object.
+        */
+        virtual void StartEnumerateL();
+
+        /**
+        * Init the test module
+        */
+        virtual void InitL( TFileName& aIniFile, const TDesC& aConfigFile );
+
+        /**
+        * Add config file
+        */
+        virtual void AddConfigFileL( TFileName& aConfigFile );
+
+        /**
+        * Remove config file
+        */
+        virtual void RemoveConfigFileL( TFileName& aConfigFile );
+
+        /**
+        * Get Test Cases
+        */
+        virtual CFixedFlatArray<TTestInfo>* TestCasesL();
+
+        /**
+        * Free used memory for test cases
+        */
+        virtual void FreeTestCases();
+
+        /**
+        * Return handle to Test Server
+        */
+        virtual RTestServer& Server( TTestInfo& aTestInfo );
+
+        /**
+        * Return the name of Test Module.
+        */
+        virtual const TDesC& ModuleName( const TDesC& aModuleName );
+
+        /**
+        * Return reference to AtsLogger
+        */
+        virtual CAtsLogger& AtsLogger(){ return *iAtsLogger; };
+        
+        /**
+        * Is enumeration complete?
+        */
+        virtual TBool EnumerationComplete();
+        
+        /**
+        * Returns pointer to the created clone of the TestModuleController
+        */		
+		virtual CTestModuleController* CloneL( CTestModuleController* aTestModuleController, TBool aAfterReset, CTestScripterController* aTestScripterController );  		
+		
+		/**
+        * Increases the value of iTestCaseCounter
+        */
+		virtual void CaseCreated();
+
+		/**
+        * Decreases the value of iTestCaseCounter and checks
+        * can old testmodulecontroller deleted or not.
+        */		
+		virtual void CaseFinished();
+		
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        virtual void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the cancellation
+        */
+        virtual void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        virtual TInt RunError( TInt aError );
+
+        /**
+        * Finds free test module controller, if not possible, creates new one.
+        */
+        virtual CTestModuleController* GetFreeOrCreateModuleControllerL(TTestInfo& aTestInfo, TBool aUITestingSupport);
+        
+        /**
+        * Deletes given module controller (used only in CTestScripterController).
+        */
+        virtual void DeleteModuleController(CTestModuleController* aRealModuleController);
+
+        /**
+        * Removes given module controller from child list (used only in CTestScripterController).
+        */
+        virtual void RemoveModuleController(CTestModuleController* aRealModuleController);
+
+        /**
+        * Enumerates test module controller synchronously.
+        * This is used when new test module controller is created when stif
+        * is about to run test case.                
+        */        
+        virtual void EnumerateSynchronously(void);
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TName& aName,
+                            TBool aAfterReboot,
+                            CTestScripterController* aTestScripterController );
+
+        /**
+        * Generate error report to xml result file and leave with notify.
+        */
+        void LeaveWithNotifyL( TInt aCode, const TDesC& aText );
+
+        /**
+        * Construct ATS logger. Added this function due to compiler error with
+        * CW 3.0 when there are multiple TRAPDs 
+        */        
+        TInt ConstructASTLoggerL( TDesC& atsName, TBool & aAfterReboot);
+
+    protected:
+        /**
+        * Parametric constructor.
+        */
+        CTestModuleController( CTestEngine* aEngine );
+
+    public:     // Data
+        // None
+
+        // Config file array
+        RPointerArray<HBufC>            iConfigFiles;
+        
+        // Tells is TestModuleController cloned or not in -15 (KErrServerTerminated) cases.
+        TBool iTestModuleCrashDetected;
+
+    private:    // Data
+    
+    protected:  // Data
+
+        // Test Engine owning us
+        CTestEngine*                    iEngine;
+
+        // Test case array
+        typedef CFixedFlatArray<TTestCaseInfo> TTestCaseArray;
+        RPointerArray<TTestCaseArray>   iTestCaseArray;
+
+        // Handle to Test Server
+        RTestServer                     iServer;
+
+        // Handle to Test Module
+        RTestModule                     iModule;
+
+        // Module name
+        HBufC*                          iName;
+
+        // Internal state
+        TTestModuleStatus               iState;
+
+        // Enumeration result
+        TCaseSize                       iEnumResultPackage;
+
+        // Count of test cases
+        TInt                            iTestCaseCount;
+
+        // Count of enumerated config files
+        TInt                            iEnumerateCount;
+
+        // Count of failed enumerated config files(This is used to decrease
+        // iEnumerateCount)
+        TInt                            iFailedEnumerateCount;
+        // For removing faulty config (test case) file(s)
+        RPointerArray<HBufC>            iFailedEnumerateConfig;
+
+        // Is enumeration complete
+        TBool                           iEnumerateComplete;
+
+        // Temporary config file for each Enumerate call
+        TPtrC                           iEnumConfigFile;
+
+        // Pointer to CErrorPrinter
+        CErrorPrinter*                  iErrorPrinter;
+        // Server state handler
+        CServerStateHandler*    iServerStateHandler;
+
+        // ATS Logger
+        CAtsLogger*                     iAtsLogger;
+
+        // Pointer to CTestScripterController
+        CTestScripterController*        iTestScripterController;
+        // Indication is CTestScripterController's services needed. Services
+        // that is implemented in CTestScripterController class.
+        TInt                            iTestScripterIndicator;
+
+        // Initialization file of Test Module
+        TFileName                       iInifile;
+        
+        // Number of running test cases
+        TInt iTestCaseCounter;
+        
+        // Reboot indication (moved here from ScripterControlle)
+        TBool                           iAfterReboot;
+        
+        // List of additional module controllers "owned" by current controller
+        // Used only with UITestingSupport and in case when every test case
+        // has to be run in separate process
+        RPointerArray<CTestModuleController> iChildrenControllers;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+        friend class CTestScripterController;
+        //friend class CTestModuleController;
+        friend class CTestEngine; //iTestScripterController used from CTestEngine::TestModuleCrash 
+
+    };
+
+// DESCRIPTION
+// CTestScripterController is for handling TestScripter's server session
+// creations and handling operations that concern to TestScripter.
+
+class CTestScripterController
+        : public CTestModuleController
+    {
+    public:     // Enumerations
+        // None
+
+    private:    // Enumerations
+        // None
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestScripterController* NewL( CTestEngine* aEngine,
+                                            const TName& aName,
+                                            TBool aAfterReboot );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTestScripterController();
+
+    public:     // New functions
+
+        /**
+        * StartEnumerateL starts the CTestModuleController active object.
+        */
+        void StartEnumerateL();
+
+        /**
+        * Init the test module
+        */
+        void InitL( TFileName& aIniFile, const TDesC& aConfigFile );
+
+        /**
+        * Add config file
+        */
+        void AddConfigFileL( TFileName& aConfigFile );
+
+        /**
+        * Remove config file
+        */
+        void RemoveConfigFileL( TFileName& aConfigFile );
+
+        /**
+        * Get Test Cases
+        */
+        CFixedFlatArray<TTestInfo>* TestCasesL();
+
+        /**
+        * Free used memory for test cases
+        */
+        void FreeTestCases();
+
+        /**
+        * Return handle to Test Server
+        */
+        RTestServer& Server( TTestInfo& aTestInfo );
+
+        /**
+        * Return the name of Test Module.
+        */
+        const TDesC& ModuleName( const TDesC& aModuleName );
+
+        /**
+        * Return reference to AtsLogger
+        */
+        CAtsLogger& AtsLogger(){ return *iTestScripter[0]->iAtsLogger; };
+
+        /**
+        * Is enumeration complete?
+        */
+        TBool EnumerationComplete();
+
+        /**
+        * Handles completed requests (Emulates RunL() ).
+        */
+        void RunLEmulator( CTestModuleController* aTestModuleController );
+
+        /**
+        * Handle errors(Emulates RunError()).
+        */
+        TInt RunErrorEmulator( TInt aError,
+                                CTestModuleController* aTestModuleController );
+
+        /**
+        * Cancel active request(Emulates DoCancel()).
+        */
+        void DoCancelEmulator( CTestModuleController* aTestModuleController );
+
+        /**
+        * Get current CTestScripterController.
+        */
+        TInt GetCurrentIndex( CTestModuleController* aTestModuleController );
+
+        /**
+        * Finds free test module controller, if not possible, creates new one.
+        */
+        CTestModuleController* GetFreeOrCreateModuleControllerL(TTestInfo& aTestInfo, TBool aUITestingSupport);
+
+        /**
+        * Deletes given module controller.
+        */
+        void DeleteModuleController(CTestModuleController *aRealModuleController);
+
+        /**
+        * Removes given module controller from children list.
+        */
+        void RemoveModuleController(CTestModuleController *aRealModuleController);
+
+    public:     // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the cancellation
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TName& aName, TBool aAfterReboot );
+
+        /**
+        * Parametric constructor.
+        */
+        CTestScripterController( CTestEngine* aEngine );
+
+        /**
+        * Create name according to TestScripter and Test case file.
+        */
+        HBufC* CreateTestScripterNameL( TFileName& aTestCaseFile, HBufC* aCreatedName );
+
+    public:     // Data
+
+        // Array for created CTestScripterController
+        RPointerArray<CTestModuleController> iTestScripter;
+
+    protected:  // Data
+
+    private:    // Data
+        // None
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+/**
+* Check is module TestScripter. Does parsing and returns new module name and
+* error codes(Needed operations when creating server sessions to TestScripter).
+*/
+TInt GenerateModuleName(const TDesC& aModuleName, TDes& aNewModuleName);
+
+#endif // TEST_MODULE_CONTROLLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/inc/TestReport.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,280 @@
+/*
+* 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: This file contains the header file of the CTestReport.
+*
+*/
+
+#ifndef TEST_REPORT_H
+#define TEST_REPORT_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "TestEngineClient.h"
+#include "TestEngine.h"
+
+// CONSTANTS
+// Maximum length for date or time definitions 'Thursday 06th November 2003'
+const TInt KMaxDateAndTimeStamp = 30;
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CStifLogger;
+
+// CLASS DECLARATION
+// None
+
+// DESCRIPTION
+// CTestReport is a class that can generate different test reports.
+class CTestReport
+        : public CBase
+    {
+    public:     // Enumerations
+
+        // TTestReportMode defines the mode of test report
+        enum TTestReportMode
+            {
+            ETestReportBlank = 0x00000000,
+            ETestReportSummary = 0x00000001,
+            ETestReportEnvironment = 0x00000002,
+            ETestReportCases = 0x00000004,
+            ETestReportFull = ETestReportSummary | ETestReportEnvironment | ETestReportCases
+            };
+
+        // TTestReportOutput defines the type of test report output
+        enum TTestReportOutput
+            {
+            ETestReportNone = 0x00000000,
+            ETestReportDebug = 0x00000001,
+            ETestReportPlainText = 0x00000002,
+            ETestReportHtml = 0x00000004,
+            ETestReportAll = ETestReportDebug | ETestReportPlainText | ETestReportHtml
+            };
+
+    public:     // Structured classes
+
+        /**
+        *  TTestReportHeader includes header information for test report.
+        *
+        */
+        struct THwInfo
+            {
+            TInt iManufacturer;
+            TInt iMachineUid;
+            TInt iModel;
+            TInt iHwRev;
+            TInt iCpu;
+            TInt iCpuSpeed;
+            TInt iLanguage;
+            };
+
+        struct TSwInfo
+            {
+            TInt iSwRev;
+            TInt iSwBuild;
+            };
+
+        struct TMemoryInfo
+            {
+            TInt iRAM;
+            TInt iRAMFree;
+            };
+
+        class TTestHWInfo
+            {
+            public: // New functions
+                TTestHWInfo();
+
+            public: // Data
+                // HW Info
+                THwInfo         iHwInfo;
+                // SW Info
+                TSwInfo         iSwInfo;
+                // Memory Info
+                TMemoryInfo     iMemoryInfo;
+            };
+
+        /**
+        *  TTestCaseSummary includes information for summary of test cases.
+        */
+        class TTestCaseSummary
+            {
+            public:     // New functions
+                TTestCaseSummary();
+
+            public:     // Data
+                // Test Info
+                TTestInfo           iTestInfo;
+                // Test Result
+                TFullTestResult     iFullTestResult;
+            };
+
+        /**
+        *  TTestSummary includes information for test report summary.
+        */
+        class TTestSummary
+            {
+            public:     // New functions
+                TTestSummary( const TName& aName );
+
+            public:     // Data
+                // Name (e.g. test module name )
+                const TName     iName;
+                // Count of passed test cases
+                TInt            iPassedCases;
+                // Count of failed test cases
+                TInt            iFailedCases;
+                // Count of crashed cases
+                TInt            iCrashedCases;
+                // Count of timed out cases
+                TInt            iTimeoutCases;
+            };
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestReport* NewL( CTestReportSettings& aTestReportSettings,
+                                  const TTestReportMode aReportMode );
+        
+        /**
+        * Destructor.
+        */
+        ~CTestReport();
+        
+    public:     // New functions
+        
+        /**
+        * Add test case result.
+        */
+        void AddTestCaseResultL( const TTestInfo& aTestInfo,
+                                 const TFullTestResult& aTestResult,
+                                 const TInt aError );
+
+        /**
+        * Generate result reports.
+        */
+        void GenerateReportL();
+        
+        /**
+        * Update result reports.
+        */
+        void UpdateReportSummaryL();
+        
+        /**
+         * Adds version of test module to RPointerArray
+         */
+        void AddTestModuleVersion(TTestModuleVersionInfo& aVersion);
+
+    public:     // Functions from base classes
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(  CTestReportSettings& aTestReportSettings );
+
+        /**
+        * Default C++ constructor.
+        */
+        CTestReport( const TTestReportMode aReportMode );
+        
+        /**
+        * Write result file header.
+        */
+        void WriteHeaderL();
+        
+        /**
+        * Write result file trailer.
+        */
+        void WriteTrailerL();
+        
+        /**
+        * Write data to file.
+        */
+        void WriteLineL( TRefByValue<const TDesC> aStr,... );
+        
+        /**
+        * Write delimiter line.
+        */
+        void WriteDelimiterL( const TDesC& aDelimiter, TInt aCount );
+        
+        /**
+        * Adds needed tags to get valid xml file.
+        */
+        void CloseXMLTagsInUnfinishedFileL(void);
+
+    public:     // Data
+    
+    protected:  // Data
+
+    private:    // Data
+
+        // Report file handles
+        RFs                             iFs;
+        RFile                           iFile;
+        CStifLogger::TLoggerType        iFormat;
+        CStifLogger::TOutput            iOutput;
+    
+        // Report Mode
+        TTestReportMode                 iReportMode;
+
+        // Report HW info
+        TTestHWInfo                     iReportHWInfo;
+
+        // Total summary
+        TTestSummary*                   iTotalSummary;
+
+        // Test summary array
+        RPointerArray<TTestSummary>     iTestSummaries;
+        
+        // Summary start position
+        TInt                            iSummaryPos;
+        
+        // Versions of test modules position
+        TInt							iModulesVersionsPos;
+        
+        // Test modules versions
+        RPointerArray<TTestModuleVersionInfo> iTestModulesVersionsInfo;
+
+        // Will report be written in xml format 
+        TBool                           iXML;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif // TEST_REPORT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/STIFTestFrameworkSettings.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,672 @@
+/*
+* 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: This module contains implementation of 
+* CSTIFTestFrameworkSettings class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "STIFTestFrameworkSettings.h"
+#include "TestReport.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: CSTIFTestFrameworkSettings
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFTestFrameworkSettings::CSTIFTestFrameworkSettings()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CSTIFTestFrameworkSettings::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CSTIFTestFrameworkSettings*: pointer to 
+                                                CSTIFTestFrameworkSettings
+                                                object
+
+    Errors/Exceptions: None 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CSTIFTestFrameworkSettings* CSTIFTestFrameworkSettings::NewL()
+    {
+    CSTIFTestFrameworkSettings* self = 
+                        new ( ELeave ) CSTIFTestFrameworkSettings();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: ~CSTIFTestFrameworkSettings
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CSTIFTestFrameworkSettings::~CSTIFTestFrameworkSettings()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: GetReportModeL
+
+    Description: Get report mode settings
+
+    Parameters: CStifSectionParser* aSectionParser: in: CStifSectionParser
+                object.
+                TPtrC aTag: in: Tag to setting to be found.
+                TUint& aSetting: inout: Parsed setting.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: Leaves is memory allocation fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestFrameworkSettings::GetReportModeL( 
+                                        CStifSectionParser* aSectionParser,
+                                        TPtrC aTag,
+                                        TUint& aSetting )
+    {
+    TPtrC string;
+
+    CStifItemParser* item = NULL;
+    TRAPD( ret, item = aSectionParser->GetItemLineL( aTag, ENoTag ) );
+    if( ret != KErrNone )
+        {
+        delete item;
+        return ret;
+        }
+    if( !item )
+        {
+        delete item;
+        return KErrNotFound;
+        }
+    else
+        {
+        ret = item->GetString( _L( "" ), string );
+        while( ret == KErrNone )
+            {
+            HBufC* stringHbuf = string.AllocL();
+            TPtr modifiableString = stringHbuf->Des();
+            modifiableString.UpperCase();
+
+            if( modifiableString == _L( "EMPTY" ) )
+                {
+                // No test report
+                aSetting = CTestReport::ETestReportBlank;
+                }
+            else if( modifiableString == _L( "SUMMARY" ) )
+                {
+                // Increment aSetting
+                aSetting += CTestReport::ETestReportSummary;
+                }
+            else if( modifiableString == _L( "ENVIRONMENT" ) )
+                {
+                // Increment aSetting
+                aSetting += CTestReport::ETestReportEnvironment;
+                }
+            else if( modifiableString == _L( "TESTCASES" ) )
+                {
+                // Increment aSetting
+                aSetting += CTestReport::ETestReportCases;
+                }
+            else if( modifiableString == _L( "FULLREPORT" ) )
+                {
+                // Set aSettings to max value and break
+                aSetting = CTestReport::ETestReportFull;
+                delete stringHbuf;
+                break;
+                }
+            else if( modifiableString == _L( "#" ) )
+                {
+                delete stringHbuf;
+                break;
+                }
+            else
+                {
+                delete stringHbuf;
+                delete item;
+                return KErrArgument;
+                }
+            delete stringHbuf;
+            ret = item->GetNextString( string );
+            }
+        }
+
+    delete item;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: GetFileSetting
+
+    Description: Get file settings
+
+    Parameters: CStifSectionParser* aSectionParser: in: CStifSectionParser
+                object.
+                TPtrC aTag: in: Tag to setting to be found.
+                TPtrC& aFilePath: inout: Test file setting.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestFrameworkSettings::GetFileSetting( 
+                                        CStifSectionParser* aSectionParser,
+                                        TPtrC aTag,
+                                        TPtrC& aSetting )
+    {
+    CStifItemParser* item = NULL;
+    TRAPD( ret, item = aSectionParser->GetItemLineL( 
+                                            aTag,
+                                            ENoTag ) );
+    if( ret != KErrNone )
+        {
+        delete item;
+        return ret;
+        }
+    if( !item )
+        {
+        delete item;
+        return KErrNotFound;
+        }
+    else
+        {
+        ret = item->GetString( _L( "" ), aSetting );
+        }
+
+    delete item;
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: GetFormatL
+
+    Description: Get Test report format settings
+
+    Parameters: CStifSectionParser* aSectionParser: in: CStifSectionParser
+                object.
+                TPtrC aTag: in: Tag to setting to be found.
+                CStifLogger::TLoggerType& aLoggerType: inout: Test report type
+                setting.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: Leaves is memory allocation fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestFrameworkSettings::GetFormatL( 
+                                        CStifSectionParser* aSectionParser,
+                                        TPtrC aTag, 
+                                        CStifLogger::TLoggerType& aLoggerType )
+    {
+    TBool xml;
+    return GetFormatL(aSectionParser, aTag, aLoggerType, xml);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: GetFormatL
+
+    Description: Get Test report format settings
+
+    Parameters: CStifSectionParser* aSectionParser: in: CStifSectionParser
+                object.
+                TPtrC aTag: in: Tag to setting to be found.
+                CStifLogger::TLoggerType& aLoggerType: inout: Test report type setting.
+                TBool& aXML: inout: true if xml format is set
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: Leaves is memory allocation fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestFrameworkSettings::GetFormatL( 
+                                        CStifSectionParser* aSectionParser,
+                                        TPtrC aTag, 
+                                        CStifLogger::TLoggerType& aLoggerType,
+                                        TBool& aXML )
+    {
+    aXML = EFalse;
+    CStifItemParser* item = NULL;
+    TRAPD( ret, item = aSectionParser->GetItemLineL( aTag, ENoTag ) );
+
+    TPtrC string;
+
+    if( ret != KErrNone )
+        {
+        delete item;
+        return ret;
+        }
+    if( !item )
+        {
+        delete item;
+        return KErrNotFound;
+        }
+    else
+        {
+        ret = item->GetString( _L( "" ), string );
+        if ( ret != KErrNone )
+            {
+            delete item;
+            return ret;
+            }
+        }
+
+    HBufC* stringHbuf = string.AllocL();
+    TPtr modifiableString = stringHbuf->Des();
+    modifiableString.UpperCase();
+
+    if( modifiableString == _L( "TXT" ) )
+        {
+        aLoggerType = CStifLogger::ETxt;
+        }
+    else if( modifiableString == _L( "HTML" ) )
+        {
+        aLoggerType = CStifLogger::EHtml;
+        }
+    else if( modifiableString == _L( "DATA" ) )
+        {
+        aLoggerType = CStifLogger::EData;
+        }
+    else if( modifiableString == _L( "XML" ) )
+        {
+        aLoggerType = CStifLogger::ETxt;
+        aXML = ETrue;
+        }
+    else
+        {
+        delete stringHbuf;
+        delete item;
+        return KErrArgument;
+        }
+
+    delete stringHbuf;
+    delete item;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: GetOutputL
+
+    Description: Get Test report output settings
+
+    Parameters: CStifSectionParser* aSectionParser: in: CStifSectionParser
+                object.
+                TPtrC aTag: in: Tag to setting to be found.
+                CStifLogger::TOutput& aOutput: inout: Test report output setting.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: Leaves is memory allocation fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestFrameworkSettings::GetOutputL( 
+                                        CStifSectionParser* aSectionParser,
+                                        TPtrC aTag,
+                                        CStifLogger::TOutput& aOutput )
+    {
+    CStifItemParser* item = NULL;
+    TRAPD( ret, item = aSectionParser->GetItemLineL( aTag, ENoTag ) );
+
+    TPtrC string;
+
+    if( ret != KErrNone )
+        {
+        delete item;
+        return ret;
+        }
+    if( !item )
+        {
+        delete item;
+        return KErrNotFound;
+        }
+    else
+        {
+        ret = item->GetString( _L( "" ), string );
+        if ( ret != KErrNone )
+            {
+            delete item;
+            return ret;
+            }
+        }
+
+    HBufC* stringHbuf = string.AllocL();
+    TPtr modifiableString = stringHbuf->Des();
+    modifiableString.UpperCase();
+
+    if( modifiableString == _L( "FILE" ) )
+        {
+        aOutput = CStifLogger::EFile;
+        }
+    else if( modifiableString == _L( "RDEBUG" ) )
+        {
+        aOutput = CStifLogger::ERDebug;
+        }
+    else
+        {
+        delete stringHbuf;
+        delete item;
+        return KErrArgument;
+        }
+
+    delete stringHbuf;
+    delete item;
+
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: GetBooleanSettingsL
+
+    Description: Get boolean type of settings
+
+    Parameters: CStifSectionParser* aSectionParser: in: CStifSectionParser
+                object.
+                TPtrC aTag: in: Tag to setting to be found.
+                TBool& aSetting: inout: Parsed setting.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: Leaves is memory allocation fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestFrameworkSettings::GetBooleanSettingsL( 
+                                        CStifSectionParser* aSectionParser,
+                                        TPtrC aTag,
+                                        TBool& aSetting )
+    {
+    TPtrC string;
+
+    CStifItemParser* item = NULL;
+    TRAPD( ret, item = aSectionParser->GetItemLineL( aTag, ENoTag ) );
+    if( ret != KErrNone )
+        {
+        delete item;
+        return ret;
+        }
+    if( !item )
+        {
+        delete item;
+        return KErrNotFound;
+        }
+    else
+        {
+        ret = item->GetString( _L( "" ), string );
+        if( ret != KErrNone )
+            {
+            delete item;
+            return ret;
+            }
+
+        HBufC* stringHbuf = string.AllocL();
+        TPtr modifiableString = stringHbuf->Des();
+        modifiableString.UpperCase();
+
+        // Parsed parameter is false
+        if( modifiableString == _L( "NO" ) )
+            {
+            aSetting = EFalse;
+            }
+        // Parsed parameter is true
+        else if( modifiableString == _L( "YES" ) )
+            {
+            aSetting = ETrue;
+            }
+        else
+            {
+            delete stringHbuf;
+            delete item;
+            return KErrArgument;
+            }
+        delete stringHbuf;
+        }
+
+    delete item;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestFrameworkSettings
+
+    Method: GetOverwriteL
+
+    Description: Get Test report file creation mode settings
+                 (overwrite settings)
+
+    Parameters: CStifSectionParser* aSectionParser: in: CStifSectionParser
+                object.
+                TPtrC aTag: in: Tag to setting to be found.
+                TBool& aOverwrite: inout: Overwrite setting.
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: Leaves is memory allocation fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestFrameworkSettings::GetOverwriteL( 
+                                        CStifSectionParser* aSectionParser,
+                                        TPtrC aTag,
+                                        TBool& aOverwrite )
+    {
+    CStifItemParser* item = NULL;
+    TRAPD( ret, item = aSectionParser->GetItemLineL( aTag, ENoTag ) );
+    if( ret != KErrNone )
+        {
+        delete item;
+        return ret;
+        }
+    if( !item )
+        {
+        delete item;
+        return KErrNotFound;
+        }
+    else
+        {
+        TPtrC string;
+        ret = item->GetString( _L( "" ), string );
+        if( ret != KErrNone )
+            {
+            delete item;
+            return ret;
+            }
+
+        HBufC* stringHbuf = string.AllocL();
+        TPtr modifiableString = stringHbuf->Des();
+        modifiableString.UpperCase();
+
+        if( modifiableString == _L( "APPEND" ) )
+            {
+            aOverwrite = EFalse;
+            }
+        else if( modifiableString == _L( "OVERWRITE") )
+            {
+            aOverwrite = ETrue;
+            }
+        else
+            {
+            delete stringHbuf;
+            delete item;
+            return KErrArgument;
+            }
+        delete stringHbuf;
+        }
+
+    delete item;
+
+    return KErrNone;
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/SettingServer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,386 @@
+/*
+* 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: This module contains implementation of CSettingServer 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+
+#include "SettingServerClient.h"
+#include "SettingServer.h"
+
+#include <StifLogger.h>
+#include "Logging.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+#undef LOGGER
+#define LOGGER iSettingServerLogger
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: PanicServer
+
+    Description: Panics the server. 
+
+    Parameters: const TSettingServerPanic aPanic :in:  Panic code
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CSettingServer::PanicServer( const TSettingServerPanic aPanic )
+    {
+    RDebug::Print( _L( "CSettingServer::PanicServer" ) );
+    _LIT( KTxtServer,"CSettingServer" );
+    User::Panic( KTxtServer,aPanic );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: NewL
+
+    Description: Returns new CSettingServer object
+
+    Parameters: const TName& aName: in: Server name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation, ConstructL or StartL
+                       leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CSettingServer* CSettingServer::NewL( const TName& aName )
+
+    {
+    CSettingServer* self = new( ELeave ) CSettingServer();
+    CleanupStack::PushL( self );
+
+    // Construct the server
+    self->ConstructL();
+
+    // Start the server
+    self->StartL( aName );
+
+    CleanupStack::Pop( self );
+
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+ 
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CSettingServer::ConstructL()
+    {
+    // Create logger, in Wins use HTML in HW default logger
+    TLoggerSettings loggerSettings;
+    // Directory must create by hand if test engine log wanted
+    loggerSettings.iCreateLogDirectories = EFalse;
+    loggerSettings.iOverwrite = ETrue;
+    loggerSettings.iTimeStamp = ETrue;
+    loggerSettings.iLineBreak = ETrue;
+    loggerSettings.iEventRanking = EFalse;
+    loggerSettings.iThreadId = EFalse;
+    loggerSettings.iHardwareFormat = CStifLogger::ETxt;
+#ifndef FORCE_STIF_INTERNAL_LOGGING_TO_RDEBUG
+    loggerSettings.iEmulatorFormat = CStifLogger::EHtml;
+    loggerSettings.iHardwareOutput = CStifLogger::EFile;
+    loggerSettings.iEmulatorOutput = CStifLogger::EFile;
+#else
+    RDebug::Print( _L( "STIF SettingServer logging forced to RDebug" ) );
+    loggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+    loggerSettings.iHardwareOutput = CStifLogger::ERDebug;
+    loggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
+#endif
+    loggerSettings.iUnicode = EFalse;
+    loggerSettings.iAddTestCaseTitle = EFalse;
+    iSettingServerLogger = CStifLogger::NewL( 
+                        _L( "C:\\logs\\testframework\\testengine\\"),
+                        _L( "SettingServer" ),
+                        loggerSettings );
+
+    ResetLoggerSettings();
+    
+    __TRACE( KInit,( _L( "-.-.-.-.-.-.-.-.-.- SettingServer log starts -.-.-.-.-.-.-.-.-.-" ) ) );
+    __TRACE( KInit,( _L( "CSettingServer::ConstructL()" ) ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: CSettingServer
+
+    Description: Constructor.
+
+    Initialises non-zero member variables and base class with correct
+    priority.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CSettingServer::CSettingServer() :
+        CServer2( CSettingServer::ESettingServerSchedulerPriority )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: ~CSettingServer
+
+    Description: Destructor.
+   
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CSettingServer::~CSettingServer()
+    {
+    delete iSettingServerLogger;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: NewSessionL
+
+    Description: Returns new session.
+    
+    Parameters: const TVersion &aVersion:in :Version required
+
+    Return Values: CSharableSession* New session
+
+    Errors/Exceptions: Leaves if invalid version
+                       Leaves if CSettingServer construction leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CSession2* CSettingServer::NewSessionL( const TVersion& aVersion,
+                                        const RMessage2& /*aMessage*/ ) const
+
+    {
+    // check version is ok
+    TVersion v( KSettingServerMajorVersionNumber,
+                KSettingServerMinorVersionNumber,
+                KSettingServerVersionNumber
+               );
+
+    if( !User::QueryVersionSupported( v, aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    return CLoggerSetting::NewL( ( CSettingServer* ) this );
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: OpenSession
+
+    Description: Opens session. Session calls calls this when session is
+    properly constructed.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CSettingServer::OpenSession()
+    {
+    iSessions++;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: Logger
+
+    Description: Return pointer to the Logger(iSettingServerLogger)
+
+    Parameters: None
+
+    Return Values: CStifLogger*: Pointer to Logger
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CStifLogger* CSettingServer::Logger()
+    {
+    return iSettingServerLogger;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: CloseSession
+
+    Description: Closes session. CLoggerSetting::CloseSession calls this
+    to inform server class. 
+
+    If there are not any active sessions, then stop active scheduler and
+    close whole server.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Function panics if OpenSessions() and CloseSessions()
+                       does not match.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CSettingServer::CloseSession()
+    {
+    __ASSERT_ALWAYS ( iSessions > 0, CSettingServer::PanicServer(ETooManyCloseSessions));
+    iSessions--;  
+
+    if ( iSessions == 0 )
+        {
+        // Stop the active scheduler if no-one is using server anymore
+        CActiveScheduler::Stop();
+        }
+
+    }
+
+void CSettingServer::ResetLoggerSettings()
+    {
+    // iLoggerSettings initializations to indicate is setting in use
+    iLoggerSettings.iIsDefined.iCreateLogDir = EFalse;
+    iLoggerSettings.iEmulatorPath.Copy( _L( "" ) );
+    iLoggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+    iLoggerSettings.iEmulatorOutput = CStifLogger::EFile;
+    iLoggerSettings.iHardwarePath.Copy( _L( "" ) );
+    iLoggerSettings.iHardwareFormat = CStifLogger::ETxt;
+    iLoggerSettings.iHardwareOutput = CStifLogger::EFile;
+    iLoggerSettings.iOverwrite = ETrue;
+    iLoggerSettings.iTimeStamp = ETrue;
+    iLoggerSettings.iLineBreak = ETrue;
+    iLoggerSettings.iEventRanking = EFalse;
+    iLoggerSettings.iThreadId = EFalse;
+    iLoggerSettings.iUnicode = EFalse;
+    iLoggerSettings.iAddTestCaseTitle = EFalse;
+
+    iLoggerSettings.iIsDefined.iPath = EFalse;
+    iLoggerSettings.iIsDefined.iHwPath = EFalse;
+    iLoggerSettings.iIsDefined.iFormat = EFalse;
+    iLoggerSettings.iIsDefined.iHwFormat = EFalse;
+    iLoggerSettings.iIsDefined.iOutput = EFalse;
+    iLoggerSettings.iIsDefined.iHwOutput = EFalse;
+    iLoggerSettings.iIsDefined.iOverwrite = EFalse;
+    iLoggerSettings.iIsDefined.iLineBreak = EFalse;
+    iLoggerSettings.iIsDefined.iTimeStamp = EFalse;
+    iLoggerSettings.iIsDefined.iEventRanking = EFalse;
+    iLoggerSettings.iIsDefined.iThreadId = EFalse;
+    iLoggerSettings.iIsDefined.iUnicode = EFalse;
+    iLoggerSettings.iIsDefined.iAddTestCaseTitle = EFalse;
+
+    iIniFile = KNullDesC;
+    iDefaultSettings = ETrue;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/SettingServerClient.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,464 @@
+/*
+* 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: This module contain implementation of RSettingServer 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <SettingServerClient.h>
+#include "SettingServerClientServer.h"
+#include "SettingServer.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+_LIT( KSettingServerName, "StifSettingServer" );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+/**
+ * Panics settings server thread
+ */
+void PanicSettingServer( const TSettingServerPanic aPanic )
+    {
+    RDebug::Print( _L( "CSettingServer::PanicServer" ) );
+    _LIT( KTxtServer,"CSettingServer" );
+    User::Panic( KTxtServer,aPanic );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: None
+
+    Method: SettingServerThreadFunction
+
+    Description: The thread function, where Setting Server lives in
+    
+    Parameters: TAny* aStartInfo aName: in: Start-up information
+    
+    Return Values: TInt: Result from server start
+
+    Errors/Exceptions: Panics current thread if:
+                       Invalid start-up information
+                       Clean-up stack can't be created
+                       Setting Server can't be started
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt SettingServerThreadFunction( TAny* aStarted )
+    {
+    __UHEAP_MARK;
+
+    // Get start-up information
+    TThreadStartSetting* startInfo = ( TThreadStartSetting* ) aStarted;
+    __ASSERT_ALWAYS( startInfo,PanicSettingServer( ENoStartupInformation ) );
+
+    // Create clean-up stack
+    CTrapCleanup* tc = CTrapCleanup::New();
+    __ASSERT_ALWAYS( tc, PanicSettingServer(ECreateTrapCleanup));
+
+    // Construct and install active scheduler
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    __ASSERT_ALWAYS( scheduler, PanicSettingServer( EMainSchedulerError ) );
+    CActiveScheduler::Install( scheduler );
+
+    // Construct server
+    CSettingServer* server = NULL;
+    RDebug::Print( startInfo->iName );
+    TRAPD( err, server = CSettingServer::NewL( startInfo->iName ) );
+    __ASSERT_ALWAYS( !err, PanicSettingServer( ESvrCreateServer ) );
+
+    // Inform that we are up and running
+    startInfo->iStartupResult = KErrNone;
+    startInfo->iStarted.Signal();
+
+    // Start handling requests
+    CActiveScheduler::Start();
+
+   // Execution continues from here after CActiveScheduler::Stop
+
+    // Delete the server. This should be deleted before scheduler,
+    // if server still has any active objects
+    delete server;
+    server = NULL;
+    
+    // Delete scheduler. 
+    delete scheduler;
+    scheduler = NULL;
+
+    // Delete clean-up stack
+    delete tc;
+    tc = NULL;
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: StartNewServer
+
+    Description: Starts a new server. Server will be running its own
+    thread and this functions returns when server is up and running or
+    server start-up fails.
+
+    Parameters:  TName& aServerName: inout: The name of the server
+    
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt StartNewSettingServer()
+    {
+    __UHEAP_MARK;
+
+    //Ccheck server not already started
+    TFindServer findServer( KSettingServerName );
+    TFullName name;
+    if( findServer.Next( name ) == KErrNone )
+        {   
+        // Server already started, nothing to do
+        __UHEAP_MARKEND;
+        return KErrAlreadyExists;
+        }
+
+    // Construct start-up information object
+    TThreadStartSetting* startInfo = new TThreadStartSetting();
+    if( startInfo == NULL )
+        {
+        __UHEAP_MARKEND;
+        return KErrNoMemory;
+        }
+
+    // Fill the start-up information
+    startInfo->iName = KSettingServerName;
+    startInfo->iStartupResult = KErrNone;
+    startInfo->iStarted.CreateLocal( 0 );
+
+    // Create thread    
+    TInt res = startInfo->iServerThread.Create( 
+        startInfo->iName ,                       // Name of thread
+        SettingServerThreadFunction,          // Thread function
+        KDefaultStackSize,                       // Stack size
+        KDefaultHeapSize,                        // Heap initial size
+        KMaxHeapSize,                            // Heap start max size
+        startInfo                                // Parameter to thread function
+        );
+
+    // If thread creation failed
+    if( res != KErrNone )        
+        {
+        startInfo->iStarted.Close();             // Close semaphore
+        delete startInfo;
+        startInfo = NULL;
+        __UHEAP_MARKEND;
+        return res;
+        }
+
+    // Now start thread
+    startInfo->iServerThread.SetPriority( EPriorityMuchMore ); 
+    startInfo->iServerThread.Resume();
+    
+    // Wait until the thread is started
+    startInfo->iStarted.Wait();
+
+    // Free memory
+    TInt r = startInfo->iStartupResult;
+    startInfo->iServerThread.Close();
+    startInfo->iStarted.Close();
+    delete startInfo;
+    startInfo = NULL;
+
+    __UHEAP_MARKEND;
+
+    // Return start-up result.
+    return r;
+
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RSettingServer
+
+    Method: RSettingServer
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C RSettingServer::RSettingServer()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RSettingServer
+
+    Method: Connect
+
+    Description: Connect method creates new RSettingServer session.
+    First the server is tried to start. If start is successfull or server is
+    already started, then a new session is created.  
+
+    Parameters: None
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RSettingServer::Connect()
+    {
+    TInt ret = StartNewSettingServer();
+
+    if( ret == KErrNone || ret == KErrAlreadyExists )
+        {
+        ret = CreateSession( KSettingServerName, Version() );
+        }
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RSettingServer
+
+    Method: Version
+
+    Description: Return client side version.
+
+    Parameters: None
+
+    Return Values: TVersion: Version number
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TVersion RSettingServer::Version() const
+    {
+    return( TVersion( KSettingServerMajorVersionNumber,
+                      KSettingServerMinorVersionNumber, 
+                      KSettingServerVersionNumber 
+                     ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RSettingServer
+
+    Method: Close
+
+    Description: Closes the RSettingServer session.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RSettingServer::Close()
+    {
+    // Check that server is connected and send close message to it if possible.
+    if( Handle() != 0 )
+        {
+        TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing );
+        // Goes to CSettingServer's DispatchMessageL() method
+        SendReceive( ESettingServerCloseSession, args );
+        }
+
+    RSessionBase::Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RSettingServer
+
+    Method: ReadLoggerSettingsFromIniFile
+
+    Description: Read Logger setting from initialization file. Mainly use from
+                 TestEngine side.
+
+    Parameters: TLoggerSettings& aLoggerSettings: inout: Logger's overwrite
+                struct
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RSettingServer::LoadLoggerSettingsFromIniFile( TLoggerSettings& aLoggerSettings, 
+        const TDesC& aIniFile,
+        TBool aOverwritePreviousSettings )
+    {
+    // Package
+    TPckg<TLoggerSettings> loggerSettingsPckg( aLoggerSettings );
+
+	TIpcArgs args( &aIniFile, &loggerSettingsPckg, aOverwritePreviousSettings );
+    // Goes to CSettingServer's DispatchMessageL() method
+    SendReceive( ELoadLoggerSettingsFromIniFile, args );
+   
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RSettingServer
+
+    Method: LoadLoggerSettingsFromCommandLine
+
+    Description: Read Logger setting from command line. Mainly use from
+                 TestEngine side.
+
+    Parameters: TDesC& aLoggerSettings: inout: Logger's overwrite
+                struct
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RSettingServer::LoadLoggerSettingsFromCommandLine(TDesC& aLoggerSettings)
+    {
+    TIpcArgs args( &aLoggerSettings, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ELoadLoggerSettingsFromCommandLine, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RSettingServer
+
+    Method: GetLoggerSettings
+
+    Description: Get Logger settings. Mainly use from Logger side.
+
+    Parameters: TLoggerSettings& aLoggerSettings: in: Logger's overwrite struct
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RSettingServer::GetLoggerSettings( 
+                                            TLoggerSettings& aLoggerSettings )
+    {
+    // Package
+    TPckg<TLoggerSettings> loggerSettingsPckg( aLoggerSettings );
+
+	TIpcArgs args( &loggerSettingsPckg, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    // Goes to CSettingServer's DispatchMessageL() method
+	return SendReceive( EGetLoggerSettings, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RSettingServer
+
+    Method: SetIniFileSetting
+
+    Description: Set new initialization file setting(e.g. SetAttribute).
+
+    Parameters: TName& aNewIniFileSetting: in: New setting
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RSettingServer::SetLoggerOutputPath( const TDesC& aLoggerOutputPath )
+    {
+	TIpcArgs args( &aLoggerOutputPath, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    // Goes to CSettingServer's DispatchMessageL() method
+	return SendReceive( ESetLoggerOutputPath, args );
+    }
+
+EXPORT_C TInt RSettingServer::ResetLoggerSettings()
+    {
+    return SendReceive( EResetLoggerSettings, TIpcArgs() );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/SettingServerSession.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,806 @@
+/*
+* 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: This module contains implementation of CSettingServer 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+
+#include "SettingServerClient.h"
+#include "SettingServer.h"
+
+#include <StifParser.h>
+#include "STIFTestFrameworkSettings.h"
+
+#include "Logging.h"
+#include "TestEngineUtils.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+#undef LOGGER
+#define LOGGER iSettingServer->Logger()
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: NewL
+
+    Description: Create new CLoggerSetting (Setting server session)
+
+    Parameters: RThread& aClient: in: Handle to thread client
+                CSettingServer* aServer: in: Pointer to CSettingServer
+
+    Return Values: CLoggerSetting* Pointer to new CLoggerSetting
+
+    Errors/Exceptions: Leaves if memory allocation fails or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CLoggerSetting* CLoggerSetting::NewL( CSettingServer* aServer )
+    {
+    CLoggerSetting* self=new( ELeave ) CLoggerSetting();
+    CleanupStack::PushL( self );
+    self->ConstructL( aServer );
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: CLoggerSetting
+
+    Description: Constructor. Initialise base class.
+
+    Parameters: RThread& aClient: in: Handle to client
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CLoggerSetting::CLoggerSetting() :
+        CSession2()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: ~CLoggerSetting
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CLoggerSetting::~CLoggerSetting()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+    
+    Parameters: CSettingServer* aServer: in: Server
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if base class CreateL leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CLoggerSetting::ConstructL( CSettingServer* aServer )
+    {
+    // @spe __TRACE( KInit,( _L( "CLoggerSetting::ConstructL - constructing server session" ) ) );
+    iSettingServer = aServer;
+
+    // second-phase construct base class
+    //CSession2::CreateL();
+
+//    iSettingServer = aServer;
+
+     // Inform server class that session is opening. 
+    iSettingServer->OpenSession();    
+
+    __TRACE( KInit,( _L( "CLoggerSetting::ConstructL - constructing server session done" ) ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: PanicClient
+
+    Description: Panic clients.
+
+    Parameters: TInt aPanic: in: Panic code
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CLoggerSetting::PanicClient( const TInt aPanic, const RMessage2& aMessage ) const
+    {
+    __TRACE( KError,( _L( "CLoggerSetting::PanicClient code = %d" ), aPanic ) );
+
+    _LIT( KTxtModule,"CLoggerSetting" );
+
+    aMessage.Panic( KTxtModule,aPanic );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: CloseSession
+
+    Description: Close session
+
+    Parameters: const RMessage&: out: Message to be completed.
+
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CLoggerSetting::CloseSession( /*const RMessage& aMessage*/ )
+    {
+    __TRACE( KVerbose,( _L( "CLoggerSetting::CloseSession in" ) ) );
+             
+    // Close session from server (and stop it if required)
+    iSettingServer->CloseSession();
+
+    // NOTE: This complete will make after DispatchMessageL in ServiceL method.
+    // Complete message. This must be done after possible closing
+    // of the server to make sure that server is first closed before
+    // client can send new messages.
+    // aMessage.Complete( KErrNone );
+
+    __TRACE( KVerbose,( _L( "CLoggerSetting::CloseSession out" ) ) );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: ServiceL
+
+    Description: Trap harness for dispatcher
+
+    Parameters: const RMessage& aMessage: inout: Message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CLoggerSetting::ServiceL( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose,( _L( "CLoggerSetting::ServiceL in" ) ) );
+
+    TInt r( KErrNone );
+    TBool isMessageSync( EFalse );
+    
+    TRAPD( ret, r = DispatchMessageL( aMessage, isMessageSync ) );
+
+    if( ret != KErrNone )
+        {
+        // Complete message on leaving cases with leave code allways.
+        __TRACE( KError,( _L( "CLoggerSetting::DispatchMessageL leaved" ) ) );
+        aMessage.Complete( ret );
+        }
+    else if( isMessageSync )
+        {
+        // Message is syncronous, Complete message with error code 
+        // originating from message handling
+         __TRACE( KVerbose,( _L( "CLoggerSetting::DispatchMessageL completed with: %d" ), r ) );
+        aMessage.Complete( r );
+        }
+    __TRACE( KVerbose,( _L( "CLoggerSetting::ServiceL out" ) ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: DispatchMessageL
+
+    Description: Dispatch message, calls corresponding function to do it.
+
+    Parameters: const RMessage& aMessage: inout: Message to be handled
+                TBool& aIsMessageSync: inout: Indication of the message type
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: Leaves if operation handling function leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CLoggerSetting::DispatchMessageL( const RMessage2& aMessage,
+                                        TBool& aIsMessageSync )
+    {
+    __TRACE( KInit ,( _L( "CLoggerSetting::DispatchMessageL in" ) ) );
+    switch( aMessage.Function() )
+        {
+        case ESettingServerCloseSession: 
+            {
+            __TRACE( KInit ,( _L( "Closing Setting server session" ) ) );
+            aIsMessageSync = ETrue;
+            return CloseSession( /*aMessage*/ );
+            }
+        case ELoadLoggerSettingsFromIniFile:
+            {
+            __TRACE( KInit ,( _L( "Read Logger setting(s) from initialization file" ) ) );
+            aIsMessageSync = ETrue;
+            return LoadLoggerSettingsFromIniFile( aMessage );
+            }
+        case ELoadLoggerSettingsFromCommandLine:
+           {
+           __TRACE( KInit ,( _L( "Read Logger setting(s) from command line" ) ) );
+           aIsMessageSync = ETrue;
+           return LoadLoggerSettingsFromCommandLine( aMessage );
+           }
+        case EGetLoggerSettings:
+            {
+            __TRACE( KInit ,( _L( "Get Logger setting(s)" ) ) );
+            aIsMessageSync = ETrue;
+            return GetLoggerSettings( aMessage );
+            }
+        case ESetLoggerOutputPath:
+            {
+            __TRACE( KInit ,( _L( "Set new initialization file setting" ) ) );
+            aIsMessageSync = ETrue;
+            return SetLoggerOutputPath( aMessage );
+            }
+        case EResetLoggerSettings:
+            {
+            __TRACE( KInit ,( _L( "Reset logger settings" ) ) );
+            aIsMessageSync = ETrue;
+            return ResetLoggerSettings( aMessage );
+            }
+         // Invalid request
+        default:
+            {
+            PanicClient( EBadRequest, aMessage );
+            return KErrNotSupported;
+            }
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: ReadLoggerSettingsFromIniFile
+
+    Description: Read Logger setting from initialization file. Mainly use from
+                 TestEngine side.
+
+    Parameters: const RMessage& aMessage: inout: Message to be handled
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CLoggerSetting::LoadLoggerSettingsFromIniFile( const RMessage2& aMessage )
+    {
+    __TRACE( KInit, ( _L( "CLoggerSetting::ReadLoggerSettingsFromIniFile" ) ) );
+
+    TInt overwritePreviousSettings = aMessage.Int2();
+    
+    if ( overwritePreviousSettings || ( iSettingServer->iDefaultSettings ) )
+        {
+        // Get data from message
+        TFileName iniFile;
+        
+        // Get length from message param 1
+        // Read data from client descriptor (param 0)
+        TRAPD( ret, aMessage.ReadL( 0, iniFile ) );
+    
+        if ( ret != KErrNone )
+            {
+            PanicClient( EBadDescriptor, aMessage );
+            return KErrBadDescriptor;
+            }
+    
+        // Inifile name and path information
+        iSettingServer->iIniFile = iniFile;    
+        
+        ret = ReadLoggerDefaults();
+        if( ret != KErrNone )
+            {
+            return ret;
+            }
+        }
+    
+    // Copies logger settings to the package
+    TPckg<TLoggerSettings> loggerSettingsPckg( iSettingServer->iLoggerSettings );
+
+    // Writes a packege that includes the logger overwrite settings to aMessage
+    TRAPD( err, aMessage.WriteL( 1, loggerSettingsPckg ) );
+
+    if ( err != KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        }
+
+    return KErrNone;
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: ReadLoggerSettingsFromIniFile
+
+    Description: Read Logger setting from initialization file. Mainly use from
+                 TestEngine side.
+
+    Parameters: const RMessage& aMessage: inout: Message to be handled
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CLoggerSetting::LoadLoggerSettingsFromCommandLine( const RMessage2& aMessage  )
+    {
+    TBuf<256> logconfiguration;
+    aMessage.ReadL( 0, logconfiguration );
+    //iSettingServer->iLoggerSettings;
+    logconfiguration.TrimAll();
+    TInt i=0;
+    TLex lex(logconfiguration);
+    while ( !lex.Eos() )
+    {
+    TPtrC key=lex.NextToken();
+    i++;
+    TPtrC value=lex.NextToken();
+    i++;
+    if(key !=KNullDesC && value !=KNullDesC)
+    {
+    UpdateLoggerSettings(key,value);
+        
+    }
+    
+    }
+    return KErrNone;
+    }
+TInt CLoggerSetting::UpdateLoggerSettings(TDesC& aKey,TDesC& aValue)
+    {
+    _LIT(KCreateLogDirectories,"CreateLogDirectories");
+    _LIT(KEmulatorBasePath,"EmulatorBasePath");
+    _LIT(KEmulatorFormat,"EmulatorFormat");
+    _LIT(KEmulatorOutput,"EmulatorOutput");
+    _LIT(KHardwareBasePath,"HardwareBasePath");
+    _LIT(KHardwareFormat,"HardwareFormat");
+    _LIT(KHardwareOutput,"HardwareOutput");
+    _LIT(KFileCreationMode,"FileCreationMode");
+    _LIT(KWithTimeStamp,"WithTimeStamp");
+    _LIT(KWithLineBreak,"WithLineBreak");
+    _LIT(KWithEventRanking,"WithEventRanking");
+    _LIT(KThreadIdToLogFile,"ThreadIdToLogFile");
+    _LIT(KFileUnicode,"FileUnicode");
+    _LIT(KAddTestCaseTitle,"AddTestCaseTitle");
+    if(aKey==KCreateLogDirectories)
+    {
+        if( aValue == _L( "NO" ) )
+        {
+        iSettingServer->iLoggerSettings.iCreateLogDirectories=EFalse;
+        }
+        else
+        {
+        iSettingServer->iLoggerSettings.iCreateLogDirectories=ETrue;
+        }
+        iSettingServer->iLoggerSettings.iIsDefined.iCreateLogDir = ETrue;
+    }
+    else if(aKey==KEmulatorBasePath)
+    {
+        iSettingServer->iLoggerSettings.iEmulatorPath = aValue;
+        iSettingServer->iLoggerSettings.iIsDefined.iPath = ETrue;
+    }
+    else if(aKey==KEmulatorFormat)
+    {
+        if( aValue == _L( "TXT" ) )
+           {
+           iSettingServer->iLoggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+           }
+        else if( aValue == _L( "HTML" ) )
+           {
+           iSettingServer->iLoggerSettings.iEmulatorFormat  = CStifLogger::EHtml;
+           }
+        else if( aValue == _L( "DATA" ) )
+           {
+           iSettingServer->iLoggerSettings.iEmulatorFormat  = CStifLogger::EData;
+           }
+        else if( aValue == _L( "XML" ) )
+           {
+           iSettingServer->iLoggerSettings.iEmulatorFormat  = CStifLogger::ETxt;
+          
+           }
+       
+        iSettingServer->iLoggerSettings.iIsDefined.iFormat = ETrue;
+    }
+    else if(aKey==KEmulatorOutput)
+    {
+        
+        if( aValue == _L( "FILE" ) )
+            {
+            iSettingServer->iLoggerSettings.iEmulatorOutput = CStifLogger::EFile;
+            }
+        else if( aValue == _L( "RDEBUG" ) )
+            {
+            iSettingServer->iLoggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
+            }
+        iSettingServer->iLoggerSettings.iIsDefined.iOutput = ETrue;
+    }
+    else if(aKey==KHardwareBasePath)
+    {
+        iSettingServer->iLoggerSettings.iHardwarePath = aValue;
+        iSettingServer->iLoggerSettings.iIsDefined.iOutput = ETrue;
+    }
+    else if(aKey==KHardwareFormat)
+    {
+        
+        if( aValue == _L( "TXT" ) )
+           {
+           iSettingServer->iLoggerSettings.iHardwareFormat = CStifLogger::ETxt;
+           }
+        else if( aValue == _L( "HTML" ) )
+           {
+           iSettingServer->iLoggerSettings.iHardwareFormat  = CStifLogger::EHtml;
+           }
+        else if( aValue == _L( "DATA" ) )
+           {
+           iSettingServer->iLoggerSettings.iHardwareFormat  = CStifLogger::EData;
+           }
+        else if( aValue == _L( "XML" ) )
+           {
+           iSettingServer->iLoggerSettings.iHardwareFormat  = CStifLogger::ETxt;
+          
+           }
+        iSettingServer->iLoggerSettings.iIsDefined.iHwFormat = ETrue;
+    }
+    else if(aKey==KHardwareOutput)
+    {
+        if( aValue == _L( "FILE" ) )
+            {
+            iSettingServer->iLoggerSettings.iHardwareOutput = CStifLogger::EFile;
+            }
+        else if( aValue == _L( "RDEBUG" ) )
+            {
+            iSettingServer->iLoggerSettings.iHardwareOutput = CStifLogger::ERDebug;
+            }
+         iSettingServer->iLoggerSettings.iIsDefined.iHwOutput = ETrue;
+    }
+    else if(aKey==KFileCreationMode)
+    {
+        if( aValue == _L( "APPEND" ) )
+            {
+            iSettingServer->iLoggerSettings.iOverwrite = EFalse;
+            }
+        else if( aValue == _L( "OVERWRITE") )
+            {
+            iSettingServer->iLoggerSettings.iOverwrite = ETrue;
+            }
+        iSettingServer->iLoggerSettings.iIsDefined.iOverwrite = ETrue;
+    }
+    else if(aKey==KWithTimeStamp)
+    {
+    
+        if( aValue == _L( "NO" ) )
+           {
+           iSettingServer->iLoggerSettings.iTimeStamp = EFalse;
+           }
+      
+        else if( aValue == _L( "YES" ) )
+           {
+           iSettingServer->iLoggerSettings.iTimeStamp = ETrue;
+           }
+        iSettingServer->iLoggerSettings.iIsDefined.iTimeStamp = ETrue;
+    }
+    else if(aKey==KWithLineBreak)
+    {
+        if( aValue == _L( "NO" ) )
+           {
+           iSettingServer->iLoggerSettings.iLineBreak = EFalse;
+           }
+      
+        else if( aValue == _L( "YES" ) )
+           {
+           iSettingServer->iLoggerSettings.iLineBreak = ETrue;
+           }
+        iSettingServer->iLoggerSettings.iIsDefined.iLineBreak = ETrue;
+    }
+    else if(aKey==KWithEventRanking)
+    {
+        if( aValue == _L( "NO" ) )
+          {
+          iSettingServer->iLoggerSettings.iEventRanking = EFalse;
+          }
+     
+       else if( aValue == _L( "YES" ) )
+          {
+          iSettingServer->iLoggerSettings.iEventRanking = ETrue;
+          }
+       iSettingServer->iLoggerSettings.iIsDefined.iEventRanking = ETrue;
+    }
+    else if(aKey==KThreadIdToLogFile)
+    {
+        if( aValue == _L( "NO" ) )
+          {
+          iSettingServer->iLoggerSettings.iThreadId = EFalse;
+          }
+     
+       else if( aValue == _L( "YES" ) )
+          {
+          iSettingServer->iLoggerSettings.iThreadId = ETrue;
+          }
+        iSettingServer->iLoggerSettings.iIsDefined.iThreadId = ETrue;
+    }
+    else if(aKey==KFileUnicode)
+    {
+        if( aValue == _L( "NO" ) )
+          {
+          iSettingServer->iLoggerSettings.iUnicode = EFalse;
+          }
+     
+       else if( aValue == _L( "YES" ) )
+          {
+          iSettingServer->iLoggerSettings.iUnicode = ETrue;
+          }
+        iSettingServer->iLoggerSettings.iIsDefined.iUnicode = ETrue;
+    }
+    else if(aKey==KAddTestCaseTitle)
+    {
+       if( aValue == _L( "NO" ) )
+         {
+         iSettingServer->iLoggerSettings.iAddTestCaseTitle = EFalse;
+         }
+    
+      else if( aValue == _L( "YES" ) )
+         {
+         iSettingServer->iLoggerSettings.iAddTestCaseTitle = ETrue;
+         }
+       iSettingServer->iLoggerSettings.iIsDefined.iAddTestCaseTitle = ETrue;
+    }
+    
+    
+    return KErrNone;
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CLoggerSetting
+
+    Method: ReadLoggerDefaults
+
+    Description: Parse Logger defaults from STIF initialization
+                 file.
+
+    Parameters: None
+
+    Return Values: TInt: Return Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CLoggerSetting::ReadLoggerDefaults()
+    {
+    __TRACE( KInit,( _L( "" ) ) );
+    __TRACE( KInit,( _L( "CLoggerSetting::ReadLoggerDefaults" ) ) );
+    __TRACE( KInit,( _L( "Start reading and parsing Logger defaults" ) ) );
+
+    TInt ret = KErrNone;
+    
+    // Create parser for parsing ini file
+    CStifParser* parser = NULL;
+    TRAPD( r, parser = CStifParser::NewL( _L(""), iSettingServer->iIniFile ) );
+    if ( r != KErrNone )
+        {
+        __TRACE( KError,( CStifLogger::ERed, _L( "Can't open ini-file [%S], code %d" ), &iSettingServer->iIniFile, r ) );
+        return r;
+        }
+
+    TTestEngineUtils::ParseLoggerDefaults( parser, iSettingServer->iLoggerSettings, LOGGER );    
+    
+    delete parser;
+
+    return ret;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: GetLoggerSettings
+
+    Description: Get Logger settings. Mainly use from Logger side.
+
+    If there are not any active sessions, then stop active scheduler and
+    close whole server.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CLoggerSetting::GetLoggerSettings( const RMessage2& aMessage )
+    {
+    __TRACE( KInit, ( _L( "CLoggerSetting::GetLoggerSettings in" ) ) );
+    
+    // Copies logger settings to the package
+    TPckg<TLoggerSettings> loggerSettingsPckg( iSettingServer->iLoggerSettings );
+
+    // Writes a packege that includes the logger overwrite settings to aMessage
+    TRAPD( err, aMessage.WriteL( 0, loggerSettingsPckg ) );
+
+    if ( err != KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        }
+
+    __TRACE( KInit, ( _L( "CLoggerSetting::GetLoggerSettings out" ) ) );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSettingServer
+
+    Method: SetNewIniFileSetting
+
+    Description: Set new initialization file settings to WINS and HW platforms.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CLoggerSetting::SetLoggerOutputPath( const RMessage2& aMessage )
+    {
+    __TRACE( KInit, ( _L( "CLoggerSetting::SetNewIniFileSetting" ) ) );
+    
+    TInt ret( 0 );
+
+    TName loggerOutputPath;
+    // Get data from message
+    // NOTE! If message length is over TName, ReadL will cut the message
+    // to allowed size and won't return any error code or leave code.
+    TRAP( ret, aMessage.ReadL( 0, loggerOutputPath ) );
+
+    if ( ret != KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        return KErrBadDescriptor;
+        }
+
+    iSettingServer->iLoggerSettings.iEmulatorPath = loggerOutputPath;
+    iSettingServer->iLoggerSettings.iIsDefined.iPath = ETrue;
+    iSettingServer->iLoggerSettings.iHardwarePath = loggerOutputPath;
+    iSettingServer->iLoggerSettings.iIsDefined.iHwPath = ETrue;
+
+    __TRACE( KInit, ( _L( "New emulator and hardware path: [%S]" ), &loggerOutputPath ) );
+
+    return KErrNone;
+    }
+
+TInt CLoggerSetting::ResetLoggerSettings( const RMessage2& aMessage )
+    {
+    __TRACE( KInit, ( _L( "CLoggerSetting::ResetLoggerSettings" ) ) );
+
+    iSettingServer->ResetLoggerSettings();
+    return KErrNone;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/StifPythonFunEng.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,73 @@
+/*
+* 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: This file contains StifPythonFunEng implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "StifPythonFunEng.h"
+#include <e32svr.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 ===============================
+
+// -----------------------------------------------------------------------------
+// GetNewIndexForThreadL
+// Function countss all threads named like pythonscripter* and returns index for
+// the new thread for pythonscripter.
+// -----------------------------------------------------------------------------
+TInt GetNewIndexForThreadL(void)
+	{
+	TInt max_index = 0;
+	// * as a wildcard for the name search
+	_LIT(KFindAll, "pythonscripter*");
+
+	// default RThread object, has a handle of the current thread
+	RThread thread;
+	TFullName fullName;
+	TFindThread finder(KFindAll);
+
+	while(finder.Next(fullName) == KErrNone)
+		{
+		max_index++;
+		}
+	return max_index;
+	}
+//
+// ============================ MEMBER FUNCTIONS ===============================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/TestCaseController.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,2877 @@
+/*
+* 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: This module contains implementation of 
+* CTestCaseController class member functions.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <e32uid.h>
+#include <StifLogger.h>
+#include "StifTFwIfProt.h"
+#include "TestCaseController.h"
+#include "TestModuleController.h"
+#include "TestReport.h"
+#include "Logging.h"
+#include "StifHWReset.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 =======================================
+// None
+
+
+#define LOGGER iEngine->Logger()
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: CTestCaseController
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+                CAtsLogger& aAtsLogger: in: Reference to CAtsLogger
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+                const TTestInfo& aTestInfo: in: Test Info
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseController::CTestCaseController( CTestEngine* aEngine,
+                                          CTestReport* aTestReport,
+                                          CAtsLogger& aAtsLogger,
+                                          RTestExecution aTestExecution,
+                                          const TTestInfo& aTestInfo ) :
+    CActive( CActive::EPriorityStandard ),
+    iEngine( aEngine ),
+    iTestReport( aTestReport ),
+    iTestExecution( aTestExecution ),
+    iTestInfo( aTestInfo ),
+    iState( ETestCaseIdle ),
+    iResultPckg( iResult ),
+    iAtsLogger( aAtsLogger )
+    {
+    CActiveScheduler::Add( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseController::ConstructL()
+    {
+    __TRACE( KVerbose, ( _L( "CTestCaseController::ConstructL, [%S]" ), &iTestInfo.iTestCaseInfo.iTitle ) );
+
+    // Logger settings
+    TLoggerSettings loggerSettings;
+    loggerSettings.iCreateLogDirectories = EFalse;
+    loggerSettings.iOverwrite = ETrue;
+    loggerSettings.iTimeStamp = EFalse;
+    loggerSettings.iLineBreak = EFalse;
+    loggerSettings.iEventRanking = EFalse;
+    loggerSettings.iThreadId = EFalse;
+    loggerSettings.iHardwareFormat = CStifLogger::ETxt;
+    loggerSettings.iHardwareOutput = CStifLogger::ERDebug;
+    loggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+    loggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
+    loggerSettings.iUnicode = EFalse;
+    loggerSettings.iAddTestCaseTitle = EFalse;
+
+    iRDebugLogger = CStifLogger::NewL( _L( "" ), _L( "" ), loggerSettings );
+
+    // If timeout is specified, then create timeout handler.
+    if ( iTestInfo.iTestCaseInfo.iTimeout > TTimeIntervalMicroSeconds(0) )
+        {
+        iTimeout = CTestCaseTimeout::NewL ( this,
+                                            iTestInfo.iTestCaseInfo.iTimeout );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                CTestReport* aTestReport: in: Pointer to CTestReport
+                CAtsLogger& aAtsLogger: in: Reference to CAtsLogger
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+                const TTestInfo& aTestInfo: in: Test Info
+
+    Return Values: CTestCaseController* : pointer to created object
+
+    Errors/Exceptions: Leaves if construction of CTestCaseController fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseController* CTestCaseController::NewL( CTestEngine* aEngine,
+                                               CTestReport* aTestReport,
+                                               CAtsLogger& aAtsLogger,
+                                               RTestExecution aTestExecution,
+                                               const TTestInfo& aTestInfo )
+    {
+    CTestCaseController* self = new ( ELeave ) CTestCaseController( aEngine,
+        aTestReport, aAtsLogger, aTestExecution, aTestInfo );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: ~CTestCaseController
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseController::~CTestCaseController()
+    {
+    __TRACE( KVerbose, ( _L( "CTestCaseController::~CTestCaseController" ) ) );
+    Cancel();
+
+    delete iRDebugLogger;
+    delete iTimeout;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: StartL
+
+    Description: Start active object
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseController::StartL( const RMessage2& aMessage )
+    {
+    iRDebugLogger->Log( _L( "Starting testcase [%S]" ), &iTestInfo.iTestCaseInfo.iTitle );
+    __TRACE( KInit, ( _L(" Starting testcase [%S]"), &iTestInfo.iTestCaseInfo.iTitle ) );
+
+    // Check that this request is not pending!!
+    __ASSERT_ALWAYS( iState != ETestCaseRunning,
+                            iEngine->PanicClient( EReqPending, aMessage ) );
+    iMessage = aMessage;
+
+    iState = ETestCaseRunning;
+    
+    SetActive();
+
+    iTestExecution.RunTestCase( iResultPckg, iStatus );    
+
+    // If testcase has timeout (handler), then start it
+    if ( iTimeout )
+        {
+        iTimeout->Start();
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: Timeout
+
+    Description: Timeouts active request.
+    - Cancel request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseController::Timeout()
+    {
+    if ( iState == ETestCaseRunning )
+        {
+        iState = ETestCaseTimeout;
+        Cancel();
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: RunL
+
+    Description: RunL handles completed requests. Leaves are handled in
+                 RunError method
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if AddTestCaseResultL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseController::RunL()
+    {
+    iState = ETestCaseCompleted;
+
+
+    // "iStatus.Int()" error code is received from system's framework not from
+    // test case execution.
+    if ( iStatus.Int() != KErrNone )
+        {
+            if ( iStatus.Int() == KErrServerTerminated )
+            {
+            // something went badly wrong!
+            __TRACE( KInit, ( CStifLogger::ERed, 
+                _L( "TestCase [%S] cannot be executed, STIF panics with[%d]" ),
+                &iTestInfo.iTestCaseInfo.iTitle,
+                iStatus.Int() ) );       
+                
+            __TRACE( KInit, ( CStifLogger::ERed, 
+                _L( "Possible reason: Test case has paniced seriously" ) ) );
+
+            // We don't leave here but we write information to 
+            // forward(testreport etc.)
+            _LIT( KLeaveInfo, "Test case execution fails" );
+            // Sets test case to crash category
+            iResult.iCaseExecutionResultCode = iStatus.Int();
+            // Test case result
+            iResult.iTestResult.iResult = iStatus.Int();
+            iResult.iTestResult.iResultDes = KLeaveInfo;
+
+            } 
+        
+            else
+            {   
+        // For example testmodule's NewL or testmodule's constructor has
+        // leaved and STIF cannot connect to test module
+        __TRACE( KInit, ( CStifLogger::ERed, 
+            _L( "TestCase [%S] cannot execute, TestModule loading operations fails with[%d]" ),
+            &iTestInfo.iTestCaseInfo.iTitle,
+            iStatus.Int() ) );
+        __TRACE( KInit, ( CStifLogger::ERed, 
+            _L( "Possible reason: TestModule's NewL or Constructor has leaved and STIF cannot connect to test module" ) ) );
+
+        // We don't leave here but we write information to 
+        // forward(testreport etc.)
+        _LIT( KLeaveInfo, "TestModule loading fails, cannot connect to the TestModule" );
+        // Sets test case to crash category
+        iResult.iCaseExecutionResultCode = iStatus.Int();
+        // Test case result
+        iResult.iTestResult.iResult = iStatus.Int();
+        iResult.iTestResult.iResultDes = KLeaveInfo;
+            }
+        }
+        
+	else
+	{
+			
+    // Cancel event request, because the testcase is completed
+    iTestExecution.CancelAsyncRequest( ETestExecutionNotifyEvent );        
+	}
+
+    // Test case is executed
+    if( iTestInfo.iTestCaseInfo.iTitle.Length() > 0 )
+        {
+        iRDebugLogger->Log( _L( "TestCase [%S] finished with verdict[%d]. Message:[%S]." ),
+                            &iTestInfo.iTestCaseInfo.iTitle,
+                            iResult.iTestResult.iResult,
+                            &(iResult.iTestResult.iResultDes) );
+
+        __TRACE( KInit, ( _L( " TestCase [%S] finished with verdict[%d]. Message:[%S]." ),
+                            &iTestInfo.iTestCaseInfo.iTitle,
+                            iResult.iTestResult.iResult,
+                            &(iResult.iTestResult.iResultDes) ) );
+        }
+    else
+        {
+        iRDebugLogger->Log( _L( "TestCase [%d] finished with verdict[%d]. Message:[%S]." ),
+                            iTestInfo.iTestCaseInfo.iCaseNumber,
+                            iResult.iTestResult.iResult,
+                            &(iResult.iTestResult.iResultDes) );
+
+        __TRACE( KInit, ( _L( " TestCase [%d] finished with verdict[%d]. Message:[%S]." ),
+                            iTestInfo.iTestCaseInfo.iCaseNumber,
+                            iResult.iTestResult.iResult,
+                            &(iResult.iTestResult.iResultDes) ) );
+        }
+    __TRACE( KVerbose, ( 
+            _L( "CTestCaseController::RunL: iStatus=[%d]" ), iStatus.Int() ));
+
+    GenerateXmlLogL();
+
+    // Report test case result
+    if( iTestReport )
+        {
+        iTestReport->AddTestCaseResultL( iTestInfo, iResult, iStatus.Int() );
+        iTestReport->UpdateReportSummaryL();
+        }
+
+    TRAPD( ret, iMessage.WriteL( 0, iResultPckg ) );
+
+    // Case done
+    iMessage.Complete( ret );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseController::DoCancel()
+    {
+
+    switch ( iState )
+        {
+        case ETestCaseRunning:
+            iTestExecution.CancelAsyncRequest( ETestExecutionRunTestCase );
+            if( iTestInfo.iTestCaseInfo.iTitle.Length() > 0 )
+                {
+                iRDebugLogger->Log( _L( "TestCase [%S] execution aborted" ),
+                                    &iTestInfo.iTestCaseInfo.iTitle );
+
+                __TRACE( KInit, ( _L( "TestCase [%S] execution aborted" ),
+                                    &iTestInfo.iTestCaseInfo.iTitle ) );
+                }
+            else
+                {
+                iRDebugLogger->Log( _L( "TestCase [%S] execution aborted" ),
+                                    iTestInfo.iTestCaseInfo.iCaseNumber );
+
+                __TRACE( KInit, ( _L( "TestCase [%S] execution aborted" ),
+                                    iTestInfo.iTestCaseInfo.iCaseNumber ) );
+                }
+            break;
+        case ETestCaseTimeout:
+            iTestExecution.CancelAsyncRequest( ETestExecutionRunTestCase );
+            // Update result to timeout
+            iResult.iCaseExecutionResultType = TFullTestResult::ECaseTimeout;
+            iResult.iTestResult.iResultDes = _L("Test case was timeouted and cancelled");
+
+            if( iTestReport )
+                {
+                iTestReport->AddTestCaseResultL( iTestInfo, iResult, KErrTimedOut );
+                }
+
+            if( iTestInfo.iTestCaseInfo.iTitle.Length() > 0 )
+                {
+                iRDebugLogger->Log( _L( "TestCase [%S] finished with verdict[%d]. Message:[%S]." ),
+                                    &iTestInfo.iTestCaseInfo.iTitle,
+                                    iResult.iTestResult.iResult,
+                                    &(iResult.iTestResult.iResultDes) );
+
+                __TRACE( KInit, ( _L( " TestCase [%S] finished with verdict[%d]. Message:[%S]." ),
+                                    &iTestInfo.iTestCaseInfo.iTitle,
+                                    iResult.iTestResult.iResult,
+                                    &(iResult.iTestResult.iResultDes) ) );
+                }
+            else
+                {
+                iRDebugLogger->Log( _L( "TestCase [%d] finished with verdict[%d]. Message:[%S]." ),
+                                    iTestInfo.iTestCaseInfo.iCaseNumber,
+                                    iResult.iTestResult.iResult,
+                                    &(iResult.iTestResult.iResultDes) );
+
+                __TRACE( KInit, ( _L( " TestCase [%d] finished with verdict[%d]. Message:[%S]." ),
+                                    iTestInfo.iTestCaseInfo.iCaseNumber,
+                                    iResult.iTestResult.iResult,
+                                    &(iResult.iTestResult.iResultDes) ) );
+                }            
+            
+            break;
+        case ETestCaseSuicided:
+            {
+            //Store current results because cancel operation overwrites it
+            TInt currentTestResult = iResult.iTestResult.iResult;
+            TInt currentExecutionResult = iResult.iCaseExecutionResultCode;
+            iTestExecution.CancelAsyncRequest(ETestExecutionRunTestCase);
+            // Update result to suicide
+            switch(iStopExecutionType)
+                {
+                case EOk:
+                    iResult.iCaseExecutionResultType = TFullTestResult::ECaseExecuted;
+                    iResult.iTestResult.iResultDes = _L("Test case passed (StopExecution())");
+                    break;
+                case EFail:
+                    iResult.iCaseExecutionResultType = TFullTestResult::ECaseExecuted;
+                    iResult.iTestResult.iResultDes = _L("Test case failed (StopExecution())");
+                    break;
+                default: //EAbort
+                    iResult.iCaseExecutionResultType = TFullTestResult::ECaseSuicided;
+                    iResult.iTestResult.iResultDes = _L("Test case killed (StopExecution())");
+                }
+            iResult.iTestResult.iResult = currentTestResult;
+            iResult.iCaseExecutionResultCode = currentExecutionResult;
+            }
+            if(iTestReport)
+                {
+                iTestReport->AddTestCaseResultL(iTestInfo, iResult, KErrNone);
+                }
+
+            // Log some message
+            if(iTestInfo.iTestCaseInfo.iTitle.Length() > 0)
+                {
+                _LIT(KTestCaseDesc, "TestCase [%S] finished with verdict [%d]. Message:[%S].");
+                switch(iStopExecutionType)
+                    {
+                    case EOk:
+                        {
+                        _LIT(KTestCaseResult, "***Testcase PASSED***");
+
+                        iRDebugLogger->Log(KTestCaseResult);
+                        __TRACE(KInit, (KTestCaseResult));
+                        iRDebugLogger->Log(KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
+                        __TRACE(KInit, (KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
+                        break;
+                        }
+                    case EFail:
+                        {
+                        _LIT(KTestCaseResult, "***Testcase FAILED***");
+
+                        iRDebugLogger->Log(KTestCaseResult);
+                        __TRACE(KInit, (KTestCaseResult));
+                        iRDebugLogger->Log(KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
+                        __TRACE(KInit, (KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
+                        break;
+                        }
+                    default: //EAbort
+                        {
+                        _LIT(KTestCaseResult, "***Testcase KILLED***");
+
+                        iRDebugLogger->Log(KTestCaseResult);
+                        __TRACE(KInit, (KTestCaseResult));
+                        iRDebugLogger->Log(KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
+                        __TRACE(KInit, (KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
+                        }
+                    }
+                }
+            else
+                {
+                _LIT(KTestCaseDesc, "TestCase [%d] finished with verdict [%d]. Message:[%S].");
+                switch(iStopExecutionType)
+                    {
+                    case EOk:
+                        {
+                        _LIT(KTestCaseResult, "***Testcase PASSED***");
+
+                        iRDebugLogger->Log(KTestCaseResult);
+                        __TRACE(KInit, (KTestCaseResult));
+                        iRDebugLogger->Log(KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
+                        __TRACE(KInit, (KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
+                        break;
+                        }
+                    case EFail:
+                        {
+                        _LIT(KTestCaseResult, "***Testcase FAILED***");
+
+                        iRDebugLogger->Log(KTestCaseResult);
+                        __TRACE(KInit, (KTestCaseResult));
+                        iRDebugLogger->Log(KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
+                        __TRACE(KInit, (KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
+                        break;
+                        }
+                    default: //EAbort
+                        {
+                        _LIT(KTestCaseResult, "***Testcase KILLED***");
+
+                        iRDebugLogger->Log(KTestCaseResult);
+                        __TRACE(KInit, (KTestCaseResult));
+                        iRDebugLogger->Log(KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
+                        __TRACE(KInit, (KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
+                        }
+                    }
+                }
+            break;
+        case ETestCaseIdle:
+        case ETestCaseCompleted:
+        default:
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestCaseController, "CTestCaseController" );
+            User::Panic( KTestCaseController, EDoCancelDisorder );
+            break;
+        }
+
+    // Write result and complete 
+    TRAPD( ret, iMessage.WriteL( 0, iResultPckg ) );
+
+    iMessage.Complete( ret );  
+        
+    iState = ETestCaseCompleted;
+    
+    // Generate xml result log
+    GenerateXmlLogL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: RunError
+
+    Description: Handle errors.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCaseController::RunError( TInt aError )
+    {
+    __TRACE( KError, ( CStifLogger::ERed, 
+        _L( "CTestCaseController::RunError: Test case execution has failed! aError=[%d]" ), aError ) );
+    TInt completionError = aError;
+
+    // Write result, because it could include descriptive result for
+    // failed case
+    TRAPD( err, iMessage.WriteL( 0, iResultPckg ); );
+
+    if ( err != KErrNone )
+        {
+        completionError = err;
+        }
+
+    // Complete message with error
+    iMessage.Complete( completionError );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: GenerateXmlLogL
+
+    Description: Generate XML log.
+
+    Parameters: None
+
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseController::GenerateXmlLogL()
+    {
+    
+    // Report result with AtsLogger
+    iAtsLogger.BeginTestCaseReportL( iTestInfo.iTestCaseInfo.iTitle, 
+                                     KErrNone,  // Expected result not supported
+                                     iResult.iStartTime );
+    
+    if( iResult.iCaseExecutionResultCode != KErrNone )
+        {
+        iAtsLogger.SetTestCaseResultL( iResult.iCaseExecutionResultCode );
+        iAtsLogger.TestCaseFailed();  
+        if( iResult.iTestResult.iResultDes.Length() > 0 )
+            {
+            iAtsLogger.ErrorL( iResult.iTestResult.iResultDes );   
+            } 
+        }
+     else
+        {
+        iAtsLogger.SetTestCaseResultL( iResult.iTestResult.iResult ); 
+        if( iResult.iTestResult.iResult == KErrNone )
+            {
+            iAtsLogger.TestCasePassed();  
+            }
+        else
+            {
+            iAtsLogger.TestCaseFailed();  
+            if( iResult.iTestResult.iResultDes.Length() > 0 )
+                {
+                iAtsLogger.ErrorL( iResult.iTestResult.iResultDes );    
+                }
+            }
+        }
+    // Set test case result to ATS Logger
+    iAtsLogger.EndTestCaseL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: GetTestCaseInfo
+
+    Description: Get testcase info(test module, config file, test case, etc).
+
+    Parameters: TTestInfo& aTestInfo: inout: Test information
+
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseController::GetTestCaseInfo( TTestInfo& aTestInfo )
+    {
+    aTestInfo = iTestInfo;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseController
+
+    Method: Suicide
+
+    Description: Cancels active request.
+
+    Parameters: aCode: the reason of suicide
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseController::Suicide(TStopExecutionType aType, TInt aCode)
+    {
+    if(iState == ETestCaseRunning)
+        {
+        iStopExecutionType = aType;
+        switch(iStopExecutionType)
+            {
+            case EOk:
+                iResult.iTestResult.iResult = KErrNone;
+                iResult.iCaseExecutionResultCode = KErrNone;
+                break;
+            case EFail:
+                iResult.iTestResult.iResult = aCode;
+                iResult.iCaseExecutionResultCode = KErrNone;
+                break;
+            default: //EAbort
+                iResult.iTestResult.iResult = aCode;
+                iResult.iCaseExecutionResultCode = aCode;
+            }
+        iState = ETestCaseSuicided;
+        Cancel();
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestProgressNotifier class member
+    functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: CTestProgressNotifier
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestProgressNotifier::CTestProgressNotifier( CTestEngine* aEngine,
+                             RTestExecution aTestExecution ) :
+    CActive( CActive::EPriorityStandard ),
+    iEngine( aEngine ),
+    iTestExecution( aTestExecution ),
+    iState( ETestProgressIdle ),
+    iProgressPckg( iProgress )
+    {
+    CActiveScheduler::Add( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestProgressNotifier::ConstructL()
+    {
+    __TRACE( KVerbose, ( _L( "CTestProgressNotifier::ConstructL" ) ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+
+    Return Values: CTestProgressNotifier* : pointer to created object
+
+    Errors/Exceptions: Leaves if construction of CTestProgressNotifier fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestProgressNotifier* CTestProgressNotifier::NewL( CTestEngine* aEngine,
+                             RTestExecution aTestExecution )
+    {
+    CTestProgressNotifier* self = new ( ELeave ) CTestProgressNotifier(
+        aEngine, aTestExecution );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: ~CTestProgressNotifier
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestProgressNotifier::~CTestProgressNotifier()
+    {
+    __TRACE( KVerbose, ( _L( "CTestProgressNotifier::~CTestProgressNotifier" ) ) );
+    Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: StartL
+
+    Description: Start active object
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestProgressNotifier::StartL( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestProgressNotifier::StartL" ) ) );
+    // Check that this request is not pending!!
+    __ASSERT_ALWAYS( iState != ETestProgressPending,
+                        iEngine->PanicClient( EReqPending, aMessage ) );
+    iMessage = aMessage;
+
+    iState = ETestProgressPending;
+    SetActive();
+
+    iTestExecution.NotifyProgress( iProgressPckg, iStatus );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if WriteL leaves
+                       Leaves if iStatus is not KErrNone or KErrEof
+                       Leaves are handled in RunError method
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestProgressNotifier::RunL()
+    {
+    __TRACE( KVerbose, (_L("CTestProgressNotifier::RunL: iStatus=[%d]" ), iStatus.Int() ));
+
+    iState = ETestProgressCompleted;
+
+    // Check that request was successful or completed with acceptable error
+    // KErrEof is acceptable error and it means that the test case will not
+    // send progresses anymore (because it is closed)
+    if ( KErrNone == iStatus.Int() )
+        {
+        iMessage.WriteL( 0, iProgressPckg );
+        }
+    else if ( KErrEof != iStatus.Int() )
+        {
+        // Leave, error will be handled in RunError
+        User::Leave( iStatus.Int() );
+        }
+
+    // Complete message
+    iMessage.Complete( iStatus.Int() );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestProgressNotifier::DoCancel()
+    {
+    switch ( iState )
+        {
+        case ETestProgressPending:
+            iTestExecution.CancelAsyncRequest( ETestExecutionNotifyProgress );
+            iMessage.Complete( KErrCancel );
+            break;
+        case ETestProgressIdle:
+        case ETestProgressCompleted:
+        default:
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestProgressNotifier, "CTestProgressNotifier" );
+            User::Panic( KTestProgressNotifier, EDoCancelDisorder );
+            break;
+        }
+    iState = ETestProgressIdle;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: RunError
+
+    Description: Handle errors.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestProgressNotifier::RunError( TInt aError )
+    {
+    // Complete message with error
+    iMessage.Complete( aError );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestEventNotifier class member
+    functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: CTestEventNotifier
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEventNotifier::CTestEventNotifier( CTestEngine* aEngine, 
+                                        RTestExecution aTestExecution ) :
+    CActive( CActive::EPriorityStandard ),
+    iEngine( aEngine ),
+    iTestExecution( aTestExecution ),
+    iState( ETestEventIdle ),
+    iEventPckg( iEvent ),
+    iEventNotifyPckg( iEventNotify ),
+    iController( NULL )
+    {
+    CActiveScheduler::Add( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEventNotifier::ConstructL( )
+    {
+    __TRACE( KVerbose, ( _L( "CTestEventNotifier::ConstructL" ) ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+
+    Return Values: CTestEventNotifier* : pointer to created object
+
+    Errors/Exceptions: Leaves if construction of CTestEventNotifier fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEventNotifier* CTestEventNotifier::NewL( CTestEngine* aEngine,
+                                              RTestExecution aTestExecution )
+    {
+    CTestEventNotifier* self = new ( ELeave ) CTestEventNotifier(
+        aEngine, aTestExecution );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: ~CTestEventNotifier
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEventNotifier::~CTestEventNotifier()
+    {
+    __TRACE( KVerbose, ( _L( "CTestEventNotifier::~CTestEventNotifier" ) ) );
+    Cancel();
+    iEventArray.ResetAndDestroy();
+    iEventArray.Close();
+    delete iController;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: StartL
+
+    Description: Start active object
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEventNotifier::Start()
+    {
+    __TRACE( KVerbose, ( _L( "CTestEventNotifier::StartL" ) ) );
+    // Check that this request is not pending!!
+    __ASSERT_ALWAYS( iState != ETestEventPending,
+        User::Leave( KErrAlreadyExists ) );
+
+    iEvent.SetType( TEventIf::EEnable );
+    iState = ETestEventPending;
+    iTestExecution.NotifyEvent( iEventPckg, iStatus );
+    SetActive();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone
+                       Leaves if iState is not ETestEventPending
+                       Leaves if some leaving method called here leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEventNotifier::RunL()
+    {
+    __TRACE( KVerbose, ( _L( "CTestEventNotifier::RunL: iStatus=[%d]" ), iStatus.Int() ) );
+
+    User::LeaveIfError( iStatus.Int() );
+
+    switch( iState )
+        {
+        case ETestEventPending:
+            {
+            iState = ETestEventCompleted;
+            
+            switch( iEvent.Type() )
+                {
+                case TEventIf::EReqEvent:
+                    {
+                    __RDEBUG( ( _L("CTestEventNotifier(ReqEvent) %S"), 
+                        &iEvent.Name() ));
+                    if( iEngine->IsStateEventAndSet( iEvent.Name() ) )
+                        {
+                        __TRACE( KVerbose, ( _L( "CTestEventNotifier::RunL: Requested Global event already set" ) ) );
+                        TEventIf event( TEventIf::ESetEvent, iEvent.Name(),
+                                        TEventIf::EState );
+                        TEventIfPckg eventPckg( event );
+                        TRequestStatus status;
+                        iTestExecution.NotifyEvent( eventPckg, status );
+                        User::WaitForRequest( status );
+                        }
+                    //add to iEventArray
+                    HBufC* name = iEvent.Name().AllocLC();
+                    if( iEventArray.Append( name ) != KErrNone )
+                        {
+                        User::Leave( KErrNoMemory );
+                        }
+                    CleanupStack::Pop( name );
+                    }
+                    break;                    
+                case TEventIf::ERelEvent:
+                    {
+                    __TRACE( KVerbose, ( _L( "CTestEventNotifier(RelEvent) %S" ), &iEvent.Name() ) );
+                    //remove from iEventArray
+                    TInt count = iEventArray.Count();
+                    const TDesC& eventName = iEvent.Name();
+                    TInt i;
+                    for( i = 0; i < count; i++ )
+                        {
+                        TPtrC name = iEventArray[i]->Des();
+                        if( name == eventName )
+                            {
+                            HBufC* tmp = iEventArray[i];
+                            iEventArray.Remove( i );
+                            delete tmp;
+                            break;
+                            }
+                        }
+                    // Check that event was found
+                    if( i == count )
+                        {
+                        User::Leave( KErrGeneral );
+                        }         
+                    }
+                    break;                    
+                case TEventIf::ESetEvent:
+                    {
+                    __RDEBUG( ( _L("CTestEventNotifier(SetEvent) %S"), 
+                        &iEvent.Name() ));
+                    delete iController;
+                    iController = NULL;
+                    iController = iEngine->CtlEventL( iEvent, iStatus );
+                    SetActive();
+                    return;
+                    }
+                case TEventIf::EUnsetEvent:
+                    {
+                    __RDEBUG( ( _L("CTestEventNotifier(UnsetEvent) %S"), 
+                        &iEvent.Name() ));
+                    delete iController;
+                    iController = NULL;
+                    iController = iEngine->CtlEventL( iEvent, iStatus );
+                    SetActive();
+                    return;
+                    }
+                default:
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+            // Set request again
+            Start();                
+            // Otherwise request is enabled again later
+            }
+            break;
+        case ETestEventCompleted:
+            __RDEBUG( ( _L("CTestEventNotifier(Complete)")));
+            Start();
+            break;
+        default:
+            User::Leave( KErrGeneral );
+            break;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEventNotifier::DoCancel()
+    {
+    __TRACE( KVerbose, ( _L( "CTestEventNotifier::DoCancel" ) ) );
+
+    switch ( iState )
+        {
+        case ETestEventPending:
+            iTestExecution.CancelAsyncRequest( ETestExecutionNotifyEvent );
+            break;
+        case ETestEventCompleted:
+            delete iController;
+            iController = NULL;
+            break;
+        default:
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestEventNotifier, "CTestEventNotifier" );
+            User::Panic( KTestEventNotifier, EDoCancelDisorder );
+            break;
+        }
+
+    iState = ETestEventIdle;
+    iEventArray.ResetAndDestroy();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: RunError
+
+    Description: Handle errors.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEventNotifier::RunError( TInt aError )
+    {
+    switch ( iState )
+        {
+        case ETestEventPending:
+            if( aError != KErrCancel )
+                {
+                __TRACE( KError, ( CStifLogger::ERed, _L( "CTestEventNotifier::RunError %d"), aError) );
+                }
+            else
+                {
+                __TRACE( KVerbose, ( _L( "CTestEventNotifier stopped")) );
+                }
+
+            // We stop event notifier if we get error here
+            // Clear requested event list
+            iEventArray.ResetAndDestroy();
+            break;
+        case ETestEventCompleted:
+            // Do not close here
+            __TRACE( KError, ( CStifLogger::ERed, _L( "CTestEventNotifier::RunError %d"), aError) );
+            delete iController;
+            iController = NULL;
+            // forward error to testcase
+            iEvent.SetType( TEventIf::EEnable );
+            iState = ETestEventPending;
+            iTestExecution.NotifyEvent( iEventPckg, iStatus, aError );
+            SetActive();
+            break;
+        default:
+            __TRACE( KError, ( CStifLogger::ERed, _L( "CTestEventNotifier::RunError %d"), aError) );
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestEventNotifier, "CTestEventNotifier" );
+            User::Panic( KTestEventNotifier, EDoCancelDisorder );
+            break;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: CtlEventL
+
+    Description: Controls events
+
+    Parameters: const TEventIf& aEvent: in: Event
+                TRequestStatus& aStatus: in: Request status
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEventNotifier::CtlEvent( const TEventIf& aEvent, 
+                                    TRequestStatus& aStatus )
+    {
+    __TRACE( KVerbose, ( _L( "CTestEventNotifier::CtlEventL" ) ) );
+    const TDesC& eventName = aEvent.Name();
+    TInt count = iEventArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        TPtrC name = iEventArray[i]->Des();
+        if( name == eventName )
+            {
+            iEventNotify.Copy( aEvent );
+            iTestExecution.NotifyEvent( iEventNotifyPckg, aStatus );
+            return;
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: CheckCtlEventL
+
+    Description: Checks if CtlEvent should be called
+
+    Parameters: const TEventIf& aEvent: in: Event
+
+    Return Values: ETrue: If CtlEvent sould be called.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestEventNotifier::CheckCtlEvent( const TEventIf& aEvent )
+    {
+    const TDesC& eventName = aEvent.Name();
+    TInt count = iEventArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        TPtrC name = iEventArray[i]->Des();
+        if( name == eventName )
+            {
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestEventController class member
+    functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: CTestEventController
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                const TEventIf& aEvent: in: Event
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEventController::CTestEventController( CTestEngine* aEngine, 
+                                            const TEventIf& aEvent ) :
+    iEngine( aEngine ),
+    iRequestStatus( NULL ),
+    iEventPckg( iEvent ),
+    iActiveEventCmds( 0 )
+    {
+    iEvent.Copy( aEvent );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: TRequestStatus* aStatus: in: Request status
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEventController::ConstructL( TRequestStatus* aStatus )
+    {
+    iEngine->Logger()->Log( _L( "CTestEventController::ConstructL" ) );
+
+    if( CheckEventsL() == 0 )
+        {
+        // No request was pending, complete immediately
+        User::RequestComplete( aStatus, KErrNone );
+        }
+    else
+        {
+        iRequestStatus = aStatus;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: RMessage& aMessage: inout: Message to be handled
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEventController::ConstructL( RMessage2& aMessage )
+    {
+    iEngine->Logger()->Log( _L( "CTestEventController::ConstructL" ) );
+
+    if( CheckEventsL() == 0 )
+        {
+        // No request was pending, complete immediately
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        iMessage = aMessage;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                const TEventIf& aEvent: in: Event
+                TRequestStatus* aStatus: in: Request status
+
+    Return Values: CTestEventController* : pointer to created object
+
+    Errors/Exceptions: Leaves if construction of CTestEventController fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+
+CTestEventController* CTestEventController::NewL( CTestEngine* aEngine,
+                                                  const TEventIf& aEvent,
+                                                  TRequestStatus* aStatus )
+    {
+    CTestEventController* self = 
+        new ( ELeave )CTestEventController( aEngine, aEvent );
+    CleanupStack::PushL( self );
+    self->ConstructL( aStatus );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventNotifier
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                const TEventIf& aEvent: in: Event
+                RMessage& aMessage: inout: Message to be handled
+
+    Return Values: CTestEventController* : pointer to created object
+
+    Errors/Exceptions: Leaves if construction of CTestEventController fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEventController* CTestEventController::NewL( CTestEngine* aEngine,
+                                                  const TEventIf& aEvent,
+                                                  RMessage2& aMessage )
+    {
+    CTestEventController* self = 
+        new ( ELeave )CTestEventController( aEngine, aEvent );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMessage );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: ~CTestEventController
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+
+CTestEventController::~CTestEventController()
+    {
+	if( iEngine != NULL )
+		{
+		if( iEngine->Logger() != NULL )
+			{
+			iEngine->Logger()->Log( _L( "CTestEventController::~CTestEventController" ) );
+			}
+		}
+    
+    if( iRequestStatus )
+        {
+        // Must be completed if pending, otherwise  
+        // CTestEventNotifier::DoCancel blocks
+        User::RequestComplete( iRequestStatus, KErrCancel );
+        }
+            
+    iEventCallBacks.ResetAndDestroy();
+    iEventCallBacks.Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: CheckEventsL
+
+    Description: Check all events.
+
+    Parameters: None
+
+    Return Values: TInt: Active event commands
+
+    Errors/Exceptions: Leaves if CtlEventL leaves
+                       Leaves if memory allocation fails
+                       Leaves if unset event not found from pending 
+                            state event list 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/  
+TInt CTestEventController::CheckEventsL()
+    {
+    iEngine->Logger()->Log( _L( "CTestEventController::CheckEventsL" ) );
+
+    iActiveEventCmds += CheckClientEventsL();
+    iActiveEventCmds += CheckTestcaseEventsL();
+
+    return iActiveEventCmds;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: CheckClientEventsL
+
+    Description: Check client events.
+
+    Parameters: None
+
+    Return Values: TInt: Request of pending
+
+    Errors/Exceptions: Leaves if CtlEventL leaves
+                       Leaves if memory allocation fails
+                       Leaves if unset event not found from pending 
+                            state event list 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/  
+TInt CTestEventController::CheckClientEventsL()
+    {
+    iEngine->Logger()->Log( _L( "CTestEventController::CheckClientEventsL" ) );
+    TInt reqPending = 0;
+
+    // Check client event requests
+    TInt count = iEngine->ClientEvents().Count();
+    for( TInt index = 0; index < count; index++ )
+        {
+        if( iEngine->ClientEvents()[index]->Name() == iEvent.Name() )
+            {
+            TEventMsg* event = iEngine->ClientEvents()[index]; 
+            if( iEvent.Type() == TEventIf::ESetEvent )
+                {
+                // Set found event 
+                event->Set( iEvent.EventType() );
+                }
+            else if( iEvent.Type() == TEventIf::EUnsetEvent )
+                {
+                // Unset found event
+                // Create callback for change notifier
+                TCallBack callBack( EventCallBack, this );
+                CCallBack* eventCallBack = new (ELeave)CCallBack( callBack,
+                                                    CActive::EPriorityHigh );
+                CleanupStack::PushL( eventCallBack );
+                
+                event->Unset( eventCallBack->Status() ); 
+                reqPending++;
+                eventCallBack->SetActive();
+                User::LeaveIfError( iEventCallBacks.Append( eventCallBack ) );
+                CleanupStack::Pop( eventCallBack );
+                }       
+            break;
+            }
+        }
+
+    return reqPending;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: CheckTestcaseEventsL
+
+    Description: Check testcase events.
+
+    Parameters: None
+
+    Return Values: TInt: Request of pending
+
+    Errors/Exceptions: Leaves if CtlEventL leaves
+                       Leaves if memory allocation fails
+                       Leaves if unset event not found from pending 
+                            state event list 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEventController::CheckTestcaseEventsL()
+    {
+    TInt reqPending = 0;
+    TCallBack callBack( EventCallBack, this );
+    CCallBack* eventCallBack = NULL;
+
+    // Then check testcase event requests
+    TInt count = iEngine->TestCaseArray().Count();
+    eventCallBack = new (ELeave)CCallBack( callBack, 
+                                           CActive::EPriorityHigh );
+    CleanupStack::PushL( eventCallBack );
+    for ( TInt index = 0; index < count; index++ )
+        {
+
+        if( iEngine->TestCaseArray()[index]->CheckCtlEvent( iEvent ))
+            {
+            reqPending++;
+            eventCallBack->SetActive();
+            iEngine->TestCaseArray()[index]->CtlEvent( iEvent, 
+                                                          eventCallBack->Status() );                                                          
+            User::LeaveIfError( iEventCallBacks.Append( eventCallBack ) );
+            CleanupStack::Pop( eventCallBack );
+            eventCallBack = new (ELeave)CCallBack( callBack, 
+                                                   CActive::EPriorityHigh );
+            CleanupStack::PushL( eventCallBack );    
+            }
+        }
+    CleanupStack::PopAndDestroy( eventCallBack );
+    return reqPending;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: EventComplete
+
+    Description: EventComplete handles completed event requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEventController::EventComplete()
+    {
+    iEngine->Logger()->Log( _L( "CTestEventController::EventComplete" ));
+
+    iActiveEventCmds--;
+    
+    if( iActiveEventCmds == 0 )
+        {
+        TInt error = KErrNone;
+        TInt count = iEventCallBacks.Count();
+        for( TInt i=0; i<count; i++ )
+            {
+            if( iEventCallBacks[i]->iStatus.Int() != KErrNone )
+                {
+                error = iEventCallBacks[i]->iStatus.Int();
+                break;
+                }
+            }
+        iEventCallBacks.ResetAndDestroy();
+            
+        // All event commands are completed
+        if( iRequestStatus )
+            {
+            User::RequestComplete( iRequestStatus, error );
+            }
+        else
+            {
+            // No request was pending, complete immediately
+            iMessage.Complete( error );
+            }
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEventController
+
+    Method: EventCallBack
+
+    Description: static EventCallBack handles completed event requests.
+
+    Parameters: TAny* aTestEventController: in: Test event controller
+
+    Return Values: TInt: returns KErrNone
+
+    Errors/Exceptions:None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEventController::EventCallBack( TAny* aTestEventController )
+    {
+    CTestEventController* controller =
+                                (CTestEventController*) aTestEventController;
+    controller->EventComplete();
+    return KErrNone;
+
+    }
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestRemoteCmdNotifier class member
+    functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgressNotifier
+
+    Method: CTestRemoteCmdNotifier
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestRemoteCmdNotifier::CTestRemoteCmdNotifier( CTestEngine* aEngine,
+                             RTestExecution aTestExecution,
+                             CTestCaseController* aTestCaseController,
+                             CAtsLogger& aAtsLogger ) :
+    CActive( CActive::EPriorityStandard ),
+    iEngine( aEngine ),
+    iTestExecution( aTestExecution ),
+    iState( ETestProgressIdle ),
+    iRemoteTypePckg( iRemoteType ),
+    iMsgSizePckg( iMsgSize ),
+    iTestCaseController( aTestCaseController ),
+    iAtsLogger( aAtsLogger )
+    {
+    CActiveScheduler::Add( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestRemoteCmdNotifier::ConstructL( )
+    {
+    __TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::ConstructL" ) ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+
+    Return Values: CTestRemoteCmdNotifier* : pointer to created object
+
+    Errors/Exceptions: Leaves if construction of CTestRemoteCmdNotifier fails
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestRemoteCmdNotifier* CTestRemoteCmdNotifier::NewL( CTestEngine* aEngine,
+                             RTestExecution aTestExecution,
+                             CTestCaseController* aTestCaseController,
+                             CAtsLogger& aAtsLogger )
+    {
+    CTestRemoteCmdNotifier* self = new ( ELeave ) CTestRemoteCmdNotifier(
+        aEngine, aTestExecution, aTestCaseController, aAtsLogger );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: ~CTestRemoteCmdNotifier
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestRemoteCmdNotifier::~CTestRemoteCmdNotifier()
+    {
+    __TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::~CTestRemoteCmdNotifier" ) ) );
+    Cancel();
+
+    delete iReceivedMsg;
+    iReceivedMsg = 0;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: EnableReceive
+
+    Description: Prepare to start active object
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestRemoteCmdNotifier::EnableReceive( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::EnableReceive" ) ) );
+    
+    iMessage = aMessage;
+    iMessageAvail = ETrue;
+    
+    Start( aMessage );
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: GetReceivedMsg
+
+    Description: Read received message
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestRemoteCmdNotifier::GetReceivedMsg( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::GetReceivedMsg" ) ) );
+    
+    TInt ret = KErrNone;
+    if( iReceivedMsg )
+        {
+        TRAP( ret, aMessage.WriteL( 0, iReceivedMsg->Des() ) );
+        delete iReceivedMsg;
+        iReceivedMsg = 0;
+        }
+    else
+        {
+        ret = KErrNotFound;
+        }
+        
+    // Complete message
+    aMessage.Complete( ret );
+                
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: StartL
+
+    Description: Start active object
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestRemoteCmdNotifier::Start( const RMessage2& aMessage )
+    {
+    // Check that this request is not pending!!
+    __ASSERT_ALWAYS( iState != ETestProgressPending,
+                    iEngine->PanicClient( EReqPending, aMessage ) );
+    iState = ETestProgressPending;
+    SetActive();
+    // Start first phase of the remote command's operations
+    iTestExecution.NotifyRemoteCmd( iRemoteTypePckg, 
+                                    iMsgSizePckg, 
+                                    iStatus );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: CancelReq
+
+    Description: Cancel the request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestRemoteCmdNotifier::CancelReq()
+    {
+    if(iMessageAvail)
+        {
+        iMessageAvail = EFalse;
+        iMessage.Complete( KErrCancel );
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if WriteL leaves
+                       Leaves if iStatus is not KErrNone or KErrEof
+                       Leaves are handled in RunError method
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestRemoteCmdNotifier::RunL()
+    {
+    __TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::StartL: iStatus=[%d]" ), iStatus.Int() ) );
+
+    User::LeaveIfError( iStatus.Int() );
+    
+    iState = ETestProgressCompleted;
+
+    TInt ret( 0 );
+    switch( iRemoteType )
+        {
+        case EStifCmdSend:             // "Sending"
+            {
+            if( ( iMessageAvail == EFalse ) ||
+                ( iMsgSize <= 0 ) )
+                { 
+                User::Leave( KErrGeneral );
+                }
+            // Delete previous if exists
+            delete iReceivedMsg;
+            iReceivedMsg = 0;
+            // Create new buffer 
+            iReceivedMsg = HBufC8::NewL( iMsgSize );
+
+            // Start second phase of the remote command's operations,
+            // buffer is read with GetReceivedMsg
+            TPtr8 tmp = iReceivedMsg->Des();
+            ret = iTestExecution.ReadRemoteCmdInfo( tmp, iRemoteType );
+
+            // Writing received info to UI
+            iMessage.WriteL( 0, iRemoteTypePckg );
+            iMessage.WriteL( 1, iMsgSizePckg );
+            
+            // Complete message
+            iMessage.Complete( ret );
+            iMessageAvail = EFalse;
+
+            break;
+            }
+        case EStifCmdReboot:           // "Sending"
+            {
+            TRebootParams remoteType;
+            TRebootParamsPckg remoteTypePckg( remoteType );
+            // Start second phase of the remote command's operations
+            ret = iTestExecution.ReadRemoteCmdInfo( remoteTypePckg, iRemoteType );
+            __TRACE( KInit, ( CStifLogger::ERed, _L("REBOOT PHONE (type %d)" ), remoteType.aType ) );
+
+            if( remoteType.aType == CTestModuleIf::EKernelReset )
+                {
+                __TRACE( KInit, ( _L("Rebooting with kernel reset" ) ) );
+                __TRACE( KInit, ( _L("Kernel reset implementation is ongoing, trying different reset..." ) ) );
+                }
+
+#ifdef __WINS__
+            __TRACE( KInit, ( _L("Rebooting with Process kill(WINS)" ) ) );
+            RProcess thisProcess;
+            //thisProcess.SetSystem( ETrue );
+            thisProcess.Kill( KErrNone );
+            thisProcess.Close();
+#else // Hardware specific
+            TInt r( KErrNone );
+            __TRACE( KInit, ( _L("Rebooting with reset module(HW)" ) ) );
+            r = DynamicResetModule( remoteType.aType );
+            if( r != KErrNone )
+                {
+                __TRACE( KInit, ( CStifLogger::EError, _L("This reseting type is failed, trying different reset...")) );
+                }
+#endif // Hardware specific
+
+            // if( !remoteType.aType == CTestModuleIf::EDefaultReset )
+            // Note this change needs an error code tranceiver between reboot
+            // module and engine. (If reboot fails return error code, if reboot
+            // is default then kill process else error code returning)
+
+            // Do process kill as a last option
+            __TRACE( KInit, ( _L("Rebooting with Process kill" ) ) );
+           
+            RProcess thisProcess2;         
+            thisProcess2.Kill( KErrNone );
+            thisProcess2.Close();
+
+            // If this text is shown in UI something is wrong and this needs some investigation.
+            iEngine->ErrorPrint( 0, _L( "Reboot phone...E.g. disconnect battery!!!" ) );
+            break;
+            }
+        case EStifCmdStoreState:       // "Sending"
+            {
+            if( iMessageAvail == EFalse )
+                { 
+                User::Leave( KErrGeneral );
+                }
+            TRebootStateParams remoteState;
+            TRebootStateParamsPckg remoteStatePckg( remoteState );
+
+            // Start second phase of the remote command's operations
+            ret = iTestExecution.ReadRemoteCmdInfo( remoteStatePckg,
+                                                    iRemoteType );
+
+            // Get test case information(test module, test case file, etc.)
+            TTestInfo testInfo;
+            iTestCaseController->GetTestCaseInfo( testInfo );
+
+            // Write state informations to the file
+            iEngine->WriteRebootParams( testInfo, remoteState.aCode,
+                                        remoteState.aName );
+                                                        
+            // Write ATS loggers buffers to drive
+            iEngine->FlushAtsLogger();
+
+            // Pause test cases that there cannot make e.g. new store state
+            // calls. iCaseNumber is index type value so increment by one to
+            // get current test case.
+            iEngine->PauseAllTestCases();
+            // Resume current test case
+            iTestCaseController->iTestExecution.Resume();
+
+            // Writing received info to UI
+            iMessage.WriteL( 0, iRemoteTypePckg );
+
+            // Complete message
+            iMessage.Complete( ret );
+            iMessageAvail = EFalse;
+            break;
+            }
+        case EStifCmdGetStoredState:   // "Reading, this must be done with two phase"
+            {
+            // Get test case information(test module, test case file, etc.)
+            TTestInfo testInfo;
+            iTestCaseController->GetTestCaseInfo( testInfo );
+
+            TGetRebootStoredParams remoteStoredState;
+            // Read state informations from the file
+            TInt errorCodeToClient = 
+                iEngine->ReadRebootParams( testInfo, 
+                                           remoteStoredState.aName,
+                                           remoteStoredState.aCode );
+
+            TGetRebootStoredParamsPckg remoteStoredPckg( remoteStoredState );
+
+            // Start second phase of the remote command's operations
+            ret = iTestExecution.ReadRemoteCmdInfo( remoteStoredPckg,
+                                                    iRemoteType,
+                                                    errorCodeToClient );
+            
+            Start( iMessage ); // Starts active object
+
+            break;
+            }
+       case EStifCmdMeasurement:   // "Reading, this must be done with two phase"
+            {
+            TGetMeasurementOptions remoteMeasurementOptions;
+            remoteMeasurementOptions.iOptions = iEngine->StifMeasurement();
+
+            TGetMeasurementOptionsPckg remoteMeasurementPckg( remoteMeasurementOptions );
+
+            // Start second phase of the remote command's operations
+            ret = iTestExecution.ReadRemoteCmdInfo( remoteMeasurementPckg,
+                                                    iRemoteType,
+                                                    KErrNone );
+            
+            Start( iMessage ); // Starts active object
+
+            break;
+            }
+
+        case EStifCmdReceive:          // "Reading"
+        default:
+            User::Leave( KErrNotFound );
+            break;
+        }
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestRemoteCmdNotifier::DoCancel()
+    {
+    switch ( iState )
+        {
+        case ETestProgressPending:
+            iTestExecution.CancelAsyncRequest( ETestExecutionNotifyRemoteCmd );
+            //iMessage.Complete( KErrCancel );
+            break;
+        case ETestProgressIdle:
+        case ETestProgressCompleted:
+        default:
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestRemoteCmdNotifier, "CTestRemoteCmdNotifier" );
+            User::Panic( KTestRemoteCmdNotifier, EDoCancelDisorder );
+            break;
+        }
+    iState = ETestProgressIdle;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: RunError
+
+    Description: Handle errors.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestRemoteCmdNotifier::RunError( TInt aError )
+    {
+    // Complete message with error
+    if(iMessageAvail)
+        {
+        iMessageAvail = EFalse;
+        iMessage.Complete( aError );
+        }
+    
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestRemoteCmdNotifier
+
+    Method: ResetL
+
+    Description: Reset HW/WINS. Loads dynamically reset module by name.
+
+    Parameters: CTestModuleIf::TRebootType aResetType: in: Reset type
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestRemoteCmdNotifier::DynamicResetModule( 
+                                        CTestModuleIf::TRebootType aResetType )
+    {
+    __TRACE( KInit, (  _L( "DynamicResetModule()" ) ) );
+    RLibrary resetModule;
+    // Load the module
+    TPtrC dllName;
+    dllName.Set( iEngine->GetDeviceResetDllName() );
+    // Loading should work with and without '.dll' extension.
+    TInt r = resetModule.Load( dllName );
+    if ( r != KErrNone )
+        {
+        __TRACE( KError, ( CStifLogger::EError, _L("Can't initialize reset module[%S], code = %d"), &dllName, r ) );
+        return KErrNotFound;
+        }
+    else
+        {
+        // Print reset module name
+        __TRACE( KInit, (  _L("Loaded reset module[%S]"), &dllName ) );
+        }
+
+
+    // Get pointer to first exported function
+    CTestInterfaceFactory libEntry;
+    libEntry = (CTestInterfaceFactory) resetModule.Lookup( 1 );
+    if ( libEntry == NULL )
+        {
+        // New instance can't be created
+        __TRACE ( KError, ( CStifLogger::EError, _L("Can't initialize reset module, NULL libEntry" ) ) );
+        return KErrNoMemory;
+        }
+    else
+        {
+        __TRACE ( KInit, ( _L("Pointer to 1st exported received")));
+        }
+
+    CStifHWReset* reset;
+    reset = NULL;
+
+    // initialize test module
+    __TRACE ( KVerbose, (_L("Calling 1st exported at 0x%x"), (TUint32) libEntry ));
+    TRAPD ( err, reset =  (*libEntry)() );
+
+     // Handle leave from test module
+    if ( err != KErrNone )
+        {
+        __TRACE (KError, ( CStifLogger::EError, _L("Leave when calling 1st exported function, code %d"), err));
+        return err;
+        }
+    else if ( reset == NULL )     // Handle NULL from test module init
+        {
+        __TRACE (KError, ( CStifLogger::EError, _L("NULL pointer received when constructing test module")));
+        delete reset;
+
+        // Set error codes
+        return KErrNoMemory;
+        }
+    else
+        {
+        __TRACE (KInit, (_L("Entrypoint successfully called, test module instance at 0x%x"), (TUint32)reset ) );
+        }
+
+    // Calls dynamically loaded reset module's method.
+    TInt ret = reset->DoReset( aResetType );
+    if( ret != KErrNone )
+        {
+        __TRACE (KInit, (_L("DynamicResetModule; DoReset fails with error: %d"), ret ) );
+        return ret;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestCommandNotifier class member
+    functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: CTestCommandNotifier
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCommandNotifier::CTestCommandNotifier(CTestEngine* aEngine,
+                                           RTestExecution aTestExecution):
+    CActive(CActive::EPriorityStandard),
+    iEngine(aEngine),
+    iTestExecution(aTestExecution),
+    iCommandPckg(iCommand)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCommandNotifier::ConstructL( )
+    {
+    __TRACE(KVerbose, (_L("CTestCommandNotifier::ConstructL")));
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+                RTestExecution aTestExecution: in: Handle to RTestExecution
+
+    Return Values: CTestCommandNotifier* : pointer to created object
+
+    Errors/Exceptions: Leaves if construction of CTestCommandNotifier fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCommandNotifier* CTestCommandNotifier::NewL(CTestEngine* aEngine,
+                                                 RTestExecution aTestExecution)
+    {
+    CTestCommandNotifier* self = new (ELeave) CTestCommandNotifier(aEngine, aTestExecution);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: ~CTestCommandNotifier
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCommandNotifier::~CTestCommandNotifier()
+    {
+    __TRACE(KVerbose, (_L("CTestEventNotifier::~CTestEventNotifier")));
+    Cancel();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: StartL
+
+    Description: Start active object
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCommandNotifier::Start()
+    {
+    __TRACE(KVerbose, (_L("CTestEventNotifier::StartL")));
+
+    TInt res = iTestExecution.NotifyCommand2(iCommandPckg, iParamsPckg, iStatus, KErrNone);
+    SetActive();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone
+                       Leaves if iState is not ETestEventPending
+                       Leaves if some leaving method called here leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCommandNotifier::RunL()
+    {
+    __TRACE(KVerbose, (_L("CTestCommandNotifier::RunL: iStatus=[%d]"), iStatus.Int()));
+
+    User::LeaveIfError(iStatus.Int());
+
+    iEngine->ExecuteCommandL(iCommand, iParamsPckg);
+
+    // Set request again
+    Start();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCommandNotifier::DoCancel()
+    {
+    __TRACE(KVerbose, (_L( "CTestEventNotifier::DoCancel")));
+
+    iTestExecution.CancelAsyncRequest(ETestExecutionNotifyCommand);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCommandNotifier
+
+    Method: RunError
+
+    Description: Handle errors.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCommandNotifier::RunError(TInt aError)
+    {
+    __TRACE(KError, (CStifLogger::ERed, _L("CTestCommandNotifier::RunError %d"), aError));
+    return KErrNone;
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/TestEngine.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5698 @@
+/*
+* 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: This module contains implementation of 
+* CTestEngineServer class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include <f32file.h>
+#include "TestEngineServer.h"
+#include "TestEngine.h"
+#include <TestEngineClient.h>
+#include "TestEngineClientServer.h"
+#include <stifinternal/TestServerClient.h>
+#include "TestModuleController.h"
+#include "TestCaseController.h"
+#include "TestReport.h"
+#include "Logging.h"
+#include "SettingServerClient.h"
+//--PYTHON-- begin
+#include "StifPython.h"
+#include "StifPythonFunEng.h"
+//--PYTHON-- end
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+_LIT( KTestModule, "TestModule=" );
+_LIT( KTestCaseFile, "TestCaseFile=" );
+_LIT( KTestCaseNumber, "TestCaseNumber=" );
+_LIT( KTestCaseTitle, "TestCaseTitle=" );
+_LIT( KStateCode, "StateCode=" );
+_LIT( KStateName, "StateName=" );
+    
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+struct TThreadStartTestEngine
+    {   
+    RThread    iEngineThread; // The server thread
+    RSemaphore iStarted;      // Startup syncronisation semaphore   
+    };
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+   
+    Function: ErrorPrint
+
+    Description: ErrorPrint
+
+    Parameters: const TInt aPriority: in: Priority of error
+                TPtrC aError: in: Error description
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ErrorPrint( const TInt aPriority, 
+                              TPtrC aError )
+    {
+    TErrorNotification error;
+    TErrorNotificationPckg errorPckg ( error );
+
+    error.iModule = _L("TestEngine");
+    error.iPriority = aPriority;
+    error.iText = aError;
+
+    ErrorPrint( errorPckg );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: ErrorPrint
+
+    Description: Sends error notification
+
+    Parameters: TErrorNotificationPckg aError: in: Error
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ErrorPrint( TErrorNotificationPckg aError )
+    {
+    // Add new item to end of queue
+     if ( iErrorQueue.Append ( aError() ) != KErrNone )
+            {
+            RDebug::Print (_L("Error message lost"));
+            return;
+            }
+
+    ProcessErrorQueue();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: ProcessErrorQueue
+
+    Description: Process error queue
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ProcessErrorQueue()
+    {
+    // If message is available, complete first item from queue
+    if ( iErrorMessageAvailable )
+        {
+        
+        if ( iErrorQueue.Count() > 0 )
+            {
+            TErrorNotification err = iErrorQueue[0];
+            TErrorNotificationPckg errPckg(err);
+            iErrorQueue.Remove(0);
+        
+        	TInt r( KErrNone );
+        
+            TRAP( r, iErrorMessage.WriteL( 0, errPckg ) );
+
+            // Do not handle errors
+
+            iErrorMessageAvailable = EFalse;
+            iErrorMessage.Complete( KErrNone );
+            }
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LeaveIfErrorWithNotify
+
+    Description: If error leave with notify
+
+    Parameters: TInt aCode: in: Error code
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::LeaveIfErrorWithNotify( TInt aCode )
+      {
+      LeaveIfErrorWithNotify ( aCode, _L("Check testengine log") );
+
+      }
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LeaveIfErrorWithNotify
+
+    Description: If error leave with notify
+
+    Parameters: TInt aCode: in: Error code
+                const TDesC& aText: in: Descriptive text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::LeaveIfErrorWithNotify( TInt aCode,
+                                          const TDesC& aText )
+    {
+    if ( aCode != KErrNone )
+        {
+           LeaveWithNotifyL ( aCode, aText );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Function: LeaveWithNotifyL
+
+    Description: Leave with notify
+
+    Parameters: TInt aCode: in: Error code
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::LeaveWithNotifyL( TInt aCode )
+    {
+    LeaveWithNotifyL ( aCode, _L("Check testengine log") );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Function: LeaveWithNotifyL
+
+    Description: Leave with notify
+
+    Parameters: TInt aCode: in: Error code
+                const TDesC& aText: in: Descriptive text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::LeaveWithNotifyL( TInt aCode,
+                                   const TDesC& aText )
+    {
+    ErrorPrint ( 0, aText );
+    User::Leave ( aCode );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestEngine class member functions.
+
+-------------------------------------------------------------------------------
+*/
+#undef LOGGER
+#define LOGGER Logger()
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: CTestEngine
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: RThread& aClient: in: Client's thread
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+    CTestEngine::CTestEngine() :
+        CSession2(),
+    iTestReport(NULL),    
+    iReportMode( CTestReport::ETestReportFull ),
+    iReportOutput( CTestReport::ETestReportNone ),        
+    iEnumerateModuleCount( 0 ),
+    iIsTestReportGenerated( EFalse ),
+    iDisableMeasurement( EEnableAll)
+   
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: CTestEngineServer* aServer: in: Pointer to CTestEngineServer
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ConstructL( CTestEngineServer* aServer )
+    {
+    // Create report setting
+    iTestReportSettings = CTestReportSettings::NewL();
+    
+    // Second-phase construct base class
+    //CSession2::CreateL();
+
+    iTestEngineServer = aServer;
+
+    // Create new object index
+    iTestCases = CObjectIx::NewL();
+    
+    // Initialize the object container from Server
+    iContainer = iTestEngineServer->NewContainerL();
+
+    __TRACE( KInit, ( _L( "CTestEngine::ConstructL: Test Engine Created" ) ) );
+
+    RFs iFs;
+    User::LeaveIfError( iFs.Connect() );
+    _LIT(KCSteve,"C:\\Testframework\\");
+    iFs.MkDirAll(KCSteve);
+
+    iFs.Close();
+
+    iIndexTestModuleControllers = 1;
+
+    SetTestEngineDefaultSettings();    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: RThread& aClient : Client's thread
+                CTestEngineServer* aServer : Pointer to CTestEngineServer
+
+    Return Values: CTestEngine* : pointer to CTestEngine object
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEngine* CTestEngine::NewL( CTestEngineServer* aServer )
+    {
+    CTestEngine* self = new ( ELeave ) CTestEngine();
+    CleanupStack::PushL( self );
+    self->ConstructL( aServer );
+    CleanupStack::Pop();
+    return self;
+    }
+
+CTestEngine::~CTestEngine()
+    {
+    // Remove contents of iTestCases
+    if ( iTestCases )
+        {
+        TInt handle;
+        CObject* object = NULL;
+        TInt count = iTestCases->Count();
+
+        for ( TInt i = 0; i < count; i++ )
+            {
+            object = iTestCases->operator[](i);
+            if ( object )
+                {
+                handle = iTestCases->At( object );
+                iTestCases->Remove( handle );       
+                }
+            }
+
+        delete iTestCases;
+        iTestCases = NULL;
+        }
+    
+    iTestCaseArray.Close();    
+    
+    CloseTestEngineL();
+
+    if ( !iIsTestReportGenerated  && RetrieveTestReport() )
+        {
+        iTestReport->GenerateReportL();
+        iIsTestReportGenerated = ETrue;
+        }
+    CloseSession();    
+    delete iTestReportSettings;
+    iTestReportSettings = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: CloseSession
+
+    Description: Close client server session to Test Engine
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::CloseSession() 
+    {
+    __TRACE( KInit, ( _L( "CTestEngine::CloseSession" ) ) );
+
+    iErrorQueue.Close();
+
+    // Delete device reset module's DLL name
+    delete iDeviceResetDllName;
+    iDeviceResetDllName = NULL;
+
+    // Delete state events
+    iStateEvents.ResetAndDestroy();
+    iStateEvents.Close();
+
+    //Delete Client events
+    iClientEvents.ResetAndDestroy();
+    iClientEvents.Close();
+
+    // Delete the object container
+    // This provides unique ids for the objects of this session
+    iTestEngineServer->DeleteContainer( iContainer );
+
+    // Inform server that session is closed
+    iTestEngineServer->SessionClosed();
+
+    // Delete test report
+    delete iTestReport;
+    iTestReport = NULL;    
+    
+    delete iIniFile;
+    iIniFile = NULL;
+
+    delete iRebootPath;
+    iRebootPath = NULL;
+
+    delete iRebootFilename;
+    iRebootFilename = NULL;
+
+    delete iRebootParams;
+    iRebootParams = 0;
+
+    __TRACE(KVerbose, ( _L( "CTestEngine::CloseSession finished" ) ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: CountResources
+
+    Description: Resource counding
+
+    Parameters: None
+
+    Return Values: TInt Resource count
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::CountResources()
+    {
+    return iResourceCount;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: NumResources
+
+    Description: Get resources, writes to Message()
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::NumResources( const RMessage2& aMessage )
+    {
+
+    TInt ret( 0 );
+
+    TPckgBuf<TInt> countPckg( iResourceCount );
+
+    TRAP( ret, aMessage.WriteL( 0, countPckg ) );
+
+    if ( ret != KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        }
+
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: PanicClient
+
+    Description: Panic the client
+
+    Parameters: TTestEnginePanic aPanic: in: Panic number
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::PanicClient( TTestEnginePanic aPanic,
+                                const RMessage2& aMessage ) const
+    {
+    iTestEngineServer->Logger()->Log( CStifLogger::ERed, _L( "CTestEngine::PanicClient [%d]" ), aPanic );
+
+    _LIT( KTestEngine, "CTestEngine" );
+
+    aMessage.Panic( KTestEngine, aPanic );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ServiceL
+
+    Description: Message handling method that calls trapped DispatchMessageL
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Error from DispatchMessageL is trapped and handled
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ServiceL( const RMessage2& aMessage )
+    {
+    TRAPD( ret, DispatchMessageL( aMessage ) );
+    if ( ret != KErrNone )
+        {
+         __TRACE(KError, ( CStifLogger::ERed, _L( "CTestEngine::DispatchMessageL Function=[%d], left with [%d]" ),
+                                                aMessage.Function(), ret ) );
+        if( ret == KErrNoMemory )
+            {
+            __TRACE( KError, ( CStifLogger::ERed, _L( "No memory available. Some possibility to do: 1. Reduce test case count. 2. Increase StifTestEngine's heap size." ) ) );
+            }
+        aMessage.Complete( ret );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: DispatchMessageL
+
+    Description: Actual message handling
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::DispatchMessageL( const RMessage2& aMessage )
+    {
+    iComplete = ETrue;
+    iReturn = KErrNone;
+
+    switch ( aMessage.Function() )
+        {
+        case ETestEngineLoadConfiguration:
+            {
+            LoadConfigurationL( aMessage );
+            break;
+            }
+        case ETestEngineUpdateLogConfiguration:
+            {
+            UpdateLogConfigurationL( aMessage );
+            break;
+            }
+        case ETestEngineUpdateEngineConfiguration:
+            {
+            UpdateEngineConfigurationL( aMessage );
+            break;
+            }
+        case ETestEngineSetAttribute:
+            {
+            SetAttributeL( aMessage );
+            break;
+            }
+        case ETestEngineAddTestModule:
+            {
+            AddTestModuleL( aMessage );
+            break;
+            }
+        case ETestEngineRemoveTestModule:
+            {
+            iReturn = RemoveTestModuleL( aMessage );
+            break;
+            }
+        case ETestEngineAddConfigFile:
+            {
+            AddConfigFileL( aMessage );
+            break;
+            }
+        case ETestEngineRemoveConfigFile:
+            {
+            RemoveConfigFileL( aMessage );
+            break;
+            }
+        case ETestEngineEnumerateTestCases:
+            {
+            EnumerateTestCasesL( aMessage );
+            break;
+            }
+        case ETestEngineGetTestCases:
+            {
+            GetTestCasesL( aMessage );
+            break;
+            }
+        case ETestEngineCancelAsyncRequest:
+            {
+            CancelAsyncRequest( aMessage );
+            break;
+            }
+        case ETestEngineEvent:
+            {
+            EventControlL( aMessage );
+            iComplete = EFalse;
+            break;
+            }
+        case ETestEngineErrorNotification:
+            {
+            HandleErrorNotificationL( aMessage );
+            iComplete = EFalse;
+            break;
+            }
+        case ETestEngineLoggerSettings:
+            {
+            LoggerSettings( aMessage );
+            break;
+            }
+        case ETestEngineReportTestCase:
+            {
+            iReturn = AddTestCaseToTestReport(aMessage);
+            break;
+            }
+        // Subsession specific functions
+        case ETestCaseCreateSubSession:
+            {
+            NewTestCaseL( aMessage );
+            break;
+            }
+        case ETestCaseCloseSubSession:
+            {
+            DeleteTestCase( aMessage.Int3() );
+            break;
+            }
+        case ETestCaseRunTestCase:
+            {
+            TestCaseByHandle( aMessage.Int3(), aMessage )->RunTestCaseL( aMessage );
+            iComplete = EFalse;
+            break;
+            }
+        case ETestCasePause:
+            {
+            iReturn = TestCaseByHandle( aMessage.Int3(), aMessage )->Pause();
+            break;
+            }
+        case ETestCaseResume:
+            {
+            iReturn = TestCaseByHandle( aMessage.Int3(), aMessage )->Resume();
+            break;
+            }
+        case ETestCaseNotifyProgress:
+            {
+            TestCaseByHandle( aMessage.Int3(), aMessage )->NotifyProgressL( aMessage );
+            iComplete = EFalse;
+            break;
+            }
+        case ETestCaseNotifyRemoteType:
+            {
+            TestCaseByHandle( aMessage.Int3(), aMessage )->NotifyRemoteTypeL( aMessage );
+            iComplete = EFalse;
+            break;
+            }
+        case ETestCaseNotifyRemoteMsg:
+            {
+            TestCaseByHandle( aMessage.Int3(), aMessage )->NotifyRemoteMsgL( aMessage );
+            iComplete = EFalse;
+            break;
+            }
+        case ETestCaseCancelAsyncRequest:
+            {
+            TestCaseByHandle( 
+                aMessage.Int3(), aMessage )->CancelAsyncRequest( aMessage );
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+    
+    if ( iComplete )
+        {
+        aMessage.Complete( iReturn );
+        }
+
+    }
+
+void CTestEngine::SetTestEngineDefaultSettings()
+    {
+    // Test report settings initialization
+    iTestReportSettings->iCreateTestReport = ETrue;
+    _LIT( path, "C:\\LOGS\\TestFramework\\");
+    _LIT( name, "TestReport");
+    delete iTestReportSettings->iPath;
+    iTestReportSettings->iPath = NULL;
+    iTestReportSettings->iPath = path().AllocL();
+    delete iTestReportSettings->iName;
+    iTestReportSettings->iName = NULL;
+    iTestReportSettings->iName = name().AllocL();
+    iTestReportSettings->iFormat = CStifLogger::ETxt;
+    iTestReportSettings->iOutput = CStifLogger::EFile;
+    iTestReportSettings->iOverwrite = ETrue;
+    
+    iRebootDefaultPath.Set( _L( "C:\\TestFramework\\" ) );
+    iRebootDefaultFilename.Set( _L( "Reboot.txt" ) );
+
+    TPtrC dllName;
+    dllName.Set( _L( "StifHWResetStub.dll" ) );
+    iDeviceResetDllName = dllName.AllocL();
+
+    iDefaultTimeout = 0;
+    iUITestingSupport = EFalse;
+    iSeparateProcesses = EFalse;    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: InitEngineL
+
+    Description: Init the test engine
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::LoadConfigurationL( const RMessage2& aMessage )
+    {
+  
+    // Parse reboot file 
+    ParseRebootParamsL();
+
+    TName iniFileName;
+
+    // Read ini file name from aMessage
+    aMessage.ReadL( 0, iniFileName );
+    TStifUtil::CorrectFilePathL( iniFileName );
+
+    iIniFile = iniFileName.AllocL();
+
+    __TRACE( KInit, ( CStifLogger::EBold, _L( "CTestEngine::InitEngineL\t iIniFile=[%S]" ), iIniFile ) );
+
+    // Connect to the Setting server and open handle(Handle will close when
+    // closing TestEngine).
+    TInt ret = iSettingServer.Connect();
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }    
+
+    if ( iIniFile->Length() > 0 )
+        {
+        Logger()->WriteDelimiter();
+        __TRACE( KInit,( _L( "Starting to parse initialization file" ) ) );
+
+        // Struct to Logger settigs.
+        TLoggerSettings loggerSettings; 
+        // Parse Logger defaults from STIF initialization file.
+        User::LeaveIfError( iSettingServer.LoadLoggerSettingsFromIniFile( loggerSettings, iniFileName, EFalse ) );
+
+        // Create parser for parsing ini file
+        CStifParser* parser = NULL;
+        TRAPD( r, parser = CStifParser::NewL( _L(""), *iIniFile ) );
+        if ( r != KErrNone )
+            {
+            __TRACE( KError,( CStifLogger::ERed, _L( "Can't open ini-file [%S], code %d" ), iIniFile, r ) );
+            LeaveWithNotifyL(r);
+            }
+
+        CleanupStack::PushL( parser );
+
+        CSTIFTestFrameworkSettings* settings = NULL;
+        TRAPD( settings_ret, settings = CSTIFTestFrameworkSettings::NewL() );
+        CleanupStack::PushL( settings );
+        if ( settings_ret != KErrNone )
+            {
+            __TRACE( KError,( CStifLogger::ERed, _L( "CSTIFTestFrameworkSettings class object creation fails") ) );
+            LeaveWithNotifyL( settings_ret );
+            }
+
+        ReadEngineDefaultsL( parser, settings );
+
+        iTestEngineServer->SetLoggerSettings( loggerSettings );
+
+        TRAP(r, ReadTestModulesL( parser ));
+        if(r != KErrNone)
+            {
+            __TRACE(KError, (CStifLogger::ERed, _L("Reading test modules finished with error [%d]"), r));
+            User::Leave(r);
+            }
+
+        CleanupStack::PopAndDestroy( settings );
+        CleanupStack::PopAndDestroy( parser );
+        __TRACE( KInit, ( _L( "Configuration file reading finished" ) ) );
+        }
+    else
+        {
+        __TRACE( KInit,( CStifLogger::EBold, _L( "Initialisation file not specified." ) ) );
+        }
+
+    Logger()->WriteDelimiter();
+    // Notch up another resource
+    iResourceCount++;
+    }
+    
+void CTestEngine::UpdateLogConfigurationL( const RMessage2& aMessage )
+    {
+    TBuf<256> logconfiguration;
+    aMessage.ReadL( 0, logconfiguration );
+    iSettingServer.LoadLoggerSettingsFromCommandLine(logconfiguration);
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ReadEngineDefaults
+
+    Description: Parse Test Engine defaults from STIF 
+                 initialization file.
+
+    Parameters: CStifParser& parser: in: CStifParser object
+                CSTIFTestFrameworkSettings* aSettings: in:
+                CSTIFTestFrameworkSettings object
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ReadEngineDefaultsL( CStifParser* aParser,
+                                        CSTIFTestFrameworkSettings* aSettings )
+    {
+    __TRACE( KInit,( _L( "" ) ) );
+    __TRACE( KInit,( _L( "Start parsing engine defaults" ) ) );
+    TInt get_ret( KErrNone );
+
+    CStifSectionParser* sectionParser = NULL;
+
+    // Parse Engine's default values
+    _LIT( KDefaultsStart, "[Engine_Defaults]" );
+    _LIT( KDefaultsEnd, "[End_Defaults]" );
+    __TRACE( KInit,( _L( "Starting to search sections" ) ) );
+    sectionParser = aParser->SectionL( KDefaultsStart, KDefaultsEnd );
+    CleanupStack::PushL( sectionParser );
+    if ( sectionParser )
+        {
+        __TRACE( KInit,( _L( "Found '%S' and '%S' sections" ), &KDefaultsStart, &KDefaultsEnd ) );
+
+        // Get Test Report Mode
+        __TRACE( KInit,( _L( "Parsing Test report mode" ) ) );
+        TUint reportMode( 0 );
+        get_ret = aSettings->GetReportModeL( sectionParser,
+                                        _L( "TestReportMode=" ), reportMode );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Report mode: %d"), reportMode ) );
+            iReportMode = reportMode;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Report mode not found or not given" ) ) );
+            }
+
+        // Indicator to test report creation
+        __TRACE( KInit,( _L( "Parsing Test report creation indicator" ) ) );
+        TBool createTestReport( 0 );
+        get_ret = aSettings->GetBooleanSettingsL( sectionParser,
+                                _L( "CreateTestReport=" ), createTestReport );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Test report creation indicator: %d"), createTestReport ) );
+            iTestReportSettings->iCreateTestReport = createTestReport;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Creation indicator not found or not given" ) ) );
+            }
+
+        // Get Test report path settings
+        if ( iTestReportSettings->iCreateTestReport )
+            {
+            __TRACE( KInit,( _L( "Parsing Test report path" ) ) );
+            TPtrC path;
+            get_ret = aSettings->GetFileSetting( sectionParser,
+                                        _L( "TestReportFilePath=" ), path );
+            if ( get_ret == KErrNone )
+                {
+                __TRACE( KInit,( _L( "Test report path: %S"), &path ) );
+                // Delete old one before setting new one
+                delete iTestReportSettings->iPath;
+				iTestReportSettings->iPath = NULL;
+                iTestReportSettings->iPath = path.AllocL();
+                }
+            else
+                {
+                __TRACE( KInit,( _L( "Path not found or not given" ) ) );
+                }
+            }
+
+        // Get Test report name settings
+        if ( iTestReportSettings->iCreateTestReport )
+            {
+            __TRACE( KInit,( _L( "Parsing Test report filename" ) ) );
+            TPtrC name;
+            get_ret = aSettings->GetFileSetting( sectionParser,
+                                        _L( "TestReportFileName=" ), name );
+            if ( get_ret == KErrNone )
+                {
+                __TRACE( KInit,( _L( "Test report filename: %S"), &name ) );
+                // Delete old one before setting new one
+                delete iTestReportSettings->iName;
+				iTestReportSettings->iName = NULL;
+                iTestReportSettings->iName = name.AllocL();
+                }
+            else
+                {
+                __TRACE( KInit,( _L( "Filename not found or not given" ) ) );
+                }
+            
+            }
+
+        // Get Test report format settings
+        if ( iTestReportSettings->iCreateTestReport )
+            {
+            __TRACE( KInit,( _L( "Parsing Test report format" ) ) );
+            CStifLogger::TLoggerType type;
+            TBool xml;
+            get_ret = aSettings->GetFormatL( sectionParser,
+                                            _L( "TestReportFormat=" ), type, xml );
+            if ( get_ret == KErrNone )
+                {
+                __TRACE( KInit,( _L( "Test report format: %d, xml: %d"), type, xml ) );
+                iTestReportSettings->iFormat = type;
+                iTestReportSettings->iXML = xml;
+                }
+            else
+                {
+                __TRACE( KInit,( _L( "Format not found or not given" ) ) );
+                }
+            }
+
+        // Get Test report output settings
+        if ( iTestReportSettings->iCreateTestReport )
+            {
+            __TRACE( KInit,( _L( "Parsing Test report output" ) ) );
+            CStifLogger::TOutput output;
+            get_ret = aSettings->GetOutputL( sectionParser,
+                                        _L( "TestReportOutput=" ), output );
+            if ( get_ret == KErrNone )
+                {
+                __TRACE( KInit,( _L( "Test report output: %d"), output ) );
+                iTestReportSettings->iOutput = output;
+                }
+            else
+                {
+                __TRACE( KInit,( _L( "Output not found or not given" ) ) );
+                }
+            }
+
+        // Get Test report file creation mode (overwrite settings)
+        if ( iTestReportSettings->iCreateTestReport )
+            {
+            __TRACE( KInit,( _L( "Parsing Test report file writing mode" ) ) );
+            TBool overwrite;
+            get_ret = aSettings->GetOverwriteL( sectionParser,
+                            _L( "TestReportFileCreationMode=" ), overwrite );
+            if ( get_ret == KErrNone )
+                {
+                __TRACE( KInit,( _L( "Test report file creation mode: %d"), overwrite ) );
+                iTestReportSettings->iOverwrite = overwrite;
+                }
+            else
+                {
+                __TRACE( KInit,( _L( "Writing mode not found or not given" ) ) );
+                }
+            }
+        // Get device reset module's DLL name
+        __TRACE( KInit,( _L( "Parsing device reset module's DLL name" ) ) );
+        TPtrC deviceResetName;
+        get_ret = aSettings->GetFileSetting( sectionParser,
+                                        _L( "DeviceResetDllName=" ), deviceResetName );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Device reset module's name: %S"), &deviceResetName ) );
+            // Delete old one before setting new one
+            delete iDeviceResetDllName;
+			iDeviceResetDllName = NULL;
+            iDeviceResetDllName = deviceResetName.AllocL();
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Device reset module's name not found or not given" ) ) );
+            }
+
+        // Get measurement disable option
+        CStifItemParser* item = NULL;
+        TRAPD( ret, item = sectionParser->GetItemLineL( _L( "DisableMeasurement=" ), ENoTag ) );
+        if( ( ret != KErrNone ) || ( item == NULL ) )
+            {
+             __TRACE( KInit,( _L( "Measurement 'DiableMeasurement=' not found or not given" ) ) );
+			delete item; 
+            item = NULL;
+            }
+        else
+            {
+			CleanupStack::PushL( item );			
+            TPtrC string;
+            ret = item->GetString( KNullDesC(), string );
+            while( ret == KErrNone )
+                {
+                HBufC* stringHbuf = string.AllocL();
+                TPtr modifiableString = stringHbuf->Des();
+                modifiableString.LowerCase();
+
+                if( modifiableString == KStifMeasurementDisableNone ||
+                    modifiableString == KStifMeasurementDisableAll ||
+                    modifiableString == KStifMeasurement01 ||
+                    modifiableString == KStifMeasurement02 ||
+                    modifiableString == KStifMeasurement03 ||
+                    modifiableString == KStifMeasurement04 ||
+                    modifiableString == KStifMeasurement05 ||
+                    modifiableString == KStifMeasurementBappea )
+                    {
+                    __TRACE( KInit,( _L( "Measurement disable option: %S"), &modifiableString ) );
+                    DisableStifMeasurement( modifiableString );
+                    }
+                else if( modifiableString == _L( "#" ) )
+                    {
+					delete stringHbuf;
+					stringHbuf = NULL;
+                    break;
+                    }
+                else
+                    {
+                    __TRACE( KInit,( _L( "Measurement disable option not found or not given" ) ) );
+                    delete stringHbuf;                    
+					stringHbuf = NULL;
+                    break;
+                    }
+                delete stringHbuf;
+                ret = item->GetNextString( string );
+                }
+			CleanupStack::PopAndDestroy( item );
+			item = NULL;
+            }
+
+        // Get timeout value option
+        __TRACE(KInit, (_L("Parsing default timeout value")));
+        iDefaultTimeout = 0;
+        item = NULL;
+        TRAP(ret, item = sectionParser->GetItemLineL(_L("Timeout=" ), ENoTag));
+        if( ( ret != KErrNone ) || ( item == NULL ) )
+            {
+            __TRACE(KInit, (_L("'Timeout' option not found or not given")));
+            delete item;
+            item = NULL;
+            }
+        else
+            {
+            CleanupStack::PushL( item );
+            TPtrC string;
+            ret = item->GetString(KNullDesC(), string);
+            if(string.Length() > 0)
+                {
+                TLex lex(string);
+                ret = lex.Val(iDefaultTimeout);
+                if(ret != KErrNone)
+                    {
+                    __TRACE(KError, (_L("Could not convert timeout value '%S' to integer. Error %d. Ignoring this setting."), &string, ret));
+                    }
+                if(iDefaultTimeout < 0)
+                    {
+                    __TRACE(KError, (_L("'Timeout' value cannot be negative. Resetting to 0.")));
+                    iDefaultTimeout = 0;
+                    }
+                }
+            else
+                {
+                __TRACE(KInit, (_L("'Timeout' value not given")));
+                }
+            CleanupStack::PopAndDestroy( item );
+            item = NULL;
+            }
+        __TRACE(KInit, (_L("'Timeout' value set to %d"), iDefaultTimeout));
+        iDefaultTimeout *= 1000;
+        
+        // Get UITestingSupport value option
+        __TRACE(KInit, (_L("Parsing UITestingSupport value")));
+        iUITestingSupport = EFalse;
+        item = NULL;
+        TRAP(ret, item = sectionParser->GetItemLineL(_L("UITestingSupport=" ), ENoTag));
+        if((ret != KErrNone) || (item == NULL))
+            {
+            __TRACE(KInit, (_L("'UITestingSupport' option not found")));
+            delete item;
+            item = NULL;
+            }
+        else
+            {
+            CleanupStack::PushL(item);
+            TPtrC string;
+            ret = item->GetString(KNullDesC(), string);
+            if(string.Length() > 0)
+                {
+                iUITestingSupport = (string == _L("YES"));
+                }
+            else
+                {
+                __TRACE(KInit, (_L("'UITestingSupport' value not given")));
+                }
+            CleanupStack::PopAndDestroy(item);
+            item = NULL;
+            }
+        __TRACE(KInit, (_L("'UITestingSupport' value set to %d"), iUITestingSupport));
+
+        // Get SeparateProcesses value option
+        __TRACE(KInit, (_L("Parsing SeparateProcesses value")));
+        iSeparateProcesses = EFalse;
+        item = NULL;
+        TRAP(ret, item = sectionParser->GetItemLineL(_L("SeparateProcesses=" ), ENoTag));
+        if((ret != KErrNone) || (item == NULL))
+            {
+            __TRACE(KInit, (_L("'SeparateProcesses' option not found")));
+            delete item;
+            item = NULL;
+            }
+        else
+            {
+            CleanupStack::PushL(item);
+            TPtrC string;
+            ret = item->GetString(KNullDesC(), string);
+            if(string.Length() > 0)
+                {
+                iSeparateProcesses = (string == _L("YES"));
+                }
+            else
+                {
+                __TRACE(KInit, (_L("'SeparateProcesses' value not given")));
+                }
+            CleanupStack::PopAndDestroy(item);
+            item = NULL;
+            }
+        __TRACE(KInit, (_L("'SeparateProcesses' value set to %d"), iSeparateProcesses));
+        }
+    else
+        {
+        __TRACE( KInit,( _L( "Not found '%S' and '%S' sections" ), &KDefaultsStart, &KDefaultsEnd ) );
+        }
+    __TRACE( KInit,( _L( "End parsing engine defaults" ) ) );
+    CleanupStack::PopAndDestroy( sectionParser );
+    
+    }
+
+void CTestEngine::ReadEngineFromCommandLineL(const TDesC& aCommand)
+    {
+    _LIT(KTestReportMode,"TestReportMode");
+    _LIT(KCreateTestReport,"CreateTestReport");
+    _LIT(KTestReportFilePath,"TestReportFilePath");
+    _LIT(KTestReportFileName,"TestReportFileName");
+    _LIT(KTestReportFormat,"TestReportFormat");
+    _LIT(KTestReportOutput,"TestReportOutput");
+    _LIT(KTestReportFileCreationMode,"TestReportFileCreationMode");
+    _LIT(KDeviceResetDllName,"DeviceResetDllName");
+    _LIT(KDisableMeasurement,"DisableMeasurement");
+    _LIT(KTimeout,"Timeout");
+    _LIT(KUITestingSupport,"UITestingSupport");
+    _LIT(KSeparateProcesses,"SeparateProcesses");
+    TInt i=0;
+    TLex lex(aCommand);
+    while ( !lex.Eos() )
+    {
+    TPtrC key=lex.NextToken();
+    i++;
+    TPtrC value=lex.NextToken();
+    i++;
+    if(key !=KNullDesC && value !=KNullDesC)
+    {
+       if(key==KTestReportMode)
+       {
+       if( value == _L( "EMPTY" ) )
+          {
+          // No test report
+          iReportMode = CTestReport::ETestReportBlank;
+          }
+      else if( value == _L( "SUMMARY" ) )
+          {
+          // Increment aSetting
+          iReportMode += CTestReport::ETestReportSummary;
+          }
+      else if( value == _L( "ENVIRONMENT" ) )
+          {
+          // Increment aSetting
+          iReportMode += CTestReport::ETestReportEnvironment;
+          }
+      else if( value == _L( "TESTCASES" ) )
+          {
+          // Increment aSetting
+          iReportMode += CTestReport::ETestReportCases;
+          }
+      else if( value == _L( "FULLREPORT" ) )
+          {
+          // Set aSettings to max value and break
+          iReportMode = CTestReport::ETestReportFull;
+          
+          }
+      else if( value == _L( "#" ) )
+          {
+         
+          }
+       }
+      else if(key==KCreateTestReport)
+      {
+      if( value == _L( "NO" ) )
+          {
+          iTestReportSettings->iCreateTestReport  = EFalse;
+          }
+      // Parsed parameter is true
+      else if( value == _L( "YES" ) )
+          {
+          iTestReportSettings->iCreateTestReport  = ETrue;
+          }
+      
+      }
+      else if(key==KTestReportFilePath)
+      {
+          if(iTestReportSettings->iCreateTestReport)
+          {
+            delete iTestReportSettings->iPath;
+            iTestReportSettings->iPath = NULL;
+            iTestReportSettings->iPath = value.AllocL();
+          }
+      
+      }
+      else if(key==KTestReportFileName)
+      {
+          if(iTestReportSettings->iCreateTestReport)
+          {
+            delete iTestReportSettings->iName;
+            iTestReportSettings->iName = NULL;
+            iTestReportSettings->iName = value.AllocL(); 
+          }
+          
+      }
+      else if(key==KTestReportFormat)
+      {
+          if( value == _L( "TXT" ) )
+              {
+              iTestReportSettings->iFormat = CStifLogger::ETxt;
+                
+              }
+          else if( value == _L( "HTML" ) )
+              {
+              iTestReportSettings->iFormat = CStifLogger::EHtml;
+              }
+          else if( value == _L( "DATA" ) )
+              {
+              iTestReportSettings->iFormat = CStifLogger::EData;
+              }
+          else if( value == _L( "XML" ) )
+              {
+              iTestReportSettings->iFormat = CStifLogger::ETxt;
+              iTestReportSettings->iXML = ETrue;
+              }
+      
+      }
+      else if(key==KTestReportOutput)
+      {
+          if( value == _L( "FILE" ) )
+              {
+              iTestReportSettings->iOutput  = CStifLogger::EFile;
+              }
+          else if( value == _L( "RDEBUG" ) )
+              {
+              iTestReportSettings->iOutput  = CStifLogger::ERDebug;
+              }
+          
+      }
+      else if(key==KTestReportFileCreationMode)
+      {
+          if( value == _L( "APPEND" ) )
+              {
+              iTestReportSettings->iOverwrite = EFalse;
+              }
+          else if( value == _L( "OVERWRITE") )
+              {
+              iTestReportSettings->iOverwrite = ETrue;
+              }
+       
+      }
+      else if(key==KDeviceResetDllName)
+      {
+          delete iDeviceResetDllName;
+          iDeviceResetDllName = NULL;
+          iDeviceResetDllName = value.AllocL();
+      }    
+      else if(key==KTimeout)
+      {
+          TLex temp(value);
+          lex.Val(iDefaultTimeout);
+          iDefaultTimeout *= 1000;
+      }
+      else if(key==KUITestingSupport)
+      {    
+       iUITestingSupport = (value == _L("YES"));
+      }
+      else if(key==KSeparateProcesses)
+      {    
+       iSeparateProcesses = (value == _L("YES")); 
+      }
+      else if(key==KDisableMeasurement)
+      {
+      if( value == KStifMeasurementDisableNone ||
+          value == KStifMeasurementDisableAll ||
+          value == KStifMeasurement01 ||
+          value == KStifMeasurement02 ||
+          value == KStifMeasurement03 ||
+          value == KStifMeasurement04 ||
+          value == KStifMeasurement05 ||
+          value == KStifMeasurementBappea )
+          {
+          
+          DisableStifMeasurement( value );
+          }
+      
+      
+      }
+    }
+    }
+    
+    
+    }
+void CTestEngine::UpdateEngineConfigurationL( const RMessage2& aMessage )
+    {
+    TBuf<256> engineconfiguration;
+    aMessage.ReadL( 0, engineconfiguration );
+    engineconfiguration.TrimAll();
+    ReadEngineFromCommandLineL(engineconfiguration);
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ParseTestModulesL
+
+    Description: Parse and search for module info and fill list of modules.
+
+    Parameters: CStifParser*     aParser:       in: CStifParser object
+                CTestModuleList* aModuleList:   in: list of modules
+                TPtrC&           aSectionStart: in: descriptor with start of section string
+                TPTrC&           aSectionEnd:   in: descriptor with end of section string
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd)
+    {
+    //First let's find all modules given in Stif's ini file and store that info in CTestModuleList object
+    CStifSectionParser* sectionParser = NULL;
+    CStifItemParser* item = NULL;
+
+    sectionParser = aParser->SectionL(aSectionStart, aSectionEnd);
+
+    TBool sectionOK;
+
+    while(sectionParser)
+        {
+        sectionOK = ETrue;
+        __TRACE(KInit, (_L("Found '%S' and '%S' sections"), &aSectionStart, &aSectionEnd));
+        CleanupStack::PushL(sectionParser);
+        __TRACE(KInit, (_L("Starting to read module information")));
+
+        // Get name of module
+        _LIT(KModuleName, "ModuleName=");
+        item = sectionParser->GetItemLineL(KModuleName);
+        CleanupStack::PushL(item);
+        if(!item)
+            {
+            __TRACE(KError, (CStifLogger::ERed, _L("'%S' not found from Module section. Skipping whole section."), &KModuleName));
+            sectionOK = EFalse;
+            }
+        else
+            {
+            __TRACE(KInit, (_L("'%S' found"), &KModuleName));
+            }
+
+        TName moduleName;
+        TInt ret(KErrNone);
+
+        if(sectionOK)
+            {
+            TPtrC name;
+            ret = item->GetString(KModuleName, name);
+            if(ret != KErrNone)
+                {
+                __TRACE(KError, (CStifLogger::ERed, _L("Module name parsing ended with error [%d]. Skipping whole section"), ret));
+                sectionOK = EFalse;
+                }
+            else
+                {
+                __TRACE(KInit, (_L("Module '%S' found from ini-file"), &name));
+                moduleName.Copy(name);
+                moduleName.LowerCase();
+                ret = aModuleList->AddTestModule(moduleName);
+                if(ret != KErrNone && ret != KErrAlreadyExists)
+                    {
+                    CleanupStack::PopAndDestroy(item);
+                    __TRACE(KError, (CStifLogger::ERed, _L("Could not add module to list of modules. Error %d"), ret));
+                    LeaveIfErrorWithNotify(ret);
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy(item);
+
+        //Get pointer to added module
+        if(sectionOK)
+            {
+            CTestModuleInfo* moduleInfo = aModuleList->GetModule(moduleName);
+            if(!moduleInfo)
+                {
+                __TRACE(KError, (CStifLogger::ERed, _L("Could not add get module info from list")));
+                LeaveIfErrorWithNotify(KErrNotFound);
+                }
+    
+            // Get ini file, if it exists
+            __TRACE(KInit, (_L("Start parsing ini file")));
+            _LIT(KIniFile, "IniFile=");
+            item = sectionParser->GetItemLineL(KIniFile);
+            if(item)
+                {
+                __TRACE(KInit, (_L("'%S' found"), &KIniFile));
+                CleanupStack::PushL(item);
+                TPtrC iniFile;
+                ret = item->GetString(KIniFile, iniFile);
+                if(ret == KErrNone)
+                    {
+                    // Module inifile (might be empty) OK
+                    TFileName filename;
+                    filename.Copy(iniFile);
+                    TStifUtil::CorrectFilePathL( filename );
+                    filename.LowerCase();
+                    __TRACE(KInit, (CStifLogger::EBold, _L("Initialization file '%S' found, file can be empty"), &iniFile));
+                    moduleInfo->SetIniFile(filename);
+                    }
+                else
+                    {
+                    __TRACE(KInit, (_L("Initialization file not found")));
+                    }
+                CleanupStack::PopAndDestroy(item);
+                }
+            else
+                {
+                __TRACE(KInit, (_L("'%S' not found"), &KIniFile));
+                }
+    
+            // Get config (testcase) file
+            __TRACE(KInit, (_L("Start parsing cfg files")));
+            TPtrC cfgTag;
+            for(TInt i = 0; i < 2; i++)
+                {
+                //Set tag for config files
+                if(i == 0)
+                    {
+                    cfgTag.Set(_L("ConfigFile="));
+                    }
+                    else
+                    {
+                    cfgTag.Set(_L("TestCaseFile="));
+                    }
+                //Read data
+                item = sectionParser->GetItemLineL(cfgTag);
+                while(item)
+                    {
+                    CleanupStack::PushL(item);
+                    __TRACE(KInit, (_L("Item '%S' found"), &cfgTag));
+                    TPtrC cfgFile;
+                    ret = item->GetString(cfgTag, cfgFile);
+                    if(ret == KErrNone)
+                        {
+                        TFileName ifile;
+                        ifile.Copy(cfgFile);
+                        TStifUtil::CorrectFilePathL( ifile );
+                        ifile.LowerCase();
+                        __TRACE(KInit, (_L("Configuration file '%S' found"), &ifile));
+                        moduleInfo->AddCfgFile(ifile);
+                        }
+                    else
+                        {
+                        __TRACE(KInit, (_L("Configuration file not found")));
+                        }
+                    CleanupStack::PopAndDestroy(item);
+                    item = sectionParser->GetNextItemLineL(cfgTag);
+                    }
+                }
+    
+            __TRACE(KInit, (_L("Module '%S' information read correctly"), &moduleName));
+            }
+        else
+            {
+            __TRACE(KError, (_L("Module '%S' information skipped"), &moduleName));
+            }
+
+        // Get next section...
+        CleanupStack::PopAndDestroy(sectionParser);
+        sectionParser = aParser->NextSectionL(aSectionStart, aSectionEnd);
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ReadTestModules
+
+    Description: Parse Test modules and module information from
+                 STIF initialization file.
+
+    Parameters: CStifParser& parser: in: CStifParser object
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ReadTestModulesL(CStifParser* aParser)
+    {
+    __TRACE( KInit, (_L("")));
+    __TRACE( KInit, (CStifLogger::EBold, _L("Start parsing test modules")));
+
+    //Create CTestModuleList object. It will keep information about all found test modules,
+    //its initialization files and test case (config) files.
+    CTestModuleList* moduleList = CTestModuleList::NewL(Logger());
+    CleanupStack::PushL(moduleList);
+
+    // Parse Test Module information
+    _LIT(KTestModuleStart, "[New_Module]");
+    _LIT(KTestModuleEnd, "[End_Module]");
+
+    __TRACE(KInit, (_L("Starting to search module sections")));
+    TRAPD(err, ParseTestModulesL(aParser, moduleList, KTestModuleStart, KTestModuleEnd));
+    if(err != KErrNone)
+        {
+        __TRACE(KError, (CStifLogger::ERed, _L("Parsing test modules returned error [%d]"), err));
+        User::Leave(err);
+        }
+    __TRACE(KInit, (CStifLogger::EBold, _L("End parsing test modules")));
+    __TRACE(KInit, (_L("")));
+
+    //Now, find included test modules and also add them to CTestModuleList object.
+    _LIT(KIncludeModuleStart, "[New_Include_Module]");
+    _LIT(KIncludeModuleEnd, "[End_Include_Module]");
+
+    __TRACE(KInit, (CStifLogger::EBold, _L("Start parsing included modules")));
+    CTestCaseFileInfo* finfo = moduleList->GetUncheckedCfgFile();
+    while(finfo)
+        {
+        TFileName fname;
+        finfo->GetCfgFileName(fname);
+
+        __TRACE(KInit, (_L("checking file: '%S'"), &fname));
+        finfo->SetChecked();
+
+        CStifParser* parser = NULL;
+
+        TRAPD(err, parser = CStifParser::NewL(_L(""), fname));
+        if(err == KErrNotFound)
+            {
+            __TRACE(KError, (CStifLogger::ERed, _L("Could not open file '%S'"), &fname));
+            }
+        else if(err != KErrNone)
+            {
+            __TRACE(KError, (CStifLogger::ERed, _L("Could not create parser for file '%S'"), &fname));
+            LeaveIfErrorWithNotify(err);
+            }
+        else
+            {
+            CleanupStack::PushL(parser);
+
+            ParseTestModulesL(parser, moduleList, KIncludeModuleStart, KIncludeModuleEnd);
+
+            CleanupStack::PopAndDestroy(parser);
+            }
+
+        finfo = moduleList->GetUncheckedCfgFile();
+        }
+
+    __TRACE(KInit, (CStifLogger::EBold, _L("End parsing included modules")));
+    __TRACE(KInit, (_L("")));
+
+    //Now, when all modules have been found, create them
+    __TRACE(KInit, (CStifLogger::EBold, _L("Start creating modules")));
+    TBool afterReset = EFalse;
+    if(iRebootParams)
+        {
+        afterReset = ETrue;
+        }
+    CTestModuleInfo* moduleInfo = NULL;
+    TInt i;
+    TInt modCnt = moduleList->Count();
+
+    for(i = 0; i < modCnt; i++)
+        {
+        moduleInfo = moduleList->GetModule(i);
+        if(!moduleInfo)
+            {
+            __TRACE(KInit, (CStifLogger::ERed, _L("Could not get module info at index %d"), i));
+            TName error;
+            error.AppendFormat(_L("Could not get module info at index %d"), i);
+            ErrorPrint(1, error);
+            continue;
+            }
+
+        TName moduleName;
+        moduleInfo->GetModuleName(moduleName);
+
+        // Create module controller
+        __TRACE(KInit, (_L("Creating module controller for '%S'"), &moduleName));
+		CTestModuleController* module = NULL;
+		if( moduleName == _L( "testscripter" ) )
+			{
+			module = CTestModuleController::NewL(this, moduleName, afterReset, ETrue);
+			}
+		else
+			{
+			module = CTestModuleController::NewL(this, moduleName, afterReset);
+			}
+        CleanupStack::PushL(module);
+        __TRACE(KInit, (_L("Module controller created")));
+
+        // Get ini file, if exists
+        __TRACE(KInit, (_L("Checking ini file")));
+        TFileName ini;
+        moduleInfo->GetIniFileName(ini);
+        if(ini.Length() == 0)
+            {
+            __TRACE(KInit, (_L("Ini file not found")));
+            }
+
+        TRAPD(err, module->InitL(ini, KNullDesC));
+        if(err != KErrNone)
+            {
+            __TRACE(KInit, (CStifLogger::ERed, _L("Module '%S' loading failed: %d"), &moduleName, err));
+            TName error;
+            error.AppendFormat(_L("Module '%S' loading failed: %d"), &moduleName, err);
+            ErrorPrint(1, error);
+
+            CleanupStack::PopAndDestroy(module);
+            continue;
+            }
+
+        //Add test case files
+        __TRACE(KInit, (_L("Checking cfg files")));
+        TInt cfgCnt = moduleInfo->CountCfgFiles();
+        TInt j;
+        TFileName cfgFile;
+        for(j = 0; j < cfgCnt; j++)
+            {
+            moduleInfo->GetCfgFileName(j, cfgFile);
+            if(cfgFile.Length() > 0)
+                {
+                __TRACE(KInit, (_L("Adding config file '%S'"), &cfgFile));
+                module->AddConfigFileL(cfgFile);
+                }
+            else
+                {
+                __TRACE(KInit, (_L("Got empty config filename")));
+                }
+            }
+        if(cfgCnt == 0)
+            {
+            __TRACE(KInit, (_L("Cfg file not found")));
+            }
+
+        __TRACE(KInit, (_L("Module '%S' created correctly"), &moduleName));
+
+        // Store module for later use
+        User::LeaveIfError(iModules.Append(module));
+        CleanupStack::Pop(module);
+        }
+
+    __TRACE(KInit, (CStifLogger::EBold, _L("End creating test modules")));
+    __TRACE(KInit, (_L("")));
+
+    //Check if there are any modules added to Stif
+    if (iModules.Count() == 0)
+        {
+        __TRACE(KInit, (_L("Not found '%S' and '%S' sections"), &KTestModuleStart, &KTestModuleEnd));
+        __TRACE(KInit, (CStifLogger::EBold, _L("Test module(s) not defined in initialisation file")));
+        // Note is printed from UI, not from here anymore
+        // ErrorPrint( 0 , _L("Test modules not found. Check testengine log"));
+        }
+
+    //Delete CTestModuleList object. It is not needed any more
+    CleanupStack::PopAndDestroy(moduleList);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: TestModuleConfigFileL
+
+    Description: Add config file to test module
+
+    Parameters: CTestModuleController* aModule: in: CTestModuleController
+                                                    object.
+                CStifSectionParser* aSectionParser: in: CStifSectionParser
+                object.
+                TDesC& aTag :in: Founded tag.
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if GetNextItemLineL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::TestModuleConfigFileL( CTestModuleController* aModule,
+                                            CStifSectionParser* aSectionParser,
+                                            TDesC& aTag )
+    {
+    // Add config files to Test Module
+    TPtrC configFile;
+    CStifItemParser* item = NULL;
+    item = aSectionParser->GetItemLineL( aTag );
+
+    TInt cfgFiles = 0;
+    TFileName config;
+
+    TInt ret( 0 );
+
+    while ( item )
+        {
+        __TRACE( KInit,( _L( "Found '%S' section" ), &aTag ) );
+        CleanupStack::PushL( item );
+        ret = item->GetString( aTag, configFile );
+        if ( ret != KErrNone )
+            {
+            CleanupStack::PopAndDestroy( item );
+            __TRACE( KError, ( CStifLogger::ERed, _L( "File parsing left with error [%d]" ), ret ) );
+            }
+        else
+            {
+            config = configFile;
+            aModule->AddConfigFileL( config );
+
+            // Module configfile (might be empty) OK
+            __TRACE( KInit,( _L( "Adding configuration file [%S]" ), &config ) );
+            cfgFiles++;
+            CleanupStack::PopAndDestroy( item );
+            }
+        item = aSectionParser->GetNextItemLineL( aTag );
+        }
+
+    // Print trace
+    if ( cfgFiles == 0)
+        {  
+        __TRACE( KInit,( _L( "Module does not have '%S' files") , &aTag ) );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ModuleControllerByName
+
+    Description: Return the module controller specified by given parameter.
+
+    Parameters: const TName& aModuleName: in: Test module name
+
+    Return Values: CTestModuleController* : pointer to CTestModuleController
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleController* CTestEngine::ModuleControllerByName(
+                                                    const TName& aModuleName )
+    {
+    TInt modules = iModules.Count();
+
+    for ( TInt i = 0; i < modules; i++ )
+        {
+        if ( iModules[i]->ModuleName( aModuleName ) == aModuleName )
+            {
+            return iModules[i];
+            }
+        }
+    return NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: GetFreeOrCreateModuleControllerL
+
+    Description: Return free module controller specified by given parameter.
+                 If it can't be found, new one will be created.
+
+    Parameters: TTestInfo& aTestInfo: test info structure
+                CTestModuleController** aRealModuleController: for test scripter a real module controller will be returned
+
+    Return Values: CTestModuleController* : pointer to CTestModuleController
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleController* CTestEngine::GetFreeOrCreateModuleControllerL(TTestInfo& aTestInfo,
+                                                                     CTestModuleController** aRealModuleController)
+    {
+    TInt i, j;
+    *aRealModuleController = NULL;
+    
+    TInt modules = iModules.Count();
+
+    //Find out which way it should be processed
+    //New way means that Stif is going to find free test module controller
+    //(free means that it does not run any test case)
+    TBool oldWay = ETrue;
+    if((iUITestingSupport && aTestInfo.iModuleName.Find(KTestScripterName) == 0) 
+        || (aTestInfo.iModuleName == KPythonScripter)
+        || (iSeparateProcesses))
+        {
+        __TRACE(KInit, (_L("Module controllers handling mode: exclusive")));
+        //Exclusive mode means that every test case must be run in separate module controller.
+        oldWay = EFalse;
+        }
+    else
+        {
+        __TRACE(KInit, (_L("Module controllers handling mode: normal")));
+        oldWay = ETrue;
+        }
+        
+    //If option is not set and it is not python scripter case
+    //(python scripter always should look for free module controller)
+    //This is the old way
+    if(oldWay) 
+        {
+        __TRACE(KInit, (_L("Find test module controller for [%S]"), &aTestInfo.iModuleName));
+        for(i = 0; i < modules; i++)
+            {
+            if(iModules[i]->ModuleName(aTestInfo.iModuleName) == aTestInfo.iModuleName)
+                {
+                __TRACE(KInit, (_L("Found test module controller for [%S]"), &aTestInfo.iModuleName));
+                return iModules[i];
+                }
+            }
+        __TRACE(KInit, (_L("Test module controller for [%S] NOT FOUND"), &aTestInfo.iModuleName));
+        return NULL;
+        }
+    
+    //This is a new way
+    __TRACE(KInit, (_L("Find free test module controller for [%S]"), &aTestInfo.iModuleName));
+
+    TName moduleName(aTestInfo.iModuleName);
+    CTestModuleController* parentController = NULL;
+
+    //First find original test module controller (parent)
+    for(TInt i = 0; i < modules; i++)
+        {
+        if(iModules[i]->ModuleName(moduleName) ==  moduleName)
+            {
+            parentController = iModules[i];
+            __TRACE(KInit, (_L("Original (parent) module controller found [%S]"), &moduleName));
+            break;
+            }
+        }
+
+    //Search free module controller among parent's children
+    if(parentController)
+        {
+        //TestScripter is handled in other way
+        if(moduleName.Find(KTestScripterName) == 0)
+            {
+            __TRACE(KInit, (_L("This is testscripter case. Searching real module controller.")));
+            *aRealModuleController = parentController->GetFreeOrCreateModuleControllerL(aTestInfo, iUITestingSupport);
+            return parentController;                 
+            }
+
+        //When UITestingSupport always create new module controller!
+        TInt childrenCount = parentController->iChildrenControllers.Count();
+        for(TInt i = 0; i < childrenCount; i++)
+            {
+            if(parentController->iChildrenControllers[i]->iTestCaseCounter == 0)
+                {
+                if(iUITestingSupport && aTestInfo.iModuleName.Find(KTestScripterName) == 0)
+                    {
+                    __TRACE(KInit, (_L("Free module controller found but in UITestingSupport mode always new one will be created")));
+                    }
+                else
+                    {
+                    __TRACE(KInit, (_L("Free module controller found [%S]"), parentController->iChildrenControllers[i]->iName));
+                    return parentController->iChildrenControllers[i];
+                    }
+                }
+            else
+                {
+                __TRACE(KInit, (_L("Module controller [%S] found but it is not free (it runs %d test cases)"), parentController->iChildrenControllers[i]->iName, parentController->iChildrenControllers[i]->iTestCaseCounter));
+                }
+            }
+        }
+    else
+        {
+        __TRACE(KError, (_L("Parent module controller NOT found [%S]"), &moduleName));
+        User::Leave(KErrNotFound);
+        }
+
+    //No free module controller has been found. Create new one.
+    TBuf<10> ind;
+    ind.Format(_L("%d"), GetIndexForNewTestModuleController());
+    moduleName.Append(_L("@"));
+    moduleName.Append(ind);
+    __TRACE(KInit, (_L("Free module controller not found. Creating new one [%S]."), &moduleName));
+            
+    //Create server and active object (This uses CTestModuleController::InitL())
+    CTestModuleController* module = CTestModuleController::NewL(this, moduleName, parentController->iAfterReboot);
+    CleanupStack::PushL(module);
+    
+    TRAPD(err, module->InitL(parentController->iInifile, aTestInfo.iConfig));
+    if(err != KErrNone)
+        {
+        __TRACE(KInit, (_L("InitL fails with error: %d for module [%S]" ), err, &moduleName));
+        User::Leave(err);
+        }
+    __TRACE(KInit, (_L("New module controller created [%S]."), &moduleName));
+
+    // Store module for later use
+    User::LeaveIfError(parentController->iChildrenControllers.Append(module));
+    CleanupStack::Pop(module);
+    __TRACE(KInit, (_L("Child added to [%S] controller. Currently it has %d children:"), parentController->iName, parentController->iChildrenControllers.Count()));
+    for(j = 0; j < parentController->iChildrenControllers.Count(); j++)
+        {
+        __TRACE(KInit, (_L("    %d. [%S]"), j + 1, parentController->iChildrenControllers[j]->iName));
+        }
+
+    return module;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: SetAttributeL
+
+    Description: Sets attributes to Test Framework
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leave if ReadL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::SetAttributeL( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::SetAttributeL" ) ) );
+
+    TAttribute attribute;
+    TName genericTName;
+
+    // Read attribute from aMessage
+    attribute = (TAttribute)aMessage.Int0();
+
+    switch( attribute )
+        {
+        // Path attribute
+        case ELogPath:
+            {
+            // Read path from aMessage. 
+            // NOTE!If message length is over TName, ReadL will cut the message
+            // to allowed size and won't return any error code or leave code.
+            aMessage.ReadL( 1, genericTName );
+
+            // Handle to Setting server.
+            RSettingServer settingServer;
+            // Connect to the Setting server and create session
+            TInt ret = settingServer.Connect();
+            if ( ret != KErrNone )
+                {
+                User::Leave( ret );
+                }
+            settingServer.SetLoggerOutputPath( genericTName );
+            // Close Setting server session
+            settingServer.Close();
+            break;
+            }
+        // Reboot directory
+        case ERebootPath:
+            {
+            // Read reboot path from aMessage. 
+            // NOTE!If message length is over TName, ReadL will cut the message
+            // to allowed size and won't return any error code or leave code.
+            aMessage.ReadL( 1, genericTName );
+            // Allocated dynamically iRebootPath size and copies aMessage path.
+            iRebootPath = genericTName.AllocL();
+            break;
+            }
+        // Reboot path
+        case ERebootFilename:
+            {
+            // Read reboot path from aMessage. 
+            // NOTE!If message length is over TName, ReadL will cut the message
+            // to allowed size and won't return any error code or leave code.
+            aMessage.ReadL( 1, genericTName );
+            // Allocated dynamically iRebootFilename size and copies aMessage
+            // filename.
+            iRebootFilename = genericTName.AllocL();
+            break;
+            }
+        // Measurement configuration info
+        case EStifMeasurementOn:
+            {
+            // Read Measurement configuration info from aMessage. 
+            aMessage.ReadL( 1, genericTName );
+
+            // Set info to test engine
+            User::LeaveIfError( EnableStifMeasurement( genericTName ) );
+            break;
+            }
+        // Measurement configuration info
+        case EStifMeasurementOff:
+            {
+            // Read Measurement configuration info from aMessage. 
+            aMessage.ReadL( 1, genericTName );
+
+            // Set info to test engine
+            User::LeaveIfError( DisableStifMeasurement( genericTName ) );
+            break;
+            }
+        default:
+            {
+            __TRACE( KVerbose, ( _L( "Not valid attribute" ) ) );
+            }
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: AddTestModuleL
+
+    Description: Adds new Test Module
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+                       Leaves if name length is zero
+
+    Status: Approved: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::AddTestModuleL( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::AddTestModuleL" ) ) );
+    TName name;
+    TFileName iniFile;
+
+    // Read test module name from aMessage
+    aMessage.ReadL( 0, name );
+
+    if( name.Length() == 0 )
+        {
+        LeaveWithNotifyL( KErrArgument );
+        }
+    // Read ini file name from aMessage
+    aMessage.ReadL( 1, iniFile );
+    
+    name.LowerCase();
+    // Remove optional '.DLL' from file name
+    TParse parse;
+    parse.Set( name, NULL, NULL );
+    
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        name.Delete ( name.Length()-len, len );
+        }
+
+    __TRACE( KInit, ( 
+        _L( "CTestEngine::AddTestModuleL, Adding Module:[%S]"), &name ) );
+
+    // Check if test module already exists
+    CTestModuleController* testModule = ModuleControllerByName( name );
+    if ( testModule == NULL )
+        {
+        TBool afterReset = EFalse;
+        if( iRebootParams && iRebootParams->iTestModule == name )
+            {
+            afterReset = ETrue;
+            }
+        
+        // Create module controller
+		CTestModuleController* module = NULL;
+		if( name == _L( "testscripter" ) )
+			{
+			module = CTestModuleController::NewL( this, name, afterReset, ETrue );
+			}
+		else
+			{
+			//CTestModuleController* module = 
+			module = CTestModuleController::NewL( this, name, afterReset );
+			}
+        CleanupStack::PushL( module );
+
+        module->InitL( iniFile, KNullDesC );
+
+        // Store module for later use
+        User::LeaveIfError( iModules.Append( module ) );
+        CleanupStack::Pop( module );
+        // Done
+        iReturn = KErrNone;
+
+        __TRACE( KInit, ( 
+        _L( "CTestEngine::AddTestModuleL, module added correctly") ) );
+        }
+    else
+        {
+        iReturn = KErrAlreadyExists;
+        __TRACE( KInit, ( 
+        _L( "CTestEngine::AddTestModuleL, module already added, all ok.") ) );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: RemoveTestModuleL
+
+    Description: Removes Test Module
+
+    Parameters: const RMessage& aMessage: in: Server message
+    
+    Return Values: TInt KErrNone: No errors occurred
+                        KErrNotFound: Test module not found
+                        KErrInUse: Test module is in use, cannot be removed
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+                       Leaves if moduleName length is zero
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::RemoveTestModuleL( const RMessage2& aMessage )
+    {
+    __TRACE( KInit, ( _L( "CTestEngine::RemoveTestModuleL" ) ) );
+    // Read Module name from message
+    TName moduleName;
+    aMessage.ReadL( 0, moduleName );
+    if( moduleName.Length() == 0 )
+        {
+        LeaveWithNotifyL( KErrArgument );
+        }
+
+    moduleName.LowerCase();
+    // Remove optional '.DLL' from file name
+    TParse parse;
+    parse.Set( moduleName, NULL, NULL );
+
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        moduleName.Delete ( moduleName.Length()-len, len );
+        }
+
+    __TRACE(KInit, (_L("Going to remove module controller [%S]"), &moduleName));
+    // Check that the module that will be removed exists
+    TInt moduleCount = iModules.Count();
+    TBool found = EFalse;
+    TInt moduleIndex;
+    for ( moduleIndex = 0; moduleIndex < moduleCount; moduleIndex++ )
+        {
+        if ( iModules[moduleIndex]->ModuleName( moduleName ) == moduleName )
+            {
+            found = ETrue;
+            break;
+            }
+        }
+
+    if ( !found )
+        {
+        // Test Module does not exists
+        __TRACE(KInit, (_L("Module controller [%S] to be removed NOT FOUND"), &moduleName));
+        return KErrNotFound;
+        }
+    // Check module controller and its children
+    if(iModules[moduleIndex]->iTestCaseCounter > 0)
+        {
+        __TRACE(KInit, (_L("Cannot remove module controller [%S], it is running %d test cases"), &moduleName, iModules[moduleIndex]->iTestCaseCounter));
+        return KErrInUse;
+        }
+    TInt j;
+    for(j = 0; j < iModules[moduleIndex]->iChildrenControllers.Count(); j++)
+        {
+        if(iModules[moduleIndex]->iChildrenControllers[j]->iTestCaseCounter > 0)
+            {
+            __TRACE(KInit, (_L("Cannot remove module controller [%S], its child [%S] is running %d test cases"), &moduleName, iModules[moduleIndex]->iChildrenControllers[j]->iName, iModules[moduleIndex]->iChildrenControllers[j]->iTestCaseCounter));
+            return KErrInUse;
+            }
+        }
+    // Test cases not running so we can remove the Test Module
+    __TRACE(KInit, (_L("Removing module controller [%S]"), &moduleName));
+    CTestModuleController* module = iModules[moduleIndex];
+    iModules.Remove(moduleIndex);
+    delete module;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: CloseTestEngineL
+
+    Description: Close test engine
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if GenerateReportL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::CloseTestEngineL()
+    {
+    __TRACE( KInit, ( _L( "CTestEngine::CloseTestEngineL" ) ) );
+    // Remove all module controllers
+    iModules.ResetAndDestroy();
+    iModules.Close();
+
+    // If test report is created
+    if( RetrieveTestReport() )
+        {
+        iTestReport->GenerateReportL();
+        iIsTestReportGenerated = ETrue;
+        }
+
+    // Close Setting server, no handle available anymore
+    iSettingServer.Close();
+
+    // Decrement resource count
+    iResourceCount--;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: AddConfigFileL
+
+    Description: Adds new config file to Test Module
+
+    Parameters: const RMessage& aMessage: in: Server Message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+                       Leaves if module length is zero
+                       Leaves if configFile length is zero
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::AddConfigFileL( const RMessage2& aMessage )
+    {
+    TName module;
+    TFileName configFile;
+
+    // Read module name from aMessage
+    aMessage.ReadL( 0, module );
+
+    if( module.Length() == 0 )
+        {
+        LeaveWithNotifyL( KErrArgument );
+        }
+    // Read config file name from aMessage
+    aMessage.ReadL( 1, configFile );
+
+    if( configFile.Length() == 0 )
+        {
+        LeaveWithNotifyL( KErrArgument );
+        }
+
+    module.LowerCase();
+    // Remove optional '.DLL' from file name
+    TParse parse;
+    parse.Set( module, NULL, NULL );
+    
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        module.Delete ( module.Length()-len, len );
+        }
+        
+    __TRACE( KInit, ( _L( "Adding config file [%S] to [%S] module"), &configFile, &module ) );
+    
+    // Get correct test module controller
+    CTestModuleController* testModule = ModuleControllerByName( module );
+    if ( testModule == NULL )
+        {        
+        __TRACE( KError, ( CStifLogger::ERed, _L( "Added configure file has an invalid module:[%S]"), &module ) );
+        LeaveWithNotifyL ( KErrNotFound );
+        }
+
+    // Add config file to Module
+    testModule->AddConfigFileL( configFile );
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: RemoveConfigFileL
+
+    Description: Removes a config file from test module
+
+    Parameters: const RMessage& aMessage: in: Server Message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+                       Leaves if module length is zero
+                       Leaves if configFile length is zero
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::RemoveConfigFileL( const RMessage2& aMessage )
+    {
+    TName module;
+    TFileName configFile;
+
+    // Read module name from aMessage
+    aMessage.ReadL( 0, module );
+
+    if( module.Length() == 0 )
+        {
+        LeaveWithNotifyL( KErrArgument );
+        }
+    // Read config file name from aMessage
+    aMessage.ReadL( 1, configFile );
+
+    if( configFile.Length() == 0 )
+        {
+        LeaveWithNotifyL( KErrArgument );
+        }
+
+    module.LowerCase();
+    // Remove optional '.DLL' from file name
+    TParse parse;
+    parse.Set( module, NULL, NULL );
+    
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        module.Delete ( module.Length()-len, len );
+        }
+        
+    __TRACE( KInit, ( _L( "Removing config file [%S] from [%S] module"), &configFile, &module ) );
+    
+    // Get correct test module controller
+    CTestModuleController* testModule = ModuleControllerByName( module );
+    if ( testModule == NULL )
+        {        
+        __TRACE( KError, ( CStifLogger::ERed, _L( "Added configure file has an invalid module:[%S]"), &module ) );
+        LeaveWithNotifyL ( KErrNotFound );
+        }
+
+    // Remove config file from Module
+    testModule->RemoveConfigFileL( configFile );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: EnumerateTestCasesL
+
+    Description: Enumerates test cases
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Panics the client if enumeration is already pending
+                       Leaves if called StartEnumerateL method leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::EnumerateTestCasesL( const RMessage2& aMessage )
+    {
+    __TRACE( KInit, ( _L( "CTestEngine::EnumerateTestCasesL" ) ) );
+    // Check if enumerate is ongoing!!
+    __ASSERT_ALWAYS( iEnumerateModuleCount == 0, PanicClient( EReqPending, aMessage ) );
+
+    iCaseCount = 0;
+    iEnumError = KErrNone;
+
+    TInt count = iModules.Count();
+    if ( count == 0 )
+        {
+
+        __TRACE( KInit, ( CStifLogger::EBold, _L( "Test module(s) not loaded - returning 0 test cases" ) ) );
+        
+        // Note is printed from UI
+        // ErrorPrint(0, _L("No test modules, check testengine log"));
+        // Write test case count to client
+        TCaseCount countPckg( 0 );
+        TRAPD( err, aMessage.WriteL( 0, countPckg ) );
+
+        // Request will be completed in DispatchMessageL
+        iReturn = err;
+        }
+    else
+        {
+        for ( TInt i = 0; i < count; i++ )
+            {
+            // Send enumerate request to each test module.
+            iModules[i]->StartEnumerateL();
+            iEnumerateModuleCount++;
+            }
+    
+        // Message is completed later from EnumerationCompleted function
+        iComplete = EFalse;
+
+        // Store the message
+        iEnumerationMessage = aMessage;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: EnumerationCompleted
+
+    Description: Return the module controller specified by given parameter.
+
+    Parameters: TInt aCount: in: Count of test cases
+                TInt aError: in: Symbian OS Error code: Error from Test Module
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::EnumerationCompleted( TInt aCount, TInt aError )
+    {
+    // Increment test case count by aCount
+    iCaseCount+= aCount;
+
+    if ( aError != KErrNone )
+        {
+        iEnumError = aError;
+        }
+
+    iEnumerateModuleCount--;
+    
+    if ( iEnumerateModuleCount == 0 )
+        {
+       
+        TInt attrib = CStifLogger::ENoStyle;
+        if ( iCaseCount == 0 )
+            {
+            attrib = CStifLogger::EBold;
+            }
+        __TRACE( KInit, ( attrib, _L( "Test case enumeration completed, testcase count %d"), iCaseCount ) );
+
+        // Write test case count to client
+        TCaseCount countPckg( iCaseCount );
+        TRAPD( err, iEnumerationMessage.WriteL( 0, countPckg ) );
+
+        if ( err != KErrNone )
+            {
+            iEnumError = err;
+            __TRACE( KError, ( CStifLogger::ERed,  _L( "CTestEngine::EnumerationCompleted: Failed %d"), iEnumError ) );
+            }
+        
+        // Complete request
+        iEnumerationMessage.Complete( iEnumError );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: GetTestCasesL
+
+    Description: Get test cases
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if enumeration is not yet complete
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::GetTestCasesL( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::GetTestCasesL" ) ) );
+
+    const TInt len = sizeof( TTestInfo );
+
+    // Loop through all test modules
+    TInt moduleCount = iModules.Count();
+    TInt pos = 0;
+    TInt totalCount = 0;
+    for ( TInt i = 0; i < moduleCount; i++ )
+        {
+        CTestModuleController* module = iModules[i];
+
+        // Check that test cases are enumerated first
+        if ( !module->EnumerationComplete() )
+            {
+            __TRACE( KError, ( CStifLogger::ERed, _L( "CTestEngine::GetTestCasesL, Test Cases not yet enumerated!" ) ) );
+            LeaveIfErrorWithNotify( KErrNotFound );
+            }
+
+        CFixedFlatArray<TTestInfo>* testCases = module->TestCasesL();
+        CleanupStack::PushL( testCases );
+        
+        // Loop through all test cases got from test module
+        const TInt caseCount = testCases->Count();
+        totalCount+=caseCount;
+
+        for ( TInt j = 0; j < caseCount; j++ )
+            {
+            if(((*testCases)[j]).iTestCaseInfo.iTimeout == 0 && iDefaultTimeout > 0)
+                {
+                ((*testCases)[j]).iTestCaseInfo.iTimeout = iDefaultTimeout;
+                }
+
+            // Construct package for source data
+            TTestInfoPckg tmpPackage( ( *testCases )[j] );
+
+            // Copy test case package to client's memory
+            aMessage.WriteL( 0, tmpPackage, pos ) ;
+
+            pos = pos + len;
+            }
+        CleanupStack::PopAndDestroy( testCases );
+
+        // Free allocated test cases because not needed anymore
+        module->FreeTestCases();
+
+        }
+
+    __TRACE( KVerbose, ( _L( "CTestEngine::GetTestCasesL, case count %d" ), totalCount ) );
+
+    // Finished
+    iReturn = KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: CancelAsyncRequest
+
+    Description: Asynchronous requests are canceled by this function.
+
+    Parameters: const RMessage aMessage
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::CancelAsyncRequest( const RMessage2& aMessage )
+    {
+    switch ( aMessage.Int0() )
+        {
+        case ETestEngineEnumerateTestCases:
+            {
+            TInt count = iModules.Count();
+            for ( TInt i=0; i < count; i++ )
+                {
+                // Cancel enumerate  
+                iModules[i]->Cancel();
+                }
+            break;
+            }
+
+        case ETestEngineErrorNotification:
+            {
+            if ( iErrorMessageAvailable )
+                {
+                iErrorMessageAvailable = EFalse;
+                iErrorMessage.Complete ( KErrCancel );
+                }
+            }
+            break;
+        case ETestEngineEvent:
+            // Event command cannot be cancelled
+            // Only EWaitEvent can be cancelled with ECancelWait
+        default:
+            PanicClient( EBadRequest, aMessage );
+            break;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: EventControlL
+
+    Description: Controls event system.
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::EventControlL( const RMessage2& aMessage )
+
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::EventControlL" ) ) );
+    TInt ret = KErrNone;
+
+    // Read EventIf from aMessage
+    TEventIf event;
+    TEventIfPckg eventIfPckg( event );
+    aMessage.ReadL( 0, eventIfPckg );
+
+    // EWaitEvent, EReqEvent and ERelEvent need processing here
+    if( ( event.Type() == TEventIf::EWaitEvent ) ||
+        ( event.Type() == TEventIf::EReqEvent ) ||
+        ( event.Type() == TEventIf::ERelEvent ) ||
+        ( event.Type() == TEventIf::ECancelWait ) )
+        {
+        TInt ind = 0; 
+        TInt count = iClientEvents.Count();
+        const TDesC& eventName = event.Name();
+        // Search event from client event list
+        for( ind=0; ind < count; ind++ )
+            {
+            if( iClientEvents[ind]->Name() == eventName )
+                {
+                break;
+                }
+            }
+
+        switch( event.Type() )
+            {
+            // Handle event waiting  
+            case TEventIf::EWaitEvent:
+                {
+                // Check that we found event from client events list
+                if( ind == count )
+                    {
+                    ret = KErrNotFound;
+                    }
+                else
+                    {
+                    TEventMsg* eventEntry = iClientEvents[ind];
+                    
+                    __TRACE( KVerbose, ( _L( "CTestEngine::EventControlL: Waiting %S (count %i)"), 
+                        &event.Name(), count ) );
+
+                    // Waiting is completed either from here in Wait method 
+                    // if event is already pending,
+                    // or from Set method in CtlEvent when event is set.
+                    eventEntry->Wait( aMessage );
+                    return;
+                    }
+                }
+                break;
+            case TEventIf::ECancelWait:
+                {
+                // Check that we found event from client events list
+                if( ind == count )
+                    {
+                    ret = KErrNotFound;
+                    }
+                else
+                    {
+                    TEventMsg* eventEntry = iClientEvents[ind];
+                    
+                    __TRACE( KVerbose, ( _L( "CTestEngine::EventControlL: Cancel waiting %S (count %i)"), 
+                        &event.Name(), count ) );
+
+                    eventEntry->CancelWait();
+                    }
+                }
+                break;
+            // Handle event request
+            case TEventIf::EReqEvent:
+                {
+                // Check that event is not already requested
+                if( ind < count )
+                    {
+                    // Already exists
+                    ret = KErrArgument;
+                    }
+                else
+                    { 
+                    // Requested events are added to iClientEvents
+                    TEventMsg* eventEntry = new TEventMsg;
+                    if( eventEntry == NULL )
+                        {
+                        ret = KErrNoMemory;
+                        }
+                    else
+                        {
+                        CleanupStack::PushL( eventEntry );
+                        eventEntry->Copy( event );
+                        // Check if state event is set already
+                        if( IsStateEventAndSet( event.Name() ) )
+                            { 
+                            // If it was set already, set the event
+                            eventEntry->Set( TEventIf::EState );
+                            }
+                        ret = iClientEvents.Append( eventEntry ); 
+                        if( ret != KErrNone )
+                            {
+                            CleanupStack::PopAndDestroy( eventEntry );
+                            }
+                        else
+                            {   
+                            CleanupStack::Pop( eventEntry );
+                               
+                            __TRACE( KVerbose, ( _L( "CTestEngine::EventControlL: Req added %S (count %i)"),
+                                &event.Name(), iClientEvents.Count() ) );
+                            } 
+                        }
+                    }
+                }
+                break;
+            // Release event 
+            case TEventIf::ERelEvent:
+                {
+                // Released events are deleted from iClientEvents
+                // Check that we found entry from client events list
+                if( ind == count )
+                    {
+                    ret = KErrNotFound;
+                    }
+                else
+                    {
+                    __TRACE( KVerbose, ( _L( "CTestEngine::EventControlL: Release event %S (count %i)"), 
+                        &event.Name(), iClientEvents.Count() ) );
+
+                    TEventMsg* eventEntry = iClientEvents[ind];
+                    iClientEvents.Remove( ind );
+                    eventEntry->Release();
+                    delete eventEntry;
+                    }
+                }
+                break;
+            default: // This should never happen!!!
+                { 
+                _LIT( KEngine, "CTestEngine" );
+                User::Panic( KEngine, KErrGeneral );
+                }
+                break;
+            }
+        }
+    else
+        {
+        // ESetEvent and EUnsetEvent are only forwarded
+        TRequestStatus req;
+        CtlEventL( event, req );
+        User::WaitForRequest( req );
+        }
+        
+    aMessage.Complete( ret );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: HandleErrorNotificationL
+
+    Description: Handle error notifications.
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::HandleErrorNotificationL( const RMessage2& aMessage )
+    {
+    iErrorMessage = aMessage;
+    iErrorMessageAvailable = ETrue;
+
+    ProcessErrorQueue();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: LoggerSettings
+
+    Description: Get Logger's overwrite parameters
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Panics if WriteL fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::LoggerSettings( const RMessage2& aMessage )
+    {
+    __TRACE( KInit, ( _L( "CTestEngine::LoggerSettings" ) ) );
+
+    // Copies logger settings to the package
+    TPckg<TLoggerSettings> loggerSettingsPckg( iTestEngineServer->GetLoggerSettings() );
+
+    // Writes a packege that includes the logger overwrite settings to aMessage
+    TRAPD( err, aMessage.WriteL( 0, loggerSettingsPckg ) );
+    if ( err != KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: CloseLoggerSettings
+
+    Description: Close logger settings
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::CloseLoggerSettings()
+    {
+    __TRACE( KInit, ( _L( "CTestEngine::CloseLoggerSettings" ) ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: TestCaseByHandle
+
+    Description: Return test case specified by aHandle
+
+    Parameters: TUint aHandle : in : TUint : Handle to TestCase subsession
+
+    Return Values: CTestCase* : pointer to CTestCase object
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCase* CTestEngine::TestCaseByHandle( TUint aHandle, const RMessage2& aMessage )
+    {
+    // Try to get test case from test case container
+    CTestCase* testCase =
+        ( CTestCase* )iTestCases->At( aHandle );
+    if ( testCase == NULL )
+        {
+        PanicClient( EBadSubsessionHandle, aMessage ); 
+        }
+
+    return testCase;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: NewTestCaseL
+
+    Description: Create new test execution subsession
+
+    Parameters: const RMessage& aMessage: in: Server Message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving method leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::NewTestCaseL( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::NewTestCaseL start" ) ) );
+
+    // Get data from message
+    TTestInfo testInfo;
+    TTestInfoPckg testInfoPckg = testInfo;
+
+    TRAPD( res, aMessage.ReadL( 0, testInfoPckg ) );
+    if ( res != KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        return;
+        }
+
+    testInfo.iModuleName.LowerCase();
+    // Remove optional '.DLL' from file name
+    TParse parse;
+    parse.Set( testInfo.iModuleName, NULL, NULL );
+
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        testInfo.iModuleName.Delete ( testInfo.iModuleName.Length()-len, len );
+        }
+
+    // Get correct test module controller
+    CTestModuleController* scrModule = NULL;
+    CTestModuleController* module = GetFreeOrCreateModuleControllerL(testInfo, &scrModule);
+    if ( module == NULL )
+        {
+        //@spe PanicClient( EInvalidModuleName, aMessage );
+        //@spe return;
+        __TRACE( KError, ( CStifLogger::ERed, _L( "Invalid module:[%S]"), &testInfo.iModuleName ) );
+        LeaveWithNotifyL ( KErrNotFound );
+        }
+
+    // Create test case object
+    CTestCase* testCase =
+        CTestCase::NewL( this, module, RetrieveTestReport(), testInfo, scrModule);
+    CleanupStack::PushL( testCase );
+
+    // Add object to object container to generate unique id
+    iContainer->AddL( testCase );
+
+    // Add object to object index
+    // This returns a unique handle so we can get it again
+    TInt handle = iTestCases->AddL( testCase );
+
+    // Write the handle to client
+    TPckg<TInt> handlePckg( handle );
+
+    TRAP( res, aMessage.WriteL( 3, handlePckg ) );
+    if ( res != KErrNone )
+        {
+        iTestCases->Remove( handle );
+        PanicClient( EBadDescriptor, aMessage );
+        return;
+        }
+
+    // Add new test case to testcase array
+    User::LeaveIfError( iTestCaseArray.Append( testCase ) );
+    CleanupStack::Pop( testCase );
+
+    // Notch up another resource
+    iResourceCount++;
+
+    iReturn = KErrNone;
+
+    __TRACE( KVerbose, ( _L( "CTestEngine::NewTestCaseL done" ) ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: DeleteTestCase
+
+    Description: Delete test case from container list
+
+    Parameters: TUint aHandle: in: Handle to test case to be removed
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::DeleteTestCase( TUint aHandle ) 
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::DeleteTestCase" ) ) );
+
+    // Get test case from container
+    CTestCase* testCase = ( CTestCase* )iTestCases->At( aHandle );
+
+    // Do nothing if invalid handle
+    if ( testCase == NULL )
+        {
+        // Handle might be already deleted, so do nothing.
+        return;
+        }
+
+    //Get controllers
+    CTestModuleController* moduleController;
+    CTestModuleController* realModuleController;
+    
+    moduleController = testCase->GetModuleControllers(&realModuleController);
+    
+    // Check if module controllers have crashed
+    TBool moduleControllerCrashed = EFalse;
+    TBool realModuleControllerCrashed = EFalse;
+
+    if(moduleController)
+        {
+        moduleControllerCrashed = moduleController->iTestModuleCrashDetected;
+        }
+    if(realModuleController)
+        {
+        realModuleControllerCrashed = realModuleController->iTestModuleCrashDetected;
+        }
+
+    //__TRACE(KInit, (_L("CTestEngine::DeleteTestCase moduleController=[%x] crashed=[%d] realModuleController=[%x] crashed=[%d]"), moduleController, moduleControllerCrashed, realModuleController, realModuleControllerCrashed));
+    // For UITestingSupport, SeparateProcesses and PythonSupport, when module is crashed,
+    // remove it from module lists, because it will be deleted when closing test case.
+    if(moduleController)
+        {
+        if(moduleControllerCrashed && iUITestingSupport && moduleController->iName->Find(KTestScripterName) == 0
+           || moduleControllerCrashed && iSeparateProcesses
+           || moduleControllerCrashed &&  moduleController->iName->Find(KPythonScripter) == 0
+          )
+            {
+            __TRACE(KInit, (_L("Removing module controller from module list because of crash")));
+            //Look for specific module controller and delete it
+            TInt i;
+            TInt j, children;
+            TInt modules = iModules.Count();
+            for(i = 0; i < modules; i++)
+                {
+                if(iModules[i] == moduleController)
+                    {
+                    __TRACE(KInit, (_L("Module controller found - removing")));
+                    iModules.Remove(i);
+                    break;
+                    }
+
+                //Check children of the module and if module to be deleted found there, remove it
+                children = iModules[i]->iChildrenControllers.Count();
+                __TRACE(KInit, (_L("Checking %d children of [%S]"), children, iModules[i]->iName));
+                for(j = 0; j < children; j++)
+                    {
+                    if(iModules[i]->iChildrenControllers[j] == moduleController)
+                        {
+                        __TRACE(KInit, (_L("Module controller found (child) - removing")));
+                        
+                        iModules[i]->iChildrenControllers.Remove(j);
+
+                        __TRACE(KInit, (_L("Child removed from [%S] controller. Currently it has %d children:"), iModules[i]->iName, iModules[i]->iChildrenControllers.Count()));
+                        for(TInt k = 0; k < iModules[i]->iChildrenControllers.Count(); k++)
+                            {
+                            __TRACE(KInit, (_L("    %d. [%S]"), k + 1, iModules[i]->iChildrenControllers[k]->iName));
+                            }                            
+                        break;
+                        }
+                    }
+                }
+            }
+        }
+    if(moduleController && realModuleController)
+        {
+        if(realModuleControllerCrashed && iUITestingSupport && realModuleController->iName->Find(KTestScripterName) == 0
+           || realModuleControllerCrashed && iSeparateProcesses
+           || realModuleControllerCrashed &&  realModuleController->iName->Find(KPythonScripter) == 0
+          )
+            {
+            __TRACE(KInit, (_L("Removing real module controller from module list because of crash")));
+            //Remove module controller from scripter controller
+            moduleController->RemoveModuleController(realModuleController);
+            }
+        }
+
+    // Close test case and remove it from container
+    //testCase->CloseTestCase();
+    iTestCases->Remove( aHandle );
+
+    // Decrement resource count
+    iResourceCount--;
+
+    // Remove from testcase array
+    iTestCaseArray.Remove( iTestCaseArray.Find( testCase ) );
+
+    //If this is UITestingSupport and module is not crashed, delete controller 
+    //(in other words, kill process, because we need somehow reset the test server).
+    if(moduleController && !moduleControllerCrashed)
+        {        
+        if(iUITestingSupport && moduleController->iName->Find(KTestScripterName) == 0)
+            {
+            if(realModuleController)
+                {
+                if(!realModuleControllerCrashed)
+                    {
+                    __TRACE(KInit, (_L("Delete module controller (and kill process in which test case was run).")));
+                    __TRACE(KInit, (_L("Real module controller provided - processing")));
+                    //Remove module controller from scripter controller
+                    moduleController->DeleteModuleController(realModuleController);
+                    }
+                }
+            else
+                {
+                 __TRACE(KInit, (_L("Delete module controller (and kill process in which test case was run).")));
+                 __TRACE(KInit, (_L("Real module controller not provided, checking normal controllers")));
+                //Look for specific module controller and delete it
+                TInt i;
+                TInt j, children;
+                TInt modules = iModules.Count();
+                for(i = 0; i < modules; i++)
+                    {
+                    if(iModules[i] == moduleController)
+                        {
+                        __TRACE(KInit, (_L("Module controller found - deleting")));
+                        delete iModules[i];
+                        iModules.Remove(i);
+                        break;
+                        }
+
+                    //Check children of the module and if module to be deleted found there, remove it
+                    children = iModules[i]->iChildrenControllers.Count();
+                    __TRACE(KInit, (_L("Checking %d children of [%S]"), children, iModules[i]->iName));
+                    for(j = 0; j < children; j++)
+                        {
+                        if(iModules[i]->iChildrenControllers[j] == moduleController)
+                            {
+                            __TRACE(KInit, (_L("Module controller found (child) - deleting")));
+                            
+                            delete iModules[i]->iChildrenControllers[j];
+                            iModules[i]->iChildrenControllers.Remove(j);
+    
+                            __TRACE(KInit, (_L("Child removed from [%S] controller. Currently it has %d children:"), iModules[i]->iName, iModules[i]->iChildrenControllers.Count()));
+                            for(TInt k = 0; k < iModules[i]->iChildrenControllers.Count(); k++)
+                                {
+                                __TRACE(KInit, (_L("    %d. [%S]"), k + 1, iModules[i]->iChildrenControllers[k]->iName));
+                                }                            
+                            break;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: IsStateEventAndSet
+
+    Description: Callback to check state event status.
+
+    Parameters: const TName& aEventName: in: Event name
+
+    Return Values: ETrue: event is set 
+                   EFalse: event is not set
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestEngine::IsStateEventAndSet( const TName& aEventName )
+    {
+    TInt count = iStateEvents.Count();
+    for( TInt i = 0; i < count; i++ ) 
+        {
+        TPtrC name = iStateEvents[i]->Des();
+        if( name == aEventName )
+            {
+            // Requested state event set already
+            return ETrue;
+            }
+        }
+    return EFalse;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: CtlEventL
+
+    Description: Callback to control events.
+
+    Parameters: const TEventIf& aEvent: in: event information
+                TRequestStatus& aStatus: in: Request status
+
+    Return Values: CTestEventController*: CTestEventController object
+
+    Errors/Exceptions: Leaves if CtlEventL leaves
+                       Leaves if memory allocation fails
+                       Leaves if unset event not found from pending 
+                       state event list
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEventController* CTestEngine::CtlEventL( const TEventIf& aEvent, 
+                                              TRequestStatus& aStatus )
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::CtlEventL" ) ) );
+    
+    aStatus = KRequestPending;
+
+    UpdateEventL( aEvent );
+    return CTestEventController::NewL( this, aEvent, &aStatus );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: UpdateEventL
+
+    Description: Update event lists.
+
+    Parameters: const TEventIf& aEvent: in: event information
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if CtlEventL leaves
+                       Leaves if memory allocation fails
+                       Leaves if unset event not found from pending
+                       state event list
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::UpdateEventL( const TEventIf& aEvent )
+    {
+    // Handle ESetEvent and EUnsetEvent for state events here
+    if( aEvent.EventType() == TEventIf::EState )
+        {
+        // Find event from the list
+        TInt count = iStateEvents.Count();
+        TInt index = 0;
+        const TDesC& eventName = aEvent.Name();
+        for( ; index < count; index++ ) 
+            {
+            TPtrC name = iStateEvents[index]->Des();
+            if( name == eventName )
+                {
+                break;
+                }
+            }
+
+        if( aEvent.Type() == TEventIf::ESetEvent )
+            {
+            // Check that event is not already pending
+            if( index < count )
+                {
+                User::Leave( KErrAlreadyExists );
+                }
+
+            // Add set event to pending state event list
+            HBufC* name = aEvent.Name().AllocLC();
+            User::LeaveIfError( iStateEvents.Append( name ) );
+            CleanupStack::Pop( name );
+            }
+        else if( aEvent.Type() == TEventIf::EUnsetEvent )
+            {
+            if( index == count )
+                {
+                // Not found from state event list
+                User::Leave( KErrNotFound );
+                }
+            HBufC* tmp = iStateEvents[index];
+            iStateEvents.Remove( index );
+            delete tmp;
+            }
+        }
+    else if( aEvent.Type() == TEventIf::EUnsetEvent )
+        {
+        // Can not give Unset for indication event
+        User::Leave( KErrNotSupported );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: Logger
+
+    Description: Return the pointer to Logger.
+
+    Parameters: None
+
+    Return Values: CStifLogger*: Pointer to StifLogger
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifLogger* CTestEngine::Logger()
+    {
+    return iTestEngineServer->Logger();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: WriteRebootParams
+
+    Description: Write the Reboot's state parameters.
+
+    Parameters: TTestInfo& aTestInfo: in: Test case information.
+                TInt& aCode: in: Reboot related integer information.
+                TDesC& aName: in: Reboot related string information.
+
+    Return Values: TInt: Symbian OS error
+
+    Errors/Exceptions: Error code returned if Logger creation fails.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::WriteRebootParams( TTestInfo& aTestInfo,
+                                        TInt& aCode,
+                                        TDesC& aName )
+    {
+    __TRACE( KVerbose, ( _L( "WriteRebootParams() starts..." ) ) );
+    
+    // Logger's setting definitions
+    TLoggerSettings loggerSettings;
+
+    loggerSettings.iCreateLogDirectories = ETrue;
+    loggerSettings.iOverwrite = ETrue;
+    loggerSettings.iTimeStamp = EFalse;
+    loggerSettings.iLineBreak = EFalse;
+    loggerSettings.iEventRanking = EFalse;
+    loggerSettings.iThreadId = EFalse;
+    // EData format because now we don't have to check file type when
+    // parsing this.
+    loggerSettings.iHardwareFormat = CStifLogger::EData;
+    loggerSettings.iHardwareOutput = CStifLogger::EFile;
+    loggerSettings.iEmulatorFormat = CStifLogger::EData;
+    loggerSettings.iEmulatorOutput = CStifLogger::EFile;
+    loggerSettings.iUnicode = EFalse;
+    loggerSettings.iAddTestCaseTitle = EFalse;
+
+    // Use default setting if path or filename are not set by SetAttribute()
+    if( iRebootPath == NULL )
+        {
+        iRebootPath= iRebootDefaultPath.Alloc();
+        }
+    if( iRebootFilename == NULL )
+        {
+        iRebootFilename= iRebootDefaultFilename.Alloc();
+        }
+
+    CStifLogger* logger = NULL;
+    TRAPD( ret, logger = CStifLogger::NewL( *iRebootPath,
+                                        *iRebootFilename,
+                                        loggerSettings ) );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, ( _L( "WriteRebootParams() Logger creation fails with error: " ), ret ) );
+        delete logger;
+        return ret;
+        }
+
+    // Write reboot parameters
+    // Because logging format is EData we need add line breaks by hand.
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "This is TestFramework's file which includes Reboot related informations" ) );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "Reboot case's related information:" ) );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "%S %S" ), &KTestModule, &aTestInfo.iModuleName );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "%S %S" ), &KTestCaseFile, &aTestInfo.iConfig );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "%S %d" ), &KTestCaseNumber, aTestInfo.iTestCaseInfo.iCaseNumber );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "%S %S" ), &KTestCaseTitle, &aTestInfo.iTestCaseInfo.iTitle );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "%S %d" ), &KStateCode, aCode );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "%S " ), &KStateName );
+    logger->Log( aName );
+    logger->Log( _L( "\r\n" ) );
+    logger->Log( _L( "\r\n" ) );
+
+    delete logger;
+
+    __TRACE( KVerbose, ( _L( "WriteRebootParams() ends" ) ) );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ReadRebootParams
+
+    Description: Read the Reboot parameters.
+
+    Parameters: TTestInfo& aTestInfo: in: Test case information.
+
+    Return Values: TInt: Symbian OS error
+
+    Errors/Exceptions: Error code returned if Parser creation fails.
+                       Error code returned if section creation fails.
+                       Error code returned if item creation fails.
+                       Error code returned if parsing operation fails.
+                       KErrArgument returned if parsed values and test case
+                       values are different.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::ReadRebootParams( TTestInfo& aTestInfo, 
+                                    TDes& aStateDes, 
+                                    TInt& aState )
+    {
+    __TRACE( KVerbose, ( _L( "ReadRebootParams() starts..." ) ) );
+
+    if( iRebootParams == NULL )
+        {
+        __TRACE( KVerbose, ( _L( "ReadRebootParams(): Reboot not done" )) );
+        return KErrNotFound;
+        }
+        
+    // --.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--
+    // Checks parsed values and test case values
+    // --.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--
+    if( iRebootParams->iTestModule != aTestInfo.iModuleName ||
+        iRebootParams->iTestCaseFile != aTestInfo.iConfig ||
+        iRebootParams->iCaseNumber != aTestInfo.iTestCaseInfo.iCaseNumber )
+        {
+        __TRACE( KVerbose, 
+            ( _L( "ReadRebootParams(): Reboot not done by %S" ), 
+                &aTestInfo.iModuleName) );
+        return KErrArgument;
+        }
+   
+    aStateDes.Copy( iRebootParams->iStateName );
+    aState = iRebootParams->iStateCode;
+   
+    // delete reboot params, to ensure that same test case 
+    // does not get indication about reboot again
+    delete iRebootParams;
+    iRebootParams = 0;
+
+    __TRACE( KVerbose, ( _L("ReadRebootParams() ends" ) ) );
+    
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ParseRebootParamsL
+
+    Description: Parse the Reboot parameters.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian OS error
+
+    Errors/Exceptions: Error code returned if Parser creation fails.
+                       Error code returned if section creation fails.
+                       Error code returned if item creation fails.
+                       Error code returned if parsing operation fails.
+                       KErrArgument returned if parsed values and test case
+                       values are different.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::ParseRebootParamsL()
+    {
+    __TRACE( KVerbose, ( _L( "ParseRebootParamsL() starts..." ) ) );
+
+    TInt ret_parsing( 0 );
+    TPtrC tmp;
+
+    // Use default setting if path or filename are not set by SetAttribute()
+    if( iRebootPath == NULL )
+        {
+        iRebootPath= iRebootDefaultPath.Alloc();
+        }
+    if( iRebootFilename == NULL )
+        {
+        iRebootFilename= iRebootDefaultFilename.Alloc();
+        }
+
+    // Create parser object
+    CStifParser* parser = NULL;
+    TRAPD( ret, parser = CStifParser::NewL( *iRebootPath,
+                                        *iRebootFilename ) );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, ( _L( "ReadRebootParams(): Reboot file not found" )) );
+        return ret;        
+        }
+    CleanupStack::PushL( parser );
+    
+    // Create section object
+    CStifSectionParser* section = parser->SectionL( KNullDesC, KNullDesC );
+    CleanupStack::PushL( section );
+    
+    // Delete old reboot params
+    delete iRebootParams;
+    iRebootParams = 0;
+    iRebootParams = CRebootParams::NewL();
+    
+    // ----------------------Test module parsing
+    CStifItemParser* item = section->GetItemLineL( KTestModule );
+    CleanupStack::PushL( item );
+
+    // Parsing integer
+    ret_parsing = item->GetString( KTestModule, tmp );
+    if( ret_parsing == KErrNone || ret_parsing == KErrNotFound )
+        {
+        __TRACE( KVerbose, ( _L("ReadRebootParams(): TestModule: %S" ), &tmp ) );
+        }
+    else
+        {
+        __TRACE( KError, 
+            ( _L("ReadRebootParams(): TestModule parsing fails with error: " ), 
+                ret_parsing ) );
+        User::Leave( ret_parsing );        
+        }
+    iRebootParams->SetTestModuleNameL( tmp );
+    CleanupStack::PopAndDestroy( item );
+
+    // ----------------------Testcase parsing
+    item = section->GetItemLineL( KTestCaseFile );
+    CleanupStack::PushL( item );
+
+    // Parsing string
+    ret_parsing = item->GetString( KTestCaseFile, tmp );
+    if( ret_parsing == KErrNone ) 
+        {
+        __TRACE( KVerbose, ( _L("ReadRebootParams(): TestCaseFile: %S" ), &tmp ) );
+        iRebootParams->SetTestCaseFileNameL( tmp );
+        }
+    else if( ret_parsing == KErrNotFound )
+        {
+        __TRACE( KVerbose, 
+            ( _L("ReadRebootParams(): No testcasefile defined for test module" )) );
+        }
+    else
+        {
+        __TRACE( KError, 
+            ( _L("ReadRebootParams(): TestCaseFile parsing fails with error: %d " ), 
+                ret_parsing ) );
+        User::Leave( ret_parsing );  
+        }
+    CleanupStack::PopAndDestroy( item );
+
+    // ----------------------Testcase number parsing
+    item = section->GetItemLineL( KTestCaseNumber );
+    CleanupStack::PushL( item );    
+    
+    // Parsing integer
+    ret_parsing = item->GetInt( KTestCaseNumber, iRebootParams->iCaseNumber );
+    if( ret_parsing == KErrNone || ret_parsing == KErrNotFound )
+        {
+        __TRACE( KVerbose, ( _L("ReadRebootParams(): TestCaseNumber: %d" ), 
+            iRebootParams->iCaseNumber ) );
+        }
+    else
+        {
+        __TRACE( KError,
+            ( _L("ReadRebootParams(): TestCaseNumber parsing fails with error: %d " ), 
+                ret_parsing ) );
+         User::Leave( ret_parsing );  
+        }
+    CleanupStack::PopAndDestroy( item );
+
+    // --.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--
+    // --.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--
+    // Next state code and name parsing if no error found
+    // --.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--.--
+
+    // ----------------------State code parsing
+    item = section->GetItemLineL( KStateCode );
+    CleanupStack::PushL( item );   
+
+    // Parsing integer
+    ret_parsing = item->GetInt( KStateCode, iRebootParams->iStateCode );
+    if( ret_parsing == KErrNone || ret_parsing == KErrNotFound )
+        {
+        __TRACE( KVerbose, ( _L("ReadRebootParams(): StateCode: %d" ), 
+            iRebootParams->iStateCode ) );
+        }
+    else
+        {
+        __TRACE( KError, 
+            ( _L("ReadRebootParams(): StateCode parsing fails with error: %d " ), 
+            ret_parsing ) );
+        User::Leave( ret_parsing );  
+        }
+    CleanupStack::PopAndDestroy( item );
+    
+    // ----------------------State name parsing
+    ret_parsing = section->GetLine( KStateName, tmp, ENoTag );
+    if( ret_parsing != KErrNone )
+        {
+        __TRACE( KError, 
+            ( _L("ReadRebootParams(): State name parsing fails with error: %d " ), 
+            ret_parsing ) );
+        User::Leave( ret_parsing );         
+        }
+
+    iRebootParams->SetTestCaseStateL( tmp );
+
+    __TRACE( KVerbose, ( _L("ReadRebootParams() ends" ) ) );
+
+    CleanupStack::PopAndDestroy( section );
+    CleanupStack::PopAndDestroy( parser );
+
+    // Delete file
+    RFs rf;
+    TInt retVal = rf.Connect();
+	if( retVal != KErrNone )
+		{
+		User::Leave( retVal ); 
+		}
+		
+    TFileName file( *iRebootPath );
+    file.Append( *iRebootFilename );
+    rf.Delete( file );
+    rf.Close();
+    
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: PauseAllTestCases
+
+    Description: Pause all test case(s) which are/is running.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::PauseAllTestCases()
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::PauseAllTestCases()" ) ) );
+
+    TInt count( 0 );
+    count = iTestCaseArray.Count();
+
+    for( TInt a = 0; a < count; a++ )
+        {
+         // Pause test case
+         iTestCaseArray[a]->Pause();
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: FlushAtsLogger
+
+    Description: Flush ATS logger's
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::FlushAtsLogger()
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::FlushAtsLogger()" ) ) );
+
+    TInt count( 0 );
+    count = iModules.Count();
+
+    for( TInt a = 0; a < count; a++ )
+        {
+         // Pause test case
+         iModules[a]->AtsLogger().SaveForRebootL();
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: GetDeviceResetDllName
+
+    Description: Get device reset module's DLL name.
+
+    Parameters: None
+
+    Return Values: TPtrC
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TPtrC CTestEngine::GetDeviceResetDllName()
+    {
+    __TRACE( KVerbose, ( _L( "CTestEngine::GetDeviceResetDllName()" ) ) );
+
+    return iDeviceResetDllName->Des();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: EnableStifMeasurement
+
+    Description: Set measurements related information, enable measurement.
+
+    Parameters: const TName& aInfoType: in: Enabled measurement type
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::EnableStifMeasurement( const TDesC& aInfoType )
+    {
+    __TRACE( KInit, ( _L( "Measurement [%S] enabled" ), &aInfoType ) );
+
+    if( aInfoType == KStifMeasurement01 )
+        {
+        iDisableMeasurement &= ~EMeasurement01;
+        }
+    else if( aInfoType == KStifMeasurement02 )
+        {
+        iDisableMeasurement &= ~EMeasurement02;
+        }
+    else if( aInfoType == KStifMeasurement03 )
+        {
+        iDisableMeasurement &= ~EMeasurement03;
+        }
+    else if( aInfoType == KStifMeasurement04 )
+        {
+        iDisableMeasurement &= ~EMeasurement04;
+        }
+    else if( aInfoType == KStifMeasurement05 )
+        {
+        iDisableMeasurement &= ~EMeasurement05;
+        }
+    else if( aInfoType == KStifMeasurementBappea )
+        {
+        iDisableMeasurement &= ~EBappea;
+        }
+    else if( aInfoType == KStifMeasurementDisableAll )
+        {
+        __TRACE( KInit, ( _L( "All measurements are disabled" ) ) );
+        iDisableMeasurement &= EDisableAll; // Does change anything !!!
+        }
+    else if( aInfoType ==  KStifMeasurementEnableAll )
+        {
+        __TRACE( KInit, ( _L( "All measurements types are enabled" ) ) );
+        iDisableMeasurement &= EEnableAll;
+        }
+    else
+        {
+        __TRACE( KInit, ( _L( "Measurement [%S] not recognized" ), &aInfoType ) );
+        return KErrArgument;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: DisableStifMeasurement
+
+    Description: Set measurements related information, disable measurement.
+
+    Parameters: const TName& aInfoType: in: Disabled measurement type 
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::DisableStifMeasurement( const TDesC& aInfoType )
+    {
+    __TRACE( KInit, ( _L( "Measurement [%S] disabled" ), &aInfoType ) );
+
+    if( aInfoType == KStifMeasurement01 )
+        {
+        iDisableMeasurement |=  EMeasurement01;
+        }
+    else if( aInfoType ==  KStifMeasurement02 )
+        {
+        iDisableMeasurement |=  EMeasurement02;
+        }
+    else if( aInfoType ==  KStifMeasurement03 )
+        {
+        iDisableMeasurement |= EMeasurement03;
+        }
+    else if( aInfoType ==  KStifMeasurement04 )
+        {
+        iDisableMeasurement |=  EMeasurement04;
+        }
+    else if( aInfoType ==  KStifMeasurement05 )
+        {
+        iDisableMeasurement |=  EMeasurement05;
+        }
+    else if( aInfoType ==  KStifMeasurementBappea )
+        {
+        iDisableMeasurement |=  EBappea;
+        }
+    else if( aInfoType ==  KStifMeasurementDisableAll )
+        {
+        __TRACE( KInit, ( _L( "All measurements are disabled" ) ) );
+        iDisableMeasurement |=  EDisableAll;
+        }
+    else if( aInfoType ==  KStifMeasurementEnableAll )
+        {
+        __TRACE( KInit, ( _L( "All measurements types are enabled" ) ) );
+        iDisableMeasurement |=  EEnableAll; // Does change anything !!!
+        }
+    // This option can be defined in TestFramework.ini file
+    else if( aInfoType ==  KStifMeasurementDisableNone )
+        {
+        __TRACE( KInit, ( _L( "All measurements types are enabled" ) ) );
+        iDisableMeasurement =  EEnableAll; // Sets to 0
+        }
+    else
+        {
+        __TRACE( KInit, ( _L( "Measurement [%S] not recognized" ), &aInfoType ) );
+        return KErrArgument;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: StifMeasurement
+
+    Description: Get measurements related information. Returns is measurement
+                 disable.
+
+    Parameters: None
+
+    Return Values: TInt: Indication what measurement types is/are disabled.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::StifMeasurement()
+    {
+    return iDisableMeasurement;
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: TestModuleCrash
+
+    Description: This method is called only when test module crashed 
+                 with KErrServerTerminated (-15). 
+                 Clones new TestModuleController:
+                 - Find crashed testmodulecontroller
+                 - Creates new copy of that testmodulecontroller
+                 - Replaces old crashed testmodulecontroller with this new one
+
+    Parameters: CTestModuleController* aTestModuleController: in: TestModuleController
+    Return Values: None
+
+    Errors/Exceptions: Leaves if error happens when adding clone to the list
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::TestModuleCrash(CTestModuleController* aTestModuleController)
+    {
+    TName crashModuleName = aTestModuleController->ModuleName(KNullDesC);
+    __TRACE(KInit, (_L("Handling crashed test module [%S]"), &crashModuleName));
+    TBool isTestScripter(EFalse);
+    
+    // Find crashed test module controller
+    CTestScripterController* testScripterController = aTestModuleController->iTestScripterController;
+    if(testScripterController)
+        {
+        isTestScripter = ETrue;
+        }
+
+    // If UITestingSupport or SeparateProcesses is enabled, there is no need
+    // to create clone of Test Module Controller, because it will be created
+    // automatically when needed.
+    if(iUITestingSupport && crashModuleName.Find(KTestScripterName) == 0 
+       || iSeparateProcesses
+       || (crashModuleName.Find(KPythonScripter) == 0)
+      )
+        {
+        __TRACE(KInit, (_L("Handling crashed test module with enabled UITestingSupport or SeparateProcesses is not needed")));
+        aTestModuleController->iTestModuleCrashDetected = ETrue;
+        return;
+        }
+        
+    // Clone crashed module
+    TBool afterReset = EFalse;
+    if(iRebootParams && iRebootParams->iTestModule == crashModuleName)
+        {
+        afterReset = ETrue;
+        }  
+    
+    CTestModuleController* clone;    
+    clone = aTestModuleController->CloneL(aTestModuleController, afterReset, testScripterController);  
+    
+    // Replaces crashed testmodulecontroller with this new one    
+    // Note: Old Testmodulecontroller is deleted in CTestModuleController::CaseFinished 
+    //       that is called from  CTestCase::~CTestCase() 
+
+    TInt index = KErrNotFound;
+    if(isTestScripter)
+        {
+        index = testScripterController->iTestScripter.Find(aTestModuleController);
+        __TRACE(KInit, (_L("Crashed module index [%d]"), index));
+        if(index != KErrNotFound)
+            {
+            testScripterController->iTestScripter.Remove(index);
+            }
+        testScripterController->iTestScripter.Append(clone);            
+        }
+    else
+        {
+        index = iModules.Find(aTestModuleController);
+        __TRACE(KInit, (_L("Crashed module index [%d]"), index));
+        if(index != KErrNotFound)
+            {
+            iModules.Remove(index);
+            }
+        iModules.Append(clone);
+        }
+    __TRACE(KInit, (_L("End of handling crashed test module")));
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: ExecuteCommandL
+
+    Description: Executes command received from test case.
+                 The method was created to allow test case to kill itself.
+
+    Parameters: aTestCaseHandle: handler to test case
+    Return Values: None
+
+    Errors/Exceptions: Leaves if error happens when adding clone to the list
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngine::ExecuteCommandL(TCommand aCommand, TDesC8& aParamsPckg)
+    {
+    TInt testCaseHandle = 0;
+    // Get params
+    switch(aCommand)
+        {
+        case EStopExecution:
+            {
+            //Unpack received parameters
+            TStopExecutionCommandParams par;
+            TStopExecutionCommandParamsPckg parPack(par);
+            parPack.Copy(aParamsPckg);
+
+            __TRACE(KInit, (_L("CTestEngine::ExecuteCommandL received command [%d] type [%d] code [%d] test handle [%d]"), TInt(aCommand), TInt(par.iType), TInt(par.iCode), par.iTestCaseHandle));
+
+            //Get test case handle
+            testCaseHandle = par.iTestCaseHandle;
+
+            break;
+            }
+        case ESendTestModuleVersion:
+        	{
+        	TSendTestModuleVesionCommandParams par;
+        	TSendTestModuleVesionCommandParamsPckg parPack(par);
+        	parPack.Copy(aParamsPckg);
+
+        	TTestModuleVersionInfo testModuleVersionInfo;
+        	testModuleVersionInfo.iMajor = par.iMajor;
+        	testModuleVersionInfo.iMinor = par.iMinor;
+        	testModuleVersionInfo.iBuild = par.iBuild;
+        	testModuleVersionInfo.iTestModuleName = par.iTestModuleName;
+        	if( RetrieveTestReport() )
+        	    {
+                iTestReport->AddTestModuleVersion(testModuleVersionInfo);
+        	    }
+        	
+        	return;
+        	}
+        default:
+            __TRACE(KError, (_L("CTestEngine::ExecuteCommandL Unknown command [%d]"), TInt(aCommand)));
+            return;
+        }
+
+    // Get test case from container
+    CTestCase* testCase = (CTestCase*)iTestCases->At(testCaseHandle);
+
+    // Log some info if invalid handle
+    if(testCase == NULL)
+        {
+        __TRACE(KInit, ( _L( "CTestEngine::ExecuteCommandL - invalid handle. Unable to get test case to execute command [%d]"), TInt(aCommand)));
+        return;
+        }
+
+    testCase->ExecuteCommandL(aCommand, aParamsPckg);
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: GetIndexForNewTestModuleController
+
+    Description: Returns new index for test module controller.
+                 This number is appended to module controller name.
+                 This method is used when option to run every test case in 
+                 separate process is set to on.
+
+    Parameters: aTestCaseHandle: handler to test case
+    Return Values: None
+
+    Errors/Exceptions: Leaves if error happens when adding clone to the list
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::GetIndexForNewTestModuleController(void)
+    {
+    return iIndexTestModuleControllers++;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngine
+
+    Method: AddTestCaseToTestReport
+
+    Description: Get parameters from message and add test case to test report.
+
+    Parameters: aMessage: message
+    Return Values: error id
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestEngine::AddTestCaseToTestReport(const RMessage2& aMessage)
+    {
+    if( RetrieveTestReport() )
+        {
+        // Read test data
+        TTestInfo testInfo;
+        TTestInfoPckg testInfoPckg(testInfo);
+    
+        TFullTestResult fullTestResult;
+        TFullTestResultPckg fullTestResultPckg(fullTestResult);
+        
+        TRAPD(err, aMessage.ReadL(0, testInfoPckg));
+        if(err)
+            {
+            __TRACE(KError, (_L("Leave when reading TTestInfo in AddTestCaseToTestReport [%d]"), err));
+            return err;
+            }
+    
+        TRAP(err, aMessage.ReadL(1, fullTestResultPckg));
+        if(err)
+            {
+            __TRACE(KError, (_L("Leave when reading TFullTestResult in AddTestCaseToTestReport [%d]"), err));
+            return err;
+            }
+            
+        TRAP( err, iTestReport->AddTestCaseResultL(testInfo, fullTestResult, aMessage.Int2()));
+        if( err )
+            {
+            __TRACE(KError, (_L("Leave from test report in AddTestCaseToTestReport [%d]"), err));
+            return err;
+            }
+        }
+    else
+        {
+        __TRACE(KError, (_L("TestReport not initialized in AddTestCaseToTestReport")));
+        return KErrNotReady;
+        }
+
+    return KErrNone;
+    }
+
+TBool CTestEngine::UITesting()
+    {
+    return iUITestingSupport;
+    }
+
+TBool CTestEngine::SeparateProcesses()
+    {
+    return iSeparateProcesses;
+    }
+
+CTestReport* CTestEngine::RetrieveTestReport()
+    {
+    if(iTestReport==NULL)
+        {
+        // Create Test Reporter if allowed
+        if ( iTestReportSettings->iCreateTestReport )
+            {
+            TRAPD(err, iTestReport = 
+                CTestReport::NewL( *iTestReportSettings, ( CTestReport::TTestReportMode ) iReportMode ));
+            if(err!=KErrNone)
+                {
+                iTestReport = NULL;
+                __TRACE( KInit,( CStifLogger::ERed, _L( "Test report creation failed with error: %d, test report not created." ), err ) );
+                __TRACE( KInit,( CStifLogger::ERed, _L( "Check your testreport settings from testframework.ini file (e.g. TestReportFilePath)." ) ) );
+                __TRACE( KInit,( CStifLogger::ERed, _L( "Also check if testreport is not used by other testengine session. If it is change testreport " ) ) );
+                __TRACE( KInit,( CStifLogger::ERed, _L( "name in TestFramework.ini." ) ) );
+                }
+            }
+        }
+    return iTestReport;    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestEngineSubSession class member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestCase class member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: CTestCase
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: CTestEngine* aEngine: in: Pointer to Test Engine
+                CTestModuleController* aModuleController: in: Pointer to 
+                  Module Controller
+                TTestInfo& aTestInfo: in: Test info for this test case
+                CTestModuleController* aRealModuleController: in: Pointer to
+                  module controller used inside in scripter controller
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestCase::CTestCase( CTestEngine* aEngine,
+                     CTestModuleController* aModuleController,
+                     TTestInfo& aTestInfo,
+                     CTestModuleController* aRealModuleController ) :
+    iTestEngine( aEngine ),
+    iTestModule( aModuleController ),
+    iRealModuleController (aRealModuleController)
+    {
+    
+    // This method must be called to find out how
+    // many testcases are currently ongoing by increasing iTestCaseCounter. 
+    // This is a part of the implementation for 
+    //  supporting test module crashing with -15
+    iTestModule->CaseCreated();  
+
+    // Store handle to RTestServer
+    //If test scripter is used (it uses internally module controllers)
+    //then use it (real module controller). 
+    if(iRealModuleController)
+        {
+        iTestServer = iRealModuleController->Server(aTestInfo); 
+        }
+    else
+        {
+        iTestServer = iTestModule->Server( aTestInfo );
+        }
+
+    //If real test module controller is provided, increase test case count
+    if(iRealModuleController)
+        {
+        iRealModuleController->CaseCreated();
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: CTestReport* aTestReport: in: Pointer to Test Report
+                TTestInfo& aTestInfo: in: Test Info for this test case
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if RTestExecution::Open returns error
+                       Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::ConstructL( CTestReport* aTestReport,
+                           TTestInfo& aTestInfo )
+    {
+    __TRACE( KVerbose, ( _L( "CTestCase::ConstructL" ) ) );
+
+    // Open handle to RTestExecution
+    User::LeaveIfError( iTestExecution.Open( iTestServer,
+        aTestInfo.iTestCaseInfo.iCaseNumber, aTestInfo.iConfig ) );
+
+    // Make new test case runner
+    iTestCaseController = CTestCaseController::NewL( iTestEngine,
+        aTestReport, iTestModule->AtsLogger(), iTestExecution, aTestInfo );
+
+    // Make new test case printer
+    iTestCasePrint = CTestProgressNotifier::NewL( iTestEngine,
+                                                  iTestExecution );
+
+    iTestCaseEvent = CTestEventNotifier::NewL( iTestEngine, iTestExecution );
+
+    iTestCaseRemoteCmd = CTestRemoteCmdNotifier::NewL( iTestEngine,
+                                                    iTestExecution,
+                                                    iTestCaseController,
+                                                    iTestModule->AtsLogger() );
+
+    iTestCaseCommand = CTestCommandNotifier::NewL(iTestEngine, iTestExecution);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to Test Engine
+                CTestModuleController* aModuleController: in: Pointer to
+                 Module Controller
+                CTestReport* aTestReport: in: Pointer to Test Report
+                TTestInfo& aTestInfo: in: Test Info for this test case
+
+    Return Values: CTestCase* : pointer to created CTestCase object
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCase* CTestCase::NewL( CTestEngine* aEngine,
+            CTestModuleController* aModuleController,
+            CTestReport* aTestReport,
+            TTestInfo& aTestInfo,
+            CTestModuleController* aRealModuleController )    
+    {
+    CTestCase* self = new ( ELeave ) CTestCase( aEngine, aModuleController, aTestInfo, aRealModuleController );
+    CleanupClosePushL( *self );
+    self->ConstructL( aTestReport, aTestInfo );
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: ~CTestCase
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCase::~CTestCase()
+    {
+    CloseTestCase();
+    
+    // This added method call is a part of the implementation for 
+    // supporting test module crashing with -15.
+    // It checks that can old Testmodulecontroller be deletd or not 
+	if( iTestModule != NULL )
+		{
+		iTestModule->CaseFinished();    
+		}
+	
+    //If real test module controller is provided, decrease test case count
+    if( iRealModuleController != NULL )
+        {
+        iRealModuleController->CaseFinished();
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: CloseTestCase
+
+    Description: Close session
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::CloseTestCase()
+    {
+    __TRACE( KVerbose, ( _L( "CTestCase::CloseTestCase" ) ) );
+
+    // Free allocated resources
+    delete iTestCaseController;
+    iTestCaseController = NULL;
+    delete iTestCasePrint;
+    iTestCasePrint = NULL;
+    delete iTestCaseRemoteCmd;
+    iTestCaseRemoteCmd = NULL;
+
+    delete iTestCaseEvent;
+    iTestCaseEvent = NULL;
+
+    delete iTestCaseCommand;
+    iTestCaseCommand = NULL;
+
+    iTestExecution.Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: RunTestCaseL
+
+    Description: Enumerates test cases
+
+    Parameters: const RMessage& aMessage: in: Server Message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::RunTestCaseL( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestCase::RunTestCaseL" ) ) );
+    // Start active objects for running test case
+    iTestCaseController->StartL( aMessage );
+    iTestCaseEvent->Start();
+    iTestCaseCommand->Start();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: Pause
+
+    Description: Suspend the test case execution
+
+    Parameters: None
+
+    Return Values: TInt: Return value from RTestExecution::Pause
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCase::Pause()
+    {
+    __TRACE( KVerbose, ( _L( "CTestCase::Pause" ) ) );
+
+    return iTestExecution.Pause();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: Resume
+
+    Description: Resume the suspended test case execution
+
+    Parameters: None
+
+    Return Values: TInt: Return value from RTestExecution::Resume
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCase::Resume()
+    {
+    __TRACE( KVerbose, ( _L( "CTestCase::Resume" ) ) );
+
+    return iTestExecution.Resume();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: NotifyProgressL
+
+    Description: Notifies progresses from Test Module
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called StartL method leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::NotifyProgressL( const RMessage2& aMessage )
+    {
+    __TRACE( KVerbose, ( _L( "CTestCase::NotifyProgressL" ) ) );
+    iTestCasePrint->StartL( aMessage );
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: NotifyRemoteTypeL
+
+    Description: Notifies remote commands from Test Module
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called StartL method leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::NotifyRemoteTypeL( const RMessage2& aMessage )
+    {
+    
+    __TRACE( KVerbose, ( _L( "CTestCase::NotifyRemoteTypeL" ) ) );
+    iTestCaseRemoteCmd->EnableReceive( aMessage );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: NotifyRemoteMsgL
+
+    Description: Notifies remote commands from Test Module
+
+    Parameters: const RMessage& aMessage: in: Server message
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called StartL method leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::NotifyRemoteMsgL( const RMessage2& aMessage )
+    {
+    
+    __TRACE( KVerbose, ( _L( "CTestCase::NotifyRemoteMsgL" ) ) );
+    switch( aMessage.Int1() )
+        {
+        case EStifCmdSend:
+            {
+            iTestCaseRemoteCmd->GetReceivedMsg( aMessage );
+            }
+            break;
+        case EStifCmdReceive:
+            {
+            TInt len = aMessage.Int2();
+            if( len <= 0 )
+                {
+                User::Leave( KErrGeneral );
+                }
+            HBufC8* buf = HBufC8::NewLC( len );
+
+            TPtr8 tmp = buf->Des();
+            aMessage.ReadL( 0, tmp );
+
+            TInt ret = iTestExecution.ReadRemoteCmdInfo( tmp, EStifCmdReceive );
+
+            CleanupStack::PopAndDestroy( buf );
+            
+            aMessage.Complete( ret );
+            }
+            break;
+        case EStifCmdRebootProceed:
+            {
+            TInt value = 0;
+            TPckg<TInt> tmp( value );
+            aMessage.ReadL( 0, tmp );
+
+            TInt ret = iTestExecution.ReadRemoteCmdInfo( tmp, 
+                                                         EStifCmdRebootProceed,
+                                                         value );        
+            aMessage.Complete( ret );
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrGeneral );
+            }  
+        }            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: CancelAsyncRequest
+
+    Description: Asynchronous requests are canceled by this function.
+
+    Parameters: const RMessage aMessage
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::CancelAsyncRequest( const RMessage2& aMessage )
+    {
+    switch ( aMessage.Int0() )
+        {
+        case ETestCaseRunTestCase:
+            {
+            iTestCaseController->Cancel();
+            iTestCaseEvent->Cancel();
+            break;
+            }
+        case ETestCaseNotifyProgress:
+            {
+            iTestCasePrint->Cancel();
+            break;
+            }
+        case ETestCaseNotifyRemoteType:
+            {
+            iTestCaseRemoteCmd->CancelReq();
+            break;
+            }
+        case ETestCaseNotifyCommand:
+            {
+            iTestCaseCommand->Cancel();
+            break;
+            }
+        default:
+            iTestEngine->PanicClient( EBadRequest, aMessage );
+            break;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: ModuleName
+
+    Description: Return the name of Test Module.
+
+    Parameters: None
+
+    Return Values: const TFileName& : Test Module owning this test case
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestCase::ModuleName()
+    {
+    return iTestModule->ModuleName( KNullDesC );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: CtlEvent
+
+    Description: Control events
+
+    Parameters: const TEventIf& aEvent: in: Event
+                TRequestStatus& aStatus: in: Request status
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::CtlEvent( const TEventIf& aEvent, TRequestStatus& aStatus )
+    {
+    __ASSERT_ALWAYS( iTestCaseEvent, User::Panic( _L( "TestEngine event panic" ), KErrArgument ) );
+        
+    iTestCaseEvent->CtlEvent( aEvent, aStatus );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: CheckCtlEvent
+
+    Description: Check if CtlEvent should be called
+
+    Parameters: const TEventIf& aEvent: in: Event
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestCase::CheckCtlEvent( const TEventIf& aEvent )
+    {
+    return iTestCaseEvent->CheckCtlEvent( aEvent );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: Logger
+
+    Description: Return the pointer to Logger.
+
+    Parameters: None
+
+    Return Values: CStifLogger*: Pointer to StifLogger
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifLogger* CTestCase::Logger()
+    {
+    return iTestEngine->Logger();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: ExecuteCommaandL
+
+    Description: Executes command received from test case.
+
+    Parameters: aStifCommand command to be executed
+                aParam1      parameter to command
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::ExecuteCommandL(TCommand aCommand, TDesC8& aParamsPckg)
+    {
+    switch(aCommand)
+        {
+        case EStopExecution:
+            {
+            //Unpack received parameters
+            TStopExecutionCommandParams par;
+            TStopExecutionCommandParamsPckg parPack(par);
+            parPack.Copy(aParamsPckg);
+
+            __TRACE(KVerbose, (_L("CTestCase::ExecuteCommandL command [%d] type [%d] code [%d]"), TInt(aCommand), TInt(par.iType), par.iCode));
+
+            iTestCaseController->Suicide(par.iType, par.iCode);
+            break;
+            }
+        default:
+            __TRACE(KVerbose, (_L("CTestCase::ExecuteCommandL unknown command [%d]"), TInt(aCommand)));
+            return;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: GetModuleControllers
+
+    Description: Return module controller and real module controller
+
+    Parameters: aRealModuleController: out: real module controller
+
+    Return Values: module controller
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleController* CTestCase::GetModuleControllers(CTestModuleController** aRealModuleController)
+    {
+    *aRealModuleController = iRealModuleController;
+    return iTestModule;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: ResetModuleController
+
+    Description: Set new module controller for test case (only in case when 
+                 original controller crashed)
+
+    Parameters: aModuleController: in: new module controller
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::ResetModuleController(CTestModuleController* aModuleController)
+    {
+    iTestModule = aModuleController;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCase
+
+    Method: ResetRealModuleController
+
+    Description: Set new real module controller for test case (only in case 
+                 when original controller crashed).
+
+    Parameters: aRealModuleController: in: new real module controller
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCase::ResetRealModuleController(CTestModuleController* aRealModuleController)
+    {
+    iRealModuleController = aRealModuleController;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    Default constructor
+
+-------------------------------------------------------------------------------
+*/
+CTestReportSettings::CTestReportSettings()
+    {
+    iCreateTestReport = ETrue;
+    iPath = NULL;
+    iName = NULL;
+    iFormat = CStifLogger::ETxt;
+    iOutput = CStifLogger::EFile;
+    iOverwrite = ETrue; 
+    iXML = EFalse;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    Two-phased constructor.
+
+-------------------------------------------------------------------------------
+*/
+CTestReportSettings* CTestReportSettings::NewL()
+    {
+    CTestReportSettings* self = new ( ELeave ) CTestReportSettings();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    Symbian OS second phase constructor
+
+-------------------------------------------------------------------------------
+*/
+void CTestReportSettings::ConstructL()
+    {
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    Destructor
+
+-------------------------------------------------------------------------------
+*/
+CTestReportSettings::~CTestReportSettings()
+    { 
+    delete iPath; 
+    iPath = NULL;
+    delete iName;
+    iName = NULL;
+    }     
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CRebootParams class member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRebootParams
+
+    Method: CRebootParams
+
+    Description: Default constructor
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CRebootParams::CRebootParams()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRebootParams
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if RTestExecution::Open returns error
+                       Leaves if some of called leaving methods leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CRebootParams::ConstructL()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRebootParams
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: none
+    
+    Return Values: CRebootParams* : pointer to created CRebootParams object
+
+    Errors/Exceptions: Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CRebootParams* CRebootParams::NewL()    
+    {
+    
+    CRebootParams* self = new ( ELeave ) CRebootParams();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRebootParams
+
+    Method: ~CRebootParams
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CRebootParams::~CRebootParams()
+    {
+    
+    delete iTestModuleBuf;
+    iTestModuleBuf = 0;
+    delete iTestCaseFileBuf;
+    iTestCaseFileBuf = 0;
+    delete iTestCaseTitleBuf;
+    iTestCaseTitleBuf = 0;
+    delete iStateNameBuf;
+    iStateNameBuf = 0;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRebootParams
+
+    Method: SetTestModuleNameL
+
+    Description: Setter
+
+    Parameters: const TDesC& aName: in: name to set
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation fails
+    
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+void CRebootParams::SetTestModuleNameL( const TDesC& aName )
+    {
+    
+    delete iTestModuleBuf;
+    iTestModuleBuf = 0;
+    iTestModuleBuf = aName.AllocLC();
+    iTestModule.Set( iTestModuleBuf->Des() );
+    CleanupStack::Pop( iTestModuleBuf );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRebootParams
+
+    Method: SetTestModuleNameL
+
+    Description: Setter
+
+    Parameters: const TDesC& aName: in: name to set
+
+    Return Values: None
+
+    Errors/Exceptions:  Leaves if memory allocation fails
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+void CRebootParams::SetTestCaseFileNameL( const TDesC& aName )
+    {
+    
+    delete iTestCaseFileBuf;
+    iTestCaseFileBuf = 0;
+    iTestCaseFileBuf = aName.AllocLC();
+    iTestCaseFile.Set( iTestCaseFileBuf->Des() );
+    CleanupStack::Pop( iTestCaseFileBuf );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRebootParams
+
+    Method: SetTestModuleNameL
+
+    Description: Setter
+
+    Parameters: const TDesC& aName: in: name to set
+
+    Return Values: None
+
+    Errors/Exceptions:  Leaves if memory allocation fails
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+void CRebootParams::SetTestCaseTitleL( const TDesC& aName )
+    {
+    
+    delete iTestCaseTitleBuf;
+    iTestCaseTitleBuf = 0;
+    iTestCaseTitleBuf = aName.AllocLC();
+    iTestCaseTitle.Set( iTestCaseTitleBuf->Des() );
+    CleanupStack::Pop( iTestCaseTitleBuf );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRebootParams
+
+    Method: SetTestModuleNameL
+
+    Description: Setter
+
+    Parameters: const TDesC& aName: in: name to set
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation fails
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+void CRebootParams::SetTestCaseStateL( const TDesC& aName )
+    {
+    
+    delete iStateNameBuf;
+    iStateNameBuf = 0;
+    iStateNameBuf = aName.AllocLC();
+    iStateName.Set( iStateNameBuf->Des() );
+    CleanupStack::Pop( iStateNameBuf );
+    
+    }
+
+    
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of TEventMsg class member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEventMsg
+
+    Method: TEventMsg
+
+    Description: Default constructor
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/    
+TEventMsg::TEventMsg():
+    TEventIf(),
+    iWaitPending(EFalse), 
+    iStateEventPending(EFalse),
+    iStatus( NULL )
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEventMsg
+
+    Method: ~TEventMsg
+
+    Description: Destructor
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/    
+TEventMsg::~TEventMsg()
+    {
+    if( iWaitPending )
+        {
+        iWaitMsg.Complete( KErrCancel );
+        iWaitPending = EFalse;
+        }
+        
+    if( iStatus )
+        {
+        User::RequestComplete( iStatus, KErrCancel );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEventMsg
+
+    Method: Set
+
+    Description: Set event.
+    
+    Parameters: TEventType aEventType: in: Event type
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/    
+void TEventMsg::Set( TEventType aEventType )
+    {
+    iEventType = aEventType;
+    if( aEventType == EState )
+        {
+        iStateEventPending = ETrue;
+        }
+    if( iWaitPending )
+        {
+        TEventIf event;
+        event.Copy( *this );
+        TEventIfPckg eventIfPckg( event );
+        iWaitMsg.WriteL( 0, eventIfPckg );
+
+        iWaitMsg.Complete( KErrNone );
+        iWaitPending = EFalse;
+        }
+    } 
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEventMsg
+
+    Method: Wait
+
+    Description: Wait event.
+    
+    Parameters: const RMessage& aMessage: in: Message
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void TEventMsg::Wait( const RMessage2& aMessage )
+    { 
+    if( iStateEventPending )
+        {
+        TEventIf event;
+        event.Copy( *this );
+        TEventIfPckg eventIfPckg( event );
+        aMessage.WriteL( 0, eventIfPckg );
+        aMessage.Complete( KErrNone );
+        }
+    else
+        {
+        iWaitMsg = aMessage;
+        iWaitPending = ETrue;
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEventMsg
+
+    Method: CancelWait
+
+    Description: Cancel pending Wait
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/    
+void TEventMsg::CancelWait()
+    {
+    if( iWaitPending )
+        {
+        iWaitMsg.Complete( KErrCancel );
+        iWaitPending = EFalse;
+        } 
+    } 
+             
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEventMsg
+
+    Method: Release
+
+    Description: Release event. Unset released.
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/    
+void TEventMsg::Release()
+    { 
+    
+    if( iStatus )
+        {
+        User::RequestComplete( iStatus, KErrNone );
+        }
+        
+    } 
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEventMsg
+
+    Method: Unset
+
+    Description: Unset event. Blocks until Release is called.
+    
+    Parameters: TRequestStatus& aStatus: in: Status 
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/    
+void TEventMsg::Unset( TRequestStatus& aStatus )
+    { 
+    
+    iStatus = &aStatus;
+    
+    } 
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/TestEngineClient.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,871 @@
+/*
+* 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: This module contains implementation of 
+* RTestEngineServer class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+
+#include "TestEngineClient.h"
+#include "TestEngineClientServer.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+const TInt KServerRetryCount = 5;
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/**
+ * Starts TestEngine server process and waits untill TestEngineServer ir ready
+ */
+static TInt StartTestEngineServer()
+    {
+    const TUidType testEngineServerUid( KNullUid, KNullUid, KTestEngineServerUid3 );
+    RProcess testEngineServerProcess;
+    TInt ret = testEngineServerProcess.Create( KTestEngineServerExe,
+            KNullDesC, testEngineServerUid );
+    if ( ret != KErrNone )
+        return ret;
+    
+    TRequestStatus status;
+    testEngineServerProcess.Rendezvous( status );
+    if ( status != KRequestPending )
+        {
+        testEngineServerProcess.Kill(0);     // abort startup
+        }
+    else
+        {
+        testEngineServerProcess.Resume();    // logon OK - start the server
+        }
+    
+    User::WaitForRequest( status );     // wait for start or death
+    // we can't use the 'exit reason' if the server panicked as this
+    // is the panic 'reason' and may be '0' which cannot be distinguished
+    // from KErrNone
+    ret = ( testEngineServerProcess.ExitType() == EExitPanic ) ? KErrGeneral : status.Int();
+    testEngineServerProcess.Close();
+    
+    return ret;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngineServer
+
+    Method: Connect
+
+    Description: Connect method creates new RTestEngineServer session.
+
+    RTestEngineServer session is used to manage the test case execution.
+
+    Parameters: None
+
+    Return Values: TInt KErrNone : TestEngineServer created successfully
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::Connect()
+    {
+    TInt retry = KServerRetryCount;
+    for (;;)
+        {
+        TInt ret = CreateSession( KTestEngineServerName, Version() );
+        if ( ret != KErrNotFound && ret != KErrServerTerminated )
+            {
+            return ret;
+            }
+
+        if ( --retry == 0 )
+            {
+            return ret;
+            }
+        
+        ret = StartTestEngineServer();
+        if ( ret != KErrNone && ret != KErrAlreadyExists )
+            {
+            return ret;
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngineServer
+
+    Method: Version
+
+    Description: Return client side version number from RTestEngineServer.
+
+    Parameters: None
+
+    Return Values: TVersion : Version number from RTestEngineServer
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TVersion RTestEngine::Version() const
+    {
+    return ( TVersion( KTestEngineMajorVersionNumber,
+        KTestEngineMinorVersionNumber, KTestEngineBuildVersionNumber ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngineServer
+
+    Method: Close
+
+    Description: Closes the RTestEngineServer session.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestEngine::Close()
+    {
+    RSessionBase::Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of RTestEngine class member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: Open
+
+    Description: Open creates a subsession to TestEngine.
+
+    Parameters: RTestEngineServer& aServer : Handle to Test Engine Server
+                const TFileName& aIniFile : Ini file to be used for 
+                 initialization of the Test Engine
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::LoadConfiguration( const TFileName& aIniFile )
+    {
+    TIpcArgs args( &aIniFile, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineLoadConfiguration, args );
+    }
+
+
+
+EXPORT_C TInt RTestEngine::UpdateLogConfiguration(TDesC& aLogConfigList)
+    {
+    TIpcArgs args( &aLogConfigList, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineUpdateLogConfiguration, args );
+    }
+
+EXPORT_C TInt RTestEngine::UpdateEngineConfiguration(TDesC& aEngineConfigList)
+    {
+    TIpcArgs args( &aEngineConfigList, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineUpdateEngineConfiguration, args );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: SetAttribute
+
+    Description: Sets attributes to Test Framework
+
+    Parameters: TAttribute aAttribute: in: Attribute type
+                const TDesC& aValue: in: Attribute value
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::SetAttribute( TAttribute aAttribute,
+                                          const TDesC& aValue )
+    {
+    TIpcArgs args( aAttribute, &aValue, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineSetAttribute, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: AddTestModule
+
+    Description: Load dynamically a new Test Module to the Test Framework.
+
+    Parameters: const TName& aTestModule : Name of the Test Module to be added
+                const TFileName& aIniFile : Initialization file of Test Module
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::AddTestModule( const TName& aTestModule,
+                                          const TFileName& aIniFile )
+    {
+    TIpcArgs args( &aTestModule, &aIniFile, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineAddTestModule, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: RemoveTestModule
+
+    Description: Remove the existing Test Module from the Test Framework.
+
+    Parameters: const TName& aTestModule : Name of the Test Module to be 
+                                           removed
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::RemoveTestModule( const TName& aTestModule )
+    {
+    TIpcArgs args( &aTestModule, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineRemoveTestModule, args );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: AddConfigFile
+
+    Description: Add new config file to Test Module.
+
+    Parameters: const TName& aTestModule : Name of Test Module where the config
+                 file will be added
+                const TFileName& aConfigFile : Name of config file to be added
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::AddConfigFile( const TName& aTestModule,
+                                          const TFileName& aConfigFile )
+    {
+    TIpcArgs args( &aTestModule, &aConfigFile, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineAddConfigFile, args );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: RemoveConfigFile
+
+    Description: Remove config file from Test Module.
+
+    Parameters: const TName& aTestModule : Test Module name
+                const TFileName& aConfigFile : Name of config file to be removed
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::RemoveConfigFile( const TName& aTestModule,
+                                             const TFileName& aConfigFile )
+    {
+    TIpcArgs args( &aTestModule, &aConfigFile, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineRemoveConfigFile, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: EnumerateTestCases
+
+    Description: First phase of two-phased test case query operation.
+
+    Test cases are inquired by two-phased operation calling first the 
+    EnumerateTestCases method and then the GetTestCases. 
+
+    Parameters: TInt& aCount : Test case count
+                TRequestStatus& aStatus : Request status
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestEngine::EnumerateTestCases( TCaseCount& aCount,
+                                              TRequestStatus& aStatus )
+    {
+    TIpcArgs args( &aCount, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    SendReceive( ETestEngineEnumerateTestCases, args, aStatus );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: GetTestCases
+
+    Description: Second phase of two-phased test case query operation.
+
+    GetTestCases retrieves test cases from Test Modules to aTestCases that is
+    a list consisting of several TTestInfo objects.
+
+    Parameters: CArrayFixFlat<TTestInfo>& aTestCaseBuffer : Test case array
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::GetTestCases( 
+                     CFixedFlatArray<TTestInfo>& aTestCaseBuffer )
+    {
+    // Construct and send message
+    TIpcArgs args( &aTestCaseBuffer.Des(), TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestEngineGetTestCases, args );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: ErrorNotification
+
+    Description: Obtains error notifications from Test Engine and Test
+    Servers via Test Engine.
+
+    Parameters: TTestProgressPckg& aError : Error package
+                TRequestStatus& aStatus : Request status
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C void RTestEngine::ErrorNotification( TErrorNotificationPckg& aError,
+                                              TRequestStatus& aStatus )
+    {
+    TIpcArgs args( &aError, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    SendReceive( ETestEngineErrorNotification, args, aStatus );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: CancelAsyncRequest
+
+    Description: Asynchronous requests can be canceled by this function.
+
+    Parameters: TInt aReqToCancel : Request to be cancelled
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::CancelAsyncRequest( TTestEngineAsyncRequest aReqToCancel )
+    {
+    TIpcArgs args;
+    switch( aReqToCancel )
+        {
+        case EErrorNotification:
+            args.Set( 0, ETestEngineErrorNotification );
+            break;
+        case EEvent:
+            args.Set( 0, ETestEngineEvent );
+            break;            
+        default:
+            return KErrUnknown;        
+        }
+    return SendReceive( ETestEngineCancelAsyncRequest, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: Event
+
+    Description: Used to control STIF Test Framework event system.
+
+    Parameters: TEventIfPckg& aEvent : in : Event information
+                 TRequestStatus& aStatus : in :  Request status
+
+    Return Values: TInt KErrNone : No errors occurred
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestEngine::Event( TEventIfPckg& aEvent, 
+                                  TRequestStatus& aStatus )
+    {
+    TIpcArgs args( &aEvent, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    SendReceive( ETestEngineEvent, args, aStatus );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: OpenLoggerSession
+
+    Description: Open created subsession to TestEngine.
+
+    Parameters: RTestEngineServer& aServer : Handle to Test Engine Server
+                TLoggerSettings& aLoggerSettings: in: Logger's overwrite struct
+
+    Return Values: TInt KErrNone: TestEngine opened and initialized
+                                  succesfully
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::OpenLoggerSession( TLoggerSettings& aLoggerSettings )
+    {
+    // Package
+    TPckg<TLoggerSettings> loggerSettingsPckg( aLoggerSettings );
+
+    TIpcArgs args( &loggerSettingsPckg, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    // Goes to CTestEngine's DispatchMessageL() method
+    
+    return SendReceive( ETestEngineLoggerSettings, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestEngine
+
+    Method: AddTestCaseResultToTestReport
+
+    Description: Sends info about executed test cases to test engine, which
+                 will forward it to test report.
+                 This is used when after reboot UIStore reads info about 
+                 executed test cases before reboot.
+
+    Parameters: TTestIngo& aTestInfo : test info structure
+                TFullTestResult& aTestResult: test result structure
+                TInt aError: error
+
+    Return Values: TInt error code returned by test engine
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestEngine::AddTestCaseResultToTestReport(const TTestInfo& aTestInfo,
+                                                         const TFullTestResult& aTestResult,
+                                                         const TInt aError)
+    {
+    // Create packages
+    TTestInfoPckg testInfoPckg(aTestInfo);
+    TFullTestResultPckg fullTestResultPckg(aTestResult);
+
+    // Create argument list
+    TIpcArgs args(&testInfoPckg, &fullTestResultPckg, aError);
+
+    // Send it to test engine
+    TInt res = SendReceive(ETestEngineReportTestCase, args);
+
+    return res;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of RTestCase class member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: Open
+
+    Description: Open creates a subsession to TestCase.
+
+    Parameters: RTestEngineServer& aServer : Handle to Test Engine Server
+                const TTestInfoPckg& aTestCaseInfo : TTestInfoPckg : Test info
+                                                                     package
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestCase::Open( RTestEngine& aServer,
+                              const TTestInfoPckg& aTestCaseInfo )
+    {
+    TIpcArgs args( &aTestCaseInfo, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return CreateSubSession( aServer, ETestCaseCreateSubSession, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: Close
+
+    Description: Close the RTestCase subsession.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestCase::Close()
+    {
+    RSubSessionBase::CloseSubSession( ETestCaseCloseSubSession );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: RunTestCase
+
+    Description: Run a test case asynchronously.
+
+    Parameters: TFullTestResultPckg& aTestResult : TFullTestResult :
+                 Test Result package
+                TRequestStatus& aStatus : Request status
+
+    Return Values: TInt KErrNone : Test case could be run
+                        Other error code : Reason the test case couldn't be run
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestCase::RunTestCase( TFullTestResultPckg& aTestResult,
+                                     TRequestStatus& aStatus )
+    {
+    TIpcArgs args( &aTestResult, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    SendReceive( ETestCaseRunTestCase, args, aStatus );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: Pause
+
+    Description: Pause suspends the execution of the test case.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestCase::Pause()
+    {
+    TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestCasePause, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: Resume
+
+    Description: Resume the test case suspended previously.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestCase::Resume()
+    {
+    TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestCaseResume, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: NotifyProgress
+
+    Description: Request different progress information from the test case.
+
+    Parameters: TTestProgressPckg& aProgress : TTestProgress : Test Progress
+                                                               package
+                TRequestStatus& aStatus : Request status
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestCase::NotifyProgress( TTestProgressPckg& aProgress,
+                                         TRequestStatus& aStatus )
+    {
+    TIpcArgs args( &aProgress, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    SendReceive( ETestCaseNotifyProgress, args, aStatus );
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: NotifyRemoteType
+
+    Description: Request remote commands information from the test case.
+
+    Parameters: TRemoteCommandPckg& aType: in: Request type
+                TRequestStatus& aStatus : Request status
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestCase::NotifyRemoteType( TStifCommandPckg& aType,
+                                           TPckg<TInt>& aMsgSize,
+                                           TRequestStatus& aStatus )
+    {
+    TIpcArgs args( &aType, &aMsgSize, TIpcArgs::ENothing );
+    SendReceive( ETestCaseNotifyRemoteType, args, aStatus );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: NotifyRemoteMsg
+
+    Description: Request remote commands information from the test case.
+
+    Parameters: TDesC& aMessage: in: Message buffer
+                TRemoteCmdType aType: in: Message direction
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestCase::NotifyRemoteMsg( TDes8& aMessage,
+                                          TStifCommand aType )
+    {
+    TIpcArgs args( &aMessage, aType, aMessage.Length() );
+    return SendReceive( ETestCaseNotifyRemoteMsg, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestCase
+
+    Method: CancelAsyncRequest
+
+    Description: Asynchronous requests can be canceled by this function.
+
+    Parameters: TInt aReqToCancel : Request to be cancelled
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestCase::CancelAsyncRequest( TTestCaseAsyncRequest aReqToCancel )
+    {
+    TIpcArgs args;
+    switch( aReqToCancel )
+        {
+        case ERunTestCase:
+            args.Set( 0, ETestCaseRunTestCase );
+            break;
+        case ENotifyProgress:
+            args.Set( 0, ETestCaseNotifyProgress );
+            break;
+        case ENotifyRemoteType:
+            args.Set( 0, ETestCaseNotifyRemoteType );
+            break;
+        default:
+            return KErrUnknown;        
+        }
+    return SendReceive( ETestCaseCancelAsyncRequest, args );
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/TestEngineServer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,579 @@
+/*
+* 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: This module contains implementation of 
+* CTestEngineServer class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "TestEngineServer.h"
+#include "TestEngineClientServer.h"
+#include "Logging.h"
+#include "TestEngine.h"
+#include "TestReport.h"
+
+#define LOGGER iLogger
+
+const TInt KTestEngineServerShutdownDelay = 5000000; // 10s
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: CTestEngineServer
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEngineServer::CTestEngineServer() :
+    CServer2( CTestEngineServer::ETestEngineServerPriority ),
+    iSessionCount( 0 )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if CObjectConIx::NewL leaves
+                       Leaves if CStifLogger::NewL leaves
+                       Leaves if StartL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngineServer::ConstructL()
+    {
+    // Create container
+    iContainerIndex = CObjectConIx::NewL();
+
+    InitLoggerSettings();
+    InitLoggerL();
+
+    iAutoShutdownTimer = CTestEngineServerAutoShutdown::NewL();
+    iAutoShutdownTimer->Start();
+    
+    __TRACE(KVerbose, (_L( "CTestEngineServer::ConstructL: Server Created" ) ) );
+    }
+
+void CTestEngineServer::InitLoggerSettings()
+    {
+    // Initializations to indicator is setting in use
+    iLoggerSettings.iIsDefined.iCreateLogDir = EFalse;
+    iLoggerSettings.iIsDefined.iPath = EFalse;
+    iLoggerSettings.iIsDefined.iHwPath = EFalse;
+    iLoggerSettings.iIsDefined.iFormat = EFalse;
+    iLoggerSettings.iIsDefined.iHwFormat = EFalse;
+    iLoggerSettings.iIsDefined.iOutput = EFalse;
+    iLoggerSettings.iIsDefined.iHwOutput = EFalse;
+    iLoggerSettings.iIsDefined.iOverwrite = EFalse;
+    iLoggerSettings.iIsDefined.iLineBreak = EFalse;
+    iLoggerSettings.iIsDefined.iTimeStamp = EFalse;
+    iLoggerSettings.iIsDefined.iEventRanking = EFalse;
+    iLoggerSettings.iIsDefined.iThreadId = EFalse;    
+    }
+
+void CTestEngineServer::InitLoggerL()
+    {
+    // Create logger, in Wins use HTML in HW default logger
+    TLoggerSettings loggerSettings;
+
+    // Directory must create by hand if test engine log wanted
+    loggerSettings.iCreateLogDirectories = EFalse;
+
+    loggerSettings.iOverwrite = ETrue;
+    loggerSettings.iTimeStamp = ETrue;
+    loggerSettings.iLineBreak = ETrue;
+    loggerSettings.iEventRanking = EFalse;
+    loggerSettings.iThreadId = EFalse;
+    loggerSettings.iHardwareFormat = CStifLogger::ETxt;
+#ifndef FORCE_STIF_INTERNAL_LOGGING_TO_RDEBUG
+    loggerSettings.iEmulatorFormat = CStifLogger::EHtml;
+    loggerSettings.iEmulatorOutput = CStifLogger::EFile;
+    loggerSettings.iHardwareOutput = CStifLogger::EFile;
+#else
+    RDebug::Print( _L( "STIF Test Engine logging forced to RDebug" ) );
+    loggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+    loggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
+    loggerSettings.iHardwareOutput = CStifLogger::ERDebug;
+#endif
+    loggerSettings.iUnicode = EFalse;
+    loggerSettings.iAddTestCaseTitle = EFalse;
+
+    iLogger = CStifLogger::NewL( _L( "C:\\logs\\testframework\\testengine\\"),
+                                    _L( "testengine" ),
+                                    loggerSettings );    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CTestEngineServer* : pointer to CTestEngineServer object
+
+    Errors/Exceptions: Leaves if construction of CBufferArray fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEngineServer* CTestEngineServer::NewL()
+    {
+    CTestEngineServer* self = new ( ELeave ) CTestEngineServer();
+    CleanupStack::PushL( self );      
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: ~CTestEngineServer
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestEngineServer::~CTestEngineServer()
+    {
+    delete iAutoShutdownTimer;
+    
+    delete iContainerIndex; 
+
+    __TRACE(KAlways, ( _L( "---------------- Log Ended ----------------" ) ) );
+    delete iLogger;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: NewContainerL
+
+    Description: Create new container
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called CreateL method leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CObjectCon* CTestEngineServer::NewContainerL()
+    {
+    CObjectCon* container = iContainerIndex->CreateL();
+    
+    if ( iSessionCount == 0 )
+        {
+        iAutoShutdownTimer->Cancel();
+        }
+    iSessionCount++;
+
+    return container;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: DeleteContainer
+
+    Description: Deletes a container
+
+    Parameters: CObjectCon* 
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngineServer::DeleteContainer( CObjectCon* aContainer )
+    {
+    iContainerIndex->Remove( aContainer );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: SessionClosed
+
+    Description: Inform Server that session is closed.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngineServer::SessionClosed()
+    {
+    // Decrease session count
+    iSessionCount--;
+
+    // Check if last session is closed
+    if ( iSessionCount <= 0 )
+        {
+        // Stop the active scheduler
+        // Execution will continue in ThreadFunction()
+        iAutoShutdownTimer->Start();
+        
+        RSettingServer settingServer;
+        TRAPD( ret, settingServer.Connect() );
+        if ( ret == KErrNone )
+            {
+            settingServer.ResetLoggerSettings();
+            settingServer.Close();
+            }
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: NewSessionL
+
+    Description: Create a new client session for this server.
+
+    Parameters: const TVersion& aVersion: in: Client side version number
+
+    Return Values: CSharableSession* : pointer to CSharableSession object
+
+    Errors/Exceptions: Leaves if given version is incorrect
+                       Leaves if CTestEngine::NewL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSession2* CTestEngineServer::NewSessionL( const TVersion &aVersion,
+                                         const RMessage2& /*aMessage*/ ) const
+    {
+    // Check that version is ok
+    TVersion v( KTestEngineMajorVersionNumber,
+                KTestEngineMinorVersionNumber,
+                KTestEngineBuildVersionNumber );
+    if ( !User::QueryVersionSupported( v, aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    return CTestEngine::NewL( ( CTestEngineServer* ) this );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: PanicServer
+
+    Description: Panic the server
+
+    Parameters: TTestEnginePanic aPanic: in: Panic number
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestEngineServer::PanicServer( TTestEnginePanic aPanic )
+    {
+    _LIT( KTestServer, "CTestEngineServer" );
+    User::Panic( KTestServer, aPanic );
+
+    }
+
+void CTestEngineServer::SetLoggerSettings( const TLoggerSettings& aLoggerSettings )
+    {
+    iLoggerSettings = aLoggerSettings;
+    }
+
+const TLoggerSettings& CTestEngineServer::GetLoggerSettings() const
+    {
+    return iLoggerSettings;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServer
+
+    Method: Logger
+
+    Description: Return the pointer to iLogger.
+
+    Parameters: None
+
+    Return Values: CStifLogger*: Pointer to StifLogger
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CStifLogger* CTestEngineServer::Logger()
+    {
+    return iLogger;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServerAutoShutdown
+
+    Method: NewL
+
+    Description: NewL is two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CTestEngineServerAutoShutdown*: Pointer to new CTestEngineServerAutoShutdown object
+
+    Errors/Exceptions: None
+-------------------------------------------------------------------------------
+*/
+CTestEngineServerAutoShutdown* CTestEngineServerAutoShutdown::NewL()
+    {
+    CTestEngineServerAutoShutdown* self = new(ELeave)CTestEngineServerAutoShutdown;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServerAutoShutdown
+
+    Method: CTestEngineServerAutoShutdown
+
+    Description: Default constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+-------------------------------------------------------------------------------
+*/
+CTestEngineServerAutoShutdown::CTestEngineServerAutoShutdown()
+:CTimer(-1)
+    {
+    CActiveScheduler::Add( this );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServerAutoShutdown
+
+    Method: ConstructL
+
+    Description: Second phase of two-pahes constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+-------------------------------------------------------------------------------
+*/
+void CTestEngineServerAutoShutdown::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServerAutoShutdown
+
+    Method: Start
+
+    Description: Starts timer countdown.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+-------------------------------------------------------------------------------
+*/
+void CTestEngineServerAutoShutdown::Start()
+    {
+    After( KTestEngineServerShutdownDelay );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestEngineServerAutoShutdown
+
+    Method: RunL
+
+    Description: Stops active scheduler.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+-------------------------------------------------------------------------------
+*/
+void CTestEngineServerAutoShutdown::RunL()
+    {
+    RDebug::Print( _L("TestEngine server shutdown") );
+    CActiveScheduler::Stop();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Function: RunTestEngineServerL
+
+    Description: Creates and starts TestEngine server
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+-------------------------------------------------------------------------------
+*/
+static void RunTestEngineServerL()
+    {
+    User::LeaveIfError( RThread::RenameMe( KTestEngineServerName ) );
+
+    CActiveScheduler* activeScheduler = new(ELeave) CActiveScheduler;
+    CleanupStack::PushL( activeScheduler );
+    CActiveScheduler::Install( activeScheduler );
+
+    // create the server (leave it on the cleanup stack)
+    CTestEngineServer* testEngineServer = CTestEngineServer::NewL();
+    CleanupStack::PushL( testEngineServer );
+
+    testEngineServer->StartL( KTestEngineServerName );
+    
+    // Initialisation complete, now signal the client
+    RProcess::Rendezvous( KErrNone );
+
+    // Ready to run
+    CActiveScheduler::Start();
+
+    // Cleanup the server and scheduler
+    CleanupStack::PopAndDestroy( testEngineServer );    
+    CleanupStack::PopAndDestroy( activeScheduler );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Function: E32Main
+
+    Description: TestEngine process main function
+
+    Parameters: None
+
+    Return Values: TInt: Process exit code.
+
+    Errors/Exceptions: None
+-------------------------------------------------------------------------------
+*/
+TInt E32Main()
+    {
+    __UHEAP_MARK;
+    RDebug::Print( _L("TestEngine server start") );
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    TInt ret = KErrNoMemory;
+    if ( cleanup )
+        {
+        TRAP( ret, RunTestEngineServerL() );
+        delete cleanup;
+        }
+    RDebug::Print( _L("TestEngine server closed") );
+    __UHEAP_MARKEND;
+    return ret;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/TestEngineUtils.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,318 @@
+/*
+* Copyright (c) 2010 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: 
+*
+*/
+#include "TestEngineUtils.h"
+#include "Logging.h"
+#include <StifLogger.h>
+#include <StifParser.h>
+#include "STIFTestFrameworkSettings.h"
+
+#define LOGGER aLogger
+
+TInt TTestEngineUtils::ParseLoggerDefaults( CStifParser* aParser, TLoggerSettings& aLoggerSettings, CStifLogger* aLogger )
+    {
+    __TRACE( KInit,( _L( "" ) ) );
+    __TRACE( KInit,( _L( "CLoggerSetting::ReadLoggerDefaults" ) ) );
+    __TRACE( KInit,( _L( "Start reading and parsing Logger defaults" ) ) );
+
+    TInt ret = KErrNone;
+
+    CSTIFTestFrameworkSettings* settings = NULL;
+    TRAPD( settings_ret, settings = CSTIFTestFrameworkSettings::NewL() );
+    if ( settings_ret != KErrNone )
+        {
+        __TRACE( KError,( CStifLogger::ERed, _L( "CSTIFTestFrameworkSettings class object creation fails") ) );
+        return settings_ret;
+        }
+
+    TInt get_ret( KErrNone );
+
+    CStifSectionParser* sectionParser = NULL;
+    // Parse Logger's overwrite values
+    _LIT( KDefaultsStart, "[Logger_Defaults]" );
+    _LIT( KDefaultsEnd, "[End_Logger_Defaults]" );
+    __TRACE( KInit,( _L( "Starting to search sections" ) ) );
+    
+    TRAPD( r,
+        sectionParser = aParser->SectionL( KDefaultsStart, KDefaultsEnd );
+        );
+    // Get directory settings
+    if ( ( r == KErrNone ) && sectionParser )
+        {
+        __TRACE( KInit,( _L( "Found '%S' and '%S' sections" ), &KDefaultsStart, &KDefaultsEnd ) );
+
+        __TRACE( KInit,( _L( "Parsing Logger directory indicator" ) ) );
+        TBool createDir( EFalse );
+        TRAP( get_ret,
+            get_ret = settings->GetBooleanSettingsL( sectionParser,
+                                _L( "CreateLogDirectories=" ), createDir );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Logger directory indicator: %d"), createDir ) );
+            aLoggerSettings.iCreateLogDirectories = createDir;
+            aLoggerSettings.iIsDefined.iCreateLogDir = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Indicator not found or not given" ) ) );
+            }
+
+        // Get Logger path settings
+        __TRACE( KInit,( _L( "Parsing Logger path setting (Emulator)" ) ) );
+        TPtrC emulatorPath;
+        get_ret = settings->GetFileSetting( sectionParser,
+                                               _L( "EmulatorBasePath=" ),
+                                               emulatorPath );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Logger base path setting: %S"), &emulatorPath ) );
+            aLoggerSettings.iEmulatorPath = emulatorPath;
+            aLoggerSettings.iIsDefined.iPath = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Path not found or not given (Emulator)" ) ) );
+            }
+
+        // Get Logger format settings
+        __TRACE( KInit,( _L( "Parsing Logger file type setting (Emulator)" ) ) );
+        CStifLogger::TLoggerType emulatorType = CStifLogger::ETxt;
+        TRAP( get_ret, 
+            get_ret = settings->GetFormatL( sectionParser,
+                                    _L( "EmulatorFormat=" ), emulatorType );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "File type setting: %d"), emulatorType ) );
+            aLoggerSettings.iEmulatorFormat = emulatorType;
+            aLoggerSettings.iIsDefined.iFormat = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "File type not found or not given (Emulator)" ) ) );
+            }
+
+        // Get Logger output settings
+        __TRACE( KInit,( _L( "Parsing Logger output setting (Emulator)" ) ) );
+        CStifLogger::TOutput emulatorOutput = CStifLogger::EFile;
+        TRAP( get_ret,
+            get_ret = settings->GetOutputL( sectionParser,
+                                    _L( "EmulatorOutput=" ), emulatorOutput );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Output setting: %d"), emulatorOutput ) );
+            aLoggerSettings.iEmulatorOutput = emulatorOutput;
+            aLoggerSettings.iIsDefined.iOutput = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Output not found or not given (Emulator)" ) ) );
+            }
+
+        // Get Logger HW path settings
+        __TRACE( KInit,( _L( "Parsing Logger path setting (Hardware)" ) ) );
+        TPtrC hwPath;
+        get_ret = settings->GetFileSetting( sectionParser,
+                                               _L( "HardwareBasePath=" ),
+                                               hwPath );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Base path setting: %S"), &hwPath ) );
+            aLoggerSettings.iHardwarePath = hwPath;
+            aLoggerSettings.iIsDefined.iHwPath = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Path not found or not given (Hardware)" ) ) );
+            }
+
+        // Get Logger HW format settings
+        __TRACE( KInit,( _L( "Parsing Logger file type setting (Hardware)" ) ) );
+        CStifLogger::TLoggerType hwType = CStifLogger::ETxt;
+        TRAP( get_ret,
+            get_ret = settings->GetFormatL( sectionParser,
+                                        _L( "HardwareFormat=" ), hwType );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "File type setting: %d"), hwType ) );
+            aLoggerSettings.iHardwareFormat = hwType;
+            aLoggerSettings.iIsDefined.iHwFormat = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "File type not found or not given (Hardware)" ) ) );
+            }
+
+        // Get Logger HW output settings
+        __TRACE( KInit,( _L( "Parsing Logger output setting (Hardware)" ) ) );
+        CStifLogger::TOutput hwOutput = CStifLogger::EFile;
+        TRAP( get_ret, 
+        get_ret = settings->GetOutputL( sectionParser,
+                                    _L( "HardwareOutput=" ), hwOutput );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Output setting: %d"), hwOutput ) );
+            aLoggerSettings.iHardwareOutput = hwOutput;
+            aLoggerSettings.iIsDefined.iHwOutput = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Output not found or not given (Hardware)" ) ) );
+            }
+
+        // Get Logger file creation mode (overwrite settings)
+        __TRACE( KInit,( _L( "Parsing file creation setting" ) ) );
+        TBool overwrite( ETrue );
+        TRAP( get_ret,
+            get_ret = settings->GetOverwriteL( sectionParser,
+                                _L( "FileCreationMode=" ), overwrite );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "File creation mode setting: %d"), overwrite ) );
+            aLoggerSettings.iOverwrite = overwrite;
+            aLoggerSettings.iIsDefined.iOverwrite = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "File creation not found or not given" ) ) );
+            }
+
+        // Get Time stamp settings
+        __TRACE( KInit,( _L( "Parsing time stamp setting" ) ) );
+        TBool timeStamp( ETrue );
+        TRAP( get_ret,
+            get_ret = settings->GetBooleanSettingsL( sectionParser,
+                                _L( "WithTimeStamp=" ), timeStamp );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Time stamp setting: %d"), timeStamp ) );
+            aLoggerSettings.iTimeStamp = timeStamp;
+            aLoggerSettings.iIsDefined.iTimeStamp = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Time stamp not found or not given" ) ) );
+            }
+
+        // Get Test report line break settings
+        __TRACE( KInit,( _L( "Parsing line break setting" ) ) );
+        TBool lineBreak( ETrue );
+        TRAP( get_ret,
+            get_ret = settings->GetBooleanSettingsL( sectionParser,
+                                _L( "WithLineBreak=" ), lineBreak );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Line break setting: %d"), lineBreak ) );
+            aLoggerSettings.iLineBreak = lineBreak;
+            aLoggerSettings.iIsDefined.iLineBreak = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Line break not found or not given" ) ) );
+            }
+
+        // Get Test report event ranking settings
+        __TRACE( KInit,( _L( "Parsing event ranking setting" ) ) );
+        TBool eventRanking( EFalse );
+        TRAP( get_ret,
+            get_ret = settings->GetBooleanSettingsL( sectionParser,
+                            _L( "WithEventRanking=" ), eventRanking );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Event ranking setting: %d"), eventRanking ) );
+            aLoggerSettings.iEventRanking = eventRanking;
+            aLoggerSettings.iIsDefined.iEventRanking = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Event ranking not found or not given" ) ) );
+            }
+
+        // Get Test report thread id settings
+        __TRACE( KInit,( _L( "Parsing thread id setting" ) ) );
+        TBool threadId( EFalse );
+        TRAP( get_ret,
+            get_ret = settings->GetBooleanSettingsL( sectionParser,
+                                    _L( "ThreadIdToLogFile=" ), threadId );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Thread id setting: %d"), threadId ) );
+            aLoggerSettings.iThreadId = threadId;
+            aLoggerSettings.iIsDefined.iThreadId = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Thread id not found or not given" ) ) );
+            }
+        // Get unicode setting
+        __TRACE( KInit,( _L( "Parsing unicode setting" ) ) );
+        TBool unicode(EFalse);
+        TRAP( get_ret,
+            get_ret = settings->GetBooleanSettingsL( sectionParser,
+                                    _L( "FileUnicode=" ), unicode );
+            );
+        if ( get_ret == KErrNone )
+            {
+            __TRACE( KInit,( _L( "Unicode setting: %d"), unicode ) );
+            aLoggerSettings.iUnicode = unicode;
+            aLoggerSettings.iIsDefined.iUnicode = ETrue;
+            }
+        else
+            {
+            __TRACE( KInit,( _L( "Unicode setting not found or not given" ) ) );
+            }
+
+        // Check if test case title should be added to log file name
+        __TRACE( KInit,( _L( "Parsing AddTestCaseTitle setting" ) ) );
+        TBool addTestCaseTitle(EFalse);
+        TRAP(get_ret,
+            get_ret = settings->GetBooleanSettingsL(sectionParser,
+                                    _L( "AddTestCaseTitle=" ), addTestCaseTitle);
+            );
+        if(get_ret == KErrNone)
+            {
+            __TRACE( KInit,( _L( "AddTestCaseTitle setting: %d"), addTestCaseTitle));
+            aLoggerSettings.iAddTestCaseTitle = addTestCaseTitle;
+            aLoggerSettings.iIsDefined.iAddTestCaseTitle = ETrue;
+            }
+        else
+            {
+            __TRACE(KInit, (_L("AddTestCaseTitle setting not found or not given")));
+            }
+        }
+    else
+        {
+        __TRACE( KInit,( _L( "Not found '%S' and '%S' sections" ), &KDefaultsStart, &KDefaultsEnd ) );
+        ret = KErrNotFound;
+        }
+    __TRACE( KInit,( _L( "End reading and parsing Logger defaults" ) ) );
+    __TRACE( KInit,( _L( "" ) ) );
+    delete sectionParser;
+    delete settings;
+
+    return ret;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/TestModuleController.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3108 @@
+/*
+* 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: This module contains implementation of 
+* CTestModuleController class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <stifinternal/TestServerClient.h>
+#include <StifLogger.h>
+#include "TestEngine.h"
+#include "TestModuleController.h"
+#include "Logging.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 =======================================
+// None
+
+#define LOGGER iEngine->Logger()
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: CTestModuleController
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleController::CTestModuleController( CTestEngine* aEngine ) :
+    CActive( CActive::EPriorityStandard ),
+    iEngine( aEngine ),
+    iState( ETestModuleIdle )
+    {
+    CActiveScheduler::Add( this );
+    iTestScripterController = NULL;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: const TName& aName: in: Test module name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation for iConfigFiles fails
+                       Leaves if memory allocation for iTestCaseArray fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::ConstructL( 
+                            const TName& aName,
+                            TBool aAfterReboot,
+                            CTestScripterController* aTestScripterController )
+    {
+    iTestScripterController = aTestScripterController;
+    iTestScripterIndicator = 0;
+    
+    iAfterReboot = aAfterReboot;
+
+    __TRACE ( KInit, ( _L( "Creating CTestModuleController [%S]" ), &aName ) );
+
+    iTestCaseArray = RPointerArray<TTestCaseArray>();
+
+    // Check aName length
+    if( aName.Length() <= 0 )
+        {
+        iEngine->LeaveWithNotifyL( KErrArgument );
+        }
+
+    // Remove optional '.DLL' from file name
+    TName name = aName;
+    name.LowerCase();
+    TParse parse;
+    parse.Set( name, NULL, NULL );
+
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        name.Delete ( name.Length()-len, len );
+        }
+
+    iName = name.AllocL();
+
+    // HBufC to TPtrC
+    TPtrC atsName;
+
+    TFileName newNameBuffer;
+    TInt check = GenerateModuleName( iName->Des(), newNameBuffer );
+    if( check == KErrNone )
+        {
+        // Load the module(TestScripter)
+        atsName.Set( newNameBuffer );
+        }
+    else
+        {
+        // Load the module(Others)
+        atsName.Set( iName->Des() );
+        }
+
+    // Moved the implementation to a new function, ConstructASTLoggerL, due to
+    // CW 3.0 compiler error with multiple TRAPDs
+    TRAPD(err, ConstructASTLoggerL( atsName, aAfterReboot));
+
+    if( err != KErrNone )
+        {
+         __TRACE ( KError, ( _L( "CTestModuleController[%S]::ConstructL: Creation of ATS logger failed" ), iName ) );
+        iEngine->LeaveWithNotifyL( err, _L("Creation of ATS logger failed") );
+        }
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: ConstructASTLoggerL
+
+    Description: Construct ATS logger
+
+    Parameters: TDesC& atsName, TBool& aAfterReboot
+
+    Return Values: TInt
+
+    Errors/Exceptions: Leaves if error got from ATS logger NewL
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+
+TInt CTestModuleController::ConstructASTLoggerL( TDesC& atsName, TBool& aAfterReboot )
+    {
+    TRAPD( err, iAtsLogger = CAtsLogger::NewL( atsName, aAfterReboot ); );
+    if( err == KErrNotFound && aAfterReboot )
+        {
+        // If file does not exist, create new 
+        aAfterReboot = EFalse;
+        iAtsLogger = CAtsLogger::NewL( atsName, aAfterReboot );
+        }
+    User::LeaveIfError( err );
+    iAtsLogger->SetFullReporting( ETrue );
+    if( aAfterReboot )
+        {
+        iAtsLogger->ContinueAfterRebootL();
+        }
+    else
+        {
+        // Begin reporting
+        iAtsLogger->BeginTestReportL();
+          
+        // Begin test set
+        iAtsLogger->BeginTestSetL();
+        }
+    return KErrNone;
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: InitL
+
+    Description: Initialize test module.
+
+    Parameters: TFileName& aIniFile: in: Initialization file of Test Module
+                const TDesC& aConfigFile: in: Test case(config) file name(Used 
+                in TestScripter case).
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if error got from Test Server
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::InitL( TFileName& aIniFile, 
+                                    const TDesC& aConfigFile )
+    {
+    __TRACE( KInit, (_L( "Initialising test module [%S] with initialization file [%S]" ),
+        iName, &aIniFile ) );
+
+    // HBufC to TPtrC
+    TPtrC name( iName->Des() );
+
+    // Connect to server
+    TInt r = iServer.Connect( name, aConfigFile );
+
+    if ( r != KErrNone )
+        {
+        __TRACE( KError, ( CStifLogger::ERed, _L( "Can't connect to test module [%S], IniFile [%S]" ), &name, &aIniFile ) );
+        LeaveWithNotifyL( r,  _L( "Can't connect to test module" ) );
+        }
+
+    TEngineSettings engineSettings;
+    engineSettings.iUITestingSupport = iEngine->UITesting();
+    engineSettings.iSeparateProcesses = iEngine->SeparateProcesses();
+    
+    iServer.PassEngineSessionSettings( engineSettings );
+    
+    // Open session 
+    r = iModule.Open( iServer, aIniFile );
+    if ( r != KErrNone )
+        {
+        __TRACE( KError, ( CStifLogger::ERed, _L( "Can't open session to test module [%S], IniFile=[%S]" ), &name, &aIniFile ) );
+        LeaveWithNotifyL( r, _L( "Can't open session to test module" ) );
+        }
+
+    iErrorPrinter = CErrorPrinter::NewL( iEngine );
+    iErrorPrinter->StartL( iModule );
+
+    iServerStateHandler = CServerStateHandler::NewL( iEngine, this );
+    iServerStateHandler->StartL( iServer );
+    __TRACE( KInit, (_L( "Initialising test module [%S] with initialization file [%S] done" ),
+        iName, &aIniFile ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: CTestEngine object.
+                const TName& aName: in: module name.
+                TBool aAfterReboot: in: reboot indicator.
+                TBool aCreateTestScripterCont: in: Indications to
+                TestModule or TestScripter creation
+                CTestScripterController* aTestScripterController: in:
+                CTestEngine object.
+
+
+    Return Values: CTestModuleController* : pointer to created object
+
+    Errors/Exceptions: Leaves if called ConstructL method leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleController* CTestModuleController::NewL( 
+                            CTestEngine* aEngine,
+                            const TName& aName,
+                            TBool aAfterReboot,
+                            TBool aCreateTestScripterCont,
+                            CTestScripterController* aTestScripterController )
+    {
+    // Create CTestScripterController
+    if( aCreateTestScripterCont )
+        {
+        CTestScripterController* testScripterController = NULL;
+        testScripterController = CTestScripterController::NewL(
+            aEngine, aName, aAfterReboot );
+        return testScripterController;  
+        }
+
+
+    CTestModuleController* self =
+        new ( ELeave ) CTestModuleController( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aAfterReboot, aTestScripterController );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: ~CTestModuleController
+
+    Description: Destructor
+
+    Deallocate all allocated resources
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleController::~CTestModuleController()
+    {
+
+    // If CTestScripterController is created there is deleted base class(
+    // CTestModuleController) also and this has no iName.
+    if( iName )
+        {
+        __TRACE(KVerbose, (_L( "Deleting CTestModuleController [%S]" ), iName ) );
+        }
+
+    Cancel();
+
+    // If CTestScripterController is created there is deleted base class(
+    // CTestModuleController) also and this has no iAtsLogger.
+    if( iAtsLogger )
+        {
+        // End test set
+        TRAPD( err, iAtsLogger->EndTestSetL() );
+        // End AtsLogger reporting, has to be trapped in destructor
+        TRAPD( err2, iAtsLogger->EndTestReportL() );
+        if( ( err != KErrNone ) || ( err2 != KErrNone ) )
+            {
+            // Print error if error got from trap
+            __TRACE( KError, ( 
+                _L( "Destructor of CTestModuleController [%S]: XML log closing failed" ),
+                iName ) );
+            }
+        }
+
+    // Delete Atslogger
+    delete iAtsLogger;
+
+    // Stop error printer
+    delete iErrorPrinter;
+    iErrorPrinter = NULL;
+    // Delete server state handler
+    delete iServerStateHandler;
+    iServerStateHandler = NULL;
+
+    // Close RTestModule session
+    iModule.Close();
+    // Close RTestServer session
+    iServer.Close();
+
+    // Release the test case array
+    iTestCaseArray.Close();
+
+    // Release the config file array
+    iConfigFiles.ResetAndDestroy();
+    iConfigFiles.Close();
+
+    // Release the config file array
+    iFailedEnumerateConfig.ResetAndDestroy();
+    iFailedEnumerateConfig.Close();
+    
+    // Release the children array
+    iChildrenControllers.ResetAndDestroy();
+    iChildrenControllers.Close();
+
+    delete iName;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: AddConfigFileL
+
+    Description: Add config file
+
+    Parameters: TFileName& aConfigFile: in: Config file for Test Module
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if AppendL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::AddConfigFileL( TFileName& aConfigFile )
+    {
+    __TRACE( KInit,
+        ( _L( "CTestModuleController::AddConfigFileL [%S] aConfigFile=[%S]" ),
+        iName, &aConfigFile ) );
+    // Check that this config file does not already exists
+    for ( TInt i = 0; i < iConfigFiles.Count(); i++ )
+        {
+        // HBufC to TPtrC
+        TPtrC name( iConfigFiles[i]->Des() );
+        if ( KErrNone == aConfigFile.CompareF( name ) )
+            {
+            LeaveWithNotifyL( KErrAlreadyExists,  
+                _L( "Adding config file failed: Config file already exists" ) );
+            }
+        }
+    HBufC* configFile = aConfigFile.AllocLC();
+
+    User::LeaveIfError( iConfigFiles.Append( configFile ) );
+    CleanupStack::Pop( configFile );
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: RemoveConfigFileL
+
+    Description: Remove config file
+
+    Parameters: TFileName& aConfigFile: in: Config file name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::RemoveConfigFileL( TFileName& aConfigFile )
+    {
+    __TRACE( KInit, ( 
+        _L( "CTestModuleController::RemoveConfigFileL [%S] aConfigFile=[%S]" ),
+        iName, &aConfigFile ) );
+    // Find config file
+    for ( TInt i = 0; i < iConfigFiles.Count(); i++ )
+        {
+        // HBufC to TPtrC
+        TPtrC name( iConfigFiles[i]->Des() );
+        if ( KErrNone == aConfigFile.CompareF( name ) )
+            {
+            HBufC* configFile = iConfigFiles[i];
+            iConfigFiles.Remove(i);
+            delete configFile;
+            // Cancel enumerate and free test cases
+            Cancel();
+            FreeTestCases();
+            return;
+            }
+        }
+        
+    LeaveWithNotifyL( KErrNotFound, 
+        _L( "Removing config file failed: Config file not found" ) );
+            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: StartEnumerateL
+
+    Description: Start test case enumeration
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::StartEnumerateL()
+    {
+    __TRACE( KVerbose, ( 
+        _L( "CTestModuleController::StartEnumerateL [%S]" ), iName ) ); 
+    iTestCaseCount = 0;
+    iEnumerateCount = 0;
+    iFailedEnumerateCount = 0;
+    iFailedEnumerateConfig.ResetAndDestroy();
+    iEnumerateComplete = EFalse;
+
+    iState = ETestModuleEnumerateCases;
+
+    if ( iConfigFiles.Count() > 0 )
+        {
+        // HBufC to TPtrC
+        iEnumConfigFile.Set( iConfigFiles[0]->Des() );
+        }
+
+    __TRACE( KInit, ( 
+        _L( "Getting testcases from module [%S], test case file [%S]" ),
+        iName, &iEnumConfigFile ) );
+
+    SetActive();
+    iModule.EnumerateTestCases( iEnumConfigFile, iEnumResultPackage, iStatus );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone
+                       Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::RunL()
+    {
+
+    // If CTestScripterController is used then move execution to the
+    // CTestScripterController size
+    if( iTestScripterController )
+        {
+        iTestScripterController->RunLEmulator( this );
+        return;
+        }
+
+    __TRACE( KVerbose, ( _L( "CTestModuleController::RunL [%S] [iStatus = %d]"),
+        iName, iStatus.Int() ) );
+
+    // Note:
+    // If test case not found there may be existing cases from previous
+    // enumerations, so those cases are valid. e.g. case: "add test case file",
+    // "add test case file that not exist" and "get test cases".
+
+    TInt ret( KErrNone );
+    // Check that request was successful
+    if( iStatus.Int() == KErrNone )
+        {
+        // Get enumerated test cases and append them to array
+        CFixedFlatArray<TTestCaseInfo>* testCases = 
+            CFixedFlatArray<TTestCaseInfo>::NewL( iEnumResultPackage() );
+        CleanupStack::PushL( testCases );
+        ret = iModule.GetTestCases( *testCases );
+        __TRACE( KInit, ( _L( "RunL()'s GetTestCases method returns: %d" ), ret ) );
+
+        iTestCaseCount += testCases->Count();
+
+        if ( testCases->Count() == 0 )
+            {
+
+            if (iConfigFiles.Count() > 0)
+                {
+                __TRACE( KInit, ( CStifLogger::EBold, 
+                    _L( "Module [%S], test case file [%S] returned 0 cases" ),
+                    iName,  iConfigFiles[iEnumerateCount] ) );
+                }
+            else
+                {
+                __TRACE( KInit, ( CStifLogger::EBold, 
+                    _L( "Module [%S] without test case file, returned 0 cases" ),
+                    iName ) );
+                }
+            iEngine->ErrorPrint( 1, _L("Someone returned 0 test cases. Check testengine log"));
+            iAtsLogger->CommentL( _L("Test module returned 0 test cases") );   
+            }
+
+        // Store test cases for later use
+        User::LeaveIfError( iTestCaseArray.Append( testCases ) );
+        CleanupStack::Pop( testCases );
+        
+        }
+    else
+        {
+        // Calculate failed enumeration count
+        iFailedEnumerateCount++;
+        // Add failed config(test case) file to array for later removing
+        if( iConfigFiles.Count() > 0 )
+            {
+            __TRACE( KError, (
+                CStifLogger::ERed, 
+                _L( "Test case[%S] enumeration fails with error: %d" ),
+                iConfigFiles[iEnumerateCount], iStatus.Int() ) );
+            // Append
+            iFailedEnumerateConfig.Append( iConfigFiles[iEnumerateCount] );
+            }
+        }
+
+    iEnumerateCount++;
+
+    if ( iEnumerateCount < iConfigFiles.Count() )
+        {
+        // Continue enumeration
+        __TRACE( KInit, ( 
+            _L( "Getting testcases from module [%S], test case file [%S]" ),
+            iName, iConfigFiles[iEnumerateCount] ) );
+        SetActive();
+        iModule.EnumerateTestCases( *iConfigFiles[iEnumerateCount],
+                                    iEnumResultPackage, iStatus );
+        }
+    else if( iTestCaseCount == 0 )
+        {
+        // Total count of succesfully enumerations
+        iEnumerateCount -= iFailedEnumerateCount;
+        User::Leave( KErrNotFound );
+        }
+    else
+        {
+        // Total count of succesfully enumerations
+        iEnumerateCount -= iFailedEnumerateCount;
+        // Remove faulty config (test case) file(s)
+        for( TInt a= 0; a < iFailedEnumerateConfig.Count(); a++ )
+            {
+            TInt index( 0 );
+            // Find removed config(test case) file
+            index = iConfigFiles.Find( iFailedEnumerateConfig[a] );
+            if( index != KErrNotFound )
+                {
+                __TRACE( KInit, ( _L( "Removing test case file[%S]" ),
+                    iConfigFiles[index] ) );
+                // Remove
+                iConfigFiles.Remove( index );
+                }
+            }
+
+        // All test cases enumerated
+        iState = ETestModuleEnumerateCasesCompleted;
+        iEnumerateComplete = ETrue;
+
+        iEngine->EnumerationCompleted( iTestCaseCount );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: TestCasesL
+
+    Description: Return Test Cases
+
+    Parameters: None
+
+    Return Values: CFixedFlatArray<TTestInfo>* :Pointer to created array
+
+    Errors/Exceptions: Leaves if NewL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CFixedFlatArray<TTestInfo>* CTestModuleController::TestCasesL()
+    {
+    CFixedFlatArray<TTestInfo>* testCases = 
+        CFixedFlatArray<TTestInfo>::NewL( iTestCaseCount );
+
+    CleanupStack::PushL( testCases );
+
+    // Loop through all test cases from all config files
+    TInt totalCount = 0;
+    // HBufC to TPtrC
+    TPtrC name( iName->Des() );
+    for ( TInt i = 0; i < iEnumerateCount; i++ )
+        {
+        TTestInfo tmpInfo;
+        tmpInfo.iModuleName = name;
+        if ( iConfigFiles.Count() > 0 )
+            {
+            tmpInfo.iConfig = *iConfigFiles[i];
+            }
+
+        // Get test cases from iTestCaseArray at [i]
+        //if( (iTestCaseArray)[i] )
+		if ( iTestCaseArray.Count() > 0) 
+            {
+            CFixedFlatArray<TTestCaseInfo>* tempTestCases = (iTestCaseArray)[i];
+            for ( TInt j = 0; j < tempTestCases->Count(); j++ )
+                {
+                tmpInfo.iTestCaseInfo = (*tempTestCases)[j];
+                // Set TestCaseInfo to testCases array
+                testCases->Set( totalCount, tmpInfo );
+                totalCount++;
+                }
+            }
+        }
+
+    CleanupStack::Pop( testCases );
+
+    return testCases;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: FreeTestCases
+
+    Description: Free memory used for test cases
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::FreeTestCases()
+    {
+    // Reset and destroy test cases
+    iTestCaseArray.ResetAndDestroy();
+    iTestCaseArray.Close();
+
+    iTestCaseCount = 0;
+    iEnumerateComplete = EFalse;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::DoCancel()
+    {
+
+    // If CTestScripterController is used then move execution to the
+    // CTestScripterController size
+    if( iTestScripterController )
+        {
+        iTestScripterController->DoCancelEmulator( this );
+        return;
+        }
+
+    __TRACE( KVerbose, ( _L( "CTestModuleController::DoCancel [%S]" ), iName ) );
+
+    switch ( iState )
+        {
+        case ETestModuleEnumerateCases:
+            iModule.CancelAsyncRequest( ETestModuleEnumerateTestCases );
+            iEnumerateComplete = ETrue;
+            // Enumeration canceled, complete with KErrCancel
+            iEngine->EnumerationCompleted( 0, KErrCancel );
+
+            // Free allocated test cases because EnumerateTestCases was
+            // canceled
+            FreeTestCases();
+            break;
+        case ETestModuleIdle:
+        case ETestModuleEnumerateCasesCompleted:
+        default:
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestModuleController, "CTestModuleController" );
+            User::Panic( KTestModuleController, EDoCancelDisorder );
+            break;
+        }
+
+    iAtsLogger->ErrorL( _L("Test case enumeration cancelled") );   
+
+    iState = ETestModuleIdle;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: RunError
+
+    Description: Handle errors.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleController::RunError( TInt aError )
+    {
+
+    // If CTestScripterController is used then move execution to the
+    // CTestScripterController size
+    if( iTestScripterController )
+        {
+        return iTestScripterController->RunErrorEmulator( aError, this );
+        }
+
+    __TRACE( KError, ( CStifLogger::ERed, 
+        _L( "CTestModuleController::RunError [%S] aError=[%d]" ),
+        iName, aError ) );
+    if( aError == KErrNoMemory )
+        {
+        __TRACE( KError, ( CStifLogger::ERed, 
+            _L( "No memory available. Test case file's size might be too big." ) ) );
+        }
+
+    iEnumerateComplete = ETrue;
+
+    iAtsLogger->ErrorL( _L("Test module did not return any test cases") );
+    
+    _LIT( KErrorText, " did not return any test cases [error: ");
+    if( KErrorText().Length() + iName->Length() + 1 < KMaxName )
+        {
+        // Enumeration failed, print warning and complete with KErrNone
+        TName error( iName->Des() );
+        error.Append( KErrorText );  
+        error.AppendNum( aError );  
+        error.Append( _L("]") );  
+        iEngine->ErrorPrint ( 0, error );
+    
+        iEngine->EnumerationCompleted( 0, KErrNone );
+        }
+    else 
+        {
+        // Cannot only print warning, complete with error
+        iEngine->EnumerationCompleted( 0, aError );
+        }        
+
+    // Free allocated test cases because EnumerateTestCases failed
+    FreeTestCases();
+    iEnumerateComplete = ETrue;
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: Server
+
+    Description: Return handle to Test Server
+
+    Parameters: TTestInfo& aTestInfo: in: Test info for this test case
+
+    Return Values: RTestServer& : Reference to RTestServer
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+RTestServer& CTestModuleController::Server( TTestInfo& /*aTestInfo*/ )
+    {
+    return iServer;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: GetFreeOrCreateModuleControllerL
+
+    Description: Return pointer to module controller.
+                 Find module controller which does not run test case
+                 and if this is not possible then create new one.
+                 (Only for test scripter).
+
+    Parameters: TTestInfo& aTestInfo: in: Test info for this test case
+                TBool aUITestingSupport: in: Is UI testing mode enabled
+
+    Return Values: CTestModuleController* : pointer to module controller
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleController* CTestModuleController::GetFreeOrCreateModuleControllerL(TTestInfo& /*aTestInfo*/, TBool /*aUItestingSupport*/)
+    {
+    return NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: ModuleName
+
+    Description: Return the name of Test Module
+
+    Parameters: const TDesC& aModuleName: in Modulename
+
+    Return Values: const TDesC : Name of Test Module
+
+    Errors/Exceptions: None
+
+    Status: proposal
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestModuleController::ModuleName( const TDesC& /*aModuleName*/ )
+    {
+    return *iName;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: EnumerationComplete
+
+    Description: Is enumeration of test cases complete.
+
+    Parameters: None
+    
+    Return Values: TBool ETrue: Enumeration of test cases is complete
+                         EFalse: Enumeration is not complete
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestModuleController::EnumerationComplete()
+    {
+    return iEnumerateComplete;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: LeaveWithNotifyL
+
+    Description: Print out info and leave.
+
+    Parameters: TInt aCode: in: Error code 
+                const TDesC& aText: in: Test info
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleController::LeaveWithNotifyL( TInt aCode, const TDesC& aText )
+    {
+
+    __TRACE( KError, ( CStifLogger::ERed, aText ) );
+    if( iAtsLogger )
+        {
+        iAtsLogger->ErrorL( aText );
+        }
+    iEngine->LeaveWithNotifyL( aCode );
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: CaseCreated
+
+    Description: Increases the value of iTestCaseCounter
+
+    Parameters: None
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/  
+void CTestModuleController::CaseCreated()
+    {
+    // Number of ongoing testcases
+    iTestCaseCounter++;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: CaseFinished
+
+    Description: Decreases the value of iTestCaseCounter and deletes this pointer
+                 only in test module crash situations (KErrServerTerminated -15)
+
+    Parameters: None:
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/  
+void CTestModuleController::CaseFinished()
+    {
+    // Number of ongoing testcases
+    iTestCaseCounter--;
+    
+    // iTestModuleCrashDetected tells is TestModuleController cloned or not
+    // TestModuleController is cloned only when testmodule is crashed with KErrServerTerminated -15
+    if (iTestCaseCounter == 0 && iTestModuleCrashDetected)
+       {
+       // Delete this in case where it has been replaced with it clone
+       // and no one have pointer to this. This happens only when test module
+       // crashes    
+  	   delete this;
+  	   // Mem::Fill(this, sizeof(CTestModuleController), 0xa1a1a1a1);
+       }
+       
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: CloneL
+
+    Description: 
+
+    Parameters: 
+    
+    Return Values: 
+    
+    Errors/Exceptions: 
+
+    Status: 
+
+-------------------------------------------------------------------------------
+*/    
+CTestModuleController* CTestModuleController::CloneL( 
+                            CTestModuleController* aTestModuleController,
+                            TBool aAfterReset,
+                            CTestScripterController* aTestScripterController )
+    {
+    __TRACE( KInit, ( _L( "Cloning CTestModuleController" ) ) );
+   
+    
+    TName crashModuleName;
+    crashModuleName = aTestModuleController->ModuleName( crashModuleName );
+    
+    CTestModuleController* clone = CTestModuleController::NewL( iEngine, crashModuleName, aAfterReset, EFalse, aTestScripterController );
+    
+    clone->InitL( aTestModuleController->iInifile, KNullDesC );
+
+	// Give ATS logger to clone
+	clone->iAtsLogger = iAtsLogger;
+	iAtsLogger = NULL; 
+	
+    for ( TInt i = 0; i < aTestModuleController->iConfigFiles.Count(); i++ )
+	    {
+		TPtrC configFile = aTestModuleController->iConfigFiles[i]->Des();
+		TFileName config = configFile;
+   	    clone->AddConfigFileL( config );
+   	    }   
+	
+	iTestModuleCrashDetected = ETrue;       
+	
+    __TRACE( KVerbose, ( _L( "Cloning of CTestModuleController finished " ) ) );
+    return clone; 
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: DeleteModuleController
+
+    Description: In that class this method does nothing. It is implemented
+                 in CTestScripterController.
+
+    Parameters: CTestModuleController* aRealModuleController: not used
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: 
+
+-------------------------------------------------------------------------------
+*/    
+void CTestModuleController::DeleteModuleController(CTestModuleController* /*aRealModuleController*/)
+    {
+    } 
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: RemoveModuleController
+
+    Description: In that class this method does nothing. It is implemented
+                 in CTestScripterController.
+
+    Parameters: CTestModuleController* aRealModuleController: not used
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: 
+
+-------------------------------------------------------------------------------
+*/    
+void CTestModuleController::RemoveModuleController(CTestModuleController* /*aRealModuleController*/)
+    {
+    } 
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleController
+
+    Method: EnumerateSynchronously
+
+    Description: Enumerates test module controller. Used only when new
+                 test module controller is created during test case
+                 execution.
+
+    Parameters: None
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: 
+
+-------------------------------------------------------------------------------
+*/    
+void CTestModuleController::EnumerateSynchronously(void)
+    {
+    TInt i;
+    TInt cfgfiles = iConfigFiles.Count();
+    __TRACE(KInit, (_L("Module controller will enumerate synchronously [%d] config files"), cfgfiles));
+    
+    for(i = 0; i < cfgfiles; i++)
+        {
+        TRequestStatus status; 
+        iModule.EnumerateTestCases(*iConfigFiles[i],
+                                   iEnumResultPackage, 
+                                   status);
+        User::WaitForRequest(status);
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestScripterController class member
+    functions.
+
+-------------------------------------------------------------------------------
+*/
+#define LOGGER iEngine->Logger()
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: CTestScripterController
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestScripterController::CTestScripterController( CTestEngine* aEngine ) :
+    CTestModuleController( aEngine )
+    {
+    // None
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: const TName& aName: in: Test module name
+                TBool aAfterReboot: in: Reboot indication
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::ConstructL( const TName& aName,
+                                          TBool aAfterReboot )
+    {
+    __TRACE( KInit, ( 
+        _L( "NOTE: Test module is TestScripter and each test case(config) file(s) will have own server(s)" ) ) );
+
+    // Remove optional '.DLL' from file name
+    TName name = aName;
+    name.LowerCase();
+    TParse parse;
+    parse.Set( name, NULL, NULL );
+
+    if ( parse.Ext() == _L(".dll") )
+        {
+        const TInt len = parse.Ext().Length();
+        name.Delete ( name.Length()-len, len );
+        }
+
+    iName = name.AllocL();
+
+    iAfterReboot = aAfterReboot;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: InitL
+
+    Description: Initialize test module.
+
+    Parameters: TFileName& aIniFile: in: Initialization file of Test Module
+                const TDesC& aConfigFile: in: Test case(config) file name(Used 
+                in TestScripter case).
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::InitL( TFileName& aIniFile, 
+                                     const TDesC& /*aConfigFile*/ )
+    {
+    // Take initialization file of Test Module
+    iInifile = aIniFile;
+
+    // Just empty, don't create TestServer operations. TestServer
+    // creation will be do in AddTestCaseFile()-method.
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestEngine* aEngine: in: CTestEngine object
+                const TName& aName: in: Test module name
+                TBool aAfterReboot: in: Reboot indication
+
+    Return Values: CTestScripterController* : pointer to created object
+
+    Errors/Exceptions: Leaves if called ConstructL method leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestScripterController* CTestScripterController::NewL( CTestEngine* aEngine,
+                                                        const TName& aName,
+                                                        TBool aAfterReboot )
+    {
+    CTestScripterController* self =
+        new ( ELeave ) CTestScripterController( aEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aAfterReboot );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: ~CTestScripterController
+
+    Description: Destructor
+
+    Deallocate all allocated resources. Delete CTestScripterController's
+    CTestModuleController(s). After this is deleted base class also, see:
+    CTestModuleController::~CTestModuleController(). 
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestScripterController::~CTestScripterController()
+    {
+    // Delete CTestScripterController(s).
+    iTestScripter.ResetAndDestroy();
+    iTestScripter.Close();
+
+    // After this is deleted base class also, see:
+    // CTestModuleController::~CTestModuleController(). 
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: AddConfigFileL
+
+    Description: Add config file.
+                 - Creates CTestModuleController(Gives test case file name)
+                 - Initializes CTestModuleController( creates a server session)
+                 - Adds config file
+
+    Parameters: TFileName& aConfigFile: in: Config file for TestScripter
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if AppendL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::AddConfigFileL( TFileName& aConfigFile )
+    {
+    // Check that this config file does not already exists
+    for(  TInt a = 0; a < iTestScripter.Count(); a++ )
+        {
+        for ( TInt i = 0; i < iTestScripter[a]->iConfigFiles.Count(); i++ )
+            {
+            // HBufC to TPtrC
+            TPtrC name( iTestScripter[a]->iConfigFiles[i]->Des() );
+            if ( KErrNone == aConfigFile.CompareF( name ) )
+                {
+                LeaveWithNotifyL( KErrAlreadyExists,  
+                    _L( "Adding config file failed: Config file already exists" ) );
+                }
+            }
+        }
+
+    __TRACE( KInit, ( 
+        _L( "CTestScripterController::AddConfigFileL aConfigFile=[%S]" ) ,
+        &aConfigFile ) );
+
+    HBufC* testScripterAndTestCaseFile = NULL; // InitL() takes TFileName
+    testScripterAndTestCaseFile = CreateTestScripterNameL( 
+                                            aConfigFile,
+                                            testScripterAndTestCaseFile );
+    // Add to cleanup stack here, because CreateTestScripterNameL needs to be
+    // trapped in other methods.
+    CleanupStack::PushL( testScripterAndTestCaseFile );
+
+    //Create server and active object(This uses CTestModuleController::InitL())
+    CTestModuleController* module = CTestModuleController::NewL( 
+                                        iEngine,
+                                        testScripterAndTestCaseFile->Des(),
+                                        iAfterReboot, EFalse, this );
+    CleanupStack::PopAndDestroy( testScripterAndTestCaseFile );
+    CleanupStack::PushL( module );
+
+    User::LeaveIfError( iTestScripter.Append( module ) );
+
+    // Now is used TestScripter so give test case file also(used
+    // in caps modifier cases). 
+    TRAPD ( err, module->InitL( iInifile, aConfigFile ) );
+    if( err != KErrNone )
+        {
+        __TRACE( KInit, ( _L( "InitL fails with error: %d" ), err ) );
+        User::Leave( err );
+        }
+
+    module->AddConfigFileL( aConfigFile );
+
+    CleanupStack::Pop( module );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: RemoveConfigFileL
+
+    Description: Remove config file
+
+    Parameters: TFileName& aConfigFile: in: Config file name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::RemoveConfigFileL( TFileName& aConfigFile )
+    {
+     __TRACE( KInit, ( _L( "CTestScripterController::RemoveConfigFileL" ) ) );
+
+    HBufC* testScripterAndTestCaseFile = NULL;
+    testScripterAndTestCaseFile = CreateTestScripterNameL( aConfigFile,
+                                         testScripterAndTestCaseFile );
+    // Add to cleanup stack here, because CreateTestScripterNameL needs to be
+    // trapped in other methods.
+    CleanupStack::PushL( testScripterAndTestCaseFile );
+
+    // Get correct iTestScripter
+    TInt index( -1 );
+    for( TInt a = 0; a < iTestScripter.Count(); a++ )
+        {
+        if( ( iTestScripter[a]->iName->CompareF( 
+                        testScripterAndTestCaseFile->Des() ) == KErrNone ) )
+            {
+            index = a;
+            break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( testScripterAndTestCaseFile );
+
+    if( index == -1 )
+        {
+        LeaveWithNotifyL( KErrNotFound, 
+            _L( "Removing config file failed: Config file not found" ) );
+        }
+
+    __TRACE( KInit, ( 
+        _L( "CTestScripterController[%S]::RemoveConfigFileL aConfigFile=[%S]"),
+        iTestScripter[index]->iName, &aConfigFile ) );
+
+    // Find config file
+    for ( TInt i = 0; i < iTestScripter[index]->iConfigFiles.Count(); i++ )
+        {
+        // HBufC to TPtrC
+        TPtrC name( iTestScripter[index]->iConfigFiles[i]->Des() );
+        if ( KErrNone == aConfigFile.CompareF( name ) )
+            {
+            HBufC* configFile = iTestScripter[index]->iConfigFiles[i];
+            iTestScripter[index]->iConfigFiles.Remove(i);
+            delete configFile;
+            // Cancel enumerate and free test cases
+            Cancel();
+            FreeTestCases();
+            // Testcasefile(config) is found, so we can return
+            return;
+            }
+        }
+
+    LeaveWithNotifyL( KErrNotFound, 
+        _L( "Removing config file failed: Config file not found" ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: StartEnumerateL
+
+    Description: Start test case enumeration
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: LeaveWithNotifyL if no test case added. 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::StartEnumerateL()
+    {
+    if( iTestScripter.Count() <= 0 )
+        {
+        RDebug::Print( 
+            _L( "There is no test case file for TestScripter registered yet. Enumeraton aborted." ) );
+        LeaveWithNotifyL( KErrNotFound,
+            _L( "There is no test case file for TestScripter registered yet. Enumeraton aborted." ) );
+        return;
+        }
+
+    for( TInt a = 0; a < iTestScripter.Count(); a++ )
+        {
+        __TRACE( KVerbose, ( 
+                _L( "CTestScripterController[%S]::StartEnumerateL" ),
+                iTestScripter[a]->iName ) );
+        iTestScripter[a]->iTestCaseCount = 0;
+        iTestScripter[a]->iEnumerateCount = 0;
+        iTestScripter[a]->iFailedEnumerateCount = 0;
+        iTestScripter[a]->iFailedEnumerateConfig.ResetAndDestroy();
+        iTestScripter[a]->iEnumerateComplete = EFalse;
+
+        iTestScripter[a]->iState = ETestModuleEnumerateCases;
+        
+        if ( iTestScripter[a]->iConfigFiles.Count() > 0 )
+            {
+            // HBufC to TPtrC
+            iTestScripter[a]->iEnumConfigFile.Set( 
+                                iTestScripter[a]->iConfigFiles[0]->Des() );
+            }
+
+        __TRACE( KInit, ( 
+            _L( "Getting testcases from module [%S], test case file[%S]" ),
+            iTestScripter[a]->iName, &iTestScripter[a]->iEnumConfigFile ) );
+        
+        iTestScripter[a]->SetActive();
+        iTestScripter[a]->iModule.EnumerateTestCases( 
+                                    iTestScripter[a]->iEnumConfigFile,
+                                    iTestScripter[a]->iEnumResultPackage,
+                                    iTestScripter[a]->iStatus );
+        } // End of for-loop
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: GetCurrentIndex
+
+    Description: Get current CTestScripterController.
+
+    Parameters: CTestModuleController* aTestModuleController: in:
+                Pointer current to CTestModuleController
+
+    Return Values: KErrNotFound returned if CTestModuleController not found
+                   else current index returned.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestScripterController::GetCurrentIndex( CTestModuleController*
+                                                    aTestModuleController )
+    {
+    // Get correct iTestScripter
+    return iTestScripter.Find( aTestModuleController );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::RunL()
+    {
+    // Should never come here because one TestScripter have one test case
+    // file per server session.
+    // CTestScripterController's base class is an active object but this class
+    // not used as an active object. So there not used RunL => Panic.
+
+    User::Panic( _L( "CTestScripterController::RunL()" ), KErrCorrupt );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: RunLEmulator
+
+    Description: RunLEmulator handles completed requests(Emulates RunL()).
+                 This is called from CTestModuleController::RunL.
+
+    Parameters: CTestModuleController* aTestModuleController: in: pointer to
+                CTestModuleController.
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::RunLEmulator( CTestModuleController*
+                                                    aTestModuleController )
+    {
+    iTestScripterIndicator++;
+    TInt index = GetCurrentIndex( aTestModuleController );
+    if( index < KErrNone )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    __TRACE( KVerbose, ( 
+        _L( "CTestScripterController[%S]::RunLEmulator [iStatus = %d]"),
+        iTestScripter[index]->iName, iTestScripter[index]->iStatus.Int() ) );
+
+    // Note:
+    // If test case not found there may be existing cases from previous
+    // enumerations, so those cases are valid. e.g. case: "add test case file",
+    // "add test case file that not exist" and "get test cases".
+
+    TInt ret( KErrNone );
+
+    // Check that request was successful
+    if( iTestScripter[index]->iStatus.Int() == KErrNone )
+        {
+        // Get enumerated test cases and append them to array
+        CFixedFlatArray<TTestCaseInfo>* testCases = 
+                        CFixedFlatArray<TTestCaseInfo>::NewL( 
+                        iTestScripter[index]->iEnumResultPackage() );
+        CleanupStack::PushL( testCases );
+        ret = iTestScripter[index]->iModule.GetTestCases( *testCases );
+        __TRACE( KInit, ( 
+                _L( "RunL()'s GetTestCases method returns: %d" ), ret ) );
+
+        iTestScripter[index]->iTestCaseCount += testCases->Count();
+
+        if ( testCases->Count() == 0 )
+            {
+
+            if (iTestScripter[index]->iConfigFiles.Count() > 0)
+                {
+                __TRACE( KInit, ( 
+                    CStifLogger::EBold, 
+                    _L( "Module [%S], test case file[%S] returned 0 cases" ),
+                    iTestScripter[index]->iName,
+                    iTestScripter[index]->iConfigFiles[iTestScripter[index]->iEnumerateCount] ) );
+                }
+            else
+                {
+                __TRACE( KInit, ( CStifLogger::EBold,
+                    _L("Module [%S] without test case file, returned 0 cases"),
+                    iTestScripter[index]->iName ) );
+                }
+            iTestScripter[index]->iEngine->ErrorPrint( 1,
+                _L("Someone returned 0 test cases. Check testengine log"));
+            iTestScripter[index]->iAtsLogger->CommentL( 
+                _L("Test module returned 0 test cases") );   
+            }
+
+        // Store test cases for later use
+        User::LeaveIfError( iTestScripter[index]->iTestCaseArray.Append( 
+                                                                testCases ) );
+        CleanupStack::Pop( testCases );
+        
+        }
+    else
+        {
+        // Calculate failed enumeration count
+        iTestScripter[index]->iFailedEnumerateCount++;
+        // Add failed config(test case) file to array for later removing
+        if( iTestScripter[index]->iConfigFiles.Count() != NULL )
+            {
+            __TRACE( KError, (
+                CStifLogger::ERed, 
+                _L( "Test case[%S] enumeration fails with error: %d" ),
+                iTestScripter[index]->iConfigFiles[iTestScripter[index]->iEnumerateCount],
+                iTestScripter[index]->iStatus.Int() ) );
+            // Append
+            iTestScripter[index]->iFailedEnumerateConfig.Append(
+                iTestScripter[index]->iConfigFiles[iTestScripter[index]->iEnumerateCount] );
+            }
+        }
+
+    TInt count = iTestScripter.Count();
+
+    // All TestScripter enumerations is finished for cleaning if necessarily
+    // and complete request up to engine.
+    if( count == iTestScripterIndicator )
+        {
+        TInt testCaseCount( 0 );
+        for( TInt a = 0; a < count; a++  )
+            {
+            // Remove faulty config (test case) file(s) and 
+            // iEnumerateCount not increased.
+            if( iTestScripter[a]->iTestCaseCount == 0 )
+                {
+                // Check that test case file is not allready removed.
+                if( iTestScripter[a]->iConfigFiles.Count() != 0 )
+                    {
+                    iTestScripter[a]->iConfigFiles.Remove( 0 );
+                    }
+                }
+            else
+                {
+                iTestScripter[a]->iEnumerateCount++;
+                testCaseCount += iTestScripter[a]->iTestCaseCount;
+                }
+
+            // All test cases enumerated
+            iTestScripter[a]->iState = ETestModuleEnumerateCasesCompleted;
+            iTestScripter[a]->iEnumerateComplete = ETrue;
+            }
+
+        iTestScripterIndicator = 0; // Initialization back to 0, enumerations
+                                    // are done at this run.
+        iEngine->EnumerationCompleted( testCaseCount );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: TestCasesL
+
+    Description: Return Test Cases
+
+    Parameters: None
+
+    Return Values: CFixedFlatArray<TTestInfo>*: Pointer to created array
+
+    Errors/Exceptions: Leaves if NewL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CFixedFlatArray<TTestInfo>* CTestScripterController::TestCasesL()
+    {
+    TInt testCaseCount( 0 );
+    for( TInt i = 0; i < iTestScripter.Count(); i++  )
+        {
+        testCaseCount += iTestScripter[i]->iTestCaseCount;
+        }
+
+    CFixedFlatArray<TTestInfo>* testCases = 
+        CFixedFlatArray<TTestInfo>::NewL( testCaseCount );
+
+    CleanupStack::PushL( testCases );
+
+    // Loop through all test cases from all config files
+    TInt totalCount = 0;
+    // HBufC to TPtrC
+    for( TInt a = 0; a < iTestScripter.Count(); a++ )
+        {
+        TPtrC name( iTestScripter[a]->iName->Des() );
+        for ( TInt i = 0; i < iTestScripter[a]->iEnumerateCount; i++ )
+            {
+            TTestInfo tmpInfo;
+            tmpInfo.iModuleName = name;
+            if ( iTestScripter[a]->iConfigFiles.Count() > 0 )
+                {
+                tmpInfo.iConfig = *iTestScripter[a]->iConfigFiles[i];
+                }
+
+            // Get test cases from iTestCaseArray at [i]
+            if( (iTestScripter[a]->iTestCaseArray)[i] )
+                {
+                CFixedFlatArray<TTestCaseInfo>* tempTestCases = 
+                                    (iTestScripter[a]->iTestCaseArray)[i];
+                for ( TInt j = 0; j < tempTestCases->Count(); j++ )
+                    {
+                    tmpInfo.iTestCaseInfo = (*tempTestCases)[j];
+                    // Set TestCaseInfo to testCases array
+                    testCases->Set( totalCount, tmpInfo );
+                    totalCount++;
+                    }
+                }
+            }
+        }
+
+    CleanupStack::Pop( testCases );
+
+    return testCases;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: FreeTestCases
+
+    Description: Free memory used for test cases
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::FreeTestCases()
+    {
+    for( TInt a = 0; a < iTestScripter.Count(); a++ )
+        {
+        // Reset and destroy test cases
+        iTestScripter[a]->iTestCaseArray.ResetAndDestroy();
+        iTestScripter[a]->iTestCaseArray.Close();
+
+        iTestScripter[a]->iTestCaseCount = 0;
+        iTestScripter[a]->iEnumerateComplete = EFalse;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::DoCancel()
+    {
+    // Should never come here because one TestScripter have one test case
+    // file per server session.
+    // CTestScripterController's base class is an active object but this class
+    // not used as an active object. So there not used DoCancel => Panic.
+
+    User::Panic( _L( "CTestScripterController::DoCancel()" ), KErrCorrupt );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: DoCancelEmulator
+
+    Description: Cancel active request(Emulates DoCancel)
+                 This is called from CTestModuleController::DoCancel.
+
+    Parameters: CTestModuleController* aTestModuleController: in: pointer to
+                CTestModuleController.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestScripterController::DoCancelEmulator(
+                                CTestModuleController* aTestModuleController )
+    {
+    TInt index = GetCurrentIndex( aTestModuleController );
+    if( index < KErrNone )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    __TRACE( KVerbose, ( 
+        _L( "CTestScripterController[%S]::RunDoCancelEmulator" ),
+        iTestScripter[index]->iName ) );
+
+    switch ( iTestScripter[index]->iState )
+        {
+        case ETestModuleEnumerateCases:
+            iTestScripter[index]->iModule.CancelAsyncRequest(
+                                            ETestModuleEnumerateTestCases );
+            iTestScripter[index]->iEnumerateComplete = ETrue;
+            // Enumeration canceled, complete with KErrCancel
+            iTestScripter[index]->iEngine->EnumerationCompleted(
+                                                            0, KErrCancel );
+
+            // Free allocated test cases because EnumerateTestCases was
+            // canceled
+            FreeTestCases();
+            break;
+        case ETestModuleIdle:
+        case ETestModuleEnumerateCasesCompleted:
+        default:
+            // DoCancel called in wrong state => Panic
+            _LIT( KTestModuleController, "CTestModuleController" );
+            User::Panic( KTestModuleController, EDoCancelDisorder );
+            break;
+        }
+
+    iTestScripter[index]->iAtsLogger->ErrorL( 
+                        _L("Test case enumeration cancelled") );
+    iTestScripter[index]->iState = ETestModuleIdle;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: RunError
+
+    Description: Handle errors.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestScripterController::RunError( TInt /*aError*/ )
+    {
+    // Should never come here because one TestScripter have one test case
+    // file per server session.
+    // CTestScripterController's base class is an active object but this class
+    // not used as an active object. So there not used RunError => Panic.
+
+    User::Panic( _L( "CTestScripterController::RunError()" ), KErrCorrupt );
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: RunErrorEmulator
+
+    Description: Handle errors(Emulates RunError).
+                 This is called from CTestModuleController::RunError.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code.
+                CTestModuleController* aTestModuleController: in: pointer to
+                CTestModuleController.
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestScripterController::RunErrorEmulator( TInt aError,
+                                CTestModuleController* aTestModuleController )
+    {
+    TInt index = GetCurrentIndex( aTestModuleController );
+    if( index < KErrNone )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    __TRACE( KError, ( CStifLogger::ERed,
+        _L( "CTestScripterController[%S]::RunErrorEmulator aError=[%d]" ),
+        iTestScripter[index]->iName, aError ) );
+    if( aError == KErrNoMemory )
+        {
+        __TRACE( KError, ( CStifLogger::ERed, 
+            _L( "No memory available. Test case file's size might be too big." ) ) );
+        }
+
+    iTestScripter[index]->iEnumerateComplete = ETrue;
+
+    iTestScripter[index]->iAtsLogger->ErrorL( 
+                            _L("Test module did not return any test cases") );
+    
+    _LIT( KErrorText, " did not return any test cases [error: ");
+    if( KErrorText().Length() +
+            iTestScripter[index]->iName->Length() +
+            1 < KMaxName )
+        {
+        // Enumeration failed, print warning and complete with KErrNone
+        TName error( iTestScripter[index]->iName->Des() );
+        error.Append( KErrorText );  
+        error.AppendNum( aError );  
+        error.Append( _L("]") );  
+        iEngine->ErrorPrint ( 0, error );
+    
+        iTestScripter[index]->iEngine->EnumerationCompleted( 0, KErrNone );
+        }
+    else 
+        {
+        // Cannot only print warning, complete with error
+        iTestScripter[index]->iEngine->EnumerationCompleted( 0, aError );
+        }
+
+    // Free allocated test cases because EnumerateTestCases failed
+    FreeTestCases();
+    iTestScripter[index]->iEnumerateComplete = ETrue;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: EnumerationComplete
+
+    Description: Is enumeration of test cases complete.
+
+    Parameters: None
+    
+    Return Values: TBool ETrue: Enumeration of test cases is complete
+                         EFalse: Enumeration is not complete
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestScripterController::EnumerationComplete()
+    {
+    for( TInt a = 0; a < iTestScripter.Count(); a++ )
+        {
+        if( !iTestScripter[a]->iEnumerateComplete )
+            {
+            return EFalse;
+            }
+        }
+    return ETrue;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: Server
+
+    Description: Return handle to Test Server
+
+    Parameters: TTestInfo& aTestInfo: in: Test info for this test case
+
+    Return Values: RTestServer& : Reference to RTestServer
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+RTestServer& CTestScripterController::Server( TTestInfo& aTestInfo )
+    {
+    HBufC* testScripterAndTestCaseFile = NULL;
+    TRAPD( ret, testScripterAndTestCaseFile = CreateTestScripterNameL( 
+                                            aTestInfo.iConfig,
+                                            testScripterAndTestCaseFile ) );
+    // Add to cleanup stack here, because CreateTestScripterNameL needs to be
+    // trapped in other methods.
+    CleanupStack::PushL( testScripterAndTestCaseFile );
+    if( ret != KErrNone )
+        {
+        User::Panic( 
+            _L( "CTestScripterController::Server(): CreateTestScripterNameL" ),
+            ret );
+        }
+
+    // Get correct handle
+    TInt index( KErrNotFound );
+    for( TInt a = 0; a < iTestScripter.Count(); a++ )
+        {
+        if( testScripterAndTestCaseFile->Des() == 
+                                            iTestScripter[a]->iName->Des() )
+            {
+            index = a;
+            break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( testScripterAndTestCaseFile );
+
+    if( index == KErrNotFound )
+        {
+        User::Panic(
+            _L( "CTestScripterController::Server(): Index not found" ),
+            KErrNotFound );
+        }
+
+    // Return handle
+    return iTestScripter[index]->iServer;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: GetFreeOrCreateModuleControllerL
+
+    Description: Return pointer to test module controller.
+                 Find controller which does not run test case
+                 and if this is not possible then create new one.
+
+    Parameters: TTestInfo& aTestInfo: in: Test info for this test case
+                TBool aUITestingSupport: in: Is UI testing mode enabled
+
+    Return Values: CTestModuleController* : pointer to controller
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleController* CTestScripterController::GetFreeOrCreateModuleControllerL(TTestInfo& aTestInfo, TBool aUITestingSupport)
+    {
+    HBufC* testScripterAndTestCaseFile = NULL;
+    TRAPD(ret, testScripterAndTestCaseFile = CreateTestScripterNameL(aTestInfo.iConfig, testScripterAndTestCaseFile));
+
+    // Add to cleanup stack here, because CreateTestScripterNameL needs to be trapped in other methods.
+    CleanupStack::PushL(testScripterAndTestCaseFile);
+    if(ret != KErrNone)
+        {
+        User::Panic(_L("CTestScripterController::GetFreeOrCreateModuleControllerL(): CreateTestScripterNameL"), ret);
+        }
+
+    CTestModuleController* resultController = NULL;
+    CTestModuleController* parentController = NULL;
+    TInt j;
+    
+    __TRACE(KInit, (_L("Find free real module controller (or create new one)")));
+
+    // Get handle to correct "parent" module controller
+    __TRACE(KInit, (_L("Searching for parent module controller named [%S]"), testScripterAndTestCaseFile));
+    for(TInt a = 0; a < iTestScripter.Count(); a++)
+        {
+        //Check if module name matches to given name
+        if(iTestScripter[a]->iName->Des() == testScripterAndTestCaseFile->Des())
+            {
+            parentController = iTestScripter[a]; 
+            __TRACE(KInit, (_L("Parent module controller [%S] has been found. Checking its %d children"), parentController->iName, parentController->iChildrenControllers.Count()));
+            //Now check all its children and find free one
+            //In UI testing mode always create new module controller
+            if(!aUITestingSupport)
+                {
+                for(j = 0; j < parentController->iChildrenControllers.Count(); j++)
+                    {
+                    if(parentController->iChildrenControllers[j]->iTestCaseCounter == 0)
+                        {
+                        resultController = parentController->iChildrenControllers[j];
+                        __TRACE(KInit, (_L("Free real module controller found [%S]"), resultController->iName));
+                        break;
+                        }
+                    else
+                        {
+                        __TRACE(KInit, (_L("Module controller found [%S] but is not free (it runs %d test cases)"), parentController->iChildrenControllers[j]->iName, parentController->iChildrenControllers[j]->iTestCaseCounter));
+                        }
+                    }
+                }
+            else
+                {
+                __TRACE(KInit, (_L("In UITestingSupport mode new module controller will be always created")));
+                }
+            }
+        }
+
+    //Append underscore to name
+    TPtr ptr = testScripterAndTestCaseFile->Des();
+    ptr.Append(_L("@"));
+
+    //Create new module controller if free one has not been found
+    if(!resultController)
+        {
+        TBuf<10> ind;
+        ind.Format(_L("%d"), iEngine->GetIndexForNewTestModuleController());
+        TPtr ptr = testScripterAndTestCaseFile->Des();
+        ptr.Append(ind);
+        __TRACE(KInit, (_L("Free real module controller not found. Creating new one [%S]."), testScripterAndTestCaseFile));
+            
+        //Create server and active object (This uses CTestModuleController::InitL())
+        CTestModuleController* module = CTestModuleController::NewL( 
+                                            iEngine,
+                                            testScripterAndTestCaseFile->Des(),
+                                            iAfterReboot, EFalse, this);
+        CleanupStack::PushL(module);
+        parentController->iChildrenControllers.AppendL(module);
+        __TRACE(KInit, (_L("Child added to [%S] controller. Currently it has %d children:"), parentController->iName, parentController->iChildrenControllers.Count()));
+        for(j = 0; j < parentController->iChildrenControllers.Count(); j++)
+            {
+            __TRACE(KInit, (_L("    %d. [%S]"), j + 1, parentController->iChildrenControllers[j]->iName));
+            }
+
+        // Now is used TestScripter so give test case file also(used
+        // in caps modifier cases). 
+        TRAPD(err, module->InitL(iInifile, aTestInfo.iConfig));
+        if(err != KErrNone)
+            {
+            __TRACE(KVerbose, (_L("InitL fails with error: %d" ), err));
+            User::Leave(err);
+            }
+
+        module->AddConfigFileL(aTestInfo.iConfig);
+
+        __TRACE(KInit, (_L("New module controller created [%S]."), testScripterAndTestCaseFile));
+
+        //Enumerate test cases
+        module->EnumerateSynchronously();
+
+        CleanupStack::Pop(module);
+        resultController = module;
+        }
+
+    CleanupStack::PopAndDestroy(testScripterAndTestCaseFile);
+
+    // Return handle
+    return resultController;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: ModuleName
+
+    Description: Return the name of Test Scripter
+
+    Parameters: const TDesC& aModuleName: in: Module name
+
+    Return Values: const TDesC : Name of Test Scripter
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestScripterController::ModuleName( const TDesC& aModuleName )
+    {
+    // If test case file not added yet.
+    if( iTestScripter.Count() == 0 || aModuleName == KTestScripterName )
+        {
+        return *iName;
+        }
+
+    // Test case(s) is(are) added. Scan the name from corrent TestScripter
+    // session
+    for( TInt a = 0; a < iTestScripter.Count(); a++ )
+        {
+        if( aModuleName == iTestScripter[a]->iName->Des() )
+            {
+            return *iTestScripter[a]->iName;
+            }
+        }
+
+    return KNullDesC;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: CreateTestScripterNameL
+
+    Description: Create name according to TestScripter and Test case file.
+
+    Parameters: TFileName& aTestCaseFile: in: Test case file with path and name
+                TFileName& aCreatedName: inout: Created name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves is test case file is too long
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+HBufC* CTestScripterController::CreateTestScripterNameL( 
+                                                    TFileName& aTestCaseFile,
+                                                    HBufC* aCreatedName )
+    {
+    TParse parse;
+    parse.Set( aTestCaseFile, NULL, NULL );
+
+    TInt length( 0 );
+    length = parse.Name().Length();
+    length += ( KTestScripterNameLength + 1 );
+    length += 10; //this will be used to add unique identifier (when run test case in separate process is on)
+
+    // aCreatedName to CleanupStack
+    aCreatedName = HBufC::NewLC( length );
+    TPtr ptr = aCreatedName->Des();
+
+    // Maximum length of TestScripter's name(Max limitation from
+    // CTestModuleController creation)
+    TInt maximumLength = KMaxName - ( KTestScripterNameLength + 1 );
+
+    // Start create name. Format is testscripter_testcasefile
+    ptr.Copy( KTestScripterName );
+    ptr.Append( _L( "_" ) );
+    if( parse.Name().Length() < maximumLength )
+        {
+        ptr.Append( parse.Name() );
+        ptr.LowerCase();
+        }
+    else
+        {
+        __TRACE( KInit, ( CStifLogger::ERed,
+            _L( "TestScripter test case file(config)'s name is too long. Current length[%d], allowed max length[%d]. Cannot continue" ),
+            parse.Name().Length(), maximumLength ) );
+        User::Leave( KErrArgument );
+        }
+
+    // Pop here because this method can be trapped and trap panics with
+    // E32USER-CBase if cleap up stack is not empty.
+    CleanupStack::Pop( aCreatedName );
+
+    return aCreatedName;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: DeleteModuleController
+
+    Description: Finds specified module controller and deletes it.
+
+    Parameters: CTestModuleController* aRealModuleController: module controller
+                   to be deleted.
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: 
+
+-------------------------------------------------------------------------------
+*/    
+void CTestScripterController::DeleteModuleController(CTestModuleController* aRealModuleController)
+    {
+    __TRACE(KInit, (_L("Attempting to delete real module controller [%S]"), aRealModuleController->iName));
+
+    TInt i, j, k;
+    TInt children;
+    TInt subcontrollers = iTestScripter.Count();
+    
+    for(k = 0; k < subcontrollers; k++)
+        {
+        children = iTestScripter[k]->iChildrenControllers.Count();
+        __TRACE(KInit, (_L("...checking controller [%S] which has %d children"), iTestScripter[k]->iName, children));
+
+        for(i = 0; i < children; i++)
+            {
+            if(iTestScripter[k]->iChildrenControllers[i] == aRealModuleController)
+                {
+                __TRACE(KInit, (_L("Real module controller found... deleting")));
+                delete iTestScripter[k]->iChildrenControllers[i];
+                iTestScripter[k]->iChildrenControllers.Remove(i);
+    
+                __TRACE(KInit, (_L("Child removed from [%S] controller. Currently it has %d children:"), iTestScripter[k]->iName, iTestScripter[k]->iChildrenControllers.Count()));
+                for(j = 0; j < iTestScripter[k]->iChildrenControllers.Count(); j++)
+                    {
+                    __TRACE(KInit, (_L("    %d. [%S]"), j + 1, iTestScripter[k]->iChildrenControllers[j]->iName));
+                    }
+    
+                return;
+                }
+            }
+        }
+    __TRACE(KInit, (_L("Real module controller NOT found... NOT deleting")));
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestScripterController
+
+    Method: RemoveModuleController
+
+    Description: Finds specified module controller and removes it from children list.
+
+    Parameters: CTestModuleController* aRealModuleController: module controller
+                   to be removed.
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: 
+
+-------------------------------------------------------------------------------
+*/    
+void CTestScripterController::RemoveModuleController(CTestModuleController* aRealModuleController)
+    {
+    __TRACE(KInit, (_L("Attempting to remove real module controller [%x]"), aRealModuleController));
+
+    TInt i, j, k;
+    TInt children;
+    TInt subcontrollers = iTestScripter.Count();
+    
+    for(k = 0; k < subcontrollers; k++)
+        {
+        children = iTestScripter[k]->iChildrenControllers.Count();
+        __TRACE(KInit, (_L("...checking controller [%S] which has %d children"), iTestScripter[k]->iName, children));
+
+        for(i = 0; i < children; i++)
+            {
+            if(iTestScripter[k]->iChildrenControllers[i] == aRealModuleController)
+                {
+                __TRACE(KInit, (_L("Real module controller found... removing")));
+                iTestScripter[k]->iChildrenControllers.Remove(i);
+    
+                __TRACE(KInit, (_L("Child removed from [%S] controller. Currently it has %d children:"), iTestScripter[k]->iName, iTestScripter[k]->iChildrenControllers.Count()));
+                for(j = 0; j < iTestScripter[k]->iChildrenControllers.Count(); j++)
+                    {
+                    __TRACE(KInit, (_L("    %d. [%S]"), j + 1, iTestScripter[k]->iChildrenControllers[j]->iName));
+                    }
+    
+                return;
+                }
+            }
+        }
+    __TRACE(KInit, (_L("Real module controller NOT found... NOT removing")));
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CErrorPrinter class member
+    functions.
+
+-------------------------------------------------------------------------------
+*/
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrinter
+
+    Method: NewL
+
+    Description: Create a testcase runner.
+
+    Parameters: CTestEngine* aMain: in: Pointer to console main
+
+    Return Values: CErrorPrinter* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CErrorPrinter* CErrorPrinter::NewL( CTestEngine* aTestEngine )
+    {
+    CErrorPrinter* self = new ( ELeave ) CErrorPrinter();
+    CleanupStack::PushL( self );
+    self->ConstructL( aTestEngine );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrinter
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CTestEngine* aEngine: in: Pointer to Engine
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CErrorPrinter::ConstructL( CTestEngine* aEngine )
+    {
+    iEngine = aEngine;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrinter
+
+    Method: CErrorPrinter
+
+    Description: Constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CErrorPrinter::CErrorPrinter( ) : CActive( EPriorityStandard ),
+                                      iErrorPckg( iError )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrinter
+
+    Method: ~CErrorPrinter
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CErrorPrinter::~CErrorPrinter( )
+    {
+    Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrinter
+
+    Method: StartL
+
+    Description: Starts a test case and sets the active object to active.
+
+    Parameters: RTestModule& aServer: in: Reference to the server object
+
+    Return Values: None
+
+    Errors/Exceptions: TInt: Return KErrNone
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CErrorPrinter::StartL( RTestModule& aServer )
+    {
+    iServer = aServer;
+
+    CActiveScheduler::Add ( this );
+
+    SetActive();
+    aServer.ErrorNotification ( iErrorPckg, iStatus );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrinter
+
+    Method: RunL
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CErrorPrinter::RunL()
+    {
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        __TRACE( KVerbose, ( _L( "In CErrorPrinter::RunL [iStatus = %d]" ), iStatus.Int() ) );
+        }
+    else
+       {
+        // Forward error print to UI and set request again active.
+        iEngine->ErrorPrint( iErrorPckg );
+        SetActive();
+        iServer.ErrorNotification ( iErrorPckg, iStatus );
+       }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrinter
+
+    Method: DoCancel
+
+    Description: Cancels the asynchronous request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CErrorPrinter::DoCancel()
+    {
+    iServer.CancelAsyncRequest ( ETestModuleErrorNotification );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrinter
+
+    Method: RunError
+
+    Description: Handles errors. RunL can't leave so just forward error
+    and let framework handle error.
+
+    Parameters: TInt aError: in: Error code
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CErrorPrinter::RunError( TInt aError )
+    {
+    return aError;
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CServerStateHandler
+
+    Method: NewL
+
+    Description: Constructs a new CServerStateHandler object.
+
+    Parameters: CTestEngine* aMain
+
+    Return Values: CServerStateHandler*: New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CServerStateHandler* CServerStateHandler::NewL( CTestEngine* aTestEngine, 
+                                                CTestModuleController* aTestModuleController )
+    {
+
+    CServerStateHandler* self = 
+                        new( ELeave ) CServerStateHandler( aTestEngine, aTestModuleController );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CServerStateHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CServerStateHandler::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CServerStateHandler
+
+    Method: CServerStateHandler
+
+    Description: Constructor
+
+    Parameters: CTestEngine* aMain
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CServerStateHandler::CServerStateHandler( CTestEngine* aTestEngine, 
+                                          CTestModuleController* aTestModuleController ) :
+    CActive( CActive::EPriorityStandard ),
+    iEngine( aTestEngine ),
+    iTestModuleController( aTestModuleController )
+    {
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CServerStateHandler
+
+    Method: ~CServerStateHandler
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CServerStateHandler::~CServerStateHandler()
+    {
+    
+    Cancel();
+
+    iServerThread.Close();
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CServerStateHandler
+
+    Method: StartL
+
+    Description: Starts to monitor server thread.
+
+    Parameters: RTestServer& aServer
+
+    Return Values: TInt: 
+
+    Errors/Exceptions: 
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CServerStateHandler::StartL( RTestServer& aServer )
+    {
+    
+    __TRACE( KVerbose, ( _L( "CServerStateHandler::StartL" ) ) );
+     
+    TThreadId serverThreadId; 
+     
+    iStatus = KRequestPending;
+  
+    // Asks from server its thread ID value
+    User::LeaveIfError( aServer.GetServerThreadId ( serverThreadId ) ); 
+      
+    // Opens handle to thread
+    User::LeaveIfError( iServerThread.Open( serverThreadId ) );
+    
+    CActiveScheduler::Add( this );
+        
+    // Requests notification when this thread dies, normally or otherwise   
+    iServerThread.Logon( iStatus ); // Miten RThread hanska ko serveriin..
+   
+    SetActive();
+
+    return KErrNone;
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CServerStateHandler
+
+    Method: RunL
+
+    Description: Handles thread death.
+  
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CServerStateHandler::RunL()
+    {
+    
+    // something went badly wrong!
+    __TRACE( KInit, ( CStifLogger::ERed, 
+        _L( "Test case execution fails. Possible reason: KErrServerTerminated" ) ) );
+ 
+    RDebug::Print( _L("Test case execution fails. Possible reason: KErrServerTerminated") );     
+             
+    // Note: 
+    // More Info about STIF panic with KErrServerTerminated 
+    // will be informed to the user via testengine log and testreport    
+    // in CTestCaseController::RunL() method
+   
+    // TestModuleCrash is called for doing all needed recovering operations for enabling STIF 
+    // to continue test case execution
+    iEngine->TestModuleCrash( iTestModuleController );
+      
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CServerStateHandler
+
+    Method: DoCancel
+
+    Description: Stops listening TestServer status.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CServerStateHandler::DoCancel()
+    {
+
+    __TRACE( KVerbose, ( _L( "CServerStateHandler::DoCancel" ) ) );
+
+    // Cancels an outstanding request for notification of the death of this thread.
+    iServerThread.LogonCancel( iStatus );
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CServerStateHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError: in: Error code
+
+    Return Values:  TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CServerStateHandler::RunError( TInt aError )
+    {
+    __TRACE( KError,( _L( "CServerStateHandler::RunError" ) ) );
+    return aError;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: GenerateModuleName
+
+    Description: Check is module TestScripter. Does parsing and returns new
+                 module name and error codes(Needed operations when creating
+                 server sessions to TestScripter). 
+
+    Parameters: const TFileName& aModuleName: in: Module name for checking.
+                TFileName& aNewModuleName: inout: Parsed module name.
+
+    Return Values: KErrNone if TestScripter releated module.
+                   KErrNotFound if not TestScripter releated module.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+
+TInt GenerateModuleName(const TDesC& aModuleName,
+                        TDes& aNewModuleName)
+    {
+    // Check that length is greated than KTestScripterNameLength
+    if( aModuleName.Length() < KTestScripterNameLength )
+        {
+        return KErrNotFound;
+        }
+    // Check is TestScripter
+    TPtrC check( aModuleName.Mid( 0, KTestScripterNameLength ) );
+    TInt ret = check.CompareF( KTestScripterName );
+    if( ret == KErrNone )
+        {
+        aNewModuleName.Copy( aModuleName.Mid( 0, KTestScripterNameLength ) );
+        aNewModuleName.LowerCase();
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+
+    return KErrNone;
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/TestModuleInfo.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1001 @@
+/*
+* 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: This module contains implementation of 
+* CTestModuleList class and CTestModuleInfo class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "TestModuleInfo.h"
+#include <e32svr.h>
+#include "Logging.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 =======================================
+// None
+
+#define LOGGER iLogger
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: CTestModuleInfo
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleInfo::CTestModuleInfo()
+    {
+	iLogger = NULL;
+    iModuleName = NULL;
+    iIniFileName = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: aModuleName: module name
+                aLogger: pointer to stif logger
+
+    Return Values: None
+
+    Errors/Exceptions:
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleInfo::ConstructL(TDesC& aModuleName, CStifLogger* aLogger)
+    {
+	iLogger = aLogger;
+
+	if(iModuleName)
+	    {
+        delete iModuleName;
+		iModuleName = NULL;
+        }
+    iModuleName = aModuleName.AllocL();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: aModuleName: module name
+                aLogger: pointer to stif logger
+
+    Return Values: CTestModuleInfo* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleInfo* CTestModuleInfo::NewL(TDesC& aModuleName, CStifLogger* aLogger)
+    {
+    CTestModuleInfo* self = new (ELeave) CTestModuleInfo();
+    CleanupStack::PushL(self);
+    self->ConstructL(aModuleName, aLogger);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: ~CTestModuleInfo
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleInfo::~CTestModuleInfo()
+    {
+    delete iModuleName;
+    delete iIniFileName;
+
+    iCfgFiles.ResetAndDestroy();
+    iCfgFiles.Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: SetIniFile
+
+    Description: Set ini file
+
+    Parameters: aIniFileName: initialization file name
+
+    Return Values: KErrNone if everything went ok
+                   KErrAlreadyExists if ini file was already set
+                   Symbian error code otherwise
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleInfo::SetIniFile(TDesC& aIniFileName)
+    {
+	if(iIniFileName)
+	    {
+        return KErrAlreadyExists;
+        }
+
+    TRAPD(err, iIniFileName = aIniFileName.AllocL());
+    if(err != KErrNone)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Could not create descriptor (CTestModuleInfo::SetIniFile) for string '%S'. Error %d."), &aIniFileName, err));
+            }
+        else
+            {
+            RDebug::Print(_L("Could not create descriptor (CTestModuleInfo::SetIniFile) for string '%S'. Error %d."), &aIniFileName, err);
+            }
+        return err;
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: AddCfgFile
+
+    Description: Add config file if it is not yet added to the array
+
+    Parameters: aCfgFileName: file name
+
+    Return Values: KErrNone if everything went ok
+                   KErrAlreadyExists if config file is already present
+                   Symbian error code otherwise
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleInfo::AddCfgFile(TDesC& aCfgFileName)
+    {
+    //Check if given file name does not exist already
+    TInt cnt = iCfgFiles.Count();
+    TInt i;
+    TFileName cfgFileName;
+
+    //Check if given module is already on the list
+    for(i = 0; i < cnt; i++)
+        {
+        iCfgFiles[i]->GetCfgFileName(cfgFileName);
+        if(cfgFileName == aCfgFileName)
+            {
+            return KErrAlreadyExists;
+			}
+        }
+
+    //Add to array
+    TInt err = KErrNone;
+    CTestCaseFileInfo* tmp = NULL;
+    TRAP(err, tmp = CTestCaseFileInfo::NewL(aCfgFileName, iLogger));
+    if(err != KErrNone)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Could not create CTestCaseFileInfo object (CTestModuleInfo::AddCfgFile). Error %d."), err));
+            }
+        else
+            {
+            RDebug::Print(_L("Could not create CTestCaseFileInfo object (CTestModuleInfo::AddCfgFile). Error %d."), err);
+            }
+		return err;
+        }
+    if(!tmp)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Could not create CTestCaseFileInfo object (CTestModuleInfo::AddCfgFile)")));
+            }
+        else
+            {
+            RDebug::Print(_L("Could not create CTestCaseFileInfo object (CTestModuleInfo::AddCfgFile)"));
+            }
+		return KErrGeneral;
+        }
+
+    err = iCfgFiles.Append(tmp);
+    if(err != KErrNone)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Could not append CTestCaseFileInfo object to array (CTestModuleInfo::AddCfgFile). Error %d."), err));
+            }
+        else
+            {
+            RDebug::Print(_L("Could not append CTestCaseFileInfo object to array (CTestModuleInfo::AddCfgFile). Error %d."), err);
+            }
+        delete tmp;
+        return err;
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: CountCfgFiles
+
+    Description: Return number of config files
+
+    Parameters: None
+
+    Return Values: number of config files
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleInfo::CountCfgFiles(void)
+    {
+    return iCfgFiles.Count();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: GetModuleName
+
+    Description: Get module name
+
+    Parameters: None
+
+    Return Values:
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleInfo::GetModuleName(TDes& aModuleName)
+    {
+    aModuleName.Zero();
+    if(iModuleName)
+        {
+        aModuleName.Copy(*iModuleName);
+        }
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: GetIniFileName
+
+    Description: Get module ini file name
+
+    Parameters: None
+
+    Return Values:
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleInfo::GetIniFileName(TDes& aIniFileName)
+    {
+    aIniFileName.Zero();
+    if(iIniFileName)
+        {
+        aIniFileName.Copy(*iIniFileName);
+        }
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: GetCfgFileName
+
+    Description: Get config file name
+
+    Parameters: aIndex: index of config file
+
+    Return Values: TDesC&: config file name
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleInfo::GetCfgFileName(TInt aIndex, TDes& aCfgFileName)
+    {
+    aCfgFileName.Zero();
+    TInt cnt = iCfgFiles.Count();
+
+    //Check index
+    if(aIndex >= cnt || aIndex < 0)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Given index reaches out of array (CTestModuleInfo::GetCfgFileName). Given index: %d. Max allowed index: %d"), aIndex, cnt - 1));
+            }
+        else
+            {
+            RDebug::Print(_L("Given index reaches out of array (CTestModuleInfo::GetCfgFileName). Given index: %d. Max allowed index: %d"), aIndex, cnt - 1);
+            }
+        return KErrArgument;
+        }
+
+    TInt ret = iCfgFiles[aIndex]->GetCfgFileName(aCfgFileName);
+    return ret;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleInfo
+
+    Method: GetUncheckedCfgFile
+
+    Description: Get first unchecked test case file
+
+    Parameters: None
+
+    Return Values: Pointer to CTestCaseFileInfo object if found
+                   Null otherwise
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseFileInfo* CTestModuleInfo::GetUncheckedCfgFile(void)
+    {
+    TInt cnt = iCfgFiles.Count();
+    TInt i;
+
+    for(i = 0; i < cnt; i++)
+        {
+        if(!iCfgFiles[i]->IsChecked())
+            {
+            return iCfgFiles[i];
+            }
+        }
+
+    return NULL;
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: CTestModuleList
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleList::CTestModuleList()
+    {
+	iLogger = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: aLogger: pointer to stif logger
+
+    Return Values: None
+
+    Errors/Exceptions:
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleList::ConstructL(CStifLogger* aLogger)
+    {
+	iLogger = aLogger;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: aLogger: pointer to stif logger
+
+    Return Values: CTestModuleList* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModuleList* CTestModuleList::NewL(CStifLogger* aLogger)
+    {
+    CTestModuleList* self = new (ELeave) CTestModuleList();
+    CleanupStack::PushL(self);
+    self->ConstructL(aLogger);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: ~CTestModuleList
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModuleList::~CTestModuleList()
+    {
+    iTestModules.ResetAndDestroy();
+    iTestModules.Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: AddTestModule
+
+    Description: Adds new test module to list if specified module is not already added.
+
+    Parameters: aModuleName: module name
+
+    Return Values: KErrNone if opereation succeeded
+                   KErrAlreadyExists if module is already present on the list
+                   Symbian error code otherwise
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleList::AddTestModule(TDesC& aModuleName)
+    {
+    //Check if given module is already on the list
+    CTestModuleInfo* tmp = GetModule(aModuleName);
+    if(tmp)
+        {
+        return KErrAlreadyExists;
+        }
+
+    //There is no module on the list, so create new info object
+    TInt err = KErrNone;
+    TRAP(err, tmp = CTestModuleInfo::NewL(aModuleName, iLogger));
+    if(err != KErrNone)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Could not create CTestModuleInfo object (CTestModuleList::AddTestModule). Error %d."), err));
+            }
+        else
+            {
+            RDebug::Print(_L("Could not create CTestModuleInfo object (CTestModuleList::AddTestModule). Error %d."), err);
+            }
+		return err;
+        }
+    if(!tmp)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Could not create CTestModuleInfo object (CTestModuleList::AddTestModule)")));
+            }
+        else
+            {
+            RDebug::Print(_L("Could not create CTestModuleInfo object (CTestModuleList::AddTestModule)"));
+            }
+		return KErrGeneral;
+        }
+
+    //Add to list
+    err = iTestModules.Append(tmp);
+    if(err != KErrNone)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Could not append CTestModuleInfo object to array (CTestModuleList::AddTestModule). Error %d."), err));
+            }
+        else
+            {
+            RDebug::Print(_L("Could not append CTestModuleInfo object to array (CTestModuleList::AddTestModule). Error %d."), err);
+            }
+        delete tmp;
+        return err;
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: Count
+
+    Description: Counts test modules
+
+    Parameters: None
+
+    Return Values: Number of test modules on list
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleList::Count()
+    {
+	return iTestModules.Count();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: GetModule
+
+    Description: Searches test module with given name
+
+    Parameters: aModuleName: module name
+
+    Return Values: Pointer to found object or NULL when not found
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModuleInfo* CTestModuleList::GetModule(TDesC& aModuleName)
+    {
+    TInt cnt = iTestModules.Count();
+    TInt i;
+    CTestModuleInfo* tmp;
+    TName moduleName;
+
+    //Check if given module is already on the list
+    for(i = 0; i < cnt; i++)
+        {
+        tmp = iTestModules[i];
+        tmp->GetModuleName(moduleName);
+        if(moduleName == aModuleName)
+            {
+            return tmp;
+			}
+        }
+    return NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: GetModule
+
+    Description: Searches test module with given index
+
+    Parameters: aIndex: module index
+
+    Return Values: Pointer to found object or NULL when not found
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModuleInfo* CTestModuleList::GetModule(TInt aIndex)
+    {
+    TInt cnt = iTestModules.Count();
+
+    //Check index
+    if(aIndex >= cnt || aIndex < 0)
+        {
+        if(iLogger)
+            {
+            __TRACE(KError, (_L("Given index reaches out of array (CTestModuleList::GetModule). Given index: %d. Max allowed index: %d"), aIndex, cnt - 1));
+            }
+        else
+            {
+            RDebug::Print(_L("Given index reaches out of array (CTestModuleList::GetModule). Given index: %d. Max allowed index: %d"), aIndex, cnt - 1);
+            }
+        return NULL;
+        }
+
+    //return module
+    return iTestModules[aIndex];
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleList
+
+    Method: GetUncheckedCfgFile
+
+    Description: Get first unchecked test case file (module: testscripter and testcombiner)
+
+    Parameters: None
+
+    Return Values: Pointer to CTestCaseFileInfo object if found
+                   Null otherwise
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestCaseFileInfo* CTestModuleList::GetUncheckedCfgFile(void)
+    {
+    CTestCaseFileInfo* ret = NULL;
+
+    TBuf<12> modname(_L("testscripter"));
+    CTestModuleInfo* mod = GetModule(modname);
+
+    if(mod)
+        {
+        ret = mod->GetUncheckedCfgFile();
+        }
+
+    if(!ret)
+	    {
+        modname.Copy(_L("testcombiner"));
+        mod = GetModule(modname);
+        if(mod)
+            {
+            ret = mod->GetUncheckedCfgFile();
+            }
+        }
+
+    return ret;
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseFileInfo
+
+    Method: CTestCaseFileInfo
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseFileInfo::CTestCaseFileInfo()
+    {
+	iLogger = NULL;
+    iCfgFileName = NULL;
+    iChecked = EFalse;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseFileInfo
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: aCfgFileName: config file name
+                aLogger: pointer to Stif logger
+
+    Return Values: None
+
+    Errors/Exceptions:
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseFileInfo::ConstructL(TDesC& aCfgFileName, CStifLogger* aLogger)
+    {
+	iLogger = aLogger;
+
+	if(iCfgFileName)
+	    {
+        delete iCfgFileName;
+		iCfgFileName = NULL;
+        }
+    iCfgFileName = aCfgFileName.AllocL();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseFileInfo
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: aCfgFileName: config file name
+                aLogger: pointer to stif logger
+
+    Return Values: CTestCaseFileInfo* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseFileInfo* CTestCaseFileInfo::NewL(TDesC& aCfgFileName, CStifLogger* aLogger)
+    {
+    CTestCaseFileInfo* self = new (ELeave) CTestCaseFileInfo();
+    CleanupStack::PushL(self);
+    self->ConstructL(aCfgFileName, aLogger);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseFileInfo
+
+    Method: ~CTestCaseFileInfo
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseFileInfo::~CTestCaseFileInfo()
+    {
+    delete iCfgFileName;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseFileInfo
+
+    Method: GetCfgFileName
+
+    Description: Get config file name
+
+    Parameters: None
+
+    Return Values: TDesC& : config file name
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestCaseFileInfo::GetCfgFileName(TDes& aCfgFileName)
+    {
+    aCfgFileName.Zero();
+    if(iCfgFileName)
+        {
+        aCfgFileName.Copy(*iCfgFileName);
+        }
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseFileInfo
+
+    Method: SetChecked
+
+    Description: Set configuration file as already checked
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CTestCaseFileInfo::SetChecked(void)
+    {
+    iChecked = ETrue;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseFileInfo
+
+    Method: IsChecked
+
+    Description: Return if config file has been checked
+
+    Parameters: None
+
+    Return Values: 0 if test case file has not been checked yet
+                   other value otherwise
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestCaseFileInfo::IsChecked(void)
+    {
+    return iChecked;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/TestReport.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1404 @@
+/*
+* 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: This module contains implementation of CTestReport 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <f32file.h>
+#include <hal.h>
+#include "TestReport.h"
+#include "TestEngineClientServer.h"
+#include "Logging.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+const TInt KMaxLenEol = 6;
+const TInt KMaxReportData = 256;
+typedef TBuf<KMaxReportData> TPrintInfo;
+const TInt KSummaryLineEndLen = 12;
+_LIT( KSummaryLineEnd,  "            ");
+
+// XML Tags (alphabetically)
+_LIT(KXMLCaseNumberTag,          "<CaseNumber>");
+_LIT(KXMLCaseNumberTagEnd,       "</CaseNumber>");
+_LIT(KXMLCaseTitleTag,           "<Title>");
+_LIT(KXMLCaseTitleTagEnd,        "</Title>");
+_LIT(KXMLConfigFileTag,          "<Config>");
+_LIT(KXMLConfigFileTagEnd,       "</Config>");
+_LIT(KXMLCpuSpeedTag,            "<CPUSpeed>");
+_LIT(KXMLCpuSpeedTagEnd,         "</CPUSpeed>");
+_LIT(KXMLCpuTag,                 "<CPU>");
+_LIT(KXMLCpuTagEnd,              "</CPU>");
+_LIT(KXMLCrashedTag,             "<Crashed>");
+_LIT(KXMLCrashedTagEnd,          "</Crashed>");
+_LIT(KXMLDateTag,                "<Date>");
+_LIT(KXMLDateTagEnd,             "</Date>");
+_LIT(KXMLDllSummaryTag,          "<Dlls>");
+_LIT(KXMLDllSummaryTagEnd,       "</Dlls>");
+_LIT(KXMLDllTag,                 "<Dll>");
+_LIT(KXMLDllTagEnd,              "</Dll>");
+_LIT(KXMLEndTimeTag,             "<EndTime>");
+_LIT(KXMLEndTimeTagEnd,          "</EndTime>");
+_LIT(KXMLEnvironmentInfoTag,     "<EnvironmentInfo>");
+_LIT(KXMLEnvironmentInfoTagEnd,  "</EnvironmentInfo>");
+_LIT(KXMLExecutionResultTag,     "<ExecutionResultCode>");
+_LIT(KXMLExecutionResultTagEnd,  "</ExecutionResultCode>");
+_LIT(KXMLFailedTag,              "<Failed>");
+_LIT(KXMLFailedTagEnd,           "</Failed>");
+_LIT(KXMLFileNameTag,            "<FileName>");
+_LIT(KXMLFileNameTagEnd,         "</FileName>");
+_LIT(KXMLHardwareInfoTag,        "<HardwareInfo>");
+_LIT(KXMLHardwareInfoTagEnd,     "</HardwareInfo>");
+_LIT(KXMLHwRevisionTag,          "<HwRevision>");
+_LIT(KXMLHwRevisionTagEnd,       "</HwRevision>");
+_LIT(KXMLLanguageTag,            "<Language>");
+_LIT(KXMLLanguageTagEnd,         "</Language>");
+_LIT(KXMLMachineUidTag,          "<MachineUID>");
+_LIT(KXMLMachineUidTagEnd,       "</MachineUID>");
+_LIT(KXMLManufacturerTag,        "<Manufacturer>");
+_LIT(KXMLManufacturerTagEnd,     "</Manufacturer>");
+_LIT(KXMLMemoryInfoTag,          "<MemoryInfo>");
+_LIT(KXMLMemoryInfoTagEnd,       "</MemoryInfo>");
+_LIT(KXMLModelTag,               "<Model>");
+_LIT(KXMLModelTagEnd,            "</Model>");
+_LIT(KXMLModuleNameTag,          "<ModuleName>");
+_LIT(KXMLModuleNameTagEnd,       "</ModuleName>");
+_LIT(KXMLModuleSummaryTag,       "<Modules>");
+_LIT(KXMLModuleSummaryTagEnd,    "</Modules>");
+_LIT(KXMLModuleTag,              "<Module>");
+_LIT(KXMLModuleTagEnd,           "</Module>");
+_LIT(KXMLPassedTag,              "<Passed>");
+_LIT(KXMLPassedTagEnd,           "</Passed>");
+_LIT(KXMLRamFreeTag,             "<RAMFree>");
+_LIT(KXMLRamFreeTagEnd,          "</RAMFree>");
+_LIT(KXMLRamTag,                 "<RAM>");
+_LIT(KXMLRamTagEnd,              "</RAM>");
+_LIT(KXMLResultDescrTag,         "<ResultDescription>");
+_LIT(KXMLResultDescrTagEnd,      "</ResultDescription>");
+_LIT(KXMLResultTag,              "<Result>");
+_LIT(KXMLResultTagEnd,           "</Result>");
+_LIT(KXMLSoftwareInfoTag,        "<SoftwareInfo>");
+_LIT(KXMLSoftwareInfoTagEnd,     "</SoftwareInfo>");
+_LIT(KXMLStartTimeTag,           "<StartTime>");
+_LIT(KXMLStartTimeTagEnd,        "</StartTime>");
+_LIT(KXMLSwBuildTag,             "<SwBuild>");
+_LIT(KXMLSwBuildTagEnd,          "</SwBuild>");
+_LIT(KXMLSwRevisionTag,          "<SwRevision>");
+_LIT(KXMLSwRevisionTagEnd,       "</SwRevision>");
+_LIT(KXMLTestCasesSummaryTag,    "<TestCasesSummary>");
+_LIT(KXMLTestCasesSummaryTagEnd, "</TestCasesSummary>");
+_LIT(KXMLTestCasesTag,           "<TestCases>");
+_LIT(KXMLTestCasesTagEnd,        "</TestCases>");
+_LIT(KXMLTestCaseTag,            "<TestCase>");
+_LIT(KXMLTestCaseTagEnd,         "</TestCase>");
+_LIT(KXMLTestReportTag,          "<TestReport>");
+_LIT(KXMLTestReportTagEnd,       "</TestReport>");
+_LIT(KXMLTestResultTag,          "<ResultCode>");
+_LIT(KXMLTestResultTagEnd,       "</ResultCode>");
+_LIT(KXMLTimeoutedTag,           "<Timeout>");
+_LIT(KXMLTimeoutedTagEnd,        "</Timeout>");
+_LIT(KXMLTimeTag,                "<Time>");
+_LIT(KXMLTimeTagEnd,             "</Time>");
+_LIT(KXMLTotalTag,               "<Total>");
+_LIT(KXMLTotalTagEnd,            "</Total>");
+_LIT(KXMLVersionTag,             "<Version>");
+_LIT(KXMLVersionTagEnd,          "</Version>");
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: CTestReport
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: const TTestReportMode aReportMode: in: Report mode
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestReport::CTestReport( const TTestReportMode aReportMode ):
+    iReportMode( aReportMode ) 
+    {
+    iXML = EFalse;
+    iReportHWInfo = TTestHWInfo();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: CTestReportSettings& aTestReportSettings: in: Report settings
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation for iTotalSummary fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::ConstructL( CTestReportSettings& aTestReportSettings )
+    {
+    // Create summary for all test cases
+    _LIT( KName, "All test cases" );
+    iTotalSummary = new ( ELeave ) TTestSummary( KName() );
+
+    User::LeaveIfError( iFs.Connect() );
+    
+    TPtrC path;
+    path.Set( aTestReportSettings.iPath->Des() );
+    TPtrC name;
+    name.Set( aTestReportSettings.iName->Des() );
+
+    iFormat = aTestReportSettings.iFormat;
+    iOutput = aTestReportSettings.iOutput;
+    iXML = aTestReportSettings.iXML;
+    
+    // XML format can be used only when report is of txt file type.
+    if(iFormat != CStifLogger::ETxt && iOutput != CStifLogger::EFile && iXML)
+        {
+        RDebug::Print(_L("Stif: XML report is available only when TestReportFormat is TXT and TestReportOutput is FILE"));
+        iXML = EFalse;
+        }
+    
+    if( iOutput == CStifLogger::EFile )
+        {
+        iFs.MkDirAll( path );
+        
+        HBufC* pathAndFileBuf = HBufC::NewLC( path.Length() + name.Length() + 5 );
+        TPtr pathAndFile(pathAndFileBuf->Des() );
+        pathAndFile.Append( path );
+        pathAndFile.Append( name );
+
+        if(iXML)
+            {
+            pathAndFile.Append( _L(".xml") );
+            }
+        else
+            {
+            if( ( iFormat == CStifLogger::EHtml ) && 
+                ( iOutput == CStifLogger::EFile ) )
+                {
+                pathAndFile.Append( _L(".html") );
+                }
+            else 
+                {
+                pathAndFile.Append( _L(".txt") );
+                }
+            }
+        
+        if( aTestReportSettings.iOverwrite )
+            {
+            User::LeaveIfError( iFile.Replace( iFs, 
+                           pathAndFile,
+                           EFileWrite | EFileStreamText | EFileShareExclusive ) );
+            }
+        else
+            {
+            TInt fileOpen = iFile.Open( iFs, 
+                                        pathAndFile, 
+                                        EFileWrite | EFileStreamText | EFileShareAny );
+            if( fileOpen == KErrNotFound )
+                {
+                User::LeaveIfError( 
+                    iFile.Create( iFs, 
+                                  pathAndFile, 
+                                  EFileWrite | EFileStreamText | EFileShareExclusive ) );
+                }
+            else if( fileOpen == KErrNone )
+                {
+                TInt endPosOfFile = 0;
+                User::LeaveIfError( iFile.Seek( ESeekEnd, endPosOfFile ) );
+                }
+            else
+                {
+                User::Leave( fileOpen );
+                }
+            }
+       
+        CleanupStack::PopAndDestroy( pathAndFileBuf );
+        }
+            
+    WriteHeaderL();
+    
+    // Add temporarily closing tags to keep valid xml structure
+    CloseXMLTagsInUnfinishedFileL();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestReportSettings& aTestReportSettings: in: Report settings
+                const TTestReportMode aReportMode: in: Report mode
+    
+    Return Values: CTestReport* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestReport* CTestReport::NewL( CTestReportSettings& aTestReportSettings,
+                                const TTestReportMode aReportMode )
+    {
+    CTestReport* self = new ( ELeave ) CTestReport( aReportMode );
+    CleanupStack::PushL( self );
+    self->ConstructL( aTestReportSettings );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: ~CTestReport
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestReport::~CTestReport()
+    {
+    iTestModulesVersionsInfo.ResetAndDestroy();
+    iTestModulesVersionsInfo.Close();
+        
+    // Reset and destroy arrays
+    iTestSummaries.ResetAndDestroy();
+    delete iTotalSummary;
+    if( iOutput != CStifLogger::ERDebug )
+        {
+        // Delete file
+        iFile.Close();
+        iFs.Close();
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: AddTestCaseResultL
+
+    Description: Add new test case result.
+
+    Parameters: const TTestInfo& aTestInfo: in: TTestInfo: Test info
+                const TFullTestResult& aTestResult: in: TTestResult: Testresult
+                const TInt aError: in: Symbian OS error: Additional error code
+
+    Return Values: None
+
+    Errors/Exceptions: Leave is iReportGenerated is generated
+                       Leave if summary creation fails
+                       Leave if summary adding fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::AddTestCaseResultL( const TTestInfo& aTestInfo,
+                                        const TFullTestResult& aTestResult,
+                                        const TInt aError )
+    {
+    // Create summary for this test case
+    TTestCaseSummary summary;
+    
+    summary.iTestInfo = aTestInfo;
+    summary.iFullTestResult = aTestResult;
+
+    TBool passed( EFalse );
+    TBool crashed( EFalse );
+    TBool timeout( EFalse );
+    if( ( aError == KErrNone ) && 
+         ( summary.iFullTestResult.iCaseExecutionResultType == TFullTestResult::ECaseExecuted ) &&
+         ( KErrNone == summary.iFullTestResult.iTestResult.iResult ) )
+        {
+        passed = ETrue;
+        }
+    else if( summary.iFullTestResult.iCaseExecutionResultType == TFullTestResult::ECaseTimeout )
+        {
+        timeout = ETrue;
+        }
+    else if( ( summary.iFullTestResult.iCaseExecutionResultCode != KErrNone )
+    		|| ( summary.iFullTestResult.iCaseExecutionResultType == TFullTestResult::ECasePanic )
+    		|| ( summary.iFullTestResult.iCaseExecutionResultType == TFullTestResult::ECaseException ) )
+        {
+        crashed = ETrue;
+        }
+
+    if ( iReportMode & ETestReportCases )
+        {
+        // Print summary to file
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCaseTag);
+            WriteLineL(_L("%S%S%S"), &KXMLModuleNameTag, &summary.iTestInfo.iModuleName, &KXMLModuleNameTagEnd);
+            if(summary.iTestInfo.iConfig != KNullDesC)
+                {
+                WriteLineL(_L("%S%S%S"), &KXMLConfigFileTag, &summary.iTestInfo.iConfig, &KXMLConfigFileTagEnd);
+                }
+            WriteLineL(_L("%S%d%S"), &KXMLCaseNumberTag, summary.iTestInfo.iTestCaseInfo.iCaseNumber, &KXMLCaseNumberTagEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLCaseTitleTag, &summary.iTestInfo.iTestCaseInfo.iTitle, &KXMLCaseTitleTagEnd);
+            }
+        else
+            {
+            WriteLineL( _L("[%S][%S][%d] Title:[%S]"),
+                &summary.iTestInfo.iModuleName,
+                &summary.iTestInfo.iConfig,
+                summary.iTestInfo.iTestCaseInfo.iCaseNumber,
+                &summary.iTestInfo.iTestCaseInfo.iTitle );
+            }
+
+        const TInt KTimeFieldLength = 30;
+        TBuf<KTimeFieldLength> startTime;
+        TBuf<KTimeFieldLength> endTime;
+        _LIT(KDateString4,"%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B");
+        summary.iFullTestResult.iStartTime.FormatL(
+            startTime,KDateString4 );
+        summary.iFullTestResult.iEndTime.FormatL(
+            endTime,KDateString4 );
+            
+        // Result description needs max length 0x80(Must be same as
+        // TResultDes length) + specific characters see below.
+        TBuf<KMaxReportData> printBuf2;
+        TInt code = CStifLogger::ENoStyle;
+        if( ( summary.iFullTestResult.iCaseExecutionResultType 
+        	!= TFullTestResult::ECasePanic ) &&
+        	( summary.iFullTestResult.iCaseExecutionResultCode 
+            == KErrNone ) )
+            {
+            printBuf2.AppendFormat( _L("\tResult: %d [%S]"),
+                summary.iFullTestResult.iTestResult.iResult,
+                &summary.iFullTestResult.iTestResult.iResultDes );
+
+            if ( KErrNone == 
+                 summary.iFullTestResult.iTestResult.iResult )
+                {
+                printBuf2.AppendFormat( _L(" ==> PASSED"));
+                }
+            else
+                {
+                code = CStifLogger::ERed;
+                printBuf2.AppendFormat( _L(" ==> FAILED"));
+                }
+            }
+        else
+            {
+            code = CStifLogger::ERed;
+            printBuf2.AppendFormat( _L("\tCaseExecutionResult: %S with %d"),
+                &summary.iFullTestResult.iTestResult.iResultDes,
+                summary.iFullTestResult.iCaseExecutionResultCode );
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S%S%S"), &KXMLStartTimeTag, &startTime, &KXMLStartTimeTagEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLEndTimeTag, &endTime, &KXMLEndTimeTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLTestResultTag, summary.iFullTestResult.iTestResult.iResult, &KXMLTestResultTagEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLResultDescrTag, &summary.iFullTestResult.iTestResult.iResultDes, &KXMLResultDescrTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLExecutionResultTag, summary.iFullTestResult.iCaseExecutionResultCode, &KXMLExecutionResultTagEnd);
+            }
+        else
+            {
+            WriteLineL( _L("\tStartTime: %S, EndTime: %S"),
+                &startTime,
+                &endTime );
+            WriteLineL( printBuf2, code );
+            WriteDelimiterL( _L( "- " ), 10 );
+            WriteLineL( _L( "" ) );
+            }
+        }
+        
+    // Add test summary
+    // Check if the module already exists for this test case
+    TTestSummary* moduleSummary = NULL;
+    TInt count = iTestSummaries.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if ( iTestSummaries[i]->iName == aTestInfo.iModuleName )
+            {
+            moduleSummary = iTestSummaries[i];
+            break;
+            }
+        }
+    
+    if( moduleSummary == NULL )
+        {
+        // Create new module array
+        moduleSummary = new ( ELeave ) TTestSummary( aTestInfo.iModuleName );
+        User::LeaveIfError( iTestSummaries.Append( moduleSummary ) );
+        }
+
+    if( passed )
+        {
+        moduleSummary->iPassedCases++;
+        iTotalSummary->iPassedCases++;
+        if(iXML && (iReportMode & ETestReportCases))
+            {
+            WriteLineL(_L("%SPASSED%S"), &KXMLResultTag, &KXMLResultTagEnd);
+            }
+        }
+    else if( timeout )
+        {
+        moduleSummary->iTimeoutCases++;
+        iTotalSummary->iTimeoutCases++;
+        if(iXML && (iReportMode & ETestReportCases))
+            {
+            WriteLineL(_L("%STIMEOUT%S"), &KXMLResultTag, &KXMLResultTagEnd);
+            }
+        }
+    else if( crashed ||
+           ( aError != KErrNone ) )
+        {
+        moduleSummary->iCrashedCases++;
+        iTotalSummary->iCrashedCases++;
+        if(iXML && (iReportMode & ETestReportCases))
+            {
+            WriteLineL(_L("%SCRASHED%S"), &KXMLResultTag, &KXMLResultTagEnd);
+            }
+        }
+    else
+        {
+        moduleSummary->iFailedCases++;
+        iTotalSummary->iFailedCases++;
+        if(iXML && (iReportMode & ETestReportCases))
+            {
+            WriteLineL(_L("%SFAILED%S"), &KXMLResultTag, &KXMLResultTagEnd);
+            }
+        }
+
+    if(iXML && (iReportMode & ETestReportCases))
+        {
+        WriteLineL(_L("%S"), &KXMLTestCaseTagEnd);
+        }
+
+    // Add temporarily closing tags to keep valid xml structure
+    CloseXMLTagsInUnfinishedFileL();
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: WriteHeaderL
+
+    Description: Write test report header.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::WriteHeaderL()
+    {
+    if( ( iFormat == CStifLogger::EHtml ) && 
+        ( iOutput == CStifLogger::EFile ) )
+        {        
+        // Html start tags to whole page and header section
+        iFile.Write(
+            _L8( "\n<html>\n<head>\n<title>TestReport</title>\n</head>\n\n\n<body>\n" ) );
+        }
+    
+    if(iXML)
+        {
+        WriteLineL(_L("<?xml version=\"1.0\" ?>"));
+        WriteLineL(_L("%S"), &KXMLTestReportTag);            
+        }
+    else
+        {
+        WriteDelimiterL( _L( "***" ), 25 );
+        }
+
+    // Generate date and time
+    TTime time;
+    time.HomeTime();
+    TBuf<30> date;
+    TBuf<30> clock;
+    // Date
+    _LIT( KDate, "%E%D%X%N%Y %1 %2 %3" );
+    time.FormatL( date, KDate );
+    // Time
+    _LIT( KClock,"%-B%:0%J%:1%T%:2%S%:3%+B" );
+    time.FormatL( clock,KClock );
+    // Add date and time
+    if(iXML)
+        {
+        WriteLineL(_L("%S%S%S"), &KXMLDateTag, &date, &KXMLDateTagEnd);
+        WriteLineL(_L("%S%S%S"), &KXMLTimeTag, &clock, &KXMLTimeTagEnd);
+        }
+    else
+        {
+        WriteLineL( _L( "%S" ), &date );
+        WriteLineL( _L( "%S" ), &clock );
+        }
+    
+    if ( iReportMode & ETestReportSummary )
+        {
+        if( iOutput == CStifLogger::EFile )
+            {
+            // Get current file position
+            iSummaryPos = 0;
+            User::LeaveIfError( iFile.Seek( ESeekCurrent, iSummaryPos ) );
+            }
+        // Generate Summary to Report
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTag);
+            WriteLineL(_L("%S%S%S"), &KXMLPassedTag, &KXMLPassedTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLFailedTag, &KXMLFailedTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLTimeoutedTag, &KXMLTimeoutedTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLCrashedTag, &KXMLCrashedTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S%S%S"), &KXMLTotalTag, &KXMLTotalTagEnd, &KSummaryLineEnd);
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTagEnd);
+            }
+        else
+            {
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL(_L("SUMMARY:") );
+            WriteLineL(_L("\tPassed cases: %S"), &KSummaryLineEnd );
+            WriteLineL(_L("\tFailed cases: %S"), &KSummaryLineEnd );
+            WriteLineL(_L("\tTimeout cases: %S"), &KSummaryLineEnd );
+            WriteLineL(_L("\tCrashed cases: %S"), &KSummaryLineEnd );
+            WriteLineL(_L("\tTotal cases: %S"), &KSummaryLineEnd );
+            WriteLineL( _L( "" ));
+            }   
+        }
+
+    if ( iReportMode & ETestReportEnvironment )
+        {
+        const TInt KMegaByte = 1024*1024;
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLEnvironmentInfoTag);
+            WriteLineL(_L("%S"), &KXMLHardwareInfoTag);
+            WriteLineL(_L("%S0x%x%S"), &KXMLManufacturerTag, iReportHWInfo.iHwInfo.iManufacturer, &KXMLManufacturerTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLMachineUidTag, iReportHWInfo.iHwInfo.iMachineUid, &KXMLMachineUidTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLModelTag, iReportHWInfo.iHwInfo.iModel, &KXMLModelTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLHwRevisionTag, iReportHWInfo.iHwInfo.iHwRev, &KXMLHwRevisionTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLCpuTag, iReportHWInfo.iHwInfo.iCpu, &KXMLCpuTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLCpuSpeedTag, iReportHWInfo.iHwInfo.iCpuSpeed/1000, &KXMLCpuSpeedTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLLanguageTag, iReportHWInfo.iHwInfo.iLanguage, &KXMLLanguageTagEnd);
+            WriteLineL(_L("%S"), &KXMLHardwareInfoTagEnd);
+            WriteLineL(_L("%S"), &KXMLSoftwareInfoTag);
+            WriteLineL(_L("%S0x%x%S"), &KXMLSwRevisionTag, iReportHWInfo.iSwInfo.iSwRev, &KXMLSwRevisionTagEnd);
+            WriteLineL(_L("%S0x%x%S"), &KXMLSwBuildTag, iReportHWInfo.iSwInfo.iSwBuild, &KXMLSwBuildTagEnd);
+            WriteLineL(_L("%S"), &KXMLSoftwareInfoTagEnd);
+            WriteLineL(_L("%S"), &KXMLMemoryInfoTag);
+            WriteLineL(_L("%S%d%S"), &KXMLRamTag, iReportHWInfo.iMemoryInfo.iRAM/KMegaByte, &KXMLRamTagEnd);
+            WriteLineL(_L("%S%d%S"), &KXMLRamFreeTag, iReportHWInfo.iMemoryInfo.iRAMFree/KMegaByte, &KXMLRamFreeTagEnd);
+            WriteLineL(_L("%S"), &KXMLMemoryInfoTagEnd);            
+            WriteLineL(_L("%S"), &KXMLEnvironmentInfoTagEnd);            
+            }
+        else
+            {
+            // HW Info
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL( _L("ENVIRONMENT INFO:") );
+            WriteLineL( _L("HW Info:") );
+    
+            WriteLineL(
+                _L("\tManufacturer: 0x%x, MachineUid: 0x%x, Model: 0x%x "),
+                    iReportHWInfo.iHwInfo.iManufacturer,
+                    iReportHWInfo.iHwInfo.iMachineUid,
+                    iReportHWInfo.iHwInfo.iModel );
+            WriteLineL(
+                _L("\tHW Rev: 0x%x, CPU: 0x%x, CPU Speed: %d MHz "),
+                    iReportHWInfo.iHwInfo.iHwRev,
+                    iReportHWInfo.iHwInfo.iCpu,
+                    iReportHWInfo.iHwInfo.iCpuSpeed/1000 );
+            WriteLineL(_L("\tLanguage: %d "),
+                iReportHWInfo.iHwInfo.iLanguage );
+    
+            // SW Info
+            WriteLineL(_L("SW Info:") );
+            WriteLineL(_L("\tSW Rev: 0x%x, SW Build: 0x%x"),
+                iReportHWInfo.iSwInfo.iSwRev,
+                iReportHWInfo.iSwInfo.iSwBuild );
+    
+            // Memory Info
+            WriteLineL(_L("Memory Info:") );
+            WriteLineL(_L("\tRAM: %d MB, RAM Free: %d MB"),
+                ( iReportHWInfo.iMemoryInfo.iRAM/KMegaByte ),
+                ( iReportHWInfo.iMemoryInfo.iRAMFree/KMegaByte ) );
+    
+            WriteLineL( _L( "" ) );
+            }
+        }
+        
+    if ( iReportMode & ETestReportCases )
+        {
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesTag);
+            }
+        else
+            {
+            // Generate Test Cases to Report
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL( _L("TESTCASE SUMMARY:") );
+            }
+        }
+
+    if ( iReportMode == ETestReportBlank )
+        {
+        if(!iXML)
+            {
+            WriteLineL( _L( "") );
+            WriteLineL( _L( "'Empty' configuration given in initialization file's [Engine_Defaults] section" ) );
+            WriteLineL( _L( "No test report created" ) );
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: WriteTrailerL
+
+    Description: Write test report trailer.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::WriteTrailerL()
+    {
+    if(iXML && (iReportMode & ETestReportCases))
+        {
+        WriteLineL(_L("%S"), &KXMLTestCasesTagEnd);
+        }
+
+    if ( iReportMode & ETestReportSummary )
+        {
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLModuleSummaryTag);            
+            }
+        else
+            {
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL(_L("TESTMODULE SUMMARIES:") );
+            }
+        // Generate module related reports
+        for ( TInt k = 0; k < iTestSummaries.Count(); k++ )
+            {
+            if(iXML)
+                {
+                WriteLineL(_L("%S"), &KXMLModuleTag);
+                WriteLineL(_L("%S%S%S"), &KXMLModuleNameTag, &iTestSummaries[k]->iName, &KXMLModuleNameTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLPassedTag, iTestSummaries[k]->iPassedCases, &KXMLPassedTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLFailedTag, iTestSummaries[k]->iFailedCases, &KXMLFailedTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLTimeoutedTag, iTestSummaries[k]->iTimeoutCases, &KXMLTimeoutedTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLCrashedTag, iTestSummaries[k]->iCrashedCases, &KXMLCrashedTagEnd);
+                WriteLineL(_L("%S%d%S"), &KXMLTotalTag, iTestSummaries[k]->iPassedCases + iTestSummaries[k]->iFailedCases + iTestSummaries[k]->iTimeoutCases + iTestSummaries[k]->iCrashedCases, &KXMLTotalTagEnd);
+                WriteLineL(_L("%S"), &KXMLModuleTagEnd);
+                }
+            else
+                {
+                WriteLineL(_L("Module: [%S]"),
+                    &iTestSummaries[k]->iName );
+                WriteLineL(_L("\tPassed cases: %d"),
+                    iTestSummaries[k]->iPassedCases );
+                WriteLineL(_L("\tFailed cases: %d"),
+                    iTestSummaries[k]->iFailedCases );
+                WriteLineL(_L("\tTimeout cases: %d"),
+                    iTestSummaries[k]->iTimeoutCases );
+                WriteLineL(_L("\tCrashed cases: %d"),
+                    iTestSummaries[k]->iCrashedCases );
+                TInt moduleTotal = iTestSummaries[k]->iPassedCases +
+                    iTestSummaries[k]->iFailedCases +
+                    iTestSummaries[k]->iTimeoutCases +
+                    iTestSummaries[k]->iCrashedCases;
+                WriteLineL(_L("\tTotal cases: %d"), moduleTotal );
+                WriteLineL( _L( "" ) );
+                }
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLModuleSummaryTagEnd);            
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLDllSummaryTag);            
+            }
+        else
+            {
+            WriteDelimiterL(_L( "-- " ), 25 );
+            WriteLineL(_L("TEST MODULES VERSIONS:"));
+            }
+
+        // Generate test module versions info
+        for( TInt i = 0; i < iTestModulesVersionsInfo.Count(); i++ )
+            {
+            TTestModuleVersionInfo* versionInfo = (TTestModuleVersionInfo*)iTestModulesVersionsInfo[i];
+            if(iXML)
+                {
+                WriteLineL(_L("%S"), &KXMLDllTag);
+                WriteLineL(_L("%S%S%S"), &KXMLFileNameTag, &(versionInfo->iTestModuleName), &KXMLFileNameTagEnd);
+                WriteLineL(_L("%S%d.%d.%d%S"), &KXMLVersionTag, versionInfo->iMajor, versionInfo->iMinor, versionInfo->iBuild, &KXMLVersionTagEnd);
+                WriteLineL(_L("%S"), &KXMLDllTagEnd);
+                }
+            else
+                {
+                WriteLineL(_L("%S %d.%d.%d"), &(versionInfo->iTestModuleName), versionInfo->iMajor, versionInfo->iMinor, versionInfo->iBuild);
+                }
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLDllSummaryTagEnd);            
+            }
+        }
+    
+    if(!iXML)
+        {
+        WriteLineL( _L( "" ) );
+        }
+    
+    if( ( iFormat == CStifLogger::EHtml ) && 
+        ( iOutput == CStifLogger::EFile ) )
+        {        
+        // Html start tags to whole page and header section
+        iFile.Write(
+            _L8( "\n\n\n</html>\n</body>\n\n\n" ) );
+        }
+
+    if(iXML)
+        {
+        WriteLineL(_L("%S"), &KXMLTestReportTagEnd);            
+        }
+    }
+            
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: UpdateReportSummaryL
+
+    Description: Updates the test report summary.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::UpdateReportSummaryL()
+    {
+    TInt currentPos = 0;
+    // Add numeric information to summary
+    if ( iReportMode & ETestReportSummary )
+        {
+        // Go to the summary start position of the file
+        if( iOutput == CStifLogger::EFile )
+            {
+            User::LeaveIfError(iFile.Seek(ESeekCurrent, currentPos));//Get current position
+            User::LeaveIfError( iFile.Seek( ESeekStart, iSummaryPos ) );
+            }
+        TBuf<KSummaryLineEndLen> numStr;        
+        // Generate Summary to Report
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTag);
+            }
+        else
+            {
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL(_L("SUMMARY:") );
+            }
+        numStr.Num( iTotalSummary->iPassedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLPassedTag, &numStr, &KXMLPassedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tPassed cases: %S"), &numStr );
+            }
+        
+        numStr.Num( iTotalSummary->iFailedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLFailedTag, &numStr, &KXMLFailedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tFailed cases: %S"), &numStr );
+            }
+            
+        numStr.Num( iTotalSummary->iTimeoutCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLTimeoutedTag, &numStr, &KXMLTimeoutedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tTimeout cases: %S"), &numStr );
+            }
+        
+        numStr.Num( iTotalSummary->iCrashedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLCrashedTag, &numStr, &KXMLCrashedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tCrashed cases: %S"), &numStr );
+            }
+        
+        TInt total = iTotalSummary->iPassedCases +
+            iTotalSummary->iFailedCases +
+            iTotalSummary->iTimeoutCases +
+            iTotalSummary->iCrashedCases;
+        numStr.Num( total );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLTotalTag, &numStr, &KXMLTotalTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tTotal cases: %S"), &numStr );
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTagEnd);
+            }
+
+        if(iOutput == CStifLogger::EFile)
+            {
+            User::LeaveIfError(iFile.Seek(ESeekStart, currentPos));
+            }
+        }
+    }
+            
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: GenerateReportL
+
+    Description: Generate the test report.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::GenerateReportL()
+    {
+    WriteTrailerL();
+    
+    // Add numeric information to summary
+    if ( iReportMode & ETestReportSummary )
+        {
+        // Go to the summary start position of the file
+        if( iOutput == CStifLogger::EFile )
+            {
+            User::LeaveIfError( iFile.Seek( ESeekStart, iSummaryPos ) );
+            }
+        TBuf<KSummaryLineEndLen> numStr;
+        // Generate Summary to Report
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTag);
+            }
+        else
+            {
+            WriteDelimiterL( _L( "-- " ), 25 );
+            WriteLineL(_L("SUMMARY:") );
+            }
+
+        numStr.Num( iTotalSummary->iPassedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLPassedTag, &numStr, &KXMLPassedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tPassed cases: %S"), &numStr );
+            }
+
+        numStr.Num( iTotalSummary->iFailedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLFailedTag, &numStr, &KXMLFailedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tFailed cases: %S"), &numStr );
+            }
+        
+        numStr.Num( iTotalSummary->iTimeoutCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLTimeoutedTag, &numStr, &KXMLTimeoutedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tTimeout cases: %S"), &numStr );
+            }
+        
+        numStr.Num( iTotalSummary->iCrashedCases );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLCrashedTag, &numStr, &KXMLCrashedTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tCrashed cases: %S"), &numStr );
+            }
+        
+        TInt total = iTotalSummary->iPassedCases +
+            iTotalSummary->iFailedCases +
+            iTotalSummary->iTimeoutCases +
+            iTotalSummary->iCrashedCases;
+        numStr.Num( total );
+        if(iXML)
+            {
+            TPtrC spaces(KSummaryLineEnd().Ptr(), KSummaryLineEnd().Length() - numStr.Length());
+            WriteLineL(_L("%S%S%S%S"), &KXMLTotalTag, &numStr, &KXMLTotalTagEnd, &spaces);
+            }
+        else
+            {
+            numStr.Append( KSummaryLineEnd().Ptr(), 
+                           KSummaryLineEnd().Length() - numStr.Length() );
+            WriteLineL(_L("\tTotal cases: %S"), &numStr );
+            }
+
+        if(iXML)
+            {
+            WriteLineL(_L("%S"), &KXMLTestCasesSummaryTagEnd);
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: WriteLine
+
+    Description: Write line to file.
+
+    Parameters: TRefByValue<const TDesC> aStr: in: test to print
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::WriteLineL( TRefByValue<const TDesC> aStr,... )
+    {
+    
+    VA_LIST list;
+    VA_START( list, aStr );
+    TPrintInfo line;
+
+    // Parse parameters
+    line.AppendFormatList( aStr, list, NULL );
+    
+    if( iOutput == CStifLogger::ERDebug )
+        {
+        // RDebug output
+        RDebug::Print( line );
+        return;
+        }
+    
+    HBufC8* buf = HBufC8::NewLC( line.Length() + KMaxLenEol );
+    TPtr8 ptr( buf->Des() );
+    ptr.Copy( line );    
+            
+    if( ( iFormat == CStifLogger::EHtml ) && 
+        ( iOutput == CStifLogger::EFile ) )
+        {
+        // Html output, add linefeed
+        ptr.Append( _L8("<BR>\r\n") );
+        }
+    else 
+        {
+        // Default: Text format to file
+        // Add linefeed
+        ptr.Append( _L8("\r\n") );
+        }
+    
+    // Write to file    
+    iFile.Write( ptr );
+    CleanupStack::PopAndDestroy( buf );
+    
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: WriteDelimiter
+
+    Description: Write delimiter line to file.
+
+    Parameters: const TDesC& aDelimiter: in: delimiter mark
+                TInt aCount: in: number of delimiters written
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::WriteDelimiterL( const TDesC& aDelimiter, TInt aCount )
+    {
+    
+     if( iOutput == CStifLogger::ERDebug )
+        {
+        // RDebug output
+        // Nothing is printed
+        return;
+        }
+    
+    HBufC8* buf = HBufC8::NewLC( aDelimiter.Length() );
+    TPtr8 ptr( buf->Des() );
+    ptr.Copy( aDelimiter );    
+    
+    for( TInt i = 0; i<aCount; i++ )
+        {
+        // Write to file    
+        iFile.Write( ptr );
+        }
+    CleanupStack::PopAndDestroy( buf );
+    
+    TBuf8<KMaxLenEol> linefeed;        
+    if( ( iFormat == CStifLogger::EHtml ) && 
+        ( iOutput == CStifLogger::EFile ) )
+        {
+        // Html output, add linefeed
+        linefeed.Append( _L8("<BR>\r\n") );
+        }
+    else 
+        {
+        // Default: Text format to file
+        // Add linefeed
+        linefeed.Append( _L8("\r\n") );
+        }
+     // Write to file    
+    iFile.Write( linefeed );
+    
+    }        
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: TTestReportHeader::TTestReportHeader
+
+    Description: Constructor of TTestReportHeader
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestReport::TTestHWInfo::TTestHWInfo()
+    {
+    // Initialize, fills a specified block of data with binary zeroes
+    Mem::FillZ( this, sizeof( CTestReport::TTestHWInfo ) );
+
+    // Get HW Info
+    HAL::Get( HALData::EManufacturer, iHwInfo.iManufacturer );
+    HAL::Get( HALData::EMachineUid, iHwInfo.iMachineUid );
+    HAL::Get( HALData::EManufacturerHardwareRev, iHwInfo.iHwRev );
+    HAL::Get( HALData::EModel, iHwInfo.iModel );
+    HAL::Get( HALData::ECPU, iHwInfo.iCpu );
+    HAL::Get( HALData::ECPUSpeed, iHwInfo.iCpuSpeed );
+    HAL::Get( HALData::ELanguageIndex, iHwInfo.iLanguage );
+
+    // Get SW Info
+    HAL::Get( HALData::EManufacturerSoftwareRev, iSwInfo.iSwRev );
+    HAL::Get( HALData::EManufacturerSoftwareBuild, iSwInfo.iSwBuild );
+
+    // Memory Info
+    HAL::Get( HALData::EMemoryRAM, iMemoryInfo.iRAM );
+    HAL::Get( HALData::EMemoryRAMFree, iMemoryInfo.iRAMFree );
+
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: TTestSummary::TTestSummary
+
+    Description: Constructor of TTestSummary.
+
+    Parameters: const TName& aName: in: Name of summary
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestReport::TTestSummary::TTestSummary( const TName& aName ) :
+    iName( aName ),
+    iPassedCases( 0 ),
+    iFailedCases( 0 ),
+    iCrashedCases( 0 ),
+    iTimeoutCases( 0 )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+	Class: CTestReport
+
+    Method: AddTestModuleVersion
+    
+    Description: Method adds version of a test module to the list of versions
+    			 that will be printed when stif is stopped.
+    			 
+    Parameters: TTestModuleVersionInfo aVersion : object contains information about version and
+    			name of test module.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+-------------------------------------------------------------------------------
+*/
+
+void CTestReport::AddTestModuleVersion(TTestModuleVersionInfo& aVersion)
+	{
+	for(TInt i = 0; i < iTestModulesVersionsInfo.Count(); i++)
+		{
+		if( aVersion.iTestModuleName == iTestModulesVersionsInfo[i]->iTestModuleName )
+			{
+			return;
+			}
+		}
+	
+	TTestModuleVersionInfo* testModuleVersionInfo = new (ELeave) TTestModuleVersionInfo;
+	testModuleVersionInfo->iMajor = aVersion.iMajor;
+	testModuleVersionInfo->iMinor = aVersion.iMinor;
+	testModuleVersionInfo->iBuild = aVersion.iBuild;
+	testModuleVersionInfo->iTestModuleName = aVersion.iTestModuleName;
+	
+	TInt res = iTestModulesVersionsInfo.Append(testModuleVersionInfo);
+	if( res != KErrNone )
+		{
+		delete testModuleVersionInfo;
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: TTestCaseSummary::TTestCaseSummary
+
+    Description: Constructor of TTestCaseSummary.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestReport::TTestCaseSummary::TTestCaseSummary()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestReport
+
+    Method: CloseXMLTagsInUnfinishedFileL
+
+    Description: Adds needed tags to get valid xml file.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Seek operations may cause leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestReport::CloseXMLTagsInUnfinishedFileL(void)
+    {
+    // For xml file keep current position in file.
+    if(iXML)
+        {
+        TInt currentPos = 0;
+        User::LeaveIfError(iFile.Seek(ESeekCurrent, currentPos));
+        
+        // Add closing tags to get valid xml file
+        WriteLineL(_L("%S"), &KXMLTestCasesTagEnd);
+        WriteLineL(_L("%S"), &KXMLTestReportTagEnd);
+        
+        // Move back to previous position
+        User::LeaveIfError(iFile.Seek(ESeekStart, currentPos));
+        }
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testengine/src/Testcasetimeout.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,321 @@
+/*
+* 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: This module contains implementation of 
+* CTestCaseTimeout class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <hal.h>
+#include <StifLogger.h>
+#include "TestReport.h"
+#include "TestEngine.h"
+#include "TestEngineClientServer.h"
+#include "TestCaseController.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 =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseTimeout
+
+    Method: CTestCaseTimeout
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseTimeout::CTestCaseTimeout() : CActive (CActive::EPriorityStandard)
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseTimeout
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: 
+
+    Return Values: None
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseTimeout::ConstructL( CTestCaseController* aCase,
+                                   TTimeIntervalMicroSeconds aTimeout )
+    {
+    iCase = aCase;
+    iTimeout = aTimeout;  
+    iTimer.CreateLocal();
+
+	iTestCaseTimeout = 0;  // Initialize
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseTimeout
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: const TTestReportOutput aReportOutput: in: Report output type
+
+    Return Values: CTestCaseTimeout* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseTimeout* CTestCaseTimeout::NewL( CTestCaseController* aCase, 
+                                          TTimeIntervalMicroSeconds aTimeout )
+    {
+    CTestCaseTimeout* self = new ( ELeave ) CTestCaseTimeout();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCase, aTimeout );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseTimeout
+
+    Method: ~CTestCaseTimeout
+
+    Description: Destructor.
+
+    Cancel request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCaseTimeout::~CTestCaseTimeout()
+    {
+    Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseTimeout
+
+    Method: Start
+
+    Description: Start timeout counting
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseTimeout::Start()
+    {
+    // Add to active scheduler
+    CActiveScheduler::Add ( this );
+    SetActive();
+
+    // Request timer
+    TTime timeout;
+    timeout.HomeTime();
+    timeout = timeout + iTimeout;
+    
+    // Store absolute timeout
+    iTestCaseTimeout = timeout;
+
+    // Note: iTimer.After() method cannot use because there needed
+    // TTimeIntervalMicroSeconds32 and it is 32 bit. So then cannot create 
+    // timeout time that is long enough. At() uses 64 bit value=>Long enough.
+    iTimer.At( iStatus, timeout );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseTimeout
+
+    Method: RunL
+
+    Description: RunL handles completed timeouts.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseTimeout::RunL()
+    {
+    // Timeout
+	TTime timeout;
+	timeout.HomeTime();
+	// Handle the abort case when system time gets changed, but timeout is
+    // still valid. All other cases should timeout since they invalidate the
+    // logic of the timers.
+	if ( iStatus == KErrAbort)
+		{
+		if ( iTestCaseTimeout > timeout )
+			{  
+			RDebug::Print( _L( "Absolute timer still valid. Restaring timer. iStatus: %d" ), iStatus.Int() );
+			// Start new timer
+			iStatus = KErrNone; // reset value
+			iTimer.At ( iStatus, iTestCaseTimeout );  // restart timer
+			SetActive();
+			}
+		else
+			{
+			// Absolute timer no longer valid. Must timeout.
+			iCase->Timeout();
+			}
+
+		}
+	else
+		{
+		// Status was not KErrAbort. Timing out!
+		iCase->Timeout();
+		}
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseTimeout
+
+    Method: DoCancel
+
+    Description: Cancel active request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCaseTimeout::DoCancel()
+    {
+    iTimer.Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCaseTimeout
+
+    Method: RunError
+
+    Description: Handle errors. Just let framework handle errors because
+    RunL does not leave.
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+
+    Return Values: TInt: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCaseTimeout::RunError( TInt aError )
+    {
+    return aError;
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/BMARM/STIFTESTINTERFACEU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,122 @@
+EXPORTS
+	__9TTestInfo @ 1 NONAME R3UNUSED ; TTestInfo::TTestInfo(void)
+	Append__14CStifTFwIfProtPFi_7TPtrC16i @ 2 NONAME R3UNUSED ; CStifTFwIfProt::Append(TPtrC16 (*)(int), int)
+	Append__14CStifTFwIfProtPFi_7TPtrC16iRC7TDesC16 @ 3 NONAME ; CStifTFwIfProt::Append(TPtrC16 (*)(int), int, TDesC16 const &)
+	Append__14CStifTFwIfProtPFi_7TPtrC16iT1i @ 4 NONAME ; (null)
+	Append__14CStifTFwIfProtPFi_7TPtrC16ii @ 5 NONAME ; CStifTFwIfProt::Append(TPtrC16 (*)(int), int, int)
+	Append__14CStifTFwIfProtRC7TDesC16 @ 6 NONAME R3UNUSED ; CStifTFwIfProt::Append(TDesC16 const &)
+	CallTestClass__11CScriptBaseRC7TDesC16 @ 7 NONAME R3UNUSED ; CScriptBase::CallTestClass(TDesC16 const &)
+	CancelEvent__13CTestModuleIfR8TEventIfP14TRequestStatus @ 8 NONAME R3UNUSED ; CTestModuleIf::CancelEvent(TEventIf &, TRequestStatus *)
+	CancelSignal__11CScriptBase @ 9 NONAME R3UNUSED ; CScriptBase::CancelSignal(void)
+	CheckAllowResult__13CTestModuleIfi @ 10 NONAME R3UNUSED ; CTestModuleIf::CheckAllowResult(int)
+	CmdType__14CStifTFwIfProti @ 11 NONAME R3UNUSED ; CStifTFwIfProt::CmdType(int)
+	CreateL__14CStifTFwIfProti @ 12 NONAME R3UNUSED ; CStifTFwIfProt::CreateL(int)
+	CreationResult__11CStifLogger @ 13 NONAME R3UNUSED ; CStifLogger::CreationResult(void)
+	DstDevId__14CStifTFwIfProt @ 14 NONAME R3UNUSED ; CStifTFwIfProt::DstDevId(void)
+	DstId__14CStifTFwIfProt @ 15 NONAME R3UNUSED ; CStifTFwIfProt::DstId(void)
+	DstTestId__14CStifTFwIfProt @ 16 NONAME R3UNUSED ; CStifTFwIfProt::DstTestId(void)
+	EnableSignal__11CScriptBaseR14TRequestStatus @ 17 NONAME R3UNUSED ; CScriptBase::EnableSignal(TRequestStatus &)
+	EventStatusParams__14CStifTFwIfProti @ 18 NONAME R3UNUSED ; CStifTFwIfProt::EventStatusParams(int)
+	EventStatus__14CStifTFwIfProti @ 19 NONAME R3UNUSED ; CStifTFwIfProt::EventStatus(int)
+	EventType__14CStifTFwIfProti @ 20 NONAME R3UNUSED ; CStifTFwIfProt::EventType(int)
+	Event__13CTestModuleIfR8TEventIf @ 21 NONAME R3UNUSED ; CTestModuleIf::Event(TEventIf &)
+	Event__13CTestModuleIfR8TEventIfR14TRequestStatus @ 22 NONAME R3UNUSED ; CTestModuleIf::Event(TEventIf &, TRequestStatus &)
+	GetChar__15CStifItemParserRC7TDesC16R5TChar @ 23 NONAME R3UNUSED ; CStifItemParser::GetChar(TDesC16 const &, TChar &)
+	GetInt__15CStifItemParserRC7TDesC16RUi6TRadix @ 24 NONAME ; CStifItemParser::GetInt(TDesC16 const &, unsigned int &, TRadix)
+	GetInt__15CStifItemParserRC7TDesC16Ri @ 25 NONAME R3UNUSED ; CStifItemParser::GetInt(TDesC16 const &, int &)
+	GetItemLineL__18CStifSectionParserRC7TDesC1617TTagToReturnValue @ 26 NONAME R3UNUSED ; CStifSectionParser::GetItemLineL(TDesC16 const &, TTagToReturnValue)
+	GetLine__18CStifSectionParserRC7TDesC16R7TPtrC1617TTagToReturnValue @ 27 NONAME ; CStifSectionParser::GetLine(TDesC16 const &, TPtrC16 &, TTagToReturnValue)
+	GetMeasurementOptions__13CTestModuleIfRi @ 28 NONAME R3UNUSED ; CTestModuleIf::GetMeasurementOptions(int &)
+	GetNextChar__15CStifItemParserR5TChar @ 29 NONAME R3UNUSED ; CStifItemParser::GetNextChar(TChar &)
+	GetNextChar__15CStifItemParserRC7TDesC16R5TChar @ 30 NONAME R3UNUSED ; CStifItemParser::GetNextChar(TDesC16 const &, TChar &)
+	GetNextInt__15CStifItemParserRC7TDesC16RUi6TRadix @ 31 NONAME ; CStifItemParser::GetNextInt(TDesC16 const &, unsigned int &, TRadix)
+	GetNextInt__15CStifItemParserRC7TDesC16Ri @ 32 NONAME R3UNUSED ; CStifItemParser::GetNextInt(TDesC16 const &, int &)
+	GetNextInt__15CStifItemParserRUi6TRadix @ 33 NONAME R3UNUSED ; CStifItemParser::GetNextInt(unsigned int &, TRadix)
+	GetNextInt__15CStifItemParserRi @ 34 NONAME R3UNUSED ; CStifItemParser::GetNextInt(int &)
+	GetNextItemLineL__18CStifSectionParser @ 35 NONAME R3UNUSED ; CStifSectionParser::GetNextItemLineL(void)
+	GetNextItemLineL__18CStifSectionParserRC7TDesC1617TTagToReturnValue @ 36 NONAME R3UNUSED ; CStifSectionParser::GetNextItemLineL(TDesC16 const &, TTagToReturnValue)
+	GetNextLine__18CStifSectionParserR7TPtrC16 @ 37 NONAME R3UNUSED ; CStifSectionParser::GetNextLine(TPtrC16 &)
+	GetNextLine__18CStifSectionParserRC7TDesC16R7TPtrC1617TTagToReturnValue @ 38 NONAME ; CStifSectionParser::GetNextLine(TDesC16 const &, TPtrC16 &, TTagToReturnValue)
+	GetNextString__15CStifItemParserR7TPtrC16 @ 39 NONAME R3UNUSED ; CStifItemParser::GetNextString(TPtrC16 &)
+	GetNextString__15CStifItemParserRC7TDesC16R7TPtrC16 @ 40 NONAME R3UNUSED ; CStifItemParser::GetNextString(TDesC16 const &, TPtrC16 &)
+	GetPosition__18CStifSectionParser @ 41 NONAME R3UNUSED ; CStifSectionParser::GetPosition(void)
+	GetStoredState__13CTestModuleIfRiRt4TBuf1i128 @ 42 NONAME R3UNUSED ; CTestModuleIf::GetStoredState(int &, TBuf<128> &)
+	GetString__15CStifItemParserRC7TDesC16R7TPtrC16 @ 43 NONAME R3UNUSED ; CStifItemParser::GetString(TDesC16 const &, TPtrC16 &)
+	GetTestObject__11CScriptBaseRC7TDesC16 @ 44 NONAME R3UNUSED ; CScriptBase::GetTestObject(TDesC16 const &)
+	Log__11CStifLoggerGt11TRefByValue1ZC6TDesC8e @ 45 NONAME ; CStifLogger::Log(TRefByValue<TDesC8 const>,...)
+	Log__11CStifLoggerGt11TRefByValue1ZC7TDesC16e @ 46 NONAME ; CStifLogger::Log(TRefByValue<TDesC16 const>,...)
+	Log__11CStifLoggerRC6TDesC8 @ 47 NONAME R3UNUSED ; CStifLogger::Log(TDesC8 const &)
+	Log__11CStifLoggerRC7TDesC16 @ 48 NONAME R3UNUSED ; CStifLogger::Log(TDesC16 const &)
+	Log__11CStifLoggeriGt11TRefByValue1ZC6TDesC8e @ 49 NONAME ; CStifLogger::Log(int, TRefByValue<TDesC8 const>,...)
+	Log__11CStifLoggeriGt11TRefByValue1ZC7TDesC16e @ 50 NONAME ; CStifLogger::Log(int, TRefByValue<TDesC16 const>,...)
+	Log__11CStifLoggeriRC6TDesC8 @ 51 NONAME R3UNUSED ; CStifLogger::Log(int, TDesC8 const &)
+	Log__11CStifLoggeriRC7TDesC16 @ 52 NONAME R3UNUSED ; CStifLogger::Log(int, TDesC16 const &)
+	MsgType__14CStifTFwIfProti @ 53 NONAME R3UNUSED ; CStifTFwIfProt::MsgType(int)
+	NewL__11CStifLoggerRC7TDesC16T1Q211CStifLogger11TLoggerTypeQ211CStifLogger7TOutputiiiiiiii @ 54 NONAME ; CStifLogger::NewL(TDesC16 const &, TDesC16 const &, CStifLogger::TLoggerType, CStifLogger::TOutput, int, int, int, int, int, int, int, int)
+	NewL__11CStifLoggerRC7TDesC16T1R15TLoggerSettings @ 55 NONAME R3UNUSED ; CStifLogger::NewL(TDesC16 const &, TDesC16 const &, TLoggerSettings &)
+	NewL__11CStifParserRC7TDesC16Q211CStifParser12TCommentType @ 56 NONAME R3UNUSED ; CStifParser::NewL(TDesC16 const &, CStifParser::TCommentType)
+	NewL__11CStifParserRC7TDesC16T1Q211CStifParser12TCommentType @ 57 NONAME R3UNUSED ; CStifParser::NewL(TDesC16 const &, TDesC16 const &, CStifParser::TCommentType)
+	NewL__13CTestModuleIfP20CTestThreadContainerP15CTestModuleBase @ 58 NONAME R3UNUSED ; CTestModuleIf::NewL(CTestThreadContainer *, CTestModuleBase *)
+	NewL__14CStifTFwIfProt @ 59 NONAME R3UNUSED ; CStifTFwIfProt::NewL(void)
+	NewL__15CStifItemParserG7TPtrC16ii @ 60 NONAME ; CStifItemParser::NewL(TPtrC16, int, int)
+	NewL__20CSTIFTestMeasurementP15CTestModuleBaseQ220CSTIFTestMeasurement20TSTIFMeasurementTypeRC7TDesC16 @ 61 NONAME R3UNUSED ; CSTIFTestMeasurement::NewL(CTestModuleBase *, CSTIFTestMeasurement::TSTIFMeasurementType, TDesC16 const &)
+	NewL__21CTestModuleParamVer01 @ 62 NONAME R3UNUSED ; CTestModuleParamVer01::NewL(void)
+	NewL__21MSTIFTestInterferenceP15CTestModuleBaseQ221MSTIFTestInterference29TStifTestInterferenceCategory @ 63 NONAME R3UNUSED ; MSTIFTestInterference::NewL(CTestModuleBase *, MSTIFTestInterference::TStifTestInterferenceCategory)
+	NextSectionL__11CStifParserRC7TDesC16T1i @ 64 NONAME ; CStifParser::NextSectionL(TDesC16 const &, TDesC16 const &, int)
+	NextSubSectionL__18CStifSectionParserRC7TDesC16T1i @ 65 NONAME ; CStifSectionParser::NextSubSectionL(TDesC16 const &, TDesC16 const &, int)
+	OutputType__11CStifLogger @ 66 NONAME R3UNUSED ; CStifLogger::OutputType(void)
+	ParsingType__15CStifItemParser @ 67 NONAME R3UNUSED ; CStifItemParser::ParsingType(void)
+	Printf__13CTestModuleIfiRC7TDesC16Gt11TRefByValue1ZC7TDesC16e @ 68 NONAME ; CTestModuleIf::Printf(int, TDesC16 const &, TRefByValue<TDesC16 const>,...)
+	Reboot__13CTestModuleIfi @ 69 NONAME R3UNUSED ; CTestModuleIf::Reboot(int)
+	Remainder__15CStifItemParserR7TPtrC16 @ 70 NONAME R3UNUSED ; CStifItemParser::Remainder(TPtrC16 &)
+	RemoteReceiveCancel__13CTestModuleIf @ 71 NONAME R3UNUSED ; CTestModuleIf::RemoteReceiveCancel(void)
+	RemoteReceive__13CTestModuleIfR6TDes16R14TRequestStatus @ 72 NONAME R3UNUSED ; CTestModuleIf::RemoteReceive(TDes16 &, TRequestStatus &)
+	RemoteSend__13CTestModuleIfRC7TDesC16 @ 73 NONAME R3UNUSED ; CTestModuleIf::RemoteSend(TDesC16 const &)
+	RemoteType__14CStifTFwIfProti @ 74 NONAME R3UNUSED ; CStifTFwIfProt::RemoteType(int)
+	ResetAllowResult__13CTestModuleIf @ 75 NONAME R3UNUSED ; CTestModuleIf::ResetAllowResult(void)
+	RespParam__14CStifTFwIfProti @ 76 NONAME R3UNUSED ; CStifTFwIfProt::RespParam(int)
+	ResultCategory__14CStifTFwIfProti @ 77 NONAME R3UNUSED ; CStifTFwIfProt::ResultCategory(int)
+	RunInternalL__11CScriptBasePC17TStifFunctionInfoiR15CStifItemParser @ 78 NONAME ; CScriptBase::RunInternalL(TStifFunctionInfo const *, int, CStifItemParser &)
+	RunParams__14CStifTFwIfProti @ 79 NONAME R3UNUSED ; CStifTFwIfProt::RunParams(int)
+	RunStatusParams__14CStifTFwIfProti @ 80 NONAME R3UNUSED ; CStifTFwIfProt::RunStatusParams(int)
+	RunStatus__14CStifTFwIfProti @ 81 NONAME R3UNUSED ; CStifTFwIfProt::RunStatus(int)
+	SaveData__11CStifLoggerR6TDesC8 @ 82 NONAME R3UNUSED ; CStifLogger::SaveData(TDesC8 &)
+	SaveData__11CStifLoggerR7TDesC16 @ 83 NONAME R3UNUSED ; CStifLogger::SaveData(TDesC16 &)
+	SectionL__11CStifParserRC7TDesC16T1i @ 84 NONAME ; CStifParser::SectionL(TDesC16 const &, TDesC16 const &, int)
+	SetAllowResult__13CTestModuleIfi @ 85 NONAME R3UNUSED ; CTestModuleIf::SetAllowResult(int)
+	SetBehavior__13CTestModuleIfQ213CTestModuleIf13TTestBehaviorPv @ 86 NONAME R3UNUSED ; CTestModuleIf::SetBehavior(CTestModuleIf::TTestBehavior, void *)
+	SetCmdType__14CStifTFwIfProtQ214CStifTFwIfProt8TCmdType @ 87 NONAME R3UNUSED ; CStifTFwIfProt::SetCmdType(CStifTFwIfProt::TCmdType)
+	SetDstId__14CStifTFwIfProtUl @ 88 NONAME R3UNUSED ; CStifTFwIfProt::SetDstId(unsigned long)
+	SetExitReason__13CTestModuleIfQ213CTestModuleIf11TExitReasoni @ 89 NONAME R3UNUSED ; CTestModuleIf::SetExitReason(CTestModuleIf::TExitReason, int)
+	SetL__14CStifTFwIfProtRC7TDesC16 @ 90 NONAME R3UNUSED ; CStifTFwIfProt::SetL(TDesC16 const &)
+	SetMsgType__14CStifTFwIfProtQ214CStifTFwIfProt8TMsgType @ 91 NONAME R3UNUSED ; CStifTFwIfProt::SetMsgType(CStifTFwIfProt::TMsgType)
+	SetParsingType__15CStifItemParserQ215CStifItemParser12TParsingType @ 92 NONAME R3UNUSED ; CStifItemParser::SetParsingType(CStifItemParser::TParsingType)
+	SetPosition__18CStifSectionParseri @ 93 NONAME R3UNUSED ; CStifSectionParser::SetPosition(int)
+	SetRespType__14CStifTFwIfProtQ214CStifTFwIfProt8TMsgType @ 94 NONAME R3UNUSED ; CStifTFwIfProt::SetRespType(CStifTFwIfProt::TMsgType)
+	SetResult__11TTestResultiRC7TDesC16 @ 95 NONAME R3UNUSED ; TTestResult::SetResult(int, TDesC16 const &)
+	SetScripter__11CScriptBasePFP13CTestScripter19TStifTSCallBackTypeRC7TDesC16_iP13CTestScripter @ 96 NONAME R3UNUSED ; CScriptBase::SetScripter(int (*)(CTestScripter *, TStifTSCallBackType, TDesC16 const &), CTestScripter *)
+	SetSrcId__14CStifTFwIfProtUl @ 97 NONAME R3UNUSED ; CStifTFwIfProt::SetSrcId(unsigned long)
+	Signal__11CScriptBasei @ 98 NONAME R3UNUSED ; CScriptBase::Signal(int)
+	SrcDevId__14CStifTFwIfProt @ 99 NONAME R3UNUSED ; CStifTFwIfProt::SrcDevId(void)
+	SrcId__14CStifTFwIfProt @ 100 NONAME R3UNUSED ; CStifTFwIfProt::SrcId(void)
+	SrcTestId__14CStifTFwIfProt @ 101 NONAME R3UNUSED ; CStifTFwIfProt::SrcTestId(void)
+	StartSession__Fv @ 102 NONAME R3UNUSED ; StartSession(void)
+	Start__20CSTIFTestMeasurement @ 103 NONAME R3UNUSED ; CSTIFTestMeasurement::Start(void)
+	StifMacroError__13CTestModuleIfiPCUcPCciiiiiii @ 104 NONAME ; CTestModuleIf::StifMacroError(int, unsigned char const *, char const *, int, int, int, int, int, int, int)
+	Stop__20CSTIFTestMeasurement @ 105 NONAME R3UNUSED ; CSTIFTestMeasurement::Stop(void)
+	StoreState__13CTestModuleIfiRt4TBuf1i128 @ 106 NONAME R3UNUSED ; CTestModuleIf::StoreState(int, TBuf<128> &)
+	SubSectionL__18CStifSectionParserRC7TDesC16T1i @ 107 NONAME ; CStifSectionParser::SubSectionL(TDesC16 const &, TDesC16 const &, int)
+	TestModuleIf__11CScriptBase @ 108 NONAME R3UNUSED ; CScriptBase::TestModuleIf(void)
+	WriteDelimiter__11CStifLoggerRC6TDesC8i @ 109 NONAME R3UNUSED ; CStifLogger::WriteDelimiter(TDesC8 const &, int)
+	WriteDelimiter__11CStifLoggerRC7TDesC16i @ 110 NONAME R3UNUSED ; CStifLogger::WriteDelimiter(TDesC16 const &, int)
+	"_._11CStifParser" @ 111 NONAME R3UNUSED ; CStifParser::~CStifParser(void)
+	"_._14CStifTFwIfProt" @ 112 NONAME R3UNUSED ; CStifTFwIfProt::~CStifTFwIfProt(void)
+	"_._21CTestModuleParamVer01" @ 113 NONAME R3UNUSED ; CTestModuleParamVer01::~CTestModuleParamVer01(void)
+	__11CScriptBaseR13CTestModuleIf @ 114 NONAME R3UNUSED ; CScriptBase::CScriptBase(CTestModuleIf &)
+	__11TTestResult @ 115 NONAME R3UNUSED ; TTestResult::TTestResult(void)
+	__13TTestCaseInfo @ 116 NONAME R3UNUSED ; TTestCaseInfo::TTestCaseInfo(void)
+	__13TTestProgress @ 117 NONAME R3UNUSED ; TTestProgress::TTestProgress(void)
+	__15TFullTestResult @ 118 NONAME R3UNUSED ; TFullTestResult::TFullTestResult(void)
+	__18TErrorNotification @ 119 NONAME R3UNUSED ; TErrorNotification::TErrorNotification(void)
+	AppendId__14CStifTFwIfProtUl @ 120 NONAME R3UNUSED ; CStifTFwIfProt::AppendId(unsigned long)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/BWINS/STIFTESTINTERFACEU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,168 @@
+EXPORTS
+	??0CScriptBase@@IAE@AAVCTestModuleIf@@@Z @ 1 NONAME ; CScriptBase::CScriptBase(class CTestModuleIf &)
+	??0TErrorNotification@@QAE@XZ @ 2 NONAME ; TErrorNotification::TErrorNotification(void)
+	??0TFullTestResult@@QAE@XZ @ 3 NONAME ; TFullTestResult::TFullTestResult(void)
+	??0TTestCaseInfo@@QAE@XZ @ 4 NONAME ; TTestCaseInfo::TTestCaseInfo(void)
+	??0TTestInfo@@QAE@XZ @ 5 NONAME ; TTestInfo::TTestInfo(void)
+	??0TTestProgress@@QAE@XZ @ 6 NONAME ; TTestProgress::TTestProgress(void)
+	??0TTestResult@@QAE@XZ @ 7 NONAME ; TTestResult::TTestResult(void)
+	??1CStifParser@@UAE@XZ @ 8 NONAME ; CStifParser::~CStifParser(void)
+	??1CStifTFwIfProt@@UAE@XZ @ 9 NONAME ; CStifTFwIfProt::~CStifTFwIfProt(void)
+	??1CTestModuleParamVer01@@UAE@XZ @ 10 NONAME ; CTestModuleParamVer01::~CTestModuleParamVer01(void)
+	?Append@CStifTFwIfProt@@QAEHABVTDesC16@@@Z @ 11 NONAME ; int CStifTFwIfProt::Append(class TDesC16 const &)
+	?Append@CStifTFwIfProt@@QAEHP6A?AVTPtrC16@@H@ZH0H@Z @ 12 NONAME ; int CStifTFwIfProt::Append(class TPtrC16 (*)(int), int, class TPtrC16 (*)(int), int)
+	?Append@CStifTFwIfProt@@QAEHP6A?AVTPtrC16@@H@ZH@Z @ 13 NONAME ; int CStifTFwIfProt::Append(class TPtrC16 (*)(int), int)
+	?Append@CStifTFwIfProt@@QAEHP6A?AVTPtrC16@@H@ZHABVTDesC16@@@Z @ 14 NONAME ; int CStifTFwIfProt::Append(class TPtrC16 (*)(int), int, class TDesC16 const &)
+	?Append@CStifTFwIfProt@@QAEHP6A?AVTPtrC16@@H@ZHH@Z @ 15 NONAME ; int CStifTFwIfProt::Append(class TPtrC16 (*)(int), int, int)
+	?AppendId@CStifTFwIfProt@@QAEHK@Z @ 16 NONAME ; int CStifTFwIfProt::AppendId(unsigned long)
+	?CallTestClass@CScriptBase@@QAEHABVTDesC16@@@Z @ 17 NONAME ; int CScriptBase::CallTestClass(class TDesC16 const &)
+	?CancelEvent@CTestModuleIf@@QAEHAAVTEventIf@@PAVTRequestStatus@@@Z @ 18 NONAME ; int CTestModuleIf::CancelEvent(class TEventIf &, class TRequestStatus *)
+	?CancelSignal@CScriptBase@@AAEXXZ @ 19 NONAME ; void CScriptBase::CancelSignal(void)
+	?CheckAllowResult@CTestModuleIf@@QAEHH@Z @ 20 NONAME ; int CTestModuleIf::CheckAllowResult(int)
+	?CmdType@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 21 NONAME ; class TPtrC16 CStifTFwIfProt::CmdType(int)
+	?CreateL@CStifTFwIfProt@@QAEXH@Z @ 22 NONAME ; void CStifTFwIfProt::CreateL(int)
+	?CreationResult@CStifLogger@@QAEHXZ @ 23 NONAME ; int CStifLogger::CreationResult(void)
+	?DstDevId@CStifTFwIfProt@@QAEGXZ @ 24 NONAME ; unsigned short CStifTFwIfProt::DstDevId(void)
+	?DstId@CStifTFwIfProt@@QAEKXZ @ 25 NONAME ; unsigned long CStifTFwIfProt::DstId(void)
+	?DstTestId@CStifTFwIfProt@@QAEGXZ @ 26 NONAME ; unsigned short CStifTFwIfProt::DstTestId(void)
+	?EnableSignal@CScriptBase@@AAEXAAVTRequestStatus@@@Z @ 27 NONAME ; void CScriptBase::EnableSignal(class TRequestStatus &)
+	?Event@CTestModuleIf@@QAEHAAVTEventIf@@@Z @ 28 NONAME ; int CTestModuleIf::Event(class TEventIf &)
+	?Event@CTestModuleIf@@QAEXAAVTEventIf@@AAVTRequestStatus@@@Z @ 29 NONAME ; void CTestModuleIf::Event(class TEventIf &, class TRequestStatus &)
+	?EventStatus@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 30 NONAME ; class TPtrC16 CStifTFwIfProt::EventStatus(int)
+	?EventStatusParams@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 31 NONAME ; class TPtrC16 CStifTFwIfProt::EventStatusParams(int)
+	?EventType@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 32 NONAME ; class TPtrC16 CStifTFwIfProt::EventType(int)
+	?GetChar@CStifItemParser@@QAEHABVTDesC16@@AAVTChar@@@Z @ 33 NONAME ; int CStifItemParser::GetChar(class TDesC16 const &, class TChar &)
+	?GetInt@CStifItemParser@@QAEHABVTDesC16@@AAH@Z @ 34 NONAME ; int CStifItemParser::GetInt(class TDesC16 const &, int &)
+	?GetInt@CStifItemParser@@QAEHABVTDesC16@@AAIW4TRadix@@@Z @ 35 NONAME ; int CStifItemParser::GetInt(class TDesC16 const &, unsigned int &, enum TRadix)
+	?GetItemLineL@CStifSectionParser@@QAEPAVCStifItemParser@@ABVTDesC16@@W4TTagToReturnValue@@@Z @ 36 NONAME ; class CStifItemParser * CStifSectionParser::GetItemLineL(class TDesC16 const &, enum TTagToReturnValue)
+	?GetLine@CStifSectionParser@@QAEHABVTDesC16@@AAVTPtrC16@@W4TTagToReturnValue@@@Z @ 37 NONAME ; int CStifSectionParser::GetLine(class TDesC16 const &, class TPtrC16 &, enum TTagToReturnValue)
+	?GetMeasurementOptions@CTestModuleIf@@QAEHAAH@Z @ 38 NONAME ; int CTestModuleIf::GetMeasurementOptions(int &)
+	?GetNextChar@CStifItemParser@@QAEHAAVTChar@@@Z @ 39 NONAME ; int CStifItemParser::GetNextChar(class TChar &)
+	?GetNextChar@CStifItemParser@@QAEHABVTDesC16@@AAVTChar@@@Z @ 40 NONAME ; int CStifItemParser::GetNextChar(class TDesC16 const &, class TChar &)
+	?GetNextInt@CStifItemParser@@QAEHAAH@Z @ 41 NONAME ; int CStifItemParser::GetNextInt(int &)
+	?GetNextInt@CStifItemParser@@QAEHAAIW4TRadix@@@Z @ 42 NONAME ; int CStifItemParser::GetNextInt(unsigned int &, enum TRadix)
+	?GetNextInt@CStifItemParser@@QAEHABVTDesC16@@AAH@Z @ 43 NONAME ; int CStifItemParser::GetNextInt(class TDesC16 const &, int &)
+	?GetNextInt@CStifItemParser@@QAEHABVTDesC16@@AAIW4TRadix@@@Z @ 44 NONAME ; int CStifItemParser::GetNextInt(class TDesC16 const &, unsigned int &, enum TRadix)
+	?GetNextItemLineL@CStifSectionParser@@QAEPAVCStifItemParser@@ABVTDesC16@@W4TTagToReturnValue@@@Z @ 45 NONAME ; class CStifItemParser * CStifSectionParser::GetNextItemLineL(class TDesC16 const &, enum TTagToReturnValue)
+	?GetNextItemLineL@CStifSectionParser@@QAEPAVCStifItemParser@@XZ @ 46 NONAME ; class CStifItemParser * CStifSectionParser::GetNextItemLineL(void)
+	?GetNextLine@CStifSectionParser@@QAEHAAVTPtrC16@@@Z @ 47 NONAME ; int CStifSectionParser::GetNextLine(class TPtrC16 &)
+	?GetNextLine@CStifSectionParser@@QAEHABVTDesC16@@AAVTPtrC16@@W4TTagToReturnValue@@@Z @ 48 NONAME ; int CStifSectionParser::GetNextLine(class TDesC16 const &, class TPtrC16 &, enum TTagToReturnValue)
+	?GetNextString@CStifItemParser@@QAEHAAVTPtrC16@@@Z @ 49 NONAME ; int CStifItemParser::GetNextString(class TPtrC16 &)
+	?GetNextString@CStifItemParser@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 50 NONAME ; int CStifItemParser::GetNextString(class TDesC16 const &, class TPtrC16 &)
+	?GetPosition@CStifSectionParser@@QAEHXZ @ 51 NONAME ; int CStifSectionParser::GetPosition(void)
+	?GetStoredState@CTestModuleIf@@QAEHAAHAAV?$TBuf@$0IA@@@@Z @ 52 NONAME ; int CTestModuleIf::GetStoredState(int &, class TBuf<128> &)
+	?GetString@CStifItemParser@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 53 NONAME ; int CStifItemParser::GetString(class TDesC16 const &, class TPtrC16 &)
+	?GetTestObject@CScriptBase@@QAEPAV1@ABVTDesC16@@@Z @ 54 NONAME ; class CScriptBase * CScriptBase::GetTestObject(class TDesC16 const &)
+	?Log@CStifLogger@@QAAHHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 55 NONAME ; int CStifLogger::Log(int, class TRefByValue<class TDesC16 const >, ...)
+	?Log@CStifLogger@@QAAHHV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 56 NONAME ; int CStifLogger::Log(int, class TRefByValue<class TDesC8 const >, ...)
+	?Log@CStifLogger@@QAAHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 57 NONAME ; int CStifLogger::Log(class TRefByValue<class TDesC16 const >, ...)
+	?Log@CStifLogger@@QAAHV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 58 NONAME ; int CStifLogger::Log(class TRefByValue<class TDesC8 const >, ...)
+	?Log@CStifLogger@@QAEHABVTDesC16@@@Z @ 59 NONAME ; int CStifLogger::Log(class TDesC16 const &)
+	?Log@CStifLogger@@QAEHABVTDesC8@@@Z @ 60 NONAME ; int CStifLogger::Log(class TDesC8 const &)
+	?Log@CStifLogger@@QAEHHABVTDesC16@@@Z @ 61 NONAME ; int CStifLogger::Log(int, class TDesC16 const &)
+	?Log@CStifLogger@@QAEHHABVTDesC8@@@Z @ 62 NONAME ; int CStifLogger::Log(int, class TDesC8 const &)
+	?MsgType@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 63 NONAME ; class TPtrC16 CStifTFwIfProt::MsgType(int)
+	?NewL@CSTIFTestMeasurement@@SAPAV1@PAVCTestModuleBase@@W4TSTIFMeasurementType@1@ABVTDesC16@@@Z @ 64 NONAME ; class CSTIFTestMeasurement * CSTIFTestMeasurement::NewL(class CTestModuleBase *, enum CSTIFTestMeasurement::TSTIFMeasurementType, class TDesC16 const &)
+	?NewL@CStifItemParser@@SAPAV1@VTPtrC16@@HH@Z @ 65 NONAME ; class CStifItemParser * CStifItemParser::NewL(class TPtrC16, int, int)
+	?NewL@CStifLogger@@KAPAV1@ABVTDesC16@@0AAUTLoggerSettings@@@Z @ 66 NONAME ; class CStifLogger * CStifLogger::NewL(class TDesC16 const &, class TDesC16 const &, struct TLoggerSettings &)
+	?NewL@CStifLogger@@SAPAV1@ABVTDesC16@@0W4TLoggerType@1@W4TOutput@1@HHHHHHHH@Z @ 67 NONAME ; class CStifLogger * CStifLogger::NewL(class TDesC16 const &, class TDesC16 const &, enum CStifLogger::TLoggerType, enum CStifLogger::TOutput, int, int, int, int, int, int, int, int)
+	?NewL@CStifParser@@SAPAV1@ABVTDesC16@@0W4TCommentType@1@@Z @ 68 NONAME ; class CStifParser * CStifParser::NewL(class TDesC16 const &, class TDesC16 const &, enum CStifParser::TCommentType)
+	?NewL@CStifParser@@SAPAV1@ABVTDesC16@@W4TCommentType@1@@Z @ 69 NONAME ; class CStifParser * CStifParser::NewL(class TDesC16 const &, enum CStifParser::TCommentType)
+	?NewL@CStifTFwIfProt@@SAPAV1@XZ @ 70 NONAME ; class CStifTFwIfProt * CStifTFwIfProt::NewL(void)
+	?NewL@CTestModuleIf@@SAPAV1@PAVCTestThreadContainer@@PAVCTestModuleBase@@@Z @ 71 NONAME ; class CTestModuleIf * CTestModuleIf::NewL(class CTestThreadContainer *, class CTestModuleBase *)
+	?NewL@CTestModuleParamVer01@@SAPAV1@XZ @ 72 NONAME ; class CTestModuleParamVer01 * CTestModuleParamVer01::NewL(void)
+	?NewL@MSTIFTestInterference@@SAPAV1@PAVCTestModuleBase@@W4TStifTestInterferenceCategory@1@@Z @ 73 NONAME ; class MSTIFTestInterference * MSTIFTestInterference::NewL(class CTestModuleBase *, enum MSTIFTestInterference::TStifTestInterferenceCategory)
+	?NextSectionL@CStifParser@@QAEPAVCStifSectionParser@@ABVTDesC16@@0H@Z @ 74 NONAME ; class CStifSectionParser * CStifParser::NextSectionL(class TDesC16 const &, class TDesC16 const &, int)
+	?NextSubSectionL@CStifSectionParser@@QAEPAV1@ABVTDesC16@@0H@Z @ 75 NONAME ; class CStifSectionParser * CStifSectionParser::NextSubSectionL(class TDesC16 const &, class TDesC16 const &, int)
+	?OutputType@CStifLogger@@QAE?AW4TOutput@1@XZ @ 76 NONAME ; enum CStifLogger::TOutput CStifLogger::OutputType(void)
+	?ParsingType@CStifItemParser@@QAE?AW4TParsingType@1@XZ @ 77 NONAME ; enum CStifItemParser::TParsingType CStifItemParser::ParsingType(void)
+	?Printf@CTestModuleIf@@QAAXHABVTDesC16@@V?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 78 NONAME ; void CTestModuleIf::Printf(int, class TDesC16 const &, class TRefByValue<class TDesC16 const >, ...)
+	?Reboot@CTestModuleIf@@QAEHH@Z @ 79 NONAME ; int CTestModuleIf::Reboot(int)
+	?Remainder@CStifItemParser@@QAEHAAVTPtrC16@@@Z @ 80 NONAME ; int CStifItemParser::Remainder(class TPtrC16 &)
+	?RemoteReceive@CTestModuleIf@@QAEXAAVTDes16@@AAVTRequestStatus@@@Z @ 81 NONAME ; void CTestModuleIf::RemoteReceive(class TDes16 &, class TRequestStatus &)
+	?RemoteReceiveCancel@CTestModuleIf@@QAEXXZ @ 82 NONAME ; void CTestModuleIf::RemoteReceiveCancel(void)
+	?RemoteSend@CTestModuleIf@@QAEHABVTDesC16@@@Z @ 83 NONAME ; int CTestModuleIf::RemoteSend(class TDesC16 const &)
+	?RemoteType@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 84 NONAME ; class TPtrC16 CStifTFwIfProt::RemoteType(int)
+	?ResetAllowResult@CTestModuleIf@@QAEHXZ @ 85 NONAME ; int CTestModuleIf::ResetAllowResult(void)
+	?RespParam@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 86 NONAME ; class TPtrC16 CStifTFwIfProt::RespParam(int)
+	?ResultCategory@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 87 NONAME ; class TPtrC16 CStifTFwIfProt::ResultCategory(int)
+	?RunInternalL@CScriptBase@@MAEHQBVTStifFunctionInfo@@HAAVCStifItemParser@@@Z @ 88 NONAME ; int CScriptBase::RunInternalL(class TStifFunctionInfo const * const, int, class CStifItemParser &)
+	?RunParams@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 89 NONAME ; class TPtrC16 CStifTFwIfProt::RunParams(int)
+	?RunStatus@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 90 NONAME ; class TPtrC16 CStifTFwIfProt::RunStatus(int)
+	?RunStatusParams@CStifTFwIfProt@@SA?AVTPtrC16@@H@Z @ 91 NONAME ; class TPtrC16 CStifTFwIfProt::RunStatusParams(int)
+	?SaveData@CStifLogger@@QAEHAAVTDesC16@@@Z @ 92 NONAME ; int CStifLogger::SaveData(class TDesC16 &)
+	?SaveData@CStifLogger@@QAEHAAVTDesC8@@@Z @ 93 NONAME ; int CStifLogger::SaveData(class TDesC8 &)
+	?SectionL@CStifParser@@QAEPAVCStifSectionParser@@ABVTDesC16@@0H@Z @ 94 NONAME ; class CStifSectionParser * CStifParser::SectionL(class TDesC16 const &, class TDesC16 const &, int)
+	?SetAllowResult@CTestModuleIf@@QAEHH@Z @ 95 NONAME ; int CTestModuleIf::SetAllowResult(int)
+	?SetBehavior@CTestModuleIf@@QAEHW4TTestBehavior@1@PAX@Z @ 96 NONAME ; int CTestModuleIf::SetBehavior(enum CTestModuleIf::TTestBehavior, void *)
+	?SetCmdType@CStifTFwIfProt@@QAEHW4TCmdType@1@@Z @ 97 NONAME ; int CStifTFwIfProt::SetCmdType(enum CStifTFwIfProt::TCmdType)
+	?SetDstId@CStifTFwIfProt@@QAEHK@Z @ 98 NONAME ; int CStifTFwIfProt::SetDstId(unsigned long)
+	?SetExitReason@CTestModuleIf@@QAEXW4TExitReason@1@H@Z @ 99 NONAME ; void CTestModuleIf::SetExitReason(enum CTestModuleIf::TExitReason, int)
+	?SetL@CStifTFwIfProt@@QAEHABVTDesC16@@@Z @ 100 NONAME ; int CStifTFwIfProt::SetL(class TDesC16 const &)
+	?SetMsgType@CStifTFwIfProt@@QAEHW4TMsgType@1@@Z @ 101 NONAME ; int CStifTFwIfProt::SetMsgType(enum CStifTFwIfProt::TMsgType)
+	?SetParsingType@CStifItemParser@@QAEHW4TParsingType@1@@Z @ 102 NONAME ; int CStifItemParser::SetParsingType(enum CStifItemParser::TParsingType)
+	?SetPosition@CStifSectionParser@@QAEHH@Z @ 103 NONAME ; int CStifSectionParser::SetPosition(int)
+	?SetRespType@CStifTFwIfProt@@QAEHW4TMsgType@1@@Z @ 104 NONAME ; int CStifTFwIfProt::SetRespType(enum CStifTFwIfProt::TMsgType)
+	?SetResult@TTestResult@@QAEXHABVTDesC16@@@Z @ 105 NONAME ; void TTestResult::SetResult(int, class TDesC16 const &)
+	?SetScripter@CScriptBase@@AAEXP6AHPAVCTestScripter@@W4TStifTSCallBackType@@ABVTDesC16@@@Z0@Z @ 106 NONAME ; void CScriptBase::SetScripter(int (*)(class CTestScripter *, enum TStifTSCallBackType, class TDesC16 const &), class CTestScripter *)
+	?SetSrcId@CStifTFwIfProt@@QAEHK@Z @ 107 NONAME ; int CStifTFwIfProt::SetSrcId(unsigned long)
+	?Signal@CScriptBase@@QAEXH@Z @ 108 NONAME ; void CScriptBase::Signal(int)
+	?SrcDevId@CStifTFwIfProt@@QAEGXZ @ 109 NONAME ; unsigned short CStifTFwIfProt::SrcDevId(void)
+	?SrcId@CStifTFwIfProt@@QAEKXZ @ 110 NONAME ; unsigned long CStifTFwIfProt::SrcId(void)
+	?SrcTestId@CStifTFwIfProt@@QAEGXZ @ 111 NONAME ; unsigned short CStifTFwIfProt::SrcTestId(void)
+	?Start@CSTIFTestMeasurement@@QAEHXZ @ 112 NONAME ; int CSTIFTestMeasurement::Start(void)
+	?StartSession@@YAHXZ @ 113 NONAME ; int StartSession(void)
+	?StifMacroError@CTestModuleIf@@QAEHHPBEPBDHHHHHHH@Z @ 114 NONAME ; int CTestModuleIf::StifMacroError(int, unsigned char const *, char const *, int, int, int, int, int, int, int)
+	?Stop@CSTIFTestMeasurement@@QAEHXZ @ 115 NONAME ; int CSTIFTestMeasurement::Stop(void)
+	?StoreState@CTestModuleIf@@QAEHHAAV?$TBuf@$0IA@@@@Z @ 116 NONAME ; int CTestModuleIf::StoreState(int, class TBuf<128> &)
+	?SubSectionL@CStifSectionParser@@QAEPAV1@ABVTDesC16@@0H@Z @ 117 NONAME ; class CStifSectionParser * CStifSectionParser::SubSectionL(class TDesC16 const &, class TDesC16 const &, int)
+	?TestModuleIf@CScriptBase@@QAEAAVCTestModuleIf@@XZ @ 118 NONAME ; class CTestModuleIf & CScriptBase::TestModuleIf(void)
+	?WriteDelimiter@CStifLogger@@QAEHABVTDesC16@@H@Z @ 119 NONAME ; int CStifLogger::WriteDelimiter(class TDesC16 const &, int)
+	?WriteDelimiter@CStifLogger@@QAEHABVTDesC8@@H@Z @ 120 NONAME ; int CStifLogger::WriteDelimiter(class TDesC8 const &, int)
+	?StopExecution@CTestModuleIf@@QAEHW4TStopExecutionType@@H@Z @ 121 NONAME ; int CTestModuleIf::StopExecution(enum TStopExecutionType, int)
+	?GetConstantValue@CScriptBase@@IAEHABVTDesC16@@AAH@Z @ 122 NONAME ; int CScriptBase::GetConstantValue(class TDesC16 const &, int &)
+	?GetConstantValue@CScriptBase@@IAEHABVTDesC16@@AAN@Z @ 123 NONAME ; int CScriptBase::GetConstantValue(class TDesC16 const &, double &)
+	?GetConstantValue@CScriptBase@@IAEHABVTDesC16@@AAVTDes16@@@Z @ 124 NONAME ; int CScriptBase::GetConstantValue(class TDesC16 const &, class TDes16 &)
+	?CorrectFilePathL@TStifUtil@@SAXAAVTDes16@@@Z @ 125 NONAME ; void TStifUtil::CorrectFilePathL(class TDes16 &)
+	?GetTestCaseTitleL@CTestModuleIf@@QAEXAAVTDes16@@@Z @ 126 NONAME ; void CTestModuleIf::GetTestCaseTitleL(class TDes16 &)
+	?STIFVersion@TStifUtil@@SAXAAH00AAVTDes16@@@Z @ 127 NONAME ; void TStifUtil::STIFVersion(int &, int &, int &, class TDes16 &)
+	?GetUiEnvProxy@CTestModuleIf@@QAEPAVCUiEnvProxy@@XZ @ 128 NONAME ; class CUiEnvProxy * CTestModuleIf::GetUiEnvProxy(void)
+	?UITesting@CTestModuleIf@@QAEHXZ @ 129 NONAME ; int CTestModuleIf::UITesting(void)
+	?SendTestModuleVersion@CTestModuleIf@@QAEHVTVersion@@V?$TBuf@$0BAA@@@@Z @ 130 NONAME ; int CTestModuleIf::SendTestModuleVersion(class TVersion, class TBuf<256>)
+	?SendTestModuleVersion@CTestModuleIf@@QAEHAAVTVersion@@ABVTDesC16@@H@Z @ 131 NONAME ; int CTestModuleIf::SendTestModuleVersion(class TVersion &, class TDesC16 const &, int)
+	?SetResultDescription@CScriptBase@@QAEXABVTDesC16@@@Z @ 132 NONAME ; void CScriptBase::SetResultDescription(class TDesC16 const &)
+	?SetLocalValue@CScriptBase@@IAEHABVTDesC16@@0@Z @ 133 NONAME ; int CScriptBase::SetLocalValue(class TDesC16 const &, class TDesC16 const &)
+	?SetLocalValue@CScriptBase@@IAEHABVTDesC16@@H@Z @ 134 NONAME ; int CScriptBase::SetLocalValue(class TDesC16 const &, int)
+	?SetLocalValue@CScriptBase@@IAEHABVTDesC16@@N@Z @ 135 NONAME ; int CScriptBase::SetLocalValue(class TDesC16 const &, double)
+	?GetLocalValue@CScriptBase@@IAEHABVTDesC16@@AAH@Z @ 136 NONAME ; int CScriptBase::GetLocalValue(class TDesC16 const &, int &)
+	?GetLocalValue@CScriptBase@@IAEHABVTDesC16@@AAN@Z @ 137 NONAME ; int CScriptBase::GetLocalValue(class TDesC16 const &, double &)
+	?GetLocalValue@CScriptBase@@IAEHABVTDesC16@@AAVTDes16@@@Z @ 138 NONAME ; int CScriptBase::GetLocalValue(class TDesC16 const &, class TDes16 &)
+	??1TScriptObject@@UAE@XZ @ 139 NONAME ; TScriptObject::~TScriptObject(void)
+	?AddTestObjToCaseDictL@CTestModuleIf@@IAEXPAVTScriptObject@@@Z @ 140 NONAME ; void CTestModuleIf::AddTestObjToCaseDictL(class TScriptObject *)
+	?Connect@RSTFLogger@@QAEHXZ @ 141 NONAME ; int RSTFLogger::Connect(void)
+	?CreateL@RSTFLogger@@QAEHABVTDesC16@@0AAUTLoggerSettings@@@Z @ 142 NONAME ; int RSTFLogger::CreateL(class TDesC16 const &, class TDesC16 const &, struct TLoggerSettings &)
+	?CreateL@RSTFLogger@@QAEHABVTDesC16@@0W4TLoggerType@CStifLogger@@W4TOutput@4@HHHHHHHH@Z @ 143 NONAME ; int RSTFLogger::CreateL(class TDesC16 const &, class TDesC16 const &, enum CStifLogger::TLoggerType, enum CStifLogger::TOutput, int, int, int, int, int, int, int, int)
+	?CreationResult@RSTFLogger@@QAEHAAH@Z @ 144 NONAME ; int RSTFLogger::CreationResult(int &)
+	?DelTestObjFromCaseDict@CTestModuleIf@@IAEXABVTDesC16@@@Z @ 145 NONAME ; void CTestModuleIf::DelTestObjFromCaseDict(class TDesC16 const &)
+	?GetObjFrmCaseDict@CTestModuleIf@@QAEPAVCScriptBase@@ABVTDesC16@@@Z @ 146 NONAME ; class CScriptBase * CTestModuleIf::GetObjFrmCaseDict(class TDesC16 const &)
+	?GetTestObjFromCaseDict@CTestModuleIf@@IBEPAVTScriptObject@@ABVTDesC16@@@Z @ 147 NONAME ; class TScriptObject * CTestModuleIf::GetTestObjFromCaseDict(class TDesC16 const &) const
+	?GetValueOf@CStifItemParser@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 148 NONAME ; int CStifItemParser::GetValueOf(class TDesC16 const &, class TDes16 &)
+	?Log@RSTFLogger@@QAAHHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 149 NONAME ; int RSTFLogger::Log(int, class TRefByValue<class TDesC16 const >, ...)
+	?Log@RSTFLogger@@QAAHHV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 150 NONAME ; int RSTFLogger::Log(int, class TRefByValue<class TDesC8 const >, ...)
+	?Log@RSTFLogger@@QAAHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 151 NONAME ; int RSTFLogger::Log(class TRefByValue<class TDesC16 const >, ...)
+	?Log@RSTFLogger@@QAAHV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 152 NONAME ; int RSTFLogger::Log(class TRefByValue<class TDesC8 const >, ...)
+	?Log@RSTFLogger@@QAEHABVTDesC16@@@Z @ 153 NONAME ; int RSTFLogger::Log(class TDesC16 const &)
+	?Log@RSTFLogger@@QAEHABVTDesC8@@@Z @ 154 NONAME ; int RSTFLogger::Log(class TDesC8 const &)
+	?Log@RSTFLogger@@QAEHHABVTDesC16@@@Z @ 155 NONAME ; int RSTFLogger::Log(int, class TDesC16 const &)
+	?Log@RSTFLogger@@QAEHHABVTDesC8@@@Z @ 156 NONAME ; int RSTFLogger::Log(int, class TDesC8 const &)
+	?NextSectionL@CStifParser@@QAEPAVCStifSectionParser@@ABVTDesC16@@0HH@Z @ 157 NONAME ; class CStifSectionParser * CStifParser::NextSectionL(class TDesC16 const &, class TDesC16 const &, int, int)
+	?OutputType@RSTFLogger@@QAEHAAW4TOutput@CStifLogger@@@Z @ 158 NONAME ; int RSTFLogger::OutputType(enum CStifLogger::TOutput &)
+	?SaveData@RSTFLogger@@QAEHABVTDesC16@@@Z @ 159 NONAME ; int RSTFLogger::SaveData(class TDesC16 const &)
+	?SaveData@RSTFLogger@@QAEHABVTDesC8@@@Z @ 160 NONAME ; int RSTFLogger::SaveData(class TDesC8 const &)
+	?SectionL@CStifParser@@QAEPAVCStifSectionParser@@ABVTDesC16@@0HH@Z @ 161 NONAME ; class CStifSectionParser * CStifParser::SectionL(class TDesC16 const &, class TDesC16 const &, int, int)
+	?Send@CStifLogger@@UAEHHABVTDesC16@@@Z @ 162 NONAME ; int CStifLogger::Send(int, class TDesC16 const &)
+	?Send@CStifLogger@@UAEHHABVTDesC8@@@Z @ 163 NONAME ; int CStifLogger::Send(int, class TDesC8 const &)
+	?SeperateProcesses@CTestModuleIf@@QAEHXZ @ 164 NONAME ; int CTestModuleIf::SeperateProcesses(void)
+	?WriteDelimiter@RSTFLogger@@QAEHABVTDesC16@@H@Z @ 165 NONAME ; int RSTFLogger::WriteDelimiter(class TDesC16 const &, int)
+	?WriteDelimiter@RSTFLogger@@QAEHABVTDesC8@@H@Z @ 166 NONAME ; int RSTFLogger::WriteDelimiter(class TDesC8 const &, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/eabi/StifTestInterfaceu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,222 @@
+EXPORTS
+	_Z12StartSessionv @ 1 NONAME
+	_ZN11CScriptBase11SetScripterEPFiP13CTestScripter19TStifTSCallBackTypeRK7TDesC16ES1_ @ 2 NONAME
+	_ZN11CScriptBase12CancelSignalEv @ 3 NONAME
+	_ZN11CScriptBase12EnableSignalER14TRequestStatus @ 4 NONAME
+	_ZN11CScriptBase12RunInternalLEPK17TStifFunctionInfoiR15CStifItemParser @ 5 NONAME
+	_ZN11CScriptBase12TestModuleIfEv @ 6 NONAME
+	_ZN11CScriptBase13CallTestClassERK7TDesC16 @ 7 NONAME
+	_ZN11CScriptBase13GetTestObjectERK7TDesC16 @ 8 NONAME
+	_ZN11CScriptBase6SignalEi @ 9 NONAME
+	_ZN11CScriptBaseC2ER13CTestModuleIf @ 10 NONAME
+	_ZN11CStifLogger10OutputTypeEv @ 11 NONAME
+	_ZN11CStifLogger14CreationResultEv @ 12 NONAME
+	_ZN11CStifLogger14WriteDelimiterERK6TDesC8i @ 13 NONAME
+	_ZN11CStifLogger14WriteDelimiterERK7TDesC16i @ 14 NONAME
+	_ZN11CStifLogger3LogE11TRefByValueIK6TDesC8Ez @ 15 NONAME
+	_ZN11CStifLogger3LogE11TRefByValueIK7TDesC16Ez @ 16 NONAME
+	_ZN11CStifLogger3LogERK6TDesC8 @ 17 NONAME
+	_ZN11CStifLogger3LogERK7TDesC16 @ 18 NONAME
+	_ZN11CStifLogger3LogEi11TRefByValueIK6TDesC8Ez @ 19 NONAME
+	_ZN11CStifLogger3LogEi11TRefByValueIK7TDesC16Ez @ 20 NONAME
+	_ZN11CStifLogger3LogEiRK6TDesC8 @ 21 NONAME
+	_ZN11CStifLogger3LogEiRK7TDesC16 @ 22 NONAME
+	_ZN11CStifLogger4NewLERK7TDesC16S2_NS_11TLoggerTypeENS_7TOutputEiiiiiiii @ 23 NONAME
+	_ZN11CStifLogger4NewLERK7TDesC16S2_R15TLoggerSettings @ 24 NONAME
+	_ZN11CStifLogger8SaveDataER6TDesC8 @ 25 NONAME
+	_ZN11CStifLogger8SaveDataER7TDesC16 @ 26 NONAME
+	_ZN11CStifParser12NextSectionLERK7TDesC16S2_i @ 27 NONAME
+	_ZN11CStifParser4NewLERK7TDesC16NS_12TCommentTypeE @ 28 NONAME
+	_ZN11CStifParser4NewLERK7TDesC16S2_NS_12TCommentTypeE @ 29 NONAME
+	_ZN11CStifParser8SectionLERK7TDesC16S2_i @ 30 NONAME
+	_ZN11CStifParserD0Ev @ 31 NONAME
+	_ZN11CStifParserD1Ev @ 32 NONAME
+	_ZN11CStifParserD2Ev @ 33 NONAME
+	_ZN11TTestResult9SetResultEiRK7TDesC16 @ 34 NONAME
+	_ZN11TTestResultC1Ev @ 35 NONAME
+	_ZN11TTestResultC2Ev @ 36 NONAME
+	_ZN13CTestModuleIf10RemoteSendERK7TDesC16 @ 37 NONAME
+	_ZN13CTestModuleIf10StoreStateEiR4TBufILi128EE @ 38 NONAME
+	_ZN13CTestModuleIf11CancelEventER8TEventIfP14TRequestStatus @ 39 NONAME
+	_ZN13CTestModuleIf11SetBehaviorENS_13TTestBehaviorEPv @ 40 NONAME
+	_ZN13CTestModuleIf13RemoteReceiveER6TDes16R14TRequestStatus @ 41 NONAME
+	_ZN13CTestModuleIf13SetExitReasonENS_11TExitReasonEi @ 42 NONAME
+	_ZN13CTestModuleIf14GetStoredStateERiR4TBufILi128EE @ 43 NONAME
+	_ZN13CTestModuleIf14SetAllowResultEi @ 44 NONAME
+	_ZN13CTestModuleIf14StifMacroErrorEiPKhPKciiiiiii @ 45 NONAME
+	_ZN13CTestModuleIf16CheckAllowResultEi @ 46 NONAME
+	_ZN13CTestModuleIf16ResetAllowResultEv @ 47 NONAME
+	_ZN13CTestModuleIf19RemoteReceiveCancelEv @ 48 NONAME
+	_ZN13CTestModuleIf21GetMeasurementOptionsERi @ 49 NONAME
+	_ZN13CTestModuleIf4NewLEP20CTestThreadContainerP15CTestModuleBase @ 50 NONAME
+	_ZN13CTestModuleIf5EventER8TEventIf @ 51 NONAME
+	_ZN13CTestModuleIf5EventER8TEventIfR14TRequestStatus @ 52 NONAME
+	_ZN13CTestModuleIf6PrintfEiRK7TDesC1611TRefByValueIS1_Ez @ 53 NONAME
+	_ZN13CTestModuleIf6RebootEi @ 54 NONAME
+	_ZN13TTestCaseInfoC1Ev @ 55 NONAME
+	_ZN13TTestCaseInfoC2Ev @ 56 NONAME
+	_ZN13TTestProgressC1Ev @ 57 NONAME
+	_ZN13TTestProgressC2Ev @ 58 NONAME
+	_ZN14CStifTFwIfProt10RemoteTypeEi @ 59 NONAME
+	_ZN14CStifTFwIfProt10SetCmdTypeENS_8TCmdTypeE @ 60 NONAME
+	_ZN14CStifTFwIfProt10SetMsgTypeENS_8TMsgTypeE @ 61 NONAME
+	_ZN14CStifTFwIfProt11EventStatusEi @ 62 NONAME
+	_ZN14CStifTFwIfProt11SetRespTypeENS_8TMsgTypeE @ 63 NONAME
+	_ZN14CStifTFwIfProt14ResultCategoryEi @ 64 NONAME
+	_ZN14CStifTFwIfProt15RunStatusParamsEi @ 65 NONAME
+	_ZN14CStifTFwIfProt17EventStatusParamsEi @ 66 NONAME
+	_ZN14CStifTFwIfProt4NewLEv @ 67 NONAME
+	_ZN14CStifTFwIfProt4SetLERK7TDesC16 @ 68 NONAME
+	_ZN14CStifTFwIfProt5DstIdEv @ 69 NONAME
+	_ZN14CStifTFwIfProt5SrcIdEv @ 70 NONAME
+	_ZN14CStifTFwIfProt6AppendEPF7TPtrC16iEi @ 71 NONAME
+	_ZN14CStifTFwIfProt6AppendEPF7TPtrC16iEiRK7TDesC16 @ 72 NONAME
+	_ZN14CStifTFwIfProt6AppendEPF7TPtrC16iEiS2_i @ 73 NONAME
+	_ZN14CStifTFwIfProt6AppendEPF7TPtrC16iEii @ 74 NONAME
+	_ZN14CStifTFwIfProt6AppendERK7TDesC16 @ 75 NONAME
+	_ZN14CStifTFwIfProt7CmdTypeEi @ 76 NONAME
+	_ZN14CStifTFwIfProt7CreateLEi @ 77 NONAME
+	_ZN14CStifTFwIfProt7MsgTypeEi @ 78 NONAME
+	_ZN14CStifTFwIfProt8AppendIdEm @ 79 NONAME
+	_ZN14CStifTFwIfProt8DstDevIdEv @ 80 NONAME
+	_ZN14CStifTFwIfProt8SetDstIdEm @ 81 NONAME
+	_ZN14CStifTFwIfProt8SetSrcIdEm @ 82 NONAME
+	_ZN14CStifTFwIfProt8SrcDevIdEv @ 83 NONAME
+	_ZN14CStifTFwIfProt9DstTestIdEv @ 84 NONAME
+	_ZN14CStifTFwIfProt9EventTypeEi @ 85 NONAME
+	_ZN14CStifTFwIfProt9RespParamEi @ 86 NONAME
+	_ZN14CStifTFwIfProt9RunParamsEi @ 87 NONAME
+	_ZN14CStifTFwIfProt9RunStatusEi @ 88 NONAME
+	_ZN14CStifTFwIfProt9SrcTestIdEv @ 89 NONAME
+	_ZN14CStifTFwIfProtD0Ev @ 90 NONAME
+	_ZN14CStifTFwIfProtD1Ev @ 91 NONAME
+	_ZN14CStifTFwIfProtD2Ev @ 92 NONAME
+	_ZN15CStifItemParser10GetNextIntERK7TDesC16Ri @ 93 NONAME
+	_ZN15CStifItemParser10GetNextIntERK7TDesC16Rj6TRadix @ 94 NONAME
+	_ZN15CStifItemParser10GetNextIntERi @ 95 NONAME
+	_ZN15CStifItemParser10GetNextIntERj6TRadix @ 96 NONAME
+	_ZN15CStifItemParser11GetNextCharER5TChar @ 97 NONAME
+	_ZN15CStifItemParser11GetNextCharERK7TDesC16R5TChar @ 98 NONAME
+	_ZN15CStifItemParser11ParsingTypeEv @ 99 NONAME
+	_ZN15CStifItemParser13GetNextStringER7TPtrC16 @ 100 NONAME
+	_ZN15CStifItemParser13GetNextStringERK7TDesC16R7TPtrC16 @ 101 NONAME
+	_ZN15CStifItemParser14SetParsingTypeENS_12TParsingTypeE @ 102 NONAME
+	_ZN15CStifItemParser4NewLE7TPtrC16ii @ 103 NONAME
+	_ZN15CStifItemParser6GetIntERK7TDesC16Ri @ 104 NONAME
+	_ZN15CStifItemParser6GetIntERK7TDesC16Rj6TRadix @ 105 NONAME
+	_ZN15CStifItemParser7GetCharERK7TDesC16R5TChar @ 106 NONAME
+	_ZN15CStifItemParser9GetStringERK7TDesC16R7TPtrC16 @ 107 NONAME
+	_ZN15CStifItemParser9RemainderER7TPtrC16 @ 108 NONAME
+	_ZN15TFullTestResultC1Ev @ 109 NONAME
+	_ZN15TFullTestResultC2Ev @ 110 NONAME
+	_ZN18CStifSectionParser11GetNextLineER7TPtrC16 @ 111 NONAME
+	_ZN18CStifSectionParser11GetNextLineERK7TDesC16R7TPtrC1617TTagToReturnValue @ 112 NONAME
+	_ZN18CStifSectionParser11GetPositionEv @ 113 NONAME
+	_ZN18CStifSectionParser11SetPositionEi @ 114 NONAME
+	_ZN18CStifSectionParser11SubSectionLERK7TDesC16S2_i @ 115 NONAME
+	_ZN18CStifSectionParser12GetItemLineLERK7TDesC1617TTagToReturnValue @ 116 NONAME
+	_ZN18CStifSectionParser15NextSubSectionLERK7TDesC16S2_i @ 117 NONAME
+	_ZN18CStifSectionParser16GetNextItemLineLERK7TDesC1617TTagToReturnValue @ 118 NONAME
+	_ZN18CStifSectionParser16GetNextItemLineLEv @ 119 NONAME
+	_ZN18CStifSectionParser7GetLineERK7TDesC16R7TPtrC1617TTagToReturnValue @ 120 NONAME
+	_ZN18TErrorNotificationC1Ev @ 121 NONAME
+	_ZN18TErrorNotificationC2Ev @ 122 NONAME
+	_ZN20CSTIFTestMeasurement4NewLEP15CTestModuleBaseNS_20TSTIFMeasurementTypeERK7TDesC16 @ 123 NONAME
+	_ZN20CSTIFTestMeasurement4StopEv @ 124 NONAME
+	_ZN20CSTIFTestMeasurement5StartEv @ 125 NONAME
+	_ZN21CTestModuleParamVer014NewLEv @ 126 NONAME
+	_ZN21CTestModuleParamVer01D0Ev @ 127 NONAME
+	_ZN21CTestModuleParamVer01D1Ev @ 128 NONAME
+	_ZN21CTestModuleParamVer01D2Ev @ 129 NONAME
+	_ZN21MSTIFTestInterference4NewLEP15CTestModuleBaseNS_29TStifTestInterferenceCategoryE @ 130 NONAME
+	_ZN9TTestInfoC1Ev @ 131 NONAME
+	_ZN9TTestInfoC2Ev @ 132 NONAME
+	_ZTI10CTxtLogger @ 133 NONAME ABSENT ; #<TI>#
+	_ZTI11CDataLogger @ 134 NONAME ABSENT ; #<TI>#
+	_ZTI11CFileOutput @ 135 NONAME ABSENT ; #<TI>#
+	_ZTI11CHtmlLogger @ 136 NONAME ABSENT ; #<TI>#
+	_ZTI11CNullOutput @ 137 NONAME ABSENT ; #<TI>#
+	_ZTI11CScriptBase @ 138 NONAME ; #<TI>#
+	_ZTI11CStifLogger @ 139 NONAME ; #<TI>#
+	_ZTI11CStifParser @ 140 NONAME ; #<TI>#
+	_ZTI13CRDebugOutput @ 141 NONAME ABSENT ; #<TI>#
+	_ZTI13CTestModuleIf @ 142 NONAME ; #<TI>#
+	_ZTI14CStifTFwIfProt @ 143 NONAME ; #<TI>#
+	_ZTI15CStifItemParser @ 144 NONAME ; #<TI>#
+	_ZTI18CStifSectionParser @ 145 NONAME ; #<TI>#
+	_ZTI21CTestModuleParamVer01 @ 146 NONAME ; #<TI>#
+	_ZTI25TDesLoggerOverflowHandler @ 147 NONAME ABSENT ; #<TI>#
+	_ZTI26TDes8LoggerOverflowHandler @ 148 NONAME ABSENT ; #<TI>#
+	_ZTI7COutput @ 149 NONAME ABSENT ; #<TI>#
+	_ZTV10CTxtLogger @ 150 NONAME ABSENT ; #<VT>#
+	_ZTV11CDataLogger @ 151 NONAME ABSENT ; #<VT>#
+	_ZTV11CFileOutput @ 152 NONAME ABSENT ; #<VT>#
+	_ZTV11CHtmlLogger @ 153 NONAME ABSENT ; #<VT>#
+	_ZTV11CNullOutput @ 154 NONAME ABSENT ; #<VT>#
+	_ZTV11CScriptBase @ 155 NONAME ; #<VT>#
+	_ZTV11CStifLogger @ 156 NONAME ; #<VT>#
+	_ZTV11CStifParser @ 157 NONAME ; #<VT>#
+	_ZTV13CRDebugOutput @ 158 NONAME ABSENT ; #<VT>#
+	_ZTV13CTestModuleIf @ 159 NONAME ; #<VT>#
+	_ZTV14CStifTFwIfProt @ 160 NONAME ; #<VT>#
+	_ZTV15CStifItemParser @ 161 NONAME ; #<VT>#
+	_ZTV18CStifSectionParser @ 162 NONAME ; #<VT>#
+	_ZTV21CTestModuleParamVer01 @ 163 NONAME ; #<VT>#
+	_ZTV25TDesLoggerOverflowHandler @ 164 NONAME ABSENT ; #<VT>#
+	_ZTV26TDes8LoggerOverflowHandler @ 165 NONAME ABSENT ; #<VT>#
+	_ZTV7COutput @ 166 NONAME ABSENT ; #<VT>#
+	_ZN13CTestModuleIf13StopExecutionE18TStopExecutionTypei @ 167 NONAME
+	_ZN11CScriptBase16GetConstantValueERK7TDesC16R6TDes16 @ 168 NONAME
+	_ZN11CScriptBase16GetConstantValueERK7TDesC16Rd @ 169 NONAME
+	_ZN11CScriptBase16GetConstantValueERK7TDesC16Ri @ 170 NONAME
+	_ZN9TStifUtil16CorrectFilePathLER6TDes16 @ 171 NONAME
+	_ZN13CTestModuleIf17GetTestCaseTitleLER6TDes16 @ 172 NONAME
+	_ZN9TStifUtil11STIFVersionERiS0_S0_R6TDes16 @ 173 NONAME
+	_ZN13CTestModuleIf13GetUiEnvProxyEv @ 174 NONAME
+	_ZN13CTestModuleIf9UITestingEv @ 175 NONAME
+	_ZN13CTestModuleIf21SendTestModuleVersionE8TVersion4TBufILi256EE @ 176 NONAME
+	_ZN13CTestModuleIf21SendTestModuleVersionER8TVersionRK7TDesC16i @ 177 NONAME
+	_ZN11CScriptBase20SetResultDescriptionERK7TDesC16 @ 178 NONAME
+	_ZN11CScriptBase13GetLocalValueERK7TDesC16R6TDes16 @ 179 NONAME
+	_ZN11CScriptBase13GetLocalValueERK7TDesC16Rd @ 180 NONAME
+	_ZN11CScriptBase13GetLocalValueERK7TDesC16Ri @ 181 NONAME
+	_ZN11CScriptBase13SetLocalValueERK7TDesC16S2_ @ 182 NONAME
+	_ZN11CScriptBase13SetLocalValueERK7TDesC16d @ 183 NONAME
+	_ZN11CScriptBase13SetLocalValueERK7TDesC16i @ 184 NONAME
+	_ZN10RSTFLogger10OutputTypeERN11CStifLogger7TOutputE @ 185 NONAME
+	_ZN10RSTFLogger14CreationResultERi @ 186 NONAME
+	_ZN10RSTFLogger14WriteDelimiterERK6TDesC8i @ 187 NONAME
+	_ZN10RSTFLogger14WriteDelimiterERK7TDesC16i @ 188 NONAME
+	_ZN10RSTFLogger3LogE11TRefByValueIK6TDesC8Ez @ 189 NONAME
+	_ZN10RSTFLogger3LogE11TRefByValueIK7TDesC16Ez @ 190 NONAME
+	_ZN10RSTFLogger3LogERK6TDesC8 @ 191 NONAME
+	_ZN10RSTFLogger3LogERK7TDesC16 @ 192 NONAME
+	_ZN10RSTFLogger3LogEi11TRefByValueIK6TDesC8Ez @ 193 NONAME
+	_ZN10RSTFLogger3LogEi11TRefByValueIK7TDesC16Ez @ 194 NONAME
+	_ZN10RSTFLogger3LogEiRK6TDesC8 @ 195 NONAME
+	_ZN10RSTFLogger3LogEiRK7TDesC16 @ 196 NONAME
+	_ZN10RSTFLogger7CreateLERK7TDesC16S2_N11CStifLogger11TLoggerTypeENS3_7TOutputEiiiiiiii @ 197 NONAME
+	_ZN10RSTFLogger7CreateLERK7TDesC16S2_R15TLoggerSettings @ 198 NONAME
+	_ZN10RSTFLogger7ConnectEv @ 199 NONAME
+	_ZN10RSTFLogger8SaveDataERK6TDesC8 @ 200 NONAME
+	_ZN10RSTFLogger8SaveDataERK7TDesC16 @ 201 NONAME
+	_ZN11CStifLogger4SendEiRK6TDesC8 @ 202 NONAME
+	_ZN11CStifLogger4SendEiRK7TDesC16 @ 203 NONAME
+	_ZN11CStifParser12NextSectionLERK7TDesC16S2_ii @ 204 NONAME
+	_ZN11CStifParser8SectionLERK7TDesC16S2_ii @ 205 NONAME
+	_ZN13CTestModuleIf17GetObjFrmCaseDictERK7TDesC16 @ 206 NONAME
+	_ZN13CTestModuleIf21AddTestObjToCaseDictLEP13TScriptObject @ 207 NONAME
+	_ZN13CTestModuleIf22DelTestObjFromCaseDictERK7TDesC16 @ 208 NONAME
+	_ZN15CStifItemParser10GetValueOfERK7TDesC16R6TDes16 @ 209 NONAME
+	_ZNK13CTestModuleIf22GetTestObjFromCaseDictERK7TDesC16 @ 210 NONAME
+	_ZTI28TDesSTFLoggerOverflowHandler @ 211 NONAME
+	_ZTI29TDes8STFLoggerOverflowHandler @ 212 NONAME
+	_ZTV28TDesSTFLoggerOverflowHandler @ 213 NONAME
+	_ZTV29TDes8STFLoggerOverflowHandler @ 214 NONAME
+	_ZN13CTestModuleIf17SeperateProcessesEv @ 215 NONAME
+	_ZN13TScriptObjectD0Ev @ 216 NONAME
+	_ZN13TScriptObjectD1Ev @ 217 NONAME
+	_ZN13TScriptObjectD2Ev @ 218 NONAME
+	_ZTI13TScriptObject @ 219 NONAME ; #<TI>#
+	_ZTV13TScriptObject @ 220 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/group/TestInterface.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,89 @@
+/*
+* 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: MMP file for STIF Test Framework's TestInterface 
+* module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+TARGET          StifTestInterface.dll
+TARGETTYPE      dll
+
+CAPABILITY	ALL -TCB
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3DE
+
+VENDORID 	0x101FB657
+SECUREID        0x102073E1
+
+DEFFILE         StifTestInterface.def
+
+OS_LAYER_SYSTEMINCLUDE
+
+// ------- Logger -------
+USERINCLUDE     ../../logger/STFLogger/inc
+USERINCLUDE     ../../logger/common/inc
+SOURCEPATH      ../../logger/STFLogger/src
+
+SOURCE          STFLogger.cpp
+SOURCE          STFLoggerOverFlow.cpp
+SOURCE          StifLogger.cpp
+
+
+// ------- Parser -------
+USERINCLUDE     ../../parser/inc
+SOURCEPATH      ../../parser/src
+
+SOURCE          StifParser.cpp
+SOURCE          StifSectionParser.cpp
+SOURCE          StifItemParser.cpp
+SOURCE          StifFileParser.cpp
+
+// ------- TestInterface -------
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+SOURCEPATH      ../src
+
+SOURCE          TestInterface.cpp
+SOURCE          TestModuleIf.cpp
+SOURCE          StifTFwIfProt.cpp 
+SOURCE          TestModuleParameters.cpp 
+
+// ------- TestScripter's TestClass API -------
+USERINCLUDE     ../../../stfext/testmodules/scriptermod/inc
+SOURCEPATH      ../../../stfext/testmodules/scriptermod/src
+
+SOURCE          TestScripterInternal.cpp
+
+// ------- TestInterference -------
+USERINCLUDE     ../../testinterference/inc
+SOURCEPATH      ../../testinterference/src
+
+SOURCE          StifTestInterference.cpp
+
+LIBRARY         euser.lib   		// For TInt, etc.
+LIBRARY         efsrv.lib   		// For RFs file server
+LIBRARY         stiftestengine.lib 	// For testengine server
+LIBRARY         stiftestserver.lib 	// For testengine server
+LIBRARY         testscripter.lib 	// For testengine server
+LIBRARY         hal.lib     		// For logging (HAL)
+//LIBRARY         bafl.lib			// For file system utilities
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STIF Test Framework's TestInterface.
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	TestInterface.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/src/StifTFwIfProt.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,2165 @@
+/*
+* 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: This file conatins StifTfIfProt implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include "StifTFwIfProt.h"
+
+#include <StifLogger.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define DEBUG(a) RDebug::Print(a)
+//#define DEBUG2(a,b) RDebug::Print(a,b)
+//#define DEBUG3(a,b,c) RDebug::Print(a,b,c)
+#define DEBUG(a)
+#define DEBUG2(a,b)
+#define DEBUG3(a,b,c)
+#define ERROR RDebug::Print
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Function: <function name>
+
+    Description: <one line description>
+
+    <Description of the functionality 
+    description continues and...
+    continues>
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+/*
+<type function_name(
+    <arg_type arg,>  
+    <arg_type arg >)  	
+    {
+    // <comment>
+    <code> 
+    
+    // <comment>
+    <code>
+    }
+*/
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CStifTFwIfProt class 
+	member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: CStifTFwIfProt
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters:	none
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+CStifTFwIfProt::CStifTFwIfProt(): iMessage(0,0)
+    { 
+    };
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: ConstructL
+
+     Description: Symbian OS second phase constructor
+
+     Symbian OS default constructor can leave.
+
+     Parameters:    None
+
+     Return Values: None
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CStifTFwIfProt::ConstructL()
+    {        
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: NewL
+
+     Description: Two-phased constructor.
+          
+     Parameters:    None
+
+     Return Values: CStifTFwIfProt*: new object
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves and in oom.
+
+     Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifTFwIfProt* CStifTFwIfProt::NewL()
+    {
+     
+    CStifTFwIfProt* self = new (ELeave) CStifTFwIfProt();
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+     
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: ~CStifTFwIfProt
+
+    Description: Destructor
+
+    Parameters:	None
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/    
+
+EXPORT_C CStifTFwIfProt::~CStifTFwIfProt()
+    {
+    
+    delete iItem;
+    delete iMessageBuf;
+    iMessageBuf = NULL;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: CreateL
+
+    Description: Create new empty protocol message.
+
+    Parameters:	TInt aLength: in: protocol message length
+    
+    Return Values: None
+    
+    Errors/Exceptions: Leave if oom.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CStifTFwIfProt::CreateL( TInt aLength )
+    {
+    
+    // Delete previous if exists
+    delete iMessageBuf;
+    iMessageBuf = NULL;
+    iMessage.Set( 0, 0, 0 );
+    
+    iMessageBuf = HBufC::NewL( aLength );
+    iMessage.Set( iMessageBuf->Des() );
+            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: Append
+
+    Description: Append string to protocol message.
+
+    Parameters:	TInt aLength: in: protocol message length
+    
+    Return Values: None
+    
+    Errors/Exceptions: Leave if oom.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/   
+EXPORT_C TInt CStifTFwIfProt::Append( const TDesC& aStr )
+    {
+    
+    if( ( aStr.Length() + 1 ) >
+        ( iMessage.MaxLength() - iMessage.Length() ) )
+        {
+        ERROR( _L("No space left for string") );
+        return KErrOverflow;   
+        }
+    iMessage.Append( aStr );
+    iMessage.Append( _L(" ") );
+    
+    return KErrNone;
+
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: Append
+
+    Description: Append hexadecimal value to protocol message.
+
+    Parameters:	TInt aLength: in: protocol message length
+    
+    Return Values: None
+    
+    Errors/Exceptions: Leave if oom.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/   
+EXPORT_C TInt CStifTFwIfProt::AppendId( TUint32 aId )
+    {
+    
+     if( ( KMaxValueLength + 1 ) >
+        ( iMessage.MaxLength() - iMessage.Length() ) )
+        {
+        ERROR( _L("No space left for string") );
+        return KErrOverflow;   
+        }
+        
+    iMessage.AppendNumFixedWidth( aId, EHex, KProtocolIdLength );
+    iMessage.Append( _L(" ") );
+    
+    return KErrNone;
+
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: Append
+
+    Description: Append string to protocol message.
+
+    Parameters:	TInt aLength: in: protocol message length
+    
+    Return Values: None
+    
+    Errors/Exceptions: Leave if oom.
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/   
+EXPORT_C TInt CStifTFwIfProt::Append( KeywordFunc aFunc, TInt aKeyword )
+    {
+    
+    if( ( aFunc( aKeyword ).Length() + 1 ) >
+        ( iMessage.MaxLength() - iMessage.Length() ) )
+        {
+        ERROR( _L("No space left for string") );
+        return KErrOverflow;   
+        }
+    iMessage.Append( aFunc( aKeyword ) );
+    iMessage.Append( _L(" ") );
+    
+    return KErrNone;
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: Append
+
+    Description: Append type-value string to protocol message.
+
+    Parameters:	TInt aLength: in: protocol message length
+    
+    Return Values: None
+    
+    Errors/Exceptions: Leave if oom.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/   
+EXPORT_C TInt CStifTFwIfProt::Append( KeywordFunc aFunc, 
+                                      TInt aKeyword, 
+                                      const TDesC& aStr )
+    {
+    
+     if( ( aFunc( aKeyword ).Length() + 2 +  aStr.Length() ) >
+        ( iMessage.MaxLength() - iMessage.Length() ) )
+        {
+        ERROR( _L("No space left for string") );
+        return KErrOverflow;
+        }
+        
+    iMessage.Append( aFunc( aKeyword ) );
+    iMessage.Append( _L("=") );
+    iMessage.Append( aStr );
+    iMessage.Append( _L(" ") );
+    
+    return KErrNone;
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: Append
+
+    Description: Append type-value string to protocol message.
+
+    Parameters:	TInt aLength: in: protocol message length
+    
+    Return Values: None
+    
+    Errors/Exceptions: Leave if oom.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/   
+EXPORT_C TInt CStifTFwIfProt::Append( KeywordFunc aFunc, 
+                                      TInt aKeyword, 
+                                      KeywordFunc aValueFunc, 
+                                      TInt aValue )
+    {
+    
+     if( ( aFunc( aKeyword ).Length() + 2 +  aValueFunc( aValue ).Length() ) >
+        ( iMessage.MaxLength() - iMessage.Length() ) )
+        {
+        ERROR( _L("No space left for string") );
+        return KErrOverflow;   
+        }
+        
+    iMessage.Append( aFunc( aKeyword ) );
+    iMessage.Append( _L("=") );
+    iMessage.Append( aValueFunc( aValue ) );
+    iMessage.Append( _L(" ") );
+    
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: Append
+
+    Description: Append type-value string to protocol message.
+
+    Parameters:	TInt aLength: in: protocol message length
+    
+    Return Values: None
+    
+    Errors/Exceptions: Leave if oom.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/   
+EXPORT_C TInt CStifTFwIfProt::Append( KeywordFunc aFunc, 
+                                       TInt aKeyword, 
+                                       TInt aValue )
+    {
+    
+     if( ( aFunc( aKeyword ).Length() + 2 + KMaxValueLength ) >
+        ( iMessage.MaxLength() - iMessage.Length() ) )
+        {
+        ERROR( _L("No space left for string") );
+        return KErrOverflow;   
+        }
+        
+    iMessage.Append( aFunc( aKeyword ) );
+    iMessage.Append( _L("=") );
+    iMessage.AppendNum( aValue );
+    iMessage.Append( _L(" ") );
+    
+    return KErrNone;
+
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: SetL
+
+    Description: Set and parse protocol message.
+
+    Parameters:	TDesC& aMessage: in: protocol message
+    
+    Return Values: Symbian OS error code: If protocol message parsing fails, 
+        i.e. message prsing after header <msg type> <sdcid> <dstid>
+    
+    Errors/Exceptions: Leaves if protocol header parsing fails and oom.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIfProt::SetL( const TDesC& aMessage )
+    {
+    
+    // Delete previous if exists
+    delete iMessageBuf;
+    iMessageBuf = NULL;
+    iMessage.Set( 0,0,0 );
+    
+    iMessageBuf = aMessage.AllocL();
+    iMessage.Set( iMessageBuf->Des() );
+    
+    return ParseMessageL();
+        
+    }
+            
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: SetL
+
+    Description: Get protocol source identifier.
+
+    Parameters:	None
+    
+    Return Values: Source identifier.
+    
+    Errors/Exceptions: None.
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TUint32 CStifTFwIfProt::SrcId()
+    {
+    
+    return iSrcId;    
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: SetL
+
+    Description: Get protocol source device identifier.
+
+    Parameters:	None
+    
+    Return Values: Source device identifier.
+    
+    Errors/Exceptions: None.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TUint16 CStifTFwIfProt::SrcDevId()
+    {
+    
+    return DEVID( iSrcId );  
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: SetL
+
+    Description: Get protocol source test identifier.
+
+    Parameters:	None
+    
+    Return Values: Source test identifier.
+    
+    Errors/Exceptions: None.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TUint16 CStifTFwIfProt::SrcTestId()
+    {
+
+    return TESTID( iSrcId );  
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: SetL
+
+    Description: Get protocol destination identifier.
+
+    Parameters:	None
+    
+    Return Values: Destination identifier.
+    
+    Errors/Exceptions: None.
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TUint32 CStifTFwIfProt::DstId()
+    {
+    
+    return iDstId;  
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: SetL
+
+    Description: Get protocol destination device identifier.
+
+    Parameters:	None
+    
+    Return Values: Destination device identifier.
+    
+    Errors/Exceptions: None.
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TUint16 CStifTFwIfProt::DstDevId()
+    {
+
+    return DEVID( iDstId );  
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: SetL
+
+    Description: Get protocol destination test identifier.
+
+    Parameters:	None
+    
+    Return Values: Destination test identifier.
+    
+    Errors/Exceptions: None.
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TUint16 CStifTFwIfProt::DstTestId()
+    {
+
+    return TESTID( iDstId );  
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: ParseMessageL
+
+    Description: Parse protocol message.
+
+    Parameters:	None
+
+    Return Values: None.
+
+    Errors/Exceptions: None.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifTFwIfProt::ParseMessageL()
+    {
+    RDebug::Print(_L("CStifTFwIfProt::ParseMessageL start"));
+
+    RDebug::Print(_L("CStifTFwIfProt::ParseMessageL message content: (next line)"));
+    RDebug::Print(iMessage);
+
+    iItem = CStifItemParser::NewL( iMessage, 0, iMessage.Length() );
+
+    ParseHeaderL();
+
+    TRAPD( err,
+    switch( iMsgType )
+        {
+        case EMsgReserve:
+            RDebug::Print(_L("CStifTFwIfProt::ParseMessageL EMsgReserve"));
+            ParseReserveL();
+            break;
+        case EMsgRelease:
+            RDebug::Print(_L("CStifTFwIfProt::ParseMessageL EMsgRelease"));
+            break;
+        case EMsgRemote:
+            RDebug::Print(_L("CStifTFwIfProt::ParseMessageL EMsgRemote"));
+            ParseRemoteL();
+            break;
+        case EMsgResponse:
+            RDebug::Print(_L("CStifTFwIfProt::ParseMessageL EMsgResponse"));
+            ParseResponseL();
+            break;
+        default:
+            RDebug::Print(_L("CStifTFwIfProt::ParseMessageL ERROR invalid message type. Leaving!!!"));
+            ERROR( _L("Invalid message type") );        
+            User::Leave( KErrArgument );
+        }
+    );
+    
+    delete iItem;
+    iItem = 0;
+    
+    return err;
+           
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: ParseHeaderL
+
+    Description: Parse protocol header.
+
+    Parameters:	None
+    
+    Return Values: None.
+    
+    Errors/Exceptions: None.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void CStifTFwIfProt::ParseHeaderL()
+    {
+    
+    TPtrC tmp;
+    TInt ret;
+    TInt tmpMsgType;
+    
+    // Get and parse message type    
+    ret = iItem->GetString( _L(""), tmp );
+    if( ret != KErrNone )
+        {
+        ERROR( _L("No message type given") );        
+        User::Leave( KErrNotFound );
+        }
+        
+    tmpMsgType = Parse( tmp, MsgType );
+    if( tmpMsgType < 0 )
+        {
+        ERROR( _L("Invalid message type given") );        
+        User::Leave( KErrArgument );
+        }
+	iMsgType = ( TMsgType )tmpMsgType;
+
+    // Get and parse srcid    
+    ret = iItem->GetNextString( tmp );
+    if( ret != KErrNone )
+        {
+        ERROR( _L("No srcid given") );        
+        User::Leave( KErrNotFound );
+        }
+    // Check id length
+    if( tmp.Length() != KProtocolIdLength )
+        {
+        ERROR( _L("Invalid srcid length [%d]"), tmp.Length() );        
+        User::Leave( KErrArgument );
+        }    
+    TUint32 id;
+    TLex lex( tmp );
+    if( lex.Val( id, EHex ) != KErrNone )
+        {
+        ERROR( _L("Invalid srcid given") );        
+        User::Leave( KErrArgument );
+        }        
+    iSrcId = id;
+
+
+    // Get and parse dstid    
+    ret = iItem->GetNextString( tmp );
+    if( ret != KErrNone )
+        {
+        ERROR( _L("No dstid given") );        
+        User::Leave( KErrNotFound );
+        }
+    // Check id length
+    if( tmp.Length() != KProtocolIdLength )
+        {
+        ERROR( _L("Invalid srcid length [%d]"), tmp.Length() );        
+        User::Leave( KErrArgument );
+        }                    
+    lex.Assign( tmp );
+    if( lex.Val( id, EHex ) != KErrNone )
+        {
+        ERROR( _L("Invalid dstid given") );        
+        User::Leave( KErrArgument );
+        }        
+    iDstId = id;
+    
+    }
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: ParseReserveL
+
+    Description: Parse protocol reserve message.
+
+    Parameters:	None
+    
+    Return Values: None.
+    
+    Errors/Exceptions: None.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void CStifTFwIfProt::ParseReserveL()
+    {
+    
+    TPtrC tmp;
+    TInt ret;
+	TInt tmpRemoteType;
+    
+    // Get and parse remote type    
+    ret = iItem->GetNextString( tmp );
+    if( ret != KErrNone )
+        {
+        ERROR( _L("No remote type given") );        
+        User::Leave( KErrNotFound );
+        }
+            
+    tmpRemoteType = Parse( tmp, RemoteType );
+    if( tmpRemoteType < 0 )
+        {
+        iRemoteType = ERemoteUnknown;
+        }
+    else 
+    	{
+    	iRemoteType = ( TRemoteType ) tmpRemoteType;
+    	}
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: ParseRemoteL
+
+    Description: Parse protocol remote message.
+
+    Parameters:	None
+    
+    Return Values: None.
+    
+    Errors/Exceptions: None.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void CStifTFwIfProt::ParseRemoteL()
+    {
+    RDebug::Print(_L("CStifTFwIfProt::ParseRemoteL start"));
+
+    TPtrC tmp;
+    TInt ret;
+    TInt tmpCmdType;
+
+    // Set mode of item parser to be able to read titles with spaces inside
+    iItem->SetParsingType(CStifItemParser::EQuoteStyleParsing);
+
+    // Get and parse command
+    ret = iItem->GetNextString( tmp );
+    if( ret != KErrNone )
+        {
+        ERROR( _L("No command given") );
+        User::Leave( KErrNotFound );
+        }
+
+    iCmdDes.Set( tmp );
+    tmpCmdType = Parse( tmp, CmdType );
+    RDebug::Print(_L("CStifTFwIfProt::ParseRemoteL read command %d"), tmpCmdType);
+    if( tmpCmdType < 0 )
+        {
+        iCmdType = ECmdUnknown;
+        DEBUG( _L("Unknown command given") );        
+        }
+    else
+    	{
+    	iCmdType = ( TCmdType ) tmpCmdType;
+    	}
+        
+    switch( iCmdType )
+        {
+        case ECmdRun:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseRemoteL iCmdType ECmdRun"));
+            // Parse run parameters
+            TPtrC arg; 
+            TPtrC val;
+            iTestCaseNumber = KErrNotFound;
+            while( iItem->GetNextString( tmp ) == KErrNone )
+                {
+                if( ParseOptArg( tmp, arg, val ) == KErrNone )
+                    {              
+                    TInt param = Parse( arg, RunParams );
+                    if( param < 0 )
+                        {
+                        ERROR( _L("Invalid run parameter given") );        
+                        User::Leave( KErrArgument );
+                        }
+                    
+                    switch( param )
+                        {
+                        case ERunModule:
+                            iModule.Set( val );
+                            break;
+                        case ERunInifile:
+                            iIniFile.Set( val );
+                            break;
+                        case ERunTestcasefile:
+                            iTestCaseFile.Set( val );
+                            break;
+                        case ERunTestcasenum:
+                            {
+                            TLex ptr( val );
+                            if( ptr.Val( iTestCaseNumber ) != KErrNone )
+                                {
+                                ERROR( _L("Invalid test case number given") );        
+                                User::Leave( KErrArgument );
+                                }  
+                            }
+                            break;
+                        case ERunTitle:
+                            iTitle.Set(val);
+                            break;
+                        default:
+                            ERROR( _L("Invalid run parameter given") );        
+                            User::Leave( KErrArgument );
+                        }
+                    }
+                else
+                    {
+                    ERROR( _L("Invalid run parameter given") );        
+                    User::Leave( KErrArgument );
+                    }
+                }
+            if( iModule.Length() == 0 )
+                {
+                ERROR( _L("No mandatory test module name given as run parameter") );        
+                //User::Leave( KErrNotFound );
+                }    
+            if(iTestCaseNumber < 0 && iTitle.Length() == 0) //No test case number and no title
+                {
+                ERROR( _L("No mandatory test case number given as run parameter") );        
+                //User::Leave( KErrNotFound );
+                }    
+            }   
+            break;
+        case ECmdPause:
+        case ECmdResume:
+        case ECmdCancel:
+            RDebug::Print(_L("CStifTFwIfProt::ParseRemoteL iCmdType ECmdPause,Resume,Cancel"));
+            break;
+        case ECmdRequest:
+        case ECmdRelease:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseRemoteL iCmdType ECmdRequest,Release"));
+            ret = iItem->GetNextString( tmp );
+            if( ret != KErrNone )
+                {
+                ERROR( _L("No event name given") );        
+                //User::Leave( KErrNotFound );
+                iEventName.Set( 0, 0 );
+                }
+            else
+                {
+                iEventName.Set( tmp );
+                }
+            }
+            break;
+        case ECmdSetEvent:
+        case ECmdUnsetEvent:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseCmdResponseL ECmdSetEvent,UnsetEvent"));
+            ret = iItem->GetNextString( tmp );
+            if( ret != KErrNone )
+                {
+                ERROR( _L("No set/unset response event name given") );
+                User::Leave( KErrNotFound );
+                }
+            iEventName.Set( tmp );
+            TPtrC optParam;
+            ret = iItem->GetNextString( optParam );
+            iEventType = TEventIf::EIndication;
+            if( ret == KErrNone )
+                {
+                if ( optParam != _L("state") )
+                    {
+                    ERROR(_L("Invalid set/unset event optional argument"));
+                    User::Leave( KErrArgument );
+                    }
+                iEventType = TEventIf::EState;
+                }
+            }
+            break;            
+        case ECmdSendReceive:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseRemoteL iCmdType ECmdSendReceive"));
+            DEBUG( _L("sendreceive") );
+            break;
+            }
+        default:
+            RDebug::Print(_L("CStifTFwIfProt::ParseRemoteL iCmdType UNKNOWN!!!"));
+            DEBUG( _L("Unknown command") );
+            break;
+        }
+    }    
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: ParseResponseL
+
+    Description: Parse protocol response message.
+
+    Parameters:	None
+    
+    Return Values: None.
+    
+    Errors/Exceptions: None.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void CStifTFwIfProt::ParseResponseL()
+    {
+
+    TPtrC tmp;
+    TInt ret;
+    TInt tmpRespType;
+    TInt tmpCmdType;
+
+    // Get and parse request response type
+    ret = iItem->GetNextString( tmp );
+    if( ret != KErrNone )
+        {
+        ERROR( _L("No request type given") );
+        User::Leave( KErrNotFound );
+        }
+
+    tmpRespType = Parse( tmp, MsgType );
+    if( tmpRespType < 0 )
+        {
+        ERROR( _L("Invalid request type given") );
+        User::Leave( KErrArgument );
+        }
+    else
+    	{
+    	iRespType = ( TMsgType ) tmpRespType;
+    	}
+
+    ret = iItem->GetNextString( tmp );
+
+    // First check if this is a response to a remote command
+    if( iRespType == EMsgRemote )
+        {
+        if( ret != KErrNone )
+            {
+            ERROR( _L("No arguments for remote response given") );
+            User::Leave( KErrNotFound );
+            }
+
+        iCmdDes.Set( tmp );
+        tmpCmdType = Parse( tmp, CmdType );;
+        if( tmpCmdType >= 0 )
+            {
+			iCmdType = ( TCmdType ) tmpCmdType;
+            DEBUG2( _L("Remote response for %S"), &tmp );
+            ParseCmdResponseL();
+            // Get and parse general response parameters
+            ret = iItem->GetNextString( tmp );
+            }
+        else
+            {
+            iCmdType = (TCmdType)KErrNotFound;
+            }
+        }
+    while( ret == KErrNone )
+        {
+        TPtrC arg;
+        TPtrC val;
+        if( ParseOptArg( tmp, arg, val ) == KErrNone )
+            {              
+            TInt param = Parse( arg, RespParam );
+            if( param < 0 )
+                {
+                ERROR( _L("Invalid parameter given") );        
+                User::Leave( KErrArgument );
+                }
+            
+            switch( param )
+                {
+                case ERespResult:
+                    {
+                    TLex ptr( val );
+                    if( ptr.Val( iResult ) != KErrNone )
+                        {
+                        ERROR( _L("Invalid error code given") );        
+                        User::Leave( KErrArgument );
+                        }   
+                    }
+                    break;
+                default:
+                    ERROR( _L("Invalid parameter given") );        
+                    User::Leave( KErrArgument );
+                }       
+            }
+#if 0 // Check all parameters anyway
+        else 
+            {
+            ERROR( _L("Invalid parameter given") );        
+            User::Leave( KErrArgument ); 
+            }
+#endif
+        ret = iItem->GetNextString( tmp );
+
+        }
+    
+    }    
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIfProt
+
+    Method: ParseCmdResponseL
+
+    Description: Parse protocol command response parameters.
+
+    Parameters:	None
+    
+    Return Values: None.
+    
+    Errors/Exceptions: None.
+    
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void CStifTFwIfProt::ParseCmdResponseL()
+    {
+    
+    TPtrC tmp;
+    TPtrC arg; 
+    TPtrC val;
+    TInt ret;
+    TInt tmpRunStatus;
+    TInt tmpResultCategory;
+    TInt tmpEventStatus;
+    TInt tmpEventType;	
+    
+    RDebug::Print(_L("CStifTFwIfProt::ParseCmdResponseL start"));
+    switch( iCmdType )
+        {
+        case ECmdRun:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseCmdResponseL ECmdRun"));
+            // Parse run response status 
+            ret = iItem->GetNextString( tmp );
+            if( ret != KErrNone )
+                {
+                ERROR( _L("No run response status given") );        
+                User::Leave( KErrNotFound );
+                }
+            
+            tmpRunStatus = Parse( tmp, RunStatus );;
+            if( tmpRunStatus < 0 )
+                {
+                ERROR( _L("Invalid run status in response given") );        
+                User::Leave( KErrArgument );
+                }
+            else
+            	{
+            	iRunStatus = (TRunStatus) tmpRunStatus;
+            	}
+            
+            // Parse runs status parameters
+            while( iItem->GetNextString( tmp ) == KErrNone )
+                {
+                if( ParseOptArg( tmp, arg, val ) == KErrNone )
+                    {              
+                    TInt param = Parse( arg, RunStatusParams );
+                    if( param < 0 )
+                        {
+                        ERROR( _L("Invalid run status parameter given") );        
+                        User::Leave( KErrArgument );
+                        }
+                    
+                    switch( param )
+                        {
+                        case ERunResult:
+                            {
+                            TLex ptr( val );
+                            if( ptr.Val( iResult ) != KErrNone )
+                                {
+                                ERROR( _L("Invalid run result given") );        
+                                User::Leave( KErrArgument );
+                                }  
+                            }
+                            break;
+                        case ERunCategory:
+                            tmpResultCategory = Parse( val, ResultCategory );
+                            if( tmpResultCategory < 0 )
+                                {
+                                ERROR( _L("Invalid run result category given") );        
+                                User::Leave( KErrArgument );
+                                }
+                            else 
+                            	{
+                            	iResultCategory = ( TResultCategory ) tmpResultCategory;
+                            	}
+                            break;
+                        default:
+                            ERROR( _L("Invalid run status parameter given") );        
+                            User::Leave( KErrArgument );
+                        }
+                    }
+                else
+                    {
+                    ERROR( _L("Invalid run status parameter given") );        
+                    User::Leave( KErrArgument );                    
+                    }
+                }
+            }           
+            break;
+        case ECmdPause:
+        case ECmdResume:
+        case ECmdCancel:
+            RDebug::Print(_L("CStifTFwIfProt::ParseCmdResponseL ECmdPause,Resume,Cancel"));
+            break;
+        case ECmdRequest:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseCmdResponseL ECmdRequest"));
+            // Parse event request response status
+            ret = iItem->GetNextString( tmp );
+            if( ret != KErrNone )
+                {
+                ERROR( _L("No request response status given") );        
+                User::Leave( KErrNotFound );
+                }
+            
+            tmpEventStatus = Parse( tmp, EventStatus );
+            if( tmpEventStatus < 0 )
+                {
+                ERROR( _L("Invalid request status in response given") );        
+                User::Leave( KErrArgument );
+                }
+            else
+            	{
+            	iEventStatus = (TEventStatus) tmpEventStatus;
+            	}
+            
+            // Parse request response event name
+            ret = iItem->GetNextString( tmp );
+            if( ret != KErrNone )
+                {
+                ERROR( _L("No request response event name given") );        
+                User::Leave( KErrNotFound );
+                }
+            iEventName.Set( tmp );    
+            
+            // Parse request response status parameters
+            while( iItem->GetNextString( tmp ) == KErrNone )
+                {
+                if( ParseOptArg( tmp, arg, val ) == KErrNone )
+                    {              
+                    TInt param = Parse( arg, EventStatusParams );
+                    if( param < 0 )
+                        {
+                        ERROR( _L("Invalid request response status parameter given") );        
+                        User::Leave( KErrArgument );
+                        }
+                    
+                    switch( param )
+                        {
+                        case EEventResult:
+                            {
+                            TLex ptr( val );
+                            if( ptr.Val( iResult ) != KErrNone )
+                                {
+                                ERROR( _L("Invalid request response status parameter result given") );        
+                                User::Leave( KErrArgument );
+                                }  
+                            }
+                            break;
+                        case EEventType:
+                            tmpEventType = Parse( val, EventType );;
+                            if( tmpEventType < 0 )
+                                {
+                                ERROR( _L("Invalid request response status parameter event type given") );        
+                                User::Leave( KErrArgument );
+                                }
+                            else
+                            	{
+                            	iEventType = ( TEventIf::TEventType ) tmpEventType;
+                            	}
+                            break;
+                        default:
+                            ERROR( _L("Invalid request response status parameter given") );        
+                            User::Leave( KErrArgument );
+                        }
+                    }
+                else
+                    {
+                    ERROR( _L("Invalid request response status parameter given") );        
+                    User::Leave( KErrArgument );            
+                    }    
+                }
+            }
+            break;
+        case ECmdRelease:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseCmdResponseL ECmdRelease"));
+            // Parse release response event name
+            ret = iItem->GetNextString( tmp );
+            if( ret != KErrNone )
+                {
+                ERROR( _L("No release response event name given") );        
+                User::Leave( KErrNotFound );
+                }
+            iEventName.Set( tmp );
+            }
+            break;
+        case ECmdSetEvent:
+        case ECmdUnsetEvent:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseCmdResponseL ECmdSetEvent,UnsetEvent"));
+            // Parse release response event name
+            ret = iItem->GetNextString( tmp );
+            if( ret != KErrNone )
+                {
+                ERROR( _L("Set/unset invalid response") );
+                User::Leave( KErrNotFound );
+                }
+            
+            tmpEventStatus = Parse( tmp, EventStatus );
+            if( tmpEventStatus >= 0 )
+                {
+                iEventStatus = (TEventStatus) tmpEventStatus;
+                ret = iItem->GetNextString( tmp );
+                if( ret != KErrNone )
+                    {
+                    ERROR( _L("No set/unset response event name given") );
+                    User::Leave( KErrNotFound );
+                    }
+                iEventName.Set( tmp );
+                }
+            else
+                {
+                if( ParseOptArg( tmp, arg, val ) == KErrNone )
+                    {              
+                    TInt param = Parse( arg, EventStatusParams );
+                    if( param < 0 )
+                        {
+                        ERROR( _L("Invalid request response status parameter given") );        
+                        User::Leave( KErrArgument );
+                        }
+                    
+                    if ( param == EEventResult )
+                        {
+                        TLex ptr( val );
+                        if( ptr.Val( iResult ) != KErrNone )
+                            {
+                            ERROR( _L("Invalid request response status parameter result given") );        
+                            User::Leave( KErrArgument );
+                            }  
+                        }
+                    else
+                        {
+                        ERROR( _L("Invalid request response status parameter given") );        
+                        User::Leave( KErrArgument );
+                        }                    
+                    }
+                else
+                    {
+                    ERROR( _L("Expected remote event set/unset result") );
+                    User::Leave( KErrArgument );                    
+                    }            
+                }
+            
+            // Parse request response status parameters
+            while( iItem->GetNextString( tmp ) == KErrNone )
+                {
+                if( ParseOptArg( tmp, arg, val ) == KErrNone )
+                    {              
+                    TInt param = Parse( arg, EventStatusParams );
+                    if( param < 0 )
+                        {
+                        ERROR( _L("Invalid request response status parameter given") );        
+                        User::Leave( KErrArgument );
+                        }
+                    
+                    if ( param == EEventType )
+                        {
+                        tmpEventType = Parse( val, EventType );;
+                        if( tmpEventType < 0 )
+                            {
+                            ERROR( _L("Invalid request response status parameter event type given") );        
+                            User::Leave( KErrArgument );
+                            }
+                        else
+                            {
+                            iEventType = ( TEventIf::TEventType ) tmpEventType;
+                            }
+                        }
+                    else
+                        {
+                        ERROR( _L("Invalid request response status parameter given") );        
+                        User::Leave( KErrArgument );
+                        }
+                    }
+                else
+                    {
+                    ERROR( _L("Invalid request response status parameter given") );        
+                    User::Leave( KErrArgument );            
+                    }    
+                }            
+            }
+            break;
+        case ECmdSendReceive:
+            {
+            RDebug::Print(_L("CStifTFwIfProt::ParseCmdResponseL ECmdSendReceive"));
+            // Parse sendreceive response status
+            ret = iItem->GetNextString( tmp );
+            if( ret != KErrNone )
+                {
+                ERROR( _L("No run response status given") );        
+                User::Leave( KErrNotFound );
+                }
+            
+            tmpRunStatus = Parse( tmp, RunStatus );
+            if( tmpRunStatus < 0 )
+                {
+                ERROR( _L("Invalid run status in response given") );        
+                User::Leave( KErrArgument );
+                }
+            else
+            	{
+            	iRunStatus = (TRunStatus) tmpRunStatus;
+            	}
+            break;
+            }
+        default:
+            ERROR( _L("Invalid command response") );        
+            User::Leave( KErrArgument );
+        
+        }      
+    }
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: MsgType
+
+     Description: Returns a string desrciptor corresponding 
+        to message type number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::MsgType( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"reserve",
+        (TText*)L"release",
+        (TText*)L"remote",
+        (TText*)L"response",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: ResultCategory
+
+     Description: Returns a string desrciptor corresponding 
+        to result category number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::CmdType( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"run",
+        (TText*)L"pause",
+        (TText*)L"resume",
+        (TText*)L"cancel",
+        (TText*)L"request",
+        (TText*)L"release",
+        (TText*)L"sendreceive",
+        (TText*)L"set",
+        (TText*)L"unset",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: RemoteType
+
+     Description: Returns a string desrciptor corresponding 
+        to remote type number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::RemoteType( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"phone",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: RunParams
+
+     Description: Returns a string desrciptor corresponding 
+        to run parameter number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::RunParams( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"module",
+        (TText*)L"inifile",
+        (TText*)L"testcasefile",
+        (TText*)L"testcasenum",
+        (TText*)L"title",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+  
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: RunStatus
+
+     Description: Returns a string desrciptor corresponding 
+        to run status number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::RunStatus( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"started",
+        (TText*)L"error",
+        (TText*)L"ready",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: RunStatusParams
+
+     Description: Returns a string desrciptor corresponding 
+        to run status parameter number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::RunStatusParams( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"result",
+        (TText*)L"category",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: ResultCategory
+
+     Description: Returns a string desrciptor corresponding 
+        to command type number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::ResultCategory( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"normal",
+        (TText*)L"panic",
+        (TText*)L"exception",
+        (TText*)L"timeout",
+        (TText*)L"leave",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: EventStatus
+
+     Description: Returns a string desrciptor corresponding 
+        to command type number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::EventStatus( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"active",
+        (TText*)L"set",
+        (TText*)L"error",
+        (TText*)L"unset",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: EventStatusParams
+
+     Description: Returns a string desrciptor corresponding 
+        to command type number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::EventStatusParams( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"result",
+        (TText*)L"type",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: EventType
+
+     Description: Returns a string desrciptor corresponding 
+        to event type number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::EventType( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"indication",
+        (TText*)L"state",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: RespParam
+
+     Description: Returns a string desrciptor corresponding 
+        to response parameter number. 
+
+     Parameters:    TInt aKeyword: in: keyword index.
+     
+     Return Values: TPtrC: keyword descriptor
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TPtrC CStifTFwIfProt::RespParam( TInt aKeyword )
+    {
+    static TText* const keywords[] =
+        {
+        (TText*)L"result",
+        };
+    
+    if( (TUint)aKeyword >= (sizeof( keywords )/sizeof(TText*)) )
+          {
+          TPtrC null;
+          return null;
+          } 
+    
+    TPtrC keyword( keywords[ aKeyword ] ); 
+    return keyword;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: SetSrcId
+
+     Description: Set protocol source identifier.
+
+     Parameters: TUint32 aSrcId: in: source identifier
+     
+     Return Values: Symbian OS error code
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIfProt::SetSrcId( TUint32 aSrcId )
+    {
+    
+    iSrcId = aSrcId;
+    return AppendId( iSrcId );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: SetDstId
+
+     Description: Set protocol destination identifier.
+
+     Parameters: TUint32 aDstId: in: destination identifier
+     
+     Return Values: Symbian OS error code
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CStifTFwIfProt::SetDstId( TUint32 aDstId )
+    {
+    
+    iDstId = aDstId;
+    return AppendId( iDstId );
+    
+    }
+    
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: SetMsgType
+
+     Description: Set message type.
+
+     Parameters: TMsgType iMsgType: in: message type
+     
+     Return Values: Symbian OS error code
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CStifTFwIfProt::SetMsgType( TMsgType aMsgType )
+    {
+    
+    iMsgType = aMsgType;
+    return Append( CStifTFwIfProt::MsgType, iMsgType );
+    
+    }
+    
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: SetRespType
+
+     Description: Set response type.
+
+     Parameters:    TMsgType iMsgType : in: set response type
+     
+     Return Values: Symbian OS error code
+     
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CStifTFwIfProt::SetRespType( TMsgType aRespType )
+    {
+    
+    iRespType = aRespType;
+    return Append( CStifTFwIfProt::MsgType, iRespType );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: SetCmdType
+
+     Description: Set command type.
+
+     Parameters: TCmdType iCmdType: in: command type
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIfProt::SetCmdType( TCmdType aCmdType )
+    {
+    
+    iCmdType = aCmdType;
+    return Append( CStifTFwIfProt::CmdType, iCmdType );
+    
+    }
+
+    
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: Parse
+
+     Description: Returns a keyword enum corresponding to keyword 
+                  string descriptor.
+
+     Parameters:    TPtrC aKeyword: in: keyword descriptor.
+                    KeywordFunc aFunc: in: Function pointer to keyword parser 
+     
+     Return Values: TInt: keyword index
+                    KErrNotFound: Keyword does not exists
+
+     Errors/Exceptions: None
+     
+     Status: Draft 
+    
+------------------------------------------------------------------------------
+*/
+TInt CStifTFwIfProt::Parse( TDesC& aKeyword, KeywordFunc aFunc )
+    {
+    TInt ind;
+    for( ind = 0; aFunc( ind ).Length() > 0; ind++ )
+        {
+        if( aFunc( ind ) == aKeyword )
+            {
+            return ind;
+            }
+        }
+    return KErrNotFound;
+    };
+    
+    
+    /*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFwIfProt
+
+     Method: ParseOptArgL
+
+     Description: Parses optional argument 
+  
+     Parameters: const TDesC& aOptArg: in: 
+                    argument-value pair (format arg=value)
+                 TPtrC& aArg: out: parsed argument  
+                 TPtrC& aVal: out: parsed value
+     
+     Return Values: KErrNone: Everything ok
+                    Symbian OS error code: Not a valid optarg
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CStifTFwIfProt::ParseOptArg( const TDesC& aOptArg, 
+                                   TPtrC& aArg, 
+                                   TPtrC& aVal )
+    { 
+    TInt length = aOptArg.Length();
+    for( TInt i=0; i < length; i++) 
+        {
+        // find the '=' sign 
+        if( aOptArg[i] == '=' )
+            {
+            if( i+1 >= length )
+                {
+                return KErrArgument;
+                }
+            aArg.Set( aOptArg.Left( i ) );
+            aVal.Set( aOptArg.Mid( i+1 ) );
+            DEBUG3(  _L( "arg '%S', val '%S'" ),
+                &aArg, &aVal );        
+            return KErrNone;
+            }
+        }
+    return KErrArgument;
+    
+    }     
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/src/TestInterface.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,619 @@
+/*
+* 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: This file contains TestInterface implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32std.h>
+#include "StifTestInterface.h"
+#include "TestServerModuleIf.h"
+#include "StifTestModule.h"
+#include <stifinternal/TestServerClient.h>
+//#include <bautils.h>
+#include "version.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
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: StifDriveLetters
+
+    Description: This defines drive letters that is available in STIF TF.
+
+    Parameters: TInt aDriveNumber: in: Number to indicate drive letter
+                TInt& aCount: inout: Counts of drives that is available
+
+    Return Values: const TChar: Returns a drive letter that is select by
+                   aDriveNumber
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+//@spe
+/*
+EXPORT_C const TChar StifDriveLetters( TInt aDriveNumber, TInt& aCount )
+    {
+    static TChar* const EStifDriveLetters[] =
+        {
+        ( TChar* )L"a",
+        ( TChar* )L"b",
+        ( TChar* )L"c",
+        ( TChar* )L"d",
+        ( TChar* )L"e",
+        ( TChar* )L"f",
+        ( TChar* )L"g",
+        ( TChar* )L"h",
+        ( TChar* )L"i",
+        ( TChar* )L"j",
+        ( TChar* )L"k",
+        ( TChar* )L"l",
+        ( TChar* )L"m",
+        ( TChar* )L"n",
+        ( TChar* )L"o",
+        ( TChar* )L"p",
+        ( TChar* )L"q",
+        ( TChar* )L"r",
+        ( TChar* )L"s",
+        ( TChar* )L"t",
+        ( TChar* )L"u",
+        ( TChar* )L"v",
+        ( TChar* )L"w",
+        ( TChar* )L"x",
+        ( TChar* )L"y",
+        ( TChar* )L"z",
+        };
+    aCount = (sizeof( EStifDriveLetters )/sizeof(TChar*));
+    return TChar( *EStifDriveLetters[aDriveNumber] );
+
+    }
+*/
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TTestCaseInfo class 
+    member function.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TTestCaseInfo
+
+    Method: TTestCaseInfo
+
+    Description: This method is the constructor of class TTestCaseInfo.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TTestCaseInfo::TTestCaseInfo() 
+    {
+    iCaseNumber = -1;
+    iTitle.Zero();
+    iTimeout = 0;
+    iPriority = EPriorityNormal;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TTestInfo class 
+    member function.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TTestInfo
+
+    Method: TTestInfo
+
+    Description: This method is the constructor of class TTestInfo.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TTestInfo::TTestInfo()
+    {
+
+    iModuleName.Zero();
+    iConfig.Zero();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TTestResult class 
+    member function.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TTestResult
+
+    Method: TTestResult
+
+    Description: This method is the constructor of class TTestResult.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TTestResult::TTestResult()
+    {
+    iResult = 0;
+    iResultDes.Zero();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TTestResult
+
+    Method: TTestResult
+
+    Description: Sets result and result description of the test case.
+    
+    Parameters: TInt aResultCode: in: Symbian error code
+                const TResultDes& aResultDes: in: Result description of the
+                test case
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void TTestResult::SetResult( TInt aResultCode,
+                                        const TDesC& aResultDes )
+    {
+    iResult = aResultCode;
+    // If description is too length then cut.
+    if( aResultDes.Length() > KStifMaxResultDes )
+        {
+        iResultDes = aResultDes.Left( KStifMaxResultDes );
+        }
+    else
+        {
+        iResultDes = aResultDes;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TFullTestResult class 
+    member function.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TFullTestResult
+
+    Method: TFullTestResult
+
+    Description: This method is the constructor of class TFullTestResult.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TFullTestResult::TFullTestResult():
+    iStartTime( 0 ),
+    iEndTime( 0 )
+    {    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TTestProgress class 
+    member function.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TTestProgress
+
+    Method: TTestProgress
+
+    Description: This method is the constructor of class TTestProgress.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TTestProgress::TTestProgress()
+    {
+    iPosition = 0;
+    iDescription.Zero();
+    iText.Zero();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of TErrorNotification class 
+    member function.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TErrorNotification
+
+    Method: TErrorNotification
+
+    Description: This method is the constructor of class TTestProgress.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TErrorNotification::TErrorNotification()
+    {
+    iPriority = 0;
+    iModule.Zero();
+    iText.Zero();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: StartSession
+
+    Description: This works and used only in EKA2 environment and used from
+                 STIF TestFramework internally.
+                 Executable module uses defined capabilities(PlatSec's
+                 Capability model) to start session. Function for starting
+                 the TestServer and Testmodule/TestClass.
+    
+                 Starts a new server. Server will be running its own
+                 thread and this functions returns when server is up and
+                 running or server start-up fails.
+
+    Parameters: None
+    
+    Return Values: TInt Error code / KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt StartSession()
+    {
+    //__UHEAP_MARK;
+
+    // Get module name from command line
+	const TInt length = User().CommandLineLength();
+    HBufC* cmdLine = HBufC::New( length );
+    
+    if ( cmdLine == NULL )
+        {
+        //__UHEAP_MARKEND;
+        return KErrNoMemory;
+        }
+
+    TPtr moduleName = cmdLine->Des();
+    User().CommandLine( moduleName );
+
+    RDebug::Print(_L("StartSession() Received data [%S]"), &moduleName);
+
+    // Extract semaphore name passed in data    
+    TInt index = moduleName.Find(_L(" "));
+    RDebug::Print(_L("StartSession() Space separator found at position [%d]"), index);
+    TPtrC semaphoreName = moduleName.Mid(index + 1);
+    moduleName = moduleName.Left(index);
+
+    RDebug::Print(_L("StartSession() Extracted module name [%S] and sempahore name [%S]"), &moduleName, &semaphoreName);
+   
+    // Open start-up synchronization semaphore
+    RSemaphore startup;
+    RDebug::Print(_L(" Opening start-up semaphore"));
+//    TName semaphoreName = _L("startupSemaphore");
+//    semaphoreName.Append( moduleName );
+    
+    TInt res = startup.OpenGlobal(semaphoreName);
+    RDebug::Print(_L("Opening result %d"), res);    
+
+
+    TFileName serverName;
+    TInt r = StartNewServer ( moduleName, serverName, EFalse, startup);    
+
+    if ( r ==   KErrAlreadyExists )
+        {        
+        // Ok, server was already started
+        RDebug::Print(_L("Server already started, signaling semaphore and exiting"));
+        startup.Signal();        
+        //__UHEAP_MARKEND;
+        
+        delete cmdLine;
+        
+        return KErrNone;
+        }
+    else
+        {       
+        RDebug::Print(_L("Server is finished, code %d"), r);
+        }
+
+    //__UHEAP_MARKEND;
+
+	// Program execution never comes here, because StartNewServer doesn't return
+	// unless server is already started.
+	
+    delete cmdLine;
+    
+    // Return start-up result.
+    return r;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TStifUtil
+
+    Method: CorrectFilePath
+
+    Description: Checks if file path contains drive letter. If not file is serched
+                 on all drives and first hit is added to file name.
+
+    Parameters: TDes& aFilePath: in/out: file path to correct
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void TStifUtil::CorrectFilePathL( TDes& aFilePath )
+	{
+	_LIT( KDriveSelector, ":\\" );
+	_LIT( KDriveSelectorFormat_1, "%c:" );                                                                  
+	_LIT( KDriveSelectorFormat_2, "%c:\\" );                                                                
+	TChar KDriveZ = EDriveZ;//'Z';                                                                          
+	                                                                                                              
+	_LIT( KBackslash, "\\" );                                                                              
+	                                                                                                                
+	TInt length = aFilePath.Length();                                                                      
+	                                                                                                                
+	if (length == 0 )                                                                                     
+	   {                                                                                                  
+	   return;                                                                                            
+	   }                                                                                                  
+	if (length > 2 )                                                                                      
+	   {                                                                                                  
+	   // Check if file path contains drive selector                                                      
+	   if ( aFilePath.Mid( 1, 2 ) == KDriveSelector )                                                     
+	       {                                                                                               
+	       // File path contains selector letter so we have nothing to do here                             
+	       return;                                                                                         
+	       }                                                                                               
+	   }                                                                                                  
+	                                                                                                                
+	// Check if file path contains backslash at the begining and                                          
+	// select proper drive selector format according to this information                                  
+	TInt driveSelectorFormat = 2;                                                                         
+	if ( aFilePath.Mid( 0, 1 ) == KBackslash )                                                            
+	   {                                                                                               
+	   driveSelectorFormat = 1;                                                                        
+	   }                                                                                               
+	                                                                                                                
+	RFs rfs;                                                                                              
+	if ( rfs.Connect() != KErrNone )                                                                      
+	   {                                                                                                  
+	   return;                                                                                            
+	   }                                                                                                  
+	                                                                                                                
+	// Get available drives list, revers it order and move z drive at                                     
+	// the end of the list.  
+	TDriveList drivesList; 
+	rfs.DriveList(drivesList); 
+
+	// Set drive variable to last drive (except for Z, which will be checked at the end)
+	char drive = 'Y' ;
+
+	// Loop through all the drives in following order: YX..CBAZ
+	while(drive >= 'A' && drive <= 'Z')
+	     {
+	     // Do further action only if drive exists
+	     TInt driveint;
+	     rfs.CharToDrive(drive, driveint);
+	     if(drivesList[driveint])
+	          {
+	          //further checking (drive selector and file existence)
+	          
+	          // Prepare drive selector                                                                         
+	          TBuf<3> driveSelector;                                                                            
+	          if ( driveSelectorFormat == 1 )                                                                   
+	              {                                                                                           
+	              driveSelector.Format( KDriveSelectorFormat_1, drive );                                    
+	              }                                                                                           
+	          else if ( driveSelectorFormat == 2 )                                                              
+	              {                                                                                           
+	              driveSelector.Format( KDriveSelectorFormat_2, drive );                                    
+	              }                                                                                           
+	                                                                                                                
+	          aFilePath.Insert( 0, driveSelector );                                                             
+	                                                                                                                
+	          TEntry entry;                                                                                     
+	          if ( rfs.Entry(aFilePath, entry) == KErrNone )                                                    
+	              {                                                                                         
+	              rfs.Close();                                                                                
+	              return;                                                                                     
+	              }                                                                                           
+	                                                                                                                
+	          // File does not exists on selected drive. Restoring orginal file path                            
+	          aFilePath.Delete( 0, driveSelector.Length() );    	         
+	          }//if(drivesList[driveint])       
+	            
+	   // Select next drive
+	   if(drive == 'Z')
+	       break; // the last driver
+	   else if(drive ==  'A' )
+	       drive = 'Z'; //after checking A check Z
+	   else
+	       drive =  (TChar)(TInt(drive)-1) ; //after checking Y check X and so on in reverse alphabetical order
+	   } //while 
+	rfs.Close(); 
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TStifUtil
+
+    Method: STIFVersion
+
+    Description: Method used to retrieve version of STIF by both STIF and STIF UI 
+
+    Parameters: TInt& aMajorV - parameter used to pass major STIF version
+     			TInt& aMinorV - parameter used to pass minor STIF version
+     			TInt& aBuildV - parameter used to pass build version of STIF
+     			TDes& aRelDate - parameter used to pass information about release date
+
+    Return Values: None
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void TStifUtil::STIFVersion(TInt& aMajorV, TInt& aMinorV, TInt& aBuildV, TDes& aRelDate)
+	{
+	aMajorV = STIF_MAJOR_VERSION;
+	aMinorV = STIF_MINOR_VERSION;
+	aBuildV = STIF_BUILD_VERSION;
+	aRelDate = TO_UNICODE(STIF_REL_DATE);
+	}
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/src/TestModuleIf.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1908 @@
+/*
+* 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: This file contains TestModuleIf implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include "StifTFwIfProt.h"
+#include "StifTestInterface.h"
+#include "TestServerModuleIf.h"
+#include "StifTestModule.h"
+#include "TestThreadContainer.h"
+#include "STIFMeasurement.h"
+#include "TestScripterInternal.h"
+#include <e32property.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+const TUid KPropertyCat =
+    {
+    0x101FB3DE
+    };
+const TUint KPropertyKey = 0x00000001;
+
+// MACROS
+// Debugging is enabled with next define
+#define __TRACING_ENABLED
+#ifdef __TRACING_ENABLED
+#define __RDEBUG(p) RDebug::Print p 
+#else
+#define __RDEBUG(p)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+static RPointerArray<TScriptObject> *getDict()
+    {
+    TInt script = 0;
+    TInt err = RProperty::Get(KPropertyCat, RProcess().Id().Id(), script);
+    if (err != KErrNone)
+        {
+        return NULL;
+        }
+    return (RPointerArray<TScriptObject> *) script;
+    }
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    TDesOverflowHandler class contains a simple overflow handler implementation.
+
+-------------------------------------------------------------------------------
+*/
+class TDesOverflowHandler : public TDes16Overflow
+    {
+    public:
+        TDesOverflowHandler( CTestModuleIf* aModuleIf, 
+                             const TInt aPriority, 
+                             const TDesC& aDefinition)
+            {
+            iModuleIf = aModuleIf;
+            iPriority = aPriority;
+            iDefinition = aDefinition;
+            }
+
+        void Overflow(TDes16& /*aDes*/ )
+            { 
+            }
+    
+        CTestModuleIf* iModuleIf;
+        TInt iPriority;
+        TStifInfoName iDefinition;
+    };
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CTestModuleIf class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: CTestModuleIf
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: None
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTestModuleIf::CTestModuleIf( CTestThreadContainer* aTestExecution ) :
+    iTestExecution( aTestExecution )
+    {
+    iNumberInGlbDict = 0;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: CTestExecution* aTestExecution: in: Pointer to TestExecution
+                CTestModuleBase* aTestModule: in: Pointer to TestModule
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModuleIf::ConstructL( CTestModuleBase* aTestModule )
+    {
+
+    if ( aTestModule->iTestModuleIf != NULL)
+        {
+        delete aTestModule->iTestModuleIf;
+        aTestModule->iTestModuleIf = NULL;
+        }
+    aTestModule->iTestModuleIf = this; 
+
+    iIsRebootReady = EFalse;
+    iStoreStateCounter = 0;
+
+    // Used to "resets" iTestCaseResults array
+    iAllowTestCaseResultsCount = 0;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestExecution* aTestExecution: in: Pointer to TestExecution
+                CTestModuleBase* aTestModule: in: Pointer to TestModule
+    
+    Return Values: CTestModuleIf object.
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModuleIf* CTestModuleIf::NewL( CTestThreadContainer* aExecutionSession, 
+                                             CTestModuleBase* aTestModule )
+    {
+
+    CTestModuleIf* self = 
+        new (ELeave) CTestModuleIf( aExecutionSession );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aTestModule );
+
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: ~CTestModuleIf
+
+    Description: Destructor
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+    
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/    
+CTestModuleIf::~CTestModuleIf()
+    {
+    iTestExecution = NULL;
+
+    // Used to "resets" iTestCaseResults array
+    iAllowTestCaseResultsCount = 0;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: Printf
+
+    Description: Printing
+
+    Printf is used to provide different information up to the UI 
+    that can be then printed e.g. to the Console Screen. 
+    The priority can be used in the UI to decide if the information 
+    received from the Test DLL will be discarded or not in 
+    the different performance situations. The priority is also 
+    used in the Test DLL server and in the Test Engine to queue 
+    the Printf responses.
+    This method is implemented in Test DLL Server and the Test DLL 
+    can call it to provide printable information to the UI.
+
+    Parameters:  const TInt aPriority: in: 
+                    Importance of the returned information
+                 const TDesC& aDefinition: in: 
+                    Definition of data to be printed 
+                 TRefByValue<const TDesC> aFmt: in: Printed data
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CTestModuleIf::Printf( const TInt aPriority, 
+                                     const TDesC& aDefinition, 
+                                     TRefByValue<const TDesC> aFmt,
+                                     ... 
+                                   )
+    {           
+
+    if( !IsServerAlive() )
+        {
+        return;
+        }
+
+    VA_LIST list;
+    VA_START(list,aFmt);
+    TName aBuf;
+    RBuf buf;
+    TInt ret = buf.Create(1024);
+    if(ret != KErrNone)
+        {
+        __RDEBUG((_L("STF: Printf: Buffer creation failed [%d]"), ret));
+        return;
+        }
+
+    // Cut the description length
+    TInt len = aDefinition.Length();
+    if ( len > KMaxInfoName )
+        {
+        len = KMaxInfoName;
+        }
+
+    TStifInfoName shortDescription = aDefinition.Left(len);
+
+    // Create overflow handler
+    TDesOverflowHandler overFlowHandler (this, aPriority, shortDescription);
+
+    // Parse parameters
+    buf.AppendFormatList(aFmt, list, &overFlowHandler);
+    
+    if(buf.Length() == 0)
+        {
+        __RDEBUG((_L("STF: Printf: Unable to prepare print buffer (probably printed string is too long)")));
+        }
+
+    // Print
+    aBuf.Copy(buf.Left(aBuf.MaxLength()));
+    buf.Close();
+
+    iTestExecution->DoNotifyPrint( aPriority, shortDescription, aBuf );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: Event
+
+    Description: Event control.
+
+    Event function is used to control and use the event system. 
+    TEventIf &aEvent encapsulates the request type and 
+    the event name, see StifTestEventInterface.h for more information.
+    This method is implemented in Test DLL Server and the Test DLL 
+    can call it to control the event system.
+  
+    Parameters: TEventIf& aEvent: in: Event command
+    
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TInt CTestModuleIf::Event( TEventIf& aEvent )
+    {
+
+    if( !IsServerAlive() )
+        {
+        return KErrGeneral;
+        }
+
+    // All event commands are handled in testserver and testengine
+    return iTestExecution->DoNotifyEvent( aEvent );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: Event
+
+    Description: Event control.
+
+    Asynchronous version of event control function.
+    It is used to control and use the event system asynchronously. 
+    TEventIf &aEvent encapsulates the request type and 
+    the event number, see StifTestEventInterface.h for more information.
+    This method is implemented in Test DLL Server and the Test DLL 
+    can call it to control the event system.
+  
+    Parameters: TEventIf& aEvent: in: Event command
+                TRequestStatus& aStatus: in: Request status parameter
+
+    Return Values: None. 
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C void CTestModuleIf::Event( TEventIf& aEvent, TRequestStatus& aStatus )
+    {
+    TInt ret = KErrNone;
+
+    if( !IsServerAlive() )
+        {
+        __RDEBUG( (_L("iTestExecution not initialised")));
+        ret = KErrGeneral;
+        }
+    else
+        {        
+        aStatus = KRequestPending;
+
+        // All event commands are handled in testserver and testengine
+        ret = iTestExecution->DoNotifyEvent( aEvent, &aStatus );
+        }
+    if( ret != KErrNone )
+        {
+        TRequestStatus* rs = &aStatus;
+        User::RequestComplete( rs, ret );
+        }
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: CancelEvent
+
+    Description: Cancel asynchronous event control call.
+  
+    Parameters: TEventIf& aEvent: in: Event command to be cancelled.
+                const TRequestStatus* aStatus: in: 
+                    Pointer to TRequestStatus parameter that is cancelled
+
+    Return Values: Symbian OS error code.
+    
+    Errors/Exceptions: None
+    
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TInt CTestModuleIf::CancelEvent( TEventIf& aEvent,
+                                          TRequestStatus* aStatus )
+    {
+     if( !IsServerAlive() )
+        {
+        __RDEBUG( (_L("iTestExecution not initialised")));
+        return KErrGeneral;
+        }
+
+    // All event commands are handled in testserver and testengine
+    iTestExecution->CancelEvent( aEvent, aStatus );
+    
+    return KErrNone;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: SetExitReason
+
+    Description: Set exit reason
+  
+    Parameters: const TExitReason aExitReason in: Exit reason
+                const TInt aExitCode in: Exit code
+
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C void CTestModuleIf::SetExitReason( const CTestModuleIf::TExitReason aExitReason, 
+                                            const TInt aExitCode )
+        
+    {
+
+     if( !IsServerAlive() )
+        {
+        __RDEBUG( (_L("iTestExecution not initialised")));
+        return;
+        }
+    
+    iTestExecution->SetExitReason( aExitReason, aExitCode );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: RemoteSend
+
+    Description: RemoteSend is used to send control protocol messages to slaves
+        (e.g. another phone, call box, ...). 
+    
+    Parameters:  const TDesC& aRemoteMsg: in: 
+                    Remote command protocol message 
+                 
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::RemoteSend( const TDesC& aRemoteMsg )
+    {           
+
+    if( !IsServerAlive() )
+        {
+        __RDEBUG( ( _L("iTestExecution not initialised") ) );
+        return KErrNotReady;
+        }
+
+    TParams params;
+    params.aRemoteMsgConstRef = &aRemoteMsg;
+
+    TRequestStatus status = KRequestPending; 
+
+    // Forward
+    iTestExecution->DoRemoteReceive( EStifCmdSend, params, 
+                                     aRemoteMsg.Length(), status );
+    
+    User::WaitForRequest( status );
+
+    return status.Int();
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: RemoteReceive
+
+    Description: RemoteReceive is used to receive control protocol messages to 
+        slaves (e.g. another phone, call box, ...). 
+    
+    Parameters:  const TDesC& aRemoteMsg: in: 
+                    Remote command protocol message 
+                 TRequestStatus& aStatus: in: Request status parameter
+
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CTestModuleIf::RemoteReceive( TDes& aRemoteMsg, 
+                                            TRequestStatus& aStatus )
+    {           
+    aStatus = KRequestPending;
+    if( !IsServerAlive() )
+        {
+        __RDEBUG( ( _L("iTestExecution not initialised") ) );
+        TRequestStatus* rs = &aStatus;
+        User::RequestComplete( rs, KErrNotReady );
+        }
+
+    TParams params;
+    params.aRemoteMsgRef = &aRemoteMsg;
+
+    iTestExecution->DoRemoteReceive( EStifCmdReceive, params, 
+                                     aRemoteMsg.Length(), aStatus );
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: RemoteReceiveCancel
+
+    Description: RemoteReceiveCancel is used to cancel RemoteReceive.
+     
+    Parameters:  None
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CTestModuleIf::RemoteReceiveCancel()
+    {           
+    if( !IsServerAlive() )
+        {
+        __RDEBUG( ( _L("iTestExecution not initialised") ) );
+        return;
+        }
+
+    // Forward
+    iTestExecution->DoRemoteReceiveCancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: Reboot
+
+    Description: Start a reboot operation.
+
+    Parameters: TInt aType: in: Reboot type
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
+                       KErrNotReady returned if reboot not allowed(Store state
+                       not called).
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::Reboot( TInt aType )
+    {           
+    if ( !IsServerAlive() )
+        {
+        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
+        return KErrNotReady;
+        }
+    if( !iIsRebootReady )
+        {
+        __RDEBUG( ( _L( "Reboot operation not ready" ) ) );
+        return KErrNotReady;
+        }
+     
+/*    switch( aType )
+        {
+        case EDefaultReset:
+            __RDEBUG( ( _L( "Reboot, type default" )) );
+            break;
+        case EKernelReset:
+            __RDEBUG( ( _L( "Reboot, type KernelReset" )) );
+            break;
+        case EDeviceReset0:
+            __RDEBUG( ( _L( "Reboot, type Reset 0" )) );
+            break;
+        case EDeviceReset1:
+            __RDEBUG( ( _L( "Reboot, type Reset 1" )) );
+            break;
+        case EDeviceReset2:
+            __RDEBUG( ( _L( "Reboot, type Reset 2" )) );
+            break;
+        case EDeviceReset3:
+            __RDEBUG( ( _L( "Reboot, type Reset 3" )) );
+            break;
+        case EDeviceReset4:
+            __RDEBUG( ( _L( "Reboot, type Reset 4" )) );
+            break;
+        case EDeviceReset5:
+            __RDEBUG( ( _L( "Reboot, type Reset 5" )) );
+            break;
+        default:
+            __RDEBUG( ( _L( "Reboot type %d not supported" ), aType ) );
+            return KErrNotSupported;    
+        }
+*/
+
+    TParams params;
+    TRebootParams rebootParams;
+    
+    params.aRebootType = &rebootParams;
+    rebootParams.aType = ( TRebootType )aType;
+    
+    TRequestStatus status = KRequestPending; 
+
+    // Forward
+    iTestExecution->DoRemoteReceive( EStifCmdReboot, params, sizeof( aType ), status );
+    
+    User::WaitForRequest( status );
+
+    return status.Int();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: StoreState
+
+    Description: Stores the current state before reboot.
+
+    Parameters: TInt aCode: in: Reboot releated integer value.
+                TName& aName: in: Reboot related string value.
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
+                       KErrOverflow returned if aName length is over TName.
+                       KErrInUse returned if method is called more than once.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::StoreState( TInt aCode, TName& aName )
+    {
+    iStoreStateCounter++;   // Store state counter
+
+    if ( !IsServerAlive() )
+        {
+        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
+        return KErrNotReady;
+        }
+    // Check aName length
+    if ( aName.Length() > KMaxName )
+        {
+        __RDEBUG( ( _L( "CTestModuleIf::StoreState(): aName length is not valid" ) ) );
+        return KErrOverflow;
+        }
+    // Only one store state call may be done
+    if( iStoreStateCounter > 1 )
+        {
+        __RDEBUG( ( _L( "Store state allready called" ) ) );
+        return KErrInUse;
+        }
+
+    TParams params;
+    TRebootStateParams rebootStateParams;
+    params.aRebootState = &rebootStateParams;
+    rebootStateParams.aCode = aCode;
+    rebootStateParams.aName = aName;
+
+    TRequestStatus status = KRequestPending; 
+
+    // Forward
+    iTestExecution->DoRemoteReceive( EStifCmdStoreState, params,
+                                     sizeof( TRebootStateParams), status );
+    
+    User::WaitForRequest( status );
+
+    // If store state is done successfully reboot operation is allowed
+    if( status.Int() == KErrNone )
+        {
+        iIsRebootReady = ETrue;
+        }
+
+    return status.Int();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: GetStoredState
+
+    Description: Get saved store information after the reboot.
+
+    Parameters: TInt aCode: inout: Get reboot releated integer value.
+                TName& aName: inout: Get reboot related string value.
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::GetStoredState( TInt& aCode, TName& aName )
+    {           
+    if( !IsServerAlive() )
+        {
+        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
+        return KErrNotReady;
+        }
+
+    TInt code;
+    TName name;
+    
+    TParams params;
+    TGetRebootStoredParamsRef getRebootStoredParamsRef( code, name );
+    
+    params.aRebootStoredRef = &getRebootStoredParamsRef;
+
+    TRequestStatus status = KRequestPending; 
+
+    // Forward
+    iTestExecution->DoRemoteReceive( EStifCmdGetStoredState, params,
+                                     sizeof( TRebootStateParams), status );
+    
+    User::WaitForRequest( status );
+
+    // Return results if getting state is done without error
+    if(status.Int() == KErrNone)
+        {
+        aCode = code;
+        aName = name;
+        }
+
+    return status.Int();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: SetBehavior
+
+    Description: Set test case behavior.
+
+    Parameters: TInt aCode: inout: Get reboot releated integer value.
+                TName& aName: inout: Get reboot related string value.
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::SetBehavior( TTestBehavior aType, TAny* aPtr )
+    {         
+    
+    if( !IsServerAlive() )
+        {
+        return KErrGeneral;
+        }
+
+    // All event commands are handled in testserver and testengine
+    return iTestExecution->SetBehavior( aType, aPtr );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: StifMacroError
+
+    Description: STIF TF's macros. Saves information for later use.
+
+    Parameters: TInt aMacroType: in: Macro type(0:TL, 1:T1L, 2:T2L, etc.)
+                const TText8* aFile: in: Uses __FILE__ macro and this includes
+                path and file name. Maximun length for this is
+                KStifMacroMaxFile. If length is more then cutted from left.
+                char* aFunction: in: Uses __FUNCTION__ macro and this includes
+                function name. Maximun length for this is
+                KStifMacroMaxFunction. If length is more then cutted from
+                rigth.
+                TInt aLine: in: Uses __LINE__ macro and includes line number.
+                TInt aResult: in: Result from called operations.
+                TInt aExpected1: in: Users expected result.
+                TInt aExpected2: in: Users expected result.
+                TInt aExpected3: in: Users expected result.
+                TInt aExpected4: in: Users expected result.
+                TInt aExpected5: in: Users expected result.
+
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::StifMacroError( TInt aMacroType, 
+                                             const TText8* aFile,
+                                             const char* aFunction,
+                                             TInt aLine,
+                                             TInt aResult,
+                                             TInt aExpected1,
+                                             TInt aExpected2,
+                                             TInt aExpected3,
+                                             TInt aExpected4,
+                                             TInt aExpected5 )
+    {
+    if( !IsServerAlive() )
+        {
+        return KErrGeneral;
+        }
+
+    return iTestExecution->StifMacroError( aMacroType, aFile,
+                                           aFunction, aLine,
+                                           aResult, aExpected1,
+                                           aExpected2, aExpected3,
+                                           aExpected4, aExpected5 );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: ServerAlive
+
+    Description: Get saved store information after the reboot.
+
+    Parameters: TInt aCode: inout: Get reboot releated integer value.
+                TName& aName: inout: Get reboot related string value.
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestModuleIf::IsServerAlive()
+    {
+    
+    if( iTestExecution == NULL )
+        {
+        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
+        // Execution not initialized
+        return EFalse;
+        }
+       
+    return ETrue;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: AddInterferenceThread
+
+    Description: 
+
+    Parameters: RThread aSTIFTestInterference: in: Handle to RThread
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: 
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleIf::AddInterferenceThread( RThread aSTIFTestInterference )
+    {
+    // Add thread to Array. Via array can handle test interference thread's
+    // kill in panic etc. cases
+    return iTestExecution->AddInterferenceThread( aSTIFTestInterference );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: RemoveInterferenceThread
+
+    Description: 
+
+    Parameters: RThread aSTIFTestInterference: in: Handle to RThread
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: 
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleIf::RemoveInterferenceThread( RThread aSTIFTestInterference )
+    {
+    // Remove thread from Array.Test interference thread is stopped and killed
+    // successfully
+    return iTestExecution->RemoveInterferenceThread( aSTIFTestInterference );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: HandleMeasurementProcess
+
+    Description: With this can be stored information about test measurement
+                 to TestServer space.
+
+    Parameters: RProcess aTestMeasurement: in: Handle to RProcess
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleIf::HandleMeasurementProcess( 
+            CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo )
+    {
+    // Add process to Array. Via array can handle test measurement process's
+    // kill in panic etc. cases
+    return iTestExecution->HandleMeasurementProcess( aSTIFMeasurementInfo );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: GetMeasurementOptions
+
+    Description: Get measurement option(s) given from initialization file etc.
+
+    Parameters: TInt& aOptions: inout: Get measurement option(s)
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::GetMeasurementOptions( TInt& aOptions )
+    {           
+    if( !IsServerAlive() )
+        {
+        __RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
+        return KErrNotReady;
+        }
+
+    TParams params;
+    TGetMeasurementOptionsRef getMeasurementOptionsRef( aOptions );
+    params.aMeasurementOption = &getMeasurementOptionsRef;
+
+    TRequestStatus status = KRequestPending; 
+
+    // Forward
+    iTestExecution->DoRemoteReceive( EStifCmdMeasurement, params,
+                                     sizeof( TGetMeasurementOptions ), status );
+    
+    User::WaitForRequest( status );
+
+    aOptions = getMeasurementOptionsRef.iOptions;
+    
+    return status.Int();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: SetAllowResult
+
+    Description: Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to allow
+                 results.
+                 Set test case allow result given by user. In TestScripter
+                 cases allow result can set by 'allownextresult' or
+                 'allowerrorcodes' keywords. In Normal and Hardcoded test
+                 modules allow result can be set with this method, reset should
+                 be done with ResetAllowResult method.
+
+    Parameters: TInt aResult: in: Result value to be appended.
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::SetAllowResult( TInt aResult )
+    {
+    for( TInt a = 0; a < iAllowTestCaseResultsCount; a++ )
+        {
+        // Check that result is not given already
+        if ( iTestCaseResults[a] == aResult )
+            {
+            return KErrNone;
+            }
+        }
+    // If values are given more that allow(see KSTIFMacroResultArraySize).
+    // Array starts from 0...9 -> 10 => 10th should fail
+    if( iAllowTestCaseResultsCount >= KSTIFMacroResultArraySize )
+        {
+        __RDEBUG( ( 
+            _L( "STIF macro's SetAllowResult() allow only %d results, fails with %d" ),
+            KSTIFMacroResultArraySize, KErrOverflow  ) );
+        return KErrOverflow;
+        }
+
+    // New result
+    iAllowTestCaseResultsCount++;
+    iTestCaseResults[iAllowTestCaseResultsCount-1] = aResult;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: CheckAllowResult
+
+    Description: This is mainly used by STIF's TAL-TA5L macros internally.
+                 Check is macros result allowed result.
+
+    Parameters: TInt aResult: in: Result value to be checked.
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::CheckAllowResult( TInt aResult )
+    {
+    // Check is result allowed
+    for( TInt a = 0; a < iAllowTestCaseResultsCount; a++ )
+        {
+        if ( iTestCaseResults[a] == aResult )
+            {
+            // Result is allow
+            __RDEBUG( ( _L( "STIF TAL-TA5L macro's result check. Test case result[%d] allowed" ),
+                aResult ) );
+            return KErrNone;
+            }
+        }
+
+    __RDEBUG( ( 
+        _L( "STIF TAL-TA5L macro's result check. Test case result[%d] not allowed" ),
+        aResult ) );
+    // No match with allow result
+    return KErrGeneral;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: ResetAllowResult
+
+    Description: Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to reset
+                 allowed results.
+                 Reset allow result(s) given with SetAllowResult. In
+                 TestScripter cases this will be called automatically by STIF.
+                 Normal and Hardcoded cases this should be called by user.
+
+    Parameters: None.
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::ResetAllowResult()
+    {
+    // Used to "resets" iTestCaseResults array
+    iAllowTestCaseResultsCount = 0;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: StopExecution
+
+    Description: Causes that test case is going to be cancelled.
+
+    Parameters: None
+
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CTestModuleIf::StopExecution(TStopExecutionType aType, TInt aCode)
+    {
+
+    //Check parameters
+    if((aType == EOk) && (aCode != KErrNone))
+        {
+        return KErrArgument;
+        }
+    else if((aType != EOk) && (aCode == KErrNone))
+        {
+        return KErrArgument;
+        }
+
+    //Check server
+    if(!IsServerAlive())
+        {
+        return KErrGeneral;
+        }
+
+    //Everything is ok, we can continue with processing command
+    _LIT(KStopExecution, "StopExecution");
+    const TInt KPrintPriority = 30;
+
+    switch(aType)
+        {
+        case EOk:
+            Printf(KPrintPriority, KStopExecution, _L("***Test case PASSED***\n\n"));
+            break;
+        case EFail:
+            Printf(KPrintPriority, KStopExecution, _L("***Test case FAILED***\n\n"));
+            break;
+        case EAbort:
+            Printf(KPrintPriority, KStopExecution, _L("***Test case KILLED***\n\n"));
+            break;
+        default:
+            return KErrNotFound;
+        }
+
+    TStopExecutionCommandParams params;
+    params.iType = aType;
+    params.iCode = aCode;
+    __RDEBUG((_L("CTestModuleIf::StopExecution(): type [%d] code [%d]"), TInt(aType), aCode));
+
+    TStopExecutionCommandParamsPckg pckg(params);
+
+    TInt res = Command(EStopExecution, pckg);
+    return res;
+    }
+
+/*
+------------------------------------------------------------------------------
+
+	Class: CTestModuleIf
+
+    Method: SendTestModuleVersion
+    
+    Description: SendTestModuleVersion method is used to pass version of test module
+    
+------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CTestModuleIf::SendTestModuleVersion(TVersion aVersion, TFileName aModuleName)
+	{
+	if( aModuleName.Length() == 0 )
+		{
+		return KErrArgument;
+		}
+	
+	//Check server
+	if(!IsServerAlive())
+	    {
+	    return KErrGeneral;
+	    }
+	
+	const TInt KPrintPriority = 30;
+	_LIT(KVersion ,"SendTestModuleVersion");
+	Printf(KPrintPriority, KVersion, _L("Sending test module version"));
+	
+	TSendTestModuleVesionCommandParams params;
+	params.iMajor = aVersion.iMajor;
+	params.iMinor = aVersion.iMinor;
+	params.iBuild = aVersion.iBuild;
+	params.iTestModuleName = aModuleName;
+	
+	TSendTestModuleVesionCommandParamsPckg pckg(params);
+	TInt res = Command( ESendTestModuleVersion, pckg );
+	return res;
+	}
+
+
+/*
+------------------------------------------------------------------------------
+
+	Class: CTestModuleIf
+
+    Method: SendTestModuleVersion
+    
+    Description: SendTestModuleVersion method is used to pass version of test module.
+    			This version uses three parameters to enable the overloading of version with
+    			two parameters. The version with two params has params passed by value which
+    			is incorrect. The "old" version (with two parameters) is left here not to cause
+    			binary break. Only this version (with three parameters) should be used.
+    
+------------------------------------------------------------------------------
+ */
+EXPORT_C TInt CTestModuleIf::SendTestModuleVersion(TVersion& aVersion, const TDesC& aModuleName, TBool /*aNewVersion*/)
+	{
+	if( aModuleName.Length() == 0 )
+		{
+		return KErrArgument;
+		}
+	
+	//Check server
+	if(!IsServerAlive())
+	    {
+	    return KErrGeneral;
+	    }
+	
+	const TInt KPrintPriority = 30;
+	_LIT(KVersion ,"SendTestModuleVersion");
+	Printf(KPrintPriority, KVersion, _L("Sending test module version"));
+	
+	TSendTestModuleVesionCommandParams params;
+	params.iMajor = aVersion.iMajor;
+	params.iMinor = aVersion.iMinor;
+	params.iBuild = aVersion.iBuild;
+	params.iTestModuleName = aModuleName;
+	
+	TSendTestModuleVesionCommandParamsPckg pckg(params);
+	TInt res = Command( ESendTestModuleVersion, pckg );
+	return res;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: Command
+
+    Description: Sends specific command to TestServer.
+
+    Parameters: aCommand - command to be send
+
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleIf::Command(TCommand aCommand, const TDesC8& aParamsPckg)
+    {
+    TInt res = KErrNone;
+
+    if( !IsServerAlive() )
+        {
+        return KErrGeneral;
+        }
+
+    switch(aCommand)
+        {
+        case EStopExecution:
+            iTestExecution->DoNotifyCommand(aCommand, aParamsPckg);
+            break;
+        case ESendTestModuleVersion:
+        	iTestExecution->DoNotifyCommand(aCommand, aParamsPckg);
+        	break;
+        default:
+            __RDEBUG((_L("Command [%d] not recognized."), aCommand));
+        }
+
+    return res;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: GetTestCaseTitleL
+
+    Description: Returns title of current test case.
+
+    Parameters: aCommand - command to be send
+
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CTestModuleIf::GetTestCaseTitleL(TDes& aTestCaseTitle)
+    {
+    iTestExecution->GetTestCaseTitleL(aTestCaseTitle);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: UITesting
+
+    Description: Gets information if it is UI test or not
+
+    Parameters: none
+
+    Return Values: True if it is UI test, in other case it returns false.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TBool CTestModuleIf::UITesting()
+	{
+	return iTestExecution->UITesting();
+	}
+
+EXPORT_C TBool CTestModuleIf::SeperateProcesses()
+    {
+    return iTestExecution->SeperateProcesses();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: GetUiEnvProxy
+
+    Description: Gets UiEnvProxy
+
+    Parameters: none
+
+    Return Values: Pointer to UiEnvProxy
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CUiEnvProxy* CTestModuleIf::GetUiEnvProxy()
+	{
+	return iTestExecution->GetUiEnvProxy();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: GetObjFrmDict
+
+    Description: Gets CScriptBase
+
+    Parameters: none
+
+    Return Values: Pointer to CScriptBase
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CScriptBase* CTestModuleIf::GetObjFrmCaseDict(
+        const TDesC& aObjectId)
+    {
+    RPointerArray<TScriptObject> *Objects = getDict();
+    if (NULL == Objects)
+        {
+        return NULL;
+        }
+    TInt count = Objects->Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        if ((*Objects)[i]->ObjectId() == aObjectId)
+            {
+            // Found testcase with specified TestId
+            return (*Objects)[i]->iScript;
+            }
+        }
+
+    return NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: AddTestObjToDictL
+
+    Description: Add Test Object
+
+    Parameters: TScriptObject* aObject
+
+    Return Values: Pointer to CScriptBase
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CTestModuleIf::AddTestObjToCaseDictL(TScriptObject* aObject)
+    {
+    User::LeaveIfNull((TAny*) aObject);
+
+    RPointerArray<TScriptObject> *Objects = getDict();
+    User::LeaveIfNull(Objects);
+
+    TInt count = Objects->Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        if ((*Objects)[i]->ObjectId() == aObject->ObjectId())
+            {
+            // Found testcase with specified TestId
+            return;
+            }
+        }
+
+    User::LeaveIfError(Objects->Append(aObject));
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: DelTestObjFromDict
+
+    Description: Delete Test Object
+
+    Parameters: TDesC& aObjectId
+
+    Return Values: Pointer to CScriptBase
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CTestModuleIf::DelTestObjFromCaseDict(const TDesC& aObjectId)
+    {
+    RPointerArray<TScriptObject> *Objects = getDict();
+    if (NULL == Objects)
+        {
+        return;
+        }
+
+    TInt count = Objects->Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        if ((*Objects)[i]->ObjectId() == aObjectId)
+            {
+            // Found testcase with specified TestId
+            Objects->Remove(i);
+            return;
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleIf
+
+    Method: GetTestObjFromDict
+
+    Description: Get Test Object
+
+    Parameters: TDesC& aObjectId
+
+    Return Values: Pointer to CScriptBase
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TScriptObject* CTestModuleIf::GetTestObjFromCaseDict(
+        const TDesC& aObjectId) const
+    {
+    RPointerArray<TScriptObject> *Objects = getDict();
+    if (NULL == Objects)
+        {
+        return NULL;
+        }
+    TInt count = Objects->Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        if ((*Objects)[i]->ObjectId() == aObjectId)
+            {
+            // Found testcase with specified TestId
+            return (*Objects)[i];
+            }
+        }
+
+    return NULL;
+    }
+
+EXPORT_C TScriptObject::~TScriptObject()
+    {
+    delete iScript;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CSTIFTestMeasurement class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestMeasurement
+
+    Method: CSTIFTestMeasurement
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: CTestModuleBase* aTestModuleBase: in: Pointer to STIF
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFTestMeasurement::CSTIFTestMeasurement( CTestModuleBase* aTestModuleBase ) :
+    iTestModuleBase( aTestModuleBase ),
+    iMeasurementOption( 0 )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestMeasurement
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: TSTIFMeasurement aType: in: Measurement type
+                const TDesC& aConfigurationInfo: in: Configuration issues
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if HandleMeasurementProcess returns error code
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CSTIFTestMeasurement::ConstructL( TSTIFMeasurementType aType,
+                                    const TDesC& aConfigurationInfo )
+    {
+    // aType into struct here. This is compared to
+    iMeasurementStruct.iMeasurementType = aType;
+
+    // Check that measurement is not disabled(This is given from UI level or
+    // from TestFramework.ini file)
+    TInt ret( 0 );
+    ret = iTestModuleBase->TestModuleIf().GetMeasurementOptions( 
+                                                        iMeasurementOption );
+    if( ret != KErrNone )
+        {
+        __RDEBUG( ( _L( "GetMeasurementOptions() return an error[%d]" ), ret ) );
+        User::Leave( ret );
+        }
+
+    // Check that measurement is not disabled
+    if( ( iMeasurementOption & EDisableAll ) == EDisableAll )
+        {
+        __RDEBUG( _L( "Measurement disable option [KStifMeasurementDisableAll] is given by user" ) );
+        return;
+        }
+    if( ( ( iMeasurementOption & EMeasurement01 ) == EMeasurement01 ) && aType == KStifMeasurementPlugin01 )
+        {
+        __RDEBUG( _L( "Measurement disable option [KStifMeasurement01] is given by user" ) );
+        return;
+        }
+    if( ( ( iMeasurementOption & EMeasurement02 ) == EMeasurement02 ) && aType == KStifMeasurementPlugin02 )
+        {
+        __RDEBUG( _L( "Measurement disable option [KStifMeasurement02] is given by user" ) );
+        return;
+        }
+    if( ( ( iMeasurementOption & EMeasurement03 ) == EMeasurement03 ) && aType == KStifMeasurementPlugin03 )
+        {
+        __RDEBUG( _L( "Measurement disable option [KStifMeasurement03] is given by user" ) );
+        return;
+        }
+    if( ( ( iMeasurementOption & EMeasurement04 ) == EMeasurement04 ) && aType == KStifMeasurementPlugin04 )
+        {
+        __RDEBUG( _L( "Measurement disable option [KStifMeasurement04] is given by user" ) );
+        return;
+        }
+    if( ( ( iMeasurementOption & EMeasurement05 ) == EMeasurement05 ) && aType == KStifMeasurementPlugin05 )
+        {
+        __RDEBUG( _L( "Measurement disable option [KStifMeasurement05] is given by user" ) );
+        return;
+        }
+    if( ( ( iMeasurementOption & EBappea ) == EBappea ) && aType == KStifMeasurementBappeaProfiler )
+        {
+        __RDEBUG( _L( "Measurement disable option [KStifMeasurementBappea] is given by user" ) );
+        return;
+        }
+
+    iMeasurementStruct.iConfigurationInfo = aConfigurationInfo;
+    iMeasurementStruct.iMeasurementOperation = KMeasurementNew;
+    iMeasurementStruct.iPointerToMeasurementModule = iTestModuleBase;
+
+    // Move measurement execution initialization forward to TestServer.
+    User::LeaveIfError( iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
+            iMeasurementStruct ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestMeasurement
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CTestModuleBase* aTestModuleBase: in: Pointer to STIF.
+                TSTIFMeasurement aType: in: Measurement type.
+                const TDesC& aConfigurationInfo: in: Configuration info.
+    
+    Return Values: CSTIFTestMeasurement object.
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CSTIFTestMeasurement* CSTIFTestMeasurement::NewL( 
+                                            CTestModuleBase* aTestModuleBase,
+                                            TSTIFMeasurementType aType, 
+                                            const TDesC& aConfigurationInfo )
+    {
+    CSTIFTestMeasurement* self = 
+            new (ELeave) CSTIFTestMeasurement( aTestModuleBase );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aType, aConfigurationInfo );
+
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestMeasurement
+
+    Method: ~CSTIFTestMeasurement
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFTestMeasurement::~CSTIFTestMeasurement()
+    {
+    // None
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFTestMeasurement
+
+    Method: Start
+
+    Description: Start commant for measurement.
+
+    Parameters: None
+
+    Return Values: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestMeasurement::Start()
+    {
+    // Check that measurement is not disabled
+    if( iMeasurementOption  == iMeasurementStruct.iMeasurementType )
+        {
+        __RDEBUG( ( _L( "Measurement with type[%d] is disabled by user" ), iMeasurementOption ) );
+        // Cannot return error code because this causes problems in
+        // TestScripter and TestCombiner error handling. Now testing continue
+        // without measurement.
+        return KErrNone;
+        }
+
+    iMeasurementStruct.iMeasurementOperation = KMeasurementStart;
+
+    // Move measurement start execution forward to TestServer.
+    return iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
+                                                        iMeasurementStruct );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestMeasurement
+
+    Method: Stop
+
+    Description: Stop command for measurement.
+
+    Parameters: None
+
+    Return Values: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CSTIFTestMeasurement::Stop()
+    {
+    // Check that measurement is not disabled
+    if( iMeasurementOption  == iMeasurementStruct.iMeasurementType )
+        {
+        __RDEBUG( ( _L( "Measurement with type[%d] is disabled by user" ), iMeasurementOption ) );
+        // Cannot return error code because this causes problems in
+        // TestScripter and TestCombiner error handling. Now testing continue
+        // without measurement.
+        return KErrNone;
+        }
+
+    iMeasurementStruct.iMeasurementOperation = KMeasurementStop;
+
+    // Move measurement stop execution forward to TestServer.
+    return iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
+                                                        iMeasurementStruct );
+
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterface/src/TestModuleParameters.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,154 @@
+/*
+* 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: This module contains implementation of 
+* CTestModuleParamVer01 class and CTestModuleParamVer01 class 
+* member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <stifinternal/TestServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleParamVer01
+
+    Method: NewL
+
+    Description: Creates CTestModuleParamVer01
+      
+    Parameters: None
+
+    Return Values: CTestModuleParamVer01: CTestModuleParamVer01 object
+
+    Errors/Exceptions: Leaves if memory allocation fails.
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModuleParamVer01* CTestModuleParamVer01::NewL()
+    {
+    CTestModuleParamVer01* self = new( ELeave ) CTestModuleParamVer01();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleParamVer01
+
+    Method: CTestModuleParamVer01
+
+    Description: Constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleParamVer01::CTestModuleParamVer01()
+    {
+    iVersio = EVersio1;
+
+    // Default test module thread heap and stack sizes.
+    iTestThreadStackSize = KStackSize;
+	iTestThreadMinHeap = KTestThreadMinHeap;
+	iTestThreadMaxHeap = KTestThreadMaxHeap;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleParamVer01
+
+    Method: ~CTestModuleParamVer01
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModuleParamVer01::~CTestModuleParamVer01()
+    {
+    // None
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleParamVer01
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleParamVer01::ConstructL()
+    {
+	// None
+
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterference/inc/TestInterferenceImplementation.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,501 @@
+/*
+* 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: This file contains declaration of STIF interference
+* classes.
+*
+*/
+
+#ifndef TESTINTERFERENCEIMPLEMENTATION_H
+#define TESTINTERFERENCEIMPLEMENTATION_H
+
+// INCLUDES
+#include <StifTestInterference.h>
+#include <StifLogger.h>
+#include <e32std.h>
+#include <e32base.h>
+#include <e32svr.h>
+
+// Needed by interference test cases
+#include <f32file.h>
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+class CExecuteInterference;
+
+// CLASS DECLARATION
+
+/**
+*  This is a CSTIFInterferenceAO class.
+*  This class is inherited from CActive and class implements MSTIFTestInterference.
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS( CSTIFInterferenceAO ) : public CActive, 
+										   public MSTIFTestInterference
+    {
+
+     public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CSTIFInterferenceAO* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSTIFInterferenceAO();
+
+    public: // New functions
+
+        /**
+        * StartL method starts test interference.
+        */
+        TInt StartL( TStifTestInterferenceType aType,
+                    TInt aIdleTime,
+                    TInt aActiveTime );
+
+        /**
+        * Stop method stops test interference.
+        */
+        TInt Stop();
+
+        /**
+        * Sets thread or active object priority. This should use before
+        * test interference is started otherwise error code will return.
+        */
+        TInt SetPriority( TInt aPriority );
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CActive RunL handles request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive DoCancel handles request cancellation.
+        */
+        void DoCancel();
+
+        /**
+        * From CActive RunError handles error situations.
+        */
+        TInt RunError( TInt aError );
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSTIFInterferenceAO();
+
+        /**
+        * 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& );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // 
+        TStifTestInterferenceType   iInterferenceType;
+        // Test interference idle time
+        TInt                        iIdleTime;
+        // Test interference active time
+        TInt                        iActiveTime;
+
+        // Timer for executing idle time
+        RTimer                      iAOIdleTimer;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+
+        // CExecuteInterference object
+        CExecuteInterference*       iExecuteInterference;
+
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+/**
+*  This a CSTIFInterferenceThread class.
+*  This class is inherited from CBase and class implements MSTIFTestInterference.
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS( CSTIFInterferenceThread ) : public CBase,
+											   public MSTIFTestInterference
+    {
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CSTIFInterferenceThread* NewL( CTestModuleBase* aTestModuleBase );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSTIFInterferenceThread();
+
+    public: // New functions
+
+        /**
+        * StartL method starts test interference.
+        */
+        TInt StartL( TStifTestInterferenceType aType,
+                    TInt aIdleTime,
+                    TInt aActiveTime );
+
+        /**
+        * Stop method stops test interference.
+        */
+        TInt Stop();
+
+        /**
+        * Sets thread or active object priority. This should use before
+        * test interference is started otherwise error code will return.
+        */
+        TInt SetPriority( TInt aPriority );
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+        static TInt ThreadFunction( TAny* aStarted );
+
+        /**
+        * Executes interference.
+        */
+        static void ExecuteInterferenceL( TStifTestInterferenceType aType, TInt aIdleTime, TInt aActiveTime );
+    public: // Functions from base classes
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSTIFInterferenceThread();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( CTestModuleBase* aTestModuleBase );
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+
+        // Struct that keeps thread related informations.
+        struct TThreadParam
+            {
+            RSemaphore                  iStarted;
+            TStifTestInterferenceType   iType;
+            TInt                        iIdleTime;
+            TInt                        iActiveTime;
+            // Note: Be carefully if adding pointers to struct
+            };
+
+        // RThread object
+        RThread                         iThread;
+
+        // TThreadParam object(Struct that keeps thread related informations)
+        TThreadParam*                   iThreadParam;
+
+        // Pointer to STIF size
+        CTestModuleBase*                iTestModuleBase;
+
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+/**
+*  This is a CExecuteInterference class.
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS( CExecuteInterference ) : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CExecuteInterference* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CExecuteInterference();
+
+    public: // New functions
+
+        /**
+        * Start implement the test interference according to aType parameter.
+        */
+        TInt InterferenceL( 
+                    MSTIFTestInterference::TStifTestInterferenceType aType,
+                    TInt aActiveTime );
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CExecuteInterference();
+
+        /**
+        * 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& );
+
+        /**
+        * Searches a file from given drive
+        */        
+        TInt SearchAFileForReading( TDes &aDriveName, RFs &aFileserver );
+
+        /**
+        * Prepares file system for test cases
+        */        
+        TInt PrepareFileSystemL( TDesC &aDriveName,
+                                 TDesC &aFileName );
+
+        /**
+        * Deletes files recursively starting from aStartDirectory
+        */        
+        TInt DeleteFilesRecursivelyL( RFs &aFileserver, 
+                                      TDes &aStartDirectory,
+                                      const TTime &aEndTime );
+
+        /**
+        * Empties file system using DeleteFilesRecursivelyL method
+        */        
+        TInt EmptyTheFileSystemL( TDes &aFilePath,
+                                 const TTime &aEndTime );
+
+        /**
+        * Creates CPU load
+        */        
+        TInt CPULoad( const TTimeIntervalMicroSeconds32 &aActiveTime );
+       
+        /**
+        * Writes data to file asynchronously
+        */                   
+        TInt WriteToFileAsynchL( TDes &aFilePath,
+                                RFs &aFileserver,
+                                const TTime & aEndTime );
+        /**
+        * Repeats write until aActiveTime has expired
+        */                                       
+        TInt RepeatWriteToFileL( 
+                    TDes &aFilePath,
+                    const TTime &aActiveTime );
+        
+        /**
+        * Repeats read until aActiveTime has expired
+        */              
+        TInt RepeatReadFromFileL( TDes &aFilePath,
+                                 const TTimeIntervalMicroSeconds32 &aActiveTime );
+                
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+
+        // RTimer object
+        RTimer                          iTimer;
+
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // TESTINTERFERENCEIMPLEMENTATION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testinterference/src/StifTestInterference.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1999 @@
+/*
+* 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: This module contains the implementation of 
+* MSTIFTestInterference class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestInterference.h>
+#include "TestInterferenceImplementation.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// For test interference thread's heap size
+const TUint KMaxHeapSize        = 0x20000; // 128 K
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: MSTIFTestInterference
+
+    Method: MSTIFTestInterference
+
+    Description: Create test interference object according to the paramater.
+
+    Parameters: CTestModuleBase* aTestModuleBase: inout: CTestModuleBase object
+                for get test interference handle to STIF's side(Used if test
+                case panic so test interference thread can be kill by STIF).
+                TStifTestInterferenceCategory aCategory: in: Test interference
+                category
+
+    Return Values: MSTIFTestInterference*: pointer to MSTIFTestInterference 
+                   object
+
+    Errors/Exceptions: Leaves if object creation fails.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C MSTIFTestInterference* MSTIFTestInterference::NewL(
+                                    CTestModuleBase* aTestModuleBase,
+                                    TStifTestInterferenceCategory aCategory )
+    {
+    if( aCategory == EActiveObject )        // Active object
+        {
+        CSTIFInterferenceAO* self = NULL;
+        self = CSTIFInterferenceAO::NewL();
+        return (MSTIFTestInterference*)self;
+        }
+    else                                    // EThread
+        {
+        CSTIFInterferenceThread* self = NULL;
+        self = CSTIFInterferenceThread::NewL( aTestModuleBase );
+        return (MSTIFTestInterference*)self;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: MSTIFTestInterference
+
+    Method: MSTIFTestInterference
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+MSTIFTestInterference::~MSTIFTestInterference()
+    {
+    // None
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CSTIFInterferenceAO class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: CSTIFInterferenceAO
+
+    Description: C++ default constructor can NOT contain any code, that
+                 might leave 
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFInterferenceAO::CSTIFInterferenceAO() :
+                                    CActive ( CActive::EPriorityStandard )
+    {
+    iInterferenceType = ENone;
+    iIdleTime = 0;
+    iActiveTime = 0;
+    iExecuteInterference = NULL;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: ConstructL
+
+    Description: Symbian 2nd phase constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leave if CreateLocal fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CSTIFInterferenceAO::ConstructL()
+    {
+    CActiveScheduler::Add ( this );
+
+    User::LeaveIfError( iAOIdleTimer.CreateLocal() );
+
+    iExecuteInterference = CExecuteInterference::NewL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CSTIFInterferenceAO*: pointer to CSTIFInterferenceAO object
+
+    Errors/Exceptions: Leaves if object creation fails.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFInterferenceAO* CSTIFInterferenceAO::NewL()
+    {
+    CSTIFInterferenceAO* self = new (ELeave) CSTIFInterferenceAO();
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: ~CSTIFInterferenceAO
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFInterferenceAO::~CSTIFInterferenceAO()
+    {
+    Cancel(); // Cancel itself
+    // If test case panic etc. do close operations here.
+    delete iExecuteInterference;
+    iExecuteInterference = NULL;
+
+    iAOIdleTimer.Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: RunL
+
+    Description: Derived from CActive, handles test interference execution.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if InterferenceL leaves.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CSTIFInterferenceAO::RunL( )
+    {
+    iExecuteInterference->InterferenceL( iInterferenceType, iActiveTime );
+    
+    // Start idle timer
+    iAOIdleTimer.After( iStatus, iIdleTime );
+    SetActive();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: DoCancel
+
+    Description: Derived from CActive handles the Cancel
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CSTIFInterferenceAO::DoCancel( )
+    {
+    iAOIdleTimer.Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: RunError
+
+    Description: Derived from CActive handles errors from active handler.
+
+    Parameters: TInt aError: in: error from CActive 
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CSTIFInterferenceAO::RunError( TInt aError )
+    {
+    RDebug::Print( _L( "CSTIFInterferenceAO::RunError() with [%d]" ), aError );
+
+    return aError;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: StartL
+
+    Description: StartL method starts test interference.
+
+    Parameters: TStifTestInterferenceType aType: in: Test interference type.
+                TInt aIdleTime: in: Test interference idle time.
+                TInt aActiveTime: in: Test interference active time.
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: Leaves if active object is active.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CSTIFInterferenceAO::StartL( TStifTestInterferenceType aType,
+                                    TInt aIdleTime,
+                                    TInt aActiveTime )
+    {
+    if( IsActive() )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    switch( aType )
+    	{
+    	case ENone:
+    	case ECpuLoad:
+    	case EFileSystemReadC:
+    	case EFileSystemReadD:
+    	case EFileSystemReadE:
+    	case EFileSystemReadZ:
+    	case EFileSystemWriteC:
+    	case EFileSystemWriteD:
+    	case EFileSystemWriteE:
+    	case EFileSystemFillAndEmptyC:
+    	case EFileSystemFillAndEmptyD:
+    	case EFileSystemFillAndEmptyE:
+    		aIdleTime = aIdleTime * 1000;
+    		aActiveTime = aActiveTime * 1000;
+    		break;
+    	case ENoneMicroSeconds:
+    		aType = ENone;
+    		break;
+    	case ECpuLoadMicroSeconds:
+			aType = ECpuLoad;
+			break;
+    	case EFileSystemReadCMicroSeconds:
+			aType = EFileSystemReadC;
+			break;
+    	case EFileSystemReadDMicroSeconds:
+			aType = EFileSystemReadD;
+			break;
+    	case EFileSystemReadEMicroSeconds:
+			aType = EFileSystemReadE;
+			break;
+    	case EFileSystemReadZMicroSeconds:
+			aType = EFileSystemReadZ;
+			break;
+    	case EFileSystemWriteCMicroSeconds:
+			aType = EFileSystemWriteC;
+			break;
+    	case EFileSystemWriteDMicroSeconds:
+			aType = EFileSystemWriteD;
+			break;
+    	case EFileSystemWriteEMicroSeconds:
+			aType = EFileSystemWriteE;
+			break;
+    	case EFileSystemFillAndEmptyCMicroSeconds:
+			aType = EFileSystemFillAndEmptyC;
+			break;
+    	case EFileSystemFillAndEmptyDMicroSeconds:
+			aType = EFileSystemFillAndEmptyD;
+			break;
+    	case EFileSystemFillAndEmptyEMicroSeconds:
+			aType = EFileSystemFillAndEmptyE;
+			break;
+    	}    
+    
+    iInterferenceType = aType;
+    iIdleTime = aIdleTime;
+    iActiveTime = aActiveTime;
+
+    // Set request to pending and active object to active
+    iStatus = KRequestPending;
+    SetActive();
+    // Complete request immediately
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: Stop
+
+    Description: Stop method stops test interference.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CSTIFInterferenceAO::Stop()
+    {
+    Cancel();
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceAO
+
+    Method: SetPriority
+
+    Description: Sets thread or active object priority. This should use before
+                 test interference is started otherwise error code will return.
+
+    Parameters: TInt aPriority: in: New priority for active object given by
+                user.
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CSTIFInterferenceAO::SetPriority( TInt aPriority )
+    {
+    if( IsActive() )
+        {
+        RDebug::Print( _L( "STIF: Priority cannot set because active object is active" ) );
+        return KErrGeneral;
+        }
+
+    CActive::SetPriority( (TPriority)aPriority );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CSTIFInterferenceThread class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: CSTIFInterferenceThread
+
+    Description: C++ default constructor can NOT contain any code, that
+                 might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFInterferenceThread::CSTIFInterferenceThread()
+    {
+    // None
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: ConstructL
+
+    Description: C++ default constructor can NOT contain any code, that
+                 might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CSTIFInterferenceThread::ConstructL( CTestModuleBase* aTestModuleBase )
+    {
+    iTestModuleBase = aTestModuleBase;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CSTIFInterferenceThread*: pointer to CSTIFInterferenceThread
+                   object
+
+    Errors/Exceptions: Leaves if object creation fails.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFInterferenceThread* CSTIFInterferenceThread::NewL( 
+                                            CTestModuleBase* aTestModuleBase )
+    {
+    CSTIFInterferenceThread* self = new (ELeave) CSTIFInterferenceThread();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aTestModuleBase );
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: ~CSTIFInterferenceThread
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSTIFInterferenceThread::~CSTIFInterferenceThread()
+    {
+    // If test case crash etc. do stop operations here also
+    if( iThreadParam != NULL )
+        {
+        iThreadParam->iStarted.Close();
+        }
+    delete iThreadParam;
+    iThreadParam = NULL;
+    if( iThread.Handle() != NULL )
+        {
+        iThread.Kill( KErrNone );
+        iThread.Close();
+        }    
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: StartL
+
+    Description: StartL method starts test interference.
+
+    Parameters: TStifTestInterferenceType aType: in: Test interference type.
+                TInt aIdleTime: in: Test interference idle time.
+                TInt aActiveTime: in: Test interference active time.
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: Leaves if iThreadParam exists.
+                       Leaves if thread creation fails.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CSTIFInterferenceThread::StartL( TStifTestInterferenceType aType,
+                                        TInt aIdleTime,
+                                        TInt aActiveTime )
+    {
+    //__UHEAP_MARK;
+
+    if( iThreadParam )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    // Thread related parameters
+    iThreadParam = new TThreadParam;
+    iThreadParam->iStarted.CreateLocal( 0 );
+    iThreadParam->iType = aType;
+    iThreadParam->iIdleTime = aIdleTime;
+    iThreadParam->iActiveTime = aActiveTime;
+
+    // Temporary thread unique name
+    _LIT( KThreadFirstName, "STIFInterference_%x" );
+     
+    TBuf<32> tmpThreadName;
+    TInt uniqueCounter = 1;
+    
+    TInt ret = KErrNone;
+    do
+    	{
+    	tmpThreadName.Format( KThreadFirstName, uniqueCounter );
+    	// Create thread
+    	ret = iThread.Create(
+    		    					tmpThreadName,       // thread name
+    		                        ThreadFunction,         // thread function
+    		                        KDefaultStackSize*4,    // stack
+    		                        KMinHeapSize,           // Heap, min
+    		                        KMaxHeapSize*2,         // Heap, max
+    		                        (TAny*) iThreadParam    // parameter to thread function
+    		                        );
+    	uniqueCounter++;
+    	}
+    while( ret == KErrAlreadyExists );
+    
+    // If thread creation failed
+    if( ret != KErrNone )        
+        {
+        iThreadParam->iStarted.Close();         // Close semaphore
+        delete iThreadParam;
+        iThreadParam = NULL;
+        //__UHEAP_MARKEND;
+        User::Leave( ret );
+        }
+
+    // Add thread pointer to STIF side for cases where need to kill
+    // thread e.g. if test case is crashed etc. before Stop(give by user).
+    iTestModuleBase->iTestModuleIf->AddInterferenceThread( iThread );
+
+    // Create unique thread name
+    const TInt name = 17; // Name parts
+    const TInt id = 8;    // Unique id parts
+    _LIT( KThreadUniqueName, "STIFInterference_" );
+    TBuf<name+id> threadUniqueName;
+    threadUniqueName.Copy( KThreadUniqueName );
+    // Appends id in hexadesimal format 
+    threadUniqueName.AppendFormat(  _L( "%x" ), (TInt)iThread.Id() );
+    //RDebug::Print(threadUniqueName);
+
+    // Reneme thread with unique name
+    iThread.RenameMe( threadUniqueName );
+
+    // Thread is currently in suspend state
+
+    // Now start thread
+    iThread.SetPriority( EPriorityMuchMore ); // set its priority
+    iThread.Resume();                         // kick it into life in
+                                              // sometimes(depend on scheduler)
+
+    // This block execution here and continue when signal is said in thread
+    // execution side.
+    // Wait until the thread is started
+    iThreadParam->iStarted.Wait();
+
+    //__UHEAP_MARKEND;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: Stop
+
+    Description:  Stop method stops test interference.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CSTIFInterferenceThread::Stop()
+    {
+    // Ensures that remove(Stop()) sequence won't do two times for one thread.
+    if( iThread.Handle() != NULL )
+        {
+        // Remove pointer from array
+        iTestModuleBase->iTestModuleIf->RemoveInterferenceThread( iThread );
+        }
+
+    // If test case crash etc. do stop operations here also
+    if( iThreadParam != NULL )
+        {
+        iThreadParam->iStarted.Close();
+        }
+    delete iThreadParam;
+    iThreadParam = NULL;
+    if( iThread.Handle() != NULL )
+        {
+        iThread.Kill( KErrNone );
+        iThread.Close();
+        }    
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: SetPriority
+
+    Description: Sets thread or active object priority. This should use before
+                 test interference is started otherwise error code will return.
+
+    Parameters: TInt aPriority: in: New priority for active object given by
+                user.
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CSTIFInterferenceThread::SetPriority( TInt aPriority )
+    {
+    // RThread priority can set during interference executions time. User
+    // should be sure that given value is acceptable, otherwise SetPriority
+    // panics.
+
+    RThread thisThread;
+    thisThread.SetPriority ( (TThreadPriority) aPriority );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: ThreadFunction
+
+    Description: Implements thread code
+
+    Parameters: TAny* aThreadArg: in : Thread related informations
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CSTIFInterferenceThread::ThreadFunction( TAny* aThreadArg )
+        {
+        // Thread code here
+
+        // Create clean-up stack
+        CTrapCleanup* tc = CTrapCleanup::New();
+
+        // Take local copy of incoming parameters. 
+        // This object is in stack -> no manual deletion
+        TThreadParam params = *(TThreadParam*)aThreadArg;
+        
+        // Signal to continue from CSTIFInterferenceThread::StartL
+        params.iStarted.Signal();
+
+        TInt ret = KErrNone;
+
+        // Construct and install active scheduler
+        CActiveScheduler* activeScheduler = new CActiveScheduler;
+        CActiveScheduler::Install( activeScheduler );
+
+        TRAP( ret, ExecuteInterferenceL( params.iType, params.iIdleTime, params.iActiveTime ) );
+
+    	User::LeaveIfError( ret );
+        
+        delete activeScheduler;
+        
+        // Delete clean-up stack
+        delete tc;
+        tc = NULL;
+
+        return KErrNone;
+        }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSTIFInterferenceThread
+
+    Method: ExecuteInterferenceL
+
+    Description: Executes interference.
+
+    Parameters: aType		Interference type.
+    			aIdleTime	Idle time.
+    			aActiveTime Active time.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CSTIFInterferenceThread::ExecuteInterferenceL( TStifTestInterferenceType aType, TInt aIdleTime, TInt aActiveTime )
+	{
+	CSTIFInterferenceAO* interferenceAO = CSTIFInterferenceAO::NewL();
+	CleanupStack::PushL( interferenceAO );
+
+	interferenceAO->StartL( aType, aIdleTime, aActiveTime );
+
+	CActiveScheduler::Start();
+	
+	CleanupStack::PopAndDestroy( interferenceAO );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CExecuteInterference class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: CExecuteInterference
+
+    Description: C++ default constructor can NOT contain any code, that
+                 might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CExecuteInterference::CExecuteInterference()
+    {
+    iTimer.CreateLocal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: ConstructL
+
+    Description: C++ default constructor can NOT contain any code, that
+                 might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CExecuteInterference::ConstructL()
+    {
+    // None
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CExecuteInterference*: pointer to CExecuteInterference
+                   object
+
+    Errors/Exceptions: Leaves if object creation fails.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CExecuteInterference* CExecuteInterference::NewL()
+    {
+    CExecuteInterference* self = new (ELeave) CExecuteInterference();
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: ~CExecuteInterference
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CExecuteInterference::~CExecuteInterference()
+    {
+    iTimer.Cancel();
+    iTimer.Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: Interference
+
+    Description: Start implement the test interference according to aType
+                 parameter.
+
+    Parameters: MSTIFTestInterference::TStifTestInterferenceType aType: in:
+                    Test interference type.
+                TInt aActiveTime: in: Test interference active time
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: Leaves if CleanupClosePushL leave
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::InterferenceL( 
+                    MSTIFTestInterference::TStifTestInterferenceType aType,
+                    TInt aActiveTime )
+    {
+    TTimeIntervalMicroSeconds32 myActiveTime( aActiveTime );    
+    
+    TTime endTime;
+    endTime.HomeTime();           
+    endTime = endTime + myActiveTime;   
+        
+    TFileName myFile;    
+        
+    switch( aType )
+        {
+        case MSTIFTestInterference::ECpuLoad:
+            {
+            return CPULoad( myActiveTime );
+            }
+        case MSTIFTestInterference::EFileSystemReadC:
+            {           
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemReadC" ) );
+            
+            _LIT( KDrive, "c:\\" );   
+            myFile.Format( KDrive );
+            
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );                                                                        
+
+            err = fileserver.SetSessionPath( myFile );
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive C is not ready!" ) );                                
+                // R Classes have not created with New, no delete needed
+                CleanupStack::Pop( &fileserver );
+                fileserver.Close();
+                return KErrNone;
+                }                           
+                
+            RDebug::Print( _L( "SearchAFileForReading" ) );                  
+            err = SearchAFileForReading( myFile, fileserver );                        
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "File not found!" ) );                  
+                return KErrNone;
+                }                            
+
+            RDebug::Print( _L( "File's name is: %S" ), &myFile );                     
+                        
+            return RepeatReadFromFileL( myFile, myActiveTime );
+            }
+        case MSTIFTestInterference::EFileSystemReadD:
+            {
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemReadD" ) );            
+            _LIT( KDrive, "D\x3a\\" );   
+            myFile.Format( KDrive );
+            
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );                                                                        
+            err = fileserver.SetSessionPath( myFile );
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive D is not ready!" ) );                                
+                // R Classes have not created with New, no delete needed
+                CleanupStack::Pop( &fileserver );
+                fileserver.Close();
+                return KErrNone;
+                }                           
+            RDebug::Print( _L( "Fileserver created" ) );                  
+                        
+            err = SearchAFileForReading( myFile, fileserver );                        
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "File not found!" ) );                  
+                return KErrNone;
+                }                                                  
+            return RepeatReadFromFileL( myFile, myActiveTime );
+            }
+        case MSTIFTestInterference::EFileSystemReadE:
+            {
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemReadE" ) );            
+            _LIT( KDrive, "E\x3a\\" );   
+            myFile.Format( KDrive );
+           
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );                                                                        
+            RDebug::Print( _L( "Fileserver created" ) );                  
+            err = fileserver.SetSessionPath( myFile );
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive E is not ready!" ) );
+                // R Classes have not created with New, no delete needed
+                CleanupStack::Pop( &fileserver );
+                fileserver.Close();
+                return KErrNone;
+                }                           
+            
+            err = SearchAFileForReading( myFile, fileserver );                        
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "File not found!" ) );                  
+                return KErrNone;
+                }                                                  
+            
+            return RepeatReadFromFileL( myFile, myActiveTime );
+            }
+        case MSTIFTestInterference::EFileSystemReadZ:
+            {
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemReadZ" ) );            
+            _LIT( KDrive, "Z:\\" );   
+            myFile.Format( KDrive );
+
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );                                                        
+            RDebug::Print( _L( "Fileserver created" ) );                  
+            err = fileserver.SetSessionPath( myFile );
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive Z is not ready!" ) );                                
+                // R Classes have not created with New, no delete needed
+                CleanupStack::Pop( &fileserver );
+                fileserver.Close();
+                return KErrNone;
+                }                           
+
+            err = SearchAFileForReading( myFile, fileserver );                        
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "File not found!" ) );                  
+                return KErrNone;
+                }                                                  
+            
+            return RepeatReadFromFileL( myFile, myActiveTime );
+            }           
+        case MSTIFTestInterference::EFileSystemWriteC:
+            {            
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemWriteC" ) );            
+            _LIT( KDrive, "C:\\" );
+            _LIT( KFileName,  "FileSystemWriteC.txt" );                                    
+            TBufC<20> myFileName( KFileName );            
+            myFile.Format( KDrive );
+
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );                                                        
+            RDebug::Print( _L( "Fileserver created" ) );                  
+                        
+            err = fileserver.SetSessionPath( myFile );                       
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive C is not ready!" ) );
+                return KErrNone;
+                }
+            
+            PrepareFileSystemL( myFile, myFileName );
+            myFile.Append( myFileName );
+            return RepeatWriteToFileL( myFile, endTime );
+            }
+        case MSTIFTestInterference::EFileSystemWriteD:
+            {
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemWriteD" ) );            
+            _LIT( KDrive, "D\x3a\\" );
+            _LIT( KFileName,  "FileSystemWriteD.txt" );                                    
+            TBufC<20> myFileName( KFileName );            
+            myFile.Format( KDrive );
+
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );                                            
+            RDebug::Print( _L( "Fileserver created" ) );                  
+            err = fileserver.SetSessionPath( myFile );                       
+                        
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive D is not ready!" ) );
+                return KErrNone;
+                }
+                            
+            PrepareFileSystemL( myFile, myFileName );
+            myFile.Append( myFileName );
+            return RepeatWriteToFileL( myFile, endTime );
+            }
+        case MSTIFTestInterference::EFileSystemWriteE:
+            {            
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemWriteE" ) );            
+            _LIT( KDrive, "E\x3a\\" );
+            _LIT( KFileName,  "FileSystemWriteE.txt" );
+            TBufC<20> myFileName( KFileName );            
+            myFile.Format( KDrive );
+            
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );                                
+            RDebug::Print( _L( "Fileserver created" ) );                  
+                        
+            err = fileserver.SetSessionPath( myFile );                       
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive E is not ready!" ) );
+                return KErrNone;
+                }            
+            PrepareFileSystemL( myFile, myFileName );
+            myFile.Append( myFileName );
+
+            return RepeatWriteToFileL( myFile, endTime );
+            }
+        case MSTIFTestInterference::EFileSystemFillAndEmptyC:
+            {                       
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemFillAndEmptyC" ) );            
+            _LIT( KDrive, "C:\\" );
+            _LIT( KFileName,  "FillAndEmptyFile.txt" );                      
+            TBufC<20> myFileName( KFileName );            
+            myFile.Format( KDrive );
+            
+            RFs fileserver;            
+            TInt err = fileserver.Connect();             
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );                    
+            RDebug::Print( _L( "Fileserver created" ) );                  
+                        
+            err = fileserver.SetSessionPath( myFile );                       
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive C is not ready!" ) );
+                return KErrNone;
+                }                
+            PrepareFileSystemL( myFile, myFileName );
+            myFile.Append( myFileName );
+
+            RepeatWriteToFileL( myFile, endTime );                        
+            EmptyTheFileSystemL( myFile, endTime );
+            
+            return KErrNone;
+            }
+        case MSTIFTestInterference::EFileSystemFillAndEmptyD:
+            {
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemFillAndEmptyD" ) );            
+            _LIT( KDrive, "D\x3a\\" );
+            _LIT( KFileName,  "FillAndEmptyFile.txt" );                      
+            TBufC<20> myFileName( KFileName );            
+            myFile.Format( KDrive );
+            
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }      
+            CleanupClosePushL( fileserver );                    
+            RDebug::Print( _L( "Fileserver created" ) );                  
+                        
+            err = fileserver.SetSessionPath( myFile );                       
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive D is not ready!" ) );
+                return KErrNone;
+                }                
+            PrepareFileSystemL( myFile, myFileName );
+            myFile.Append( myFileName );
+
+            RepeatWriteToFileL( myFile, endTime );                        
+            EmptyTheFileSystemL( myFile, endTime );
+            
+            return KErrNone;
+            }
+        case MSTIFTestInterference::EFileSystemFillAndEmptyE:
+            {
+            RDebug::Print( _L( "STIFTestInterference::EFileSystemFillAndEmptyE" ) );            
+            _LIT( KDrive, "E\x3a\\" );
+            _LIT( KFileName,  "FillAndEmptyFile.txt" );                      
+            TBufC<20> myFileName( KFileName );            
+            myFile.Format( KDrive );
+            
+            RFs fileserver;            
+            TInt err = fileserver.Connect(); 
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+                return err;
+                }          
+            CleanupClosePushL( fileserver );
+            RDebug::Print( _L( "Fileserver created" ) );                  
+                        
+            err = fileserver.SetSessionPath( myFile );                       
+            // R Classes have not created with New, no delete needed
+            CleanupStack::Pop( &fileserver );
+            fileserver.Close();
+
+            if( err != KErrNone )
+                {
+                RDebug::Print( _L( "Drive E is not ready!" ) );
+                return KErrNone;
+                }                
+            PrepareFileSystemL( myFile, myFileName );
+            myFile.Append( myFileName );
+
+            RepeatWriteToFileL( myFile, endTime );                        
+            EmptyTheFileSystemL( myFile, endTime );
+            
+            return KErrNone;
+            }       
+        default:
+            {
+            return KErrNone;
+            }
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: SearchAFileForReading
+
+    Description: Searches a file from given directory
+
+    Parameters: TDes &aPath, TDes &aFileserver
+
+    Return Values: TInt Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::SearchAFileForReading( TDes &aPath, RFs &aFileserver )
+    {
+    RDebug::Print( _L( "CExecuteInterference::SearchAFileForReading" ) );    
+    
+    CDir * filelist;
+    CDir * dirlist;
+    TInt ret = KErrNotFound;       
+    aFileserver.SetSessionPath( aPath );        
+    
+    aFileserver.GetDir( aPath, KEntryAttNormal, ESortByName, filelist, dirlist );        
+    
+    if( !filelist || !dirlist )
+        {
+        return KErrArgument;
+        }
+
+    if( filelist->Count() > 0 )
+        {
+        RDebug::Print( _L( "Filelist > 0" ) );    
+            
+        // File found! 
+        
+        // Check file size and accept it only if the size is ~10kb
+        // at miminum, or something like that
+        aPath.Append( (*filelist)[0].iName );                        
+        ret = KErrNone;
+        
+        RDebug::Print( _L( "File name: %S" ), &(*filelist)[0].iName );        
+        }
+    else
+        {
+        RDebug::Print( _L( "Filelist < 0, lets check other dirs" ) );            
+        TFileName tmp;
+        tmp.Append( aPath );
+        for( TInt x=0; x<dirlist->Count(); x++ )
+            {            
+            aPath.Format( tmp );
+            aPath.Append( (*dirlist)[0].iName );
+            aPath.Append( _L("\\") );
+            ret = SearchAFileForReading( aPath, aFileserver );
+            if( ret == KErrNone )
+                {
+                break;
+                }
+            }
+        }
+    
+    delete filelist;
+    delete dirlist;    
+       
+    return ret;        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: PrepareFileSystemLL
+
+    Description: Creates directory and file for test cases, if necessary
+
+    Parameters: TDes &aDriveName, TDes &aFileName
+
+    Return Values: TInt Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::PrepareFileSystemL( TDesC &aDriveName,
+                                              TDesC &aFileName )
+    {
+    // Note that aDriveName must be in format drivename:\\, e.g. "c:\\"
+    
+    RDebug::Print(_L("CExecuteInterference::PrepareFileSystemL"));
+    TFileName tmp;
+    tmp.Append( aDriveName );
+    
+    RFs fileserver;
+    TInt err = fileserver.Connect(); 
+    if( err != KErrNone )
+        {
+        RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+        return err;
+        }      
+    CleanupClosePushL( fileserver );                    
+            
+    _LIT( KSTIFDirName, "STIFInterference\\" );                                          
+
+    err = fileserver.SetSessionPath( tmp );                           
+    if( err != KErrNone )
+        {
+        CleanupStack::Pop( &fileserver );
+        fileserver.Close();
+        return err;
+        }
+    
+    tmp.Append( KSTIFDirName );
+    err = fileserver.MkDir( tmp );
+    if( err != KErrNone && err != KErrAlreadyExists )
+        {
+        RDebug::Print( _L( "MkDir failed with error: %d" ), err );
+        // R Classes have not created with New, no delete needed
+        CleanupStack::Pop( &fileserver );
+        fileserver.Close();
+        return err;
+        }              
+    
+    tmp.Format( aDriveName );
+    tmp.Append( KSTIFDirName );        
+    fileserver.SetSessionPath( tmp );                               
+
+    RFile newFile;
+    CleanupClosePushL( newFile );                    
+    TInt ret = newFile.Create( fileserver, aFileName, EFileWrite );
+    if( ret != KErrNone && ret != KErrAlreadyExists )
+        {
+        RDebug::Print( _L( "File create failed with error: %d" ), err );            
+        }
+        
+    // R Classes have not created with New, no delete needed
+    CleanupStack::Pop( &newFile );
+    CleanupStack::Pop( &fileserver );
+    newFile.Close();
+    fileserver.Close();
+    
+    return ret;      
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: CPULoad
+
+    Description: Creates CPU load to the system
+
+    Parameters: const TTimeIntervalMicroSeconds32 &aActiveTime
+
+    Return Values: TInt Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::CPULoad( const TTimeIntervalMicroSeconds32 &aActiveTime )
+    {
+    RDebug::Print(_L("CExecuteInterference::CPULoad"));
+
+    TTime endTime;
+    TTime currentTime;
+
+    currentTime.HomeTime();
+    endTime.HomeTime();
+
+    endTime = endTime + aActiveTime;  
+
+    while ( currentTime < endTime )
+       {
+        currentTime.HomeTime();    
+       }
+
+    return KErrNone;    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: DeleteFilesRecursivelyL
+
+    Description: Delete files in current directory and its subdirectories
+
+    Parameters: RFs &aFileserver, 
+                TDes &aStartDirectory
+
+    Return Values: TInt Symbian error code
+
+    Errors/Exceptions: Leaves if GetDir fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::DeleteFilesRecursivelyL( RFs &aFileserver, 
+                                                    TDes &aStartDirectory,
+                                                    const TTime &aEndTime )
+    { 
+    TTime currentTime;
+    currentTime.HomeTime();      
+    if( currentTime >= aEndTime )
+        {
+        return KErrTimedOut;
+        }
+    
+    RDebug::Print( _L( "CExecuteInterference::DeleteFilesRecursivelyL" ) );    
+    
+    TFileName currentDir;   
+    CDir * filelist;
+    CDir * dirlist;       
+    
+    aFileserver.SetSessionPath( aStartDirectory );    
+    aFileserver.SessionPath( currentDir );
+    RDebug::Print( _L( "Hakemistopolku = %S" ), &currentDir );       
+    
+    User::LeaveIfError( aFileserver.GetDir( 
+            currentDir, KEntryAttNormal, ESortByName, filelist, dirlist ) );
+               
+    // Delete all files
+    for( TInt x=0; x<filelist->Count(); x++ )
+        {
+        RDebug::Print( _L( "CExecuteInterference::DeleteFilesRecursivelyL: delete: %S" ), &(*filelist)[x].iName );                    
+        aFileserver.Delete( (*filelist)[x].iName );    
+        }
+    
+    // Looping all directories recursively
+    for( TInt y= 0; y<dirlist->Count(); y++ )
+        {        
+        currentDir.Format( aStartDirectory );
+        currentDir.Append( (*dirlist)[y].iName );
+        currentDir.Append( _L("\\") );
+        DeleteFilesRecursivelyL( aFileserver, currentDir, aEndTime );
+        }    
+     
+    delete filelist;
+    delete dirlist;
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: EmptyTheFileSystemL
+
+    Description: Empty the file system using DeleteFilesRecursivelyL
+
+    Parameters: TDes &aFilePath
+
+    Return Values: TInt Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::EmptyTheFileSystemL( TDes &aFilePath, 
+                                               const TTime &aEndTime )
+    {
+    TTime currentTime;
+    currentTime.HomeTime();
+    if( currentTime >= aEndTime )
+        {
+        // End of time
+        return KErrTimedOut;
+        }    
+    
+    RDebug::Print( _L( "CExecuteInterference::EmptyTheFileSystemL" ) );    
+    RFs fileserver;
+    TInt err = fileserver.Connect(); 
+    if( err != KErrNone )
+        {
+        RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+        return err;
+        }      
+    CleanupClosePushL( fileserver );                           
+    TRAP( err, DeleteFilesRecursivelyL( fileserver, aFilePath, aEndTime ) );        
+    if( err != KErrNone )
+        {
+        RDebug::Print( _L( "DeleteFilesRecursivelyL failed with error: %d" ), err );
+        }    
+    // R Classes have not created with New, no delete needed
+    CleanupStack::Pop( &fileserver );   
+    fileserver.Close();
+    return err;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: WriteToFileAsynchL
+
+    Description: Writes data to a file asynchronously
+
+    Parameters: RFs &aFileserver,
+                const TTime &aEndTime 
+
+    Return Values: TInt Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::WriteToFileAsynchL( TDes &aFilePath,
+                                              RFs &aFileserver,
+                                              const TTime &aEndTime )
+    {
+    RFile myFile;
+
+    TInt err = myFile.Open( aFileserver, aFilePath, EFileWrite );
+    if( err != KErrNone )
+        {
+        RDebug::Print( _L( "Open file failed with error: %d" ), err );
+        return err;
+        }    
+    CleanupClosePushL( myFile );                      
+    TInt position = 0;
+    myFile.Seek( ESeekEnd, position );
+
+    _LIT8( KMyBuffer, "STIF Interference module: WriteToFile");
+    
+    // NOTE: this part has previous asynch implementation, doesn't work
+    // at the moment
+    /* 
+    TRequestStatus status;
+    myFile.Write( position, KMyBuffer, status );    
+    // Loop until either write operation is completed or the execution 
+    // time has expired    
+    while( doAlways ) 
+        {
+        if( status != KRequestPending )
+            {
+            return status.Int();
+            }
+        currentTime.HomeTime();                   
+        if( currentTime >= aEndTime )
+            {
+            return KErrTimedOut;
+            }
+         
+       }
+    */            
+
+    TTime currentTime;
+    currentTime.HomeTime();
+    
+    while( currentTime <= aEndTime )
+        {
+        myFile.Write( position, KMyBuffer );
+        currentTime.HomeTime();
+        }
+    // R Classes have not created with New, no delete needed
+    CleanupStack::Pop( &myFile );          
+    myFile.Close();
+    return KErrNone;      
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: RepeatWriteToFileL
+
+    Description: Repeats file writing using WriteToFileAsynchL method
+
+    Parameters: const TTimeIntervalMicroSeconds32 &aActiveTime
+
+    Return Values: TInt Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::RepeatWriteToFileL(
+                    TDes &aFilePath, 
+                    const TTime &aActiveTime )
+    {
+    RFs fileserver;
+    TInt err = fileserver.Connect(); 
+    if( err != KErrNone )
+        {
+        RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+        return err;
+        }      
+    CleanupClosePushL( fileserver );                           
+        
+    TTime currentTime;
+    currentTime.HomeTime();
+
+    TVolumeInfo myVolume;
+    fileserver.Volume( myVolume, EDriveC );   
+
+    while( ( currentTime <= aActiveTime ) && ( myVolume.iFree > 0 ) )    
+        {
+        WriteToFileAsynchL( aFilePath, fileserver, aActiveTime );        
+        currentTime.HomeTime();
+        }
+    
+    // R Classes have not created with New, no delete needed
+    CleanupStack::Pop( &fileserver );        
+    fileserver.Close();
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CExecuteInterference
+
+    Method: RepeatReadFromFileL
+
+    Description: Repeats file reading using ReadFromFileAsynch method
+
+    Parameters: const TTimeIntervalMicroSeconds32 &aActiveTime
+
+    Return Values: TInt Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CExecuteInterference::RepeatReadFromFileL( 
+                               TDes &aFilePath,
+                               const TTimeIntervalMicroSeconds32 &aActiveTime )
+    {
+    RDebug::Print( _L( "CExecuteInterference::RepeatReadFromFileL" ) );
+    
+    RFs fileserver;
+    TInt err = fileserver.Connect(); 
+    if( err != KErrNone )
+        {
+        RDebug::Print( _L( "RFs connection failed with error: %d" ), err );
+        return err;
+        }      
+    CleanupClosePushL( fileserver );                           
+    
+    TTime endTime;
+    TTime currentTime;
+    RFile myFile;
+    TBuf8<20> myReadBuffer;
+
+    RDebug::Print( _L( "RepeatReadFromFileL: Open" ) );                  
+
+    // Open file
+    err = myFile.Open( fileserver, aFilePath, EFileWrite );
+    if( err != KErrNone )
+        {
+        RDebug::Print( _L( "Open file failed with error: %d" ), err );
+        // R Classes have not created with New, no delete needed
+        CleanupStack::Pop( &fileserver );
+        fileserver.Close();
+        return err;
+        }        
+            
+    CleanupClosePushL( myFile );                                       
+    // This part has previous async implementation, doesn't work at moment
+    /*   
+    RDebug::Print( _L( "ReadFromFileAsynch: trequeststatus" ) );                        
+           
+    TRequestStatus timer;
+    TRequestStatus read;
+
+    RDebug::Print( _L( "ReadFromFileAsynch: asynk timer" ) );                    
+
+    RTimer clock;
+    clock.CreateLocal();
+    clock.At( timer, endTime);
+
+    RDebug::Print( _L( "ReadFromFileAsynch: asynk read" ) );
+    myFile.Read( myReadBuffer, 20, read );
+
+    RDebug::Print( _L( "ReadFromFileAsynch: ennen whilelooppia" ) );
+    while( timer == KRequestPending )
+        {
+        User::WaitForRequest( read, timer );
+        if( read != KRequestPending)
+            {
+            RDebug::Print( _L( "ReadFromFileAsynch: uudelleen asynk read" ) );
+            read = KRequestPending;                              
+    	    myFile.Read( myReadBuffer, 20, read );    	    
+            }
+        else
+            {  
+            RDebug::Print( _L( "ReadFromFileAsynch: cancel luku, timer kompletoitui" ) );                  
+            // Timer valmis         
+            //read = KRequestPending;   
+            myFile.ReadCancel( read );
+            User::WaitForRequest( read );
+            break;
+            }
+        }      
+    */
+
+    currentTime.HomeTime();
+    endTime.HomeTime();
+    endTime = endTime + aActiveTime;
+    
+    while( currentTime <= endTime )
+        {
+        myFile.Read( myReadBuffer );
+        currentTime.HomeTime();    	    
+        }
+        
+    //myFile.Close();
+    //fileserver.Close();
+    // R Classes have not created with New, no delete needed
+    CleanupStack::Pop( &myFile );
+    CleanupStack::Pop( &fileserver );
+    myFile.Close();
+    fileserver.Close();
+    //CleanupStack::PopAndDestroy( 2 );       
+   
+    RDebug::Print( _L( "CExecuteInterference::RepeatReadFromFileL success" ) );
+    return KErrNone;    
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/BMARM/STIFTESTSERVERU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,25 @@
+EXPORTS
+	__11RTestServer @ 1 NONAME R3UNUSED ; RTestServer::RTestServer(void)
+	CancelAsyncRequest__14RTestExecutioni @ 2 NONAME R3UNUSED ; RTestExecution::CancelAsyncRequest(int)
+	Close__11RTestModule @ 3 NONAME R3UNUSED ; RTestModule::Close(void)
+	Close__11RTestServer @ 4 NONAME R3UNUSED ; RTestServer::Close(void)
+	Close__14RTestExecution @ 5 NONAME R3UNUSED ; RTestExecution::Close(void)
+	Connect__11RTestServerRCt4TBuf1i256RC7TDesC16 @ 6 NONAME R3UNUSED ; RTestServer::Connect(TBuf<256> const &, TDesC16 const &)
+	EnumerateTestCases__11RTestModuleR7TDesC16Rt8TPckgBuf1ZiR14TRequestStatus @ 7 NONAME ; RTestModule::EnumerateTestCases(TDesC16 &, TPckgBuf<int> &, TRequestStatus &)
+	ErrorNotification__11RTestModuleRt5TPckg1Z18TErrorNotificationR14TRequestStatus @ 8 NONAME R3UNUSED ; RTestModule::ErrorNotification(TPckg<TErrorNotification> &, TRequestStatus &)
+	GetTestCases__11RTestModuleRt15CFixedFlatArray1Z13TTestCaseInfo @ 9 NONAME R3UNUSED ; RTestModule::GetTestCases(CFixedFlatArray<TTestCaseInfo> &)
+	NotifyEvent__14RTestExecutionRt5TPckg1Z8TEventIfR14TRequestStatusi @ 10 NONAME ; RTestExecution::NotifyEvent(TPckg<TEventIf> &, TRequestStatus &, int)
+	NotifyProgress__14RTestExecutionRt5TPckg1Z13TTestProgressR14TRequestStatus @ 11 NONAME R3UNUSED ; RTestExecution::NotifyProgress(TPckg<TTestProgress> &, TRequestStatus &)
+	NotifyRemoteCmd__14RTestExecutionRt5TPckg1Z12TStifCommandRt5TPckg1ZiR14TRequestStatus @ 12 NONAME ; RTestExecution::NotifyRemoteCmd(TPckg<TStifCommand> &, TPckg<int> &, TRequestStatus &)
+	Open__11RTestModuleR11RTestServerRt4TBuf1i256 @ 13 NONAME R3UNUSED ; RTestModule::Open(RTestServer &, TBuf<256> &)
+	Open__14RTestExecutionR11RTestServeriRCt4TBuf1i256 @ 14 NONAME ; RTestExecution::Open(RTestServer &, int, TBuf<256> const &)
+	Pause__14RTestExecution @ 15 NONAME R3UNUSED ; RTestExecution::Pause(void)
+	ReadRemoteCmdInfo__14RTestExecutionR5TDes812TStifCommandi @ 16 NONAME ; RTestExecution::ReadRemoteCmdInfo(TDes8 &, TStifCommand, int)
+	Resume__14RTestExecution @ 17 NONAME R3UNUSED ; RTestExecution::Resume(void)
+	RunTestCase__14RTestExecutionRt5TPckg1Z15TFullTestResultR14TRequestStatus @ 18 NONAME R3UNUSED ; RTestExecution::RunTestCase(TPckg<TFullTestResult> &, TRequestStatus &)
+	StartNewServer__FRCt4TBuf1i256Rt4TBuf1i256 @ 19 NONAME R3UNUSED ; StartNewServer(TBuf<256> const &, TBuf<256> &)
+	StartNewServer__FRCt4TBuf1i256Rt4TBuf1i256iG10RSemaphore @ 20 NONAME ; StartNewServer(TBuf<256> const &, TBuf<256> &, int, RSemaphore)
+	Version__C11RTestServer @ 21 NONAME R3UNUSED ; RTestServer::Version(void) const
+	CancelAsyncRequest__11RTestModulei @ 22 NONAME R3UNUSED ; RTestModule::CancelAsyncRequest(int)
+	GetServerThreadId__11RTestServerR9TThreadId @ 23 NONAME R3UNUSED ; RTestServer::GetServerThreadId(TThreadId &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/BWINS/STIFTESTSERVERU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+EXPORTS
+	??0RTestServer@@QAE@XZ @ 1 NONAME ; RTestServer::RTestServer(void)
+	?CancelAsyncRequest@RTestExecution@@QAEHH@Z @ 2 NONAME ; int RTestExecution::CancelAsyncRequest(int)
+	?CancelAsyncRequest@RTestModule@@QAEHH@Z @ 3 NONAME ; int RTestModule::CancelAsyncRequest(int)
+	?Close@RTestExecution@@QAEXXZ @ 4 NONAME ; void RTestExecution::Close(void)
+	?Close@RTestModule@@QAEXXZ @ 5 NONAME ; void RTestModule::Close(void)
+	?Close@RTestServer@@QAEXXZ @ 6 NONAME ; void RTestServer::Close(void)
+	?Connect@RTestServer@@QAEHABV?$TBuf@$0BAA@@@ABVTDesC16@@@Z @ 7 NONAME ; int RTestServer::Connect(class TBuf<256> const &, class TDesC16 const &)
+	?EnumerateTestCases@RTestModule@@QAEXAAVTDesC16@@AAV?$TPckgBuf@H@@AAVTRequestStatus@@@Z @ 8 NONAME ; void RTestModule::EnumerateTestCases(class TDesC16 &, class TPckgBuf<int> &, class TRequestStatus &)
+	?ErrorNotification@RTestModule@@QAEXAAV?$TPckg@VTErrorNotification@@@@AAVTRequestStatus@@@Z @ 9 NONAME ; void RTestModule::ErrorNotification(class TPckg<class TErrorNotification> &, class TRequestStatus &)
+	?GetTestCases@RTestModule@@QAEHAAV?$CFixedFlatArray@VTTestCaseInfo@@@@@Z @ 10 NONAME ; int RTestModule::GetTestCases(class CFixedFlatArray<class TTestCaseInfo> &)
+	?NotifyEvent@RTestExecution@@QAEHAAV?$TPckg@VTEventIf@@@@AAVTRequestStatus@@H@Z @ 11 NONAME ; int RTestExecution::NotifyEvent(class TPckg<class TEventIf> &, class TRequestStatus &, int)
+	?NotifyProgress@RTestExecution@@QAEHAAV?$TPckg@VTTestProgress@@@@AAVTRequestStatus@@@Z @ 12 NONAME ; int RTestExecution::NotifyProgress(class TPckg<class TTestProgress> &, class TRequestStatus &)
+	?NotifyRemoteCmd@RTestExecution@@QAEHAAV?$TPckg@W4TStifCommand@@@@AAV?$TPckg@H@@AAVTRequestStatus@@@Z @ 13 NONAME ; int RTestExecution::NotifyRemoteCmd(class TPckg<enum TStifCommand> &, class TPckg<int> &, class TRequestStatus &)
+	?Open@RTestExecution@@QAEHAAVRTestServer@@HABV?$TBuf@$0BAA@@@@Z @ 14 NONAME ; int RTestExecution::Open(class RTestServer &, int, class TBuf<256> const &)
+	?Open@RTestModule@@QAEHAAVRTestServer@@AAV?$TBuf@$0BAA@@@@Z @ 15 NONAME ; int RTestModule::Open(class RTestServer &, class TBuf<256> &)
+	?Pause@RTestExecution@@QAEHXZ @ 16 NONAME ; int RTestExecution::Pause(void)
+	?ReadRemoteCmdInfo@RTestExecution@@QAEHAAVTDes8@@W4TStifCommand@@H@Z @ 17 NONAME ; int RTestExecution::ReadRemoteCmdInfo(class TDes8 &, enum TStifCommand, int)
+	?Resume@RTestExecution@@QAEHXZ @ 18 NONAME ; int RTestExecution::Resume(void)
+	?RunTestCase@RTestExecution@@QAEXAAV?$TPckg@VTFullTestResult@@@@AAVTRequestStatus@@@Z @ 19 NONAME ; void RTestExecution::RunTestCase(class TPckg<class TFullTestResult> &, class TRequestStatus &)
+	?StartNewServer@@YAHABV?$TBuf@$0BAA@@@AAV1@@Z @ 20 NONAME ; int StartNewServer(class TBuf<256> const &, class TBuf<256> &)
+	?StartNewServer@@YAHABV?$TBuf@$0BAA@@@AAV1@HVRSemaphore@@@Z @ 21 NONAME ; int StartNewServer(class TBuf<256> const &, class TBuf<256> &, int, class RSemaphore)
+	?Version@RTestServer@@QBE?AVTVersion@@XZ @ 22 NONAME ; class TVersion RTestServer::Version(void) const
+	?GetServerThreadId@RTestServer@@QAEHAAVTThreadId@@@Z @ 23 NONAME ; int RTestServer::GetServerThreadId(class TThreadId &)
+	?NotifyCommand@RTestExecution@@QAEHAAV?$TPckg@W4TCommand@@@@AAV?$TBuf8@$0DC@@@AAVTRequestStatus@@H@Z @ 24 NONAME ; int RTestExecution::NotifyCommand(class TPckg<enum TCommand> &, class TBuf8<50> &, class TRequestStatus &, int)
+	?GetUiEnvProxy@CTestThreadContainer@@QAEPAVCUiEnvProxy@@XZ @ 25 NONAME ; class CUiEnvProxy * CTestThreadContainer::GetUiEnvProxy(void)
+	?NewL@CTestThreadContainerRunner@@SAPAV1@VTThreadId@@PAVCActiveScheduler@@@Z @ 26 NONAME ; class CTestThreadContainerRunner * CTestThreadContainerRunner::NewL(class TThreadId, class CActiveScheduler *)
+	?NewL@CTestThreadContainerRunnerFactory@@SAPAV1@VTThreadId@@PAVCActiveScheduler@@PAVCUiEnvProxy@@@Z @ 27 NONAME ; class CTestThreadContainerRunnerFactory * CTestThreadContainerRunnerFactory::NewL(class TThreadId, class CActiveScheduler *, class CUiEnvProxy *)
+	?StartNewServer@@YAHABV?$TBuf@$0BAA@@@AAV1@HVRSemaphore@@HPAVCTestThreadContainerRunnerFactory@@@Z @ 28 NONAME ; int StartNewServer(class TBuf<256> const &, class TBuf<256> &, int, class RSemaphore, int, class CTestThreadContainerRunnerFactory *)
+	?UITesting@CTestThreadContainer@@QAEHXZ @ 29 NONAME ; int CTestThreadContainer::UITesting(void)
+	?NotifyCommand2@RTestExecution@@QAEHAAV?$TPckg@W4TCommand@@@@AAVTDes8@@AAVTRequestStatus@@H@Z @ 30 NONAME ; int RTestExecution::NotifyCommand2(class TPckg<enum TCommand> &, class TDes8 &, class TRequestStatus &, int)
+	??1TScriptObject@@UAE@XZ @ 31 NONAME ABSENT ; TScriptObject::~TScriptObject(void)
+	?SeperateProcesses@CTestThreadContainer@@QAEHXZ @ 32 NONAME ; int CTestThreadContainer::SeperateProcesses(void)
+	?PassEngineSessionSettings@RTestServer@@QAEHABUTEngineSettings@@@Z @ 33 NONAME ; int RTestServer::PassEngineSessionSettings(struct TEngineSettings const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/eabi/StifTestServeru.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,65 @@
+EXPORTS
+	_Z14StartNewServerRK4TBufILi256EERS0_ @ 1 NONAME
+	_Z14StartNewServerRK4TBufILi256EERS0_i10RSemaphore @ 2 NONAME
+	_ZN11RTestModule12GetTestCasesER15CFixedFlatArrayI13TTestCaseInfoE @ 3 NONAME
+	_ZN11RTestModule17ErrorNotificationER5TPckgI18TErrorNotificationER14TRequestStatus @ 4 NONAME
+	_ZN11RTestModule18CancelAsyncRequestEi @ 5 NONAME
+	_ZN11RTestModule18EnumerateTestCasesER7TDesC16R8TPckgBufIiER14TRequestStatus @ 6 NONAME
+	_ZN11RTestModule4OpenER11RTestServerR4TBufILi256EE @ 7 NONAME
+	_ZN11RTestModule5CloseEv @ 8 NONAME
+	_ZN11RTestServer5CloseEv @ 9 NONAME
+	_ZN11RTestServer7ConnectERK4TBufILi256EERK7TDesC16 @ 10 NONAME
+	_ZN11RTestServerC1Ev @ 11 NONAME
+	_ZN11RTestServerC2Ev @ 12 NONAME
+	_ZN14RTestExecution11NotifyEventER5TPckgI8TEventIfER14TRequestStatusi @ 13 NONAME
+	_ZN14RTestExecution11RunTestCaseER5TPckgI15TFullTestResultER14TRequestStatus @ 14 NONAME
+	_ZN14RTestExecution14NotifyProgressER5TPckgI13TTestProgressER14TRequestStatus @ 15 NONAME
+	_ZN14RTestExecution15NotifyRemoteCmdER5TPckgI12TStifCommandERS0_IiER14TRequestStatus @ 16 NONAME
+	_ZN14RTestExecution17ReadRemoteCmdInfoER5TDes812TStifCommandi @ 17 NONAME
+	_ZN14RTestExecution18CancelAsyncRequestEi @ 18 NONAME
+	_ZN14RTestExecution4OpenER11RTestServeriRK4TBufILi256EE @ 19 NONAME
+	_ZN14RTestExecution5CloseEv @ 20 NONAME
+	_ZN14RTestExecution5PauseEv @ 21 NONAME
+	_ZN14RTestExecution6ResumeEv @ 22 NONAME
+	_ZNK11RTestServer7VersionEv @ 23 NONAME
+	_ZTI11CPrintQueue @ 24 NONAME ; #<TI>#
+	_ZTI11CRcvHandler @ 25 NONAME ; #<TI>#
+	_ZTI11CSndHandler @ 26 NONAME ; #<TI>#
+	_ZTI11CTestModule @ 27 NONAME ; #<TI>#
+	_ZTI11CTestServer @ 28 NONAME ; #<TI>#
+	_ZTI11CUnderTaker @ 29 NONAME ; #<TI>#
+	_ZTI13CEventHandler @ 30 NONAME ; #<TI>#
+	_ZTI13CPrintHandler @ 31 NONAME ; #<TI>#
+	_ZTI14CTestExecution @ 32 NONAME ; #<TI>#
+	_ZTI18CErrorPrintHandler @ 33 NONAME ; #<TI>#
+	_ZTI20CTestModuleContainer @ 34 NONAME ; #<TI>#
+	_ZTI20CTestThreadContainer @ 35 NONAME ; #<TI>#
+	_ZTV11CPrintQueue @ 36 NONAME ; #<VT>#
+	_ZTV11CRcvHandler @ 37 NONAME ; #<VT>#
+	_ZTV11CSndHandler @ 38 NONAME ; #<VT>#
+	_ZTV11CTestModule @ 39 NONAME ; #<VT>#
+	_ZTV11CTestServer @ 40 NONAME ; #<VT>#
+	_ZTV11CUnderTaker @ 41 NONAME ; #<VT>#
+	_ZTV13CEventHandler @ 42 NONAME ; #<VT>#
+	_ZTV13CPrintHandler @ 43 NONAME ; #<VT>#
+	_ZTV14CTestExecution @ 44 NONAME ; #<VT>#
+	_ZTV18CErrorPrintHandler @ 45 NONAME ; #<VT>#
+	_ZTV20CTestModuleContainer @ 46 NONAME ; #<VT>#
+	_ZTV20CTestThreadContainer @ 47 NONAME ; #<VT>#
+	_ZN11RTestServer17GetServerThreadIdER9TThreadId @ 48 NONAME
+	_ZN14RTestExecution13NotifyCommandER5TPckgI8TCommandER5TBuf8ILi50EER14TRequestStatusi @ 49 NONAME
+	_Z14StartNewServerRK4TBufILi256EERS0_i10RSemaphoreiP33CTestThreadContainerRunnerFactory @ 50 NONAME
+	_ZN20CTestThreadContainer13GetUiEnvProxyEv @ 51 NONAME
+	_ZN20CTestThreadContainer9UITestingEv @ 52 NONAME
+	_ZN26CTestThreadContainerRunner4NewLE9TThreadIdP16CActiveScheduler @ 53 NONAME
+	_ZN33CTestThreadContainerRunnerFactory4NewLE9TThreadIdP16CActiveSchedulerP11CUiEnvProxy @ 54 NONAME
+	_ZTI26CTestThreadContainerRunner @ 55 NONAME ; #<TI>#
+	_ZTI33CTestThreadContainerRunnerFactory @ 56 NONAME ; #<TI>#
+	_ZTV26CTestThreadContainerRunner @ 57 NONAME ; #<VT>#
+	_ZTV33CTestThreadContainerRunnerFactory @ 58 NONAME ; #<VT>#
+	_ZN14RTestExecution14NotifyCommand2ER5TPckgI8TCommandER5TDes8R14TRequestStatusi @ 59 NONAME
+	_ZTI11CCommandDef @ 60 NONAME ; #<TI>#
+	_ZTV11CCommandDef @ 61 NONAME ; #<VT>#
+	_ZN11RTestServer25PassEngineSessionSettingsERK15TEngineSettings @ 62 NONAME
+	_ZN20CTestThreadContainer17SeperateProcessesEv @ 63 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/group/TestServer.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,65 @@
+/*
+* 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: MMP file for STIF Test Framework's TestServer module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+#include        "../../../inc/STIFConfiguration.mmh"
+
+TARGET          StifTestServer.dll
+TARGETTYPE      dll
+
+CAPABILITY      ALL -TCB
+VENDORID        0x101FB657
+SECUREID        0x102073E3
+
+DEFFILE         StifTestServer.def
+
+UID             0x1000008D 0x101FB3E0
+
+/* Include paths */
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+/* Source files */
+SOURCEPATH      ../src
+
+SOURCE          TestServerClient.cpp
+SOURCE          TestServer.cpp
+SOURCE          Testserversession.cpp
+SOURCE          Testexecution.cpp
+SOURCE          TestExecutionThread.cpp
+SOURCE          TestModuleContainer.cpp
+SOURCE          Testundertaker.cpp
+SOURCE          Printqueue.cpp
+SOURCE          TestServerEvent.cpp
+SOURCE          TestThreadContainerRunner.cpp
+SOURCE          TestThreadContainerRunnerFactory.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         efsrv.lib               // For RFs file server
+LIBRARY         stfeventsystemclient.lib
+
+/* Flag to disable all memory, request and handle leaks 
+* Do NOT enable this!!! Only for special purposes. */
+//MACRO STIF_DISABLE_LEAK_CHECK
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+/*
+* 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:  
+*
+*	bld.inf Toplevel build information for STIF Test Framework's TestServer.
+*/
+
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	TestServer.mmp
+
+PRJ_TESTMMPFILES
+
+
+/* End of File */// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/inc/Logging.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,97 @@
+/*
+* 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: This file contains the CPrintQueue and 
+* CPrintQueueItem class definitions.
+*
+*/
+
+#ifndef LOGGINGDEFS_H
+#define LOGGINGDEFS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+
+// CONSTANTS
+const TUint KError           = 0x1;
+const TUint KInit            = 0x2;
+const TUint KThreadOperation = 0x4;
+const TUint KRunTestCase     = 0x8;
+const TUint KPrint           = 0x10;
+const TUint KMessage         = 0x20;
+const TUint KVerbose         = 0x40;
+const TUint KAlways          = 0xFFFFFFFF;
+const TUint KDebugLevel      = ( KMessage | KInit | KError );
+
+// MACROS
+#define __TRACING_ENABLED
+
+// Define USE_RDEBUG to use RDebug::Print for logging
+//#define USE_RDEBUG
+
+// Define USE_LOGGER to use logger for logging
+#define USE_LOGGER
+
+#ifdef __TRACING_ENABLED
+
+    // TRACE macro is used in server thread
+    
+    // Disable conditional expression is constant -warning
+    #pragma warning( disable : 4127 )
+
+    // Using logger and not RDebug
+    #if defined (USE_LOGGER) && !defined (USE_RDEBUG)
+    #define __TRACE(level,p) if ( (level) & KDebugLevel) { ((CStifLogger*) Dll::Tls())->Log p; }
+    #endif
+
+    // Using RDebug and not Logger
+    #if defined (USE_RDEBUG) && !defined (USE_LOGGER)
+    #define __TRACE(level,p) if ( (level) & KDebugLevel) { RDebug::Print p; }
+    #endif
+
+    // Using Logger and RDebug
+    #if defined (USE_RDEBUG) && defined (USE_LOGGER)
+    #define __TRACE(level,p) if ( (level) & KDebugLevel) {\
+    ((CStifLogger*) Dll::Tls())->Log p;\
+    RDebug::Print p;\
+    }
+    #endif
+
+    // Not using RDebug and not using logger
+    #if !defined(USE_RDEBUG) && !defined (USE_LOGGER)
+    #define __TRACE(level,p);
+    #endif
+    
+    #define __RDEBUG(x) if( KVerbose & KDebugLevel){ RDebug::Print x ; }
+
+#else
+    // No tracing
+    #define __TRACE(level,p);
+    
+    #define  __RDEBUG(x)
+#endif
+
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // LOGGINGDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/inc/PrintQueue.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,191 @@
+/*
+* 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: This file contains the CPrintQueue and 
+* TPrintQueueItem class definitions.
+*
+*/
+
+#ifndef PRINTQUEUE_H
+#define PRINTQUEUE_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifTestInterface.h>
+
+
+// CONSTANTS
+
+// The print queue maximum length. If queue overflows, the lowest
+// priority item is discarded from queue.
+const TInt KQueueMaxLen = 20;
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// TPrintQueueItem is a print queue item class.
+class TPrintQueueItem 
+        :public CBase
+    {
+    public: // Enumerations
+         // None
+    
+    protected: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        /** 
+        * C++ default constructor.
+        */
+        TPrintQueueItem( const TInt aPriority,
+                         const TStifInfoName& aText1,
+                         const TName& aText2 );
+
+    public: // New functions
+        // None
+
+    protected:  // New functions
+        // None
+
+    private:    // New functions
+
+    public:  // Functions from base classes        
+        
+    protected:  // Functions from base classes
+        // None
+
+    private:
+       // None
+       
+    public:   //Data
+        TStifInfoName     iData1;                    // Description
+        TName         iData2;                    // Text
+        TInt          iPriority;                 // Priority
+        static const  TInt iOffset;              // Queue link offset
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        TSglQueLink   iSlink;                    // Queue link
+    
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None 
+
+    };
+
+// DESCRIPTION
+// CPrintQueue is a queue for test module prints
+class CPrintQueue
+        :public CBase
+    {
+    public: // Enumerations
+        // None
+
+    protected: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */        
+        static CPrintQueue* NewL();
+
+        /**
+        * Destructor of CPrintQueue.
+        */
+        virtual ~CPrintQueue();
+
+
+    public: // New functions
+
+        /**
+        * Pops item from queue
+        */
+        TPrintQueueItem*  Pop();
+    
+
+        /**
+        * Push item to queue
+        */
+        TInt Push( TPrintQueueItem& anItem );
+
+        /**
+        * Returns the count
+        */
+        TInt Count();
+        
+
+    public: // Functions from base classes
+        // None
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CPrintQueue();
+        
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        TSglQue<TPrintQueueItem>     iQueue;
+        TSglQueIter<TPrintQueueItem> iQueueIterator;
+        TInt                         iQueueLen;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif  // PRINTQUEUE_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/inc/TestServer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1695 @@
+/*
+* 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: This file contains the header file of the 
+* CTestServer.
+*
+*/
+
+#ifndef TEST_SERVER_H
+#define TEST_SERVER_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "PrintQueue.h"
+#include <StifLogger.h>
+#include "Logging.h"
+#include <StifTestModule.h>
+#include <StifTestInterface.h>
+
+// CONSTANTS
+
+// KDefaultHeapSize needed for creating server thread.
+const TUint KDefaultHeapSize = 0x10000;
+const TUint KMaxHeapSize     = 0x20000;
+
+// MACROS
+
+// FUNCTION PROTOTYPES
+typedef CTestModuleBase*( *CTestInterfaceFactory )();
+
+// DATA TYPES
+
+// Panic reasons
+enum TTestServerPanic
+    {
+    EBadRequest,
+    EBadDescriptor,
+    EDescriptorNonNumeric,
+    EMainSchedulerError,
+    ESvrCreateServer,
+    ECreateTrapCleanup,
+    EBadRemove, 
+    EBadSubsessionHandle,
+    ENoStartupInformation,
+    EEnumerateHasNotBeenCalled,
+    EClosingWhileTestRunning,
+    EPrintMutexNotFreed,
+    EThreadMutexNotFreed,
+    EEventMutexNotFreed,
+    EEventArrayMutexNotFreed,
+    ETestModuleMutexNotFreed,
+    EInvalidCTestExecution,
+    EPrintQueueBroken,
+    EInvalidRequestCancel,
+    EWrongEventQueueDeleteContext,
+    EReInitializingTestModule,
+    ETestModuleNotInitialized,
+    EInvalidTestModuleOperation,
+    EWrongHeapInUse,
+    ENullTestModuleFunction,
+    ENullTestModuleContainer,
+    ENullTestModule,
+    ECannotCreateEventArray,
+    EPreviousRequestStillOngoing,
+    ECannotOpenServerThread,
+    ENullModuleSession,
+    EInvalidThreadState,
+    EUnknownEventCmd,
+    EUnknownRemoteCmd,
+    ENullTestThreadContainer,
+    ENullExecution,
+    EAlreadyActive,
+    };
+
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class TEvent;
+class CTestModule;
+class CTestModuleContainer;
+class CTestExecution;
+class CTestThreadContainer;
+class CErrorPrintHandler;
+class CTestThreadContainerRunnerFactory;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CUnderTaker class is an active object that handles thread death
+// notifications.
+class CUnderTaker 
+        :public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CUnderTaker* NewL( CTestModuleContainer* aContainer );
+
+        /**
+        * Destructor of CUnderTaker.
+        */
+        virtual ~CUnderTaker();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        TInt StartL();
+
+        /**
+        * Is undertaker completed?
+        */
+        TBool Completed();
+
+		/**
+        * Sets or unsets local processing mode
+        */
+        void SetSynchronousMode(const TBool aMode);
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CUnderTaker();
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CTestModuleContainer* aContainer );
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestModuleContainer* iModuleContainer;           // Pointer to parent
+         TBool iCancelNeeded;                              // Is cancel needed?
+		 TBool iSynchronousMode;                           // In synchronous mode
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+
+
+// DESCRIPTION
+// CTestModuleContainer is a class, which contains the test execution thread
+// and interface functions to do operations in that thread context.
+class CTestModuleContainer 
+       :public CActive  
+    {
+
+    public: // Enumerations
+        enum TOperation
+            {
+            EInitializeModule,
+            EEnumerateInThread,
+            EExecuteTestInThread,
+            EFreeEnumerationData,
+            EExit,
+            };
+        
+        enum TRequestType
+            {
+            ERqTestCase,
+            ERqErrorPrint,
+            };
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestModuleContainer* NewL( const TDesC& aName, 
+                                           CTestModule* aSession,
+                                           const TDesC& aConfig );
+
+        /**
+        * Destructor of CTestModuleContainer.
+        */
+        virtual ~CTestModuleContainer();
+
+
+    public: // New functions
+
+        /**
+        * Initialize the test module
+        */
+        TInt Initialize( const TFileName& aName,
+                         const TBool aFirstTime );
+
+        /**
+        * Enumerate test cases
+        */
+        TInt EnumerateTestCases( const TFileName& aName );
+
+
+        /**
+        * Frees the enumeration data
+        */
+        TInt FreeEnumerationData();
+
+        /**
+        * Run a test case
+        */
+        void RunTestCase( const TFileName& aName,
+                          const TInt aCaseNumber,
+                          const RMessage2& aMessage );
+
+
+        /**
+        * Changes the operation, can fail
+        */
+        TInt ChangeOperation( const TOperation aOperation, 
+                              const TFileName& aNameBuffer,
+                              const TInt aInt );
+
+        /**
+        * Changes the operation
+        */
+		void ChangeOperationNoError( const TOperation aOperation,
+                                     const TInt aInt );
+
+        /**
+        * Return the operation
+        */
+        //@spe const TOperation Operation();
+        TOperation Operation();
+
+        /**
+        * Set a new execution subsession
+        */
+        void SetExecutionSubSession( CTestExecution* aExecution );
+
+        /**
+        * Pauses the thread
+        */
+        TInt PauseThread();
+
+        /**
+        * Resumes the thread
+        */
+        TInt ResumeThread();
+
+        /**
+        * Returns pointer to test cases
+        */
+        const RPointerArray<TTestCaseInfo>* TestCases() const;
+
+        /**
+        * Returns error code from operation
+        */
+        TInt& OperationErrorResult();
+
+        /**
+        * Returns error code from module
+        */
+        TInt& ModuleResult();
+
+        /**
+        * Kill the thread
+        */
+        void KillThread( const TInt aCode );
+        
+        /**
+        * Error print handler.
+        */
+        void DoErrorPrint();
+
+        /**
+        * Make sure that any of the test interference thread's won't stay
+        * to run if test case is crashed of test interference object is not
+        * deleted.
+        */ 
+        void KillTestinterferenceThread();
+
+        /**
+        * Make sure that any of the test measurement process's won't stay
+        * to run if test case is crashed of test measurement object is not
+        * deleted.
+        */
+        void KillTestMeasurement();
+
+    public: 
+    
+        /**
+        * Get semaphore handles.
+        */
+        TInt OperationStartSemHandle(){ return iOperationStartSemaphore.Handle(); };
+        TInt OperationChangeSemHandle(){ return iOperationChangeSemaphore.Handle(); };
+    
+        /** 
+        * Access to "shared" memory.
+        * Called from test thread'
+        */
+        void SetThreadContainer( CTestThreadContainer* aThread )
+            { iThreadContainer = aThread; };
+        
+        const TDesC& OperationName(){ return iOperationName; };
+
+        TDes& OperationText(){ return iOperationText; };
+        
+        TInt& OperationIntBuffer(){ return iOperationIntBuffer; };
+        
+        TOperation OperationType(){ return iOperationType; };
+        
+        const TDesC& TestModuleName();
+        const TDesC& TestModuleIniFile();
+        
+        CTestModuleIf::TExitReason& AllowedExitReason()
+            { return iAllowedExitReason; };   
+
+        TInt& AllowedExitCode(){ return iAllowedExitCode; };        
+      
+        TThreadId ServerThreadId(){ return iServerThreadId; };
+        
+        CTestExecution* TestExecution()
+            { return iCTestExecution; };
+
+        TRequestStatus* GetRequest( TRequestType aType );
+        
+        TErrorNotification& ErrorNotification(){ return iErrorPrint; };
+        
+        TInt ErrorPrintSemHandle(){ return iErrorPrintSem.Handle(); };
+        
+        /**
+        * Get title of currently running test case
+        */ 
+        void GetTestCaseTitleL(TDes& aTestCaseTitle);
+
+        /**
+         * Gets pointer to test module
+         */
+        CTestModule* GetTestModule();        
+        
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aName, 
+                         CTestModule* aSession,
+                         const TDesC& aConfig );
+
+	private:  // New functions
+
+		/**
+        * Start and wait until operation is completed.
+        */
+        TInt StartAndWaitOperation();
+
+        /**
+        * Completes operation from test execution thread or from undertaker
+        */
+        void Complete(  const TInt aCompletionCode );
+
+        /**
+        * Function that initialise module in execution thread context.
+        */
+        TInt InitializeModuleInThread( RLibrary& aModule );
+
+        /**
+        * Function that enumerates test cases in execution thread context.
+        */
+        TInt EnumerateInThread();
+
+        /**
+        * Function that frees the enumeration data in execution thread context.
+        */
+        void FreeEnumerationDataInThread();
+
+        /**
+        * Function that executes test case in execution thread context.
+        */
+        TInt ExecuteTestCaseInThread();
+
+		
+        /**
+        * Delete a test module instance
+        */
+		void DeleteTestModule();
+
+        /**
+        * Function that resolves test case completion code
+        */
+        TInt ResolveCompletionCode( TInt aLeaveCode,
+                                    TInt aErrorCode );
+
+        /**
+        * Test case execution thread thread function
+        */
+        static TInt ExecutionThread( TAny* aParams );
+
+        /**
+        * Parse stack and heap information for TestScripter's
+        * test case (config) file.
+        */
+		TInt ReadParametersFromScriptFileL( const TDesC& aConfig,
+                                            TInt& aStackSize,
+											TInt& aHeapMinSize,
+											TInt& aHeapMaxSize );
+
+        /**
+        * Loads dynamically testmodule and calls SetRequirements()-
+		* method for test module parameter handling.
+        */
+        TInt ReadParametersFromTestModule( const TDesC& aModuleName,
+										CTestModuleParam*& aTestModuleParam );
+
+        /**
+        * Load test module dynamically. If loading is done succesfully
+		* then get test module's parameters according to version.
+        * Verifies received parameters also.
+        */
+        TInt GetTestModuleParams( const TDesC& aModuleName,
+                                    const TDesC& aConfig,
+									TInt& aStackSize,
+									TInt& aHeapMinSize,
+									TInt& aHeapMaxSize );
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CTestModuleContainer();
+
+    public:     // Data
+
+    protected:  // Data
+        // None
+
+    private:    // Data     
+        CTestExecution* iCTestExecution;         // Handle to "parent" test execution
+        CTestModule* iCTestModule;               // Handle to "parent"  module
+        CUnderTaker* iUnderTaker;                // Pointer to thread undertaker
+        CTestThreadContainer*   iThreadContainer;// Pointer thread container
+
+        RThread iThread;                         // Thread where test module lives in
+        TBool iUpAndRunning;                     // Is the thread running
+        TOperation iOperationType;               // What to do?
+
+        RSemaphore iOperationStartSemaphore;     // Used to wait until something to do
+        RSemaphore iOperationChangeSemaphore;    // Protects the operation changes
+
+        TPtr iOperationName;                     // Operation descriptor buffer
+        HBufC* iModuleNameBuffer;                // HBuffer for module name file;
+     
+        TInt iOperationIntBuffer;                // Transfers operation int to thread
+
+        RMessage2 iMessage;                      // Message to complete, used in RunTestCase
+
+        // Results from test module
+        TInt iModuleResult;                      // Low priority result from test module
+        TInt iErrorResult;                       // High priority error from operation
+        TRequestStatus iOperationStatus;         // Operation ongoing?
+        TThreadId iServerThreadId;               // Server thread Id. Used in completion
+		TBuf<30> iOperationText;                 // Human readable current operation for
+		
+        CTestModuleIf::TExitReason iAllowedExitReason;          // Allowed exit reason
+        TInt iAllowedExitCode;                   // Allowed exit code
+        
+        // Error print handler	    
+        CErrorPrintHandler*         iErrorPrintHandler;
+        
+        RSemaphore      iErrorPrintSem;          // Synchonize error messages
+        TErrorNotification  iErrorPrint;
+
+        // Indicates is pause operation executed. This value will be checked
+        // when test case is executed. Resume operation will be reset this
+        // value.
+        TBool  iIsPaused;
+
+		// This active scheduler is uses as a nested one        
+        CActiveSchedulerWait*       iNestedActiveScheduler;
+    
+    public:     // Friend classes
+        friend class CUnderTaker;                // Handles the thread deaths
+        friend class CErrorPrintHandler;
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+    };
+
+
+// DESCRIPTION
+// CTestServer is a server class.
+// Contains an object container index which provides subsessions with object containers.
+class CTestServer
+        :public CServer2
+    {
+    public: // Enumerations
+        enum { ETestServerPriority = CActive::EPriorityHigh };
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestServer* NewL( const TFileName& aName );
+
+        /**
+        * Destructor of CTestServer.
+        */
+        ~CTestServer();
+
+    public: // New functions
+
+        /**
+        * ThreadFunction is used to create new thread.
+        */
+        static TInt ThreadFunction( TAny* aStarted );
+
+        /**
+        * Return object container, guaranteed to produce object containers with
+        * unique ids within the server.
+        */
+        CObjectCon* NewContainerL();
+
+        /**
+        * Removes a container. Needed to close session properly.
+        */
+        void DeleteContainer( CObjectCon* aContainer );
+                    
+        /**
+        * Inform Server that session is closed.
+        */
+        void SessionClosed();
+        
+        /**
+        * Returns module name
+        */
+        const TDesC& ModuleName() const;
+
+        /**
+        * Is module inside this server already initialised?
+        */
+        //@spe const TBool FirstTime() const;
+        TBool FirstTime() const;
+
+        /**
+        * Clears the module first time flag.
+        */
+        void ClearFirstTime();
+
+        /**
+        * PanicServer panics the CTestServer
+        */
+        static void PanicServer( const TTestServerPanic aPanic );
+
+        /**
+        * GetServerThreadId for ServerStateHandler Active object usage
+        */
+        TInt GetServerThreadId ();
+        
+        /**
+         * Gets CTestThreadContainerRunner pointer which is used in UI testing
+         */
+        CTestThreadContainerRunnerFactory* GetTestThreadContainerRunnerFactory();
+                
+        /**
+         * Gets information that testserver supports UI testing or not
+         */
+        TBool IsUiTestingSupported();
+        
+        /**
+         * Gets pointer to UiEnvProxy.
+         */
+        CUiEnvProxy* GetUiEnvProxy();
+    public: // Functions from base classes
+
+        /**
+        * NewSessionL creates new CTestServer session.
+        */
+        CSession2* NewSessionL( const TVersion &aVersion,
+                                const RMessage2& aMessage ) const;
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CTestServer();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TFileName& aName );
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CObjectConIx* iContainerIndex;           // Pointer to container
+        TPtr iModuleName;                        // Server name
+        HBufC* iModuleNameBuffer;                // HBuffer for module name file;
+        TBool iFirstTime;                        // Is module previously initialized?
+
+        // Container count
+        TInt                    iSessionCount;
+
+        TBool iUiTestingSupport;						 // Indicates if it is testserver which supports UI testing
+        CTestThreadContainerRunnerFactory* iTestThreadContainerRunnerFactory; // Pointer to CTestThreadContainerRunnerFactory
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// CTestCasesList is a class, which contains list of test cases assosiated with
+// specified config file.
+NONSHARABLE_CLASS( CTestCasesList ): public CBase
+    {
+public:
+    /**
+    * NewL is first phase of two-phased constructor.
+    */
+    static CTestCasesList* NewL( const TDesC& aConfigFileName );
+public:
+    /**
+    * Destructor of CTestServer.
+    */
+    ~CTestCasesList();
+
+    /**
+     * Appends test case.
+     */
+    void AppendTestCaseL( const TDesC& aTestCaseTitle );
+    
+    /**
+     * Returns specified test case title.
+     */
+    const TDesC& GetTestCaseTitleL( TInt aIndex ) const;
+    
+    /**
+     * Returns config file name.
+     */
+    const TDesC& GetConfigFileName() const;
+    
+    /**
+     * Returns count of test cases.
+     */
+    TInt Count() const;
+    
+    /**
+     * Resets list of test cases.
+     */
+    void ResetAndDestroy();
+private:
+    /** 
+    * C++ default constructor.
+    */
+    CTestCasesList();
+    
+    /**
+    * By default Symbian OS constructor is private.
+    */
+    void ConstructL( const TDesC& aConfigFileName );
+private:
+    // Config file name
+    HBufC* iConfigFileName;
+    // List of test cases
+    RPointerArray<HBufC> iTestCases;
+    };
+
+        
+// DESCRIPTION
+// CTestModule is a session class.
+// Session for the CTestServer server, to a single client-side session
+// a session may own any number of CCounter objects
+class CTestModule
+        :public CSession2
+    {    
+    public:
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+
+        /**
+        * Construct a test module object.
+        */
+        static CTestModule* NewL( CTestServer* aServer );
+
+        /**
+        * Destructor
+        */
+        virtual ~CTestModule();
+
+    public: // New functions
+
+        /**
+        * Dispatch message
+        */
+        TInt DispatchMessageL( const RMessage2& aMessage );
+
+        /**
+        * Create Module Session
+        */
+        TInt CreateModuleSessionL( const RMessage2& aMessage );
+
+        /**
+        * Close the session to CTestServer.
+        */
+        TInt CloseSession( const RMessage2& aMessage );
+
+
+        /**
+        * Create CTestExecution subsession.
+        */
+        TInt NewTestExecutionL( const RMessage2& aMessage );
+
+        /**
+        * Destroy the created CTestExecution subsession.
+        * Cannot fail - can panic client.
+        */
+        void DeleteTestExecution( const TUint aHandle, const RMessage2& aMessage );
+
+        /**
+        * NumResources is used to provide reserver resources to client.
+        */
+        void NumResources( const RMessage2& aMessage );
+
+        /**
+        * Return the number of resources owned by the session.
+        */
+        TInt CountResources();
+
+        /**
+        * Enumerates test cases
+        */
+        TInt EnumerateTestCasesL( const RMessage2& aMessage );
+
+        /**
+        * Get test cases
+        */
+        TInt GetTestCasesL( const RMessage2& aMessage );
+
+        /**
+        * Handles error notifications
+        */
+        TInt HandleErrorNotificationL( const RMessage2& aMessage );
+
+        /**
+        * Get Server Thread Id
+        */
+        TInt GetServerThreadIdL( const RMessage2& aMessage );
+
+        /**
+        * 
+        */
+        TInt PassEngineSessionSettings( const RMessage2& aMessage );
+
+        /**
+        * Prints error notification
+        */
+        void ErrorPrint( const TInt aPriority, 
+                         TPtrC aError );
+
+        /**
+        * Cancels asynchronous request
+        */
+        TInt CancelAsyncRequestL( const RMessage2& aMessage );
+
+        /**
+        * Frees a test case specific data owned by module( i.e enumeration data )
+        */
+        TInt FreeCaseData();
+
+        /**
+        * Returns case corresponding handle
+        */
+        CTestExecution* CaseFromHandle( const TUint aHandle, const RMessage2& aMessage ) const;
+
+        /**
+        * Returns module initialisation file name
+        */
+        const TDesC& IniName() const;
+
+		/**
+        * Returns module name
+        */
+		const TDesC& Name() const;
+
+        /**
+        * Returns a test module.
+        */
+        TInt GetTestModule( CTestModuleContainer*& aContainer,
+                            const TDesC& aConfig );
+
+        /**
+        * Frees a test module.
+        */
+        TInt FreeTestModule( CTestModuleContainer* aModule );
+
+        /**
+        * Write is utility method.
+        */
+        void Write( const TAny* aPtr, const TDesC8& aDes, TInt anOffset = 0 );
+
+        /**
+        * PanicClient panics the user of CTestModule( RTestModule user )
+        */
+        void PanicClient( TInt aPanic, const RMessage2& aMessage ) const;
+
+        /**
+        * Get title of currently running test case
+        */ 
+        void GetTestCaseTitleL(TInt aTestCaseNumber, const TDesC& aConfigFile, TDes& aTestCaseTitle);
+
+        /**
+         * Get pointer to test server
+         */ 
+         CTestServer* GetTestServer();        
+
+         TBool UiTesting();
+                 
+         TBool SeperateProcesses();         
+         
+    public: // Functions from base classes
+
+        /**
+        * ServiceL handles the messages to CTestServer
+        */
+        virtual void ServiceL( const RMessage2& aMessage );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CTestServer* aServer );
+
+    public:   //Data
+        // None
+
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        RPointerArray<CTestModuleContainer>* iTestModuleInstances; // List of FREE test modules
+        CTestServer* iTestServer;                    // Pointer to "parent"
+        CObjectCon* iContainer;                  // Object container for this session
+        CObjectIx* iTestExecutionHandle;         // Object index( stores CTestExecutions,
+                                                 // (Unclosed)subsession handle )
+
+        TBool iUiTesting;
+        TBool iSeperateProcesses;
+        
+        TInt iResourceCount;                     // Total number of resources allocated
+        TPtr iIni;                               // Module initialisation( file ) name
+        HBufC* iIniBuffer;                       // HBuffer for ini name file;
+
+        CTestModuleContainer* iEnumerateModule;  // Module used in enumeration
+
+        RMessage2 iErrorMessage;                 // Error message
+
+        TBool iErrorMessageAvailable;            // Error message available?
+        
+        RPointerArray<CTestCasesList> iTestCaseTitlesMap;    //Test case titles
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CPrintHandler class is an active object that handles print
+// indication from test thread.
+class CPrintHandler 
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CPrintHandler* NewL( CTestExecution& aExecution );
+
+        /**
+        * Destructor of CPrintHandler.
+        */
+        virtual ~CPrintHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CPrintHandler( CTestExecution& aExecution );
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestExecution&        iExecution;     // Pointer to parent
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CEventHandler class is an active object that handles print
+// indication from test thread.
+class CEventHandler 
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CEventHandler* NewL( CTestExecution& aExecution );
+
+        /**
+        * Destructor of CEventHandler.
+        */
+        virtual ~CEventHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CEventHandler( CTestExecution& aExecution );
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestExecution&        iExecution;     // Pointer to parent
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CSndHandler class is an active object that handles print
+// indication from test thread.
+class CSndHandler 
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CSndHandler* NewL( CTestExecution& aExecution );
+
+        /**
+        * Destructor of CSndHandler.
+        */
+        virtual ~CSndHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CSndHandler( CTestExecution& aExecution );
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestExecution&        iExecution;     // Pointer to parent
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CRcvHandler class is an active object that handles print
+// indication from test thread.
+class CRcvHandler 
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CRcvHandler* NewL( CTestExecution& aExecution );
+
+        /**
+        * Destructor of CRcvHandler.
+        */
+        virtual ~CRcvHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CRcvHandler( CTestExecution& aExecution );
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestExecution&        iExecution;     // Pointer to parent
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+        
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CErrorPrintHandler class is an active object that handles print
+// indication from test thread.
+class CErrorPrintHandler 
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CErrorPrintHandler* NewL( CTestModuleContainer& aContainer );
+
+        /**
+        * Destructor of CErrorPrintHandler.
+        */
+        virtual ~CErrorPrintHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CErrorPrintHandler( CTestModuleContainer& aContainer );
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestModuleContainer&      iContainer;     // Pointer to parent
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CTestInterferenceHandler class is an active object that handles test
+// interference
+NONSHARABLE_CLASS( CInterferenceHandler ) 
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CInterferenceHandler* NewL( CTestExecution& aExecution );
+
+        /**
+        * Destructor of CInterferenceHandler.
+        */
+        virtual ~CInterferenceHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CInterferenceHandler( CTestExecution& aExecution );
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestExecution&        iExecution;     // Pointer to parent
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+// DESCRIPTION
+// CMeasurementHandler class is an active object that handles test
+// measurement
+NONSHARABLE_CLASS( CMeasurementHandler ) 
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMeasurementHandler* NewL( CTestExecution& aExecution );
+
+        /**
+        * Destructor of CMeasurementHandler.
+        */
+        virtual ~CMeasurementHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError( TInt aError );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CMeasurementHandler( CTestExecution& aExecution );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to test execution side
+        CTestExecution&        iExecution;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+/**
+* Check is module TestScripter. Does parsing and returns new module name and
+* error codes(Needed operations when creating server sessions to TestScripter).
+*/
+TInt CheckModuleName( TFileName aModuleName, TFileName& aNewModuleName );
+
+/**
+* Remove optional index appended to module name.
+* If it is found (@ char) then set new module name without it.
+* This feature is used when iSeparateProcesses is set in TestEngine.
+*/
+void RemoveOptionalIndex(const TDesC& aModuleName, TDes& aNewModuleName);
+
+// DESCRIPTION
+// CEventHandler class is an active object that handles print
+// indication from test thread.
+NONSHARABLE_CLASS(CCommandHandler)
+    : public CActive
+    {
+
+    public:  // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCommandHandler* NewL(CTestExecution& aExecution);
+
+        /**
+        * Destructor of CCommandHandler.
+        */
+        virtual ~CCommandHandler();
+
+    public: // New functions
+
+        /**
+        * Start monitoring
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+        /**
+        * RunError derived from CActive handles errors from active handler.
+        */
+        TInt RunError(TInt aError);
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCommandHandler(CTestExecution& aExecution);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+         CTestExecution&        iExecution;     // Pointer to parent
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif // TEST_SERVER_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/inc/TestServerCommon.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,54 @@
+/*
+* 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: This file contains common data for Test Server.
+*
+*/
+
+
+#ifndef TEST_SERVER_COMMON_H
+#define TEST_SERVER_COMMON_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+
+// Server name
+_LIT( KTestServerName,"TestFrameworkServer" );
+
+// The server version.
+// A version must be specified when creating a session with the server.
+const TUint KTestServerMajorVersionNumber=0;
+const TUint KTestServerMinorVersionNumber=1;
+const TUint KTestServerBuildVersionNumber=1;
+
+
+#endif // TEST_SERVER_COMMON_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/inc/TestServerEvent.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,176 @@
+/*
+* 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: This file contains the header file of the event 
+* interface.
+*
+*/
+
+#ifndef TESTSERVEREVENT_H
+#define TESTSERVEREVENT_H
+
+//  INCLUDES
+#include <StifTestEventInterface.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+class CTestExecution;
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+// Interface class for the test system.
+class TEvent
+    :public TEventIf
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        /**
+        * C++ default constructor.
+        */
+        TEvent( TThreadId aThreadId );
+        
+        /**
+        * C++ destructor.
+        */
+        ~TEvent();
+
+    public: // New functions
+        
+        /**
+        * Set event.
+        */
+        void Set( TEventType aEventType );
+        
+       	/** 
+        * Check event status.
+        */ 
+        TBool EventPending();
+        
+        /** 
+        * Check waiting status.
+        */ 
+        TBool WaitEventPending();
+        
+        /**
+        * First phase of waiting.
+        */
+		TInt SetWaitPending( TRequestStatus* aStatus = NULL );
+
+        /**
+        * Wait event.
+        */
+        void Wait();
+        
+        /**
+        * Complete pending wait.
+        */
+		void CompletePendingWait( TInt aError );
+
+        /**
+        * Release event. Completes conceivably pending unset.
+        */
+        void Release();
+        
+        /**
+        * Unset event. Unset blocks until Release is called 
+        * (i.e. iUnsetMessage is compeled from release).
+        */
+        TInt Unset( const RMessage2& aMessage, CTestExecution* aExecution );
+        
+        /**
+        * Get TRequestStatus of the event.
+        */ 
+        const TRequestStatus* RequestStatus() const { return iReq; }; 
+
+    public: // Functions from base classes
+        // None
+        
+    protected:  // New functions
+        // None
+        
+    protected:  // Functions from base classes
+        // None
+        
+    private:
+        // None
+        
+	public:   //Data
+	    // None
+        
+	protected:  // Data
+        // None
+        
+    private:    // Data
+        /**
+        * Request status.
+        */
+        TRequestStatus* iReq; 
+        TRequestStatus iRequestStatus;
+        
+        /**
+        * Thread id.
+        */
+        TThreadId iThread;
+
+        /**
+        * Unset message.
+        */
+        RMessage2 iUnsetMessage;
+
+        /**
+        * Flag for state event status.
+        */
+        TBool iEventPending;
+        /**
+        * Flag for indicating that iReq is owned by us.
+        */
+        TBool iOwnReq;
+        
+        /**
+        * Execution object. Is non-NULL if unset is pending.
+        */ 
+        CTestExecution* iExecution;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+    };
+
+#endif      // TESTSERVEREVENT_H
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/inc/TestThreadContainerRunner.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,180 @@
+/*
+* 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: This file contains the header file of the 
+* TestThreadContainerRunner class.
+*
+*/
+
+#ifndef TESTTHREADCONTAINERRUNNER_H_
+#define TESTTHREADCONTAINERRUNNER_H_
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestThreadContainer;
+class CTestModuleContainer;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// This class is used to emulate CTestThreadContainer::ExecutionThread method
+// as an active object run in main thread of uitestserverstarter.
+class CTestThreadContainerRunner: public CActive
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+		// Current operation type
+		enum TOperationType { ENone,			// None 
+							  ESetup, 			// Setup
+							  ETearDown,		// TearDown
+							  ERunOneIteration,	// Emulate one iteration of while loop placed 
+							  					// in CTestThreadContainer::ExecutionThread   
+							};
+	
+	public:  // Constructors and destructor
+		/**
+		 * Performs first phase of two-phased constructor.
+		 */
+		IMPORT_C static CTestThreadContainerRunner* NewL( TThreadId aMainThreadId, 
+				CActiveScheduler* aMainThreadActiveScheduler );
+
+		/**
+		 * C++ destructor.
+		 */
+		~CTestThreadContainerRunner();
+	
+	private:  // Constructors and destructor
+		/**
+		 * C++ constructor.
+		 */
+		CTestThreadContainerRunner();
+		
+		/**
+		 * Performs second phase of two-phased constructor.
+		 */
+		void ConstructL( TThreadId aMainThreadId, 
+				CActiveScheduler* aMainThreadActiveScheduler );
+	
+	public: // New functions
+		/**
+		 * Performs TestThreadContainer setup.
+		 */
+		void Setup( CTestModuleContainer* aTestModuleContainer );
+		
+		/**
+		 * Runs one iteration of emulated CTestThreadContainer::ExecutionThread while loop.
+		 */
+		void RunOneIteration();
+		
+		/**
+		 * Performs cleanup of TestThreadContainer.
+		 */
+		void TeareDown();
+		
+		/**
+		 * Checks if operation change signal was signaled from suspend state. 
+		 */
+		void CheckSignalFromSuspend();
+
+		/**
+		 * Checks if test thread is reusable.
+		 */
+		TBool IsReusable();
+
+
+	public: // Functions from base classes
+		/**
+		 * RunL derived from CActive handles the completed requests.
+		 */
+		void RunL();
+
+		/**
+		 * DoCancel derived from CActive handles the Cancel.
+		 */
+		void DoCancel();
+
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+        
+    private:	// New functions
+    	/**
+    	 * Test thread exception handler. 
+    	 */
+		static void ExceptionHandler ( TExcType aType );
+	
+		/**
+		 * Raises panic.
+		 */
+		void Panic( TInt aReason );
+		
+		/**
+		 * Complets current operation request, what causes execution of RunL method 
+		 * in main thread of UITestServerStarter.
+		 */
+		void CompleteRequest();
+    private:	// Functions from base classes
+        // None    
+    
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+		TThreadId iMainThreadId;					// UITestServerStarter main thread id.
+		CActiveScheduler* iMainThreadActiveScheduler;	// Pointer to UITestServerStarter main thread active scheduler.		
+	    RLibrary iModule;							// Handle to test module library.
+		CTestModuleContainer* iTestModuleContainer; // Pointer to test module container.		
+		TOperationType iCurrentOperation;			// Current operation type.
+		CTestThreadContainer* iTestThreadContainer;	// Pointer to test thread container.
+	
+		RSemaphore iOperationOngoing;				// Current operation end semaphore.
+		
+	    TBool iReusable;             				// Is test module reusable.
+	    TBool iSignalFromSuspend;   				// Send signal from suspend state.
+	    TBool iInitialized;         				// Is module initialized.
+	    TInt iReturnCode;							// Lasst loop result code
+		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None
+	};
+
+#endif // TESTTHREADCONTAINERRUNNER_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/inc/ThreadLogging.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,99 @@
+/*
+* 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: Logging definitions.
+*
+*/
+
+#ifndef LOGGINGDEFS_H
+#define LOGGINGDEFS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+
+// CONSTANTS
+const TUint KError           = 0x1;
+const TUint KInit            = 0x2;
+const TUint KThreadOperation = 0x4;
+const TUint KRunTestCase     = 0x8;
+const TUint KPrint           = 0x10;
+const TUint KMessage         = 0x20;
+const TUint KVerbose         = 0x40;
+const TUint KAlways          = 0xFFFFFFFF;
+const TUint KDebugLevel      = ( KMessage | KInit | KError );
+
+// MACROS
+#define __TRACING_ENABLED
+
+// Define USE_RDEBUG to use RDebug::Print for logging
+//#define USE_RDEBUG
+
+// Define USE_LOGGER to use logger for logging
+#define USE_LOGGER
+
+#ifdef __TRACING_ENABLED
+
+    // TRACEI macro is used in test execution thread to allow the test use Tls for its own purposes
+    // Note that handles to server (i.e to fileserver) are thread specific.
+
+    // Disable conditional expression is constant -warning
+    #pragma warning( disable : 4127 )
+
+    // Using logger and not RDebug
+    #if defined (USE_LOGGER) && !defined (USE_RDEBUG)
+    #define __TRACEI(level,p) if ( (level) & KDebugLevel) { if(THREADLOGGER)THREADLOGGER->Log p; }
+    #endif
+
+    // Using RDebug and not Logger
+    #if defined (USE_RDEBUG) && !defined (USE_LOGGER)
+    #define __TRACEI(level,p) if ( (level) & KDebugLevel) { RDebug::Print p; }
+    #endif
+
+    // Using Logger and RDebug
+    #if defined (USE_RDEBUG) && defined (USE_LOGGER)
+
+    #define __TRACEI(level,p) if ( (level) & KDebugLevel) {\
+        if(THREADLOGGER)THREADLOGGER->Log p;\
+        RDebug::Print p;\
+    }
+
+    #endif
+
+    // Not using RDebug and not using logger
+    #if !defined(USE_RDEBUG) && !defined (USE_LOGGER)
+    #define __TRACEI(level,p);
+    #endif
+    
+    #define __RDEBUG(x) if( KVerbose & KDebugLevel){ RDebug::Print x ; }
+
+#else
+    // No tracing
+    #define __TRACEI(level,p);
+
+    #define  __RDEBUG(x)
+#endif
+
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // LOGGINGDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/Printqueue.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,282 @@
+/*
+* 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: This module contains implementation of CPrintQueue 
+* class and TPrintQueueItem class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "PrintQueue.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+// Initialise the queue
+const TInt TPrintQueueItem::iOffset = _FOFF( TPrintQueueItem, iSlink );
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintQueue
+
+    Method: NewL
+
+    Description: Constructs a print queue.
+      
+    Parameters: None
+
+    Return Values: CPrintQueue*                     Pointer to new queue
+
+    Errors/Exceptions: Leaves if memory allocation fails.
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CPrintQueue* CPrintQueue::NewL()
+    {
+
+    CPrintQueue* self = new( ELeave ) CPrintQueue;
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintQueue
+
+    Method: CPrintQueue
+
+    Description: Constructor.
+    Initialises the queue and queue iterator.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CPrintQueue::CPrintQueue():
+     iQueue( TPrintQueueItem::iOffset ),
+     iQueueIterator( iQueue )
+    {
+
+    iQueueLen = 0;
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintQueue
+
+    Method: ~CPrintQueue
+
+    Description: Destructor.
+
+    Deletes all items in queue. Function requires that it is called from
+    the heap to where the items are constructed.
+       
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CPrintQueue::~CPrintQueue()
+    {
+    
+    TPrintQueueItem *item = NULL;
+
+    // Delete items in queue
+    while(( item = Pop() ) != NULL )
+        {
+        delete item;      // TPrintQueueItem destructor does't free the memory
+        }
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintQueue
+
+    Method: Push
+
+    Description:
+
+    Push item to queue. If queue is full, does not add item to queue.
+
+    Parameters: TPrintQueueItem& anItem       :in:  Item to push to queue
+
+    Return Values: TInt                             KErrNoMemory if queue is full
+                                                    KErrNone     otherwise
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CPrintQueue::Push( TPrintQueueItem& anItem )
+    {
+
+    if( iQueueLen < KQueueMaxLen  )
+        {
+        iQueue.AddLast( anItem  );
+        iQueueLen++;
+
+        // Added successfully
+        return KErrNone;
+        }
+    else
+        {    
+        // Do not add to queue
+        return KErrNoMemory;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintQueue
+
+    Method: Pop
+
+    Description: Removes first item from queue and returns that.
+    if queue is empty, then return NULL.
+
+    Parameters: None
+
+    Return Values: TPrintQueueItem*                 Queue item or NULL.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TPrintQueueItem* CPrintQueue::Pop()
+    {
+
+    TPrintQueueItem* firstItem = NULL;
+    
+    if( !iQueue.IsEmpty()  )
+        {
+        firstItem = iQueue.First();
+        iQueue.Remove( *firstItem  );
+        iQueueLen--;
+        }
+    
+    return( firstItem  );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintQueue
+
+    Method: Count
+
+    Description: Returns the queue size.
+    
+    Parameters: None
+
+    Return Values: TInt                             Count
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TInt CPrintQueue::Count()
+    {
+    
+    return( iQueueLen  );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TPrintQueueItem
+
+    Method: TPrintQueueItem
+
+    Description: Constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters  const TInt aPriority          :in:  Priority
+                const TStifInfoName& aText1       :in:  Description field
+                const TName& aText2           :in:  Text field
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TPrintQueueItem::TPrintQueueItem( const TInt aPriority,
+                                  const TStifInfoName& aText1,
+                                  const TName& aText2 )
+    {
+
+    iPriority = aPriority;
+    iData1 = aText1;
+    iData2 = aText2;
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/TestExecutionThread.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,2936 @@
+/*
+* 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: This module contains implementation of 
+* CTestThreadContainer class implementation. These functions are 
+* called from the context of the test execution thread.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include <e32uid.h>
+#include <StifTestModule.h>
+#include "ThreadLogging.h"
+#include "TestEngineClient.h"
+#include <stifinternal/TestServerClient.h>
+#include "TestServer.h"
+#include "TestThreadContainer.h"
+#include "TestServerCommon.h"
+#include "TestServerModuleIf.h"
+#include "TestServerEvent.h"
+#include "TestThreadContainerRunner.h"
+#include <stifinternal/TestThreadContainerRunnerFactory.h>
+#include <stfeventsystem.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+#ifdef THREADLOGGER
+#undef THREADLOGGER
+#endif
+#define THREADLOGGER iThreadLogger 
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: NewL
+
+    Description: Returns new CTestThreadContainer instance.
+
+    Parameters: None
+
+    Return Values: CTestThreadContainer*            New instance
+
+    Errors/Exceptions: Function leaves if memory allocation fails or
+                       CTestThreadContainer ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainer* CTestThreadContainer::NewL( 
+    CTestModuleContainer* aModuleContainer,
+    TThreadId aServerThreadId )
+    {
+
+    CTestThreadContainer* self = 
+        new ( ELeave ) CTestThreadContainer( aModuleContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL( aServerThreadId );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: CTestThreadContainer*            New instance
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::ConstructL( TThreadId aServerThreadId )
+    {
+    
+    User::LeaveIfError( iServerThread.Open( aServerThreadId ) );
+    
+    iErrorPrintSem.SetHandle( ModuleContainer().ErrorPrintSemHandle() );
+    User::LeaveIfError( iErrorPrintSem.Duplicate( iServerThread ) );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: CTestThreadContainer
+
+    Description: Constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainer::CTestThreadContainer( 
+    CTestModuleContainer* aModuleContainer ):
+    iModuleContainer( aModuleContainer ),
+    iCheckResourceFlags( 0 )
+    {
+   
+    ModuleContainer().SetThreadContainer( this );
+    
+    StifMacroErrorInit(); // Initialization
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ~CTestThreadContainer
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainer::~CTestThreadContainer()
+    {
+
+    // Close mutexes
+    if ( iPrintMutex.Handle() != 0 ) iPrintMutex.Close();
+    if ( iEventMutex.Handle() != 0 ) iEventMutex.Close();
+    if ( iSndMutex.Handle() != 0 ) iSndMutex.Close();
+    if ( iRcvMutex.Handle() != 0 ) iRcvMutex.Close();
+    if ( iInterferenceMutex.Handle() != 0 ) iInterferenceMutex.Close();
+    if ( iMeasurementMutex.Handle() != 0 ) iMeasurementMutex.Close();
+    if ( iCommandMutex.Handle() != 0 ) iCommandMutex.Close();
+
+    // Mutex for testcomplete and cancel operations. Close duplicate mutex
+    if ( iTestThreadMutex.Handle() != 0 ) iTestThreadMutex.Close();
+
+    // Close semaphores
+    if ( iPrintSem.Handle() != 0 ) iPrintSem.Close();
+    if ( iErrorPrintSem.Handle() != 0 ) iErrorPrintSem.Close();
+    if ( iEventSem.Handle() != 0 ) iEventSem.Close();
+    if ( iSndSem.Handle() != 0 ) iSndSem.Close();
+    if ( iRcvSem.Handle() != 0 ) iRcvSem.Close();
+    if ( iInterferenceSem.Handle() != 0 ) iInterferenceSem.Close();
+    if ( iMeasurementSem.Handle() != 0 ) iMeasurementSem.Close();
+    //if ( iReceiverSem.Handle() != 0 ) iReceiverSem.Close();
+    if ( iCommandSem.Handle() != 0) iCommandSem.Close();
+    
+    iServerThread.Close();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: InitializeModule
+
+    Description: Initialize test module.
+
+    Function obtains pointer to the first exported function of the test module,
+    and calls that function to obtain an instance of CTestModuleBase derived
+    object. After that the "Init()"-method is called. If some operation fails,
+    module will be deleted and error code is returned.
+
+    This function is a static member function, which is intented to be called
+    from the context of the test module thread.
+
+    Parameters: RLibrary& aModule                 :in: Module to be loaded
+    
+    Return Values: TInt                                Error code from module
+                                                       or memory allocation.
+
+    Errors/Exceptions: None.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::InitializeModuleInThread ( RLibrary& aModule )
+    {        
+        
+    __TRACEI ( KInit, ( _L("Starting test module initialization") ) );
+    __TRACEI ( KInit, ( CStifLogger::EBold,  _L("Module name \"%S\""), 
+        &ModuleContainer().OperationName() ) );
+    ModuleContainer().OperationText() = _L("E32DLL");
+
+    TFileName moduleName;
+    TFileName tmpBuffer;
+
+    TInt r( KErrNone );
+    TFileName newNameBuffer;
+    TInt check = CheckModuleName( ModuleContainer().OperationName(), newNameBuffer );
+    if( check == KErrNone )
+        {
+        // Load the module(TestScripter)
+        r = aModule.Load( newNameBuffer );
+        }
+    else
+        {
+        // Load the module(Others)
+        RemoveOptionalIndex(ModuleContainer().OperationName(), newNameBuffer);
+        __TRACEI(KInit, (_L( "Valid module name is [%S] (extracted from [%S])"), &newNameBuffer, &ModuleContainer().OperationName()));
+        r = aModule.Load(newNameBuffer);
+        }
+    
+    if ( r != KErrNone )
+        {
+        __TRACEI (KError, ( CStifLogger::EError, _L("Can't initialize test module code = %d"), r));
+
+        // Set error codes
+        ModuleContainer().OperationErrorResult() = r;
+        return r;
+        }
+    else
+        {
+        // Print module name
+        moduleName = aModule.FileName();    
+        __TRACEI (KInit, (  _L("Loaded test module[%S]"), &moduleName ) );
+        }
+
+   
+    // Get pointer to first exported function
+    ModuleContainer().OperationText() = _L("1st EXPORTED function");
+    CTestInterfaceFactory libEntry;
+    libEntry = (CTestInterfaceFactory) aModule.Lookup(1);
+    if ( libEntry == NULL )
+        {
+        // New instance can't be created
+        __TRACEI (KError, ( CStifLogger::EError, _L("Can't initialize test module, NULL libEntry")));
+
+        // Set error codes
+        ModuleContainer().OperationErrorResult() = KErrNoMemory;
+        return KErrNoMemory;
+        }
+    else
+        {
+        __TRACEI ( KInit, ( _L("Pointer to 1st exported received")));
+        }
+
+    // initialize test module
+    __TRACEI ( KVerbose, (_L("Calling 1st exported at 0x%x"), (TUint32) libEntry ));
+    TRAPD ( err, iTestModule =  (*libEntry)() );
+
+     // Handle leave from test module
+    if ( err != KErrNone )
+        {
+        __TRACEI (KError, ( CStifLogger::EError, _L("Leave when calling 1st exported function, code %d"), err));
+        tmpBuffer = _L("Leave from test module 1st EXPORTED function");        
+        ErrorPrint( 1, tmpBuffer );        
+        delete iTestModule;
+        iTestModule = NULL;
+
+        // Set error codes
+        ModuleContainer().OperationErrorResult() = err;
+        return err;
+        }
+    else if ( iTestModule == NULL )     // Handle NULL from test module init
+        {
+        __TRACEI (KError, ( CStifLogger::EError, _L("NULL pointer received when constructing test module")));
+        tmpBuffer = _L("Test module 1st EXPORTED function returned NULL");        
+        ErrorPrint( 1, tmpBuffer );        
+        delete iTestModule;
+        iTestModule = NULL;
+
+        // Set error codes
+        ModuleContainer().OperationErrorResult() = KErrNoMemory;
+        return KErrNoMemory;
+        }
+    else
+        {
+        __TRACEI (KInit, (_L("Entrypoint successfully called, test module instance at 0x%x"), (TUint32)iTestModule ) );
+        }
+
+    // Verify version number.
+    ModuleContainer().OperationText() = _L("Version");
+    TVersion moduleAPIVersion(0,0,0);
+    TVersion myOldAPIVersion( KOldTestModuleAPIMajor, KOldTestModuleAPIMinor, KOldTestModuleAPIBuild );
+    TVersion myAPIVersion( KTestModuleAPIMajor, KTestModuleAPIMinor, KTestModuleAPIBuild );
+    TRAP ( err,  moduleAPIVersion = iTestModule->Version() );
+
+    if ( err != KErrNone ||  (( myOldAPIVersion.iMajor !=  moduleAPIVersion.iMajor ||
+                                myOldAPIVersion.iMinor !=  moduleAPIVersion.iMinor  )
+                                &&
+                              ( myAPIVersion.iMajor != moduleAPIVersion.iMajor ||
+                              	myAPIVersion.iMinor != moduleAPIVersion.iMinor ))
+        )
+        {
+        tmpBuffer = moduleAPIVersion.Name();
+        __TRACEI (KError, ( CStifLogger::EError, _L("Incorrect test module version. Module version %S"), &tmpBuffer ) );        
+        tmpBuffer = myOldAPIVersion.Name();
+        __TRACEI (KError, ( CStifLogger::EError, _L("Required version %S"), &tmpBuffer  ) );
+                
+        tmpBuffer.Format(_L("Invalid version in [%S]"), &moduleName );
+        ErrorPrint( 1, tmpBuffer );        
+
+         // Set error codes
+        ModuleContainer().OperationErrorResult() = KErrNotSupported;
+        return KErrNotSupported;
+        }
+
+   
+    ModuleContainer().OperationText() = _L("InitL");
+    // Initialize test module
+    TInt initResult = KErrNone;
+    TRAP ( err, 
+        CTestModuleIf::NewL( NULL, iTestModule );
+        TFileName tmp = ModuleContainer().TestModuleIniFile();
+        initResult = iTestModule->InitL( tmp, ModuleContainer().OperationIntBuffer() );
+    );
+
+    // Handle leave from test module
+    if ( err != KErrNone )
+        {
+        __TRACEI (KError, ( CStifLogger::EError, _L("Leave when initializing test module code %d"), err));
+        tmpBuffer = _L("Leave from test module InitL");        
+        ErrorPrint( 1, tmpBuffer );   
+        ModuleContainer().OperationText() = _L("DESTRUCTOR");
+        delete iTestModule;
+        iTestModule = NULL;
+        ModuleContainer().OperationText() = _L("");
+
+        // Set error codes
+        ModuleContainer().OperationErrorResult() = err;
+        return err;
+        }      
+    else if ( initResult != KErrNone ) 
+        {     // Handle failed initialisation of test module
+        __TRACEI (KError, ( CStifLogger::EError, _L("Can't initialize test module, code %d"), initResult));
+        ModuleContainer().OperationText() = _L("DESTRUCTOR");
+        delete iTestModule;
+        iTestModule = NULL;
+        ModuleContainer().OperationText() = _L("");
+        
+        // Set error code
+        ModuleContainer().ModuleResult() = initResult;
+        return initResult;
+        }
+    ModuleContainer().OperationText() = _L("");
+
+    __TRACEI (KInit, ( CStifLogger::EBold, _L("Test module initialization done")));     
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: EnumerateInThread
+
+    Description: Enumerate test cases. Function calls GetTestCases method
+    from the test module.
+
+    This function is a static member function, which is intented to be called
+    from the context of the test module thread.
+        
+    Parameters: None
+    
+    Return Values: TInt                           Error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::EnumerateInThread()
+    {
+
+    TInt err = KErrNone;
+    __TRACEI ( KInit, ( CStifLogger::EBold, _L("Calling GetTestCasesL") ) );
+
+    if ( iCases == NULL )
+        {
+        iCases = new RPointerArray<TTestCaseInfo>;
+        if ( iCases == NULL )
+            {
+            ModuleContainer().OperationErrorResult() = KErrNoMemory;
+            __TRACEI ( KError, ( _L("Can't create pointer array for cases") ) );
+            return ModuleContainer().OperationErrorResult();
+            }
+        }
+
+    // Thread ID logging(For error situations) !!!!! ----------
+    /*
+    RThread t;
+    RDebug::Print(_L("XXXXXXXXXXXXXXXXXXXXXX CurrentThread=[%d]"), t.Id() );
+    t.Open( t.Id() );   
+    RDebug::Print(_L("XXXXXXXXXXXXXXXXXXXXXX Real id=[%d]"), t.Id() );
+    t.Close();
+    */
+    // --------------------------------------------------------
+
+    ModuleContainer().OperationText() = _L("GetTestCasesL");
+    TRAPD (r, err = iTestModule->GetTestCasesL( 
+                        ModuleContainer().OperationName(),
+                        *iCases ) );
+    ModuleContainer().OperationText() = _L("");
+
+    // Leave
+    if ( r != KErrNone )
+        {
+        __TRACEI ( KError, ( CStifLogger::ERed, _L("GetTestCasesL leave code %d"), r ) );
+        TName tmpBuffer = _L("Leave from test module GetTestCasesL");        
+        ErrorPrint( 1, tmpBuffer );        
+        FreeEnumerationDataInThread();
+
+        ModuleContainer().OperationErrorResult() = r;
+        return r;
+        }
+        
+    // Error originating from test module
+    if ( err != KErrNone )
+        {
+        __TRACEI ( KError, ( CStifLogger::ERed, _L("GetTestCasesL returned error %d"), err ) );
+        FreeEnumerationDataInThread();
+
+        ModuleContainer().ModuleResult() = err;
+        return err;
+        }
+
+    __TRACEI ( KInit, ( _L("GetTestCasesL successfully called") ) );
+
+    // All ok.
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: FreeEnumerationDataInThread
+
+    Description: Frees the enumeration data. This function is called, when
+    the enumeration data is read from execution thread heap to server thread
+    heap. If cases have not been enumerated function does nothing.
+    
+    Function is intented to be called from the context of the test module thread.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::FreeEnumerationDataInThread()
+    {
+
+    __TRACEI ( KInit, ( _L("Freeing test case array") ) );
+
+    if ( iCases )
+        {
+        iCases->ResetAndDestroy();
+        delete iCases;
+        iCases = NULL;
+        }
+    
+    __TRACEI ( KInit, ( _L("Freeing test case array done") ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ExecuteTestCaseInThread
+
+    Description: Execute test case. This function calls either RunTestCase or 
+    ExecuteOOMTestCase to execute and report the results.
+
+    This function is a static member function, which is intented to be called
+    from the context of the test module thread.
+
+    Parameters: None
+
+    Return Values: TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::ExecuteTestCaseInThread()
+    {        
+    TVersion moduleAPIVersion;
+    moduleAPIVersion = iTestModule->Version(); 
+
+    __TRACEI ( KInit, 
+        ( CStifLogger::EBold, _L("Executing test case file=[%S] case=%d"), 
+            &ModuleContainer().OperationName(), 
+            ModuleContainer().OperationIntBuffer() ) );
+
+    TInt r = KErrNone;
+    
+    // Thread handle
+    RThread thisRt;
+    r = DuplicateMutexHandles( thisRt );
+       
+    // Result from RunTestCase       
+    TTestResult caseResult; 
+    
+    // Execution result from RunTestCase
+    TInt err = KErrNone;
+
+    // Fill in initial values
+    TestExecution().FullResult().iCaseExecutionResultType = 
+        TFullTestResult::ECaseExecuted;
+    TestExecution().FullResult().iCaseExecutionResultCode = KErrNone;            
+    TestExecution().FullResult().iStartTime.HomeTime();
+    TestExecution().TestThreadFailure() = CTestExecution::ETestThreadOk;
+
+    // Set handle to test execution
+    TRAP( r, CTestModuleIf::NewL( this,
+                                  iTestModule ) );
+
+    ModuleContainer().OperationText() =_L("RunTestCaseL");
+    
+    // Do resource checks before starting test case
+    iCheckResourceFlags = 0;        
+    
+    TInt tmp;
+    TInt threadHandleCountBeforeTest;
+
+    // Request count check
+    TInt requestCountBeforeTest = thisRt.RequestCount();
+    // Handle count check, not checking process handles
+    thisRt.HandleCount( tmp, threadHandleCountBeforeTest );
+
+    // If handle ok, then execute test          
+    if( r == KErrNone )
+        {       
+        TInt testCaseNumber = ModuleContainer().OperationIntBuffer();
+
+        // Do the test
+        __TRACEI ( KInit, ( _L("About to call RunTestCaseL. If nothing in log \
+            after line \"Calling RunTestCaseL\", check testserver log file.") ) );        
+                    
+        TInt firstMemFailure = 0; 
+        TInt lastMemFailure = 0;        
+        // Store the OOM test type
+        CTestModuleBase::TOOMFailureType failureType;
+                
+        // Check if the current test case is supposed to be run using OOM
+        if( iTestModule->OOMTestQueryL( ModuleContainer().OperationName(), 
+                                        testCaseNumber, 
+                                        failureType,
+                                        firstMemFailure, 
+                                        lastMemFailure ) )
+            {
+            //  Run the test case in OOM conditions      
+            r = ExecuteOOMTestCase( testCaseNumber, 
+                                    firstMemFailure, 
+                                    lastMemFailure, 
+                                    err, 
+                                    caseResult );
+            }
+        else
+            {
+            // Run the test case the old way, without OOM testing           
+            __TRACEI ( KInit, ( _L("Calling RunTestCaseL - \
+                OOM condition is not set") ) );
+            TRAP( r, err = iTestModule->RunTestCaseL( 
+                                            testCaseNumber,
+                                            ModuleContainer().OperationName(),
+                                            caseResult ) );
+            }
+        }        
+     
+    // Do resource checks after test case execution
+    // Handle count check
+    TInt threadHandleCountAfterTest;
+    thisRt.HandleCount( tmp, threadHandleCountAfterTest );
+    threadHandleCountAfterTest -= iTestModule->TestModuleIf().iNumberInGlbDict;
+    // Request count check
+    TInt requestCountAfterTest = thisRt.RequestCount();           
+          
+    ModuleContainer().OperationText() =_L("");
+
+    // Store end time
+    TestExecution().FullResult().iEndTime.HomeTime();   
+    // Remove handle to testexecution 
+    TRAPD( rr, CTestModuleIf::NewL( NULL, iTestModule ) );
+    
+
+    if ( rr != KErrNone )
+        {        
+        __TRACEI ( KError, ( _L("Memory low in executionthread.") ) );        
+        // Do not actually handle error
+        }
+  
+    // Report test result. Parts of this will be overwritten if error
+    // is detected
+    TestExecution().FullResult().iTestResult = caseResult;
+
+    // Get target exit reasons
+    CTestModuleIf::TExitReason allowedExitReason;
+    TInt allowedExitCode = KErrNone;
+    ExitReason( allowedExitReason, allowedExitCode );
+    
+    TBool returnLeakCheckFail = EFalse;
+
+    // Check are STIF macros used
+    if( iTestMacroInfo.iIndication ) 
+        {
+        // STIF macros are used. Set description info, test case to
+        // ECaseExecuted state and case execution result code to KErrNone
+        // to get test case to failed category.
+        TName tmpResultDes;
+        __TRACEI ( KError, ( CStifLogger::ERed, _L("Leave from RunTestCaseL(STIF TF's macro is used)" ) ) );
+        // Set result description
+        tmpResultDes.Copy( _L( "FILE[") );
+        tmpResultDes.Append( iTestMacroInfo.iFileDes );
+        tmpResultDes.Append( _L( "] FUNCTION[" ) );
+        tmpResultDes.Append( iTestMacroInfo.iFunctionDes );
+        tmpResultDes.Append( _L( "] LINE[" ) );
+        tmpResultDes.AppendNum( iTestMacroInfo.iLine );
+        tmpResultDes.Append( _L( "]" ) );
+        // Other result information
+        TestExecution().FullResult().iTestResult.iResult =
+                                            iTestMacroInfo.iReceivedError;
+        TestExecution().FullResult().iTestResult.iResultDes = tmpResultDes;
+        TestExecution().FullResult().iCaseExecutionResultType = 
+                                            TFullTestResult::ECaseExecuted;
+        // Set category to failed cases
+        TestExecution().FullResult().iCaseExecutionResultCode = KErrNone;
+        StifMacroErrorInit(); // Initialization back to default
+        }
+    else if( r != KErrNone )
+        {   // Case has left, overwrite normal result description string
+        __TRACEI ( KError, ( CStifLogger::ERed, _L("Leave from RunTestCaseL, code %d"), r ) );
+        // Set result description
+        TName tmpResultDes = _L("Leave during case:");
+        // Check if there was already some description passed to result object
+        if(caseResult.iResultDes.Length() > 0)
+            {
+            tmpResultDes.Format(_L("Leave during case [%S]:"), &caseResult.iResultDes);
+            if(tmpResultDes.Length() > KStifMaxResultDes)
+                {
+                tmpResultDes.SetLength(KStifMaxResultDes);
+                }
+            }
+        // Other result information
+        TestExecution().FullResult().iTestResult.iResult = KErrGeneral;
+        TestExecution().FullResult().iTestResult.iResultDes = tmpResultDes;
+        TestExecution().FullResult().iCaseExecutionResultType = 
+            TFullTestResult::ECaseLeave;
+        TestExecution().FullResult().iCaseExecutionResultCode = r;
+        }    
+    else if ( err != KErrNone )
+        {   
+        // Case has returned error (e.g. case not found )       
+        __TRACEI ( KError, ( CStifLogger::ERed, _L("RunTestCaseL returned error %d"), err ) ); 
+        TestExecution().FullResult().iCaseExecutionResultType = 
+            TFullTestResult::ECaseErrorFromModule;
+        TestExecution().FullResult().iCaseExecutionResultCode = err;
+        }
+    else if ( allowedExitReason != CTestModuleIf::ENormal )
+        {
+        // Test is failed, because it should end to panic or exception.
+        __TRACEI ( KInit, ( _L("Case ended normally even if it should end to panic/exception") ) ); 
+        TestExecution().FullResult().iTestResult.iResult = KErrGeneral;
+        TestExecution().FullResult().iTestResult.iResultDes = 
+            _L("Case did not ended to panic/exception");
+        }
+    // If test case is passed, check memory leak, handles etc...    
+    else if( caseResult.iResult == KErrNone )
+        {
+        returnLeakCheckFail = ETrue;
+        }
+   
+   // Test case leak checks
+    // In EKA2 heap size cannot be measured because THeapWalk is no longer supported    
+    LeakChecksForTestCase( returnLeakCheckFail, 
+                           threadHandleCountBeforeTest,
+                           threadHandleCountAfterTest,
+                           requestCountBeforeTest,
+                           requestCountAfterTest );
+
+    // Close execution specific handles
+
+    iPrintMutex.Close();
+    iEventMutex.Close();
+    iSndMutex.Close();
+    iRcvMutex.Close();
+    iInterferenceMutex.Close();
+    iMeasurementMutex.Close();
+    iCommandMutex.Close();
+    
+    // The Wait operation is performed to let the message from TestServer 
+    // to TestEngine achieve TestEngine or TestCombiner.   
+    iCommandSem.Wait();
+    
+    // Note: iTestThreadMutex.iClose() mutex will be used later, close in destructor.
+    
+    iPrintSem.Close();
+    iEventSem.Close();
+    iSndSem.Close();
+    iRcvSem.Close();
+    iInterferenceSem.Close();
+    iMeasurementSem.Close();
+    iCommandSem.Close();
+
+    // Close thread handle 
+    thisRt.Close();
+
+    __TRACEI ( KVerbose, ( _L("ExecuteTestCase out") ) );
+
+    // continues from CTestModuleContainer::RunL
+        
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: DuplicateMutexHandles
+
+    Description: Duplicates mutex handles
+
+    Parameters: None
+
+    Return Values: TInt
+
+    Errors/Exceptions: Panic if duplication fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::DuplicateMutexHandles( RThread& aThread )
+    {
+    // For duplicating mutexes
+    iPrintMutex.SetHandle( TestExecution().PrintMutexHandle() );
+    iEventMutex.SetHandle( TestExecution().EventMutexHandle() );
+    iSndMutex.SetHandle( TestExecution().SndMutexHandle() );
+    iRcvMutex.SetHandle( TestExecution().RcvMutexHandle() );
+    iInterferenceMutex.SetHandle( TestExecution().InterferenceMutexHandle() );
+    iMeasurementMutex.SetHandle( TestExecution().MeasurementMutexHandle() );
+    iCommandMutex.SetHandle(TestExecution().CommandMutexHandle());
+
+    // Mutex for testcomplete and cancel operations. For duplicating mutex
+    iTestThreadMutex.SetHandle( TestExecution().TestThreadMutexHandle() );
+
+    // For duplicating semaphores
+    iPrintSem.SetHandle( TestExecution().PrintSemHandle() );
+    iEventSem.SetHandle( TestExecution().EventSemHandle() );
+    iSndSem.SetHandle( TestExecution().SndSemHandle() );
+    iRcvSem.SetHandle( TestExecution().RcvSemHandle() );
+    iInterferenceSem.SetHandle( TestExecution().InterferenceSemHandle() );
+    iMeasurementSem.SetHandle( TestExecution().MeasurementSemHandle() );
+    iCommandSem.SetHandle(TestExecution().CommandSemHandle());
+    
+    // Store thread id for later use
+    TestExecution().SetTestThread( aThread.Id() );
+    
+    // Duplicate handles from server thread
+    TRAPD( r,
+        User::LeaveIfError( iPrintMutex.Duplicate( iServerThread ) );
+        User::LeaveIfError( iEventMutex.Duplicate( iServerThread ) );
+        User::LeaveIfError( iSndMutex.Duplicate( iServerThread ) );
+        User::LeaveIfError( iRcvMutex.Duplicate( iServerThread ) );
+        User::LeaveIfError( iInterferenceMutex.Duplicate( iServerThread ) );
+        User::LeaveIfError( iMeasurementMutex.Duplicate( iServerThread ) );
+        User::LeaveIfError( iCommandMutex.Duplicate( iServerThread ) );
+        
+        User::LeaveIfError( iTestThreadMutex.Duplicate( iServerThread ) );
+
+        User::LeaveIfError( iPrintSem.Duplicate( iServerThread ) );
+        User::LeaveIfError( iEventSem.Duplicate( iServerThread ) );
+        User::LeaveIfError( iSndSem.Duplicate( iServerThread ) );
+        User::LeaveIfError( iRcvSem.Duplicate( iServerThread ) );
+        User::LeaveIfError( iInterferenceSem.Duplicate( iServerThread ) );
+        User::LeaveIfError( iMeasurementSem.Duplicate( iServerThread ) );
+        User::LeaveIfError( iCommandSem.Duplicate( iServerThread ) );
+        );
+
+    // Raise panic if duplications failed        
+    if( r != KErrNone )
+        {
+        Panic( EDuplicateFail );
+        }
+    
+    // Return the result, no error occurred
+    return KErrNone;            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ExecuteOOMTestCase
+
+    Description: Executes OOM test case
+
+    Parameters: None
+
+    Return Values: TInt
+
+    Errors/Exceptions: Panic if EOOMDisableLeakChecks is not set and test case
+    leaks memory.                       
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::ExecuteOOMTestCase( TInt aTestCaseNumber,
+                                               TInt aFirst, 
+                                               TInt aLast, 
+                                               TInt& aResult, 
+                                               TTestResult& caseResult )
+    {
+    TBool OOMwarning = EFalse;  
+    __TRACEI ( KInit, ( _L("CTestThreadContainer::ExecuteOOMTestCase") ) );            
+    __TRACEI ( KInit, ( _L("Executing test case #%d using OOM"), aTestCaseNumber ) );               
+    
+    // OOM test environment initialization
+    TRAPD( r, iTestModule->OOMTestInitializeL( 
+                                ModuleContainer().OperationName(),
+                                aTestCaseNumber ); );               
+    
+    for( TInt i=aFirst; i<aLast; i++ )
+        {   
+        // Fail the i:nth heap allocation
+        User::__DbgSetAllocFail( RHeap::EUser, RHeap::EFailNext, i  );
+        
+        //__TRACEI ( KInit, ( _L("Setting %d:nth heap allocation to fail"), i  ) );             
+                
+        // Intersection of iCheckResourceFlags and 
+        // EDisableMemoryLeakChecksInOOM to check if memory leak checks are to 
+        // be used with OOM testing.        
+        if( !( iCheckResourceFlags & CTestModuleIf::EOOMDisableLeakChecks ) )
+            {
+            User::__DbgMarkStart( RHeap::EUser );
+            }
+            
+        TRAP( r, aResult = iTestModule->RunTestCaseL( 
+                        aTestCaseNumber,
+                        ModuleContainer().OperationName(),
+                        caseResult ) );
+        
+        // Raise panic if test case leaks memory and EOOMDisableLeakChecks is not
+        // set        
+        if( !( iCheckResourceFlags & CTestModuleIf::EOOMDisableLeakChecks ) )
+            {
+            User::__DbgMarkEnd( RHeap::EUser, 0 );
+            }
+        
+        // If no error occurred, fake a memory error to make sure that this is
+        // the last test. If this last allocation goes wrong, it proves that 
+        // either the FAILNEXT() macro has reached its limit or that somewhere
+        // in the code some object TRAPped the OOM exception and did not leave.     
+        if( ( r != KErrNoMemory ) && ( aResult != KErrNoMemory  )
+            && ( caseResult.iResult != KErrNoMemory ) )
+            {
+            TInt* dummy = new TInt;
+            OOMwarning = ( dummy != NULL );
+            delete dummy;
+            }
+
+        // Cancel the simulated heap allocation failure
+        User::__DbgSetAllocFail( RHeap::EUser, RHeap::ENone, 1 );
+    
+        if( ( r != KErrNoMemory ) && !OOMwarning && ( aResult != KErrNoMemory )
+            && ( caseResult.iResult != KErrNoMemory ) )
+            {
+            // If we get here test was executed properly (= no memory error
+            // and no warning)
+            break;
+            }
+
+        if( OOMwarning )
+            {            
+            // It is possible that during testing some components TRAP the OOM
+            // exception and continue to run (do not leave) or they return an 
+            // error other than KErrNoMemory. These situations are making the
+            // OOM testing really difficult, so they should be detected and 
+            // make the tester aware.
+             
+            // Since each test case might have a specific oppinion on handling
+            // this situation, it is left up to the tester to handle it by 
+            // implementing the OOMHandleWarningL method. STIF will log a
+            // warning and call OOMHandleWarningL method.
+
+            // Print the OOM error message
+            __TRACEI ( KInit, ( _L("Possible trapped or non-leaving allocation in test case #%d"), i  ) );                          
+
+            iTestModule->OOMHandleWarningL( ModuleContainer().OperationName(), aTestCaseNumber, i );
+
+            // Clear the warning flag
+            OOMwarning = EFalse;
+            }
+        }
+        
+    // OOM test environment finalization                    
+    __TRACEI ( KInit, ( _L("Calling OOMTestFinalizeL") ) ); 
+    TRAPD( fres, iTestModule->OOMTestFinalizeL( 
+                                    ModuleContainer().OperationName(), 
+                                    aTestCaseNumber ); );
+    // Check the result
+    if( fres != KErrNone )
+        {
+        __TRACEI ( KInit, ( _L("OOMTestFinalizeL execution failed with error %d"), fres ) );                            
+        }
+                
+    return r;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: LeakChecksForTestCase
+
+    Description: Checks test case for memory, handle and request leaks
+
+    Parameters: None    
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::LeakChecksForTestCase( TBool aReturnLeakCheckFail,
+                                                  TInt aThreadHandleCountBeforeTest,
+                                                  TInt aThreadHandleCountAfterTest,
+                                                  TInt aRequestCountBeforeTest, 
+                                                  TInt aRequestCountAfterTest )
+                                                
+    {      
+    __TRACEI ( KInit, ( _L("CTestThreadContainer::LeakChecksForTestCase") ) );                          
+
+    // Note: Request leaks detection is disabled in UI components testing
+    if( !( iCheckResourceFlags & CTestModuleIf::ETestLeaksRequests ) && 
+             ( aRequestCountBeforeTest != aRequestCountAfterTest ) &&
+             ( !( iModuleContainer->GetTestModule()->GetTestServer()->IsUiTestingSupported() 
+                     && iModuleContainer->GetTestModule()->UiTesting() )))
+        {
+        // Test is failed, because it should end to panic or exception.
+        __TRACEI ( KError, ( CStifLogger::ERed, 
+            _L("Asynchronous request leak from test module. Request count before:[%d] and after:[%d] test."),
+            aRequestCountBeforeTest, aRequestCountAfterTest ) );
+            
+        // Set failure status    
+        TestExecution().TestThreadFailure() |= CTestExecution::ETestRequestLeak;
+        if( aReturnLeakCheckFail )
+            {
+            aReturnLeakCheckFail = EFalse;   // return first fail   
+#ifndef STIF_DISABLE_LEAK_CHECK 
+            // Testcase set to failed when request leak occurred
+            TestExecution().FullResult().iTestResult.iResult = KErrGeneral;
+#endif
+            TestExecution().FullResult().iTestResult.iResultDes = 
+                _L("Asynchronous request leak from testmodule");
+            TestExecution().FullResult().iTestResult.iResultDes.
+                AppendNum( aRequestCountAfterTest );
+            }
+        }
+    // Note: Handle leaks detection is disabled in UI components testing
+    if( !( iCheckResourceFlags & CTestModuleIf::ETestLeaksHandles ) && 
+             ( aThreadHandleCountBeforeTest != aThreadHandleCountAfterTest ) &&
+             ( !( iModuleContainer->GetTestModule()->GetTestServer()->IsUiTestingSupported() 
+                     && iModuleContainer->GetTestModule()->UiTesting() )) )
+        {
+        // Test is failed, because it should end to panic or exception.
+        __TRACEI ( KError, ( CStifLogger::ERed, 
+            _L("Thread handle leak from test module. Handle count before:[%d] and after:[%d] test."),
+            aThreadHandleCountBeforeTest, aThreadHandleCountAfterTest ) ); 
+            
+        // Set failure status
+        TestExecution().TestThreadFailure() |= CTestExecution::ETestHandleLeak;    
+        if( aReturnLeakCheckFail )
+            {
+            aReturnLeakCheckFail = EFalse;   // return first fail   
+#ifndef STIF_DISABLE_LEAK_CHECK 
+            // Testcase is set to failed yet when handle leak occurred
+            TestExecution().FullResult().iTestResult.iResult = KErrGeneral;
+#endif
+            TestExecution().FullResult().iTestResult.iResultDes = 
+                _L("Thread handle leak from testmodule");
+            TestExecution().FullResult().iTestResult.iResultDes.
+                AppendNum( aRequestCountAfterTest );
+            }
+        }       
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: DeleteTestModule
+
+    Description: Deletes a test module
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::DeleteTestModule()
+    {
+
+    __TRACEI ( KInit, ( _L("Deleting test module instance at 0x%x"), iTestModule ) );
+    // Delete the test module
+    ModuleContainer().OperationText() = _L("DESTRUCTOR");
+    TRAPD( r, delete iTestModule );
+    ModuleContainer().OperationText() = _L("");
+    iTestModule = NULL;
+
+    if ( r )
+        {
+        __TRACEI ( KError, ( _L("Leave when deleting test module, code %d"), r ) );
+        }
+
+    __TRACEI ( KInit, ( _L("Test module instance deleted") ) );
+
+    }
+    
+    /*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: TestCases
+
+    Description: Returns constant pointer to test case array
+
+    Parameters: None
+    
+    Return Values: const RPointerArray<TTestCaseInfo>*  Test cases
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+const RPointerArray<TTestCaseInfo>* CTestThreadContainer::TestCases() const
+    {
+    
+    return iCases;
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ErrorPrint
+
+    Description: Prints error
+
+    Parameters: const TInt aPriority :in: Priority
+                TPtrC aError: in: Error
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::ErrorPrint( const TInt aPriority, 
+                                       TPtrC aError )
+    {
+    
+    // Get access to print stuff
+    iErrorPrintSem.Wait();
+    
+    // Get status variable from server
+    TRequestStatus* status = 
+        ModuleContainer().GetRequest( CTestModuleContainer::ERqErrorPrint );
+    
+    if( status == NULL )
+        {
+        Panic( ENullRequest );
+        return;
+        }
+    
+    // Fill in progress
+    TErrorNotification& progress = ModuleContainer().ErrorNotification();
+    progress.iPriority = aPriority;
+    progress.iText = aError;
+    
+    // Complete action to server
+    iServerThread.RequestComplete( status, KErrNone );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: DoNotifyPrint
+
+    Description: If print notification available, notification is copied to
+                    client memory space and request is completed.
+                 Else new print queue item is created and appended to print 
+                    queue. If queue is full or memory can't be allocated,
+                    then message will be discarded.
+        
+    Parameters: const TInt aPriority  :       :in:  Priority
+                const TStifInfoName& aDes         :in:  Description
+                const TName& aBuffer          :in:  Value
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::DoNotifyPrint( const TInt aPriority,
+                                    const TStifInfoName& aDes,
+                                    const TName& aBuffer )
+    {    
+    // Get access to print stuff
+    iPrintSem.Wait();
+    
+    iPrintMutex.Wait(); // Take mutex to get access to server thread.
+                        // Between Wait and Signal is critical section and this
+                        // verifies that iPrintSem and RequestComplete is done
+                        // successfully.
+    
+    // Get status variable from server
+    TRequestStatus* status = 
+        TestExecution().GetRq( CTestExecution::ERqPrint );
+    
+    if( status == NULL )
+        {
+        iPrintMutex.Signal();
+        Panic( ENullRequest );
+        return;
+        }
+
+    if( *status != KRequestPending )
+        {
+        // CPrintHandler::DoCancel called before getting here, just return
+        iPrintMutex.Signal();
+        return;    
+        }
+    // Fill in progress
+    TTestProgress& progress = TestExecution().TestProgress();
+    progress.iPosition = aPriority;
+    progress.iDescription = aDes;
+    progress.iText = aBuffer;
+    
+    // Complete action to server
+    iServerThread.RequestComplete( status, KErrNone );
+
+    iPrintMutex.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: DoNotifyEvent
+
+    Description: Forward event request.
+        
+    Parameters: const TEventIf: in: Event definition
+                TRequestStatus* aStatus: in: TRequestStatus to complete 
+    
+    Return Values: None
+
+    Errors/Exceptions: Panics if event array can't be created
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::DoNotifyEvent( TEventIf& aEvent, 
+                                          TRequestStatus* aStatus )
+    {
+    RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() aStatus=[%x]"), aStatus);
+
+    REventSystem es;
+    TInt ret = KErrNone;
+
+    // Handle all events right here (except for asynchronous wait, which
+    // must be handled on server side.
+    // Asynchronous wait    
+    if(aEvent.Type() == TEventIf::EWaitEvent && aStatus)
+        {
+        RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() handling asynchronous wait"));
+        SetEventReq(TEventDef::EEventCmd, aEvent, aStatus);
+        //return KErrNotSupported; // to be forwarded to Server and handled there
+        }
+    // Synchronous wait
+    else if(aEvent.Type() == TEventIf::EWaitEvent)
+        {
+        RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() handling wait event"));
+        TRAP(ret, es.WaitEventL(aEvent.Name(), reinterpret_cast<TInt>(iModuleContainer->TestExecution())));
+        }
+    // Set indication
+    else if(aEvent.Type() == TEventIf::ESetEvent && aEvent.EventType() == TEventIf::EIndication)
+        {
+        RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() handling set indication event"));
+        TRAP(ret, es.SetIndicationEventL(aEvent.Name(), aStatus));
+        }
+    // Set state
+    else if(aEvent.Type() == TEventIf::ESetEvent && aEvent.EventType() == TEventIf::EState)
+        {
+        RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() handling set state event"));
+        TRAP(ret, es.SetEventL(aEvent.Name(), aStatus));
+        }
+    // Unset state
+    else if(aEvent.Type() == TEventIf::EUnsetEvent)
+        {
+        RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() handling unset event"));
+        TRAP(ret, es.UnsetEventL(aEvent.Name(), aStatus));
+        }
+    // Request
+    else if(aEvent.Type() == TEventIf::EReqEvent)
+        {
+        RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() handling request event"));
+        TRAP(ret, es.RequestEventL(aEvent.Name(), reinterpret_cast<TInt>(iModuleContainer->TestExecution())));
+        }
+    // Release
+    else if(aEvent.Type() == TEventIf::ERelEvent)
+        {
+        RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() handling release event"));
+        TRAP(ret, es.ReleaseEventL(aEvent.Name(), reinterpret_cast<TInt>(iModuleContainer->TestExecution())));
+        }
+    // Unknown
+    else
+        {
+        RDebug::Print(_L("STF [ES]: CTestThreadContainer::DoNotifyEvent() Unknown event type [%d] [%d]"), aEvent.Type(), aEvent.EventType());
+        ret = KErrNotSupported;
+        }
+
+    return ret;
+    
+    /* - old implementation    
+    TInt ret = KErrNone;
+    
+    // Send event req
+    SetEventReq( TEventDef::EEventCmd, aEvent, aStatus );
+    
+    if( aStatus == NULL )
+        {
+        // Synchronous Event command used ->
+        // Block until completed with ECmdComplete from NotifyEvent
+        // Cannot be done before ERelEvent, 
+        // because Unset may be blocking the server  
+        User::WaitForRequest( iReqStatus ); 
+        
+        User::After( 1 );// workaround found for STIF 347 
+        
+        // Return result from engine 
+        ret = iReqStatus.Int();
+        
+        }    
+    
+    return ret;
+    */
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: CancelEvent
+
+    Description: Cancels pending event request.
+        
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::CancelEvent( TEventIf& aEvent, 
+                                        TRequestStatus* aStatus )
+    {
+    RDebug::Print(_L("STF [ES]: CTestThreadContainer::CancelEvent()"));
+
+    __TRACEI( KMessage, ( _L( "CTestThreadContainer::CancelEvent(%d): %S [%p]" ), 
+            aEvent.Type(), &aEvent.Name(), aStatus ) );
+            
+    // Send event req
+    SetEventReq( TEventDef::EEventCmdCancel, aEvent, aStatus );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: SetExitReason
+
+    Description: Set exit reason
+        
+    Parameters: const TExitReason aExitReason in: Exit reason
+                const TInt aExitCode in: Exit code
+
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::SetExitReason( const CTestModuleIf::TExitReason aExitReason, 
+                                    const TInt aExitCode )
+    {
+    
+    TInt exitCode = aExitCode;
+    
+    if( ( aExitReason == CTestModuleIf::ENormal ) &&
+        ( aExitCode != KErrNone ) )
+        {
+        __TRACEI( KError, 
+            ( _L( "SetExitReason: Exit type normal uses always exit code 0 (given %d is not used)" ), 
+                exitCode ) );
+        exitCode = KErrNone;
+        }
+
+    ModuleContainer().AllowedExitReason() = aExitReason;
+    ModuleContainer().AllowedExitCode() = exitCode;              
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: SetBehavior
+
+    Description: Set test behaviour.
+        
+    Parameters:  const CTestModuleIf::TTestBehavior aType: in: behaviour type 
+                 TAny* aPtr: in: data
+
+    Return Values: Symbian OS error code.
+    
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::SetBehavior( const CTestModuleIf::TTestBehavior aType, 
+                                        TAny* /*aPtr*/ )
+    {
+    
+    if( aType & CTestModuleIf::ETestLeaksMem )
+        {
+        iCheckResourceFlags |= CTestModuleIf::ETestLeaksMem;
+        }
+    if( aType & CTestModuleIf::ETestLeaksRequests )
+        {
+        iCheckResourceFlags |= CTestModuleIf::ETestLeaksRequests;
+        } 
+    if( aType & CTestModuleIf::ETestLeaksHandles )
+        {
+        iCheckResourceFlags |= CTestModuleIf::ETestLeaksHandles;
+        }
+    // For OOM testing
+    if( aType & CTestModuleIf::EOOMDisableLeakChecks )
+        {
+        iCheckResourceFlags |= CTestModuleIf::EOOMDisableLeakChecks;
+        }                
+    if( !( aType & iCheckResourceFlags ) )
+        {
+        return KErrNotFound;
+        }
+        
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ExitReason
+
+    Description: Gets exit reason
+        
+    Parameters: TExitReason& aExitReason out: Exit reason
+                TInt& aExitCode out: Exit code
+
+    Return Values: None
+    
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::ExitReason( CTestModuleIf::TExitReason& aExitReason, 
+                                   TInt& aExitCode )
+    {
+
+    aExitReason = ModuleContainer().AllowedExitReason();
+    aExitCode = ModuleContainer().AllowedExitCode();
+          
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: SetEventReq 
+
+    Description: Sets asynchronous event request.
+        
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::SetEventReq( TEventDef::TEventCmdType aType, 
+                                        TEventIf& aEvent, 
+                                        TRequestStatus* aStatus )
+    {
+    RDebug::Print(_L("STF [ES]: CTestThreadContainer::SetEventReq()"));
+    // Get access to event stuff
+    iEventSem.Wait();
+
+    iEventMutex.Wait(); // Take mutex to get access to server thread.
+                        // Between Wait and Signal is critical section and this
+                        // verifies that iPrintSem and RequestComplete is done
+                        // successfully.
+    
+    // Get status variable from server
+    TRequestStatus* status = 
+        TestExecution().GetRq( CTestExecution::ERqEvent );
+    
+    if( status == NULL )
+        {
+        iEventMutex.Signal();
+        Panic( ENullRequest );
+        return;
+        }
+    if( *status != KRequestPending )
+        {
+        // CEventHandler::DoCancel called before getting here, just return
+        iEventMutex.Signal();
+        return;    
+        }
+    
+    // Fill in event on server thread
+    TEventDef& event = TestExecution().EventDef();
+    event.iType = aType;
+    event.iEvent.Copy( aEvent );
+
+    if( aStatus )
+        {
+        // Store TRequestStatus which is completed when next EEnable comes in
+        event.iStatus = aStatus;
+        } 
+    else
+        {
+        iReqStatus = KRequestPending;
+        event.iStatus = &iReqStatus;
+        }   
+
+    __TRACEI( KMessage ,(_L("SetReq Stat %d, %x"), this, aStatus ));
+    
+    // Complete action to server
+    iServerThread.RequestComplete( status, KErrNone );
+    
+    iEventMutex.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: DoRemoteReceive
+
+    Description: Enable remote receive and send.
+    
+    Parameters: 
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::DoRemoteReceive( TStifCommand aRemoteCommand,
+                                            TParams aParams,
+                                            TInt aLen,
+                                            TRequestStatus& aStatus )
+    {    
+    
+    switch( aRemoteCommand )
+        {
+        case EStifCmdSend:             // "Send"
+        case EStifCmdReboot:           // "Send"
+        case EStifCmdStoreState:       // "Send"
+        case EStifCmdGetStoredState:   // "Receive, this must be done with two phase"
+        case EStifCmdMeasurement:      // "Receive"
+            {
+            __TRACEI( KMessage, ( _L( "CTestThreadContainer::DoRemoteReceive Wait SndSem" ) ) );
+            
+            // Get access to sender 
+            // (for receive, used for securing access to shared memory)
+            iSndSem.Wait();
+
+            iSndMutex.Wait();   // Take mutex to get access to server thread.
+                                // Between Wait and Signal is critical section and this
+                                // verifies that iPrintSem and RequestComplete is done
+                                // successfully.
+
+            // Get status variable from server
+            TRequestStatus* status = 
+                TestExecution().GetRq( CTestExecution::ERqSnd );
+
+            if( status == NULL )
+                {
+                iSndMutex.Signal();
+                Panic( ENullRequest );
+                return;
+                }
+            if( *status != KRequestPending )
+                {
+                // CSndHandler::DoCancel called before getting here, just return
+                iSndMutex.Signal();
+                return;    
+                }                
+
+            // Fill in information
+            TCmdDef& aDef = TestExecution().SndInfo();
+            aDef.iCommand = aRemoteCommand;
+            aDef.iParam = aParams;
+            aDef.iLen = aLen;
+            aDef.iStatus = &aStatus;
+            
+            __TRACEI( KMessage ,
+                (_L("CTestThreadContainer::DoRemoteReceive Complete request 0x%x"),
+                    status ));
+            // Complete action to server
+            iServerThread.RequestComplete( status, KErrNone );  
+
+            iSndMutex.Signal();
+            }
+            break;
+        case EStifCmdReceive:          // "Receive"
+             {
+            __TRACEI( KMessage, ( _L( "CTestThreadContainer::DoRemoteReceive Wait RcvSem" ) ) );
+
+            // Get access to receive handler 
+            iRcvSem.Wait();
+
+            iRcvMutex.Wait();   // Take mutex to get access to server thread.
+                                // Between Wait and Signal is critical section and this
+                                // verifies that iPrintSem and RequestComplete is done
+                                // successfully.
+
+            // Get status variable from server
+            TRequestStatus* status = 
+                TestExecution().GetRq( CTestExecution::ERqRcv );
+
+            if( status == NULL )
+                {
+                iRcvMutex.Signal();
+                Panic( ENullRequest );
+                return;
+                }
+            if( *status != KRequestPending )
+                {
+                // CRcvHandler::DoCancel called before getting here, just return
+                iRcvMutex.Signal();
+                return;    
+                }                
+
+            // Fill in information
+            TCmdDef& aDef = TestExecution().RcvInfo();
+            aDef.iCommand = aRemoteCommand;
+            aDef.iParam = aParams;
+            aDef.iLen = aLen;
+            aDef.iStatus = &aStatus;
+            
+            __TRACEI( KMessage ,
+                (_L("CTestThreadContainer::DoRemoteReceive Complete request 0x%x"),
+                    status ));
+            __TRACEI( KMessage, ( _L( "CTestThreadContainer::DoRemoteReceive signal RcvSem" ) ) );
+            //iReceiverSem.Signal();
+
+            // Complete action to server
+            iServerThread.RequestComplete( status, KErrNone );  
+
+            iRcvMutex.Signal();
+            
+            }
+            break;
+
+        default:
+            TRequestStatus* rs = &aStatus;
+            User::RequestComplete( rs, KErrNotSupported );
+            break;
+        }
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: DoRemoteReceiveCancel
+
+    Description: Cancel DoRemoteReceive
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::DoRemoteReceiveCancel()
+    {   
+           
+    // Get access to receive handler
+    iRcvSem.Wait();
+
+    iRcvMutex.Wait();   // Take mutex to get access to server thread.
+                        // Between Wait and Signal is critical section and this
+                        // verifies that iPrintSem and RequestComplete is done
+                        // successfully. 
+
+    // Get status variable from server
+    TRequestStatus* status = 
+        TestExecution().GetRq( CTestExecution::ERqRcv );
+
+    if( status == NULL )
+        {
+        iRcvMutex.Signal();
+        return KErrNotFound;
+        }
+        
+    if( *status != KRequestPending )
+        {
+        // CRcvHandler::DoCancel called before getting here, just return
+        iRcvMutex.Signal();
+        Panic( ENullRequest );
+        return KErrNone;    
+        }        
+
+    // Fill in information
+    TCmdDef& aDef = TestExecution().RcvInfo();
+    aDef.iCommand = EStifCmdReceiveCancel;
+    // Complete action to server
+    iServerThread.RequestComplete( status, KErrNone );  
+    
+    iRcvMutex.Signal();
+
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: TestComplete
+
+    Description: Complete test operation: Get test case, run test case,
+                 complete test case, etc.
+        
+    Parameters: TInt aCompletionCode: in: completion code.
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::TestComplete( TInt aCompletionCode )
+    {    
+    
+    // Get status variable from server
+    TRequestStatus* status = 
+        ModuleContainer().GetRequest( CTestModuleContainer::ERqTestCase );
+    
+    if( status == NULL )
+        {
+        Panic( ENullRequest );
+        return;
+        }
+        
+    // Complete action to server
+    if( iTestThreadMutex.Handle() == 0 )
+        {
+        // Actual test case is not started yet. Inititialization phase is ongoing.
+        // Before the completion check if the status was not already completed
+        // from other thread in CTestModuleContainer::DoCancel().
+        // For details see Jira STIF-564
+        if(*status == KRequestPending)
+            iServerThread.RequestComplete( status, aCompletionCode );
+        }
+    else
+        {
+        // Test case execution is started. Test is ongoing.
+        // Before the completion check if the status was not already completed
+        // from other thread in CTestModuleContainer::DoCancel().
+        // For details see Jira STIF-564
+        if(*status == KRequestPending)
+            {
+            iTestThreadMutex.Wait(); // Block that complete and cancel do not
+                                     // executed at the same time.
+            iServerThread.RequestComplete( status, aCompletionCode );
+            iTestThreadMutex.Signal();
+            }            
+        }
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: UIExecutionThread
+
+    Description: This is the test module execution thread "main" function".
+    All test module function calls are executed in context of this execution
+    thread.
+
+    When the thread is resumed first time, function goes to wait a semaphore.
+    Operations are initiated by setting operation and signaling the semaphore.
+    If operation is synchronous, then end of operation is signaled by using
+    OperationCompleted -Semaphore. When operation is done, function (and thread)
+    are going to wait OperationSemaphore.
+
+    Function exist either when operation does fatal error, or operation type
+    is "Exit". The thread function exist from it's main loop and the thread
+    will be terminated.
+
+    Parameters: TAny* aParams:                :in:  Pointer to CTestModuleContainer
+    
+    Return Values: TInt                        KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::UIExecutionThread( TAny* aParams )
+	{
+	
+    CTestModuleContainer* moduleContainer = 
+    	(CTestModuleContainer*) aParams;
+    
+    CTestModule* module = moduleContainer->GetTestModule();
+    CTestServer* testServer = module->GetTestServer();
+    CTestThreadContainerRunnerFactory* factory = testServer->GetTestThreadContainerRunnerFactory();    
+    
+    RThread server;
+    // Duplicate handles from server thread
+    TInt ret = server.Open( moduleContainer->ServerThreadId() );
+    if( ret != KErrNone )
+    	{
+    	Panic( EThreadHandleOpenFail );
+    	}
+    RSemaphore OperationStartSemaphore;
+    OperationStartSemaphore.SetHandle( 
+    		moduleContainer->OperationStartSemHandle() );
+    if( OperationStartSemaphore.Duplicate( server ) != KErrNone )
+        {
+        Panic( EDuplicateFail );
+        }        
+    RSemaphore OperationChangeSemaphore;
+    OperationChangeSemaphore.SetHandle( 
+    		moduleContainer->OperationChangeSemHandle() );
+    if( OperationChangeSemaphore.Duplicate( server ) != KErrNone )
+        {
+        Panic( EDuplicateFail );
+        }
+    server.Close();
+    
+    CTestThreadContainerRunner* runner = factory->CreateL();
+    
+    runner->Setup( moduleContainer );
+    
+    while ( runner->IsReusable() )
+        {
+        // Thread is going to suspend        
+        runner->CheckSignalFromSuspend();
+        
+        // Wait next operation
+        OperationStartSemaphore.Wait();
+
+        // Get operation semaphore
+        OperationChangeSemaphore.Wait();    
+    
+        // Run and wait active object
+        runner->RunOneIteration();
+        
+        OperationChangeSemaphore.Signal();        
+        }
+        
+    OperationStartSemaphore.Close();
+    OperationChangeSemaphore.Close();        
+        
+    runner->TeareDown();
+    
+    runner->Deque();
+    
+    factory->DeleteL( runner );    
+    
+    return KErrNone;    
+	}
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ExecutionThread
+
+    Description: This is the test module execution thread "main" function".
+    All test module function calls are executed in context of this execution
+    thread.
+
+    When the thread is resumed first time, function goes to wait a semaphore.
+    Operations are initiated by setting operation and signaling the semaphore.
+    If operation is synchronous, then end of operation is signaled by using
+    OperationCompleted -Semaphore. When operation is done, function (and thread)
+    are going to wait OperationSemaphore.
+
+    Function exist either when operation does fatal error, or operation type
+    is "Exit". The thread function exist from it's main loop and the thread
+    will be terminated.
+
+    Parameters: TAny* aParams:                :in:  Pointer to CTestModuleContainer
+    
+    Return Values: TInt                        KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::ExecutionThread( TAny* aParams )
+    {
+    TInt error( KErrNone );
+    
+    const TUint32 KAll = 0xFFFFFFFF;
+#ifndef __HIDE_IPC_V1__ // e.g. 7.0s, 8.0a
+    RThread currentThread;
+    currentThread.SetExceptionHandler( ExceptionHandler, KAll );
+#else // PlatSec used. Thread exception management is part of the User class.
+    User::SetExceptionHandler( ExceptionHandler, KAll );
+#endif // __HIDE_IPC_V1__
+
+     // Check parameters
+    __ASSERT_ALWAYS( aParams, Panic( EInvalidCTestThreadContainer ) );
+
+    CTestModuleContainer* moduleContainer = 
+        (CTestModuleContainer*) aParams;
+       
+    // Create cleanup stack
+    CTrapCleanup* tc = CTrapCleanup::New();
+    __ASSERT_ALWAYS( tc, Panic( ECreateTrapCleanup ) );
+
+    CTestThreadContainer* exec = NULL;    
+    TRAPD( err,
+        exec = CTestThreadContainer::NewL( moduleContainer, 
+                                           moduleContainer->ServerThreadId() );
+        );    
+    if( err != KErrNone )
+        {
+        Panic( ENullTestThreadContainer );
+        }
+
+    // Construct the logger
+    TName path = _L("C:\\logs\\testframework\\testserver\\");
+    TFileName name = _L("testserver_thread_");  
+    name.Append( moduleContainer->TestModuleName() );
+
+    // Create logger, in Wins use HTML in HW default logger
+    TLoggerSettings loggerSettings;
+
+    // Directory must create by hand if test server log wanted
+    loggerSettings.iCreateLogDirectories = EFalse;
+
+    loggerSettings.iOverwrite = ETrue;
+    loggerSettings.iTimeStamp = ETrue;
+    loggerSettings.iLineBreak = ETrue;
+    loggerSettings.iEventRanking = EFalse;
+    loggerSettings.iThreadId = EFalse;
+    loggerSettings.iHardwareFormat = CStifLogger::ETxt;
+#ifndef FORCE_STIF_INTERNAL_LOGGING_TO_RDEBUG
+    loggerSettings.iEmulatorFormat = CStifLogger::EHtml;
+    loggerSettings.iHardwareOutput = CStifLogger::EFile;
+    loggerSettings.iEmulatorOutput = CStifLogger::EFile;
+#else
+    RDebug::Print( _L( "STIF Test Server's thread logging forced to RDebug" ) );
+    loggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+    loggerSettings.iHardwareOutput = CStifLogger::ERDebug;
+    loggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
+#endif
+    loggerSettings.iUnicode = EFalse;
+    loggerSettings.iAddTestCaseTitle = EFalse;
+
+    TRAP ( error, exec->iThreadLogger = CStifLogger::NewL( path, name,
+                                                            loggerSettings ) );
+
+    RLibrary module;                    // Handle to test module library
+    TBool reusable = ETrue;             // Is test module reusable?
+    TBool initialized = EFalse;         // Is module initialized?
+    TBool signalFromSuspend = EFalse;   // Send signal from suspend state?
+
+    RThread server;
+    // Duplicate handles from server thread
+    TInt ret = server.Open( moduleContainer->ServerThreadId() );
+    if( ret != KErrNone )
+    	{
+    	Panic( EThreadHandleOpenFail );
+    	}
+    RSemaphore OperationStartSemaphore;
+    OperationStartSemaphore.SetHandle( 
+        exec->ModuleContainer().OperationStartSemHandle() );
+    if( OperationStartSemaphore.Duplicate( server ) != KErrNone )
+        {
+        Panic( EDuplicateFail );
+        }        
+    RSemaphore OperationChangeSemaphore;
+    OperationChangeSemaphore.SetHandle( 
+        exec->ModuleContainer().OperationChangeSemHandle() );
+    if( OperationChangeSemaphore.Duplicate( server ) != KErrNone )
+        {
+        Panic( EDuplicateFail );
+        }
+    server.Close();
+   
+    
+    ret = KErrNone;
+
+    // The test module thread will stay in this loop until it either
+    // dies or is exited nicely.
+    while ( reusable )
+        {
+        // Thread is going to suspend
+        
+        if ( signalFromSuspend )
+            {
+            signalFromSuspend = EFalse;
+            exec->TestComplete( ret );
+            }
+        ret = KErrNone;
+        
+        // Wait next operation
+        OperationStartSemaphore.Wait();
+
+        // Get operation semaphore
+        OperationChangeSemaphore.Wait();
+        switch ( moduleContainer->OperationType() )
+            {
+
+            // Test module initialisation
+            case CTestModuleContainer::EInitializeModule:
+                {
+                __ASSERT_ALWAYS ( !initialized,
+                                  Panic( EReInitializingTestModule ) );
+
+                // Initialize module
+                if ( exec->InitializeModuleInThread( module ) == KErrNone )
+                    {
+                    initialized = ETrue;
+                    }
+
+                signalFromSuspend = ETrue;
+                break;
+                }
+
+            // Test case enumeration
+            case CTestModuleContainer::EEnumerateInThread:
+                {
+                __ASSERT_ALWAYS ( initialized,
+                                  Panic( ETestModuleNotInitialized ) );
+                ret = exec->EnumerateInThread();
+
+                signalFromSuspend = ETrue;
+                break;
+                }
+
+            // Free test case enumeration data
+            case CTestModuleContainer::EFreeEnumerationData:
+                {
+                __ASSERT_ALWAYS ( initialized,
+                                  Panic( ETestModuleNotInitialized ) );
+                exec->FreeEnumerationDataInThread ();
+                
+                signalFromSuspend = ETrue;
+                break;
+                }
+
+            // Execute test case
+            case CTestModuleContainer::EExecuteTestInThread:
+                {
+                __ASSERT_ALWAYS ( initialized,
+                                  Panic( ETestModuleNotInitialized ) );
+                ret = exec->ExecuteTestCaseInThread ();
+
+                signalFromSuspend = ETrue;
+                break;
+                }
+
+            // Exiting (i.e test server is unloading)
+            case CTestModuleContainer::EExit:
+                {
+                reusable = EFalse;
+                break;
+                }
+
+            // Illegal state
+            default:
+                {
+                Panic( EInvalidTestModuleOperation );
+                }
+            }
+            OperationChangeSemaphore.Signal();
+        
+        }
+        
+    OperationStartSemaphore.Close();
+    OperationChangeSemaphore.Close();
+
+    exec->DeleteTestModule();
+
+    // Close handle to module. No function calls to test
+    // module are possible after this line.
+    module.Close();
+
+    // Delete logger    
+    delete exec->iThreadLogger;
+    exec->iThreadLogger = NULL;
+
+    // Delete clean-up stack.
+    delete tc;
+    tc = NULL;
+
+    // Operation completed ( = Exit completed )
+    exec->TestComplete( KErrNone );
+    
+    delete exec;
+    
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: Panic
+
+    Description: Panicing function for test thread.
+
+    Parameters: TPanicReason aReason: in: Reason code
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::Panic( TPanicReason aReason )
+    {
+    
+    RDebug::Print( _L("CTestThreadContainer::Panic %d"), aReason );
+    
+    User::Panic( _L("CTestThreadContainer::Panic"), aReason );
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ServerAlive
+
+    Description: Check that server is alive.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: Panics thread if server has died.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::IsServerAlive()
+    {
+        
+    if( iServerThread.ExitType() != EExitPending ) 
+        {
+        // Server thread has died
+        __RDEBUG( ( _L( "Server died" ) ) );
+        Panic( EServerDied );
+        }
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: TestExecution
+
+    Description: Return CTestExecution handle to "parent" i.e. server.
+
+    Parameters: None
+    
+    Return Values: CTestExecution&
+
+    Errors/Exceptions: Panics thread if server has died.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestExecution& CTestThreadContainer::TestExecution()
+    { 
+    
+    IsServerAlive();
+    CTestExecution* execution = iModuleContainer->TestExecution();
+    if( execution == NULL )
+        {
+        Panic( ENullExecution );
+        }
+    return *execution;
+    
+    };
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: TestExecution
+
+    Description: Return CTestExecution handle to "parent" i.e. server.
+
+    Parameters: None
+    
+    Return Values: CTestExecution&
+
+    Errors/Exceptions: Panics thread if server has died.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleContainer& CTestThreadContainer::ModuleContainer()
+    { 
+    
+    IsServerAlive();
+    return *iModuleContainer; 
+    
+    };
+ 
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: ExceptionHandler
+
+    Description: Test execution thread exception handler
+
+    Just kill thread. Undertaker handles rest.
+
+    Parameters: TExcType: in: Exception type
+    
+    Return Values: None
+
+    Errors/Exceptions: This function kills the thread where it is executed in.
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::ExceptionHandler ( TExcType aType )
+    {
+
+    // Kill the current thread, undertaker handles rest
+    RThread current;
+    current.Kill( aType );
+
+    // This line is never executed, because thread has been killed.
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: StifMacroErrorInit
+
+    Description: STIF TF's macro. Initialized TTestMacro.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::StifMacroErrorInit()
+    {
+    iTestMacroInfo.iIndication = EFalse;
+    iTestMacroInfo.iFileDes = KNullDesC;
+    iTestMacroInfo.iFunctionDes = KNullDesC;
+    iTestMacroInfo.iLine = 0;
+    iTestMacroInfo.iReceivedError = 0;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: StifMacroError
+
+    Description: STIF TF's macros. Saves information for later use.
+
+    Parameters: TInt aMacroType: in: Macro type(0:TL, 1:T1L, 2:T2L, etc.)
+                TDesC& aFile: in: Modified file information.
+                TDesC& aFunction: in: Modified function information.
+                TInt aLine: in: Line information.
+                TInt aResult: in: Received result.
+                TInt aExpected1: in: Expected result from user.
+                TInt aExpected2: in: Expected result from user.
+                TInt aExpected3: in: Expected result from user.
+                TInt aExpected4: in: Expected result from user.
+                TInt aExpected5: in: Expected result from user.
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::StifMacroError( TInt aMacroType,
+                                           const TText8* aFile,
+                                           const char* aFunction,
+                                           TInt aLine,
+                                           TInt aResult,
+                                           TInt aExpected1,
+                                           TInt aExpected2,
+                                           TInt aExpected3,
+                                           TInt aExpected4,
+                                           TInt aExpected5 )
+    {
+    TStifMacroDes file;
+    TStifMacroDes function;
+
+    // Modifies aFile and aFunction lengths if nesessarily.
+    // File and function maximun length is KStifMacroMax.
+    SetMacroInformation( KStifMacroMax, KStifMacroMax, 
+                            aFile, aFunction, file, function );
+
+    // Log more information to file and rdebug
+    switch( aMacroType )
+        {
+        case 0: // TL macro
+            {
+            __TRACEI( KError, ( CStifLogger::ERed, 
+                _L( "FAIL: STIF TF's macro. FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                &file, &function, aLine ) );
+            RDebug::Print( 
+                _L( "FAIL: STIF TF's macro. FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                &file, &function, aLine );
+            break;
+            }
+       case 1: // T1L macro
+            {
+           __TRACEI( KError, ( CStifLogger::ERed,
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, &file, &function, aLine ) );
+            RDebug::Print( 
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, &file, &function, aLine );
+            break;
+            }
+       case 2: // T2L macro
+            {
+            __TRACEI( KError, ( CStifLogger::ERed,
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, aExpected2, &file, &function, aLine ) );
+            RDebug::Print( 
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, aExpected2, &file, &function, aLine );
+            break;
+            }
+       case 3: // T3L macro
+            {
+            __TRACEI( KError, ( CStifLogger::ERed,
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, aExpected2, aExpected3, &file, &function, aLine ) );
+            RDebug::Print( 
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, aExpected2, aExpected3, &file, &function, aLine );
+            break;
+            }
+       case 4: // T4L macro
+            {
+            __TRACEI( KError, ( CStifLogger::ERed,
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, aExpected2, aExpected3, aExpected4, &file, &function, aLine ) );
+            RDebug::Print( 
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, aExpected2, aExpected3, aExpected4, &file, &function, aLine );
+            break;
+            }
+       case 5: // T5L macro
+            {
+            __TRACEI( KError, ( CStifLogger::ERed,
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, aExpected2, aExpected3, aExpected4, aExpected5, &file, &function, aLine ) );
+            RDebug::Print( 
+                _L( "FAIL: STIF TF's macro. RECEIVED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], EXPECTED[%d], FILE[%S], FUNCTION[%S], LINE[%d]" ),
+                aResult, aExpected1, aExpected2, aExpected3, aExpected4, aExpected5, &file, &function, aLine );
+            break;
+            }
+        default: // default, faulty handling
+            {
+            __TRACEI( KError, ( CStifLogger::EError,
+                _L( "CTestThreadContainer::StifMacroError(): Macro faulty handling(Macro type is incorrect)" ) ) );
+            RDebug::Print( 
+                _L( "ERROR: CTestThreadContainer::StifMacroError(): Macro faulty handling(Macro type is incorrect)" ) );
+            return KErrArgument; // Test case goes to crashed category
+            }        
+        }
+
+    // Modifies aFile and aFunction lengths if nesessarily.
+    // File maximun length is KStifMacroMaxFile.
+    // Function maximun length is KStifMacroMaxFunction.
+    SetMacroInformation( KStifMacroMaxFile, KStifMacroMaxFunction, 
+                            aFile, aFunction, file, function );
+
+    // Set information for later use(this information is
+    // limited and can be seen in UI)
+    iTestMacroInfo.iIndication = ETrue;
+    iTestMacroInfo.iFileDes = file;
+    iTestMacroInfo.iFunctionDes = function;
+    iTestMacroInfo.iLine = aLine;
+    if( aResult == KErrNone )
+        {
+        // aResult is KErrNone. TL macro is used or expected result(s) are/is
+        // negative value(s). Received error code is mapped to KErrArgument
+        // because this is erronous case.
+        iTestMacroInfo.iReceivedError = KErrArgument;
+        }
+    else
+        {
+        iTestMacroInfo.iReceivedError = aResult;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: SetMacroInformation
+
+    Description: Modifies aRecFile and aRecFunction lengths if nesessarily.
+
+    Parameters: TInt aMaxLength: in: Maximum length of file information.
+                TInt aMaxLength: in: Maximum length of function information.
+                const TText8* aRecFile: in: Received file information.
+                char* aRecFunction: in: Received function information.
+                TDes& aFile: inout: Modified file.
+                TDes& aFunction: inout: Modified function.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::SetMacroInformation( TInt aFileMaxLength,
+                                                TInt aFuntionMaxLength,
+                                                const TText8* aRecFile,
+                                                const char* aRecFunction,
+                                                TDes& aFile,
+                                                TDes& aFunction )
+    {
+    // Create 8 to 16
+    TPtrC8 buf_file;
+    buf_file.Set( aRecFile );
+    // File description length is limited. Extracts the rightmost part of the
+    // data.
+    aFile.Copy( buf_file.Right( aFileMaxLength ) );
+    aFile.LowerCase();
+
+    if( aRecFunction )
+        {
+        // Create 8 to 16
+        TPtrC8 buf_func;
+        buf_func.Set( (const unsigned char*)aRecFunction );
+        // Function description length is limited. Extracts the leftmost part
+        // of the data.
+        aFunction.Copy( buf_func.Left( aFuntionMaxLength ) );
+        aFunction.LowerCase();
+        }
+    else
+        {
+        // Function is not given(WINS)
+        aFunction.Copy( _L( "-" ) );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: AddInterferenceThread
+
+    Description: With this can be store information about test interference
+                 thread to client space.
+
+    Parameters: RThread aSTIFTestInterference: in: Thread information to store
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::AddInterferenceThread( 
+                                RThread aSTIFTestInterference )
+    {
+    // Get access to test interference stuff
+    iInterferenceSem.Wait();
+    
+    iInterferenceMutex.Wait();  // Take mutex to get access to server thread.
+                                // Between Wait and Signal is critical section
+                                // and this verifies that iInterferenceSem and
+                                // RequestComplete is done successfully.
+    
+    // Get status variable from server
+    TRequestStatus* status = 
+        TestExecution().GetRq( CTestExecution::ERqInterference );
+    
+    if( status == NULL )
+        {
+        iInterferenceMutex.Signal();
+        Panic( ENullRequest );
+        return KErrNone;
+        }
+
+    if( *status != KRequestPending )
+        {
+        // CInterferenceHandler::DoCancel called before getting here,
+        // just return
+        iInterferenceMutex.Signal();
+        return KErrNone;    
+        }
+
+    // Add thread to Array. Via array can handle test interference thread's
+    // kill in panic etc. cases
+    TTestInterference& testInterface = TestExecution().TestInterference();
+    testInterface.iThreadId = aSTIFTestInterference.Id();    
+    testInterface.iOperation = TTestInterference::EAppend;
+
+    // Complete action to server
+    iServerThread.RequestComplete( status, KErrNone );
+    // Goes to CInterferenceHandler::RunL()
+
+    iInterferenceMutex.Signal();
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: RemoveInterferenceThread
+
+    Description: With this can be remove information about test interference
+                 thread from client space.
+
+    Parameters:  RThread aSTIFTestInterference: in: Thread information to store
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::RemoveInterferenceThread( 
+                                RThread aSTIFTestInterference )
+    {
+    // Get access to test interference stuff
+    iInterferenceSem.Wait();
+    
+    iInterferenceMutex.Wait();  // Take mutex to get access to server thread.
+                                // Between Wait and Signal is critical section
+                                // and this verifies that iInterferenceSem and
+                                // RequestComplete is done successfully.
+    
+    // Get status variable from server
+    TRequestStatus* status = 
+        TestExecution().GetRq( CTestExecution::ERqInterference );
+    
+    if( status == NULL )
+        {
+        iInterferenceMutex.Signal();
+        Panic( ENullRequest );
+        return KErrNone;
+        }
+
+    if( *status != KRequestPending )
+        {
+        // CInterferenceHandler::DoCancel called before getting here, just return
+        iInterferenceMutex.Signal();
+        return KErrNone;    
+        }
+
+    // Add thread to Array. Via array can handle test interference thread's
+    // kill in panic etc. cases
+    TTestInterference& testInterface = TestExecution().TestInterference();
+    testInterface.iThreadId = aSTIFTestInterference.Id();    
+    testInterface.iOperation = TTestInterference::ERemove;
+
+    // Complete action to server
+    iServerThread.RequestComplete( status, KErrNone );
+    // Goes to CInterferenceHandler::RunL()
+
+    iInterferenceMutex.Signal();
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: HandleMeasurementProcess
+
+    Description: With this can be stored information about test measurement
+                 to TestServer space.
+
+    Parameters: CSTIFTestMeasurement::TMeasurement aSTIFMeasurementInfo: in:
+                Struct for measurement information.
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestThreadContainer::HandleMeasurementProcess( 
+            CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo )
+    {
+    // Get access to test measurement stuff
+
+    // This is syncronous operation and other request cannot executed at the
+    // same time. In this case iMeasurementSem is not signaled in StarL().
+    // So iMeasurementSem.Wait(); is not needed in this case.
+
+    iMeasurementMutex.Wait();   // Take mutex to get access to server thread.
+                                // Between Wait and Signal is critical section
+                                // and this verifies that iMeasurementSem and
+                                // RequestComplete is done successfully.
+
+    // Get status variable from server
+    TRequestStatus* status = 
+        TestExecution().GetRq( CTestExecution::ERqMeasurement );
+
+    if( status == NULL )
+        {
+        iMeasurementMutex.Signal();
+        Panic( ENullRequest );
+        return KErrNone;
+        }
+
+    if( *status != KRequestPending )
+        {
+        // CMeasurementHandler::DoCancel called before getting here,
+        // just return
+        iMeasurementMutex.Signal();
+        return KErrNone;
+        }
+
+    TTestMeasurement& testmeasurement = TestExecution().TestMeasurement();
+    testmeasurement.iMeasurementStruct = aSTIFMeasurementInfo;
+
+    // Complete action to server
+    iServerThread.RequestComplete( status, KErrNone );
+    // Goes to CMeasurementHandler::RunL()
+
+    // Make this synchronous and block until needed operations are done.
+    iMeasurementSem.Wait();
+    // This continue here when iMeasurementSem.Signal is said in 
+    // CMeasurementHandler::RunL(). So when measurement operations are done.
+
+    // Error code from measurement related operations
+    TInt ret( testmeasurement.iMeasurementStruct.iOperationResult );
+
+    iMeasurementMutex.Signal();
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: SetEventReq
+
+    Description: Sets asynchronous event request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::DoNotifyCommand(TCommand aCommand, const TDesC8& aParamsPckg)
+    {
+    // Get access to command stuff
+    iCommandSem.Wait();
+
+    iCommandMutex.Wait(); // Take mutex to get access to server thread.
+                          // Between Wait and Signal is critical section and this
+                          // verifies that iCommandSem and RequestComplete is done
+                          // successfully.
+
+    // Get status variable from server
+    TRequestStatus* status = TestExecution().GetRq(CTestExecution::ERqCommand);
+
+    if(status == NULL)
+        {
+        iCommandMutex.Signal();
+        Panic(ENullRequest);
+        return;
+        }
+    if(*status != KRequestPending)
+        {
+        iCommandMutex.Signal();
+        return;
+        }
+
+    // Fill in information
+    CCommandDef& aDef = TestExecution().CommandDef();
+    aDef.iCommand = aCommand;
+    aDef.iParamsPckg.Copy(aParamsPckg);
+
+    // Complete action to server
+    iServerThread.RequestComplete(status, KErrNone);
+
+    iCommandMutex.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: GetTestCaseTitleL
+
+    Description: Gets title of currently running test.
+
+    Parameters: aTestCaseTitle: OUT: test case title descriptor
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::GetTestCaseTitleL(TDes& aTestCaseTitle)
+    {
+    ModuleContainer().GetTestCaseTitleL(aTestCaseTitle); 
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: SetThreadLogger
+
+    Description: Sets thread logger.
+
+    Parameters: CStifLogger* aThreadLogger: in: Pointer to thread logger.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainer::SetThreadLogger( CStifLogger* aThreadLogger )
+	{
+	
+	iThreadLogger = aThreadLogger;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: SetThreadLogger
+
+    Description: Gets thread logger.
+
+    Parameters: None
+
+    Return Values: Pointer to CStifLogger. 
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CStifLogger* CTestThreadContainer::GetThreadLogger()
+	{
+	
+	return iThreadLogger;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: UITesting
+
+    Description: Gets information if testserver supports UI testing.
+
+    Parameters: None
+
+    Return Values: True if testserver supports UI testing, False if testserver
+    			   doesn't support UI testing. 
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TBool CTestThreadContainer::UITesting()
+	{
+	return iModuleContainer->GetTestModule()->GetTestServer()->IsUiTestingSupported() &&
+            iModuleContainer->GetTestModule()->UiTesting();	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestThreadContainer
+
+    Method: GetUiEnvProxy
+
+    Description: Gets UIEnvProxy.
+
+    Parameters: None
+
+    Return Values: Pointer to UIEnvProxy 
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CUiEnvProxy* CTestThreadContainer::GetUiEnvProxy()
+	{
+	return iModuleContainer->GetTestModule()->GetTestServer()->GetUiEnvProxy();
+	}
+
+EXPORT_C TBool CTestThreadContainer::SeperateProcesses()
+    {
+    return iModuleContainer->GetTestModule()->SeperateProcesses();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/TestModuleContainer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,2362 @@
+/*
+* 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: This module contains implementation of 
+* CTestModuleContainer class member functions. CTestModuleContainer 
+* class contains interface * to execute various functions in context 
+* of test execution thread.
+*
+* CTestModuleContainer is the owner of the test execution thread 
+* object and the owner of the test module instance.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include <e32uid.h>
+#include "TestEngineClient.h"
+#include <StifTestModule.h>
+#include <stifinternal/TestServerClient.h>
+#include "TestServer.h"
+#include "TestServerModuleIf.h"
+#include "TestServerCommon.h"
+#include "PrintQueue.h"
+#include "TestThreadContainer.h"
+//--PYTHON-- begin
+#include "StifPython.h"
+//--PYTHON-- end
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// The test module execution thread function
+TInt ExecutionThread( TAny* aParams );
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+typedef TInt( *CTestInterfaceFactoryTestModule )( CTestModuleParam*&, TUint32& );
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: NewL
+
+    Description: Returns new CTestModuleContainer instance.
+
+    Parameters: const TDesC& aName: in: Module name
+                CTestModule* aSession: in: "Parent"
+                const TDesC& aConfig: in: Test case (config) file name.
+
+    Return Values: CTestModuleContainer* New instance
+
+    Errors/Exceptions: Function leaves if memory allocation fails or
+                       CTestModuleContainer ConstructL leaves.
+                       Panics if aSession is NULL.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleContainer* CTestModuleContainer::NewL( const TDesC& aName,
+                                                  CTestModule* aSession,
+                                                  const TDesC& aConfig )
+    {
+
+    __ASSERT_ALWAYS ( aSession, 
+                      CTestServer::PanicServer( ENullTestModule ) );
+
+    CTestModuleContainer* self = new ( ELeave ) CTestModuleContainer();
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aSession, aConfig );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Function creates the execution thread, creates exception
+    handler and the thread undertaker for it and then resumes the thread.
+
+    Parameters: const TDesC& aName: in: Module name
+                CTestModule* aSession: in: "Parent"
+                const TDesC& aConfig: in: Test case (config) file name.
+
+    Return Values: CTestModuleContainer* New instance
+
+    Errors/Exceptions: Function leaves if thread creation fails,
+                       memory allocation fails or undertaker creation leaves.
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::ConstructL( const TDesC& aName,
+                                       CTestModule* aSession,
+                                       const TDesC& aConfig )
+    {
+
+    RDebug::Print( aName );
+    
+    iNestedActiveScheduler = new (ELeave) CActiveSchedulerWait;
+    
+    iCTestModule = aSession;
+
+    // Create error print handler
+    iErrorPrintHandler = CErrorPrintHandler::NewL( *this );
+    User::LeaveIfError( iErrorPrintSem.CreateLocal( 0 ) );
+
+    // Construct unique thread name
+    const TInt KAddressLen = 8;
+    const TInt KMaxName = 50;  // Something smaller than max thread name
+    TInt len = aName.Length();
+    if ( KAddressLen + len > KMaxName )
+        {
+        len = KMaxName - KAddressLen;
+        }
+    
+    // Default heap and stack sizes that may configure by user.
+    TInt heapMinSize( KTestThreadMinHeap );
+    TInt heapMaxSize( KTestThreadMaxHeap );
+    TInt stackSize( KStackSize );
+
+    // Check is user give heap or stack sizes and verify sizes.
+    GetTestModuleParams( aName, aConfig, stackSize, heapMinSize, heapMaxSize );
+
+    // Create a new thread
+    TInt ret = KErrAlreadyExists;
+    for( TInt i = 0; ret == KErrAlreadyExists; i++ )
+        {
+        TName threadName = aName.Left( len );
+        threadName.AppendFormat( _L( "%x" ), ( TUint32 ) this );
+        threadName.AppendFormat( _L( "%x" ), i );
+        //RDebug::Print( threadName );
+
+		RDebug::Print(_L("CTestModuleContainer::ConstructL create thread=[%S] stackSize=(%d)"), &threadName, stackSize);
+
+		if ( iCTestModule->GetTestServer()->IsUiTestingSupported() && iCTestModule->UiTesting() )
+            {
+            ret = iThread.Create(
+                    threadName,                 // name of thread
+                    CTestThreadContainer::UIExecutionThread,// thread function
+                    stackSize,                  // Stack size
+                    heapMinSize,                // Heap sizes
+                    heapMaxSize,
+                    this                        // Parameter to thread function
+                    );
+            }
+		else
+		    {
+	        ret = iThread.Create(
+	                    threadName,                 // name of thread
+	                    CTestThreadContainer::ExecutionThread,// thread function
+	                    stackSize,                  // Stack size
+	                    heapMinSize,                // Heap sizes
+	                    heapMaxSize,
+	                    this                        // Parameter to thread function
+	                    );
+			}
+
+        // If test execution thread exist try to create new one
+        if( ret == KErrAlreadyExists )
+            {
+            RDebug::Print( _L( "Thread[%S] allready exist, creating new one" ), &threadName );
+            __TRACE ( KInit, ( CStifLogger::ERed, _L( "Thread[%S] allready exist, creating new one" ), &threadName ) );
+            }
+        }
+
+    // If thread creation fails, leave here.
+    if( ret != KErrNone )
+        {
+        RDebug::Print( _L( "Execution thread creation fails with: [%d]" ), ret );
+        __TRACE ( KError, ( CStifLogger::ERed, _L( "Execution thread creation fails with: [%d]" ), ret ) );
+        User::Leave( ret );
+        }
+
+    // Doing nothing
+    // ChangeOperationNoError ( ESuspend, 0 );
+    // Thread suspends always first by default
+    
+    // Construct the undertaker to get notifications about the 
+    // thread death. 
+    // This must be trapped to allow to kill just created thread
+    // nicely without a mess in destructor.
+    TRAPD ( r, 
+        iUnderTaker = CUnderTaker::NewL ( this );
+        CActiveScheduler::Add( iUnderTaker );
+        iUnderTaker->StartL();
+        );    
+
+    // Can't create or start the undertaker. Kill the thread. 
+    // Undertaker will be deleted in destructor if needed.
+    if ( r != KErrNone )
+        {
+        iThread.Kill ( r );
+        iThread.Close();
+        User::Leave( r );
+        }
+
+    // Get server thread id ( i.e current thread id )
+    RThread tmpThread;
+    iServerThreadId = tmpThread.Id();
+    
+    // Resume the thread
+    iThread.Resume();                // Start the thread
+    iUpAndRunning = ETrue;           // Thread is created 
+
+    // Add "this" container to active scheduler
+    CActiveScheduler::Add ( this );
+
+    // Start error print handler
+    iErrorPrintHandler->StartL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: CTestModuleContainer
+
+    Description: Constructor.
+
+    Initialise semaphores.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CTestModuleContainer::CTestModuleContainer() :
+    CActive( CActive::EPriorityStandard ),
+    iOperationName ( 0, 0 ),
+    iIsPaused( EFalse )
+    {
+
+    // Create operation start semaphore
+    iOperationStartSemaphore.CreateLocal( 0 );
+
+    // Operation can be changed without first waiting.
+    iOperationChangeSemaphore.CreateLocal( 1 );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ~CTestModuleContainer
+
+    Description: Destructor
+
+    Delete the test execution thread, if it is up and running. Delete
+    undertaker and close handles.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestModuleContainer::~CTestModuleContainer()
+    {
+
+    __TRACE ( KThreadOperation, ( _L( "CTestModuleContainer::~CTestModuleContainer in" ) ) );
+
+    if ( iUpAndRunning )
+        {
+		if( iUnderTaker != NULL )
+			{
+			iUnderTaker->Cancel();
+			}
+
+        // Set the operation
+        ChangeOperationNoError ( EExit, 0 );
+
+        // Do operation
+        StartAndWaitOperation();
+
+        }
+    
+    delete iErrorPrintHandler;
+	iErrorPrintHandler = NULL;
+
+    // Delete heap descriptor
+    delete iModuleNameBuffer;
+    iModuleNameBuffer = NULL;
+
+    // Delete undertaker
+    delete iUnderTaker;
+    iUnderTaker = NULL;
+
+    // Close error semaphore
+    if ( iErrorPrintSem.Handle() != 0 ) iErrorPrintSem.Close();
+
+    // Close the semaphores
+    iOperationStartSemaphore.Close();
+    iOperationChangeSemaphore.Close();
+
+    // Close handle to thread
+    iThread.Close();
+
+    Cancel();
+
+    delete iNestedActiveScheduler;
+    iNestedActiveScheduler = NULL;
+
+    __TRACE ( KThreadOperation, ( _L( "CTestModuleContainer::~CTestModuleContainer out" ) ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: StartAndWaitOperation
+
+    Description: Signals operation and waits until operation is completed.
+
+    Function executes active scheduler locally to handle both request
+    completion from execution thread and thread undertaker operations.    
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::StartAndWaitOperation()
+    {
+
+    // Change undertaker mode to synchronous    
+    iUnderTaker->SetSynchronousMode( ETrue );
+
+    iStatus = KRequestPending;
+    // Get ready to handle operation completion
+    SetActive();
+
+    // Start operation
+    iOperationStartSemaphore.Signal();
+
+    // Start "nested" active scheduler "locally"
+    //CActiveScheduler::Start();
+    iNestedActiveScheduler->Start();
+
+    // Request completed or operation crashed, everything 
+    // is done in ModuleContainer's RunL function or in UnderTaker's RunL.
+
+    // Cancel the original request in case than it was the undertaker
+    // that stopped the active scheduler. Does not do anything if original
+    // request is already finished.
+    Cancel();
+    
+    // Undertaker back to "normal" mode
+    iUnderTaker->SetSynchronousMode ( EFalse );
+
+    return iModuleResult;
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: Initialise
+
+    Description: Initialise the test module
+
+    Initialisation is done in context of test execution thread.
+
+    Parameters: const TDesC& aName            :in:  Module name
+                TBool aFirstTime              :in:  First init?
+
+
+    Return Values: TInt                             Result from init
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::Initialize( const TFileName& aName,
+                                       TBool aFirstTime
+                                     )
+    {
+
+    __TRACE ( KInit, ( _L( "Initializing test module" ) ) );
+
+    // Set the operation
+    iErrorResult = ChangeOperation ( EInitializeModule, aName, aFirstTime );
+    iModuleResult = KErrNone;
+    
+    if ( iErrorResult == KErrNone )
+        {
+        // Wait until operation is completed
+        StartAndWaitOperation();
+        }
+    
+    if ( iErrorResult )
+        {
+        __TRACE ( KError, ( CStifLogger::ERed,  _L( "Initializing test module failed %d" ), iErrorResult ) );
+        }
+    else if ( iModuleResult )
+        {
+        __TRACE ( KError, ( CStifLogger::ERed, _L( "Initializing test module failed code from module = %d" ), iModuleResult ) );
+        } 
+    else
+        {
+        __TRACE ( KInit, ( CStifLogger::EBold, _L( "Test module initialization done" ) ) );
+        }
+
+    // Return result
+    return iModuleResult;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: EnumerateTestCases
+
+    Description: Enumerate test cases of the test module
+
+    Enumeration is done in context of test execution thread.
+
+    Parameters: const TDesC& aName            :in:  Configuration file
+
+    Return Values: TInt                             Result from enumeration
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::EnumerateTestCases( const TFileName& aName )
+    {
+
+    __TRACE ( KInit, ( CStifLogger::EBold, _L( "Enumerating test cases from [%S] (might be empty)" ), &aName ) );
+
+    // Set the operation
+    iErrorResult = ChangeOperation( EEnumerateInThread, aName, 0 );
+    iModuleResult = KErrNone;
+
+    if ( iErrorResult == KErrNone )
+        {
+        // Wait until operation is completed
+        StartAndWaitOperation();
+        }
+
+    if ( iErrorResult )
+        {
+        __TRACE ( KError, ( CStifLogger::ERed, _L( "Enumerating test cases failed %d" ), iErrorResult ) );
+        }
+    else if ( iModuleResult )
+        {
+        __TRACE ( KError, ( CStifLogger::ERed, _L( "Enumerating test cases failed, code from module = %d" ), iModuleResult ) );
+        } 
+    else
+        {
+        __TRACE ( KInit, ( _L( "Enumerating test cases done" ) ) );
+        }
+
+    // Return result
+    return iModuleResult;
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: FreeEnumerationData
+
+    Description: Frees the enumeration data
+
+    Memory deallocation is done in context of test execution thread.
+
+    Parameters: None
+
+    Return Values: TInt                             Result from operation
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+TInt CTestModuleContainer::FreeEnumerationData()
+    {
+
+    // Set the operation
+    ChangeOperationNoError( EFreeEnumerationData, 0 );
+    
+    // Do the operation
+    StartAndWaitOperation();
+
+    // Return result
+    return iModuleResult;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: RunTestCase
+
+    Description: Run a test case
+
+    Running a test case is done in context of test execution thread. This
+    function is asynchronous ( i.e test is not finished when this function
+    returns ).
+
+    Parameters: const TFileName& aName        :in:  Configuration file
+                TInt aCaseNumber              :in:  Case number
+                const RMessage                :in:  Handle to test msg.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::RunTestCase ( const TFileName& aName,
+                                         const TInt aCaseNumber,
+                                         const RMessage2& aMessage
+                                       )
+    {
+
+    __TRACE ( KInit, ( CStifLogger::EBold, _L( "Running test case [%S], case [%d]" ), &aName, aCaseNumber ) );
+
+    // Set the operation    
+    iErrorResult = ChangeOperation( EExecuteTestInThread, aName, aCaseNumber );
+
+    if ( iErrorResult != KErrNone )
+        {
+        aMessage.Complete ( iErrorResult );
+        return;
+        }    
+
+    // Set data
+    iMessage = aMessage;
+
+    iStatus = KRequestPending;
+    // Get ready to handle operation completion
+    SetActive();
+
+    // Do operation
+    iOperationStartSemaphore.Signal();    
+
+    // This is asynchronous operation, 
+    // do not wait until completed.    
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: SetExecutionSubSession
+
+    Description: Set execution subsession
+
+    Sets module container test execution subsession. Execution subsession
+    is changed when a module container is reused to run another 
+    test case.
+
+    Parameters: CTestExecution* aExecution    :in:  Subsession pointer
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::SetExecutionSubSession( CTestExecution* aExecution )
+    {
+
+    iCTestExecution = aExecution;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: PauseThread
+
+    Description: Pauses the thread
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::PauseThread()
+    {
+    
+    if( iThread.ExitType() != EExitPending )
+        {
+        // Thread is not alive anymore
+        return KErrDied;
+        }
+
+    if(iCTestExecution != NULL)
+    	{
+		RMutex printMutex;
+		printMutex.SetHandle( iCTestExecution->PrintMutexHandle() );
+		RMutex eventMutex;
+		eventMutex.SetHandle( iCTestExecution->EventMutexHandle() );
+		RMutex sndMutex;
+		sndMutex.SetHandle( iCTestExecution->SndMutexHandle() );
+		RMutex rcvMutex;
+		rcvMutex.SetHandle( iCTestExecution->RcvMutexHandle() );
+		
+		printMutex.Wait(); // wait that print operation is done
+		eventMutex.Wait(); // wait that event operation is done        
+		sndMutex.Wait(); // wait that and operation is done
+		rcvMutex.Wait(); // wait that event operation is done        
+			
+		iThread.Suspend();
+		
+		printMutex.Signal();
+		eventMutex.Signal();
+		sndMutex.Signal();
+		rcvMutex.Signal();
+    	}
+    else
+		{
+		__TRACE( KError,( _L( "STIF internal error - iCTestExecution is NULL in CTestModuleContainer::PauseThread" ) ) );
+		User::Panic(_L("NULL pointer exception"), KErrGeneral);
+		}
+    
+    iIsPaused = ETrue;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ResumeThread
+
+    Description: Resumes the thread
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::ResumeThread()
+    {
+
+    if( iThread.ExitType() != EExitPending )
+        {
+        // Thread is not alive anymore
+        return KErrDied;
+        }
+    
+    iThread.Resume();
+
+    // Pause() - Resume() operations done successfully. 
+    iIsPaused = EFalse;
+
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: KillThread
+
+    Description: Kills the thread
+
+    Parameters: const TInt aCode              :in:   Kill code
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::KillThread( const TInt aCode )
+    {
+
+    iUpAndRunning = EFalse;
+    iUnderTaker->Cancel();
+    
+    if(iCTestExecution != NULL)
+    	{
+		RMutex printMutex;
+		printMutex.SetHandle( iCTestExecution->PrintMutexHandle() );
+		RMutex eventMutex;
+		eventMutex.SetHandle( iCTestExecution->EventMutexHandle() );
+		RMutex sndMutex;
+		sndMutex.SetHandle( iCTestExecution->SndMutexHandle() );
+		RMutex rcvMutex;
+		rcvMutex.SetHandle( iCTestExecution->RcvMutexHandle() );
+		
+		printMutex.Wait(); // wait that print operation is done
+		eventMutex.Wait(); // wait that event operation is done        
+		sndMutex.Wait(); // wait that snd operation is done
+		rcvMutex.Wait(); // wait that event operation is done        
+			
+		iThread.Kill ( aCode );
+		
+		printMutex.Signal();
+		eventMutex.Signal();
+		sndMutex.Signal();
+		rcvMutex.Signal();
+    	}
+    else
+		{
+		__TRACE( KError,( _L( "STIF internal error - iCTestExecution is NULL in CTestModuleContainer::KillThread" ) ) );
+		User::Panic(_L("NULL pointer exception"), KErrGeneral);
+		}
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ChangeOperation
+
+    Description: Multithread safe way to change operation
+
+    Parameters: const TOperation aOperation   :in:  Operation type
+                const TFileName* aNameBuffer  :in:  Filename ( or NULL )
+                const TInt aInt               :in:  Operation specific int
+    
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::ChangeOperation( const TOperation aOperation,
+                                            const TFileName& aNameBuffer,
+                                            const TInt aInt )
+    {
+
+    TInt ret = KErrNone;
+
+    iOperationChangeSemaphore.Wait();
+
+    iErrorResult  = KErrNone;
+    iModuleResult = KErrNone;
+
+    TFileName newNameBuffer;
+    // Check is TestScripter
+    TInt check = CheckModuleName( aNameBuffer, newNameBuffer );
+    delete iModuleNameBuffer;
+	iModuleNameBuffer = NULL;
+    if( check == KErrNone )
+        {
+        // Construct heap buffer for configuration file
+        TRAP( ret, iModuleNameBuffer = HBufC::NewL( newNameBuffer.Length() ) );
+
+        if( ret == KErrNone )
+            {
+            iOperationName.Set ( iModuleNameBuffer->Des() );
+            iOperationName.Copy ( newNameBuffer );
+        
+            iOperationIntBuffer = aInt;
+            iOperationType = aOperation;
+            }
+        else
+            {
+            __TRACE ( KError, ( CStifLogger::ERed, _L( "CTestModuleContainer::ChangeOperation NoMemory" ) ) );
+            }   
+        }
+    else
+        {
+        // Construct heap buffer for configuration file
+        TRAP( ret, iModuleNameBuffer = HBufC::NewL( aNameBuffer.Length() ) );
+
+        if( ret == KErrNone )
+            {
+            iOperationName.Set ( iModuleNameBuffer->Des() );
+            iOperationName.Copy ( aNameBuffer );
+        
+            iOperationIntBuffer = aInt;
+            iOperationType = aOperation;
+            }
+        else
+            {
+            __TRACE ( KError, ( CStifLogger::ERed, _L( "CTestModuleContainer::ChangeOperation NoMemory" ) ) );
+            }
+        }
+
+    iOperationChangeSemaphore.Signal();
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ChangeOperationNoError
+
+    Description: Multithread safe way to change operation. This version
+    of function can't fail.
+
+    Parameters: const TOperation aOperation   :in:  Operation type
+                const TInt aInt               :in:  Operation specific int
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::ChangeOperationNoError( const TOperation aOperation,
+                                                   const TInt aInt
+                                                 )
+    {
+
+    iOperationChangeSemaphore.Wait();
+
+    iErrorResult  = KErrNone;
+    iModuleResult = KErrNone;
+    iOperationIntBuffer = aInt;
+    iOperationType = aOperation;
+    
+    iOperationChangeSemaphore.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: Operation
+
+    Description: Multithread safe way to obtain current operation.
+
+    Parameters: None
+
+    Return Values: TBool                            Operation
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+//@spe const CTestModuleContainer::TOperation CTestModuleContainer::Operation()
+CTestModuleContainer::TOperation CTestModuleContainer::Operation()
+    {
+    TOperation operation;
+    iOperationChangeSemaphore.Wait();
+    operation = iOperationType;
+    iOperationChangeSemaphore.Signal();
+
+    return operation;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ModuleResult
+
+    Description: Returns error code from test module
+
+    Parameters: None
+
+    Return Values: TInt                             Result code from module
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt& CTestModuleContainer::ModuleResult()
+    {
+
+    return iModuleResult;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: OperationErrorResult
+
+    Description: Returns error code from test module
+
+    Parameters: None
+
+    Return Values: TInt                             Result code from module
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt& CTestModuleContainer::OperationErrorResult()
+    {
+
+    return iModuleResult;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: TestModuleName
+
+    Description: Returns test module name.
+
+    Parameters: None
+
+    Return Values: const TDesC&: test module name
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestModuleContainer::TestModuleName()
+    {
+    
+    return iCTestModule->Name();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: TestModuleName
+
+    Description: Returns test module name.
+
+    Parameters: None
+
+    Return Values: const TDesC&: test module name
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestModuleContainer::TestModuleIniFile()
+    {
+    
+    return iCTestModule->IniName();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ModuleResult
+
+    Description: Returns constant pointer to test case array
+
+    Parameters: None
+    
+    Return Values: const RPointerArray<TTestCaseInfo>*  Test cases
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+const RPointerArray<TTestCaseInfo>* CTestModuleContainer::TestCases() const
+    {
+    
+    if( !iUpAndRunning )
+        {
+        return NULL;
+        }
+        
+    if( iThreadContainer == NULL )
+        {
+        CTestServer::PanicServer( ENullTestThreadContainer );
+        }
+    return iThreadContainer->TestCases();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: Complete
+
+    Description: Completes operation from any thread
+
+    Parameters: const TInt aCompletionCode :in:     Completion code
+    
+    Return Values: None
+
+    Errors/Exceptions: Function panics if server's thread can't be opened.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::Complete( const TInt aCompletionCode )
+    {
+
+    TRequestStatus* req = &iStatus;
+    User::RequestComplete( req, aCompletionCode );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: DoErrorPrint
+
+    Description: Handle error prints.
+        
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::DoErrorPrint()
+    {    
+    
+    iCTestModule->ErrorPrint( iErrorPrint.iPriority, iErrorPrint.iText );
+    
+    }
+ 
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: KillTestinterferenceThread
+
+    Description: Make sure that any of the test interference thread's won't
+                 stay to run if test case is crashed of test interference
+                 object is not deleted.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::KillTestinterferenceThread()
+    {
+    if (iCTestExecution != NULL)
+    	{
+    	iCTestExecution->KillTestinterferenceThread();
+    	}
+    else
+    	{
+    	__TRACE( KError,( _L( "STIF internal error - iCTestExecution is NULL in CTestModuleContainer::KillTestinterferenceThread" ) ) );
+    	User::Panic(_L("NULL pointer exception"), KErrGeneral);
+    	}
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: KillTestMeasurement
+
+    Description: Make sure that any of the test measurement process's won't
+                 stay to run if test case is crashed of test measurement object
+                 is not deleted.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::KillTestMeasurement()
+    {    
+    if (iCTestExecution != NULL)
+    	{
+    	iCTestExecution->KillTestMeasurement();
+    	}
+    else
+    	{
+    	__TRACE( KError,( _L( "STIF internal error - iCTestExecution is NULL in CTestModuleContainer::KillTestMeasurement" ) ) );
+    	User::Panic(_L("NULL pointer exception"), KErrGeneral);
+    	}
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: GetRequest
+
+    Description: Return status flags.
+        
+    Parameters: TRequestType aType: in: request type
+    
+    Return Values: TRequestStatus*: pointer to TRequestStatus
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TRequestStatus* CTestModuleContainer::GetRequest( TRequestType aType )
+    { 
+    
+    TRequestStatus* status = NULL;
+    
+    switch( aType )
+        {
+        case ERqTestCase:
+            status = &iStatus;
+            break;
+        case ERqErrorPrint:
+            status = &iErrorPrintHandler->iStatus;
+            break;
+        default: 
+            break;
+        }
+    
+    return status;
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: RunL
+
+    Description: Stops active scheduler when operation in another thread
+                 is completed.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::RunL()
+    {
+    
+    if( iOperationType == CTestModuleContainer::EExecuteTestInThread )
+        {
+        // Make sure that any of the test interference thread's won't stay
+        // to run.
+        KillTestinterferenceThread();
+
+        // Make sure that any of the test measurement process's won't stay
+        // to run.
+        KillTestMeasurement();
+
+        if(iCTestExecution == NULL)
+        	{
+        	__TRACE( KError,( _L( "STIF internal error - iCTestExecution is NULL in CTestModuleContainer::RunL" ) ) );
+        	User::Leave(KErrGeneral);
+        	}
+        else
+        	{
+			// Set the thread state
+			iCTestExecution->SetThreadState( CTestExecution::EFinished );
+	
+			 // If test print queue is empty, then complete request with KEof. If Queue
+			// is not empty, then do not complete. Queue will be emptied by UI.   
+			iCTestExecution->CompletePrintRequestIfQueueEmpty();
+	
+			// Event queue clean-up
+			iCTestExecution->CleanupEvents();
+			
+			// Complete the test request
+			iCTestExecution->CompleteTestExecution( iStatus.Int() );
+			
+			// Test case execution OK and test module thread's pause operation
+			// is not ongoing. Re-use old test module execution thread
+			if( iCTestExecution->TestThreadFailure() == CTestExecution::ETestThreadOk && !iIsPaused )
+				{
+				// Return this module to pool
+				__TRACE( KInit, ( _L("Freeing test module container at 0x%x"),  
+					(TUint32) this ) );
+				iCTestModule->FreeTestModule( this );
+				}
+			// Problems in test case execution. Delete this test module thread and
+			// start next test case in new test module thread.
+			else
+				{
+				if( iIsPaused )
+					{
+					// Test case is paused by user and this RunL is executed also.
+					// This RunL will make Resume() operation to fail because test
+					// case is finished. Next test case cannot complete and that is
+					// why next test case will start at the "clean table".
+					__TRACE( KInit, ( _L( "Delete test module container at 0x%x because test module thread is paused while test case is finished(Cannot Resume())" ), (TUint32) this ) );  
+					}
+				else
+					{
+					// delete test module thread if some thread problem has occurred 
+					__TRACE( KInit, ( _L("Delete test module container at 0x%x because of thread leak (0x%x)"),  
+						(TUint32) this,  iCTestExecution->TestThreadFailure() ) );
+					}
+				delete this;            
+				}
+        	}
+        }
+    else
+        {
+        // Synchronous operation is completed, stop "nested" active scheduler.
+        //CActiveScheduler::Stop();
+        iNestedActiveScheduler->AsyncStop();
+        // Execution continues from CTestModuleContainer::WaitOperation().
+        }
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: DoCancel
+
+    Description: Cancel asyncronous request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::DoCancel()
+    {
+
+    if ( iUpAndRunning == EFalse )
+        {
+        
+        // Before the completion check if the status was not already completed
+        // from other thread in CTestThreadContainer::TestComplete().
+        // For details see Jira STIF-564
+        if(iStatus == KRequestPending)
+            Complete ( KErrCancel ); 
+
+        }
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: RunError
+
+    Description: Handle errors. 
+
+    Because RunL does not leave, one should never come here. Just forward
+    error code and let framework panic the server in case of error.
+
+    Parameters: TInt aError:                  :in:  Error code
+
+    Return Values:  TInt                            Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::RunError( TInt aError )
+    {
+
+    __TRACE( KError,( _L( "CTestModuleContainer::RunError %d" ), aError ) );
+
+    return aError;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ReadParametersFromScriptFileL
+
+    Description: Read test class parameters from script file if parameter(s)
+                 are/is set(TestScripter and TestCombiner).
+
+    Parameters: const TDesC& aConfig: in: Test case (config) file name.
+                TUint32& aStackSize: inout: Stack size.
+                TUint32& aHeapMinSize: inout: Heap's minimum size.
+                TUint32& aHeapMaxSize: inout: Heap's maximum size.
+
+    Return Values: Symbian error code.
+
+    Errors/Exceptions: Leaves if User::LeaveIfError() leaves
+                       Leaves if User::LeaveIfNull() leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::ReadParametersFromScriptFileL( 
+                                                const TDesC& aConfig,
+                                                TInt& aStackSize,
+                                                TInt& aHeapMinSize,
+                                                TInt& aHeapMaxSize )
+    {
+    // __UHEAP_MARK;
+
+    RFs fileServer;
+    RFile file;
+    TInt ret( KErrNone );
+
+    User::LeaveIfError( fileServer.Connect() );
+    CleanupClosePushL( fileServer );
+    
+    __TRACE( KInit, ( _L( "ReadParametersFromScriptFile(): Open configfile [%S]" ), &aConfig ) );
+
+    TParse parse;
+    parse.Set( aConfig, NULL, NULL );
+
+    User::LeaveIfError( fileServer.SetSessionPath( parse.DriveAndPath() ) );
+
+    User::LeaveIfError( file.Open( fileServer, aConfig, EFileRead | EFileShareAny ) );
+    CleanupClosePushL( file );
+
+    TInt size( 0 );
+    User::LeaveIfError( file.Size( size ) );
+
+    const TInt tmpSize = KMaxName; // 128
+    TInt offset( 0 ); // Offset value to parts reading
+
+    // Indications for tags
+    TBool start_tag_found( EFalse );
+    TBool end_tag_found( EFalse );
+    // Offset values for start and end position parsing
+    TInt offset_start( 0 );
+    TInt offset_end( 0 );
+
+    /* Search is combined to section that include tags. After this create new
+    combined section that include second buffer data and new buffer data.
+    Section:     1) 1+2
+                 2) 2+1
+                 2) 1+2 etc. This should ensure that all data is search.
+    */
+
+    // Construct modifiable heap-based descriptor. tmp1 to CleanupStack
+    // This for first data buffer
+    HBufC8* tmp1 = HBufC8::NewLC( tmpSize );            // 128
+    TPtr8 buf1 = tmp1->Des();
+
+    // Construct modifiable heap-based descriptor. tmp2 to CleanupStack
+    // This for second data buffer
+    HBufC8* tmp2 = HBufC8::NewLC( tmpSize );            // 128
+    TPtr8 buf2 = tmp2->Des();
+
+    // Construct modifiable heap-based descriptor. tmp3 to CleanupStack
+    // This includes both first and second data buffers
+    HBufC* tmp3 = HBufC::NewLC( tmpSize + tmpSize );    // 256
+    TPtr currentSection = tmp3->Des();
+
+    // Construct modifiable heap-based descriptor. tmp4 to CleanupStack
+    // This is for changing 8 bit to 16 bit
+    HBufC* tmp4 = HBufC::NewLC( tmpSize );              // 128
+    TPtr to16bit = tmp4->Des();
+
+    ret = KErrNone;
+
+    // Read data to buffer 1
+    // tmp4, tmp3, tmp2 and tmp1 are in CleanupStack => Leave OK
+    // CleanupClosePushL is used to fileServer and file => Leave OK
+    User::LeaveIfError( file.Read( offset, buf1, tmpSize ) );
+
+    // For next buffer reading
+    offset += tmpSize;
+
+    // Read data to buffer 2
+    // tmp4, tmp3, tmp2 and tmp1 are in CleanupStack => Leave OK
+    // CleanupClosePushL is used to fileServer and file => Leave OK
+    User::LeaveIfError( file.Read( offset, buf2, tmpSize ) );
+
+    // 8 bit to 16. Create first combined buffer 1 and buffer 2 that
+    // is used for searching.
+    to16bit.Copy( buf1 );
+    currentSection.Copy( to16bit );
+    to16bit.Copy( buf2 );
+    currentSection.Append( to16bit );
+
+    // Check if small files to be parsed(e.g. settings + one short case).
+    TInt bigsize( 0 );
+    // Check if parsed section is smaller than 256
+    if( size <  ( tmpSize + tmpSize ) )
+        {
+        bigsize = size;
+        }
+    else
+        {
+        bigsize = tmpSize + tmpSize;    // 256
+        }
+
+    do
+        {
+        // Start the next buffer reading
+        offset += tmpSize;
+
+        // Search the start tag
+        ret = currentSection.Find( KStifSettingsStartTag );
+        if( ret != KErrNotFound )
+            {
+            // Succesfully search, take the start offset
+            ret = file.Seek( ESeekCurrent, offset_start );
+            if( ret == KErrNone )
+                {
+                start_tag_found = ETrue;
+                // Current section is end so offset to beging of the 
+                // combined section.
+                offset_start = ( offset_start - ( bigsize ) );
+                }
+            }
+        // Search the end tag
+        ret = currentSection.Find( KStifSettingsEndTag );
+        if( ret != KErrNotFound )
+            {
+            // Succesfully search, take the end offset
+            ret = file.Seek( ESeekCurrent, offset_end );
+            if( ret == KErrNone )
+                {
+                end_tag_found = ETrue;
+                }
+            }
+
+        // Both start and end tags are founded, start parsing sizes.
+        if( start_tag_found && end_tag_found )
+            {
+            TInt length = ( offset_end - offset_start );
+
+            // Construct modifiable heap-based descriptor.
+            // setting_buf to CleanupStack
+            HBufC8* setting_buf = HBufC8::NewLC( length );// 8 bit for reading
+            TPtr8 setting8 = setting_buf->Des();
+
+            // Construct modifiable heap-based descriptor.
+            // setting_buf2 to CleanupStack
+            HBufC* setting_buf2 = HBufC::NewLC( length );// 16 bit for parsing
+            TPtr setting16 = setting_buf2->Des();
+
+            // Read data from the founded STIF settings sections
+            ret = KErrNone;
+            // HBufCs are in CleanupStack => Leave OK
+            // CleanupClosePushL is used to fileServer and file => Leave OK
+            User::LeaveIfError( file.Read( offset_start, setting8, length ) );
+
+            // Section 8 bit to 16.
+            setting16.Copy( setting8 );
+
+            // Start create parser for parsing heap and stack sizes.
+            // NOTE: Comments are parsed away from the section.
+            CStifParser* parser = NULL;
+            User::LeaveIfNull( parser = CStifParser::NewL( setting16,
+                                        CStifParser::ECStyleComments  ) );
+            CleanupStack::PushL(parser);
+
+            CStifSectionParser* section = NULL;
+            User::LeaveIfNull( section = parser->SectionL( KStifSettingsStartTag,
+                                                   KStifSettingsEndTag ) );
+            CleanupStack::PushL(section);
+            TInt lineRet( KErrNone );
+            TInt integer( 0 );
+
+            // Try to get stack size
+            CStifItemParser* itemLine = NULL;
+            TRAPD( parse_ret, itemLine = section->GetItemLineL(
+                                                        KUserDefStackSize ) );
+            if ( parse_ret == KErrNone && itemLine != NULL )
+                {
+                lineRet = itemLine->GetInt( KUserDefStackSize, integer );
+                if ( lineRet == KErrNone )
+                    {
+                    aStackSize = integer;
+                    }
+                }
+            delete itemLine;
+            itemLine = NULL;
+
+            // Try to get minimum heap size
+            TRAP( parse_ret, itemLine = section->GetItemLineL(
+                                                        KUserDefMinHeap ) );
+            if ( parse_ret == KErrNone && itemLine != NULL )
+                {
+                lineRet = itemLine->GetInt( KUserDefMinHeap, integer );
+                if ( lineRet == KErrNone )
+                    {
+                    aHeapMinSize = integer;
+                    }
+                }
+            delete itemLine;
+            itemLine = NULL;
+
+            // Try to get maximum heap size
+            TRAP( parse_ret, itemLine = section->GetItemLineL(
+                                                        KUserDefMaxHeap ) );
+            if ( parse_ret == KErrNone && itemLine != NULL )
+                {
+                lineRet = itemLine->GetInt( KUserDefMaxHeap, integer );
+                if ( lineRet == KErrNone )
+                    {
+                    aHeapMaxSize = integer;
+                    }
+                }
+            delete itemLine;
+
+            CleanupStack::Pop(section);
+            CleanupStack::Pop(parser);
+
+            CleanupStack::PopAndDestroy( setting_buf2 );
+            CleanupStack::PopAndDestroy( setting_buf );
+
+            delete section;
+            delete parser;
+
+            break; // Stop the do branch
+            }
+
+        // Start to create new section for search
+
+        // 8 bit to 16. Last buffer to first
+        to16bit.Copy( buf2 );
+        currentSection.Copy( to16bit );
+
+        // Read new data to buffer 1
+        ret = KErrNone;
+        User::LeaveIfError( file.Read( offset, buf1, tmpSize ) );
+
+        // 8 bit to 16. Append
+        to16bit.Copy( buf1 );
+        currentSection.Append( to16bit );
+
+        // Copy first buffer data to buffer 2. This is added to first
+        // in section in next run
+        buf2.Copy( buf1 );
+
+        } while( offset < size );
+
+    CleanupStack::PopAndDestroy( tmp4 );
+    CleanupStack::PopAndDestroy( tmp3 );
+    CleanupStack::PopAndDestroy( tmp2 );
+    CleanupStack::PopAndDestroy( tmp1 );
+
+    CleanupStack::PopAndDestroy( &file );
+    CleanupStack::PopAndDestroy( &fileServer );
+    file.Close();
+    fileServer.Close();
+
+    //__UHEAP_MARKEND;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: ReadParametersFromTestModule
+
+    Description: Loads dynamically testmodule and calls SetRequirements()-
+                 method for test module parameter handling.
+
+    Parameters: const TDesC& aModuleName: in: Test module name
+                CTestModuleParam*& aTestModuleParam: inout: Object for handling
+                test module parameters.
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::ReadParametersFromTestModule(
+                                const TDesC& aModuleName,
+                                CTestModuleParam*& aTestModuleParam )
+    {
+    __TRACE( KInit, (  _L( "ReadParametersFromTestModule() [%S]" ), &aModuleName ) );
+    RLibrary testModule;
+    // Load the module
+    TPtrC dllName;
+    
+    // Remove optional index appended to module name
+    TFileName validModuleName;
+    RemoveOptionalIndex(aModuleName, validModuleName);
+    __TRACE(KInit, (_L( "Valid module name is [%S] (extracted from [%S])"), &validModuleName, &aModuleName));
+    dllName.Set(validModuleName);
+    
+    // Loading should work with and without '.dll' extension.
+    TInt r = testModule.Load( dllName );
+    if ( r != KErrNone )
+        {
+        __TRACE( KError, ( CStifLogger::EError, _L("Can't initialize test module[%S], code = %d"), &dllName, r ) );
+        return KErrNotFound;
+        }
+    else
+        {
+        // Print reset module name
+        __TRACE( KInit, (  _L("Loaded test module[%S]"), &dllName ) );
+        }
+
+   
+    CTestInterfaceFactoryTestModule libEntry = NULL;
+    
+#if defined( __ARMCC__ )
+        {
+        // In this environment the heap and stack feature may crash if
+        // test module not include a workaround for ARM RVCT(ARMv5) compiler
+        // error. For more information see STIF user guide.
+        __TRACE ( KInit, ( _L( "Workaround for ARM RVCT(ARMv5) compiler error should be included to TestModule." ) ) );
+        }
+#endif // #if defined(__ARMCC__)
+
+    // Get pointer to second exported function
+    // Verify that there is function
+    //CTestInterfaceFactoryTestModule libEntry;
+    libEntry = (CTestInterfaceFactoryTestModule) testModule.Lookup( 2 );
+    if ( libEntry == NULL )
+        {
+        // New instance can't be created
+        __TRACE( KInit, (_L( "Test module is old version and has not SetRequirements() feature." ) ) );
+        testModule.Close();
+        return KErrNotSupported;
+        }
+    else
+        {
+        __TRACE ( KInit, ( _L("Pointer to 2st exported received")));
+        }
+
+    // Calls dynamically loaded module's second method.
+    __TRACE ( KVerbose, (_L("Calling 2st exported at 0x%x"), (TUint32) libEntry ));
+    TUint32 check = 0;
+    TInt ret =  (*libEntry)( aTestModuleParam, check  );
+    if( check != KStifTestModuleParameterChanged  )
+        {
+        // Problems in def-file definitions. Test module is old wersion
+        // and has not SetRequirements feature.
+        RDebug::Print( ( _L( "STIF TF: Test module is old version and has not SetRequirements() feature." ) ) );
+        __TRACE( KInit, (_L( "Test module is old version and has not SetRequirements() feature." ) ) );
+        testModule.Close();
+        return KErrNotSupported;
+        }
+    if( ret != KErrNone )
+        {
+        __TRACE (KInit, (_L("ReadParametersFromTestModule; SetRequirements fails with error: %d"), ret ) );
+        testModule.Close();
+        return ret;
+        }
+
+    libEntry = NULL; 
+    testModule.Close(); // After close test module's pointer is not
+                        // valid anymore.
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: GetTestModuleParams
+
+    Description: Load test module dynamically. If loading is done succesfully
+                 then set test module's parameters according to version.
+                 Verify received parameters.
+
+    Parameters: const TDesC& aModuleName: in: Test module name.
+                const TDesC& aConfig: in: Test case (config) file name.
+                TInt& aStackSize: inout: Stack size.
+                TInt& aHeapMinSize: inout: Heap's minimum size.
+                TInt& aHeapMaxSize: inout: Heap's maximum size.
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModuleContainer::GetTestModuleParams( const TDesC& aModuleName,
+                                                const TDesC& aConfig,
+                                                TInt& aStackSize,
+                                                TInt& aHeapMinSize,
+                                                TInt& aHeapMaxSize )
+    {
+    TInt r( KErrNone );
+
+    // There is lower case despite what is initialization file given.
+    // Module name is without dll extension.
+    // Check is TestScripter or TestCombiner and test case (config) file
+    // name is given.
+    if( ( aModuleName.Find( KTestScripterName ) != KErrNotFound ||
+          aModuleName == _L( "testcombiner" ) ) && aConfig != KNullDesC )
+        {
+        TRAPD( ret, r = ReadParametersFromScriptFileL( aConfig, aStackSize,
+                                          aHeapMinSize, aHeapMaxSize ) );
+        if( r != KErrNone )
+            {
+            __TRACE( KInit, ( CStifLogger::ERed, _L( "Cannot set Test Class's stack or heap sizes, fail with error: %d" ), r ) );
+            __TRACE( KInit, ( _L( "Default sizes will be use(See KTestThreadMinHeap, KTestThreadMinHeap and KStackSize)" ) ) );
+            return r;
+            }
+        if( ret != KErrNone )
+            {
+            __TRACE( KInit, ( CStifLogger::ERed, _L( "Cannot set Test Class's stack or heap sizes, leaves with error: %d" ), r ) );
+            __TRACE( KInit, ( _L( "Default sizes will be use(See KTestThreadMinHeap, KTestThreadMinHeap and KStackSize)" ) ) );
+            return ret;
+            }
+        }
+    else
+        {
+        CTestModuleParam* testModuleParam = NULL;
+        //--PYTHON-- begin
+        if(aModuleName.Find(KPythonScripter) != KErrNotFound)
+            {
+			RDebug::Print(_L("CTestModuleContainer::GetTestModuleParams reading params for PythonScripter, aModuleName=[%S]"), &aModuleName);
+            TName n;
+            n.Copy(KPythonScripter);
+            r = ReadParametersFromTestModule( n, testModuleParam );
+            }
+        else
+        //--PYTHON-- end
+            r = ReadParametersFromTestModule( aModuleName, testModuleParam );
+
+        if( r != KErrNone )
+            {
+            __TRACE( KInit, ( _L( "Cannot set Test Module's stack or heap sizes, fails with: %d" ), r ) );
+            __TRACE( KInit, ( _L( "Default sizes will be use(See KTestThreadMinHeap, KTestThreadMinHeap and KStackSize)" ) ) );
+            delete testModuleParam;
+            return r;
+            }
+
+        if ( testModuleParam->Version() == 1 )
+            {
+            // Casting
+            CTestModuleParamVer01* paramVer01 = ( CTestModuleParamVer01* ) testModuleParam;
+            aStackSize = paramVer01->iTestThreadStackSize;
+            aHeapMinSize = paramVer01->iTestThreadMinHeap;
+            aHeapMaxSize = paramVer01->iTestThreadMaxHeap;
+            }
+
+        delete testModuleParam;
+        }
+
+    // Verify that sizes are valid. If problems are notices then use default 
+    // value
+
+    // 1) "The panic occurs when the value of the stack size is negative."
+    if( aStackSize < 0 )
+        {
+        RDebug::Print( ( _L("STIF TF: GetTestModuleParams() fails because value of the stack size is negative, default value is taken into use") ) );
+        __TRACE( KInit, ( CStifLogger::ERed, _L("STIF TF: GetTestModuleParams() fails because value of the stack size is negative, default value is taken into use" ) ) );
+        // Use default value
+        aStackSize = KStackSize;
+        }
+    
+    // 2) "The panic occurs if the minimum heap size specified is less
+    // than KMinHeapSize".
+    // KMinHeapSize: "Functions that require a new heap to be allocated will
+    // either panic, or will reset the required heap size to this value if a
+    // smaller heap size is specified".
+    if( aHeapMinSize < KMinHeapSize )
+        {
+        RDebug::Print( _L( "STIF TF: GetTestModuleParams() fails because test module minimum heap size is less than KMinHeapSize:[%d], default value is taken into use" ), KMinHeapSize );
+        __TRACE( KInit, ( CStifLogger::ERed, _L("STIF TF: GetTestModuleParams() fails because test module minimum heap size is less than KMinHeapSize:[%d], default value is taken into use"), KMinHeapSize ) );
+        // Use default value(Note: This is used for now on)
+        aHeapMinSize = KTestThreadMinHeap;
+        }
+
+    // 3) "The panic occurs if the minimum heap size specified is greater than
+    // the maximum size to which the heap can grow".
+    // Check this last !
+    if( aHeapMinSize > aHeapMaxSize )
+        {
+        RDebug::Print( ( _L("STIF TF: GetTestModuleParams() fails because the maximum heap size is specified less than minimum heap size, default values is taken into use" ) ) );
+        __TRACE( KInit, ( CStifLogger::ERed, _L( "STIF TF: GetTestModuleParams() fails because the maximum heap size is specified less than minimum heap size, default values is taken into use" ) ) );
+        // Use default values
+        aHeapMinSize = KTestThreadMinHeap;
+        aHeapMaxSize = KTestThreadMaxHeap;
+        }
+
+    __TRACE( KInit, ( _L( "[%S] uses:" ), &aModuleName ) );
+    __TRACE( KInit, ( _L( "Stack size: [%d]" ), aStackSize ) );
+    __TRACE( KInit, ( _L( "Minimum heap size: [%d]" ), aHeapMinSize ) );
+    __TRACE( KInit, ( _L( "Maximum heap size: [%d]" ), aHeapMaxSize ) );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: GetTestCaseTitleL
+
+    Description: Gets title of currently running test case.
+
+    Parameters: TDes& aTestCaseTitle: out: Test case title.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModuleContainer::GetTestCaseTitleL(TDes& aTestCaseTitle)
+    {
+    //currently run test case stored in the iOperationIntBuffer variable
+    iCTestModule->GetTestCaseTitleL( iOperationIntBuffer, 
+                                     iCTestExecution->GetConfigFileName(),
+                                    aTestCaseTitle);  
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModuleContainer
+
+    Method: GetTestModule
+
+    Description: Gets pointer to test module
+
+    Parameters: none
+
+    Return Values: CTestModule* : Pointer to test module
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestModule* CTestModuleContainer::GetTestModule()
+    {
+    
+    return iCTestModule;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CPrintHandler class member functions.
+    CErrorPrintHandler listens print notifications from test thread.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrintHandler
+
+    Method: NewL
+
+    Description: Constructs a new CErrorPrintHandler object.
+
+    Parameters: CTestExecution& aExecution: in: "Parent"
+
+    Return Values: CErrorPrintHandler*: New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CErrorPrintHandler* CErrorPrintHandler::NewL( CTestModuleContainer& aContainer )
+    {
+
+    CErrorPrintHandler* self = new( ELeave ) CErrorPrintHandler( aContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrintHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CErrorPrintHandler::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrintHandler
+
+    Method: CErrorPrintHandler
+
+    Description: Constructor
+
+    Parameters: CTestModuleContainer& aExecution :in:   "Parent"
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CErrorPrintHandler::CErrorPrintHandler( CTestModuleContainer& aContainer ) :
+    CActive( CActive::EPriorityStandard ),
+    iContainer( aContainer )
+    {
+    
+    CActiveScheduler::Add ( this );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrintHandler
+
+    Method: ~CErrorPrintHandler
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CErrorPrintHandler::~CErrorPrintHandler()
+    {
+
+    Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrintHandler
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CErrorPrintHandler::StartL()
+    {
+    
+    __TRACE( KPrint, ( _L( "CErrorPrintHandler::StartL" ) ) );
+    
+    iStatus = KRequestPending;
+    SetActive();
+    
+    // Signal test thread
+    iContainer.iErrorPrintSem.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrintHandler
+
+    Method: RunL
+
+    Description: Handles thread death.
+    Function does:
+    1 ) Stops monitoring thread
+    1 ) Marks thread death
+    2 ) Completes ongoing requests
+    3 ) Cleans the memory
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CErrorPrintHandler::RunL()
+    {
+
+    __TRACE( KPrint, ( _L( "CErrorPrintHandler::RunL [%d]" ), iStatus.Int() ) );
+    
+    iContainer.DoErrorPrint();    
+    
+    // enable error print request
+    iContainer.iErrorPrintHandler->StartL();
+       
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrintHandler
+
+    Method: DoCancel
+
+    Description: Stops print notification listening.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CErrorPrintHandler::DoCancel()
+    {
+
+    __TRACE( KPrint, ( _L( "CErrorPrintHandler::DoCancel" ) ) );
+
+    // Signal test thread
+    iContainer.iErrorPrintSem.Wait();
+
+    TRequestStatus* status = &iStatus;    
+    User::RequestComplete( status, KErrCancel );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CErrorPrintHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError:                  :in:  Error code
+
+    Return Values:  TInt                            Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CErrorPrintHandler::RunError( TInt aError )
+    {
+    
+    __TRACE( KError,( _L( "CErrorPrintHandler::RunError" ) ) );
+
+    return aError;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: CheckModuleName
+
+    Description: Check is module TestScripter. Does parsing and returns new
+                 module name and error codes(Needed operations when creating
+                 server sessions to TestScripter).
+
+    Parameters: TFileName aModuleName: in: Module name for checking.
+                TFileName& aNewModuleName: inout: Parsed module name.
+
+    Return Values: KErrNone if TestScripter releated module.
+                   KErrNotFound if not TestScripter releated module.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CheckModuleName( TFileName aModuleName, TFileName& aNewModuleName )
+    {
+//--PYTHON-- old code has been replaced with the new one
+/*
+    // Check that length is greated than KTestScripterNameLength
+    if( aModuleName.Length() < KTestScripterNameLength )
+        {
+        return KErrNotFound;
+        }
+    // Check is TestScripter
+    TPtrC check( aModuleName.Mid( 0, KTestScripterNameLength ) );
+    TInt ret = check.Compare( KTestScripterName );
+    if( ret == KErrNone )
+        {
+        aNewModuleName.Copy( aModuleName.Mid( 0, KTestScripterNameLength ) );
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+
+    return KErrNone;
+*/
+
+	// Check that length is greated than KTestScripterNameLength
+	if( aModuleName.Length() >= KTestScripterNameLength )
+		{
+		TPtrC check( aModuleName.Mid( 0, KTestScripterNameLength ) );
+		TInt ret = check.Compare( KTestScripterName );
+		if( ret == KErrNone )
+			{
+			aNewModuleName.Copy( aModuleName.Mid( 0, KTestScripterNameLength ) );
+			return KErrNone;
+			}
+		}
+
+	// Check that length is greated than KTestScripterNameLength
+	if( aModuleName.Length() >= KPythonScripterLength )
+		{
+		TPtrC check( aModuleName.Mid( 0, KPythonScripterLength ) );
+		TInt ret = check.Compare( KPythonScripter );
+		if( ret == KErrNone )
+			{
+			aNewModuleName.Copy( aModuleName.Mid( 0, KPythonScripterLength ) );
+			return KErrNone;
+			}
+		}
+
+    return KErrNotFound;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: RemoveOptionalIndex
+
+    Description: Remove optional index appended to module name.
+                 If it is found (@ char) then set new module name without it.
+                 This feature is used when iSeparateProcesses is set in
+                 TestEngine.
+
+    Parameters: TFileName aModuleName: in: Module name for checking.
+                TFileName& aNewModuleName: inout: Parsed module name.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void RemoveOptionalIndex(const TDesC& aModuleName, TDes& aNewModuleName)
+    {
+    //Copy module name to destination buffer
+    aNewModuleName.Copy(aModuleName);
+    
+    //Search for @ char (it means that some index has been appended)
+    TInt index = aNewModuleName.Find(_L("@"));
+    
+    //Remove index form name (if found)
+    if(index != KErrNotFound)
+        {
+        aNewModuleName.Delete(index, aNewModuleName.Length() - index);
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/TestServer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,976 @@
+/*
+* 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: This module contains implementation of CTestServer 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include "TestEngineClient.h"
+#include <StifTestModule.h>
+#include <stifinternal/TestServerClient.h>
+#include "TestServer.h"
+#include "TestServerCommon.h"
+#include <stifinternal/TestThreadContainerRunnerFactory.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// Struct to pass parameters to server thread
+struct TThreadStartTestServer
+    {
+    TFileName  iName;         // Server name
+    RThread    iServerThread; // The server thread
+    RSemaphore iStarted;      // Startup syncronisation semaphore   
+    TBool      iInNewThread;  // Is thread running in new process?
+    TInt       iStartupResult;// Start-up result
+    TBool      iUiTesting;    // Is it testserver for UI testing
+    CTestThreadContainerRunnerFactory* iTestThreadContainerRunnerFactory; // Pointer to CTestThreadContainerRunner. Defined when
+																		  // iUiTesting is true
+    };
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: PanicServer
+
+    Description: Panics the server. 
+
+    Parameters: const TTestServerPanic aPanic: in: Panic code
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestServer::PanicServer( const TTestServerPanic aPanic )
+    {
+    
+#ifdef USE_LOGGER
+    // Check if logger is available, if so, use it.
+    CStifLogger* log = (CStifLogger*) Dll::Tls();
+    if ( log )
+        {
+        log->Log( CStifLogger::ERed, _L("TestServer.DLL Panic %d"), aPanic);
+        }
+#endif
+
+    RDebug::Print( _L( "CTestServer::PanicServer" ) );
+    _LIT( KTxtTestServer,"CTestServer" );
+    User::Panic( KTxtTestServer,aPanic );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: NewL
+
+    Description: Returns new CTestServer object
+
+    Parameters: const TFileName& aName: in: Server name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation, ConstructL or StartL leaves.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestServer* CTestServer::NewL( const TFileName& aName )
+    {
+
+    CTestServer* self = new( ELeave ) CTestServer();
+    CleanupStack::PushL( self );
+
+    // Construct the server
+    self->ConstructL( aName );
+
+    // Start the server
+    self->StartL( aName );
+
+    CleanupStack::Pop( self );
+
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: ConstructL
+
+    Description: Second level constructor. Obtains pointer to library
+    entrypoint.
+
+    Parameters: const TFileName& aName: in: Server name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if entrypoint can't be obtained.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestServer::ConstructL( const TFileName& aName )
+    {
+    // Construct heap buffer for configuration file
+    iModuleNameBuffer = HBufC::NewL( aName.Length() );
+    iModuleName.Set ( iModuleNameBuffer->Des() );
+    iModuleName.Copy ( aName );
+
+    iContainerIndex = CObjectConIx::NewL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: CTestServer
+
+    Description: Constructor.
+
+    Initialises non-zero member variables and base class with correct
+    priority.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestServer::CTestServer() : CServer2( CTestServer::ETestServerPriority ),
+                             iModuleName(0, 0),
+                             iSessionCount( 0 )
+    {
+    iFirstTime = ETrue;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: ~CTestServer
+
+    Description: Destructor
+    Frees memory.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestServer::~CTestServer()
+    {
+
+    delete iModuleNameBuffer;
+    iModuleNameBuffer = NULL;
+
+    delete iContainerIndex;
+    iContainerIndex = NULL;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: NewContainerL
+
+    Description: Returns new container. Used to store subsessions
+
+    Parameters: None
+
+    Return Values: CObjectCon* New object container
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CObjectCon* CTestServer::NewContainerL()
+    {
+     
+    CObjectCon* container = iContainerIndex->CreateL();
+
+    iSessionCount++;
+
+    return container;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: DeleteContainer
+
+    Description: Deletes a container.
+
+    Parameters: CObjectCon* aContainer: in: Container to be removed
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestServer::DeleteContainer( CObjectCon* aContainer )
+    {
+    iContainerIndex->Remove( aContainer );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: SessionClosed
+
+    Description: Inform Server that session is closed.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestServer::SessionClosed()
+    {
+    // Decrease session count
+    iSessionCount--;
+
+    // Check if last session is closed
+    if ( iSessionCount <= 0 )
+        {
+        // Stop the active scheduler
+        // Execution will continue in ThreadFunction()
+        CActiveScheduler::Stop();
+        }
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: NewSessionL
+
+    Description: Returns new session.
+    
+    Parameters: const TVersion &aVersion: in: Version required
+
+    Return Values: CSharableSession* New session
+
+    Errors/Exceptions: Leaves if invalid version or CTestModule construction
+                       leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CSession2* CTestServer::NewSessionL( const TVersion& aVersion,
+                                        const RMessage2& /*aMessage*/ ) const
+    {
+    // check version is ok
+    TVersion v( KTestServerMajorVersionNumber,
+                KTestServerMinorVersionNumber,
+                KTestServerBuildVersionNumber
+               );
+    if( !User::QueryVersionSupported( v,aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    return CTestModule::NewL( ( CTestServer* ) this );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: ModuleName
+
+    Description: Returns module name
+
+    Parameters: None
+
+    Return Values: const TDesC&* Module name
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestServer::ModuleName() const
+    {
+    return iModuleName;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: FirstTime
+
+    Description: Is module already once initialised.
+
+    Parameters: None
+
+    Return Values: TBool Has module initialized?
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+//@spe const TBool CTestServer::FirstTime() const
+TBool CTestServer::FirstTime() const
+    {
+    return iFirstTime;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: ClearFirstTime
+
+    Description: Clear module first time flag. 
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestServer::ClearFirstTime()
+    {
+    iFirstTime = EFalse;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: ThreadFunction
+
+    Description: The thread function, where Test Server lives in
+    
+    Parameters: TAny* aStarted: in: Start-up information
+    
+    Return Values: TInt Result from test module
+
+    Errors/Exceptions: Clean-up stack can't be created because cannot
+                       leave, error checks are done locally.
+                       Panics if:
+                       invalid start-up information
+                       Test Server can't be started
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestServer::ThreadFunction( TAny* aStarted )
+    {
+
+    __UHEAP_MARK;
+
+    TInt error( KErrNone );
+
+    // Get start-up information
+    TThreadStartTestServer* startInfo = ( TThreadStartTestServer* ) aStarted;
+    __ASSERT_ALWAYS( startInfo,PanicServer( ENoStartupInformation ) );
+
+    // Create clean-up stack
+    CTrapCleanup* tc = CTrapCleanup::New();
+    __ASSERT_ALWAYS( tc, PanicServer(ECreateTrapCleanup));
+
+    // Construct the logger
+    TName path = _L("C:\\logs\\testframework\\testserver\\");
+    TFileName name = _L("testserver_");
+    name.Append ( startInfo->iName );
+
+    // Create logger, in Wins use HTML in HW default logger
+    TLoggerSettings loggerSettings;
+
+    // Directory must create by hand if test server log wanted
+    loggerSettings.iCreateLogDirectories = EFalse;
+
+    loggerSettings.iOverwrite = ETrue;
+    loggerSettings.iTimeStamp = ETrue;
+    loggerSettings.iLineBreak = ETrue;
+    loggerSettings.iEventRanking = EFalse;
+    loggerSettings.iThreadId = EFalse;
+    loggerSettings.iHardwareFormat = CStifLogger::ETxt;
+#ifndef FORCE_STIF_INTERNAL_LOGGING_TO_RDEBUG
+    loggerSettings.iEmulatorFormat = CStifLogger::EHtml;
+    loggerSettings.iHardwareOutput = CStifLogger::EFile;
+    loggerSettings.iEmulatorOutput = CStifLogger::EFile;
+#else
+    RDebug::Print( _L( "STIF Test Server logging forced to RDebug" ) );
+    loggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+    loggerSettings.iHardwareOutput = CStifLogger::ERDebug;
+    loggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
+#endif
+    loggerSettings.iUnicode = EFalse;
+    loggerSettings.iAddTestCaseTitle = EFalse;
+
+    CStifLogger* logger = NULL;
+    TRAP ( error, logger = CStifLogger::NewL( path, name, loggerSettings ) );
+
+    // Thread Local Storage is used for get pointer to logger.
+    Dll::SetTls ( logger );
+
+    __TRACE( KInit,( _L( "TestServer.DLL server starting" ) ) );
+    __TRACE( KInit,( CStifLogger::EBold, _L( "Loading module: %S"), &startInfo->iName ) );
+
+    RLibrary module;
+    TInt ret = KErrNone;
+
+    TFileName newNameBuffer;
+    TInt check = CheckModuleName( startInfo->iName, newNameBuffer );
+    if( check == KErrNone )
+        {
+        // Load the module(TestScripter)
+        ret = module.Load( newNameBuffer );
+        }
+    else
+        {
+        RemoveOptionalIndex(startInfo->iName, newNameBuffer);
+        __TRACE(KInit, (CStifLogger::EBold, _L( "Valid module name is [%S] (extracted from [%S])"), &newNameBuffer, &startInfo->iName));
+        // Load the module(Others)
+        ret = module.Load(newNameBuffer);
+        }
+
+    // If test module loading fails, do not start server
+    if( ret != KErrNone )
+        {
+         __TRACE( KError,( CStifLogger::ERed, _L( "Test module loading failed, code = %d" ), ret ) );
+         __TRACE( KError,( _L( "Check that module is compiled properly and stored to correct directory and all DLLs that it requires are available" ) ) );                  
+
+         // Error will be handled in StartNewServer
+        startInfo->iStartupResult = ret;
+        startInfo->iStarted.Signal();
+        if ( !startInfo->iInNewThread )
+            {
+            startInfo->iStarted.Close();
+            }
+        module.Close();
+        Dll::FreeTls();
+        // Delete logger
+        delete logger;
+        logger = NULL;
+        // Delete clean-up stack
+        delete tc;
+        tc = NULL;
+        __UHEAP_MARKEND;
+        return ret;
+        }
+    else
+        {
+        __TRACE( KInit,( _L( "Test module loaded correctly" ) ) );
+        }
+
+    // Verify that there is function
+    CTestInterfaceFactory libEntry = ( CTestInterfaceFactory ) module.Lookup( 1 );
+    if( libEntry == NULL )
+        {
+         // Error will be handled in StartNewServer
+        __TRACE( KError,( CStifLogger::ERed, _L( "Can't find entrypoint from test module" ) ) );
+
+        startInfo->iStartupResult = KErrNotFound;
+        startInfo->iStarted.Signal();
+        if ( !startInfo->iInNewThread )
+            {
+            startInfo->iStarted.Close();
+            }
+        module.Close();
+        Dll::FreeTls();
+        // Delete logger
+        delete logger;
+        logger = NULL;
+        // Delete clean-up stack
+        delete tc;
+        tc = NULL;
+        __UHEAP_MARKEND;
+        return KErrNotFound;
+        }
+
+    module.Close();
+
+    // Construct and install active scheduler
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    __ASSERT_ALWAYS( scheduler, PanicServer( EMainSchedulerError ) );
+    CActiveScheduler::Install( scheduler );
+
+    // Construct server
+    CTestServer* server = NULL;
+    TRAPD( err, server = CTestServer::NewL( startInfo->iName ) );
+    __ASSERT_ALWAYS( !err, PanicServer( ESvrCreateServer ) );
+
+    server->iUiTestingSupport = startInfo->iUiTesting;
+    server->iTestThreadContainerRunnerFactory = startInfo->iTestThreadContainerRunnerFactory;
+    
+    // Inform that we are up and running
+    startInfo->iStartupResult = KErrNone;
+    startInfo->iStarted.Signal();
+    if ( !startInfo->iInNewThread )
+        {
+        startInfo->iStarted.Close();
+        }
+
+    // Start handling requests
+    CActiveScheduler::Start();
+
+    // Execution continues from here after CActiveScheduler::Stop
+
+    __TRACE( KVerbose,( _L( "TestServer.DLL active scheduler stopped" ) ) );
+
+    // Delete the server
+    delete server;
+    server = NULL;
+    __TRACE( KVerbose,( _L( "TestServer.DLL server object deleted" ) ) );
+
+    delete scheduler;
+    scheduler = NULL;
+    __TRACE( KVerbose,( _L( "Active scheduler deleted" ) ) );
+
+    __TRACE ( KInit, (_L("TestServer.DLL ThreadFunction exiting, server closing")) );
+
+    Dll::FreeTls();
+    // Delete logger
+    delete logger;
+    logger = NULL;
+    // Delete clean-up stack
+    delete tc;
+    tc = NULL;
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: GetServerThreadId
+
+    Description: Returns server thread id
+
+    Parameters: None
+
+    Return Values: TInt : thread id
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestServer::GetServerThreadId()
+    {
+    RThread thread; 
+    return thread.Id();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: GetTestThreadContainerRunnerFactory
+
+    Description: Returns server thread id
+
+    Parameters: None
+
+    Return Values: TInt : thread id
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainerRunnerFactory* CTestServer::GetTestThreadContainerRunnerFactory()
+	{
+	
+	return iTestThreadContainerRunnerFactory;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: UiTesting
+
+    Description: Gets information if testserver supports UI testing
+
+    Parameters: None
+
+    Return Values: True if testserver supports UI testing, False if not.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestServer::IsUiTestingSupported()
+	{	
+	return iUiTestingSupport;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestServer
+
+    Method: GetUiEnvProxy
+
+    Description: Gets UIEnvProxy
+
+    Parameters: None
+
+    Return Values: Pointer to UIEnvProxy.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CUiEnvProxy* CTestServer::GetUiEnvProxy()
+	{
+	
+	return iTestThreadContainerRunnerFactory->GetUiEnvProxy();
+	}
+
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: StartNewServer
+
+    Description: Starts a new server. Server will be running its own
+    thread and this functions returns when server is up and running or
+    server start-up fails.
+
+    Parameters: const TFileName& aModuleFileName: in: Module name
+                TFileName& aServerName: in: Server name
+                const TBool aInNewThread: in: Is new thread
+                RSemaphore aSynchronisation: in: For synchronisation
+                TBool aUiTestingServer: in: Indicates if testserver should support UI testing
+                CTestThreadContainerRunnerFactory* aTestThreadContainerRunnerFactory: in: Pointer to runner factory
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt StartNewServer( const TFileName& aModuleFileName,
+                              TFileName& aServerName,
+                              const TBool aInNewThread,
+                              RSemaphore aSynchronisation,
+                              TBool aUiTestingServer,
+                              CTestThreadContainerRunnerFactory* aTestThreadContainerRunnerFactory
+                            )
+    {
+
+    __UHEAP_MARK;
+
+    //Check server not already started
+    TFindServer findServer( aModuleFileName );
+    TFullName name;
+    if( findServer.Next( name ) == KErrNone )
+        {   
+        // Server already started, nothing to do
+        aServerName = aModuleFileName;
+        __UHEAP_MARKEND;
+        return KErrAlreadyExists;
+        }
+
+    // Construct start-up information object
+    TThreadStartTestServer* startInfo = new TThreadStartTestServer();
+    if( startInfo == NULL )
+        {
+        __UHEAP_MARKEND;
+        return KErrNoMemory;
+        }
+
+    // Fill the start-up information
+    startInfo->iName = aModuleFileName;
+    startInfo->iStartupResult = KErrNone;
+    startInfo->iStarted = aSynchronisation;
+    startInfo->iInNewThread = aInNewThread;
+	startInfo->iUiTesting = aUiTestingServer;
+	startInfo->iTestThreadContainerRunnerFactory = aTestThreadContainerRunnerFactory;
+
+    // EKA1
+    if ( aInNewThread )
+        {
+        // Create thread    
+        TInt res = startInfo->iServerThread.Create( 
+            startInfo->iName ,                       // Name of thread
+            CTestServer::ThreadFunction,             // Thread function
+            KDefaultStackSize,                       // Stack size
+            KDefaultHeapSize,                        // Heap initial size
+            KMaxHeapSize,                            // Heap start max size
+            startInfo                                // Parameter to thread function
+            );
+
+        // If thread creation failed
+        if( res != KErrNone )
+            {
+            startInfo->iStarted.Close();             // Close semaphore
+            delete startInfo;
+            startInfo = NULL;
+            __UHEAP_MARKEND;
+            return res;
+            }
+
+         // Now start thread
+        startInfo->iServerThread.SetPriority( EPriorityMuchMore ); 
+        startInfo->iServerThread.Resume();
+
+        // Wait until the thread is started
+        startInfo->iStarted.Wait();
+
+        // Server is started( or it has returned error )
+    
+
+        }
+
+    // EKA2 and EKA1's HW
+    else
+        {
+        // Call directly thread function, this starts server and
+        // blocks this thread.
+        // Priority is default, not known reason why should be greater
+        // than default priority (Work over a year).
+        CTestServer::ThreadFunction( startInfo );
+        }
+
+    // Set server name
+    aServerName = aModuleFileName;
+
+    // Free memory
+    TInt r = startInfo->iStartupResult;
+    startInfo->iServerThread.Close();
+    startInfo->iStarted.Close();
+    delete startInfo;
+    startInfo = NULL;
+
+    __UHEAP_MARKEND;
+
+    // Return start-up result.
+    return r;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: StartNewServer
+
+    Description: Starts a new server. Server will be running its own
+    thread and this functions returns when server is up and running or
+    server start-up fails.
+
+    Parameters: const TFileName& aModuleFileName: in: Module name
+                TFileName& aServerName: in: Server name
+                const TBool aInNewThread: in: Is new thread
+                RSemaphore aSynchronisation: in: For synchronisation
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt StartNewServer( const TFileName& aModuleFileName,
+                              TFileName& aServerName,
+                              const TBool aInNewThread,
+                              RSemaphore aSynchronisation
+                            )
+	{
+	
+	return StartNewServer( aModuleFileName, aServerName, aInNewThread, aSynchronisation, false, NULL );
+	}
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: StartNewServer
+
+    Description: Starts a new server. Server will be running its own
+    thread and this functions returns when server is up and running or
+    server start-up fails.
+
+    Parameters: const TFileName& aName: in: Module name to be used
+                TFileName& aServerName: out: The name of the server
+
+    Return Values: TInt Error code / KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt StartNewServer( const TFileName& aModuleFileName,
+                              TFileName& aServerName
+                            )
+    {
+
+    __UHEAP_MARK;
+
+    RMutex startupMutex;
+    TInt ret( KErrNone );
+    // Global mutex already created(see CTestEngineServer::ThreadFunction).
+    // Open global mutex.
+    ret = startupMutex.OpenGlobal( KStifTestServerStartupMutex );
+    if( ret != KErrNone )
+        {
+        // Not able to open mutex
+        return ret;
+        }
+
+    startupMutex.Wait();
+
+    //Check server not already started
+    TFindServer findServer( aModuleFileName );
+    TFullName name;
+    if( findServer.Next( name ) == KErrNone )
+        {
+        // Server already started, nothing to do
+        aServerName = aModuleFileName;
+        
+        // release startupmutex
+        startupMutex.Signal();
+        startupMutex.Close();
+
+        __UHEAP_MARKEND;
+        return KErrAlreadyExists;
+        }
+
+    RSemaphore startupSemaphore;
+    startupSemaphore.CreateLocal( 0 );
+
+    // Start server in new thread
+    TInt r = StartNewServer ( aModuleFileName, aServerName, ETrue, startupSemaphore );
+
+    // startupSemaphore will be closed inside StartNewServer when start-up is done.
+
+    // release startupmutex
+    startupMutex.Signal();
+    startupMutex.Close();
+
+    __UHEAP_MARKEND;
+
+    // Return start-up result.
+    return r;
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/TestServerClient.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1102 @@
+/*
+* 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: This module contains implementation of RTestServer, 
+* RTestModule and RTestExecution class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <stifinternal/TestServerClient.h>
+#include "TestServerCommon.h"
+//--PYTHON-- begin
+#include "StifPython.h"
+//--PYTHON-- end
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestServer
+
+    Method: RTestServer
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C RTestServer::RTestServer()
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestServer
+
+    Method: Connect
+
+    Description: Connect method creates new RTestServer session.
+    RTestServer session is used to manage the test case execution.
+    
+    Parameters: const TFileName& aModuleName: in: Module to be loaded
+                const TDesC& aConfigFile: in: Test case(config) file
+                name(Used in TestScripter case for parsing STIF settings).
+
+    Return Values: TInt Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestServer::Connect( const TFileName& aModuleName,
+                                    const TDesC& aConfigFile
+                                    )
+    {
+    TFileName serverName;
+
+    TInt ret = KErrNone;
+
+    // Create global semaphore start-up. It will be indexed (if given name already exsists, index will be increased)
+    RSemaphore startSemaphore;
+    TName semaphoreName = _L("startupSemaphore");
+    semaphoreName.Append( aModuleName );
+    TInt x = 0;
+    RBuf semName;
+    ret = semName.Create(KMaxName);
+    if(ret != KErrNone)
+        {
+        RDebug::Print(_L("RTestServer::Connect() Could not create buffer for semaphore name [%d]"), ret);
+        return ret;
+        }
+    do
+        {
+        semName.Format(_L("%S%d"), &semaphoreName, x);
+        ret = startSemaphore.CreateGlobal(semName, 0);
+        RDebug::Print(_L("RTestServer::Connect() Creating global semaphore [%S] with result [%d]"), &semName, ret);
+        if(ret != KErrAlreadyExists)
+            {
+            semaphoreName.Copy(semName);
+            break;
+            }
+        x++;
+        } while (ETrue);
+    semName.Close();
+    
+    if ( ret != KErrNone )
+        {
+        startSemaphore.Close();
+        return ret;
+        }
+
+    // By default start 'testserverstarter.exe'
+    TFileName pathAndExeModule;
+    if ( aModuleName.Find( _L( "testscripter_ui_" ) ) == 0 ) 
+    	{
+        pathAndExeModule.Copy( KDefaultUiExeName );    	
+    	}
+    else
+    	{
+        pathAndExeModule.Copy( KDefaultExeName );    	
+    	}
+
+    RProcess pr;
+
+    // Data to be passed to new process. It will contain module name and synchronization semaphore name separated with space.
+    // I.e. it will be: "mymodule startupSemaphore0"
+    RBuf data; 
+    ret = data.Create(KMaxName);
+    if(ret != KErrNone)
+        {
+        RDebug::Print(_L("RTestServer::Connect() Could not create buffer for data to be passed to process [%d]"), ret);
+        return ret;
+        }
+    data.Format(_L("%S %S"), &aModuleName, &semaphoreName);
+    RDebug::Print(_L("RTestServer::Connect() Data for new process prepared [%S]"), &data);
+    
+
+    // Indication is Create() operation needed
+    TBool doCreate( ETrue );
+
+    #ifdef __WINS__ // CodeWarrior(emulator)
+        // Create without path(Uses Symbian default path).
+        // Note: If TestScriter used then module name is format:
+        // testscripter_testcasefilename
+        
+        ret = pr.Create( aModuleName, data );
+        if( ret == KErrNone )
+            {
+            RDebug::Print(_L("RTestServer::Connect() Combination (1): Caps modifier [%S], Data [%S]"), &aModuleName, &data);
+            doCreate = EFalse;
+            }
+    #endif // __WINS__
+
+    if ( doCreate )
+        {
+        TInt find_ret( KErrNone );
+        TInt trapd_ret( KErrNone );
+        // Check is TestScripter and is caps modifíer name given
+        if( aModuleName.Find( KTestScripterName ) != KErrNotFound && aConfigFile != KNullDesC )
+            {
+            TInt ret_caps;
+            TFileName capsModifierName;
+            // In TestClass's test case (config) file can give name to caps
+            // modifier module.
+            ret_caps = GetCapsModifier( aConfigFile, capsModifierName );
+            if( ret_caps != KErrNone )
+                {
+                RDebug::Print( _L( "RTestServer::Connect() Caps modifier was not defined. Default modifier will be used" ) );
+                }
+            else
+                {
+                #ifdef __WINS__ // CodeWarrior(emulator)
+                    // Create without path(Uses Symbian default path)
+                    ret = pr.Create( capsModifierName, data );
+                    if( ret == KErrNone )
+                        {
+                        RDebug::Print( _L( "RTestServer::Connect() Combination (2): Caps modifier [%S], Data [%S]"), &capsModifierName, &data);
+                        doCreate = EFalse;
+                        }
+                #endif // __WINS__
+                if ( doCreate )
+                    {
+                    TRAP( trapd_ret, find_ret = FindExeL(
+                                    capsModifierName, pathAndExeModule ) );
+                    }
+                }
+            }
+        //--PYTHON-- begin
+        // If this is python module, use caps modifier
+        else if(aModuleName.Length() >= KPythonScripterLength && aModuleName.Mid(0, KPythonScripterLength).Compare(KPythonScripter) == 0)
+           {
+           pathAndExeModule.Copy(KPythonScripter);
+           }
+        //--PYTHON-- end
+        // Find exe from file system
+        else if( aModuleName != _L( "testcombiner" ) )
+           {
+           // Check if e.g. TestModule.exe is available
+           TRAP( trapd_ret, find_ret = FindExeL( aModuleName, pathAndExeModule  ) );
+           }
+
+        // Check FindExeL error codes
+        if( find_ret != KErrNone )
+			{
+			// Module was not found, using default exe: testserverstarter.exe
+			RDebug::Print( _L( "RTestServer::Connect() Correct caps modifier module not found, capabilities cannot set" ) );
+			if ( aModuleName.Find( _L( "testscripter_ui_" ) ) == 0 ) 
+				{
+				pathAndExeModule.Copy( KDefaultUiExeName );    	
+				}
+			else
+				{
+				pathAndExeModule.Copy( KDefaultExeName );    	
+				}           
+			}
+        if( trapd_ret != KErrNone )
+           {
+           // FindExeL fails
+           RDebug::Print( _L( "RTestServer::Connect() Caps modifier module searching fails with error: %d" ), trapd_ret );
+           startSemaphore.Close();
+           data.Close();
+           return trapd_ret;
+           }
+
+        }
+
+    if ( doCreate )
+        {
+        ret = pr.Create( pathAndExeModule, data );
+        RDebug::Print(
+            _L( "RTestServer::Connect() Combination (3): Caps modifier [%S], Data [%S], Result [%d]" ),
+            &pathAndExeModule, &data, ret );
+        }
+
+    data.Close();
+    
+    if ( ret != KErrNone )
+        {
+        startSemaphore.Close();  
+        return ret;
+        }
+
+    // Process created, continue start-up
+    pr.Resume();
+    pr.Close();
+
+    // Wait until server is started
+    startSemaphore.Wait();
+    startSemaphore.Close();     // Close semaphore
+
+    serverName = aModuleName;
+
+    // Server is up and running, connect to it    
+    ret = CreateSession( serverName, Version() );    
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestServer
+
+    Method: Version
+
+    Description: Return client side version.
+
+    Parameters: None
+
+    Return Values: TVersion: Version number
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TVersion RTestServer::Version() const
+    {
+
+    return( TVersion( KTestServerMajorVersionNumber,
+                       KTestServerMinorVersionNumber, 
+                       KTestServerBuildVersionNumber 
+                     ) );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestServer
+
+    Method: Close
+
+    Description: Closes the RTestServer session.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestServer::Close()
+    {
+
+    // Check that server is connected
+    if( Handle() != 0 )
+        {
+        TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing );
+        SendReceive( ETestServerCloseSession, args );
+        }
+
+    RSessionBase::Close();
+
+    }
+ /*
+-------------------------------------------------------------------------------
+
+    Class: RTestServer
+
+    Method: GetServerThreadId
+
+    Description: Get server thread id
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestServer::GetServerThreadId(TThreadId& aThreadId)
+    {
+
+    TInt ret(0);
+
+    // Check that server is connected
+    if( Handle() != 0 )
+        {
+        TThreadId id;
+        TPckg<TThreadId> threadIdPckg( id );
+        TIpcArgs args( &threadIdPckg, TIpcArgs::ENothing, TIpcArgs::ENothing );
+        ret = SendReceive( ETestServerGetServerThreadId, args );  
+        
+        aThreadId = threadIdPckg();        
+        }
+        
+    return ret;
+
+    }            
+
+EXPORT_C TInt RTestServer::PassEngineSessionSettings( const TEngineSettings& aEngineSessionSettings )
+    {
+    TPckgC<TEngineSettings> engineSessionSettingsBuf( aEngineSessionSettings );    
+    return SendReceive( ETestServerPassEngineSessionSettings, 
+            TIpcArgs( &engineSessionSettingsBuf ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestServer
+
+    Method: FindExeL
+
+    Description: Find exe(CapsModifier) from file system(Used in EKA2)
+
+    Parameters: TFileName aModuleName: in: Module name.
+                TFileName& aPathAndExeModule: inout: Module's exe(CapsModifier)
+                path information.
+
+    Return Values: TBool: Symbian error code: If exe(CapsModifier) is found
+                          return KErrNone else other error code will return.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TBool RTestServer::FindExeL( TFileName aModuleName,
+                                TFileName& aPathAndExeModule )
+    {
+    RFs fsSession;  // For the file session handling
+    RFile file;
+
+    // Connect to file server
+	User::LeaveIfError( fsSession.Connect() ); // Start session
+
+    TDriveList drivelist; 
+	User::LeaveIfError( fsSession.DriveList(drivelist) );
+	// A TDriveList (the list of available drives), is an array of 
+	// 26 bytes. Each byte with a non zero value signifies that the 
+	// corresponding drive is available.
+    TInt driveNumber; 
+	TChar driveLetter;
+    
+	for( driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++ )
+		{
+		if( !drivelist[driveNumber] ) 
+			{
+			// If drive-list entry is zero, drive is not available
+			continue;
+			}
+        User::LeaveIfError(fsSession.DriveToChar(driveNumber,driveLetter));
+
+        aPathAndExeModule.Zero();
+        aPathAndExeModule.Append( driveLetter );
+
+        aPathAndExeModule.Append( _L(":\\sys\\bin\\") );
+
+        aPathAndExeModule.Append( aModuleName );
+        aPathAndExeModule.Append( _L( ".exe" ) );
+
+        TInt found( KErrNone );
+        found = file.Open( fsSession, aPathAndExeModule, EFileRead );
+        if( found == KErrNone )
+            {
+            // exe(capsmodifier module) is founded.
+            file.Close();
+            fsSession.Close();
+            return KErrNone;
+            }
+        }
+
+    // If exe not found use testserverstarter.exe but capabilities cannot
+    // set.
+    if ( aModuleName.Find( _L( "testscripter_ui_" ) ) == 0 ) 
+    	{
+        aPathAndExeModule.Copy( KDefaultUiExeName );    	
+    	}
+    else
+    	{
+        aPathAndExeModule.Copy( KDefaultExeName );    	
+    	}	
+    file.Close();
+    fsSession.Close();
+ 
+    return KErrNotFound;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestServer
+
+    Method: GetCapsModifierName
+
+    Description: Get caps modifier module name from TestScripter's test
+                 case(config) file.
+
+    Parameters: const TDesC& aConfigFile: in: TestScripter's test case(config)
+                file path and name.
+                TFileName& aCapsModifierName: inout: Parsed caps modifier name.
+
+    Return Values: TInt: Symbian error code: Return KErrNone if caps modifier
+                                             module name is successfully parsed
+                                             or given else other error code
+                                             will return.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt RTestServer::GetCapsModifier( const TDesC& aConfigFile,
+                                        TFileName& aCapsModifierName )
+    {
+    // Create parser
+    CStifParser* parser = NULL;
+    TRAPD( err, parser = CStifParser::NewL( _L(""), aConfigFile ) );
+    if( err != KErrNone )
+        {
+        return err;
+        }
+
+    CleanupStack::PushL( parser );
+
+    // Create section
+    CStifSectionParser* section = NULL;
+    TRAP( err, section = parser->SectionL( KStifSettingsStartTag,
+                                            KStifSettingsEndTag ) );
+    if( err != KErrNone || section == NULL)
+        {
+        CleanupStack::PopAndDestroy( parser );
+        return KErrNotFound;
+        }
+
+    CleanupStack::PushL( section );
+
+    // Create item
+    CStifItemParser* item = NULL;
+    TRAP( err, item = section->GetItemLineL( KCapsModifier ) );
+    if( err != KErrNone || item == NULL )
+        {
+        CleanupStack::PopAndDestroy( section );
+        CleanupStack::PopAndDestroy( parser );
+        return KErrNotFound;
+        }
+    CleanupStack::PushL( item );
+
+    // Get caps modifier module name
+    TPtrC capsModifierName;
+    err = item->GetString( KCapsModifier, capsModifierName );
+    if( err != KErrNone )
+        {
+        CleanupStack::PopAndDestroy( item );
+        CleanupStack::PopAndDestroy( section );
+        CleanupStack::PopAndDestroy( parser );
+        return err;
+        }
+
+    aCapsModifierName.Copy( capsModifierName );
+
+    // Remove optional '.EXE' from the name
+    aCapsModifierName.LowerCase();
+    TParse parse;
+    parse.Set( aCapsModifierName, NULL, NULL );
+
+    if ( parse.Ext() == _L(".exe") )
+        {
+        const TInt len = parse.Ext().Length();
+        aCapsModifierName.Delete ( aCapsModifierName.Length()-len, len );
+        }
+
+    CleanupStack::PopAndDestroy( item );
+    CleanupStack::PopAndDestroy( section );
+    CleanupStack::PopAndDestroy( parser );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: Open
+
+    Description: Create new subsession with the RTestServer server
+
+    Parameters: RTestServer& aServer          :inout: Server
+                TFileName& aIniFile           :in:    Initialization file
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestModule::Open( RTestServer& aServer,
+                                 TFileName& aIniFile
+                               )
+    {
+    TIpcArgs args( &aIniFile, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return CreateSubSession( aServer, ETestModuleCreateSubSession, args );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: Close
+
+    Description: Close a subsession
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestModule::Close()
+    {
+
+    RSubSessionBase::CloseSubSession( ETestModuleCloseSubSession );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: EnumerateTestCases
+
+    Description: Enumerates test cases
+
+    Parameters: TFileName aConfigFile         :in:  Configuration file name
+                TCaseSize& aCount             :out: Package for storing count
+                TRequestStatus& aStatus       :out: Status
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestModule::EnumerateTestCases( TDesC& aConfigFile,
+                                               TCaseSize& aCount,
+                                               TRequestStatus& aStatus
+                                             )
+    {
+    TIpcArgs args( &aConfigFile, &aCount, TIpcArgs::ENothing );
+    SendReceive( ETestModuleEnumerateTestCases, args, aStatus );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: GetTestCases
+
+    Description: Get test cases
+
+    Parameters: CFixedFlatArray<TTestCaseInfo>& aTestCaseBuffer :Out:    Cases
+
+    Return Values: TInt                             Return value from operation
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestModule::GetTestCases( CFixedFlatArray<TTestCaseInfo>& aTestCaseBuffer )
+    {
+    TIpcArgs args( &aTestCaseBuffer.Des(), TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestModuleGetTestCases, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: ErrorNotification
+
+    Description: Request error notification
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestModule::ErrorNotification( TErrorNotificationPckg& aError,                                           
+                                              TRequestStatus& aStatus )
+    {
+    TIpcArgs args( &aError, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    SendReceive( ETestModuleErrorNotification, args, aStatus );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: CancelAsyncRequest
+
+    Description: Cancel ongoing request
+
+    Parameters: TInt aReqToCancel             :in:  Request to be cancelled
+
+    Return Values: TInt                             Return value from operation
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestModule::CancelAsyncRequest( TInt aReqToCancel )
+    {
+    TIpcArgs args( aReqToCancel, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestModuleCancelAsyncRequest, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestExecution
+
+    Method: Open
+
+    Description: create new subsession with the RTestModule
+
+    Parameters: RTestServer& aServer          :in:  Handle to server
+                const TInt aCaseNumber        :in:  Case number
+                const TFileName& aConfig      :in:  Configuration file
+
+    Return Values: TInt                             Return value from operation
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::Open( RTestServer& aServer,
+                                    const TInt aCaseNumber,
+                                    const TFileName& aConfig
+                                  )
+    {
+    TIpcArgs args( aCaseNumber, &aConfig, TIpcArgs::ENothing );
+    return CreateSubSession( aServer, ETestExecutionCreateSubSession, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: Close
+
+    Description: close a subsession
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestExecution::Close()
+    {
+
+    // Close subsession
+    RSubSessionBase::CloseSubSession( ETestExecutionCloseSubSession );
+
+    }
+
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestExecution
+
+    Method: RunTestCase
+
+    Description: Runs a test case
+
+    Parameters: TFullTestResultPckg& aResult  :out: Case result
+                TRequestStatus& aStatus       :out: Request to be completed
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void RTestExecution::RunTestCase( TFullTestResultPckg& aResult,
+                                           TRequestStatus& aStatus 
+                                         )
+    {
+    TIpcArgs args( &aResult, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    SendReceive( ETestExecutionRunTestCase, args, aStatus );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestExecution
+
+    Method: NotifyProgress
+
+    Description: Notify about test case progress, i.e test case prints.
+
+    Parameters: TTestProgressPckg& aProgress  :out: Print info
+                TRequestStatus& aStatus       :out: Request to be completed
+
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::NotifyProgress( TTestProgressPckg& aProgress,
+                                              TRequestStatus& aStatus 
+                                            )
+    {
+    TIpcArgs args( &aProgress, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    SendReceive( ETestExecutionNotifyProgress, args, aStatus );
+    return KErrNone;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: Pause
+
+    Description: Pauses a test case
+
+    Parameters: None
+
+    Return Values: TInt                             Return value from operation
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::Pause()
+    {
+    TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestExecutionPause, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: Resume
+
+    Description: Resumes a test case
+
+    Parameters: None
+
+    Return Values: TInt                             Return value from operation
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::Resume()
+    {
+    TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestExecutionResume, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: CancelAsyncRequest
+
+    Description: Cancels an asynchronous request.
+
+    Parameters: TInt aReqToCancel             :in:  Request to be cancelled.
+
+    Return Values: TInt                             Return value from operation
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::CancelAsyncRequest( TInt aReqToCancel )
+    {
+    TIpcArgs args( aReqToCancel, TIpcArgs::ENothing, TIpcArgs::ENothing );
+    return SendReceive( ETestExecutionCancelAsyncRequest, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: NotifyEvent
+
+    Description: NotifyEvent is used to receive event requests
+                 from the Test module.
+
+    Parameters: TEventIfPckg& aEvent          :inout:  Event package.
+                TRequestStatus& aStatus       :out:    Request to be completed
+                TInt aError                   :in:     Error from event system
+
+    Return Values: TInt                                Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::NotifyEvent( TEventIfPckg& aEvent,
+                                           TRequestStatus& aStatus,
+                                           TInt aError )
+    {
+    TIpcArgs args( &aEvent, aError, TIpcArgs::ENothing );
+    SendReceive( ETestExecutionNotifyEvent, args, aStatus );
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestModule
+
+    Method: NotifyRemoteCmd
+
+    Description: NotifyRemoteCmd is used to receive RemoteCmd requests
+                 from the Test module.
+
+    Parameters: TRemoteCmdPckg& aRemoteCommand: nout: Remote command's packege.
+                TRemoteCmdType aType: in: Remote type.
+                TRequestStatus& aStatus: inout: Request to be completed
+
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::NotifyRemoteCmd( TStifCommandPckg& aRemoteCommand,
+                                               TPckg<TInt>& aMsgSizePckg,
+                                               TRequestStatus& aStatus )
+    {
+// Construct message
+    TIpcArgs args( &aRemoteCommand, &aMsgSizePckg, TIpcArgs::ENothing );
+    SendReceive( ETestExecutionNotifyRemoteCmd, args, aStatus );
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestExecution
+
+    Method: ReadRemoteCmdInfo
+
+    Description: ReadRemoteCmdInfo is used to receive RemoteCmd requests
+                 from the Test module.
+
+    Parameters: TDesC& aMsg :inout: message.
+                TRemoteCommand aType :in: Remote command's type
+                TInt aError: in: Symbian error code
+
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::ReadRemoteCmdInfo( TDes8& aMsg,
+                                                 TStifCommand aType,
+                                                 TInt aError )
+    {
+    TInt value = 0;
+    if( aError != KErrNone )
+        {
+        value = aError;
+        }
+    else
+        {
+        value = aMsg.Length();
+        }
+
+// Construct message
+    TIpcArgs args( &aMsg, aType, value );
+     // Synchronous method so return a value
+    return SendReceive( ETestExecutionReadRemoteCmdInfo, args );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestExecution
+
+    Method: NotifyCommand
+
+    Description: NotifyCommand is used to receive command requests
+                 from the Test module. DEPRECATED !!
+                 Use NotifyCommand2 instead.
+
+    Parameters: aStifCommandPckg:     command
+                aParam1Pckg:          parameter of command
+                aTestCaseHandlePckg:  handle to test case
+                aStatus:              request status
+                aError:               error
+
+    Return Values: TInt               Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::NotifyCommand(TCommandPckg& /*aCommandPckg*/,
+                                            TBuf8<KMaxCommandParamsLength>& /*aParamsPckg*/,
+                                            TRequestStatus& /*aStatus*/,
+                                            TInt /*aError*/)
+    {
+    /*TIpcArgs args(&aCommandPckg, &aParamsPckg, TIpcArgs::ENothing);
+    SendReceive(ETestExecutionNotifyCommand, args, aStatus);
+    return KErrNone;*/
+    return KErrNotSupported;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: RTestExecution
+
+    Method: NotifyCommand2
+
+    Description: NotifyCommand is used to receive command requests
+                 from the Test module.
+
+    Parameters: aStifCommandPckg:     command
+                aParam1Pckg:          parameter of command
+                aTestCaseHandlePckg:  handle to test case
+                aStatus:              request status
+                aError:               error
+
+    Return Values: TInt               Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt RTestExecution::NotifyCommand2(TCommandPckg& aCommandPckg,
+                                            TDes8& aParamsPckg,
+                                            TRequestStatus& aStatus,
+                                            TInt /*aError*/)
+    {
+    TIpcArgs args(&aCommandPckg, &aParamsPckg, TIpcArgs::ENothing);
+    SendReceive(ETestExecutionNotifyCommand, args, aStatus);
+    return KErrNone;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/TestServerEvent.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,408 @@
+/*
+* 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: <This module contains the implementation of xxx 
+* class member functions...>
+*
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include "TestServerEvent.h"
+#include "TestThreadContainer.h"
+#include "TestServerModuleIf.h"
+#include "Logging.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: TEvent
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    <description of the functionality 
+    description continues and...
+    continues.>
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+		                     description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+TEvent::TEvent( TThreadId aTestThread ) :
+    TEventIf(),
+	iReq(NULL),
+	iThread( aTestThread ),
+	iEventPending(EFalse),
+	iExecution( NULL )
+	{
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: ~TEvent
+
+    Description: Destructor
+    
+    <description of the functionality 
+    description continues and...
+    continues.>
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+		                     description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/    
+TEvent::~TEvent()
+    {
+    // Removed this call, to be studied @js
+    //Release(); //safety
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: Set
+
+    Description: Set event.
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void TEvent::Set( TEventType aEventType )
+    {
+   	iEventPending = ETrue; 
+    iEventType = aEventType;
+    
+   	if( iReq )
+   		{ 
+   		CompletePendingWait( KErrNone );  
+  		if( iEventType == EIndication )
+			iEventPending = EFalse;    		
+    	} 
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: EventPending
+
+    Description: Check event status.
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+TBool TEvent::EventPending()
+	{
+	if( iEventPending )
+		{
+		// Indication events are signaled only once
+		if( iEventType == EIndication )
+			iEventPending = EFalse;
+		return ETrue;
+		}
+	return EFalse;
+	}        
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: WaitEventPending
+
+    Description: Check waiting status.
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+TBool TEvent::WaitEventPending()
+	{
+	if( iReq )
+	    {
+	    return ETrue;
+	    }
+	else
+	    {
+	    return EFalse;
+	    }
+	}        
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: SetWaitPending
+
+    Description: First phase of waiting.
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+TInt TEvent::SetWaitPending( TRequestStatus* aStatus )
+	{	       
+	if( aStatus )
+	    {
+	    iReq = aStatus;
+	    }
+	else
+	    {
+	    iReq = &iRequestStatus;
+	    }
+    __RDEBUG((_L("Set wait pending(%d) %x"), this, iReq ));
+
+    return KErrNone;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: CompletePendingWait
+
+    Description: Complete pending wait.
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void TEvent::CompletePendingWait( TInt aError )
+	{	       
+	_LIT( KTEvent, "TEvent" );
+	__ASSERT_ALWAYS( iReq, User::Panic( KTEvent, KErrGeneral ) );
+	
+	RThread rt;
+    if( rt.Open( iThread ) == KErrNone )
+        {
+        __RDEBUG( (_L("Complete wait(%d) %x"), this, iReq ) );
+        rt.RequestComplete( iReq, aError );
+	    } 
+    rt.Close();
+    iReq = NULL;
+    
+	}
+	
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: Wait
+
+    Description: Wait event.
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void TEvent::Wait()
+    { 
+
+    User::WaitForRequest( iRequestStatus );
+    // else Wait was already completed from other thread
+    EventPending();
+    } 
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: Release
+
+    Description: Release event. Completes conceivably pending unset.
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+void TEvent::Release()
+    { 
+    if( iReq )
+   		{
+   		// Wait is pending and we received Release, 
+   		// so we complete event with Cancel   
+   		CompletePendingWait( KErrCancel );
+   		iEventPending = ETrue;
+    	} 
+    	
+	if( iExecution )
+		{
+
+		iExecution->UnsetEvent( *this, iUnsetMessage );
+		iExecution = NULL;
+		
+		}
+		
+    } 
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: TEvent
+
+    Method: Unset
+
+    Description: Unset event. Unset blocks until Release is called 
+    			(i.e. iUnsetMessage is compeled from release).
+
+    Parameters:	<arg1>: <in/out/inout>: <accepted values>: <Description>
+    
+    Return Values: <value_1: Description
+		            value_n: Description line 1
+			                 description line 2>
+
+    Errors/Exceptions: <description how errors and exceptions are handled>
+
+    Status: Draft
+	
+-------------------------------------------------------------------------------
+*/
+TInt TEvent::Unset( const RMessage2& aMessage, CTestExecution* aExecution )
+    { 
+
+    if( iExecution )
+        {
+    	return KErrAlreadyExists;
+    	}
+
+    if( aExecution == NULL )
+        {
+    	return KErrArgument;
+    	}
+    
+    iExecution = aExecution;	
+    iUnsetMessage = aMessage;
+    
+    return KErrNone;
+    
+    } 
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/TestThreadContainerRunner.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,625 @@
+/*
+* 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: This module contains the implementation of 
+* CTestThreadContainerRunner class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "TestThreadContainerRunner.h"
+#include "ThreadLogging.h"
+#include "TestThreadContainer.h"
+#include "TestServer.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
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: NewL
+
+     Description: NewL is first phase of two-phased constructor.
+
+     NewL is first phase of two-phased constructor.
+
+     Parameters: TThreadId aMainThreadId: in: Main thread id.
+     			 CActiveScheduler* aMainThreadActiveScheduler: in: Pointer to main thread active scheduler.
+     
+     Return Values: Pointer to new CTestThreadContainerRunner object.
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestThreadContainerRunner* CTestThreadContainerRunner::NewL( TThreadId aMainThreadId, 
+		CActiveScheduler* aMainThreadActiveScheduler )
+	{	
+	CTestThreadContainerRunner* self = new(ELeave) CTestThreadContainerRunner();
+	CleanupStack::PushL( self );
+	self->ConstructL( aMainThreadId, aMainThreadActiveScheduler );
+	CleanupStack::Pop( self );
+	
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: CTestThreadContainerRunner
+
+     Description: Default constructor.
+
+	 Default constructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainerRunner::CTestThreadContainerRunner()
+:CActive( EPriorityNormal )
+	{
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: ~CTestThreadContainerRunner
+
+     Description: Default destructor.
+
+	 Default destructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainerRunner::~CTestThreadContainerRunner()
+	{
+	Cancel();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: ConstructL
+
+     Description: Second phase of two-phased constructor.
+
+	 Second phase of two-phased constructor.
+
+     Parameters: TThreadId aMainThreadId: in: Main thread id.
+     			 CActiveScheduler* aMainThreadActiveScheduler: in: Pointer to main thread active scheduler.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::ConstructL( TThreadId aMainThreadId, 
+		CActiveScheduler* aMainThreadActiveScheduler )
+	{
+	User::LeaveIfNull( aMainThreadActiveScheduler );
+	
+	iMainThreadId = aMainThreadId;
+
+	iMainThreadActiveScheduler = aMainThreadActiveScheduler;	
+	aMainThreadActiveScheduler->Add( this );
+	
+	iOperationOngoing.CreateLocal( 0 );
+	
+	iTestThreadContainer = NULL;
+	iCurrentOperation = ENone;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: Setup
+
+     Description: Emulates setup part of CTestThreadContainer::ExecutionThread method
+
+	 Setup is performed in main thread.
+
+     Parameters: CTestModuleContainer* aTestModuleContainer: in: Pointer to test CTestModuleContainer
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::Setup( CTestModuleContainer* aTestModuleContainer )
+	{	
+	iTestModuleContainer = aTestModuleContainer;
+	iCurrentOperation = ESetup;
+	SetActive();
+	CompleteRequest();
+	iOperationOngoing.Wait();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: RunOneIteration
+
+     Description: Emulates one iteration of while loop from CTestThreadContainer::ExecutionThread method
+
+	 Iterations is performed in main thread.
+
+     Parameters: None
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::RunOneIteration()
+	{	
+	iCurrentOperation = ERunOneIteration;
+	SetActive();
+	CompleteRequest();
+	iOperationOngoing.Wait();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: TeareDown
+
+     Description: Emulates teare down part of CTestThreadContainer::ExecutionThread method
+
+	 Teare down is performed in main thread.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::TeareDown()
+	{	
+	iCurrentOperation = ETearDown;
+	SetActive();
+	CompleteRequest();
+	iOperationOngoing.Wait();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: CheckSignalFromSuspend
+
+     Description: Checks if operation change signal was signaled from suspend state.
+
+	 Main part of code is executed in main thread.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::CheckSignalFromSuspend()
+	{
+    if ( iSignalFromSuspend )
+        {
+        iSignalFromSuspend = EFalse;
+        iTestThreadContainer->TestComplete( iReturnCode );
+        }
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: IsReusable
+
+     Description: Checks if test thread is reusable.
+
+	 Checks if test thread is reusable.
+
+     Parameters: None
+     
+     Return Values: True if TestThreadContainer is reusable.
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TBool CTestThreadContainerRunner::IsReusable()
+	{
+	return iReusable;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: ExceptionHandler
+
+     Description: Test thread exception handler.
+
+	 Test thread exception handler.
+
+     Parameters: TExcType aType: in: Exception type.
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::ExceptionHandler ( TExcType aType )
+	{
+	// Kill the current thread, undertaker handles rest
+	RThread current;
+	current.Kill( aType );
+	
+	// This line is never executed, because thread has been killed.
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: RunL
+
+     Description: RunL derived from CActive handles the completed requests.
+
+	 RunL derived from CActive handles the completed requests.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if one of the called method leavs.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::RunL()
+	{
+	switch( iCurrentOperation )
+		{
+		case ESetup:
+			{
+		    TInt error( KErrNone );
+		    
+		    const TUint32 KAll = 0xFFFFFFFF;
+		#ifndef __HIDE_IPC_V1__ // e.g. 7.0s, 8.0a
+		    RThread currentThread;
+		    currentThread.SetExceptionHandler( ExceptionHandler, KAll );
+		#else // PlatSec used. Thread exception management is part of the User class.
+		    User::SetExceptionHandler( ExceptionHandler, KAll );
+		#endif // __HIDE_IPC_V1__
+
+		    // Create cleanup stack
+//		    CTrapCleanup* tc = CTrapCleanup::New();
+//		    __ASSERT_ALWAYS( tc, Panic( ECreateTrapCleanup ) );
+
+		    iTestThreadContainer = NULL;    
+		    TRAPD( err,
+		    	iTestThreadContainer = CTestThreadContainer::NewL( iTestModuleContainer, 
+		    			iTestModuleContainer->ServerThreadId() );
+		        );    
+		    if( err != KErrNone )
+		        {
+		        Panic( ENullTestThreadContainer );
+		        }
+
+		    // Construct the logger
+		    TName path = _L("C:\\logs\\testframework\\testserver\\");
+		    TFileName name = _L("testserver_thread_");  
+		    name.Append( iTestModuleContainer->TestModuleName() );
+
+		    // Create logger, in Wins use HTML in HW default logger
+		    TLoggerSettings loggerSettings;
+
+		    // Directory must create by hand if test server log wanted
+		    loggerSettings.iCreateLogDirectories = EFalse;
+
+		    loggerSettings.iOverwrite = ETrue;
+		    loggerSettings.iTimeStamp = ETrue;
+		    loggerSettings.iLineBreak = ETrue;
+		    loggerSettings.iEventRanking = EFalse;
+		    loggerSettings.iThreadId = EFalse;
+		    loggerSettings.iHardwareFormat = CStifLogger::ETxt;
+		#ifndef FORCE_STIF_INTERNAL_LOGGING_TO_RDEBUG
+		    loggerSettings.iEmulatorFormat = CStifLogger::EHtml;
+		    loggerSettings.iHardwareOutput = CStifLogger::EFile;
+		    loggerSettings.iEmulatorOutput = CStifLogger::EFile;
+		#else
+		    RDebug::Print( _L( "STIF Test Server's thread logging forced to RDebug" ) );
+		    loggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+		    loggerSettings.iHardwareOutput = CStifLogger::ERDebug;
+		    loggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
+		#endif
+		    loggerSettings.iUnicode = EFalse;
+		    loggerSettings.iAddTestCaseTitle = EFalse;
+
+		    TRAP ( error, iTestThreadContainer->SetThreadLogger( CStifLogger::NewL( path, name,
+		                                                            loggerSettings ) ) );
+
+		    iReusable = ETrue;             // Is test module reusable?
+		    iInitialized = EFalse;         // Is module initialized?
+		    iSignalFromSuspend = EFalse;   // Send signal from suspend state?
+		    
+		    iReturnCode = KErrNone;			
+			}
+			break;
+		case ERunOneIteration:
+			{			
+	        iReturnCode = KErrNone;
+	        
+	        switch ( iTestModuleContainer->OperationType() )
+	            {
+	            // Test module initialisation
+	            case CTestModuleContainer::EInitializeModule:
+	                {
+	                __ASSERT_ALWAYS ( !iInitialized,
+	                                  Panic( EReInitializingTestModule ) );
+
+	                // Initialize module
+	                if ( iTestThreadContainer->InitializeModuleInThread( iModule ) == KErrNone )
+	                    {
+	                    iInitialized = ETrue;
+	                    }
+
+	                iSignalFromSuspend = ETrue;
+	                break;
+	                }
+
+	            // Test case enumeration
+	            case CTestModuleContainer::EEnumerateInThread:
+	                {
+	                __ASSERT_ALWAYS ( iInitialized,
+	                                  Panic( ETestModuleNotInitialized ) );
+	                iReturnCode = iTestThreadContainer->EnumerateInThread();
+
+	                iSignalFromSuspend = ETrue;
+	                break;
+	                }
+
+	            // Free test case enumeration data
+	            case CTestModuleContainer::EFreeEnumerationData:
+	                {
+	                __ASSERT_ALWAYS ( iInitialized,
+	                                  Panic( ETestModuleNotInitialized ) );
+	                iTestThreadContainer->FreeEnumerationDataInThread ();
+	                
+	                iSignalFromSuspend = ETrue;
+	                break;
+	                }
+
+	            // Execute test case
+	            case CTestModuleContainer::EExecuteTestInThread:
+	                {
+	                __ASSERT_ALWAYS ( iInitialized,
+	                                  Panic( ETestModuleNotInitialized ) );
+	                iReturnCode = iTestThreadContainer->ExecuteTestCaseInThread ();
+
+	                iSignalFromSuspend = ETrue;
+	                break;
+	                }
+
+	            // Exiting (i.e test server is unloading)
+	            case CTestModuleContainer::EExit:
+	                {
+	                iReusable = EFalse;
+	                break;
+	                }
+
+	            // Illegal state
+	            default:
+	                {
+	                Panic( EInvalidTestModuleOperation );
+	                }
+	            }
+			}
+			break;
+		case ETearDown:
+			{
+			iTestThreadContainer->DeleteTestModule();
+
+		    // Close handle to module. No function calls to test
+		    // module are possible after this line.
+			iModule.Close();
+
+		    // Delete logger    
+			CStifLogger* threadLogger = iTestThreadContainer->GetThreadLogger();
+			iTestThreadContainer->SetThreadLogger( NULL );
+			delete threadLogger;
+			threadLogger = NULL;
+
+		    // Delete clean-up stack.
+//		    delete tc;
+//		    tc = NULL;
+			
+		    // Operation completed ( = Exit completed )
+		    iTestThreadContainer->TestComplete( KErrNone );
+		    
+		    delete iTestThreadContainer;
+			}
+			break;
+		}
+		
+	iCurrentOperation = ENone;
+	iOperationOngoing.Signal();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: Panic
+
+     Description: Raises panic.
+
+	 Raises panic.
+
+     Parameters: TInt aReason: in: Panic reason.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::Panic( TInt aReason )
+    {    
+    RDebug::Print( _L("CTestThreadContainer::Panic %d"), aReason );    
+    User::Panic( _L("CTestThreadContainer::Panic"), aReason );    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: DoCancel
+
+     Description: DoCancel derived from CActive handles the Cancel.
+
+	 DoCancel derived from CActive handles the Cancel.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::DoCancel()
+	{
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunner
+
+     Method: CompleteRequest
+
+     Description: Complets current operation request.
+
+     Complets current operation request, what causes execution of RunL method 
+     in main thread of UITestServerStarter.
+
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunner::CompleteRequest()
+	{
+	iStatus = KRequestPending;
+	TRequestStatus* statusPtr = &iStatus;		            	
+	RThread mainThread;
+	User::LeaveIfError( mainThread.Open( iMainThreadId ) );
+	mainThread.RequestComplete( statusPtr, KErrNone );
+	mainThread.Close();	
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/TestThreadContainerRunnerFactory.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,368 @@
+/*
+* 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: This module contains the implementation of 
+* CTestthreadContainerRunnerFactory class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <stifinternal/TestThreadContainerRunnerFactory.h>
+#include "TestThreadContainerRunner.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
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: NewL
+
+     Description: NewL is first phase of two-phased constructor.
+
+	 NewL is first phase of two-phased constructor.
+
+     Parameters: TThreadId aThreadId: in: main thread id.
+     			 CActiveScheduler* aScheduler: in: Pointer to main thread active scheduler.
+     			 CUiEnvProxy* aUiEnvProxy: in: Pointer to UIEnvProxy.
+     
+     Return Values: Pointer to new CTestServerThreadStarter object.
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestThreadContainerRunnerFactory* 
+CTestThreadContainerRunnerFactory::NewL( TThreadId aThreadId, CActiveScheduler* aScheduler, CUiEnvProxy* aUiEnvProxy )
+	{
+	CTestThreadContainerRunnerFactory* self = 
+		new(ELeave)CTestThreadContainerRunnerFactory();
+	CleanupStack::PushL( self );
+	self->ConstructL( aThreadId, aScheduler, aUiEnvProxy );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: CTestThreadContainerRunnerFactory
+
+     Description: Default constructor.
+
+	 Default constructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainerRunnerFactory::CTestThreadContainerRunnerFactory()
+:CActive( EPriorityNormal ),
+iTestThreadContainerRunner( NULL ),
+iOperation( ENone )
+	{
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: ~CTestThreadContainerRunnerFactory
+
+     Description: Default destructor.
+
+	 Default destructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainerRunnerFactory::~CTestThreadContainerRunnerFactory()
+	{
+	Cancel();
+	iOperationEndSemaphore.Close();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: ConstructL
+
+     Description: Second phase of two-phased constructor.
+
+	 Second phase of two-phased constructor.
+
+     Parameters: TThreadId aThreadId: in: main thread id.
+     			 CActiveScheduler* aScheduler: in: Pointer to main thread active scheduler.
+     			 CUiEnvProxy* aUiEnvProxy: in: Pointer to UIEnvProxy.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunnerFactory::ConstructL( TThreadId aThreadId, CActiveScheduler* aScheduler, CUiEnvProxy* aUiEnvProxy )
+	{
+	User::LeaveIfNull( aScheduler );
+	iThreadId = aThreadId;
+	iScheduler = aScheduler;
+	iUiEnvProxy = aUiEnvProxy;
+	
+	TInt ret = iOperationEndSemaphore.CreateLocal( 0 );
+	if ( ret != KErrNone )
+		{
+		User::Leave( ret );
+		}
+	
+	iScheduler->Add( this );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: DeleteL
+
+     Description: Performs creation of CTestThreadContainerRunner object.
+
+	 Performs creation of CTestThreadContainerRunner object.
+
+     Parameters: CTestThreadContainerRunner* aTestThreadContainerRunner: in: Pointer to 
+     				CTestThreadContainerRunner object which needs to be deleted.
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if one of the called method leavs.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestThreadContainerRunner* CTestThreadContainerRunnerFactory::CreateL()
+	{
+	if ( IsActive() )
+		{
+		User::Panic( _L( "E32USER-CBase" ), 42 );
+		}
+
+	iOperation = ECreate;
+	iStatus = KRequestPending;
+	
+	RThread thread;
+	TInt ret = thread.Open( iThreadId );
+	if ( ret != KErrNone )
+		{
+		User::Leave( ret );
+		}
+	
+	SetActive();
+	TRequestStatus* statusPtr = &iStatus;
+	thread.RequestComplete( statusPtr, KErrNone );
+	thread.Close();
+	iOperationEndSemaphore.Wait();
+
+	return iTestThreadContainerRunner;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: DeleteL
+
+     Description: Performs deletion of CTestThreadContainerRunner object.
+
+	 Performs deletion of CTestThreadContainerRunner object.
+
+     Parameters: CTestThreadContainerRunner* aTestThreadContainerRunner: in: Pointer to 
+     				CTestThreadContainerRunner object which needs to be deleted.
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if one of the called method leavs.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunnerFactory::DeleteL( CTestThreadContainerRunner* aTestThreadContainerRunner )
+	{
+	if ( IsActive() )
+		{
+		User::Panic( _L( "E32USER-CBase" ), 42 );
+		}
+	
+	iOperation = EDelete;
+	iStatus = KRequestPending;
+	
+	RThread thread;
+	TInt ret = thread.Open( iThreadId );
+	if ( ret != KErrNone )
+		{
+		User::Leave( ret );
+		}
+	
+	iTestThreadContainerRunner = aTestThreadContainerRunner;
+	SetActive();
+	TRequestStatus* statusPtr = &iStatus;
+	thread.RequestComplete( statusPtr, KErrNone );
+	thread.Close();
+	iOperationEndSemaphore.Wait();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: RunL
+
+     Description: RunL derived from CActive handles the completed requests.
+
+	 RunL derived from CActive handles the completed requests.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if one of the called method leavs.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunnerFactory::RunL()
+	{
+	switch( iOperation )
+		{
+		case ECreate:
+			{
+			iTestThreadContainerRunner = CTestThreadContainerRunner::NewL( iThreadId, iScheduler );
+			}
+			break;
+		case EDelete:
+			{
+			delete iTestThreadContainerRunner;
+			iTestThreadContainerRunner = NULL;
+			}
+			break;
+		default:
+			{
+			User::Panic( _L("STIFInternalError"), KErrNotFound );
+			}			
+			break;
+		}
+	iOperation = ENone;
+	iOperationEndSemaphore.Signal();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: DoCancel
+
+     Description: DoCancel derived from CActive handles the Cancel.
+
+	 DoCancel derived from CActive handles the Cancel.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestThreadContainerRunnerFactory::DoCancel()
+	{	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestThreadContainerRunnerFactory
+
+     Method: GetUiEnvProxy
+
+     Description: Gets UIEnvProxy.
+
+     Parameters: None.
+     
+     Return Values: Pointer to UIEnvProxy.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUiEnvProxy* CTestThreadContainerRunnerFactory::GetUiEnvProxy()
+	{
+	return iUiEnvProxy;
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/Testexecution.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4826 @@
+/*
+* 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: This module contains implementation of CTestExecution 
+* class member functions. CTestExecution class handles a test 
+* execution subsession specific operations.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include "TestEngineClient.h"
+#include "StifTFwIfProt.h"
+#include <stifinternal/TestServerClient.h>
+#include "TestServer.h"
+#include "TestServerModuleIf.h"
+#include "TestServerCommon.h"
+#include "PrintQueue.h"
+#include "TestServerEvent.h"
+#include "TestThreadContainer.h"
+#include "STIFMeasurement.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: NewL
+
+    Description: Returns new CTestExecution instance.
+
+    Parameters: CTestModule* aModuleSession   :in:  "Parent" module
+                TInt aCaseNumber              :in:  Test case number
+                const TFileName& aConfig      :in:  Configuration filename
+
+    Return Values: CTestExecution*                  New instance
+
+    Errors/Exceptions: Function leaves if memory allocation fails or
+                       CTestExecution construction leaves.
+                       Panics is aModuleSession is NULL.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestExecution* CTestExecution::NewL( CTestModule* aModuleSession,
+                                      TInt aCaseNumber, 
+                                      const TFileName& aConfig )
+    {
+
+    __ASSERT_ALWAYS ( aModuleSession, 
+                      CTestServer::PanicServer( ENullModuleSession ) );
+
+    CTestExecution* self=new( ELeave ) CTestExecution;
+    CleanupClosePushL( *self );
+    self->ConstructL( aModuleSession, aCaseNumber, aConfig );
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CTestExecution
+
+    Description: Constructor.
+    Initialises member variables whose default state is not zero or NULL.
+
+    Parameters:  None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CTestExecution::CTestExecution() : 
+    iConfig( 0, 0 ),
+    iTestThreadOpen( EFalse ),
+    iTestThreadFailure( ETestThreadOk )
+    {
+
+    iPrintNotifyAvailable = EFalse;
+    iThreadState = ENotStarted;
+    iRemoteSendAvailable = EFalse;
+    iRemoteReceiveAvailable = EFalse;
+    iEventNotifyAvailable = EFalse;
+    iCommandNotifyAvailable = EFalse;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: ~CTestExecution
+
+    Description: Destructor
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: Panics is threadmutex is taken.
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTestExecution::~CTestExecution()
+    {
+    // Cancel (remove) all requested events of current test case
+    REventSystem es;
+    es.RemoveInRequestedState(reinterpret_cast<TInt>(this));
+
+    // Thread must be stopped before CTestExecution can be deleted
+    if( iThreadState == EOnGoing ) 
+		{
+			if( iModuleContainer != NULL )
+				{
+				iModuleContainer->KillThread( KErrCancel );
+				}
+			delete iModuleContainer;
+			iModuleContainer = NULL;
+			CTestServer::PanicServer( EClosingWhileTestRunning );
+		}
+
+    delete iPrintHandler;
+    iPrintHandler = NULL;
+    delete iEventHandler;
+    iEventHandler = NULL;
+    delete iSndHandler;
+    iSndHandler = NULL;
+    delete iRcvHandler;
+    iRcvHandler = NULL;
+    delete iInterferenceHandler;
+    iInterferenceHandler = NULL;
+    delete iMeasurementHandler;
+    iMeasurementHandler = NULL;
+    delete iCommandHandler;
+    iCommandHandler = NULL;
+
+    // Test interference array(Needed cases when test interference thread is
+    // needed to Kill())
+    iSTIFTestInterferenceArray.Reset();
+    iSTIFTestInterferenceArray.Close();
+
+    // Reset test measurement array
+    iMeasurementHandlingArray.Reset();
+    iMeasurementHandlingArray.Close();
+
+    // iPrintQueue must be emptied here, because it items are allocated from server heap
+    delete iPrintQueue;
+    iPrintQueue = NULL;
+
+    // Delete name buffer
+    delete iConfigNameBuffer;
+    iConfigNameBuffer = NULL;
+    
+    iStateEvents.ResetAndDestroy();
+    iStateEvents.Close();
+
+    iEventArray.ResetAndDestroy();
+    iEventArray.Close();
+
+    // Close mutexes
+    if ( iPrintMutex.Handle() != 0 ) iPrintMutex.Close();
+    if ( iEventMutex.Handle() != 0 ) iEventMutex.Close();
+    if ( iSndMutex.Handle() != 0 ) iSndMutex.Close();
+    if ( iRcvMutex.Handle() != 0 ) iRcvMutex.Close();
+    if ( iInterferenceMutex.Handle() != 0 ) iInterferenceMutex.Close();
+    if ( iMeasurementMutex.Handle() != 0 ) iMeasurementMutex.Close();
+    if ( iCommandMutex.Handle() != 0 ) iCommandMutex.Close();
+
+    // Mutex for testcomplete and cancel operations. Close mutex
+    if ( iTestThreadMutex.Handle() != 0 ) iTestThreadMutex.Close();
+
+    // Close semaphores
+    if ( iPrintSem.Handle() != 0 ) iPrintSem.Close();
+    if ( iEventSem.Handle() != 0 ) iEventSem.Close();
+    if ( iSndSem.Handle() != 0 ) iSndSem.Close();
+    if ( iRcvSem.Handle() != 0 ) iRcvSem.Close();
+    if ( iInterferenceSem.Handle() != 0 ) iInterferenceSem.Close();
+    if ( iMeasurementSem.Handle() != 0 ) iMeasurementSem.Close();
+    //if ( iReceiverSem.Handle() != 0 ) iReceiverSem.Close();
+    if ( iCommandSem.Handle() != 0 ) iCommandSem.Close();
+    
+    iMessageQueue.Close();
+    
+    iTestThread.Close();
+
+    delete iCommandDef;
+    iCommandDef = NULL;
+    
+    delete iAsyncEventActive;
+    iAsyncEventActive = NULL;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: ConstructL
+
+    Description: Second level constructor
+
+    Parameters: CTestModule* aModuleSession   :in:  "Parent" module
+                TInt aCaseNumber ::           :in:  Test case number
+                const TFileName& aConfig      :in:  Configuration filename
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::ConstructL( CTestModule *aModuleSession,
+                                 TInt aCaseNumber,
+                                 const TFileName& aConfig )
+    {
+
+    // Get the parameters
+    iModuleSession = aModuleSession;
+    iCaseNumber = aCaseNumber;
+
+    // Construct heap buffer for configuration file
+    iConfigNameBuffer = HBufC::NewL( aConfig.Length() );
+    iConfig.Set ( iConfigNameBuffer->Des() );
+    iConfig.Copy ( aConfig );
+
+    // Create mutexes
+    User::LeaveIfError( iPrintMutex.CreateLocal() );
+    User::LeaveIfError( iEventMutex.CreateLocal() );
+    User::LeaveIfError( iSndMutex.CreateLocal() );
+    User::LeaveIfError( iRcvMutex.CreateLocal() );
+    User::LeaveIfError( iInterferenceMutex.CreateLocal() );
+    User::LeaveIfError( iMeasurementMutex.CreateLocal() );
+    User::LeaveIfError( iCommandMutex.CreateLocal() );
+
+    // Mutex for testcomplete and cancel operations. Create mutex
+    User::LeaveIfError( iTestThreadMutex.CreateLocal() );
+
+    // Create semaphores
+    User::LeaveIfError( iPrintSem.CreateLocal( 0 ) );
+    User::LeaveIfError( iEventSem.CreateLocal( 0 ) );
+    User::LeaveIfError( iSndSem.CreateLocal( 0 ) );
+    User::LeaveIfError( iRcvSem.CreateLocal( 0 ) );
+    User::LeaveIfError( iInterferenceSem.CreateLocal( 0 ) );
+    User::LeaveIfError( iMeasurementSem.CreateLocal( 0 ) );
+    //User::LeaveIfError( iReceiverSem.CreateLocal( 0 ) );
+    User::LeaveIfError( iCommandSem.CreateLocal( 0 ) );
+
+    // Create handlers
+    iPrintHandler = CPrintHandler::NewL( *this );
+    iEventHandler = CEventHandler::NewL( *this );
+    iSndHandler  = CSndHandler::NewL( *this );
+    iRcvHandler  = CRcvHandler::NewL( *this );
+    iInterferenceHandler = CInterferenceHandler::NewL( *this );
+    iMeasurementHandler = CMeasurementHandler::NewL( *this );
+    iCommandHandler = CCommandHandler::NewL( *this );
+
+    // Create print queue
+    iPrintQueue = CPrintQueue::NewL();
+
+    // Start print handler   
+    iPrintHandler->StartL();
+    
+    // Start rcv handler
+    iRcvHandler->StartL();
+
+    // Start interference handler
+    iInterferenceHandler->StartL();
+
+    // Start measurement handler
+    iMeasurementHandler->StartL();
+
+    iCommandDef = CCommandDef::NewL();
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: RunTestCase
+
+    Description: Starts to execute test case in separate thread.
+
+    Parameters: const RMessage& aMessage  :in:      Message from client.
+
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::RunTestCase( const RMessage2& aMessage )
+    {
+
+    __TRACE ( KInit, ( _L( "CTestExecution::RunTestCase in" ) ) );
+
+    // Store message to be completed when case is finished
+    iTestExeMessage = aMessage;
+
+    iFullResult.iStartTime.HomeTime();
+
+    // Get a test module, which executes the test case.
+    // The test module will be freed either when the test case
+    // completes, or the test case is aborted.
+    TInt ret = iModuleSession->GetTestModule( iModuleContainer, iConfig );
+    if ( ret != KErrNone || iModuleContainer == NULL )
+        {
+        _LIT(KRunError,"Can't get test module");
+        __TRACE ( KError, ( CStifLogger::ERed, KRunError() ) );
+        CompleteTestExecution( KErrNone,
+                               TFullTestResult::ECaseException,
+                               ret,
+                               KErrGeneral,
+                               KRunError );
+        return KErrNone;
+        }
+    
+
+    // Thread is created, so all thread specific operations are possible, 
+    // even if thread is not yet resumed, so mark thread to be "Running"
+    SetThreadState ( EOnGoing );
+
+    // Start the test
+    iModuleContainer->SetExecutionSubSession( this );
+    iModuleContainer->RunTestCase( iConfig, iCaseNumber, aMessage );
+
+    __TRACE ( KRunTestCase, ( _L( "CTestExecution::RunTestCase out. Case ongoing" ) ) );
+
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: NotifyPrint
+
+    Description: Handles print request from engine. If print queue is empty,
+                 message is stored to be used later when there is something to
+                 print, otherwise the first queue item is returned and request
+                 completes immediately.
+
+    Parameters: const RMessage& aMessage      :in:  Message from client.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::NotifyPrint( const RMessage2& aMessage )
+    {
+
+    __ASSERT_ALWAYS( iPrintNotifyAvailable == EFalse, 
+                     CTestServer::PanicServer( EPrintQueueBroken ) );
+
+    // Get first item from queue
+    TPrintQueueItem *item = iPrintQueue->Pop();
+
+    if ( item == NULL )
+        {
+
+        // If thread can't print anymore, and queue is empty, then 
+        // complete with Eof, because there will not be any new prints
+        if ( iThreadState == EFinished || iThreadState == ECancelled )
+            {
+            __TRACE ( KPrint, ( _L( "CTestExecution::NotifyPrint to finished thread" ) ) );
+            aMessage.Complete ( KErrEof );
+            }
+        else
+            {
+            // Print request available, do not complete request
+            iNotifyPrintMessage = aMessage;
+            iPrintNotifyAvailable = ETrue;
+            }
+
+        }
+    else
+        {
+        // Construct message
+        TTestProgress progress;
+        progress.iPosition = item->iPriority;
+        progress.iDescription = item->iData1;
+        progress.iText = item->iData2;
+
+        iNotifyPrintMessage = aMessage;
+        // Write message to client space and complete request
+        WritePrint( progress );
+
+        delete item; 
+        }
+
+
+    return KErrNone;
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: DoNotifyPrint
+
+    Description: If print notification available, notification is copied to
+                    client memory space and request is completed.
+                 Else new print queue item is created and appended to print 
+                    queue. If queue is full or memory can't be allocated,
+                    then message will be discarded.
+        
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::DoNotifyPrint()
+    {    
+
+    if ( iPrintNotifyAvailable )
+        {
+        // Write message to client space
+        WritePrint( iProgress );
+        }
+    else
+        {
+
+        TPrintQueueItem *item = 
+            new TPrintQueueItem( iProgress.iPosition, 
+                                 iProgress.iDescription, 
+                                 iProgress.iText );
+
+        if ( item != NULL )
+            {
+            // Item constructed ok, add it to queue
+            if ( iPrintQueue->Push( *item ) != KErrNone )
+                { 
+                // Queue is full, clean-up
+                delete item;
+                }
+            }
+        // else: Could not construct TPrintQueueItem, no free memory.
+        // drop printing            
+        }
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: DoNotifyInterference
+
+    Description: Handles Test Interference thread append and remove operations.
+        
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::DoNotifyInterference()
+    {    
+    // Information for this context => information is in this thread's heap and
+    // if CUndertaker::RunL is called then test interface thread can called
+    // with function call and kill() test interference thread
+
+    // Take information from struct given in 
+    // CTestThreadContainer::AddInterferenceThread or
+    // CTestThreadContainer::RemoveInterferenceThread
+    
+    RThread thread;
+    TInt ret = thread.Open ( iTestInterference.iThreadId );
+    if( ret != KErrNone )
+    	{
+    	RDebug::Print( _L("CTestExecution::DoNotifyInterference %d"), ret );
+        User::Panic( _L("CTestExecution::DoNotifyInterference"), ret );
+    	}
+    
+    if ( iTestInterference.iOperation == TTestInterference::EAppend )
+        {
+        iSTIFTestInterferenceArray.Append( thread );
+        }
+    else if (iTestInterference.iOperation == TTestInterference::ERemove )
+        {
+        // Remove thread from Array.Test interference thread is stopped and killed
+        // successfully
+        for( TInt i = 0; i < iSTIFTestInterferenceArray.Count(); i++ )
+            {
+            if( iSTIFTestInterferenceArray[i].Id() == thread.Id() )
+                {
+                iSTIFTestInterferenceArray.Remove( i );
+                break;
+                }
+            }
+        }
+    else
+        {
+        return;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: DoNotifyMeasurement
+
+    Description: Handles test measurement operations: NewL, Start and Stop.
+        
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::DoNotifyMeasurement()
+    {    
+    // Information for this context => information is in this thread's heap:
+    // From CUndertaker::RunL() or CTestModuleContainer::RunL() method can
+    // handle stop and clean operations if these operations are not done 
+    // before.
+    // Erronous cases(CUndertaker::RunL will be called) or when test case is
+    // executed(CTestModuleContainer::RunL() will be called) there can handle
+    // test measurement stop and clean operation. 
+
+    if( iTestMeasurement.iMeasurementStruct.iMeasurementOperation == 
+                                        CSTIFTestMeasurement::KMeasurementNew)
+        {
+        // Check that same measurement module don't try to create several times
+        // Only one measurement type per test is allowed
+        for( TInt i = 0; i < iMeasurementHandlingArray.Count(); i++ )
+            {
+            if( iMeasurementHandlingArray[i]->iMeasurementModulePtr->MeasurementType() ==
+                        iTestMeasurement.iMeasurementStruct.iMeasurementType )
+                {
+                return KErrAlreadyExists;
+                }
+            }
+
+        TMeasurementHandling* measurementHandling = NULL;
+        measurementHandling = new TMeasurementHandling();
+
+        TBuf<KStifMeasurementTypeLength> modulename;
+        if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 1 )
+            {
+            modulename.Copy( KStifMeasurement01 );
+            }
+        else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 2 )
+            {
+            modulename.Copy( KStifMeasurement02 );
+            }
+        else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 3 )
+            {
+            modulename.Copy( KStifMeasurement03 );
+            }
+        else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 4 )
+            {
+            modulename.Copy( KStifMeasurement04 );
+            }
+        else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 5 )
+            {
+            modulename.Copy( KStifMeasurement05 );
+            }
+        else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 6 )
+            {
+            modulename.Copy( KStifMeasurementBappea );
+            }
+        else
+            {
+            __TRACE( KError, (  _L("CTestExecution::DoNotifyMeasurement(): unknown measurement type" ) ) );
+            return KErrArgument;
+            }
+
+        // Loading should work with and without '.dll' extension.
+        TInt r = measurementHandling->iMeasurementModule.Load( modulename );
+        if ( r != KErrNone )
+            {
+            __TRACE( KError, ( CStifLogger::EError, _L("Can't load test measurement module[%S], code = %d"),
+                &modulename, r ) );
+            delete measurementHandling;
+            return KErrNotFound;
+            }
+        else
+            {
+            //Print test measururement module name
+            __TRACE( KInit, (  _L("Loaded test measurement module[%S]"),
+                &modulename ) );
+            }
+
+        // Get pointer to first exported function
+        // Verify that there is function
+        measurementHandling->iMeasurementLibEntry = (CTestMeasurementFactory) measurementHandling->iMeasurementModule.Lookup( 1 );
+        if ( measurementHandling->iMeasurementLibEntry == NULL )
+            {
+            // New instance can't be created
+            __TRACE( KInit, (_L( "Test measurement module instance cannot create." ) ) );
+            measurementHandling->iMeasurementModule.Close();
+            delete measurementHandling;
+            return KErrNotFound;
+            }
+        else
+            {
+            __TRACE ( KInit, ( _L("Pointer to 1st exported received")));
+            }
+
+        CSTIFTestMeasurementImplementation* measurement;
+        measurement = NULL;
+
+        // initialize test measurement module
+        __TRACE ( KVerbose, (_L("Calling 1st exported at 0x%x"), (TUint32) measurementHandling->iMeasurementLibEntry ));
+        TRAPD ( err, measurement = (*measurementHandling->iMeasurementLibEntry)( 
+                            iTestMeasurement.iMeasurementStruct.iConfigurationInfo, iTestMeasurement.iMeasurementStruct.iMeasurementType ) );
+
+         // Handle leave from test module
+        if ( err != KErrNone )
+            {
+            __TRACE (KError, ( CStifLogger::EError, _L( "Leave when calling 1st exported function, code %d"), err ) );
+            delete measurementHandling;
+            return err;
+            }
+        else if ( measurementHandling->iMeasurementLibEntry == NULL )     // Handle NULL from test measurement
+            {
+            __TRACE (KError, ( CStifLogger::EError, _L( "NULL pointer received when constructing test measurement module" ) ) );
+            delete measurementHandling;
+            // Set error codes
+            return KErrNoMemory;
+            }
+        else
+            {
+            measurementHandling->iMeasurementModulePtr = measurement;
+            __TRACE (KInit, (_L("Entrypoint successfully called, Measurement module instance at 0x%x"),
+                (TUint32)measurementHandling->iMeasurementLibEntry ) );
+            }
+        iMeasurementHandlingArray.Append( measurementHandling );
+        } // End of NewL operations
+
+    else if( iTestMeasurement.iMeasurementStruct.iMeasurementOperation == 
+                                        CSTIFTestMeasurement::KMeasurementStart)
+        {
+        for( TInt i = 0; i < iMeasurementHandlingArray.Count(); i++ )
+            {
+            if( iMeasurementHandlingArray[i]->iMeasurementModulePtr->MeasurementType() == iTestMeasurement.iMeasurementStruct.iMeasurementType )
+                {
+                return iMeasurementHandlingArray[i]->iMeasurementModulePtr->Start();
+                }
+            }
+
+        }
+    else if( iTestMeasurement.iMeasurementStruct.iMeasurementOperation == 
+                                        CSTIFTestMeasurement::KMeasurementStop)
+        {
+        for( TInt i = 0; i < iMeasurementHandlingArray.Count(); i++ )
+            {
+            if( iMeasurementHandlingArray[i]->iMeasurementModulePtr->MeasurementType() == iTestMeasurement.iMeasurementStruct.iMeasurementType )
+                {
+                TInt stop_ret = iMeasurementHandlingArray[i]->iMeasurementModulePtr->Stop();
+                delete iMeasurementHandlingArray[i];
+                iMeasurementHandlingArray.Remove(i);
+                return stop_ret;
+                }
+            }
+        }
+    else 
+        {
+        __TRACE (KError, ( CStifLogger::EError, _L("CTestExecution::DoNotifyMeasurement(): Not supported operation") ) );
+        return KErrNotSupported;
+        }
+    
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: WritePrint
+
+    Description: Writes print notification to client memory space.                 
+        
+    Parameters: const TInt aPriority          :in:  Priority
+                const TStifInfoName& aDes         :in:  Description
+                const TName& aBuffer          :in:  Value
+    
+    Return Values: TInt                             Return value from message write
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::WritePrint( TTestProgress& aProgress )
+    {
+
+    TTestProgressPckg progressPckg( aProgress );
+ 
+    // Write message to client space    
+    TRAPD( res, iNotifyPrintMessage.WriteL( 0, progressPckg ) );
+
+    iPrintNotifyAvailable = EFalse;
+
+    // Complete request with possible error code
+    iNotifyPrintMessage.Complete( res );
+
+    return res;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: NotifyEvent
+
+    Description: Handles event request from engine. 
+
+    ESetEvent and EUnsetEvent change event status. EEnable enables 
+    event notify.
+
+    Parameters: const RMessage& aMessage      :in:  Message from client.
+                    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::NotifyEvent( const RMessage2& aMessage )
+    {   
+
+    TEventIf event;
+    TEventIfPckg eventPckg( event );
+    
+    TRAPD( res, aMessage.ReadL( 0, eventPckg ) );
+
+    if( res != KErrNone )
+        {
+        __TRACE( KError, ( _L( "CTestExecution::NotifyEvent: ReadL failed" ) ));
+        return res;
+        }
+    
+    switch( event.Type() )
+        {
+        case TEventIf::ESetEvent: 
+            {
+            TInt ind = 0;
+            TInt count = iEventArray.Count();
+            for( ind=0; ind < count; ind++ )
+                {
+                if( iEventArray[ind]->Name() == event.Name() )
+                    {
+                    __TRACE( KMessage, ( _L( "CTestExecution::NotifyEvent(%d): SetEvent %S ( count %i )" ), 
+                        this, &event.Name(), count ) );
+                    TEventIf::TEventType etype = TEventIf::EIndication;
+                    // To get state events working with testcombiner
+                    if( ( event.EventType() == TEventIf::EState ) ||                            
+                        ( iEventArray[ind]->EventType() == TEventIf::EState ) )
+                        {
+                        etype = TEventIf::EState;
+                        }
+                    iEventArray[ind]->Set( etype );
+                    }
+                }
+            }
+            break;
+        case TEventIf::EUnsetEvent:
+            { 
+            return UnsetEvent( event, aMessage );
+            }
+        case TEventIf::EEnable:
+            {
+            // Store event message
+            iNotifyEventMessage = aMessage;
+            iEventNotifyAvailable = ETrue;
+            TInt errorFromPreviousCmd =  aMessage.Int1();
+
+            __TRACE( KMessage, ( _L( "CTestExecution::NotifyEvent: enable (%d) notify %d" ), 
+                errorFromPreviousCmd, this ) );
+
+            // Complete previous Event command
+            CompleteEvent( errorFromPreviousCmd );    
+            iEventHandler->StartL();
+            
+            // iNotifyEventMessage is completed from DoNotifyEvent
+            return KErrNone; 
+            }
+        
+        default:
+            __TRACE( KError, ( _L( "CTestExecution::NotifyEvent: Unknown command %i" ), 
+                event.Type() ));
+            return KErrArgument;
+        }
+
+    __TRACE( KMessage, ( _L( "CTestExecution::NotifyEvent(%d): Done" ), this ) );
+
+    aMessage.Complete( KErrNone );
+    //User::After(1000); //Stif-95 This pause is needed to let Info::TestFrameworkEngine thread
+                       //get some processor time and run exactly at this moment (by calling
+                       //CTestEventController::EventCallBack). When Stif is focused on the screen,
+                       //there is no problem if this line is absent, however when another
+                       //application (like screen saver) is focused this is required.
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: DoNotifyEvent
+
+    Description: Forward event request.
+        
+    Parameters: None
+   
+    Return Values: None
+
+    Errors/Exceptions: Panics if event array can't be created
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::DoNotifyEvent()
+    {
+    // Handle asynchronous wait by using asynchronous active object available from stf event system.
+    RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent()"));
+
+    // First check current situation.
+    if(iAsyncEventActive)
+        {
+        RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent() iAsyncEventActive is already created"));
+        if(iAsyncEventActive->IsPending())
+            {
+            RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent() iAsyncEventActive is pending, returning KErrInUse"));
+            return KErrInUse;
+            }
+        else
+            {
+            RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent() iAsyncEventActive is not pending, deleting"));
+            // Event is not in pending state, so it can be deleted because it must be completed
+            delete iAsyncEventActive;
+            iAsyncEventActive = NULL;
+            }
+        }
+    
+    // Check if we deal with asynchronous wait
+    if(!(iEventDef.iEvent.Type() == TEventIf::EWaitEvent && iEventDef.iStatus))
+        {
+        RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent() only state waits will be handled here, returning KErrArgument"));
+        return KErrArgument;
+        }
+    
+    TInt ret = KErrNone;
+    
+    // Create asynchronous object and start query to event server
+    RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent() creating iAsyncEventActive"));
+    TRAP(ret, iAsyncEventActive = CAsyncEventActive::NewL(reinterpret_cast<TInt>(this)));
+    if(ret == KErrNone)
+        {
+        RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent() starting iAsyncEventActive with event name [%S]"), &iEventDef.iEvent.Name());
+        TRAP(ret, iAsyncEventActive->StartL(iEventDef.iStatus, iTestThreadId, iEventDef.iEvent.Name(), NULL);
+                  iEventDef.iStatus = NULL; // iStatus transferred to AO
+            );
+        }
+
+    if(ret == KErrNone)
+        {
+        RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent() restarting iEventHandler"));
+        TRAP(ret, iEventHandler->StartL());
+        }
+        
+    RDebug::Print(_L("STF [ES]: CTestExecution::DoNotifyEvent() finished with [%d]"), ret);
+    return ret;
+        
+    /*
+    TInt ret = KErrNone;
+        
+    switch( iEventDef.iEvent.Type() )
+        {
+        case TEventIf::EReqEvent:
+            {
+            __TRACE( KMessage, 
+                ( _L( "CTestExecution::DoNotifyEvent(%d): ReqEvent %S" ), 
+                    this, &iEventDef.iEvent.Name() ) );
+            ret = RequestEvent( iEventDef.iEvent );
+            // If error, return error, 
+            // otherwise proceed with sending information to engine
+            if( ret != KErrNone )
+                {
+                iEventHandler->StartL();
+                return ret;
+                }
+            }
+            break;
+        case TEventIf::EWaitEvent:
+        case TEventIf::ESetWaitPending:
+            {
+            __TRACE( KMessage, 
+                ( _L( "CTestExecution::DoNotifyEvent(%d): WaitEvent %S" ), 
+                    this, &iEventDef.iEvent.Name() ) );
+            // We return from here, i.e. nothing is sent to engine
+            ret = WaitEvent( iEventDef.iEvent, iEventDef.iStatus );
+            iEventHandler->StartL();
+            return ret;
+            }
+        // Add state events to internal array  
+        case TEventIf::ESetEvent: 
+        case TEventIf::EUnsetEvent:
+            {
+            __TRACE( KMessage, 
+                ( _L( "CTestExecution::DoNotifyEvent(%d): Set/UnsetEvent %S" ), 
+                    this, &iEventDef.iEvent.Name() ) );
+            EventStateChange( iEventDef.iEvent );
+            }
+            break;
+        case TEventIf::ERelEvent:
+            // This is handled later
+            __TRACE( KMessage, 
+                ( _L( "CTestExecution::DoNotifyEvent(%d): RelEvent %S" ), 
+                    this, &iEventDef.iEvent.Name() ) );
+            break;
+        default:
+            iEventHandler->StartL();
+            return KErrArgument;
+        }
+    
+    // Construct message
+    TEventIfPckg eventPckg( iEventDef.iEvent );
+
+    // Write message to client space
+    TRAPD( res, iNotifyEventMessage.WriteL( 0, eventPckg ) );
+
+    if( res != KErrNone )
+        {
+        __TRACE( KError, ( _L( "CTestExecution::DoNotifyEvent: WriteL failed" ) ) );
+        ret = res;
+        }
+    // Complete request
+    // Complete with WriteL result
+    // MUST be done before ERelEvent
+    iEventNotifyAvailable = EFalse;
+    iNotifyEventMessage.Complete( res );
+    User::After(1000); //Stif-95 This pause is needed to let Info::TestFrameworkEngine thread
+                       //get some processor time and run exactly at this moment (by calling
+                       //CTestEventNotifier::RunL). When Stif is focused on the screen,
+                       //there is no problem if this line is absent, however when another
+                       //application (like screen saver) is focused this is required.
+
+    if( iEventDef.iEvent.Type() == TEventIf::ERelEvent )
+        {
+        ret = ReleaseEvent( iEventDef.iEvent );
+        if( ret != KErrNone )
+            {
+            // If error, return immediately
+            return ret;
+            }
+        }
+
+    __TRACE( KMessage, ( _L( "CTestExecution::DoNotifyEvent(%d): Done" ), this ) );
+
+    return ret;
+    */
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: RequestEvent
+
+    Description: Handles TestModule event requests. 
+        
+    Parameters: const TEventIf& aEvent: in: Event requested  
+    
+    Return Values: TInt: Success/Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/    
+TInt CTestExecution::RequestEvent( TEventIf& aEvent )
+    {
+
+    // Requested events are added to iEventArray
+    // There can be multiple simultaneous requests for the same event                    
+    TEvent* event = new TEvent( iTestThreadId );    
+    if( !event )
+        {
+        return KErrNoMemory;
+        }
+    event->Copy( aEvent );
+    if( iEventArray.Append( event ) != KErrNone )
+        {
+        delete event;
+        return KErrNoMemory;
+        }
+        
+    __TRACE( KMessage,( _L( "CTestExecution::DoNotifyEvent: Req added %S ( count %i )" ), 
+         &aEvent.Name(), iEventArray.Count() ));
+    
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: WaitEvent
+
+    Description: Handles TestModule event waits. Waiting is implemented here 
+                and completed in NotifyEvent    
+
+        
+    Parameters: const TEventIf& aEvent: in: Event wait  
+    
+    Return Values: TInt: Success/Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/    
+TInt CTestExecution::WaitEvent( TEventIf& aEvent, TRequestStatus* aStatus )
+    {
+      
+    // Get first "free" event entry from requested events
+    TInt ind = 0;
+    TInt count = iEventArray.Count();
+    TEvent* event = NULL;
+    for( ind=0; ind < count; ind++ )
+        {
+        if( ( iEventArray[ind]->Name() == aEvent.Name() ) &&
+            ( iEventArray[ind]->WaitEventPending() == EFalse ) )
+            {
+            // Found event with correct name and one that is still free
+            // i.e. nobody is waiting for it.
+            event = iEventArray[ind];
+            if( aEvent.Type() == TEventIf::EWaitEvent )
+                {
+                // For EWaitEvent we complete immediately if event is pending
+                if( event->EventPending() )
+                    {
+                    // Event was already pending, so we may return immediately
+                    if( aStatus )
+                        {
+                        TestThreadRequestComplete( aStatus, KErrNone );
+                        }
+                    return KErrNone;           
+                    }
+                }
+            }
+        }
+    if( event == NULL )
+        {
+        // Event is not in the iEventArray, 
+        // so event is not currently requested
+        return KErrNotFound;
+        }
+        
+    __TRACE( KMessage,( _L( "CTestExecution::DoNotifyEvent: Waiting %S ( count %i )" ), 
+        &aEvent.Name(), count ));
+    
+    // Event is not pending so we have to wait for it
+    // Set wait pending            
+    TInt ret = event->SetWaitPending( aStatus );
+    // event cannot be freed by the test module, 
+    // because it is waiting the event, 
+
+    if( ( aStatus == NULL ) &&
+        ( ret == KErrNone ) &&
+        ( aEvent.Type() == TEventIf::EWaitEvent ) ) 
+        {
+        // This is synchronous wait
+        // Go waiting, completed from set event            
+        event->Wait();
+        }
+
+    return ret;
+    
+    } 
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: ReleaseEvent
+
+    Description: Handles TestModule event releases. 
+        
+    Parameters: const TEventIf& aEvent: in: Event released  
+    
+    Return Values: TInt: Success/Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/   
+TInt CTestExecution::ReleaseEvent( TEventIf& aEvent )
+    {
+    
+    // Get last event entry from requested events
+    TInt ind = 0;
+    TInt freeFound = 0;
+    TInt eventIndex = 0;
+    TInt count = iEventArray.Count();
+    for( ind=0; ind < count; ind++ )
+        {
+        if( iEventArray[ind]->Name() == aEvent.Name() )
+            {
+            if( iEventArray[ind]->WaitEventPending() == EFalse )
+                {
+                freeFound++;
+                eventIndex = ind;
+                }
+            }
+        }
+
+    if( freeFound == 0 )
+        {
+        return KErrNotFound;
+        }
+    __TRACE( KMessage,( 
+        _L( "CTestExecution::DoNotifyEvent: Release event %S ( count %i )" ), 
+            &aEvent.Name(), iEventArray.Count() ));
+
+    TEvent* event = iEventArray[eventIndex];
+    iEventArray.Remove( eventIndex );
+    // Release and free event entry
+    event->Release(); 
+
+    // Delete used event entry
+    delete event;
+    
+    return KErrNone;
+}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: UnsetEvent
+
+    Description: Handles TestModule event unsets. 
+        
+    Parameters: const TEventIf& aEvent: in: Event unset  
+    
+    Return Values: TInt: Success/Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::UnsetEvent( TEventIf& aEvent, const RMessage2& aMessage )
+    {
+    
+    TInt ret = KErrNone;
+    TInt ind = 0;
+    TInt count = iEventArray.Count();
+    TBool activeEventReq = EFalse;
+    for( ind=0; ind < count; ind++ )
+        {
+        if( iEventArray[ind]->Name() == aEvent.Name() )
+            {
+             __TRACE( KMessage, ( 
+                _L( "CTestExecution::NotifyEvent(%d): UnsetEvent %S ( count %i )" ), 
+                this, &aEvent.Name(), count ) );
+                
+            ret = iEventArray[ind]->Unset( aMessage, this );
+            if( ret == KErrNone )
+                {
+                activeEventReq = ETrue;
+                }
+            break;
+            }
+        }
+    if( activeEventReq )
+        {
+        // Unset is completed by release   
+        return KErrNone;
+        }
+        
+    // No pending requests or error from unset
+    aMessage.Complete( ret );
+    
+    return KErrNone;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: EventStateChange
+
+    Description: Handles event setting and unsetting. Saves status of
+                state events to enable unsetting of set state events when 
+                killing the testcase abnormally.
+        
+    Parameters: const TEventIf& aEvent: in: Event set/unset  
+    
+    Return Values: TInt: Success/Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/   
+TInt CTestExecution::EventStateChange( TEventIf& aEvent )
+    {
+    
+    TInt ret = KErrNotFound;
+    if( aEvent.EventType() == TEventIf::EState )
+        {
+        
+        TInt count = iStateEvents.Count();
+        TInt index = 0;
+        for(; index < count; index++ )   
+            {
+            TPtrC name = *(iStateEvents[index]);
+            if( name == aEvent.Name() )
+                {
+                break;
+                }
+            } 
+            
+                
+        if( aEvent.Type() == TEventIf::ESetEvent )
+            {
+            if( index < count )
+                {
+                ret = KErrAlreadyExists;
+                }
+            else
+                {
+                // add event to iStateEvents
+                HBufC* name = aEvent.Name().Alloc();
+                if( name == NULL )
+                    {
+                    ret = KErrNoMemory;
+                    }
+                else if( iStateEvents.Append( name ) != KErrNone )
+                    {
+                    delete name;
+                    ret = KErrNoMemory;
+                    }
+                else
+                    {
+                    ret = KErrNone;
+                    }
+                }                
+            }
+        else if( aEvent.Type() == TEventIf::EUnsetEvent )
+            {
+            if( index == count )
+                {
+                ret = KErrNotFound;
+                }
+            else
+                {
+                ret = KErrNone;
+                delete iStateEvents[index];
+                iStateEvents.Remove( index );
+                }
+            }
+        }
+    
+    return ret;
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelEvent
+
+    Description: Cancels pending event request.
+        
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::CancelEvent()
+    {
+    RDebug::Print(_L("STF [ES]: CTestExecution::CancelEvent()"));
+    
+    // Delete AO. This will cancel event if necessary.
+    if(iAsyncEventActive)
+        {
+        RDebug::Print(_L("STF [ES]: CTestExecution::CancelEvent() iAsyncEventActive exists, deleting"));
+        delete iAsyncEventActive;
+        iAsyncEventActive = NULL;
+        }
+
+    iEventHandler->StartL();
+    
+    /*    
+    TInt ret = KErrNotFound;
+
+    __TRACE( KMessage, ( _L( "CTestThreadContainer::CancelEvent(%d): %S [%p]" ), 
+            iEventDef.iEvent.Type(), &iEventDef.iEvent.Name(), iEventDef.iStatus ) );
+
+    switch( iEventDef.iEvent.Type() )
+        {
+        case TEventIf::EReqEvent:
+        case TEventIf::ERelEvent:
+        case TEventIf::ESetEvent:
+        case TEventIf::EUnsetEvent:   
+            CompleteEvent( KErrCancel );  
+            break;
+        case TEventIf::EWaitEvent:
+        case TEventIf::ESetWaitPending:
+            {
+            // Get waited event entry from requested events
+            TInt ind = 0;
+            TInt count = iEventArray.Count();
+            for( ind=0; ind < count; ind++ )
+                {
+                if( ( iEventArray[ind]->Name() == iEventDef.iEvent.Name() ) &&
+                    ( iEventArray[ind]->WaitEventPending() != EFalse ) &&
+                    ( iEventArray[ind]->RequestStatus() == iEventDef.iStatus ) )
+                    {
+                    TEvent* event = iEventArray[ind];
+                    // Found event with correct name and one that is waited.
+                    event->CompletePendingWait( KErrCancel ); 
+                    ret = KErrNone;
+                    break;
+                    }
+                }
+            if( ret != KErrNone )
+                {
+                // Request has been already completed, not handled 
+                // by ActiveScheduler yet.
+                // DoCancel will do the job, don't worry.
+                __TRACE( KError, ( _L( "CTestThreadContainer::CancelEvent(%d): %S, not found 2" ), 
+                    iEventDef.iEvent.Type(), &iEventDef.iEvent.Name() ) ); 
+                }
+            }
+            break;
+        default:
+            CTestServer::PanicServer( EUnknownEventCmd );
+            break;
+        }
+        
+    // Synchonize
+    iEventHandler->StartL();
+    */
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: NotifyRemoteCmd
+
+    Description: Handles the first phase of the RemoteCmd request from engine.
+
+    Parameters: const RMessage& aMessage: in: Message from client.
+                    
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::NotifyRemoteCmd( const RMessage2& aMessage )
+    {   
+
+    // Store RemoteCmd message
+    // and the length buffer address
+    iNotifyRemoteCmdMessage = aMessage;
+    iRemoteSendAvailable = ETrue;
+    iSndHandler->StartL();
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: DoRemoteReceive
+
+    Description: Enable remote receive.
+    
+    Parameters: None 
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::DoRemoteReceive()
+    {    
+
+    switch( iRcvCmdDef.iCommand )
+        {
+        case EStifCmdReceive:          // "Receive"
+            {
+            // @js If there's pointer in array, we'll send it down
+            if(iMessageQueue.Count() > 0)
+                {
+                HBufC8 * buf =  iMessageQueue[0];
+                iRcvCmdDef.iParam.aRemoteMsgRef->Copy( iMessageQueue[0]->Des() );
+                iMessageQueue.Remove(0);
+                delete buf; 
+                __TRACE( KMessage, 
+                        (_L("CTestExecution::ReadRemoteCmdInfo: complete receive 0x%x"), 
+                            iRcvCmdDef.iStatus ));
+                       
+                 // calls the TestCombiner's CRemoteReceiver::RunL()
+                 TestThreadRequestComplete( iRcvCmdDef.iStatus, KErrNone );
+                }
+            else
+                {
+                iRemoteReceiveAvailable = ETrue;            
+                }
+
+            break;
+            }
+        case EStifCmdReceiveCancel:
+            if( iRemoteReceiveAvailable )
+                {
+                iRemoteReceiveAvailable = EFalse;
+                TestThreadRequestComplete( iRcvCmdDef.iStatus, KErrCancel );
+                }                
+            break;
+        default:
+            CTestServer::PanicServer( EUnknownRemoteCmd );
+            break;
+        }
+    // Signal test thread
+    iRcvHandler->StartL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: DoRemoteSend
+
+    Description: Send remote messages.
+    
+    Parameters: None 
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::DoRemoteSend()
+    {  
+    switch( iCmdDef.iCommand )
+        {  
+        case EStifCmdSend:             // "Send"
+        case EStifCmdReboot:           // "Send"
+        case EStifCmdStoreState:       // "Send"
+        case EStifCmdGetStoredState:   // "Receive, this must be done with two phase"
+        case EStifCmdMeasurement:      // "Receive, this must be done with two phase"
+            {
+            if( iRemoteSendAvailable )
+                {
+                TInt ret = KErrNone;
+                TPckg<TStifCommand> remoteCommandPckg( iCmdDef.iCommand );
+
+                // Start first phase of the writing message to client space
+                TRAP( ret, 
+                    iNotifyRemoteCmdMessage.WriteL( 0, remoteCommandPckg ) );
+
+                if( ret != KErrNone )
+                    {
+                    __TRACE( KError, ( _L( "CTestExecution::DoRemoteSend: WriteL failed" ) ) );
+                    }
+                TPckg<TInt> lenPckg( iCmdDef.iLen );
+
+                TRAP( ret, 
+                    iNotifyRemoteCmdMessage.WriteL( 1, lenPckg ) );
+
+                if( ret != KErrNone )
+                    {
+                    __TRACE( KError, ( _L( "CTestExecution::DoRemoteSend: WriteL failed" ) ) );
+                    }
+
+                // Complete request
+                // Complete with WriteL result
+                // CTestRemoteCmdNotifier::RunL() will called
+                iRemoteSendAvailable = EFalse;
+                iNotifyRemoteCmdMessage.Complete( ret );
+                break;
+                }
+            }
+            TestThreadRequestComplete( iCmdDef.iStatus, KErrNotSupported );
+            break;
+        default:
+            CTestServer::PanicServer( EUnknownRemoteCmd );
+            break;
+        }
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: ReadRemoteCmdInfo
+
+    Description: Handles the second phase of the RemoteCmd request from engine.
+
+    Parameters: const RMessage& aMessage: in: Message from client.
+                    
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::ReadRemoteCmdInfo( const RMessage2& aMessage )
+    {   
+    
+    TInt ret( KErrNone );
+    TInt completeSend = EFalse;
+    TInt returnedErrorCode = KErrNone;
+    TInt len = 0;
+    TInt value( aMessage.Int2() );
+    if( value < 0 )
+        {
+        returnedErrorCode = value;
+        }
+    else
+        {
+        len = value;
+        }
+  
+    switch( aMessage.Int1() )
+        {
+        case EStifCmdReceive:              // "Receive"
+            {
+
+                if( len <= 0 )
+                    {
+                    __TRACE( KError, 
+                        (_L("CTestExecution::ReadRemoteCmdInfo: empty message")));
+                    ret = KErrGeneral;
+                    break;
+                    }
+                if( iRcvCmdDef.iParam.aRemoteMsgRef->MaxLength() < len )
+                    {
+                    __TRACE( KError, 
+                        (_L("CTestExecution::ReadRemoteCmdInfo: message overflow")));
+                    ret = KErrGeneral;
+                    break;
+                    }
+
+                HBufC8* buf = HBufC8::New( len );
+                if( buf == NULL )
+                    { 
+                    ret = KErrNoMemory;
+                    break;
+                    }
+                TPtr8 tmp = buf->Des();
+                // Read message from client space
+                TRAP( ret, aMessage.ReadL( 0, tmp ) );
+
+                
+                if( ret != KErrNone )
+                    {
+                    __TRACE( KError, 
+                        (_L("CTestExecution::ReadRemoteCmdInfo: ReadL failed")));
+                    break;
+                    }
+                    
+                if( iRemoteReceiveAvailable )
+                // @js Checking moved here
+                    {                                   
+                    iRcvCmdDef.iParam.aRemoteMsgRef->Copy( buf->Des() );
+                    delete buf;
+                
+                    __TRACE( KMessage, 
+                        (_L("CTestExecution::ReadRemoteCmdInfo: complete receive 0x%x"), 
+                            iRcvCmdDef.iStatus ));
+                    // calls the TestCombiner's CRemoteReceiver::RunL()
+                    TestThreadRequestComplete( iRcvCmdDef.iStatus, ret );
+                    
+                    iRemoteReceiveAvailable = EFalse;
+                    }
+                else
+                // @js Adding buf to RPointerArray, handling it in DoRemoteReceive function
+                    {
+                   iMessageQueue.Append( buf );
+                    } 
+                
+            break;
+            }
+        case EStifCmdSend:                 // "Send"
+            {
+            HBufC8* buf = HBufC8::New( iCmdDef.iParam.aRemoteMsgConstRef->Length() );
+            if( buf == NULL )
+                { 
+                ret = KErrNoMemory;
+                break;
+                }
+            TPtr8 tmp = buf->Des();
+            tmp.Copy( *iCmdDef.iParam.aRemoteMsgConstRef );
+            // Second phase of the writing. Write information to the Engine.
+            TRAP( ret, aMessage.WriteL( 0, tmp ) );
+
+            delete buf;
+            
+            if( ret != KErrNone )
+                {
+                __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: WriteL failed" ) ) );
+                }
+            completeSend = ETrue;
+            break;
+            }
+        case EStifCmdReboot:               // "Send"
+            {
+            TRebootParamsPckg remoteTypePckg( *iCmdDef.iParam.aRebootType );
+
+            // Second phase of the writing. Write information to the Engine.
+            TRAP( ret, aMessage.WriteL( 0, remoteTypePckg ) );
+
+            if( ret != KErrNone )
+                {
+                __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: WriteL failed" ) ) );
+                }
+            // Because Reboot must block...Don't complete, so now we wait for
+            // ever phone booting operation !!!!!
+            break;
+            }
+        case EStifCmdStoreState:          // "Send"
+            {
+            TRebootStateParamsPckg remoteStatePckg( *iCmdDef.iParam.aRebootState );
+
+            // Second phase of the writing. Write information to the Engine.
+            TRAP( ret, aMessage.WriteL( 0, remoteStatePckg ) );
+
+            if( ret != KErrNone )
+                {
+                __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: WriteL failed" ) ) );
+                }
+            // Completed from EStifCmdRebootProceed
+            break;
+            }
+        case EStifCmdMeasurement:   // "Receive"
+            {
+            TGetMeasurementOptions getMeasurementOptions;
+            TGetMeasurementOptionsPckg measurementParamsPckg( getMeasurementOptions );
+
+            // Read message from client space
+            TRAP( ret, aMessage.ReadL( 0, measurementParamsPckg ) );
+
+            if( ret != KErrNone )
+                {
+                __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: ReadL failed" ) ) );
+                }
+            iCmdDef.iParam.aMeasurementOption->iOptions = getMeasurementOptions.iOptions;
+
+            completeSend = ETrue;
+            break;
+            }
+        case EStifCmdGetStoredState:   // "Receive"
+            {
+            TGetRebootStoredParams getRebootStoredParams;
+            TGetRebootStoredParamsPckg rebootStoredParamsPckg( getRebootStoredParams );
+
+            // Read message from client space
+            TRAP( ret, aMessage.ReadL( 0, rebootStoredParamsPckg ) );
+
+            if( ret != KErrNone )
+                {
+                __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: ReadL failed" ) ) );
+                }
+            iCmdDef.iParam.aRebootStoredRef->iCode = getRebootStoredParams.aCode;
+            iCmdDef.iParam.aRebootStoredRef->iName = getRebootStoredParams.aName;
+
+            completeSend = ETrue;
+            break;
+            }
+        case EStifCmdRebootProceed:          
+            {
+            completeSend = ETrue; // Complete EStifCmdStoreState
+            }
+            break;
+        default:
+            {
+            iModuleSession->PanicClient( EUnknownRemoteCmd, aMessage );
+            break;
+            }
+        }
+    // Complete request with ret
+    aMessage.Complete( ret ); 
+
+    if( completeSend )
+        {
+        // Calls the TestCombiner's CRemoteReceiver::RunL() and
+        // returns error code to test module.
+        TestThreadRequestComplete( iCmdDef.iStatus, returnedErrorCode );
+        }
+        
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: Pause
+
+    Description: Pauses a test case
+
+    Only ongoing tests can be paused. If test is not ongoing, then
+    function does nothing.
+
+    Parameters: const RMessage& aMessage      :in:  Message from client.
+    
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::Pause( const RMessage2& aMessage )
+    {
+
+    __TRACE ( KThreadOperation, ( _L( "CTestExecution::Pause" ) ) );
+
+    TInt completionCode = KErrNone;
+
+    // Note that it is allowed to suspend already suspended thread, so
+    // there is no need for states to verify that thread is really in
+    // resumed state.
+    switch ( iThreadState )
+        {
+        case EOnGoing:
+            completionCode = iModuleContainer->PauseThread();
+            break;
+
+        case ENotStarted:
+            completionCode = KErrNotReady;
+            break;
+
+        case EFinished:
+        case ECancelled:
+            completionCode = KErrCompletion;
+            break;
+
+        default:
+            CTestServer::PanicServer( EInvalidThreadState );
+            break;
+        }
+
+
+    // Complete the request
+    aMessage.Complete( completionCode );
+
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: Resume
+
+    Description: Resumes a test case. If test is not ongoing,
+    then do not resume.
+
+    Parameters: const RMessage& aMessage      :in:  Message from client.
+    
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::Resume( const RMessage2& aMessage )
+    {
+
+    __TRACE ( KThreadOperation, ( _L( "CTestExecution::Resume" ) ) );
+
+    TInt completionCode = KErrNone;
+
+    // Note that it is allowed to resume already resumed thread, so
+    // there is no need for states to verify that thread is really in
+    // suspended state.
+    switch ( iThreadState )
+        {
+        case EOnGoing:
+            completionCode = iModuleContainer->ResumeThread();
+            break;
+
+        case ENotStarted:
+            completionCode = KErrNotReady;
+            break;
+
+        case EFinished:
+        case ECancelled:
+            completionCode = KErrCompletion;
+            break;
+
+        default:
+            CTestServer::PanicServer( EInvalidThreadState );
+            break;
+        }
+
+
+    // Complete the request
+    aMessage.Complete( completionCode );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CloseTestExecution
+
+    Description: Closes Test Execution subsession
+
+    Parameters: const RMessage& aMessage      :in:  Message from client.
+    
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CloseTestExecution( const RMessage2& aMessage )
+    {
+
+    // Cancel test request
+    CancelTestRequest();
+
+    // Cancel print request
+    CancelPrintRequest();
+    
+    // Cancel event request
+    CancelEventRequest();
+
+    // Delete this subsession
+    const TUint subsession = aMessage.Int3();
+    iModuleSession->DeleteTestExecution( subsession, aMessage );
+
+    // Complete the request
+    aMessage.Complete( KErrNone );
+
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelPrintRequest
+
+    Description: Cancel print request. Completes ongoing print request
+    with KErrCancel.
+
+    Parameters: None
+    
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CancelPrintRequest()
+    {
+
+    if ( iPrintNotifyAvailable )
+        {
+        iPrintHandler->Cancel();
+        
+        iPrintNotifyAvailable = EFalse;
+        iNotifyPrintMessage.Complete ( KErrCancel );
+        //@spe iPrintNotifyAvailable = EFalse;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelEventRequest
+
+    Description: Cancel event request. Completes ongoing event request
+    with KErrCancel.
+
+    Parameters: None
+    
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CancelEventRequest()
+    {
+    iEventHandler->Cancel();
+
+    if( iEventNotifyAvailable )
+        {
+        // Cancel request
+        iEventNotifyAvailable = EFalse;
+        iNotifyEventMessage.Complete ( KErrCancel );
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelInterferenceRequest
+
+    Description: Cancel print request. Completes ongoing print request
+    with KErrCancel.
+
+    Parameters: None
+
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CancelInterferenceRequest()
+    {
+
+    if ( iInterferenceNotifyAvailable )
+        {
+        iInterferenceHandler->Cancel();
+        
+        iInterferenceNotifyAvailable = EFalse;
+        iNotifyInterferenceMessage.Complete ( KErrCancel );
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelRemoteCmdRequest
+
+    Description: Cancel RemoteCmd request. Completes ongoing RemoteCmd request
+        with KErrCancel.
+
+    Parameters: None
+    
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CancelRemoteCmdRequest()
+    {
+    iSndHandler->Cancel();
+
+    // Cancel request
+    if( iRemoteSendAvailable )
+        {
+        iRemoteSendAvailable = EFalse;
+        iNotifyRemoteCmdMessage.Complete ( KErrCancel );
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: NotifyCommand
+
+    Description: Handles the first phase of the Command request from engine.
+
+    Parameters: const RMessage& aMessage: in: Message from client.
+
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::NotifyCommand( const RMessage2& aMessage )
+    {
+    iNotifyCommandMessage = aMessage;
+    iCommandNotifyAvailable = ETrue;
+    iCommandHandler->StartL();
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelCommandRequest
+
+    Description: Cancel Command request. Completes ongoing Command request
+        with KErrCancel.
+
+    Parameters: None
+
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CancelCommandRequest()
+    {
+    iCommandHandler->Cancel();
+
+    // Cancel request
+    if(iCommandNotifyAvailable)
+        {
+        iCommandNotifyAvailable = EFalse;
+        iNotifyCommandMessage.Complete(KErrCancel);
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelTestRequest
+
+    Description: Cancel test execution request.
+    If thread is not in OnGoing state, function does not do anything.
+
+    Otherwise following operations are done:
+    1 ) Obtain access to both  PrintMutex and EventMutex to make sure that
+       thread can't be accessing print queue or events.
+    2 ) Kill the thread
+    3 ) Complete original "RunTestCase" request with KErrCancel
+    4 ) If print queue is empty, complete print request
+    5 ) Give up mutexes
+    6 ) Delete module container
+
+    Parameters: None
+    
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CancelTestRequest()
+    {
+    // This mutex block and make sure that cancel operation is done succesfully
+    // and test case e.g. cannot complete at the same time. Get mutex.
+    iTestThreadMutex.Wait();
+
+    // iModuleContainer is an active object, check is active.
+    if ( iModuleContainer == NULL || ( iModuleContainer != NULL && !iModuleContainer->IsActive() ) )
+        {
+        // Test case is already ready, return.
+        iTestThreadMutex.Signal();
+        return KErrNone;
+        }
+
+    if ( iThreadState == EOnGoing )
+        {
+        // Print mutex access is required to make sure that the dying thread
+        // does not have access to print queue. Same is true for event queue.
+
+        // NOTE: iEventArrayMutex is now taken, so the ongoing thread
+        // can't set any events so queue will be empty.
+        iPrintHandler->Cancel();
+        iEventHandler->Cancel();
+        iInterferenceHandler->Cancel();
+        iCommandHandler->Cancel();
+
+        // Kill the thread
+        iModuleContainer->KillThread( KErrCancel );
+
+        // Complete the test execution request
+        CompleteTestExecution( KErrCancel, TFullTestResult::ECaseCancelled, 
+                               KErrCancel, KErrCancel, _L( "Cancelled" ) );
+        iThreadState = ECancelled;
+
+       
+        /**        
+        * Removed, because may block in certain situations. Implemented now in
+        * TestCombiner instead.
+        // Unset all pending state events, 
+        // because we have killed the testcase abnormally
+        // UnsetStateEvents();
+        */
+        
+        // Complete print request if queue is empty
+        CompletePrintRequestIfQueueEmpty();
+        
+        // Delete the module containter
+        delete iModuleContainer;
+        iModuleContainer = NULL;
+        }
+        
+    // Relinquish mutex.
+    iTestThreadMutex.Signal();
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelRequestL
+
+    Description: Cancel asynchronous request
+
+    Parameters: const RMessage& aMessage      :in:  Message from client.
+    
+    Return Values: TInt                             Error code from CancelXXX-
+                                                    function
+
+    Errors/Exceptions: Function panics the client, if invalid message
+                       received.
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CancelRequestL( const RMessage2& aMessage )
+    {
+    TInt r = KErrNone;
+
+    switch ( aMessage.Int0() )
+        {
+        case ETestExecutionRunTestCase:
+            {
+            r = CancelTestRequest();
+            break;
+            }
+        case ETestExecutionNotifyProgress:
+            {
+            r = CancelPrintRequest();
+            break;
+            }
+        case ETestExecutionNotifyEvent:
+            {
+            r = CancelEventRequest();
+            break;
+            }
+        case ETestExecutionNotifyRemoteCmd:
+            {
+            r = CancelRemoteCmdRequest();
+            break;
+            }
+        case ETestExecutionNotifyCommand:
+            {
+            r = CancelCommandRequest();
+            break;
+            }
+        default:
+            iModuleSession->PanicClient( EInvalidRequestCancel, aMessage );
+            break;
+        }
+
+    aMessage.Complete( r );
+
+    return r;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: SetThreadState
+
+    Description: A multithread safe thread state modification function
+
+    Parameters: const TTestState aState       :in:  New state
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::SetThreadState( const TTestState aState )
+    {
+
+    iThreadState = aState;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: Complete event
+
+    Description: Completes pending event request. Must be 
+        called with iEventSem taken.
+        
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::CompleteEvent( TInt aError )
+    {
+    RDebug::Print(_L("STF [ES]: CTestExecution::CompleteEvent()"));
+    if( iEventDef.iStatus )
+        {
+        __TRACE( KMessage,(_L("Comp Stat %d, %x (error %d)"), 
+            this, iEventDef.iStatus, aError));
+    RDebug::Print(_L("STF [ES]: CTestExecution::CompleteEvent() completing status [%x]"), iEventDef.iStatus);
+        TestThreadRequestComplete( iEventDef.iStatus, aError );
+        
+        iEventDef.iStatus = NULL;
+        
+        }
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CompletePrintRequestIfQueueEmpty
+
+    Description: Completes print request if queue is empty.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::CompletePrintRequestIfQueueEmpty()
+    {
+
+    if ( iPrintNotifyAvailable &&  iPrintQueue->Count() == 0 )
+        {
+        iNotifyPrintMessage.Complete ( KErrEof );
+        iPrintNotifyAvailable = EFalse;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CleanupEvents
+
+    Description: Cleanups Events.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::CleanupEvents()
+    {
+    
+    iEventArray.ResetAndDestroy();
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: GetRq
+
+    Description: Get request pointers.
+
+    Parameters: None
+
+    Return Values: TRequestStatus*
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TRequestStatus* CTestExecution::GetRq( TRequestType aType )
+    {
+
+    TRequestStatus* status = NULL;
+
+    switch( aType )
+        {
+        case ERqPrint:
+            status = &iPrintHandler->iStatus;
+            break;
+        case ERqEvent:
+            status = &iEventHandler->iStatus;
+            break;
+        case ERqSnd:
+            status = &iSndHandler->iStatus;
+            break;
+        case ERqRcv:
+            status = &iRcvHandler->iStatus;
+            break;
+        case ERqInterference:
+            status = &iInterferenceHandler->iStatus;
+            break;
+        case ERqMeasurement:
+            status = &iMeasurementHandler->iStatus;
+            break;
+        case ERqCommand:
+            status = &iCommandHandler->iStatus;
+            break;
+        default:
+            break;
+        }
+
+    return status;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CompleteTestExecution
+
+    Description: Completes test execution
+
+    Parameters: const TInt aCompletionCode    :in:  Request completion code
+                const TInt aCaseExecutionCode  in:  Case execution code
+                const TFullTestResult::TCaseExecutionResult aCaseExecutionType,
+                const TInt aCaseResult        :in:  Case result
+                const TDesC& aText            :in:  Completion text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::CompleteTestExecution( const TInt aCompletionCode,
+    const TFullTestResult::TCaseExecutionResult aCaseExecutionType,
+    const TInt aCaseExecutionCode,
+    const TInt aCaseResult,
+    const TDesC& aText )
+    {
+    
+    TInt completionCode = aCompletionCode;
+    
+    if( iModuleContainer != NULL )
+        {
+        // Fill the description
+        iFullResult.iEndTime.HomeTime();
+        iFullResult.iCaseExecutionResultType = aCaseExecutionType;
+        iFullResult.iCaseExecutionResultCode = aCaseExecutionCode;
+        iFullResult.iTestResult.iResult = aCaseResult;
+        iFullResult.iTestResult.iResultDes = aText;
+        CompleteTestExecution( aCompletionCode );
+        return;
+        }
+    else
+        {   
+        completionCode = KErrGeneral;
+        __TRACE ( KError, ( CStifLogger::ERed, 
+            _L("CTestExecution::CompleteTestExecution: ModuleContainer NULL") ) );
+        }
+
+    iTestExeMessage.Complete ( completionCode );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CompleteTestExecution
+
+    Description: Completes test execution
+
+    Parameters: const TInt aCompletionCode: in: completion code
+                TFullTestResult&: in: test case result
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::CompleteTestExecution( const TInt aCompletionCode )
+    {
+    
+    TInt completionCode = aCompletionCode;
+    
+    TFullTestResultPckg fullResultPckg( iFullResult );
+    TRAPD( res, iTestExeMessage.WriteL( 0, fullResultPckg ) );
+    if ( res != KErrNone )
+        {
+        completionCode = res;
+        }
+
+    iTestExeMessage.Complete ( completionCode );
+    
+    // @js Now it returns completionCode, used to return res
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: UnsetStateEvents
+
+    Description: Unsets all state events. Must be done if testcase is exited 
+                abnormally (i.e. aborted by the user).
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::UnsetStateEvents()
+    {
+
+
+    // Unset all state events that are set currently
+    TInt count = iStateEvents.Count();
+    TEventIf event;
+    for( TInt i = 0; i < count; i++ )   
+        {
+        TPtrC name = *(iStateEvents[i]);
+        event.Set( TEventIf::EUnsetEvent, name, TEventIf::EState );
+        
+        // Construct message
+        TEventIfPckg eventPckg( event );
+
+        // Write message to client space
+        TRAPD( res, iNotifyEventMessage.WriteL( 0, eventPckg ) );
+
+        // Complete with WriteL result
+        iEventNotifyAvailable = EFalse;
+        iNotifyEventMessage.Complete( res );
+        if( res != KErrNone )
+            {
+            __TRACE( KError,( _L( "CTestExecution::UnsetStateEvents: WriteL failed" ) ));
+            break;
+            } 
+        }
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: TestThreadRequestComplete
+
+    Description: Complete test thread request.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestExecution::TestThreadRequestComplete( TRequestStatus* aStatus, 
+                                                TInt aCode)
+    {                                        
+    
+    if( iThreadState != EOnGoing )
+        {
+        __TRACE( KError,
+            ( _L( "CTestExecution::TestThreadRequestComplete: test thread killed" ) ));
+        return;
+        }
+
+    if( iTestThreadOpen == EFalse )
+        {        
+        if( iTestThread.Open( iTestThreadId ) != KErrNone )
+            {
+            __TRACE( KError,
+                ( _L( "CTestExecution::TestThreadRequestComplete: test thread cannot be opened" ) ));
+            return;
+            }
+        iTestThreadOpen = ETrue;
+        }
+    if( iTestThread.ExitType() != EExitPending ) 
+        {
+        // test thread has died
+        __TRACE( KError,
+            ( _L( "CTestExecution::TestThreadRequestComplete: test thread has died" ) ));
+        return;
+        }    
+     
+    iTestThread.RequestComplete( aStatus, aCode );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: CancelTestExecution
+
+    Description: Cancels test(s) execution in special cases e.g. timeout,
+                 exit etc.
+
+    Parameters: None
+    
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::CancelTestExecution()
+    {
+    TInt ret( KErrNone );
+    ret = CancelTestRequest();
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: KillTestinterferenceThread
+
+    Description: Make sure that any of the test interference thread's won't
+                 stay to run if test case is crashed of test interference
+                 object is not deleted.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::KillTestinterferenceThread()
+    {
+    for( TInt i = 0; i < iSTIFTestInterferenceArray.Count(); i++ )
+        {
+        RDebug::Print( 
+            _L( "Test interference's thread[%x] killed by STIF" ), (TInt)iSTIFTestInterferenceArray[i].Id() );
+        __TRACE( KInit,
+            ( _L( "Test interference's thread[%x] killed by STIF" ), (TInt)iSTIFTestInterferenceArray[i].Id() ) );
+        iSTIFTestInterferenceArray[i].Kill( KErrCancel );
+        //iSTIFTestInterferenceArray.Remove( i );
+        }
+
+    iSTIFTestInterferenceArray.Reset();
+    iSTIFTestInterferenceArray.Close();
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: DoNotifyCommand
+
+    Description: Completes command message.
+
+    Parameters: None.
+
+    Return Values: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::DoNotifyCommand()
+    {
+    if(!iCommandNotifyAvailable)
+    	{
+    	__TRACE(KPrint, (_L("CTestExecution::DoNotifyCommand(): unable to complete notification")))
+    	return KErrNone;
+    	}
+
+    TInt ret = KErrNone;
+
+    switch(iCommandDef->iCommand)
+        {
+        case EStopExecution:
+            {
+            //Unpack received parameters
+            TStopExecutionCommandParams par;
+            TStopExecutionCommandParamsPckg parPack(par);
+            parPack.Copy(iCommandDef->iParamsPckg);
+
+            //Set test case handle
+            par.iTestCaseHandle = iNotifyCommandMessage.Int3();
+
+            __TRACE(KPrint, (_L("CTestExecution::DoNotifyCommand(): command [%d] type [%d] code [%d] test handle [%d]"), TInt(iCommandDef->iCommand), TInt(par.iType), TInt(par.iCode), par.iTestCaseHandle));
+            iCommandDef->iParamsPckg.Copy(parPack);
+            break;
+            }
+        case ESendTestModuleVersion:
+        	{
+        	TSendTestModuleVesionCommandParams par;
+        	TSendTestModuleVesionCommandParamsPckg parPack(par);
+        	parPack.Copy(iCommandDef->iParamsPckg);
+        	
+        	__TRACE(KPrint, (_L("CTestExecution::DoNotifyCommand(): command ESendTestModuleVersion")));
+        	break;
+        	}
+        default:
+            __TRACE(KError, (_L("CTestExecution::DoNotifyCommand(): Unknown command [%d]"), TInt(iCommandDef->iCommand)));
+            return KErrNotFound;
+        }
+    // Construct message
+    TPckg<TCommand> commandPckg(iCommandDef->iCommand);
+
+    // Start first phase of the writing message to client space
+    TRAP(ret, iNotifyCommandMessage.WriteL(0, commandPckg));
+    if(ret != KErrNone)
+       {
+       __TRACE(KError, (_L( "CTestExecution::DoNotifyCommand(): WriteL failed (0)")));
+       }
+
+    TRAP(ret, iNotifyCommandMessage.WriteL(1, iCommandDef->iParamsPckg));
+    if(ret != KErrNone)
+       {
+       __TRACE(KError, (_L( "CTestExecution::DoNotifyCommand(): WriteL failed (1)")));
+       }
+
+    // Complete request with WriteL result
+    iCommandNotifyAvailable = EFalse;
+    iNotifyCommandMessage.Complete(ret);
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestExecution
+
+    Method: KillTestMeasurement
+
+    Description: Make sure that any of the test measurement operations won't
+                 stay to run if test case is crashed or test measurement object
+                 is not stopped by user.
+
+    Parameters: None
+
+    Return Values: TInt: Symbian OS error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestExecution::KillTestMeasurement()
+    {
+    for( TInt i = 0; i < iMeasurementHandlingArray.Count(); i++ )
+        {
+        iMeasurementHandlingArray[i]->iMeasurementModulePtr->Stop();
+        }
+
+    iMeasurementHandlingArray.ResetAndDestroy();
+    iMeasurementHandlingArray.Close();
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CPrintHandler class member functions.
+    CPrintHandler listens print notifications from test thread.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintHandler
+
+    Method: NewL
+
+    Description: Constructs a new CPrintHandler object.
+
+    Parameters: CTestExecution& aExecution: in: "Parent"
+
+    Return Values: CPrintHandler*: New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CPrintHandler* CPrintHandler::NewL( CTestExecution& aExecution )
+    {
+
+    CPrintHandler* self = new( ELeave ) CPrintHandler( aExecution );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CPrintHandler::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintHandler
+
+    Method: CPrintHandler
+
+    Description: Constructor
+
+    Parameters: CTestModuleContainer& aExecution :in:   "Parent"
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CPrintHandler::CPrintHandler( CTestExecution& aExecution ) :
+    CActive( CActive::EPriorityStandard ),
+    iExecution( aExecution )
+    {
+    
+    CActiveScheduler::Add ( this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintHandler
+
+    Method: ~CPrintHandler
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CPrintHandler::~CPrintHandler()
+    {
+
+    Cancel();
+
+    }
+
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintHandler
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CPrintHandler::StartL()
+    {
+    
+    __TRACE( KPrint, ( _L( "CPrintHandler::StartL" ) ) );
+    
+    if( IsActive() ) 
+        {
+        CTestServer::PanicServer( EAlreadyActive );
+        }
+
+    iStatus = KRequestPending;
+    SetActive();
+    
+    // Signal test thread
+    iExecution.iPrintSem.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintHandler
+
+    Method: RunL
+
+    Description: Handles thread death.
+    Function does:
+    1 ) Stops monitoring thread
+    1 ) Marks thread death
+    2 ) Completes ongoing requests
+    3 ) Cleans the memory
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CPrintHandler::RunL()
+    {
+
+    __TRACE( KPrint, ( _L( "CPrintHandler::RunL [%d]" ), iStatus.Int() ) );
+    
+    iExecution.DoNotifyPrint();
+    
+    // enable print request
+    //@speiExecution.iPrintHandler->StartL();
+    StartL();
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintHandler
+
+    Method: DoCancel
+
+    Description: Stops print notification listening.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CPrintHandler::DoCancel()
+    {
+
+    __TRACE( KPrint, ( _L( "CPrintHandler::DoCancel" ) ) );
+
+    iExecution.iPrintMutex.Wait();  // Take mutex and check test case print
+                                    // operation. If pending take print semaphore
+                                    // and complete
+    if( iStatus == KRequestPending )
+        {
+        // Signal test thread
+        // @remove iExecution.iPrintSem.Wait();
+    
+        TRequestStatus* status = &iStatus;    
+        User::RequestComplete( status, KErrCancel );        
+        }
+
+    iExecution.iPrintMutex.Signal();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CPrintHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError:                  :in:  Error code
+
+    Return Values:  TInt                            Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CPrintHandler::RunError( TInt aError )
+    {
+    
+    __TRACE( KError,( _L( "CPrintHandler::RunError" ) ) );
+
+    return aError;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CEventHandler class member functions.
+    CEventHandler listens print notifications from test thread.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CEventHandler
+
+    Method: NewL
+
+    Description: Constructs a new CEventHandler object.
+
+    Parameters: CTestExecution& aExecution: in: "Parent"
+
+    Return Values: CEventHandler*: New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CEventHandler* CEventHandler::NewL( CTestExecution& aExecution )
+    {
+
+    CEventHandler* self = new( ELeave ) CEventHandler( aExecution );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CEventHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CEventHandler::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CEventHandler
+
+    Method: CEventHandler
+
+    Description: Constructor
+
+    Parameters: CTestModuleContainer& aExecution :in:   "Parent"
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CEventHandler::CEventHandler( CTestExecution& aExecution ) :
+    CActive( CActive::EPriorityStandard ),
+    iExecution( aExecution )
+    {
+    
+    CActiveScheduler::Add ( this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CEventHandler
+
+    Method: ~CEventHandler
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CEventHandler::~CEventHandler()
+    {
+
+    Cancel();
+
+    }
+
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CEventHandler
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CEventHandler::StartL()
+    {
+    
+    __TRACE( KPrint, ( _L( "CEventHandler::StartL" ) ) );
+
+    if( IsActive() ) 
+        {
+        CTestServer::PanicServer( EAlreadyActive );
+        }
+    
+    iStatus = KRequestPending;
+    SetActive();
+    
+    // Signal test thread
+    iExecution.iEventSem.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CEventHandler
+
+    Method: RunL
+
+    Description: Handles thread death.
+    Function does:
+    1 ) Stops monitoring thread
+    1 ) Marks thread death
+    2 ) Completes ongoing requests
+    3 ) Cleans the memory
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CEventHandler::RunL()
+    {
+    RDebug::Print(_L("STF [ES]: CEventHandler::RunL()"));
+
+    __TRACE( KPrint, ( _L( "CEventHandler::RunL [%d]" ), iStatus.Int() ) );
+
+    switch( iExecution.EventDef().iType )
+        {
+        case TEventDef::EEventCmd:
+            iExecution.DoNotifyEvent();
+            break;
+        case TEventDef::EEventCmdCancel:
+            iExecution.CancelEvent();
+            break;
+        default:
+            CTestServer::PanicServer( EUnknownEventCmd );
+            break;  
+        }
+         
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CEventHandler
+
+    Method: DoCancel
+
+    Description: Stops print notification listening.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CEventHandler::DoCancel()
+    {
+
+    __TRACE( KPrint, ( _L( "CEventHandler::DoCancel" ) ) );
+    
+    iExecution.iEventMutex.Wait();  // Take mutex and check test case event
+                                    // operation. If pending take event
+                                    // semaphore and complete
+    if( iStatus == KRequestPending )
+        {
+        // Signal test thread
+        // @remove iExecution.iEventSem.Wait();
+
+        TRequestStatus* status = &iStatus;    
+        User::RequestComplete( status, KErrCancel );
+
+        }
+
+    iExecution.iEventMutex.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CEventHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError:                  :in:  Error code
+
+    Return Values:  TInt                            Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CEventHandler::RunError( TInt aError )
+    {
+    
+    __TRACE( KError,( _L( "CEventHandler::RunError" ) ) );
+
+    return aError;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CSndHandler class member functions.
+    CSndHandler listens print notifications from test thread.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSndHandler
+
+    Method: NewL
+
+    Description: Constructs a new CSndHandler object.
+
+    Parameters: CTestExecution& aExecution: in: "Parent"
+
+    Return Values: CSndHandler*: New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CSndHandler* CSndHandler::NewL( CTestExecution& aExecution )
+    {
+
+    CSndHandler* self = new( ELeave ) CSndHandler( aExecution );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSndHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CSndHandler::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSndHandler
+
+    Method: CSndHandler
+
+    Description: Constructor
+
+    Parameters: CTestModuleContainer& aExecution :in:   "Parent"
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CSndHandler::CSndHandler( CTestExecution& aExecution ) :
+    CActive( CActive::EPriorityStandard ),
+    iExecution( aExecution )
+    {
+    
+    CActiveScheduler::Add ( this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSndHandler
+
+    Method: ~CSndHandler
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CSndHandler::~CSndHandler()
+    {
+
+    Cancel();
+
+    }
+
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSndHandler
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CSndHandler::StartL()
+    {
+    
+    __TRACE( KPrint, ( _L( "CSndHandler::StartL" ) ) );
+
+    if( IsActive() ) 
+        {
+        CTestServer::PanicServer( EAlreadyActive );
+        }
+    
+    iStatus = KRequestPending;
+    SetActive();
+    
+    // Signal test thread
+    iExecution.iSndSem.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSndHandler
+
+    Method: RunL
+
+    Description: Handles thread death.
+    Function does:
+    1 ) Stops monitoring thread
+    1 ) Marks thread death
+    2 ) Completes ongoing requests
+    3 ) Cleans the memory
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CSndHandler::RunL()
+    {
+
+    __TRACE( KPrint, ( _L( "CSndHandler::RunL [%d]" ), iStatus.Int() ) );
+    
+    iExecution.DoRemoteSend();
+       
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSndHandler
+
+    Method: DoCancel
+
+    Description: Stops print notification listening.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CSndHandler::DoCancel()
+    {
+
+    __TRACE( KPrint, ( _L( "CSndHandler::DoCancel" ) ) );
+
+    iExecution.iSndMutex.Wait();  // Take mutex and check test case send
+                                  // operation. If pending take send
+                                  // semaphore and complete
+    if( iStatus == KRequestPending )
+        {
+        // Signal test thread
+        // @remove iExecution.iSndSem.Wait();
+
+        TRequestStatus* status = &iStatus;    
+        User::RequestComplete( status, KErrCancel );
+
+        }
+
+    iExecution.iSndMutex.Signal();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CSndHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError:                  :in:  Error code
+
+    Return Values:  TInt                            Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CSndHandler::RunError( TInt aError )
+    {
+    
+    __TRACE( KError,( _L( "CSndHandler::RunError" ) ) );
+
+    return aError;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CSndHandler class member functions.
+    CRcvHandler listens print notifications from test thread.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRcvHandler
+
+    Method: NewL
+
+    Description: Constructs a new CRcvHandler object.
+
+    Parameters: CTestExecution& aExecution: in: "Parent"
+
+    Return Values: CRcvHandler*: New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CRcvHandler* CRcvHandler::NewL( CTestExecution& aExecution )
+    {
+
+    CRcvHandler* self = new( ELeave ) CRcvHandler( aExecution );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRcvHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CRcvHandler::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRcvHandler
+
+    Method: CRcvHandler
+
+    Description: Constructor
+
+    Parameters: CTestModuleContainer& aExecution :in:   "Parent"
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRcvHandler::CRcvHandler( CTestExecution& aExecution ) :
+    CActive( CActive::EPriorityStandard ),
+    iExecution( aExecution )
+    {
+    
+    CActiveScheduler::Add ( this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRcvHandler
+
+    Method: ~CRcvHandler
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CRcvHandler::~CRcvHandler()
+    {
+
+    Cancel();
+
+    }
+
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRcvHandler
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CRcvHandler::StartL()
+    {
+    
+    __TRACE( KPrint, ( _L( "CRcvHandler::StartL" ) ) );
+    
+    if( IsActive() ) 
+        {
+        CTestServer::PanicServer( EAlreadyActive );
+        }
+    iStatus = KRequestPending;
+    SetActive();
+    
+    // Signal test thread
+    iExecution.iRcvSem.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRcvHandler
+
+    Method: RunL
+
+    Description: Handles thread death.
+    Function does:
+    1 ) Stops monitoring thread
+    1 ) Marks thread death
+    2 ) Completes ongoing requests
+    3 ) Cleans the memory
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CRcvHandler::RunL()
+    {
+
+    __TRACE( KPrint, ( _L( "CRcvHandler::RunL [%d]" ), iStatus.Int() ) );
+    
+    iExecution.DoRemoteReceive();
+       
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRcvHandler
+
+    Method: DoCancel
+
+    Description: Stops print notification listening.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CRcvHandler::DoCancel()
+    {
+
+    __TRACE( KPrint, ( _L( "CRcvHandler::DoCancel" ) ) );
+
+    iExecution.iRcvMutex.Wait();  // Take mutex and check test case receive
+                                  // operation. If pending take reveive
+                                  // semaphore and complete
+    if( iStatus == KRequestPending )
+        {
+        // Signal test thread
+        // @remove iExecution.iRcvSem.Wait();
+
+        TRequestStatus* status = &iStatus;    
+        User::RequestComplete( status, KErrCancel );
+        }
+        
+    iExecution.iRcvMutex.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CRcvHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError:                  :in:  Error code
+
+    Return Values:  TInt                            Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CRcvHandler::RunError( TInt aError )
+    {
+    
+    __TRACE( KError,( _L( "CRcvHandler::RunError" ) ) );
+
+    return aError;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestInterferenceHandler class 
+    member functions. CTestInterferenceHandler listens print notifications from
+    test thread.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CInterferenceHandler
+
+    Method: NewL
+
+    Description: Constructs a new CInterferenceHandler object.
+
+    Parameters: CTestExecution& aExecution: in: "Parent"
+
+    Return Values: CInterferenceHandler*: New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CInterferenceHandler* CInterferenceHandler::NewL( 
+                                                CTestExecution& aExecution )
+    {
+    CInterferenceHandler* self = 
+                        new( ELeave ) CInterferenceHandler( aExecution );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CInterferenceHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CInterferenceHandler::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CInterferenceHandler
+
+    Method: CInterferenceHandler
+
+    Description: Constructor
+
+    Parameters: CTestModuleContainer& aExecution :in: "Parent"
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CInterferenceHandler::CInterferenceHandler( CTestExecution& aExecution ) :
+    CActive( CActive::EPriorityStandard ),
+    iExecution( aExecution )
+    {
+    CActiveScheduler::Add ( this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CInterferenceHandler
+
+    Method: ~CInterferenceHandler
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CInterferenceHandler::~CInterferenceHandler()
+    {
+    Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CInterferenceHandler
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CInterferenceHandler::StartL()
+    {
+    __TRACE( KPrint, ( _L( "CInterferenceHandler::StartL" ) ) );
+    
+    if( IsActive() ) 
+        {
+        CTestServer::PanicServer( EAlreadyActive );
+        }
+
+    iStatus = KRequestPending;
+    SetActive();
+    
+    // Signal test thread, Notify test thread that operation is done.
+    iExecution.iInterferenceSem.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CInterferenceHandler
+
+    Method: RunL
+
+    Description: Handles thread death.
+    Function does:
+    1 ) Stops monitoring thread
+    1 ) Marks thread death
+    2 ) Completes ongoing requests
+    3 ) Cleans the memory
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CInterferenceHandler::RunL()
+    {
+    __TRACE( KPrint, ( _L( "CInterferenceHandler::RunL [%d]" ), iStatus.Int() ) );
+    
+    iExecution.DoNotifyInterference();
+    
+    StartL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CInterferenceHandler
+
+    Method: DoCancel
+
+    Description: Stops interference notification listening.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CInterferenceHandler::DoCancel()
+    {
+    __TRACE( KPrint, ( _L( "CInterferenceHandler::DoCancel" ) ) );
+
+    iExecution.iInterferenceMutex.Wait();   // Take mutex and check test
+                                            // interference operation. If
+                                            // pending take interference
+                                            // semaphore and complete
+    if( iStatus == KRequestPending )
+        {
+    
+        TRequestStatus* status = &iStatus;    
+        User::RequestComplete( status, KErrCancel );
+        }
+
+    iExecution.iInterferenceMutex.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CInterferenceHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError: in: Error code
+
+    Return Values:  TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CInterferenceHandler::RunError( TInt aError )
+    {
+    __TRACE( KError,( _L( "CTestInterferenceHandler::RunError" ) ) );
+
+    return aError;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CMeasurementHandler class 
+    member functions. CMeasurementHandler handles test measurement operations
+    that comes from test execution side to TestServer side.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMeasurementHandler
+
+    Method: NewL
+
+    Description: Constructs a new CMeasurementHandler object.
+
+    Parameters: CTestExecution& aExecution: in: Pointer to test execution side.
+
+    Return Values: CMeasurementHandler*: New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CMeasurementHandler* CMeasurementHandler::NewL( CTestExecution& aExecution )
+    {
+    CMeasurementHandler* self = 
+                        new( ELeave ) CMeasurementHandler( aExecution );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMeasurementHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CMeasurementHandler::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMeasurementHandler
+
+    Method: CMeasurementHandler
+
+    Description: Constructor
+
+    Parameters: CTestModuleContainer& aExecution :in: Pointer to test
+                execution side.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CMeasurementHandler::CMeasurementHandler( CTestExecution& aExecution ) :
+    CActive( CActive::EPriorityStandard ),
+    iExecution( aExecution )
+    {
+    CActiveScheduler::Add ( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMeasurementHandler
+
+    Method: ~CMeasurementHandler
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CMeasurementHandler::~CMeasurementHandler()
+    {
+    Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMeasurementHandler
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: TInt: Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CMeasurementHandler::StartL()
+    {
+    __TRACE( KPrint, ( _L( "CMeasurementHandler::StartL" ) ) );
+
+    if( IsActive() ) 
+        {
+        CTestServer::PanicServer( EAlreadyActive );
+        }
+
+    iStatus = KRequestPending;
+    SetActive();
+
+    // Do not Signal here because synchronous operations will be executed and we
+    // don't want to signal at first time: iExecution.iMeasurementSem.Signal();
+    // Signal() operation will be handled in RunL in this case.
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMeasurementHandler
+
+    Method: RunL
+
+    Description: Derived from CActive, handles test measurement execution.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CMeasurementHandler::RunL()
+    {
+    __TRACE( KPrint, ( _L( "CMeasurementHandler::RunL [%d]" ), iStatus.Int() ) );
+    
+    TInt ret( 0 );
+    ret = iExecution.DoNotifyMeasurement();
+
+    // ret value is copied to struct so it can be handled later.
+    iExecution.iTestMeasurement.iMeasurementStruct.iOperationResult = ret;
+    
+    // SetActive again
+    StartL();
+
+    // TestServer side operations are done, Signal that operation is done.
+    iExecution.iMeasurementSem.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMeasurementHandler
+
+    Method: DoCancel
+
+    Description: Stops measurement notification listening.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CMeasurementHandler::DoCancel()
+    {
+    __TRACE( KPrint, ( _L( "CMeasurementHandler::DoCancel" ) ) );
+
+    iExecution.iMeasurementMutex.Wait();    // Take mutex and check test
+                                            // measurement operation. If
+                                            // pending take measurement
+                                            // semaphore and complete
+    if( iStatus == KRequestPending )
+        {
+    
+        TRequestStatus* status = &iStatus;    
+        User::RequestComplete( status, KErrCancel );
+        }
+
+    iExecution.iMeasurementMutex.Signal();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMeasurementHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError: in: Error code
+
+    Return Values:  TInt: Error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CMeasurementHandler::RunError( TInt aError )
+    {
+    __TRACE( KError,( 
+        _L( "CMeasurementHandler::RunError with error: %d" ), aError ) );
+
+    return aError;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CCommandHandler class member functions.
+    CCommandHandler listens command notifications from test thread.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandHandler
+
+    Method: NewL
+
+    Description: Constructs a new CCommandHandler object.
+
+    Parameters: CTestExecution& aExecution: in: "Parent"
+
+    Return Values: CCommandHandler*: New object
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CCommandHandler* CCommandHandler::NewL(CTestExecution& aExecution)
+    {
+    CCommandHandler* self = new (ELeave) CCommandHandler(aExecution);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandHandler
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CCommandHandler::ConstructL()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandHandler
+
+    Method: CCommandHandler
+
+    Description: Constructor
+
+    Parameters: CTestExecution& aExecution :in:   "Parent"
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CCommandHandler::CCommandHandler(CTestExecution& aExecution):
+    CActive(CActive::EPriorityStandard),
+    iExecution(aExecution)
+    {
+    CActiveScheduler::Add (this);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandHandler
+
+    Method: ~CCommandHandler
+
+    Description: Destructor.
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CCommandHandler::~CCommandHandler()
+    {
+    Cancel();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandHandler
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CCommandHandler::StartL()
+    {
+    __TRACE(KPrint, (_L( "CCommandHandler::StartL" )));
+
+    if(IsActive())
+        {
+        CTestServer::PanicServer(EAlreadyActive);
+        }
+    iStatus = KRequestPending;
+    SetActive();
+
+    // Signal test thread
+    iExecution.iCommandSem.Signal();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandHandler
+
+    Method: RunL
+
+    Description:
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CCommandHandler::RunL()
+    {
+    __TRACE(KPrint, (_L( "CCommandHandler::RunL [%d]"), iStatus.Int()));
+
+    iExecution.DoNotifyCommand();
+//    StartL();
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandHandler
+
+    Method: DoCancel
+
+    Description: Stops command notification listening.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+
+void CCommandHandler::DoCancel()
+    {
+    __TRACE(KPrint, (_L("CCommandHandler::DoCancel")));
+
+    iExecution.iCommandMutex.Wait();  // Take mutex and check test case receive
+                                      // operation. If pending take reveive
+                                      // semaphore and complete
+    if(iStatus == KRequestPending)
+        {
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete(status, KErrCancel);
+        }
+
+    iExecution.iCommandMutex.Signal();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandHandler
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here.
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError:                  :in:  Error code
+
+    Return Values:  TInt                            Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CCommandHandler::RunError(TInt aError)
+    {
+    __TRACE(KError, (_L("CCommandHandler::RunError")));
+
+    return aError;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandDef
+
+    Method: CCommandDef
+
+    Description: private constructor
+
+    Return Values:  void
+
+-------------------------------------------------------------------------------
+*/
+
+CCommandDef::CCommandDef()
+	{
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandDef
+
+    Method: ConstructL
+
+    Description: Second phase constructor
+
+    Return Values:  void
+
+-------------------------------------------------------------------------------
+*/
+
+void CCommandDef::ConstructL()
+	{
+
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandDef
+
+    Method: NewL
+
+    Description: First phase constructor
+
+    Return Values:  void
+
+-------------------------------------------------------------------------------
+*/
+
+CCommandDef* CCommandDef::NewL()
+	{
+	CCommandDef* self = new(ELeave) CCommandDef;
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCommandDef
+
+    Method: ~CCommandDef
+
+    Description: destructor
+
+-------------------------------------------------------------------------------
+*/
+
+CCommandDef::~CCommandDef()
+	{
+
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/Testserversession.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1704 @@
+/*
+* 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: This module contains implementation of CTestServer 
+* class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include "TestEngineClient.h"
+#include <StifTestModule.h>
+#include <stifinternal/TestServerClient.h>
+#include "TestServer.h"
+#include "TestServerCommon.h"
+#include "TestServerModuleIf.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+// Struct to pass parameters to server thread
+struct TThreadStartTestServerSession
+    {
+    RThread    iServerThread; // The server thread
+    RSemaphore iStarted;      // Startup syncronisation semaphore   
+    TInt       iStartupResult;// Start-up result
+    };
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: NewL
+
+    Description: Create new test cases list    
+
+    Parameters: const TDesC& aConfigFileName :in:  Config file name
+
+    Return Values: CTestCasesList* Pointer to new test cases list
+
+    Errors/Exceptions: Leaves if memory allocation fails or ConstructL leaves.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCasesList* CTestCasesList::NewL( const TDesC& aConfigFileName )
+    {    
+    CTestCasesList* self = new(ELeave)CTestCasesList;
+    CleanupStack::PushL( self );
+    self->ConstructL( aConfigFileName );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: ~CTestCasesList
+
+    Description: Destructor    
+
+    Parameters: 
+
+    Return Values: 
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCasesList::~CTestCasesList()
+    {
+    delete iConfigFileName;
+    iConfigFileName = NULL;
+    iTestCases.ResetAndDestroy();
+    iTestCases.Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: AppendTestCaseL
+
+    Description: Appends test case.
+
+    Parameters: const TDesC& aTestCaseTitle  in: Test case title
+
+    Return Values: 
+
+    Errors/Exceptions: Leaves if memory allocation fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCasesList::AppendTestCaseL( const TDesC& aTestCaseTitle )
+    {
+    HBufC* testCaseTitle = aTestCaseTitle.AllocL();
+    CleanupStack::PushL( testCaseTitle );
+    iTestCases.AppendL( testCaseTitle );
+    CleanupStack::Pop( testCaseTitle );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: GetTestCaseTitleL
+
+    Description: Returns specified test case title  
+
+    Parameters: TInt aIndex: in: Requested test case index. 
+
+    Return Values: Test case title.
+
+    Errors/Exceptions: Leaves if test case index is invalid
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestCasesList::GetTestCaseTitleL( TInt aIndex ) const
+    {    
+    if ( ( aIndex < 0 ) || ( aIndex >= iTestCases.Count() ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+    return *iTestCases[ aIndex ];
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: GetConfigFileName
+
+    Description: Returns config file name  
+
+    Parameters: 
+
+    Return Values: Config file name.
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestCasesList::GetConfigFileName() const
+    {    
+    return *iConfigFileName;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: Count
+
+    Description: Returns count of test cases.    
+
+    Parameters: 
+
+    Return Values: Test cases count.
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestCasesList::Count() const
+    {
+    return iTestCases.Count();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: ResetAndDestroy
+
+    Description: Resets list of test cases.    
+
+    Parameters: 
+
+    Return Values: 
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCasesList::ResetAndDestroy()
+    {    
+    iTestCases.ResetAndDestroy();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: ~CTestCasesList
+
+    Description: Destructor    
+
+    Parameters: 
+
+    Return Values: 
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestCasesList::CTestCasesList()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestCasesList
+
+    Method: ~CTestCasesList
+
+    Description: Destructor    
+
+    Parameters: 
+
+    Return Values: 
+
+    Errors/Exceptions: 
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestCasesList::ConstructL( const TDesC& aConfigFileName )
+    {
+    iConfigFileName = aConfigFileName.AllocL();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: NewL
+
+    Description: Create new Test Module    
+
+    Parameters: RThread& aClient              :in:  Handle to client
+                CTestServer* aServer          :in:  Pointer to server
+
+    Return Values: CTestModule*                     Pointer to new test module
+
+    Errors/Exceptions: Leaves if memory allocation fails or ConstructL leaves.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModule* CTestModule::NewL( CTestServer* aServer )
+    {
+
+    CTestModule* self=new( ELeave ) CTestModule();
+    CleanupStack::PushL( self );
+    self->ConstructL( aServer );
+    CleanupStack::Pop();
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: CTestModule
+
+    Description: Constructor.
+    Initialise base class.
+
+    Parameters: RThread& aClient              :in:  Handle to client
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestModule::CTestModule() :
+    CSession2(),
+    iIni(0, 0)
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: ~CTestModule
+
+    Description: Destructor.
+    Deallocate memory and close handles.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CTestModule::~CTestModule()
+    {
+
+    __TRACE( KVerbose, ( _L( "Closing test module" ) ) );
+        
+    // Free test case related data. No error checking here, because if freeing
+    // fails, then nothing can be done in destructor.
+    FreeCaseData();
+
+    // Delete all test module instances.
+    // Cleanup all RTestExecution has been opened by client but not properly
+    // closed for example if timeout occurs and client died. This almost do
+    // same than CloseSession() in "if( iTestExecutionHandle )" branch.
+    if( iTestExecutionHandle )
+        {
+        TInt handle = 0;
+        CObject* theObj = NULL;
+        TInt count = iTestExecutionHandle->Count();
+
+        for( TInt i = 0 ; i < count; i++ )
+            {
+            // Get pointer to CTestExecution
+            theObj=iTestExecutionHandle->operator[]( i );
+            if( theObj )
+                {
+                handle=iTestExecutionHandle->At( theObj );
+
+                CTestExecution* testcase = (CTestExecution*) theObj;
+                // Cancels test(s) execution(timeout, exit, etc)
+                // For example TestCombiner is timeouted => TestCombiner's
+                // TestServer+TestModule(s) should cancel also.
+                testcase->CancelTestExecution();
+                // CTestExecution will panic if test case is ongoing!!! This
+                // should be stopped, client should handless this.
+                iTestExecutionHandle->Remove( handle );
+                }
+            }
+
+        delete iTestExecutionHandle;
+        iTestExecutionHandle = NULL;
+
+        }
+
+    // Delete all FREE Test Module instances.
+    if( iTestModuleInstances )
+        {
+        iTestModuleInstances->ResetAndDestroy();
+        delete iTestModuleInstances;
+        iTestModuleInstances = NULL;
+        }
+
+    // Delete ini file heap buffer
+    delete iIniBuffer;
+    iIniBuffer = NULL;
+
+    // Delete array of test case titles
+    iTestCaseTitlesMap.ResetAndDestroy();
+    iTestCaseTitlesMap.Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+    
+    Parameters: CTestServer* aServer          :in:  Server
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if:
+                       base class CreateL leaves
+                       Object index creation fails
+                       Object container creation fails
+                       Pointer array construction fails                       
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModule::ConstructL( CTestServer* aServer )
+    {
+
+	__TRACE( KVerbose, ( _L( "CTestModule::ConstructL - constructing server session" ) ) );
+
+    // second-phase construct base class
+    //CSession2::CreateL( /* *aServer */ );
+    iTestServer = aServer;
+
+    // create new object index
+    iTestExecutionHandle = CObjectIx::NewL();
+
+    // Initialize the object container using the object
+    // container index in the server.
+    iContainer = iTestServer->NewContainerL();
+
+    iTestModuleInstances = new( ELeave ) RPointerArray<CTestModuleContainer>;
+
+	__TRACE( KError, ( _L( "CTestModule::ConstructL - constructing server session done" ) ) );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: CountResources
+
+    Description: Resource counting
+
+    Parameters: None
+
+    Return Values: TInt                             Resource count
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::CountResources()
+    {
+
+    return iResourceCount;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: NumResources
+
+    Description: Get resources, writes to Message()
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Panic client if result can't be written to descriptor.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModule::NumResources( const RMessage2& aMessage )
+    {
+
+    TPckgBuf<TInt> countPckg( iResourceCount );
+
+    TRAPD( r, aMessage.WriteL( 0, countPckg ) );
+    if( r !=KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: PanicClient
+
+    Description: Panic clients.
+
+    Parameters: TInt aPanic                   :in:  Panic code
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestModule::PanicClient( const TInt aPanic, const RMessage2& aMessage ) const
+    {
+
+    __TRACE( KError,( _L( "CTestModule::PanicClient code = %d" ), aPanic ) );
+
+    _LIT( KTxtTestModule,"CTestModule" );
+
+    aMessage.Panic( KTxtTestModule, aPanic );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: CloseSession
+
+    Description: Close session
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::CloseSession( const RMessage2& aMessage )
+    {
+
+    __TRACE( KMessage,( _L( "CTestModule::CloseSession in" ) ) );
+
+    // Delete all unclosed subsession handle before closing session.
+    // Remove iTestExecutionHandle contents. iTestExecutionHandle countains
+    // CTestExecution that handles test case have been created.
+    if( iTestExecutionHandle )
+        {
+        TInt handle = 0;
+        CObject* theObj = NULL;
+        TInt count = iTestExecutionHandle->Count();        
+        for ( TInt i = count - 1; i >= 0; i-- )
+            {
+            theObj=iTestExecutionHandle->operator[]( i );
+            if( theObj )
+                {
+                handle=iTestExecutionHandle->At( theObj );
+                // CTestExecution will panic if test case is ongoing!!! This
+                // should be stopped, client should handle this.
+                iTestExecutionHandle->Remove( handle );
+                }
+            }
+
+        delete iTestExecutionHandle;
+        iTestExecutionHandle = NULL;
+        }
+
+    // Deletion must be done here, because the "CloseSession" message is 
+    // completed before execution continues from CActiveScheduler::Start 
+    // location, and the main thread can continue execution 
+    // and therefore shutdown itself and all threads in that process.
+    
+    // Delete the object container
+    iTestServer->DeleteContainer( iContainer );
+
+    // Free test case related data
+    TInt r = FreeCaseData();
+
+    // Delete all FREE Test Module instances
+    iTestModuleInstances->ResetAndDestroy();
+    delete iTestModuleInstances;
+    iTestModuleInstances = NULL;
+
+     // Inform server that session is closed
+    iTestServer->SessionClosed();
+
+	// Check for avoiding multiple complete, see CTestModule::ServiceL()
+    if( r != KErrNone )
+        {
+		// In error cases do not complete, just return
+        __TRACE( KMessage,( _L( "CTestModule::CloseSession out (1)" ) ) );
+        return r;
+        }
+
+    aMessage.Complete( KErrNone );
+
+    // After active scheduler shutdown is done, execution continues from
+    // CTestServer::ThreadFunction()
+
+    __TRACE( KMessage,( _L( "CTestModule::CloseSession out (2)" ) ) );
+    return r;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: ServiceL
+
+    Description: Trap harness for dispatcher
+
+    Parameters: const RMessage& aMessage  :inout:   Message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModule::ServiceL( const RMessage2& aMessage )
+    {
+
+    // NOTE! HW testing slows down dramatically if adds commants here
+
+    //__TRACE( KMessage,( _L( "CTestModule::ServiceL in" ) ) );
+
+    TInt r = KErrNone;
+    TRAPD( ret, r = DispatchMessageL( aMessage ) );
+
+    if ( ret != KErrNone )
+        {
+        // Complete message on leaving cases with leave code.
+        __TRACE( KError, ( CStifLogger::ERed, _L( "CTestModule::DispatchMessageL leaved" ) ) );
+        aMessage.Complete( ret );
+        }
+
+    // Complete message with error code originating from message handling
+    // function.
+    if ( r != KErrNone )
+        {
+        __TRACE( KError, ( CStifLogger::ERed, _L( "CTestModule::DispatchMessageL returned error" ) ) );
+        aMessage.Complete( r );
+        }
+
+     // __TRACE( KMessage,( _L( "CTestModule::ServiceL out" ) ) );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: DispatchMessageL
+
+    Description: Dispatch message, calls corresponding function to do it.
+
+    Parameters: const RMessage& aMessage  :inout:   Message to be handled
+
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: Leaves if operation handling function leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::DispatchMessageL( const RMessage2& aMessage )
+    {
+
+    __TRACE( KMessage,( _L( "CTestModule::DispatchMessageL %d" ),
+        aMessage.Function()  ) );
+    switch( aMessage.Function() )
+    {
+    // Session specific
+    case ETestServerCloseSession:                // Close whole session
+        {
+		__TRACE( KError ,( _L( "Closing test module session" ) ) );
+        return CloseSession( aMessage );
+        }
+    case ETestServerGetServerThreadId:           // Get Server ThreadId
+        {
+		__TRACE( KError ,( _L( "Return server thread id" ) ) );
+        return GetServerThreadIdL( aMessage );
+        }
+
+    case ETestServerPassEngineSessionSettings:
+        {
+        __TRACE( KError ,( _L( "Passing test engine session settings to testserver session" ) ) );
+        return PassEngineSessionSettings( aMessage );
+        }
+        
+    case ETestModuleCreateSubSession :           // Create new test module subsession
+        {
+		__TRACE( KError,( _L( "Creating test module session" ) ) );
+        return CreateModuleSessionL( aMessage );
+        }
+
+    case ETestModuleCloseSubSession:             // Close module subsession
+        {
+        // Nothing to do.
+        aMessage.Complete( KErrNone );
+        return KErrNone;
+        }
+
+    case ETestExecutionCreateSubSession:         // Create new test execution subsession
+        {
+        return NewTestExecutionL( aMessage );
+        }
+ 
+    case ETestModuleEnumerateTestCases:          // Enumerate test cases
+        {
+		__TRACE( KError,( _L( "Enumerating test cases" ) ) );
+        return EnumerateTestCasesL( aMessage );
+        }
+        
+    case ETestModuleGetTestCases:                // Get test cases
+        {
+        return GetTestCasesL( aMessage );
+        }
+
+    case ETestModuleErrorNotification:           // Request error notification
+        {
+        return HandleErrorNotificationL( aMessage );
+        }
+
+    case ETestModuleCancelAsyncRequest:
+        {
+        return CancelAsyncRequestL( aMessage );
+        }
+  
+    // Subsession specific
+    case ETestExecutionRunTestCase:              // Run test case
+        {
+		__TRACE( KInit,( _L( "Running test case" ) ) );
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->RunTestCase( aMessage );
+        }
+        
+    case ETestExecutionNotifyProgress:           // Test case prints
+        {
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->NotifyPrint( aMessage );
+        }
+
+    case ETestExecutionNotifyEvent:              // Event notifications
+        {
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->NotifyEvent( aMessage );
+        }
+        
+    case ETestExecutionNotifyRemoteCmd:          // RemoteCmd notifications
+        {
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->NotifyRemoteCmd( aMessage );
+        }
+    case ETestExecutionReadRemoteCmdInfo:          // RemoteCmd reading
+        {
+        //CTestExecution* testCase=CaseFromHandle( aMessage.Int3() );
+        //return testCase->NotifyRemoteCmd( aMessage );
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->ReadRemoteCmdInfo( aMessage );
+        }
+
+
+    case ETestExecutionResume:                   // Resume case execution
+        {
+		__TRACE( KVerbose,( _L( "Resuming test execution" ) ) );
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->Resume( aMessage );
+        }
+        
+    case ETestExecutionPause:                    // Pause case execution
+        {
+		__TRACE( KVerbose,( _L( "Pausing test execution" ) ) );
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->Pause( aMessage );
+        }
+            
+    case ETestExecutionCloseSubSession:          // Close execution subsession
+        {
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->CloseTestExecution( aMessage );
+        }
+
+    case ETestExecutionCancelAsyncRequest:       // Cancel async request
+        {
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->CancelRequestL( aMessage );
+        }
+    case ETestExecutionNotifyCommand:            // Command notifications
+        {
+        CTestExecution* testCase=CaseFromHandle( aMessage.Int3(), aMessage );
+        return testCase->NotifyCommand( aMessage );
+        }
+
+    default:                                     // Invalid request
+        {
+        PanicClient( EBadRequest, aMessage );
+        return KErrNotSupported;
+        }
+    }
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: EnumerateTestCases
+
+    Description: Enumerates test cases and returns test case count by writing
+    result to client side package.
+
+    Function obtains a TestModule and calls EnumerateTestCases from it.
+    Test module will be released when calling GetTestCases function.
+
+    Parameters: const RMessage& aMessage  :inout:   Message to be handled
+
+    Return Values: TInt                             Operation result
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::EnumerateTestCasesL( const RMessage2& aMessage )
+    {
+
+    __TRACE( KMessage,( _L( "CTestModule::EnumerateTestCasesL in" ) ) );
+ 
+    // Get data from message
+    TFileName config;
+    TRAPD( res, aMessage.ReadL( 0, config ) );
+    if(res == KErrDied)
+        {
+        RDebug::Print(_L("CTestModule::EnumerateTestCasesL() Reading from RMessage ended with KErrDied. Client is not alive anymore and this request will be ignored"));
+        return res;
+        }
+    else if( res != KErrNone )
+        {
+        RDebug::Print(_L("CTestModule::EnumerateTestCasesL() #1 Panic client with [%d], res=[%d]"), EBadDescriptor, res);
+        PanicClient( EBadDescriptor, aMessage );
+        return res;
+        }
+
+    // Free old case data
+    User::LeaveIfError( FreeCaseData() );
+
+    // Get test cases from the test module
+    User::LeaveIfError( GetTestModule( iEnumerateModule, config ) );
+
+    // Enumerate test cases
+    iEnumerateModule->EnumerateTestCases( config );
+
+    // Something fatal?
+    TInt r = iEnumerateModule->OperationErrorResult();
+    if(  r != KErrNone )
+        {
+        // Enumeration module have crashed.
+        delete iEnumerateModule;
+        iEnumerateModule = NULL;
+
+        return r;
+        }
+
+    // Error from module?
+    if( iEnumerateModule->ModuleResult() != KErrNone )
+        {
+        return iEnumerateModule->ModuleResult();
+        }
+
+    // Write count to Ptr1()
+    const RPointerArray<TTestCaseInfo>* testCases = iEnumerateModule->TestCases();
+    
+    if( testCases == NULL )
+        {
+        User::Leave( KErrGeneral );
+        }
+    
+    CTestCasesList* testCasesList = NULL;
+    for ( TInt i = 0; i < iTestCaseTitlesMap.Count(); i++ )
+        {
+        if ( iTestCaseTitlesMap[ i ]->GetConfigFileName() == config )
+            {
+            testCasesList = iTestCaseTitlesMap[ i ];
+            break;
+            }
+        }
+    if ( testCasesList == NULL )
+        {
+        testCasesList = CTestCasesList::NewL( config );
+        CleanupStack::PushL( testCasesList );
+        iTestCaseTitlesMap.AppendL( testCasesList );
+        CleanupStack::Pop( testCasesList );
+        }
+    
+    // Store titles (for further use, i.e. when asked for title from the interface via CTestModuleIf->CTestThreadContainer->CTestModuleContainer)
+    testCasesList->ResetAndDestroy();
+    TInt i;
+    for(i = 0; i < testCases->Count(); i++)
+        {
+        //Handle situation when test cases are enumerated not as 0-based (testscripter, ...)
+        if(i == 0 && (*testCases)[i]->iCaseNumber > 0)
+            {
+            testCasesList->AppendTestCaseL( KNullDesC );
+            }
+        testCasesList->AppendTestCaseL( (*testCases)[i]->iTitle );
+        }
+    
+    TPckgBuf<TInt> countPckg( testCases->Count() );
+    TRAP( res, aMessage.WriteL( 1, countPckg ) );
+    if(res == KErrDied)
+        {
+        RDebug::Print(_L("CTestModule::EnumerateTestCasesL() Writing to RMessage ended with KErrDied. Client is not alive anymore and this request will be ignored"));
+        return res;
+        }
+    else if( res != KErrNone )
+        {
+        RDebug::Print(_L("CTestModule::EnumerateTestCasesL() #2 Panic client with [%d], res=[%d], config=[%S]"), EBadDescriptor, res, &config);
+        PanicClient( EBadDescriptor, aMessage );
+        return res;
+        }
+
+    // All ok, complete message
+    aMessage.Complete( KErrNone );
+
+    __TRACE( KMessage,( _L( "CTestModule::EnumerateTestCasesL out" ) ) );
+    
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCasesL
+
+    Description: Get test cases. Enumerate test cases must be called before
+    calling this function.
+
+    Function releases the test module reserved by EnumerateTestCase().
+
+    Parameters: const RMessage& aMessage  :inout:   Message to be handled
+
+    Return Values: TInt                             Operation result
+
+    Errors/Exceptions: Leaves if cases have not been enumerated.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::GetTestCasesL( const RMessage2& aMessage )
+    {
+
+    __TRACE( KMessage,( _L( "CTestModule::GetTestCasesL in" ) ) );
+
+    // Leave if cases have not been enumerated.
+    //User::LeaveIfNull(( TAny* ) iEnumerateModule->TestCases() );
+    if( ( TAny* ) iEnumerateModule->TestCases() == NULL )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    const TInt len = sizeof( TTestCaseInfo );
+    
+    // Get cases
+    const RPointerArray<TTestCaseInfo>& cases = *iEnumerateModule->TestCases();
+
+    // Get number of cases
+    const TInt Kcount = cases.Count();
+
+    // Loop through case and copy then to client's descriptor.
+    for( TInt i = 0; i < Kcount; i++ )
+        {
+
+        // Construct package for source data
+        TTestCaseInfoPckg tmpPackage( *cases[i] );
+
+        // Write to correct location
+        aMessage.WriteL( 0, tmpPackage, i *len );
+
+        }
+
+    // Free case data and the test module
+    User::LeaveIfError( FreeCaseData() );
+
+    // Finished
+    aMessage.Complete( KErrNone );
+
+    __TRACE( KMessage,( _L( "CTestModule::GetTestCasesL out" ) ) );
+
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: HandleErrorNotification
+
+    Description: Request error notification.
+
+    Parameters: const RMessage& aMessage  :inout:   Message to be handled
+
+    Return Values: TInt                             Operation result
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::HandleErrorNotificationL( const RMessage2& aMessage )
+    {
+    
+    iErrorMessage = aMessage;
+    iErrorMessageAvailable = ETrue;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetServerThreadId
+
+    Description: Request server state notification.
+
+    Parameters: const RMessage& aMessage :inout: Message to be handled
+
+    Return Values: TInt Operation result
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::GetServerThreadIdL( const RMessage2& aMessage )
+    {
+      
+    TInt id( iTestServer->GetServerThreadId() );
+   
+    TPckg<TThreadId> threadIdPckg( id );
+   
+    TRAPD( res, aMessage.WriteL( 0, threadIdPckg ) );
+    
+      // Finished
+    aMessage.Complete( res );
+    
+    return KErrNone;
+
+    }      
+
+TInt CTestModule::PassEngineSessionSettings( const RMessage2& aMessage )
+    {
+    TPckgBuf<TEngineSettings> engineSettings;
+    
+    TRAPD( ret, aMessage.ReadL( 0, engineSettings, 0 ) );
+    
+    iUiTesting = engineSettings().iUITestingSupport;
+    iSeperateProcesses  = engineSettings().iSeparateProcesses;
+    
+    aMessage.Complete( ret );
+    
+    return KErrNone;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: CancelAsyncRequest
+
+    Description: Cancels asynchronous request
+
+    Parameters: const RMessage& aMessage  :inout:   Message to be handled
+
+    Return Values: TInt                             Operation result
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::CancelAsyncRequestL( const RMessage2& aMessage )
+    {
+    
+    switch ( aMessage.Int0() )
+        {
+        case ETestModuleErrorNotification:
+            {
+            if ( iErrorMessageAvailable )
+                {
+                iErrorMessage.Complete ( KErrCancel );
+                iErrorMessageAvailable = EFalse;
+                }
+            aMessage.Complete ( KErrNone );
+            break;
+            }
+
+        default:
+            {
+            PanicClient( EInvalidRequestCancel, aMessage );
+            break;
+            }
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: ErrorPrint
+
+    Description: Prints error
+
+    Parameters: const TInt aPriority :in: Priority
+                TPtrC aError: in: Error
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModule::ErrorPrint( const TInt aPriority, 
+                              TPtrC aError )
+    {
+
+    if ( iErrorMessageAvailable )
+        {        
+        TErrorNotification error;
+        TErrorNotificationPckg errorPckg ( error );
+
+        error.iModule = _L("TestServer");
+        error.iPriority = aPriority;
+        error.iText = aError;
+
+        TRAPD( r, iErrorMessage.WriteL( 0, errorPckg ) );
+        
+        // Do not handle errors
+        iErrorMessageAvailable = EFalse;
+        iErrorMessage.Complete( r );
+
+        }
+    else
+        {
+        RDebug::Print (_L("Error message lost %d [%S]"), aPriority, &aError );
+        }
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: FreeCaseData
+
+    Description: Frees the test case data and test module that is used in
+    enumeration.
+
+    Parameters: None
+
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::FreeCaseData()
+    {
+
+    __TRACE( KMessage,( _L( "CTestModule::FreeCaseData in" ) ) );
+ 
+    TInt r = KErrNone;
+
+    if( iEnumerateModule )
+        {
+        
+        // Deallocate testcase memory
+        iEnumerateModule->FreeEnumerationData();
+
+        // Free the module
+        r = FreeTestModule( iEnumerateModule );
+
+        iEnumerateModule = NULL;
+
+        }
+
+    __TRACE( KMessage,( _L( "CTestModule::FreeCaseData out" ) ) );
+
+    return r;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: CreateModuleSessionL
+
+    Description: Creates a new module session.
+    Just take the initialisation file name from message.
+
+    Parameters: const RMessage& aMessage  :inout:   Message to be handled
+
+    Return Values: TInt                             Operation result
+
+    Errors/Exceptions: Leaves if memory allocation fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::CreateModuleSessionL( const RMessage2& aMessage )
+    {
+
+    __TRACE( KMessage,( _L( "CTestModule::CreateModuleSession in" ) ) );
+
+    // Take parameters
+    TFileName ini;
+    TRAPD( res, aMessage.ReadL( 0, ini ) );
+    if( res != KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        return res;
+        }
+
+    // Construct heap buffer for initialization file name
+    iIniBuffer = HBufC::NewL( ini.Length() );
+    iIni.Set ( iIniBuffer->Des() );
+    iIni.Copy ( ini );
+
+    aMessage.Complete( KErrNone );
+
+    __TRACE( KMessage,( _L( "CTestModule::CreateModuleSession out" ) ) );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: NewTestExecutionL
+
+    Description: Create new test execution subsession
+    
+    Parameters: const RMessage& aMessage  :inout:   Message to be handled
+    
+    Return Values: TInt                             Operation result
+
+    Errors/Exceptions: Function leaves if object can't be created or
+                       it can't be added to container.
+                       Function panics client if message contains invalid
+                       descriptor.
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::NewTestExecutionL( const RMessage2& aMessage )
+    {
+
+    __TRACE( KMessage,( _L( "CTestModule::NewTestExecutionL in" ) ) );
+
+    // Get data from message
+    TInt caseNumber = aMessage.Int0();
+    TFileName config;
+    
+    TRAPD( res, aMessage.ReadL( 1, config ) );
+    if( res != KErrNone )
+        {
+        PanicClient( EBadDescriptor, aMessage );
+        return res;
+        }
+
+    // Make new object
+    CTestExecution* execution=CTestExecution::NewL( this, caseNumber, config );
+
+    // add object to object container to generate unique id
+    iContainer->AddL( execution );
+
+    // add object to object index; this returns a unique handle so we can get it again
+    TInt handle=iTestExecutionHandle->AddL( execution );
+
+    // write the handle to client
+    TPckg<TInt> handlePckg( handle );
+    TRAP( res, aMessage.WriteL( 3, handlePckg ) );
+    if( res != KErrNone )
+        {
+        iTestExecutionHandle->Remove( handle );
+        PanicClient( EBadDescriptor, aMessage );
+        return res;
+        }
+
+    // notch up another resource
+    iResourceCount++;
+
+    // Complete message
+    aMessage.Complete( KErrNone );
+
+    __TRACE( KMessage,( _L( "CTestModule::NewTestExecutionL out" ) ) );
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: DeleteTestExecution
+
+    Description: Deletes Test Execution by handle
+
+    Parameters: const TUint aHandle           :in:  Handle
+
+    Return Values: None
+
+    Errors/Exceptions: Panics client if invalid handle
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CTestModule::DeleteTestExecution( const TUint aHandle, const RMessage2& aMessage )
+    {
+
+    // Verify that handle is valid
+    CaseFromHandle( aHandle, aMessage );
+
+    // Remove object
+    iTestExecutionHandle->Remove( aHandle );
+
+    // Decrement resource count.
+    iResourceCount--;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: CaseFromHandle
+
+    Description: Return subsession from handle
+
+    Parameters: const TUint aHandle           :in:  Handle
+
+    Return Values: CTestExecution*                  Test Execution object
+
+    Errors/Exceptions: Function panics client if invalid handle.
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CTestExecution* CTestModule::CaseFromHandle( const TUint aHandle, const RMessage2& aMessage ) const
+    {
+
+    CTestExecution* testcase =( CTestExecution* ) iTestExecutionHandle->At( aHandle );
+
+    if( testcase == NULL )
+        {
+        PanicClient( EBadSubsessionHandle, aMessage );
+        }
+
+    return testcase;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestModule
+
+    Description: Gets a CTestModuleBase*. If there is a free entry
+    in the free list, then it is returned. Otherwise a new one is created.
+
+    Parameters: CTestModuleContainer*& aContainer: out: container pointer.
+                const TDesC& aConfig: in: Test case (config) file name.
+
+    Return Values: Symbian OS error code
+    
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::GetTestModule( CTestModuleContainer*& aContainer,
+                                    const TDesC& aConfig )
+    {
+    TInt ret = KErrNone;
+
+    if( iTestModuleInstances->Count() )
+        {
+        // Return an existing one        
+        aContainer =( *iTestModuleInstances )[0];
+        iTestModuleInstances->Remove( 0 );
+		__TRACE( KInit,( _L( "Reusing old test module container instance at 0x%x" ), (TUint32) aContainer ) );
+        }
+    else
+        {
+        // Create a new one    
+        __TRACE( KInit,( _L( "Creating new test module instance" ) ) );
+        TRAPD( err, aContainer = CTestModuleContainer::NewL( 
+                                                iTestServer->ModuleName(),
+                                                this,
+                                                aConfig ) );
+
+        // If module can't be created, then return NULL.
+        if( err )
+            {
+            __TRACE( KError,( _L( "Can't create new test module container instance" ) ) );
+            aContainer = NULL;
+            ret = err;
+            }
+		else
+			{
+			__TRACE( KInit,( _L( "Test module instance container created" ) ) );
+			}
+
+        if( aContainer )
+            {
+
+            // Initialise module
+            aContainer->Initialize( iTestServer->ModuleName(), iTestServer->FirstTime() );
+
+            if( aContainer->OperationErrorResult() != KErrNone )
+                {
+                // Can't initialise module, delete it
+                __TRACE( KError,( CStifLogger::ERed, _L( "Operation error, can't initialize test module container instance" ) ) );
+                ret = aContainer->OperationErrorResult();                    
+                delete aContainer;
+                aContainer = NULL;
+                }
+            else if( aContainer->ModuleResult() != KErrNone )
+                {
+                // Can't initialise module, delete it
+                __TRACE( KError,( CStifLogger::ERed, _L( "Module error, can't initialize test module container instance" ) ) );
+                ret = aContainer->ModuleResult();
+                delete aContainer;
+                aContainer = NULL;
+                }
+            else
+                {
+                // Module initialised properly, clear the first time flag.
+                iTestServer->ClearFirstTime();
+				__TRACE( KInit,( _L( "Test module container initialized at 0x%x" ), (TUint32) aContainer ) );
+                }
+            }
+        }
+
+    return ret;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: FreeTestModule
+
+    Description:Frees a CTestModuleContainer. This function can be called
+    from the context of the test execution thread.
+    
+    Parameters: CTestModuleContainer* aModule :in:  Module to be freed
+    
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::FreeTestModule( CTestModuleContainer* aModule )
+    {
+  
+    // Free the module
+    TInt r = iTestModuleInstances->Append( aModule );
+    if( r != KErrNone )
+        {
+        delete aModule;
+        aModule = NULL;
+        }
+
+    return r;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: IniName
+
+    Returns the initialisation file name
+    
+    Parameters: None
+    
+    Return Values: const TDesC&                     Initialisation file name
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+const TDesC& CTestModule::IniName() const
+    {
+
+    return iIni;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: Name
+
+    Returns the module name
+    
+    Parameters: None
+    
+    Return Values: const TDesC&                     Initialisation file name
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+const TDesC& CTestModule::Name() const
+    {
+
+    return iTestServer->ModuleName();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCaseTitleL
+
+    Gets title of currently running test case
+    
+    Parameters: None
+    
+    Return Values: TInt aTestCaseNumber: in: index of currently running test case
+                   TDes& aTestCaseTitle: out: test case title
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CTestModule::GetTestCaseTitleL(TInt aTestCaseNumber, const TDesC& aConfigFile,TDes& aTestCaseTitle)
+    {
+    CTestCasesList* testCasesList = NULL;
+    for ( TInt i = 0; i < iTestCaseTitlesMap.Count(); i++ )
+        {
+        if ( iTestCaseTitlesMap[ i ]->GetConfigFileName() == aConfigFile )
+            {
+            testCasesList = iTestCaseTitlesMap[ i ];
+            break;
+            }
+        }
+    if ( testCasesList == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    RDebug::Print(_L("Trying to get test case title from module. Index=%d, count=%d"), aTestCaseNumber, testCasesList->Count() );
+    
+    aTestCaseTitle.Copy( testCasesList->GetTestCaseTitleL( aTestCaseNumber ) );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestServer
+
+    Gets pointer to TestServer
+    
+    Parameters: None
+    
+    Return Values: CTestServer : pointer to TestServer
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CTestServer* CTestModule::GetTestServer()
+    {
+    return iTestServer;
+    }
+
+TBool CTestModule::UiTesting()
+    {
+    return iUiTesting;
+    }
+
+TBool CTestModule::SeperateProcesses()
+    {
+    return iSeperateProcesses;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrv/src/Testundertaker.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,492 @@
+/*
+* 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: This module contains implementation of CUnderTaker 
+* class member functions. CUnderTaker is a class, which listens 
+* on Test Execution Thread death, and if that thread dies, then 
+* UnderTaker aborts the ongoing test execution request.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include "TestEngineClient.h"
+#include <StifTestModule.h>
+#include <stifinternal/TestServerClient.h>
+#include "TestServer.h"
+#include "TestServerModuleIf.h"
+#include "TestServerCommon.h"
+#include "PrintQueue.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: NewL
+
+    Description: Constructs a new CUnderTaker object.
+
+    Parameters: CTestModuleContainer* aContainer :in:   "Parent"
+
+    Return Values: CUnderTaker*                         New undertaker
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves.
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+CUnderTaker* CUnderTaker::NewL( CTestModuleContainer* aContainer )
+    {
+
+    CUnderTaker* self = new( ELeave ) CUnderTaker();
+    CleanupStack::PushL( self );
+    self->ConstructL( aContainer );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CTestModuleContainer* aExecution :in:   "Parent"
+
+    Return Values: None
+
+    Errors/Exceptions: Panics if aContainer is NULL
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CUnderTaker::ConstructL( CTestModuleContainer* aContainer )
+    {
+
+    __ASSERT_ALWAYS( aContainer, 
+                     CTestServer::PanicServer( ENullTestModuleContainer ) );
+
+    iModuleContainer = aContainer;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: CUnderTaker
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CUnderTaker::CUnderTaker() :
+    CActive( CActive::EPriorityHigh+1 )
+    {
+
+    // By default in asynchronous mode
+    iSynchronousMode = EFalse;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: ~CUnderTaker
+
+    Description: Destructor. 
+    Cancels active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+CUnderTaker::~CUnderTaker()
+    {
+
+    Cancel();
+
+    }
+
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: StartL
+
+    Description: Starts to monitor thread.
+
+    Parameters: None
+
+    Return Values: TInt                             Always KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CUnderTaker::StartL()
+    {
+    
+    SetActive();
+    iModuleContainer->iThread.Logon( iStatus );
+    iCancelNeeded = ETrue;
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: RunL
+
+    Description: Handles thread death.
+    Function does:
+    1 ) Stops monitoring thread
+    1 ) Marks thread death
+    2 ) Completes ongoing requests
+    3 ) Cleans the memory
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CUnderTaker::RunL()
+    {
+
+    // Make sure that any of the test interference thread's won't stay to run.
+    iModuleContainer->KillTestinterferenceThread();
+
+    // Make sure that any of the test measurement's process won't stay to run.
+    iModuleContainer->KillTestMeasurement();
+
+    // Get the exit category
+    TName exitCategory = _L( "Crash reason:" );
+    exitCategory.Append( iModuleContainer->iThread.ExitCategory() );
+    TInt exitReason = iModuleContainer->iThread.ExitReason();
+    TFullTestResult::TCaseExecutionResult exitType = TFullTestResult::ECaseException;
+    if( iModuleContainer->iThread.ExitType() == EExitPanic )
+        {
+        exitType = TFullTestResult::ECasePanic;
+        }    
+
+    // it is not running anymore..
+    iModuleContainer->iUpAndRunning = EFalse;
+
+    // Do not monitor anymore.
+    iModuleContainer->iThread.LogonCancel( iStatus );
+    iCancelNeeded = EFalse;
+
+    __TRACE( KError,( CStifLogger::ERed, _L( "Execution thread crashed, exitReason = %d" ), exitReason ) );
+    __TRACE( KError,( CStifLogger::ERed, exitCategory ) );    
+
+    if ( iSynchronousMode )
+        {        
+
+        // Synchronous request was running. Complete that 
+          // operation.
+        __TRACE( KVerbose,( _L( "CUnderTaker::RunL Crash during synchronous operation" ) ) );
+        iModuleContainer->iErrorResult = KErrDied;
+        iModuleContainer->Cancel();
+        iModuleContainer->iUpAndRunning = EFalse;
+
+        // Print notification
+        TName operationText = _L("Test module died when calling:");
+        operationText.Append( iModuleContainer->iOperationText );
+
+        // Print to log file        
+        __TRACE( KError,( CStifLogger::ERed, operationText ) );
+        // Print to UI
+        iModuleContainer->iCTestModule->ErrorPrint ( 1, operationText );        
+
+        // Stop active scheduler.
+        CActiveScheduler::Stop();
+
+        // Execution continues from CTestModuleContainer::StartAndWaitOperation.
+
+        }
+    else
+        {// Test case was running, 
+
+        __TRACE( KError,( _L( "Test case execution aborted" ) ) );
+        __TRACE( KVerbose,( _L( "CUnderTaker::Run crash during test execution" ) ) );      
+
+        TInt caseResult = KErrGeneral;
+        
+        // Check if case have any special panic or exception codes that are "passed"
+        if ( iModuleContainer->iAllowedExitReason != 
+             CTestModuleIf::ENormal )            
+            {
+                
+            if ( iModuleContainer->iAllowedExitReason == 
+                 CTestModuleIf::EPanic &&
+                 exitType == TFullTestResult::ECasePanic &&
+                 iModuleContainer->iAllowedExitCode == exitReason )
+                {
+                exitType = TFullTestResult::ECaseExecuted;
+                caseResult = KErrNone;
+                exitCategory = _L("Allowed case panic");
+                
+                __TRACE( KError,( _L( "Test case execution panic, setting to OK" ) ) );
+                }
+
+            if ( iModuleContainer->iAllowedExitReason == 
+                 CTestModuleIf::EException &&
+                 exitType == TFullTestResult::ECaseException &&
+                 iModuleContainer->iAllowedExitCode == exitReason )
+                {
+                exitType = TFullTestResult::ECaseExecuted;
+                caseResult = KErrNone;
+                exitCategory = _L("Allowed case exception");
+
+                __TRACE( KError,( _L( "Test case execution exception, setting to OK" ) ) );
+                }
+            
+            
+            }
+
+        // This was asynchronous request, and nobody is waiting for it
+        // completion in server, so all clean-up must be done here
+
+        // Forget iTestThreadContainer pointer, memory is freed because test thread
+        // is destroyed   
+        // This is needed to prevent from accessing memory from thread that is destroyed.
+        // Do this only if test is been executed.
+        iModuleContainer->iThreadContainer = NULL;
+
+        if (iModuleContainer->iCTestExecution != NULL)
+        	{
+			// Execution thread have been killed
+			iModuleContainer->iCTestExecution->SetThreadState( CTestExecution::ECancelled );
+	
+			
+			// Cancel the request
+			iModuleContainer->iCTestExecution->CompleteTestExecution( KErrNone,
+																	  exitType,
+																	  exitReason,
+																	  caseResult,
+																	  exitCategory );
+	
+			// If the print queue is empty, and there is active print
+			// request, then cancel that request. 
+			// NOTE: Case queue not empty AND request waiting AND
+			//       thread terminated can't happen due iPrintMutex
+			iModuleContainer->iCTestExecution->CompletePrintRequestIfQueueEmpty();
+        	}
+        else
+        	{
+        	__TRACE( KError,( _L( "STIF internal error - iCTestExecution is NULL in CUnderTaker::RunL." ) ) );
+        	User::Leave(KErrGeneral);
+        	}
+        // Free the memory
+        // Remove undertaker from module container to make sure that
+        // it does not delete this.
+        iModuleContainer->iUnderTaker = NULL;
+        delete iModuleContainer;
+        iModuleContainer = NULL;
+
+        // Suicide. "Parent", i.e iModuleContainer has already died
+        // and no-one have pointer to this active object, so die.
+        delete this;
+
+        }
+       
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: DoCancel
+
+    Description: Stops thread monitoring
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+
+void CUnderTaker::DoCancel()
+    {
+
+    if( iCancelNeeded && iModuleContainer )
+        {
+        iModuleContainer->iThread.LogonCancel( iStatus );
+        }
+    else
+        {
+        // Note that iModuleContainer can be NULL if iCancelNeeded is EFalse
+        __ASSERT_ALWAYS( iModuleContainer, 
+                         CTestServer::PanicServer( ENullTestModuleContainer ) );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: RunError
+
+    Description: Handle errors. RunL function does not leave, so one should
+    never come here. 
+
+    Print trace and let framework handle error( i.e to do Panic )
+
+    Parameters: TInt aError:                  :in:  Error code
+
+    Return Values:  TInt                            Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CUnderTaker::RunError( TInt aError )
+    {
+    __TRACE( KError,( _L( "CUnderTaker::RunError" ) ) );
+
+    return aError;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: Completed
+
+    Description: Is request completed
+
+    Parameters: None
+
+    Return Values:  TBool                           Completed?
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CUnderTaker::Completed()
+    {
+
+    if( iStatus == KRequestPending )
+        {
+        return EFalse;
+        }
+    else
+        {
+        return ETrue;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUnderTaker
+
+    Method: SetSynchronousMode
+
+    Description: Set or unsets local processing mode
+
+    Parameters: const TBool aMode             :in:  Mode
+
+    Return Values:  None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CUnderTaker::SetSynchronousMode( const TBool aMode )
+    {
+
+    iSynchronousMode = aMode;
+   
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrvstarter/group/TestServerStarter.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* 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: MMP file for STIF Test Framework's TestServerStarter 
+* module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET          TestServerStarter.exe
+TARGETTYPE      exe
+
+CAPABILITY	ALL -TCB
+VENDORID 	0x101FB657
+SECUREID        0x102073E4
+
+/* Include paths */
+USERINCLUDE     ../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+/* Source files */
+SOURCEPATH      ../src
+
+SOURCE          TestServerStarter.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY         stiftestserver.lib
+
+/* Test Server requires large stack */
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrvstarter/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for Test Framework's Console UI.
+*/
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	TestServerStarter.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/testsrvstarter/src/TestServerStarter.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,113 @@
+/*
+* 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: This file contains TestServerStarter implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stifinternal/TestServerClient.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: 
+
+    Parameters: None
+
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+GLDEF_C TInt E32Main()
+    {
+
+    RDebug::Print(_L("STF: New process starting"));
+
+    // Get module name from command line
+	const TInt length = User().CommandLineLength();
+
+    HBufC* cmdLine = HBufC::New( length );
+    
+    if ( cmdLine == NULL )
+        {
+        return KErrNoMemory;
+        }
+
+    TPtr moduleName = cmdLine->Des();
+
+	User().CommandLine( moduleName );
+
+    RDebug::Print(_L("STF: Received data [%S]"), &moduleName);
+
+    // Extract semaphore name passed in data
+    TInt index = moduleName.Find(_L(" "));
+    RDebug::Print(_L("STF: Space separator found at position [%d]"), index);
+    TPtrC semaphoreName = moduleName.Mid(index + 1);
+    moduleName = moduleName.Left(index);
+
+    RDebug::Print(_L("STF: Extracted module name [%S] and sempahore name [%S]"), &moduleName, &semaphoreName);
+
+    // Open start-up synchronization semaphore
+    RSemaphore startup;
+    RDebug::Print(_L(" Openingstart-up semaphore"));
+    //TName semaphoreName = _L("startupSemaphore");
+    //semaphoreName.Append( moduleName );
+    
+    TInt res = startup.OpenGlobal(semaphoreName);
+    RDebug::Print(_L("Opening result %d"), res);    
+
+
+    TFileName serverName;
+    TInt r = StartNewServer ( moduleName, serverName, EFalse, startup);    
+
+    if ( r ==   KErrAlreadyExists )
+        {        
+        // Ok, server was already started
+        RDebug::Print(_L("Server already started, signaling semaphore and existing"));
+        startup.Signal();        
+
+        delete cmdLine;
+
+        return KErrNone;
+        }
+    else
+        {       
+        RDebug::Print(_L("Server is finished, code %d"), r);
+        }
+
+    delete cmdLine;
+    
+    return r;
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/atsui/group/ATSInterface.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,50 @@
+/*
+* 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: MMP file for STIF Test Framework's ATSInterface app.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET      	ATSInterface.exe
+TARGETTYPE  	exe
+
+UID		0x1000007a
+
+CAPABILITY	AllFiles CommDD
+VENDORID 	0x101FB657
+SECUREID        0x102073D8
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+
+SOURCE		ATSInterface.cpp 
+SOURCE		ATSInterfaceRunner.cpp
+
+LIBRARY		euser.lib
+LIBRARY		StifTestEngine.lib
+LIBRARY		StifTestInterface.lib
+
+// In case of large amount of test cases, bigger heap size is required. 
+// Heap sizes can be changed using EPOCHEAPSIZE statement, where the first
+// parameter is heap's minimum size and the latter the maximum size.
+EPOCHEAPSIZE    0x10000 0x300000
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/atsui/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -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:
+*
+*	bld.inf Toplevel build information for STIF ATSInterface.
+*/
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+	ATSInterface.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/atsui/inc/ATSInterface.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,184 @@
+/*
+* 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: This file contains the header file of the CATSInterface.
+*
+*/
+
+#ifndef ATS_INTERFACE_H
+#define ATS_INTERFACE_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "TestEngineClient.h"
+#include "TestModuleInfo.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+class CATSInterfaceRunner;
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+// CATSInterface is the main class of ATS Interface
+
+class CATSInterface
+        : public CBase
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None    
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CATSInterface* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CATSInterface();
+
+    public: // New functions
+        
+        /**
+        * Run test cases
+        */
+        void RunTestsL();
+
+        /**
+        * Test case is completed
+        */
+        void TestCompleted( TInt aError );
+
+        /**
+        * Return handle to Test Engine Server.
+        */
+        RTestEngine& TestEngine();
+
+    public: // Functions from base classes
+        // None
+
+    protected: // New functions
+        // None
+
+    protected: // Functions from base classes
+        // None
+
+    private: // New functions
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * C++ default constructor.
+        */
+        CATSInterface();
+
+        /**
+        * Parse command line
+        */
+        void ParseCommandLineL();
+
+        /**
+        * Run all test cases
+        */
+        void RunAllTestCasesL();
+
+        /**
+        * Run the test case specified by aTestInfo.
+        */
+        void RunTestCaseL( TTestInfo& aTestInfo );
+
+        /**
+        * Run a test case
+        */
+        TInt RunATestCaseL( CATSInterfaceRunner* aTestCase );
+
+        /**
+        * Log errors and leave.
+        */
+        void LogErrorAndLeaveL( const TDesC& aFunction, 
+                                const TDesC& aDescription,
+                                const TInt aError );
+
+        /**
+        * Parse and search for module info and fill list of modules.
+        */
+        void ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd);
+
+    protected: // Data
+        // None
+
+    private: // Data
+
+        // Console window
+        CConsoleBase*           iConsole;
+
+        // Handle to Test Engine
+        RTestEngine             iTestEngine;
+
+        // Complete error for test case
+        TInt                    iTestCompletedError;
+
+        // Test Module
+        TName                   iTestModule;
+
+        // Name of the Test Module's config file
+        TFileName               iConfigFile;
+
+        // Name of the Test Engine's ini file
+        TFileName               iEngineIniFile;
+
+        // Name of the Test Module's ini file
+        TFileName               iModuleIniFile;
+
+        // List of found modules (included from module given in parameters)
+        CTestModuleList*        iModuleList;
+
+    public: // Friend classes
+        // None
+
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        // None
+
+    };
+
+
+#endif // ATS_INTERFACE_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/atsui/inc/ATSInterfaceRunner.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,254 @@
+/*
+* 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: This file contains the header file of the 
+* CATSInterfaceRunner.
+*
+*/
+
+#ifndef ATS_INTERFACE_RUNNER_H
+#define ATS_INTERFACE_RUNNER_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "ATSInterface.h"
+
+// CONSTANTS
+
+// Interval for timer printing
+const TInt KPrintInterval = 1000000;
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+// None
+
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+// CATSInterfaceRunner is a class that is used to run test cases using
+// STIF Test Framework.
+
+class CATSInterfaceRunner
+        : public CActive
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public: // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CATSInterfaceRunner* NewL( CATSInterface* aATSInterface,
+             TTestInfo& aTestInfo );
+
+        /**
+        * Destructor of CATSInterfaceRunner.
+        */
+        ~CATSInterfaceRunner();
+
+    public: // New functions
+
+        /**
+        * Run Tests.
+        */
+        TInt RunTestsL();
+
+        /**
+        * Start testing.
+        */
+        void StartTestL();
+
+    public: // Functions from base classes
+
+        /**
+        * From CActive RunL handles request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive DoCancel handles request cancellation.
+        */
+        void DoCancel();
+
+        /**
+        * From CActive RunError handles error situations.
+        */
+        TInt RunError( TInt aError );
+
+    protected: // New functions
+        // None
+
+    protected: // Functions from base classes
+        // None
+
+    private: // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CATSInterfaceRunner( CATSInterface* aATSInterface,
+            TTestInfo& aTestInfo );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+    public: //Data
+        // None
+    
+    protected: // Data
+        // None
+
+    private: // Data
+        
+        // Pointer to ATSInterface
+        CATSInterface*                  iATSInterface;
+
+        // Handle to Test Engine
+        RTestEngine                     iTestEngine;
+
+        // Handle to Test Case
+        RTestCase                       iTestCase;
+
+        // Test info and package
+        TTestInfo                       iTestInfo;
+        TTestInfoPckg                   iTestInfoPckg;
+
+        // Test result and package
+        TFullTestResult                 iFullTestResult;
+        TFullTestResultPckg             iFullTestResultPckg;
+
+    public: // Friend classes
+        // None
+
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        // None
+
+    };
+
+
+// DESCRIPTION
+// CActiveTimer is used to print running seconds to Console window
+class CActiveTimer
+        : public CTimer
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public: // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CActiveTimer* NewL( CConsoleBase* aConsole );
+
+        /**
+        * Destructor of CActiveTimer.
+        */
+        ~CActiveTimer();
+
+    public: // New functions
+
+        /**
+        * Start timer.
+        */
+        void StartL();
+
+    public: // Functions from base classes
+
+        /**
+        * From CActive RunL handles request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive DoCancel handles request cancellation.
+        */
+        void DoCancel();
+
+    protected: // New functions
+        // None
+
+    protected: // Functions from base classes
+        // None
+
+    private: // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CActiveTimer( CConsoleBase* aConsole );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+    public: // Data
+        // None
+    
+    protected: // Data
+        // None
+
+    private: // Data
+        
+        // Pointer to Console
+        CConsoleBase*                   iConsole;
+
+        // Start Time
+        TTime                           iStartTime;
+
+        // Console position
+        TInt                            iXPos;
+        TInt                            iYPos;
+
+    public: // Friend classes
+        // None
+
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        // None
+
+    };
+
+#endif // ATS_INTERFACE_RUNNER_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/atsui/src/ATSInterface.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1083 @@
+/*
+* 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: CATSInterface: This object executes test cases from 
+* STIF Test Framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include "ATSInterface.h"
+#include "ATSInterfaceRunner.h"
+
+#include "StifTestInterface.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 ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS ========================================= 
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: CATSInterface
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CATSInterface::CATSInterface()
+    {
+    // Initialize buffers to zero
+    iEngineIniFile.Zero();
+    iModuleIniFile.Zero();
+    iConfigFile.Zero();
+    iTestModule.Zero();
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving functions leaves
+                       Leaves each time the LogErrorAndLeaveL is called
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterface::ConstructL()
+    {
+    RDebug::Print(_L("Creating module list object"));
+    TRAPD(err, iModuleList = CTestModuleList::NewL(NULL));
+    if(err != KErrNone)
+        {
+        LogErrorAndLeaveL(_L("CATSInterface::ConstructL"), _L("CTestModuleList::NewL"), err);
+        return;
+        }
+    if(!iModuleList)
+        {
+        LogErrorAndLeaveL(_L("CATSInterface::ConstructL"), _L("CTestModuleList::NewL - iModuleList is NULL"), KErrGeneral);
+        return;
+        }
+
+    // Read command line
+    ParseCommandLineL();
+
+    // Add to module list info about module taken from command line
+    RDebug::Print(_L("Adding command line module to list"));
+    TName moduleName;
+    moduleName.Copy(iTestModule);
+    moduleName.LowerCase();
+    err = iModuleList->AddTestModule(moduleName);
+    if(err != KErrNone && err != KErrAlreadyExists)
+        {
+        LogErrorAndLeaveL(_L("CATSInterface::ConstructL"), _L("CTestModuleList::AddTestModule - Could not add module to list of modules"), err);
+        return;
+        }
+
+    //Get added module
+    CTestModuleInfo* moduleInfo = iModuleList->GetModule(moduleName);
+    if(!moduleInfo)
+        {
+        LogErrorAndLeaveL(_L("CATSInterface::ConstructL"), _L("CTestModuleList::GetModule - Could not add get module info from list"), KErrGeneral);
+        return;
+        }
+
+    //Add ini file if given
+    if(iModuleIniFile.Length() > 0)
+        {
+        TFileName filename;
+        filename.Copy(iModuleIniFile);
+        filename.LowerCase();
+        moduleInfo->SetIniFile(filename);
+        }
+
+    //Add config file if given
+    if(iConfigFile.Length() > 0)
+        {
+        TFileName filename;
+        filename.Copy(iConfigFile);
+        filename.LowerCase();
+        moduleInfo->AddCfgFile(filename);
+        }
+
+    //Now check all config files if there are included modules
+    _LIT(KIncludeModuleStart, "[New_Include_Module]");
+    _LIT(KIncludeModuleEnd, "[End_Include_Module]");
+
+    RDebug::Print(_L("Start parsing included modules"));
+    CTestCaseFileInfo* finfo = iModuleList->GetUncheckedCfgFile();
+    while(finfo)
+        {
+        TFileName fname;
+        finfo->GetCfgFileName(fname);
+
+        RDebug::Print(_L("Checking file: '%S'"), &fname);
+        finfo->SetChecked();
+
+        CStifParser* parser = NULL;
+
+        TRAP(err, parser = CStifParser::NewL(_L(""), fname));
+        if(err != KErrNone)
+            {
+            LogErrorAndLeaveL(_L("CATSInterface::ConstructL"), _L("CStifParser::NewL - Could not create parser"), err);
+            return;
+            }
+        CleanupStack::PushL(parser);
+
+        ParseTestModulesL(parser, iModuleList, KIncludeModuleStart, KIncludeModuleEnd);
+
+        CleanupStack::PopAndDestroy(parser);
+        finfo = iModuleList->GetUncheckedCfgFile();
+        }
+    RDebug::Print(_L("End parsing included modules"));
+
+    // Create Test Engine
+    RDebug::Print(_L("Creating test engine"));
+    TInt ret = iTestEngine.Connect();
+    if ( ret != KErrNone )
+        {
+        // Log error
+        LogErrorAndLeaveL( _L("CATSInterface::ConstructL"), _L("iTestEngineServ.Connect"), ret );
+        return;
+        }
+
+    ret = iTestEngine.LoadConfiguration( iEngineIniFile );
+    if ( ret != KErrNone )
+        {
+        // Log error
+        LogErrorAndLeaveL( _L("CATSInterface::ConstructL"), _L("iTestEngine.Open"), ret );
+        return;
+        }
+
+/*
+    // Add test module
+    ret = iTestEngine.AddTestModule( iTestModule, iModuleIniFile );
+    if ( ret != KErrNone && ret != KErrAlreadyExists )
+        {
+        // Log error
+        LogErrorAndLeaveL( _L("CATSInterface::ConstructL"), _L("iTestEngine.AddTestModule"), ret );
+        return;
+        }
+*/
+    // Add all test modules and config files
+    RDebug::Print(_L("Start creating test modules"));
+    moduleInfo = NULL;
+    TInt i;
+    TInt modCnt = iModuleList->Count();
+
+    for(i = 0; i < modCnt; i++)
+        {
+        RDebug::Print(_L("Processing module"));
+        // Get module
+        moduleInfo = iModuleList->GetModule(i);
+        if(!moduleInfo)
+            {
+            RDebug::Print(_L("Could not get module info at index %d"), i);
+            continue;
+            }
+
+        // Get module name
+        TName moduleName;
+        moduleInfo->GetModuleName(moduleName);
+        RDebug::Print(_L("module name: '%S'"), &moduleName);
+
+        // Get ini file, if exists
+        TFileName ini;
+        moduleInfo->GetIniFileName(ini);
+        if(ini.Length() == 0)
+            {
+            RDebug::Print(_L("ini file not found"));
+            }
+        else
+            {
+            RDebug::Print(_L("ini file: '%S'"), &ini);
+            }
+
+        // Create test module
+        RDebug::Print(_L("Adding module to test engine"));
+        ret = iTestEngine.AddTestModule(moduleName, ini);
+        if(ret != KErrNone && ret != KErrAlreadyExists)
+            {
+            LogErrorAndLeaveL(_L("CATSInterface::ConstructL"), _L("iTestEngine.AddTestModule"), ret);
+            return;
+            }
+
+        //Add test case files
+        TInt cfgCnt = moduleInfo->CountCfgFiles();
+        TInt j;
+        TFileName cfgFile;
+        for(j = 0; j < cfgCnt; j++)
+            {
+            moduleInfo->GetCfgFileName(j, cfgFile);
+            if(cfgFile.Length() > 0)
+                {
+                RDebug::Print(_L("config file: '%S'"), &cfgFile);
+
+                ret = iTestEngine.AddConfigFile(moduleName, cfgFile);
+                if(ret != KErrNone && ret != KErrAlreadyExists)
+                    {
+                    // Log error
+                    LogErrorAndLeaveL(_L("CATSInterface::ConstructL"), _L("RTestEngine::AddConfigFile"), ret);
+                    return;
+                    }
+                }
+            else
+                {
+                RDebug::Print(_L("Got empty cfg file"));
+                }
+            }
+        if(cfgCnt == 0)
+            {
+            RDebug::Print(_L("cfg file not found"));
+            }
+
+        RDebug::Print(_L("Module '%S' processed correctly"), &moduleName);
+        }
+
+    RDebug::Print(_L("End creating test modules"));
+
+    // Create console screen
+    iConsole = Console::NewL(
+        iTestModule, TSize( KConsFullScreen, KConsFullScreen ) );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: None
+
+    Return Values: CATSInterface* : pointer to created CATSInterface object
+
+    Errors/Exceptions: Leaves if memory allocation for CATSInterface fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CATSInterface* CATSInterface::NewL()
+    {
+    // Create CATSInterface and return it
+    CATSInterface* self =  new ( ELeave ) CATSInterface();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: ~CATSInterface
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CATSInterface::~CATSInterface()
+    {
+    // Close Test Engine
+    iTestEngine.Close();
+
+    delete iModuleList;
+    delete iConsole;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: ParseTestModulesL
+
+    Description: Parse and search for module info and fill list of modules.
+
+    Parameters: CStifParser*     aParser:       in: CStifParser object
+                CTestModuleList* aModuleList:   in: list of modules
+                TPtrC&           aSectionStart: in: descriptor with start of section string
+                TPTrC&           aSectionEnd:   in: descriptor with end of section string
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CATSInterface::ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd)
+    {
+    //First let's find all modules given in Stif's ini file and store that info in CTestModuleList object
+    CStifSectionParser* sectionParser = NULL;
+    CStifItemParser* item = NULL;
+
+    sectionParser = aParser->SectionL(aSectionStart, aSectionEnd);
+
+    while(sectionParser)
+        {
+        RDebug::Print(_L("Found '%S' and '%S' sections"), &aSectionStart, &aSectionEnd);
+        CleanupStack::PushL(sectionParser);
+        RDebug::Print(_L("Starting to read module information"));
+
+        // Get name of module
+        _LIT(KModuleName, "ModuleName=");
+        item = sectionParser->GetItemLineL(KModuleName);
+        CleanupStack::PushL(item);
+        if(!item)
+            {
+            CleanupStack::PopAndDestroy(item);
+            LogErrorAndLeaveL(_L("CATSInterface::ParseTestModulesL"), _L("CStifItemParser::GetItemLineL - line not found from module section"), KErrNotFound);
+            return;
+            }
+        else
+            {
+            RDebug::Print(_L("'%S' found"), &KModuleName);
+            }
+
+        TPtrC name;
+        TName moduleName;
+        TInt ret(KErrNone);
+        ret = item->GetString(KModuleName, name);
+        if(ret != KErrNone)
+            {
+            CleanupStack::PopAndDestroy(item);
+            LogErrorAndLeaveL(_L("CATSInterface::ParseTestModulesL"), _L("CStifItemParser::GetString - Module name parsing left with error"), ret);
+            return;
+            }
+        else
+            {
+            RDebug::Print(_L("Module '%S' found from ini-file"), &name);
+            moduleName.Copy(name);
+            moduleName.LowerCase();
+            ret = aModuleList->AddTestModule(moduleName);
+            if(ret != KErrNone && ret != KErrAlreadyExists)
+                {
+                LogErrorAndLeaveL(_L("CATSInterface::ParseTestModulesL"), _L("CTestModuleList::AddTestModule - Could not add module to list of modules"), ret);
+                return;
+                }
+            }
+        CleanupStack::PopAndDestroy(item);
+
+        //Get pointer to added module
+        CTestModuleInfo* moduleInfo = aModuleList->GetModule(moduleName);
+        if(!moduleInfo)
+            {
+                LogErrorAndLeaveL(_L("CATSInterface::ParseTestModulesL"), _L("CTestModuleList::GetModule - Could not add get module info from list"), KErrNotFound);
+                return;
+            }
+
+        // Get ini file, if it exists
+        RDebug::Print(_L("Start parsing ini file"));
+        _LIT(KIniFile, "IniFile=");
+        item = sectionParser->GetItemLineL(KIniFile);
+        if(item)
+            {
+            RDebug::Print(_L("'%S' found"), &KIniFile);
+            CleanupStack::PushL(item);
+            TPtrC iniFile;
+            ret = item->GetString(KIniFile, iniFile);
+            if(ret == KErrNone)
+                {
+                RDebug::Print(_L("Initialization file '%S' found, file can be empty"), &iniFile);
+                TFileName filename;
+                filename.Copy(iniFile);
+                filename.LowerCase();
+                TStifUtil::CorrectFilePathL( filename );
+                moduleInfo->SetIniFile(filename);
+                }
+            else
+                {
+                RDebug::Print(_L("Initialization file not found"));
+                }
+            CleanupStack::PopAndDestroy(item);
+            }
+        else
+            {
+            RDebug::Print(_L("'%S' not found"), &KIniFile);
+            }
+
+        // Get config (testcase) file
+        RDebug::Print(_L("Start parsing cfg files"));
+        TPtrC cfgTag;
+        for(TInt i = 0; i < 2; i++)
+            {
+            //Set tag for config files
+            if(i == 0)
+                {
+                cfgTag.Set(_L("ConfigFile="));
+                }
+                else
+                {
+                cfgTag.Set(_L("TestCaseFile="));
+                }
+            //Read data
+            item = sectionParser->GetItemLineL(cfgTag);
+            while(item)
+                {
+                CleanupStack::PushL(item);
+                RDebug::Print(_L("Item '%S' found"), &cfgTag);
+                TPtrC cfgFile;
+                ret = item->GetString(cfgTag, cfgFile);
+                if(ret == KErrNone)
+                    {
+                    TFileName ifile;
+                    ifile.Copy(cfgFile);
+                    ifile.LowerCase();
+                    TStifUtil::CorrectFilePathL( ifile );
+                    RDebug::Print(_L("Configuration file '%S' found"), &ifile);
+                    moduleInfo->AddCfgFile(ifile);
+                    }
+                else
+                    {
+                    RDebug::Print(_L("Configuration file not found"));
+                    }
+                CleanupStack::PopAndDestroy(item);
+                item = sectionParser->GetNextItemLineL(cfgTag);
+                }
+            }
+
+        RDebug::Print(_L("Module '%S' information read correctly"), &moduleName);
+
+        // Get next section
+        CleanupStack::PopAndDestroy(sectionParser);
+        sectionParser = aParser->NextSectionL(aSectionStart, aSectionEnd);
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: ParseCommandLineL
+
+    Description: Parse command line parameters
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if module name not found from command line
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterface::ParseCommandLineL()
+    {
+    // Command line params
+    _LIT( KTestModule, "-testmodule" );
+    _LIT( KConfigFile, "-config" );
+    _LIT( KEngineIniFile, "-engineini" );
+    _LIT( KModuleIniFile, "-moduleini" );
+
+	const TInt length = User().CommandLineLength();
+
+    HBufC* cmdLine = HBufC::NewLC( length );
+    TPtr ptr = cmdLine->Des();
+
+	User().CommandLine( ptr );
+
+    TBool moduleFound( EFalse );
+    TLex lex( ptr );
+    // Parse the command line
+    while ( !lex.Eos() )
+        {
+        TPtrC tmpPtr = lex.NextToken();
+        // Check the test module name
+        if ( tmpPtr == KTestModule )
+            {
+            TPtrC module = lex.NextToken();
+            if ( module.Ptr() )
+                {
+                iTestModule.Copy( module );
+                moduleFound = ETrue;
+                }
+            }
+        // Check the module's config file
+        else if ( tmpPtr == KConfigFile )
+            {
+            TPtrC config = lex.NextToken();
+            if ( config.Ptr() )
+                {
+                iConfigFile.Copy( config );
+                TStifUtil::CorrectFilePathL( iConfigFile );
+                }
+            }
+        // Check the engine's ini file
+        else if ( tmpPtr == KEngineIniFile )
+            {
+            TPtrC iniFile = lex.NextToken();
+            if ( iniFile.Ptr() )
+                {
+                iEngineIniFile.Copy( iniFile );
+                TStifUtil::CorrectFilePathL( iEngineIniFile );
+                }
+            }
+        // Check the module's ini file
+        else if ( tmpPtr == KModuleIniFile )
+            {
+            TPtrC iniFile = lex.NextToken();
+            if ( iniFile.Ptr() )
+                {
+                iModuleIniFile.Copy( iniFile );
+                TStifUtil::CorrectFilePathL( iModuleIniFile );
+                }
+            }
+        else
+            {
+            // Skip unknown commands
+            }
+        } // while
+
+    // Destroy command line buffer
+    CleanupStack::PopAndDestroy( cmdLine );
+
+    // Module name has to exists
+    if ( !moduleFound )
+        {
+        User::Leave( KErrArgument );
+        }
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: RunTestsL
+
+    Description: Starts testing
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if RunAllTestCasesL leaves
+                       Leaves if RemoveTestModule returns error
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterface::RunTestsL()
+    {
+    // Run all test cases
+    RunAllTestCasesL();
+
+    /*
+    // Remove test module
+    User::LeaveIfError( iTestEngine.RemoveTestModule( iTestModule ) );
+    */
+    RDebug::Print(_L("Start removing test modules"));
+    CTestModuleInfo* moduleInfo = NULL;
+    TInt i;
+    TInt modCnt = iModuleList->Count();
+
+    for(i = 0; i < modCnt; i++)
+        {
+        RDebug::Print(_L("Processing module"));
+        // Get module
+        moduleInfo = iModuleList->GetModule(i);
+        if(!moduleInfo)
+            {
+            RDebug::Print(_L("Could not get module info at index %d"), i);
+            continue;
+            }
+
+        // Get module name
+        TName moduleName;
+        moduleInfo->GetModuleName(moduleName);
+        RDebug::Print(_L("module name: '%S'"), &moduleName);
+
+        // Remove test module
+        User::LeaveIfError(iTestEngine.RemoveTestModule(moduleName));
+        RDebug::Print(_L("Module '%S' removed"), &moduleName);
+        }
+
+    RDebug::Print(_L("End removing test modules"));
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: RunAllTestCasesL
+
+    Description: Run all test cases from test module.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CATSInterface::RunAllTestCasesL()
+    {
+    TInt ret( KErrNone );
+
+    /*
+    // Add given config file to test module
+    if ( iConfigFile.Length() > 0 )
+        {
+        ret = iTestEngine.AddConfigFile( iTestModule, iConfigFile );
+        if ( ret != KErrNone && ret != KErrAlreadyExists )
+            {
+            // Log error
+            LogErrorAndLeaveL( _L("CATSInterface::RunAllTestCasesL"), _L("iTestEngine.AddConfigFile"), ret );
+            return;
+            }
+        }
+    */
+
+    // Enumerate test cases
+    TCaseCount caseCount;
+    TRequestStatus status;
+    iTestEngine.EnumerateTestCases( caseCount, status );
+    User::WaitForRequest( status );
+
+    // Check that enumerate succeeded
+    if ( status != KErrNone )
+        {
+        // Log error 
+        LogErrorAndLeaveL( _L("CATSInterface::RunAllTestCasesL"), _L("iTestEngine.EnumerateTestCases"), status.Int() );
+        return;
+        }
+
+    // Get test cases to buffer
+    CFixedFlatArray<TTestInfo>* testCases = 
+        CFixedFlatArray<TTestInfo>::NewL( caseCount() );
+    CleanupStack::PushL( testCases );
+
+    ret = iTestEngine.GetTestCases( *testCases );
+    if ( ret != KErrNone )
+        {
+        // Log error 
+        LogErrorAndLeaveL( _L("CATSInterface::RunAllTestCasesL"), _L("iTestEngine.GetTestCases"), status.Int() );
+        return;
+        }
+
+    //variables used to get version of STIF
+    TInt majorV;
+    TInt minorV;
+    TInt buildV;
+    TBuf<30> relDate;
+    TStifUtil::STIFVersion(majorV, minorV, buildV, relDate);
+    
+    TBuf<50> version;
+    version.Format(_L("STF v%d.%d.%d - "), majorV, minorV, buildV);
+    version.Append(relDate);
+    version.Append(_L("\n"));
+    
+    iConsole->Printf(version);	//printing STIF version information (version and release date)
+    iConsole->Printf( _L("Test case count: [%d]\n\n\n"), testCases->Count() );
+
+    // Loop through all test cases in buffer and run them
+    const TInt count = testCases->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+#ifdef _DEBUG
+        RDebug::Print( ( *testCases)[i].iTestCaseInfo.iTitle );
+#endif
+        iConsole->Printf( _L("Now running test case: [%d] [%S] "), i+1,
+            &( *testCases )[i].iTestCaseInfo.iTitle );
+
+        // Run test case
+        RunTestCaseL( ( *testCases )[i] );
+        }
+
+    // End test set
+    CleanupStack::PopAndDestroy( testCases );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: RunTestCaseL
+
+    Description: Run test case
+
+    Parameters: TTestInfo& aTestInfo: in: TTestInfo: Test info
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CATSInterface::RunTestCaseL( TTestInfo& aTestInfo )
+    {
+    TInt testResult( KErrNone );
+    CATSInterfaceRunner* runner;
+
+    // Trap to catch errors from test case executing
+    TRAPD( trapError,
+        runner = CATSInterfaceRunner::NewL( this, aTestInfo );
+        CleanupStack::PushL( runner );
+
+        testResult = RunATestCaseL( runner );
+
+        CleanupStack::PopAndDestroy( runner );
+        );
+
+    if ( trapError != KErrNone )
+        {
+        testResult = trapError;
+        }
+
+    if ( testResult != KErrNone ) // Test case is FAILED
+        {
+        // Test case failed, print out the error
+        iConsole->Printf( _L("\nTest case FAILED! err=[%d]\n"), testResult );
+        }
+
+    else // Test case is PASSED
+        {
+        iConsole->Printf( _L("\nTest case PASSED!\n") );
+        testResult = KErrNone;
+        }
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: RunATestCaseL
+
+    Description: Run a test case
+
+    Parameters: CATSInterfaceRunner* aTestCase: in: Pointer to test case runner
+
+    Return Values: TInt KErrNone: Test case passed
+                   other error code: Test case failed or cannot be executed
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CATSInterface::RunATestCaseL( CATSInterfaceRunner* aTestCase )
+    {
+    iTestCompletedError = KErrNone;
+
+    // Create timer
+    CActiveTimer* timer = CActiveTimer::NewL( iConsole );
+    CleanupStack::PushL( timer );
+
+    // Start test case and timer
+    aTestCase->StartTestL();
+    timer->StartL();
+
+    // Wait for test case completed
+    CActiveScheduler::Start();
+
+    timer->Cancel();
+    CleanupStack::PopAndDestroy( timer );
+
+    // test completion error is set in TestCompleted method
+    return iTestCompletedError;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: TestEngine
+
+    Description: Return handle to Test Engine.
+
+    Parameters: None
+    
+    Return Values: RTestEngine&: reference to RTestEngine handle
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+RTestEngine& CATSInterface::TestEngine()
+    {
+    return iTestEngine;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: TestCompleted
+
+    Description: Test case completed
+
+    This method is called when test case is completed or error occurred
+    during the test.
+
+    Parameters: TInt aError: in: Symbian OS error: Test result
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterface::TestCompleted( TInt aError )
+    {
+    // Store completion error
+    iTestCompletedError = aError;
+
+    // Stop the scheduler
+    CActiveScheduler::Stop();
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterface
+
+    Method: LogErrorAndLeaveL
+
+    Description: Write error Logger and leave.
+
+    This function is called if some function returns error and the error cannot
+    be logged another way Logger, e.g. RTestEngineServer and
+    RTestEngine methods.
+
+    Parameters: const TDesC& aFunction: in: any string: Function where the error
+                 occurred
+                const TDesC& aDescription: in: any string: Description for error
+                const TInt aError: in: Symbian OS error: Test result
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterface::LogErrorAndLeaveL( const TDesC& aFunction, 
+                                      const TDesC& aDescription, 
+                                      const TInt aError )
+    {
+
+    RDebug::Print( _L("%S: %S [%d]"), &aFunction, &aDescription, aError );
+    User::Leave( aError );
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Main
+
+    Description: Main function called by E32.
+
+    Parameters: None
+
+    Return Values: TInt: KErrNone :No errors occurred
+                   TInt: Other Symbian OS Error :Error catch by TRAP
+
+    Errors/Exceptions: TRAP is used to catch errors from leaving methods.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+ 
+    TInt processHandleCountBefore;
+    TInt threadHandleCountBefore;
+    RThread().HandleCount( processHandleCountBefore, threadHandleCountBefore );
+    TInt reqsBefore = RThread().RequestCount();
+
+    TInt processHandleCountAfter;
+    TInt threadHandleCountAfter;
+    TInt reqsAfter;
+
+    __UHEAP_MARK;
+
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    if ( cleanup == NULL )
+        {
+        __UHEAP_MARKEND;
+        return KErrNoMemory;
+        }
+
+    CActiveScheduler* activeScheduler = new CActiveScheduler;
+    if ( activeScheduler == NULL )
+        {
+        delete cleanup;
+        __UHEAP_MARKEND;
+        return KErrNoMemory;
+        }
+    CActiveScheduler::Install( activeScheduler );
+
+    // Construct the test client
+    CATSInterface* test = NULL;
+    TRAPD( err, test = CATSInterface::NewL() );
+    if ( err != KErrNone )
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("ATSInterface construction failed %d: "), err );
+#endif
+        delete cleanup;
+        delete activeScheduler;
+        __UHEAP_MARKEND;
+        return err;
+        }
+
+    // Run tests
+    TRAP( err, test->RunTestsL() );
+    if ( err != KErrNone )
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("RunTestsL left with %d: "), err );
+#endif
+        }
+
+
+    // Deallocate resources
+    delete test;
+    delete activeScheduler;
+    delete cleanup;
+
+    reqsAfter = RThread().RequestCount();
+    RThread().HandleCount( processHandleCountAfter, threadHandleCountAfter );
+
+    if ( reqsAfter != reqsBefore )
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("Request count not matching! %d vs. %d: "),
+            reqsBefore, reqsAfter );
+#endif
+        }
+    if ( threadHandleCountAfter != threadHandleCountBefore )
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("Handle count not matching! %d vs. %d: "),
+            threadHandleCountBefore, threadHandleCountAfter );
+#endif
+        }
+
+    __UHEAP_MARKEND;
+
+    return err;
+    }
+
+//  End of File
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/atsui/src/ATSInterfaceRunner.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,572 @@
+/*
+* 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: CATSInterfaceRunner: This object executes test 
+* cases from Test Framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include "ATSInterface.h"
+#include "ATSInterfaceRunner.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 ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS ========================================= 
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    CATSInterfaceRunner: This object executes test cases from Test Framework.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterfaceRunner
+
+    Method: CATSInterfaceRunner
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CATSInterfaceRunner::CATSInterfaceRunner( CATSInterface* aATSInterface,
+                                   TTestInfo& aTestInfo ) : 
+    CActive( CActive::EPriorityStandard ),
+    iATSInterface( aATSInterface ),
+    iTestInfo( aTestInfo ),
+    iTestInfoPckg( iTestInfo ),
+    iFullTestResultPckg( iFullTestResult )
+    {
+    __ASSERT_ALWAYS( aATSInterface, User::Panic( _L("Null pointer"), KErrGeneral ) );
+
+    CActiveScheduler::Add( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterfaceRunner
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterfaceRunner::ConstructL()
+    {    
+    iTestEngine = iATSInterface->TestEngine();
+
+    User::LeaveIfError( iTestCase.Open( iTestEngine, iTestInfoPckg ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterfaceRunner
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+    
+    Parameters: CATSInterface* aATSInterface: in: pointer to ATS Interface
+                TTestInfo& aTestInfo: in: Test info
+
+    Return Values: CATSInterfaceRunner* : pointer to created runner object
+
+    Errors/Exceptions: Leaves if memory allocation for CATSInterfaceRunner fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CATSInterfaceRunner* CATSInterfaceRunner::NewL( CATSInterface* aATSInterface,
+                                         TTestInfo& aTestInfo )
+    {
+    CATSInterfaceRunner* self =  
+        new ( ELeave ) CATSInterfaceRunner( aATSInterface, aTestInfo );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterfaceRunner
+
+    Method: ~CATSInterfaceRunner
+
+    Description: Destructor
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/    
+CATSInterfaceRunner::~CATSInterfaceRunner()
+    {
+    Cancel();
+    iTestCase.Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterfaceRunner
+
+    Method: StartTestL
+
+    Description: Starts testing
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterfaceRunner::StartTestL()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("Start test case %d: "), iTestInfo.iTestCaseInfo.iCaseNumber );
+#endif
+
+    if ( IsActive() )
+        Cancel();
+
+    iTestCase.RunTestCase( iFullTestResultPckg, iStatus );
+
+    SetActive();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterfaceRunner
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
+                       RunError called by CActiveObject
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterfaceRunner::RunL()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("RunTestCase completed: [%d] "), iStatus.Int() );
+#endif
+    // Check if the test case could not be executed, error handled in RunError
+    User::LeaveIfError ( iStatus.Int() );
+
+    // Check if the test case crashed, error handler in RunError
+    if ( iFullTestResult.iCaseExecutionResultType !=
+         TFullTestResult::ECaseExecuted )
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("Test case execution failed: [%d] "), 
+            iFullTestResult.iCaseExecutionResultCode );
+#endif
+        // Complete with the result of the test case
+        iATSInterface->TestCompleted( iFullTestResult.iCaseExecutionResultCode );
+
+        }
+    else
+        {
+#ifdef _DEBUG
+        // Debug test result
+        RDebug::Print( _L("Test case execution completed[%d]: %S"), 
+                            iFullTestResult.iTestResult.iResult,  
+                            &iFullTestResult.iTestResult.iResultDes);
+#endif
+
+        // Complete with the result of the test case
+        iATSInterface->TestCompleted( iFullTestResult.iTestResult.iResult );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterfaceRunner
+
+    Method: DoCancel
+
+    Description: Cancel active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CATSInterfaceRunner::DoCancel()
+    {
+    // Cancel the active request
+    iTestCase.CancelAsyncRequest( RTestCase::ERunTestCase );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CATSInterfaceRunner
+
+    Method: RunError
+
+    Description: Handle errors from TestFramework
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+    
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CATSInterfaceRunner::RunError( TInt aError )
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("Test case execution failed: [%d] "), 
+            aError );
+#endif
+    iATSInterface->TestCompleted ( aError );
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    CActiveTimer: This object prints running seconds to console screen.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CActiveTimer
+
+    Method: CActiveTimer
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: CConsoleBase* aConsole: in: Pointer to CConsoleBase
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CActiveTimer::CActiveTimer( CConsoleBase* aConsole ) : 
+    CTimer( CActive::EPriorityStandard ),
+    iConsole( aConsole )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CActiveTimer
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CActiveTimer::ConstructL()
+    {
+    //Base class 2nd phase constructor
+    CTimer::ConstructL();
+
+    // Set console positions
+    iXPos = 0;
+    iYPos = 1;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CActiveTimer
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+    
+    Parameters: CConsoleBase* aConsole: in: Pointer to CConsoleBase
+
+    Return Values: CActiveTimer* : pointer to created CActiveTimer object
+
+    Errors/Exceptions: Leaves if memory allocation for CATSInterface fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+CActiveTimer* CActiveTimer::NewL( CConsoleBase* aConsole )
+    {
+    CActiveTimer* self =  
+        new ( ELeave ) CActiveTimer( aConsole );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CActiveTimer
+
+    Method: ~CActiveTimer
+
+    Description: Destructor
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/    
+CActiveTimer::~CActiveTimer()
+    {
+    Cancel();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CActiveTimer
+
+    Method: StartTestL
+
+    Description: Starts testing
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CActiveTimer::StartL()
+    {
+    iStartTime.HomeTime();
+    // Wait a moment
+    CTimer::After( KPrintInterval );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CActiveTimer
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CActiveTimer::RunL()
+    {
+    // Print time
+    TTimeIntervalSeconds seconds;
+    TTime time;
+    time.HomeTime();
+    time.SecondsFrom( iStartTime, seconds );
+
+    TInt x = iConsole->WhereX();
+    TInt y = iConsole->WhereY();
+
+    // Print time to screen
+    iConsole->SetPos( iXPos, iYPos );
+    
+    // ClearToEndOfLine will cause console crash in debug mode. 
+    //iConsole->ClearToEndOfLine();
+    
+    iConsole->Printf( _L("[Time: %d] "), seconds.Int() );
+
+    iConsole->SetPos( x, y );
+    // Wait a moment
+    CTimer::After( KPrintInterval );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CActiveTimer
+
+    Method: DoCancel
+
+    Description: Cancel
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+    
+-------------------------------------------------------------------------------
+*/
+void CActiveTimer::DoCancel()
+    {
+    // Print time
+    TTimeIntervalSeconds seconds;
+    TTime time;
+    time.HomeTime();
+    time.SecondsFrom( iStartTime, seconds );
+
+    // Print time to screen
+    iConsole->Printf( _L("Total Time: [%d] "), seconds.Int() );
+    // Cancel the active request
+    CTimer::DoCancel();
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+// None
+
+//  End of File
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/consoleui/group/ConsoleUI.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* 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: MMP file for STIF Test Framework's Consoleui app.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          ConsoleUI.exe
+TARGETTYPE      exe
+UID			 0 0x2002C346
+
+CAPABILITY	AllFiles CommDD
+//VENDORID 	0x101FB657
+//SECUREID        2002C346
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../uiengine/inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+/* Source files */
+SOURCEPATH      ../src
+
+SOURCE          ConsoleUI.cpp
+SOURCE          ConsoleMenus.cpp
+SOURCE          ConsoleNotify.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY		efsrv.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftfwif.lib
+LIBRARY     	  stiftestengine.lib
+
+// In case of large amount of test cases, bigger heap size is required. 
+// Heap sizes can be changed using EPOCHEAPSIZE statement, where the first
+// parameter is heap's minimum size and the latter the maximum size.
+EPOCHEAPSIZE    0x10000 0x300000
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/consoleui/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STIF Test Framework's Console UI.
+*/
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	ConsoleUI.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/consoleui/inc/CallBack.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,211 @@
+/*
+* 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: This file contains the header file of the CCallBack 
+* class.
+*
+*/
+
+#ifndef CALLBACK_H
+#define CALLBACK_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Simple class for callbacks.
+
+class CCallBack 
+    :public CAsyncCallBack
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * C++ constructor.
+        */
+        CCallBack( TInt aPriority ):CAsyncCallBack( aPriority ) {}
+
+        /**
+        * C++ constructor.
+        */
+        CCallBack( TCallBack& aCallBack, TInt aPriority ):
+            CAsyncCallBack( aCallBack, aPriority ) {}
+    
+    public: // New functions
+        /**
+        * Return reference to TRequestStatus member.
+        */
+        TRequestStatus& Status(){ return iStatus; }
+
+        /**
+        * Set CCallBack active.
+        */
+        void SetActive()
+            { 
+            iStatus = KRequestPending; 
+            CActive::SetActive(); 
+            };
+    
+    public: // Functions from base classes
+   
+        /**
+        *
+        */
+        void RunL(){ iCallBack.CallBack(); }
+
+    protected:  // New functions
+        
+    protected:  // Functions from base classes
+        
+    private:
+
+	public:     // Data
+    
+	protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+
+template <class T>
+class CActiveCallback 
+        :public CActive
+    {
+    public: // Enumerations
+
+        /**
+        * Callback function type definitions
+        */
+       typedef void (T::* TestFunction)();    
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * C++ constructor.
+        */
+        CActiveCallback ( T* aClass, TestFunction aFunction ) : CActive (EPriorityStandard)
+            {
+            iMethod = aFunction;
+            iClass = aClass;
+            iCompleted = EFalse;
+            }
+    
+    public: // New functions
+        /**
+        * Return reference to TRequestStatus member.
+        */
+        TRequestStatus& Status(){ return iStatus; }
+
+        /**
+        * Set active object to active and return reference to TRequestStatus member
+        */
+        TRequestStatus& Activate()
+            {        
+            iCompleted = EFalse;
+            SetActive();
+            return iStatus;
+            }
+
+        /**
+        * Is callback completed?
+        */
+        TBool isCompleted()
+            {
+            return iCompleted;
+            }
+    
+    public: // Functions from base classes
+   
+        /**
+        * Call the callback
+        */
+        void RunL()
+            {
+            iCompleted = ETrue;
+            if ( iMethod != NULL )
+                {
+                (iClass->*iMethod) ();
+                }        
+            }
+
+        /**
+        * Just forward errors to framework
+        */
+        TInt RunError ( TInt aError )
+            {
+            return aError;
+            }
+
+        /**
+        * Cancel is not supported.
+        */
+        void DoCancel ()
+            {  
+            }
+
+    protected:  // New functions
+        
+    protected:  // Functions from base classes
+        
+    private:
+
+
+
+	public:     // Data
+    
+	protected:  // Data
+
+    private:    // Data
+        TestFunction iMethod;           // Pointer to method to be called
+        T* iClass;                      // Pointer to calls to be called
+        TBool iCompleted;               // Is callback completed?
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // CALLBACK_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/consoleui/inc/ConsoleMenus.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1910 @@
+/*
+* 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: This file contains the header file of the CMenu 
+* derived classes.
+*
+*/
+
+
+#ifndef CONSOLE_MENUS_H
+#define CONSOLE_MENUS_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "CallBack.h"
+
+// CONSTANTS
+const TInt KMenuOverhead = 4;
+
+// Numeric key ascii code values for ConsoleUI's menu
+const TInt KMyKeyDownAsciiCode = 56; // Ascii code for number '8'
+const TInt KMyKeyLeftAsciiCode = 52; // Ascii code for number '4'
+const TInt KMyKeyRightAsciiCode = 54; // Ascii code for number '6'
+const TInt KMyKeyUpAsciiCode = 50;  // Ascii code for number '2'
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CMenu;
+class CConsoleMain;
+class CCaseOperationMenu;
+class CCaseExecutionView;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Main menu
+class CMenu
+        :public CBase
+    {
+    public:  // Enumerations
+        enum TUpdateType
+            {
+            EMenuPrint,
+            EMenuRefresh,
+            };
+
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMenu* NewL( CConsoleMain* aConsole,
+                            CMenu* aParent,
+                            const TDesC& aName);
+
+       /**
+        * Destructor of CConsoleMain.
+        */
+        virtual ~CMenu();
+
+    public: // New functions
+    
+        /** 
+        * Return menu name
+        */
+        virtual const TDesC& Name() const;
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Set parent menu
+        */
+        virtual void SetParent ( CMenu* aMenu );
+
+        /** 
+        * Print line
+        */
+        virtual void Print( const TDesC& aPrint);
+
+        /** 
+        * Multi line print
+        */
+        virtual void PrintMulti( const TDesC& aPrint );
+
+        /** 
+        * Add item to menu
+        */
+        virtual void AddItemL ( CMenu* aItem );
+        
+        /** 
+        * Signals test completion
+        */
+        virtual void SignalL ( CStartedTestCase* /*aContainer*/ ){};
+		
+        /** 
+        * Update display from timer
+        */
+		virtual void TimerUpdate();
+		
+		/**
+		* Append text before original text.
+		*/
+		virtual void AppendBefore(  TInt aLineNum, TDes& aLine );
+		
+		/**
+		* Get menu type.
+		*/
+		inline TInt Type(){ return iType; };
+		
+		/**
+		* Map KeyCode 
+		*/
+		void MapKeyCode(TKeyCode &aSelection);
+
+		/**
+		 * Recalculates visible menu elements.
+		 */
+		void Recalculate( TInt aItemCount );
+		
+    public: // Functions from base classes
+        // None
+
+    protected:  // New functions
+        // None
+
+    private:   // New functions
+        /**
+        * Changes internal variables to move cursor in the menu.
+        */
+        void MovePosition(TInt aDelta);
+
+    protected:  // Functions from base classes
+        // None    
+
+        /** 
+        * C++ default constructor.
+        */
+        CMenu();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         const TDesC& aHeader = KNullDesC);
+    
+    private:   // Functions from base classes
+        // None
+
+    public:   // Data
+        // None
+
+    protected:  // Data    
+    
+        CConsoleBase*           iConsole;      // Pointer to console
+        CConsoleMain*           iMain;         // Pointer to main console
+        CMenu*                  iParent;       // Pointer to parent menu
+        TName                   iName;         // Menu name
+    	TName					iHeader;	   // Used to display STIF version information
+
+        RPointerArray<CMenu>    iItems;        // Menu items
+
+        TInt                    iPosOnScreen;  // Position on display
+        TInt                    iPrevPosOnScreen; // Previous position on display
+        TInt                    iMenuItemsListStartIndex;    // Y-index of the first line containing menu item
+        TInt                    iMenuItemsListEndIndex;    // Y-index of the last line containing menu item
+        TInt                    iFirst;        // First displayed item
+        TInt                    iLast;         // Last displayed item
+        TBool                   iPreventClearScreen;  // In case of moving cursor "in screen" cleaning screen is not needed
+        TInt                    iItemCount;    // Last Item
+        TSize                   iSize;         // Display size
+        TInt                    iScreenSize;   // "Work area" size
+		TInt                    iDirection;    // Scrolling direction
+		TInt                    iStart;        // Scrolling position
+		TInt                    iPrevPos;      // Previous position in scrolling
+
+        // Menu type (which updates must cause console update) 
+        // Flags from CUIStoreIf::TUpdateFlags 
+        TInt                    iType;
+        
+        // Update type set from PrintMenuL
+		TUpdateType             iUpdateType;
+		
+    private:    // Data
+        TName           iScrolledLine; //Original value of line, that was recently scrolled
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+
+// CONSTANTS
+_LIT( KSelectMenuTxt, "Select module to load, if using ini or test case file use testframework.ini" );
+
+// DESCRIPTION
+// Filename query menu
+class CFileNameQueryView 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CFileNameQueryView* NewL( CConsoleMain* aConsole, 
+                                         CMenu* aParent, 
+                                         const TDesC& aName);
+
+        ~CFileNameQueryView();
+        
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+        
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+    protected:  // New functions
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent, 
+                         const TDesC& aName );
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+    public:   // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // List of module names
+        RPointerArray<TDesC>    iTestModuleNames;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KAddMenuTxt,  "Add test module" );
+_LIT( KLoadMenuTxt,  "Load all test modules" );
+
+// DESCRIPTION
+// Module list menu
+class CModuleListView 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TModuleListMenu
+            {
+            EAddMenuTxtItem,
+            ELoadMenuTxtItem,
+            };
+            
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CModuleListView* NewL( CConsoleMain* aConsole,
+                                      CMenu* aParent,
+                                      const TDesC& aName );
+
+       /**
+        * Destructor
+        */
+        ~CModuleListView();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+        
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, 
+                                TBool& aContinue );
+ 
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+        
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CMenu*                     iModuleAdd;
+
+    public:     // Friend classes
+         // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// Test case starting menu
+class CCaseStartMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCaseStartMenu* NewL( CConsoleMain* aConsole, 
+                                     CMenu* aParent, 
+                                     const TDesC& aName,
+                                     TBool aShowOutput = EFalse);
+
+        /**
+        * Destructor.
+        */
+		~CCaseStartMenu();
+
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, 
+                                TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         TBool aShowOutput = EFalse);
+
+    private:
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // Test case array
+        RRefArray<CTestInfo> iTestCases;
+
+    private:    // Data
+        // Show output automaticly after test case is started
+        TBool iShowOutput;
+        
+        // Map table. Translates indexes from filtered to all loaded from module  
+        RArray<TInt> iMapFilteredToAll;
+        
+        // Keeps filter name converted to lower case
+        TFileName iFilterLowerCase;
+        
+        // Keeps title of test case converted to lower case
+        TFileName iTitleLowerCase;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KChangeAll, "Change all");
+_LIT( KCancelSet, "Cancel set execution" );
+
+// Test set creation menu
+class CMultipleBaseMenu 
+    :public CCaseStartMenu
+  
+    {
+    public:  // Enumerations
+         enum TMenuIndex
+		    {  
+		    EChangeAll = 0,
+		    ECancelSet = 0,
+		    };
+        enum TRunType
+            {
+            ERunSequential,
+            ERunParallel,
+            ERunRepeatSequential,
+            };
+		    
+    protected: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMultipleBaseMenu* NewL( CConsoleMain* aConsole, 
+                                        CMenu* aParent, 
+                                        const TDesC& aName);
+        
+        /**
+        * Destructor.
+        */
+		~CMultipleBaseMenu();
+
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+		/** 
+        * Signals test completion
+        */
+        virtual void SignalL ( CStartedTestCase* aContainer );
+        
+        /** 
+        * Append text before line print.
+        */
+        virtual void AppendBefore( TInt aLineNum, TDes& aLine );
+        
+    protected:  // New functions
+
+        //inline void SetRunType( TRunType aRunType )
+        //    { iRunType = aRunType; };
+            
+        /**
+        * Update iTestCases();
+        */ 
+        virtual TInt UpdateTestCases();
+        TBool CheckIfAnyCaseIsSelected(TInt aCount);
+                      
+    protected:  // Functions from base classes
+
+        /**
+        * Constructor.
+        */
+		CMultipleBaseMenu();
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+       
+    public:     // Data
+
+    protected:  // Data
+		RArray<TBool>       iSetState;
+		TInt                iCurrentRunPos;
+		TBool               iSetFinished;
+		CStartedTestCase*   iOngoingCaseContainer;
+		TRunType            iRunType;
+				
+		// Number of items in "static" menu (including derived classes)
+		TInt                iMenuTotCount;
+
+    private:    // Data
+		// Number of items in "static" menu of this class
+		// (excluding derived classes)  
+		TInt                iMenuCount;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+// CONSTANTS
+_LIT( KRunSequentially, "Run selection sequentially");
+_LIT( KRunParallel, "Run selection parallel");
+_LIT( KRepeatRunSequentially, "Repeat run selection sequentially");
+
+_LIT( KSelectFromTo, "Select all between already selected"); 
+
+// Test set creation menu
+class CMultipleCaseMenu 
+    :public CMultipleBaseMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TMultipleMenuIndex
+		    {  
+		    ERunSelection = 0,
+		    ERunSelectionParaller = 1,
+		    ERepeatRunSelection = 2,
+		    ESelectFromTo = 3,
+		    };
+		    
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMultipleCaseMenu* NewL( CConsoleMain* aConsole, 
+                                        CMenu* aParent, 
+                                        const TDesC& aName);
+        
+        /**
+        * Destructor.
+        */
+		~CMultipleCaseMenu();
+
+    public: // New functions
+       /**
+       * Start running.
+       */
+       virtual void StartRunningL( TRunType aRunType, 
+                                   const TDesC& aModule = KNullDesC, 
+                                   const TDesC& aTestCaseFile = KNullDesC );
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+    
+        /**
+        * Constructor.
+        */
+		CMultipleCaseMenu();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+       
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Number of items in "static" menu of this class
+		// (excluding derived classes)  
+		TInt                iMenuItemsCount;
+		
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+// CONSTANTS
+_LIT( KExitTxt,     "Exit" );
+
+// DESCRIPTION
+// The main menu class
+class CMainMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMainMenu* NewL( CConsoleMain* aConsole, 
+                                CMenu* aParent, 
+                                const TDesC& aName,
+                                const TDesC& aHeader );
+
+        /**
+        * Destructor
+        */
+        ~CMainMenu();
+
+    public: // New functions
+        /**
+        * Creates CaseOperationMenu and CaseExecutionView.
+        * Used when after test case starting its output view needs to be shown.
+        */
+        CMenu* CreateOutputViewL(CMenu* aParent);
+
+    public: // Functions from base classes    
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         const TDesC& aHeader );
+
+    private:
+
+    public:   //Data
+
+    protected:  // Data
+
+    private:    // Data
+        // Menu representing output view, used to show it after test case is started
+        CCaseExecutionView* iOutputView;
+
+        // Operation menu used to show output view after test case is started
+        CCaseOperationMenu* iOperationMenu;
+		
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+
+// DESCRIPTION
+// The case list (passed/failed/...) menu class
+class CCaseMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCaseMenu* NewL( CConsoleMain* aConsole, 
+                                CMenu* aParent, 
+                                const TDesC& aName, 
+                                TInt aType );
+
+        /**
+        * Destructor
+        */
+        ~CCaseMenu();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes    
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+        
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+        /**
+        * Append text before original text.
+        */
+        virtual void AppendBefore(TInt aLineNum, TDes& aLine);
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent, 
+                         const TDesC& aName, 
+                         TInt aType );
+
+    private:    // Data
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        CCaseOperationMenu*             iCaseOperationMenu;    // Submenu
+        RRefArray<CStartedTestCase>     iTestCases;
+
+    private:    // Data
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KOutputViewDes,   "View Output");
+_LIT( KPauseCaseDes,    "Pause");
+_LIT( KResumeCaseDes,   "Resume");
+_LIT( KAbortCaseDes,    "Abort case");
+_LIT( KRestartCaseDes,  "Restart");
+
+// DESCRIPTION
+// Case specific operations, like pause, abort etc.
+class CCaseOperationMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TCaseOperationMenu
+            {
+            ERestartCase,
+            EOutputView,
+            EPauseResume,
+            EAbortCase,   
+            };
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCaseOperationMenu* NewL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName, 
+                            const CStartedTestCase* aCaseContainer );
+        
+        /**
+        * Destructor.
+        */
+        ~CCaseOperationMenu();
+        
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         const CStartedTestCase* aCaseContainer );
+
+    private:    // Functions from base classes
+        // None
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Case container
+        const CStartedTestCase* iCaseContainer; 
+        // Execution view                       
+        CCaseExecutionView*     iView;
+        
+    public:     // Friend classes
+        // None        
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+class CCaseExecutionView 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCaseExecutionView* NewL( CConsoleMain* aConsole, 
+                                         CMenu* aParent, 
+                                         const TDesC& aName, 
+                                         const CStartedTestCase* aCase);
+
+         /**
+        * Destructor.
+        */
+        ~CCaseExecutionView();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+        
+        /**
+        * Get current testcase info.
+        */ 
+        inline const CStartedTestCase* TestCase(){ return iCase; };
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         const CStartedTestCase* aCase );
+
+    private:   // Functions from base classes
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        const CStartedTestCase* iCase;
+
+        /**
+        * Indicates current selected line.
+        */
+        TInt                    iLine;
+        /**
+        * Indicates will line show.
+        */
+        TBool                   iShowLine;
+        /**
+        * Line to be show.
+        */
+        HBufC*                  iLineTextBuf;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CMenu notifier class shows dialogs in UI.
+class CMenuNotifier
+        :public CBase
+    {
+    public:  // Enumerations
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMenuNotifier* NewL( const TDesC& aError, 
+                                    CConsoleMain* aMain );
+
+       /**
+        * Destructor of CConsoleMain.
+        */
+        virtual ~CMenuNotifier();
+
+    public: // New functions  
+            
+    public: // Functions from base classes
+        // None
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None    
+
+        /** 
+        * C++ default constructor.
+        */
+        CMenuNotifier( CConsoleMain* aMain );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aError );
+    
+    private:   // Functions from base classes
+        // None
+
+    private:   // New functions
+        /** 
+        * C++ default constructor.
+        */
+        void Run1();	
+
+    public:   // Data
+        // None
+
+    protected:  // Data      
+
+    private:    // Data
+        CActiveCallback <CMenuNotifier> iCallBack1;
+        CActiveCallback <CMenuNotifier> iCallBack2;
+        RTimer iTimer;
+        CConsoleBase* iConsole;
+        CConsoleMain* iMain;        
+        TInt iCompletionCode; 
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CMenu dialog class shows dialogs in UI and waits for keypress.
+class CMenuDialog
+    :public CBase
+    {
+    public:  // Enumerations
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMenuDialog* NewL( CConsoleMain* aMain, 
+                                  const TDesC& aMessage, 
+                                  const TDesC& aInstruction,
+                                  TInt aTimeInSecs );
+
+       /**
+        * Destructor.
+        */
+        virtual ~CMenuDialog();
+
+    public: // New functions  
+            
+    public: // Functions from base classes
+        
+        TInt WaitForKeypress( TKeyCode& aKeyCode, 
+                              TRequestStatus& aStatus  );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None    
+
+        /** 
+        * C++ default constructor.
+        */
+        CMenuDialog( CConsoleMain* aMain );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aMessage, 
+                         const TDesC& aInstruction, 
+                         TInt aTimeInSecs );
+    
+    private:   // Functions from base classes
+        // None
+
+    private:   // New functions
+        /**
+        * Handle completions.
+        */
+        void Run1();	
+
+    public:   // Data
+        // None
+
+    protected:  // Data      
+
+    private:    // Data
+        // Backpointer
+        CConsoleMain* iMain;        
+        CConsoleBase* iConsole;
+
+        // Timer support
+        CActiveCallback <CMenuDialog> iCallBack1;
+        RTimer iTimer;
+        
+        // Reading
+        CActiveCallback <CMenuDialog> iCallBack2;
+        
+        // For reading keys        
+        TRequestStatus* iStatus;
+        TKeyCode*     iKeyCode;
+    
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KTestSetMenu,     "CTestSetMenu" );
+
+_LIT( KDefaultSetName,  "ConsoleUI.set" );
+
+_LIT( KSetCreate,       "Create test set" );
+_LIT( KSetLoad,         "Load test set" );
+
+_LIT( KSetShow,         "Show started test sets" );
+_LIT( KSetRemove,       "Remove test set" );
+_LIT( KSetCaseAdd,      "Add test case to test set" );
+_LIT( KSetCaseRemove,   "Remove test case from test set" );
+_LIT( KSetSave,         "Save test set" );
+
+_LIT( KSetStartSeq,     "Start sequential test set execution" );
+_LIT( KSetStartPar,     "Start parallel test set execution" );
+//_LIT( KSetStartRep,     "Start repeating test set execution" );
+
+_LIT( KSetStartSeqNotRun, "Start sequentially not started tests" );
+
+// DESCRIPTION
+// Test set menu
+class CTestSetMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        
+    private: // Enumerations
+        
+        enum TCreateMenu
+            {
+            ESetCreate,
+            ESetLoad,    
+            };
+            
+        enum TEditMenu
+            {
+            ESetShow,
+ 
+            ESetStartSeq,
+            ESetStartPar,
+            //ESetStartRep,
+ 
+            ESetRemove,
+            ESetSave,
+            ESetCaseAdd,
+            ESetCaseRemove,
+            
+            ESetStartSeqNotRun,
+            
+
+            ESetLAST //This entry must remain LAST in this menu
+            };
+            
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetMenu* NewL( CConsoleMain* aConsole,
+                                   CMenu* aParent,
+                                   const TDesC& aName );
+
+       /**
+        * Destructor
+        */
+        ~CTestSetMenu();
+
+    public: // New functions
+        /**
+        * Set test set file name.
+        */
+        void SetTestSetFileName( const TFileName& aTestSetFileName ); 
+        
+        /**
+        * Set test set state created.
+        */
+        void SetCreated(){ iTestSetCreated = ETrue; };
+         
+    public: // Functions from base classes
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+        
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, 
+                                TBool& aContinue );
+ 
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+        /**
+        * Constructor
+        */
+        CTestSetMenu();
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        TBool               iTestSetCreated;
+        TFileName           iTestSetName;
+        
+        CMenu*              iSubMenu;
+        
+    public:     // Friend classes
+         // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+    // CONSTANTS
+    _LIT( KTestSetChoice,     "CTestSetChoiceMenu" );
+    _LIT( KSetSelect,       "Select Test Set" );
+
+
+    // DESCRIPTION
+    // Test set choice menu
+    class CTestSetChoiceMenu 
+        :public CMenu
+
+        {
+        public:  // Enumerations
+            
+        private: // Enumerations
+            
+            
+                
+        public:  // Constructors and destructor
+
+            /**
+            * NewL is first phase of two-phased constructor.
+            */
+            static CTestSetChoiceMenu* NewL( CConsoleMain* aConsole,
+                                       CMenu* aParent,
+                                       const TDesC& aName );
+
+           /**
+            * Destructor
+            */
+            ~CTestSetChoiceMenu();
+
+        public: // New functions
+             
+        public: // Functions from base classes
+
+            /** 
+            * Return item texts.
+            */
+           virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+            
+            /** 
+            * Process keypresses on this menu
+            */
+            virtual CMenu* SelectL( TKeyCode aSelectLion, 
+                                    TBool& aContinue );
+     
+            /** 
+            * Prints the menu
+            */
+            virtual void PrintMenuL( TUpdateType  aType );
+            
+        protected:  // New functions
+
+        protected:  // Functions from base classes
+            /**
+            * Constructor
+            */
+            CTestSetChoiceMenu();
+           
+            /**
+            * By default Symbian OS constructor is private.
+            */
+            void ConstructL( CConsoleMain* aConsole, 
+                             CMenu* aParent,
+                             const TDesC& aName );
+
+        private:
+
+        public:   //Data
+            // None
+
+        protected:  // Data
+            // None
+
+        private:    // Data
+            TFileName           iTestSetName;
+            RPointerArray<HBufC> iFileList;
+            
+        public:     // Friend classes
+             // None
+
+        protected:  // Friend classes
+            // None
+
+        private:    // Friend classes
+            // None
+
+        };
+    
+// CONSTANTS
+_LIT( KAddSelected, "Add selected cases");
+
+// Test set case add menu
+class CTestSetAddCaseMenu 
+    :public CMultipleBaseMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TTestSetAddCaseMenuIndex
+		    {  
+		    EAddSelected = 0,
+		    };
+		    
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetAddCaseMenu* NewL( CConsoleMain* aConsole, 
+                                         CMenu* aParent, 
+                                         const TDesC& aName,
+                                         TDesC& aTestSetName );
+        
+        /**
+        * Destructor.
+        */
+		~CTestSetAddCaseMenu();
+
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+    
+        /**
+        * Constructor.
+        */
+		CTestSetAddCaseMenu( TDesC& aTestSetName );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+       
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Number of items in "static" menu of this class
+		// (excluding derived classes)  
+		TInt    iMenuItemsCount;
+		
+        TPtrC   iTestSetName;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KRemoveSelected, "Remove selected cases");
+
+// Test set case add menu
+class CTestSetRemoveCaseMenu 
+    :public CMultipleBaseMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TTestSetRemoveCaseMenuIndex
+		    {  
+		    ERemoveSelected = 0,
+		    };
+		    
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetRemoveCaseMenu* NewL( CConsoleMain* aConsole, 
+                                             CMenu* aParent, 
+                                             const TDesC& aName,
+                                             TDesC& aTestSetName );
+        
+        /**
+        * Destructor.
+        */
+		~CTestSetRemoveCaseMenu();
+
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+        
+        /**
+        * Update iTestCases;
+        */ 
+        virtual TInt UpdateTestCases();
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+    
+        /**
+        * Constructor.
+        */
+		CTestSetRemoveCaseMenu( TDesC& aTestSetName );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+       
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Number of items in "static" menu of this class
+		// (excluding derived classes)  
+		TInt        iMenuItemsCount;
+		
+        TPtrC       iTestSetName;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };    
+
+// DESCRIPTION
+// The case list (passed/failed/...) menu class
+class CTestSetCaseMenu  
+    :public CCaseMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetCaseMenu* NewL( CConsoleMain* aConsole, 
+                                       CMenu* aParent, 
+                                       const TDesC& aName,
+                                       CStartedTestSet& aTestSet );
+
+        /**
+        * Destructor
+        */
+        ~CTestSetCaseMenu();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes    
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+        /** 
+        * Prints the menu
+        */
+        void AppendBefore( TInt aLineNum, TDes& aLine );
+        
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );     
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+       
+
+    private:    // Data
+    
+        CTestSetCaseMenu( CStartedTestSet& aTestSet );
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent, 
+                         const TDesC& aName );
+    public:     // Data
+        // None
+
+    protected:  // Data
+
+    private:    // Data
+        CStartedTestSet& iTestSet;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KCancelTestSet, "Cancel test set");
+        
+// DESCRIPTION
+// Started test sets (passed/failed/...) menu class
+class CStartedTestSetMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CStartedTestSetMenu* NewL( CConsoleMain* aConsole, 
+                                          CMenu* aParent, 
+                                          const TDesC& aName );
+
+        /**
+        * Destructor
+        */
+        ~CStartedTestSetMenu();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes    
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+        
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+
+        /** 
+        * Prints the menu
+        */
+        void AppendBefore( TInt aLineNum, TDes& aLine );
+        
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+       
+
+    private:    // Data
+    
+        CStartedTestSetMenu();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent, 
+                         const TDesC& aName );
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CTestSetCaseMenu*           iCaseMenu;    // Submenu
+        RRefArray<CStartedTestSet>  iTestSets;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// Menu which shows available filters for test case titles
+class CFilterMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CFilterMenu* NewL(CConsoleMain* aConsole, 
+                                 CMenu* aParent, 
+                                 const TDesC& aName);
+
+        /**
+        * Destructor.
+        */
+        ~CFilterMenu();
+
+    public: // New functions
+        /**
+        * Set test case menu, so it can be shown when user selects filter
+        */
+        void SetTestCaseMenu(CMenu* aTestCaseMenu);
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL(TKeyCode aSelectLion, 
+                               TBool& aContinue);
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts(RRefArray<TDesC>& aArray);
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        /** 
+        * C++ default constructor.
+        */
+        CFilterMenu();
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(CConsoleMain* aConsole,
+                        CMenu* aParent,
+                        const TDesC& aName);
+
+    private:    // Functions
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+        
+    private:    // Data
+        /**
+        * Test case menu. It will be shown when user selects filter.
+        */
+        CMenu *iTestCaseMenu;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+   
+#endif // CONSOLE_MENUS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/consoleui/inc/ConsoleUI.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,435 @@
+/*
+* 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: This file contains the header file of the ConsoleUI.
+*
+*/
+
+#ifndef CONSOLE_UI_H
+#define CONSOLE_UI_H
+
+
+//  INCLUDE
+#include <e32std.h>
+#include <e32base.h>
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+
+#include "CallBack.h"
+
+#include "TestModuleInfo.h"
+
+#include "ConsoleMenus.h"
+
+// CONSTANTS
+const TInt KMaxLineLength = 80;            // Longest supported line length
+const TInt KScrollPeriod = 300000;		   // Scrolling speed
+
+// MACROS
+
+// DATA TYPES
+
+// Case state
+// Menu update type
+enum TConsoleUIPanic
+    {
+    EInvalidCaseCompletion,
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CMenu;
+class CConsoleMain;
+class CConsoleReader;
+class CMenuDialog;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CModule contains a test module data
+
+class CScrollerTimer
+        :public CActive
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CScrollerTimer* NewL( CConsoleMain* aMain );
+
+        /**
+        * Destructor of CModule.
+        */
+        ~CScrollerTimer();
+
+    public: // New functions
+
+		/** 
+        * StartL
+        */
+		void StartL();
+
+		/** 
+        * RunL
+        */
+		void RunL();
+
+		/** 
+        * DoCancel
+        */
+		void DoCancel();
+
+		/** 
+        * RunError
+        */
+		TInt RunError ( TInt aError );
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CScrollerTimer();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aMain );
+
+    public:   //Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CConsoleMain*     iMain;            // Pointer to main console
+		RTimer            iTimer;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// Console UI main class
+class CConsoleMain
+        :public CUIStoreIf
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TStartCasesOnStart
+            {
+            EStartCaseNo = 0,
+            EStartSingleCase,
+            EStartCasesSeq,
+            EStartCasesPar,
+            };
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CConsoleMain* NewL();
+
+        /**
+        * Start
+        */
+        TInt StartL();
+
+        /**
+        * Destructor of CConsoleMain.
+        */
+        ~CConsoleMain();
+
+
+    public: // New functions
+    
+    
+        /**
+        * Receives output update notification from CUIStore.
+        */
+        void Update( CStartedTestCase* aTestCase, 
+                     TInt aFlags );
+                                                                      
+        /**
+        * Function is called when test framework prints error.
+        */
+        void Error( TErrorNotification& aError );
+        
+        /**
+        * Function is called when testframework 
+        * wants to print a popup window.
+        */
+        TInt PopupMsg( const TDesC& aLine1, 
+                       const TDesC& aLine2, 
+                       TInt aTimeInSecs );
+        
+        /**
+        * Function is called when testframework 
+        * wants to print a popup window and 
+        * get the key pressed.
+        */
+        TInt PopupMsg( const TDesC& aLine1, 
+                       const TDesC& aLine2, 
+                       TInt aTimeInSecs,
+                       TKeyCode& aKey,
+                       TRequestStatus& aStatus );
+
+        /**
+        * Close instance.
+        */
+        void Close( TInt aHandle );
+                
+        /**
+        * Console UI panic function
+        */
+        static void Panic( TConsoleUIPanic aPanic );
+
+        /**
+        * Return pointer to console
+        */
+        CConsoleBase* GetConsole();
+
+        /**
+        * Called from timer to perform scrolling
+        */
+        void TimerUpdate();
+                
+        /**
+        * Process keystokes.
+        */
+        void KeyPressed();
+
+        /**
+         * Displays no memory error message and closes ConsoleUI
+         */
+        void ExitWithNoMemoryErrorMessage();
+        
+        /**
+         * Returns MainMenu of console
+         */
+        CMainMenu* GetMainMenu();
+        
+        /**
+         * Get filter array for reading purpose
+         */
+        const RPointerArray<TDesC>& GetFilterArray(void) const;
+        
+        /**
+         * Set info about which index filter is used
+         */
+        void SetFilterIndex(TInt aFilterIndex);
+
+        /**
+         * Get info about which index filter is used
+         */
+        TInt GetFilterIndex(void);
+        
+    public: // Functions from base classes
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CConsoleMain();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+        /**
+        * Print error from ConsoleUI.
+        */  
+        void UiError( const TDesC& aInfo );
+        
+        /**
+        * Process command line parameters.
+        */
+        void ProcessCommandlineL( TFileName& aIniFile );
+
+        /**
+        * Parse and search for module info and fill list of modules.
+        */
+        void ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd);
+        
+    public:   //Data
+        RPointerArray<CMenuDialog> iDialogs;
+        
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CConsoleBase*       iConsole;       // Pointer to console
+
+        CMenu*              iMainMenu;      // Root menu
+        CMenu*              iCurrentMenu;   // Current menu
+
+        CScrollerTimer*     iScroller;
+        
+        CConsoleReader*     iReader;        // Console reader                   
+    
+        // For starting runnning multiple cases upon start
+        TStartCasesOnStart  iStartCases;
+        HBufC*              iTestModule;
+        HBufC*              iTestModuleIni;
+        HBufC*              iTestCaseFile;
+        TInt                iTestCaseNum;
+        HBufC*              iTestSetName;
+
+        // List of found modules (included from module given in parameters)
+        CTestModuleList*    iModuleList;
+        
+        // List of filters (for test cases title)
+        RPointerArray<TDesC> iFilters;
+        
+        // Chosen filter index
+        TInt iChosenFilterIndex;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+    
+// DESCRIPTION
+// Read keystrokes from console
+class CConsoleReader
+    :public CActive
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CConsoleReader* NewL( CConsoleMain* aMain, 
+                                     CConsoleBase* aConsole );
+
+        /**
+        * Start
+        */
+        void StartL();
+
+        /**
+        * Destructor of CConsoleReader.
+        */
+        ~CConsoleReader();
+
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+        /**
+        * RunError derived from CActive handles errors from active object
+        */        
+        virtual TInt RunError(TInt aError);
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CConsoleReader( CConsoleMain* aMain, 
+                        CConsoleBase* iConsole );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CConsoleBase*   iConsole;   // Pointer to console
+        CConsoleMain*   iMain;      // Backpointer
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif // CONSOLEUI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/consoleui/src/ConsoleNotify.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,474 @@
+/*
+* 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: This module contains implementation of CMenuNotifier 
+* and CMenuDialog class implementations.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include <f32file.h>
+#include "ConsoleUI.h"
+#include "ConsoleMenus.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+const TInt KDefaultTime = 2;
+
+// MACROS
+#ifndef __WINS__
+  #define GETPTR &
+#else
+  #define GETPTR
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+   
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuNotifier
+
+    Method: NewL
+
+    Description: Constructs new menu notifier
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenuNotifier* CMenuNotifier::NewL( const TDesC& aError, CConsoleMain* aMain )
+    {
+
+    CMenuNotifier* self = new ( ELeave ) CMenuNotifier( aMain );
+    CleanupStack::PushL( self );
+    self->ConstructL( aError );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuNotifier
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenuNotifier::ConstructL( const TDesC& aError )
+    {
+    
+    TSize size = iMain->GetConsole()->ScreenSize();
+    size.iWidth = Min( size.iWidth - KMenuOverhead, 
+                       aError.Length() );
+    size.iHeight = aError.Length()/size.iWidth + 2;
+    
+    iConsole = Console::NewL( _L("Error note"), size );
+    
+    iConsole->Printf( _L("Error:") );    
+    iConsole->Printf( aError ); 
+    iConsole->Printf( _L("\n") );
+    iConsole->Printf( _L("Press any key") );
+
+    iTimer.CreateLocal();
+
+    CActiveScheduler::Add ( &iCallBack1 );
+    CActiveScheduler::Add ( &iCallBack2 );
+
+    // Get timer
+    iTimer.After( iCallBack1.Activate(), 10000000 );
+
+    // Poll keypresses
+    iConsole->Read ( iCallBack2.Activate() );        
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuNotifier
+
+    Method: CMenuNotifier
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+#pragma warning( disable : 4355 )       // Incomplete this usage
+CMenuNotifier::CMenuNotifier( CConsoleMain* aMain ): 
+    iCallBack1 ( this, GETPTR CMenuNotifier::Run1 ),
+    iCallBack2 ( this, GETPTR CMenuNotifier::Run1 ),
+    iMain( aMain )          
+    {
+    }
+#pragma warning( default : 4355 )
+
+/*
+-------------------------------------------------------------------------------
+e
+    Class: CMenuNotifier
+
+    Method: ~CMenuNotifier
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CMenuNotifier::~CMenuNotifier()
+    {
+    iTimer.Close();
+    delete iConsole;    
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuNotifier
+
+    Method: Run1
+
+    Description: Callback function. Closes dialog
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenuNotifier::Run1()
+    {
+
+    if ( iCallBack1.isCompleted() && iCallBack2.isCompleted() )
+        {
+        // Both callback have been done, delete this object
+        delete this;
+        return;
+        }
+    else
+        {
+        // One callback finished, stop listening anything else
+        iConsole->ReadCancel();
+        iTimer.Cancel();
+        }
+    }  
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: NewL
+
+    Description: Constructs new menu dialog
+
+    Parameters: const TDesC& aMessage: in: Message to dialog
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenuDialog* CMenuDialog::NewL( CConsoleMain* aMain,
+                                const TDesC& aLine1, 
+                                const TDesC& aLine2, 
+                                TInt aTimeInSecs )
+    {
+
+    CMenuDialog* self = new ( ELeave ) CMenuDialog( aMain );
+    CleanupStack::PushL( self );
+    self->ConstructL( aLine1, aLine2, aTimeInSecs );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: const TDesC& aMessage: in: Message to dialog
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenuDialog::ConstructL( const TDesC& aLine1, 
+                              const TDesC& aLine2, 
+                              TInt aTimeInSecs )
+    {
+    
+    TSize size = iMain->GetConsole()->ScreenSize();
+    size.iWidth = Min( size.iWidth - KMenuOverhead, 
+                       Max( aLine1.Length(), aLine2.Length() ) );
+    size.iHeight = aLine1.Length()/size.iWidth + aLine2.Length()/size.iWidth + 2;
+    
+    iConsole = Console::NewL( _L("Info"), size );
+    
+    if( aLine1.Length() > 0 )
+        {
+        iConsole->Printf( aLine1 );
+        }
+    if( aLine2.Length() > 0 )
+        {
+        iConsole->Printf( _L("\n") );
+        iConsole->Printf( aLine2 );
+        }
+    
+    if( aTimeInSecs == 0 )
+        {
+        aTimeInSecs = KDefaultTime;
+        }
+    iTimer.CreateLocal();
+
+    CActiveScheduler::Add ( &iCallBack1 );
+    // Get timer
+    iTimer.After( iCallBack1.Activate(), aTimeInSecs*1000*1000 );
+           
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: CMenuDialog
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+#pragma warning( disable : 4355 )       // Incomplete this usage
+CMenuDialog::CMenuDialog( CConsoleMain* aMain ):  
+    iMain( aMain ),      
+    iCallBack1 ( this, GETPTR CMenuDialog::Run1 ), 
+    iCallBack2 ( this, GETPTR CMenuDialog::Run1 )
+    {
+    }
+#pragma warning( default : 4355 )
+
+/*
+-------------------------------------------------------------------------------
+e
+    Class: CMenuDialog
+
+    Method: ~CMenuDialog
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CMenuDialog::~CMenuDialog()
+    {
+ 
+    //if( iCallBack1.IsActive() )
+    //    {
+        iTimer.Cancel();
+        iTimer.Close();
+        iCallBack1.Cancel();
+    //    }
+        
+    if( iCallBack2.IsActive() )
+        {
+        User::RequestComplete( iStatus, KErrCancel );
+		if( iConsole != NULL )
+			{
+			iConsole->ReadCancel();    
+			}
+        iCallBack2.Cancel();
+        }
+        
+    delete iConsole;    
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: Run1
+
+    Description: Callback function. Closes dialog
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenuDialog::Run1()
+    {
+
+    if ( iCallBack2.isCompleted() )
+        {            
+        *iKeyCode = iConsole->KeyCode();
+    
+        User::RequestComplete( iStatus, iCallBack2.Status().Int() );
+        }
+        
+    TInt index = iMain->iDialogs.Find( this );
+    if( index >= 0 )
+        {
+        iMain->iDialogs.Remove( index );
+        }
+    // Timeout, delete this object
+    delete this;
+    return;
+
+    }  
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: WaitForKeypress
+
+    Description: Wait for keypress
+
+    Parameters: None
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CMenuDialog::WaitForKeypress( TKeyCode& aKeyCode, 
+                                   TRequestStatus& aStatus )
+    {
+    
+    aStatus = KRequestPending;
+    iKeyCode = &aKeyCode;
+    iStatus = &aStatus;
+    
+    CActiveScheduler::Add ( &iCallBack2 );
+     
+    // Poll keypresses
+    iConsole->Read( iCallBack2.Activate() );        
+
+    return KErrNone;
+    
+    }  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/consoleui/src/ConsoleUI.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,2132 @@
+/*
+* 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: This module contains implementation of CConsoleMain 
+* and CModule class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include <f32file.h>
+
+#include <stifinternal/UIStoreIf.h>
+
+#include "ConsoleUI.h"
+#include "ConsoleMenus.h"
+
+#include "StifTestInterface.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+_LIT(KNameTxt,"STF");
+_LIT( KConsoleMain, "CConsoleMain" );
+
+// Commandline params
+_LIT( KTestModule,      "-testmodule" );
+_LIT( KTestModuleIni,   "-testmoduleini" );
+_LIT( KTestCaseFile,    "-testcasefile" );
+_LIT( KTestSet,         "-testset" );
+_LIT( KTestRun,         "-run" );
+_LIT( KTestRunAll,      "all" );
+_LIT( KTestRunSeq,      "sequential" );
+_LIT( KTestRunPar,      "parallel" );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+LOCAL_C void MainL();
+
+
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: NewL
+
+    Description: Construct the console main class
+
+    Parameters: None
+
+    Return Values: CConsoleMain*                    New object
+
+    Errors/Exceptions: Leaves if memory allocation fails or
+                       ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleMain* CConsoleMain::NewL( )
+    {
+
+    CConsoleMain* self = new ( ELeave ) CConsoleMain();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Construct the console
+    Construct module and case containers
+    Retrieve command line parameters
+    Connect to test engine
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation fails or fileserver or
+                       test engine can't be connected.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::ConstructL( )
+    {
+    
+    CUIStoreIf::ConstructL();
+
+    // Construct the console
+    iConsole = Console::NewL( KNameTxt,
+                             TSize( KConsFullScreen, KConsFullScreen ) );
+
+    RDebug::Print(_L("Creating module list object"));
+    TRAPD(err, iModuleList = CTestModuleList::NewL(NULL));
+    if(err != KErrNone)
+        {
+        RDebug::Print(_L("Could not create module list (%d)"), err);
+        UiError(_L("Could not create module list (err)"));
+        User::Leave(err);
+        }
+    if(!iModuleList)
+        {
+        RDebug::Print(_L("Could not create module list (NULL)"));
+        UiError(_L("Could not create module list (NULL)"));
+        User::Leave(KErrGeneral);
+        }
+
+    // Get command line parameters
+    TFileName iniFile; // TestFramework initialization file
+                    
+    ProcessCommandlineL( iniFile );
+
+    if(iTestModule)
+        {
+        // Add to module list info about module taken from command line
+        RDebug::Print(_L("Adding command line module to list"));
+        TName moduleName;
+        moduleName.Copy(iTestModule->Des());
+        moduleName.LowerCase();
+        err = iModuleList->AddTestModule(moduleName);
+        if(err != KErrNone && err != KErrAlreadyExists)
+            {
+            RDebug::Print(_L("Could not add module to list of modules (%d)"), err);
+            UiError(_L("Could not add module to list of modules (err)"));
+            User::Leave(err);
+            }
+
+        //Get added module
+        CTestModuleInfo* moduleInfo = iModuleList->GetModule(moduleName);
+        if(!moduleInfo)
+            {
+            RDebug::Print(_L("Could not add get module info from list"));
+            UiError(_L("Could not add get module info from list"));
+            User::Leave(KErrGeneral);
+            }
+
+        //Add ini file if given
+        if(iTestModuleIni && iTestModuleIni->Length() > 0)
+            {
+            TFileName filename;
+            filename.Copy(iTestModuleIni->Des());
+            filename.LowerCase();
+            moduleInfo->SetIniFile(filename);
+            }
+
+        //Add config file if given
+        if(iTestCaseFile && iTestCaseFile->Length() > 0)
+            {
+            TFileName filename;
+            filename.Copy(iTestCaseFile->Des());
+            filename.LowerCase();
+            moduleInfo->AddCfgFile(filename);
+            }
+
+        //Now check all config files if there are included modules
+        _LIT(KIncludeModuleStart, "[New_Include_Module]");
+        _LIT(KIncludeModuleEnd, "[End_Include_Module]");
+
+        RDebug::Print(_L("Start parsing included modules"));
+        CTestCaseFileInfo* finfo = iModuleList->GetUncheckedCfgFile();
+        while(finfo)
+            {
+            TFileName fname;
+            finfo->GetCfgFileName(fname);
+
+            RDebug::Print(_L("Checking file: '%S'"), &fname);
+            finfo->SetChecked();
+
+            CStifParser* parser = NULL;
+ 
+            TRAP(err, parser = CStifParser::NewL(_L(""), fname));
+            if(err != KErrNone)
+                {
+                RDebug::Print(_L("Could not create parser to read content of config file (%d)"), err);
+                UiError(_L("Could not create parser to read content of config file (err)"));
+                User::Leave(err);
+                }
+            CleanupStack::PushL(parser);
+
+            ParseTestModulesL(parser, iModuleList, KIncludeModuleStart, KIncludeModuleEnd);
+
+            CleanupStack::PopAndDestroy(parser);
+            finfo = iModuleList->GetUncheckedCfgFile();
+            }
+        RDebug::Print(_L("End parsing included modules"));
+        }
+
+    iConsole->Printf(_L("\nTest Framework starting\n"));
+
+    // CUIStore open
+    User::LeaveIfError( UIStore().Open( iniFile ) );
+    
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: CConsoleMain
+
+    Description: Constructor.
+    Initialize non-zero member variables.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleMain::CConsoleMain( ):iStartCases( EStartCaseNo )
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ~CConsoleMain
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleMain::~CConsoleMain( )
+    {	
+
+    iDialogs.ResetAndDestroy();
+    iDialogs.Close();
+ 
+    // CUIStore close
+    UIStore().Close();
+    
+    delete iReader;
+    iReader = NULL;
+    
+	delete iScroller;
+	iScroller = NULL;
+    
+    delete iConsole;
+    iConsole = NULL;
+
+    delete iMainMenu;
+    iMainMenu = NULL;
+
+    delete iTestModule;
+    iTestModule = 0;
+    
+    delete iTestModuleIni;
+    iTestModuleIni = 0;
+    
+    delete iTestCaseFile;
+    iTestCaseFile = 0;
+    
+    delete iTestSetName;
+    iTestSetName = 0;
+
+    delete iModuleList;
+    iModuleList = 0;
+    
+    iFilters.ResetAndDestroy();
+    iFilters.Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ProcessCommandlineL
+
+    Description: Process commandline parameters.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves on error.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::ProcessCommandlineL( TFileName& aIniFile )
+    {
+
+	User me;
+    TInt lineLength = me.CommandLineLength();
+    HBufC* lineBuf = HBufC::NewLC( lineLength );
+    TPtr line( lineBuf->Des() );
+    TBool firstTime = ETrue;
+    TInt offset = 0;
+    TPtrC param;
+    TChar c;
+    
+    me.CommandLine( line );
+    TLex lex( line );
+    
+    while( offset < lineLength )
+        {    
+        // Get first charecter of the parameter
+        lex.SkipSpace();
+        c = lex.Peek();
+        if( c == 0 )
+            {
+            // End of line
+            break;
+            }
+        
+        // Get the whole parameter 
+        param.Set( lex.NextToken() );
+        if( firstTime )
+            {
+            // Filebrowser workaround. It gives the exe name as command line param
+            // verify that it is not the same as the executable name
+            //@spe TFileName exePath = me.FileName();
+			TFileName exePath = RProcess().FileName();
+            if ( param == exePath )
+                {
+                // Discard command line parameters when using filebrowser
+                break;
+                }
+
+            firstTime = EFalse;
+            }
+        // Check if -param option
+        if( c == '-' )
+            {
+            // This is option
+            if( param == KTestModule )
+                {
+                // Get test module name
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test module name not given"));
+                    break;
+                    }
+                if( param.Length() > KMaxName )
+                    {
+                    UiError( _L("Test module name too long"));
+                    break;
+                    }
+                iTestModule = param.AllocL();
+                }
+            else if( param == KTestModuleIni )
+                {
+                // Get test module initialization file
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test module initialization file name not given"));
+                    break;
+                    }
+                if( param.Length() > KMaxFileName )
+                    {
+                    UiError( _L("Test module initialization file name too long"));
+                    break;
+                    }
+                TFileName tmpTestModuleIni( param );
+                TStifUtil::CorrectFilePathL( tmpTestModuleIni );
+                iTestModuleIni = tmpTestModuleIni.AllocL();
+                }
+            else if( param == KTestCaseFile )
+                {
+                // Get test case file name
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test case file name not given"));
+                    break;
+                    }
+                if( param.Length() > KMaxFileName )
+                    {
+                    UiError( _L("Test case file name too long"));
+                    break;
+                    }
+                TFileName tmpTestCaseFile( param );
+                TStifUtil::CorrectFilePathL( tmpTestCaseFile );
+                iTestCaseFile = tmpTestCaseFile.AllocL();
+                }
+            else if( param == KTestSet )
+                {
+                // Get test set name
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test set name not given"));
+                    break;
+                    }
+                if( param.Length() > KMaxFileName )
+                    {
+                    UiError( _L("Test set name too long"));
+                    
+                    break;
+                    }
+                iTestSetName = param.AllocL();
+                }
+            else if( param == KTestRun )
+                {
+                if( iStartCases )
+                    {
+                    UiError( _L("Only one -run option allowed") );
+                    // Do not start anything
+                    iStartCases = EStartCaseNo;
+                    break;
+                    }
+                // Get run type
+                lex.Mark();
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test set name not given"));
+                    break;
+                    }
+                if( ( param == KTestRunAll ) ||
+                    ( param == KTestRunSeq ) )
+                    {
+                    iStartCases = EStartCasesSeq;
+                    }
+                else if( param == KTestRunPar )
+                    {
+                    iStartCases = EStartCasesPar;
+                    }
+                else
+                    {
+                    lex.UnGetToMark();
+                    lex.SkipSpace();
+                    if( lex.Val( iTestCaseNum ) != KErrNone )
+                        { 
+                        UiError( _L("Unknown run type given, valid values are all/sequential/parallel/test case number"));
+                        }
+                    else
+                        {
+                        iStartCases = EStartSingleCase;
+                        }    
+                    break;
+                    }
+                }            
+            }
+        else 
+            {
+            // This is Test Framework ini file
+            aIniFile = param;
+            TStifUtil::CorrectFilePathL( aIniFile );
+            // ini file is last option
+            break;
+            }
+        
+        }
+      
+    CleanupStack::PopAndDestroy( lineBuf );
+
+    }
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: Panic
+
+    Description: Console UI panic function
+
+    Parameters: TInt
+
+    Return Values: 
+
+    Errors/Exceptions: Does not return.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::Panic(TConsoleUIPanic aPanic )
+    {
+        
+    User::Panic (_L("STIF TestFramework Console UI panic"), aPanic );
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: StartL
+
+    Description: Construct menu objects and start the menu handling
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions:
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CConsoleMain::StartL()
+    {
+    
+    // Construct keystroke reader
+    iReader           = CConsoleReader::NewL( this, iConsole );
+
+    // Construct the main menu
+    TInt majorV;
+    TInt minorV;
+    TInt buildV;
+    TBuf<30> relDate;
+    TStifUtil::STIFVersion(majorV, minorV, buildV, relDate);
+    
+    TBuf<128> version;
+    version.Format(_L("STF v%d.%d.%d - "), majorV, minorV, buildV);
+    version.Append(relDate);
+    version.Append(_L("\n"));
+    iMainMenu = CMainMenu::NewL( this, NULL, _L("Main menu"), version );
+
+    // Add the case menu
+    CMenu* caseMenu   = CMenu::NewL( this, iMainMenu, _L("Case menu") );
+    iMainMenu->AddItemL ( caseMenu );
+
+    // Add the module menu
+    CMenu* moduleMenu = CModuleListView::NewL( this, iMainMenu, _L("Module menu") );
+    iMainMenu->AddItemL ( moduleMenu );
+
+    // Add test set menu
+    CTestSetMenu* testSetMenu = CTestSetMenu::NewL( this, iMainMenu, _L("Test set menu") );
+    iMainMenu->AddItemL ( testSetMenu );
+ 
+    // Construct the case menus
+    CMenu* casestart  = NULL;
+    CMenu* casestartshow  = NULL;
+    
+    // Load filters
+    UIStore().ReadFiltersL(iFilters);
+    
+    // If there are no filters defined, then construct menu without filter's menu
+    if(iFilters.Count() == 0)
+        {
+        casestart = CCaseStartMenu::NewL(this, caseMenu, _L("Start new case"));
+        caseMenu->AddItemL(casestart);
+    CMenu* casestartshow  = NULL;
+        casestartshow = CCaseStartMenu::NewL(this, caseMenu, _L("Start & show output"), ETrue);
+        caseMenu->AddItemL(casestartshow);
+        }
+    else // if there are filters defined, create also filter's menu
+        {
+        CFilterMenu* filtercasestart = NULL;
+        CFilterMenu* filtercasestartshow = NULL;
+        
+        filtercasestart = CFilterMenu::NewL(this, caseMenu, _L("Start new case (filter)"));
+        caseMenu->AddItemL(filtercasestart);
+        casestart = CCaseStartMenu::NewL(this, caseMenu, _L("Start new case"));
+        filtercasestart->SetTestCaseMenu(casestart);
+        
+        filtercasestartshow = CFilterMenu::NewL(this, caseMenu, _L("Start & show output (filter)"));
+        caseMenu->AddItemL(filtercasestartshow);
+        casestartshow = CCaseStartMenu::NewL(this, caseMenu, _L("Start & show output"), ETrue);
+        filtercasestartshow->SetTestCaseMenu(casestartshow);
+        }
+
+	CMultipleCaseMenu* multicasestart =
+	    CMultipleCaseMenu::NewL (this, caseMenu, _L("Run multiple tests") );
+    caseMenu->AddItemL( multicasestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Ongoing cases"), 
+        CUIStoreIf::EStatusRunning );
+    caseMenu->AddItemL( casestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Executed cases"), 
+        CUIStoreIf::EStatusExecuted );
+    caseMenu->AddItemL( casestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Passed cases"), 
+        CUIStoreIf::EStatusPassed );
+    caseMenu->AddItemL( casestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Failed cases"), 
+        CUIStoreIf::EStatusFailed );
+    caseMenu->AddItemL( casestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Aborted/Crashed cases"), 
+        ( CUIStoreIf::EStatusAborted | CUIStoreIf::EStatusCrashed) );
+    caseMenu->AddItemL( casestart );
+    //Add "test set choice" menu
+    CTestSetChoiceMenu* testChoiceMenu = CTestSetChoiceMenu::NewL( this, testSetMenu, _L("Load test set") );
+ 	testSetMenu->AddItemL( testChoiceMenu );
+
+    // Start stuff according to command line parameters
+    if( iTestSetName )
+        { 
+        // Set test set name
+        testSetMenu->SetTestSetFileName( iTestSetName->Des() );
+        
+        // Load test set
+        if( UIStore().LoadTestSet( iTestSetName->Des() ) != KErrNone )
+ 	       {
+           UiError( _L("Test set loading failed"));
+           }
+        else 
+           {
+           // Inform test set menu that set is loaded
+           testSetMenu->SetCreated();
+    
+            // Check if test set should be started
+    	    if( ( iStartCases == EStartCasesPar ) || 
+    	    	( iStartCases == EStartCasesSeq ))         	
+            	{
+            
+	            // Check set starting type
+    	    	CStartedTestSet::TSetType setType = 
+       	        CStartedTestSet::ESetSequential;
+       	        
+                if( iStartCases == EStartCasesPar )
+                    {
+                    setType = 
+                        CStartedTestSet::ESetParallel;
+                    }
+                    
+                // Start test set
+                RRefArray<CTestSetInfo> setInfos;
+                TInt ret = UIStore().TestSets( setInfos );
+                if( (  ret != KErrNone ) ||
+                    ( setInfos.Count() != 1 ) )
+                    {
+                    // Should never ever happen
+                    User::Panic( KConsoleMain, KErrGeneral );
+                    }
+                
+                const CTestSetInfo& set = setInfos[0];
+                setInfos.Reset();
+                setInfos.Close();
+                
+                TInt index;
+                ret = UIStore().StartTestSet( set, index, setType );
+                if( ret != KErrNone )
+                    {
+                    UiError( _L("Test set starting failed") );
+                    }
+                } 
+            }
+        delete iTestSetName;
+        iTestSetName = 0;     
+        }
+    if( iTestModule )
+        {
+        TPtrC module( iTestModule->Des() ); 
+
+        // Add all test modules and config files
+        RDebug::Print(_L("Start creating test modules"));
+        CTestModuleInfo* moduleInfo = NULL;
+        TInt i;
+        TInt modCnt = iModuleList->Count();
+        TInt ret;
+
+        for(i = 0; i < modCnt; i++)
+            {
+            RDebug::Print(_L("Processing module"));
+            // Get module
+            moduleInfo = iModuleList->GetModule(i);
+            if(!moduleInfo)
+                {
+                RDebug::Print(_L("Could not get module info at index %d"), i);
+                continue;
+                }
+
+            // Get module name
+            TName moduleName;
+            moduleInfo->GetModuleName(moduleName);
+            RDebug::Print(_L("module name: '%S'"), &moduleName);
+
+            // Get ini file, if exists
+            TFileName ini;
+            moduleInfo->GetIniFileName(ini);
+            if(ini.Length() == 0)
+                {
+                RDebug::Print(_L("ini file not found"));
+                }
+            else
+                {
+                RDebug::Print(_L("ini file: '%S'"), &ini);
+                }
+
+            // Create test module
+            RDebug::Print(_L("Adding module to UI store"));
+            ret = UIStore().AddTestModule(moduleName, ini);
+            if(ret != KErrNone && ret != KErrAlreadyExists)
+                {
+                RDebug::Print(_L("Test module adding failed (%d)"), ret);
+                UiError(_L("Test module adding failed"));
+                continue;
+                }
+
+            //Add test case files
+            TInt cfgCnt = moduleInfo->CountCfgFiles();
+            TInt j;
+            TFileName cfgFile;
+            for(j = 0; j < cfgCnt; j++)
+                {
+                moduleInfo->GetCfgFileName(j, cfgFile);
+                if(cfgFile.Length() > 0)
+                    {
+                    RDebug::Print(_L("config file: '%S'"), &cfgFile);
+
+                    ret = UIStore().AddTestCaseFile(moduleName, cfgFile);
+                    if(ret != KErrNone)
+                        {
+                        // Log error
+                        RDebug::Print(_L("Test case file adding failed (%d)"), ret);
+                        UiError(_L("Test case file adding failed"));
+                        continue;
+                        }
+                    }
+                else
+                    {
+                    RDebug::Print(_L("Got empty cfg file"));
+                    }
+                }
+            if(cfgCnt == 0)
+                {
+                RDebug::Print(_L("cfg file not found"));
+                }
+
+            RDebug::Print(_L("Module '%S' processed correctly"), &moduleName);
+            }
+
+        RDebug::Print(_L("End creating test modules"));
+
+        if( ( iStartCases == EStartCasesPar ) ||
+            ( iStartCases == EStartCasesSeq ) )
+            {
+            // Start running
+            CMultipleBaseMenu::TRunType runType = 
+                CMultipleBaseMenu::ERunSequential;
+            if( iStartCases == EStartCasesPar )
+                {
+                runType = CMultipleBaseMenu::ERunParallel;
+                }
+            TRAPD( err,
+                //multicasestart->StartRunningL( runType, module, file );
+                multicasestart->StartRunningL(runType, KNullDesC, KNullDesC);
+                );
+            if( err != KErrNone )
+                {
+                UiError( _L("Stating test cases failed") );
+                }
+            }
+        else if( iStartCases == EStartSingleCase )
+            {
+            // Get test case
+            RRefArray<CTestInfo> testCases;
+            //ret = UIStore().TestCases( testCases, module, file );
+            ret = UIStore().TestCases(testCases, KNullDesC, KNullDesC);
+            if( ret == KErrNone )
+                {
+                if( ( iTestCaseNum < 0 ) ||
+                    ( iTestCaseNum >= testCases.Count() ) )
+                    {
+                    ret = KErrNotFound;
+                    }
+                else
+                    {         
+                    TInt index;           
+                    // Start single test case
+                    ret = UIStore().StartTestCase( testCases[iTestCaseNum], index );
+                    }                                       
+                }
+            testCases.Reset();       
+            testCases.Close();
+            if( ret != KErrNone )
+                {
+                UiError( _L("Starting test case failed"));        
+                }
+            }
+
+        delete iTestCaseFile;
+        iTestCaseFile = 0;
+        delete iTestModuleIni;
+        iTestModuleIni = 0;
+        delete iTestModule;
+        iTestModule = 0;
+        }
+        
+    iStartCases = EStartCaseNo;
+    
+    // Load testcase if some stored 
+    UIStore().LoadSavedTestCases();
+           
+	iScroller = CScrollerTimer::NewL ( this );
+	iScroller->StartL();	
+
+    // Print the main menu
+    iCurrentMenu = iMainMenu;
+    iCurrentMenu->PrintMenuL( CMenu::EMenuPrint );
+
+    // Start to process keyboard events
+    iReader->StartL();
+    
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: KeyPressed
+
+    Description: Process keyboard events. Print new menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if SelectL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::KeyPressed()
+    {
+
+    TBool cont = ETrue;
+
+    // Read the key
+    TKeyCode key = iConsole->KeyCode();
+    CMenu* tmp = iCurrentMenu;
+
+    // Let the menu handle the key press
+    TRAPD( err, 
+        iCurrentMenu = iCurrentMenu->SelectL( key, cont );
+        );
+    if( err != KErrNone )
+        {
+        User::InfoPrint( 
+            _L("Processing keystroke failed") );  
+        }
+            
+    if ( iCurrentMenu == NULL )
+        {
+        iCurrentMenu = tmp;
+        }
+
+   // If "not-exit" key pressed, continue
+    if ( cont )
+        {
+
+        // Either only update old menu or new menu.
+        if ( tmp == iCurrentMenu )
+            {
+            TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ); );
+            }
+        else
+            {
+            TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuPrint ); )
+            }
+        
+        if( err != KErrNone )
+            {
+            if ( err == KErrNoMemory )
+            	{            	
+            	ExitWithNoMemoryErrorMessage();                
+            	}
+            else
+            	{
+	            User::InfoPrint( 
+	                _L("Printing menu failed") );
+            	}
+            }
+
+        // Enable keystrokes
+        iReader->StartL();
+
+        }
+    else
+        {
+        // "Exit", stop scheduler and exit
+        CActiveScheduler::Stop();
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ExitWithNoMemoryErrorMessage
+
+    Description: Displays no memory error message and closes ConsoleUI
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::ExitWithNoMemoryErrorMessage()
+	{
+    // "Exit", stop scheduler and exit
+    CActiveScheduler::Stop();
+
+    _LIT( KErrorTitle, "Error:\n" );
+    _LIT( KErrorMessage, "Test cases execution have been stopped. ConsoleUI does not have enough memory to store information about executed test cases.  Results of executed test cases can be found in TestReport file. ConsoleUI will be closed now." );
+    _LIT( KErrorPressAnyKey, "\n\nPress any key" );
+    
+    TSize size = GetConsole()->ScreenSize();
+    size.iWidth = Min( size.iWidth - KMenuOverhead, 
+                       KErrorMessage().Length() );
+    size.iHeight = ( KErrorTitle().Length() + KErrorMessage().Length() + 
+    				 KErrorPressAnyKey().Length() ) / size.iWidth + 3;
+    
+    CConsoleBase* console = NULL;
+    TRAPD( err, console = Console::NewL( _L("Error note"), size ) );
+    if ( err != KErrNone )
+    	{
+    	// We can't create console, exit without displaying error message
+    	return;
+    	}
+    
+    console->Printf( KErrorTitle );    
+    console->Printf( KErrorMessage ); 
+    console->Printf( KErrorPressAnyKey );
+        
+    console->Getch();
+    
+    delete console;    
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: UiError
+
+    Description: Function is called when UI hit an error.
+    
+    Parameters: const TDesC& aInfo: in: information
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+void CConsoleMain::UiError( const TDesC& aInfo )
+    {
+    
+    // Error note deletes itself when it completes
+    CMenuNotifier::NewL( aInfo, this );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: Update
+
+    Description: Receives output update notification from CUIStore.
+    
+    Parameters: CStartedTestCase* aTestCase: in: Test case information
+                TInt aFlags: in: Update reason flags
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::Update( CStartedTestCase* aTestCase, TInt aFlags )
+    {
+    
+   	TInt err( KErrNone );
+    
+    // First check if some menu should be signaled 
+    if( ( aFlags & CUIStoreIf::EStatusExecuted ) &&
+        ( aTestCase->iBackPtr ) )
+        {
+        CMenu* menu = ( CMenu* )aTestCase->iBackPtr;
+        TRAP( err, 
+            menu->SignalL( aTestCase ); 
+            );            
+        }
+
+    // Update console if needed
+    if( iCurrentMenu && ( iCurrentMenu->Type() & aFlags ) )
+        {
+        if( aFlags & CUIStoreIf::EPrintUpdate )
+            {
+            CCaseExecutionView* view = 
+                ( CCaseExecutionView* )iCurrentMenu;
+            if( view->TestCase() == aTestCase )
+                {
+                TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ) );
+                }
+            }
+        else
+            {
+            TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ); )
+            }
+        }
+    
+    	if ( err != KErrNone )
+    		{
+    		if ( err == KErrNoMemory )
+    			{
+    			ExitWithNoMemoryErrorMessage();
+    			}
+    		}
+    
+    }
+                                                              
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: Error
+
+    Description: Function is called when test framework prints error.
+    
+    Parameters: TErrorNotification& aError: in: Error description
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+void CConsoleMain::Error( TErrorNotification& aError )
+    {
+    
+    // Error note deletes itself when it completes
+    CMenuNotifier::NewL( aError.iText, this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: PopupMsg
+
+    Description: Function is called when testframework 
+        wants to print a popup window.
+    
+    Parameters: TDesC& aMsg: in: message
+                
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+TInt CConsoleMain::PopupMsg( const TDesC& aLine1, 
+                             const TDesC& aLine2, 
+                             TInt aTimeInSecs )
+    {
+    
+    TInt ret = KErrNone;
+    
+    CMenuDialog* dialog = NULL;
+
+    TRAP( ret, dialog = CMenuDialog::NewL( this, aLine1, aLine2, aTimeInSecs ); );
+
+    if( ret == KErrNone )
+        {
+        iDialogs.Append( dialog ); 
+        return (TInt)dialog;
+        }
+
+    return ret;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: PopupMsg
+
+    Description: Function is called when testframework 
+        wants to print a popup window.
+    
+    Parameters: TDesC& aMsg: in: message
+                
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+TInt CConsoleMain::PopupMsg( const TDesC& aLine1, 
+                             const TDesC& aLine2, 
+                             TInt aTimeInSecs,
+                             TKeyCode& aKey,
+                             TRequestStatus& aStatus )
+    {
+    
+    TInt ret = PopupMsg( aLine1, aLine2, aTimeInSecs );
+    if( ret < 0 )
+        {
+        return ret;
+        }    
+        
+    CMenuDialog* dialog = (CMenuDialog*) ret; 
+    ret = dialog->WaitForKeypress( aKey, aStatus );
+
+    return (TInt) dialog;
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: Close
+
+    Description: Close instance.
+    
+    Parameters: TInt aHandle: in: handle to open instance.                
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::Close( TInt aHandle )
+    {
+    
+    if( aHandle < 0 )
+        {
+        return;
+        }
+    CMenuDialog* dialog = (CMenuDialog*) aHandle;
+    TInt index = iDialogs.Find( dialog );
+    if( index >= 0 )
+        {
+        delete dialog;
+        iDialogs.Remove( index );
+        }
+        
+    }
+           
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: GetConsole
+
+    Description: Returns the console
+
+    Parameters: None
+
+    Return Values: CConsoleBase*                    Console
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleBase* CConsoleMain::GetConsole()
+    {
+
+    return iConsole;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: TimerUpdate
+
+    Description: Updates current menu from timer
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::TimerUpdate()
+    {
+
+	iCurrentMenu->TimerUpdate();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ParseTestModulesL
+
+    Description: Parse and search for module info and fill list of modules.
+
+    Parameters: CStifParser*     aParser:       in: CStifParser object
+                CTestModuleList* aModuleList:   in: list of modules
+                TPtrC&           aSectionStart: in: descriptor with start of section string
+                TPTrC&           aSectionEnd:   in: descriptor with end of section string
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd)
+    {
+    //First let's find all modules given in Stif's ini file and store that info in CTestModuleList object
+    CStifSectionParser* sectionParser = NULL;
+    CStifItemParser* item = NULL;
+
+    sectionParser = aParser->SectionL(aSectionStart, aSectionEnd);
+
+    while(sectionParser)
+        {
+        RDebug::Print(_L("Found '%S' and '%S' sections"), &aSectionStart, &aSectionEnd);
+        CleanupStack::PushL(sectionParser);
+        RDebug::Print(_L("Starting to read module information"));
+
+        // Get name of module
+        _LIT(KModuleName, "ModuleName=");
+        item = sectionParser->GetItemLineL(KModuleName);
+        CleanupStack::PushL(item);
+        if(!item)
+            {
+            CleanupStack::PopAndDestroy(item);
+            UiError(_L("Line not found from module section"));
+            User::Leave(KErrGeneral);
+            }
+        else
+            {
+            RDebug::Print(_L("'%S' found"), &KModuleName);
+            }
+
+        TPtrC name;
+        TName moduleName;
+        TInt ret(KErrNone);
+        ret = item->GetString(KModuleName, name);
+        if(ret != KErrNone)
+            {
+            CleanupStack::PopAndDestroy(item);
+            RDebug::Print(_L("Module name parsing left with error (%d)"), ret);
+            UiError(_L("Module name parsing left with error (err)"));
+            User::Leave(ret);
+            }
+        else
+            {
+            RDebug::Print(_L("Module '%S' found from ini-file"), &name);
+            moduleName.Copy(name);
+            moduleName.LowerCase();
+            ret = aModuleList->AddTestModule(moduleName);
+            if(ret != KErrNone && ret != KErrAlreadyExists)
+                {
+                RDebug::Print(_L("Could not add module to list of modules (%d)"), ret);
+                UiError(_L("Could not add module to list of modules (err)"));
+                User::Leave(ret);
+                }
+            }
+        CleanupStack::PopAndDestroy(item);
+
+        //Get pointer to added module
+        CTestModuleInfo* moduleInfo = aModuleList->GetModule(moduleName);
+        if(!moduleInfo)
+            {
+                RDebug::Print(_L("Could not add get module info from list"));
+                UiError(_L("Could not add get module info from list"));
+                User::Leave(KErrNotFound);
+            }
+
+        // Get ini file, if it exists
+        RDebug::Print(_L("Start parsing ini file"));
+        _LIT(KIniFile, "IniFile=");
+        item = sectionParser->GetItemLineL(KIniFile);
+        if(item)
+            {
+            RDebug::Print(_L("'%S' found"), &KIniFile);
+            CleanupStack::PushL(item);
+            TPtrC iniFile;
+            ret = item->GetString(KIniFile, iniFile);
+            if(ret == KErrNone)
+                {
+                RDebug::Print(_L("Initialization file '%S' found, file can be empty"), &iniFile);
+                TFileName filename;
+                filename.Copy(iniFile);
+				TStifUtil::CorrectFilePathL(filename);
+                filename.LowerCase();
+                moduleInfo->SetIniFile(filename);
+                }
+            else
+                {
+                RDebug::Print(_L("Initialization file not found"));
+                }
+            CleanupStack::PopAndDestroy(item);
+            }
+        else
+            {
+            RDebug::Print(_L("'%S' not found"), &KIniFile);
+            }
+
+        // Get config (testcase) file
+        RDebug::Print(_L("Start parsing cfg files"));
+        TPtrC cfgTag;
+        for(TInt i = 0; i < 2; i++)
+            {
+            //Set tag for config files
+            if(i == 0)
+                {
+                cfgTag.Set(_L("ConfigFile="));
+                }
+                else
+                {
+                cfgTag.Set(_L("TestCaseFile="));
+                }
+            //Read data
+            item = sectionParser->GetItemLineL(cfgTag);
+            while(item)
+                {
+                CleanupStack::PushL(item);
+                RDebug::Print(_L("Item '%S' found"), &cfgTag);
+                TPtrC cfgFile;
+                ret = item->GetString(cfgTag, cfgFile);
+                if(ret == KErrNone)
+                    {
+                    RDebug::Print(_L("Configuration file '%S' found"), &cfgFile);
+                    TFileName ifile;
+                    ifile.Copy(cfgFile);
+					TStifUtil::CorrectFilePathL(ifile);
+                    ifile.LowerCase();
+                    moduleInfo->AddCfgFile(ifile);
+                    }
+                else
+                    {
+                    RDebug::Print(_L("Configuration file not found"));
+                    }
+                CleanupStack::PopAndDestroy(item);
+                item = sectionParser->GetNextItemLineL(cfgTag);
+                }
+            }
+
+        RDebug::Print(_L("Module '%S' information read correctly"), &moduleName);
+
+        // Get next section
+        CleanupStack::PopAndDestroy(sectionParser);
+        sectionParser = aParser->NextSectionL(aSectionStart, aSectionEnd);
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: GetMainMenu
+
+    Description: Return main menu of console.
+
+    Parameters: None
+
+    Return Values: CMainMenu*  pointer to main menu
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CMainMenu* CConsoleMain::GetMainMenu()
+    {
+    return dynamic_cast<CMainMenu*>(iMainMenu);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: GetFilterArray
+
+    Description: Get filter array for reading purposes
+
+    Parameters: None
+
+    Return Values: const RPointerArray<TDesC>&  array with filters
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+const RPointerArray<TDesC>& CConsoleMain::GetFilterArray(void) const
+    {
+    return iFilters;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: SetFilterIndex
+
+    Description: Set info about which index filter is used
+
+    Parameters: TInt aFilterIndex: filter index selected by user
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::SetFilterIndex(TInt aFilterIndex)
+    {
+    iChosenFilterIndex = aFilterIndex;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: GetFilterIndex
+
+    Description: Get info about which index filter is used
+
+    Parameters: None
+
+    Return Values: TInt: filter index selected by user
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CConsoleMain::GetFilterIndex(void)
+    {
+    return iChosenFilterIndex;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: NewL
+
+    Description: Construct a new CScrollerTimer object
+
+    Parameters: CConsoleMain*             :in:      Pointer to main console               
+
+    Return Values: CScrollerTimer*                         New CScrollerTimer object
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CScrollerTimer* CScrollerTimer::NewL( CConsoleMain* aMain )
+    {
+
+    CScrollerTimer* self = new ( ELeave ) CScrollerTimer();
+    CleanupStack::PushL( self );
+    self->ConstructL( aMain );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: ConstructL
+
+    Description: Second level constructor
+
+    Parameters: CConsoleMain*             :in:      Pointer to main console
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CScrollerTimer::ConstructL( CConsoleMain* aMain )
+    {
+
+    // Store module information
+    iMain = aMain;
+	iTimer.CreateLocal();
+
+	CActiveScheduler::Add ( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: CScrollerTimer
+
+    Description: Constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CScrollerTimer::CScrollerTimer() : CActive (CActive::EPriorityStandard)
+    {
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: ~CScrollerTimer
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CScrollerTimer::~CScrollerTimer( )
+    {
+
+	Cancel();
+	iTimer.Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: StartL
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CScrollerTimer::StartL( )
+    {
+
+	SetActive();
+	iTimer.After ( iStatus, KScrollPeriod );	
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: RunL
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CScrollerTimer::RunL( )
+    {
+
+	iMain->TimerUpdate();
+
+	// Restart request
+	SetActive();
+	iTimer.After ( iStatus, KScrollPeriod );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: DoCancel
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CScrollerTimer::DoCancel( )
+    {
+
+	iTimer.Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: RunError
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CScrollerTimer::RunError( TInt aError)
+    {
+    if ( aError == KErrNoMemory )
+    	{
+    	iMain->ExitWithNoMemoryErrorMessage();
+    	}
+  
+	return aError;
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CConsoleReader class.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: NewL
+
+    Description: Construct the console main class
+
+    Parameters: CConsoleMain* aMain: in: Pointer to main console
+                CConsoleBase* aConsole: in: Console pointer
+
+    Return Values: CConsoleReader*                    New object
+
+    Errors/Exceptions: Leaves if memory allocation fails or
+                       ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleReader* CConsoleReader::NewL( CConsoleMain* aMain, 
+                                      CConsoleBase* aConsole )
+    {
+
+    CConsoleReader* self = 
+        new ( ELeave ) CConsoleReader( aMain, aConsole );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: 
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleReader::ConstructL( )
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: CConsoleReader
+
+    Description: Constructor.
+
+    Parameters: CConsoleMain* aMain: in: Pointer to main console
+                CConsoleBase* aConsole: in: Console pointer
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleReader::CConsoleReader( CConsoleMain* aMain, 
+                                CConsoleBase* aConsole ): 
+    CActive( EPriorityStandard )
+    {
+    
+    iMain = aMain;
+    iConsole = aConsole;
+    
+    CActiveScheduler::Add( this );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: ~CConsoleReader
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleReader::~CConsoleReader( )
+    {	
+    
+    Cancel();    
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: StartL
+
+    Description: Construct menu objects and start the menu handling
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions:
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleReader::StartL( )
+    {
+
+    // Start to process keyboard events
+    SetActive();
+    iConsole->Read(iStatus);
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: RunError
+
+    Description: None
+
+    Parameters: TInt aError
+
+    Return Values: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/    
+TInt CConsoleReader::RunError(TInt aError)
+    {
+    return aError;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: RunL
+
+    Description: Process keyboard events. Print new menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if SelectL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleReader::RunL()
+    {
+
+    iMain->KeyPressed();
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: DoCancel
+
+    Description: Cancel request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleReader::DoCancel()
+    {
+    
+    iConsole->ReadCancel();
+    
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: MainL
+
+    Description: The main function that can leave.
+    Create the CMainConsole object and create, initialise and 
+    start active scheduler.
+
+    When active scheduler is stopped, clean up memory and exit.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation or CConsoleMain construction
+                       leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+LOCAL_C void MainL()
+    {
+
+    // Construct and install active scheduler
+    CActiveScheduler* scheduler=new ( ELeave ) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    // Construct the console
+    CConsoleMain* mainConsole = CConsoleMain::NewL();
+    CleanupStack::PushL( mainConsole );
+
+    // Start the console
+    mainConsole->StartL();
+
+    // Start handling requests
+    CActiveScheduler::Start();
+    // Execution continues from here after CActiveScheduler::Stop()
+
+    // Clean-up
+    CleanupStack::PopAndDestroy( mainConsole );
+    CleanupStack::PopAndDestroy( scheduler );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: The main function. Execution starts from here.
+    Create clean-up stack and trap the MainL function which does the
+    real work.
+
+    Parameters: None
+
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+
+    __UHEAP_MARK;
+
+    // Get clean-up stack
+    CTrapCleanup* cleanup=CTrapCleanup::New();
+
+    // Call the main function
+    TRAPD( error, MainL() );
+
+    // Clean-up
+    delete cleanup; 
+    cleanup = NULL;
+
+    __UHEAP_MARKEND;
+
+    return error;
+
+    }
+
+#if defined(__WINS__)
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: WinsMain
+
+    Description: The WinsMain function.
+
+    Parameters: None
+
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt WinsMain()
+	{
+	E32Main();
+	return KErrNone;
+	}
+
+#endif // __WINS__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/consoleui/src/Consolemenus.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5695 @@
+/*
+* 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: This module contains implementation of 
+* CMenu-derived classes.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+
+#include <f32file.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "ConsoleUI.h"
+#include "ConsoleMenus.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+LOCAL_C void LimitedAppend( TDes& aOriginal, const TDesC& aAppend);
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+LOCAL_C void LimitedAppend( TDes& aOriginal, const TDesC& aAppend)
+    {
+
+    TInt spaceLeft = aOriginal.MaxLength() - aOriginal.Length();
+    
+    if (spaceLeft > aAppend.Length())
+        {
+        aOriginal.Append ( aAppend );
+        }
+    else
+        {       
+        aOriginal.Append ( aAppend.Left ( spaceLeft ) );
+        }
+
+    }
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMenu::NewL( CConsoleMain* aConsole,
+                    CMenu* aParent,
+                    const TDesC& aName
+                  )
+    {
+
+    CMenu* self = new ( ELeave ) CMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+				const TDesC& aHeader	  :in:		Text containing STIF version info
+				
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::ConstructL( CConsoleMain* aConsole,
+                        CMenu* aParent,
+                        const TDesC& aName,
+                        const TDesC& aHeader
+                      )
+    {
+ 
+    // Store the parameters
+    iMain = aConsole;
+    iConsole = aConsole->GetConsole();
+    iParent = aParent;
+    iName = aName;
+    iHeader = aHeader;
+
+    // Get display size
+    const TInt KOverHead = 5;
+    iSize = iConsole->ScreenSize();
+    iScreenSize = iSize.iHeight - KOverHead;   // Size available for menus
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: CMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu::CMenu()
+    {
+    iDirection = 1;
+    iPrevPos  = -1;     // Invalid starting value
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: ~CMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CMenu::~CMenu()
+    {
+    
+    iItems.ResetAndDestroy();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: TimerUpdate
+
+    Description: TimerUpdate
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenu::TimerUpdate()
+    {    
+    iScrolledLine.Zero();
+    RRefArray<TDesC> texts;
+    User::LeaveIfError( ItemTexts( texts ) );
+    
+    TInt count = texts.Count();
+    // If list is empty, do not scroll.
+    if ( count < 1 )
+        {
+        texts.Close();
+        return;
+        }
+    
+    // Recalculate visible part of menu
+    Recalculate( count );
+
+    // If menu selection is updated, then restart scrolling
+    if (iPrevPos != iFirst + iPosOnScreen)
+        {
+        iPrevPos = iFirst + iPosOnScreen;
+        iStart = 0;
+        iDirection = 1;
+        }
+
+
+    // If menu item have not been changed after last timer, then
+    // start scrolling  
+    const TDesC& name = texts[ iFirst + iPosOnScreen ];
+    if ( name.Length() > ( iSize.iWidth - KMenuOverhead ) )
+        {
+
+        TInt y = iConsole->WhereY();
+        TInt x = iConsole->WhereX();
+        TBuf<80> iTmp;              
+
+        iStart = iStart + iDirection;
+
+        // "Right end"
+        if ( iStart + iSize.iWidth > name.Length() + KMenuOverhead + 2)
+            {
+            iStart--;
+            iDirection = -1;
+            }
+        
+        // "Left end"
+        if ( iStart == -1 )
+            {
+            iStart++;
+            iDirection = 1;
+            }
+        
+        if( iStart > name.Length() )
+            {
+            iStart = 0;
+            }
+
+        iTmp=_L(" *");
+        LimitedAppend( iTmp, name.Mid ( iStart ) );
+            
+        iConsole->SetPos( 0, iPosOnScreen+1);       
+        Print(iTmp);
+        iScrolledLine.Copy(texts[iFirst + iPosOnScreen].Left(iScrolledLine.MaxLength())); 
+
+        iConsole->SetPos(x,y);
+        }
+    texts.Close();
+
+    }
+    
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number 
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenu::AppendBefore( TInt aLineNum, TDes& aLine )
+    {
+    
+    if( ( aLine.MaxLength() - aLine.Length() ) < 2 )
+        {
+        return;
+        }        
+    
+    // If printing active line, print the marker
+    if ( aLineNum == iPosOnScreen + iFirst )
+        {
+        aLine.Append( _L(" *") );
+        }
+    else
+        {
+        aLine.Append( _L("  ") );
+        }
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenu::PrintMenuL( TUpdateType aType )
+    {
+
+    iUpdateType = aType;
+    
+    TBuf<KMaxLineLength> line;
+    
+    //if we are moving between items located on the same page clearing screen is not needed
+    if(!iPreventClearScreen)
+        {
+        // Clear display
+        iConsole->ClearScreen();
+        
+        //Print STIF version information, only when defined (i.e. in main menu)
+        if(iHeader != _L(""))
+           Print(iHeader);
+        
+        // Print menu title
+        Print( Name() );
+        
+        RRefArray<TDesC> texts;
+        User::LeaveIfError( ItemTexts( texts ) );
+        
+        // Recalculate visible part of menu
+        Recalculate( texts.Count() );
+        
+        //needed for setting cursor at correct line 
+        iMenuItemsListStartIndex = iConsole->CursorPos().iY;
+        
+        // Print items
+        for ( TInt i = iFirst; i <= iLast; i++ )
+            {
+            line.Zero();
+            
+            // Append text before line
+            AppendBefore( i, line );
+        
+            // Get the menu line
+            LimitedAppend ( line, texts[i] );
+        
+            // Print the line
+            Print(line);
+            }
+        texts.Close();
+        
+        //needed for setting cursor at correct line 
+        iMenuItemsListEndIndex = iConsole->CursorPos().iY;
+        }
+    else
+        {
+        //removing "*" sign from the previous cursor position
+        iConsole->SetPos(0, iPrevPosOnScreen + iMenuItemsListStartIndex);
+        //line.Append( _L("  ") );
+        AppendBefore(iPrevPosOnScreen + iFirst, line);
+        LimitedAppend(line, iScrolledLine);
+        //iConsole->Printf(line);
+        Print(line);
+        iConsole->SetPos(0, iPosOnScreen + iMenuItemsListStartIndex);
+        line.Zero();
+        iScrolledLine.Zero();
+        
+        //writing "*" sign before the currently selected line
+        line.Append( _L(" *") );
+        iConsole->Printf(line);
+        iConsole->SetPos(0, iMenuItemsListEndIndex);
+        iPreventClearScreen = EFalse;
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: SelectL
+
+    Description: Common method to count all variables needed for printing
+                 page of the screen.
+
+    Parameters: TInt aDelta       :in:      where to move current position
+                 Value > 0 stands for moving down the menu.
+                 Value < 0 stands for moving up the menu.
+
+    Return Values: 
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::MovePosition(TInt aDelta)
+    {
+    if(iItemCount > 0 && aDelta != 0)
+        {
+        // Valid screen size
+        TInt screenSize = iScreenSize + 1;
+        TInt realPosition = iFirst + iPosOnScreen;
+
+        // Number of all pages and items in the last page
+        TInt rest = iItemCount % screenSize;
+        TInt pages = (iItemCount / screenSize) + ((rest == 0) ? (0) : (1));
+
+        // Current page
+        TInt currPage = realPosition / screenSize;
+        
+        // New page
+        TInt newRealPosition = realPosition + aDelta;
+        while(newRealPosition < 0)
+            newRealPosition += iItemCount;
+        newRealPosition %= iItemCount;
+        TInt newPage = newRealPosition / screenSize;
+        
+        // Change position
+        iFirst = newPage * screenSize;
+        iLast = iFirst + screenSize - 1;
+        if(iLast >= iItemCount)
+            iLast = iItemCount - 1;
+        iPrevPosOnScreen = iPosOnScreen;
+        iPosOnScreen = newRealPosition % screenSize;
+        if(newPage == pages - 1 && iPosOnScreen >= rest)
+            iPosOnScreen = rest - 1;
+            
+        // Prevent refreshing
+        iPreventClearScreen = (currPage == newPage);
+        }
+    else
+        iPreventClearScreen = ETrue;    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Either updates position in
+    menu or returns new menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    switch ( (TInt) aSelection )
+    {
+
+    // Exit
+    case EKeyEscape:
+        aContinue = EFalse;
+        return this;
+
+    // SelectL item
+    case EKeyEnter:
+    case EKeyRightArrow:
+        return iItems[iPosOnScreen];
+
+    // Going back
+    case EKeyLeftArrow:
+        return iParent;
+
+    // Go down
+    case EKeyDownArrow:
+        MovePosition(1);
+        break;
+        
+    // Go Up
+    case EKeyUpArrow:
+        MovePosition(-1);
+        break;
+
+    // Additional keys
+    case EKeyHome:
+    case '3':
+        MovePosition(-iFirst - iPosOnScreen);
+        break;
+
+    case EKeyEnd:
+    case '9':
+        MovePosition(iItemCount - 1 - iFirst - iPosOnScreen);
+        break;
+
+    case EKeyPageUp:
+    case '1':
+        MovePosition((iFirst + iPosOnScreen - iScreenSize - 1 >= 0) ? (-iScreenSize - 1) : (-iFirst - iPosOnScreen));
+        break;
+
+    case EKeyPageDown:
+    case '7':
+        MovePosition((iFirst + iPosOnScreen + iScreenSize + 1 < iItemCount) ? (iScreenSize + 1) : (iItemCount - 1 - iFirst - iPosOnScreen));
+        break;
+    default:  // Bypass the keypress
+        break;
+    }
+
+    // Continue normally and keep in the same menu
+    aContinue = ETrue;
+    return this;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    TInt count = iItems.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aArray.Append( iItems[i]->Name() ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    return KErrNone;
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: SetParent
+
+    Description: Sets menu parent menu.
+
+    Parameters: CMenu* aMenu              :in:      Menu parent
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::SetParent ( CMenu* aMenu )
+    {
+
+    iParent = aMenu;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: Print
+
+    Description: Prints one line text and changes to next line. If line is
+    too long, overhead is not printed..
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenu::Print( const TDesC& aPrint )
+    {
+    
+    iConsole->Write ( aPrint.Left( iSize.iWidth - KMenuOverhead ) );
+    iConsole->Write(_L("\n"));
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: PrintMulti
+
+    Description: Prints text. If line is too long, it will be continued to
+    following lines.
+
+    Parameters: const TDesC& aPrint       :in:      Text to print
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::PrintMulti( const TDesC& aPrint )
+    {
+
+    // Get current line
+    const TInt KMenuOverHead = 2;
+    TInt y = iConsole->WhereY();
+
+    const TInt KLineLen =iSize.iWidth -4;
+    TBuf<KMaxLineLength+1> oneLine;
+
+    // Loop through the line
+    for (TInt i = 0; i < aPrint.Length(); i++)
+        {
+        oneLine.Append( aPrint[i] );
+
+        // Print one line
+        if (oneLine.Length() == KLineLen )
+            {
+            oneLine.Append (_L("\n"));
+            iConsole->Printf(oneLine);
+            oneLine=_L("");
+            y++;
+            }
+    
+        // Prevent display scrolling
+        if ( y == iScreenSize + KMenuOverHead )
+            {
+            oneLine=_L("");
+            break;
+            }
+        }
+
+    // Print last part if required
+    if ( oneLine.Length() != 0 )
+        {
+        oneLine.Append (_L("\n"));
+        iConsole->Printf(oneLine);
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: AddItem
+
+    Description: Add new item to menu
+
+    Parameters: CMenu* aMenu              :in:      Menu to be added
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if can't add item to menu
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::AddItemL( CMenu* aMenu )
+    {
+
+    User::LeaveIfError ( iItems.Append (aMenu) );
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: Name
+
+    Description: Returns menu name
+
+    Parameters: None
+
+    Return Values: const TDesC&                     Menu name
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CMenu::Name( ) const
+    {
+
+    return iName;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: MapKeyCode
+
+    Description: Maps numeric keycodes to proper TKeyCode values
+
+    Parameters: TKeyCode 
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+void CMenu::MapKeyCode(TKeyCode &aSelection)
+    {
+    
+    TInt asciiCode = (TInt) aSelection;
+    
+    // Handling numeric keys 2,4,6 and 8
+    
+    if(asciiCode == KMyKeyUpAsciiCode)
+        {
+        aSelection = EKeyUpArrow;
+        }
+        
+    if(asciiCode == KMyKeyLeftAsciiCode)
+        {
+        aSelection = EKeyLeftArrow;
+        }
+
+    if(asciiCode == KMyKeyRightAsciiCode)
+        {
+        aSelection = EKeyEnter;
+        }
+
+    if(asciiCode == KMyKeyDownAsciiCode)
+        {
+        aSelection = EKeyDownArrow;
+        }
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: Recalculate
+
+    Description: Recalculates visible menu elements
+
+    Parameters: TInt aItemCount    :in:      Menu items count
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::Recalculate( TInt aItemCount )
+	{    
+    TInt oldItemCount = iItemCount;
+     
+    iItemCount = aItemCount;
+ 
+    // If first time in menu, update start and end positions
+    if ( ( iFirst == 0 ) && ( iLast == 0 ) || (iItemCount == 0)) //if there are no items, update start and end positions too
+    	{
+    	if ( iItemCount - 1 > iScreenSize  )
+    		{
+    		iLast = iScreenSize;
+    		}
+    	else
+    		{
+    		iLast = iItemCount - 1;
+    		}
+    	iPosOnScreen = 0;
+    	}
+    // New menu entry added, update last visible element if needed
+    else if ( oldItemCount < iItemCount )
+    	{
+    	if ( iFirst + iScreenSize < iItemCount )
+    		{
+    		iLast = iFirst + iScreenSize;
+    		}
+    	else
+    		{
+    		iLast = iItemCount - 1;
+    		}
+    	}
+    // Menu entry removed, update last visible element if needed
+    else if ( oldItemCount > iItemCount )
+    	{
+    	if ( iFirst + iScreenSize < iItemCount )
+    		{
+    		iLast = iFirst + iScreenSize;
+    		}
+    	else if ( iFirst > iItemCount - 1 )
+    		{
+    		iFirst = iItemCount - 1 - iScreenSize;
+    		if ( iFirst < 0 )
+    			{
+    			iFirst = 0;
+    			}
+    		iLast = iItemCount - 1;
+    		iPosOnScreen = iFirst - iLast;
+    		}
+    	else
+    		{
+    		iLast = iItemCount - 1;
+    		}
+    	
+    	if ( iFirst + iPosOnScreen > iLast )
+    		{
+    		iPosOnScreen = iLast - iFirst;
+    		}
+    	}
+    
+    if (iFirst < 0)
+        {
+        iFirst = 0;
+        }
+    if (iLast > iItemCount)
+        {
+        iLast = iItemCount - 1;
+        }
+    if ( iFirst + iScreenSize < iItemCount )
+        {
+        iLast = iFirst + iScreenSize;
+        }
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CFileNameQueryView* CFileNameQueryView::NewL( CConsoleMain* aConsole,
+                                              CMenu* aParent,
+                                              const TDesC& aName )
+    {
+
+    CFileNameQueryView* self = new ( ELeave ) CFileNameQueryView();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CFileNameQueryView::ConstructL( CConsoleMain* aConsole, 
+                                     CMenu* aParent, 
+                                     const TDesC& aName 
+                                    )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: ~CFileNameQueryView
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CFileNameQueryView::~CFileNameQueryView()
+    {
+
+    iTestModuleNames.ResetAndDestroy();
+    iTestModuleNames.Close();
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: ItemText
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CFileNameQueryView::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    iTestModuleNames.ResetAndDestroy();    
+    
+    // Add loaded module names to menu
+    TInt ret = iMain->UIStore().ListAllModules( iTestModuleNames );
+
+    if( ret != KErrNone )
+        {                 
+        return ret;
+        }
+        
+    TInt count = iTestModuleNames.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aArray.Append( *iTestModuleNames[i] ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    return KErrNone; 
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Just return the parent menu
+
+    Parameters: TKeyCode aSelection       :in:      Not used
+                TBool& aContinue          :out:     Has user pressed "Quit"?
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CFileNameQueryView::SelectL( TKeyCode aSelection, 
+                                    TBool& aContinue )
+    {  
+    
+    MapKeyCode(aSelection);
+
+    if (aSelection == EKeyEnter || aSelection == EKeyRightArrow )
+        {
+        if( iPosOnScreen < iTestModuleNames.Count() )
+            {
+            TInt ret = 
+                iMain->UIStore().AddTestModule( *iTestModuleNames[iPosOnScreen] );
+            if( ret != KErrNone )
+                {
+                TErrorNotification error;
+                error.iModule.Copy( _L("ConsoleUI") );
+                error.iText.Copy( _L("Failed to load test module ") );
+                error.iText.Append( *iTestModuleNames[iPosOnScreen] );
+                error.iText.Append( _L(" error "));
+                error.iText.AppendNum( ret );
+                iMain->Error( error );
+                }
+            return iParent;
+            }
+        else
+            {
+            return this;
+            }
+        }  
+
+    return CMenu::SelectL( aSelection, aContinue );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                const TDesC& aHeader	  :in:		Text containing STIF version information
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMainMenu* CMainMenu::NewL( CConsoleMain* aConsole,
+                            CMenu* aParent,
+                            const TDesC& aName,
+                            const TDesC& aHeader)
+    {
+
+    CMainMenu* self = new ( ELeave ) CMainMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aHeader );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMainMenu
+
+    Method: ~CMainMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMainMenu::~CMainMenu()
+    {
+    delete iOutputView;
+    iOutputView = NULL;
+    delete iOperationMenu;
+    iOperationMenu = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text. Add "Exit" to normal SelectLion
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMainMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    TInt ret = CMenu::ItemTexts( aArray );
+    if ( ret != KErrNone )
+    	{
+    	return ret;
+    	}
+    // Add Exit to last one in menu
+    if( aArray.Append( KExitTxt ) != KErrNone )
+        {
+        return KErrNoMemory;
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                const TDesC& aHeader	  :in:		Text containing STIF version information
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMainMenu::ConstructL( CConsoleMain* aConsole, 
+                            CMenu* aParent,
+                            const TDesC& aName,
+                            const TDesC& aHeader
+                          )
+    {
+    CMenu::ConstructL( aConsole, aParent, aName, aHeader);
+    iOutputView = NULL;
+    iOperationMenu = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle SelectLion in this
+    method, other keys are handles in CMenu class.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMainMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    // If SelectLion == "exit" and right or enter
+    if (aSelection == EKeyEnter || aSelection == EKeyRightArrow )
+        {
+        if ( iPosOnScreen == iItemCount-1 )
+            {
+            // Exit
+            aContinue = EFalse;
+            return this;
+            }
+        }
+
+    // Normal menu handling
+    CMenu* tmp = CMenu::SelectL(aSelection, aContinue);
+    return tmp;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: CreateOutputViewL
+
+    Description: Creates test case output view.
+
+    Parameters: CMenu* aParent: parent menu for case operation menu
+
+    Return Values: CMenu*        New menu
+
+    Errors/Exceptions: Leaves is CCaseExecutionView menu leaves during creation
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMainMenu::CreateOutputViewL(CMenu* aParent)
+    {
+    // Get test cases that have been run
+    RRefArray<CStartedTestCase> startedTestCases;
+    CleanupClosePushL(startedTestCases);
+    CMenu* res = NULL;
+
+    startedTestCases.Reset();
+    if(iMain->UIStore().StartedTestCases(startedTestCases, CUIStoreIf::EStatusAll) == KErrNone)
+        {                 
+        TInt count = startedTestCases.Count();
+        if(count > 0)
+            {
+            // Create menu with execution info
+            const CStartedTestCase* caseContainer = &startedTestCases[count - 1];
+            delete iOutputView;
+            iOutputView = NULL;
+            delete iOperationMenu;
+            iOperationMenu = NULL;
+
+            iOperationMenu = CCaseOperationMenu::NewL(iMain,
+                                                      aParent, //back to parent menu
+                                                      caseContainer->TestInfo().TestCaseTitle(),
+                                                      caseContainer
+                                                     );
+
+            iOutputView = CCaseExecutionView::NewL(iMain,
+                                                   iOperationMenu, //back to Case Operation Menu
+                                                   caseContainer->TestInfo().TestCaseTitle(),
+                                                   caseContainer
+                                                  );
+            res = iOutputView;
+            }
+        }
+        
+    CleanupStack::PopAndDestroy(&startedTestCases);
+    return res;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CModuleListView* CModuleListView::NewL( CConsoleMain* aConsole,
+                                        CMenu* aParent,
+                                        const TDesC& aName )
+    {    
+
+    CModuleListView* self = new ( ELeave ) CModuleListView();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: ~CModuleListView
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CModuleListView::~CModuleListView()
+    {
+    delete iModuleAdd;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: ConstructL
+
+    Description: Second level constructor. 
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if module can't be appended to list
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CModuleListView::ConstructL( CConsoleMain* aConsole,
+                                  CMenu* aParent,
+                                  const TDesC& aName
+                                 )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+   
+    // Construct module menu
+    iModuleAdd  = CFileNameQueryView::NewL ( iMain, this, KSelectMenuTxt );    
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: ItemText
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CModuleListView::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    // Add also "Add module" text
+    if( aArray.Append( KAddMenuTxt ) != KErrNone )
+        {
+        return KErrNoMemory;
+        }
+    if( aArray.Append( KLoadMenuTxt ) != KErrNone )
+        {
+        return KErrNoMemory;
+        } 
+        
+    return KErrNone; 
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CModuleListView
+
+    Method: PrintMenuL
+
+    Description: Prints the menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CModuleListView::PrintMenuL( TUpdateType aType )
+    {
+    
+    // Get module names
+    RRefArray<TDesC> modules;
+    TInt ret = iMain->UIStore().Modules( modules );
+
+    CMenu::PrintMenuL( aType );
+    
+    // Add loaded module names to menu
+    if( ret != KErrNone )
+        {
+        modules.Reset();
+        modules.Close();
+        return;
+        }
+        
+    TBuf<KMaxLineLength> line;
+    TInt count = modules.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        line = _L("    ");
+        LimitedAppend ( line, modules[i] );
+
+        // Print the line
+        Print(line);
+        }
+    modules.Reset();
+    modules.Close();
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle right arrow and enter
+                 here, others in parent menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CModuleListView::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+    
+    MapKeyCode(aSelection);
+
+    if( ( aSelection == EKeyRightArrow ||
+            aSelection == EKeyEnter ) )
+        {
+        if( iPosOnScreen == EAddMenuTxtItem )
+            {
+            return iModuleAdd;
+            }
+        else if( iPosOnScreen == ELoadMenuTxtItem )
+            {
+            iMain->UIStore().LoadAllModules();
+            return this;
+            }
+        else 
+            {
+            return this;
+            }
+        }
+
+    return CMenu::SelectL( aSelection, aContinue );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseStartMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TBool aShowOutput         :in:      Show output after test case is run
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseStartMenu* CCaseStartMenu::NewL( CConsoleMain* aConsole,
+                                      CMenu* aParent,
+                                      const TDesC& aName,
+                                      TBool aShowOutput)
+    {
+
+    CCaseStartMenu* self = new ( ELeave ) CCaseStartMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aShowOutput );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseStartMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseStartMenu::ConstructL( CConsoleMain* aConsole,
+                                 CMenu* aParent,
+                                 const TDesC& aName,
+                                 TBool aShowOutput
+                               )
+    {
+
+    iShowOutput = aShowOutput;
+    CMenu::ConstructL( aConsole, aParent, aName);
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CCaseStartMenu
+
+    Method: ~CCaseStartMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseStartMenu::~CCaseStartMenu()
+    {
+    iTestCases.Close();
+
+    iMapFilteredToAll.Reset();
+    iMapFilteredToAll.Close();
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseStartMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CCaseStartMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+    iTestCases.Reset();
+    TInt ret = iMain->UIStore().TestCases( iTestCases );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    const RPointerArray<TDesC> &filters = iMain->GetFilterArray();
+    const TInt filterindex = iMain->GetFilterIndex(); 
+    iMapFilteredToAll.Reset();
+    
+    TInt count = iTestCases.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        //If user has chosen filter, let's apply it
+        if(filterindex > 0) //skip the first filter which always is "No filter"
+            {
+            //Check whether test title is matching the applied filter
+            iTitleLowerCase.Copy(iTestCases[i].TestCaseTitle());
+            iTitleLowerCase.LowerCase();
+            iFilterLowerCase.Copy(*filters[filterindex]);
+            iFilterLowerCase.LowerCase();
+
+            if(iTitleLowerCase.Match(iFilterLowerCase) != KErrNotFound)
+                {
+                ret = aArray.Append(iTestCases[i].TestCaseTitle());
+                if(ret != KErrNone)
+                    {
+                    return ret;
+                    }
+                ret = iMapFilteredToAll.Append(i);
+                if(ret != KErrNone)
+                    {
+                    return ret;
+                    }                
+                }
+            }
+        else
+            {
+            ret = aArray.Append( iTestCases[i].TestCaseTitle() );
+            if(ret != KErrNone)
+                {
+                return ret;
+                }
+            ret = iMapFilteredToAll.Append(i);
+            if(ret != KErrNone)
+                {
+                return ret;
+                }                
+            }
+        }
+        
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseStartMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CCaseStartMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    switch ( aSelection )
+        {
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            // Start the case
+            if ( (iFirst + iPosOnScreen) < iMapFilteredToAll.Count() ) //changed from iTestCases to iMapFilteredToAll, because first table keeps info about all test cases, and second one about filtered cases
+                {
+                TInt index;
+                User::LeaveIfError( 
+                    iMain->UIStore().StartTestCase( 
+                        iTestCases[iMapFilteredToAll[iFirst + iPosOnScreen]], index ) );
+                // Create output screen (menu) if needed
+                if(iShowOutput)
+                    {
+                    CMenu* m = iMain->GetMainMenu()->CreateOutputViewL(iParent);
+                    if(m)
+                        return m;
+                    }
+                return iParent;
+                }
+            else
+                {
+                return this;
+                }
+            }
+
+        default:
+            return CMenu::SelectL( aSelection, aContinue);
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleBaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleBaseMenu* CMultipleBaseMenu::NewL( CConsoleMain* aConsole,
+                                            CMenu* aParent,
+                                            const TDesC& aName )
+    {
+
+    CMultipleBaseMenu* self = new ( ELeave ) CMultipleBaseMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleBaseMenu
+
+    Method: CMultipleBaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleBaseMenu::CMultipleBaseMenu(): 
+    iSetFinished( ETrue ),
+    iRunType( ERunSequential ),
+    iMenuTotCount( 0 ),
+    iMenuCount( 0 )
+    {
+    
+    iMenuCount = EChangeAll + 1;
+    iMenuTotCount = iMenuCount;
+    
+    }   
+    
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleBaseMenu
+
+    Method: ~CMultipleBaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleBaseMenu::~CMultipleBaseMenu()
+    {
+    
+    iSetState.Close();
+    
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMultipleBaseMenu::ConstructL( CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName 
+                             )
+    {
+
+    CCaseStartMenu::ConstructL( aConsole, aParent, aName );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMultipleBaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+    if ( iSetFinished )
+        {
+        if( aArray.Append( KChangeAll ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        
+        if( iUpdateType ==  EMenuPrint )
+            {   
+            TInt ret = UpdateTestCases();
+            if( ret != KErrNone )
+                {                 
+                return ret;
+                }
+            }
+        TInt count = iTestCases.Count();
+        for( TInt j=0; j<count; j++ )
+            {
+            if( aArray.Append( iTestCases[j].TestCaseTitle() ) 
+                != KErrNone )
+                {
+                return KErrNoMemory;
+                }
+            if( aArray.Count() > iSetState.Count())
+                {
+                // Appends iSetState only if aArray's size is bigger @js
+                if( iSetState.Append(EFalse) != KErrNone )
+                    {
+                    return KErrNoMemory;
+                    }
+                }
+            }
+        }
+    else
+        {
+        if( aArray.Append( KCancelSet ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMultipleBaseMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number 
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMultipleBaseMenu::AppendBefore( TInt aLineNum, TDes& aLine )
+    {
+    
+    CMenu::AppendBefore( aLineNum, aLine );
+    if( ( aLine.MaxLength() - aLine.Length() ) < 2 )
+        {
+        return;
+        }        
+    
+    if( aLineNum >= iMenuTotCount )
+        {
+        if ( iSetState[ aLineNum - iMenuTotCount ] )
+            {
+            aLine.Append(_L("S "));
+            }
+        else
+            {
+            aLine.Append(_L("  "));
+            }
+        }
+   
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMultipleBaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    if ( iSetFinished )
+        {
+
+        if ( ( aSelection == EKeyEnter  ) || ( aSelection == EKeyRightArrow ) )
+            {
+            // CMultipleBaseMenu relative position 
+            TInt pos = iFirst + iPosOnScreen - iMenuTotCount + iMenuCount;
+            if( pos  == EChangeAll )
+                {
+                TInt count = iTestCases.Count();    
+
+                // Change all                                       
+                for (TInt i = 0; i < count; i++)
+                    {
+                    iSetState[i] = !iSetState[i];
+                    }
+
+                return this;
+                }
+            else
+                {
+                // Normal item, change state...
+                iSetState[ iFirst + iPosOnScreen - iMenuTotCount ] = 
+                    !iSetState[ iFirst + iPosOnScreen - iMenuTotCount ];
+                return this;
+                }            
+            
+            }
+
+		return CMenu::SelectL( aSelection, aContinue );
+        }
+    else
+        {
+
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {
+                if ( iOngoingCaseContainer != NULL )
+                    {
+                    iOngoingCaseContainer->UIEngineContainer().CancelTest();
+                    }
+                iSetFinished = ETrue;
+                iFirst = 0;
+                iLast = 0;
+                return this;
+                }
+            default:
+                return CMenu::SelectL( aSelection, aContinue );
+            }
+
+
+
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: CheckIfAnyCaseIsSelected
+
+    Description: Checks if any of testcases was selected in multiple selection menu
+
+    Parameters: TInt aCount number of testcases in multiple selection menu
+
+    Return Values: ETrue if any testcase was selected, EFalse if none of testcases was selected
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CMultipleBaseMenu::CheckIfAnyCaseIsSelected(TInt aCount)
+{
+	TInt currentPos = 0;
+	for(; currentPos<aCount; currentPos++)	
+	{
+		//if any of testcases was selected then return true
+		if (iSetState[currentPos])
+			return ETrue;
+	}
+	//if none of testcases was selected then return false
+	return EFalse;
+}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: SignalL
+
+    Description: Handle test case starts
+
+    Parameters: CStartedTestCase* aContainer: in: CStartedTestCase container
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CMultipleBaseMenu::SignalL( CStartedTestCase* /*aContainer*/ )
+    {
+
+    TInt count = iTestCases.Count();
+    
+    TBool started = EFalse;
+    TInt index;
+    TInt err = KErrNone;
+
+    // Counter to prevent infinite loop when cases can't be started at all
+    // when running cases in repeat mode.
+    TInt casesChecked = 0;
+
+    // If cases are not aborted or not in last case and at least one test
+    // case was selected, start a new one
+    if ( !iSetFinished && iCurrentRunPos != count && CheckIfAnyCaseIsSelected(count) )
+        {
+        // Search next case from set and execute it.
+        while( iCurrentRunPos < count )
+            {
+            if ( iSetState[iCurrentRunPos] )
+                {       
+                err = iMain->UIStore().StartTestCase( 
+                    iTestCases[ iCurrentRunPos ], 
+                    index );
+
+                iCurrentRunPos++;
+                casesChecked++;
+
+                // Go to start of list, if running cases in repeat mode. 
+                // In other modes, just get out from the main loop
+                if( ( iRunType == ERunRepeatSequential ) &&
+                    ( iCurrentRunPos >= count ) )
+                    {
+                    // Restart from first one on next time.
+                    iCurrentRunPos = 0;
+                    }
+
+                // Handle out of memory error separately, because there is
+                // always new test case result display constructed when
+                // starting case => Starting more new cases uses more memory
+                // and it will not work, so stop starting new cases.
+                if( err == KErrNoMemory )
+                    {
+                    iSetFinished = ETrue;
+                    break;
+                    }
+
+                // Get pointer to ongoing case in case that user wants to
+                // cancel it.
+                iOngoingCaseContainer = 
+                    &iMain->UIStore().StartedTestCaseL( index );
+
+                // Store pointer to this object to allow 
+                // SignalL call when test case is completed
+                iOngoingCaseContainer->iBackPtr = (TAny*)this;
+
+                if( err != KErrNone )
+                    {
+                    TFullTestResult result;  
+                    result.iTestResult.iResult = err;
+                    result.iTestResult.iResultDes.Copy( 
+                                            _L("Failed to start testcase") );
+                    // Prevent infinite loop in case, where
+                    // ERunRepeatSequential and ALL cases fail to start.
+                    if ( iRunType == ERunRepeatSequential && 
+                                            casesChecked == count )
+                        {
+                        // In this state, started = EFalse so final check
+                        // stops running
+                        break;
+                        }
+                    }
+                else if( ( iRunType == ERunSequential ) ||
+                         ( iRunType == ERunRepeatSequential ) )
+                    {
+                    started = ETrue;
+                    break;
+                    }
+                }
+            else 
+                {
+                iCurrentRunPos++;
+                casesChecked++;
+
+                // Go to start of list, if running cases in repeat mode. 
+                // In other modes, just get out from the main loop
+                if( ( iRunType == ERunRepeatSequential ) &&
+                    ( iCurrentRunPos >= count ) )
+                    {
+                    // Restart from first one
+                    iCurrentRunPos = 0;
+                    }
+                }
+            }
+        }
+
+    if ( err == KErrNoMemory )
+    	{
+    	iMain->ExitWithNoMemoryErrorMessage();
+    	}
+    
+    // If nothing was selected, then mark set as finished. 
+    // Or running cases at same time, so all have been started.
+    if ( started == EFalse )
+        {
+        iFirst = 0;
+        iLast = 0;
+        iSetFinished = ETrue;
+        iCurrentRunPos = 0;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: UpdateTestCases
+
+    Description: 
+
+    Parameters: 
+
+    Return Values: 
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMultipleBaseMenu::UpdateTestCases()
+    {
+
+    // Update test cases
+    iTestCases.Reset();
+    iSetState.Reset();
+    return iMain->UIStore().TestCases( iTestCases );
+            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleCaseMenu* CMultipleCaseMenu::NewL( CConsoleMain* aConsole,
+                                            CMenu* aParent,
+                                            const TDesC& aName )
+    {
+
+    CMultipleCaseMenu* self = new ( ELeave ) CMultipleCaseMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleCaseMenu
+
+    Method: CMultipleCaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleCaseMenu::CMultipleCaseMenu()    
+    {
+    
+    iMenuItemsCount = ERepeatRunSelection + 1;
+    iMenuItemsCount++; //Select all between already selected
+    iMenuTotCount += iMenuItemsCount;
+    
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleCaseMenu
+
+    Method: ~CMultipleCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleCaseMenu::~CMultipleCaseMenu()
+    {
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMultipleCaseMenu::ConstructL( CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName 
+                             )
+    {
+
+    CCaseStartMenu::ConstructL( aConsole, aParent, aName );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleCaseMenu
+
+    Method: StartRunningL
+
+    Description: Start running multiple cases.
+
+    Parameters: TRunType aRunType: in: Running type
+                const TDesC& aModule: in: module name 
+                const TDesC& aTestCaseFile: in: test case file name 
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves on error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMultipleCaseMenu::StartRunningL( TRunType aRunType, 
+                                       const TDesC& aModule, 
+                                       const TDesC& aTestCaseFile )
+    {
+    
+    // Update test cases
+    iTestCases.Reset();
+    iSetState.Reset();
+    User::LeaveIfError( 
+        iMain->UIStore().TestCases( iTestCases, aModule, aTestCaseFile ) );
+    
+    // Select all for running
+    TInt count = iTestCases.Count();
+    for( TInt j=0; j<count; j++ )
+        {
+        User::LeaveIfError( iSetState.Append(ETrue) );
+        }
+        
+    // Start running
+    iCurrentRunPos = 0;
+    iSetFinished = EFalse;
+    iRunType = aRunType;
+    SignalL ( NULL );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMultipleCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+    if ( iSetFinished )
+        {
+        if( aArray.Append( KRunSequentially ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if( aArray.Append( KRunParallel ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if( aArray.Append( KRepeatRunSequentially ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if(aArray.Append(KSelectFromTo) != KErrNone)
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    TInt ret = CMultipleBaseMenu::ItemTexts(aArray);
+    if(ret != KErrNone)
+        {
+        return ret;
+        }
+    
+    return KErrNone;    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMultipleCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    if ( iSetFinished )
+        {
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {
+
+                if ( iFirst + iPosOnScreen == ERunSelection )
+                    {
+                    // Start the first one
+                    iCurrentRunPos = 0;
+                    iSetFinished = EFalse;
+                    iRunType = ERunSequential;
+                    SignalL ( NULL );
+
+                    return iParent;
+                    }
+                else if ( iFirst + iPosOnScreen == ERunSelectionParaller )
+                    {
+                    // Start the first one
+                    iCurrentRunPos = 0;
+                    iSetFinished = EFalse;
+                    iRunType = ERunParallel;
+                    SignalL ( NULL );
+
+                    return iParent;
+                    }
+                else if ( iFirst + iPosOnScreen == ERepeatRunSelection )
+                    {
+                    // Start the first one
+                    iCurrentRunPos = 0;
+                    iSetFinished = EFalse;
+                    iRunType = ERunRepeatSequential;
+                    SignalL ( NULL );
+
+                    return iParent;
+                    }
+                else if(iFirst + iPosOnScreen == ESelectFromTo)
+                    {
+                    TInt count = iTestCases.Count();
+                    TInt indexFirst = count;
+                    TInt indexLast = count - 1;
+                    TInt i;
+                    
+                    // Find first test case which is set
+                    for(i = 0; i < count; i++)
+                        {
+                        if(iSetState[i])
+                            {
+                            indexFirst = i;
+                            break;
+                            }
+                        }
+                    
+                    // Find last test case which is set
+                    if(indexFirst < count)
+                        {
+                        for(i = count - 1; i > indexFirst; i--)
+                            {
+                            if(iSetState[i])
+                                {
+                                indexLast = i;
+                                break;
+                                }
+                            }
+                        
+                        // Set test cases between first and last
+                        for(i = indexFirst; i <= indexLast; i++)
+                            {
+                            iSetState[i] = ETrue;
+                            }
+                        }
+
+                    return this;
+                    }
+                }
+                break;
+            default:
+                break;
+            }
+        }   
+        
+    return CMultipleBaseMenu::SelectL( aSelection, aContinue );
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseMenu* CCaseMenu::NewL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName, 
+                            TInt aType )
+    {
+
+    CCaseMenu* self = new ( ELeave ) CCaseMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aType );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if memory allocation fails
+                       Leaves if CCaseOperation menu NewL leaves
+                       Leaves if UpcateCaseListL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseMenu::ConstructL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName, 
+                            TInt aType
+                          )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+    iType = aType;
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: ~CCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CCaseMenu::~CCaseMenu()
+    {
+
+    delete iCaseOperationMenu;
+    iCaseOperationMenu = 0;
+    
+    iTestCases.Close();
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    iTestCases.Reset();
+    
+    TInt ret = iMain->UIStore().StartedTestCases( iTestCases, iType );
+    if ( ret != KErrNone )
+    	{
+    	return ret;
+    	}
+
+    TInt count = iTestCases.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aArray.Append( iTestCases[i].TestInfo().TestCaseTitle() ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CCaseMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseMenu::AppendBefore(TInt aLineNum, TDes& aLine)
+    {
+    CMenu::AppendBefore(aLineNum, aLine);
+
+    //START of --Add number to the test case title--
+    //First check how much space we need
+    TInt additionalSpace = 0;
+    TInt currentCount = aLineNum + 1;
+
+    if(currentCount >= 10000) additionalSpace = 10; //f.e. "10157521. "
+    else if(currentCount >= 1000) additionalSpace = 6; //f.e. "1157. "
+    else if(currentCount >= 100) additionalSpace = 5; //f.e. "101. "
+    else if(currentCount >= 10) additionalSpace = 4; //f.e. "15. "
+    else additionalSpace = 3; //f.e. "1. "
+
+ //Create descriptor, add content to it, and finally append to line
+    TBuf<20> num;
+
+    if(iTestCases[aLineNum].Status() == CUIStoreIf::EStatusRunning )
+ 	   {
+    if( iTestCases[aLineNum].UIEngineContainer().State() == CUIEngineContainer::EPaused)
+     	{
+     	  //If not enough space, return
+     	if((aLine.MaxLength() - aLine.Length()) < additionalSpace + 4)
+     	     {
+     	     return;
+     	     }
+     		num.Format(_L("%d.(P) "), currentCount);
+     	}
+     else
+     	{
+        //If not enough space, return
+     	if((aLine.MaxLength() - aLine.Length()) < additionalSpace)
+     		{
+     	  	return;
+     	     }     		  			
+     	num.Format(_L("%d."), currentCount);
+     	}
+ 	   }
+    aLine.Append(num);
+    }
+    //END of --Add number to test case title--
+    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle Enter and Right Arrow
+    here, other will be handled in CMenu::SelectL
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    switch (aSelection)
+        {
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            if ( iFirst + iPosOnScreen < iTestCases.Count() )
+                {
+                delete iCaseOperationMenu;
+                iCaseOperationMenu = 0;
+                iCaseOperationMenu = CCaseOperationMenu::NewL( 
+                    iMain, 
+                    this, 
+                    iTestCases[iFirst + iPosOnScreen].TestInfo().TestCaseTitle(), 
+                    &iTestCases[iFirst + iPosOnScreen] );   
+
+                return iCaseOperationMenu;
+                }
+            }
+            return this;
+        default:
+            // Let the parent class handle rest
+            return CMenu::SelectL(aSelection, aContinue);
+        }
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseOperationMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                CStartedTestCase* aCaseContainer:in: Case container
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseOperationMenu* CCaseOperationMenu::NewL( CConsoleMain* aConsole,
+                                 CMenu* aParent,
+                                 const TDesC& aName,
+                                 const CStartedTestCase* aCaseContainer
+                               )
+    {
+
+    CCaseOperationMenu* self = new ( ELeave ) CCaseOperationMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aCaseContainer );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseOperationMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                CStartedTestCase* aCaseContainer:in: Case container
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseOperationMenu::ConstructL( CConsoleMain* aConsole,
+                                     CMenu* aParent,
+                                     const TDesC& aName,
+                                     const CStartedTestCase* aCaseContainer
+                                   )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName); 
+    iCaseContainer = aCaseContainer;
+    
+    // Indicate that this menu contains prints, update when needed
+    iType = CUIStoreIf::EStatusExecuted;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: ~CMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CCaseOperationMenu::~CCaseOperationMenu()
+    {
+    delete iView;
+    iView = 0;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseOperationMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CCaseOperationMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    if( iCaseContainer->Status() & CUIStoreIf::EStatusRunning )
+        {
+        if( aArray.Append( KOutputViewDes ) != KErrNone )
+            {
+            return KErrNoMemory; 
+            }
+                
+        // Set resume/pause text
+        if( iCaseContainer->UIEngineContainer().State() == 
+            CUIEngineContainer::EPaused )
+            {
+            if( aArray.Append( KResumeCaseDes ) != KErrNone )
+                {
+                return KErrNoMemory; 
+                }
+            }
+        else
+            {
+            if( aArray.Append( KPauseCaseDes ) != KErrNone )
+                {
+                return KErrNoMemory; 
+                }
+            }
+        if( aArray.Append( KAbortCaseDes ) != KErrNone )
+            {
+            return KErrNoMemory; 
+            }
+        }
+    else
+        {
+        if(aArray.Append(KRestartCaseDes) != KErrNone)
+            {
+            return KErrNoMemory; 
+            }
+        if( aArray.Append( KOutputViewDes ) != KErrNone )
+            {
+            return KErrNoMemory; 
+            }
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu and test case specific information after that.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if FormatL leaves
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CCaseOperationMenu::PrintMenuL( TUpdateType  aType )
+    {
+
+    // Print menu
+    CMenu::PrintMenuL( aType );
+    
+    // Print the result description + result code
+    // If case is finished, print also result string
+    TInt state = iCaseContainer->Status();
+    if  ( ! ( state & CUIStoreIf::EStatusRunning ) )
+        {        
+
+        TName resultLine;
+        
+        Print (_L(""));
+        resultLine.Append(_L("Result info: ") );
+
+        if( state & CUIStoreIf::EStatusPassed )
+            {
+            resultLine.Append( _L("Passed" ) );
+            } 
+        else if( state & CUIStoreIf::EStatusFailed )
+            {
+            resultLine.Append( _L("Failed" ) );
+            } 
+        else if( state & CUIStoreIf::EStatusAborted )
+            {
+            resultLine.Append( _L("Aborted" ) );
+            } 
+        else if( state & CUIStoreIf::EStatusCrashed )
+            {
+            resultLine.Append( _L("Crashed" ) );
+            }
+        PrintMulti( resultLine );
+        resultLine.Zero();             
+
+        // Print test results
+        if( !( ( state & CUIStoreIf::EStatusAborted ) || 
+               ( state & CUIStoreIf::EStatusCrashed ) || 
+               ( state & CUIStoreIf::EStatusPassed ) ) )
+            {
+
+            resultLine.Format(_L("Result code %d"), 
+                iCaseContainer->Result().iTestResult.iResult );
+            PrintMulti ( resultLine );            
+            }
+
+        if( iCaseContainer->Result().iCaseExecutionResultType == 
+            TFullTestResult::ECaseErrorFromModule )
+            {
+            PrintMulti ( _L("Error from RunTestCase():"));
+            }
+
+        // Print result descriptor if that is available
+        const TDesC& des = iCaseContainer->Result().iTestResult.iResultDes;
+        if ( des.Length() >0 )
+            {
+            PrintMulti(des);
+            }
+
+        // Print abort code if that is available
+        if( ( state & CUIStoreIf::EStatusAborted ) ||
+            ( state & CUIStoreIf::EStatusCrashed ) )
+            {
+            // Print abort type, if that is available
+            TFullTestResult::TCaseExecutionResult res = 
+                iCaseContainer->Result().iCaseExecutionResultType;
+            
+            if ( res == TFullTestResult::ECaseLeave ||
+                 res == TFullTestResult::ECasePanic ||
+                 res == TFullTestResult::ECaseException || 
+                 res == TFullTestResult::ECaseErrorFromModule ||
+                 res == TFullTestResult::ECaseSuicided )
+                {
+                TInt code = iCaseContainer->Result().iCaseExecutionResultCode;
+                resultLine.Format(_L("Code %d (0x%x)"), code, code );
+                PrintMulti ( resultLine );
+                }
+            }
+
+        // Print start and end times
+        const TInt KTimeFieldLength = 30;
+        TBuf<KTimeFieldLength> time;
+        _LIT(KDateString,"%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B");
+
+        resultLine = _L("Started:");
+        iCaseContainer->Result().iStartTime.FormatL(time,KDateString);
+        resultLine.Append(time);
+        PrintMulti (resultLine);
+
+        resultLine = _L("Completed:");
+        iCaseContainer->Result().iEndTime.FormatL(time,KDateString);
+        
+        resultLine.Append(time);
+        PrintMulti (resultLine);
+
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseOperationMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle Enter and right arrow
+    here, others are handled in parent menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CCaseOperationMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {   
+
+    MapKeyCode(aSelection);
+    
+    if (aSelection == EKeyEnter || aSelection == EKeyRightArrow )
+        {        
+        // restartOptionModifier is used because when test case is running
+        // restart option is not available (and visible) and that's why
+        // we need to modify switch by 1.
+        // When test case is finished, restart option becomes available
+        // and is put at the first place.
+        TInt restartOptionModifier = 0;
+        if(iCaseContainer->Status() & CUIStoreIf::EStatusRunning)
+            restartOptionModifier = 1;
+        
+        switch (iPosOnScreen + iFirst + restartOptionModifier)
+        {
+        case ERestartCase:
+            {
+            TInt index;
+            User::LeaveIfError(iMain->UIStore().StartTestCase(iCaseContainer->TestInfo(), index));
+            // Create output screen
+            CMenu* m = iMain->GetMainMenu()->CreateOutputViewL(iParent);
+            return m;
+            }
+        case EOutputView:
+            {
+            delete iView;
+            iView = 0;
+            iView = CCaseExecutionView::NewL( 
+                iMain, 
+                this, 
+                iCaseContainer->TestInfo().TestCaseTitle(), 
+                iCaseContainer );
+
+            return iView;
+            }
+
+        case EPauseResume:
+
+            if( iCaseContainer->UIEngineContainer().State() == 
+                CUIEngineContainer::ERunning )
+                {    
+                // Pausing a running case
+                iCaseContainer->UIEngineContainer().PauseTest();
+
+                }
+            else if( iCaseContainer->UIEngineContainer().State() == 
+                     CUIEngineContainer::EPaused )
+                {
+                // Resuming a paused case
+                iCaseContainer->UIEngineContainer().ResumeTest();
+
+                }
+            // No other possibilities
+            return this;
+
+        case EAbortCase:
+            iCaseContainer->UIEngineContainer().CancelTest();
+            break;
+
+        }
+        
+        return this;
+        }
+    else
+        {
+        return CMenu::SelectL(aSelection, aContinue);
+        }
+        
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseExecutionView
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                CStartedTestCase* aCase :in:      Case container
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseExecutionView* CCaseExecutionView::NewL( CConsoleMain* aConsole,
+                                              CMenu* aParent,
+                                              const TDesC& aName,
+                                              const CStartedTestCase* aCase )
+    {
+
+    CCaseExecutionView* self = new ( ELeave ) CCaseExecutionView();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aCase );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseExecutionView
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                CStartedTestCase* aCase :in:      Case container
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseExecutionView::ConstructL( CConsoleMain* aConsole,
+                                     CMenu* aParent,
+                                     const TDesC& aName,
+                                     const CStartedTestCase* aCase
+                                    )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName );
+
+    iCase = aCase;
+    
+    // Indicate that this menu contains prints, update when needed
+    iType = CUIStoreIf::EPrintUpdate;
+
+    iLine = 0;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CCaseExecutionView
+
+    Method: ~CCaseExecutionView
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseExecutionView::~CCaseExecutionView()
+    {
+    delete iLineTextBuf;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu. Show the test status and the test case
+    print statements.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseExecutionView::PrintMenuL( TUpdateType  /*aType*/ )
+    {
+    
+    if( iShowLine )
+        {
+        // User want to see whole line 
+        iConsole->ClearScreen();
+        this->PrintMulti( iLineTextBuf->Des() );
+        return;
+        }
+
+    // Print the status
+    TName tmp;
+    TInt state = iCase->Status();
+    if( state & CUIStoreIf::EStatusRunning )
+        {
+        if( iCase->UIEngineContainer().State() == 
+            CUIEngineContainer::EPaused )
+            {
+            tmp = _L("Paused");
+            }
+        else
+            {
+            tmp = _L("Running");
+            }
+        }
+    else if( state & CUIStoreIf::EStatusPassed )
+        {
+        tmp = _L("Passed");
+        }
+    else if( state & CUIStoreIf::EStatusFailed )
+        {
+        tmp = _L("Failed");
+        }
+    else if( state & CUIStoreIf::EStatusAborted )
+        {
+        tmp = _L("Aborted");
+        }
+    else if( state & CUIStoreIf::EStatusCrashed )
+        {
+        tmp = _L("Aborted");
+        }
+    else
+        {
+        tmp = _L("Unknown");
+        }
+    
+    // Clear screen.
+    iConsole->ClearScreen();
+    TBuf<KMaxLineLength> line;
+
+    line.Append(_L(" : "));
+    LimitedAppend(line, iCase->TestInfo().TestCaseTitle() );
+    Print( line );
+
+    const RPointerArray<CTestProgress>& prints = iCase->PrintArray();
+
+    Recalculate( prints.Count() );
+
+    // Print the print statements.
+    for ( TInt i = iFirst; i <= iLast; i++ )
+        {
+        line.Zero();
+        if( iLine == i )
+            {
+            line = _L( "*" ); // For indicating current line
+            }
+        line.Append( prints[i]->iDescription );
+        line.Append(_L(" : "));
+        LimitedAppend(line, prints[i]->iText );
+
+        // Print the line
+        TSize screenSize;
+        screenSize = iConsole->ScreenSize();
+        Print ( line.Left(screenSize.iWidth ) );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseExecutionView
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Either updates position in
+    menu or returns new menu.
+
+    Parameters: TKeyCode aSelection: in: Key
+                TBool& aContinue: out: Has user pressed "Quit"
+
+    Return Values: CMenu* New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CCaseExecutionView::SelectL( TKeyCode aSelection, TBool& /*aContinue*/ )
+    {
+    iShowLine = EFalse;
+    MapKeyCode(aSelection);
+
+    // Take prints
+    const RPointerArray<CTestProgress>& prints = iCase->PrintArray();
+
+    switch( aSelection  )
+        {        
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            // Check that not out of range(too many EKeyUpArrow or EKeyDownArrow)
+            if( iLine >= prints.Count() || iLine < 0)
+                {
+                // do nothing
+                break;
+                }
+            TInt extra = 3; // ' : '
+            TInt length( 0 );
+            length = length + prints[iLine]->iDescription.Length();
+            length = length + prints[iLine]->iText.Length();
+            // Selected print line in seperate(operation will do in
+            // CCaseExecutionView::PrintMenuL() method )
+            delete iLineTextBuf;
+			iLineTextBuf = NULL;
+            TRAPD( ret, iLineTextBuf = HBufC::NewL( length + extra ) );
+            if( ret != KErrNone )
+                {
+                User::InfoPrint( _L("Line show failed, maybe out of memory!!!") );
+                break;
+                }
+            TPtr ptr = iLineTextBuf->Des();
+            ptr.Copy( prints[iLine]->iDescription );
+            ptr.Append( _L( " : " ) );
+            ptr.Append( prints[iLine]->iText );
+            iShowLine = ETrue;
+            break;
+            }
+        case EKeyLeftArrow:
+            {
+            return iParent;
+            }
+		// Go down
+		case EKeyDownArrow:
+			{
+			if ( iFirst + iPosOnScreen == iItemCount - 1 )
+				{
+				// If end of the list, go to beginning
+				iPosOnScreen = 0;
+				iFirst = 0;
+				iLast = iScreenSize;
+				if ( iLast > iItemCount - 1 )
+					{
+					iLast = iItemCount - 1;
+					}
+				iLine = 0;
+				}
+			else 
+				{
+				if ( iPosOnScreen == iScreenSize )
+					{
+					iLast++;
+					iFirst++;
+					}
+				else
+					{
+					// Going down "in-screen", no need to update items
+					iPosOnScreen++;
+					}
+				iLine++;
+				}			
+			break;
+			}
+			
+		// Go Up
+		case EKeyUpArrow:
+			{
+			if ( iFirst + iPosOnScreen == 0 )
+				{
+				// If in the beginning of the list
+
+				iLast = iItemCount - 1;
+				iFirst = iLast - iScreenSize;
+				if ( iFirst < 0 )
+					{
+					iFirst = 0;            	
+					}
+				iPosOnScreen = iLast - iFirst;
+				iLine = iItemCount - 1;
+				}
+			else 
+				{
+				if ( iPosOnScreen == 0 )
+					{
+					iLast--;
+					iFirst--;
+					}
+				else
+					{
+					iPosOnScreen--;
+					}
+				iLine--;
+			}
+			break;
+			}
+		// Additional keys
+		case EKeyHome:
+		case '3':
+			iPosOnScreen = 0;
+			iLine = 0;
+			iFirst = 0;
+			iLast = iScreenSize;
+
+			if ( iLast > iItemCount - 1 )
+				{
+				iLast = iItemCount - 1;
+				}
+			break;
+
+		case EKeyEnd:
+		case '9':
+			iLast = iItemCount - 1;
+			iFirst = iLast - iScreenSize;
+			iLine = iItemCount - 1;
+			
+			if ( iFirst < 0 )
+				{
+				iFirst = 0;
+				}
+			iPosOnScreen = iLast - iFirst;        
+			break;
+
+		case EKeyPageUp:
+		case '1':
+			iFirst = iFirst - iScreenSize;
+			iLast = iLast - iScreenSize;
+
+			if ( iFirst < 0 )
+				{
+				iFirst = 0;
+				iLast = iScreenSize;
+				if ( iLast > iItemCount - 1 )
+					{
+					iLast = iItemCount - 1;
+					}
+				iPosOnScreen = 0;
+				}
+			
+			iLine = iLine - iScreenSize;
+			if ( iLine < 0 )
+				{
+				iLine = 0;
+				}
+			break;
+
+		case EKeyPageDown:
+		case '7':
+			iFirst = iFirst + iScreenSize;
+			iLast = iLast + iScreenSize;
+
+			// Going too far
+			if ( iLast > iItemCount - 1 )
+				{
+				iLast = iItemCount - 1;
+				iFirst = iLast - iScreenSize;
+				if ( iFirst < 0 )
+					{
+					iFirst = 0;
+					}
+				iPosOnScreen = iLast - iFirst;
+				}
+
+			iLine = iLine + iScreenSize;
+			if ( iLine > iItemCount - 1 )
+				{
+				iLine = iItemCount - 1;
+				}
+			break;
+        default:
+            {
+            break;
+            }
+        }
+    
+    return this;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetMenu* CTestSetMenu::NewL( CConsoleMain* aConsole,
+                                        CMenu* aParent,
+                                        const TDesC& aName )
+    {    
+
+    CTestSetMenu* self = new ( ELeave ) CTestSetMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+       
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: CTestSetMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetMenu::CTestSetMenu():
+    iTestSetCreated( EFalse )
+    {
+    
+    iTestSetName.Copy( KDefaultSetName );    
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: ~CTestSetMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestSetMenu::~CTestSetMenu()
+    {
+    
+    delete iSubMenu;
+    iSubMenu = 0;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor. 
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if module can't be appended to list
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetMenu::ConstructL( CConsoleMain* aConsole,
+                                  CMenu* aParent,
+                                  const TDesC& aName
+                                 )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+   
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: SetTestSetName
+
+    Description: Set test set name.
+
+    Parameters: const TFileName& aTestSetName: in: Test set name
+
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetMenu::SetTestSetFileName( const TFileName& aTestSetName )
+    {
+    
+    iTestSetName.Copy( aTestSetName );    
+    
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    if( !iTestSetCreated )
+        {
+        if( aArray.Append( KSetCreate ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if( aArray.Append( KSetLoad ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }        
+        }
+    else
+        {
+        if( aArray.Append( KSetShow ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetStartSeq ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetStartPar ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if( aArray.Append( KSetRemove ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetSave ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetCaseAdd ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetCaseRemove ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetStartSeqNotRun ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        }
+        
+    return KErrNone; 
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CTestSetMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestSetMenu::PrintMenuL( TUpdateType aType )
+    {
+    
+    if( iTestSetCreated )
+        {
+        RRefArray<CTestSetInfo> setInfos;
+        TInt ret = iMain->UIStore().TestSets( setInfos );
+
+        CMenu::PrintMenuL( aType );
+
+        if( (  ret != KErrNone ) ||
+            ( setInfos.Count() != 1 ) )
+            {
+            // Should never ever happen
+            User::Panic( KTestSetMenu, KErrGeneral );
+            return;
+            }
+        const CTestSetInfo& set = setInfos[0];
+        setInfos.Reset();
+        setInfos.Close();
+        
+        const RRefArray<const CTestInfo> testCases = set.TestCases();
+        
+        TBuf<KMaxLineLength> line;
+        TInt count = testCases.Count();
+        for(TInt i = 0; i < count && i + ESetLAST <= iScreenSize; i++)
+            {
+            line = _L("    ");
+            LimitedAppend ( line, testCases[i].TestCaseTitle() );
+
+            // Print the line
+            Print(line);
+            }
+        }
+    else
+        {
+        CMenu::PrintMenuL( aType );
+        }    
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle right arrow and enter
+                 here, others in parent menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+    TBuf<32> currSetName;
+    MapKeyCode(aSelection);    
+    
+    if( ( aSelection != EKeyRightArrow ) &&
+        ( aSelection != EKeyEnter ) )
+        {
+        return CMenu::SelectL( aSelection, aContinue );
+        }            
+    
+    TInt ret = KErrNone;        
+    if( !iTestSetCreated )
+        {
+        switch( iPosOnScreen )
+            {
+            case ESetCreate:
+                ret = iMain->UIStore().CreateTestSet( iTestSetName );
+                if( ret != KErrNone )
+                    {
+                    User::InfoPrint( _L("Test set creation failed") );
+                    }
+                break;
+            case ESetLoad: 
+            
+            	return iItems[0];
+            } 
+        if( ret == KErrNone )
+            {
+            iTestSetCreated = ETrue;
+            }      
+        }
+    else
+        {
+        CStartedTestSet::TSetType setType = CStartedTestSet::ESetSequential;
+        switch( iPosOnScreen )
+            {
+            case ESetShow:   
+            // Add the test sets menu
+                delete iSubMenu;
+                iSubMenu = 0;
+                iSubMenu = CStartedTestSetMenu::NewL( iMain, 
+                                        this, 
+                                        _L("Started test sets menu"));
+                return iSubMenu;
+            case ESetRemove: 
+                ret = iMain->UIStore().RemoveTestSet( iTestSetName );
+                if( ret != KErrNone )
+                    {
+                    User::InfoPrint( _L("Test set creation failed") );
+                    }
+                iTestSetCreated = EFalse;  
+                break;
+            case ESetCaseAdd:   
+                delete iSubMenu;
+                iSubMenu = 0;
+                iSubMenu = CTestSetAddCaseMenu::NewL( 
+                                iMain, 
+                                this, 
+                                _L("Add test cases to test set"),
+                                iTestSetName );
+                                
+                return iSubMenu;
+            case ESetCaseRemove: 
+                delete iSubMenu;
+                iSubMenu = 0;
+                iSubMenu =  CTestSetRemoveCaseMenu::NewL( 
+                                iMain, 
+                                this, 
+                                _L("Remove test cases from test set"),
+                                iTestSetName );
+                                
+                                
+                return iSubMenu;  
+            case ESetSave:   
+                // during the save operation default set name (ConsoleUI.set) is replaced with
+                // new name created base on current date.
+                // Set is the reloaded to make sure that 
+                // old test set with default name will not affect test execution
+                currSetName.Copy( iTestSetName );
+                ret = iMain->UIStore().SaveTestSet2( iTestSetName );
+                if( ret != KErrNone )
+                    {
+                    User::InfoPrint( _L("Test set saving failed at saving test set") );
+                    } 
+                
+                ret = iMain->UIStore().RemoveTestSet( currSetName );
+                if( ret != KErrNone )
+                    {
+                    User::InfoPrint( _L("Test set saving failed at removing old test set") );
+                    }             
+                
+                ret = iMain->UIStore().LoadTestSet( iTestSetName );
+                if( ret != KErrNone )
+                    {
+                    User::InfoPrint( _L("Test set saving failed at reloding test set") );
+                    }   
+                break;
+  
+  			default:          
+//            case ESetStartPar:   
+//                setType = CStartedTestSet::ESetParallel;
+//            case ESetStartSeq: 
+            //case ESetStartRep: 
+            	if( iPosOnScreen == ESetStartPar )
+                  {
+	            		setType = CStartedTestSet::ESetParallel;
+                  }
+              if( iPosOnScreen == ESetStartSeq || iPosOnScreen == ESetStartSeqNotRun)
+	                {
+	                RRefArray<CTestSetInfo> setInfos;
+	                ret = iMain->UIStore().TestSets( setInfos );
+	                if( (  ret != KErrNone ) ||
+	                    ( setInfos.Count() != 1 ) )
+	                    {
+	                    // Should never ever happen
+	                    User::Panic( KTestSetMenu, KErrGeneral );
+	                    }
+	                const CTestSetInfo& set = setInfos[0];
+	                setInfos.Reset();
+	                setInfos.Close();
+	                
+	                TInt index;
+	                ret = KErrGeneral;
+	                if(iPosOnScreen == ESetStartSeq)
+	                    {
+                        ret = iMain->UIStore().StartTestSet(set, index, setType);
+                        }
+                    else if(iPosOnScreen == ESetStartSeqNotRun)
+                        {
+	                    ret = iMain->UIStore().StartTestSet(set, index, setType, ETrue);
+	                    }
+	                if( ret != KErrNone )
+	                    {
+	                    User::InfoPrint( _L("Test set starting failed") );
+	                    }                 
+	                }    
+                break;
+            }
+        }
+        
+    return this;
+
+    }
+/**
+-------------------------------------------------------------------------------
+
+Class: CTestSetChoiceMenu
+
+Method: NewL
+
+Description: Constructs new menu.
+
+Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+            CMenu* aParent            :in:      Parent menu
+            const TDesC& aName        :in:      Menu name
+
+Return Values: CMenu*                           New menu
+
+Errors/Exceptions: Leaves if memory allocation fails
+                   Leaves if ConstructL leaves.
+
+Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetChoiceMenu* CTestSetChoiceMenu::NewL( CConsoleMain* aConsole,
+                                    CMenu* aParent,
+                                    const TDesC& aName )
+{    
+
+	CTestSetChoiceMenu* self = new ( ELeave ) CTestSetChoiceMenu();
+	CleanupStack::PushL( self );
+	self->ConstructL( aConsole, aParent, aName );
+	CleanupStack::Pop( self );
+	return self;
+
+}
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: CTestSetChoiceMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetChoiceMenu::CTestSetChoiceMenu()
+    
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: ~CTestSetChoiceMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestSetChoiceMenu::~CTestSetChoiceMenu()
+    {
+    
+    
+
+    iFileList.ResetAndDestroy();
+    iFileList.Close();
+
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor. 
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if module can't be appended to list
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetChoiceMenu::ConstructL( CConsoleMain* aConsole,
+                                  CMenu* aParent,
+                                  const TDesC& aName
+                                 )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetChoiceMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+   TInt ret = iMain->UIStore().GetTestSetsList( aArray );
+  
+   iFileList.ResetAndDestroy();
+   TRAPD( err,
+	//Assign aArray to iFileList, it is used in LoadTestSet
+   for( TInt i=0 ; i < aArray.Count(); i++)
+	  {
+	  iFileList.AppendL(aArray[i].AllocL());
+	  }
+     ); // TRAPD
+   return err;       
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CTestSetChoiceMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestSetChoiceMenu::PrintMenuL( TUpdateType aType )
+    {
+    
+    iUpdateType = aType;
+    
+    TBuf<KMaxLineLength> line;
+    
+    // Clear display
+    iConsole->ClearScreen();
+
+    // Print menu title
+    Print( Name() );
+    
+    RRefArray<TDesC> texts;
+    if(  iMain->UIStore().GetTestSetsList( texts ) != KErrNone )
+        {
+        return;
+        }
+    
+    TInt oldItemCount = iItemCount;
+     
+    iItemCount = texts.Count();
+
+    // If first time in menu, update start and end positions
+    if( (iFirst == iLast) ||        // First time here..
+        ( iLast >= iItemCount ) ||
+        ( oldItemCount != iItemCount ) )      // Menu size changed
+        {
+        iLast = iItemCount - 1;
+        iPosOnScreen = 0;
+
+        // If "overflow", then adjust the end
+        if (iLast > iScreenSize )
+            {
+            iLast = iScreenSize;
+            }
+        }
+    
+    // Print items
+    for ( TInt i = iFirst; i <= iLast; i++ )
+        {
+        line.Zero();
+        
+        // Append text before line
+        AppendBefore( i, line );
+
+        // Get the menu line
+        LimitedAppend ( line, texts[i] );
+
+        // Print the line
+        Print(line);
+
+        }
+    texts.Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle right arrow and enter
+                 here, others in parent menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetChoiceMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+    
+    //return CMenu::SelectL( aSelection, aContinue );    
+    //return iParent;
+	    MapKeyCode(aSelection);
+	    TInt ret = 0;
+
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {           
+                if(iPosOnScreen < iFileList.Count())
+                    {
+                    const TDesC& aSetName = iFileList.operator [](iPosOnScreen)->Des();
+                
+                    ret = iMain->UIStore().LoadTestSet( iFileList.operator [](iPosOnScreen)->Des() );
+                    if (ret == KErrNone)
+                        {
+                        ((CTestSetMenu*)iParent)->SetCreated();
+                        ((CTestSetMenu*)iParent)->SetTestSetFileName(iFileList.operator [](iPosOnScreen)->Des());
+                        }
+                    return iParent;
+                    }
+                else
+                    {
+                    return this;
+                    }
+                }
+            default:
+                break;
+            }
+            
+    return CMenu::SelectL( aSelection, aContinue );    
+
+    }
+
+
+
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetAddCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetAddCaseMenu* CTestSetAddCaseMenu::NewL( CConsoleMain* aConsole,
+                                            CMenu* aParent,
+                                            const TDesC& aName,
+                                            TDesC& aTestSetName )
+    {
+
+    CTestSetAddCaseMenu* self = 
+        new ( ELeave ) CTestSetAddCaseMenu( aTestSetName );
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetAddCaseMenu
+
+    Method: CTestSetAddCaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetAddCaseMenu::CTestSetAddCaseMenu( TDesC& aTestSetName ):
+    iTestSetName( aTestSetName )    
+    {
+    
+    iMenuItemsCount = EAddSelected + 1;
+    iMenuTotCount += iMenuItemsCount;
+    
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetAddCaseMenu
+
+    Method: ~CTestSetAddCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetAddCaseMenu::~CTestSetAddCaseMenu()
+    {
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetAddCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetAddCaseMenu::ConstructL( CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName )
+    {
+
+    CCaseStartMenu::ConstructL( aConsole, aParent, aName );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetAddCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetAddCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    if ( iSetFinished )
+        {
+        if( aArray.Append( KAddSelected ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    return CMultipleBaseMenu::ItemTexts( aArray );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetAddCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetAddCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    if ( iSetFinished )
+        {
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {
+
+                if ( iFirst + iPosOnScreen == EAddSelected )
+                    {
+                    TInt count = iTestCases.Count();    
+                    for( TInt i=0; i<count; i++ )
+                        {
+                        if ( iSetState[i] )
+                            {
+                            TInt ret = 
+                                iMain->UIStore().AddToTestSet( iTestSetName,
+                                                               iTestCases[i] );
+                            if( ret != KErrNone )
+                                {
+                                User::InfoPrint( _L("Test case adding failed") );
+                                }   
+                            }
+                        } 
+                    return iParent;
+                    }               
+                }
+                break;
+            default:
+                break;
+            }
+        }   
+        
+    return CMultipleBaseMenu::SelectL( aSelection, aContinue );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetAddCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetRemoveCaseMenu* CTestSetRemoveCaseMenu::NewL( CConsoleMain* aConsole,
+                                            CMenu* aParent,
+                                            const TDesC& aName,
+                                            TDesC& aTestSetName )
+    {
+
+    CTestSetRemoveCaseMenu* self = 
+        new ( ELeave ) CTestSetRemoveCaseMenu( aTestSetName );
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetRemoveCaseMenu
+
+    Method: CTestSetRemoveCaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetRemoveCaseMenu::CTestSetRemoveCaseMenu( TDesC& aTestSetName ):
+    iTestSetName( aTestSetName )    
+    {
+    
+    iMenuItemsCount = ERemoveSelected + 1;
+    iMenuTotCount += iMenuItemsCount;
+    
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetRemoveCaseMenu
+
+    Method: ~CTestSetRemoveCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetRemoveCaseMenu::~CTestSetRemoveCaseMenu()
+    {
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetRemoveCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetRemoveCaseMenu::ConstructL( CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName )
+    {
+
+    CCaseStartMenu::ConstructL( aConsole, aParent, aName );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetRemoveCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetRemoveCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+    if ( iSetFinished )
+        {
+        if( aArray.Append( KRemoveSelected ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    return CMultipleBaseMenu::ItemTexts( aArray );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetRemoveCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetRemoveCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    if ( iSetFinished )
+        {
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {
+
+                if ( iFirst + iPosOnScreen == ERemoveSelected )
+                    {
+                    TInt count = iTestCases.Count();    
+                    for( TInt i=0; i<count; i++ )
+                        {
+                        if ( iSetState[i] )
+                            {
+                            TInt ret = 
+                                iMain->UIStore().RemoveFromTestSet( iTestSetName,
+                                                                    iTestCases[i] );
+                            if( ret != KErrNone )
+                                {
+                                User::InfoPrint( _L("Test case adding failed") );
+                                }   
+                            }
+                        } 
+                    return iParent;
+                    }               
+                }
+                break;
+            default:
+                break;
+            }
+        }   
+        
+    return CMultipleBaseMenu::SelectL( aSelection, aContinue );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetRemoveCaseMenu
+
+    Method: UpdateTestCases
+
+    Description: 
+
+    Parameters: 
+
+    Return Values: 
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetRemoveCaseMenu::UpdateTestCases()
+    {
+    
+    TRAPD( err,
+        const CTestSetInfo& set = iMain->UIStore().TestSetL( iTestSetName );                
+        const RRefArray<const CTestInfo>& testCases = set.TestCases();
+
+        // Update test cases
+        iTestCases.Reset();
+        iSetState.Reset();
+        
+        TInt count = testCases.Count();
+        for( TInt i=0; i<count; i++ )
+            {
+            err = iTestCases.Append( testCases[i] );
+            if( err != KErrNone )
+                {
+                break;
+                }
+            }
+
+        ); // TRAPD
+                
+    return err;
+                
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestSetMenu* CStartedTestSetMenu::NewL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName )
+    {
+
+    CStartedTestSetMenu* self = new ( ELeave ) CStartedTestSetMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: CStartedTestSetMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestSetMenu::CStartedTestSetMenu()
+    {
+    iType = CUIStoreIf::ESetAll;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if memory allocation fails
+                       Leaves if CCaseOperation menu NewL leaves
+                       Leaves if UpcateCaseListL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CStartedTestSetMenu::ConstructL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: ~CStartedTestSetMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStartedTestSetMenu::~CStartedTestSetMenu()
+    {
+
+    delete iCaseMenu;
+    iCaseMenu = 0;
+    
+    iTestSets.Reset();
+    iTestSets.Close();
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStartedTestSetMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    iTestSets.Reset();
+    
+    TInt ret = iMain->UIStore().StartedTestSets( iTestSets, iType );
+    if ( ret != KErrNone )
+    	{
+    	return ret;
+    	}
+
+    TInt count = iTestSets.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aArray.Append( iTestSets[i].TestSetInfo().Name() ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CStartedTestSetMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number 
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CStartedTestSetMenu::AppendBefore( TInt aLineNum, TDes& aLine )
+    {
+    
+    CMenu::AppendBefore( aLineNum, aLine );
+    
+    if( ( aLine.MaxLength() - aLine.Length() ) < 2 )
+        {
+        return;
+        }        
+    if( iTestSets[aLineNum].Status() & CUIStoreIf::ESetRunning )
+        {
+        aLine.Append( _L("O ") );
+        }
+    else if( iTestSets[aLineNum].Status() & CUIStoreIf::ESetPassed )
+        {
+        aLine.Append( _L("P ") );
+        }    
+    else if( iTestSets[aLineNum].Status() & CUIStoreIf::ESetFailed )
+        {
+        aLine.Append( _L("F ") );
+        }    
+            
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle Enter and Right Arrow
+    here, other will be handled in CMenu::SelectL
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CStartedTestSetMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    switch (aSelection)
+        {
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            if ( iFirst + iPosOnScreen < iTestSets.Count() )
+                {
+                delete iCaseMenu;
+                iCaseMenu = 0;
+                iCaseMenu = CTestSetCaseMenu::NewL( 
+                    iMain, 
+                    this, 
+                    iTestSets[iFirst + iPosOnScreen].TestSetInfo().Name(), 
+                    iTestSets[iFirst + iPosOnScreen] ); 
+
+                return iCaseMenu;
+                }
+            }
+            return this;
+        default:
+            break;
+        }   
+        
+    // Let the parent class handle rest
+    return CMenu::SelectL(aSelection, aContinue);
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetCaseMenu* CTestSetCaseMenu::NewL( CConsoleMain* aConsole, 
+                                          CMenu* aParent, 
+                                          const TDesC& aName,
+                                          CStartedTestSet& aTestSet  )
+    {
+
+    CTestSetCaseMenu* self = new ( ELeave ) CTestSetCaseMenu( aTestSet );
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: CTestSetCaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetCaseMenu::CTestSetCaseMenu( CStartedTestSet& aTestSet ):
+    iTestSet( aTestSet )
+    {
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if memory allocation fails
+                       Leaves if CCaseOperation menu NewL leaves
+                       Leaves if UpcateCaseListL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetCaseMenu::ConstructL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName )
+    {
+
+    CCaseMenu::ConstructL( aConsole, aParent, aName, 
+                           CUIStoreIf::EStatusAll );
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: ~CTestSetCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestSetCaseMenu::~CTestSetCaseMenu()
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    if ( iTestSet.Status() & CUIStoreIf::ESetRunning )
+        {
+        if( aArray.Append( KCancelTestSet ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    const RRefArray<CStartedTestCase>& testCases = iTestSet.TestCases();
+        
+    iTestCases.Reset();
+    
+    TInt count = testCases.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( iTestCases.Append( testCases[i] ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }  
+        if( aArray.Append( testCases[i].TestInfo().TestCaseTitle() ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }   
+        }
+
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CTestSetCaseMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number 
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestSetCaseMenu::AppendBefore( TInt aLineNum, TDes& aLine )
+    {
+    
+    CMenu::AppendBefore( aLineNum, aLine );
+   
+    TInt testCaseNum = aLineNum; 
+    if( iTestSet.Status() & CUIStoreIf::ESetRunning ) 
+        {
+        if( aLineNum == 0 )
+            {
+            // "Cancel test set" row
+            return;
+            }
+        testCaseNum--;
+        }
+        
+    if( ( aLine.MaxLength() - aLine.Length() ) < 2 )
+        {
+        return;
+        }        
+    
+   if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusRunning )
+        {
+        aLine.Append( _L("O ") );
+        }
+    else if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusPassed )
+        {
+        aLine.Append( _L("P ") );
+        }
+    else if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusFailed )
+        {
+        aLine.Append( _L("F ") );
+        }
+    else if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusAborted )
+        {
+        aLine.Append( _L("A ") );
+        }
+    else if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusCrashed )
+        {
+        aLine.Append( _L("C ") );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+    
+    MapKeyCode(aSelection);
+
+    if( ( aSelection == EKeyEnter ) || ( aSelection == EKeyRightArrow ) )
+        {
+        TInt pos = iFirst + iPosOnScreen; 
+        if( iTestSet.Status() & CUIStoreIf::ESetRunning )
+            {
+            pos--;
+            }               
+        if( pos == -1 )
+            {
+            User::LeaveIfError( 
+                iMain->UIStore().AbortTestSet( iTestSet ) );
+            return iParent;             
+            }
+        else if( pos < iTestCases.Count() )
+            {
+            delete iCaseOperationMenu;
+            iCaseOperationMenu = 0;
+            iCaseOperationMenu = CCaseOperationMenu::NewL( 
+                iMain, 
+                this, 
+                iTestCases[pos].TestInfo().TestCaseTitle(), 
+                &iTestCases[pos] ); 
+
+            return iCaseOperationMenu;
+            }
+        }
+
+        // Let the parent class handle rest
+    return CMenu::SelectL(aSelection, aContinue);
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CFilterMenu* CFilterMenu::NewL(CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName)
+    {
+    CFilterMenu* self = new (ELeave) CFilterMenu();
+    CleanupStack::PushL(self);
+    self->ConstructL(aConsole, aParent, aName);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CFilterMenu::ConstructL(CConsoleMain* aConsole,
+                             CMenu* aParent,
+                             const TDesC& aName
+                            )
+    {
+    CMenu::ConstructL(aConsole, aParent, aName);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CFilterMenu
+
+    Method: CFilterMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CFilterMenu::CFilterMenu()
+    {
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    CFilterMenu
+
+    Method: ~CFilterMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CFilterMenu::~CFilterMenu()
+    {
+    delete iTestCaseMenu;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CFilterMenu::ItemTexts(RRefArray<TDesC>& aArray)
+    {
+    const RPointerArray<TDesC> &filters = iMain->GetFilterArray();
+    TInt ret;
+    
+    TInt count = filters.Count();
+    for(TInt i = 0; i < count; i++)
+        {    
+        ret = aArray.Append(*filters[i]);
+        if(ret != KErrNone)
+            {
+            return ret;
+            }
+        }
+        
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CFilterMenu::SelectL(TKeyCode aSelection, TBool& aContinue)
+    {
+    const RPointerArray<TDesC> &filters = iMain->GetFilterArray();
+    
+    MapKeyCode(aSelection);
+    
+    switch ( aSelection )
+        {
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            // Start the case
+            if((iFirst + iPosOnScreen) < filters.Count())
+                {
+                // Show test cases menu
+                iMain->SetFilterIndex(iFirst + iPosOnScreen);
+                if(iTestCaseMenu)
+                    {
+                    return iTestCaseMenu;
+                    }
+                else
+                    {
+                    RDebug::Print(_L("STIF: CFilterMenu::SelectL: test case menu is not set, however it should be"));
+                    return this;
+                    }
+                }
+            else
+                {
+                return this;
+                }
+            }
+
+        default:
+            return CMenu::SelectL( aSelection, aContinue);
+        }
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: SetTestCaseMenu
+
+    Description: Set pointer to test case menu, so it can be shown when user
+                 selects filter.
+                 This menu will be deleted along with the filter menu.
+
+    Parameters: CMenu* aTestCaseMenu      :in:      test case menu
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CFilterMenu::SetTestCaseMenu(CMenu* aTestCaseMenu)
+    {
+    if(iTestCaseMenu)
+        {
+        RDebug::Print(_L("STIF: CFilterMenu::SetTestCaseMenu: test case menu is already set!"));
+        delete iTestCaseMenu;
+        iTestCaseMenu = NULL;
+        }
+    iTestCaseMenu = aTestCaseMenu;
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STF UIs.
+*/
+
+//UI Engine
+#include "../uiengine/group/bld.inf"
+
+// Qt UI 
+//#include "../qtui/group/bld.inf"
+
+// ATS UI
+// #include "../atsui/group/bld.inf"
+
+//STF Console UI
+#include "../stf/group/bld.inf"
+
+//former STIF console UI
+#include "../consoleui/group/bld.inf"
+
+//former STIF touchable console UI
+#include "../touchconsoleui/group/bld.inf"
+
+
Binary file testexecfw/stf/stfui/stf/doc/STF CLI Specification.doc has changed
Binary file testexecfw/stf/stfui/stf/doc/Stf_cli.doc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/doc/help.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,48 @@
+Help document for STF console based execution UI.
+file version: 1.0
+release date: 2009-12-03
+============================================================
+
+
+
+Usage: stf [-option value] [--parameter value] [casename]
+
+where options include:
+
+-m <module name>
+-s <script file path> if use this parameter, system will use "testsripter" to call the script file.
+-i <engine initialization file path> Setting engine initialization file, if this option missed, STF will check the file under: "c:\testframework\testframework.ini"
+
+-c <module initialization file path> Setting module initialization file.
+
+--<configuration item> <value> 
+         Setting configuration parameter, this setting will override settings in initialization file.
+         The setting item could be:
+         TestReportMode             # Possible values are: 'Empty', 'Summary', 'Environment', 'TestCases' or 'FullReport'
+         CreateTestReport           # Possible values: YES or NO
+         TestReportFilePath
+         TestReportFileName
+         TestReportFormat           # Possible values: TXT, HTML or XML
+         TestReportOutput           # Possible values: FILE or RDEBUG
+         TestReportFileCreationMode # Possible values: OVERWRITE or APPEND    
+
+-p <item> <value> 
+         transfer name&value parameter into test module.
+
+-v       display version information
+-?/-h    display this help information.
+
+
+
+For example:
+1, stf -m demomodule 3
+        STF will execute 3rd case in "demomodule".
+        
+2, stf -m demomodule -i c:\test\test.ini -p input ETrue -p expected 0 case1
+        STF will execute "case1" under "demomodule", 
+        take initialization setting from "test.ini", 
+        transfer two paramters "input" and "expected" into test module.
+
+3, stf -s c:\test\mytest.cfg --TestReportMode Summary
+        STF will execute cases definied in "mytest.cfg" via testscripter, 
+        take initialization setting from "c:\testframework\testframework.ini", and take "TestReportMode" parameter as "summary"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,21 @@
+/*
+* 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: 
+*
+*/
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+stf.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/group/stf.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -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: 
+*
+*/
+#include <platform_paths.hrh>
+
+SMPSAFE
+TARGET		  stf.exe
+TARGETTYPE	  exe
+UID			 0 0x2002BC9F
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH	  ..\src
+SOURCE		  stf.cpp cmdparser.cpp activetimer.cpp caserunner.cpp executor.cpp helper.cpp
+
+LIBRARY		 euser.lib
+LIBRARY		StifTestEngine.lib
+LIBRARY		StifTestInterface.lib
+
+CAPABILITY	AllFiles CommDD
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/inc/activetimer.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* 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: 
+* 
+*/
+
+#ifndef ACTIVETIMER_H_
+#define ACTIVETIMER_H_
+#include <e32std.h>
+#include <e32base.h>
+#include <e32cons.h>
+
+const TInt KPrintInterval = 1000000;
+
+class CActiveTimer : public CTimer
+    {
+    
+public:
+    static CActiveTimer* NewL( CConsoleBase* aConsole );
+    ~CActiveTimer();
+
+public:
+    void StartL();
+
+public:
+    void RunL();
+    void DoCancel();
+
+private:
+    CActiveTimer( CConsoleBase* aConsole );
+    void ConstructL();
+
+private: 
+    CConsoleBase* iConsole;
+    TTime iStartTime;
+    TInt iXPos;
+    TInt iYPos;
+    
+    };
+
+#endif /* ACTIVETIMER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/inc/caserunner.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,56 @@
+/*
+* 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: Used for execute a single case.
+*
+*/
+
+#ifndef CASERUNNER_H_
+#define CASERUNNER_H_
+
+#include <e32std.h>
+#include <e32base.h>
+#include <e32cons.h>
+#include "executor.h"
+
+class CCaseRunner : public CActive
+    {
+public:
+    static CCaseRunner* NewL(CExecutor* executor, TTestInfo& aTestInfo );
+    ~CCaseRunner();
+
+private:
+    CCaseRunner(CExecutor* executor, TTestInfo& aTestInfo);
+    void ContructL();
+    
+public: //public method
+    TInt RunTestsL();
+    void StartTestL();
+
+public: //implement CActive
+    void RunL();
+    void DoCancel();
+    TInt RunError(TInt aError);
+    
+private:
+    CExecutor* iExecutor;
+    RTestEngine iTestEngine;
+    RTestCase iTestCase;
+    TTestInfo iTestInfo;
+    TTestInfoPckg iTestInfoPckg;
+    TFullTestResult iFullTestResult;
+    TFullTestResultPckg iFullTestResultPckg;
+    
+    };
+
+#endif /* CASERUNNER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/inc/cmdparser.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,72 @@
+/*
+* 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: CCmdParser is used to parse the command line parameters. 
+*
+*/
+
+#ifndef CMDPARSER_H_
+#define CMDPARSER_H_
+
+#include <e32hashtab.h> 
+#include <e32std.h>
+#include <e32base.h>
+#include <e32cmn.h> 
+
+class CCmdParser : public CBase
+    {
+public:
+    static CCmdParser* NewL();
+    ~CCmdParser();
+    
+public:
+    TBool Parse(TPtr& commandLine);
+    TBool CaseContains(TInt index, TDesC& caseName);
+    inline TInt CaseCount(){return iTestCaseIndexList.Count() + iTestCaseList.Count();}
+    inline TName TestModule() {return iTestModule;}
+    inline TFileName ConfigFile() {return iConfigFile;}
+    inline TFileName EngineIniFile() {return iEngineIniFile;}
+    inline TFileName ModuleIniFile() {return iModuleIniFile;}
+    inline TBool IsVersion(){return iIsVersion;}
+    inline TBool IsHelp() {return iIsHelp;}
+    inline RArray<TName> TestCaseList() {return iTestCaseList;}
+    inline RArray<TInt> TestCaseIndexList() {return iTestCaseIndexList;}
+    inline TDes& EngineConfigList() {return iEngineConfigList;}
+    inline TDes& LogConfigList() {return iLogConfigList;}
+    inline TBool IsPrompt() {return iIsPrompt;}
+    
+private:
+    CCmdParser();
+    TBool IsNumber(const TDesC & aDes);
+    
+private:
+    TName iTestModule;
+    TFileName iConfigFile;
+    TFileName iEngineIniFile;
+    TFileName iModuleIniFile;
+    TBuf<256> iEngineConfigList;
+    TBuf<256> iLogConfigList;
+    RArray<TName> iTestCaseList;
+    
+    RArray<TInt> iTestCaseIndexList;
+    
+    TName iTestCase;
+    TInt iTestCaseIndex;
+    TBool iIsVersion;
+    TBool iIsHelp;
+    TBool iIsPrompt;
+    
+    };
+
+
+#endif /* CMDPARSER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/inc/executor.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,64 @@
+/*
+* 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: CExecutor is used to execute the testing via STIF engine.
+*
+*/
+
+#ifndef EXECUTOR_H_
+#define EXECUTOR_H_
+
+#include <e32std.h>
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include "activetimer.h"
+#include <TestEngineClient.h>
+#include "TestModuleInfo.h"
+#include <StifTestInterface.h>
+#include "cmdparser.h"
+
+class CCaseRunner;
+
+class CExecutor : public CBase
+    {
+public:
+    static CExecutor* NewL(CCmdParser* aParser,CConsoleBase* aConsole);
+    ~CExecutor();
+    
+public:
+    void RunTestsL();
+    void TestCompleted(TInt aError);
+    RTestEngine& TestEngine();
+  
+private:
+    void ConstructL();
+    CExecutor(CCmdParser* aParser,CConsoleBase* aConsole);
+    void RunAllTestCasesL();
+    void RunTestCaseL(TTestInfo& aTestInfo);
+    TInt RunATestCaseL(CCaseRunner* aCaseRunner);
+    void LogErrorAndLeaveL(const TDesC& aFunction, const TDesC& aDescription, const TInt aError);
+    void ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd);
+    
+private:
+    CConsoleBase* iConsole;
+    RTestEngine iTestEngine;
+    TInt iTestCompletedError;
+    CTestModuleList* iModuleList;
+    CCmdParser* iParser;
+    CFixedFlatArray<TTestInfo>* iTestCasesList;
+    
+    
+    };
+
+#endif /* EXECUTOR_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/inc/helper.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* 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: CHelp is used to show the version info and help info.
+*
+*/
+#ifndef HELPER_H_
+#define HELPER_H_
+
+#include <e32std.h>
+#include <e32base.h>
+#include <e32cons.h>
+#include <StifTestInterface.h>
+
+class CHelper : public CBase
+    {
+public:
+    static CHelper* NewL(CConsoleBase* aConsole);
+    ~CHelper();
+    
+public:
+    void ShowHelp();
+    void ShowVersion();
+    
+private:
+    CHelper(CConsoleBase* aConsole);
+    void ConstructL();
+    
+private:
+    CConsoleBase* iConsole;
+    
+    };
+
+
+
+#endif /* HELPER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/inc/stf.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,30 @@
+/*
+* 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: 
+*
+*/
+
+#ifndef __STF_H__
+#define __STF_H__
+
+//  Include Files
+
+#include <e32base.h>
+
+//  Function Prototypes
+
+GLDEF_C TInt E32Main();
+
+#endif  // __STF_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/src/activetimer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,82 @@
+/*
+* 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: 
+*
+*/
+#include "activetimer.h"
+
+CActiveTimer::CActiveTimer(CConsoleBase* aConsole) : 
+    CTimer(CActive::EPriorityStandard),
+    iConsole(aConsole)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+void CActiveTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    iXPos = 0;
+    iYPos = 1;
+    }
+
+CActiveTimer* CActiveTimer::NewL(CConsoleBase* aConsole)
+    {
+    CActiveTimer* self = new(ELeave) CActiveTimer(aConsole);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+CActiveTimer::~CActiveTimer()
+    {
+    Cancel();    
+    }
+
+void CActiveTimer::StartL()
+    {
+    iStartTime.HomeTime();
+    CTimer::After(KPrintInterval);
+    }
+
+void CActiveTimer::RunL()
+    {
+    TTimeIntervalSeconds seconds;
+    TTime time;
+    time.HomeTime();
+    time.SecondsFrom(iStartTime, seconds);
+    
+    TInt x = iConsole->WhereX();
+    TInt y = iConsole->WhereY();
+    
+    iConsole->SetPos(iXPos, iYPos);
+    iConsole->Printf(_L("\n"));
+    iConsole->Printf(_L("[Time: %d]   "), seconds.Int());
+    iConsole->SetPos(x, y);
+    
+    CTimer::After(KPrintInterval);
+    }
+
+void CActiveTimer::DoCancel()
+    {
+    TTimeIntervalSeconds seconds;
+    TTime time;
+    time.HomeTime();
+    time.SecondsFrom(iStartTime, seconds);
+    iConsole->Printf(_L("Total Time: [%d]"), seconds.Int());
+    CTimer::DoCancel();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/src/caserunner.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,105 @@
+/*
+* 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: 
+*
+*/
+#include "caserunner.h"
+
+CCaseRunner::CCaseRunner(CExecutor* aExecutor, TTestInfo& aTestInfo) :
+    CActive(CActive::EPriorityStandard),
+    iExecutor(aExecutor),
+    iTestInfo(aTestInfo),
+    iTestInfoPckg(iTestInfo),
+    iFullTestResultPckg(iFullTestResult)
+    {
+    __ASSERT_ALWAYS( aExecutor, User::Panic( _L("Null pointer"), KErrGeneral ) );
+    CActiveScheduler::Add( this );
+    }
+
+void CCaseRunner::ContructL()
+    {
+    iTestEngine = iExecutor->TestEngine();
+    User::LeaveIfError(iTestCase.Open(iTestEngine, iTestInfoPckg));
+    }
+
+CCaseRunner* CCaseRunner::NewL(CExecutor* aExecutor, TTestInfo& aTestInfo)
+    {
+    CCaseRunner* self = new(ELeave) CCaseRunner(aExecutor, aTestInfo);
+    CleanupStack::PushL(self);
+    self->ContructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CCaseRunner::~CCaseRunner()
+    {
+    Cancel();
+    iTestCase.Close();
+    }
+
+void CCaseRunner::StartTestL()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("Start test case %d: "), iTestInfo.iTestCaseInfo.iCaseNumber );
+#endif
+    if(IsActive())
+        {
+        Cancel();
+        }
+    iTestCase.RunTestCase(iFullTestResultPckg, iStatus);
+    SetActive();
+    
+    }
+
+void CCaseRunner::RunL()
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("RunTestCase completed: [%d]"), iStatus.Int());
+#endif
+    User::LeaveIfError(iStatus.Int());
+    
+    if(iFullTestResult.iCaseExecutionResultType != TFullTestResult::ECaseExecuted)
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("Test case execution failed: [%d] "),iFullTestResult.iCaseExecutionResultCode );
+#endif
+        iExecutor->TestCompleted(iFullTestResult.iCaseExecutionResultCode);
+        }
+    else
+        {
+#ifdef _DEBUG
+        // Debug test result
+        RDebug::Print( _L("Test case execution completed[%d]: %S"), 
+                            iFullTestResult.iTestResult.iResult,  
+                            &iFullTestResult.iTestResult.iResultDes);
+#endif
+        iExecutor->TestCompleted( iFullTestResult.iTestResult.iResult );
+        }
+    
+    
+    }
+
+void CCaseRunner::DoCancel()
+    {
+    iTestCase.CancelAsyncRequest(RTestCase::ERunTestCase);
+    }
+
+TInt CCaseRunner::RunError(TInt aError)
+    {
+#ifdef _DEBUG
+    RDebug::Print(_L("Test case execution failed: [%d] "),aError );
+#endif
+    iExecutor->TestCompleted( aError );
+    return KErrNone;       
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/src/cmdparser.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,315 @@
+/*
+* 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: 
+*
+*/
+#include "cmdparser.h"
+#include <StifTestInterface.h>
+
+
+_LIT( KTestModule, "-m" );
+_LIT( KConfigFile, "-s" );
+_LIT( KEngineIniFile, "-i" );
+_LIT( KModuleIniFile, "-c" );
+_LIT( KEngineConfigurationItem, "-engine" );
+_LIT( KLogConfigurationItem, "-log" );
+_LIT( KVersion1, "-v" );
+_LIT( KVersion2, "-version" );
+_LIT( KHelp1, "-?" );
+_LIT( KHelp2, "-h" );
+_LIT( KHelp3, "-help" );
+_LIT( KNoPrompt, "-NOPROMPT");
+_LIT( KDefaultEngineIni, "c:\\TestFramework\\TestFramework.ini" );
+
+
+
+
+CCmdParser::CCmdParser() : iIsHelp(EFalse), iIsVersion(EFalse), iIsPrompt(ETrue)
+    {
+    iEngineIniFile.Zero();
+    iModuleIniFile.Zero();
+    iConfigFile.Zero();
+    iTestModule.Zero();
+    iTestCase.Zero();
+    
+    }
+
+CCmdParser::~CCmdParser()
+    {
+    iTestCaseList.Close();
+    iTestCaseIndexList.Close();
+       
+    }
+
+CCmdParser* CCmdParser::NewL()
+    {
+    CCmdParser* self = new(ELeave)CCmdParser();
+    return self;
+    }
+
+TBool CCmdParser::Parse(TPtr& commandLine)
+    {
+    TBool rst(ETrue);
+    TBool findmodule(EFalse);
+    TLex lex(commandLine);
+    TBufC<1> comma(_L("\""));
+    TBool continueName(EFalse); //parse case name, when count \" need continue read name.
+    while ( !lex.Eos() )
+        {
+        TPtrC tmpPtr = lex.NextToken();
+        if(tmpPtr == KTestModule)
+            {
+            TPtrC module = lex.NextToken();
+            if(module.Ptr())
+                {
+                iTestModule.Copy(module);
+                if(iTestModule != _L(""))
+                    {
+                    findmodule = ETrue;    
+                    }
+                }
+            else
+                {
+                rst = EFalse;
+                break;
+                }
+            }
+        else if(tmpPtr == KConfigFile)
+            {
+            TPtrC config = lex.NextToken();
+            if(config.Ptr())
+                {
+                //iTestModule.Copy(_L("testscripter"));//mark here.
+                iConfigFile.Copy(config);
+                TStifUtil::CorrectFilePathL(iConfigFile);
+                if(iConfigFile != _L(""))
+                    {
+                    findmodule = ETrue;    
+                    }
+                }
+            else
+                {
+                rst = EFalse;
+                break;
+                }
+            }
+        else if(tmpPtr == KEngineIniFile)
+            {
+            TPtrC iniFile = lex.NextToken();
+            if(iniFile.Ptr())
+                {
+                iEngineIniFile.Copy(iniFile);
+                TStifUtil::CorrectFilePathL(iEngineIniFile);
+                }
+            else
+                {
+                rst = EFalse;                
+                break;
+                }
+            }
+        else if(tmpPtr == KModuleIniFile)
+            {
+            TPtrC iniFile = lex.NextToken();
+            if(iniFile.Ptr())
+                {
+                iModuleIniFile.Copy(iniFile);
+                TStifUtil::CorrectFilePathL(iModuleIniFile);
+                }
+            else
+                {
+                rst = EFalse;
+                break;
+                }
+            }
+       
+        else if(tmpPtr == KEngineConfigurationItem)
+            {
+            TName pname=lex.NextToken();
+            
+            if(pname.Length() > 0)
+                {
+                TPtrC pval = lex.NextToken();            
+                if(pval.Ptr())
+                    {
+                    
+                    iEngineConfigList.Append(pname);
+                    iEngineConfigList.Append(_L(" "));
+                    iEngineConfigList.Append(pval);
+                    iEngineConfigList.Append(_L(" "));
+                    
+                    }
+                else
+                    {
+                    rst = EFalse;
+                    break;
+                    }
+                }
+            else
+                {
+                rst = EFalse;
+                break;
+                }
+            }
+        else if(tmpPtr == KLogConfigurationItem)
+            {
+            TName pname=lex.NextToken();
+            if(pname.Length() > 0)
+                {
+                TPtrC pval = lex.NextToken();            
+                if(pval.Ptr())
+                    {
+                    
+                    iLogConfigList.Append(pname);
+                    iLogConfigList.Append(_L(" "));
+                    iLogConfigList.Append(pval);
+                    iLogConfigList.Append(_L(" "));
+                    }
+                else
+                    {
+                    rst = EFalse;
+                    break;
+                    }
+                }
+            else
+                {
+                rst = EFalse;
+                break;
+                }
+            
+            }
+        else if(tmpPtr == KVersion1 || tmpPtr == KVersion2)
+            {
+            iIsVersion = true;
+            rst = ETrue;
+            break;            
+            }
+        else if(tmpPtr == KHelp1 || tmpPtr == KHelp2 || tmpPtr == KHelp3)
+            {
+            iIsHelp = true;
+            rst = ETrue;
+            break;
+            }
+        else if(tmpPtr == KNoPrompt)
+            {
+            iIsPrompt = false;
+            }
+        else
+            {
+            if(!tmpPtr.Left(1).Compare(comma))
+                {
+                continueName = ETrue;
+                iTestCase.Copy(tmpPtr);
+                }
+            else
+                {
+                if(continueName)
+                    {
+                    iTestCase.Append(_L(" "));
+                    iTestCase.Append(tmpPtr);
+                    }
+                else
+                    {
+                    //is a number without "\""
+                    if(IsNumber(tmpPtr))
+                        {
+                        TLex myLex(tmpPtr);
+                        myLex.Val(iTestCaseIndex);  
+                        iTestCaseIndexList.Append(iTestCaseIndex);
+                        continue;
+                        }
+                    else
+                        {
+                        iTestCase.Copy(tmpPtr);                    
+                        }
+                    
+                    }
+                }
+            
+
+            
+            if(!iTestCase.Right(1).Compare(comma))
+                {
+                if(continueName)
+                    {
+                    iTestCase.Copy(iTestCase.Mid(1, iTestCase.Length() -2));
+                    iTestCaseList.Append(iTestCase);
+                    }
+                //error input.
+                iTestCase.Copy(_L(""));
+                continueName = EFalse;
+                }
+            else
+                {
+                if(!continueName)
+                    {
+                    iTestCaseList.Append(iTestCase);
+                    iTestCase.Copy(_L(""));
+                    }
+                }
+            
+
+            }
+        }//end while
+    if(iConfigFile.Length() != 0 && iTestModule.Length() == 0)
+        {
+        iTestModule.Copy(_L("testscripter"));
+        }
+    if(iEngineIniFile.Length()==0)
+        {
+        iEngineIniFile.Append(KDefaultEngineIni);
+        }
+    return (rst && findmodule);
+    }
+
+
+TBool CCmdParser::CaseContains(TInt index, TDesC& caseName)
+    {
+    //RArray<TName> iTestCaseList;
+    //RArray<TInt> iTestCaseIndexList;
+    TInt size = iTestCaseIndexList.Count();
+    for(TInt i=0;i<size; i++)
+        {
+        if(iTestCaseIndexList[i] == index)
+            {
+            return ETrue;
+            }
+        }
+    size = iTestCaseList.Count();
+    for(TInt i=0;i<size;i++)
+        {
+        if(!iTestCaseList[i].Compare(caseName))
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+TBool CCmdParser::IsNumber(const TDesC & aDes)
+    {
+    TBuf<2> tempChar;
+    for (TInt i=0;i<aDes.Length();i++)
+        {
+        tempChar.Zero();
+        tempChar.Append(aDes.Mid(i,1));
+        TLex myLex(tempChar);
+        TInt32 model;
+        if (myLex.Val(model))
+            {
+            return  EFalse;
+            }
+    }
+    return ETrue;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/src/executor.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,698 @@
+/*
+ * 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: 
+ *
+ */
+#include "caserunner.h"
+#include "executor.h"
+
+CExecutor::CExecutor(CCmdParser* aParser,CConsoleBase* aConsole) :
+    iConsole(aConsole),iParser(aParser)
+    {
+    }
+
+void CExecutor::ConstructL()
+    {
+    // Create console screen
+   
+    RDebug::Print(_L("Creating module list object"));
+    TRAPD(err, iModuleList = CTestModuleList::NewL(NULL));
+    if (err != KErrNone)
+        {
+        LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                _L("CTestModuleList::NewL"), err);
+        return;
+        }
+    if (!iModuleList)
+        {
+        LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                _L("CTestModuleList::NewL - iModuleList is NULL"),
+                KErrGeneral);
+        return;
+        }
+
+    // Add to module list info about module taken from command line
+    RDebug::Print(_L("Adding command line module to list"));
+    TName moduleName;
+    moduleName.Copy(iParser->TestModule());
+    moduleName.LowerCase();
+    RDebug::Print(_L("AddTestModule : '%S'"), &moduleName);
+    err = iModuleList->AddTestModule(moduleName);
+    
+    if (err != KErrNone && err != KErrAlreadyExists)
+        {
+        LogErrorAndLeaveL(
+                _L("CExecutor::ConstructL"),
+                _L("CTestModuleList::AddTestModule - Could not add module to list of modules"),
+                err);
+        return;
+        }
+
+    //Get added module
+    CTestModuleInfo* moduleInfo = iModuleList->GetModule(moduleName);
+    if (!moduleInfo)
+        {
+        LogErrorAndLeaveL(
+                _L("CExecutor::ConstructL"),
+                _L("CTestModuleList::GetModule - Could not add get module info from list"),
+                KErrGeneral);
+        return;
+        }
+
+    //Add ini file if given
+    if (iParser->ModuleIniFile().Length() > 0)
+        {
+        TFileName filename;
+        filename.Copy(iParser->ModuleIniFile());
+        filename.LowerCase();
+        moduleInfo->SetIniFile(filename);
+        }
+
+    //Add config file if given
+    if (iParser->ConfigFile().Length() > 0)
+        {
+        TFileName filename;
+        filename.Copy(iParser->ConfigFile());
+        filename.LowerCase();
+        moduleInfo->AddCfgFile(filename);
+        }
+    //Now check all config files if there are included modules
+    _LIT(KIncludeModuleStart, "[New_Include_Module]");
+    _LIT(KIncludeModuleEnd, "[End_Include_Module]");
+
+    RDebug::Print(_L("Start parsing included modules"));
+    CTestCaseFileInfo* finfo = iModuleList->GetUncheckedCfgFile();
+    while (finfo)
+        {
+        TFileName fname;
+        finfo->GetCfgFileName(fname);
+
+        RDebug::Print(_L("Checking file: '%S'"), &fname);
+        finfo->SetChecked();
+
+        CStifParser* parser = NULL;
+
+        TRAP(err, parser = CStifParser::NewL(_L(""), fname));
+        if (err != KErrNone)
+            {
+            iConsole->Printf(_L("\n ErrNo: [%d],can't find cfg \n file: [%S] \n in %S module. \n"), err,&fname,&moduleName);
+            LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                    _L("CStifParser::NewL - Could not create parser"),
+                    err);
+            return;
+            }
+        CleanupStack::PushL(parser);
+
+        ParseTestModulesL(parser, iModuleList, KIncludeModuleStart,
+                KIncludeModuleEnd);
+
+        CleanupStack::PopAndDestroy(parser);
+        finfo = iModuleList->GetUncheckedCfgFile();
+        }
+    RDebug::Print(_L("End parsing included modules"));
+
+    // Create Test Engine
+    RDebug::Print(_L("Creating test engine"));
+    TInt ret = iTestEngine.Connect();
+    if (ret != KErrNone)
+        {
+        // Log error
+        LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                _L("iTestEngine.Connect"), ret);
+        return;
+        }
+    
+    
+    ret = iTestEngine.LoadConfiguration(iParser->EngineIniFile());
+    
+    if (ret != KErrNone)
+        {
+        iConsole->Printf(_L("\n ErrNo: [%d],can't load  engine ini :[%S]. \n"), err,&iParser->EngineIniFile());
+              
+        // Log error
+        LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                _L("iTestEngine.LoadConfiguration"), ret);
+        return;
+        }
+  
+      //update Log Configuration
+      ret = iTestEngine.UpdateLogConfiguration(iParser->LogConfigList());
+      if (ret != KErrNone)
+          {
+          // Log error
+          LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                 _L("iTestEngine.UpdateLogConfiguration"), ret);
+          return;
+          } 
+    
+      //update Engine Configuration        
+      ret = iTestEngine.UpdateEngineConfiguration(iParser->EngineConfigList());
+      if (ret != KErrNone)
+          {
+          // Log error
+          LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                 _L("iTestEngine.UpdateEngineConfiguration"), ret);
+          return;
+          }  
+    RDebug::Print(_L("End creating test modules"));
+    
+    //Get all test modules loaded via TestFramework.ini
+    //Remove them before load user assiged module.
+    // Enumerate test cases
+    TCaseCount caseCount;
+    TRequestStatus status;
+    iTestEngine.EnumerateTestCases(caseCount, status);
+    User::WaitForRequest(status);
+
+    // Check that enumerate succeeded
+    if (status != KErrNone)
+        {
+        // Log error 
+        LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                _L("iTestEngine.EnumerateTestCases"), status.Int());
+        return;
+        }
+
+    // Get test cases to buffer
+    CFixedFlatArray<TTestInfo>* casesList = CFixedFlatArray<TTestInfo>::NewL(
+            caseCount());
+    
+    CleanupStack::PushL(casesList);
+    
+    ret = iTestEngine.GetTestCases(*casesList);
+    if (ret != KErrNone)
+        {
+        // Log error 
+        LogErrorAndLeaveL(_L("CExecutor::RunAllTestCasesL"),
+                _L("iTestEngine.GetTestCases"), status.Int());
+        return;
+        }
+  
+    //remove all exist cases.
+    for(TInt i=0;i<(*casesList).Count();i++)
+        {
+        RDebug::Print((*casesList)[i].iModuleName);
+        iTestEngine.RemoveTestModule((*casesList)[i].iModuleName); 
+        iTestEngine.RemoveConfigFile((*casesList)[i].iModuleName, (*casesList)[i].iConfig);
+        }
+    CleanupStack::PopAndDestroy(casesList);
+        
+    
+    // Add all test modules and config files
+    RDebug::Print(_L("Start creating test modules"));
+    moduleInfo = NULL;
+    TInt i;
+    TInt modCnt = iModuleList->Count();
+
+    for (i = 0; i < modCnt; i++)
+        {
+        RDebug::Print(_L("Processing module"));
+        // Get module
+        moduleInfo = iModuleList->GetModule(i);
+        if (!moduleInfo)
+            {
+            RDebug::Print(_L("Could not get module info at index %d"), i);
+            continue;
+            }
+
+        // Get module name
+        TName moduleName;
+        moduleInfo->GetModuleName(moduleName);
+        RDebug::Print(_L("module name: '%S'"), &moduleName);
+
+        // Get ini file, if exists
+        TFileName ini;
+        moduleInfo->GetIniFileName(ini);
+        if (ini.Length() == 0)
+            {
+            RDebug::Print(_L("ini file not found"));
+            }
+        else
+            {
+            RDebug::Print(_L("ini file: '%S'"), &ini);
+            }
+
+        // Create test module
+        RDebug::Print(_L("Adding module to test engine"));
+        ret = iTestEngine.AddTestModule(moduleName, ini);
+        if (ret != KErrNone && ret != KErrAlreadyExists)
+            {
+            iConsole->Printf(_L("\n ErrNo: [%d],can't find module: [%S] \n"), ret,&moduleName);
+            LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                    _L("iTestEngine.AddTestModule"), ret);
+            
+            return;
+            }
+
+        //Add test case files
+        TInt cfgCnt = moduleInfo->CountCfgFiles();
+        TInt j;
+        TFileName cfgFile;
+        for (j = 0; j < cfgCnt; j++)
+            {
+            moduleInfo->GetCfgFileName(j, cfgFile);
+            if (cfgFile.Length() > 0)
+                {
+                RDebug::Print(_L("config file: '%S'"), &cfgFile);
+
+                ret = iTestEngine.AddConfigFile(moduleName, cfgFile);
+                if (ret != KErrNone && ret != KErrAlreadyExists)
+                    {
+                   
+                    // Log error
+                    LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                            _L("RTestEngine::AddConfigFile"), ret);
+                    return;
+                    }
+                }
+            else
+                {
+                RDebug::Print(_L("Got empty cfg file"));
+                }
+            }
+        if (cfgCnt == 0)
+            {
+            RDebug::Print(_L("cfg file not found"));
+            }
+
+        RDebug::Print(_L("Module '%S' processed correctly"), &moduleName);
+        }
+    
+    // Enumerate test cases in added module
+    iTestEngine.EnumerateTestCases(caseCount, status);
+    User::WaitForRequest(status);
+
+    // Check that enumerate succeeded
+    if (status != KErrNone)
+        {
+        // Log error 
+        LogErrorAndLeaveL(_L("CExecutor::ConstructL"),
+                _L("iTestEngine.EnumerateTestCases"), status.Int());
+        return;
+        }
+
+    iTestCasesList = CFixedFlatArray<TTestInfo>::NewL(caseCount());
+    ret = iTestEngine.GetTestCases(*iTestCasesList);
+    if (ret != KErrNone)
+        {
+        // Log error 
+        LogErrorAndLeaveL(_L("CExecutor::RunAllTestCasesL"),
+                _L("iTestEngine.GetTestCases"), status.Int());
+        return;
+        }
+    }
+
+CExecutor* CExecutor::NewL(CCmdParser* aParser,CConsoleBase* aConsole)
+    {
+    CExecutor* self = new (ELeave) CExecutor(aParser,aConsole);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CExecutor::~CExecutor()
+    {
+    iTestEngine.Close();
+    delete iTestCasesList;
+    delete iModuleList;
+    
+    }
+
+void CExecutor::ParseTestModulesL(CStifParser* aParser,
+        CTestModuleList* aModuleList, const TDesC& aSectionStart,
+        const TDesC& aSectionEnd)
+    {
+    //First let's find all modules given in Stif's ini file and store that info in CTestModuleList object
+    CStifSectionParser* sectionParser = NULL;
+    CStifItemParser* item = NULL;
+
+    sectionParser = aParser->SectionL(aSectionStart, aSectionEnd);
+
+    while (sectionParser)
+        {
+        RDebug::Print(_L("Found '%S' and '%S' sections"), &aSectionStart,
+                &aSectionEnd);
+        CleanupStack::PushL(sectionParser);
+        RDebug::Print(_L("Starting to read module information"));
+        // Get name of module
+        _LIT(KModuleName, "ModuleName=");
+        item = sectionParser->GetItemLineL(KModuleName);
+        CleanupStack::PushL(item);
+        if (!item)
+            {
+            CleanupStack::PopAndDestroy(item);
+            LogErrorAndLeaveL(
+                    _L("CExecutor::ParseTestModulesL"),
+                    _L("CStifItemParser::GetItemLineL - line not found from module section"),
+                    KErrNotFound);
+            return;
+            }
+        else
+            {
+            RDebug::Print(_L("'%S' found"), &KModuleName);
+            }
+
+        TPtrC name;
+        TName moduleName;
+        TInt ret(KErrNone);
+        ret = item->GetString(KModuleName, name);
+        if (ret != KErrNone)
+            {
+            CleanupStack::PopAndDestroy(item);
+            LogErrorAndLeaveL(
+                    _L("CExecutor::ParseTestModulesL"),
+                    _L("CStifItemParser::GetString - Module name parsing left with error"),
+                    ret);
+            return;
+            }
+        else
+            {
+            RDebug::Print(_L("Module '%S' found from ini-file"), &name);
+            moduleName.Copy(name);
+            moduleName.LowerCase();
+            ret = aModuleList->AddTestModule(moduleName);
+            if (ret != KErrNone && ret != KErrAlreadyExists)
+                {
+                LogErrorAndLeaveL(
+                        _L("CExecutor::ParseTestModulesL"),
+                        _L("CTestModuleList::AddTestModule - Could not add module to list of modules"),
+                        ret);
+                return;
+                }
+            }
+        CleanupStack::PopAndDestroy(item);
+
+        //Get pointer to added module
+        CTestModuleInfo* moduleInfo = aModuleList->GetModule(moduleName);
+        if (!moduleInfo)
+            {
+            LogErrorAndLeaveL(
+                    _L("CExecutor::ParseTestModulesL"),
+                    _L("CTestModuleList::GetModule - Could not add get module info from list"),
+                    KErrNotFound);
+            return;
+            }
+
+        // Get ini file, if it exists
+        RDebug::Print(_L("Start parsing ini file"));
+        _LIT(KIniFile, "IniFile=");
+        item = sectionParser->GetItemLineL(KIniFile);
+        if (item)
+            {
+            RDebug::Print(_L("'%S' found"), &KIniFile);
+            CleanupStack::PushL(item);
+            TPtrC iniFile;
+            ret = item->GetString(KIniFile, iniFile);
+            if (ret == KErrNone)
+                {
+                RDebug::Print(
+                        _L("Initialization file '%S' found, file can be empty"),
+                        &iniFile);
+                TFileName filename;
+                filename.Copy(iniFile);
+                filename.LowerCase();
+                TStifUtil::CorrectFilePathL(filename);
+                moduleInfo->SetIniFile(filename);
+                }
+            else
+                {
+                RDebug::Print(_L("Initialization file not found"));
+                }
+            CleanupStack::PopAndDestroy(item);
+            }
+        else
+            {
+            RDebug::Print(_L("'%S' not found"), &KIniFile);
+            }
+
+        // Get config (testcase) file
+        RDebug::Print(_L("Start parsing cfg files"));
+        TPtrC cfgTag;
+        for (TInt i = 0; i < 2; i++)
+            {
+            //Set tag for config files
+            if (i == 0)
+                {
+                cfgTag.Set(_L("ConfigFile="));
+                }
+            else
+                {
+                cfgTag.Set(_L("TestCaseFile="));
+                }
+            //Read data
+            item = sectionParser->GetItemLineL(cfgTag);
+            while (item)
+                {
+                CleanupStack::PushL(item);
+                RDebug::Print(_L("Item '%S' found"), &cfgTag);
+                TPtrC cfgFile;
+                ret = item->GetString(cfgTag, cfgFile);
+                if (ret == KErrNone)
+                    {
+                    TFileName ifile;
+                    ifile.Copy(cfgFile);
+                    ifile.LowerCase();
+                    TStifUtil::CorrectFilePathL(ifile);
+                    RDebug::Print(_L("Configuration file '%S' found"), &ifile);
+                    moduleInfo->AddCfgFile(ifile);
+                    }
+                else
+                    {
+                    RDebug::Print(_L("Configuration file not found"));
+                    }
+                CleanupStack::PopAndDestroy(item);
+                item = sectionParser->GetNextItemLineL(cfgTag);
+                }
+            }
+
+        RDebug::Print(_L("Module '%S' information read correctly"),
+                &moduleName);
+
+        // Get next section
+        CleanupStack::PopAndDestroy(sectionParser);
+        sectionParser = aParser->NextSectionL(aSectionStart, aSectionEnd);
+        }
+    }
+
+void CExecutor::RunTestsL()
+    {
+    RunAllTestCasesL();
+
+    // Remove test module
+    RDebug::Print(_L("Start removing test modules"));
+    CTestModuleInfo* moduleInfo = NULL;
+    TInt i;
+    TInt modCnt = iModuleList->Count();
+
+    for (i = 0; i < modCnt; i++)
+        {
+        RDebug::Print(_L("Processing module"));
+        // Get module
+        moduleInfo = iModuleList->GetModule(i);
+        if (!moduleInfo)
+            {
+            RDebug::Print(_L("Could not get module info at index %d"), i);
+            continue;
+            }
+
+        // Get module name
+        TName moduleName;
+        moduleInfo->GetModuleName(moduleName);
+        RDebug::Print(_L("module name: '%S'"), &moduleName);
+
+        // Remove test module
+        User::LeaveIfError(iTestEngine.RemoveTestModule(moduleName));
+        RDebug::Print(_L("Module '%S' removed"), &moduleName);
+        }
+
+    RDebug::Print(_L("End removing test modules"));
+    }
+
+void CExecutor::RunAllTestCasesL()
+    {
+    
+    RArray<TName> testCasesTitleList;
+    CleanupClosePushL(testCasesTitleList);
+    
+    for(TInt i=0;i<iTestCasesList->Count();i++)
+        {
+        TName title;
+        title.Append((*iTestCasesList)[i].iTestCaseInfo.iTitle);
+        testCasesTitleList.Append(title);
+        }
+    
+    
+    for(TInt i=0;i<iParser->TestCaseIndexList().Count();i++)
+    {
+    
+       if(iParser->TestCaseIndexList()[i]>=testCasesTitleList.Count())
+           {
+               iConsole->Printf(_L("\ncase No.[%d] doesn't exist\n"),iParser->TestCaseIndexList()[i]);
+           }
+    }
+    
+    
+    for(TInt i=0;i<iParser->TestCaseList().Count();i++)
+    {
+        
+        TBool isfound(EFalse);
+        for(TInt j=0;j<testCasesTitleList.Count();j++)
+            {
+                if(iParser->TestCaseList()[i].Compare(testCasesTitleList[j])==KErrNone)
+                    {
+                    isfound=ETrue;  
+                    }
+            
+            }
+        if(!isfound)
+            {
+            iConsole->Printf(_L("\ncase [%S] doesn't exist\n"),&iParser->TestCaseList()[i]);
+            }
+    
+    
+    }
+    
+    
+    //variables used to get version of STIF
+    TInt majorV;
+    TInt minorV;
+    TInt buildV;
+    TBuf<30> relDate;
+    TStifUtil::STIFVersion(majorV, minorV, buildV, relDate);
+
+    TBuf<50> version;
+    version.Format(_L("STF v%d.%d.%d - "), majorV, minorV, buildV);
+    version.Append(relDate);
+    version.Append(_L("\n"));
+
+    iConsole->Printf(version); //printing STIF version information (version and release date)
+
+    TInt caseNum = iParser->CaseCount();
+    if (caseNum == 0)
+        {
+        caseNum = iTestCasesList->Count();
+        }
+
+    iConsole->Printf(_L("Test case count: [%d]\n\n"), caseNum);
+
+    // Loop through all test cases in buffer and run them
+    const TInt count = iTestCasesList->Count();
+    if (iParser->CaseCount() == 0)
+        {
+        //execute all
+        for (TInt i = 0; i < count; i++)
+            {
+#ifdef _DEBUG
+            RDebug::Print((*iTestCasesList)[i].iTestCaseInfo.iTitle);
+#endif
+            iConsole->Printf(_L("Now running test case: [%d] [%S] "), i,
+                    &(*iTestCasesList)[i].iTestCaseInfo.iTitle);
+
+            // Run test case
+            RunTestCaseL((*iTestCasesList)[i]);
+            }
+        }
+    else
+        {
+        for (TInt i = 0; i < count; i++)
+            {
+            if (iParser->CaseContains(i, (*iTestCasesList)[i].iTestCaseInfo.iTitle))
+                {
+#ifdef _DEBUG
+                RDebug::Print((*iTestCasesList)[i].iTestCaseInfo.iTitle);
+#endif
+                iConsole->Printf(_L("Now running test case: [%d] [%S] "),
+                        i, &(*iTestCasesList)[i].iTestCaseInfo.iTitle);
+                // Run test case
+                RunTestCaseL((*iTestCasesList)[i]);
+                }
+            }
+        }
+    
+    CleanupStack::PopAndDestroy(&testCasesTitleList);
+    }
+
+void CExecutor::RunTestCaseL(TTestInfo& aTestInfo)
+    {
+    TInt testResult(KErrNone);
+    CCaseRunner* runner;
+    // Trap to catch errors from test case executing
+    TRAPD( trapError, runner = CCaseRunner::NewL( this, aTestInfo );
+            CleanupStack::PushL( runner );
+
+            testResult = RunATestCaseL( runner );
+
+            CleanupStack::PopAndDestroy( runner );
+    );
+
+    if (trapError != KErrNone)
+        {
+        testResult = trapError;
+        }
+
+    if (testResult != KErrNone) // Test case is FAILED
+        {
+        // Test case failed, print out the error
+        iConsole->Printf(_L("\nTest case FAILED! err=[%d]\n"), testResult);
+        }
+
+    else // Test case is PASSED
+        {
+        iConsole->Printf(_L("\nTest case PASSED!\n"));
+        testResult = KErrNone;
+        }
+    }
+
+TInt CExecutor::RunATestCaseL(CCaseRunner* aCaseRunner)
+    {
+    iTestCompletedError = KErrNone;
+
+    // Create timer
+    CActiveTimer* timer = CActiveTimer::NewL(iConsole);
+    CleanupStack::PushL(timer);
+
+    // Start test case and timer
+    aCaseRunner->StartTestL();
+    timer->StartL();
+
+    // Wait for test case completed
+    CActiveScheduler::Start();
+
+    timer->Cancel();
+    CleanupStack::PopAndDestroy(timer);
+
+    // test completion error is set in TestCompleted method
+    return iTestCompletedError;
+    }
+
+RTestEngine& CExecutor::TestEngine()
+    {
+    return iTestEngine;
+    }
+
+void CExecutor::TestCompleted(TInt aError)
+    {
+    iTestCompletedError = aError;
+    CActiveScheduler::Stop();
+   
+    }
+
+void CExecutor::LogErrorAndLeaveL(const TDesC& aFunction,
+        const TDesC& aDescription, const TInt aError)
+    {
+    RDebug::Print(_L("%S: %S [%d]"), &aFunction, &aDescription, aError);
+    User::Leave(aError);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/src/helper.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,108 @@
+/*
+* 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: 
+*
+*/
+#include "helper.h"
+
+_LIT(KVersion, "STF console based executor, version: 1.0.0");
+_LIT(KRelDate, "2009-12-03");
+
+CHelper::CHelper(CConsoleBase* aConsole) : iConsole(aConsole)
+    {}
+
+CHelper::~CHelper()
+    {
+    }
+
+CHelper* CHelper::NewL(CConsoleBase* aConsole)
+    {
+    CHelper* self = new(ELeave) CHelper(aConsole);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+void CHelper::ConstructL()
+    {
+    //Nothing to do.
+    }
+
+void CHelper::ShowVersion()
+    {
+        
+    iConsole->Printf(_L("* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).\n"));
+    iConsole->Printf(_L("* All rights reserved.\n"));
+    iConsole->Printf(_L("* This component and the accompanying materials are made available\n"));
+    iConsole->Printf(_L("* under the terms of \"Eclipse Public License v1.0\"\n"));
+    iConsole->Printf(_L("* which accompanies this distribution, and is available\n"));
+    iConsole->Printf(_L("* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\n"));
+    iConsole->Printf(_L("*\n"));
+    iConsole->Printf(_L("* Nokia Corporation\n"));
+    iConsole->Printf(_L("\n"));
+    iConsole->Printf(_L("\n"));
+    iConsole->Printf(_L("\n"));
+        
+    //variables used to get version of STIF
+    TInt majorV;
+    TInt minorV;
+    TInt buildV;
+    TBuf<30> relDate;
+    TStifUtil::STIFVersion(majorV, minorV, buildV, relDate);
+    
+    TBuf<50> version;
+    version.Format(_L("STF v%d.%d.%d - "), majorV, minorV, buildV);
+    version.Append(relDate);
+    version.Append(_L("\n"));
+    
+    iConsole->Printf(version);  //printing STIF version information (version and release date)
+    
+    TBuf<100> toolversion;
+    toolversion.Append(KVersion);
+    toolversion.Append(_L(" - Release at:"));
+    toolversion.Append(KRelDate);
+    toolversion.Append(_L("\n"));
+    iConsole->Printf(toolversion);
+    iConsole->Printf(_L("\n"));
+    }
+
+
+void CHelper::ShowHelp()
+    {
+    TSize screenSize;
+    screenSize = iConsole->ScreenSize();
+    
+    iConsole->Printf(_L("Usage: stf [-option value] [--parameter value] [case name/case index]\n"));
+    iConsole->Printf(_L("\n"));
+    iConsole->Printf(_L("where options include:\n"));
+    iConsole->Printf(_L("\n"));
+    iConsole->Printf(_L("-m <modulename>\n"));
+    iConsole->Printf(_L("-s <script file path>\n"));
+    iConsole->Printf(_L("-i <engine initialization file path>\n"));
+    iConsole->Printf(_L("-c <module initialization file path>\n"));
+    iConsole->Printf(_L("-engine <configuration item> <value>\n"));
+    iConsole->Printf(_L("-log <configuration item> <value>\n"));
+    iConsole->Printf(_L("-p <item> <value>\n"));
+    iConsole->Printf(_L("-v  display version information\n"));
+    iConsole->Printf(_L("-NOPROMPT exit without prompt when the execution finished.\n"));
+    iConsole->Printf(_L("-?/-h  display this help information.\n"));
+    iConsole->Printf(_L("\n"));
+    iConsole->Printf(_L("For example:\n"));
+    iConsole->Printf(_L("stf -m demomodule 3\n"));
+    iConsole->Printf(_L("\n"));
+    iConsole->Printf(_L("\n"));
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/stf/src/stf.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,223 @@
+/*
+* 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: 
+*
+*/
+//  Include Files  
+#include "stf.h"
+#include <e32base.h>
+#include <e32std.h>
+#include <e32cons.h>			// Console
+#include "executor.h"
+#include "cmdparser.h"
+#include "helper.h"
+
+_LIT(KTextFailed, " failed, leave code = %d");
+_LIT(KTextPressAnyKey, " [press any key to exit.]\n");
+
+LOCAL_D CConsoleBase* console;
+LOCAL_D TBool isPrompt = ETrue;
+
+
+LOCAL_C TInt Execute()
+    {
+      
+      //parse the command line
+      CCmdParser* parser = NULL;    
+      TRAPD(err, parser = CCmdParser::NewL());
+      if (err != KErrNone)
+          {
+#ifdef _DEBUG
+         RDebug::Print(_L("Command parser construction failed %d: "), err);
+ #endif
+         return err;
+          }
+
+      const TInt length = User().CommandLineLength();
+      HBufC* cmdLine = NULL;
+      TRAPD(err1 , cmdLine = HBufC::NewL(length));
+      if (err1 != KErrNone)
+           {
+   #ifdef _DEBUG
+           RDebug::Print(_L("Command line buffer construction failed %d: "), err1);
+   #endif
+           delete parser;
+           return err1;
+           }
+      
+      TPtr ptr = cmdLine->Des();
+      User().CommandLine(ptr);
+      ptr.TrimAll();
+      TBool rst = parser->Parse(ptr);
+      delete cmdLine;
+      //end parse the command line.
+      
+      isPrompt = parser->IsPrompt();
+      if (parser->IsHelp() || parser->IsVersion())
+          {
+          //only show help or version info.
+          isPrompt = ETrue;
+          CHelper* helper = NULL;
+          TRAPD( err, helper = CHelper::NewL(console));
+          if (err != KErrNone)
+              {
+  #ifdef _DEBUG
+              RDebug::Print(_L("helper construction failed %d: "), err);
+  #endif
+              delete parser;
+              return err;
+              }
+          if(parser->IsHelp())
+              {
+              helper->ShowHelp();            
+              }
+          else
+              {
+              helper->ShowVersion();
+              }
+          delete helper;
+          }
+      else
+          {
+          if (!rst)
+              {
+      #ifdef _DEBUG
+              RDebug::Print(_L("arguments error."));
+      #endif
+              delete parser;
+              return KErrArgument;
+              } 
+          
+          // Construct the test client
+           CExecutor* executor = NULL;
+           TRAPD( err, executor = CExecutor::NewL(parser,console) );
+           if (err != KErrNone)
+               {
+       #ifdef _DEBUG
+               RDebug::Print(_L("STF executor construction failed %d: \n"), err);
+       #endif
+               delete parser;
+               return err;
+               }
+
+               // Run tests
+               TRAP( err, executor->RunTestsL() );
+           if (err != KErrNone)
+               {
+               console->Printf(_L("STF execution failed with: %d \n"),err);
+               
+       #ifdef _DEBUG
+               RDebug::Print(_L("RunTestsL left with %d: "), err);
+       #endif
+               }
+           
+           // Deallocate resources
+           delete executor;
+          }
+   
+      delete parser;
+      return KErrNone;
+    }
+
+LOCAL_C void DoStartL()
+    {
+    // Create active scheduler (to run active objects)
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
+    CleanupStack::PushL(scheduler);
+    CActiveScheduler::Install(scheduler);
+    TInt err = Execute();
+    if(err != KErrNone)
+        {
+        console->Printf(_L("STF Get Error: %d."), err);
+        if(err == KErrArgument)
+                {
+                console->Printf(_L("Arguments error.\n"));
+                }
+            else if(err == KErrNoMemory)
+                {
+                console->Printf(_L("No enough memory.\n"));    
+                }
+            else if(err == KErrNotFound)
+                {
+                console->Printf(_L("Required resouce not found.\n"));    
+                }
+            else if(err == KErrNotSupported)
+                {
+                console->Printf(_L("Operation not supported in this version.\n"));   
+                }
+            else
+                {
+                console->Printf(_L("Other unknow error.\n"));   
+                }
+        }
+        
+    
+    // Delete active scheduler
+    CleanupStack::PopAndDestroy(scheduler); 
+    }
+
+//  Global Variables
+GLDEF_C TInt E32Main()
+    {
+
+    TInt processHandleCountBefore;
+    TInt threadHandleCountBefore;
+    RThread().HandleCount(processHandleCountBefore, threadHandleCountBefore);
+    TInt reqsBefore = RThread().RequestCount();
+
+    TInt processHandleCountAfter;
+    TInt threadHandleCountAfter;
+    TInt reqsAfter;
+    
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    TRAPD(createError, console = Console::NewL(_L("STF"), TSize(
+               KConsFullScreen, KConsFullScreen)));
+    if(createError)
+        {
+        return createError;
+        }
+    
+    TRAPD(mainError, DoStartL());
+    if(mainError)
+        {
+        console->Printf(KTextFailed, mainError);    
+        }
+    if(isPrompt)
+        {
+        console->Printf(KTextPressAnyKey);
+        console->Getch();
+        }
+    reqsAfter = RThread().RequestCount();
+    RThread().HandleCount(processHandleCountAfter, threadHandleCountAfter);
+
+    if (reqsAfter != reqsBefore)
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("Request count not matching! %d vs. %d: "),
+        reqsBefore, reqsAfter);
+#endif
+        }
+    if (threadHandleCountAfter != threadHandleCountBefore)
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("Handle count not matching! %d vs. %d: "),
+        threadHandleCountBefore, threadHandleCountAfter);
+#endif
+        }
+    delete console;
+    delete cleanup;
+    __UHEAP_MARKEND;
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/touchconsoleui/group/TouchConsoleUI.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,54 @@
+/*
+* 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: MMP file for STIF Test Framework's Consoleui app.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          TouchConsoleUI.exe
+TARGETTYPE      exe
+UID			 0 0x2002C347
+
+CAPABILITY	AllFiles CommDD
+//VENDORID 	0x101FB657
+//SECUREID    0x102073DB
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../uiengine/inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+/* Source files */
+SOURCEPATH      ../src
+
+SOURCE          ConsoleUI.cpp
+SOURCE          ConsoleMenus.cpp
+SOURCE          ConsoleNotify.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY		efsrv.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftfwif.lib
+LIBRARY     	  stiftestengine.lib
+LIBRARY         econs.lib
+LIBRARY         hal.lib
+
+// In case of large amount of test cases, bigger heap size is required. 
+// Heap sizes can be changed using EPOCHEAPSIZE statement, where the first
+// parameter is heap's minimum size and the latter the maximum size.
+EPOCHEAPSIZE    0x10000 0x300000
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/touchconsoleui/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STIF Test Framework's Console UI.
+*/
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	TouchConsoleUI.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/touchconsoleui/inc/CallBack.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,211 @@
+/*
+* 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: This file contains the header file of the CCallBack 
+* class.
+*
+*/
+
+#ifndef CALLBACK_H
+#define CALLBACK_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Simple class for callbacks.
+
+class CCallBack 
+    :public CAsyncCallBack
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * C++ constructor.
+        */
+        CCallBack( TInt aPriority ):CAsyncCallBack( aPriority ) {}
+
+        /**
+        * C++ constructor.
+        */
+        CCallBack( TCallBack& aCallBack, TInt aPriority ):
+            CAsyncCallBack( aCallBack, aPriority ) {}
+    
+    public: // New functions
+        /**
+        * Return reference to TRequestStatus member.
+        */
+        TRequestStatus& Status(){ return iStatus; }
+
+        /**
+        * Set CCallBack active.
+        */
+        void SetActive()
+            { 
+            iStatus = KRequestPending; 
+            CActive::SetActive(); 
+            };
+    
+    public: // Functions from base classes
+   
+        /**
+        *
+        */
+        void RunL(){ iCallBack.CallBack(); }
+
+    protected:  // New functions
+        
+    protected:  // Functions from base classes
+        
+    private:
+
+	public:     // Data
+    
+	protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+
+template <class T>
+class CActiveCallback 
+        :public CActive
+    {
+    public: // Enumerations
+
+        /**
+        * Callback function type definitions
+        */
+       typedef void (T::* TestFunction)();    
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * C++ constructor.
+        */
+        CActiveCallback ( T* aClass, TestFunction aFunction ) : CActive (EPriorityStandard)
+            {
+            iMethod = aFunction;
+            iClass = aClass;
+            iCompleted = EFalse;
+            }
+    
+    public: // New functions
+        /**
+        * Return reference to TRequestStatus member.
+        */
+        TRequestStatus& Status(){ return iStatus; }
+
+        /**
+        * Set active object to active and return reference to TRequestStatus member
+        */
+        TRequestStatus& Activate()
+            {        
+            iCompleted = EFalse;
+            SetActive();
+            return iStatus;
+            }
+
+        /**
+        * Is callback completed?
+        */
+        TBool isCompleted()
+            {
+            return iCompleted;
+            }
+    
+    public: // Functions from base classes
+   
+        /**
+        * Call the callback
+        */
+        void RunL()
+            {
+            iCompleted = ETrue;
+            if ( iMethod != NULL )
+                {
+                (iClass->*iMethod) ();
+                }        
+            }
+
+        /**
+        * Just forward errors to framework
+        */
+        TInt RunError ( TInt aError )
+            {
+            return aError;
+            }
+
+        /**
+        * Cancel is not supported.
+        */
+        void DoCancel ()
+            {  
+            }
+
+    protected:  // New functions
+        
+    protected:  // Functions from base classes
+        
+    private:
+
+
+
+	public:     // Data
+    
+	protected:  // Data
+
+    private:    // Data
+        TestFunction iMethod;           // Pointer to method to be called
+        T* iClass;                      // Pointer to calls to be called
+        TBool iCompleted;               // Is callback completed?
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // CALLBACK_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/touchconsoleui/inc/ConsoleMenus.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1901 @@
+/*
+* 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: This file contains the header file of the CMenu 
+* derived classes.
+*
+*/
+
+
+#ifndef CONSOLE_MENUS_H
+#define CONSOLE_MENUS_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "CallBack.h"
+
+// CONSTANTS
+const TInt KMenuOverhead = 4;
+
+// Numeric key ascii code values for ConsoleUI's menu
+const TInt KMyKeyDownAsciiCode = 56; // Ascii code for number '8'
+const TInt KMyKeyLeftAsciiCode = 52; // Ascii code for number '4'
+const TInt KMyKeyRightAsciiCode = 54; // Ascii code for number '6'
+const TInt KMyKeyUpAsciiCode = 50;  // Ascii code for number '2'
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CMenu;
+class CConsoleMain;
+class CCaseOperationMenu;
+class CCaseExecutionView;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Main menu
+class CMenu
+        :public CBase
+    {
+    public:  // Enumerations
+        enum TUpdateType
+            {
+            EMenuPrint,
+            EMenuRefresh,
+            };
+
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMenu* NewL( CConsoleMain* aConsole,
+                            CMenu* aParent,
+                            const TDesC& aName);
+
+       /**
+        * Destructor of CConsoleMain.
+        */
+        virtual ~CMenu();
+
+    public: // New functions
+    
+        /** 
+        * Return menu name
+        */
+        virtual const TDesC& Name() const;
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Set parent menu
+        */
+        virtual void SetParent ( CMenu* aMenu );
+
+        /** 
+        * Print line
+        */
+        virtual void Print( const TDesC& aPrint);
+
+        /** 
+        * Multi line print
+        */
+        virtual void PrintMulti( const TDesC& aPrint );
+
+        /** 
+        * Add item to menu
+        */
+        virtual void AddItemL ( CMenu* aItem );
+        
+        /** 
+        * Signals test completion
+        */
+        virtual void SignalL ( CStartedTestCase* /*aContainer*/ ){};
+		
+        /** 
+        * Update display from timer
+        */
+		virtual void TimerUpdate();
+		
+		/**
+		* Append text before original text.
+		*/
+		virtual void AppendBefore(  TInt aLineNum, TDes& aLine );
+		
+		/**
+		* Get menu type.
+		*/
+		inline TInt Type(){ return iType; };
+		
+		/**
+		* Map KeyCode 
+		*/
+		void MapKeyCode(TKeyCode &aSelection);
+
+		/**
+		 * Recalculates visible menu elements.
+		 */
+		void Recalculate( TInt aItemCount );
+		
+    public: // Functions from base classes
+        // None
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None    
+
+        /** 
+        * C++ default constructor.
+        */
+        CMenu();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         const TDesC& aHeader = KNullDesC);
+    
+    private:   // Functions from base classes
+        // None
+
+    public:   // Data
+        // None
+
+    protected:  // Data    
+    
+        //CConsoleBase*           iConsole;      // Pointer to console
+        RConsole*           iConsole;      // Pointer to console
+        CConsoleMain*           iMain;         // Pointer to main console
+        CMenu*                  iParent;       // Pointer to parent menu
+        TName                   iName;         // Menu name
+    	TName					iHeader;	   // Used to display STIF version information
+
+        RPointerArray<CMenu>    iItems;        // Menu items
+
+        TInt                    iPosOnScreen;  // Position on display
+        TInt                    iFirst;        // First displayed item
+        TInt                    iLast;         // Last displayed item
+        TInt                    iItemCount;    // Last Item
+        TSize                   iSize;         // Display size
+        TInt                    iScreenSize;   // "Work area" size
+		TInt                    iDirection;    // Scrolling direction
+		TInt                    iStart;        // Scrolling position
+		TInt                    iPrevPos;      // Previous position in scrolling
+
+        // Menu type (which updates must cause console update) 
+        // Flags from CUIStoreIf::TUpdateFlags 
+        TInt                    iType;
+        
+        // Update type set from PrintMenuL
+		TUpdateType             iUpdateType;
+		
+    private:    // Data
+        // None
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+
+// CONSTANTS
+_LIT( KSelectMenuTxt, "Select module to load, if using ini or test case file use testframework.ini" );
+
+// DESCRIPTION
+// Filename query menu
+class CFileNameQueryView 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CFileNameQueryView* NewL( CConsoleMain* aConsole, 
+                                         CMenu* aParent, 
+                                         const TDesC& aName);
+
+        ~CFileNameQueryView();
+        
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+        
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+    protected:  // New functions
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent, 
+                         const TDesC& aName );
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+    public:   // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // List of module names
+        RPointerArray<TDesC>    iTestModuleNames;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KAddMenuTxt,  "Add test module" );
+_LIT( KLoadMenuTxt,  "Load all test modules" );
+
+// DESCRIPTION
+// Module list menu
+class CModuleListView 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TModuleListMenu
+            {
+            EAddMenuTxtItem,
+            ELoadMenuTxtItem,
+            };
+            
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CModuleListView* NewL( CConsoleMain* aConsole,
+                                      CMenu* aParent,
+                                      const TDesC& aName );
+
+       /**
+        * Destructor
+        */
+        ~CModuleListView();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+        
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, 
+                                TBool& aContinue );
+ 
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+        
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CMenu*                     iModuleAdd;
+
+    public:     // Friend classes
+         // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// Test case starting menu
+class CCaseStartMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCaseStartMenu* NewL( CConsoleMain* aConsole, 
+                                     CMenu* aParent, 
+                                     const TDesC& aName,
+                                     TBool aShowOutput = EFalse);
+
+        /**
+        * Destructor.
+        */
+		~CCaseStartMenu();
+
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, 
+                                TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         TBool aShowOutput = EFalse);
+
+    private:
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // Test case array
+        RRefArray<CTestInfo> iTestCases;
+
+    private:    // Data
+        // Show output automaticly after test case is started
+        TBool iShowOutput;
+        
+        // Map table. Translates indexes from filtered to all loaded from module  
+        RArray<TInt> iMapFilteredToAll;
+        
+        // Keeps filter name converted to lower case
+        TFileName iFilterLowerCase;
+        
+        // Keeps title of test case converted to lower case
+        TFileName iTitleLowerCase;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KChangeAll, "Change all");
+_LIT( KCancelSet, "Cancel set execution" );
+
+// Test set creation menu
+class CMultipleBaseMenu 
+    :public CCaseStartMenu
+  
+    {
+    public:  // Enumerations
+         enum TMenuIndex
+		    {  
+		    EChangeAll = 0,
+		    ECancelSet = 0,
+		    };
+        enum TRunType
+            {
+            ERunSequential,
+            ERunParallel,
+            ERunRepeatSequential,
+            };
+		    
+    protected: // Enumerations
+
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMultipleBaseMenu* NewL( CConsoleMain* aConsole, 
+                                        CMenu* aParent, 
+                                        const TDesC& aName);
+        
+        /**
+        * Destructor.
+        */
+		~CMultipleBaseMenu();
+
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+		/** 
+        * Signals test completion
+        */
+        virtual void SignalL ( CStartedTestCase* aContainer );
+        
+        /** 
+        * Append text before line print.
+        */
+        virtual void AppendBefore( TInt aLineNum, TDes& aLine );
+        
+    protected:  // New functions
+
+        //inline void SetRunType( TRunType aRunType )
+        //    { iRunType = aRunType; };
+            
+        /**
+        * Update iTestCases();
+        */ 
+        virtual TInt UpdateTestCases();
+        TBool CheckIfAnyCaseIsSelected(TInt aCount);
+                      
+    protected:  // Functions from base classes
+
+        /**
+        * Constructor.
+        */
+		CMultipleBaseMenu();
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+       
+    public:     // Data
+
+    protected:  // Data
+		RArray<TBool>       iSetState;
+		TInt                iCurrentRunPos;
+		TBool               iSetFinished;
+		CStartedTestCase*   iOngoingCaseContainer;
+		TRunType            iRunType;
+				
+		// Number of items in "static" menu (including derived classes)
+		TInt                iMenuTotCount;
+
+    private:    // Data
+		// Number of items in "static" menu of this class
+		// (excluding derived classes)  
+		TInt                iMenuCount;
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+// CONSTANTS
+_LIT( KRunSequentially, "Run selection sequentially");
+_LIT( KRunParallel, "Run selection parallel");
+_LIT( KRepeatRunSequentially, "Repeat run selection sequentially");
+
+_LIT( KSelectFromTo, "Select all between already selected"); 
+
+// Test set creation menu
+class CMultipleCaseMenu 
+    :public CMultipleBaseMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TMultipleMenuIndex
+		    {  
+		    ERunSelection = 0,
+		    ERunSelectionParaller = 1,
+		    ERepeatRunSelection = 2,
+		    ESelectFromTo = 3,
+		    };
+		    
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMultipleCaseMenu* NewL( CConsoleMain* aConsole, 
+                                        CMenu* aParent, 
+                                        const TDesC& aName);
+        
+        /**
+        * Destructor.
+        */
+		~CMultipleCaseMenu();
+
+    public: // New functions
+       /**
+       * Start running.
+       */
+       virtual void StartRunningL( TRunType aRunType, 
+                                   const TDesC& aModule = KNullDesC, 
+                                   const TDesC& aTestCaseFile = KNullDesC );
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+    
+        /**
+        * Constructor.
+        */
+		CMultipleCaseMenu();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+       
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Number of items in "static" menu of this class
+		// (excluding derived classes)  
+		TInt                iMenuItemsCount;
+		
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+// CONSTANTS
+_LIT( KExitTxt,     "Exit" );
+
+// DESCRIPTION
+// The main menu class
+class CMainMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMainMenu* NewL( CConsoleMain* aConsole, 
+                                CMenu* aParent, 
+                                const TDesC& aName,
+                                const TDesC& aHeader );
+
+        /**
+        * Destructor
+        */
+        ~CMainMenu();
+
+    public: // New functions
+        /**
+        * Creates CaseOperationMenu and CaseExecutionView.
+        * Used when after test case starting its output view needs to be shown.
+        */
+        CMenu* CreateOutputViewL(CMenu* aParent);
+
+    public: // Functions from base classes    
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         const TDesC& aHeader );
+
+    private:
+
+    public:   //Data
+
+    protected:  // Data
+
+    private:    // Data
+        // Menu representing output view, used to show it after test case is started
+        CCaseExecutionView* iOutputView;
+
+        // Operation menu used to show output view after test case is started
+        CCaseOperationMenu* iOperationMenu;
+		
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+
+// DESCRIPTION
+// The case list (passed/failed/...) menu class
+class CCaseMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCaseMenu* NewL( CConsoleMain* aConsole, 
+                                CMenu* aParent, 
+                                const TDesC& aName, 
+                                TInt aType );
+
+        /**
+        * Destructor
+        */
+        ~CCaseMenu();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes    
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+        
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+        /**
+        * Append text before original text.
+        */
+        virtual void AppendBefore(TInt aLineNum, TDes& aLine);
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent, 
+                         const TDesC& aName, 
+                         TInt aType );
+
+    private:    // Data
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        CCaseOperationMenu*             iCaseOperationMenu;    // Submenu
+        RRefArray<CStartedTestCase>     iTestCases;
+
+    private:    // Data
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KOutputViewDes,   "View Output");
+_LIT( KPauseCaseDes,    "Pause");
+_LIT( KResumeCaseDes,   "Resume");
+_LIT( KAbortCaseDes,    "Abort case");
+_LIT( KRestartCaseDes,  "Restart");
+
+// DESCRIPTION
+// Case specific operations, like pause, abort etc.
+class CCaseOperationMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TCaseOperationMenu
+            {
+            ERestartCase,
+            EOutputView,
+            EPauseResume,
+            EAbortCase,   
+            };
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCaseOperationMenu* NewL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName, 
+                            const CStartedTestCase* aCaseContainer );
+        
+        /**
+        * Destructor.
+        */
+        ~CCaseOperationMenu();
+        
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         const CStartedTestCase* aCaseContainer );
+
+    private:    // Functions from base classes
+        // None
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Case container
+        const CStartedTestCase* iCaseContainer; 
+        // Execution view                       
+        CCaseExecutionView*     iView;
+        
+    public:     // Friend classes
+        // None        
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+class CCaseExecutionView 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CCaseExecutionView* NewL( CConsoleMain* aConsole, 
+                                         CMenu* aParent, 
+                                         const TDesC& aName, 
+                                         const CStartedTestCase* aCase);
+
+         /**
+        * Destructor.
+        */
+        ~CCaseExecutionView();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+        
+        /**
+        * Get current testcase info.
+        */ 
+        inline const CStartedTestCase* TestCase(){ return iCase; };
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName,
+                         const CStartedTestCase* aCase );
+
+    private:   // Functions from base classes
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        const CStartedTestCase* iCase;
+
+        /**
+        * Indicates current selected line.
+        */
+        TInt                    iLine;
+        /**
+        * Indicates will line show.
+        */
+        TBool                   iShowLine;
+        /**
+        * Line to be show.
+        */
+        HBufC*                  iLineTextBuf;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CMenu notifier class shows dialogs in UI.
+class CMenuNotifier
+        :public CBase
+    {
+    public:  // Enumerations
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMenuNotifier* NewL( const TDesC& aError, 
+                                    CConsoleMain* aMain );
+
+       /**
+        * Destructor of CConsoleMain.
+        */
+        virtual ~CMenuNotifier();
+
+    public: // New functions  
+            
+    public: // Functions from base classes
+        // None
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None    
+
+        /** 
+        * C++ default constructor.
+        */
+        CMenuNotifier( CConsoleMain* aMain );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aError );
+    
+    private:   // Functions from base classes
+        // None
+
+    private:   // New functions
+        /** 
+        * C++ default constructor.
+        */
+        void Run1();	
+
+    public:   // Data
+        // None
+
+    protected:  // Data      
+
+    private:    // Data
+        CActiveCallback <CMenuNotifier> iCallBack1;
+        CActiveCallback <CMenuNotifier> iCallBack2;
+        RTimer iTimer;
+        CConsoleBase* iConsole;
+        CConsoleMain* iMain;        
+        TInt iCompletionCode; 
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CMenu dialog class shows dialogs in UI and waits for keypress.
+class CMenuDialog
+    :public CBase
+    {
+    public:  // Enumerations
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CMenuDialog* NewL( CConsoleMain* aMain, 
+                                  const TDesC& aMessage, 
+                                  const TDesC& aInstruction,
+                                  TInt aTimeInSecs );
+
+       /**
+        * Destructor.
+        */
+        virtual ~CMenuDialog();
+
+    public: // New functions  
+            
+    public: // Functions from base classes
+        
+        TInt WaitForKeypress( TKeyCode& aKeyCode, 
+                              TRequestStatus& aStatus  );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None    
+
+        /** 
+        * C++ default constructor.
+        */
+        CMenuDialog( CConsoleMain* aMain );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aMessage, 
+                         const TDesC& aInstruction, 
+                         TInt aTimeInSecs );
+    
+    private:   // Functions from base classes
+        // None
+
+    private:   // New functions
+        /**
+        * Handle completions.
+        */
+        void Run1();	
+
+    public:   // Data
+        // None
+
+    protected:  // Data      
+
+    private:    // Data
+        // Backpointer
+        CConsoleMain* iMain;        
+        CConsoleBase* iConsole;
+
+        // Timer support
+        CActiveCallback <CMenuDialog> iCallBack1;
+        RTimer iTimer;
+        
+        // Reading
+        CActiveCallback <CMenuDialog> iCallBack2;
+        
+        // For reading keys        
+        TRequestStatus* iStatus;
+        TKeyCode*     iKeyCode;
+    
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KTestSetMenu,     "CTestSetMenu" );
+
+_LIT( KDefaultSetName,  "ConsoleUI.set" );
+
+_LIT( KSetCreate,       "Create test set" );
+_LIT( KSetLoad,         "Load test set" );
+
+_LIT( KSetShow,         "Show started test sets" );
+_LIT( KSetRemove,       "Remove test set" );
+_LIT( KSetCaseAdd,      "Add test case to test set" );
+_LIT( KSetCaseRemove,   "Remove test case from test set" );
+_LIT( KSetSave,         "Save test set" );
+
+_LIT( KSetStartSeq,     "Start sequential test set execution" );
+_LIT( KSetStartPar,     "Start parallel test set execution" );
+//_LIT( KSetStartRep,     "Start repeating test set execution" );
+
+_LIT( KSetStartSeqNotRun, "Start sequentially not started tests" );
+
+// DESCRIPTION
+// Test set menu
+class CTestSetMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        
+    private: // Enumerations
+        
+        enum TCreateMenu
+            {
+            ESetCreate,
+            ESetLoad,    
+            };
+            
+        enum TEditMenu
+            {
+            ESetShow,
+ 
+            ESetStartSeq,
+            ESetStartPar,
+            //ESetStartRep,
+ 
+            ESetRemove,
+            ESetSave,
+            ESetCaseAdd,
+            ESetCaseRemove,
+            
+            ESetStartSeqNotRun,
+            
+
+            ESetLAST //This entry must remain LAST in this menu
+            };
+            
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetMenu* NewL( CConsoleMain* aConsole,
+                                   CMenu* aParent,
+                                   const TDesC& aName );
+
+       /**
+        * Destructor
+        */
+        ~CTestSetMenu();
+
+    public: // New functions
+        /**
+        * Set test set file name.
+        */
+        void SetTestSetFileName( const TFileName& aTestSetFileName ); 
+        
+        /**
+        * Set test set state created.
+        */
+        void SetCreated(){ iTestSetCreated = ETrue; };
+         
+    public: // Functions from base classes
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+        
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, 
+                                TBool& aContinue );
+ 
+        /** 
+        * Prints the menu
+        */
+        virtual void PrintMenuL( TUpdateType  aType );
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+        /**
+        * Constructor
+        */
+        CTestSetMenu();
+       
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        TBool               iTestSetCreated;
+        TFileName           iTestSetName;
+        
+        CMenu*              iSubMenu;
+        
+    public:     // Friend classes
+         // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+    // CONSTANTS
+    _LIT( KTestSetChoice,     "CTestSetChoiceMenu" );
+    _LIT( KSetSelect,       "Select Test Set" );
+
+
+    // DESCRIPTION
+    // Test set choice menu
+    class CTestSetChoiceMenu 
+        :public CMenu
+
+        {
+        public:  // Enumerations
+            
+        private: // Enumerations
+            
+            
+                
+        public:  // Constructors and destructor
+
+            /**
+            * NewL is first phase of two-phased constructor.
+            */
+            static CTestSetChoiceMenu* NewL( CConsoleMain* aConsole,
+                                       CMenu* aParent,
+                                       const TDesC& aName );
+
+           /**
+            * Destructor
+            */
+            ~CTestSetChoiceMenu();
+
+        public: // New functions
+             
+        public: // Functions from base classes
+
+            /** 
+            * Return item texts.
+            */
+           virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+            
+            /** 
+            * Process keypresses on this menu
+            */
+            virtual CMenu* SelectL( TKeyCode aSelectLion, 
+                                    TBool& aContinue );
+     
+            /** 
+            * Prints the menu
+            */
+            virtual void PrintMenuL( TUpdateType  aType );
+            
+        protected:  // New functions
+
+        protected:  // Functions from base classes
+            /**
+            * Constructor
+            */
+            CTestSetChoiceMenu();
+           
+            /**
+            * By default Symbian OS constructor is private.
+            */
+            void ConstructL( CConsoleMain* aConsole, 
+                             CMenu* aParent,
+                             const TDesC& aName );
+
+        private:
+
+        public:   //Data
+            // None
+
+        protected:  // Data
+            // None
+
+        private:    // Data
+            TFileName           iTestSetName;
+            RPointerArray<HBufC> iFileList;
+            
+        public:     // Friend classes
+             // None
+
+        protected:  // Friend classes
+            // None
+
+        private:    // Friend classes
+            // None
+
+        };
+    
+// CONSTANTS
+_LIT( KAddSelected, "Add selected cases");
+
+// Test set case add menu
+class CTestSetAddCaseMenu 
+    :public CMultipleBaseMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TTestSetAddCaseMenuIndex
+		    {  
+		    EAddSelected = 0,
+		    };
+		    
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetAddCaseMenu* NewL( CConsoleMain* aConsole, 
+                                         CMenu* aParent, 
+                                         const TDesC& aName,
+                                         TDesC& aTestSetName );
+        
+        /**
+        * Destructor.
+        */
+		~CTestSetAddCaseMenu();
+
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+    
+        /**
+        * Constructor.
+        */
+		CTestSetAddCaseMenu( TDesC& aTestSetName );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+       
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Number of items in "static" menu of this class
+		// (excluding derived classes)  
+		TInt    iMenuItemsCount;
+		
+        TPtrC   iTestSetName;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KRemoveSelected, "Remove selected cases");
+
+// Test set case add menu
+class CTestSetRemoveCaseMenu 
+    :public CMultipleBaseMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TTestSetRemoveCaseMenuIndex
+		    {  
+		    ERemoveSelected = 0,
+		    };
+		    
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetRemoveCaseMenu* NewL( CConsoleMain* aConsole, 
+                                             CMenu* aParent, 
+                                             const TDesC& aName,
+                                             TDesC& aTestSetName );
+        
+        /**
+        * Destructor.
+        */
+		~CTestSetRemoveCaseMenu();
+
+    public: // New functions
+       // None
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+        
+        /**
+        * Update iTestCases;
+        */ 
+        virtual TInt UpdateTestCases();
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+    
+        /**
+        * Constructor.
+        */
+		CTestSetRemoveCaseMenu( TDesC& aTestSetName );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole,
+                         CMenu* aParent,
+                         const TDesC& aName );
+
+    private:
+       
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        // Number of items in "static" menu of this class
+		// (excluding derived classes)  
+		TInt        iMenuItemsCount;
+		
+        TPtrC       iTestSetName;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };    
+
+// DESCRIPTION
+// The case list (passed/failed/...) menu class
+class CTestSetCaseMenu  
+    :public CCaseMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CTestSetCaseMenu* NewL( CConsoleMain* aConsole, 
+                                       CMenu* aParent, 
+                                       const TDesC& aName,
+                                       CStartedTestSet& aTestSet );
+
+        /**
+        * Destructor
+        */
+        ~CTestSetCaseMenu();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes    
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+        /** 
+        * Prints the menu
+        */
+        void AppendBefore( TInt aLineNum, TDes& aLine );
+        
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );     
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+       
+
+    private:    // Data
+    
+        CTestSetCaseMenu( CStartedTestSet& aTestSet );
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent, 
+                         const TDesC& aName );
+    public:     // Data
+        // None
+
+    protected:  // Data
+
+    private:    // Data
+        CStartedTestSet& iTestSet;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// CONSTANTS
+_LIT( KCancelTestSet, "Cancel test set");
+        
+// DESCRIPTION
+// Started test sets (passed/failed/...) menu class
+class CStartedTestSetMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        // None
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CStartedTestSetMenu* NewL( CConsoleMain* aConsole, 
+                                          CMenu* aParent, 
+                                          const TDesC& aName );
+
+        /**
+        * Destructor
+        */
+        ~CStartedTestSetMenu();
+
+    public: // New functions
+        // None
+
+    public: // Functions from base classes    
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL( TKeyCode aSelectLion, TBool& aContinue );
+        
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts( RRefArray<TDesC>& aArray );
+
+
+        /** 
+        * Prints the menu
+        */
+        void AppendBefore( TInt aLineNum, TDes& aLine );
+        
+        
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+       
+
+    private:    // Data
+    
+        CStartedTestSetMenu();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aConsole, 
+                         CMenu* aParent, 
+                         const TDesC& aName );
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CTestSetCaseMenu*           iCaseMenu;    // Submenu
+        RRefArray<CStartedTestSet>  iTestSets;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// Menu which shows available filters for test case titles
+class CFilterMenu 
+    :public CMenu
+  
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CFilterMenu* NewL(CConsoleMain* aConsole, 
+                                 CMenu* aParent, 
+                                 const TDesC& aName);
+
+        /**
+        * Destructor.
+        */
+        ~CFilterMenu();
+
+    public: // New functions
+        /**
+        * Set test case menu, so it can be shown when user selects filter
+        */
+        void SetTestCaseMenu(CMenu* aTestCaseMenu);
+
+    public: // Functions from base classes
+
+        /** 
+        * Process keypresses on this menu
+        */
+        virtual CMenu* SelectL(TKeyCode aSelectLion, 
+                               TBool& aContinue);
+
+        /** 
+        * Return item texts.
+        */
+        virtual TInt ItemTexts(RRefArray<TDesC>& aArray);
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        /** 
+        * C++ default constructor.
+        */
+        CFilterMenu();
+        
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(CConsoleMain* aConsole,
+                        CMenu* aParent,
+                        const TDesC& aName);
+
+    private:    // Functions
+        // None
+
+    public:     // Data
+        // None
+
+    protected:  // Data
+        // None
+        
+    private:    // Data
+        /**
+        * Test case menu. It will be shown when user selects filter.
+        */
+        CMenu *iTestCaseMenu;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+   
+#endif // CONSOLE_MENUS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/touchconsoleui/inc/ConsoleUI.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,446 @@
+/*
+* 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: This file contains the header file of the ConsoleUI.
+*
+*/
+
+#ifndef CONSOLE_UI_H
+#define CONSOLE_UI_H
+
+
+//  INCLUDE
+#include <e32std.h>
+#include <e32base.h>
+#include <e32twin.h>
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+
+#include "CallBack.h"
+
+#include "TestModuleInfo.h"
+
+#include "ConsoleMenus.h"
+
+// CONSTANTS
+const TInt KMaxLineLength = 80;            // Longest supported line length
+const TInt KScrollPeriod = 300000;		   // Scrolling speed
+
+// MACROS
+
+// DATA TYPES
+
+// Case state
+// Menu update type
+enum TConsoleUIPanic
+    {
+    EInvalidCaseCompletion,
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CMenu;
+class CConsoleMain;
+class CConsoleReader;
+class CMenuDialog;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// CModule contains a test module data
+
+class CScrollerTimer
+        :public CActive
+    {
+    public:  // Enumerations
+        // None
+
+    private: // Enumerations
+        
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CScrollerTimer* NewL( CConsoleMain* aMain );
+
+        /**
+        * Destructor of CModule.
+        */
+        ~CScrollerTimer();
+
+    public: // New functions
+
+		/** 
+        * StartL
+        */
+		void StartL();
+
+		/** 
+        * RunL
+        */
+		void RunL();
+
+		/** 
+        * DoCancel
+        */
+		void DoCancel();
+
+		/** 
+        * RunError
+        */
+		TInt RunError ( TInt aError );
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CScrollerTimer();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( CConsoleMain* aMain );
+
+    public:   //Data
+        // None
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+        CConsoleMain*     iMain;            // Pointer to main console
+		RTimer            iTimer;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+// DESCRIPTION
+// Console UI main class
+class CConsoleMain
+        :public CUIStoreIf
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TStartCasesOnStart
+            {
+            EStartCaseNo = 0,
+            EStartSingleCase,
+            EStartCasesSeq,
+            EStartCasesPar,
+            };
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CConsoleMain* NewL();
+
+        /**
+        * Start
+        */
+        TInt StartL();
+
+        /**
+        * Destructor of CConsoleMain.
+        */
+        ~CConsoleMain();
+
+
+    public: // New functions
+    
+    
+        /**
+        * Receives output update notification from CUIStore.
+        */
+        void Update( CStartedTestCase* aTestCase, 
+                     TInt aFlags );
+                                                                      
+        /**
+        * Function is called when test framework prints error.
+        */
+        void Error( TErrorNotification& aError );
+        
+        /**
+        * Function is called when testframework 
+        * wants to print a popup window.
+        */
+        TInt PopupMsg( const TDesC& aLine1, 
+                       const TDesC& aLine2, 
+                       TInt aTimeInSecs );
+        
+        /**
+        * Function is called when testframework 
+        * wants to print a popup window and 
+        * get the key pressed.
+        */
+        TInt PopupMsg( const TDesC& aLine1, 
+                       const TDesC& aLine2, 
+                       TInt aTimeInSecs,
+                       TKeyCode& aKey,
+                       TRequestStatus& aStatus );
+
+        /**
+        * Close instance.
+        */
+        void Close( TInt aHandle );
+                
+        /**
+        * Console UI panic function
+        */
+        static void Panic( TConsoleUIPanic aPanic );
+
+        /**
+        * Return pointer to console
+        */
+        
+        RConsole* GetConsole();
+
+        /**
+        * Called from timer to perform scrolling
+        */
+        void TimerUpdate();
+                
+        /**
+        * Process keystokes.
+        */
+        void KeyPressed();
+        
+        TKeyCode mapKey();
+
+        /**
+         * Displays no memory error message and closes ConsoleUI
+         */
+        void ExitWithNoMemoryErrorMessage();
+        
+        /**
+         * Returns MainMenu of console
+         */
+        CMainMenu* GetMainMenu();
+        
+        /**
+         * Get filter array for reading purpose
+         */
+        const RPointerArray<TDesC>& GetFilterArray(void) const;
+        
+        /**
+         * Set info about which index filter is used
+         */
+        void SetFilterIndex(TInt aFilterIndex);
+
+        /**
+         * Get info about which index filter is used
+         */
+        TInt GetFilterIndex(void);
+        
+    public: // Functions from base classes
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CConsoleMain();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+        /**
+        * Print error from ConsoleUI.
+        */  
+        void UiError( const TDesC& aInfo );
+        
+        /**
+        * Process command line parameters.
+        */
+        void ProcessCommandlineL( TFileName& aIniFile );
+
+        /**
+        * Parse and search for module info and fill list of modules.
+        */
+        void ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd);
+        
+    public:   //Data
+        RPointerArray<CMenuDialog> iDialogs;
+        
+        TConsoleKey key; 
+        
+    protected:  // Data
+        // None
+
+    private:    // Data
+        //CConsoleBase*       iConsole;       // Pointer to console
+        RConsole iConsole; // Pointer to console
+        TBool 				rConsoleCreated;
+
+        CMenu*              iMainMenu;      // Root menu
+        CMenu*              iCurrentMenu;   // Current menu
+
+        CScrollerTimer*     iScroller;
+        
+        CConsoleReader*     iReader;        // Console reader                   
+    
+        // For starting runnning multiple cases upon start
+        TStartCasesOnStart  iStartCases;
+        HBufC*              iTestModule;
+        HBufC*              iTestModuleIni;
+        HBufC*              iTestCaseFile;
+        TInt                iTestCaseNum;
+        HBufC*              iTestSetName;
+
+        // List of found modules (included from module given in parameters)
+        CTestModuleList*    iModuleList;
+        
+        // List of filters (for test cases title)
+        RPointerArray<TDesC> iFilters;
+        
+        // Chosen filter index
+        TInt iChosenFilterIndex;
+        
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+    
+// DESCRIPTION
+// Read keystrokes from console
+class CConsoleReader
+    :public CActive
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CConsoleReader* NewL( CConsoleMain* aMain, 
+                                     //CConsoleBase* aConsole );
+                                     RConsole* aConsole );
+
+        /**
+        * Start
+        */
+        void StartL();
+
+        /**
+        * Destructor of CConsoleReader.
+        */
+        ~CConsoleReader();
+
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+        /**
+        * RunError derived from CActive handles errors from active object
+        */        
+        virtual TInt RunError(TInt aError);
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+    private:
+
+        /** 
+        * C++ default constructor.
+        */
+        CConsoleReader( CConsoleMain* aMain, 
+                        //CConsoleBase* iConsole );
+                        RConsole* iConsole );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+        //CConsoleBase*   iConsole;   // Pointer to console
+        RConsole*   iConsole;   // Pointer to console
+        CConsoleMain*   iMain;      // Backpointer
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif // CONSOLEUI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/touchconsoleui/src/ConsoleNotify.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,480 @@
+/*
+* 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: This module contains implementation of CMenuNotifier 
+* and CMenuDialog class implementations.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include <f32file.h>
+#include "ConsoleUI.h"
+#include "ConsoleMenus.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+const TInt KDefaultTime = 2;
+
+// MACROS
+#ifndef __WINS__
+  #define GETPTR &
+#else
+  #define GETPTR
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+   
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuNotifier
+
+    Method: NewL
+
+    Description: Constructs new menu notifier
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenuNotifier* CMenuNotifier::NewL( const TDesC& aError, CConsoleMain* aMain )
+    {
+
+    CMenuNotifier* self = new ( ELeave ) CMenuNotifier( aMain );
+    CleanupStack::PushL( self );
+    self->ConstructL( aError );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuNotifier
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenuNotifier::ConstructL( const TDesC& aError )
+    {
+    
+    //TSize size = iMain->GetConsole()->ScreenSize();
+    TSize size;
+    iMain->GetConsole()->Size(size);
+    
+    size.iWidth = Min( size.iWidth - KMenuOverhead, 
+                       aError.Length() );
+    size.iHeight = aError.Length()/size.iWidth + 2;
+    
+    iConsole = Console::NewL( _L("Error note"), size );
+    
+    iConsole->Printf( _L("Error:") );    
+    iConsole->Printf( aError ); 
+    iConsole->Printf( _L("\n") );
+    iConsole->Printf( _L("Press any key") );
+
+    iTimer.CreateLocal();
+
+    CActiveScheduler::Add ( &iCallBack1 );
+    CActiveScheduler::Add ( &iCallBack2 );
+
+    // Get timer
+    iTimer.After( iCallBack1.Activate(), 10000000 );
+
+    // Poll keypresses
+    iConsole->Read ( iCallBack2.Activate() );        
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuNotifier
+
+    Method: CMenuNotifier
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+#pragma warning( disable : 4355 )       // Incomplete this usage
+CMenuNotifier::CMenuNotifier( CConsoleMain* aMain ): 
+    iCallBack1 ( this, GETPTR CMenuNotifier::Run1 ),
+    iCallBack2 ( this, GETPTR CMenuNotifier::Run1 ),
+    iMain( aMain )          
+    {
+    }
+#pragma warning( default : 4355 )
+
+/*
+-------------------------------------------------------------------------------
+e
+    Class: CMenuNotifier
+
+    Method: ~CMenuNotifier
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CMenuNotifier::~CMenuNotifier()
+    {
+
+    delete iConsole;    
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuNotifier
+
+    Method: Run1
+
+    Description: Callback function. Closes dialog
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenuNotifier::Run1()
+    {
+
+    if ( iCallBack1.isCompleted() && iCallBack2.isCompleted() )
+        {
+        // Both callback have been done, delete this object
+        delete this;
+        return;
+        }
+    else
+        {
+        // One callback finished, stop listening anything else
+        iConsole->ReadCancel();
+        iTimer.Cancel();
+        }
+    }  
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: NewL
+
+    Description: Constructs new menu dialog
+
+    Parameters: const TDesC& aMessage: in: Message to dialog
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenuDialog* CMenuDialog::NewL( CConsoleMain* aMain,
+                                const TDesC& aLine1, 
+                                const TDesC& aLine2, 
+                                TInt aTimeInSecs )
+    {
+
+    CMenuDialog* self = new ( ELeave ) CMenuDialog( aMain );
+    CleanupStack::PushL( self );
+    self->ConstructL( aLine1, aLine2, aTimeInSecs );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: const TDesC& aMessage: in: Message to dialog
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenuDialog::ConstructL( const TDesC& aLine1, 
+                              const TDesC& aLine2, 
+                              TInt aTimeInSecs )
+    {
+    
+    //TSize size = iMain->GetConsole()->ScreenSize();
+    TSize size;
+    iMain->GetConsole()->Size(size);
+    
+    size.iWidth = Min( size.iWidth - KMenuOverhead, 
+                       Max( aLine1.Length(), aLine2.Length() ) );
+    size.iHeight = aLine1.Length()/size.iWidth + aLine2.Length()/size.iWidth + 2;
+    
+    iConsole = Console::NewL( _L("Info"), size );
+    
+    if( aLine1.Length() > 0 )
+        {
+        iConsole->Printf( aLine1 );
+        }
+    if( aLine2.Length() > 0 )
+        {
+        iConsole->Printf( _L("\n") );
+        iConsole->Printf( aLine2 );
+        }
+    
+    if( aTimeInSecs == 0 )
+        {
+        aTimeInSecs = KDefaultTime;
+        }
+    iTimer.CreateLocal();
+
+    CActiveScheduler::Add ( &iCallBack1 );
+    // Get timer
+    iTimer.After( iCallBack1.Activate(), aTimeInSecs*1000*1000 );
+           
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: CMenuDialog
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+#pragma warning( disable : 4355 )       // Incomplete this usage
+CMenuDialog::CMenuDialog( CConsoleMain* aMain ):  
+    iMain( aMain ),      
+    iCallBack1 ( this, GETPTR CMenuDialog::Run1 ), 
+    iCallBack2 ( this, GETPTR CMenuDialog::Run1 )
+    {
+    }
+#pragma warning( default : 4355 )
+
+/*
+-------------------------------------------------------------------------------
+e
+    Class: CMenuDialog
+
+    Method: ~CMenuDialog
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CMenuDialog::~CMenuDialog()
+    {
+ 
+    if( iCallBack1.IsActive() )
+        {
+        iTimer.Cancel();
+        iTimer.Close();
+        iCallBack1.Cancel();
+        }
+        
+    if( iCallBack2.IsActive() )
+        {
+        User::RequestComplete( iStatus, KErrCancel );
+		if( iConsole != NULL )
+			{
+			iConsole->ReadCancel();    
+			}
+        iCallBack2.Cancel();
+        }
+        
+    delete iConsole;    
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: Run1
+
+    Description: Callback function. Closes dialog
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenuDialog::Run1()
+    {
+
+    if ( iCallBack2.isCompleted() )
+        {            
+        *iKeyCode = iConsole->KeyCode();
+    
+        User::RequestComplete( iStatus, iCallBack2.Status().Int() );
+        }
+        
+    TInt index = iMain->iDialogs.Find( this );
+    if( index >= 0 )
+        {
+        iMain->iDialogs.Remove( index );
+        }
+    // Timeout, delete this object
+    delete this;
+    return;
+
+    }  
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenuDialog
+
+    Method: WaitForKeypress
+
+    Description: Wait for keypress
+
+    Parameters: None
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CMenuDialog::WaitForKeypress( TKeyCode& aKeyCode, 
+                                   TRequestStatus& aStatus )
+    {
+    
+    aStatus = KRequestPending;
+    iKeyCode = &aKeyCode;
+    iStatus = &aStatus;
+    
+    CActiveScheduler::Add ( &iCallBack2 );
+     
+    // Poll keypresses
+    iConsole->Read( iCallBack2.Activate() );        
+
+    return KErrNone;
+    
+    }  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/touchconsoleui/src/ConsoleUI.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,2282 @@
+/*
+* 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: This module contains implementation of CConsoleMain 
+* and CModule class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include <f32file.h>
+#include <HAL.h>
+#include <hal_data.h>
+
+
+
+#include <stifinternal/UIStoreIf.h>
+
+#include "ConsoleUI.h"
+#include "ConsoleMenus.h"
+
+#include "StifTestInterface.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+_LIT(KNameTxt,"STF");
+_LIT( KConsoleMain, "CConsoleMain" );
+
+// Commandline params
+_LIT( KTestModule,      "-testmodule" );
+_LIT( KTestModuleIni,   "-testmoduleini" );
+_LIT( KTestCaseFile,    "-testcasefile" );
+_LIT( KTestSet,         "-testset" );
+_LIT( KTestRun,         "-run" );
+_LIT( KTestRunAll,      "all" );
+_LIT( KTestRunSeq,      "sequential" );
+_LIT( KTestRunPar,      "parallel" );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+LOCAL_C void MainL();
+
+
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: NewL
+
+    Description: Construct the console main class
+
+    Parameters: None
+
+    Return Values: CConsoleMain*                    New object
+
+    Errors/Exceptions: Leaves if memory allocation fails or
+                       ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleMain* CConsoleMain::NewL( )
+    {
+
+    CConsoleMain* self = new ( ELeave ) CConsoleMain();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Construct the console
+    Construct module and case containers
+    Retrieve command line parameters
+    Connect to test engine
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation fails or fileserver or
+                       test engine can't be connected.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::ConstructL( )
+    {
+    _LIT( KEnableMaximised,  "+Maximised" );
+    //_LIT( KDisableMaximised, "-Maximised" );
+    _LIT( KEnableInform,     "+Inform" );
+    //_LIT( KDisableInform,    "-Inform" );
+    _LIT( KEnableRaw,        "+Raw" );
+    //_LIT( KDisableRaw,       "-Raw" );
+    _LIT( KEnablePointer,    "+Pointer" );
+    //_LIT( KDisablePointer,   "-Pointer" );
+    //_LIT( KDescription,   "-Pointer" );
+    
+    CUIStoreIf::ConstructL();
+
+    rConsoleCreated = false;
+    // Construct the console
+    //iConsole = Console::NewL( KNameTxt,
+    //                         TSize( KConsFullScreen, KConsFullScreen ) );
+ 
+    TInt ret = iConsole.Create(); 
+    
+    if(ret != KErrNone)
+    	{
+    	RDebug::Print(_L("Could not create console, err = (%d)"), ret);
+    	User::Leave(ret);
+    	}
+    
+    rConsoleCreated = true;
+    
+    ret = iConsole.Init(KNameTxt, TSize( KConsFullScreen, KConsFullScreen ));
+    if(ret != KErrNone)
+    	{
+    	RDebug::Print(_L("Could not initialize console, err = (%d)"), ret);
+    	User::Leave(ret);
+    	}
+    
+    ret = iConsole.Control( KEnableMaximised );
+    if(ret != KErrNone)
+    	{
+    	RDebug::Print(_L("Could not initialize console controls(+Maximised), err = (%d)"), ret);
+    	User::Leave(ret);
+    	}
+    ret = iConsole.Control( KEnableInform );
+    if(ret != KErrNone)
+        	{
+        	RDebug::Print(_L("Could not initialize console controls(+Inform), err = (%d)"), ret);
+        	User::Leave(ret);
+        	}
+    ret = iConsole.Control( KEnablePointer );
+    if(ret != KErrNone)
+        	{
+        	RDebug::Print(_L("Could not initialize console controls(+Pointer), err = (%d)"), ret);
+        	User::Leave(ret);
+        	}
+    ret = iConsole.Control( KEnableRaw );
+    if(ret != KErrNone)
+        	{
+        	RDebug::Print(_L("Could not initialize console controls(+Raw), err = (%d)"), ret);
+        	User::Leave(ret);
+        	}
+    
+    
+
+    RDebug::Print(_L("Creating module list object"));
+    TRAPD(err, iModuleList = CTestModuleList::NewL(NULL));
+    if(err != KErrNone)
+        {
+        RDebug::Print(_L("Could not create module list (%d)"), err);
+        UiError(_L("Could not create module list (err)"));
+        User::Leave(err);
+        }
+    if(!iModuleList)
+        {
+        RDebug::Print(_L("Could not create module list (NULL)"));
+        UiError(_L("Could not create module list (NULL)"));
+        User::Leave(KErrGeneral);
+        }
+
+    // Get command line parameters
+    TFileName iniFile; // TestFramework initialization file
+                    
+    ProcessCommandlineL( iniFile );
+
+    if(iTestModule)
+        {
+        // Add to module list info about module taken from command line
+        RDebug::Print(_L("Adding command line module to list"));
+        TName moduleName;
+        moduleName.Copy(iTestModule->Des());
+        moduleName.LowerCase();
+        err = iModuleList->AddTestModule(moduleName);
+        if(err != KErrNone && err != KErrAlreadyExists)
+            {
+            RDebug::Print(_L("Could not add module to list of modules (%d)"), err);
+            UiError(_L("Could not add module to list of modules (err)"));
+            User::Leave(err);
+            }
+
+        //Get added module
+        CTestModuleInfo* moduleInfo = iModuleList->GetModule(moduleName);
+        if(!moduleInfo)
+            {
+            RDebug::Print(_L("Could not add get module info from list"));
+            UiError(_L("Could not add get module info from list"));
+            User::Leave(KErrGeneral);
+            }
+
+        //Add ini file if given
+        if(iTestModuleIni && iTestModuleIni->Length() > 0)
+            {
+            TFileName filename;
+            filename.Copy(iTestModuleIni->Des());
+            filename.LowerCase();
+            moduleInfo->SetIniFile(filename);
+            }
+
+        //Add config file if given
+        if(iTestCaseFile && iTestCaseFile->Length() > 0)
+            {
+            TFileName filename;
+            filename.Copy(iTestCaseFile->Des());
+            filename.LowerCase();
+            moduleInfo->AddCfgFile(filename);
+            }
+
+        //Now check all config files if there are included modules
+        _LIT(KIncludeModuleStart, "[New_Include_Module]");
+        _LIT(KIncludeModuleEnd, "[End_Include_Module]");
+
+        RDebug::Print(_L("Start parsing included modules"));
+        CTestCaseFileInfo* finfo = iModuleList->GetUncheckedCfgFile();
+        while(finfo)
+            {
+            TFileName fname;
+            finfo->GetCfgFileName(fname);
+
+            RDebug::Print(_L("Checking file: '%S'"), &fname);
+            finfo->SetChecked();
+
+            CStifParser* parser = NULL;
+ 
+            TRAP(err, parser = CStifParser::NewL(_L(""), fname));
+            if(err != KErrNone)
+                {
+                RDebug::Print(_L("Could not create parser to read content of config file (%d)"), err);
+                UiError(_L("Could not create parser to read content of config file (err)"));
+                User::Leave(err);
+                }
+            CleanupStack::PushL(parser);
+
+            ParseTestModulesL(parser, iModuleList, KIncludeModuleStart, KIncludeModuleEnd);
+
+            CleanupStack::PopAndDestroy(parser);
+            finfo = iModuleList->GetUncheckedCfgFile();
+            }
+        RDebug::Print(_L("End parsing included modules"));
+        }
+
+    //iConsole->Printf(_L("\nTest Framework starting\n"));
+    iConsole.Write(_L("\nTest Framework starting\n"));
+
+    // CUIStore open
+    User::LeaveIfError( UIStore().Open( iniFile ) );
+    
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: CConsoleMain
+
+    Description: Constructor.
+    Initialize non-zero member variables.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleMain::CConsoleMain( ):iStartCases( EStartCaseNo )
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ~CConsoleMain
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleMain::~CConsoleMain( )
+    {	
+
+    iDialogs.ResetAndDestroy();
+    iDialogs.Close();
+ 
+    // CUIStore close
+    UIStore().Close();
+    
+    delete iReader;
+    iReader = NULL;
+    
+	delete iScroller;
+	iScroller = NULL;
+    
+    //delete iConsole;
+    //iConsole = NULL;
+	if(rConsoleCreated){
+		iConsole.Destroy();
+	}
+    delete iMainMenu;
+    iMainMenu = NULL;
+
+    delete iTestModule;
+    iTestModule = 0;
+    
+    delete iTestModuleIni;
+    iTestModuleIni = 0;
+    
+    delete iTestCaseFile;
+    iTestCaseFile = 0;
+    
+    delete iTestSetName;
+    iTestSetName = 0;
+
+    delete iModuleList;
+    iModuleList = 0;
+    
+    iFilters.ResetAndDestroy();
+    iFilters.Close();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ProcessCommandlineL
+
+    Description: Process commandline parameters.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves on error.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::ProcessCommandlineL( TFileName& aIniFile )
+    {
+
+	User me;
+    TInt lineLength = me.CommandLineLength();
+    HBufC* lineBuf = HBufC::NewLC( lineLength );
+    TPtr line( lineBuf->Des() );
+    TBool firstTime = ETrue;
+    TInt offset = 0;
+    TPtrC param;
+    TChar c;
+    
+    me.CommandLine( line );
+    TLex lex( line );
+    
+    while( offset < lineLength )
+        {    
+        // Get first charecter of the parameter
+        lex.SkipSpace();
+        c = lex.Peek();
+        if( c == 0 )
+            {
+            // End of line
+            break;
+            }
+        
+        // Get the whole parameter 
+        param.Set( lex.NextToken() );
+        if( firstTime )
+            {
+            // Filebrowser workaround. It gives the exe name as command line param
+            // verify that it is not the same as the executable name
+            //@spe TFileName exePath = me.FileName();
+			TFileName exePath = RProcess().FileName();
+            if ( param == exePath )
+                {
+                // Discard command line parameters when using filebrowser
+                break;
+                }
+
+            firstTime = EFalse;
+            }
+        // Check if -param option
+        if( c == '-' )
+            {
+            // This is option
+            if( param == KTestModule )
+                {
+                // Get test module name
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test module name not given"));
+                    break;
+                    }
+                if( param.Length() > KMaxName )
+                    {
+                    UiError( _L("Test module name too long"));
+                    break;
+                    }
+                iTestModule = param.AllocL();
+                }
+            else if( param == KTestModuleIni )
+                {
+                // Get test module initialization file
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test module initialization file name not given"));
+                    break;
+                    }
+                if( param.Length() > KMaxFileName )
+                    {
+                    UiError( _L("Test module initialization file name too long"));
+                    break;
+                    }
+                TFileName tmpTestModuleIni( param );
+                TStifUtil::CorrectFilePathL( tmpTestModuleIni );
+                iTestModuleIni = tmpTestModuleIni.AllocL();
+                }
+            else if( param == KTestCaseFile )
+                {
+                // Get test case file name
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test case file name not given"));
+                    break;
+                    }
+                if( param.Length() > KMaxFileName )
+                    {
+                    UiError( _L("Test case file name too long"));
+                    break;
+                    }
+                TFileName tmpTestCaseFile( param );
+                TStifUtil::CorrectFilePathL( tmpTestCaseFile );
+                iTestCaseFile = tmpTestCaseFile.AllocL();
+                }
+            else if( param == KTestSet )
+                {
+                // Get test set name
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test set name not given"));
+                    break;
+                    }
+                if( param.Length() > KMaxFileName )
+                    {
+                    UiError( _L("Test set name too long"));
+                    
+                    break;
+                    }
+                iTestSetName = param.AllocL();
+                }
+            else if( param == KTestRun )
+                {
+                if( iStartCases )
+                    {
+                    UiError( _L("Only one -run option allowed") );
+                    // Do not start anything
+                    iStartCases = EStartCaseNo;
+                    break;
+                    }
+                // Get run type
+                lex.Mark();
+                param.Set( lex.NextToken() );
+                if( param.Length() == 0 )
+                    {
+                    UiError( _L("Test set name not given"));
+                    break;
+                    }
+                if( ( param == KTestRunAll ) ||
+                    ( param == KTestRunSeq ) )
+                    {
+                    iStartCases = EStartCasesSeq;
+                    }
+                else if( param == KTestRunPar )
+                    {
+                    iStartCases = EStartCasesPar;
+                    }
+                else
+                    {
+                    lex.UnGetToMark();
+                    lex.SkipSpace();
+                    if( lex.Val( iTestCaseNum ) != KErrNone )
+                        { 
+                        UiError( _L("Unknown run type given, valid values are all/sequential/parallel/test case number"));
+                        }
+                    else
+                        {
+                        iStartCases = EStartSingleCase;
+                        }    
+                    break;
+                    }
+                }            
+            }
+        else 
+            {
+            // This is Test Framework ini file
+            aIniFile = param;
+            TStifUtil::CorrectFilePathL( aIniFile );
+            // ini file is last option
+            break;
+            }
+        
+        }
+      
+    CleanupStack::PopAndDestroy( lineBuf );
+
+    }
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: Panic
+
+    Description: Console UI panic function
+
+    Parameters: TInt
+
+    Return Values: 
+
+    Errors/Exceptions: Does not return.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::Panic(TConsoleUIPanic aPanic )
+    {
+        
+    User::Panic (_L("STIF TestFramework Console UI panic"), aPanic );
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: StartL
+
+    Description: Construct menu objects and start the menu handling
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions:
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CConsoleMain::StartL()
+    {
+    
+    // Construct keystroke reader
+    iReader           = CConsoleReader::NewL( this, &iConsole );
+
+    // Construct the main menu
+    TInt majorV;
+    TInt minorV;
+    TInt buildV;
+    TBuf<30> relDate;
+    TStifUtil::STIFVersion(majorV, minorV, buildV, relDate);
+    
+    TBuf<128> version;
+    version.Format(_L("STF v%d.%d.%d - "), majorV, minorV, buildV);
+    version.Append(relDate);
+    version.Append(_L("\n"));
+    iMainMenu = CMainMenu::NewL( this, NULL, _L("Main menu"), version );
+
+    // Add the case menu
+    CMenu* caseMenu   = CMenu::NewL( this, iMainMenu, _L("Case menu") );
+    iMainMenu->AddItemL ( caseMenu );
+
+    // Add the module menu
+    CMenu* moduleMenu = CModuleListView::NewL( this, iMainMenu, _L("Module menu") );
+    iMainMenu->AddItemL ( moduleMenu );
+
+    // Add test set menu
+    CTestSetMenu* testSetMenu = CTestSetMenu::NewL( this, iMainMenu, _L("Test set menu") );
+    iMainMenu->AddItemL ( testSetMenu );
+ 
+    // Construct the case menus
+    CMenu* casestart  = NULL;
+    CMenu* casestartshow  = NULL;
+    
+    // Load filters
+    UIStore().ReadFiltersL(iFilters);
+    
+    // If there are no filters defined, then construct menu without filter's menu
+    if(iFilters.Count() == 0)
+        {
+        casestart = CCaseStartMenu::NewL(this, caseMenu, _L("Start new case"));
+        caseMenu->AddItemL(casestart);
+    CMenu* casestartshow  = NULL;
+        casestartshow = CCaseStartMenu::NewL(this, caseMenu, _L("Start & show output"), ETrue);
+        caseMenu->AddItemL(casestartshow);
+        }
+    else // if there are filters defined, create also filter's menu
+        {
+        CFilterMenu* filtercasestart = NULL;
+        CFilterMenu* filtercasestartshow = NULL;
+        
+        filtercasestart = CFilterMenu::NewL(this, caseMenu, _L("Start new case (filter)"));
+        caseMenu->AddItemL(filtercasestart);
+        casestart = CCaseStartMenu::NewL(this, caseMenu, _L("Start new case"));
+        filtercasestart->SetTestCaseMenu(casestart);
+        
+        filtercasestartshow = CFilterMenu::NewL(this, caseMenu, _L("Start & show output (filter)"));
+        caseMenu->AddItemL(filtercasestartshow);
+        casestartshow = CCaseStartMenu::NewL(this, caseMenu, _L("Start & show output"), ETrue);
+        filtercasestartshow->SetTestCaseMenu(casestartshow);
+        }
+
+	CMultipleCaseMenu* multicasestart =
+	    CMultipleCaseMenu::NewL (this, caseMenu, _L("Run multiple tests") );
+    caseMenu->AddItemL( multicasestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Ongoing cases"), 
+        CUIStoreIf::EStatusRunning );
+    caseMenu->AddItemL( casestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Executed cases"), 
+        CUIStoreIf::EStatusExecuted );
+    caseMenu->AddItemL( casestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Passed cases"), 
+        CUIStoreIf::EStatusPassed );
+    caseMenu->AddItemL( casestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Failed cases"), 
+        CUIStoreIf::EStatusFailed );
+    caseMenu->AddItemL( casestart );
+    casestart = CCaseMenu::NewL ( this, caseMenu, _L("Aborted/Crashed cases"), 
+        ( CUIStoreIf::EStatusAborted | CUIStoreIf::EStatusCrashed) );
+    caseMenu->AddItemL( casestart );
+    //Add "test set choice" menu
+    CTestSetChoiceMenu* testChoiceMenu = CTestSetChoiceMenu::NewL( this, testSetMenu, _L("Load test set") );
+ 	testSetMenu->AddItemL( testChoiceMenu );
+
+    // Start stuff according to command line parameters
+    if( iTestSetName )
+        { 
+        // Set test set name
+        testSetMenu->SetTestSetFileName( iTestSetName->Des() );
+        
+        // Load test set
+        if( UIStore().LoadTestSet( iTestSetName->Des() ) != KErrNone )
+ 	       {
+           UiError( _L("Test set loading failed"));
+           }
+        else 
+           {
+           // Inform test set menu that set is loaded
+           testSetMenu->SetCreated();
+    
+            // Check if test set should be started
+    	    if( ( iStartCases == EStartCasesPar ) || 
+    	    	( iStartCases == EStartCasesSeq ))         	
+            	{
+            
+	            // Check set starting type
+    	    	CStartedTestSet::TSetType setType = 
+       	        CStartedTestSet::ESetSequential;
+       	        
+                if( iStartCases == EStartCasesPar )
+                    {
+                    setType = 
+                        CStartedTestSet::ESetParallel;
+                    }
+                    
+                // Start test set
+                RRefArray<CTestSetInfo> setInfos;
+                TInt ret = UIStore().TestSets( setInfos );
+                if( (  ret != KErrNone ) ||
+                    ( setInfos.Count() != 1 ) )
+                    {
+                    // Should never ever happen
+                    User::Panic( KConsoleMain, KErrGeneral );
+                    }
+                
+                const CTestSetInfo& set = setInfos[0];
+                setInfos.Reset();
+                setInfos.Close();
+                
+                TInt index;
+                ret = UIStore().StartTestSet( set, index, setType );
+                if( ret != KErrNone )
+                    {
+                    UiError( _L("Test set starting failed") );
+                    }
+                } 
+            }
+        delete iTestSetName;
+        iTestSetName = 0;     
+        }
+    if( iTestModule )
+        {
+        TPtrC module( iTestModule->Des() ); 
+
+        // Add all test modules and config files
+        RDebug::Print(_L("Start creating test modules"));
+        CTestModuleInfo* moduleInfo = NULL;
+        TInt i;
+        TInt modCnt = iModuleList->Count();
+        TInt ret;
+
+        for(i = 0; i < modCnt; i++)
+            {
+            RDebug::Print(_L("Processing module"));
+            // Get module
+            moduleInfo = iModuleList->GetModule(i);
+            if(!moduleInfo)
+                {
+                RDebug::Print(_L("Could not get module info at index %d"), i);
+                continue;
+                }
+
+            // Get module name
+            TName moduleName;
+            moduleInfo->GetModuleName(moduleName);
+            RDebug::Print(_L("module name: '%S'"), &moduleName);
+
+            // Get ini file, if exists
+            TFileName ini;
+            moduleInfo->GetIniFileName(ini);
+            if(ini.Length() == 0)
+                {
+                RDebug::Print(_L("ini file not found"));
+                }
+            else
+                {
+                RDebug::Print(_L("ini file: '%S'"), &ini);
+                }
+
+            // Create test module
+            RDebug::Print(_L("Adding module to UI store"));
+            ret = UIStore().AddTestModule(moduleName, ini);
+            if(ret != KErrNone && ret != KErrAlreadyExists)
+                {
+                RDebug::Print(_L("Test module adding failed (%d)"), ret);
+                UiError(_L("Test module adding failed"));
+                continue;
+                }
+
+            //Add test case files
+            TInt cfgCnt = moduleInfo->CountCfgFiles();
+            TInt j;
+            TFileName cfgFile;
+            for(j = 0; j < cfgCnt; j++)
+                {
+                moduleInfo->GetCfgFileName(j, cfgFile);
+                if(cfgFile.Length() > 0)
+                    {
+                    RDebug::Print(_L("config file: '%S'"), &cfgFile);
+
+                    ret = UIStore().AddTestCaseFile(moduleName, cfgFile);
+                    if(ret != KErrNone)
+                        {
+                        // Log error
+                        RDebug::Print(_L("Test case file adding failed (%d)"), ret);
+                        UiError(_L("Test case file adding failed"));
+                        continue;
+                        }
+                    }
+                else
+                    {
+                    RDebug::Print(_L("Got empty cfg file"));
+                    }
+                }
+            if(cfgCnt == 0)
+                {
+                RDebug::Print(_L("cfg file not found"));
+                }
+
+            RDebug::Print(_L("Module '%S' processed correctly"), &moduleName);
+            }
+
+        RDebug::Print(_L("End creating test modules"));
+
+        if( ( iStartCases == EStartCasesPar ) ||
+            ( iStartCases == EStartCasesSeq ) )
+            {
+            // Start running
+            CMultipleBaseMenu::TRunType runType = 
+                CMultipleBaseMenu::ERunSequential;
+            if( iStartCases == EStartCasesPar )
+                {
+                runType = CMultipleBaseMenu::ERunParallel;
+                }
+            TRAPD( err,
+                //multicasestart->StartRunningL( runType, module, file );
+                multicasestart->StartRunningL(runType, KNullDesC, KNullDesC);
+                );
+            if( err != KErrNone )
+                {
+                UiError( _L("Stating test cases failed") );
+                }
+            }
+        else if( iStartCases == EStartSingleCase )
+            {
+            // Get test case
+            RRefArray<CTestInfo> testCases;
+            //ret = UIStore().TestCases( testCases, module, file );
+            ret = UIStore().TestCases(testCases, KNullDesC, KNullDesC);
+            if( ret == KErrNone )
+                {
+                if( ( iTestCaseNum < 0 ) ||
+                    ( iTestCaseNum >= testCases.Count() ) )
+                    {
+                    ret = KErrNotFound;
+                    }
+                else
+                    {         
+                    TInt index;           
+                    // Start single test case
+                    ret = UIStore().StartTestCase( testCases[iTestCaseNum], index );
+                    }                                       
+                }
+            testCases.Reset();       
+            testCases.Close();
+            if( ret != KErrNone )
+                {
+                UiError( _L("Starting test case failed"));        
+                }
+            }
+
+        delete iTestCaseFile;
+        iTestCaseFile = 0;
+        delete iTestModuleIni;
+        iTestModuleIni = 0;
+        delete iTestModule;
+        iTestModule = 0;
+        }
+        
+    iStartCases = EStartCaseNo;
+    
+    // Load testcase if some stored 
+    UIStore().LoadSavedTestCases();
+           
+	iScroller = CScrollerTimer::NewL ( this );
+	iScroller->StartL();	
+
+    // Print the main menu
+    iCurrentMenu = iMainMenu;
+    iCurrentMenu->PrintMenuL( CMenu::EMenuPrint );
+
+    // Start to process keyboard events
+    iReader->StartL();
+    
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: KeyPressed
+
+    Description: Process keyboard events. Print new menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if SelectL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::KeyPressed()
+    {
+
+    TBool cont = ETrue;
+
+    // Read the key
+   // TKeyCode key = iConsole->KeyCode();
+    
+    TKeyCode key = mapKey();
+    if(key == EKeyNull)
+    	{
+    	iReader->StartL();
+    	return;
+    	}
+//    TKeyCode key = EKeyDownArrow; //TODO
+    CMenu* tmp = iCurrentMenu;
+
+    // Let the menu handle the key press
+    TRAPD( err, 
+        iCurrentMenu = iCurrentMenu->SelectL( key, cont );
+        );
+    if( err != KErrNone )
+        {
+        User::InfoPrint( 
+            _L("Processing keystroke failed") );  
+        }
+            
+    if ( iCurrentMenu == NULL )
+        {
+        iCurrentMenu = tmp;
+        }
+
+   // If "not-exit" key pressed, continue
+    if ( cont )
+        {
+
+        // Either only update old menu or new menu.
+        if ( tmp == iCurrentMenu )
+            {
+            TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ); );
+            }
+        else
+            {
+            TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuPrint ); )
+            }
+        
+        if( err != KErrNone )
+            {
+            if ( err == KErrNoMemory )
+            	{            	
+            	ExitWithNoMemoryErrorMessage();                
+            	}
+            else
+            	{
+	            User::InfoPrint( 
+	                _L("Printing menu failed") );
+            	}
+            }
+
+        // Enable keystrokes
+        iReader->StartL();
+
+        }
+    else
+        {
+        // "Exit", stop scheduler and exit
+        CActiveScheduler::Stop();
+        }
+
+    }
+
+
+TKeyCode CConsoleMain::mapKey()
+	{
+	TInt event   = key.Type();
+	TInt keyCode = key.Code();
+	
+	if( event == TRawEvent::EButton1Down )
+		{
+		TInt ret;
+		//displayXPixels contains X of screen resolution
+		TInt displayXPixels;    
+		//retrieve EDisplayXPixels value of this phone
+		ret = HAL::Get( HALData::EDisplayXPixels, displayXPixels );
+		 
+		//displayYPixelscontains Y of screen resolution
+		TInt displayYPixels;    
+		//retrieve EDisplayYPixels value of this phone
+		ret =HAL::Get( HALData::EDisplayYPixels, displayYPixels );
+		
+		if(ret != KErrNone)
+			{
+			UiError( _L("Unable to get screen resolution"));
+			}
+		
+	//if(keyCode ==EKeyEnter )
+		TPoint currPos = key.MousePos();	
+		if(currPos.iY < ((displayYPixels/2)-(displayYPixels*0.3)) && currPos.iX < (displayXPixels -(displayXPixels*0.2)) && currPos.iX >(displayXPixels*0.3) )
+			{
+			return EKeyUpArrow;
+			}
+		else if(currPos.iY > (displayYPixels/2+(displayYPixels*0.3))&& currPos.iX < (displayXPixels -(displayXPixels*0.2)) && currPos.iX >(displayXPixels*0.3))
+			{
+			return EKeyDownArrow;
+			}
+		if(currPos.iX < ((displayXPixels/2)-(displayXPixels*0.3)) && currPos.iY < (displayYPixels -(displayYPixels*0.2)) && currPos.iY >(displayYPixels*0.3) )
+			{
+			return EKeyLeftArrow;
+			}
+		else if(currPos.iX > (displayXPixels/2+(displayXPixels*0.3))&& currPos.iY < (displayYPixels -(displayYPixels*0.2)) && currPos.iY >(displayYPixels*0.3))
+			{
+			return EKeyRightArrow;
+			}
+		
+		
+		}
+	else if (event == TRawEvent::EKeyDown)
+		{
+		 switch (keyCode) 
+			{
+			case 16:
+				return EKeyUpArrow;
+			case 17:
+				return EKeyDownArrow;
+			case 15:
+				return EKeyRightArrow;
+			case 14:
+				return EKeyLeftArrow;
+			case 851971:
+				return EKeyEnter;
+			case 4:
+				return EKeyEscape;
+				
+			// Additional keys
+			case 180: 
+				return EKeyHome;
+							
+			default:
+				return EKeyNull;
+
+			}
+		}
+	return EKeyNull;
+	}
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ExitWithNoMemoryErrorMessage
+
+    Description: Displays no memory error message and closes ConsoleUI
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::ExitWithNoMemoryErrorMessage()
+	{
+    // "Exit", stop scheduler and exit
+    CActiveScheduler::Stop();
+
+    _LIT( KErrorTitle, "Error:\n" );
+    _LIT( KErrorMessage, "Test cases execution have been stopped. ConsoleUI does not have enough memory to store information about executed test cases.  Results of executed test cases can be found in TestReport file. ConsoleUI will be closed now." );
+    _LIT( KErrorPressAnyKey, "\n\nPress any key" );
+    
+//    TSize size = GetConsole()->ScreenSize();
+    TSize size;
+    GetConsole()->Size(size);
+    size.iWidth = Min( size.iWidth - KMenuOverhead, 
+                       KErrorMessage().Length() );
+    size.iHeight = ( KErrorTitle().Length() + KErrorMessage().Length() + 
+    				 KErrorPressAnyKey().Length() ) / size.iWidth + 3;
+    
+    CConsoleBase* console = NULL;
+    TRAPD( err, console = Console::NewL( _L("Error note"), size ) );
+    if ( err != KErrNone )
+    	{
+    	// We can't create console, exit without displaying error message
+    	return;
+    	}
+    
+    console->Printf( KErrorTitle );    
+    console->Printf( KErrorMessage ); 
+    console->Printf( KErrorPressAnyKey );
+        
+    console->Getch();
+    
+    delete console;    
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: UiError
+
+    Description: Function is called when UI hit an error.
+    
+    Parameters: const TDesC& aInfo: in: information
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+void CConsoleMain::UiError( const TDesC& aInfo )
+    {
+    
+    // Error note deletes itself when it completes
+    CMenuNotifier::NewL( aInfo, this );
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: Update
+
+    Description: Receives output update notification from CUIStore.
+    
+    Parameters: CStartedTestCase* aTestCase: in: Test case information
+                TInt aFlags: in: Update reason flags
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::Update( CStartedTestCase* aTestCase, TInt aFlags )
+    {
+    
+   	TInt err( KErrNone );
+    
+    // First check if some menu should be signaled 
+    if( ( aFlags & CUIStoreIf::EStatusExecuted ) &&
+        ( aTestCase->iBackPtr ) )
+        {
+        CMenu* menu = ( CMenu* )aTestCase->iBackPtr;
+        TRAP( err, 
+            menu->SignalL( aTestCase ); 
+            );            
+        }
+
+    // Update console if needed
+    if( iCurrentMenu && ( iCurrentMenu->Type() & aFlags ) )
+        {
+        if( aFlags & CUIStoreIf::EPrintUpdate )
+            {
+            CCaseExecutionView* view = 
+                ( CCaseExecutionView* )iCurrentMenu;
+            if( view->TestCase() == aTestCase )
+                {
+                TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ) );
+                }
+            }
+        else
+            {
+            TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ); )
+            }
+        }
+    
+    	if ( err != KErrNone )
+    		{
+    		if ( err == KErrNoMemory )
+    			{
+    			ExitWithNoMemoryErrorMessage();
+    			}
+    		}
+    
+    }
+                                                              
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: Error
+
+    Description: Function is called when test framework prints error.
+    
+    Parameters: TErrorNotification& aError: in: Error description
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+void CConsoleMain::Error( TErrorNotification& aError )
+    {
+    
+    // Error note deletes itself when it completes
+    CMenuNotifier::NewL( aError.iText, this );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: PopupMsg
+
+    Description: Function is called when testframework 
+        wants to print a popup window.
+    
+    Parameters: TDesC& aMsg: in: message
+                
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+TInt CConsoleMain::PopupMsg( const TDesC& aLine1, 
+                             const TDesC& aLine2, 
+                             TInt aTimeInSecs )
+    {
+    
+    TInt ret = KErrNone;
+    
+    CMenuDialog* dialog = NULL;
+
+    TRAP( ret, dialog = CMenuDialog::NewL( this, aLine1, aLine2, aTimeInSecs ); );
+
+    if( ret == KErrNone )
+        {
+        iDialogs.Append( dialog ); 
+        return (TInt)dialog;
+        }
+
+    return ret;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: PopupMsg
+
+    Description: Function is called when testframework 
+        wants to print a popup window.
+    
+    Parameters: TDesC& aMsg: in: message
+                
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+TInt CConsoleMain::PopupMsg( const TDesC& aLine1, 
+                             const TDesC& aLine2, 
+                             TInt aTimeInSecs,
+                             TKeyCode& aKey,
+                             TRequestStatus& aStatus )
+    {
+    
+    TInt ret = PopupMsg( aLine1, aLine2, aTimeInSecs );
+    if( ret < 0 )
+        {
+        return ret;
+        }    
+        
+    CMenuDialog* dialog = (CMenuDialog*) ret; 
+    ret = dialog->WaitForKeypress( aKey, aStatus );
+
+    return (TInt) dialog;
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: Close
+
+    Description: Close instance.
+    
+    Parameters: TInt aHandle: in: handle to open instance.                
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::Close( TInt aHandle )
+    {
+    
+    if( aHandle < 0 )
+        {
+        return;
+        }
+    CMenuDialog* dialog = (CMenuDialog*) aHandle;
+    TInt index = iDialogs.Find( dialog );
+    if( index >= 0 )
+        {
+        delete dialog;
+        iDialogs.Remove( index );
+        }
+        
+    }
+           
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: GetConsole
+
+    Description: Returns the console
+
+    Parameters: None
+
+    Return Values: CConsoleBase*                    Console
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+//CConsoleBase* CConsoleMain::GetConsole()
+RConsole* CConsoleMain::GetConsole()
+    {
+
+    return &iConsole;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: TimerUpdate
+
+    Description: Updates current menu from timer
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::TimerUpdate()
+    {
+
+	iCurrentMenu->TimerUpdate();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: ParseTestModulesL
+
+    Description: Parse and search for module info and fill list of modules.
+
+    Parameters: CStifParser*     aParser:       in: CStifParser object
+                CTestModuleList* aModuleList:   in: list of modules
+                TPtrC&           aSectionStart: in: descriptor with start of section string
+                TPTrC&           aSectionEnd:   in: descriptor with end of section string
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if some of called leaving methods leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd)
+    {
+    //First let's find all modules given in Stif's ini file and store that info in CTestModuleList object
+    CStifSectionParser* sectionParser = NULL;
+    CStifItemParser* item = NULL;
+
+    sectionParser = aParser->SectionL(aSectionStart, aSectionEnd);
+
+    while(sectionParser)
+        {
+        RDebug::Print(_L("Found '%S' and '%S' sections"), &aSectionStart, &aSectionEnd);
+        CleanupStack::PushL(sectionParser);
+        RDebug::Print(_L("Starting to read module information"));
+
+        // Get name of module
+        _LIT(KModuleName, "ModuleName=");
+        item = sectionParser->GetItemLineL(KModuleName);
+        CleanupStack::PushL(item);
+        if(!item)
+            {
+            CleanupStack::PopAndDestroy(item);
+            UiError(_L("Line not found from module section"));
+            User::Leave(KErrGeneral);
+            }
+        else
+            {
+            RDebug::Print(_L("'%S' found"), &KModuleName);
+            }
+
+        TPtrC name;
+        TName moduleName;
+        TInt ret(KErrNone);
+        ret = item->GetString(KModuleName, name);
+        if(ret != KErrNone)
+            {
+            CleanupStack::PopAndDestroy(item);
+            RDebug::Print(_L("Module name parsing left with error (%d)"), ret);
+            UiError(_L("Module name parsing left with error (err)"));
+            User::Leave(ret);
+            }
+        else
+            {
+            RDebug::Print(_L("Module '%S' found from ini-file"), &name);
+            moduleName.Copy(name);
+            moduleName.LowerCase();
+            ret = aModuleList->AddTestModule(moduleName);
+            if(ret != KErrNone && ret != KErrAlreadyExists)
+                {
+                RDebug::Print(_L("Could not add module to list of modules (%d)"), ret);
+                UiError(_L("Could not add module to list of modules (err)"));
+                User::Leave(ret);
+                }
+            }
+        CleanupStack::PopAndDestroy(item);
+
+        //Get pointer to added module
+        CTestModuleInfo* moduleInfo = aModuleList->GetModule(moduleName);
+        if(!moduleInfo)
+            {
+                RDebug::Print(_L("Could not add get module info from list"));
+                UiError(_L("Could not add get module info from list"));
+                User::Leave(KErrNotFound);
+            }
+
+        // Get ini file, if it exists
+        RDebug::Print(_L("Start parsing ini file"));
+        _LIT(KIniFile, "IniFile=");
+        item = sectionParser->GetItemLineL(KIniFile);
+        if(item)
+            {
+            RDebug::Print(_L("'%S' found"), &KIniFile);
+            CleanupStack::PushL(item);
+            TPtrC iniFile;
+            ret = item->GetString(KIniFile, iniFile);
+            if(ret == KErrNone)
+                {
+                RDebug::Print(_L("Initialization file '%S' found, file can be empty"), &iniFile);
+                TFileName filename;
+                filename.Copy(iniFile);
+				TStifUtil::CorrectFilePathL(filename);
+                filename.LowerCase();
+                moduleInfo->SetIniFile(filename);
+                }
+            else
+                {
+                RDebug::Print(_L("Initialization file not found"));
+                }
+            CleanupStack::PopAndDestroy(item);
+            }
+        else
+            {
+            RDebug::Print(_L("'%S' not found"), &KIniFile);
+            }
+
+        // Get config (testcase) file
+        RDebug::Print(_L("Start parsing cfg files"));
+        TPtrC cfgTag;
+        for(TInt i = 0; i < 2; i++)
+            {
+            //Set tag for config files
+            if(i == 0)
+                {
+                cfgTag.Set(_L("ConfigFile="));
+                }
+                else
+                {
+                cfgTag.Set(_L("TestCaseFile="));
+                }
+            //Read data
+            item = sectionParser->GetItemLineL(cfgTag);
+            while(item)
+                {
+                CleanupStack::PushL(item);
+                RDebug::Print(_L("Item '%S' found"), &cfgTag);
+                TPtrC cfgFile;
+                ret = item->GetString(cfgTag, cfgFile);
+                if(ret == KErrNone)
+                    {
+                    RDebug::Print(_L("Configuration file '%S' found"), &cfgFile);
+                    TFileName ifile;
+                    ifile.Copy(cfgFile);
+					TStifUtil::CorrectFilePathL(ifile);
+                    ifile.LowerCase();
+                    moduleInfo->AddCfgFile(ifile);
+                    }
+                else
+                    {
+                    RDebug::Print(_L("Configuration file not found"));
+                    }
+                CleanupStack::PopAndDestroy(item);
+                item = sectionParser->GetNextItemLineL(cfgTag);
+                }
+            }
+
+        RDebug::Print(_L("Module '%S' information read correctly"), &moduleName);
+
+        // Get next section
+        CleanupStack::PopAndDestroy(sectionParser);
+        sectionParser = aParser->NextSectionL(aSectionStart, aSectionEnd);
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: GetMainMenu
+
+    Description: Return main menu of console.
+
+    Parameters: None
+
+    Return Values: CMainMenu*  pointer to main menu
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CMainMenu* CConsoleMain::GetMainMenu()
+    {
+    return dynamic_cast<CMainMenu*>(iMainMenu);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: GetFilterArray
+
+    Description: Get filter array for reading purposes
+
+    Parameters: None
+
+    Return Values: const RPointerArray<TDesC>&  array with filters
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+const RPointerArray<TDesC>& CConsoleMain::GetFilterArray(void) const
+    {
+    return iFilters;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: SetFilterIndex
+
+    Description: Set info about which index filter is used
+
+    Parameters: TInt aFilterIndex: filter index selected by user
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleMain::SetFilterIndex(TInt aFilterIndex)
+    {
+    iChosenFilterIndex = aFilterIndex;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleMain
+
+    Method: GetFilterIndex
+
+    Description: Get info about which index filter is used
+
+    Parameters: None
+
+    Return Values: TInt: filter index selected by user
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CConsoleMain::GetFilterIndex(void)
+    {
+    return iChosenFilterIndex;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: NewL
+
+    Description: Construct a new CScrollerTimer object
+
+    Parameters: CConsoleMain*             :in:      Pointer to main console               
+
+    Return Values: CScrollerTimer*                         New CScrollerTimer object
+
+    Errors/Exceptions: Leaves if memory allocation or ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CScrollerTimer* CScrollerTimer::NewL( CConsoleMain* aMain )
+    {
+
+    CScrollerTimer* self = new ( ELeave ) CScrollerTimer();
+    CleanupStack::PushL( self );
+    self->ConstructL( aMain );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: ConstructL
+
+    Description: Second level constructor
+
+    Parameters: CConsoleMain*             :in:      Pointer to main console
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CScrollerTimer::ConstructL( CConsoleMain* aMain )
+    {
+
+    // Store module information
+    iMain = aMain;
+	iTimer.CreateLocal();
+
+	CActiveScheduler::Add ( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: CScrollerTimer
+
+    Description: Constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CScrollerTimer::CScrollerTimer() : CActive (CActive::EPriorityStandard)
+    {
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: ~CScrollerTimer
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CScrollerTimer::~CScrollerTimer( )
+    {
+
+	Cancel();
+	iTimer.Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: StartL
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CScrollerTimer::StartL( )
+    {
+
+	SetActive();
+	iTimer.After ( iStatus, KScrollPeriod );	
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: RunL
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CScrollerTimer::RunL( )
+    {
+
+	iMain->TimerUpdate();
+
+	// Restart request
+	SetActive();
+	iTimer.After ( iStatus, KScrollPeriod );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: DoCancel
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CScrollerTimer::DoCancel( )
+    {
+
+	iTimer.Cancel();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CScrollerTimer
+
+    Method: RunError
+
+    Description: None
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CScrollerTimer::RunError( TInt aError)
+    {
+    if ( aError == KErrNoMemory )
+    	{
+    	iMain->ExitWithNoMemoryErrorMessage();
+    	}
+  
+	return aError;
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CConsoleReader class.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: NewL
+
+    Description: Construct the console main class
+
+    Parameters: CConsoleMain* aMain: in: Pointer to main console
+                CConsoleBase* aConsole: in: Console pointer
+
+    Return Values: CConsoleReader*                    New object
+
+    Errors/Exceptions: Leaves if memory allocation fails or
+                       ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleReader* CConsoleReader::NewL( CConsoleMain* aMain, 
+                                      //CConsoleBase* aConsole )
+                                      RConsole* aConsole )
+    {
+
+    CConsoleReader* self = 
+        new ( ELeave ) CConsoleReader( aMain, aConsole );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: 
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleReader::ConstructL( )
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: CConsoleReader
+
+    Description: Constructor.
+
+    Parameters: CConsoleMain* aMain: in: Pointer to main console
+                CConsoleBase* aConsole: in: Console pointer
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleReader::CConsoleReader( CConsoleMain* aMain, 
+                                //CConsoleBase* aConsole ): 
+                                RConsole* aConsole ): 
+    CActive( EPriorityStandard )
+    {
+    
+    iMain = aMain;
+    iConsole = aConsole;
+    
+    CActiveScheduler::Add( this );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: ~CConsoleReader
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CConsoleReader::~CConsoleReader( )
+    {	
+    
+    Cancel();    
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: StartL
+
+    Description: Construct menu objects and start the menu handling
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions:
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleReader::StartL( )
+    {
+
+    // Start to process keyboard events
+    SetActive();
+    //iConsole->Read(iStatus);
+    iConsole->Read(iMain->key, iStatus);
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: RunError
+
+    Description: None
+
+    Parameters: TInt aError
+
+    Return Values: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/    
+TInt CConsoleReader::RunError(TInt aError)
+    {
+    return aError;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: RunL
+
+    Description: Process keyboard events. Print new menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if SelectL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleReader::RunL()
+    {
+
+    iMain->KeyPressed();
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CConsoleReader
+
+    Method: DoCancel
+
+    Description: Cancel request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CConsoleReader::DoCancel()
+    {
+    
+    iConsole->ReadCancel();
+    
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: MainL
+
+    Description: The main function that can leave.
+    Create the CMainConsole object and create, initialise and 
+    start active scheduler.
+
+    When active scheduler is stopped, clean up memory and exit.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation or CConsoleMain construction
+                       leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+LOCAL_C void MainL()
+    {
+
+    // Construct and install active scheduler
+    CActiveScheduler* scheduler=new ( ELeave ) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    // Construct the console
+    CConsoleMain* mainConsole = CConsoleMain::NewL();
+    CleanupStack::PushL( mainConsole );
+
+    // Start the console
+    mainConsole->StartL();
+
+    // Start handling requests
+    CActiveScheduler::Start();
+    // Execution continues from here after CActiveScheduler::Stop()
+
+    // Clean-up
+    CleanupStack::PopAndDestroy( mainConsole );
+    CleanupStack::PopAndDestroy( scheduler );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: The main function. Execution starts from here.
+    Create clean-up stack and trap the MainL function which does the
+    real work.
+
+    Parameters: None
+
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+
+    __UHEAP_MARK;
+
+    // Get clean-up stack
+    CTrapCleanup* cleanup=CTrapCleanup::New();
+
+    // Call the main function
+    TRAPD( error, MainL() );
+
+    // Clean-up
+    delete cleanup; 
+    cleanup = NULL;
+
+    __UHEAP_MARKEND;
+
+    return error;
+
+    }
+
+#if defined(__WINS__)
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: WinsMain
+
+    Description: The WinsMain function.
+
+    Parameters: None
+
+    Return Values: TInt                             Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt WinsMain()
+	{
+	E32Main();
+	return KErrNone;
+	}
+
+#endif // __WINS__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/touchconsoleui/src/Consolemenus.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,5684 @@
+/*
+* 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: This module contains implementation of 
+* CMenu-derived classes.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+
+#include <f32file.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "ConsoleUI.h"
+#include "ConsoleMenus.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+LOCAL_C void LimitedAppend( TDes& aOriginal, const TDesC& aAppend);
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+LOCAL_C void LimitedAppend( TDes& aOriginal, const TDesC& aAppend)
+    {
+
+    TInt spaceLeft = aOriginal.MaxLength() - aOriginal.Length();
+    
+    if (spaceLeft > aAppend.Length())
+        {
+        aOriginal.Append ( aAppend );
+        }
+    else
+        {       
+        aOriginal.Append ( aAppend.Left ( spaceLeft ) );
+        }
+
+    }
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMenu::NewL( CConsoleMain* aConsole,
+                    CMenu* aParent,
+                    const TDesC& aName
+                  )
+    {
+
+    CMenu* self = new ( ELeave ) CMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+				const TDesC& aHeader	  :in:		Text containing STIF version info
+				
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::ConstructL( CConsoleMain* aConsole,
+                        CMenu* aParent,
+                        const TDesC& aName,
+                        const TDesC& aHeader
+                      )
+    {
+ 
+    // Store the parameters
+    iMain = aConsole;
+    iConsole = aConsole->GetConsole();
+    iParent = aParent;
+    iName = aName;
+    iHeader = aHeader;
+
+    // Get display size
+    const TInt KOverHead = 5;
+    //iSize = iConsole->ScreenSize();
+    iConsole->ScreenSize(iSize);
+    iScreenSize = iSize.iHeight - KOverHead;   // Size available for menus
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: CMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu::CMenu()
+    {
+    iDirection = 1;
+    iPrevPos  = -1;     // Invalid starting value
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: ~CMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CMenu::~CMenu()
+    {
+    
+    iItems.ResetAndDestroy();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: TimerUpdate
+
+    Description: TimerUpdate
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenu::TimerUpdate()
+    {    
+
+    RRefArray<TDesC> texts;
+    User::LeaveIfError( ItemTexts( texts ) );
+    
+    TInt count = texts.Count();
+    // If list is empty, do not scroll.
+    if ( count < 1 )
+        {
+        texts.Close();
+        return;
+        }
+    
+    // Recalculate visible part of menu
+    Recalculate( count );
+
+    // If menu selection is updated, then restart scrolling
+    if (iPrevPos != iFirst + iPosOnScreen)
+        {
+        iPrevPos = iFirst + iPosOnScreen;
+        iStart = 0;
+        iDirection = 1;
+        }
+
+
+    // If menu item have not been changed after last timer, then
+    // start scrolling  
+    const TDesC& name = texts[ iFirst + iPosOnScreen ]; 
+    if ( name.Length() > ( iSize.iWidth - KMenuOverhead ) )
+        {
+
+        //TInt y = iConsole->WhereY();
+        //TInt x = iConsole->WhereX();
+        TPoint cp;
+        iConsole->CursorPos(cp);
+        TInt y = cp.iY;
+        TInt x = cp.iX;
+        
+        TBuf<80> iTmp;              
+
+        iStart = iStart + iDirection;
+
+        // "Right end"
+        if ( iStart + iSize.iWidth > name.Length() + KMenuOverhead )
+            {
+            iStart--;
+            iDirection = -1;
+            }
+        
+        // "Left end"
+        if ( iStart == -1 )
+            {
+            iStart++;
+            iDirection = 1;
+            }
+        
+        if( iStart > name.Length() )
+            {
+            iStart = 0;
+            }
+
+        iTmp=_L(" *");
+        LimitedAppend( iTmp, name.Mid ( iStart ) );
+            
+        //iConsole->SetPos( 0, iPosOnScreen+1);
+        TPoint p(0, iPosOnScreen+1);
+        iConsole->SetCursorPosAbs( p);       
+        //iConsole->Printf ( iTmp.Left( iSize.iWidth -2 )  );
+        iConsole->Write ( iTmp.Left( iSize.iWidth -2 )  );
+
+        //iConsole->SetPos(x,y);
+        p.SetXY(x,y);
+        iConsole->SetCursorPosAbs(p);
+        }
+    texts.Close();
+
+    }
+    
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number 
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenu::AppendBefore( TInt aLineNum, TDes& aLine )
+    {
+    
+    if( ( aLine.MaxLength() - aLine.Length() ) < 2 )
+        {
+        return;
+        }        
+    
+    // If printing active line, print the marker
+    if ( aLineNum == iPosOnScreen + iFirst )
+        {
+        aLine.Append( _L(" *") );
+        }
+    else
+        {
+        aLine.Append( _L("  ") );
+        }
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenu::PrintMenuL( TUpdateType aType )
+    {
+
+    iUpdateType = aType;
+    
+    TBuf<KMaxLineLength> line;
+
+    // Clear display
+    iConsole->ClearScreen();
+    
+    //Print STIF version information, only when defined (i.e. in main menu)
+    if(iHeader != _L(""))
+    	Print(iHeader);
+
+    // Print menu title
+    Print( Name() );
+            
+    RRefArray<TDesC> texts;
+    User::LeaveIfError( ItemTexts( texts ) );
+    
+    // Recalculate visible part of menu
+    Recalculate( texts.Count() );
+    
+    // Print items
+    for ( TInt i = iFirst; i <= iLast; i++ )
+        {
+        line.Zero();
+        
+        // Append text before line
+        AppendBefore( i, line );
+
+        // Get the menu line
+        LimitedAppend ( line, texts[i] );
+
+        // Print the line
+        Print(line);
+
+        }
+    texts.Close();
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Either updates position in
+    menu or returns new menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    switch ( (TInt) aSelection )
+    {
+
+    // Exit
+    case EKeyEscape:
+        aContinue = EFalse;
+        return this;
+    // SelectL item
+    case EKeyEnter:
+    case EKeyRightArrow:
+        return iItems[iPosOnScreen];
+
+    // Going back
+    case EKeyLeftArrow:
+        return iParent;
+
+    // Go down
+    case EKeyDownArrow:
+        {
+        if ( iFirst + iPosOnScreen == iItemCount - 1 )
+            {
+            // If end of the list, go to beginning
+            iPosOnScreen = 0;
+            iFirst = 0;
+            iLast = iScreenSize;
+            if ( iLast > iItemCount - 1 )
+            	{
+            	iLast = iItemCount - 1;
+            	}
+            }
+        else 
+            {
+            if ( iPosOnScreen == iScreenSize )
+                {
+                iLast++;
+                iFirst++;
+                }
+            else
+                {
+                // Going down "in-screen", no need to update items
+                iPosOnScreen++;
+                }
+            }
+        break;
+        }
+        
+    // Go Up
+    case EKeyUpArrow:
+        {
+        if ( iFirst + iPosOnScreen == 0 )
+            {
+            // If in the beginning of the list
+
+            if(iItemCount > 0)
+                {
+                iLast = iItemCount - 1;
+                iFirst = iLast - iScreenSize;
+                if ( iFirst < 0 )
+                	{
+                	iFirst = 0;            	
+                	}
+                iPosOnScreen = iLast - iFirst;
+                }
+            }
+        else if ( iPosOnScreen == 0 )
+            {
+            iLast--;
+            iFirst--;
+            }
+        else
+            {
+            iPosOnScreen--;
+            }
+        
+        break;
+        }
+
+    // Additional keys
+    case EKeyHome:
+    case '3':
+        iPosOnScreen = 0;
+        iFirst = 0;
+        iLast = iScreenSize;
+
+        if ( iLast > iItemCount - 1 )
+            {
+            iLast = iItemCount - 1;
+            }
+        break;
+
+    case EKeyEnd:
+    case '9':
+        iLast = iItemCount - 1;
+        iFirst = iLast - iScreenSize;
+
+        if ( iFirst < 0 )
+            {
+            iFirst = 0;
+            }
+        iPosOnScreen = iLast - iFirst;        
+        break;
+
+    case EKeyPageUp:
+    case '1':
+
+        iFirst = iFirst - iScreenSize;
+        iLast = iLast - iScreenSize;
+
+        if ( iFirst < 0 )
+            {
+            iFirst = 0;
+            iPosOnScreen = 0;           
+            iLast = iScreenSize;
+            if ( iLast > iItemCount - 1 )
+                {
+                iLast = iItemCount - 1;
+                }
+            }
+        break;
+
+    case EKeyPageDown:
+    case '7':
+        iFirst = iFirst + iScreenSize;
+        iLast = iLast + iScreenSize;
+
+        // Going too far
+        if ( iLast > iItemCount - 1 )
+            {
+            iLast = iItemCount - 1;
+            iFirst = iLast - iScreenSize;
+            if ( iFirst < 0 )
+                {
+                iFirst = 0;
+                }
+            }
+        iPosOnScreen = iLast - iFirst;
+        break;
+    default:  // Bypass the keypress
+        break;
+    }
+
+    // Continue normally and keep in the same menu
+    aContinue = ETrue;
+    return this;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    TInt count = iItems.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aArray.Append( iItems[i]->Name() ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    return KErrNone;
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: SetParent
+
+    Description: Sets menu parent menu.
+
+    Parameters: CMenu* aMenu              :in:      Menu parent
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::SetParent ( CMenu* aMenu )
+    {
+
+    iParent = aMenu;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: Print
+
+    Description: Prints one line text and changes to next line. If line is
+    too long, overhead is not printed..
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMenu::Print( const TDesC& aPrint )
+    {
+    
+    //iConsole->Printf ( aPrint.Left( iSize.iWidth - KMenuOverhead ) );
+    iConsole->Write ( aPrint.Left( iSize.iWidth - KMenuOverhead ) );
+    //iConsole->Printf(_L("\n"));
+    iConsole->Write(_L("\r\n"));
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: PrintMulti
+
+    Description: Prints text. If line is too long, it will be continued to
+    following lines.
+
+    Parameters: const TDesC& aPrint       :in:      Text to print
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::PrintMulti( const TDesC& aPrint )
+    {
+
+    // Get current line
+    const TInt KMenuOverHead = 2;
+    //TInt y = iConsole->WhereY();
+    TPoint cp;
+    iConsole->CursorPos(cp);
+    TInt y = cp.iY;
+
+
+    const TInt KLineLen =iSize.iWidth -4;
+    TBuf<KMaxLineLength+1> oneLine;
+
+    // Loop through the line
+    for (TInt i = 0; i < aPrint.Length(); i++)
+        {
+        oneLine.Append( aPrint[i] );
+
+        // Print one line
+        if (oneLine.Length() == KLineLen )
+            {
+            oneLine.Append (_L("\r\n"));
+            //iConsole->Printf(oneLine);
+            iConsole->Write(oneLine);
+            oneLine=_L("");
+            y++;
+            }
+    
+        // Prevent display scrolling
+        if ( y == iScreenSize + KMenuOverHead )
+            {
+            oneLine=_L("");
+            break;
+            }
+        }
+
+    // Print last part if required
+    if ( oneLine.Length() != 0 )
+        {
+        oneLine.Append (_L("\r\n"));
+        //iConsole->Printf(oneLine);
+        iConsole->Write(oneLine);
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: AddItem
+
+    Description: Add new item to menu
+
+    Parameters: CMenu* aMenu              :in:      Menu to be added
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if can't add item to menu
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::AddItemL( CMenu* aMenu )
+    {
+
+    User::LeaveIfError ( iItems.Append (aMenu) );
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: Name
+
+    Description: Returns menu name
+
+    Parameters: None
+
+    Return Values: const TDesC&                     Menu name
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+const TDesC& CMenu::Name( ) const
+    {
+
+    return iName;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: MapKeyCode
+
+    Description: Maps numeric keycodes to proper TKeyCode values
+
+    Parameters: TKeyCode 
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+
+void CMenu::MapKeyCode(TKeyCode &aSelection)
+    {
+    
+    TInt asciiCode = (TInt) aSelection;
+    
+    // Handling numeric keys 2,4,6 and 8
+    
+    if(asciiCode == KMyKeyUpAsciiCode)
+        {
+        aSelection = EKeyUpArrow;
+        }
+        
+    if(asciiCode == KMyKeyLeftAsciiCode)
+        {
+        aSelection = EKeyLeftArrow;
+        }
+
+    if(asciiCode == KMyKeyRightAsciiCode)
+        {
+        aSelection = EKeyEnter;
+        }
+
+    if(asciiCode == KMyKeyDownAsciiCode)
+        {
+        aSelection = EKeyDownArrow;
+        }
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: Recalculate
+
+    Description: Recalculates visible menu elements
+
+    Parameters: TInt aItemCount    :in:      Menu items count
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CMenu::Recalculate( TInt aItemCount )
+	{    
+    TInt oldItemCount = iItemCount;
+     
+    iItemCount = aItemCount;
+ 
+    // If first time in menu, update start and end positions
+    if ( ( iFirst == 0 ) && ( iLast == 0 ) || (iItemCount == 0)) //if there are no items, update start and end positions too
+    	{
+    	if ( iItemCount - 1 > iScreenSize  )
+    		{
+    		iLast = iScreenSize;
+    		}
+    	else
+    		{
+    		iLast = iItemCount - 1;
+    		}
+    	iPosOnScreen = 0;
+    	}
+    // New menu entry added, update last visible element if needed
+    else if ( oldItemCount < iItemCount )
+    	{
+    	if ( iFirst + iScreenSize < iItemCount )
+    		{
+    		iLast = iFirst + iScreenSize;
+    		}
+    	else
+    		{
+    		iLast = iItemCount - 1;
+    		}
+    	}
+    // Menu entry removed, update last visible element if needed
+    else if ( oldItemCount > iItemCount )
+    	{
+    	if ( iFirst + iScreenSize < iItemCount )
+    		{
+    		iLast = iFirst + iScreenSize;
+    		}
+    	else if ( iFirst > iItemCount - 1 )
+    		{
+    		iFirst = iItemCount - 1 - iScreenSize;
+    		if ( iFirst < 0 )
+    			{
+    			iFirst = 0;
+    			}
+    		iLast = iItemCount - 1;
+    		iPosOnScreen = iFirst - iLast;
+    		}
+    	else
+    		{
+    		iLast = iItemCount - 1;
+    		}
+    	
+    	if ( iFirst + iPosOnScreen > iLast )
+    		{
+    		iPosOnScreen = iLast - iFirst;
+    		}
+    	}	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CFileNameQueryView* CFileNameQueryView::NewL( CConsoleMain* aConsole,
+                                              CMenu* aParent,
+                                              const TDesC& aName )
+    {
+
+    CFileNameQueryView* self = new ( ELeave ) CFileNameQueryView();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CFileNameQueryView::ConstructL( CConsoleMain* aConsole, 
+                                     CMenu* aParent, 
+                                     const TDesC& aName 
+                                    )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: ~CFileNameQueryView
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CFileNameQueryView::~CFileNameQueryView()
+    {
+
+    iTestModuleNames.ResetAndDestroy();
+    iTestModuleNames.Close();
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: ItemText
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CFileNameQueryView::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    iTestModuleNames.ResetAndDestroy();    
+    
+    // Add loaded module names to menu
+    TInt ret = iMain->UIStore().ListAllModules( iTestModuleNames );
+
+    if( ret != KErrNone )
+        {                 
+        return ret;
+        }
+        
+    TInt count = iTestModuleNames.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aArray.Append( *iTestModuleNames[i] ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    return KErrNone; 
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFileNameQueryView
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Just return the parent menu
+
+    Parameters: TKeyCode aSelection       :in:      Not used
+                TBool& aContinue          :out:     Has user pressed "Quit"?
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CFileNameQueryView::SelectL( TKeyCode aSelection, 
+                                    TBool& aContinue )
+    {  
+    
+    MapKeyCode(aSelection);
+
+    if (aSelection == EKeyEnter || aSelection == EKeyRightArrow )
+        {
+        if( iPosOnScreen < iTestModuleNames.Count() )
+            {
+            TInt ret = 
+                iMain->UIStore().AddTestModule( *iTestModuleNames[iPosOnScreen] );
+            if( ret != KErrNone )
+                {
+                TErrorNotification error;
+                error.iModule.Copy( _L("ConsoleUI") );
+                error.iText.Copy( _L("Failed to load test module ") );
+                error.iText.Append( *iTestModuleNames[iPosOnScreen] );
+                error.iText.Append( _L(" error "));
+                error.iText.AppendNum( ret );
+                iMain->Error( error );
+                }
+            return iParent;
+            }
+        else
+            {
+            return this;
+            }
+        }  
+
+    return CMenu::SelectL( aSelection, aContinue );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                const TDesC& aHeader	  :in:		Text containing STIF version information
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMainMenu* CMainMenu::NewL( CConsoleMain* aConsole,
+                            CMenu* aParent,
+                            const TDesC& aName,
+                            const TDesC& aHeader)
+    {
+
+    CMainMenu* self = new ( ELeave ) CMainMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aHeader );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMainMenu
+
+    Method: ~CMainMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMainMenu::~CMainMenu()
+    {
+    delete iOutputView;
+    iOutputView = NULL;
+    delete iOperationMenu;
+    iOperationMenu = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text. Add "Exit" to normal SelectLion
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMainMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    TInt ret = CMenu::ItemTexts( aArray );
+    if ( ret != KErrNone )
+    	{
+    	return ret;
+    	}
+    // Add Exit to last one in menu
+    if( aArray.Append( KExitTxt ) != KErrNone )
+        {
+        return KErrNoMemory;
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                const TDesC& aHeader	  :in:		Text containing STIF version information
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMainMenu::ConstructL( CConsoleMain* aConsole, 
+                            CMenu* aParent,
+                            const TDesC& aName,
+                            const TDesC& aHeader
+                          )
+    {
+    CMenu::ConstructL( aConsole, aParent, aName, aHeader);
+    iOutputView = NULL;
+    iOperationMenu = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle SelectLion in this
+    method, other keys are handles in CMenu class.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMainMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    // If SelectLion == "exit" and right or enter
+    if (aSelection == EKeyEnter || aSelection == EKeyRightArrow )
+        {
+        if ( iPosOnScreen == iItemCount-1 )
+            {
+            // Exit
+            aContinue = EFalse;
+            return this;
+            }
+        }
+
+    // Normal menu handling
+    CMenu* tmp = CMenu::SelectL(aSelection, aContinue);
+    return tmp;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMainMenu
+
+    Method: CreateOutputViewL
+
+    Description: Creates test case output view.
+
+    Parameters: CMenu* aParent: parent menu for case operation menu
+
+    Return Values: CMenu*        New menu
+
+    Errors/Exceptions: Leaves is CCaseExecutionView menu leaves during creation
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMainMenu::CreateOutputViewL(CMenu* aParent)
+    {
+    // Get test cases that have been run
+    RRefArray<CStartedTestCase> startedTestCases;
+    CleanupClosePushL(startedTestCases);
+    CMenu* res = NULL;
+
+    startedTestCases.Reset();
+    if(iMain->UIStore().StartedTestCases(startedTestCases, CUIStoreIf::EStatusAll) == KErrNone)
+        {                 
+        TInt count = startedTestCases.Count();
+        if(count > 0)
+            {
+            // Create menu with execution info
+            const CStartedTestCase* caseContainer = &startedTestCases[count - 1];
+            delete iOutputView;
+            iOutputView = NULL;
+            delete iOperationMenu;
+            iOperationMenu = NULL;
+
+            iOperationMenu = CCaseOperationMenu::NewL(iMain,
+                                                      aParent, //back to parent menu
+                                                      caseContainer->TestInfo().TestCaseTitle(),
+                                                      caseContainer
+                                                     );
+
+            iOutputView = CCaseExecutionView::NewL(iMain,
+                                                   iOperationMenu, //back to Case Operation Menu
+                                                   caseContainer->TestInfo().TestCaseTitle(),
+                                                   caseContainer
+                                                  );
+            res = iOutputView;
+            }
+        }
+        
+    CleanupStack::PopAndDestroy(&startedTestCases);
+    return res;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CModuleListView* CModuleListView::NewL( CConsoleMain* aConsole,
+                                        CMenu* aParent,
+                                        const TDesC& aName )
+    {    
+
+    CModuleListView* self = new ( ELeave ) CModuleListView();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: ~CModuleListView
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CModuleListView::~CModuleListView()
+    {
+    delete iModuleAdd;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: ConstructL
+
+    Description: Second level constructor. 
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if module can't be appended to list
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CModuleListView::ConstructL( CConsoleMain* aConsole,
+                                  CMenu* aParent,
+                                  const TDesC& aName
+                                 )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+   
+    // Construct module menu
+    iModuleAdd  = CFileNameQueryView::NewL ( iMain, this, KSelectMenuTxt );    
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: ItemText
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CModuleListView::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    // Add also "Add module" text
+    if( aArray.Append( KAddMenuTxt ) != KErrNone )
+        {
+        return KErrNoMemory;
+        }
+    if( aArray.Append( KLoadMenuTxt ) != KErrNone )
+        {
+        return KErrNoMemory;
+        } 
+        
+    return KErrNone; 
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CModuleListView
+
+    Method: PrintMenuL
+
+    Description: Prints the menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CModuleListView::PrintMenuL( TUpdateType aType )
+    {
+    
+    // Get module names
+    RRefArray<TDesC> modules;
+    TInt ret = iMain->UIStore().Modules( modules );
+
+    CMenu::PrintMenuL( aType );
+    
+    // Add loaded module names to menu
+    if( ret != KErrNone )
+        {
+        modules.Reset();
+        modules.Close();
+        return;
+        }
+        
+    TBuf<KMaxLineLength> line;
+    TInt count = modules.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        line = _L("    ");
+        LimitedAppend ( line, modules[i] );
+
+        // Print the line
+        Print(line);
+        }
+    modules.Reset();
+    modules.Close();
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CModuleListView
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle right arrow and enter
+                 here, others in parent menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CModuleListView::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+    
+    MapKeyCode(aSelection);
+
+    if( ( aSelection == EKeyRightArrow ||
+            aSelection == EKeyEnter ) )
+        {
+        if( iPosOnScreen == EAddMenuTxtItem )
+            {
+            return iModuleAdd;
+            }
+        else if( iPosOnScreen == ELoadMenuTxtItem )
+            {
+            iMain->UIStore().LoadAllModules();
+            return this;
+            }
+        else 
+            {
+            return this;
+            }
+        }
+
+    return CMenu::SelectL( aSelection, aContinue );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseStartMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TBool aShowOutput         :in:      Show output after test case is run
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseStartMenu* CCaseStartMenu::NewL( CConsoleMain* aConsole,
+                                      CMenu* aParent,
+                                      const TDesC& aName,
+                                      TBool aShowOutput)
+    {
+
+    CCaseStartMenu* self = new ( ELeave ) CCaseStartMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aShowOutput );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseStartMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseStartMenu::ConstructL( CConsoleMain* aConsole,
+                                 CMenu* aParent,
+                                 const TDesC& aName,
+                                 TBool aShowOutput
+                               )
+    {
+
+    iShowOutput = aShowOutput;
+    CMenu::ConstructL( aConsole, aParent, aName);
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CCaseStartMenu
+
+    Method: ~CCaseStartMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseStartMenu::~CCaseStartMenu()
+    {
+    iTestCases.Close();
+
+    iMapFilteredToAll.Reset();
+    iMapFilteredToAll.Close();
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseStartMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CCaseStartMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+    iTestCases.Reset();
+    TInt ret = iMain->UIStore().TestCases( iTestCases );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    const RPointerArray<TDesC> &filters = iMain->GetFilterArray();
+    const TInt filterindex = iMain->GetFilterIndex(); 
+    iMapFilteredToAll.Reset();
+    
+    TInt count = iTestCases.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        //If user has chosen filter, let's apply it
+        if(filterindex > 0) //skip the first filter which always is "No filter"
+            {
+            //Check whether test title is matching the applied filter
+            iTitleLowerCase.Copy(iTestCases[i].TestCaseTitle());
+            iTitleLowerCase.LowerCase();
+            iFilterLowerCase.Copy(*filters[filterindex]);
+            iFilterLowerCase.LowerCase();
+
+            if(iTitleLowerCase.Match(iFilterLowerCase) != KErrNotFound)
+                {
+                ret = aArray.Append(iTestCases[i].TestCaseTitle());
+                if(ret != KErrNone)
+                    {
+                    return ret;
+                    }
+                ret = iMapFilteredToAll.Append(i);
+                if(ret != KErrNone)
+                    {
+                    return ret;
+                    }                
+                }
+            }
+        else
+            {
+            ret = aArray.Append( iTestCases[i].TestCaseTitle() );
+            if(ret != KErrNone)
+                {
+                return ret;
+                }
+            ret = iMapFilteredToAll.Append(i);
+            if(ret != KErrNone)
+                {
+                return ret;
+                }                
+            }
+        }
+        
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseStartMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CCaseStartMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    switch ( aSelection )
+        {
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            // Start the case
+            if ( (iFirst + iPosOnScreen) < iMapFilteredToAll.Count() ) //changed from iTestCases to iMapFilteredToAll, because first table keeps info about all test cases, and second one about filtered cases
+                {
+                TInt index;
+                User::LeaveIfError( 
+                    iMain->UIStore().StartTestCase( 
+                        iTestCases[iMapFilteredToAll[iFirst + iPosOnScreen]], index ) );
+                // Create output screen (menu) if needed
+                if(iShowOutput)
+                    {
+                    CMenu* m = iMain->GetMainMenu()->CreateOutputViewL(iParent);
+                    if(m)
+                        return m;
+                    }
+                return iParent;
+                }
+            else
+                {
+                return this;
+                }
+            }
+
+        default:
+            return CMenu::SelectL( aSelection, aContinue);
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleBaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleBaseMenu* CMultipleBaseMenu::NewL( CConsoleMain* aConsole,
+                                            CMenu* aParent,
+                                            const TDesC& aName )
+    {
+
+    CMultipleBaseMenu* self = new ( ELeave ) CMultipleBaseMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleBaseMenu
+
+    Method: CMultipleBaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleBaseMenu::CMultipleBaseMenu(): 
+    iSetFinished( ETrue ),
+    iRunType( ERunSequential ),
+    iMenuTotCount( 0 ),
+    iMenuCount( 0 )
+    {
+    
+    iMenuCount = EChangeAll + 1;
+    iMenuTotCount = iMenuCount;
+    
+    }   
+    
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleBaseMenu
+
+    Method: ~CMultipleBaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleBaseMenu::~CMultipleBaseMenu()
+    {
+    
+    iSetState.Close();
+    
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMultipleBaseMenu::ConstructL( CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName 
+                             )
+    {
+
+    CCaseStartMenu::ConstructL( aConsole, aParent, aName );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMultipleBaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+    if ( iSetFinished )
+        {
+        if( aArray.Append( KChangeAll ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        
+        if( iUpdateType ==  EMenuPrint )
+            {   
+            TInt ret = UpdateTestCases();
+            if( ret != KErrNone )
+                {                 
+                return ret;
+                }
+            }
+        TInt count = iTestCases.Count();
+        for( TInt j=0; j<count; j++ )
+            {
+            if( aArray.Append( iTestCases[j].TestCaseTitle() ) 
+                != KErrNone )
+                {
+                return KErrNoMemory;
+                }
+            if( aArray.Count() > iSetState.Count())
+                {
+                // Appends iSetState only if aArray's size is bigger @js
+                if( iSetState.Append(EFalse) != KErrNone )
+                    {
+                    return KErrNoMemory;
+                    }
+                }
+            }
+        }
+    else
+        {
+        if( aArray.Append( KCancelSet ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMultipleBaseMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number 
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CMultipleBaseMenu::AppendBefore( TInt aLineNum, TDes& aLine )
+    {
+    
+    CMenu::AppendBefore( aLineNum, aLine );
+    if( ( aLine.MaxLength() - aLine.Length() ) < 2 )
+        {
+        return;
+        }        
+    
+    if( aLineNum >= iMenuTotCount )
+        {
+        if ( iSetState[ aLineNum - iMenuTotCount ] )
+            {
+            aLine.Append(_L("S "));
+            }
+        else
+            {
+            aLine.Append(_L("  "));
+            }
+        }
+   
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMultipleBaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    if ( iSetFinished )
+        {
+
+        if ( ( aSelection == EKeyEnter  ) || ( aSelection == EKeyRightArrow ) )
+            {
+            // CMultipleBaseMenu relative position 
+            TInt pos = iFirst + iPosOnScreen - iMenuTotCount + iMenuCount;
+            if( pos  == EChangeAll )
+                {
+                TInt count = iTestCases.Count();    
+
+                // Change all                                       
+                for (TInt i = 0; i < count; i++)
+                    {
+                    iSetState[i] = !iSetState[i];
+                    }
+
+                return this;
+                }
+            else
+                {
+                // Normal item, change state...
+                iSetState[ iFirst + iPosOnScreen - iMenuTotCount ] = 
+                    !iSetState[ iFirst + iPosOnScreen - iMenuTotCount ];
+                return this;
+                }            
+            
+            }
+
+		return CMenu::SelectL( aSelection, aContinue );
+        }
+    else
+        {
+
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {
+                if ( iOngoingCaseContainer != NULL )
+                    {
+                    iOngoingCaseContainer->UIEngineContainer().CancelTest();
+                    }
+                iSetFinished = ETrue;
+                iFirst = 0;
+                iLast = 0;
+                return this;
+                }
+            default:
+                return CMenu::SelectL( aSelection, aContinue );
+            }
+
+
+
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: CheckIfAnyCaseIsSelected
+
+    Description: Checks if any of testcases was selected in multiple selection menu
+
+    Parameters: TInt aCount number of testcases in multiple selection menu
+
+    Return Values: ETrue if any testcase was selected, EFalse if none of testcases was selected
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CMultipleBaseMenu::CheckIfAnyCaseIsSelected(TInt aCount)
+{
+	TInt currentPos = 0;
+	for(; currentPos<aCount; currentPos++)	
+	{
+		//if any of testcases was selected then return true
+		if (iSetState[currentPos])
+			return ETrue;
+	}
+	//if none of testcases was selected then return false
+	return EFalse;
+}
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: SignalL
+
+    Description: Handle test case starts
+
+    Parameters: CStartedTestCase* aContainer: in: CStartedTestCase container
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CMultipleBaseMenu::SignalL( CStartedTestCase* /*aContainer*/ )
+    {
+
+    TInt count = iTestCases.Count();
+    
+    TBool started = EFalse;
+    TInt index;
+    TInt err = KErrNone;
+
+    // Counter to prevent infinite loop when cases can't be started at all
+    // when running cases in repeat mode.
+    TInt casesChecked = 0;
+
+    // If cases are not aborted or not in last case and at least one test
+    // case was selected, start a new one
+    if ( !iSetFinished && iCurrentRunPos != count && CheckIfAnyCaseIsSelected(count) )
+        {
+        // Search next case from set and execute it.
+        while( iCurrentRunPos < count )
+            {
+            if ( iSetState[iCurrentRunPos] )
+                {       
+                err = iMain->UIStore().StartTestCase( 
+                    iTestCases[ iCurrentRunPos ], 
+                    index );
+
+                iCurrentRunPos++;
+                casesChecked++;
+
+                // Go to start of list, if running cases in repeat mode. 
+                // In other modes, just get out from the main loop
+                if( ( iRunType == ERunRepeatSequential ) &&
+                    ( iCurrentRunPos >= count ) )
+                    {
+                    // Restart from first one on next time.
+                    iCurrentRunPos = 0;
+                    }
+
+                // Handle out of memory error separately, because there is
+                // always new test case result display constructed when
+                // starting case => Starting more new cases uses more memory
+                // and it will not work, so stop starting new cases.
+                if( err == KErrNoMemory )
+                    {
+                    iSetFinished = ETrue;
+                    break;
+                    }
+
+                // Get pointer to ongoing case in case that user wants to
+                // cancel it.
+                iOngoingCaseContainer = 
+                    &iMain->UIStore().StartedTestCaseL( index );
+
+                // Store pointer to this object to allow 
+                // SignalL call when test case is completed
+                iOngoingCaseContainer->iBackPtr = (TAny*)this;
+
+                if( err != KErrNone )
+                    {
+                    TFullTestResult result;  
+                    result.iTestResult.iResult = err;
+                    result.iTestResult.iResultDes.Copy( 
+                                            _L("Failed to start testcase") );
+                    // Prevent infinite loop in case, where
+                    // ERunRepeatSequential and ALL cases fail to start.
+                    if ( iRunType == ERunRepeatSequential && 
+                                            casesChecked == count )
+                        {
+                        // In this state, started = EFalse so final check
+                        // stops running
+                        break;
+                        }
+                    }
+                else if( ( iRunType == ERunSequential ) ||
+                         ( iRunType == ERunRepeatSequential ) )
+                    {
+                    started = ETrue;
+                    break;
+                    }
+                }
+            else 
+                {
+                iCurrentRunPos++;
+                casesChecked++;
+
+                // Go to start of list, if running cases in repeat mode. 
+                // In other modes, just get out from the main loop
+                if( ( iRunType == ERunRepeatSequential ) &&
+                    ( iCurrentRunPos >= count ) )
+                    {
+                    // Restart from first one
+                    iCurrentRunPos = 0;
+                    }
+                }
+            }
+        }
+
+    if ( err == KErrNoMemory )
+    	{
+    	iMain->ExitWithNoMemoryErrorMessage();
+    	}
+    
+    // If nothing was selected, then mark set as finished. 
+    // Or running cases at same time, so all have been started.
+    if ( started == EFalse )
+        {
+        iFirst = 0;
+        iLast = 0;
+        iSetFinished = ETrue;
+        iCurrentRunPos = 0;
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleBaseMenu
+
+    Method: UpdateTestCases
+
+    Description: 
+
+    Parameters: 
+
+    Return Values: 
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMultipleBaseMenu::UpdateTestCases()
+    {
+
+    // Update test cases
+    iTestCases.Reset();
+    iSetState.Reset();
+    return iMain->UIStore().TestCases( iTestCases );
+            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleCaseMenu* CMultipleCaseMenu::NewL( CConsoleMain* aConsole,
+                                            CMenu* aParent,
+                                            const TDesC& aName )
+    {
+
+    CMultipleCaseMenu* self = new ( ELeave ) CMultipleCaseMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleCaseMenu
+
+    Method: CMultipleCaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleCaseMenu::CMultipleCaseMenu()    
+    {
+    
+    iMenuItemsCount = ERepeatRunSelection + 1;
+    iMenuItemsCount++; //Select all between already selected
+    iMenuTotCount += iMenuItemsCount;
+    
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    CMultipleCaseMenu
+
+    Method: ~CMultipleCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMultipleCaseMenu::~CMultipleCaseMenu()
+    {
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMultipleCaseMenu::ConstructL( CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName 
+                             )
+    {
+
+    CCaseStartMenu::ConstructL( aConsole, aParent, aName );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleCaseMenu
+
+    Method: StartRunningL
+
+    Description: Start running multiple cases.
+
+    Parameters: TRunType aRunType: in: Running type
+                const TDesC& aModule: in: module name 
+                const TDesC& aTestCaseFile: in: test case file name 
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves on error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CMultipleCaseMenu::StartRunningL( TRunType aRunType, 
+                                       const TDesC& aModule, 
+                                       const TDesC& aTestCaseFile )
+    {
+    
+    // Update test cases
+    iTestCases.Reset();
+    iSetState.Reset();
+    User::LeaveIfError( 
+        iMain->UIStore().TestCases( iTestCases, aModule, aTestCaseFile ) );
+    
+    // Select all for running
+    TInt count = iTestCases.Count();
+    for( TInt j=0; j<count; j++ )
+        {
+        User::LeaveIfError( iSetState.Append(ETrue) );
+        }
+        
+    // Start running
+    iCurrentRunPos = 0;
+    iSetFinished = EFalse;
+    iRunType = aRunType;
+    SignalL ( NULL );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CMultipleCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+    if ( iSetFinished )
+        {
+        if( aArray.Append( KRunSequentially ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if( aArray.Append( KRunParallel ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if( aArray.Append( KRepeatRunSequentially ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if(aArray.Append(KSelectFromTo) != KErrNone)
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    TInt ret = CMultipleBaseMenu::ItemTexts(aArray);
+    if(ret != KErrNone)
+        {
+        return ret;
+        }
+    
+    return KErrNone;    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMultipleCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CMultipleCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    if ( iSetFinished )
+        {
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {
+
+                if ( iFirst + iPosOnScreen == ERunSelection )
+                    {
+                    // Start the first one
+                    iCurrentRunPos = 0;
+                    iSetFinished = EFalse;
+                    iRunType = ERunSequential;
+                    SignalL ( NULL );
+
+                    return iParent;
+                    }
+                else if ( iFirst + iPosOnScreen == ERunSelectionParaller )
+                    {
+                    // Start the first one
+                    iCurrentRunPos = 0;
+                    iSetFinished = EFalse;
+                    iRunType = ERunParallel;
+                    SignalL ( NULL );
+
+                    return iParent;
+                    }
+                else if ( iFirst + iPosOnScreen == ERepeatRunSelection )
+                    {
+                    // Start the first one
+                    iCurrentRunPos = 0;
+                    iSetFinished = EFalse;
+                    iRunType = ERunRepeatSequential;
+                    SignalL ( NULL );
+
+                    return iParent;
+                    }
+                else if(iFirst + iPosOnScreen == ESelectFromTo)
+                    {
+                    TInt count = iTestCases.Count();
+                    TInt indexFirst = count;
+                    TInt indexLast = count - 1;
+                    TInt i;
+                    
+                    // Find first test case which is set
+                    for(i = 0; i < count; i++)
+                        {
+                        if(iSetState[i])
+                            {
+                            indexFirst = i;
+                            break;
+                            }
+                        }
+                    
+                    // Find last test case which is set
+                    if(indexFirst < count)
+                        {
+                        for(i = count - 1; i > indexFirst; i--)
+                            {
+                            if(iSetState[i])
+                                {
+                                indexLast = i;
+                                break;
+                                }
+                            }
+                        
+                        // Set test cases between first and last
+                        for(i = indexFirst; i <= indexLast; i++)
+                            {
+                            iSetState[i] = ETrue;
+                            }
+                        }
+
+                    return this;
+                    }
+                }
+                break;
+            default:
+                break;
+            }
+        }   
+        
+    return CMultipleBaseMenu::SelectL( aSelection, aContinue );
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseMenu* CCaseMenu::NewL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName, 
+                            TInt aType )
+    {
+
+    CCaseMenu* self = new ( ELeave ) CCaseMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aType );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if memory allocation fails
+                       Leaves if CCaseOperation menu NewL leaves
+                       Leaves if UpcateCaseListL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseMenu::ConstructL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName, 
+                            TInt aType
+                          )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+    iType = aType;
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: ~CCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CCaseMenu::~CCaseMenu()
+    {
+
+    delete iCaseOperationMenu;
+    iCaseOperationMenu = 0;
+    
+    iTestCases.Close();
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    iTestCases.Reset();
+    
+    TInt ret = iMain->UIStore().StartedTestCases( iTestCases, iType );
+    if ( ret != KErrNone )
+    	{
+    	return ret;
+    	}
+
+    TInt count = iTestCases.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aArray.Append( iTestCases[i].TestInfo().TestCaseTitle() ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CCaseMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseMenu::AppendBefore(TInt aLineNum, TDes& aLine)
+    {
+    CMenu::AppendBefore(aLineNum, aLine);
+
+    //START of --Add number to the test case title--
+    //First check how much space we need
+    TInt additionalSpace = 0;
+    TInt currentCount = aLineNum + 1;
+
+    if(currentCount >= 10000) additionalSpace = 10; //f.e. "10157521. "
+    else if(currentCount >= 1000) additionalSpace = 6; //f.e. "1157. "
+    else if(currentCount >= 100) additionalSpace = 5; //f.e. "101. "
+    else if(currentCount >= 10) additionalSpace = 4; //f.e. "15. "
+    else additionalSpace = 3; //f.e. "1. "
+
+ //Create descriptor, add content to it, and finally append to line
+    TBuf<20> num;
+
+    if(iTestCases[aLineNum].Status() == CUIStoreIf::EStatusRunning )
+ 	   {
+    if( iTestCases[aLineNum].UIEngineContainer().State() == CUIEngineContainer::EPaused)
+     	{
+     	  //If not enough space, return
+     	if((aLine.MaxLength() - aLine.Length()) < additionalSpace + 4)
+     	     {
+     	     return;
+     	     }
+     		num.Format(_L("%d.(P) "), currentCount);
+     	}
+     else
+     	{
+        //If not enough space, return
+     	if((aLine.MaxLength() - aLine.Length()) < additionalSpace)
+     		{
+     	  	return;
+     	     }     		  			
+     	num.Format(_L("%d."), currentCount);
+     	}
+ 	   }
+    aLine.Append(num);
+    }
+    //END of --Add number to test case title--
+    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle Enter and Right Arrow
+    here, other will be handled in CMenu::SelectL
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    switch (aSelection)
+        {
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            if ( iFirst + iPosOnScreen < iTestCases.Count() )
+                {
+                delete iCaseOperationMenu;
+                iCaseOperationMenu = 0;
+                iCaseOperationMenu = CCaseOperationMenu::NewL( 
+                    iMain, 
+                    this, 
+                    iTestCases[iFirst + iPosOnScreen].TestInfo().TestCaseTitle(), 
+                    &iTestCases[iFirst + iPosOnScreen] );   
+
+                return iCaseOperationMenu;
+                }
+            }
+            return this;
+        default:
+            // Let the parent class handle rest
+            return CMenu::SelectL(aSelection, aContinue);
+        }
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseOperationMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                CStartedTestCase* aCaseContainer:in: Case container
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseOperationMenu* CCaseOperationMenu::NewL( CConsoleMain* aConsole,
+                                 CMenu* aParent,
+                                 const TDesC& aName,
+                                 const CStartedTestCase* aCaseContainer
+                               )
+    {
+
+    CCaseOperationMenu* self = new ( ELeave ) CCaseOperationMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aCaseContainer );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseOperationMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                CStartedTestCase* aCaseContainer:in: Case container
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseOperationMenu::ConstructL( CConsoleMain* aConsole,
+                                     CMenu* aParent,
+                                     const TDesC& aName,
+                                     const CStartedTestCase* aCaseContainer
+                                   )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName); 
+    iCaseContainer = aCaseContainer;
+    
+    // Indicate that this menu contains prints, update when needed
+    iType = CUIStoreIf::EStatusExecuted;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CMenu
+
+    Method: ~CMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CCaseOperationMenu::~CCaseOperationMenu()
+    {
+    delete iView;
+    iView = 0;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseOperationMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CCaseOperationMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    if( iCaseContainer->Status() & CUIStoreIf::EStatusRunning )
+        {
+        if( aArray.Append( KOutputViewDes ) != KErrNone )
+            {
+            return KErrNoMemory; 
+            }
+                
+        // Set resume/pause text
+        if( iCaseContainer->UIEngineContainer().State() == 
+            CUIEngineContainer::EPaused )
+            {
+            if( aArray.Append( KResumeCaseDes ) != KErrNone )
+                {
+                return KErrNoMemory; 
+                }
+            }
+        else
+            {
+            if( aArray.Append( KPauseCaseDes ) != KErrNone )
+                {
+                return KErrNoMemory; 
+                }
+            }
+        if( aArray.Append( KAbortCaseDes ) != KErrNone )
+            {
+            return KErrNoMemory; 
+            }
+        }
+    else
+        {
+        if(aArray.Append(KRestartCaseDes) != KErrNone)
+            {
+            return KErrNoMemory; 
+            }
+        if( aArray.Append( KOutputViewDes ) != KErrNone )
+            {
+            return KErrNoMemory; 
+            }
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu and test case specific information after that.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if FormatL leaves
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CCaseOperationMenu::PrintMenuL( TUpdateType  aType )
+    {
+
+    // Print menu
+    CMenu::PrintMenuL( aType );
+    
+    // Print the result description + result code
+    // If case is finished, print also result string
+    TInt state = iCaseContainer->Status();
+    if  ( ! ( state & CUIStoreIf::EStatusRunning ) )
+        {        
+
+        TName resultLine;
+        
+        Print (_L(""));
+        resultLine.Append(_L("Result info: ") );
+
+        if( state & CUIStoreIf::EStatusPassed )
+            {
+            resultLine.Append( _L("Passed" ) );
+            } 
+        else if( state & CUIStoreIf::EStatusFailed )
+            {
+            resultLine.Append( _L("Failed" ) );
+            } 
+        else if( state & CUIStoreIf::EStatusAborted )
+            {
+            resultLine.Append( _L("Aborted" ) );
+            } 
+        else if( state & CUIStoreIf::EStatusCrashed )
+            {
+            resultLine.Append( _L("Crashed" ) );
+            }
+        PrintMulti( resultLine );
+        resultLine.Zero();             
+
+        // Print test results
+        if( !( ( state & CUIStoreIf::EStatusAborted ) || 
+               ( state & CUIStoreIf::EStatusCrashed ) || 
+               ( state & CUIStoreIf::EStatusPassed ) ) )
+            {
+
+            resultLine.Format(_L("Result code %d"), 
+                iCaseContainer->Result().iTestResult.iResult );
+            PrintMulti ( resultLine );            
+            }
+
+        if( iCaseContainer->Result().iCaseExecutionResultType == 
+            TFullTestResult::ECaseErrorFromModule )
+            {
+            PrintMulti ( _L("Error from RunTestCase():"));
+            }
+
+        // Print result descriptor if that is available
+        const TDesC& des = iCaseContainer->Result().iTestResult.iResultDes;
+        if ( des.Length() >0 )
+            {
+            PrintMulti(des);
+            }
+
+        // Print abort code if that is available
+        if( ( state & CUIStoreIf::EStatusAborted ) ||
+            ( state & CUIStoreIf::EStatusCrashed ) )
+            {
+            // Print abort type, if that is available
+            TFullTestResult::TCaseExecutionResult res = 
+                iCaseContainer->Result().iCaseExecutionResultType;
+            
+            if ( res == TFullTestResult::ECaseLeave ||
+                 res == TFullTestResult::ECasePanic ||
+                 res == TFullTestResult::ECaseException || 
+                 res == TFullTestResult::ECaseErrorFromModule ||
+                 res == TFullTestResult::ECaseSuicided )
+                {
+                TInt code = iCaseContainer->Result().iCaseExecutionResultCode;
+                resultLine.Format(_L("Code %d (0x%x)"), code, code );
+                PrintMulti ( resultLine );
+                }
+            }
+
+        // Print start and end times
+        const TInt KTimeFieldLength = 30;
+        TBuf<KTimeFieldLength> time;
+        _LIT(KDateString,"%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B");
+
+        resultLine = _L("Started:");
+        iCaseContainer->Result().iStartTime.FormatL(time,KDateString);
+        resultLine.Append(time);
+        PrintMulti (resultLine);
+
+        resultLine = _L("Completed:");
+        iCaseContainer->Result().iEndTime.FormatL(time,KDateString);
+        
+        resultLine.Append(time);
+        PrintMulti (resultLine);
+
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseOperationMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle Enter and right arrow
+    here, others are handled in parent menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CCaseOperationMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {   
+
+    MapKeyCode(aSelection);
+    
+    if (aSelection == EKeyEnter || aSelection == EKeyRightArrow )
+        {        
+        // restartOptionModifier is used because when test case is running
+        // restart option is not available (and visible) and that's why
+        // we need to modify switch by 1.
+        // When test case is finished, restart option becomes available
+        // and is put at the first place.
+        TInt restartOptionModifier = 0;
+        if(iCaseContainer->Status() & CUIStoreIf::EStatusRunning)
+            restartOptionModifier = 1;
+        
+        switch (iPosOnScreen + iFirst + restartOptionModifier)
+        {
+        case ERestartCase:
+            {
+            TInt index;
+            User::LeaveIfError(iMain->UIStore().StartTestCase(iCaseContainer->TestInfo(), index));
+            // Create output screen
+            CMenu* m = iMain->GetMainMenu()->CreateOutputViewL(iParent);
+            return m;
+            }
+        case EOutputView:
+            {
+            delete iView;
+            iView = 0;
+            iView = CCaseExecutionView::NewL( 
+                iMain, 
+                this, 
+                iCaseContainer->TestInfo().TestCaseTitle(), 
+                iCaseContainer );
+
+            return iView;
+            }
+
+        case EPauseResume:
+
+            if( iCaseContainer->UIEngineContainer().State() == 
+                CUIEngineContainer::ERunning )
+                {    
+                // Pausing a running case
+                iCaseContainer->UIEngineContainer().PauseTest();
+
+                }
+            else if( iCaseContainer->UIEngineContainer().State() == 
+                     CUIEngineContainer::EPaused )
+                {
+                // Resuming a paused case
+                iCaseContainer->UIEngineContainer().ResumeTest();
+
+                }
+            // No other possibilities
+            return this;
+
+        case EAbortCase:
+            iCaseContainer->UIEngineContainer().CancelTest();
+            break;
+
+        }
+        
+        return this;
+        }
+    else
+        {
+        return CMenu::SelectL(aSelection, aContinue);
+        }
+        
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseExecutionView
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                CStartedTestCase* aCase :in:      Case container
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseExecutionView* CCaseExecutionView::NewL( CConsoleMain* aConsole,
+                                              CMenu* aParent,
+                                              const TDesC& aName,
+                                              const CStartedTestCase* aCase )
+    {
+
+    CCaseExecutionView* self = new ( ELeave ) CCaseExecutionView();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName, aCase );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseExecutionView
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                CStartedTestCase* aCase :in:      Case container
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseExecutionView::ConstructL( CConsoleMain* aConsole,
+                                     CMenu* aParent,
+                                     const TDesC& aName,
+                                     const CStartedTestCase* aCase
+                                    )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName );
+
+    iCase = aCase;
+    
+    // Indicate that this menu contains prints, update when needed
+    iType = CUIStoreIf::EPrintUpdate;
+
+    iLine = 0;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CCaseExecutionView
+
+    Method: ~CCaseExecutionView
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CCaseExecutionView::~CCaseExecutionView()
+    {
+    delete iLineTextBuf;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu. Show the test status and the test case
+    print statements.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CCaseExecutionView::PrintMenuL( TUpdateType  /*aType*/ )
+    {
+    
+    if( iShowLine )
+        {
+        // User want to see whole line 
+        iConsole->ClearScreen();
+        this->PrintMulti( iLineTextBuf->Des() );
+        return;
+        }
+
+    // Print the status
+    TName tmp;
+    TInt state = iCase->Status();
+    if( state & CUIStoreIf::EStatusRunning )
+        {
+        if( iCase->UIEngineContainer().State() == 
+            CUIEngineContainer::EPaused )
+            {
+            tmp = _L("Paused");
+            }
+        else
+            {
+            tmp = _L("Running");
+            }
+        }
+    else if( state & CUIStoreIf::EStatusPassed )
+        {
+        tmp = _L("Passed");
+        }
+    else if( state & CUIStoreIf::EStatusFailed )
+        {
+        tmp = _L("Failed");
+        }
+    else if( state & CUIStoreIf::EStatusAborted )
+        {
+        tmp = _L("Aborted");
+        }
+    else if( state & CUIStoreIf::EStatusCrashed )
+        {
+        tmp = _L("Aborted");
+        }
+    else
+        {
+        tmp = _L("Unknown");
+        }
+    
+    // Clear screen.
+    iConsole->ClearScreen();
+    TBuf<KMaxLineLength> line;
+
+    line.Append(_L(" : "));
+    LimitedAppend(line, iCase->TestInfo().TestCaseTitle() );
+    Print( line );
+
+    const RPointerArray<CTestProgress>& prints = iCase->PrintArray();
+
+    Recalculate( prints.Count() );
+
+    // Print the print statements.
+    for ( TInt i = iFirst; i <= iLast; i++ )
+        {
+        line.Zero();
+        if( iLine == i )
+            {
+            line = _L( "*" ); // For indicating current line
+            }
+        line.Append( prints[i]->iDescription );
+        line.Append(_L(" : "));
+        LimitedAppend(line, prints[i]->iText );
+
+        // Print the line
+        TSize screenSize;
+        //screenSize = iConsole->ScreenSize();
+        iConsole->Size(screenSize);
+        Print ( line.Left(screenSize.iWidth ) );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseExecutionView
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Either updates position in
+    menu or returns new menu.
+
+    Parameters: TKeyCode aSelection: in: Key
+                TBool& aContinue: out: Has user pressed "Quit"
+
+    Return Values: CMenu* New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CCaseExecutionView::SelectL( TKeyCode aSelection, TBool& /*aContinue*/ )
+    {
+    iShowLine = EFalse;
+    MapKeyCode(aSelection);
+
+    // Take prints
+    const RPointerArray<CTestProgress>& prints = iCase->PrintArray();
+
+    switch( aSelection  )
+        {        
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            // Check that not out of range(too many EKeyUpArrow or EKeyDownArrow)
+            if( iLine >= prints.Count() || iLine < 0)
+                {
+                // do nothing
+                break;
+                }
+            TInt extra = 3; // ' : '
+            TInt length( 0 );
+            length = length + prints[iLine]->iDescription.Length();
+            length = length + prints[iLine]->iText.Length();
+            // Selected print line in seperate(operation will do in
+            // CCaseExecutionView::PrintMenuL() method )
+            delete iLineTextBuf;
+			iLineTextBuf = NULL;
+            TRAPD( ret, iLineTextBuf = HBufC::NewL( length + extra ) );
+            if( ret != KErrNone )
+                {
+                User::InfoPrint( _L("Line show failed, maybe out of memory!!!") );
+                break;
+                }
+            TPtr ptr = iLineTextBuf->Des();
+            ptr.Copy( prints[iLine]->iDescription );
+            ptr.Append( _L( " : " ) );
+            ptr.Append( prints[iLine]->iText );
+            iShowLine = ETrue;
+            break;
+            }
+        case EKeyLeftArrow:
+            {
+            return iParent;
+            }
+		// Go down
+		case EKeyDownArrow:
+			{
+			if ( iFirst + iPosOnScreen == iItemCount - 1 )
+				{
+				// If end of the list, go to beginning
+				iPosOnScreen = 0;
+				iFirst = 0;
+				iLast = iScreenSize;
+				if ( iLast > iItemCount - 1 )
+					{
+					iLast = iItemCount - 1;
+					}
+				iLine = 0;
+				}
+			else 
+				{
+				if ( iPosOnScreen == iScreenSize )
+					{
+					iLast++;
+					iFirst++;
+					}
+				else
+					{
+					// Going down "in-screen", no need to update items
+					iPosOnScreen++;
+					}
+				iLine++;
+				}			
+			break;
+			}
+			
+		// Go Up
+		case EKeyUpArrow:
+			{
+			if ( iFirst + iPosOnScreen == 0 )
+				{
+				// If in the beginning of the list
+
+				iLast = iItemCount - 1;
+				iFirst = iLast - iScreenSize;
+				if ( iFirst < 0 )
+					{
+					iFirst = 0;            	
+					}
+				iPosOnScreen = iLast - iFirst;
+				iLine = iItemCount - 1;
+				}
+			else 
+				{
+				if ( iPosOnScreen == 0 )
+					{
+					iLast--;
+					iFirst--;
+					}
+				else
+					{
+					iPosOnScreen--;
+					}
+				iLine--;
+			}
+			break;
+			}
+		// Additional keys
+		case EKeyHome:
+		case '3':
+			iPosOnScreen = 0;
+			iLine = 0;
+			iFirst = 0;
+			iLast = iScreenSize;
+
+			if ( iLast > iItemCount - 1 )
+				{
+				iLast = iItemCount - 1;
+				}
+			break;
+
+		case EKeyEnd:
+		case '9':
+			iLast = iItemCount - 1;
+			iFirst = iLast - iScreenSize;
+			iLine = iItemCount - 1;
+			
+			if ( iFirst < 0 )
+				{
+				iFirst = 0;
+				}
+			iPosOnScreen = iLast - iFirst;        
+			break;
+
+		case EKeyPageUp:
+		case '1':
+			iFirst = iFirst - iScreenSize;
+			iLast = iLast - iScreenSize;
+
+			if ( iFirst < 0 )
+				{
+				iFirst = 0;
+				iLast = iScreenSize;
+				if ( iLast > iItemCount - 1 )
+					{
+					iLast = iItemCount - 1;
+					}
+				iPosOnScreen = 0;
+				}
+			
+			iLine = iLine - iScreenSize;
+			if ( iLine < 0 )
+				{
+				iLine = 0;
+				}
+			break;
+
+		case EKeyPageDown:
+		case '7':
+			iFirst = iFirst + iScreenSize;
+			iLast = iLast + iScreenSize;
+
+			// Going too far
+			if ( iLast > iItemCount - 1 )
+				{
+				iLast = iItemCount - 1;
+				iFirst = iLast - iScreenSize;
+				if ( iFirst < 0 )
+					{
+					iFirst = 0;
+					}
+				iPosOnScreen = iLast - iFirst;
+				}
+
+			iLine = iLine + iScreenSize;
+			if ( iLine > iItemCount - 1 )
+				{
+				iLine = iItemCount - 1;
+				}
+			break;
+        default:
+            {
+            break;
+            }
+        }
+    
+    return this;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetMenu* CTestSetMenu::NewL( CConsoleMain* aConsole,
+                                        CMenu* aParent,
+                                        const TDesC& aName )
+    {    
+
+    CTestSetMenu* self = new ( ELeave ) CTestSetMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+       
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: CTestSetMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetMenu::CTestSetMenu():
+    iTestSetCreated( EFalse )
+    {
+    
+    iTestSetName.Copy( KDefaultSetName );    
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: ~CTestSetMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestSetMenu::~CTestSetMenu()
+    {
+    
+    delete iSubMenu;
+    iSubMenu = 0;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor. 
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if module can't be appended to list
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetMenu::ConstructL( CConsoleMain* aConsole,
+                                  CMenu* aParent,
+                                  const TDesC& aName
+                                 )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+   
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: SetTestSetName
+
+    Description: Set test set name.
+
+    Parameters: const TFileName& aTestSetName: in: Test set name
+
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetMenu::SetTestSetFileName( const TFileName& aTestSetName )
+    {
+    
+    iTestSetName.Copy( aTestSetName );    
+    
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    if( !iTestSetCreated )
+        {
+        if( aArray.Append( KSetCreate ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if( aArray.Append( KSetLoad ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }        
+        }
+    else
+        {
+        if( aArray.Append( KSetShow ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetStartSeq ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetStartPar ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        if( aArray.Append( KSetRemove ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetSave ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetCaseAdd ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetCaseRemove ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        if( aArray.Append( KSetStartSeqNotRun ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }                
+        }
+        
+    return KErrNone; 
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CTestSetMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestSetMenu::PrintMenuL( TUpdateType aType )
+    {
+    
+    if( iTestSetCreated )
+        {
+        RRefArray<CTestSetInfo> setInfos;
+        TInt ret = iMain->UIStore().TestSets( setInfos );
+
+        CMenu::PrintMenuL( aType );
+
+        if( (  ret != KErrNone ) ||
+            ( setInfos.Count() != 1 ) )
+            {
+            // Should never ever happen
+            User::Panic( KTestSetMenu, KErrGeneral );
+            return;
+            }
+        const CTestSetInfo& set = setInfos[0];
+        setInfos.Reset();
+        setInfos.Close();
+        
+        const RRefArray<const CTestInfo> testCases = set.TestCases();
+        
+        TBuf<KMaxLineLength> line;
+        TInt count = testCases.Count();
+        for(TInt i = 0; i < count && i + ESetLAST <= iScreenSize; i++)
+            {
+            line = _L("    ");
+            LimitedAppend ( line, testCases[i].TestCaseTitle() );
+
+            // Print the line
+            Print(line);
+            }
+        }
+    else
+        {
+        CMenu::PrintMenuL( aType );
+        }    
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle right arrow and enter
+                 here, others in parent menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+    
+    MapKeyCode(aSelection);    
+    
+    if( ( aSelection != EKeyRightArrow ) &&
+        ( aSelection != EKeyEnter ) )
+        {
+        return CMenu::SelectL( aSelection, aContinue );
+        }            
+    
+    TInt ret = KErrNone;        
+    if( !iTestSetCreated )
+        {
+        switch( iPosOnScreen )
+            {
+            case ESetCreate:
+                ret = iMain->UIStore().CreateTestSet( iTestSetName );
+                if( ret != KErrNone )
+                    {
+                    User::InfoPrint( _L("Test set creation failed") );
+                    }
+                break;
+            case ESetLoad: 
+            	return iItems[0];
+            } 
+        if( ret == KErrNone )
+            {
+            iTestSetCreated = ETrue;
+            }      
+        }
+    else
+        {
+        CStartedTestSet::TSetType setType = CStartedTestSet::ESetSequential;
+        switch( iPosOnScreen )
+            {
+            case ESetShow:   
+            // Add the test sets menu
+                delete iSubMenu;
+                iSubMenu = 0;
+                iSubMenu = CStartedTestSetMenu::NewL( iMain, 
+                                        this, 
+                                        _L("Started test sets menu"));
+                return iSubMenu;
+            case ESetRemove: 
+                ret = iMain->UIStore().RemoveTestSet( iTestSetName );
+                if( ret != KErrNone )
+                    {
+                    User::InfoPrint( _L("Test set creation failed") );
+                    }
+                iTestSetCreated = EFalse;  
+                break;
+            case ESetCaseAdd:   
+                delete iSubMenu;
+                iSubMenu = 0;
+                iSubMenu = CTestSetAddCaseMenu::NewL( 
+                                iMain, 
+                                this, 
+                                _L("Add test cases to test set"),
+                                iTestSetName );
+                                
+                return iSubMenu;
+            case ESetCaseRemove: 
+                delete iSubMenu;
+                iSubMenu = 0;
+                iSubMenu =  CTestSetRemoveCaseMenu::NewL( 
+                                iMain, 
+                                this, 
+                                _L("Remove test cases from test set"),
+                                iTestSetName );
+                                
+                                
+                return iSubMenu;  
+            case ESetSave: 
+                ret = iMain->UIStore().SaveTestSet( iTestSetName );
+                if( ret != KErrNone )
+                    {
+                    User::InfoPrint( _L("Test set saving failed") );
+                    }   
+                break;
+  
+  			default:          
+//            case ESetStartPar:   
+//                setType = CStartedTestSet::ESetParallel;
+//            case ESetStartSeq: 
+            //case ESetStartRep: 
+            	if( iPosOnScreen == ESetStartPar )
+                  {
+	            		setType = CStartedTestSet::ESetParallel;
+                  }
+              if( iPosOnScreen == ESetStartSeq || iPosOnScreen == ESetStartSeqNotRun)
+	                {
+	                RRefArray<CTestSetInfo> setInfos;
+	                ret = iMain->UIStore().TestSets( setInfos );
+	                if( (  ret != KErrNone ) ||
+	                    ( setInfos.Count() != 1 ) )
+	                    {
+	                    // Should never ever happen
+	                    User::Panic( KTestSetMenu, KErrGeneral );
+	                    }
+	                const CTestSetInfo& set = setInfos[0];
+	                setInfos.Reset();
+	                setInfos.Close();
+	                
+	                TInt index;
+	                ret = KErrGeneral;
+	                if(iPosOnScreen == ESetStartSeq)
+	                    {
+                        ret = iMain->UIStore().StartTestSet(set, index, setType);
+                        }
+                    else if(iPosOnScreen == ESetStartSeqNotRun)
+                        {
+	                    ret = iMain->UIStore().StartTestSet(set, index, setType, ETrue);
+	                    }
+	                if( ret != KErrNone )
+	                    {
+	                    User::InfoPrint( _L("Test set starting failed") );
+	                    }                 
+	                }    
+                break;
+            }
+        }
+        
+    return this;
+
+    }
+/**
+-------------------------------------------------------------------------------
+
+Class: CTestSetChoiceMenu
+
+Method: NewL
+
+Description: Constructs new menu.
+
+Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+            CMenu* aParent            :in:      Parent menu
+            const TDesC& aName        :in:      Menu name
+
+Return Values: CMenu*                           New menu
+
+Errors/Exceptions: Leaves if memory allocation fails
+                   Leaves if ConstructL leaves.
+
+Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetChoiceMenu* CTestSetChoiceMenu::NewL( CConsoleMain* aConsole,
+                                    CMenu* aParent,
+                                    const TDesC& aName )
+{    
+
+	CTestSetChoiceMenu* self = new ( ELeave ) CTestSetChoiceMenu();
+	CleanupStack::PushL( self );
+	self->ConstructL( aConsole, aParent, aName );
+	CleanupStack::Pop( self );
+	return self;
+
+}
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: CTestSetChoiceMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetChoiceMenu::CTestSetChoiceMenu()
+    
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: ~CTestSetChoiceMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestSetChoiceMenu::~CTestSetChoiceMenu()
+    {
+    
+    
+
+    iFileList.ResetAndDestroy();
+    iFileList.Close();
+
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor. 
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if module can't be appended to list
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetChoiceMenu::ConstructL( CConsoleMain* aConsole,
+                                  CMenu* aParent,
+                                  const TDesC& aName
+                                 )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetChoiceMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+   TInt ret = iMain->UIStore().GetTestSetsList( aArray );
+   TRAPD( err,
+	//Assign aArray to iFileList, it is used in LoadTestSet
+   for( TInt i=0 ; i < aArray.Count(); i++)
+	  {
+	  iFileList.AppendL(aArray[i].AllocL());
+	  }
+     ); // TRAPD
+   return err;       
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CTestSetChoiceMenu
+
+    Method: PrintMenuL
+
+    Description: Prints the menu
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestSetChoiceMenu::PrintMenuL( TUpdateType aType )
+    {
+    
+    iUpdateType = aType;
+    
+    TBuf<KMaxLineLength> line;
+    
+    // Clear display
+    iConsole->ClearScreen();
+
+    // Print menu title
+    Print( Name() );
+    
+    RRefArray<TDesC> texts;
+    if(  iMain->UIStore().GetTestSetsList( texts ) != KErrNone )
+        {
+        return;
+        }
+    
+    TInt oldItemCount = iItemCount;
+     
+    iItemCount = texts.Count();
+
+    // If first time in menu, update start and end positions
+    if( (iFirst == iLast) ||        // First time here..
+        ( iLast >= iItemCount ) ||
+        ( oldItemCount != iItemCount ) )      // Menu size changed
+        {
+        iLast = iItemCount - 1;
+        iPosOnScreen = 0;
+
+        // If "overflow", then adjust the end
+        if (iLast > iScreenSize )
+            {
+            iLast = iScreenSize;
+            }
+        }
+    
+    // Print items
+    for ( TInt i = iFirst; i <= iLast; i++ )
+        {
+        line.Zero();
+        
+        // Append text before line
+        AppendBefore( i, line );
+
+        // Get the menu line
+        LimitedAppend ( line, texts[i] );
+
+        // Print the line
+        Print(line);
+
+        }
+    texts.Close();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetChoiceMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle right arrow and enter
+                 here, others in parent menu.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetChoiceMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+    
+    //return CMenu::SelectL( aSelection, aContinue );    
+    //return iParent;
+	    MapKeyCode(aSelection);
+	    TInt ret = 0;
+    
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {           
+                if(iPosOnScreen < iFileList.Count())
+                    {
+                    const TDesC& aSetName = iFileList.operator [](iPosOnScreen)->Des();
+                
+                    ret = iMain->UIStore().LoadTestSet( iFileList.operator [](iPosOnScreen)->Des() );
+                    if (ret == KErrNone)
+                        {
+                        ((CTestSetMenu*)iParent)->SetCreated();
+                        ((CTestSetMenu*)iParent)->SetTestSetFileName(iFileList.operator [](iPosOnScreen)->Des());
+                        }
+                    return iParent;
+                    }
+                else
+                    {
+                    return this;
+                    }
+                }
+            default:
+                break;
+            }
+            
+    return CMenu::SelectL( aSelection, aContinue );    
+
+    }
+
+
+
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetAddCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetAddCaseMenu* CTestSetAddCaseMenu::NewL( CConsoleMain* aConsole,
+                                            CMenu* aParent,
+                                            const TDesC& aName,
+                                            TDesC& aTestSetName )
+    {
+
+    CTestSetAddCaseMenu* self = 
+        new ( ELeave ) CTestSetAddCaseMenu( aTestSetName );
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetAddCaseMenu
+
+    Method: CTestSetAddCaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetAddCaseMenu::CTestSetAddCaseMenu( TDesC& aTestSetName ):
+    iTestSetName( aTestSetName )    
+    {
+    
+    iMenuItemsCount = EAddSelected + 1;
+    iMenuTotCount += iMenuItemsCount;
+    
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetAddCaseMenu
+
+    Method: ~CTestSetAddCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetAddCaseMenu::~CTestSetAddCaseMenu()
+    {
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetAddCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetAddCaseMenu::ConstructL( CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName )
+    {
+
+    CCaseStartMenu::ConstructL( aConsole, aParent, aName );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetAddCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetAddCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    if ( iSetFinished )
+        {
+        if( aArray.Append( KAddSelected ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    return CMultipleBaseMenu::ItemTexts( aArray );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetAddCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetAddCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    if ( iSetFinished )
+        {
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {
+
+                if ( iFirst + iPosOnScreen == EAddSelected )
+                    {
+                    TInt count = iTestCases.Count();    
+                    for( TInt i=0; i<count; i++ )
+                        {
+                        if ( iSetState[i] )
+                            {
+                            TInt ret = 
+                                iMain->UIStore().AddToTestSet( iTestSetName,
+                                                               iTestCases[i] );
+                            if( ret != KErrNone )
+                                {
+                                User::InfoPrint( _L("Test case adding failed") );
+                                }   
+                            }
+                        } 
+                    return iParent;
+                    }               
+                }
+                break;
+            default:
+                break;
+            }
+        }   
+        
+    return CMultipleBaseMenu::SelectL( aSelection, aContinue );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetAddCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetRemoveCaseMenu* CTestSetRemoveCaseMenu::NewL( CConsoleMain* aConsole,
+                                            CMenu* aParent,
+                                            const TDesC& aName,
+                                            TDesC& aTestSetName )
+    {
+
+    CTestSetRemoveCaseMenu* self = 
+        new ( ELeave ) CTestSetRemoveCaseMenu( aTestSetName );
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetRemoveCaseMenu
+
+    Method: CTestSetRemoveCaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetRemoveCaseMenu::CTestSetRemoveCaseMenu( TDesC& aTestSetName ):
+    iTestSetName( aTestSetName )    
+    {
+    
+    iMenuItemsCount = ERemoveSelected + 1;
+    iMenuTotCount += iMenuItemsCount;
+    
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    CTestSetRemoveCaseMenu
+
+    Method: ~CTestSetRemoveCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetRemoveCaseMenu::~CTestSetRemoveCaseMenu()
+    {
+    }   
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetRemoveCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetRemoveCaseMenu::ConstructL( CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName )
+    {
+
+    CCaseStartMenu::ConstructL( aConsole, aParent, aName );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetRemoveCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetRemoveCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+
+    if ( iSetFinished )
+        {
+        if( aArray.Append( KRemoveSelected ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    return CMultipleBaseMenu::ItemTexts( aArray );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetRemoveCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetRemoveCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    if ( iSetFinished )
+        {
+        switch ( aSelection )
+            {
+            case EKeyEnter:
+            case EKeyRightArrow:
+                {
+
+                if ( iFirst + iPosOnScreen == ERemoveSelected )
+                    {
+                    TInt count = iTestCases.Count();    
+                    for( TInt i=0; i<count; i++ )
+                        {
+                        if ( iSetState[i] )
+                            {
+                            TInt ret = 
+                                iMain->UIStore().RemoveFromTestSet( iTestSetName,
+                                                                    iTestCases[i] );
+                            if( ret != KErrNone )
+                                {
+                                User::InfoPrint( _L("Test case adding failed") );
+                                }   
+                            }
+                        } 
+                    return iParent;
+                    }               
+                }
+                break;
+            default:
+                break;
+            }
+        }   
+        
+    return CMultipleBaseMenu::SelectL( aSelection, aContinue );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetRemoveCaseMenu
+
+    Method: UpdateTestCases
+
+    Description: 
+
+    Parameters: 
+
+    Return Values: 
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetRemoveCaseMenu::UpdateTestCases()
+    {
+    
+    TRAPD( err,
+        const CTestSetInfo& set = iMain->UIStore().TestSetL( iTestSetName );                
+        const RRefArray<const CTestInfo>& testCases = set.TestCases();
+
+        // Update test cases
+        iTestCases.Reset();
+        iSetState.Reset();
+        
+        TInt count = testCases.Count();
+        for( TInt i=0; i<count; i++ )
+            {
+            err = iTestCases.Append( testCases[i] );
+            if( err != KErrNone )
+                {
+                break;
+                }
+            }
+
+        ); // TRAPD
+                
+    return err;
+                
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestSetMenu* CStartedTestSetMenu::NewL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName )
+    {
+
+    CStartedTestSetMenu* self = new ( ELeave ) CStartedTestSetMenu();
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: CStartedTestSetMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestSetMenu::CStartedTestSetMenu()
+    {
+    iType = CUIStoreIf::ESetAll;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if memory allocation fails
+                       Leaves if CCaseOperation menu NewL leaves
+                       Leaves if UpcateCaseListL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CStartedTestSetMenu::ConstructL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName )
+    {
+
+    CMenu::ConstructL( aConsole, aParent, aName);
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: ~CStartedTestSetMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CStartedTestSetMenu::~CStartedTestSetMenu()
+    {
+
+    delete iCaseMenu;
+    iCaseMenu = 0;
+    
+    iTestSets.Reset();
+    iTestSets.Close();
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStartedTestSetMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    iTestSets.Reset();
+    
+    TInt ret = iMain->UIStore().StartedTestSets( iTestSets, iType );
+    if ( ret != KErrNone )
+    	{
+    	return ret;
+    	}
+
+    TInt count = iTestSets.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aArray.Append( iTestSets[i].TestSetInfo().Name() ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CStartedTestSetMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number 
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CStartedTestSetMenu::AppendBefore( TInt aLineNum, TDes& aLine )
+    {
+    
+    CMenu::AppendBefore( aLineNum, aLine );
+    
+    if( ( aLine.MaxLength() - aLine.Length() ) < 2 )
+        {
+        return;
+        }        
+    if( iTestSets[aLineNum].Status() & CUIStoreIf::ESetRunning )
+        {
+        aLine.Append( _L("O ") );
+        }
+    else if( iTestSets[aLineNum].Status() & CUIStoreIf::ESetPassed )
+        {
+        aLine.Append( _L("P ") );
+        }    
+    else if( iTestSets[aLineNum].Status() & CUIStoreIf::ESetFailed )
+        {
+        aLine.Append( _L("F ") );
+        }    
+            
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSetMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle Enter and Right Arrow
+    here, other will be handled in CMenu::SelectL
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CStartedTestSetMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+
+    MapKeyCode(aSelection);
+    
+    switch (aSelection)
+        {
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            if ( iFirst + iPosOnScreen < iTestSets.Count() )
+                {
+                delete iCaseMenu;
+                iCaseMenu = 0;
+                iCaseMenu = CTestSetCaseMenu::NewL( 
+                    iMain, 
+                    this, 
+                    iTestSets[iFirst + iPosOnScreen].TestSetInfo().Name(), 
+                    iTestSets[iFirst + iPosOnScreen] ); 
+
+                return iCaseMenu;
+                }
+            }
+            return this;
+        default:
+            break;
+        }   
+        
+    // Let the parent class handle rest
+    return CMenu::SelectL(aSelection, aContinue);
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetCaseMenu* CTestSetCaseMenu::NewL( CConsoleMain* aConsole, 
+                                          CMenu* aParent, 
+                                          const TDesC& aName,
+                                          CStartedTestSet& aTestSet  )
+    {
+
+    CTestSetCaseMenu* self = new ( ELeave ) CTestSetCaseMenu( aTestSet );
+    CleanupStack::PushL( self );
+    self->ConstructL( aConsole, aParent, aName );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: CTestSetCaseMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetCaseMenu::CTestSetCaseMenu( CStartedTestSet& aTestSet ):
+    iTestSet( aTestSet )
+    {
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+                TCaseState aType          :in:      Case state
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if parent class ConstructL leaves
+                       Leaves if memory allocation fails
+                       Leaves if CCaseOperation menu NewL leaves
+                       Leaves if UpcateCaseListL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetCaseMenu::ConstructL( CConsoleMain* aConsole, 
+                            CMenu* aParent, 
+                            const TDesC& aName )
+    {
+
+    CCaseMenu::ConstructL( aConsole, aParent, aName, 
+                           CUIStoreIf::EStatusAll );
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: ~CTestSetCaseMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestSetCaseMenu::~CTestSetCaseMenu()
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetCaseMenu::ItemTexts( RRefArray<TDesC>& aArray )
+    {
+    
+    if ( iTestSet.Status() & CUIStoreIf::ESetRunning )
+        {
+        if( aArray.Append( KCancelTestSet ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    const RRefArray<CStartedTestCase>& testCases = iTestSet.TestCases();
+        
+    iTestCases.Reset();
+    
+    TInt count = testCases.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( iTestCases.Append( testCases[i] ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }  
+        if( aArray.Append( testCases[i].TestInfo().TestCaseTitle() ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }   
+        }
+
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CTestSetCaseMenu
+
+    Method: AppendBefore
+
+    Description: Append text before line.
+
+    Parameters: TInt aLine: in: line number 
+                TDes& aLine: in: line text
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestSetCaseMenu::AppendBefore( TInt aLineNum, TDes& aLine )
+    {
+    
+    CMenu::AppendBefore( aLineNum, aLine );
+   
+    TInt testCaseNum = aLineNum; 
+    if( iTestSet.Status() & CUIStoreIf::ESetRunning ) 
+        {
+        if( aLineNum == 0 )
+            {
+            // "Cancel test set" row
+            return;
+            }
+        testCaseNum--;
+        }
+        
+    if( ( aLine.MaxLength() - aLine.Length() ) < 2 )
+        {
+        return;
+        }        
+    
+   if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusRunning )
+        {
+        aLine.Append( _L("O ") );
+        }
+    else if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusPassed )
+        {
+        aLine.Append( _L("P ") );
+        }
+    else if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusFailed )
+        {
+        aLine.Append( _L("F ") );
+        }
+    else if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusAborted )
+        {
+        aLine.Append( _L("A ") );
+        }
+    else if( iTestCases[testCaseNum].Status() & CUIStoreIf::EStatusCrashed )
+        {
+        aLine.Append( _L("C ") );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetCaseMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CTestSetCaseMenu::SelectL( TKeyCode aSelection, TBool& aContinue )
+    {
+    
+    MapKeyCode(aSelection);
+
+    if( ( aSelection == EKeyEnter ) || ( aSelection == EKeyRightArrow ) )
+        {
+        TInt pos = iFirst + iPosOnScreen; 
+        if( iTestSet.Status() & CUIStoreIf::ESetRunning )
+            {
+            pos--;
+            }               
+        if( pos == -1 )
+            {
+            User::LeaveIfError( 
+                iMain->UIStore().AbortTestSet( iTestSet ) );
+            return iParent;             
+            }
+        else if( pos < iTestCases.Count() )
+            {
+            delete iCaseOperationMenu;
+            iCaseOperationMenu = 0;
+            iCaseOperationMenu = CCaseOperationMenu::NewL( 
+                iMain, 
+                this, 
+                iTestCases[pos].TestInfo().TestCaseTitle(), 
+                &iTestCases[pos] ); 
+
+            return iCaseOperationMenu;
+            }
+        }
+
+        // Let the parent class handle rest
+    return CMenu::SelectL(aSelection, aContinue);
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: NewL
+
+    Description: Constructs new menu.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: Leaves if memory allocation fails
+                       Leaves if ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CFilterMenu* CFilterMenu::NewL(CConsoleMain* aConsole,
+                               CMenu* aParent,
+                               const TDesC& aName)
+    {
+    CFilterMenu* self = new (ELeave) CFilterMenu();
+    CleanupStack::PushL(self);
+    self->ConstructL(aConsole, aParent, aName);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CConsoleMain* aConsole    :in:      Pointer to main console
+                CMenu* aParent            :in:      Parent menu
+                const TDesC& aName        :in:      Menu name
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CFilterMenu::ConstructL(CConsoleMain* aConsole,
+                             CMenu* aParent,
+                             const TDesC& aName
+                            )
+    {
+    CMenu::ConstructL(aConsole, aParent, aName);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    CFilterMenu
+
+    Method: CFilterMenu
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CFilterMenu::CFilterMenu()
+    {
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    CFilterMenu
+
+    Method: ~CFilterMenu
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CFilterMenu::~CFilterMenu()
+    {
+    delete iTestCaseMenu;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: ItemText
+
+    Description: Returns menu item text
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CFilterMenu::ItemTexts(RRefArray<TDesC>& aArray)
+    {
+    const RPointerArray<TDesC> &filters = iMain->GetFilterArray();
+    TInt ret;
+    
+    TInt count = filters.Count();
+    for(TInt i = 0; i < count; i++)
+        {    
+        ret = aArray.Append(*filters[i]);
+        if(ret != KErrNone)
+            {
+            return ret;
+            }
+        }
+        
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: SelectL
+
+    Description: Process keypresses in menu. Handle enter and right arrow here,
+    others in CMenu::SelectL.
+
+    Parameters: TKeyCode aSelection       :in:      Key
+                TBool& aContinue          :out:     Has user pressed "Quit"
+
+    Return Values: CMenu*                           New menu
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CMenu* CFilterMenu::SelectL(TKeyCode aSelection, TBool& aContinue)
+    {
+    const RPointerArray<TDesC> &filters = iMain->GetFilterArray();
+    
+    MapKeyCode(aSelection);
+    
+    switch ( aSelection )
+        {
+        case EKeyEnter:
+        case EKeyRightArrow:
+            {
+            // Start the case
+            if((iFirst + iPosOnScreen) < filters.Count())
+                {
+                // Show test cases menu
+                iMain->SetFilterIndex(iFirst + iPosOnScreen);
+                if(iTestCaseMenu)
+                    {
+                    return iTestCaseMenu;
+                    }
+                else
+                    {
+                    RDebug::Print(_L("STIF: CFilterMenu::SelectL: test case menu is not set, however it should be"));
+                    return this;
+                    }
+                }
+            else
+                {
+                return this;
+                }
+            }
+
+        default:
+            return CMenu::SelectL( aSelection, aContinue);
+        }
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFilterMenu
+
+    Method: SetTestCaseMenu
+
+    Description: Set pointer to test case menu, so it can be shown when user
+                 selects filter.
+                 This menu will be deleted along with the filter menu.
+
+    Parameters: CMenu* aTestCaseMenu      :in:      test case menu
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CFilterMenu::SetTestCaseMenu(CMenu* aTestCaseMenu)
+    {
+    if(iTestCaseMenu)
+        {
+        RDebug::Print(_L("STIF: CFilterMenu::SetTestCaseMenu: test case menu is already set!"));
+        delete iTestCaseMenu;
+        iTestCaseMenu = NULL;
+        }
+    iTestCaseMenu = aTestCaseMenu;
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/Bmarm/STIFTFWIFU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,58 @@
+EXPORTS
+	__10CUIStoreIf @ 1 NONAME R3UNUSED ; CUIStoreIf::CUIStoreIf(void)
+	AddTestCaseFile__10CStifTFwIfR7TDesC16T1 @ 2 NONAME R3UNUSED ; CStifTFwIf::AddTestCaseFile(TDesC16 &, TDesC16 &)
+	AddTestCaseFile__8CUIStoreRC7TDesC16T1 @ 3 NONAME R3UNUSED ; CUIStore::AddTestCaseFile(TDesC16 const &, TDesC16 const &)
+	AddTestModule__10CStifTFwIfR7TDesC16T1 @ 4 NONAME R3UNUSED ; CStifTFwIf::AddTestModule(TDesC16 &, TDesC16 &)
+	AddTestModule__8CUIStoreRC7TDesC16T1 @ 5 NONAME R3UNUSED ; CUIStore::AddTestModule(TDesC16 const &, TDesC16 const &)
+	AddToTestSet__8CUIStoreRC7TDesC16RC9CTestInfo @ 6 NONAME R3UNUSED ; CUIStore::AddToTestSet(TDesC16 const &, CTestInfo const &)
+	AtsReceive__10CStifTFwIfRC7TDesC16 @ 7 NONAME R3UNUSED ; CStifTFwIf::AtsReceive(TDesC16 const &)
+	CancelTestCase__10CStifTFwIfi @ 8 NONAME R3UNUSED ; CStifTFwIf::CancelTestCase(int)
+	CancelTest__18CUIEngineContainer @ 9 NONAME R3UNUSED ; CUIEngineContainer::CancelTest(void)
+	Close__10CStifTFwIf @ 10 NONAME R3UNUSED ; CStifTFwIf::Close(void)
+	Close__8CUIStore @ 11 NONAME R3UNUSED ; CUIStore::Close(void)
+	ConstructL__10CUIStoreIf @ 12 NONAME R3UNUSED ; CUIStoreIf::ConstructL(void)
+	CreateTestSet__8CUIStoreRC7TDesC16 @ 13 NONAME R3UNUSED ; CUIStore::CreateTestSet(TDesC16 const &)
+	GetTestCases__10CStifTFwIfRt13RPointerArray1Z9CTestInfoR7TDesC16T2 @ 14 NONAME ; CStifTFwIf::GetTestCases(RPointerArray<CTestInfo> &, TDesC16 &, TDesC16 &)
+	GoingToReboot__8CStifTFwP18CUIEngineContainerR14TRequestStatus @ 15 NONAME R3UNUSED ; CStifTFw::GoingToReboot(CUIEngineContainer *, TRequestStatus &)
+	InsertToTestSet__8CUIStoreRC7TDesC16RC9CTestInfoi @ 16 NONAME ; CUIStore::InsertToTestSet(TDesC16 const &, CTestInfo const &, int)
+	ListAllModules__8CUIStoreRt13RPointerArray1Z7TDesC16 @ 17 NONAME R3UNUSED ; CUIStore::ListAllModules(RPointerArray<TDesC16> &)
+	LoadAllModules__8CUIStore @ 18 NONAME R3UNUSED ; CUIStore::LoadAllModules(void)
+	LoadSavedTestCases__8CUIStore @ 19 NONAME R3UNUSED ; CUIStore::LoadSavedTestCases(void)
+	LoadTestSet__8CUIStoreRC7TDesC16 @ 20 NONAME R3UNUSED ; CUIStore::LoadTestSet(TDesC16 const &)
+	Modules__8CUIStoreRt9RRefArray1Z7TDesC16 @ 21 NONAME R3UNUSED ; CUIStore::Modules(RRefArray<TDesC16> &)
+	NewL__9CTestInfo @ 22 NONAME R3UNUSED ; CTestInfo::NewL(void)
+	Open__10CStifTFwIfR7TDesC16 @ 23 NONAME R3UNUSED ; CStifTFwIf::Open(TDesC16 &)
+	Open__8CUIStoreRC7TDesC16 @ 24 NONAME R3UNUSED ; CUIStore::Open(TDesC16 const &)
+	PauseTestCase__10CStifTFwIfi @ 25 NONAME R3UNUSED ; CStifTFwIf::PauseTestCase(int)
+	PauseTest__18CUIEngineContainer @ 26 NONAME R3UNUSED ; CUIEngineContainer::PauseTest(void)
+	PrintProg__8CStifTFwP18CUIEngineContainerR13TTestProgress @ 27 NONAME R3UNUSED ; CStifTFw::PrintProg(CUIEngineContainer *, TTestProgress &)
+	RemoteMsg__8CStifTFwP18CUIEngineContainerRC7TDesC16 @ 28 NONAME R3UNUSED ; CStifTFw::RemoteMsg(CUIEngineContainer *, TDesC16 const &)
+	RemoveFromTestSet__8CUIStoreRC7TDesC16RC9CTestInfo @ 29 NONAME R3UNUSED ; CUIStore::RemoveFromTestSet(TDesC16 const &, CTestInfo const &)
+	RemoveTestCaseFile__10CStifTFwIfR7TDesC16T1 @ 30 NONAME R3UNUSED ; CStifTFwIf::RemoveTestCaseFile(TDesC16 &, TDesC16 &)
+	RemoveTestCaseFile__8CUIStoreRC7TDesC16T1 @ 31 NONAME R3UNUSED ; CUIStore::RemoveTestCaseFile(TDesC16 const &, TDesC16 const &)
+	RemoveTestModule__10CStifTFwIfR7TDesC16 @ 32 NONAME R3UNUSED ; CStifTFwIf::RemoveTestModule(TDesC16 &)
+	RemoveTestModule__8CUIStoreRC7TDesC16 @ 33 NONAME R3UNUSED ; CUIStore::RemoveTestModule(TDesC16 const &)
+	RemoveTestSet__8CUIStoreRC7TDesC16 @ 34 NONAME R3UNUSED ; CUIStore::RemoveTestSet(TDesC16 const &)
+	ResumeTestCase__10CStifTFwIfi @ 35 NONAME R3UNUSED ; CStifTFwIf::ResumeTestCase(int)
+	ResumeTest__18CUIEngineContainer @ 36 NONAME R3UNUSED ; CUIEngineContainer::ResumeTest(void)
+	SaveTestSet__8CUIStoreRC7TDesC16 @ 37 NONAME R3UNUSED ; CUIStore::SaveTestSet(TDesC16 const &)
+	SetAttribute__10CStifTFwIf10TAttributeRC7TDesC16 @ 38 NONAME R3UNUSED ; CStifTFwIf::SetAttribute(TAttribute, TDesC16 const &)
+	StartTestCase__10CStifTFwIfRiRC9CTestInfo @ 39 NONAME R3UNUSED ; CStifTFwIf::StartTestCase(int &, CTestInfo const &)
+	StartTestCase__8CUIStoreRC9CTestInfoRi @ 40 NONAME R3UNUSED ; CUIStore::StartTestCase(CTestInfo const &, int &)
+	StartTestSet__8CUIStoreRC12CTestSetInfoRiQ215CStartedTestSet8TSetType @ 41 NONAME ; CUIStore::StartTestSet(CTestSetInfo const &, int &, CStartedTestSet::TSetType)
+	StartedTestCaseL__8CUIStorei @ 42 NONAME R3UNUSED ; CUIStore::StartedTestCaseL(int)
+	StartedTestCases__8CUIStoreRt9RRefArray1Z16CStartedTestCaseiRC7TDesC16T3 @ 43 NONAME ; CUIStore::StartedTestCases(RRefArray<CStartedTestCase> &, int, TDesC16 const &, TDesC16 const &)
+	StartedTestSetL__8CUIStorei @ 44 NONAME R3UNUSED ; CUIStore::StartedTestSetL(int)
+	StartedTestSets__8CUIStoreRt9RRefArray1Z15CStartedTestSeti @ 45 NONAME R3UNUSED ; CUIStore::StartedTestSets(RRefArray<CStartedTestSet> &, int)
+	TestCaseFiles__8CUIStoreRt9RRefArray1Z7TDesC16RC7TDesC16 @ 46 NONAME R3UNUSED ; CUIStore::TestCaseFiles(RRefArray<TDesC16> &, TDesC16 const &)
+	TestCases__8CUIStoreRt9RRefArray1Z9CTestInfoRC7TDesC16T2 @ 47 NONAME ; CUIStore::TestCases(RRefArray<CTestInfo> &, TDesC16 const &, TDesC16 const &)
+	TestExecuted__8CStifTFwP18CUIEngineContainerR15TFullTestResult @ 48 NONAME R3UNUSED ; CStifTFw::TestExecuted(CUIEngineContainer *, TFullTestResult &)
+	TestSetL__8CUIStoreRC7TDesC16 @ 49 NONAME R3UNUSED ; CUIStore::TestSetL(TDesC16 const &)
+	TestSets__8CUIStoreRt9RRefArray1Z12CTestSetInfo @ 50 NONAME R3UNUSED ; CUIStore::TestSets(RRefArray<CTestSetInfo> &)
+	UIEngineContainer__C16CStartedTestCase @ 51 NONAME R3UNUSED ; CStartedTestCase::UIEngineContainer(void) const
+	UIStore__10CUIStoreIf @ 52 NONAME R3UNUSED ; CUIStoreIf::UIStore(void)
+	"_._10CStifTFwIf" @ 53 NONAME R3UNUSED ; CStifTFwIf::~CStifTFwIf(void)
+	"_._10CUIStoreIf" @ 54 NONAME R3UNUSED ; CUIStoreIf::~CUIStoreIf(void)
+	__10CStifTFwIf @ 55 NONAME R3UNUSED ; CStifTFwIf::CStifTFwIf(void)
+	AbortTestSet__8CUIStoreR15CStartedTestSet @ 56 NONAME R3UNUSED ; CUIStore::AbortTestSet(CStartedTestSet &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/Bwins/STIFTFWIFU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,64 @@
+EXPORTS
+	??0CStifTFwIf@@IAE@XZ @ 1 NONAME ; CStifTFwIf::CStifTFwIf(void)
+	??0CUIStoreIf@@IAE@XZ @ 2 NONAME ; CUIStoreIf::CUIStoreIf(void)
+	??1CStifTFwIf@@UAE@XZ @ 3 NONAME ; CStifTFwIf::~CStifTFwIf(void)
+	??1CUIStoreIf@@UAE@XZ @ 4 NONAME ; CUIStoreIf::~CUIStoreIf(void)
+	?AbortTestSet@CUIStore@@QAEHAAVCStartedTestSet@@@Z @ 5 NONAME ; int CUIStore::AbortTestSet(class CStartedTestSet &)
+	?AddTestCaseFile@CStifTFwIf@@IAEHAAVTDesC16@@0@Z @ 6 NONAME ; int CStifTFwIf::AddTestCaseFile(class TDesC16 &, class TDesC16 &)
+	?AddTestCaseFile@CUIStore@@QAEHABVTDesC16@@0@Z @ 7 NONAME ; int CUIStore::AddTestCaseFile(class TDesC16 const &, class TDesC16 const &)
+	?AddTestModule@CStifTFwIf@@IAEHAAVTDesC16@@0@Z @ 8 NONAME ; int CStifTFwIf::AddTestModule(class TDesC16 &, class TDesC16 &)
+	?AddTestModule@CUIStore@@QAEHABVTDesC16@@0@Z @ 9 NONAME ; int CUIStore::AddTestModule(class TDesC16 const &, class TDesC16 const &)
+	?AddToTestSet@CUIStore@@QAEHABVTDesC16@@ABVCTestInfo@@@Z @ 10 NONAME ; int CUIStore::AddToTestSet(class TDesC16 const &, class CTestInfo const &)
+	?AtsReceive@CStifTFwIf@@IAEHABVTDesC16@@@Z @ 11 NONAME ; int CStifTFwIf::AtsReceive(class TDesC16 const &)
+	?CancelTest@CUIEngineContainer@@QAEHXZ @ 12 NONAME ; int CUIEngineContainer::CancelTest(void)
+	?CancelTestCase@CStifTFwIf@@IAEHH@Z @ 13 NONAME ; int CStifTFwIf::CancelTestCase(int)
+	?Close@CStifTFwIf@@IAEHXZ @ 14 NONAME ; int CStifTFwIf::Close(void)
+	?Close@CUIStore@@QAEHXZ @ 15 NONAME ; int CUIStore::Close(void)
+	?ConstructL@CUIStoreIf@@IAEXXZ @ 16 NONAME ; void CUIStoreIf::ConstructL(void)
+	?CreateTestSet@CUIStore@@QAEHABVTDesC16@@@Z @ 17 NONAME ; int CUIStore::CreateTestSet(class TDesC16 const &)
+	?GetTestCases@CStifTFwIf@@IAEHAAV?$RPointerArray@VCTestInfo@@@@AAVTDesC16@@1@Z @ 18 NONAME ; int CStifTFwIf::GetTestCases(class RPointerArray<class CTestInfo> &, class TDesC16 &, class TDesC16 &)
+	?GoingToReboot@CStifTFw@@EAEHPAVCUIEngineContainer@@AAVTRequestStatus@@@Z @ 19 NONAME ; int CStifTFw::GoingToReboot(class CUIEngineContainer *, class TRequestStatus &)
+	?InsertToTestSet@CUIStore@@QAEHABVTDesC16@@ABVCTestInfo@@H@Z @ 20 NONAME ; int CUIStore::InsertToTestSet(class TDesC16 const &, class CTestInfo const &, int)
+	?ListAllModules@CUIStore@@QAEHAAV?$RPointerArray@VTDesC16@@@@@Z @ 21 NONAME ; int CUIStore::ListAllModules(class RPointerArray<class TDesC16> &)
+	?LoadAllModules@CUIStore@@QAEHXZ @ 22 NONAME ; int CUIStore::LoadAllModules(void)
+	?LoadSavedTestCases@CUIStore@@QAEHXZ @ 23 NONAME ; int CUIStore::LoadSavedTestCases(void)
+	?LoadTestSet@CUIStore@@QAEHABVTDesC16@@@Z @ 24 NONAME ; int CUIStore::LoadTestSet(class TDesC16 const &)
+	?Modules@CUIStore@@QAEHAAV?$RRefArray@VTDesC16@@@@@Z @ 25 NONAME ; int CUIStore::Modules(class RRefArray<class TDesC16> &)
+	?NewL@CTestInfo@@SAPAV1@XZ @ 26 NONAME ; class CTestInfo * CTestInfo::NewL(void)
+	?Open@CStifTFwIf@@IAEHAAVTDesC16@@@Z @ 27 NONAME ; int CStifTFwIf::Open(class TDesC16 &)
+	?Open@CUIStore@@QAEHABVTDesC16@@@Z @ 28 NONAME ; int CUIStore::Open(class TDesC16 const &)
+	?PauseTest@CUIEngineContainer@@QAEHXZ @ 29 NONAME ; int CUIEngineContainer::PauseTest(void)
+	?PauseTestCase@CStifTFwIf@@IAEHH@Z @ 30 NONAME ; int CStifTFwIf::PauseTestCase(int)
+	?PrintProg@CStifTFw@@EAEHPAVCUIEngineContainer@@AAVTTestProgress@@@Z @ 31 NONAME ; int CStifTFw::PrintProg(class CUIEngineContainer *, class TTestProgress &)
+	?RemoteMsg@CStifTFw@@EAEHPAVCUIEngineContainer@@ABVTDesC16@@@Z @ 32 NONAME ; int CStifTFw::RemoteMsg(class CUIEngineContainer *, class TDesC16 const &)
+	?RemoveFromTestSet@CUIStore@@QAEHABVTDesC16@@ABVCTestInfo@@@Z @ 33 NONAME ; int CUIStore::RemoveFromTestSet(class TDesC16 const &, class CTestInfo const &)
+	?RemoveTestCaseFile@CStifTFwIf@@IAEHAAVTDesC16@@0@Z @ 34 NONAME ; int CStifTFwIf::RemoveTestCaseFile(class TDesC16 &, class TDesC16 &)
+	?RemoveTestCaseFile@CUIStore@@QAEHABVTDesC16@@0@Z @ 35 NONAME ; int CUIStore::RemoveTestCaseFile(class TDesC16 const &, class TDesC16 const &)
+	?RemoveTestModule@CStifTFwIf@@IAEHAAVTDesC16@@@Z @ 36 NONAME ; int CStifTFwIf::RemoveTestModule(class TDesC16 &)
+	?RemoveTestModule@CUIStore@@QAEHABVTDesC16@@@Z @ 37 NONAME ; int CUIStore::RemoveTestModule(class TDesC16 const &)
+	?RemoveTestSet@CUIStore@@QAEHABVTDesC16@@@Z @ 38 NONAME ; int CUIStore::RemoveTestSet(class TDesC16 const &)
+	?ResumeTest@CUIEngineContainer@@QAEHXZ @ 39 NONAME ; int CUIEngineContainer::ResumeTest(void)
+	?ResumeTestCase@CStifTFwIf@@IAEHH@Z @ 40 NONAME ; int CStifTFwIf::ResumeTestCase(int)
+	?SaveTestSet@CUIStore@@QAEHABVTDesC16@@@Z @ 41 NONAME ; int CUIStore::SaveTestSet(class TDesC16 const &)
+	?SetAttribute@CStifTFwIf@@IAEHW4TAttribute@@ABVTDesC16@@@Z @ 42 NONAME ; int CStifTFwIf::SetAttribute(enum TAttribute, class TDesC16 const &)
+	?StartTestCase@CStifTFwIf@@IAEHAAHABVCTestInfo@@@Z @ 43 NONAME ; int CStifTFwIf::StartTestCase(int &, class CTestInfo const &)
+	?StartTestCase@CUIStore@@QAEHABVCTestInfo@@AAH@Z @ 44 NONAME ; int CUIStore::StartTestCase(class CTestInfo const &, int &)
+	?StartTestSet@CUIStore@@QAEHABVCTestSetInfo@@AAHW4TSetType@CStartedTestSet@@@Z @ 45 NONAME ; int CUIStore::StartTestSet(class CTestSetInfo const &, int &, enum CStartedTestSet::TSetType)
+	?StartedTestCaseL@CUIStore@@QAEAAVCStartedTestCase@@H@Z @ 46 NONAME ; class CStartedTestCase & CUIStore::StartedTestCaseL(int)
+	?StartedTestCases@CUIStore@@QAEHAAV?$RRefArray@VCStartedTestCase@@@@HABVTDesC16@@1@Z @ 47 NONAME ; int CUIStore::StartedTestCases(class RRefArray<class CStartedTestCase> &, int, class TDesC16 const &, class TDesC16 const &)
+	?StartedTestSetL@CUIStore@@QAEAAVCStartedTestSet@@H@Z @ 48 NONAME ; class CStartedTestSet & CUIStore::StartedTestSetL(int)
+	?StartedTestSets@CUIStore@@QAEHAAV?$RRefArray@VCStartedTestSet@@@@H@Z @ 49 NONAME ; int CUIStore::StartedTestSets(class RRefArray<class CStartedTestSet> &, int)
+	?TestCaseFiles@CUIStore@@QAEHAAV?$RRefArray@VTDesC16@@@@ABVTDesC16@@@Z @ 50 NONAME ; int CUIStore::TestCaseFiles(class RRefArray<class TDesC16> &, class TDesC16 const &)
+	?TestCases@CUIStore@@QAEHAAV?$RRefArray@VCTestInfo@@@@ABVTDesC16@@1@Z @ 51 NONAME ; int CUIStore::TestCases(class RRefArray<class CTestInfo> &, class TDesC16 const &, class TDesC16 const &)
+	?TestExecuted@CStifTFw@@EAEXPAVCUIEngineContainer@@AAVTFullTestResult@@@Z @ 52 NONAME ; void CStifTFw::TestExecuted(class CUIEngineContainer *, class TFullTestResult &)
+	?TestSetL@CUIStore@@QAEABVCTestSetInfo@@ABVTDesC16@@@Z @ 53 NONAME ; class CTestSetInfo const & CUIStore::TestSetL(class TDesC16 const &)
+	?TestSets@CUIStore@@QAEHAAV?$RRefArray@VCTestSetInfo@@@@@Z @ 54 NONAME ; int CUIStore::TestSets(class RRefArray<class CTestSetInfo> &)
+	?UIEngineContainer@CStartedTestCase@@QBEAAVCUIEngineContainer@@XZ @ 55 NONAME ; class CUIEngineContainer & CStartedTestCase::UIEngineContainer(void) const
+	?UIStore@CUIStoreIf@@QAEAAVCUIStore@@XZ @ 56 NONAME ; class CUIStore & CUIStoreIf::UIStore(void)
+	?StartTestSet@CUIStore@@QAEHABVCTestSetInfo@@AAHW4TSetType@CStartedTestSet@@H@Z @ 57 NONAME ; int CUIStore::StartTestSet(class CTestSetInfo const &, int &, enum CStartedTestSet::TSetType, int)
+	?UpdateTestSet@CUIStore@@QAEHAAVCTestSetInfo@@@Z @ 58 NONAME ; int CUIStore::UpdateTestSet(class CTestSetInfo &)
+	?ReadFiltersL@CUIStore@@QAEXAAV?$RPointerArray@VTDesC16@@@@@Z @ 59 NONAME ; void CUIStore::ReadFiltersL(class RPointerArray<class TDesC16> &)
+	?GetTestSetsList@CUIStore@@QAEHAAV?$RRefArray@VTDesC16@@@@@Z @ 60 NONAME ; int CUIStore::GetTestSetsList(class RRefArray<class TDesC16> &)
+	?SaveTestSet2@CUIStore@@QAEHAAVTDes16@@@Z @ 61 NONAME ; int CUIStore::SaveTestSet2(class TDes16 &)
+	??1TScriptObject@@UAE@XZ @ 62 NONAME ABSENT ; TScriptObject::~TScriptObject(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/eabi/StifTFwIfu.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,102 @@
+EXPORTS
+	_ZN10CStifTFwIf10AtsReceiveERK7TDesC16 @ 1 NONAME
+	_ZN10CStifTFwIf12GetTestCasesER13RPointerArrayI9CTestInfoER7TDesC16S5_ @ 2 NONAME
+	_ZN10CStifTFwIf12SetAttributeE10TAttributeRK7TDesC16 @ 3 NONAME
+	_ZN10CStifTFwIf13AddTestModuleER7TDesC16S1_ @ 4 NONAME
+	_ZN10CStifTFwIf13PauseTestCaseEi @ 5 NONAME
+	_ZN10CStifTFwIf13StartTestCaseERiRK9CTestInfo @ 6 NONAME
+	_ZN10CStifTFwIf14CancelTestCaseEi @ 7 NONAME
+	_ZN10CStifTFwIf14ResumeTestCaseEi @ 8 NONAME
+	_ZN10CStifTFwIf15AddTestCaseFileER7TDesC16S1_ @ 9 NONAME
+	_ZN10CStifTFwIf16RemoveTestModuleER7TDesC16 @ 10 NONAME
+	_ZN10CStifTFwIf18RemoveTestCaseFileER7TDesC16S1_ @ 11 NONAME
+	_ZN10CStifTFwIf4OpenER7TDesC16 @ 12 NONAME
+	_ZN10CStifTFwIf5CloseEv @ 13 NONAME
+	_ZN10CStifTFwIfC2Ev @ 14 NONAME
+	_ZN10CStifTFwIfD0Ev @ 15 NONAME
+	_ZN10CStifTFwIfD1Ev @ 16 NONAME
+	_ZN10CStifTFwIfD2Ev @ 17 NONAME
+	_ZN10CUIStoreIf10ConstructLEv @ 18 NONAME
+	_ZN10CUIStoreIf7UIStoreEv @ 19 NONAME
+	_ZN10CUIStoreIfC1Ev @ 20 NONAME
+	_ZN10CUIStoreIfC2Ev @ 21 NONAME
+	_ZN10CUIStoreIfD0Ev @ 22 NONAME
+	_ZN10CUIStoreIfD1Ev @ 23 NONAME
+	_ZN10CUIStoreIfD2Ev @ 24 NONAME
+	_ZN18CUIEngineContainer10CancelTestEv @ 25 NONAME
+	_ZN18CUIEngineContainer10ResumeTestEv @ 26 NONAME
+	_ZN18CUIEngineContainer9PauseTestEv @ 27 NONAME
+	_ZN8CStifTFw12TestExecutedEP18CUIEngineContainerR15TFullTestResult @ 28 NONAME
+	_ZN8CStifTFw13GoingToRebootEP18CUIEngineContainerR14TRequestStatus @ 29 NONAME
+	_ZN8CStifTFw9PrintProgEP18CUIEngineContainerR13TTestProgress @ 30 NONAME
+	_ZN8CStifTFw9RemoteMsgEP18CUIEngineContainerRK7TDesC16 @ 31 NONAME
+	_ZN8CUIStore11LoadTestSetERK7TDesC16 @ 32 NONAME
+	_ZN8CUIStore11SaveTestSetERK7TDesC16 @ 33 NONAME
+	_ZN8CUIStore12AbortTestSetER15CStartedTestSet @ 34 NONAME
+	_ZN8CUIStore12AddToTestSetERK7TDesC16RK9CTestInfo @ 35 NONAME
+	_ZN8CUIStore12StartTestSetERK12CTestSetInfoRiN15CStartedTestSet8TSetTypeE @ 36 NONAME
+	_ZN8CUIStore13AddTestModuleERK7TDesC16S2_ @ 37 NONAME
+	_ZN8CUIStore13CreateTestSetERK7TDesC16 @ 38 NONAME
+	_ZN8CUIStore13RemoveTestSetERK7TDesC16 @ 39 NONAME
+	_ZN8CUIStore13StartTestCaseERK9CTestInfoRi @ 40 NONAME
+	_ZN8CUIStore13TestCaseFilesER9RRefArrayI7TDesC16ERKS1_ @ 41 NONAME
+	_ZN8CUIStore14ListAllModulesER13RPointerArrayI7TDesC16E @ 42 NONAME
+	_ZN8CUIStore14LoadAllModulesEv @ 43 NONAME
+	_ZN8CUIStore15AddTestCaseFileERK7TDesC16S2_ @ 44 NONAME
+	_ZN8CUIStore15InsertToTestSetERK7TDesC16RK9CTestInfoi @ 45 NONAME
+	_ZN8CUIStore15StartedTestSetLEi @ 46 NONAME
+	_ZN8CUIStore15StartedTestSetsER9RRefArrayI15CStartedTestSetEi @ 47 NONAME
+	_ZN8CUIStore16RemoveTestModuleERK7TDesC16 @ 48 NONAME
+	_ZN8CUIStore16StartedTestCaseLEi @ 49 NONAME
+	_ZN8CUIStore16StartedTestCasesER9RRefArrayI16CStartedTestCaseEiRK7TDesC16S6_ @ 50 NONAME
+	_ZN8CUIStore17RemoveFromTestSetERK7TDesC16RK9CTestInfo @ 51 NONAME
+	_ZN8CUIStore18LoadSavedTestCasesEv @ 52 NONAME
+	_ZN8CUIStore18RemoveTestCaseFileERK7TDesC16S2_ @ 53 NONAME
+	_ZN8CUIStore4OpenERK7TDesC16 @ 54 NONAME
+	_ZN8CUIStore5CloseEv @ 55 NONAME
+	_ZN8CUIStore7ModulesER9RRefArrayI7TDesC16E @ 56 NONAME
+	_ZN8CUIStore8TestSetLERK7TDesC16 @ 57 NONAME
+	_ZN8CUIStore8TestSetsER9RRefArrayI12CTestSetInfoE @ 58 NONAME
+	_ZN8CUIStore9TestCasesER9RRefArrayI9CTestInfoERK7TDesC16S6_ @ 59 NONAME
+	_ZN9CTestInfo4NewLEv @ 60 NONAME
+	_ZNK16CStartedTestCase17UIEngineContainerEv @ 61 NONAME
+	_ZTI10CStifTFwIf @ 62 NONAME ; #<TI>#
+	_ZTI10CUIStoreIf @ 63 NONAME ; #<TI>#
+	_ZTI12CTestSetInfo @ 64 NONAME ; #<TI>#
+	_ZTI13CTestProgress @ 65 NONAME ; #<TI>#
+	_ZTI13CUIStorePopup @ 66 NONAME ; #<TI>#
+	_ZTI14CUIEngineEvent @ 67 NONAME ; #<TI>#
+	_ZTI15CStartedTestSet @ 68 NONAME ; #<TI>#
+	_ZTI15CUIEngineRemote @ 69 NONAME ; #<TI>#
+	_ZTI15CUIEngineRunner @ 70 NONAME ; #<TI>#
+	_ZTI16CStartedTestCase @ 71 NONAME ; #<TI>#
+	_ZTI16CUIEnginePrinter @ 72 NONAME ; #<TI>#
+	_ZTI18CUIEngineContainer @ 73 NONAME ; #<TI>#
+	_ZTI21CUIEngineErrorPrinter @ 74 NONAME ; #<TI>#
+	_ZTI8CStifTFw @ 75 NONAME ; #<TI>#
+	_ZTI8CUIStore @ 76 NONAME ; #<TI>#
+	_ZTI9CTestInfo @ 77 NONAME ; #<TI>#
+	_ZTI9CUIEngine @ 78 NONAME ; #<TI>#
+	_ZTV10CStifTFwIf @ 79 NONAME ; #<VT>#
+	_ZTV10CUIStoreIf @ 80 NONAME ; #<VT>#
+	_ZTV12CTestSetInfo @ 81 NONAME ; #<VT>#
+	_ZTV13CTestProgress @ 82 NONAME ; #<VT>#
+	_ZTV13CUIStorePopup @ 83 NONAME ; #<VT>#
+	_ZTV14CUIEngineEvent @ 84 NONAME ; #<VT>#
+	_ZTV15CStartedTestSet @ 85 NONAME ; #<VT>#
+	_ZTV15CUIEngineRemote @ 86 NONAME ; #<VT>#
+	_ZTV15CUIEngineRunner @ 87 NONAME ; #<VT>#
+	_ZTV16CStartedTestCase @ 88 NONAME ; #<VT>#
+	_ZTV16CUIEnginePrinter @ 89 NONAME ; #<VT>#
+	_ZTV18CUIEngineContainer @ 90 NONAME ; #<VT>#
+	_ZTV21CUIEngineErrorPrinter @ 91 NONAME ; #<VT>#
+	_ZTV8CStifTFw @ 92 NONAME ; #<VT>#
+	_ZTV8CUIStore @ 93 NONAME ; #<VT>#
+	_ZTV9CTestInfo @ 94 NONAME ; #<VT>#
+	_ZTV9CUIEngine @ 95 NONAME ; #<VT>#
+	_ZN8CUIStore12StartTestSetERK12CTestSetInfoRiN15CStartedTestSet8TSetTypeEi @ 96 NONAME
+	_ZN8CUIStore13UpdateTestSetER12CTestSetInfo @ 97 NONAME
+	_ZN8CUIStore12ReadFiltersLER13RPointerArrayI7TDesC16E @ 98 NONAME
+	_ZN8CUIStore15GetTestSetsListER9RRefArrayI7TDesC16E @ 99 NONAME
+	_ZN8CUIStore12SaveTestSet2ER6TDes16 @ 100 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/group/StifTFwIf.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,62 @@
+/*
+* 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: MMP file for STIF Test Framework's StifTfIf module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+TARGET      		StifTFwIf.dll
+TARGETTYPE  		dll
+
+
+CAPABILITY		ALL -TCB
+VENDORID 		0x101FB657
+SECUREID        0x102073DE
+
+
+DEFFILE     		StifTFwIf.def
+
+
+UID			0x1000007a
+
+USERINCLUDE     	../inc
+USERINCLUDE     	../../../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      	../src
+
+SOURCE            StifTFwIf.cpp 
+SOURCE            UIEngine.cpp
+SOURCE            UIEngineContainer.cpp
+SOURCE            UIEngineRunner.cpp
+SOURCE            UIEnginePrinter.cpp
+SOURCE            UIEngineError.cpp
+SOURCE            UIEngineEvent.cpp
+SOURCE            UIEngineRemote.cpp
+SOURCE            UIStore.cpp
+SOURCE            UIStoreContainer.cpp
+SOURCE            UIStorePopup.cpp
+
+LIBRARY           euser.lib
+LIBRARY           stiftestengine.lib
+LIBRARY           stiftestinterface.lib
+LIBRARY           efsrv.lib
+LIBRARY           stfeventsystemclient.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,37 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STIF Test Framework's 
+*	StifTFwIf.
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+	StifTFwIf.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/inc/Logging.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,76 @@
+/*
+* 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: This file contains Logging macros for test combiner
+*
+*/
+
+#ifndef LOGGINGDEFS_H
+#define LOGGINGDEFS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+
+// CONSTANTS
+const TUint KError              = 0x1;
+const TUint KInit               = 0x2;
+const TUint KPrint              = 0x4;
+const TUint KMessage            = 0x10;
+const TUint KFunction           = 0x20;
+const TUint KVerbose            = 0x40;
+const TUint KAlways             = 0xFFFFFFFF;
+const TUint KDebugLevel         = KAlways;//( KPrint | KError | KMessage | KFunction );
+
+// MACROS
+#define __TRACING_ENABLED
+
+#ifdef __TRACING_ENABLED
+
+     // Disable conditional expression is constant -warning
+    #pragma warning( disable : 4127 )
+
+    // General tracing function
+    #define __TRACE(level,p) if ( ( (level) & KDebugLevel ) && LOGGER )\
+                                          {LOGGER->Log p;}
+
+    // Direct RDebug::Print                            
+    #define __RDEBUG(p) if( KVerbose & KDebugLevel ){ RDebug::Print p ; } 
+
+
+     // Log function name
+    #define __TRACEFUNC() if( ( KFunction & KDebugLevel ) && LOGGER ){\
+                                const char* f = __FUNCTION__;\
+                                 TPtrC8 F((const unsigned char*)f);\
+                                 LOGGER->Log(F);}
+
+#else // __TRACING_ENABLED
+     // No tracing
+    #define __TRACE(level,p)
+    #define __RDEBUG(p)
+    #define __TRACEFUNC()
+#endif // __TRACING_ENABLED
+
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif // LOGGINGDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/inc/UIEngineError.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,139 @@
+/*
+* 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: This file contains the header file of the 
+* CUIEngineErrorPrinter.
+*
+*/
+
+#ifndef UI_ENGINE_ERROR_H
+#define UI_ENGINE_ERROR_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "TestEngineClient.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+class CUIEngine;
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+
+// CUIEngineErrorPrinter is an active object which handles the error notifications
+// from the test framework.
+class CUIEngineErrorPrinter
+        :public CActive
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CUIEngineErrorPrinter* NewL( CUIEngine* aUIEngine );
+
+        /**
+        * Destructor of CTestCaseRunner.
+        */
+        virtual ~CUIEngineErrorPrinter();
+
+        /**
+        * Start
+        */
+        void StartL( RTestEngine& aTestCase );
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+        /** 
+        * C++ default constructor.
+        */
+        CUIEngineErrorPrinter( CUIEngine* aUIEngine );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( );
+
+    private:   // Functions from base classes
+        // None
+
+    public:   //Data
+        // None
+    
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to test case container
+        CUIEngine*                      iUIEngine;
+
+        // Testcase object handle
+        RTestEngine                     iTestEngine;
+        
+        // Test result package
+        TErrorNotification              iError;
+        TErrorNotificationPckg          iErrorPckg;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+#endif // UI_ENGINE_ERROR_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/inc/UIEngineEvent.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,181 @@
+/*
+* 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: This file contains the header file of the 
+* CUIEngineEvent.
+*
+*/
+
+#ifndef STIF_TFW_IF_EVENT_H
+#define STIF_TFW_IF_EVENT_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <StifTestEventInterface.h>
+#include <stfasynceventactive.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+class CUIEngine;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+
+// CUIEngineEvent is a class that is used to run test cases using
+// STIF Test Framework.
+class CUIEngineEvent
+        : public CActive
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // Object state
+        enum TEventState
+            {
+            EEventIdle,
+            EEventRequested,
+            EEventWait,
+            EEventWaitCompleted,
+            EEventReleased,
+            };
+
+    public: // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CUIEngineEvent* NewL( CUIEngine* aUIEngine );
+
+        /**
+        * Destructor of CUIEngineEvent.
+        */
+        ~CUIEngineEvent();
+
+    public: // New functions
+
+        /**
+        * Request request event.
+        */
+        TInt Request( TDesC& aEventName, TUint32 aMaster, TUint32 aSlave );
+
+        /**
+        * Release releases event.
+        */
+        TInt Release();
+        
+        /**
+        * Return master id.
+        */ 
+        TUint32 Master() const { return iMaster; }
+        
+        /**
+        * Return event name.
+        */ 
+        const TDesC& EventName() const { return iEvent.Name(); }
+
+
+    public: // Functions from base classes
+
+        /**
+        * From CActive RunL handles request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive DoCancel handles request cancellation.
+        */
+        void DoCancel();
+
+        /**
+        * From CActive RunError handles error situations.
+        */
+        TInt RunError( TInt aError );
+
+    protected: // New functions
+        // None
+
+    protected: // Functions from base classes
+        // None
+
+    private: // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CUIEngineEvent( CUIEngine* aUIEngine );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+    public: //Data
+        // None
+    
+    protected: // Data
+        // None
+
+    private: // Data
+    
+        // CUIEngineEvent State 
+        TEventState     iState;
+
+        // Pointer to UIEngine
+        CUIEngine*     iUIEngine;
+
+        // EventIf class for event control
+        TEventIf        iEvent;
+        TEventIfPckg    iEventPckg;
+        
+        // Master identifier
+        TUint32         iMaster;
+
+        // Slave identifier
+        TUint32         iSlave;
+        
+        // Special active object to handle with waiting in new event system
+        CAsyncEventActive *iAsyncEventActive;
+
+    public: // Friend classes
+        // None
+
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        // None
+
+    };
+
+
+
+#endif // STIF_TFW_IF_EVENT_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/inc/UIEnginePrinter.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,147 @@
+/*
+* 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: This file contains the header file of the 
+* CUIEnginePrinter.
+*
+*/
+
+#ifndef STIF_TFW_IF_PRINTER_H
+#define STIF_TFW_IF_PRINTER_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <stifinternal/UIEngineContainer.h>
+
+// CONSTANTS
+
+// Interval for timer printing
+const TInt KPrintInterval = 1000000;
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+// None
+
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+
+// CUIEnginePrinter is an active object which handles the print notifications
+// from the test case.
+class CUIEnginePrinter
+        : public CActive
+    {
+    public: // Enumerations
+
+    private: // Enumerations
+
+    public:  // Constructors and destructor
+
+        /**
+        * NewL is first phase of two-phased constructor.
+        */
+        static CUIEnginePrinter* NewL( CUIEngineContainer* aUIEngineContainer );
+
+        /**
+        * Destructor of CTestCaseRunner.
+        */
+        virtual ~CUIEnginePrinter();
+
+        /**
+        * Start
+        */
+        void StartL( RTestCase& aTestCase );
+
+    public: // New functions
+    
+        inline TBool IsRunning(){ return iRunning; };
+
+    public: // Functions from base classes
+
+        /**
+        * RunL derived from CActive handles the completed requests.
+        */
+        void RunL();
+
+        /**
+        * DoCancel derived from CActive handles the Cancel
+        */
+        void DoCancel();
+
+    protected:  // New functions
+        // None
+
+    protected:  // Functions from base classes
+        // None
+
+        /** 
+        * C++ default constructor.
+        */
+        CUIEnginePrinter( CUIEngineContainer* aUIEngineContainer );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( );
+
+    private:   // Functions from base classes
+        // None
+
+    public:   //Data
+
+    protected:  // Data
+        // None
+
+    private:    // Data
+
+        // Pointer to test case container
+        CUIEngineContainer*             iUIEngineContainer;
+
+        // Testcase object handle
+        RTestCase                       iTestCase;
+        
+        // Test result package
+        TTestProgress                   iProgress;
+        TTestProgressPckg               iProgressPckg;
+        
+        TBool                           iRunning;
+
+    public:     // Friend classes
+        // None
+
+    protected:  // Friend classes
+        // None
+
+    private:    // Friend classes
+        // None
+
+    };
+
+
+
+#endif // STIF_TFW_IF_PRINTER_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/inc/UIEngineRemote.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,165 @@
+/*
+* 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: This file contains the header file of the 
+* CUIEngineRemote.
+*
+*/
+
+
+#ifndef STIF_TFW_IF_REMOTE_H
+#define STIF_TFW_IF_REMOTE_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <stifinternal/UIEngineContainer.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+// None
+
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+
+// CUIEngineRemote is a class that is used for remote protocol 
+// forwarding.
+class CUIEngineRemote
+        :public CActive
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        enum TRemoteStatus
+            {
+            EIdle,
+            EPending,
+            EUIMsgPending,
+            };
+
+    public: // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CUIEngineRemote* NewL( CUIEngineContainer* aUIEngineContainer );
+
+        /**
+        * Destructor of CUIEngineRemote.
+        */
+        ~CUIEngineRemote();
+
+    public: // New functions
+
+        /**
+        * StartL starts testing.
+        */
+        void StartL( RTestCase& aTestCase );
+
+    public: // Functions from base classes
+
+        /**
+        * From CActive RunL handles request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive DoCancel handles request cancellation.
+        */
+        void DoCancel();
+        /**
+        * RunError derived from CActive handles errors from active object 
+        * handler.
+        */        
+        TInt RunError(TInt aError);
+
+    protected: // New functions
+        // None
+
+    protected: // Functions from base classes
+        // None
+
+    private: // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CUIEngineRemote( CUIEngineContainer* aUIEngineContainer);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+        /**
+        * Start request.
+        */
+        void Start();
+
+    public: //Data
+        // None
+    
+    protected: // Data
+        // None
+
+    private: // Data
+
+        // Pointer to UIEngine
+        CUIEngineContainer*             iUIEngineContainer;
+
+        // Handle to Test Case
+        RTestCase                       iTestCase;
+        
+        // Protocol message type
+        TStifCommand                    iRemoteType;
+        TStifCommandPckg                iRemoteTypePckg;
+
+        // Protocol message length
+        TInt                            iMsgLen;
+        TPckg<TInt>                     iMsgLenPckg;
+
+        TRemoteStatus                   iState;
+    public: // Friend classes
+        // None
+
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        // None
+
+    };
+
+
+
+#endif // STIF_TFW_IF_REMOTE_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/inc/UIEngineRunner.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,150 @@
+/*
+* 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: This file contains the header file of the 
+* CUIEngineRunner.
+*
+*/
+
+
+#ifndef STIF_TFW_IF_RUNNER_H
+#define STIF_TFW_IF_RUNNER_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <stifinternal/UIEngineContainer.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+// None
+
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+
+// CUIEngineRunner is a class that is used to run test cases using
+// STIF Test Framework.
+class CUIEngineRunner
+        : public CActive
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public: // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CUIEngineRunner* NewL( CUIEngineContainer* aUIEngineContainer );
+
+        /**
+        * Destructor of CUIEngineRunner.
+        */
+        ~CUIEngineRunner();
+
+    public: // New functions
+
+        /**
+        * StartTestL starts testing.
+        */
+        void StartL( RTestCase& aTestCase );
+        
+        /**
+        * Test result.
+        */
+        inline TFullTestResult& FullResult(){ return iFullTestResult; };
+
+    public: // Functions from base classes
+
+        /**
+        * From CActive RunL handles request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive DoCancel handles request cancellation.
+        */
+        void DoCancel();
+
+    protected: // New functions
+        // None
+
+    protected: // Functions from base classes
+        // None
+
+    private: // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CUIEngineRunner( CUIEngineContainer* aUIEngineContainer);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+    public: //Data
+        // None
+    
+    protected: // Data
+        // None
+
+    private: // Data
+
+        // Pointer to UIEngine
+        CUIEngineContainer*            iUIEngineContainer;
+
+        // Handle to Test Case
+        RTestCase                       iTestCase;
+        
+        // Test result and package
+        TFullTestResult                 iFullTestResult;
+        TFullTestResultPckg             iFullTestResultPckg;
+
+    public: // Friend classes
+        // None
+
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        // None
+
+    };
+
+
+
+#endif // STIF_TFW_IF_RUNNER_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/inc/UIStorePopup.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,182 @@
+/*
+* 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: This file contains the header file of the 
+* CUIStorePopup.
+*
+*/
+
+#ifndef STIF_TFW_IF_REMOTE_H
+#define STIF_TFW_IF_REMOTE_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <stifinternal/UIStore.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+
+// FORWARD DECLARATIONS
+// None
+
+
+// CLASS DECLARATION
+
+
+// DESCRIPTION
+
+// CUIStorePopup is a class that is used for remote protocol 
+// forwarding.
+class CUIStorePopup
+        :public CActive
+    {
+    public: // Enumerations
+        // None
+
+    private: // Enumerations
+        // None
+
+    public: // Constructors and destructor
+
+        /**
+        * NewL is two-phased constructor.
+        */
+        static CUIStorePopup* NewL( CUIStore* aUIStore,
+                                    CUIEngineContainer* aContainer,
+                                    CStifTFwIfProt* aRemoteMsg,
+                                    CUIStore::TPopupPriority aPopupPriority,
+                                    const TDesC& aMsg );
+
+        /**
+        * Destructor of CUIStorePopup.
+        */
+        ~CUIStorePopup();
+
+    public: // New functions
+    
+        TInt Start( const TDesC& aLine1, 
+                    const TDesC& aLine2 );
+                    
+        inline const CUIEngineContainer* Container()
+            { return iContainer; };
+        
+        inline TBool IsEventPopup()
+            { return ( iRemoteMsg->iCmdType == 
+                       CStifTFwIfProt::ECmdRequest ); }
+        
+        // Returns message
+        inline TDesC& GetMessage()
+            { 
+            if( iMsg == NULL )
+                {
+                User::Panic( _L("iMsg was NULL"), -1 );
+                }
+            return *iMsg;
+            };
+
+        // Returns popup priority
+        inline const CUIStore::TPopupPriority GetPriority()
+            { 
+            return iPopupPriority;
+            };
+        
+    public: // Functions from base classes
+
+        /**
+        * From CActive RunL handles request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive DoCancel handles request cancellation.
+        */
+        void DoCancel();
+
+    protected: // New functions
+        // None
+
+    protected: // Functions from base classes
+        // None
+
+    private: // New functions
+
+        /** 
+        * C++ default constructor.
+        */
+        CUIStorePopup( CUIStore* aUIStore,
+                       CUIEngineContainer* aContainer,
+                       CStifTFwIfProt* aRemoteMsg,
+                       CUIStore::TPopupPriority aPopupPriority);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL( const TDesC& aMsg );
+
+
+    public: //Data
+        // None
+    
+    protected: // Data
+        // None
+
+    private: // Data
+
+        // Pointer to UIEngine
+        CUIStore*                       iUIStore;
+
+        // Protocol message
+        CStifTFwIfProt*                 iRemoteMsg;
+        
+        // Keycode of the pressed key
+        TKeyCode                        iKey;
+        
+        // test case waiting our response
+        CUIEngineContainer*             iContainer;
+        
+        TInt                            iPopupWindow;
+        
+        // Popup priority
+        CUIStore::TPopupPriority        iPopupPriority;
+        
+        // Popup message
+        HBufC                           * iMsg;
+        
+    public: // Friend classes
+        // None
+
+    protected: // Friend classes
+        // None
+
+    private: // Friend classes
+        // None
+
+    };
+
+
+
+#endif // STIF_TFW_IF_REMOTE_H
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/StifTFwIf.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1918 @@
+/*
+* 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: CStifTFwIf: This object executes test cases from 
+* STIF Test Framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include "UIEngineEvent.h"
+#include <stifinternal/UIEngineContainer.h>
+#include "StifTFwIf.h"
+#include "StifTFw.h"
+#include "Logging.h"
+#include "StifPython.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iStifTFw->iLogger
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: CStifTFwIf
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifTFwIf::CStifTFwIf()
+    {
+    __RDEBUG( _L( "CStifTFwIf::CStifTFwIf()" ) );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: ~CStifTFwIf
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CStifTFwIf::~CStifTFwIf()
+    {
+    __RDEBUG( _L( "CStifTFwIf::~CStifTFwIf()" ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: Open
+
+    Description: Open test engine.
+
+    Parameters: TDesC& aTestFrameworkIni: in: Initialization file to Test Framework
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::Open( TDesC& aTestFrameworkIni )
+    {
+    RDebug::Print(_L("CStifTFwIf::Open"));
+    TInt err( KErrNone );
+    TRAP( err,
+        iStifTFw = CStifTFw::NewL( this );
+        )
+
+    return iStifTFw->iUIEngine->Open( aTestFrameworkIni );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: Close
+
+    Description: Close test engine.
+
+    Parameters: None
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::Close()
+    {
+    RDebug::Print(_L("CStifTFwIf::Close"));
+
+    iStifTFw->DeleteData(); //Delete objects before closing session to TestEngine server
+    iStifTFw->iUIEngine->Close();
+
+    delete iStifTFw;
+    iStifTFw = 0;
+
+    return KErrNone;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: SetAttribute
+
+    Description: Used to set attributes for Test Framework.
+
+    Parameters: TAttribute aAttribute: in: Attribute type
+                TDesC& aValue: in: Attribute value
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::SetAttribute( TAttribute aAttribute,
+                                        const TDesC& aValue )
+    {
+    RDebug::Print(_L("CStifTFwIf::SetAttribute"));
+    // Check aValue max length
+    if( aValue.Length() > KMaxName )
+        {
+        __TRACE( KPrint, ( CStifLogger::EError, _L( "CStifTFwIf::SetAttribute() method's second parameter length is incorrect" ) ) );
+        return KErrArgument;
+        }
+
+    TInt ret = iStifTFw->iUIEngine->TestEngine().SetAttribute( aAttribute, aValue );
+
+    if ( ret != KErrNone )
+        {
+        __TRACE( KPrint, ( _L( "CStifTFwIf::SetAttribute() method fails with error:%d" ), ret  ) );
+        return ret;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: AddTestModule
+
+    Description: Add test module to module list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which is added to module list
+                TDesC& aIniFile: in: Initialization file to the test module
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::AddTestModule( TDesC& aModuleName,
+                                         TDesC& aIniFile )
+    {
+    RDebug::Print(_L("CStifTFwIf::AddTestModule"));
+
+    return iStifTFw->iUIEngine->AddTestModule( aModuleName, aIniFile );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: RemoveTestModule
+
+    Description: Add test module to module list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which is removed of module list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::RemoveTestModule( TDesC& aModuleName )
+    {
+    RDebug::Print(_L("CStifTFwIf::RemoveTestModule"));
+
+    return iStifTFw->iUIEngine->RemoveTestModule( aModuleName );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: AddTestCaseFile
+
+    Description: Add test case file to test case file list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which own test cases of test case list.
+                TDesC& aCaseFile: in: Test case list, which is added to test case list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::AddTestCaseFile( TDesC& aModuleName, TDesC& aCaseFile )
+    {
+    RDebug::Print(_L("CStifTFwIf::AddTestCaseFile"));
+
+    return iStifTFw->iUIEngine->AddTestCaseFile( aModuleName, aCaseFile );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: RemoveTestCaseFile
+
+    Description: Remove test case file of test case file list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which own test cases of test case list
+                TDesC& aCaseFile: in: Test case list, which is removed of test case list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::RemoveTestCaseFile( TDesC& aModuleName, TDesC& aCaseFile )
+    {
+    RDebug::Print(_L("CStifTFwIf::RemoveTestCaseFile"));
+
+    return iStifTFw->iUIEngine->RemoveTestCaseFile( aModuleName, aCaseFile );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: GetTestCases
+
+    Description: Get test cases of enumerated list of test engine. Method is copied
+                 list of test cases to aTestCaseInfo. Copied tests are test cases
+                 of test module (aTestModule) and defined
+                 in test case file (aTestCaseFile), which are given as argument
+
+                 Method copied all enumerated test cases if aTestModule
+                 and aTestCaseFile are not defined
+
+    Parameters: RPointerArray<CTestInfo>& aTestCaseInfo: inout: List of test cases
+                TDesC& aModuleName: in: Testmodule, which own test cases of test case list
+                TDesC& aTestCaseFile: in: Test case list, which is got of test case list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::GetTestCases( RPointerArray<CTestInfo>& aTestCaseInfo,
+                                        TDesC& aTestModule,
+                                        TDesC& aTestCaseFile )
+    {
+    RDebug::Print(_L("CStifTFwIf::GetTestCases"));
+
+    TRAPD( ret,
+        ret = iStifTFw->iUIEngine->GetTestCasesL( aTestCaseInfo,
+                                                  aTestModule,
+                                                  aTestCaseFile );
+        );
+
+    return ret;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: StartTestCase
+
+    Description: Start test case execution.
+
+    Parameters: TInt& aTestId: in: ID for test case. Test ID given of address of
+                current CStifTFwIfContainer.
+
+                const CTestInfo& aTestInfo: in: Test case information
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::StartTestCase( TInt& aTestId,
+                                         const CTestInfo& aTestInfo )
+    {
+    RDebug::Print(_L("CStifTFwIf::StartTestCase"));
+
+    CUIEngineContainer* container = NULL;
+
+    TInt ret = iStifTFw->iUIEngine->StartTestCase( container,
+                                                   aTestInfo );
+
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+
+    // Add container to test case execution table
+    ret = iStifTFw->iTestExecutionTable.Append( container );
+    if( ret != KErrNone )
+        {
+        iStifTFw->iUIEngine->AbortStartedTestCase( container );
+        return ret;
+        }
+
+    // Get test id.
+    aTestId = (TInt)container;
+
+    __TRACE( KPrint, (  _L( "aTestId: %d"), aTestId ) );
+    __TRACE( KPrint, (  _L( "aTest case: %S"), &(aTestInfo.TestCaseTitle()) ) );
+
+    return ret;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: CancelTestCase
+
+    Description: Cancel test case execution
+
+    Parameters: TInt& aTestId: in: ID for test case
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::CancelTestCase( TInt aTestId )
+    {
+    RDebug::Print(_L("CStifTFwIf::CancelTestCase"));
+    TInt ret(KErrNone);
+
+    // Find test case from execution table
+    TInt index = iStifTFw->iTestExecutionTable.Find( ( CUIEngineContainer* )aTestId );
+
+    // Check if test id is found
+    if( index < 0)
+        {
+        __TRACE( KPrint, (  _L( "CStifTFwIf::CancelTestCase. Container not found. TestId = %d"), aTestId ) );
+
+        return index;
+        }
+
+    // Cancel test
+    ret = iStifTFw->iTestExecutionTable[index]->CancelTest();
+    __TRACE( KPrint, (  _L( "CStifTFwIf::CancelTestCase. Canceled testId %d"), aTestId ) );
+
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: PauseTestCase
+
+    Description: Pause test case execution
+
+    Parameters: TInt& aTestId: in: ID for test case
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::PauseTestCase(  TInt aTestId  )
+    {
+    RDebug::Print(_L("CStifTFwIf::PauseTestCase"));
+    TInt ret(KErrNone);
+
+    // Find test case from execution table
+    TInt index = iStifTFw->iTestExecutionTable.Find( ( CUIEngineContainer*) aTestId );
+
+    // Check if test id is found
+    if( index < 0 )
+        {
+        __TRACE( KPrint, (  _L( "CStifTFwIf::PauseTestCase. Container not found: testId = %d"), aTestId ) );
+
+        return index;
+        }
+
+    // Pause test
+    ret = iStifTFw->iTestExecutionTable[index]->PauseTest();
+
+    __TRACE( KPrint, (  _L( "CStifTFwIf::PauseTest. Paused testId %d"), aTestId ) );
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: ResumeTestCase
+
+    Description: Resume test case execution
+
+    Parameters: TInt& aTestId: in: ID for test case
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::ResumeTestCase( TInt aTestId )
+    {
+    RDebug::Print(_L("CStifTFwIf::ResumeTestCase"));
+    TInt ret(KErrNone);
+
+    // Find test case from execution table
+    TInt index = iStifTFw->iTestExecutionTable.Find( ( CUIEngineContainer* ) aTestId );
+
+    // Check if test id is found
+    if( index < 0 )
+        {
+        __TRACE( KPrint, (  _L( "CStifTFwIf::ResumeTestCase. Container not found: TestId = %d"), aTestId ) );
+
+        return index;
+        }
+
+    // Resume test
+    ret = iStifTFw->iTestExecutionTable[index]->ResumeTest();
+
+    __TRACE( KPrint, ( _L( "CStifTFwIf::ResumeTestCase. Resumed testId %d"), aTestId ) );
+
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: AtsReceive
+
+    Description: Handles remote protocol message receives
+
+    Parameters: const TDesC& aMessage: in: Protocol message received
+
+    Return Values: Symbian OS error code: In oom and is protocol message header
+        parsing fails, i.e. error in <msgtype> <srcid> <dstid>
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFwIf::AtsReceive( const TDesC& aMessage )
+    {
+    RDebug::Print(_L("CStifTFwIf::AtsReceive"));
+    RDebug::Print( _L("[STIF Master/Slave received message] %S"), &aMessage );
+    
+    CStifTFwIfProt* msg = NULL;
+    CStifTFwIfProt* resp = NULL;
+    TRAPD( err, msg = CStifTFwIfProt::NewL(); );
+    if( err != KErrNone )
+        {
+        return err;
+        }
+    TRAP( err, resp = CStifTFwIfProt::NewL(); );
+    if( err != KErrNone )
+        {
+        delete msg;
+        return err;
+        }
+    TInt error = KErrNone;
+    TInt ret = KErrNone;
+
+    // Parse received message
+    TRAP( err,
+        error = msg->SetL( aMessage )
+    );
+    if( err != KErrNone )
+        {
+        __TRACE( KError, ( _L( "AtsReceive: message header parsing failed [%d]"), err ) );
+        delete msg;
+        delete resp;
+        return err;
+        }
+
+    // Create response
+    TRAP( err, resp->CreateL(); );
+    if( err != KErrNone )
+        {
+        delete msg;
+        delete resp;
+        return err;
+        }
+
+    resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
+
+    if( error != KErrNone )
+        {
+        __TRACE( KError, ( _L( "AtsReceive: message parsing failed [%d]"), error ) );
+        resp->AppendId( SETID( DevId(), 0 ) );
+        resp->AppendId( msg->SrcId() );
+        resp->Append( CStifTFwIfProt::MsgType, msg->iMsgType );
+        resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
+        
+        RDebug::Print( _L("[STIF Master/Slave sending response] %S"), &resp->Message() );
+        AtsSend( resp->Message() );
+
+        // Error reported with protocol message, return success
+        delete msg;
+        delete resp;
+        return KErrNone;
+        }
+
+    switch( msg->iMsgType )
+        {
+        case CStifTFwIfProt::EMsgReserve:
+            {
+            RDebug::Print( _L("[STIF Slave handling request] %S"), &aMessage );            
+            
+            if( msg->iRemoteType != CStifTFwIfProt::ERemotePhone )
+                {
+                __TRACE( KError, ( _L( "AtsReceive: reserve for illegal type received") ) );
+                error = KErrGeneral;
+                }
+            // Check IDs
+            if( ( msg->SrcDevId() == 0 ) ||
+                ( msg->SrcTestId() == 0 ) )
+                {
+                __TRACE( KError, ( _L( "AtsReceive: reserve for illegal srcid received") ) );
+                error = KErrGeneral;
+                }
+            if( msg->DstId() != 0 )
+                {
+                // Not a broadcast
+                if( ( msg->DstDevId() != DevId() ) ||
+                    ( msg->DstTestId() != 0 ) )
+                    {
+                    __TRACE( KError, ( _L( "AtsReceive: reserve for illegal dstid received") ) );
+                    error = KErrGeneral;
+                    }
+                }
+            TInt index = iStifTFw->iMasterArray.Find( msg->SrcId() );
+            if( index >= 0 )
+                {
+                error = KErrInUse;
+                __TRACE( KError, ( _L( "AtsReceive: master has already reserved slave") ) );
+                }
+            else
+                {
+                iStifTFw->iMasterArray.Append( msg->SrcId() );
+                }
+
+            resp->AppendId( SETID( DevId(), 0 ) );
+            resp->AppendId( msg->SrcId() );
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgReserve );
+            if( error != KErrNone )
+                {
+                resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
+                }
+            
+            RDebug::Print( _L("[STIF Slave sending response] %S"), &resp->Message() );            
+            AtsSend( resp->Message() );
+
+            }
+            break;
+        case CStifTFwIfProt::EMsgRelease:
+            {
+            RDebug::Print( _L("[STIF Slave handling request] %S"), &aMessage );
+            
+            // Check protocol ids
+            if( ( msg->SrcDevId() == 0 ) ||
+                ( msg->SrcTestId() == 0 ) ||
+                ( msg->DstTestId() != 0 ) )
+                {
+                __TRACE( KError, ( _L( "AtsReceive: release for illegal srcid or dstid received") ) );
+                error = KErrGeneral;
+                }
+            else if( msg->DstDevId() != DevId() )
+                {
+                __TRACE( KError, ( _L( "AtsReceive: release for illegal dstid received") ) );
+                error = KErrNotFound;
+                }
+            else
+                {
+                // Check Master identifier
+                // First check that specific master has reserved us
+                TInt index = iStifTFw->iMasterArray.Find( msg->SrcId() );
+                if( index < 0 )
+                    {
+                    error = KErrNotFound;
+                    }
+                else
+                    {
+                    // Search test case from execution table
+                    TInt count = iStifTFw->iTestRemoteExecutionTable.Count();
+                    for( TInt ind = 0; ind < count; ind++ )
+                        {
+                        if( iStifTFw->iTestRemoteExecutionTable[ind]->RemoteId() ==
+                            msg->SrcId() )
+                            {
+                            __TRACE( KError, (  _L( "Release: test case running for %x"),
+                                msg->SrcId() ) );
+                            error = KErrInUse;
+                            break;
+                            }
+                        }
+                    if( error == KErrNone )
+                        {
+                        iStifTFw->iMasterArray.Remove( index );
+                        }
+                    }
+                }
+
+            resp->AppendId( msg->DstId() );
+            resp->AppendId( msg->SrcId() );
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRelease );
+
+            if( error != KErrNone )
+                {
+                resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
+                }
+            
+            RDebug::Print( _L("[STIF Slave sending response] %S"), &resp->Message() );            
+            AtsSend( resp->Message() );
+            }
+            break;
+        case CStifTFwIfProt::EMsgRemote:
+            {
+            RDebug::Print( _L("[STIF Slave handling request] %S"), &aMessage );
+            
+            // Check protocol ids
+            TInt index = iStifTFw->iMasterArray.Find( msg->SrcId() );
+            if( ( msg->SrcDevId() == 0 ) ||
+                ( msg->SrcTestId() == 0 ) ||
+                ( msg->DstDevId() == 0 ) )
+                {
+                __TRACE( KError, ( _L( "AtsReceive: remote for illegal srcid or dstid received") ) );
+                error = KErrGeneral;
+                }
+            else if( index < 0 )
+                {
+                __TRACE( KError, ( _L( "AtsReceive: remote for illegal srcid received") ) );
+                error = KErrNotFound;
+                }
+            else
+                {
+
+                __TRACE( KError, ( _L( "AtsReceive: Call AtsRemote") ) );
+                RDebug::Print(_L("CStifTFwIf::AtsReceive remote command received, calling AtsRemote"));
+                error = iStifTFw->AtsRemote( *msg, *resp );
+                RDebug::Print(_L("CStifTFwIf::AtsReceive remote command received, AtsRemote return"));
+                }
+
+            if( error != KErrNone )
+                {
+                resp->AppendId( msg->DstId() );
+                resp->AppendId( msg->SrcId() );
+                resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+                resp->Append( CStifTFwIfProt::CmdType, msg->iCmdType );
+                resp->Append( CStifTFwIfProt::RespParam,
+                             CStifTFwIfProt::ERespResult,
+                             error );
+                }
+            
+            RDebug::Print( _L("[STIF Slave sending response] %S"), &resp->Message() );            
+            AtsSend( resp->Message() );
+            }
+            break;
+        case CStifTFwIfProt::EMsgResponse:
+            {
+            RDebug::Print( _L("[STIF Master handling response] %S"), &aMessage );
+            
+            // Responses ae forwarded to master
+            CUIEngineContainer* container = NULL;
+            TInt count = iStifTFw->iTestRemoteExecutionTable.Count();
+            TInt index = 0;
+            for( index = 0 ; index < count; index++ )
+                {
+                if( iStifTFw->iTestRemoteExecutionTable[index]->MasterId() ==
+                    msg->SrcId() )
+                    {
+                    __TRACE( KError, (  _L( "Response for %x"),
+                        msg->SrcId() ) );
+                    container = iStifTFw->iTestRemoteExecutionTable[index];
+                    break;
+                    }
+                }
+            if( container == NULL )
+                {
+                count = iStifTFw->iTestExecutionTable.Count();
+                for( index = 0 ; index < count; index++ )
+                    {
+                    if( iStifTFw->iTestExecutionTable[index]->MasterId() ==
+                        msg->DstId() )
+                        {
+                        __TRACE( KError, (  _L( "Response for %x"),
+                            msg->SrcId() ) );
+                        container = iStifTFw->iTestExecutionTable[index];
+                        break;
+                        }
+                    }
+                }
+
+            if( container == NULL )
+                {
+                __TRACE( KError, ( _L( "AtsReceive: response to srcid %x that is not a running master"),
+                    msg->SrcId() ) );
+                ret = KErrNotFound;
+                }
+            else
+                {
+                ret = container->RemoteReceive( aMessage );
+                }
+            }
+            break;
+        default:
+            __TRACE( KError, ( _L( "AtsReceive: invalid message")) );
+            ret = KErrNotSupported;
+        }
+
+    delete msg;
+    delete resp;
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    CStifTFw: This object executes test cases from STIF Test Framework.
+
+-------------------------------------------------------------------------------
+*/
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iLogger
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: NewL
+
+    Description: Construct the CStifTFw class
+
+    Parameters: None
+
+    Return Values: CStifTFw*                    New object
+
+    Errors/Exceptions: Leaves if memory allocation fails or
+                       ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStifTFw* CStifTFw::NewL( CStifTFwIf* aStifTFwIf )
+    {
+    RDebug::Print(_L("CStifTFw::NewL"));
+
+    CStifTFw* self = new ( ELeave ) CStifTFw( aStifTFwIf );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves on error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CStifTFw::ConstructL()
+    {
+    RDebug::Print(_L("CStifTFw::ConstructL"));
+
+    iUIEngine = CUIEngine::NewL( (CUIIf*) this );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: CStifTFw
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStifTFw::CStifTFw( CStifTFwIf* aStifTFwIf ):
+    iStifTFwIf( aStifTFwIf )
+    {
+
+    __RDEBUG( _L( "CStifTFw::CStifTFw()" ) );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: ~CStifTFwIf
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStifTFw::~CStifTFw()
+    {
+    __RDEBUG( _L( "CStifTFw::~CStifTFw() begin" ) );
+
+    RDebug::Print(_L("CStifTFw::~CStifTFw resetting iTestExecutionTable cnt=%d"), iTestExecutionTable.Count());
+    iTestExecutionTable.Reset();
+    RDebug::Print(_L("CStifTFw::~CStifTFw resetting iTestRemoteExecutionTable cnt=%d"), iTestRemoteExecutionTable.Count());
+    iTestRemoteExecutionTable.Reset();
+    RDebug::Print(_L("CStifTFw::~CStifTFw resetting iEventArray cnt=%d"), iEventArray.Count());
+    iEventArray.ResetAndDestroy();
+    RDebug::Print(_L("CStifTFw::~CStifTFw resetting iMasterArray cnt=%d"), iMasterArray.Count());
+    iMasterArray.Reset();
+
+    RDebug::Print(_L("CStifTFw::~CStifTFw closing iTestExecutionTable cnt=%d"), iTestExecutionTable.Count());
+    iTestExecutionTable.Close();
+    RDebug::Print(_L("CStifTFw::~CStifTFw closing iTestRemoteExecutionTable cnt=%d"), iTestRemoteExecutionTable.Count());
+    iTestRemoteExecutionTable.Close();
+    RDebug::Print(_L("CStifTFw::~CStifTFw closing iEventArray cnt=%d"), iEventArray.Count());
+    iEventArray.Close();
+    RDebug::Print(_L("CStifTFw::~CStifTFw closing iMasterArray cnt=%d"), iMasterArray.Count());
+    iMasterArray.Close();
+
+    //Moved from the beginning of destructor, because objects from some arrays during resetting and/or closing
+    //have tried to call methods of iUIEngine.
+    RDebug::Print(_L("CStifTFw::~CStifTFw deleteing iUiEngine address=%d"), iUIEngine);
+    delete iUIEngine;
+
+    RDebug::Print(_L("CStifTFw::~CStifTFw end"));
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: AtsRemote
+
+    Description: Remote ATS call
+
+    Parameters: const TDesC& aMessage: in:
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifTFw::AtsRemote( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp )
+    {
+    RDebug::Print(_L("CStifTFw::AtsRemote start, iCmdType=%d "), aReq.iCmdType);
+
+    TInt ret = KErrNone;
+
+    switch( aReq.iCmdType )
+        {
+        case CStifTFwIfProt::ECmdRun:
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdRun "));
+            ret = AtsRemoteRun( aReq, aResp );
+            break;
+            }
+        case CStifTFwIfProt::ECmdPause:
+        case CStifTFwIfProt::ECmdResume:
+        case CStifTFwIfProt::ECmdCancel:
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdPause,Resume,Cancel "));
+            ret = AtsRemoteTestCtl( aReq, aResp );
+            break;
+            }
+        case CStifTFwIfProt::ECmdRequest:
+        case CStifTFwIfProt::ECmdRelease:
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdRequest,Release "));
+            ret = AtsRemoteEventCtl( aReq, aResp );
+            break;
+            }
+        case CStifTFwIfProt::ECmdSetEvent:
+        case CStifTFwIfProt::ECmdUnsetEvent:
+        	{
+            RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdSetEvent,Unset start "));
+            ret = AtsRemoteEventCtl( aReq, aResp );
+            RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdSetEvent,Unset end "));
+            break;
+			}
+        default:
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemote iCmdType UNSUPPORTED value=%d "), aReq.iCmdType);
+            return KErrNotSupported;
+            }
+        }
+
+    return ret;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CStifTFw
+
+     Method: GetCaseNumByTitle
+
+     Description: Enumerates test cases from given module and finds test case index by title
+
+     Parameters:    TDesC& aModule: in: module name
+                    TDesC& aTestCaseFile: in: cfg file
+	                TDesC& aTitle: in: test case title
+                    TInt& aCaseNum: in out: test case index
+
+     Return Values: KErrNone if everything is ok
+                    KErrNotFound if there is no such test case
+
+     Errors/Exceptions: None.
+
+     Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifTFw::GetCaseNumByTitle(TDesC& aModule, TDesC& aTestCaseFile, TDesC& aTitle, TInt& aCaseNum)
+    {
+    RDebug::Print(_L("CStifTFw::GetCaseNumByTitle looking for test case number module=[%S] cfg=[%S] title=[%S]"), &aModule, &aTestCaseFile, &aTitle);
+	//Allocate table
+    RPointerArray<CTestInfo> allTestInfos;
+    CleanupClosePushL(allTestInfos);
+    TInt ret = KErrNone;
+
+    //Enumerate test cases
+    RDebug::Print(_L("CStifTFw::GetCaseNumByTitle enumerating test cases"));
+    if(aTestCaseFile == _L("dummy.cfg"))
+        {
+		TName t = _L("");
+        ret = iStifTFwIf->GetTestCases(allTestInfos, aModule, t);
+		}
+    else
+        {
+        ret = iStifTFwIf->GetTestCases(allTestInfos, aModule, aTestCaseFile);
+		}
+
+    if(ret != KErrNone)
+        {
+		RDebug::Print(_L("Test cases enumeration from module [%S] and file [%S] has returned an error %d"), &aModule, &aTestCaseFile, ret);
+		}
+    else
+        {
+		//Searching through the table
+        RDebug::Print(_L("CStifTFw::GetCaseNumByTitle searching through the test cases table containing %d cases"), allTestInfos.Count());
+        ret = KErrNotFound;
+        for(TInt i = 0; i < allTestInfos.Count(); i++)
+            {
+            if(allTestInfos[i]->TestCaseTitle() == aTitle)
+                {
+                aCaseNum = i;
+                //TestScripter relies on 1-based indexing
+                if((aModule.Find(KTestScripterName) != KErrNotFound) || (aModule.Find(KPythonScripter) != KErrNotFound) || (aModule.Find(KTestCombinerName) != KErrNotFound)) 
+                    aCaseNum++;
+                ret = KErrNone;
+                break;
+                }
+            }
+		}
+	if(ret == KErrNotFound)
+	    {
+        RDebug::Print(_L("CStifTFw::GetCaseNumByTitle test case not found"));
+		}
+	else if(ret == KErrNone)
+	    {
+        RDebug::Print(_L("CStifTFw::GetCaseNumByTitle test case number found: %d"), aCaseNum);
+		}
+	else
+	    {
+        RDebug::Print(_L("CStifTFw::GetCaseNumByTitle error %d"), ret);
+		}
+
+    //Some cleaning
+    allTestInfos.Reset();
+    CleanupStack::PopAndDestroy();
+
+    return ret;
+    }
+
+/*
+    Class: CStifTFw
+
+    Method: AtsRemoteRun
+
+    Description: Remote run ATS call
+
+    Parameters: const TDesC& aMessage: in:
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifTFw::AtsRemoteRun( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp )
+    {
+    RDebug::Print(_L("CStifTFw::AtsRemoteRun start"));
+
+    TInt ret = KErrNone;
+    TUint16 testid = 0;
+
+    if( ( aReq.DstDevId() == 0 ) ||
+        ( aReq.DstTestId() != 0 ) )
+        {
+        RDebug::Print(_L("CStifTFw::AtsRemoteRun Protocol violation"));
+        // Protocol violation
+        __TRACE( KError, ( _L( "AtsReceive: remote run for illegal dstid received") ) );
+        return KErrGeneral;
+        }
+
+    if ( aReq.DstDevId() != iStifTFwIf->DevId() )
+        {
+        RDebug::Print(_L("CStifTFw::AtsRemoteRun Not our protocol message"));
+        // Not our protocol message
+        __TRACE( KError, ( _L( "AtsReceive: remote run for illegal dstdevid received") ) );
+        return KErrNotFound;
+        }
+
+
+    if( aReq.iModule.Length() == 0 )
+        {
+        RDebug::Print(_L("CStifTFw::AtsRemoteRun No test module name given"));
+        __TRACE( KError, ( _L("No mandatory test module name given as run parameter") ) );
+        ret = KErrNotFound;
+        }
+    else if(aReq.iTestCaseNumber < 0 && aReq.iTitle.Length() == 0)
+        {
+        RDebug::Print(_L("CStifTFw::AtsRemoteRun No test case number given"));
+        __TRACE( KError, ( _L("No mandatory test case number given as run parameter") ) );
+        ret = KErrNotFound;
+        }
+    else
+        {
+        TBufC<KTestScripterNameLength> myTestscripter;
+        myTestscripter = KTestScripterName;
+
+        if( ( aReq.iModule.Find( myTestscripter ) != KErrNotFound ) )
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemoteRun TestScripter module"));
+            // If testmodule's type is testscripter, then iModule has name
+            // "testscripter_testcasefile". AddTestModule method takes
+            // testscripter type of module without _testcasefile, so we cannot
+            // give iModule name as parameter.
+
+            // Adding testscripter type of testmodule
+            RDebug::Print(_L("CStifTFw::AtsRemoteRun calling AddTestModule"));
+            ret = iStifTFwIf->AddTestModule( myTestscripter, aReq.iIniFile );
+            if( ret != KErrNone )
+                {
+                __TRACE( KError, ( _L( "CStifTFw::AtsRemoteRun: AddTestModule failed [%d]"), ret ) );
+
+                // It is ok if test module is already loaded to test engine
+                if( ret == KErrAlreadyExists )
+                    {
+                    __TRACE( KPrint, ( _L( "Test module already exists at testengine, no problem") ) );
+                    }
+                }
+            // Adding testscripter testcasefile
+            RDebug::Print(_L("CStifTFw::AtsRemoteRun calling AddTestCaseFile"));
+            ret = iStifTFwIf->AddTestCaseFile( myTestscripter, aReq.iTestCaseFile );
+            if( ret != KErrNone )
+                {
+                // It is ok if test case file is already loaded to test engine
+                if( ret == KErrAlreadyExists )
+                    {
+                    __TRACE( KPrint, ( _L( "Testcasefile already exists at testengine, no problem") ) );
+                    }
+                // Got other error, log info about it
+                else
+                    {
+                    __TRACE( KError, ( _L( "CStifTFw::AtsRemoteRun: AddTestCaseFile failed [%d]"), ret ) );
+                    __TRACE( KError, ( _L( "Testscripter needs to have test case file loaded successfully, please check path and file name!") ) );
+                    }
+                }
+            }
+        else
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemoteRun It is not a TestScripter module "));
+            // For testmodules other than testscripter
+            RDebug::Print(_L("CStifTFw::AtsRemoteRun calling AddTestModule "));
+            ret = iStifTFwIf->AddTestModule( aReq.iModule, aReq.iIniFile );
+            if( ret != KErrNone )
+                {
+                __TRACE( KError, ( _L( "CStifTFw::AtsRemoteRun: AddTestModule failed [%d]"), ret ) );
+
+                // It is ok if test module is already loaded to test engine
+                if( ret == KErrAlreadyExists )
+                    {
+                    __TRACE( KPrint, ( _L( "Test module already exists at testengine, no problem") ) );
+                    }
+                }
+            }
+        if(aReq.iTitle.Length() != 0)
+            {
+			aReq.iTestCaseNumber = -1;
+            //Get test case number from title
+            ret = GetCaseNumByTitle(aReq.iModule, aReq.iTestCaseFile, aReq.iTitle, aReq.iTestCaseNumber);
+            //Check test case number
+            if(aReq.iTestCaseNumber < 0)
+                {
+                RDebug::Print(_L("CStifTFw::AtsRemoteRun No test case number could be found using given title parameter"));
+                __TRACE(KError, (_L("No mandatory test case number could be found using given title parameter")));
+                return KErrNotFound;
+                }
+            }
+
+        CTestInfo *testCase = CTestInfo::NewL();
+        CleanupStack::PushL( testCase );
+        // Copy to CTestInfo.
+
+        if( ( aReq.iModule.Find( KTestScripterName ) != KErrNotFound ) )
+            {
+            testCase->SetModuleName( KTestScripterName );
+            }
+        else
+            {
+            testCase->SetModuleName(  aReq.iModule );
+            }
+        testCase->SetTestCaseNumber( aReq.iTestCaseNumber );
+        testCase->SetTestCaseFile( aReq.iTestCaseFile );
+
+        // Create container.
+        CUIEngineContainer* container = NULL;
+
+        RDebug::Print(_L("CStifTFw::AtsRemoteRun calling StartTestCase "));
+        ret = iUIEngine->StartTestCase( container,
+                                        *testCase );
+
+        CleanupStack::PopAndDestroy( testCase );
+
+        if( ret != KErrNone )
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemoteRun test case starting FAILED "));
+            __TRACE( KError, ( _L( "Test case starting failed [%d]"), ret ) );
+            }
+        else
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemoteRun Add container"));
+            // Add container to test case execution table
+            container->SetRemoteId( aReq.SrcId() );
+            testid = TESTID( (TInt)container );
+            ret = iTestRemoteExecutionTable.Append( container );
+            __TRACE( KError, ( _L( "Test case started [%x]"), testid ) );
+            }
+        }
+
+    aResp.AppendId( SETID( iStifTFwIf->DevId(), testid ) );
+    aResp.AppendId( aReq.SrcId() );
+    aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+    aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRun );
+    if( ret != KErrNone )
+        {
+        aResp.Append( CStifTFwIfProt::RunStatus,
+                     CStifTFwIfProt::ERunError );
+        aResp.Append( CStifTFwIfProt::RunStatusParams,
+                     CStifTFwIfProt::ERunResult, ret );
+        }
+    else
+        {
+        aResp.Append( CStifTFwIfProt::RunStatus,
+                     CStifTFwIfProt::ERunStarted );
+        }
+    // Response is created, return success
+    ret = KErrNone;
+
+    RDebug::Print(_L("CStifTFw::AtsRemoteRun end "));
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: AtsRemoteTestCtl
+
+    Description: Remote run ATS call
+
+    Parameters: const TDesC& aMessage: in:
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifTFw::AtsRemoteTestCtl( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp )
+    {
+    RDebug::Print(_L("CStifTFw::AtsRemoteTestCtl"));
+
+    TInt ret = KErrNone;
+
+    if( ( aReq.DstDevId() == 0 ) ||
+        ( aReq.DstTestId() == 0 ) )
+        {
+        // Protocol violation
+        __TRACE( KError, ( _L( "AtsReceive: remote test control for illegal dstid received") ) );
+        return KErrGeneral;
+        }
+
+    if ( aReq.DstDevId() != iStifTFwIf->DevId() )
+        {
+        // Not our protocol message
+        __TRACE( KError, ( _L( "AtsReceive: remote test control for illegal dstdevid received") ) );
+        return KErrNotFound;
+        }
+
+    // Find test case from execution table
+    TInt count = iTestRemoteExecutionTable.Count();
+    TInt index = 0;
+    for(; index < count; index++ )
+        {
+        if( TESTID( iTestRemoteExecutionTable[index] ) ==
+            aReq.DstTestId() )
+            {
+            break;
+            }
+        }
+
+    // Check that test id is found
+    if( index == count )
+        {
+        __TRACE( KError, (  _L( "PauseTestCase. Container not found: testId: %x"),
+            aReq.DstTestId() ) );
+        return KErrNotFound;
+        }
+
+    switch( aReq.iCmdType )
+        {
+        case CStifTFwIfProt::ECmdPause:
+            // Pause test
+            __TRACE( KPrint, (  _L( "PauseTest: %x"), aReq.DstTestId() ) );
+            ret = iTestRemoteExecutionTable[index]->PauseTest();
+            break;
+        case CStifTFwIfProt::ECmdResume:
+            // Resume test
+            __TRACE( KPrint, (  _L( "ResumeTestCase: %x"), aReq.DstTestId() ) );
+            ret = iTestRemoteExecutionTable[index]->ResumeTest();
+            break;
+        case CStifTFwIfProt::ECmdCancel:
+            // Cancel test
+            __TRACE( KPrint, (  _L( "CancelTestCase: %x"), aReq.DstTestId() ) );
+            ret = iTestRemoteExecutionTable[index]->CancelTest();
+            break;
+        default:
+            return KErrNotSupported;
+        }
+    if( ret == KErrNone )
+        {
+        // Success response is created here
+        aResp.AppendId( aReq.DstId() );
+        aResp.AppendId( aReq.SrcId() );
+        aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+        aResp.Append( CStifTFwIfProt::CmdType, aReq.iCmdType );
+        }
+
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: AtsRemoteEventCtl
+
+    Description: Remote run ATS call
+
+    Parameters: const TDesC& aMessage: in:
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStifTFw::AtsRemoteEventCtl( CStifTFwIfProt& aReq,
+                                    CStifTFwIfProt& aResp )
+    {
+    RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl start "));
+
+    if( ( aReq.DstDevId() == 0 ) ||
+        ( aReq.DstTestId() != 0 ) )
+        {
+        // Protocol violation
+        __TRACE( KError, ( _L( "AtsReceive: remote event control for illegal dstid received") ) );
+        return KErrGeneral;
+        }
+
+    if ( aReq.DstDevId() != iStifTFwIf->DevId() )
+        {
+        // Not our protocol message
+        __TRACE( KError, ( _L( "AtsReceive: remote event control for illegal dstdevid received") ) );
+        return KErrNotFound;
+        }
+
+    if( aReq.iEventName.Length() == 0 )
+        {
+        __TRACE( KError, ( _L("No event name given") ) );
+        return KErrNotFound;
+    }
+
+    switch( aReq.iCmdType )
+        {
+        case CStifTFwIfProt::ECmdRequest:
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl ECmdRequest "));
+            CUIEngineEvent* eventCtl = NULL;
+            TRAPD( err, eventCtl = CUIEngineEvent::NewL( iUIEngine ); );
+            if( err != KErrNone )
+                {
+                return err;
+                }
+            err = iEventArray.Append( eventCtl );
+            if( err != KErrNone )
+                {
+                delete eventCtl;
+                return err;
+                }
+
+            eventCtl->Request( aReq.iEventName, aReq.SrcId(),
+                               SETID( iStifTFwIf->DevId(), 0 ) );
+
+            aResp.AppendId( aReq.DstId() );
+            aResp.AppendId( aReq.SrcId() );
+            aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest );
+            aResp.Append( CStifTFwIfProt::EventStatus,
+                         CStifTFwIfProt::EEventActive );
+            aResp.Append( aReq.iEventName );
+            }
+            break;
+        case CStifTFwIfProt::ECmdSetEvent:
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl ECmdMasterSetEvent "));
+            REventSystem eventSys;
+            
+            TInt err = KErrNone;
+            if ( aReq.iEventType == TEventIf::EState )
+                {
+                TRAP( err, eventSys.SetEventL( aReq.iEventName ) );
+                }
+            else
+                {
+                TRAP( err, eventSys.SetIndicationEventL( aReq.iEventName ) );
+                }
+            
+            if ( err != KErrNone )
+                {
+                return err;
+                }
+            
+            aResp.AppendId( aReq.DstId() );
+            aResp.AppendId( aReq.SrcId() );
+            aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdSetEvent );
+            aResp.Append( CStifTFwIfProt::EventStatus,
+                         CStifTFwIfProt::EEventSet );
+            aResp.Append( aReq.iEventName );
+            if ( aReq.iEventType == TEventIf::EState )
+                {
+                aResp.Append( CStifTFwIfProt::EventStatusParams, 
+                                             CStifTFwIfProt::EEventType,
+                                             CStifTFwIfProt::EventType, 
+                                             TEventIf::EState );
+                }
+            }
+            break;
+        case CStifTFwIfProt::ECmdUnsetEvent:
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl ECmdMasterUnsetEvent "));
+            
+            REventSystem eventSys;            
+            TRAPD( err, eventSys.UnsetEventL( aReq.iEventName ) );
+            
+            if ( err != KErrNone )
+                {
+                return err;
+                }
+            
+            aResp.AppendId( aReq.DstId() );
+            aResp.AppendId( aReq.SrcId() );
+            aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdUnsetEvent );
+            aResp.Append( CStifTFwIfProt::EventStatus,
+                         CStifTFwIfProt::EEventUnset );
+            aResp.Append( aReq.iEventName );
+            }
+            break;            
+        case CStifTFwIfProt::ECmdRelease:
+            {
+            RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl ECmdRelease "));
+            TInt count = iEventArray.Count();
+            TInt index = 0;
+            for(; index < count; index++ )
+                {
+                if( ( iEventArray[index]->EventName() == aReq.iEventName ) &&
+                    ( iEventArray[index]->Master() == aReq.SrcId() ) )
+                    {
+                    // Found correct event
+                    CUIEngineEvent* eventCtl = iEventArray[index];
+                    eventCtl->Release();
+                    iEventArray.Remove(index);
+                    delete eventCtl;
+                    break;
+                    }
+                }
+            if( index == count )
+                {
+                return KErrNotFound;
+                }
+
+            aResp.AppendId( aReq.DstId() );
+            aResp.AppendId( aReq.SrcId() );
+            aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRelease );
+            aResp.Append( aReq.iEventName );
+
+            }
+            break;
+        default:
+            RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl NotSupported"));
+            return KErrNotSupported;
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: TestExecuted
+
+    Description:
+
+    Parameters: CUIEngineContainer* aContainer: Address of current
+                CUIEngineContainer is test case ID.
+
+                TFullTestResult& aFullTestResult: in: Test result of executed test case
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CStifTFw::TestExecuted( CUIEngineContainer* aContainer,
+                                        TFullTestResult& aFullTestResult )
+    {
+    RDebug::Print(_L("CStifTFw::TestExecuted"));
+    TInt testExecutionResult = aFullTestResult.iCaseExecutionResultCode;
+    TTestResult testResult = aFullTestResult.iTestResult;
+
+    // Find Container from test execution table
+    TInt index = iTestExecutionTable.Find( aContainer );
+    if( index >= 0 )
+        {
+        // Remove Container from test case execution table
+        iTestExecutionTable.Remove( index );
+
+        iStifTFwIf->TestCompleted( (TInt)aContainer, testExecutionResult, testResult );
+        __TRACE( KPrint, ( _L( "CStifTFw::TestExecuted. TestID %d  executed"), (TInt)aContainer ) );
+        }
+     else
+        {
+        // Find Container from test remote execution table
+        index = iTestRemoteExecutionTable.Find( aContainer );
+        // Check if test id is found from remote tests
+        if( index >= 0 )
+            {
+            // Remove Container from test case execution table
+            iTestRemoteExecutionTable.Remove( index );
+
+            CStifTFwIfProt* resp = NULL;
+            TRAPD( err, resp = CStifTFwIfProt::NewL() );
+            if( err != KErrNone )
+                {
+                // oom
+                return;
+                }
+
+            // Create response
+            TRAP( err, resp->CreateL(); );
+            if( err != KErrNone )
+                {
+                delete resp;
+                // Oom
+                return;
+                }
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
+            resp->AppendId( SETID( iStifTFwIf->DevId(), TESTID( (TInt) aContainer ) ) );
+            resp->AppendId( aContainer->RemoteId() );
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            resp->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRun );
+            resp->Append( CStifTFwIfProt::RunStatus,
+                         CStifTFwIfProt::ERunReady );
+            if( testExecutionResult != KErrNone )
+                {
+                resp->Append( CStifTFwIfProt::RunStatusParams,
+                             CStifTFwIfProt::ERunResult,
+                             testExecutionResult );
+                switch( aFullTestResult.iCaseExecutionResultType )
+                    {
+                    case TFullTestResult::ECasePanic:
+                        resp->Append( CStifTFwIfProt::RunStatusParams,
+                                     CStifTFwIfProt::ERunCategory,
+                                     CStifTFwIfProt::ResultCategory,
+                                     CStifTFwIfProt::EResultPanic );
+                        break;
+                    case TFullTestResult::ECaseTimeout:
+                        resp->Append( CStifTFwIfProt::RunStatusParams,
+                                     CStifTFwIfProt::ERunCategory,
+                                     CStifTFwIfProt::ResultCategory,
+                                     CStifTFwIfProt::EResultTimeout );
+                        break;
+                    case TFullTestResult::ECaseLeave:
+                        resp->Append( CStifTFwIfProt::RunStatusParams,
+                                     CStifTFwIfProt::ERunCategory,
+                                     CStifTFwIfProt::ResultCategory,
+                                     CStifTFwIfProt::EResultLeave );
+                        break;
+                    case TFullTestResult::ECaseException:
+                        resp->Append( CStifTFwIfProt::RunStatusParams,
+                                     CStifTFwIfProt::ERunCategory,
+                                     CStifTFwIfProt::ResultCategory,
+                                     CStifTFwIfProt::EResultException );
+                        break;
+                    default:
+                        // The rest are normal execution results
+                        break;
+                    }
+                }
+            else
+                {
+                resp->Append( CStifTFwIfProt::RunStatusParams,
+                             CStifTFwIfProt::ERunResult,
+                             testResult.iResult );
+                }
+
+            iStifTFwIf->AtsSend( resp->Message() );
+            __TRACE( KPrint, ( _L( "TestExecuted: %x"), TESTID(aContainer) ) );
+            delete resp;
+            }
+        }
+
+    if( index >= 0 )
+        {
+        __TRACE( KPrint, ( _L( "Execution result %d"), testExecutionResult ) );
+        __TRACE( KPrint, ( _L( "Test result(%S) %d"), &testResult.iResultDes, testResult.iResult ) );
+        }
+    else
+        {
+        __TRACE( KPrint, ( _L( "CStifTFw::TestExecuted. Container not found: TestId = %d"),
+            (TInt)aContainer ) );
+        User::Panic( _L("CStifTFw"), KErrNotFound );
+        }
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: PrintProg
+
+    Description:
+
+    Parameters: CUIEngineContainer* aContainer: in: Address of current
+                CUIEngineContainer is test case ID
+
+                TTestProgress& aProgress: in: Progress information from test case
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFw::PrintProg( CUIEngineContainer* aContainer,
+                                     TTestProgress& aProgress )
+    {
+    RDebug::Print(_L("CStifTFw::PrintProg"));
+
+    if( aContainer == NULL )
+        {
+        return KErrArgument;
+        }
+    if( ( aProgress.iDescription.Length() == 0 ) &&
+        ( aProgress.iText.Length() == 0 ) )
+
+        {
+        return KErrArgument;
+        }
+
+//Stif-50 - the following code has been commented out to get messages on slave
+//    // Find Container from test execution table and remove it
+//    TInt index = iTestExecutionTable.Find(aContainer);
+//
+//    // Check if test id is found
+//    if( index >= 0 )
+//        {
+//        // Forward if found, prints are not forwarded from slave to master
+        iStifTFwIf->Print( (TInt)aContainer, aProgress );
+//        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: RemoteMsg
+
+    Description:
+
+    Parameters: const TDesC& aMessage: in: Remote message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFw::RemoteMsg( CUIEngineContainer* /*aContainer*/,
+                                     const TDesC& aMessage)
+    {
+    RDebug::Print(_L("CStifTFw::RemoteMsg"));
+
+    if( aMessage.Length() == 0 )
+        {
+        return KErrArgument;
+        }
+    // Forward message
+    iStifTFwIf->AtsSend( aMessage );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: RemoteMsg
+
+    Description:
+
+    Parameters: const TDesC& aMessage: in: Remote message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CStifTFw::GoingToReboot( CUIEngineContainer* /*aContainer*/,
+                                         TRequestStatus& aStatus )
+    {
+    RDebug::Print(_L("CStifTFw::GoingToReboot"));
+
+    aStatus = KRequestPending;
+    // Forward reboot indication
+    iStifTFwIf->GoingToDoReset();
+    TRequestStatus* rs = &aStatus;
+    User::RequestComplete( rs, KErrNone );
+
+    return KErrNone;
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFw
+
+    Method: DeleteData
+
+    Description: Delete arrays before closing session to test engine server
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CStifTFw::DeleteData()
+    {
+    RDebug::Print(_L("CStifTFw::DeleteData resetting iTestExecutionTable cnt=%d"), iTestExecutionTable.Count());
+    iTestExecutionTable.Reset();
+    RDebug::Print(_L("CStifTFw::DeleteData resetting iTestRemoteExecutionTable cnt=%d"), iTestRemoteExecutionTable.Count());
+    iTestRemoteExecutionTable.Reset();
+    RDebug::Print(_L("CStifTFw::DeleteData resetting iEventArray cnt=%d"), iEventArray.Count());
+    iEventArray.ResetAndDestroy();
+    RDebug::Print(_L("CStifTFw::DeleteData resetting iMasterArray cnt=%d"), iMasterArray.Count());
+    iMasterArray.Reset();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIEngine.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,1308 @@
+/*
+* 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: CUIEngine: This object executes test cases from 
+* STIF Test Framework.
+* 
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <collate.h>
+#include "UIEngineEvent.h"
+#include <stifinternal/UIEngineContainer.h>
+#include "UIEngineError.h"
+#include <stifinternal/UIEngine.h>
+#include "Logging.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+_LIT( KUIEngine, "CUIEngine" );
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iLogger
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: CUIEngine
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngine::CUIEngine( CUIIf* aUi  ):
+    iUi( aUi )
+    {
+
+    __RDEBUG( _L( "CUIEngine::CUIEngine()" ) );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngine::ConstructL()
+    {
+    // Logger's setting definitions
+    TLoggerSettings loggerSettings;
+    loggerSettings.iCreateLogDirectories = EFalse;
+    loggerSettings.iOverwrite = ETrue;
+    loggerSettings.iTimeStamp = ETrue;
+    loggerSettings.iLineBreak = ETrue;
+    loggerSettings.iEventRanking = EFalse;
+    loggerSettings.iThreadId = EFalse;
+    loggerSettings.iHardwareFormat = CStifLogger::ETxt;
+    loggerSettings.iHardwareOutput = CStifLogger::EFile;
+    loggerSettings.iEmulatorFormat = CStifLogger::ETxt;
+    loggerSettings.iEmulatorOutput = CStifLogger::EFile;
+    loggerSettings.iUnicode = EFalse;
+    loggerSettings.iAddTestCaseTitle = EFalse;
+
+    // Create Logger, Note: Use protected NewL because initialization file not
+    // readed yet.
+    iLogger = CStifLogger::NewL( KUiLogDir, KUiLogFile, loggerSettings );
+    
+    // Initialize logger    
+    iUi->InitializeLogger( iLogger );
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+    
+    Parameters: None
+    
+    Return Values: CUIEngine* : Pointer to created UI engine object
+
+    Errors/Exceptions: Leaves if memory allocation for CUIEngine fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngine* CUIEngine::NewL( CUIIf* aUi )
+    {
+    
+    CUIEngine* self =  
+        new ( ELeave ) CUIEngine( aUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: ~CUIEngine
+
+    Description: Destructor
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngine::~CUIEngine()
+    {
+    
+    __RDEBUG( _L( "CUIEngine::~CUIEngine()" ) );
+    
+    // Delete all containers, cannot use ResetAndDestroy,
+    // because destructor is private
+    TInt count = iContainerArray.Count();
+    for( TInt i=0; i< count; i++ )
+        {
+        delete iContainerArray[i];
+        }
+    iContainerArray.Reset();    
+    iContainerArray.Close();
+
+    delete iLogger;
+    iLogger = NULL;
+    
+    delete iError;
+    iError = 0;
+        
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: VUIEngine
+
+    Method: Open
+
+    Description: Open test engine.
+
+    Parameters: TDesC& aTestFrameworkIni: in: Initialization file to Test Framework
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::Open( const TDesC& aTestFrameworkIni )
+    {
+    
+    if( iTestEngine.Handle() != 0 )
+        {
+        __TRACE( KError, ( CStifLogger::EError, _L( "CUIEngine::Open() Already open" ) ) );
+        return KErrInUse;     
+        }
+
+    // Check aTestFrameworkIni max length
+    if( aTestFrameworkIni.Length() > KMaxFileName )
+        {
+        __TRACE( KPrint, ( CStifLogger::EError, _L( "CUIEngine::Open() method's parameter length is incorrect" ) ) );
+        return KErrArgument;        
+        }
+
+    // Create Test Engine
+    TInt ret = iTestEngine.Connect();
+
+    if ( ret != KErrNone )
+        {
+        __TRACE( KPrint, ( _L( "CUIEngine::Open. Engine server open failed: ret = %d"), ret ) );
+
+        return ret;
+        }
+
+    ret = iTestEngine.LoadConfiguration( aTestFrameworkIni );
+
+    if ( ret != KErrNone )
+        {
+        __TRACE( KPrint, ( _L( "CUIEngine::Open. Engine. Open failed: ret = %d"), ret ) );
+
+        return ret;
+        }
+
+    TErrorNotification error;
+    if( ErrorPrint( error ) != KErrNotSupported )
+        {
+        // Start printer
+        iError = CUIEngineErrorPrinter::NewL( this );
+        iError->StartL( iTestEngine );
+        }
+
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: Close
+
+    Description: Close test engine.
+
+    Parameters: None
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::Close()
+    {
+    
+    delete iError;
+    iError = 0;
+    
+    // Delete all containers, cannot use ResetAndDestroy,
+    // because destructor is private
+    TInt count = iContainerArray.Count();
+    for( TInt i=0; i< count; i++ )
+        {
+        delete iContainerArray[i];
+		iContainerArray[i] = NULL;
+        }
+    iContainerArray.Reset();
+    
+    iTestEngine.Close();
+
+    __TRACE( KPrint, ( _L( "CUIEngine::Close." ) ) );
+
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: AddTestModule
+
+    Description: Add test module to module list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which is added to module list
+                TDesC& aIniFile: in: Initialization file to the test module
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::AddTestModule( const TDesC& aModuleName, 
+                               const TDesC& aIniFile )
+    {
+    // Check aModuleName max length
+    if( aModuleName.Length() > KMaxName )
+        {
+        __TRACE( KPrint, ( CStifLogger::EError, _L( "CUIEngine::AddTestModule() method's first parameter length is incorrect" ) ) );
+        return KErrArgument;        
+        }
+    // Check aIniFile max length
+    if( aIniFile.Length() > KMaxFileName )
+        {
+        __TRACE( KPrint, ( CStifLogger::EError, _L( "CUIEngine::AddTestModule() method's second parameter length is incorrect" ) ) );
+        return KErrArgument;        
+        }    
+
+
+    TInt ret = iTestEngine.AddTestModule( aModuleName, aIniFile );
+
+    if ( ret != KErrNone && ret != KErrAlreadyExists )
+        {
+		__TRACE( KPrint, ( _L( "CUIEngine::AddTestModule. Add module failed: ret = %d" ), ret  ) );
+
+        return ret;
+        }
+
+    return KErrNone;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: RemoveTestModule
+
+    Description: Remove test module from test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which is removed of module list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::RemoveTestModule( const TDesC& aModuleName )
+    {
+    // Remove test module of module list of test engine
+    TInt ret = iTestEngine.RemoveTestModule( aModuleName );
+
+    if ( ret != KErrNone )
+        {
+        __TRACE( KPrint, ( _L( "CUIEngine::RemoveTestModule. Remove module failed: ret = %d"), ret  ) );
+
+        return ret;
+        }
+
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: AddTestCaseFile
+
+    Description: Add test case file to test case file list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which own test cases of test case list.
+                TDesC& aCaseFile: in: Test case list, which is added to test case list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::AddTestCaseFile( const TDesC& aModuleName, 
+                                 const TDesC& aCaseFile )
+    {
+    // Check aModuleName max length
+    if( aModuleName.Length() > KMaxName )
+        {
+        __TRACE( KPrint, ( CStifLogger::EError, _L( "CUIEngine::AddTestCaseFile() method's first parameter length is incorrect" ) ) );
+        return KErrArgument;        
+        }
+    // Check aCaseFile max length
+    if( aCaseFile.Length() > KMaxFileName )
+        {
+        __TRACE( KPrint, ( CStifLogger::EError, _L( "CUIEngine::AddTestCaseFile() method's second parameter length is incorrect" ) ) );
+        return KErrArgument;        
+        }
+    
+    TInt ret( KErrNone );
+
+    // Add given test case file to test module
+    if ( aCaseFile.Length() == 0 )
+        {
+        ret = KErrArgument;
+        __TRACE( KPrint, (  _L( "CUIEngine::AddTestCaseFile. Test case file not defined: ret = %d"), ret  ) );
+        }
+    else
+        {
+        // Add test case file to test case file list of test engine 
+        ret = iTestEngine.AddConfigFile( aModuleName, aCaseFile );
+
+        if ( ret != KErrNone && ret != KErrAlreadyExists )
+            {
+            __TRACE( KPrint, ( _L( "CUIEngine::AddTestCaseFile. Add test case file failed: ret = %d"), ret  ) );
+            }
+        }
+
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: RemoveTestCaseFile
+
+    Description: Remove test case file of test case file list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which own test cases of test case list
+                TDesC& aCaseFile: in: Test case list, which is removed of test case list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::RemoveTestCaseFile( const TDesC& aModuleName, 
+                                    const TDesC& aCaseFile )
+    {   
+    
+    TInt ret( KErrNone );
+
+    // Remove given test case file from test module
+    if ( aCaseFile.Length() == 0 )
+        {
+        ret = KErrArgument;
+        __TRACE( KPrint, (  _L( "CUIEngine::RemoveTestCaseFile. Test case file not defined: ret = %d"), ret  ) );
+        }
+    else
+        {
+        // Remove test case file  
+        ret = iTestEngine.RemoveConfigFile( aModuleName, aCaseFile );
+
+        if ( ret != KErrNone )
+            {
+            __TRACE( KPrint, ( _L( "CUIEngine::RemoveTestCaseFile. Remove test case file failed: ret = %d"), ret  ) );
+            }
+        }
+
+    return ret;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: GetTestCases
+
+    Description: Get test cases of enumerated list of test engine. Method is copied 
+                 list of test cases to aTestCaseInfo. Copied tests are test cases 
+                 of test module (aTestModule) and defined
+                 in test case file (aTestCaseFile), which are given as argument
+
+                 Method copied all enumerated test cases if aTestModule
+                 and aTestCaseFile are not defined
+    
+    Parameters: RPointerArray<CTestInfo>& aTestCaseInfo: inout: List of test cases
+                TDesC& aModuleName: in: Testmodule, which own test cases of test case list
+                TDesC& aTestCaseFile: in: Test case list, which is got of test case list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::GetTestCasesL( RPointerArray<CTestInfo>& aTestCaseInfo,
+                               const TDesC& aTestModule, 
+                               const TDesC& aTestCaseFile )
+    { 
+	__TRACE( KPrint, (  _L( "GetTestCasesL()") ) );
+
+    TInt ret(KErrNone);
+    TInt count(0);
+
+    // Enumerate test cases
+    TCaseCount caseCount;
+
+    TRequestStatus status;
+    iTestEngine.EnumerateTestCases( caseCount, status );
+    User::WaitForRequest( status );
+    ret = status.Int();
+
+    // Check that enumerate succeeded
+    if ( ret != KErrNone )
+        {
+        __TRACE( KPrint, (  _L( "CUIEngine::GetTestCases. Test case enumerate failed: ret = %d"), ret ) );
+        TErrorNotification error;
+        error.iText = _L("Can't get test cases");
+        iUi->ErrorPrint ( error );  
+        return ret;
+        }
+
+    CFixedFlatArray<TTestInfo>* testCases = NULL;
+
+    // Create test cases to buffer
+    TRAPD( err, testCases = CFixedFlatArray<TTestInfo>::NewL( caseCount() ) );
+    if( err != KErrNone )
+        {        
+        if( err == KErrNoMemory )
+            {
+            _LIT( KNotEnoughHeapMemory, 
+                "Not enough heap memory available. Either reduce the test case count or increase UI's heap size in mmp file using EPOCHEAPSIZE.");
+            RDebug::Print( KNotEnoughHeapMemory );
+        	__TRACE( KError, ( KNotEnoughHeapMemory ) );        
+        	}
+        else
+           {
+            _LIT( KGeneralError,
+                "CUIEngine::GetTestCasesL: CFixedFlatArray<TTestInfo>::NewL fails with value: %d");
+            RDebug::Print( KGeneralError, err );
+        	__TRACE( KError, ( KGeneralError, err ) );                   
+           }        	
+        User::Leave( err );
+        }    
+            
+    CleanupStack::PushL( testCases );
+
+    // Get test cases from Engine.
+    ret = iTestEngine.GetTestCases( *testCases );
+
+    if ( ret != KErrNone )
+        {
+        __TRACE( KPrint, (  _L( "CUIEngine::GetTestCases. Get test cases failed: ret = %d"), ret ) );
+
+        CleanupStack::PopAndDestroy( testCases );
+        return ret;
+        }
+
+    // count of test cases.
+    count = caseCount();
+
+    __TRACE( KPrint, (  _L( "Test case count: %d"), count ) );
+    
+    HBufC* moduleNameBuf = aTestModule.AllocLC();
+    TPtr moduleName( moduleNameBuf->Des() );
+    TCollationMethod method = 
+        *Mem::CollationMethodByIndex(0); // get the standard method
+    method.iFlags |= TCollationMethod::EFoldCase; // ignore case
+
+    moduleName.LowerCase();
+
+    // Remove optional '.DLL' from test module file name
+    TParse parse;
+    parse.Set( moduleName, NULL, NULL );
+    
+    if( !parse.Ext().CompareC(  _L(".dll"), 3, &method ) )
+        {
+        const TInt len = parse.Ext().Length();
+        moduleName.Delete ( moduleName.Length()-len, len );
+        }
+        
+    TBool found = EFalse;
+    // Update iTestCaseTable.
+    for (TInt j=0;j<count;j++, found = EFalse)
+        {
+        // Check, if module defined.
+        if ( aTestModule.Length() > 0 )
+            {
+            // Check, if test case defined.
+            if ( aTestCaseFile.Length() > 0)
+                {
+                if( moduleName == KTestScripterName )
+                    {
+                    if( !( *testCases )[j].iConfig.CompareC( aTestCaseFile, 3, &method ) )
+                        {
+                        found = ETrue;
+                        }
+                    }
+                if( !( *testCases )[j].iModuleName.CompareC( moduleName, 3, &method )
+                    && !( *testCases )[j].iConfig.CompareC( aTestCaseFile, 3, &method ) )
+                    {
+                    found = ETrue;
+                    }
+                }
+            else
+                {
+                if( moduleName == KTestScripterName )
+                    {
+                    // Test Module is TestScripter
+                    if( ( *testCases )[j].iModuleName.Find( KTestScripterName ) != KErrNotFound )
+                        {
+                        // iModuleName name is in 'testscripter_testcasefile'
+                        // format => Find()
+                        found = ETrue;
+                        }
+                    }
+                if( !( *testCases )[j].iModuleName.CompareC( 
+                                            moduleName, 3, &method ) )
+                    {
+                    found = ETrue;
+                    }
+                }
+            }
+        else
+            {
+            found = ETrue;
+            }
+        
+        if( found )
+            {
+            // Create tmpTestInfo.
+            CTestInfo *tmpTestInfo = CTestInfo::NewL();
+             
+            CleanupStack::PushL( tmpTestInfo );            
+
+            // Copy TTestInfo to CTestInfo.
+            tmpTestInfo->SetModuleName( ( *testCases )[j].iModuleName );
+            tmpTestInfo->SetTestCaseTitle( ( *testCases )[j].iTestCaseInfo.iTitle );
+            tmpTestInfo->SetTestCaseNumber( ( *testCases )[j].iTestCaseInfo.iCaseNumber );
+            tmpTestInfo->SetPriority( ( *testCases )[j].iTestCaseInfo.iPriority );
+            tmpTestInfo->SetTimeout( ( *testCases )[j].iTestCaseInfo.iTimeout );
+            tmpTestInfo->SetTestCaseFile( ( *testCases )[j].iConfig );
+            ret = aTestCaseInfo.Append(tmpTestInfo);
+            if( ret != KErrNone )
+                {
+                CleanupStack::PopAndDestroy( tmpTestInfo );
+                }
+            else
+                {
+                CleanupStack::Pop( tmpTestInfo );
+                }
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( moduleNameBuf );
+
+    CleanupStack::PopAndDestroy( testCases );
+
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: StartTestCase
+
+    Description: Start test case execution.
+
+    Parameters: TInt& aTestId: in: ID for test case. Test ID given of address of
+                current UIEngineContainer.
+
+                const CTestInfo& aTestInfo: in: Test case information
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::StartTestCase( CUIEngineContainer*& aContainer,
+                              const CTestInfo& aTestInfo )
+    {
+    TInt ret( KErrNone );
+
+    // Copy CTestInfo to TTestInfo.
+    TTestInfo testCase; 
+    testCase.iModuleName = aTestInfo.ModuleName();
+    testCase.iTestCaseInfo.iTitle = aTestInfo.TestCaseTitle();
+    testCase.iTestCaseInfo.iCaseNumber = aTestInfo.TestCaseNum();
+    testCase.iTestCaseInfo.iPriority = aTestInfo.Priority();
+    testCase.iTestCaseInfo.iTimeout = aTestInfo.Timeout();
+    testCase.iConfig = aTestInfo.TestCaseFile();
+
+    CUIEngineContainer* container = NULL;
+    TRAP( ret,
+        // Create container.
+        container = 
+            CUIEngineContainer::NewL( this, testCase, iTestEngine );
+    );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    ret = iContainerArray.Append( container );
+    if( ret != KErrNone )
+        {
+        __TRACE( KError, ( CStifLogger::EError, 
+            _L( "CUIEngine::StartTestCase() Append failed, cannot start test case" ) ) );
+        delete container;
+        return ret;
+        }
+        
+    // Call Container to starting test case execution.
+    TRAPD( trapError,
+    // Call Container to starting test case execution.
+    ret = container->StartContainerL();
+    );
+
+    if(trapError != KErrNone)
+        {
+        __TRACE( KPrint, (  _L( "CUIEngine::StartTestCase. Test case starting failed: trapError = %d"), ret ) );
+        delete container;
+        return trapError;
+        }
+        
+    aContainer = container;
+
+    return ret;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: AbortStartedTestCase
+
+    Description: Abort started test case execution.
+
+    Parameters: CUIEngineContainer* aContainer: in: Container running testcase
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: Panics if test case is not found or is already executed
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngine::AbortStartedTestCase( CUIEngineContainer* aContainer )
+    {
+    
+    // Locate container from array
+    TInt index = iContainerArray.Find( aContainer );
+    
+    if( ( index < 0) ||
+        ( aContainer->State() == CUIEngineContainer::EExecuted ) )
+        {
+        __TRACE( KError, ( CStifLogger::EError, 
+            _L( "CUIEngine::AbortStartedTestCase() Testcase executed" ) ) );
+        User::Panic( KUIEngine, KErrAccessDenied );
+        }
+        
+    // Remove and delete container
+    iContainerArray.Remove( index );
+    delete aContainer;
+    
+    }
+
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: TestExecuted
+
+    Description: 
+
+    Parameters: CUIEngineContainer* aUIEngineContainer: Address of current
+                CUIEngineContainer is test case ID.
+
+                TFullTestResult& aFullTestResult: in: Test result of executed test case
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngine::TestExecuted( CUIEngineContainer* aContainer, 
+                               TFullTestResult& aFullTestResult )
+    {
+     // Locate container from array
+    TInt index = iContainerArray.Find( aContainer );
+    
+    if( index < 0 )
+        {
+        __TRACE( KError, ( CStifLogger::EError, 
+            _L( "CUIEngine::TestExecuted() Testcase not found" ) ) );
+        User::Panic( KUIEngine, KErrNotFound );
+        }
+    
+    iUi->TestExecuted( aContainer, aFullTestResult );
+    
+    // Remove and delete container.
+    // It is safe to do here,
+    // because container and runner does not have any code after
+    // this function returns.
+    iContainerArray.Remove( index );
+    delete aContainer;
+   
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: PrintProg
+
+    Description: 
+
+    Parameters: CUIEngineContainer* aContainer: in: Address of current
+                CUIEngineContainer is test case ID
+
+                TTestProgress& aProgress: in: Progress information from test case
+
+    Return Values: SymbianOS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::PrintProg( CUIEngineContainer* aContainer, 
+                          TTestProgress& aProgress )
+    {
+
+    return iUi->PrintProg( aContainer, aProgress );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: ErrorPrint
+
+    Description: 
+
+    Parameters: TErrorNotification& aError: in: Error information from framework
+
+    Return Values: SymbianOS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::ErrorPrint( TErrorNotification& aError )
+    {
+
+    return iUi->ErrorPrint( aError );
+        
+    }
+   
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: RemoteMsg
+
+    Description: Forward Ats send.
+
+    Parameters: const TDesC& aMessage: in: message
+    
+    Return Values: SymbianOS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::RemoteMsg( CUIEngineContainer* aContainer, 
+                           const TDesC& aMessage )
+    {
+
+    return iUi->RemoteMsg( aContainer, aMessage );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngine
+
+    Method: GoingToReboot
+
+    Description: Forward reboot indication.
+
+    Parameters: None
+    
+    Return Values: SymbianOS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngine::GoingToReboot( CUIEngineContainer* aContainer,
+                               TRequestStatus& aStatus )
+    {
+
+    return iUi->GoingToReboot( aContainer, aStatus );
+        
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    CTestInfo: This object contains test case information.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: NewL
+
+    Description:
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestInfo* CTestInfo::NewL()
+    {
+    
+    //RDebug::Print(_L("CTestInfo::NewL()"));
+    CTestInfo* self =  
+        new ( ELeave ) CTestInfo();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: CTestInfo
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+    
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestInfo::CTestInfo()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestInfo::ConstructL()
+    {   
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: ~CTestInfo
+
+    Description: Destructor
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestInfo::~CTestInfo()
+    {
+    
+    delete iModuleNameBuf;
+    delete iTitleBuf;
+    delete iTestCaseFileBuf;
+    iModuleNameBuf = 0;
+    iTitleBuf = 0;
+    iTestCaseFileBuf = 0;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: SetModuleName
+
+    Description: Set module name.
+    
+    Parameters: None
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestInfo::SetModuleName ( const TDesC& aModuleName ) 
+    {
+    
+    iModuleName.Set(0,0); 
+    delete iModuleNameBuf;
+
+    if( aModuleName.Length() < KTestScripterNameLength )
+		{
+		iModuleNameBuf = aModuleName.Alloc();
+		}
+    else
+        {
+        // Check is TestScripter
+	    TPtrC check( aModuleName.Mid( 0, KTestScripterNameLength ) );
+	    TInt ret = check.Compare( KTestScripterName );
+	    if( ret == KErrNone )
+		    {
+            iModuleNameBuf = ( aModuleName.Mid( 0, KTestScripterNameLength ) ).Alloc();
+		    }
+	    else
+		    {
+		    iModuleNameBuf = aModuleName.Alloc();
+		    }
+        }
+
+    if( iModuleNameBuf == NULL )
+        {
+        return KErrNoMemory;
+        }
+    
+    iModuleName.Set( iModuleNameBuf->Des() ); 
+    
+    return KErrNone;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: SetTestCaseTitle
+
+    Description: Set module name.
+    
+    Parameters: None
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestInfo::SetTestCaseTitle ( const TDesC& aTitle )
+    { 
+    
+    iTitle.Set(0,0); 
+    delete iTitleBuf;
+    iTitleBuf = aTitle.Alloc();
+    if( iTitleBuf == NULL )
+        {
+        return KErrNoMemory;
+        }
+    
+    iTitle.Set( iTitleBuf->Des() ); 
+    
+    return KErrNone;
+    
+    };
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: SetTestCaseFile
+
+    Description: Set test case file name.
+    
+    Parameters: None
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestInfo::SetTestCaseFile ( const TDesC& aTestCaseFile )
+    { 
+    iTestCaseFile.Set(0,0); 
+    delete iTestCaseFileBuf;
+    iTestCaseFileBuf = aTestCaseFile.Alloc();
+    if( iTestCaseFileBuf == NULL )
+        {
+        return KErrNoMemory;
+        }
+    
+    iTestCaseFile.Set( iTestCaseFileBuf->Des() );
+    
+    return KErrNone;
+     
+    };
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: CopyL
+
+    Description: Copy existing CTestInfo.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves on error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestInfo::CopyL( const CTestInfo& aTestInfo )
+    {
+
+    User::LeaveIfError( SetModuleName( aTestInfo.ModuleName() ));
+    User::LeaveIfError( SetTestCaseTitle( aTestInfo.TestCaseTitle() ));
+    User::LeaveIfError( SetTestCaseFile( aTestInfo.TestCaseFile() ));
+    
+    iCaseNumber = aTestInfo.TestCaseNum();
+    iPriority = aTestInfo.Priority();
+    iTimeout = aTestInfo.Timeout();
+    iExpectedResult = aTestInfo.ExpectedResult();
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestInfo
+
+    Method: SetTestCaseFile
+
+    Description: Set test case file name.
+    
+    Parameters: None
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TBool CTestInfo::operator== ( const CTestInfo& aTestInfo ) const
+    {
+    
+    if( ( aTestInfo.ModuleName() == ModuleName() ) &&
+        ( aTestInfo.Priority() == Priority() ) &&
+        ( aTestInfo.TestCaseFile() == TestCaseFile() ) &&
+        ( aTestInfo.TestCaseNum() == TestCaseNum() ) &&
+        ( aTestInfo.Timeout() == Timeout() ) )
+        {
+        return ETrue;
+        }
+        
+             
+    return EFalse;
+    
+    }
+    
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIEngineContainer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,608 @@
+/*
+* 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: CUIEngine: This object executes test cases from STIF 
+* Test Framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+#include "UIEnginePrinter.h"
+#include "UIEngineRunner.h"
+#include "UIEngineRemote.h"
+#include "Logging.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iUIEngine->iLogger
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: CUIEngineContainer
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters:  CUIEngine* aUIEngine: in: Pointer to CUIEngine interface
+                 TTestInfo& aTestInfo: in: Test information
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineContainer::CUIEngineContainer( CUIEngine* aUIEngine,
+                                   const TTestInfo& aTestInfo,
+                                   RTestEngine& aTestEngine ) :
+    iUIEngine( aUIEngine ),
+    iTestInfo( aTestInfo ),
+    iTestInfoPckg( iTestInfo ),
+    iState( ENotStarted )
+    {
+    __TRACE( KPrint, (  _L( "CUIEngineContainer::CUIEngineContainer.") ) );
+
+    iTestEngine = aTestEngine;
+
+    __ASSERT_ALWAYS( aUIEngine, User::Panic( _L("Null pointer"), KErrGeneral ) );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineContainer::ConstructL()
+    {
+    __TRACE( KPrint, (  _L( "CUIEngineContainer::ConstructL.") ) );
+
+    // Open test case
+    User::LeaveIfError( iTestCase.Open( iTestEngine, iTestInfoPckg ) );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CUIEngine* aUIEngine: in: pointer to CUIEngine Interface
+                TTestInfo& aTestInfo: in: Test info
+
+    Return Values: CUIEngineRunner* : pointer to created runner object
+
+    Errors/Exceptions: Leaves if memory allocation for CUIEngineRunner fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineContainer* CUIEngineContainer::NewL( CUIEngine* aUIEngine,
+                                            const TTestInfo& aTestInfo,
+                                            RTestEngine& aTestEngine )
+    {
+    CUIEngineContainer* self =  
+        new ( ELeave ) CUIEngineContainer( aUIEngine,
+                                            aTestInfo,
+                                            aTestEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: ~CUIEngineContainer
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/    
+CUIEngineContainer::~CUIEngineContainer()
+    {
+    
+    __TRACE( KPrint, (  _L( "CUIEngineContainer::~CUIEngineContainer.") ) );
+
+    delete iPrinter;
+    delete iRunner;
+    delete iRemote;
+    
+    // Close test case
+    iTestCase.Close();
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: StartContinerL
+
+    Description: StartContinerL call CUIEngineRunner to starting test case execution
+
+    Parameters: None
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngineContainer::StartContainerL()
+    {
+    
+    __TRACE( KPrint, ( _L( "CUIEngineContainer::StartContainerL. Running test case: %S"), 
+        &( iTestInfo.iTestCaseInfo.iTitle ) ) );
+        
+    // Start printer
+    iPrinter = CUIEnginePrinter::NewL( this );
+    iPrinter->StartL( iTestCase );
+
+    // Start remote
+    iRemote = CUIEngineRemote::NewL( this );
+    iRemote->StartL( iTestCase );
+
+    // Start runner
+    iRunner = CUIEngineRunner::NewL( this );
+    iRunner->StartL( iTestCase );
+
+    // Update state of test case
+    iState = ERunning;
+
+    __TRACE( KPrint, ( _L( "CUIEngineContainer::StartContainerL: started") ) );
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: CancelTest
+
+    Description: CancelTest cancels test case execution
+
+    Parameters: None
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIEngineContainer::CancelTest()
+    {
+
+    if ( iState == ERunning || iState == EPaused )
+        {
+        __TRACE( KPrint, ( _L( "CUIEngineContainer::CancelTest") ) );
+
+        // Cancel test case execution
+        iTestCase.CancelAsyncRequest( RTestCase::ERunTestCase );
+        
+        }
+
+    return KErrNone;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: PauseTest
+
+    Description: PauseTest pauses test case execution
+
+    Parameters: None
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIEngineContainer::PauseTest()
+    {
+    TInt ret(KErrNone);
+
+    if ( iState == ERunning )
+        {
+        ret = iTestCase.Pause();
+
+        __TRACE( KPrint, ( _L( "CUIEngineContainer::PauseTest. Ret = %d"), ret ) );
+
+        if ( ret == KErrNone)
+            {
+            iState = EPaused;
+            }
+        }
+
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: ResumeTest
+
+    Description: PauseTest resumes test case execution
+
+    Parameters: None
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIEngineContainer::ResumeTest()
+    {
+    TInt ret(KErrNone);
+
+    if ( iState == EPaused )
+        {
+        ret = iTestCase.Resume();
+
+        __TRACE( KPrint, ( _L( "CUIEngineContainer::ResumeTest. Ret = %d"), ret ) );
+
+        if ( ret == KErrNone)
+            {
+            iState = ERunning;
+            }
+        }
+
+    return ret;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: TestCaseExecuted
+
+    Description: TestCaseExecuted informs that test case is executed
+
+    Parameters: TFullTestResult& aFullTestResult: in: Full information of 
+                test case execution. Includes also test case results
+
+    Return Values: None
+
+    Errors/Exceptions: TInt KErrNone: Always returned KErrNone
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineContainer::TestCaseExecuted( TFullTestResult& aFullTestResult, 
+                                           TInt aStatus )
+    {
+        
+    iState = EExecuted;
+
+    // Set execution result
+    if( ( KErrNone != aStatus ) &&
+        ( aFullTestResult.iCaseExecutionResultCode == KErrNone ) &&
+        ( aFullTestResult.iTestResult.iResult == KErrNone ) )
+        {
+        aFullTestResult.iTestResult.iResultDes.Copy( 
+            _L("Completed with error") );
+        aFullTestResult.iCaseExecutionResultType = 
+            TFullTestResult::ECaseErrorFromModule;
+        aFullTestResult.iCaseExecutionResultCode = aStatus;
+        }
+
+    __TRACE( KPrint, ( _L( "CUIEngineContainer::TestCaseExecuted.") ) );
+
+    // Test execution is not completed before all prints are 
+    // delivered to UI.
+    if( !iPrinter->IsRunning() || 
+        ( aStatus != KErrNone ) || 
+        ( aFullTestResult.iCaseExecutionResultCode != KErrNone ) )
+        {        
+        // Call TestExecuted of CUIEngine interface
+        iUIEngine->TestExecuted(this, aFullTestResult);
+        // 1. This method is called from CUIEngineRunner::RunL() and it is 
+        // last operation => no other call to CUIEngineContainer class.
+        // 2. TestExecuted() method takes this pointer. Inside TestExecuted()
+        // will be deleted the this pointer => iUIEngine not valid anymore.
+        // 1 and 2 => Do not handle any CUIEngineContainer variable here
+        // because memory is not valid anymore.
+        //e.g. iState = EFinished; // illegal operation here->crash
+
+        }
+        
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: PrintProgress
+
+    Description: PrintProgress prints information from test case
+
+    Parameters: TTestProgress& aProgress: in: Progress info
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineContainer::PrintProgress( TTestProgress& aProgress )
+    {
+    if( iState == ERunning )
+        {
+        // Only running cases may print
+        iUIEngine->PrintProg( this, aProgress );
+        }
+    else
+        {
+        __TRACE( KPrint, 
+            ( _L("%S: %S"), &aProgress.iDescription, &aProgress.iText ) );
+        }
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: PrintsDone
+
+    Description: Signals that printing is completed
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineContainer::PrintsDone()
+    {
+    if( iState == EExecuted )
+        {
+        // Call TestExecuted of CUIEngine interface
+        iUIEngine->TestExecuted(this, iRunner->FullResult() );
+        iState = EFinished;
+        }
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: RemoteSend
+
+    Description: RemoteSend forwards remote protocol messages from master
+
+    Parameters: 
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineContainer::RemoteSend( const TDesC& aRemoteMsg, 
+                                     TInt /* aStatus */ )
+    {
+
+    __TRACE( KPrint, ( _L( "CUIEngineContainer::RemoteSend.") ) );
+
+    // Save master id if doesn't exists already
+    if( iMasterId == 0 )
+        {
+        CStifTFwIfProt* msg = NULL;
+        TRAPD( err, 
+            msg = CStifTFwIfProt::NewL(); 
+            msg->SetL( aRemoteMsg );
+            );
+        if( err != KErrNone )
+            {
+            delete msg;
+            // oom
+            return;
+            }
+        iMasterId = msg->SrcId();
+        delete msg;
+        }
+            
+    // Call AtsSend of CUIEngine interface
+    iUIEngine->RemoteMsg( this, aRemoteMsg );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: GoingToReboot
+
+    Description: Inform UI that phone is going to rebooted
+
+    Parameters: 
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngineContainer::GoingToReboot( TRequestStatus& aStatus )
+    {
+
+    __TRACE( KPrint, ( _L( "CUIEngineContainer::GoingToReboot.") ) );
+    
+    // Forward            
+    return iUIEngine->GoingToReboot( this, aStatus );
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineContainer
+
+    Method: RemoteReceive
+
+    Description: RemoteReceive forwards remote protocol messages to master
+
+    Parameters: 
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngineContainer::RemoteReceive( const TDesC& aRemoteMsg )
+    {
+
+    __TRACE( KPrint, ( _L( "CUIEngineContainer::RemoteReceive.") ) );
+    
+    // Check master test case status, FIX110
+    if( iState != ERunning )
+        {
+        __TRACE( KError, ( _L( "Master case not running") ) );
+
+        return KErrNotFound;
+        }
+    
+    HBufC8* buf = HBufC8::New( aRemoteMsg.Length() );
+    if( buf == NULL )
+        { 
+        return KErrNoMemory;
+        }
+      
+    TPtr8 tmp = buf->Des();
+    tmp.Copy( aRemoteMsg );     
+    TInt ret = iTestCase.NotifyRemoteMsg( tmp, EStifCmdReceive );
+    delete buf;
+  
+    return ret;
+    
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIEngineError.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,273 @@
+/*
+* 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: CUIEngineErrorPrinter handles error prints from 
+* test framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stifinternal/UIEngineContainer.h>
+#include "UIEngineError.h"
+#include "Logging.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iUIEngine->iLogger
+
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineErrorPrinter
+
+    Method: NewL
+
+    Description: Create a testcase runner.
+
+    Parameters: CUIEngineContainer* aContainer: in: Pointer to testcase container
+    
+    Return Values: CUIEngineErrorPrinter* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUIEngineErrorPrinter* CUIEngineErrorPrinter::NewL( 
+                                CUIEngine* aUIEngine )
+    {
+
+    CUIEngineErrorPrinter* self = 
+        new ( ELeave ) CUIEngineErrorPrinter( aUIEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineErrorPrinter
+
+    Method: ConstructL
+
+    Description: Second phase constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUIEngineErrorPrinter::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineErrorPrinter
+
+    Method: CUIEngineErrorPrinter
+
+    Description: Constructor.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUIEngineErrorPrinter::CUIEngineErrorPrinter( CUIEngine* aUIEngine ): 
+    CActive( EPriorityStandard ),
+    iUIEngine( aUIEngine ),
+    iErrorPckg( iError )
+    {
+    
+     __TRACE( KPrint, ( _L( "CUIEngineErrorPrinter::CUIEngineErrorPrinter") ) );
+    __ASSERT_ALWAYS( aUIEngine, User::Panic( _L("Null pointer"), KErrGeneral ) );
+    
+    CActiveScheduler::Add( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineErrorPrinter
+
+    Method: ~CUIEngineErrorPrinter
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUIEngineErrorPrinter::~CUIEngineErrorPrinter( )
+    {
+    
+    __TRACE( KPrint, ( _L( "CUIEngineErrorPrinter::~CUIEngineErrorPrinter") ) );
+    Cancel();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineErrorPrinter
+
+    Method: StartL
+
+    Description: Starts a test case and sets the active object to active.
+
+    Parameters: RTestCase& aTestCase: in: Reference to the testcase object
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineErrorPrinter::StartL( RTestEngine& aEngine )
+    {
+    
+    iTestEngine = aEngine;
+ 
+    if ( IsActive() )
+        User::Leave( KErrInUse );
+
+    SetActive();   
+    iTestEngine.ErrorNotification ( iErrorPckg, iStatus );
+    
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineErrorPrinter
+
+    Method: RunL
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineErrorPrinter::RunL()
+    {
+
+    if( iStatus != KErrNone )
+        {
+        return;
+        }
+        
+    iUIEngine->ErrorPrint( iError );
+    
+    // Set new request
+    SetActive();   
+    iTestEngine.ErrorNotification ( iErrorPckg, iStatus );
+
+    }
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineErrorPrinter
+
+    Method: DoCancel
+
+    Description: Cancels the asynchronous request
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUIEngineErrorPrinter::DoCancel()
+    {
+    iTestEngine.CancelAsyncRequest ( RTestEngine::EErrorNotification );
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIEngineEvent.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,529 @@
+/*
+* 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: CUIEngineEvent: This object executes test cases 
+* from STIF Test Framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stifinternal/UIEngineContainer.h>
+#include "UIEngineEvent.h"
+#include "Logging.h"
+#include <stfeventsystem.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iUIEngine->iLogger
+
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: CUIEngineEvent
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineEvent::CUIEngineEvent( CUIEngine* aUIEngine) :
+    CActive( CActive::EPriorityStandard ),
+    iState( EEventIdle ),
+    iUIEngine( aUIEngine ),
+    iEventPckg( iEvent )
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineEvent::CUIEngineEvent") ) );
+    __ASSERT_ALWAYS( aUIEngine, User::Panic( _L("Null pointer"), KErrGeneral ) );
+
+    CActiveScheduler::Add( this );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineEvent::ConstructL()
+    {
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+    
+    Parameters: CUIEngineContainer* CUIEngineContainer: in: Pointer to CUIEngineContainer Interface
+                TTestInfo& aTestInfo: in: Test info
+
+    Return Values: CUIEngineEvent* : Pointer to created runner object
+
+    Errors/Exceptions: Leaves if memory allocation for CUIEngineEvent fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineEvent* CUIEngineEvent::NewL( CUIEngine* aUIEngine )
+    {
+    CUIEngineEvent* self =  
+        new ( ELeave ) CUIEngineEvent( aUIEngine );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: ~CUIEngineEvent
+
+    Description: Destructor
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineEvent::~CUIEngineEvent()
+    {
+    
+    __TRACE( KPrint, ( _L( "CUIEngineEvent::~CUIEngineEvent()") ) );
+    Cancel();
+    
+    if( iState == EEventWaitCompleted )
+        {
+        // Release event
+        Release();
+        }
+    
+    if(iAsyncEventActive)
+        {
+        delete iAsyncEventActive;
+        iAsyncEventActive = NULL;
+        }
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: Request
+
+    Description: Request event.
+
+    Parameters: RTestCase& aTestCase: in: Handle to test case
+                TFullTestResultPckg& aFullTestResultPckg: in: Handle to TFullTestResultPckg
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngineEvent::Request( TDesC& aEventName, 
+                               TUint32 aMaster, 
+                               TUint32 aSlave )
+    {
+    
+    __TRACE( KPrint, ( _L( "CUIEngineEvent::Request %S"), &aEventName ) );
+    
+    iState = EEventRequested;
+    
+    iMaster = aMaster;
+    iSlave = aSlave; 
+    iEvent.SetType( TEventIf::EReqEvent );
+    iEvent.SetName( aEventName );
+    
+    // new implementation
+    TInt err;
+    REventSystem ev;
+    RDebug::Print(_L("STF [ES]: CUIEngineEvent::Request() handling request event"));
+    TRAP(err, ev.RequestEventL(aEventName, reinterpret_cast<TInt>(iUIEngine)));
+
+    /* old event implementation    
+    TRequestStatus status;
+    iUIEngine->iTestEngine.Event( iEventPckg, status ); 
+    User::WaitForRequest( status );
+    */// old event impementation - end
+    
+    if(err == KErrNone )
+        {
+        __ASSERT_ALWAYS(iAsyncEventActive == NULL, User::Panic(_L("CUIEngineEvent::Request"), KErrAlreadyExists));
+        TRAP(err, iAsyncEventActive = CAsyncEventActive::NewL(reinterpret_cast<TInt>(iUIEngine)));
+        if(err != KErrNone)
+            return err;
+        // Enable event waiting
+        iState = EEventWait;            
+        iEvent.SetType( TEventIf::EWaitEvent );
+        SetActive();
+        RThread t;
+        TRAP(err, iAsyncEventActive->StartL(&iStatus, t.Id(), aEventName, NULL));
+        // old implementation iUIEngine->iTestEngine.Event( iEventPckg, iStatus ); 
+        }
+    //return status.Int();
+    return err;
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: Release
+
+    Description: Release event.
+
+    Parameters: RTestCase& aTestCase: in: Handle to test case
+                TFullTestResultPckg& aFullTestResultPckg: in: Handle to TFullTestResultPckg
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngineEvent::Release()
+    {
+    
+    __TRACE( KPrint, ( _L( "CUIEngineEvent::Release %S"), &iEvent.Name() ) );
+    RDebug::Print(_L("STF [ES]: CUIEngineEvent::Release() handling release event"));
+   
+    // new implementation
+    TInt err;
+    REventSystem ev;
+    TRAP(err, ev.ReleaseEventL(iEvent.Name(), reinterpret_cast<TInt>(iUIEngine)));
+    
+    Cancel();
+
+    return err;
+    
+/* old implementation
+    TRequestStatus status;
+    // Release event
+    iState = EEventReleased;
+    iEvent.SetType( TEventIf::ERelEvent );
+    iUIEngine->iTestEngine.Event( iEventPckg, status ); 
+    User::WaitForRequest( status ); 
+    
+    return status.Int();
+*/// end old implementation
+    }
+    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
+                       RunError called by CActiveObject
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineEvent::RunL()
+    {
+    
+    __TRACE( KPrint, ( _L( "CUIEngineEvent::RunL") ) );
+
+    if(iAsyncEventActive)
+        {
+        delete iAsyncEventActive;
+        iAsyncEventActive = NULL;
+        }
+
+    // Error handled in RunError
+    User::LeaveIfError ( iStatus.Int() );
+    
+    switch( iState )
+        {
+        case EEventWait:
+            {
+            // Create response 
+            CStifTFwIfProt* resp = CStifTFwIfProt::NewL();
+            CleanupStack::PushL( resp );    
+            
+            resp->CreateL();
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
+            resp->AppendId( iSlave );
+            resp->AppendId( iMaster );
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            resp->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest );
+            resp->Append( CStifTFwIfProt::EventStatus, 
+                         CStifTFwIfProt::EEventSet );
+            resp->Append( iEvent.Name() );
+            if( iEvent.EventType() == TEventIf::EState )
+                {
+                resp->Append( CStifTFwIfProt::EventStatusParams, 
+                             CStifTFwIfProt::EEventType,
+                             CStifTFwIfProt::EventType, 
+                             TEventIf::EState );
+                } 
+            // Send response
+            iUIEngine->RemoteMsg( NULL, resp->Message() );
+            CleanupStack::PopAndDestroy( resp );    
+            
+            if( iEvent.EventType() == TEventIf::EIndication )
+                {            
+                // Enable indication event waiting again
+                iEvent.SetType( TEventIf::EWaitEvent );
+                SetActive();
+                // old implementation iUIEngine->iTestEngine.Event( iEventPckg, iStatus );
+                iAsyncEventActive = CAsyncEventActive::NewL(reinterpret_cast<TInt>(iUIEngine));
+                // Enable event waiting
+                RThread t;
+                iAsyncEventActive->StartL(&iStatus, t.Id(), iEvent.Name(), NULL);
+                }
+            else  // state event, set only once for one request
+                {                
+                iState = EEventWaitCompleted;
+                }
+            }
+            break;
+        case EEventWaitCompleted:
+        case EEventRequested:
+        case EEventReleased:
+        default:
+            __TRACE( KError, ( _L( "CUIEngineEvent::RunL: Illegal state %d"), iState ) );
+            User::Leave( KErrGeneral );
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: DoCancel
+
+    Description: Cancel active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineEvent::DoCancel()
+    {
+    
+    __TRACE( KPrint, ( _L( "CUIEngineEvent::DoCancel") ) );
+    
+    if(iAsyncEventActive)
+        {
+        iAsyncEventActive->Cancel();
+        delete iAsyncEventActive;
+        iAsyncEventActive = NULL;
+        }
+    /* old implementation
+    TRequestStatus status;
+
+    switch( iState )
+        {
+        case EEventWait:
+            // First cancel waiting
+            iEvent.SetType( TEventIf::ECancelWait );
+            iUIEngine->iTestEngine.Event( iEventPckg, status );
+            User::WaitForRequest( status ); 
+            iState = EEventWaitCompleted;
+            break;
+        default:
+            iUIEngine->iTestEngine.CancelAsyncRequest( ETestEngineEvent ); 
+            iState = EEventIdle;
+            break;
+        }
+    */
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineEvent
+
+    Method: RunError
+
+    Description: Handle errors from STIF TestFramework
+
+    Parameters: TInt aError: in: Symbian OS error: Error code
+    
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIEngineEvent::RunError( TInt aError )
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineEvent::RunError") ) );
+
+    switch( iState )
+        {
+        case EEventRequested:
+        case EEventWait:
+        case EEventWaitCompleted:
+        case EEventReleased:
+            {
+            // Create response
+            CStifTFwIfProt* resp = NULL; 
+            TRAPD( err, resp = CStifTFwIfProt::NewL(); );
+            if( err != KErrNone )
+                {
+                return KErrNone;
+                }
+
+            resp->CreateL();
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
+            resp->AppendId( iSlave );
+            resp->AppendId( iMaster );
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            resp->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest );
+            resp->Append( CStifTFwIfProt::EventStatus, 
+                         CStifTFwIfProt::EEventError );
+            resp->Append( iEvent.Name() );
+            resp->Append( CStifTFwIfProt::EventStatusParams, 
+                             CStifTFwIfProt::EEventResult,
+                             aError );
+            
+            // Send response
+            iUIEngine->RemoteMsg( NULL, resp->Message() ); 
+            delete resp;
+            }
+            break;
+        default:
+            __TRACE( KError, ( _L( "CUIEngineEvent::RunError: Illegal state %d"), iState ) );
+            return aError;
+        }
+    
+    return KErrNone;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    CActiveTimer: This object prints running seconds to console screen.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIEnginePrinter.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,290 @@
+/*
+* 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: CUIEnginePrinter handles prints from test cases.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stifinternal/UIEngineContainer.h>
+#include "UIEnginePrinter.h"
+#include "Logging.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iUIEngineContainer->iUIEngine->iLogger
+
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEnginePrinter
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+
+    Parameters: CUIEngineContainer* CUIEngineContainer: in: Pointer to CUIEngineContainer Interface
+                TTestInfo& aTestInfo: in: Test info
+
+    Return Values: CUIEnginePrinter* : Pointer to created runner object
+
+    Errors/Exceptions: Leaves if memory allocation for CUIEnginePrinter fails
+                       Leaves if ConstructL leaves
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CUIEnginePrinter* CUIEnginePrinter::NewL( 
+    CUIEngineContainer* aUIEngineContainer )
+    {
+    CUIEnginePrinter* self =
+        new ( ELeave ) CUIEnginePrinter( aUIEngineContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEnginePrinter
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEnginePrinter::ConstructL()
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEnginePrinter
+
+    Method: CUIEnginePrinter
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEnginePrinter::CUIEnginePrinter( 
+    CUIEngineContainer* aUIEngineContainer ) :
+        CActive( CActive::EPriorityStandard ),
+        iUIEngineContainer( aUIEngineContainer ),
+        iProgressPckg( iProgress ),
+        iRunning( EFalse )
+    {
+    __TRACE( KPrint, ( _L( "CUIEnginePrinter::CUIEnginePrinter") ) );
+    __ASSERT_ALWAYS( aUIEngineContainer, User::Panic( _L("Null pointer"), KErrGeneral ) );
+
+    CActiveScheduler::Add( this );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEnginePrinter
+
+    Method: ~CUIEnginePrinter
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEnginePrinter::~CUIEnginePrinter()
+    {
+    __TRACE( KPrint, ( _L( "CUIEnginePrinter::~CUIEnginePrinter") ) );
+
+    Cancel();
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEnginePrinter
+
+    Method: StartProgressL
+
+    Description: Starts testing
+
+    Parameters: RTestCase& aTestCase: in: Handle to test case
+                TTestProgressPckg& aProgressPckg: in: Handle to TTestProgressPckg
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEnginePrinter::StartL( RTestCase& aTestCase )
+    {
+    __TRACE( KPrint, ( _L( "CUIEnginePrinter::StartProgressL.") ) );
+
+    iTestCase = aTestCase;
+
+    if ( IsActive() )
+        User::Leave( KErrInUse );
+
+    iRunning = ETrue;
+
+    SetActive();
+    iTestCase.NotifyProgress( iProgressPckg, iStatus );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEnginePrinter
+
+    Method: RunL
+
+    Description: RunL handles completed requests
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
+                       RunError called by CActiveObject
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEnginePrinter::RunL()
+    {
+    
+    if( iStatus != KErrNone )
+        {
+        // KErrEof and other errors
+        iRunning = EFalse;
+        // Signal to container
+        iUIEngineContainer->PrintsDone();
+        return;
+        }
+        
+    iUIEngineContainer->PrintProgress( iProgress );
+    
+    // Start a new request
+    SetActive();
+    iTestCase.NotifyProgress( iProgressPckg, iStatus );    
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEnginePrinter
+
+    Method: DoCancel
+
+    Description: Cancel active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEnginePrinter::DoCancel()
+    {
+    __TRACE( KPrint, ( _L( "CUIEnginePrinter::DoCancel") ) );
+    
+    iRunning = EFalse;
+
+    iTestCase.CancelAsyncRequest( RTestCase::ENotifyProgress );
+    
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIEngineRemote.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,418 @@
+/*
+* 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: CUIEngineRemote: This object executes test cases 
+* from STIF Test Framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stifinternal/UIEngineContainer.h>
+#include "UIEngineRemote.h"
+#include "Logging.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iUIEngineContainer->iUIEngine->iLogger
+
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: CUIEngineRemote
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineRemote::CUIEngineRemote( CUIEngineContainer* aUIEngineContainer) :
+    CActive( CActive::EPriorityStandard ),
+    iUIEngineContainer( aUIEngineContainer ),
+    iRemoteTypePckg ( iRemoteType ),
+    iMsgLenPckg ( iMsgLen ),
+    iState( EIdle )
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRemote::CUIEngineRemote") ) );
+    __ASSERT_ALWAYS( aUIEngineContainer, User::Panic( _L("Null pointer"), KErrGeneral ) );
+
+    CActiveScheduler::Add( this );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRemote::ConstructL()
+    {
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+    
+    Parameters: CUIEngineContainer* CUIEngineContainer: in: Pointer to CUIEngineContainer Interface
+                TTestInfo& aTestInfo: in: Test info
+
+    Return Values: CUIEngineRemote* : Pointer to created runner object
+
+    Errors/Exceptions: Leaves if memory allocation for CUIEngineRemote fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineRemote* CUIEngineRemote::NewL( CUIEngineContainer* aUIEngineContainer )
+    {
+    
+    CUIEngineRemote* self =  
+        new ( ELeave ) CUIEngineRemote( aUIEngineContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: ~CUIEngineRemote
+
+    Description: Destructor
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineRemote::~CUIEngineRemote()
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRemote::~CUIEngineRemote()") ) );
+    Cancel();
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: StartTestL
+
+    Description: Starts testing
+
+    Parameters: RTestCase& aTestCase: in: Handle to test case
+                TFullTestResultPckg& aFullTestResultPckg: in: Handle to TFullTestResultPckg
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRemote::StartL( RTestCase& aTestCase )
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRemote::StartL") ) );
+
+    iTestCase = aTestCase;
+
+    if ( IsActive() )
+        User::Leave( KErrInUse );
+
+    Start();
+        
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: Start
+
+    Description: Start request
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRemote::Start()
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRemote::Start") ) );
+
+    iState = EPending;
+    SetActive();
+    iTestCase.NotifyRemoteType( iRemoteTypePckg, iMsgLenPckg, iStatus );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
+                       RunError called by CActiveObject
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRemote::RunL()
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRemote::RunL") ) );
+    
+    switch( iState )
+        {
+        case EPending:
+            iState = EIdle;
+            
+            switch( iRemoteType )
+                {
+                case EStifCmdSend: // Sending message
+                    {
+                    if( iMsgLen <= 0 ) 
+                        {
+                        User::Leave( KErrGeneral );
+                        }
+                    HBufC8* buf = HBufC8::NewLC( iMsgLen );
+                    TPtr8 tmp = buf->Des(); 
+                    if( iTestCase.NotifyRemoteMsg( tmp, iRemoteType ) == KErrNone )
+                        {
+                        HBufC* buf2 = HBufC::NewLC( iMsgLen );
+                        TPtr tmp2 = buf2->Des();
+                        tmp2.Copy( tmp );
+                        
+                        // Forward message
+                        iUIEngineContainer->RemoteSend( tmp2, iStatus.Int() );
+                        CleanupStack::PopAndDestroy( buf2 );
+                        }
+                    CleanupStack::PopAndDestroy( buf );
+                    }        
+                    break;
+                case EStifCmdStoreState: // Got indication that reboot will follow
+                    {
+                    // System will reboot, inform UI
+                    // Forward message
+                    SetActive();
+                    TInt ret = iUIEngineContainer->GoingToReboot( iStatus );
+                    if( ret != KErrNone )
+                        {
+                        User::Leave( ret );
+                        }
+                    iState = EUIMsgPending;
+                    return;
+                    }
+                // The rest should never come here
+                case EStifCmdReboot:
+                case EStifCmdReceive:
+                case EStifCmdGetStoredState:
+                default:
+                    {
+                    if( iStatus.Int() != KErrServerTerminated )
+                        {   
+                        RDebug::Print( _L("CUIEngineRemote::RunL() -- Leaved with [%d] "), iStatus.Int() );  
+                        User::Leave( KErrNotFound );  
+                        }
+                    break;
+                    }
+                }
+            break;
+        case EUIMsgPending:
+            {
+            TInt result = iStatus.Int();
+            if( result == KErrCancel )
+                {
+                result = KErrNone;
+                }
+            // Let the system to reboot..
+            TPckg<TInt> tmp(  result );
+            iTestCase.NotifyRemoteMsg( tmp, EStifCmdRebootProceed );
+            Start();
+            return;
+            }
+        default:
+            User::Leave( KErrGeneral );
+        }
+        
+    if( iStatus.Int() == KErrNone )
+        {   
+        Start();    
+        }
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: DoCancel
+
+    Description: Cancel active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRemote::DoCancel()
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRemote::DoCancel") ) );
+    iTestCase.CancelAsyncRequest( RTestCase::ENotifyRemoteType );
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRemote
+
+    Method: RunError
+
+    Description: None
+
+    Parameters: TInt aError: in: Symbian error code
+
+    Return Values: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/    
+TInt CUIEngineRemote::RunError(TInt aError)
+    {
+    return aError;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    CActiveTimer: This object prints running seconds to console screen.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIEngineRunner.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -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: CUIEngineRunner: This object executes test cases 
+* from STIF Test Framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stifinternal/UIEngineContainer.h>
+#include "UIEngineRunner.h"
+#include "Logging.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iUIEngineContainer->iUIEngine->iLogger
+
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRunner
+
+    Method: CUIEngineRunner
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineRunner::CUIEngineRunner( CUIEngineContainer* aUIEngineContainer) :
+    CActive( CActive::EPriorityStandard ),
+    iUIEngineContainer( aUIEngineContainer ),
+    iFullTestResultPckg( iFullTestResult )
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRunner::CUIEngineRunner") ) );
+    __ASSERT_ALWAYS( aUIEngineContainer, User::Panic( _L("Null pointer"), KErrGeneral ) );
+
+    CActiveScheduler::Add( this );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRunner
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRunner::ConstructL()
+    {
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRunner
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+    
+    Parameters: CUIEngineContainer* CUIEngineContainer: in: Pointer to CUIEngineContainer Interface
+                TTestInfo& aTestInfo: in: Test info
+
+    Return Values: CUIEngineRunner* : Pointer to created runner object
+
+    Errors/Exceptions: Leaves if memory allocation for CUIEngineRunner fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineRunner* CUIEngineRunner::NewL( CUIEngineContainer* aUIEngineContainer )
+    {
+    CUIEngineRunner* self =  
+        new ( ELeave ) CUIEngineRunner( aUIEngineContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRunner
+
+    Method: ~CUIEngineRunner
+
+    Description: Destructor
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIEngineRunner::~CUIEngineRunner()
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRunner::~CUIEngineRunner()") ) );
+    Cancel();
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRunner
+
+    Method: StartTestL
+
+    Description: Starts testing
+
+    Parameters: RTestCase& aTestCase: in: Handle to test case
+                TFullTestResultPckg& aFullTestResultPckg: in: Handle to TFullTestResultPckg
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRunner::StartL( RTestCase& aTestCase )
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRunner::StartTestL") ) );
+
+    iTestCase = aTestCase;
+
+    if ( IsActive() )
+        User::Leave( KErrInUse );
+
+    SetActive();
+    iTestCase.RunTestCase( iFullTestResultPckg, iStatus );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRunner
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
+                       RunError called by CActiveObject
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRunner::RunL()
+    {
+    __TRACE( KPrint, ( _L( "CUIEngineRunner::RunL") ) );
+
+    // Complete with the result of the test case
+    iUIEngineContainer->TestCaseExecuted( iFullTestResult, iStatus.Int() );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIEngineRunner
+
+    Method: DoCancel
+
+    Description: Cancel active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIEngineRunner::DoCancel()
+    {
+
+    __TRACE( KPrint, ( _L( "CUIEngineRunner::DoCancel") ) );
+    iTestCase.CancelAsyncRequest( RTestCase::ERunTestCase );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    CActiveTimer: This object prints running seconds to console screen.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIStore.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4867 @@
+/* 
+* 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: This module contains implementation of CUIStore 
+* and CModule class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <f32file.h>
+#include <e32uid.h>
+#include <collate.h>
+
+#include <StifLogger.h>
+
+#include "Logging.h"
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreContainer.h>
+#include "UIStorePopup.h"
+#include <stifinternal/UIEngineContainer.h>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+//@spe _LIT(KNameTxt,"TEST FRAMEWORK");
+//@spe _LIT(KNameBase,"BASE");
+_LIT( KUIStore, "CUiStore" );
+_LIT( KUIStoreIf, "CUiStoreIf" );
+//_LIT( KUIStoreDefaultDir, "C:\\TestFramework\\" );
+
+_LIT( KUIStoreSetStart, "[TestSetStart]" );
+_LIT( KUIStoreSetEnd, "[TestSetEnd]" );
+_LIT( KUIStoreSetName, "TestSetName=" );
+_LIT( KUIStoreSetCaseStart, "[TestSetCaseStart]" );
+_LIT( KUIStoreSetCaseEnd, "[TestSetCaseEnd]" );
+_LIT( KUIStoreCaseModuleName, "ModuleName=" );
+_LIT( KUIStoreTestCaseTitle, "Title=" );
+_LIT( KUIStoreTestCaseFile, "TestCaseFile="); 
+_LIT( KUIStoreTestCaseNum, "TestCaseNum=");
+_LIT( KUIStoreCaseExpectedResult, "ExpectedResult=");
+_LIT( KUIStoreCasePriority, "Priority="); 
+_LIT( KUIStoreCaseTimeout, "Timeout=");
+_LIT( KUIStoreLastStartedCaseIndex, "LastStartedCaseIndex=");
+
+
+_LIT( KUIStoreDefaultRebootFile, "TestFrameworkUIReboot.txt" );
+_LIT( KUIStoreStartTest, "[StartTestCase]" );
+_LIT( KUIStoreStartTestEnd, "[StartTestCaseEnd]" );
+
+_LIT( KUIStoreCaseStatus, "TestCaseStatus=");
+_LIT( KUIStoreCaseExecutionResult, "TestCaseExecutionResult=");
+_LIT( KUIStoreCaseResult, "TestCaseResult=");
+_LIT( KUIStoreCaseStartTime, "TestCaseStartTime=");
+_LIT( KUIStoreCaseEndTime, "TestCaseEndTime=");
+
+const TInt KRcpHeaderLen = 16;        
+const TInt KFixedStartedCaseIndex = 10;
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iLogger
+
+// LOCAL CONSTANTS AND MACROS
+static const TUid KUidTestModule = { 0x101FB3E7 };
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: NewL
+
+    Description: Construct the CUIStore class
+
+    Parameters: None
+
+    Return Values: CUIStore*                    New object
+
+    Errors/Exceptions: Leaves if memory allocation fails or
+                       ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIStore* CUIStore::NewL( CUIStoreIf* aUIStoreIf )
+    {
+    
+    CUIStore* self = new ( ELeave ) CUIStore( aUIStoreIf );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Construct the console
+    Construct module and case containers
+    Retrieve command line parameters
+    Connect to test engine
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if memory allocation fails or fileserver or
+                       test engine can't be connected.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::ConstructL( )
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: CUIStore
+
+    Description: Constructor.
+    Initialize non-zero member variables.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIStore::CUIStore( CUIStoreIf* aUIStoreIf ):
+    iUIStoreIf( aUIStoreIf ),
+    iUpdateNeeded( ETrue ),
+    iActivePopupPriority( EPopupPriorityLow )
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: ~CUIStore
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIStore::~CUIStore( )
+    {	
+
+    iFileList.ResetAndDestroy();
+    iFileList.Close(); 
+    iStartedTestSets.ResetAndDestroy();
+    iStartedTestSets.Close();  
+
+    iStartedTestCases.ResetAndDestroy();
+    iStartedTestCases.Close();
+    
+    iTestSets.ResetAndDestroy();
+    iTestSets.Close();  
+
+    iTestCases.ResetAndDestroy();
+    iTestCases.Close();
+    
+    iPopups.ResetAndDestroy();
+    iPopups.Close();
+        
+    delete iUIEngine;    
+    iUIEngine = 0;
+
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStifTFwIf
+
+    Method: Open
+
+    Description: Open test engine.
+
+    Parameters: TDesC& aTestFrameworkIni: in: Initialization file to Test Framework
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C  TInt CUIStore::Open( const TDesC& aTestFrameworkIni )
+    {
+    
+    if( aTestFrameworkIni.Length() > KMaxFileName )
+        {
+        return KErrArgument;
+        }
+    
+    TRAPD( err, 
+        iUIEngine = CUIEngine::NewL( this );
+        );
+    if( err != KErrNone )
+        {
+        return err;
+        }
+    
+    TFileName ini( aTestFrameworkIni );
+    // Check given ini file
+    TRAP( err, CheckIniL( ini ) );
+    
+    // Store folder of initialization file to open it again when looking for filters
+    RDebug::Print(_L("CUIStore stores name of ini file [%S]"), &ini);
+    iTestFrameworkIni.Copy(ini);
+    
+    return iUIEngine->Open( ini );
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: Close
+
+    Description: Close test engine.
+
+    Parameters: None
+
+    Return Values: TInt KErrNone: Always returned KErrNone
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::Close()
+    {
+    
+    TInt ret = KErrNone;
+    if( iUIEngine != NULL )
+        {
+        ret = iUIEngine->Close();
+    
+        delete iUIEngine;    
+        iUIEngine = 0;
+        }
+        
+    return ret;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: AddTestModule
+
+    Description: Add test module to module list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which is added to module list
+                TDesC& aIniFile: in: Initialization file to the test module
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::AddTestModule( const TDesC& aModuleName, 
+                                       const TDesC& aIniFile )
+    {
+
+    TInt ret = iUIEngine->AddTestModule( aModuleName, aIniFile );
+         
+    RefreshAllCases();
+    
+    return ret;
+         
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: RemoveTestModule
+
+    Description: Add test module to module list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which is removed of module list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::RemoveTestModule( const TDesC& aModuleName )
+    {
+
+    TInt ret = iUIEngine->RemoveTestModule( aModuleName );
+     
+    RefreshAllCases();
+    
+    return ret;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: AddTestCaseFile
+
+    Description: Add test case file to test case file list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which own test cases of test case list.
+                TDesC& aCaseFile: in: Test case list, which is added to test case list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::AddTestCaseFile( const TDesC& aModuleName, 
+                                         const TDesC& aCaseFile )
+    {
+
+    TInt ret = iUIEngine->AddTestCaseFile( aModuleName, aCaseFile );
+     
+    RefreshAllCases();
+    
+    return ret;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: RemoveTestCaseFile
+
+    Description: Remove test case file of test case file list of test engine
+
+    Parameters: TDesC& aModuleName: in: Testmodule, which own test cases of test case list
+                TDesC& aCaseFile: in: Test case list, which is removed of test case list
+
+    Return Values: Symbian OS error: Error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::RemoveTestCaseFile( const TDesC& aModuleName, 
+                                            const TDesC& aCaseFile )
+    {   
+    
+    TInt ret = iUIEngine->RemoveTestCaseFile( aModuleName, aCaseFile );
+         
+    RefreshAllCases();
+    
+    return ret;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: StartTestCase
+
+    Description: Start selected test case identified with CTestInfo.
+                anIndex contains index in StartedTestCase array, 
+                which is valid only during execution of calling 
+                function.
+
+    Parameters: const CTestInfo& aTestInfo: in: Test case info
+                TInt& anIndex: out: Index to StartedTestCaseArray returned 
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::StartTestCase( const CTestInfo& aTestInfo, 
+                                       TInt& anIndex )
+    {
+    
+    CUIEngineContainer* container = NULL;
+    TInt ret = iUIEngine->StartTestCase( container, aTestInfo );
+    
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    CStartedTestCase* testCase = NULL;
+    TRAP( ret,
+        testCase = CStartedTestCase::NewL( aTestInfo, *container );
+       );
+    if( ret != KErrNone )
+        {
+        iUIEngine->AbortStartedTestCase( container );
+        return ret;
+        }
+        
+    ret = iStartedTestCases.Append( testCase );
+    if( ret != KErrNone )
+        {
+        iUIEngine->AbortStartedTestCase( container );
+        delete testCase;
+        return ret;
+        }
+    
+    anIndex =  iStartedTestCases.Find( testCase );
+    
+    if( anIndex < 0 )
+        {
+        User::Panic( KUIStore, KErrNotFound );
+        }
+    
+    iUIStoreIf->Update( testCase, testCase->Status() ); 
+                
+    return KErrNone;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: TestCases
+
+    Description: Return array of existing test cases.
+
+    Parameters: RRefArray<CTestInfo>& aTestCases: out: Array of test cases
+                TDesC& aTestModule: in: Test module name (optional)
+                TDesC& aTestCaseFile: in: Test case file name (optional) 
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::TestCases( RRefArray<CTestInfo>& aTestCases, 
+                                   const TDesC& aTestModule,
+                                   const TDesC& aTestCaseFile ) 
+    {
+    
+    TInt ret = UpdateCases();
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    TInt count = iTestCases.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( ( aTestModule.Length() > 0 ) &&
+            ( iTestCases[i]->ModuleName() != aTestModule ) )
+            {
+            continue;
+            }
+        else if( ( aTestCaseFile.Length() > 0 ) &&
+                 ( iTestCases[i]->TestCaseFile() != aTestCaseFile ) )
+            {
+            continue;
+            }
+        aTestCases.Append( *iTestCases[i] );
+        }
+    
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: StartedTestCaseL
+
+    Description: Return started (running/runned) test case
+
+    Parameters: CStartedTestCase& aTestCase: out: Test case information
+                TInt anIndex: in: test case index in StartedTestCaseArray
+
+    Return Values: Reference to CStartedTestCase object
+
+    Errors/Exceptions: Leaves if anIndex out of range
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C CStartedTestCase& CUIStore::StartedTestCaseL( TInt anIndex )
+    {
+    
+    TInt count = iStartedTestCases.Count();
+    if( ( anIndex >= count ) ||
+        ( anIndex < 0 ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    return *iStartedTestCases[anIndex];
+         
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: StartedTestCases
+
+    Description: Return started (running/runned) test cases
+
+    Parameters: RRefArray<CStartedTestCase>& aTestCases: out: array of test cases
+                TExecutionStatus aStatus: in: test case status (optional)
+                TDesC& aTestModule: in: test module name (optional)
+                TDesC& aTestCaseFile: in: test case file name (optional)
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/            
+EXPORT_C TInt CUIStore::StartedTestCases( RRefArray<CStartedTestCase>& aTestCases,
+                                          TInt aStatus,
+                                          const TDesC& aTestModule,
+                                          const TDesC& aTestCaseFile )
+    {
+    
+    TInt count = iStartedTestCases.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( ( aTestModule.Length() > 0 ) &&
+            ( iStartedTestCases[i]->TestInfo().ModuleName() != aTestModule ) )
+            {
+            continue;
+            }
+        else if( ( aTestCaseFile.Length() > 0 ) &&
+                 ( iStartedTestCases[i]->TestInfo().TestCaseFile() != aTestCaseFile ) )
+            {
+            continue;
+            }
+        else if( ( aStatus != CUIStoreIf::EStatusAll) &&
+                 !( iStartedTestCases[i]->Status() & aStatus ) )
+            {
+            continue;
+            }
+        if( aTestCases.Append( *iStartedTestCases[i] ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    
+    
+    return KErrNone;
+    
+    }
+            
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: Modules
+
+    Description: Return modules array
+
+    Parameters: RRefArray<CModule>& aTestModules: out: modules array
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/     
+EXPORT_C TInt CUIStore::Modules( RRefArray<TDesC>& aTestModules )
+    {
+
+    TInt ret = UpdateCases();
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+
+    // Go through test cases and search if there are new modules 
+    // and add them to aTestModules array 
+    TInt caseCount = iTestCases.Count();
+    TInt moduleCount = 0;
+    TInt caseIndex = 0;
+    TInt moduleIndex = 0;
+    for ( caseIndex = 0; caseIndex < caseCount; caseIndex++ )
+        {
+        // First check modules
+        moduleCount = aTestModules.Count();
+        for ( moduleIndex = 0; moduleIndex < moduleCount; moduleIndex++ )
+            {
+            if( iTestCases[caseIndex]->ModuleName() == 
+                aTestModules[moduleIndex] )
+                {
+                break;
+                }
+            }
+        if ( moduleIndex == moduleCount )
+            {
+            // New module found
+            if( aTestModules.Append( iTestCases[caseIndex]->ModuleName() ) !=
+                KErrNone )
+                {
+                return KErrNoMemory;
+                } 
+            }
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: TestCaseFiles
+
+    Description: Return test case files
+
+    Parameters: RRefArray<TDesC>& aTestCaseFiles: out: Array of test case files
+                TDesC& aTestModule: in: test module name (optional)
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/     
+EXPORT_C TInt CUIStore::TestCaseFiles( RRefArray<TDesC>& aTestCaseFiles,
+                                       const TDesC& aTestModule  )
+    {
+    
+    TInt ret = UpdateCases();
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+
+    // Go through test cases and search if there are new test case files 
+    // for specified test module and add them to aTestCaseFiles array 
+    TInt caseCount = iTestCases.Count();
+    TInt fileCount = 0;
+    TInt caseIndex = 0;
+    TInt fileIndex = 0;
+    for ( caseIndex = 0; caseIndex < caseCount; caseIndex++ )
+        {
+        if( ( aTestModule.Length() > 0 ) &&
+            ( aTestModule != iTestCases[caseIndex]->ModuleName() ) )
+            {
+            // Test case file is not for specified module
+            continue;
+            }
+            
+        // First check modules
+        fileCount = aTestCaseFiles.Count();
+        for ( fileIndex = 0; fileIndex < fileCount; fileIndex++ )
+            {
+            if( iTestCases[caseIndex]->TestCaseFile() == 
+                aTestCaseFiles[fileIndex] )
+                {
+                break;
+                }
+            }
+        if ( fileIndex == fileCount )
+            {
+            // New test case file found
+            if( aTestCaseFiles.Append( iTestCases[caseIndex]->TestCaseFile() ) !=
+                KErrNone )
+                {
+                return KErrNoMemory;
+                } 
+            }
+        }
+
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: LoadAllModules
+
+    Description: Loads all TestFramework test modules from \system\libs\ directories 
+                of all drives. In Secure Platform from \sys\bin directories.
+
+    Parameters: None
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CUIStore::LoadAllModules()
+    {
+    
+    RPointerArray<TDesC> testModules;
+    
+    TInt ret = ListAllModules( testModules );
+    if( ret == KErrNone )
+        {
+        for (TInt i= 0; i < testModules.Count(); i++)
+            {
+            iLogger->Log( _L("Add test module: %S"), testModules[i] );
+            ret = iUIEngine->AddTestModule( *testModules[i], KNullDesC );
+            if( ret != KErrNone )
+                {
+                iLogger->Log( _L("Add test module %S failed %d"), 
+                    testModules[i], ret );
+                break;
+                }
+            }
+        }
+    RefreshAllCases();
+    
+    testModules.ResetAndDestroy();
+    testModules.Close();
+    
+    return ret;
+
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: ListAllModules
+
+    Description: Lists all TestFramework test modules from \system\libs\ directories 
+                of all drives. In Secure Platform from \sys\bin directories.
+
+    Parameters: None
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CUIStore::ListAllModules( RPointerArray<TDesC>& aModuleNames )
+    {
+    
+    TRAPD( err, ListAllModulesL( aModuleNames ); );
+    return err;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: ListAllModulesL
+
+    Description: Lists all TestFramework test modules from \system\libs\ directories 
+                of all drives. In Secure Platform from \sys\bin directories.
+
+    Parameters: None
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+void CUIStore::ListAllModulesL( RPointerArray<TDesC>& aModuleNames )
+    {
+
+    TFileName libDirectory;
+    RFs fsSession;
+    TFileName fullName;
+
+    // Connect to file server
+	User::LeaveIfError( fsSession.Connect() ); // Start session
+	CleanupClosePushL( fsSession );
+
+    TDriveList drivelist; 
+	User::LeaveIfError( fsSession.DriveList(drivelist) );
+	// A TDriveList (the list of available drives), is an array of 
+	// 26 bytes. Each byte with a non zero value signifies that the 
+	// corresponding drive is available.
+
+    // 0x10000079, 0x1000008d, 0x101FB3E7
+    TUidType anEntryUid( KDynamicLibraryUid, 
+                         KSharedLibraryUid, 
+                         KUidTestModule ); 
+    TInt driveNumber; 
+	TChar driveLetter;
+
+    CDir* testModules = NULL;
+    
+	for( driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++ )
+		{
+		if( !drivelist[driveNumber] ) 
+			{
+			// If drive-list entry is zero, drive is not available
+			continue;
+			}
+        User::LeaveIfError(fsSession.DriveToChar(driveNumber,driveLetter));
+
+        libDirectory.Zero();
+        libDirectory.Append( driveLetter );
+        libDirectory.Append( _L(":\\sys\\bin\\*") );
+        
+        iLogger->Log( _L("Searching modules from %S"), &libDirectory );
+
+        fsSession.GetDir( libDirectory, anEntryUid, ESortNone, testModules );
+
+        if( !testModules )
+            {
+            // Continue if no test modules found
+            continue;
+            }
+        TInt count = testModules->Count();
+        for (TInt i= 0; i < count; i++)
+            {           
+            fullName = (*testModules)[i].iName;
+            
+            fullName.LowerCase();
+            // Remove optional '.DLL' from file name
+            TParse parse;
+            parse.Set( fullName, NULL, NULL );
+    
+            if ( parse.Ext() == _L(".dll") )
+                {
+                const TInt len = parse.Ext().Length();
+                fullName.Delete( fullName.Length()-len, len );
+                }
+                        
+            // Exclude internal test modules (testcombiner, testscripter, suevent)
+            _LIT(KTestCombiner, "testcombiner");
+            _LIT(KTestScripter, "testscripter");
+            _LIT(KSUEvent, "suevent");
+            _LIT(KTEFTestModule, "TEFTestModule");
+            _LIT(KTEFTestModuleLite, "TEFTestModuleLite");
+            if(fullName != KTestCombiner && fullName != KSUEvent && fullName != KTestScripter&& fullName != KTEFTestModule && fullName != KTEFTestModuleLite)
+                { 
+                HBufC* name = fullName.AllocLC();
+                iLogger->Log( _L("Found: %S"), name );
+                User::LeaveIfError( aModuleNames.Append( name ) );
+                CleanupStack::Pop( name );
+                }
+            }
+        delete testModules;
+        testModules = NULL;
+		}
+    
+    CleanupStack::PopAndDestroy(); // fsSession 
+    
+    } 
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: CreateTestSet
+
+    Description: Create new test set.
+
+    Parameters: TDesC& aSetName: in: test set name (Max length is KMaxName)
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CUIStore::CreateTestSet( const TDesC& aSetName )
+    {
+    
+    TPtrC setName;
+    TFileName tmp;
+    TInt ret = ParseTestSetName( aSetName, setName, tmp );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+        
+    CTestSetInfo* setInfo = NULL;
+    if( FindSetByName( setName, setInfo ) == KErrNone )
+        {
+        return KErrAlreadyExists;
+        }
+    TRAPD( err, 
+        setInfo = CTestSetInfo::NewL( setName );
+        );
+    if( err != KErrNone )
+        {
+        return err;
+        }
+    if( iTestSets.Append( setInfo ) != KErrNone )
+        {
+        delete setInfo;
+        return KErrNoMemory;
+        }
+            
+    return KErrNone;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: RemoveTestSet
+
+    Description: Remove active test set.
+
+    Parameters: TDesC& aSetName: in: test set name (Max length is KMaxName)
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CUIStore::RemoveTestSet( const TDesC& aSetName )
+    {
+    
+    TPtrC setName;
+    TFileName tmp;
+    TInt ret = ParseTestSetName( aSetName, setName, tmp );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    TInt count = iTestSets.Count();
+    TInt index = 0;
+    for( ; index < count; index++ )
+        {
+        if( iTestSets[index]->Name() == setName )
+            {
+            break;
+            }
+        }
+    if( index == count ) 
+        { 
+        return KErrNotFound;
+        }
+
+    CTestSetInfo* setInfo = iTestSets[index];
+    iTestSets.Remove( index );
+    
+    // If started test set keeps info about currently removed test set
+    // then remove also this info
+    CStartedTestSet *stset;
+    for(index = 0; index < iStartedTestSets.Count(); index++)
+        {
+        stset = iStartedTestSets[index];
+        if(stset->GetOriginalTestSet() == setInfo)
+            {
+            stset->NullOriginalTestSet();
+            }
+        }
+    
+    delete setInfo;
+
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: TestSets
+
+    Description: Query test sets.
+
+    Parameters:RRefArray<CTestSetInfo>& aSetInfos: out: list of test sets
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CUIStore::TestSets( RRefArray<CTestSetInfo>& aSetInfos )
+    {
+    
+    TInt count = iTestSets.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aSetInfos.Append( *iTestSets[i] ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }
+    return KErrNone;
+    
+    }       
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: TestSets
+
+    Description: Query test sets.
+
+    Parameters:RRefArray<CTestSetInfo>& aSetInfos: out: list of test sets
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C const CTestSetInfo& CUIStore::TestSetL( const TDesC& aSetName  )
+    {
+    
+    TPtrC setName;
+    TFileName tmp;
+    User::LeaveIfError( ParseTestSetName( aSetName, setName, tmp ) );
+        
+    CTestSetInfo* setInfo = NULL;
+    User::LeaveIfError( FindSetByName( setName, setInfo ) );
+    return *setInfo;
+    
+    }                
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: AddToTestSet
+
+    Description: Add test case to test set.
+
+    Parameters: TDesC& aSetName: out: test set name
+                CTestInfo& aTestInfo: in: test case to add
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CUIStore::AddToTestSet( const TDesC& aSetName, 
+                                      const CTestInfo& aTestInfo )
+    {
+    
+    TPtrC setName;
+    TFileName tmp;
+    TInt ret = ParseTestSetName( aSetName, setName, tmp );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+        
+    CTestSetInfo* setInfo = NULL;
+    ret = FindSetByName( setName, setInfo );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    return setInfo->AddTestCase( aTestInfo );
+        
+    }       
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: InsertToTestSet
+
+    Description: Insert test case to test set.
+
+    Parameters: TDesC& aSetName: out: test set name
+                CTestInfo& aTestInfo: in: test case to add
+                TInt aPos: in: position to add
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+EXPORT_C TInt CUIStore::InsertToTestSet( const TDesC& aSetName, 
+                                         const CTestInfo& aTestInfo,
+                                         TInt aPos  )
+    {
+    
+    TPtrC setName;
+    TFileName tmp;
+    TInt ret = ParseTestSetName( aSetName, setName, tmp );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+        
+    CTestSetInfo* setInfo = NULL;
+    ret = FindSetByName( setName, setInfo );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    return setInfo->InsertTestCase( aTestInfo, aPos );
+        
+    }       
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: RemoveFromTestSet
+
+    Description: Remove test case from test set.
+
+    Parameters: TDesC& aSetName: out: test set name
+                CTestInfo& aTestInfo: in: test case to remove
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::RemoveFromTestSet( const TDesC& aSetName, 
+                                           const CTestInfo& aTestInfo )
+    {
+    
+    TPtrC setName;
+    TFileName tmp;
+    TInt ret = ParseTestSetName( aSetName, setName, tmp );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+        
+    CTestSetInfo* setInfo = NULL;
+    ret = FindSetByName( setName, setInfo );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    
+    return setInfo->RemoveTestCase( aTestInfo );
+    
+    }       
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: SaveTestSet
+
+    Description: Save test set. Deprecated, SaveTestSet2 to be used instead 
+
+    Parameters: TDesC&:  out: test set name
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::SaveTestSet( const TDesC& /* aSetName */ )
+    {  
+        
+    return KErrNotSupported;
+    
+    }  
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: SaveTestSet2
+
+    Description: Save test set.
+
+    Parameters: TDes& aSetName: out: test set name
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::SaveTestSet2( TDes& aSetName )
+    {
+    
+    TPtrC setName;
+    TFileName tmp;
+
+    TTime current;
+    TDateTime date_rep;
+    current.HomeTime();
+    date_rep = current.DateTime();
+    TBuf<32> currSetName;
+    _LIT(f_ext,".set");
+    
+    //create "test set name" string
+     currSetName.AppendNum(date_rep.Year());
+     currSetName.Append('_');
+     currSetName.AppendNum(date_rep.Month()+1); // Incrimination necessary, because Day and Month fields of TDateTime class are 0 based
+     currSetName.Append('_');
+     currSetName.AppendNum(date_rep.Day()+1);
+     currSetName.Append('_');
+     currSetName.AppendNum(date_rep.Hour());
+     currSetName.Append('_');
+     currSetName.AppendNum(date_rep.Minute());
+     currSetName.Append('_');
+     currSetName.AppendNum(date_rep.Second());
+     currSetName.Append(f_ext);
+
+    TInt ret = ParseTestSetName( aSetName, setName, tmp );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+        
+    CTestSetInfo* setInfo = NULL;
+    ret = FindSetByName( setName, setInfo );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+     
+    TRAPD( err,
+        SaveTestSetL( *setInfo, currSetName );
+        );
+    
+    aSetName.Copy(currSetName);
+    
+    return err;
+    
+    }  
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: LoadTestSet
+
+    Description: Load test set.
+
+    Parameters: TDesC& aSetName: out: test set name
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::LoadTestSet( const TDesC& aSetName )
+    {
+    
+    TPtrC setName;
+    TFileName tmp;
+    TInt ret = ParseTestSetName( aSetName, setName, tmp );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+        
+    TRAPD( err,
+        LoadTestSetL( setName, aSetName );
+        );
+    
+     if( err != KErrNone && err != KErrAlreadyExists )
+        {
+        RemoveTestSet( setName );
+        }
+            
+    return err;
+    
+    }       
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: UpdateTestSet
+
+    Description: Updates (on storage) earlier saved test set.
+
+    Parameters: CTestSetInfo& aSetInfo: in: test set
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::UpdateTestSet(CTestSetInfo& aSetInfo)
+    {
+    TRAPD(err,
+          UpdateTestSetL(aSetInfo, aSetInfo.Name());
+         );
+         
+    return err;
+    }  
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: StartTestSet
+
+    Description: Start selected test set identified with CTestSetInfo.
+
+    Parameters: const CTestSetInfo& aTestSetInfo: in: Started test set
+                TInt& anIndex: out index in StartedTestSet array, 
+                    which is valid only during execution of calling 
+                    function.
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TInt CUIStore::StartTestSet( const CTestSetInfo& aTestSetInfo,
+                                      TInt& anIndex,
+                                      CStartedTestSet::TSetType aType )
+    {
+    return StartTestSet(aTestSetInfo, anIndex, aType, EFalse);    
+    }       
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: StartTestSet
+
+    Description: Start selected test set identified with CTestSetInfo.
+
+    Parameters: const CTestSetInfo& aTestSetInfo: in: Started test set
+                TInt& anIndex: out index in StartedTestSet array, 
+                    which is valid only during execution of calling 
+                    function.
+                TSetType aType: sequential or paraller
+                TBool aNotExecutedCasesMode: only test case which haven't been
+                    executed yet
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/      
+EXPORT_C TInt CUIStore::StartTestSet( const CTestSetInfo& aTestSetInfo,
+                                      TInt& anIndex,
+                                      CStartedTestSet::TSetType aType,
+                                      TBool aNotStartedCasesMode )
+    {
+    
+    TInt ret = KErrNone;
+    
+    CStartedTestSet* set = NULL;
+    TRAPD( err, 
+        set = CStartedTestSet::NewL( this, aTestSetInfo, aType );
+        );
+    if( err != KErrNone )
+        {
+        return err;
+        }
+
+    if( iStartedTestSets.Append( set ) != KErrNone )
+        {
+        delete set;
+        return KErrNoMemory;
+        } 
+
+    // Set mode in which only still not executed test cases will be run.
+    // It applies only to sequential execution.
+    set->SetNotStartedCasesMode(aNotStartedCasesMode);
+    
+    ret = set->StartNext();
+        
+    anIndex = iStartedTestSets.Find( set );
+    if( anIndex < 0 )
+        {
+        User::Panic( KUIStore, KErrNotFound );
+        }
+    // Check that testset starting was successful
+    if( ret != KErrNone )
+        {
+        iStartedTestSets.Remove( anIndex );
+        anIndex = KErrNotFound; // safety
+        delete set;
+        return ret;
+        }
+    
+    return KErrNone;
+    
+    }       
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: AbortTestSet
+
+    Description: Abort running test set.
+
+    Parameters: None
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::AbortTestSet( CStartedTestSet& aSetInfo )
+    {
+        
+    return aSetInfo.Abort();
+    
+    } 
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: StartedTestSetL
+
+    Description: Return started (running/runned) test set.
+
+    Parameters: TInt anIndex: out index in StartedTestSet array 
+                        
+    Return Values: CStartedTestSet&: reference to test set
+
+    Errors/Exceptions: Leaves on error.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/  
+EXPORT_C CStartedTestSet& CUIStore::StartedTestSetL( TInt anIndex)
+    {
+    
+    if( anIndex < 0 ||
+        anIndex >= iStartedTestSets.Count() )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    return *iStartedTestSets[ anIndex ];
+    
+    }       
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: StartedTestSets
+
+    Description: Return started (running/runned) test cases
+
+    Parameters: RRefArray<CStartedTestSet>& aTestCases: out: list of test sets
+                TInt aStatus: in: status of queried sets
+                        
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::StartedTestSets( RRefArray<CStartedTestSet>& aTestSets,
+                                         TInt aStatus )
+    {    
+    
+    TInt count = iStartedTestSets.Count();
+    
+    for( TInt i = 0; i < count; i++ )
+        {
+        if( ( aStatus != CUIStoreIf::ESetAll) &&
+            !( iStartedTestSets[i]->Status() & aStatus ) )
+            {
+            continue;
+            }
+        if( aTestSets.Append( *iStartedTestSets[i] ) != KErrNone )
+            {
+            return KErrNoMemory;
+            }
+        }        
+        
+    return KErrNone;
+    
+    }           
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: LoadSavedTestCases
+
+    Description: Load saved testcases.
+
+    Parameters: None
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::LoadSavedTestCases()
+    {
+    
+    TRAPD( err,
+        LoadExecutedTestCasesL();
+        );
+    
+    return err;
+    
+    }       
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: GetTestSetsList
+
+    Description: Returns menu item text.
+
+    Parameters: const TInt                :in:      Menu index
+
+    Return Values: const TDesC&                     Menu line text
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt CUIStore::GetTestSetsList( RRefArray<TDesC>& aArray )
+    {
+    RFs fileReader;
+    CDir* dirContents = NULL;
+    _LIT(KSetPattern,".set");
+    TInt entNum = 0;
+    TInt ret = 0;
+    HBufC* fName = NULL;
+
+    
+    ret = fileReader.Connect();
+
+    if (ret != KErrNone)
+    	return ret;
+    
+    
+    ret = fileReader.GetDir(KUIStoreDefaultDir,
+    						KEntryAttNormal | KEntryAttHidden | KEntryAttSystem,
+    						ESortByName | EDirsFirst | EAscending,
+    						dirContents);
+    fileReader.Close();	
+    if (ret != KErrNone)
+    	{    		
+	    delete dirContents;
+	    return ret;
+	    }
+    entNum = dirContents->Count();
+    for (int i = 0;i<entNum;i++)
+    	{
+    	if ((!dirContents->operator[](i).IsDir())&&
+    		 dirContents->operator[](i).iName.Find(KSetPattern)!=KErrNotFound)
+    			{
+    			  TRAPD( err, fName = HBufC::NewL(64) );		       			             
+    			  if( err != KErrNone )
+    			    {
+    			      delete dirContents;
+    			      return err;
+    			    }    		 	
+    		    *fName =  dirContents->operator[](i).iName;
+    		 	ret = iFileList.Append(fName);
+    		 	if (ret != KErrNone)
+    		 		{
+    					delete fName;
+    					delete dirContents;
+    					return ret;	
+    		 		}
+    		 	ret = aArray.Append(*fName);
+			 	if (ret != KErrNone)
+    		 		{
+    					delete fName;
+    					delete dirContents;
+    					return ret;	
+    		 		}
+
+    			}    
+    	}
+    delete dirContents;
+    return KErrNone; 
+
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: FindSetByName
+
+    Description: Finds test set by name.
+
+    Parameters: const TDesC& aSetName: in: set name 
+                CTestSetInfo*& aSetInfo: out: pointer to test set
+                        
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::FindSetByName( const TDesC& aSetName, 
+                              CTestSetInfo*& aSetInfo )
+    {
+    
+    TInt count = iTestSets.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( iTestSets[i]->Name() == aSetName )
+            {
+            aSetInfo = iTestSets[i];
+            return KErrNone;
+            }
+        }
+    
+    return KErrNotFound;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: FindSetByCase
+
+    Description: Finds test set by name.
+
+    Parameters:  const CStartedTestCase* aTestCase: in: running test case 
+                 CStartedTestSet*& aSet: out: set running test case
+                        
+    Return Values: KErrNotFound: test case is not runned by any test set
+                   KErrNone: test case was runned by aSet
+                   
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::FindStartedSetByCase( const CStartedTestCase* aTestCase, 
+                                     CStartedTestSet*& aSet  )
+    {
+    
+    TInt count = iStartedTestSets.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( iStartedTestSets[i]->IsRunning( aTestCase ) )
+            {
+            aSet = iStartedTestSets[i];
+            return KErrNone;
+            }
+        }
+    
+    return KErrNotFound;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: LoadTestSetL
+
+    Description: Load test set.
+
+    Parameters: TDesC& aSetName: out: test set name
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::LoadTestSetL( const TDesC& aSetName, const TDesC& aSetFileName )
+    {
+    
+    TPtrC tmp;
+    TInt num;
+    TInt high;
+    TInt64 interval;
+    
+    CStifParser* parser = NULL;
+    
+    TRAPD( err,
+        parser = CStifParser::NewL( _L(""), aSetFileName );
+        );
+    if( err != KErrNone )
+        {
+        parser = CStifParser::NewL( KUIStoreDefaultDir, aSetName );
+        }
+        
+    CleanupStack::PushL( parser );
+    
+    CStifSectionParser* section = 
+        parser->SectionL( KUIStoreSetStart, KUIStoreSetEnd );
+    CleanupStack::PushL( section );
+    
+    CStifItemParser* item = section->GetItemLineL( KUIStoreSetName );
+    CleanupStack::PushL( item );
+    
+    User::LeaveIfError( item->GetString( KUIStoreSetName, tmp ) );
+    
+	// get the standard method
+	TCollationMethod method = *Mem::CollationMethodByIndex(0);
+	// ignore case
+    method.iFlags |= TCollationMethod::EFoldCase;
+    
+	TInt compare = aSetName.CompareC( tmp, 3, &method );
+	if( compare != KErrNone )
+        {
+        User::LeaveIfError( KErrNotFound );
+        }
+        
+    CleanupStack::PopAndDestroy( item );
+        
+    // Get started test case (if possible)
+    TUint lastStartedCaseIndex = 0;
+    item = section->GetItemLineL(KUIStoreLastStartedCaseIndex);
+    if(item)
+        {
+        CleanupStack::PushL(item);
+        TInt r = item->GetInt(KUIStoreLastStartedCaseIndex, lastStartedCaseIndex);
+        CleanupStack::PopAndDestroy(item);
+        if(r != KErrNone)
+            {
+            __TRACE(KInit, (_L("Could not read [%S] from test set file. Result [%d]."), &KUIStoreLastStartedCaseIndex, r));
+            }
+        }
+    else
+        {
+        __TRACE(KInit, (_L("Could not find [%S] from test set file."), &KUIStoreLastStartedCaseIndex));
+        }
+
+    User::LeaveIfError( CreateTestSet( aSetName ) );
+    
+    CTestSetInfo* setInfo = NULL;
+    User::LeaveIfError( FindSetByName( aSetName, setInfo ) );
+    
+    // Update started case
+    setInfo->SetLastStartedCaseIndex(lastStartedCaseIndex);
+    
+    CTestInfo* testInfo = CTestInfo::NewL();
+    CleanupStack::PushL( testInfo );    
+
+    CStifSectionParser* subSection = 
+        section->SubSectionL( KUIStoreSetCaseStart, KUIStoreSetCaseEnd );
+    
+    while( subSection )
+        {
+        CleanupStack::PushL( subSection );    
+        
+        // Get module name
+        // Mandatory, leave if not found
+        User::LeaveIfError( 
+            subSection->GetLine( KUIStoreCaseModuleName, tmp, ENoTag ) );
+        testInfo->SetModuleName( tmp );
+    
+        // Get test case title
+        // Mandatory, leave if not found
+        User::LeaveIfError( 
+            subSection->GetLine( KUIStoreTestCaseTitle, tmp, ENoTag ) );
+        testInfo->SetTestCaseTitle( tmp );
+        
+        // Get test case file
+        num = subSection->GetLine( KUIStoreTestCaseFile, tmp, ENoTag );
+        if( ( num == KErrNone ) &&
+            ( tmp.Length() > 0 ) )
+            {
+            // Optional
+            testInfo->SetTestCaseFile( tmp );
+            }
+        
+        // Get test case number
+        item = subSection->GetItemLineL( KUIStoreTestCaseNum );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreTestCaseNum, num ));
+        testInfo->SetTestCaseNumber( num );
+        CleanupStack::PopAndDestroy( item );    
+        
+        // Get test case priority
+        item = subSection->GetItemLineL( KUIStoreCasePriority );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreCasePriority, num ));
+        testInfo->SetPriority( num );
+        CleanupStack::PopAndDestroy( item ); 
+        
+        // Get test case timeout
+        item = subSection->GetItemLineL( KUIStoreCaseTimeout );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreCaseTimeout, num ));
+        User::LeaveIfError( item->GetNextInt( high ));
+        //@js<--remove--> interval.Set( high, num );
+        interval = MAKE_TINT64( high, num );
+        TTimeIntervalMicroSeconds timeout( interval );
+        testInfo->SetTimeout( timeout );
+        CleanupStack::PopAndDestroy( item ); 
+        
+        User::LeaveIfError( setInfo->AddTestCase( *testInfo ) );
+        
+        CleanupStack::PopAndDestroy( subSection );    
+        subSection = 
+            section->NextSubSectionL( KUIStoreSetCaseStart, KUIStoreSetCaseEnd );
+        } 
+        
+    CleanupStack::PopAndDestroy( testInfo );    
+    CleanupStack::PopAndDestroy( section );
+    CleanupStack::PopAndDestroy( parser );
+    
+    const RRefArray<const CTestInfo>& testCases = setInfo->TestCases();
+    LoadTestModulesAndTestCaseFilesL( testCases );
+     
+    }     
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: SaveTestSetL
+
+    Description: Save test set.
+
+    Parameters: CTestSetInfo& aSetInfo: in: test set
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::SaveTestSetL( CTestSetInfo& aSetInfo, const TDesC& aSetFileName )
+    {
+    //Extract path
+    TParse p;
+    p.Set(aSetFileName, NULL, NULL);
+    TPtrC path =  p.DriveAndPath(); // gives path for test set
+    TPtrC fn = p.NameAndExt(); // gives filename with extension
+    if(path.Length() == 0)
+        {
+        path.Set(KUIStoreDefaultDir);
+        }
+
+    //Create file server
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs);
+
+    //Create or open file
+    RFile file;
+    TFileName filename = path;
+    filename.Append(fn);
+    
+    TInt r = file.Replace(fs, filename, EFileWrite);
+    if(r != KErrNone)
+        {
+        User::Leave(r);
+        }
+    else
+        {
+        CleanupClosePushL(file);
+        
+        RBuf buffer;
+        buffer.Create(256);
+        CleanupClosePushL(buffer);
+        
+        // Saving
+        buffer.Format(_L("%S"), &KUIStoreSetStart);
+        WriteLineL(file, buffer);
+        buffer.Format(_L("%S %S"), &KUIStoreSetName,&aSetFileName);
+        WriteLineL(file, buffer);
+
+        // Saving test set causes reset of index
+        aSetInfo.SetLastStartedCaseIndex(0);
+        buffer.Format(_L("%S "), &KUIStoreLastStartedCaseIndex);
+        buffer.AppendNumFixedWidth(aSetInfo.GetLastStartedCaseIndex(), EDecimal, KFixedStartedCaseIndex);
+        WriteLineL(file, buffer);
+
+        // Saving test cases
+        TInt count = aSetInfo.TestCases().Count();
+        for(TInt i = 0; i < count; i++)
+            {
+            WriteLineL(file, KNullDesC);
+            buffer.Format(_L("%S"), &KUIStoreSetCaseStart);
+            WriteLineL(file, buffer);
+            
+            buffer.Format(_L("%S %S"), &KUIStoreCaseModuleName, &aSetInfo.TestCases()[i].ModuleName());
+            WriteLineL(file, buffer);
+            buffer.Format(_L("%S %S"), &KUIStoreTestCaseTitle, &aSetInfo.TestCases()[i].TestCaseTitle());
+            WriteLineL(file, buffer);
+            if(aSetInfo.TestCases()[i].TestCaseFile().Length() > 0)
+                {
+                buffer.Format(_L("%S %S"), &KUIStoreTestCaseFile, &aSetInfo.TestCases()[i].TestCaseFile());
+            WriteLineL(file, buffer);
+                }
+            buffer.Format(_L("%S %d"), &KUIStoreTestCaseNum, aSetInfo.TestCases()[i].TestCaseNum());
+            WriteLineL(file, buffer);
+            buffer.Format(_L("%S %d"), &KUIStoreCasePriority, aSetInfo.TestCases()[i].Priority());
+            WriteLineL(file, buffer);
+            buffer.Format(_L("%S %d %d"), &KUIStoreCaseTimeout, I64LOW(aSetInfo.TestCases()[i].Timeout().Int64()), 
+                                                                I64HIGH(aSetInfo.TestCases()[i].Timeout().Int64()));
+            WriteLineL(file, buffer);
+            buffer.Format(_L("%S %d"), &KUIStoreCaseExpectedResult, aSetInfo.TestCases()[i].ExpectedResult());
+            WriteLineL(file, buffer);
+            buffer.Format(_L("%S"), &KUIStoreSetCaseEnd);    
+            WriteLineL(file, buffer);
+            }
+
+        WriteLineL(file, KNullDesC);
+        buffer.Format(_L("%S"), &KUIStoreSetEnd);
+        WriteLineL(file, buffer);
+
+        CleanupStack::PopAndDestroy(&buffer);
+        CleanupStack::PopAndDestroy(&file);
+        }
+    CleanupStack::PopAndDestroy(&fs);        
+    }           
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: UpdateTestSetL
+
+    Description: Updates information in test set file.
+
+    Parameters: CTestSetInfo& aSetInfo: in: test set
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: Leaves when writing to file fails
+                       Leaves when file.seek fails
+                       Leaves when can't connect to file server
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::UpdateTestSetL(CTestSetInfo& aSetInfo, const TDesC& aSetFileName)
+    {
+    // Get path
+    TParse p;
+    p.Set(aSetFileName, NULL, NULL);
+    TPtrC path = p.DriveAndPath(); // gives path for test set
+    TPtrC fn = p.NameAndExt(); // gives filename with extension
+    if(path.Length() == 0)
+        {
+        path.Set(KUIStoreDefaultDir);
+        }
+
+    //Create file server
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs);
+
+    //Create or open file
+    RFile file;
+    TFileName filename = path;
+    filename.Append(fn);
+    TInt foundpos = KErrNotFound;
+    
+    TInt r = file.Open(fs, filename, EFileWrite);
+    if(r != KErrNone)
+        {
+        User::Leave(r);
+        }
+    else
+        {
+        CleanupClosePushL(file);
+
+        //Search for line
+        RBuf buffer;
+        buffer.Create(256);
+        CleanupClosePushL(buffer);
+
+        //Prepare file
+        TInt pos = 0;
+        User::LeaveIfError(file.Seek(ESeekStart, pos));
+        
+        //Read file
+        ReadLineL(file, buffer);
+        while(buffer.Length() > 0)
+            {
+            // Keep remembering current position
+            if(buffer.Find(KUIStoreLastStartedCaseIndex) == 0)
+                {
+                foundpos = pos;
+                break;
+                }
+            // What is current position
+            pos = 0;
+            User::LeaveIfError(file.Seek(ESeekCurrent, pos));
+            // Read next line from file
+            ReadLineL(file, buffer);
+            }
+
+        if(foundpos != KErrNotFound)
+            {
+            // Position was found. Just update that line (save index of last 
+            // started test case)
+            RBuf8 b;
+            b.Create(40);
+            CleanupClosePushL(b);
+
+            b.Copy(KUIStoreLastStartedCaseIndex);
+            b.Append(_L8(" "));
+            b.AppendNumFixedWidth(aSetInfo.GetLastStartedCaseIndex(), EDecimal, KFixedStartedCaseIndex);
+            User::LeaveIfError(file.Seek(ESeekStart, foundpos));
+            User::LeaveIfError(file.Write(b));
+            CleanupStack::PopAndDestroy(&b);
+            }
+
+        CleanupStack::PopAndDestroy(&buffer);
+        CleanupStack::PopAndDestroy(&file);
+        }
+    CleanupStack::PopAndDestroy(&fs);        
+    
+    if(foundpos == KErrNotFound)
+        {
+        // Position of KUIStoreLastStartedCaseIndex could not be found.
+        // Store the whole file.
+        SaveTestSetL(aSetInfo, aSetFileName);
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: ReadLineL
+
+    Description: Read the whole line from the file. If there is enough space,
+                 the whole content of line will be returned in buffer.
+
+    Parameters: RFile& file: in: file to be read
+                TDes8& buffer: out: buffer to be returned
+    
+    Return Values: None
+
+    Errors/Exceptions: Leaves if RFile::Read method fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::ReadLineL(RFile &file, TDes& buffer)
+    {
+    TBuf8<1> c;
+    TBuf<1> c16;
+    buffer.Copy(KNullDesC);
+    
+    User::LeaveIfError(file.Read(c));
+    while(c.Length() > 0)
+        {
+        // There is still place to write to the dest buffer
+        if(buffer.Length() < buffer.MaxLength())
+            {
+            c16.Copy(c);
+            buffer.Append(c16);
+            }
+        // Stop reading if end of line
+        if(c[0] == 0x0A)
+            {
+            break;
+            }
+        User::LeaveIfError(file.Read(c));
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: WriteLineL
+
+    Description: Write given line to the file and adds end of line.
+
+    Parameters: RFile& file: in: file to be written
+                TDesC& buffer: in: buffer to be written
+    
+    Return Values: None
+
+    Errors/Exceptions: Leaves if RFile::Write method fails
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::WriteLineL(RFile &file, const TDesC& buffer)
+    {
+    if(buffer.Length() > 0)
+        {
+        // Create 8-bit buffer
+        RBuf8 buf;
+        buf.Create(buffer.Length());
+        CleanupClosePushL(buf);
+    
+        buf.Copy(buffer);
+    
+        // Write buffer to file + end of line
+        User::LeaveIfError(file.Write(buf));
+
+        // Delete 8-bit buffer
+        CleanupStack::PopAndDestroy(&buf);
+        }
+
+    // Write end of line
+    TBuf8<2> eoline;
+    eoline.Copy(_L("\r\n"));
+    User::LeaveIfError(file.Write(eoline));
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: LoadTestModulesL
+
+    Description: Load test modules. 
+
+    Parameters: CTestSetInfo& aSetInfo: in: test set
+    
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::LoadTestModulesAndTestCaseFilesL( 
+    const RRefArray<const CTestInfo>& aTestCases )
+    {
+    
+    RRefArray<TDesC> testCaseFiles;
+    RRefArray<TDesC> testModules;
+    CleanupClosePushL( testCaseFiles );
+    CleanupClosePushL( testModules );
+    
+    User::LeaveIfError( Modules( testModules ) );
+    
+    TInt cCount = aTestCases.Count();
+    TInt mCount = 0;
+    TInt mInd=0;
+    TInt fCount = 0;
+    TInt fInd=0;
+    for( TInt cInd=0; cInd<cCount; cInd++ )
+        {
+        mCount = testModules.Count();
+        for( mInd=0; mInd<mCount; mInd++ )
+            {
+            if( aTestCases[cInd].ModuleName() == testModules[mInd] )
+                {
+                // Test module already loaded
+                break;
+                }
+            }
+        if( mInd == mCount )
+            {
+            // Not found, load test module
+            if( AddTestModule( aTestCases[cInd].ModuleName() ) == KErrNone )
+                {
+                User::LeaveIfError( 
+                    testModules.Append( aTestCases[cInd].ModuleName() ) );
+                }
+            }                
+        if( aTestCases[cInd].TestCaseFile().Length() == 0 )
+            {
+            // Test case file is not used, continue
+            continue;
+            }    
+        testCaseFiles.Reset();
+        User::LeaveIfError( 
+            TestCaseFiles( testCaseFiles, aTestCases[cInd].ModuleName() ));
+        fCount = testCaseFiles.Count();
+        for( fInd=0; fInd<fCount; fInd++ )
+            {
+            if( aTestCases[cInd].TestCaseFile() == testCaseFiles[fInd] )
+                {
+                // Testcasefile already loaded
+                break;
+                }
+            }  
+        if( fInd == fCount )
+            {  
+            // Load test module
+            if( AddTestCaseFile( aTestCases[cInd].ModuleName(),
+                                 aTestCases[cInd].TestCaseFile() ) == KErrNone )
+                {
+                User::LeaveIfError( 
+                    testCaseFiles.Append( aTestCases[cInd].TestCaseFile() ) );
+                }
+            }
+        }   
+
+    CleanupStack::PopAndDestroy(); // testModules
+    CleanupStack::PopAndDestroy(); // testCaseFiles
+        
+    }
+                               
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: TestExecuted
+
+    Description: Test case executed callback from UI engine.
+    
+    Parameters:  CUIEngineContainer* const aContainer: in: Execution container
+                 TFullTestResult& aFullTestResult: in: test result
+    
+    Return Values: None
+    
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/    
+void CUIStore::TestExecuted ( CUIEngineContainer* aContainer,
+                              TFullTestResult& aFullTestResult )
+    {
+    
+    CStartedTestCase* testCase = NULL;
+    
+    if( FindByContainer( aContainer, testCase ) != KErrNone )
+        {
+        __TRACE( KError, ( CStifLogger::EError, _L("CUIStore::TestExecuted: Not found")));
+        return;
+        }
+    CStartedTestSet* set = NULL;
+    TInt setStatus = 0;
+    if( FindStartedSetByCase( testCase, set ) == KErrNone )
+        {
+        setStatus = set->Status();
+        set->TestCompleted( testCase, aFullTestResult );        
+        setStatus |= set->Status();
+        }
+        
+    // Check and delete all pending popup windows for test case
+    TInt count = iPopups.Count();
+    for( TInt i = 0; i<count; i++ )
+        {
+        if( iPopups[i]->Container() == aContainer )
+            {
+            delete iPopups[i];
+            iPopups.Remove( i );
+            }
+        }
+        
+    // Get old status 
+    TInt status = testCase->Status();
+    // Set result
+    testCase->SetResult( aFullTestResult );
+    // Get new status 
+    status |= testCase->Status();
+    // Add set status flags
+    status |= setStatus;
+    
+    iUIStoreIf->Update( testCase, status ); 
+    
+    return;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: PrintProg
+
+    Description: Progress information from test case execution, 
+            callback from UI engine.
+    
+    Parameters:  CUIEngineContainer* const aContainer: in: Execution container
+                 TTestProgress& aProgress: in: print info
+    
+    Return Values: Symbian OS error code
+
+    
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+TInt CUIStore::PrintProg ( CUIEngineContainer* aContainer,
+                           TTestProgress& aProgress )
+    {
+    if( aContainer == NULL )
+        {
+        return KErrArgument;
+        }
+    if( ( aProgress.iDescription.Length() == 0 ) &&
+        ( aProgress.iText.Length() == 0 ) )
+    
+        {
+        return KErrArgument;
+        }
+        
+    CStartedTestCase* testCase = NULL;
+    
+    if( FindByContainer( aContainer, testCase ) != KErrNone )
+        {
+        __TRACE( KError, ( CStifLogger::EError, _L("CUIStore::TestExecuted: Not found")));
+        return KErrNotFound;
+        }
+
+    TInt position = KErrNotFound;
+    TInt smallPos = KErrNotFound;
+
+    // Search the array to find the position
+    const TInt count = testCase->PrintArray().Count();
+    for (TInt i = 0; i < count; i++)
+        {
+
+        // Check if that item is already on list
+        if ( testCase->PrintArray()[i]->iDescription == aProgress.iDescription &&
+             testCase->PrintArray()[i]->iPosition    == aProgress.iPosition )
+            {
+            // Set it to be updated
+            position = i;
+            break;
+            }
+
+        // Found a smaller priority item from list
+        if ( aProgress.iPosition <  testCase->PrintArray()[i]->iPosition )
+            {              
+            smallPos = i;
+            break;
+            }
+        }
+
+    // Either update item in array or add new item to array
+    if ( position != KErrNotFound )
+        {
+        // Replace existing text
+        testCase->PrintArray()[position]->ReplaceTextL( aProgress );
+        }
+    else 
+        {
+        CTestProgress* prog = NULL;
+        TRAPD( err,
+            // Allocate new
+            prog = CTestProgress::NewL( aProgress );
+            );
+        if( err != KErrNone )
+            {
+            return err;
+            }
+        if ( smallPos != KErrNotFound )
+            {
+            if( testCase->PrintArray().Insert( prog, smallPos ) != KErrNone )
+                {
+                delete prog;
+                return KErrNoMemory;
+                }
+            }
+        else 
+            {
+            if( testCase->PrintArray().Append( prog ) != KErrNone )
+                {
+                delete prog;
+                return KErrNoMemory;
+                }
+            }
+        }
+        
+    iUIStoreIf->Update( testCase, CUIStoreIf::EPrintUpdate ); 
+    
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: PrintProg
+
+    Description: Error information from Test framework, 
+            callback from UI engine.
+    
+    Parameters:  CUIEngineContainer* const aContainer: in: Execution container
+                 TErrorNotification& aError: in: error info
+    
+    Return Values: Symbian OS error code
+    
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/    
+TInt CUIStore::ErrorPrint( TErrorNotification& aError )
+    {
+
+    if( aError.iText.Length() == 0 )
+        {
+        return KErrArgument;
+        }
+    
+    iUIStoreIf->Error( aError );
+        
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: RemoteMsg
+
+    Description: Remote protocol control messages handling.
+
+    Parameters: const TDesC& aMessage: in: Remote message
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::RemoteMsg( CUIEngineContainer* aContainer,
+                          const TDesC& aMessage)
+    {
+
+    if( ( aMessage.Length() == 0 ) ||
+        ( aContainer == NULL ) )
+        {
+        return KErrArgument;
+        }
+    
+    TInt ret = KErrNone;
+
+    TInt error = KErrNone;
+    CStifTFwIfProt* msg = NULL;
+    CStifTFwIfProt* resp = NULL;
+    TRAPD( err, msg = CStifTFwIfProt::NewL(); );
+    if( err != KErrNone )
+        {
+        return err;
+        }
+    TRAP( err, resp = CStifTFwIfProt::NewL(); );
+    if( err != KErrNone )
+        {
+        delete msg;
+        return err;
+        }
+    
+    // Parse received message
+    TRAP( err, 
+        error = msg->SetL( aMessage ) 
+    );
+    if( err != KErrNone )
+        {
+        __TRACE( KError, ( _L( "CUIStore::RemoteMsg: message header parsing failed [%d]"), err ) );
+        delete msg;
+        delete resp;
+        return err;
+        }
+
+    // Create response 
+    TRAP( err, resp->CreateL(); );
+    if( err != KErrNone )
+        {
+        delete msg;
+        delete resp;
+        return err;
+        }                
+
+    resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
+    
+    if( error != KErrNone )
+        {
+        __TRACE( KError, ( _L( "CUIStore::RemoteMsg: message parsing failed [%d]"), error ) );
+        resp->AppendId( SETID( (TInt32)DevId(), 0 ) );
+        resp->AppendId( msg->SrcId() );
+        resp->Append( CStifTFwIfProt::MsgType, msg->iMsgType );
+        resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
+        
+        aContainer->RemoteReceive( resp->Message() );
+        
+        // Error reported with protocol message, return success
+        delete msg;
+        delete resp;
+        return KErrNone;
+        }                    
+    
+    TBool sendResp = ETrue;
+                        
+    switch( msg->iMsgType )
+        {
+        case CStifTFwIfProt::EMsgReserve:
+            {
+            // Check IDs
+            if( ( msg->SrcDevId() == 0 ) ||
+                ( msg->SrcTestId() == 0 ) )
+                {
+                __TRACE( KError, ( _L( "CUIStore::RemoteMsg: reserve for illegal srcid received") ) );
+                error = KErrGeneral;
+                }
+            if( msg->DstId() != 0 ) 
+                {
+                // Not a broadcast 
+                if( ( msg->DstDevId() != DevId() ) ||
+                    ( msg->DstTestId() != 0 ) )  
+                    {
+                    __TRACE( KError, ( _L( "CUIStore::RemoteMsg: reserve for illegal dstid received") ) );
+                    error = KErrGeneral;
+                    }
+                }                
+                
+            resp->AppendId( SETID( (TInt32)DevId(), 0 ) );
+            resp->AppendId( msg->SrcId() );
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgReserve );
+            if( error != KErrNone )
+                {
+                resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
+                }
+            }
+            break;
+        case CStifTFwIfProt::EMsgRelease:
+            {
+            // Check protocol ids
+            if( ( msg->SrcDevId() == 0 ) ||
+                ( msg->SrcTestId() == 0 ) ||
+                ( msg->DstTestId() != 0 ) )
+                {
+                __TRACE( KError, ( _L( "CUIStore::RemoteMsg: release for illegal srcid or dstid received") ) );
+                error = KErrGeneral;
+                }   
+            else if( msg->DstDevId() != DevId() ) 
+                {
+                __TRACE( KError, ( _L( "CUIStore::RemoteMsg: release for illegal dstid received") ) );
+                error = KErrNotFound;
+                }   
+
+            resp->AppendId( msg->DstId() );
+            resp->AppendId( msg->SrcId() );
+            resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRelease );
+            
+            if( error != KErrNone )
+                {
+                resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
+                }            
+            }
+            break;
+        case CStifTFwIfProt::EMsgRemote:
+            {
+            // Check protocol ids
+            if( ( msg->SrcDevId() == 0 ) ||
+                ( msg->SrcTestId() == 0 ) ||
+                ( msg->DstDevId() == 0 ) )
+                {
+                __TRACE( KError, ( _L( "CUIStore::RemoteMsg: remote for illegal srcid or dstid received") ) );
+                error = KErrGeneral;
+                }
+            else
+                {               
+                __TRACE( KError, ( _L( "CUIStore::RemoteMsg: received remote call") ) );
+                
+                error = MsgRemote( aContainer, *msg, *resp );
+                }
+                
+            if( error != KErrNone )
+                {
+                resp->AppendId( msg->DstId() );
+                resp->AppendId( msg->SrcId() );
+                resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+                resp->Append( msg->iCmdDes );
+                resp->Append( CStifTFwIfProt::RespParam,     
+                             CStifTFwIfProt::ERespResult, 
+                             error );
+                }
+            else
+                {
+                sendResp = EFalse;
+                }
+                                
+            }
+            break;
+        case CStifTFwIfProt::EMsgResponse:            
+        default:
+            __TRACE( KError, ( _L( "CUIStore::RemoteMsg: invalid message")) );
+            ret = KErrNotSupported;
+        }
+
+    if( ( ret == KErrNone ) && sendResp ) 
+         {
+        aContainer->RemoteReceive( resp->Message() );
+        }
+        
+    delete msg;
+    delete resp;
+    
+    return ret;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: MsgRemote
+
+    Description: Remote command
+    
+    Parameters: const TDesC& aMessage: in:
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::MsgRemote( CUIEngineContainer* aContainer, 
+                          CStifTFwIfProt& aReq, 
+                          CStifTFwIfProt& aResp )
+    {
+    
+    TInt ret = KErrNone;    
+        
+    switch( aReq.iCmdType )
+        {
+        case CStifTFwIfProt::ECmdRun:
+            ret = MsgRemoteRun( aContainer, aReq, aResp );
+            break;
+        case CStifTFwIfProt::ECmdPause:
+        case CStifTFwIfProt::ECmdResume:
+        case CStifTFwIfProt::ECmdCancel:
+            ret = MsgRemoteTestCtl( aContainer, aReq, aResp );
+            break;
+        case CStifTFwIfProt::ECmdRequest:
+        case CStifTFwIfProt::ECmdRelease:
+        case CStifTFwIfProt::ECmdSetEvent:
+        case CStifTFwIfProt::ECmdUnsetEvent:            
+            ret = MsgRemoteEventCtl( aContainer, aReq, aResp );            
+            break;
+        case CStifTFwIfProt::ECmdSendReceive:
+            {
+            ret = MsgRemoteSendReceive( aContainer, aReq, aResp );
+            break;
+            }
+        default:
+            {
+            CStifTFwIfProt* resp = NULL;
+            TRAPD( err, 
+                resp = CStifTFwIfProt::NewL(); 
+                resp->CreateL();
+                );
+            if( err != KErrNone )
+                {
+                delete resp;
+                return err;
+                }
+            resp->SetMsgType( CStifTFwIfProt::EMsgResponse );
+            resp->SetSrcId( aReq.DstId() );
+            resp->SetDstId( aReq.SrcId() );
+            resp->SetRespType( CStifTFwIfProt::EMsgRemote );
+            // Command type must be set separately, 
+            // because it is unspecified in this case
+            resp->iCmdType = aReq.iCmdType;
+            resp->Append( aReq.iCmdDes );
+                
+            ret = RemotePopup( aContainer, aReq.Message(), resp );
+
+            if( ret != KErrNone )
+                {
+                delete resp;
+                }
+            }
+            break;
+        }
+    
+    return ret;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: AtsRemoteRun
+
+    Description: Remote run message
+    
+    Parameters: const TDesC& aMessage: in:
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+TInt CUIStore::MsgRemoteRun( CUIEngineContainer* aContainer,
+                             CStifTFwIfProt& aReq, 
+                             CStifTFwIfProt& /* aResp */)
+    {
+    
+    TInt ret = KErrNone;    
+    TUint16 testid = 0;
+    
+    if( ( aReq.DstDevId() == 0 ) ||
+        ( aReq.DstTestId() != 0 ) ) 
+        {
+        // Protocol violation
+        __TRACE( KError, ( _L( "AtsReceive: remote run for illegal dstid received") ) );
+        return KErrGeneral;
+        }
+
+    if ( aReq.DstDevId() != DevId() ) 
+        {
+        // Not our protocol message
+        __TRACE( KError, ( _L( "AtsReceive: remote run for illegal dstdevid received") ) );
+        return KErrNotFound;
+        }
+
+    
+    if( aReq.iModule.Length() == 0 )
+        {
+        __TRACE( KError, ( _L("No mandatory test module name given as run parameter") ) );        
+        ret = KErrNotFound;
+        }    
+    else if( aReq.iTestCaseNumber < 0 )
+        {
+        __TRACE( KError, ( _L("No mandatory test case number given as run parameter") ) );        
+        ret = KErrNotFound;
+        }    
+    
+    testid = 1;
+    CStifTFwIfProt* resp = NULL;
+    TRAPD( err, 
+        resp = CStifTFwIfProt::NewL(); 
+        resp->CreateL();
+        );
+    if( err != KErrNone )
+        {
+        delete resp;
+        return err;
+        }
+
+    CStifTFwIfProt* resp2 = NULL;
+    TRAP( err, 
+        resp2 = CStifTFwIfProt::NewL(); 
+        resp2->CreateL();
+        );
+    if( err != KErrNone )
+        {
+        delete resp2;
+        return err;
+        }              
+
+    resp->SetMsgType( CStifTFwIfProt::EMsgResponse );
+    resp->SetSrcId( SETID( (TInt32)DevId(), testid ) );
+    resp->SetDstId( aReq.SrcId() );
+    resp->SetRespType( CStifTFwIfProt::EMsgRemote );
+    resp->SetCmdType( CStifTFwIfProt::ECmdRun );        
+
+    resp2->SetMsgType( CStifTFwIfProt::EMsgResponse );
+    resp2->SetSrcId( SETID( (TInt32)DevId(), testid ) );
+    resp2->SetDstId( aReq.SrcId() );
+    resp2->SetRespType( CStifTFwIfProt::EMsgRemote );
+    resp2->SetCmdType( CStifTFwIfProt::ECmdRun );        
+   
+    // Remote run started popup call
+    ret = RemotePopup( aContainer, aReq.Message(), resp, EPopupPriorityHighest );
+    if( ret != KErrNone )
+        {
+        delete resp;
+        }
+    
+    // Remote run result popup call
+    ret = RemotePopup( aContainer, aReq.Message(), resp2 );
+    if( ret != KErrNone )
+        {
+        delete resp2;
+        }
+    
+    return ret;            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: MsgRemoteTestCtl
+
+    Description: Remote test control message
+    
+    Parameters: const TDesC& aMessage: in:
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+TInt CUIStore::MsgRemoteTestCtl( CUIEngineContainer* aContainer,
+                                 CStifTFwIfProt& aReq, 
+                                 CStifTFwIfProt& /*aResp*/ )
+    {
+    
+    TInt ret = KErrNone;    
+   
+    if( ( aReq.DstDevId() == 0 ) ||
+        ( aReq.DstTestId() == 0 ) ) 
+        {
+        // Protocol violation
+        __TRACE( KError, ( _L( "AtsReceive: remote test control for illegal dstid received") ) );
+        return KErrGeneral;
+        }
+
+    if ( aReq.DstDevId() != DevId() ) 
+        {
+        // Not our protocol message
+        __TRACE( KError, ( _L( "AtsReceive: remote test control for illegal dstdevid received") ) );
+        return KErrNotFound;
+        }
+    
+    CStifTFwIfProt* resp = NULL;
+    TRAPD( err, 
+        resp = CStifTFwIfProt::NewL(); 
+        resp->CreateL();
+        );
+    if( err != KErrNone )
+        {
+        delete resp;
+        return err;
+        }
+        
+    resp->SetMsgType( CStifTFwIfProt::EMsgResponse );
+    resp->SetSrcId( aReq.DstId() );
+    resp->SetDstId( aReq.SrcId() );
+    resp->SetRespType( CStifTFwIfProt::EMsgRemote );
+    resp->SetCmdType( aReq.iCmdType );
+    
+    ret = RemotePopup( aContainer, aReq.Message(), resp );
+
+    if( ret != KErrNone )
+        {
+        delete resp;
+        }
+
+    return ret;
+    
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: MsgRemoteEventCtl
+
+    Description: Remote run message
+    
+    Parameters: const TDesC& aMessage: in:
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+TInt CUIStore::MsgRemoteEventCtl( CUIEngineContainer* aContainer,
+                                  CStifTFwIfProt& aReq, 
+                                  CStifTFwIfProt& aResp )
+    {
+    
+    if( ( aReq.DstDevId() == 0 ) ||
+        ( aReq.DstTestId() != 0 ) ) 
+        {
+        // Protocol violation
+        __TRACE( KError, ( _L( "AtsReceive: remote event control for illegal dstid received") ) );
+        return KErrGeneral;
+        }
+
+    if ( aReq.DstDevId() != DevId() ) 
+        {
+        // Not our protocol message
+        __TRACE( KError, ( _L( "AtsReceive: remote event control for illegal dstdevid received") ) );
+        return KErrNotFound;
+        }
+        
+    if( aReq.iEventName.Length() == 0 )
+        {
+        __TRACE( KError, ( _L("No event name given") ) );        
+        return KErrNotFound;
+    }
+    
+    TInt ret = KErrNone;
+                    
+    switch( aReq.iCmdType )
+        {
+        case CStifTFwIfProt::ECmdRequest:
+            {
+            // Send event active information
+            CStifTFwIfProt* resp = NULL;
+            TRAP( ret, 
+                resp = CStifTFwIfProt::NewL(); 
+                resp->CreateL(); );
+            if( ret != KErrNone )
+                {
+                delete resp;
+                return ret;
+                }
+                
+            resp->SetMsgType( CStifTFwIfProt::EMsgResponse );
+            resp->SetSrcId( aReq.DstId() );
+            resp->SetDstId( aReq.SrcId() );
+            resp->SetRespType( CStifTFwIfProt::EMsgRemote );
+            resp->SetCmdType( CStifTFwIfProt::ECmdRequest );
+            resp->Append( CStifTFwIfProt::EventStatus, 
+                          CStifTFwIfProt::EEventSet );
+            resp->Append( aReq.iEventName );
+            ret = RemotePopup( aContainer, aReq.Message(), resp, EPopupPriorityNormal );                
+
+            if( ret != KErrNone )
+                {
+                delete resp;
+                }
+                    
+            aResp.AppendId( aReq.DstId() );
+            aResp.AppendId( aReq.SrcId() );
+            aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest );
+            if( ret == KErrNone )
+                {
+                aResp.Append( CStifTFwIfProt::EventStatus, 
+                              CStifTFwIfProt::EEventActive );
+                aResp.Append( aReq.iEventName );
+                }
+            else 
+                {
+                aResp.Append( CStifTFwIfProt::EventStatus, 
+                              CStifTFwIfProt::EEventError );
+                aResp.Append( aReq.iEventName );                              
+                aResp.Append( CStifTFwIfProt::EventStatusParams, 
+                             CStifTFwIfProt::EEventResult,
+                             ret );
+                }
+
+            ret = aContainer->RemoteReceive( aResp.Message() );    
+            ret = KErrNone;          
+            }
+            break;
+        case CStifTFwIfProt::ECmdSetEvent:
+            {
+            // Send event active information
+            CStifTFwIfProt* resp = NULL;
+            TRAP( ret, 
+                resp = CStifTFwIfProt::NewL(); 
+                resp->CreateL(); );
+            if( ret != KErrNone )
+                {
+                delete resp;
+                return ret;
+                }
+                
+            resp->SetMsgType( CStifTFwIfProt::EMsgResponse );
+            resp->SetSrcId( aReq.DstId() );
+            resp->SetDstId( aReq.SrcId() );
+            resp->SetRespType( CStifTFwIfProt::EMsgRemote );
+            resp->SetCmdType( CStifTFwIfProt::ECmdSetEvent );
+            resp->Append( CStifTFwIfProt::EventStatus, 
+                          CStifTFwIfProt::EEventSet );
+            resp->Append( aReq.iEventName );
+            if ( aReq.iEventType == TEventIf::EState )
+                {
+                resp->Append( CStifTFwIfProt::EventStatusParams, 
+                                                             CStifTFwIfProt::EEventType,
+                                                             CStifTFwIfProt::EventType, 
+                                                             TEventIf::EState );
+                }
+            
+            ret = RemotePopup( aContainer, aReq.Message(), resp, EPopupPriorityNormal );                
+
+            if( ret != KErrNone )
+                {
+                delete resp;
+                }
+                    
+            aResp.AppendId( aReq.DstId() );
+            aResp.AppendId( aReq.SrcId() );
+            aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdSetEvent );
+            if( ret == KErrNone )
+                {
+                aResp.Append( CStifTFwIfProt::EventStatus, 
+                              CStifTFwIfProt::EEventSet );                
+                aResp.Append( aReq.iEventName );
+                if ( aReq.iEventType == TEventIf::EState )
+                    {
+                    aResp.Append( CStifTFwIfProt::EventStatusParams, 
+                            CStifTFwIfProt::EEventType,
+                            CStifTFwIfProt::EventType, 
+                            TEventIf::EState );
+                    }
+                }
+            else 
+                {
+                aResp.Append( CStifTFwIfProt::EventStatus, 
+                              CStifTFwIfProt::EEventError );                
+                aResp.Append( CStifTFwIfProt::EventStatusParams, 
+                             CStifTFwIfProt::EEventResult,
+                             ret );
+                }
+
+            ret = aContainer->RemoteReceive( aResp.Message() );    
+            ret = KErrNone;          
+            }
+            break;
+        case CStifTFwIfProt::ECmdUnsetEvent:
+            {
+            // Send event active information
+            CStifTFwIfProt* resp = NULL;
+            TRAP( ret, 
+                resp = CStifTFwIfProt::NewL(); 
+                resp->CreateL(); );
+            if( ret != KErrNone )
+                {
+                delete resp;
+                return ret;
+                }
+                
+            resp->SetMsgType( CStifTFwIfProt::EMsgResponse );
+            resp->SetSrcId( aReq.DstId() );
+            resp->SetDstId( aReq.SrcId() );
+            resp->SetRespType( CStifTFwIfProt::EMsgRemote );
+            resp->SetCmdType( CStifTFwIfProt::ECmdUnsetEvent );
+            resp->Append( CStifTFwIfProt::EventStatus, 
+                          CStifTFwIfProt::EEventUnset );
+            resp->Append( aReq.iEventName );
+            
+            ret = RemotePopup( aContainer, aReq.Message(), resp, EPopupPriorityNormal );                
+
+            if( ret != KErrNone )
+                {
+                delete resp;
+                }
+                    
+            aResp.AppendId( aReq.DstId() );
+            aResp.AppendId( aReq.SrcId() );
+            aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdUnsetEvent );
+            if( ret == KErrNone )
+                {
+                aResp.Append( CStifTFwIfProt::EventStatus, 
+                              CStifTFwIfProt::EEventUnset );
+                aResp.Append( aReq.iEventName );
+                }
+            else 
+                {
+                aResp.Append( CStifTFwIfProt::EventStatus, 
+                              CStifTFwIfProt::EEventError );
+                aResp.Append( CStifTFwIfProt::EventStatusParams, 
+                             CStifTFwIfProt::EEventResult,
+                             ret );
+                }
+
+            ret = aContainer->RemoteReceive( aResp.Message() );    
+            ret = KErrNone;          
+            }
+            break;            
+            
+        case CStifTFwIfProt::ECmdRelease:
+            {
+            // Check and delete all pending event popup windows for test case
+            TInt count = iPopups.Count();
+            for( TInt i = 0; i<count; i++ )
+                {
+                if( ( iPopups[i]->Container() == aContainer ) &&
+                    iPopups[i]->IsEventPopup() )
+                    {
+                    delete iPopups[i];
+                    iPopups.Remove( i );
+                    }
+                }
+                
+            aResp.AppendId( aReq.DstId() );
+            aResp.AppendId( aReq.SrcId() );
+            aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+            aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRelease );
+            aResp.Append( aReq.iEventName );
+
+            ret = aContainer->RemoteReceive( aResp.Message() );    
+            ret = KErrNone;          
+            
+            }
+            break;
+        default:
+            return KErrNotSupported;
+        }
+        
+    return ret;
+    
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: MsgRemoteSendReceive
+
+    Description: Asynchronous remote sendreceive message
+    
+    Parameters: CUIEngineContainer* aContainer: in:
+                CStifTFwIfProt& aReq: in
+                CStifTFwIfProt& aResp: in
+
+    Return Values: KErrNotSupported
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/        
+TInt CUIStore::MsgRemoteSendReceive( CUIEngineContainer* aContainer,
+                             CStifTFwIfProt& aReq, 
+                             CStifTFwIfProt& aResp )
+    {
+    
+    TInt ret = KErrNone;    
+    // TUint16 testid = 0;
+    
+    if( ( aReq.DstDevId() == 0 ) ||
+        ( aReq.DstTestId() != 0 ) ) 
+        {
+        // Protocol violation
+        __TRACE( KError, ( _L( "AtsReceive: remote run for illegal dstid received") ) );
+        return KErrGeneral;
+        }
+
+    if ( aReq.DstDevId() != DevId() ) 
+        {
+        // Not our protocol message
+        __TRACE( KError, ( _L( "AtsReceive: remote run for illegal dstdevid received") ) );
+        return KErrNotFound;
+        }
+
+    // testid = 1;
+    CStifTFwIfProt* resp = NULL;
+    TRAPD( err, 
+        resp = CStifTFwIfProt::NewL(); 
+        resp->CreateL();
+        );
+    if( err != KErrNone )
+        {
+        delete resp;
+        return err;
+        }
+        
+    resp->SetMsgType( CStifTFwIfProt::EMsgResponse );
+    //resp->SetSrcId( SETID( DevId(), testid ) );
+    resp->SetSrcId( aReq.DstId() );
+    resp->SetDstId( aReq.SrcId() );
+    resp->SetRespType( CStifTFwIfProt::EMsgRemote );
+    resp->SetCmdType( CStifTFwIfProt::ECmdSendReceive );        
+   
+    ret = RemotePopup( aContainer, aReq.Message(), resp );
+    if( ret != KErrNone )
+        {
+        delete resp;
+        }
+        
+    aResp.AppendId( aReq.DstId() );
+    aResp.AppendId( aReq.SrcId() );
+    aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
+    aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdSendReceive );
+    if( ret != KErrNone )
+        {
+        aResp.Append( CStifTFwIfProt::RunStatus, 
+                      CStifTFwIfProt::ERunError );
+        aResp.Append( CStifTFwIfProt::RunStatusParams, 
+                      CStifTFwIfProt::ERunResult, ret );
+        }
+    else
+        {
+        aResp.Append( CStifTFwIfProt::RunStatus, 
+                      CStifTFwIfProt::ERunStarted );
+        }
+
+    // Send response
+    aContainer->RemoteReceive( aResp.Message() );
+    
+    // Response is created, return success
+    ret = KErrNone;        
+    
+    return ret;
+            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: GoingToReboot
+
+    Description: Reboot indication handling.
+
+    Parameters: CUIEngineContainer* aContainer: in: Container
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::GoingToReboot( CUIEngineContainer* /* aContainer */,
+                              TRequestStatus& aStatus )
+    {
+    
+    _LIT( KDateString,"%H%T%S.%C" ); 
+       
+    const TInt KTimeFieldLength = 30;
+    TBuf<KTimeFieldLength> time;
+    
+    // Store info 
+    CStifLogger* logger = CStifLogger::NewL( KUIStoreDefaultDir,
+                                             KUIStoreDefaultRebootFile,
+                                             CStifLogger::EData,
+                                             CStifLogger::EFile,
+                                             ETrue,
+                                             EFalse,
+                                             EFalse,
+                                             EFalse,
+                                             EFalse,
+                                             ETrue );
+    
+    CleanupStack::PushL( logger );
+    TInt count = iStartedTestCases.Count();
+    for( TInt index=0; index<count; index++ )
+        {
+        logger->Log( _L("%S\r\n"), &KUIStoreStartTest );
+        
+        // First test case info
+        logger->Log( _L("%S %S\r\n"), &KUIStoreCaseModuleName, 
+            &iStartedTestCases[index]->TestInfo().ModuleName() );
+        logger->Log( _L("%S %S\r\n"), &KUIStoreTestCaseTitle, 
+            &iStartedTestCases[index]->TestInfo().TestCaseTitle() );
+        if( iStartedTestCases[index]->TestInfo().TestCaseFile().Length() > 0 )
+            {
+            logger->Log( _L("%S %S\r\n"), &KUIStoreTestCaseFile, 
+                &iStartedTestCases[index]->TestInfo().TestCaseFile() );
+            }
+        logger->Log( _L("%S %d\r\n"), &KUIStoreTestCaseNum, 
+            iStartedTestCases[index]->TestInfo().TestCaseNum() );
+        logger->Log( _L("%S %d\r\n"), &KUIStoreCasePriority, 
+            iStartedTestCases[index]->TestInfo().Priority() );
+         //@js<--remove--> logger->Log( _L("%S %d %d\r\n"), &KUIStoreCaseTimeout,            
+         //@js<--remove--> iStartedTestCases[index]->TestInfo().Timeout().Int64().Low(),
+         //@js<--remove--> iStartedTestCases[index]->TestInfo().Timeout().Int64().High() );
+        logger->Log( _L("%S %d %d\r\n"), &KUIStoreCaseTimeout,            
+            I64LOW(iStartedTestCases[index]->TestInfo().Timeout().Int64()),
+            I64HIGH(iStartedTestCases[index]->TestInfo().Timeout().Int64()));     
+            
+        logger->Log( _L("%S %d\r\n"), &KUIStoreCaseExpectedResult, 
+            iStartedTestCases[index]->TestInfo().ExpectedResult() );    
+        
+        logger->Log( _L("%S %d\r\n"), &KUIStoreCaseStatus, 
+            iStartedTestCases[index]->Status() );    
+
+        logger->Log( _L("%S %d %d\r\n"), &KUIStoreCaseExecutionResult, 
+            iStartedTestCases[index]->Result().iCaseExecutionResultType,
+            iStartedTestCases[index]->Result().iCaseExecutionResultCode );    
+        logger->Log( _L("%S %d %S\r\n"), &KUIStoreCaseResult, 
+            iStartedTestCases[index]->Result().iTestResult.iResult,
+            &iStartedTestCases[index]->Result().iTestResult.iResultDes );    
+        
+        // Start time
+        iStartedTestCases[index]->Result().iStartTime.FormatL(
+                    time, KDateString );
+        logger->Log( _L("%S %S\r\n"), &KUIStoreCaseStartTime, &time );
+
+        // Start time
+        iStartedTestCases[index]->Result().iEndTime.FormatL(
+                    time, KDateString );
+        logger->Log( _L("%S %S\r\n"), &KUIStoreCaseEndTime, &time );
+
+        logger->Log( _L("%S\r\n\r\n"), &KUIStoreStartTestEnd );
+        }
+    
+    CleanupStack::PopAndDestroy( logger );
+    
+    // Show popup
+    TKeyCode key;
+    iUIStoreIf->PopupMsg( _L("GoingToReboot"), 
+                          _L("Press any key to continue"), 
+                          KRebootPopupTimeout, key, aStatus );
+    
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: LoadExecutedTestCasesL
+
+    Description: Load all executed testcases saved before reboot.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves on error
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::LoadExecutedTestCasesL()
+    {
+    TPtrC tmp;
+    TInt num = 0;
+    TInt high = 0;
+    TInt64 interval;
+    TFullTestResult result;
+    TInt status = 0;
+    CStifItemParser* item = NULL;
+    TInt ret = KErrNone;
+
+    CStifParser* parser = NULL;
+    TRAP( ret,
+        parser = CStifParser::NewL( KUIStoreDefaultDir,
+                                    KUIStoreDefaultRebootFile );
+        );
+    if( ret != KErrNone )
+        {
+        // reboot file not found
+        return; 
+        }
+    CleanupStack::PushL( parser );
+   
+    __TRACE( KInit, ( _L( "Reboot file is found(%S%S). Reboot testing ongoing..." ), &KUIStoreDefaultDir, &KUIStoreDefaultRebootFile ) );
+
+    CTestInfo* testInfo = NULL;    
+     
+    CStifSectionParser* section = 
+        parser->SectionL( KUIStoreStartTest, KUIStoreStartTestEnd );
+   
+    while( section )
+        {
+        CleanupStack::PushL( section );    
+        
+        testInfo = CTestInfo::NewL();
+        CleanupStack::PushL( testInfo ); 
+    
+        // Get module name
+        // Mandatory, leave if not found
+        User::LeaveIfError( 
+            section->GetLine( KUIStoreCaseModuleName, tmp, ENoTag ) );
+        testInfo->SetModuleName( tmp );
+    
+        // Get test case title
+        // Mandatory, leave if not found
+        User::LeaveIfError( 
+            section->GetLine( KUIStoreTestCaseTitle, tmp, ENoTag ) );
+        testInfo->SetTestCaseTitle( tmp );
+        
+        // Get test case file
+        num = section->GetLine( KUIStoreTestCaseFile, tmp, ENoTag );
+        if( ( num == KErrNone ) &&
+            ( tmp.Length() > 0 ) )
+            {
+            // Optional
+            testInfo->SetTestCaseFile( tmp );
+            }
+        else
+            {
+            testInfo->SetTestCaseFile( KNullDesC );
+            }
+        
+        // Get test case number
+        item = section->GetItemLineL( KUIStoreTestCaseNum );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreTestCaseNum, num ));
+        testInfo->SetTestCaseNumber( num );
+        CleanupStack::PopAndDestroy( item );    
+        
+        // Get test case priority
+        item = section->GetItemLineL( KUIStoreCasePriority );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreCasePriority, num ));
+        testInfo->SetPriority( num );
+        CleanupStack::PopAndDestroy( item ); 
+        
+        // Get test case timeout
+        item = section->GetItemLineL( KUIStoreCaseTimeout );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreCaseTimeout, num ));
+        User::LeaveIfError( item->GetNextInt( high ));
+        //interval.Set( high, num );
+        interval = MAKE_TINT64( high, num );      
+        TTimeIntervalMicroSeconds timeout( interval );
+        testInfo->SetTimeout( timeout );
+        CleanupStack::PopAndDestroy( item ); 
+        
+        // Get test case status
+        item = section->GetItemLineL( KUIStoreCaseStatus );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreCaseStatus, status ));
+        CleanupStack::PopAndDestroy( item ); 
+
+        // Get test case execution result
+        item = section->GetItemLineL( KUIStoreCaseExecutionResult );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreCaseExecutionResult, num ));
+        result.iCaseExecutionResultType = ( TFullTestResult::TCaseExecutionResult) num;
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetNextInt( result.iCaseExecutionResultCode ));
+        CleanupStack::PopAndDestroy( item );
+        
+        // Get test case result
+        item = section->GetItemLineL( KUIStoreCaseResult );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetInt( KUIStoreCaseResult, 
+                                          result.iTestResult.iResult ));
+        // Not mandatory
+        TBool first = ETrue;
+        result.iTestResult.iResultDes.Zero();
+        ret = item->GetNextString( tmp );
+        while( ret == KErrNone )
+            {
+            if( result.iTestResult.iResultDes.Length() + tmp.Length() + 1 > result.iTestResult.iResultDes.MaxLength() )
+                {
+                User::Leave( KErrGeneral );
+                }
+            if(!first)
+                result.iTestResult.iResultDes.Append(_L(" "));
+            result.iTestResult.iResultDes.Append( tmp );
+            first = EFalse;
+            ret = item->GetNextString( tmp );
+            }
+        /*
+        ret = item->GetNextString( tmp );
+        if( ret == KErrNone )
+            {
+            if( tmp.Length() > result.iTestResult.iResultDes.MaxLength() )
+                {
+                User::Leave( KErrGeneral );
+                }
+            result.iTestResult.iResultDes.Copy( tmp );
+            }
+        */
+        CleanupStack::PopAndDestroy( item ); 
+
+        // Get test start time
+        item = section->GetItemLineL( KUIStoreCaseStartTime );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetString( KUIStoreCaseStartTime, tmp ));
+        result.iStartTime.Set( tmp );
+        CleanupStack::PopAndDestroy( item ); 
+
+        // Get test end time
+        item = section->GetItemLineL( KUIStoreCaseEndTime );
+        CleanupStack::PushL( item );
+        // Mandatory, leave if not found
+        User::LeaveIfError( item->GetString( KUIStoreCaseEndTime, tmp ));
+        result.iEndTime.Set( tmp );
+        CleanupStack::PopAndDestroy( item ); 
+             
+        if( status != CUIStoreIf::EStatusRunning )
+            {
+            // Add executed test cases to list
+            CStartedTestCase* startedCase = 
+                new( ELeave )CStartedTestCase( testInfo, result, status );
+            User::LeaveIfError( iStartedTestCases.Append( startedCase ) );            
+            CleanupStack::Pop( testInfo );            
+
+            // Fill data with test case info and send to test engine
+            TTestInfo *info = new (ELeave) TTestInfo;
+            CleanupStack::PushL(info);
+            info->iModuleName.Copy(testInfo->ModuleName());
+            info->iConfig.Copy(testInfo->TestCaseFile());
+            info->iTestCaseInfo.iCaseNumber = testInfo->TestCaseNum();
+            info->iTestCaseInfo.iTitle.Copy(testInfo->TestCaseTitle());
+            info->iTestCaseInfo.iTimeout = testInfo->Timeout();
+            info->iTestCaseInfo.iPriority = testInfo->Priority();
+            
+            iUIEngine->TestEngine().AddTestCaseResultToTestReport(*info, result, KErrNone);
+            CleanupStack::PopAndDestroy(info);
+            } 
+        else
+            {
+            // Restart testcase that was running when reset was done
+            CUIEngineContainer* container = NULL;
+            User::LeaveIfError(  
+                iUIEngine->StartTestCase( container, *testInfo ) );
+            
+            CStartedTestCase* testCase = NULL;
+            TRAPD( retVal,
+                testCase = CStartedTestCase::NewL( *testInfo, *container );
+               );
+            if( retVal != KErrNone )
+                {
+                iUIEngine->AbortStartedTestCase( container );
+                User::Leave( retVal );
+                }
+                
+            retVal = iStartedTestCases.Append( testCase );
+            if( retVal != KErrNone )
+                {
+                iUIEngine->AbortStartedTestCase( container );
+                delete testCase;
+                User::Leave( retVal );
+                }
+
+            CleanupStack::PopAndDestroy( testInfo );
+
+            }
+        
+        CleanupStack::PopAndDestroy( section );    
+        section = 
+            parser->NextSectionL( KUIStoreStartTest, KUIStoreStartTestEnd );
+        } 
+    
+    CleanupStack::PopAndDestroy( parser );
+    
+    // Delete file
+    RFs rf;
+    TInt retVal = rf.Connect();
+	if( retVal != KErrNone )
+		{
+		User::Leave( retVal );
+		}
+		
+    TFileName file( KUIStoreDefaultDir );
+    file.Append( KUIStoreDefaultRebootFile );
+    rf.Delete( file );
+    rf.Close();
+    
+    return;
+    }    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: FindByContainer
+
+    Description: Find test case with UIEngine Container pointer.
+    
+    Parameters:  CUIEngineContainer* const aContainer: in: Execution container
+                 CStartedTestCase*& aTestCase: out: Testcase info
+    
+    Return Values: Symbian OS error code
+    
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/ 
+TInt CUIStore::FindByContainer( CUIEngineContainer* const aContainer,
+                                CStartedTestCase*& aTestCase )
+    {
+    
+    TInt count = iStartedTestCases.Count();
+    TInt index = 0;
+    for( ; index < count; index++ )
+        {
+        if( ( iStartedTestCases[index]->Status() & 
+              CUIStoreIf::EStatusRunning ) &&
+            ( &iStartedTestCases[index]->UIEngineContainer() ==
+              aContainer ) )
+            {
+            aTestCase = iStartedTestCases[index];
+            return KErrNone;
+            }
+        }
+    
+    return KErrNotFound;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: UpdateCases
+
+    Description: Refreshs iTestCases array ie. fetches test cases from 
+                test framework
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::UpdateCases()
+    {
+    
+    if( iUpdateNeeded )
+        {
+        TInt handle = iUIStoreIf->PopupMsg( 
+            _L("Updating"), _L("Test cases"), 60 );
+        iTestCases.ResetAndDestroy();
+        TRAPD( ret, 
+            ret = iUIEngine->GetTestCasesL( iTestCases );
+            );
+        iUpdateNeeded = EFalse;
+        // Close popup
+        iUIStoreIf->Close( handle );
+        if( iTestCases.Count() == 0 )
+            {
+            iUIStoreIf->PopupMsg( _L("No test cases found"), 
+                                  _L("e.g. check TestEngine log"), 
+                                  3 );
+            }
+        return ret;
+        }
+    
+    return KErrNone;
+            
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: CheckIniL
+
+    Description: Check ini file
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::CheckIniL( TFileName& aIni )
+    {
+    
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    RFile file;
+    TInt err = KErrNone;
+    TErrorNotification error;
+    error.iModule.Copy( KUIStore );
+
+    TStifUtil::CorrectFilePathL( aIni );
+    
+    if ( aIni.Length() != 0 )
+        {
+        err = file.Open ( fs, aIni, EFileRead );
+
+        if ( err == KErrNone )
+            {
+            // Use the file given as command line parameter
+            iUIStoreIf->PopupMsg( _L("Using given ini-file"), 
+                                  KNullDesC, 0 );
+            file.Close();
+            fs.Close(); 
+            return;
+            }
+        else
+            { 
+            error.iText.Copy( _L("Can't open given ini-file") );
+            iUIStoreIf->Error( error );  
+            aIni.Zero();       
+            }
+        }
+        
+    // Try to locate default ini file from every drive
+    TDriveList drivelist; 
+	User::LeaveIfError( fs.DriveList(drivelist) );
+	// A TDriveList (the list of available drives), is an array of 
+	// 26 bytes. Each byte with a non zero value signifies that the 
+	// corresponding drive is available.
+
+    TInt driveNumber; 
+	TChar driveLetter;
+
+	for( driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++ )
+		{
+		if( !drivelist[driveNumber] ) 
+			{
+			// If drive-list entry is zero, drive is not available
+			continue;
+			}
+        User::LeaveIfError(
+            fs.DriveToChar( driveNumber, driveLetter ));
+        
+        aIni.Zero();
+        aIni.Append( driveLetter );
+        aIni.Append( _L(":") );
+        aIni.Append( KDefaultIni );
+
+        // Try to open
+        err = file.Open ( fs, aIni, EFileRead );
+
+        if ( err == KErrNone )
+            {
+            // Use default file
+            file.Close();
+            TFileName info( _L("Using default ini-file ") );
+            if( info.MaxLength()-info.Length() >  aIni.Length() )
+                {
+                // Show also filename if fits to descriptor
+                info.Append( aIni );
+                }
+            iUIStoreIf->PopupMsg( info, KNullDesC, 0 );
+            break;
+            }
+        }
+    if( err != KErrNone )
+        {
+        iUIStoreIf->PopupMsg( _L("Starting without ini-file"), 
+                              KNullDesC,  0);
+        aIni.Zero();            
+        }
+
+    fs.Close();    
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: ParseTestSetName
+
+    Description: Parses test set name from test set filename.
+
+    Parameters: const TDesC& aSetFileName: in: Test set filename
+                TPtrC& aSetName: out: testset name
+                TFileName& aFileName: in: filenamebuffer
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::ParseTestSetName( const TDesC& aSetFileName, 
+                                 TPtrC& aSetName,
+                                 TFileName& aFileName )
+    {
+    if( aSetFileName.Length() > KMaxFileName )
+        {
+        return KErrArgument;
+        }
+    
+    aFileName.Copy( aSetFileName );
+    TParsePtr p( aFileName );
+    aSetName.Set( p.NameAndExt() ); // gives test set name without path
+    
+    if( aSetName.Length() > KMaxName )
+        {
+        return KErrArgument;
+        }
+    
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: RemotePopup
+
+    Description: Do remote message popup 
+
+    Parameters: const TDesC& aReq: in: request
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::RemotePopup( CUIEngineContainer* aContainer,
+                            const TDesC& aMsg, 
+                            CStifTFwIfProt* aResp,
+                            TPopupPriority aPopupPriority )
+    {
+    TInt ret = KErrNone;
+    
+    CUIStorePopup* popup = NULL;
+    TRAP( ret, popup = CUIStorePopup::NewL( this, aContainer, aResp, aPopupPriority, aMsg ); );
+    if( ret != KErrNone )
+        {
+        return ret;
+        }
+    ret = iPopups.Append( popup );
+    if( ret != KErrNone )
+        {
+        delete popup;
+        return ret;
+        }
+                
+    // We'll put new popup to the top if there are no popups active or if
+    // currently active popup has lower priority than the new one               
+    if( !iPopupActive || iActivePopupPriority > popup->GetPriority() ) 
+        {       
+        SetRemotePopupFromQueue();
+        }
+
+    return ret;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: SetRemotePopupFromQueue
+
+    Description: Prints the highest priority popup to the UI from the popup 
+    queue
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft @js
+
+-------------------------------------------------------------------------------
+*/
+
+void CUIStore::SetRemotePopupFromQueue()
+    {
+    CUIStorePopup* popup = NULL;
+    
+    if(iPopups.Count() > 0 )
+        {        
+        TInt highest = 0;
+        
+        // Let's get the highest priority popup and print it to the UI
+        for( TInt x=0; x<iPopups.Count(); x++)
+            {            
+            if( iPopups[x]->GetPriority() < iPopups[highest]->GetPriority() )    
+                {
+                highest = x;
+                }
+            }
+        
+        popup = iPopups[highest];
+        
+        if( popup == NULL )
+            {
+            // Some weird error
+            iPopupActive = EFalse;
+            return;        
+            }
+        
+        // Change the active popup priority        
+        iActivePopupPriority = popup->GetPriority();             
+                
+        // Create proper popup        
+        if( popup->GetPriority() == EPopupPriorityHighest )
+            {                                 
+            popup->Start( popup->GetMessage().Right( popup->GetMessage().Length() - KRcpHeaderLen ),
+                _L("Press any key to send 'remote run started' message"));                                  
+            }
+        else if( popup->GetPriority() == EPopupPriorityNormal )
+            {
+            popup->Start( popup->GetMessage().Right( popup->GetMessage().Length() - KRcpHeaderLen ),
+                _L("Press any key to set event") );        
+            }
+        else if( popup->GetPriority() == EPopupPriorityLow )
+            {           
+            popup->Start( popup->GetMessage().Right( popup->GetMessage().Length() - KRcpHeaderLen ),
+                _L("Press 1-9 to return negative error value, a to switch to another remote run result popup, or any other key to return 0") );                                    
+            }
+            
+        iPopupActive = ETrue;                                
+        }
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: ShuffleRemoteRunResultPopups
+
+    Description: Shuffle remote run result popups 
+
+    Parameters: CUIStorePopup* aPopup (currently active popup)
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft @js
+
+-------------------------------------------------------------------------------
+*/
+void CUIStore::ShuffleRemoteRunResultPopups( CUIStorePopup* aPopup )
+    {    
+    TInt nextPopupId = -1;
+    
+    for( TInt x=0; x<iPopups.Count(); x++)
+        {            
+        // Lets find the next remote run result priority popup
+        if( iPopups[x]->GetPriority() == EPopupPriorityLow && iPopups[x] != aPopup )    
+            {
+            nextPopupId = x;
+            break;
+            }
+        }
+    
+    if( nextPopupId == -1 )            
+        {
+        // We'll print error message popup, because there weren't any other remote run 
+        // result popups active
+
+        iUIStoreIf->PopupMsg( 
+            _L("Error! There weren't any other remote run result popups active."), 
+            _L(""), 
+            5 );        
+        User::After( 5000000 );
+        iPopups.Append( aPopup );
+        SetRemotePopupFromQueue();
+        return;
+        }
+
+    // We'll add the popup to the end of the array    
+    TInt ret = iPopups.Append( aPopup );
+        
+    if( ret != KErrNone )
+        {
+        delete aPopup;
+        return;
+        }
+        
+    // Print the next popup from queue
+    SetRemotePopupFromQueue();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: RemotePopup
+
+    Description: Do remote message popup 
+
+    Parameters: const TDesC& aReq: in: request
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStore::RemotePopupComplete( CUIStorePopup* aPopup, 
+                                    TInt aError,
+                                    CUIEngineContainer* aContainer,
+                                    CStifTFwIfProt* aResp,
+                                    TKeyCode aKeyCode )
+    {
+    
+    TInt ret = KErrNone;
+    TInt index = iPopups.Find( aPopup );
+    if( index < 0 )
+        {
+        User::Panic( KUIStore, KErrGeneral );
+        }
+    iPopups.Remove( index );   
+
+    iPopupActive = EFalse;
+    iActivePopupPriority = EPopupPriorityLow;
+
+    if( aError != KErrNone )
+        {
+        ret = aError;
+        }
+    else
+        {
+        TChar c( aKeyCode );
+        if( c.IsDigit() )
+            {
+            // Solve return value
+            ret = -( aKeyCode - '0' );
+            }
+        else
+            {
+            ret = KErrNone;
+            }
+        }
+    // If aResp is given, send it
+    if( aResp )
+        {     
+        switch( aResp->iCmdType )
+            {
+            case CStifTFwIfProt::ECmdRun:
+                {
+                TChar response( aKeyCode );  
+                RDebug::Print(_L("CUIStore::RemotePopupComplete: user pressed key %c"), (char)response);
+                  
+                if( aPopup->GetPriority() == EPopupPriorityHighest )
+                    {                                        
+                    // User has given response to remote run started- popup
+                    aResp->Append( CStifTFwIfProt::RunStatus, 
+                      CStifTFwIfProt::ERunStarted );                      
+                    }                
+                else if( aPopup->GetPriority() == EPopupPriorityLow &&  response=='a' )
+                    {                                        
+                    // User wants to change current remote run result popup to other
+                    // remote run result popup. 
+                    
+                    ShuffleRemoteRunResultPopups( aPopup );                             
+                    return KErrNone;
+                    }
+                else 
+                    {                                    
+                    // The test case result was given
+                    aResp->Append( CStifTFwIfProt::RunStatus, 
+                               CStifTFwIfProt::ERunReady );
+                    if( ret != KErrNone )
+                        {
+                        aResp->Append( CStifTFwIfProt::RunStatusParams, 
+                                       CStifTFwIfProt::ERunResult, ret );
+                        }                   
+                    }
+                break;
+                }
+            case CStifTFwIfProt::ECmdSendReceive:
+                {
+                aResp->Append( CStifTFwIfProt::RunStatus, 
+                               CStifTFwIfProt::ERunReady );
+                if( ret != KErrNone )
+                    {
+                    aResp->Append( CStifTFwIfProt::RunStatusParams, 
+                                   CStifTFwIfProt::ERunResult, ret );
+                    }
+                break;
+                }
+            case CStifTFwIfProt::ECmdPause:
+            case CStifTFwIfProt::ECmdResume:
+            case CStifTFwIfProt::ECmdCancel:
+            case CStifTFwIfProt::ECmdRequest:
+            case CStifTFwIfProt::ECmdRelease:
+            default:
+                if( ret != KErrNone )
+                    {
+                    aResp->Append( CStifTFwIfProt::RespParam, 
+                                   CStifTFwIfProt::ERespResult, 
+                                   ret );
+                    }
+                break;
+            }
+        
+        ret = aContainer->RemoteReceive( aResp->Message() ); 
+        }
+                
+    delete aPopup;      
+    
+    SetRemotePopupFromQueue();
+    
+    return ret;
+              
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStore
+
+    Method: ReadFiltersL
+
+    Description: Reads filters from test framework initialization file.
+        
+    Parameters: RPointerArray<TDesC>& aFilters: array to be filled
+
+    Return Values: None
+
+    Errors/Exceptions: 
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CUIStore::ReadFiltersL(RPointerArray<TDesC>& aFilters)
+    {
+    // Clean array
+    aFilters.ResetAndDestroy();
+    
+    // Locate file
+    _LIT(KFilterSectionStart, "[Filters]");
+    _LIT(KFilterSectionEnd, "[End_Filters]");
+    _LIT(KFilterDefinition, "filter=");
+
+    // Parse initialization file
+    TInt err = KErrNone;
+    CStifParser* parser;
+    
+    RDebug::Print(_L("STIF: Try to read filters from [%S]"), &iTestFrameworkIni);
+    parser = CStifParser::NewL(KNullDesC, iTestFrameworkIni);
+    CleanupStack::PushL(parser);
+
+    // Parser created (file exists), create section parser
+    CStifSectionParser* section;
+    section = parser->SectionL(KFilterSectionStart, KFilterSectionEnd);
+    if(section)
+        {
+        CleanupStack::PushL(section);
+            
+        // Get item lines
+        CStifItemParser* item = section->GetItemLineL(KFilterDefinition, ENoTag);
+            
+        TPtrC ptr;
+            
+        while(item)
+            {
+            CleanupStack::PushL(item);
+                
+            // Read filter value
+            err = item->GetString(KNullDesC, ptr);
+            if(err == KErrNone)
+                {
+                HBufC* filter = ptr.AllocLC();
+                User::LeaveIfError(aFilters.Append(filter));
+                CleanupStack::Pop();
+                }
+                
+            CleanupStack::PopAndDestroy(item);
+            item = NULL;
+            item = section->GetNextItemLineL(KFilterDefinition, ENoTag);
+            }
+            
+        CleanupStack::PopAndDestroy(section);
+        }
+        
+    // Clean
+    CleanupStack::PopAndDestroy(parser);
+
+    // If there are some filters added, first filter has to be "No filter"
+    if(aFilters.Count() > 0)
+        {
+        RDebug::Print(_L("STIF: Filters loaded"));
+        _LIT(KNoFilter, "No filter");
+        HBufC* name = KNoFilter().AllocLC();
+        User::LeaveIfError(aFilters.Insert(name, 0));
+        CleanupStack::Pop(name);    
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CUIStoreIf class member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStoreIf
+
+    Method: ConstructL
+
+    Description: Second phase constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if..
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C void CUIStoreIf::ConstructL( )
+    {
+    
+    iUIStore = CUIStore::NewL( this );
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStoreIf
+
+    Method: CUIStoreIf
+
+    Description: Constructor.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CUIStoreIf::CUIStoreIf( )
+    {
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStoreIf
+
+    Method: ~CUIStoreIf
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CUIStoreIf::~CUIStoreIf()
+    {	
+    
+    delete iUIStore;
+    iUIStore = NULL;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStoreIf
+
+    Method: UIStore
+
+    Description: Returns reference to CUIStore object, which handles test 
+                 cases and test modules.
+        
+    Parameters: None
+
+    Return Values: CUIStore reference
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CUIStore& CUIStoreIf::UIStore()
+    {
+    
+    __ASSERT_ALWAYS( iUIStore, User::Panic( KUIStoreIf, KErrNotFound ) );
+        
+    return *iUIStore;
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestSetInfo class member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: NewL
+
+    Description: Construct the CTestSetInfo class
+
+    Parameters: None
+
+    Return Values: CTestSetInfo*                    New object
+
+    Errors/Exceptions: Leaves if memory allocation fails or
+                       ConstructL leaves.
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetInfo* CTestSetInfo::NewL( const TDesC& aName )
+    {
+    
+    CTestSetInfo* self = new ( ELeave ) CTestSetInfo();
+    CleanupStack::PushL( self );
+    self->ConstructL( aName );
+    CleanupStack::Pop( self );
+
+    return self;
+
+    }
+            
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: ConstructL
+
+    Description: Second phase constructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if..
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetInfo::ConstructL( const TDesC& aName )
+    {
+    
+    iName = aName.AllocL();
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: CTestSetInfo
+
+    Description: Constructor.
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetInfo::CTestSetInfo()
+    {
+    iLastStartedCaseIndex = 0;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: ~CTestSetInfo
+
+    Description: Destructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestSetInfo::~CTestSetInfo()
+    {	
+    
+    iTestCases.ResetAndDestroy();
+    iTestCaseRefs.Reset();
+    iTestCases.Close();
+    iTestCaseRefs.Close();
+    
+    delete iName;
+    iName = NULL;
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: AddTestCase
+
+    Description: Add test case to test set.
+        
+    Parameters: const CTestInfo& aTestInfo: in: test info
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetInfo::AddTestCase( const CTestInfo& aTestInfo )
+    {
+    
+    CTestInfo* testInfo = NULL;
+    
+    TRAPD( err, 
+        testInfo = CTestInfo::NewL();
+        testInfo->CopyL( aTestInfo );
+        );
+    if( err != KErrNone )
+        {
+        return err;
+        }
+
+    if( iTestCaseRefs.Append( *testInfo ) != KErrNone )
+        {
+        delete testInfo;
+        return KErrNoMemory;        
+        }
+    if( iTestCases.Append( testInfo ) != KErrNone ) 
+        {
+        iTestCaseRefs.Remove( iTestCaseRefs.Count()-1 );
+        delete testInfo;
+        return KErrNoMemory;
+        }
+
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: InsertTestCase
+
+    Description: Insert test case to test set.
+        
+    Parameters: const CTestInfo& aTestInfo: in: test info
+                TInt aPos: in: position to add
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetInfo::InsertTestCase( const CTestInfo& aTestInfo, TInt aPos )
+    {
+    
+    if( ( aPos < 0 ) ||
+        ( aPos >= iTestCases.Count() ) )
+        {
+        return KErrArgument;
+        }
+    
+    CTestInfo* testInfo = NULL;
+    
+    TRAPD( err, 
+        testInfo = CTestInfo::NewL();
+        testInfo->CopyL( aTestInfo );
+        );
+    if( err != KErrNone )
+        {
+        return err;
+        }
+     
+    if( iTestCaseRefs.Insert( *testInfo, aPos ) != KErrNone )
+        {
+        delete testInfo;
+        return KErrNoMemory;        
+        }
+    if( iTestCases.Insert( testInfo, aPos ) != KErrNone )
+        {
+        iTestCaseRefs.Remove( aPos );
+        delete testInfo;
+        return KErrNoMemory;
+        }
+    
+    return err;
+        
+    }
+        
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: RemoveTestCase
+
+    Description: Remove test case from test set.
+        
+    Parameters: const CTestInfo& aTestInfo: in: test info
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CTestSetInfo::RemoveTestCase( const CTestInfo& aTestInfo )
+    {
+    
+    TInt count = iTestCases.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aTestInfo == *iTestCases[i] )
+            {
+            CTestInfo* testInfo = iTestCases[i];
+            iTestCases.Remove( i );
+            iTestCaseRefs.Remove( i );
+            delete testInfo;
+            return KErrNone;
+            }
+        }
+
+    return KErrNotFound;
+    
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: CopyL
+
+    Description: Remove test case from test set.
+        
+    Parameters: const CTestInfo& aTestInfo: in: test info
+
+    Return Values: Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetInfo::CopyL( const CTestSetInfo& aTestSetInfo )
+    {
+    
+    iTestCaseRefs.Reset();
+    iTestCases.ResetAndDestroy();
+    
+    TInt count = aTestSetInfo.TestCases().Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        User::LeaveIfError( AddTestCase( aTestSetInfo.TestCases()[i] ) );
+        }
+    
+    delete iName;
+    iName = 0;    
+    iName = aTestSetInfo.Name().AllocL(); 
+    
+    iLastStartedCaseIndex = aTestSetInfo.iLastStartedCaseIndex;
+         
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: SetLastStartedCaseIndex
+
+    Description: Sets the info which test case has been started lately.
+        
+    Parameters: TInt aCaseStarted: index of started test case
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CTestSetInfo::SetLastStartedCaseIndex(TUint aLastStartedCaseIndex)
+    {
+    iLastStartedCaseIndex = aLastStartedCaseIndex;
+    }    
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestSetInfo
+
+    Method: GetLastStartedCaseIndex
+
+    Description: Gets the info which test case has been started lately.
+        
+    Parameters: None
+
+    Return Values: TInt: index of lately started test case
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TUint CTestSetInfo::GetLastStartedCaseIndex(void)
+    {
+    return iLastStartedCaseIndex;
+    }    
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIStoreContainer.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,906 @@
+/*
+* 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: This module contains implementation of 
+* CStartedTestCase class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+#include <stifinternal/UIStoreContainer.h>
+#include <stifinternal/UIStore.h>
+
+#include "Logging.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+_LIT( KStartedTestCase, "CStartedTestCase" );
+_LIT( KStartedTestSet, "CStartedTestSet" );
+
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestCase
+
+    Method: NewL
+
+    Description: Create a testcase container.
+
+    Parameters: CTestInfo* aTestInfo: in: Test case info
+                CUIEngineContainer* aContainer: in: container
+
+    Return Values: CStartedTestCase* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestCase* CStartedTestCase::NewL( const CTestInfo& aTestInfo, 
+                                          CUIEngineContainer& aContainer )
+    {
+
+    CStartedTestCase* self = new ( ELeave ) CStartedTestCase( aContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL( aTestInfo );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestCase
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: CTestInfo* aTestInfo: Test case info
+    
+    Return Values: None
+
+    Errors/Exceptions: Leaves if CTestInfo copying fails
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CStartedTestCase::ConstructL( const CTestInfo& aTestInfo )
+    {
+
+    iTestInfo = CTestInfo::NewL();
+    iTestInfo->CopyL( aTestInfo );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestCase
+
+    Method: CStartedTestCase
+
+    Description: Constructor
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestCase::CStartedTestCase( CUIEngineContainer& aContainer ):
+    iContainer( &aContainer ),
+    iStatus( CUIStoreIf::EStatusRunning )
+    {
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestCase
+
+    Method: CStartedTestCase
+
+    Description: Private Constructor for internal use
+
+    Parameters: CTestInfo* aTestInfo: in: new testinfo
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestCase::CStartedTestCase( CTestInfo* aTestInfo, 
+                                    TFullTestResult aResult, 
+                                    TInt aStatus ):
+    iContainer( 0 ),
+    iTestInfo( aTestInfo ),
+    iResult( aResult ),
+    iStatus( aStatus )
+    {
+
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestCase
+
+    Method: ~CStartedTestCase
+
+    Description: Destructor.
+
+    Cancels the asynchronous request, deallocate memory and closes the testcase.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestCase::~CStartedTestCase()
+    {
+    
+    delete iTestInfo;
+    iPrints.ResetAndDestroy();
+    iPrints.Close();
+    
+    }
+ 
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestCase
+
+    Method: SetResult
+
+    Description: Set the result
+
+    Parameters: const TFullTestResult&     :in:      Result
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CStartedTestCase::SetResult(const TFullTestResult& aResult)
+    {
+
+    iResult = aResult;
+
+    iStatus = CUIStoreIf::EStatusExecuted;
+
+    switch( aResult.iCaseExecutionResultType )
+        {
+        case TFullTestResult::ECaseExecuted:
+            if( aResult.iTestResult.iResult == KErrNone )
+                {
+                iStatus |= CUIStoreIf::EStatusPassed;
+                }
+            else
+                {
+                iStatus |= CUIStoreIf::EStatusFailed;
+                }
+            break;
+        case TFullTestResult::ECaseCancelled:
+        case TFullTestResult::ECaseTimeout:
+        case TFullTestResult::ECaseSuicided:
+            iStatus |= CUIStoreIf::EStatusAborted;
+            break;
+        default:
+            iStatus |= CUIStoreIf::EStatusCrashed;
+            break;
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestCase
+
+    Method: UIEngineContainer
+
+    Description: Returns the UIEngineContainer
+
+    Parameters: None
+
+    Return Values: CUIEngineContainer& 
+
+    Errors/Exceptions: Panics if called for testcase that is not running
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CUIEngineContainer& CStartedTestCase::UIEngineContainer() const
+    { 
+    
+    if( !( iStatus & CUIStoreIf::EStatusRunning ) ) 
+        {
+        __RDEBUG( _L("CStartedTestCase::UIEngineContainer for test case that is not running"));
+        User::Panic( KStartedTestCase, KErrNotFound );
+        }
+    
+    return *iContainer;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CStartedTestSet class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: NewL
+
+    Description: Create a testcase container.
+
+    Parameters: const CTestSetInfo& aTestSetInfo: in: test set info
+                CUIStore::TSetType aType: in: set type
+
+    Return Values: CStartedTestSet* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestSet* CStartedTestSet::NewL( CUIStore* aUIStore, 
+                                        const CTestSetInfo& aTestSetInfo,
+                                        TSetType aType )
+    {
+
+    CStartedTestSet* self = new ( ELeave ) CStartedTestSet( aUIStore, aType );
+    CleanupStack::PushL( self );
+    self->ConstructL( aTestSetInfo );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: const CTestSetInfo& aTestSetInfo: in: Test set info
+    
+    Return Values: None
+
+    Errors/Exceptions: Leaves if CTestSetInfo copying fails
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CStartedTestSet::ConstructL( const CTestSetInfo& aTestSetInfo )
+    {
+
+    iTestSetInfo = CTestSetInfo::NewL( aTestSetInfo.Name() );
+    iTestSetInfo->CopyL( aTestSetInfo );
+
+    iOriginalTestSet = const_cast<CTestSetInfo*>(&aTestSetInfo);
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: CStartedTestSet
+
+    Description: Constructor
+
+    Parameters: CUIStore::TSetType aType: in: set type
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestSet::CStartedTestSet( CUIStore* aUIStore, 
+                                  TSetType aType ):
+    iUIStore( aUIStore ),
+    iResultSet( EFalse ),
+    iType( aType ),
+    iStatus( CUIStoreIf::ESetRunning ),
+    iNext( 0 ),
+    iRunningCases( 0 ),
+    iOriginalTestSet ( NULL )
+    {
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: ~CStartedTestSet
+
+    Description: Destructor.
+
+    Cancels the asynchronous request, deallocate memory and closes the testcase.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CStartedTestSet::~CStartedTestSet()
+    {
+    
+    delete iTestSetInfo;
+    iTestSetInfo = 0;
+    iTestCases.Reset();
+    iTestCases.Close();
+    
+    }
+ 
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: StartNext
+
+    Description: Start next testcase. 
+    
+    Parameters: None
+
+    Return Values: KErrNone: test case started
+                   KErrNotFound: no test cases found.
+                   Other Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStartedTestSet::StartNext()
+    {
+    TInt ret = KErrNone;
+    
+    TInt count = iTestSetInfo->TestCases().Count();
+    if( iNext >= count )
+        {
+        // All test cases running or completed, no more cases to start
+        return KErrNotFound;
+        }
+    
+    TInt index = 0;
+    if( iType == ESetSequential )
+        {
+        // Get test case index to be executed (when in NotExecutedCasesMode)
+        if(iNotStartedCasesMode)
+            {
+            iNext = iTestSetInfo->GetLastStartedCaseIndex();
+
+            if(iNext >= count)
+                {
+                // All test cases running or completed, no more cases to start
+                return KErrNotFound;
+                }
+
+            iTestSetInfo->SetLastStartedCaseIndex(iNext + 1);
+            if(iOriginalTestSet)
+                {
+                iOriginalTestSet->SetLastStartedCaseIndex(iNext + 1);
+                // Update only if original test set exists
+                iUIStore->UpdateTestSet(*iOriginalTestSet);
+                }
+            }
+
+        // Start next one and return
+        ret = iUIStore->StartTestCase( iTestSetInfo->TestCases()[iNext],
+                                       index );
+        if( ret != KErrNone )
+            {
+            return ret;
+            }
+        iNext++;
+        TRAPD( err,
+            CStartedTestCase& testCase = iUIStore->StartedTestCaseL( index );
+            ret = iTestCases.Append( testCase );
+            );
+        if( err != KErrNone )
+            {
+            User::Panic( KStartedTestSet, err );
+            }
+        }
+    else
+        {
+        // Start all cases
+        for( ; iNext<count; iNext++ )
+            {
+            ret = iUIStore->StartTestCase( iTestSetInfo->TestCases()[iNext],
+                                           index );
+            if( ret != KErrNone )
+                {
+                break;
+                }
+            TRAPD( err,
+                CStartedTestCase& testCase = iUIStore->StartedTestCaseL( index );
+                ret = iTestCases.Append( testCase );
+                iRunningCases++;
+                );
+            if( err != KErrNone )
+                {
+                User::Panic( KStartedTestSet, err );
+                }
+            if( ret != KErrNone )
+                {
+                break;
+                }
+            } 
+        }
+    
+    return ret;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: Abort
+
+    Description: Start next testcase. 
+    
+    Parameters: None
+
+    Return Values: KErrNone: test case started
+                   KErrNotFound: no test cases found.
+                   Other Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStartedTestSet::Abort()
+    {
+    
+    TInt ret = KErrNotFound;
+    TInt count = iTestCases.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( iTestCases[i].Status() & 
+            CUIStoreIf::EStatusRunning )
+            {
+            ret = iTestCases[i].UIEngineContainer().CancelTest();
+            if( ret != KErrNone )
+                {
+                break;
+                }
+            }
+        }
+    
+    // Prevent execution of remaining cases
+    count = iTestSetInfo->TestCases().Count();
+    iNext = count;
+    
+    return ret;  
+     
+    }
+    
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: IsRunning
+
+    Description: Check if test case running in this test set.
+    
+    Parameters: const CStartedTestCase* aTestCase: in: test case info
+
+    Return Values: ETrue: This test set is running specified test case
+                   EFalse: Not running
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TBool CStartedTestSet::IsRunning( const CStartedTestCase* aTestCase )
+    {
+    
+    TInt count = iTestCases.Count();
+    for( TInt i=0; i<count; i++ )
+        {
+        if( aTestCase == &iTestCases[i] )
+            {
+            return ETrue;
+            }
+        }
+        
+    return EFalse;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: TestCompleted
+
+    Description: Test from this set completed. Start next or 
+                set result for set.
+    
+    Parameters: const CStartedTestCase* aTestCase: in: test case info
+                TFullTestResult aResult: in: test result
+
+    Return Values:  Symbian OS error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CStartedTestSet::TestCompleted( const CStartedTestCase* aTestCase, 
+                                     TFullTestResult aResult )  
+    {
+    
+    TInt count = iTestCases.Count();
+    TInt index = 0;
+    for( ; index<count; index++ )
+        {
+        if( aTestCase == &iTestCases[index] )
+            {
+            break;
+            }
+        }
+    if( index == count )
+        {
+        return KErrNotFound;
+        }
+    
+    // Remove from running test cases
+    iRunningCases--;
+    
+    if( iResultSet == EFalse )
+        {
+        // Check test results
+        if( ( aResult.iCaseExecutionResultType != 
+              TFullTestResult::ECaseExecuted ) ||
+            ( aResult.iTestResult.iResult != KErrNone ) )
+            {
+            iResult = aResult; 
+            iResultSet = ETrue;
+            }
+        }
+        
+    // Start next test case
+    if( StartNext() == KErrNone )
+        {
+        // Test case was started
+        return KErrNone;
+        }
+    
+    if( iRunningCases > 0 )
+        {
+        // Test cases still running in test set
+        return KErrNone;
+        }
+    
+    iStatus = CUIStoreIf::ESetExecuted;
+    if( iResultSet == EFalse )
+        {  
+        // Use the result of last test case all 
+        // test cases where succesfull
+        iResult = aResult;
+        }
+        
+    // Set test case completed 
+    if( ( iResult.iCaseExecutionResultType != 
+          TFullTestResult::ECaseExecuted ) ||
+        ( iResult.iTestResult.iResult != KErrNone ) )
+        {
+        iStatus = CUIStoreIf::ESetFailed;               
+        }   
+    else
+        {
+        iStatus = CUIStoreIf::ESetPassed;
+        }
+        
+    return KErrNone;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: SetNotExecutedCasesMode
+
+    Description: Sets mode in which only not executed tests will be run.
+    
+    Parameters: TBool aNotExecutedCasesMode: desired mode
+
+    Return Values:  None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CStartedTestSet::SetNotStartedCasesMode(TBool aNotStartedCasesMode)
+    {
+    iNotStartedCasesMode = aNotStartedCasesMode;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: GetOriginalTestSet
+
+    Description: Returns pointer to original test set.
+    
+    Parameters: None
+
+    Return Values:  Pointer to original test set.
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CTestSetInfo* CStartedTestSet::GetOriginalTestSet()
+    {
+    return iOriginalTestSet;
+    }
+    
+/*
+-------------------------------------------------------------------------------
+
+    Class: CStartedTestSet
+
+    Method: NullOriginalTestSet
+
+    Description: Sets pointer to original test set to NULL.
+    
+    Parameters: None
+
+    Return Values:  None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CStartedTestSet::NullOriginalTestSet()
+    {
+    iOriginalTestSet = NULL;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains implementation of CTestProgress class 
+    member functions.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgress
+
+    Method: NewL
+
+    Description: Create CTestProgress.
+
+    Parameters: TTestProgress& aProgress: in: info from test module
+
+    Return Values: CTestProgress* : pointer to created object
+
+    Errors/Exceptions: Leaves if memory allocation for object fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestProgress* CTestProgress::NewL( const TTestProgress& aProgress )
+    {
+
+    CTestProgress* self = new ( ELeave ) CTestProgress();
+    CleanupStack::PushL( self );
+    self->ConstructL( aProgress );
+    CleanupStack::Pop( self );
+    return self;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgress
+
+    Method: ConstructL
+
+    Description: Second level constructor.
+
+    Parameters: TTestProgress& aProgress: in: print info
+    
+    Return Values: None
+
+    Errors/Exceptions: Leaves if TTestProgress copying fails
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestProgress::ConstructL( const TTestProgress& aProgress  )
+    {
+    
+    iPosition = aProgress.iPosition;
+    iDescriptionBuf = aProgress.iDescription.AllocL();
+    iTextBuf = aProgress.iText.AllocL();
+    iDescription.Set( iDescriptionBuf->Des() );
+    iText.Set( iTextBuf->Des() );
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgress
+
+    Method: ~CTestProgress
+
+    Description: Destructor.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CTestProgress::~CTestProgress()
+    {
+    
+    delete iTextBuf;
+    delete iDescriptionBuf;
+    
+    }
+ 
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestProgress
+
+    Method: ReplaceTextL
+
+    Description: Replace text with ne one.
+
+    Parameters: const TTestProgress& aProgress: in: new info
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CTestProgress::ReplaceTextL( const TTestProgress& aProgress )
+    {
+    
+    HBufC* tmp = iTextBuf;
+    iTextBuf = 0;
+    CleanupStack::PushL( tmp );
+    iTextBuf = aProgress.iText.AllocL();
+    iText.Set( iTextBuf->Des() );
+    CleanupStack::PopAndDestroy( tmp );
+    
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stfui/uiengine/src/UIStorePopup.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,310 @@
+/*
+* 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: CUIStorePopup: This object executes test cases 
+* from STIF Test Framework.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <stifinternal/UIStore.h>
+#include "UIStorePopup.h"
+#include "Logging.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+
+// MACROS
+#ifdef LOGGER
+#undef LOGGER
+#endif
+#define LOGGER iUIStore->iLogger
+
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ==================== LOCAL FUNCTIONS ======================================= 
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStorePopup
+
+    Method: CUIStorePopup
+
+    Description: Default constructor
+
+    C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+    
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIStorePopup::CUIStorePopup( CUIStore* aUIStore,
+                              CUIEngineContainer* aContainer,
+                              CStifTFwIfProt* aRemoteMsg,                             
+                              CUIStore::TPopupPriority aPopupPriority) :
+    CActive( CActive::EPriorityStandard ),
+    iUIStore( aUIStore ),
+    iRemoteMsg( aRemoteMsg ),
+    iContainer( aContainer ),
+    iPopupPriority( aPopupPriority )
+    {
+    __TRACE( KPrint, ( _L( "CUIStorePopup::CUIStorePopup") ) );
+    __ASSERT_ALWAYS( aUIStore, User::Panic( _L("Null pointer"), KErrGeneral ) );
+
+    CActiveScheduler::Add( this );
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStorePopup
+
+    Method: ConstructL
+
+    Description: Symbian OS second phase constructor
+
+    Symbian OS default constructor can leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if called Open method returns error
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CUIStorePopup::ConstructL( const TDesC& aMsg )
+    {    
+    iMsg = aMsg.AllocL();
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStorePopup
+
+    Method: NewL
+
+    Description: Two-phased constructor.
+    
+    Parameters: CUIStore* CUIStore: in: Pointer to CUIStore Interface
+                TTestInfo& aTestInfo: in: Test info
+
+    Return Values: CUIStorePopup* : Pointer to created runner object
+
+    Errors/Exceptions: Leaves if memory allocation for CUIStorePopup fails
+                       Leaves if ConstructL leaves
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIStorePopup* CUIStorePopup::NewL( CUIStore* aUIStore,
+                                    CUIEngineContainer* aContainer,
+                                    CStifTFwIfProt* aRemoteMsg,
+                                    CUIStore::TPopupPriority aPopupPriority,
+                                    const TDesC& aMsg )
+    {
+    
+    CUIStorePopup* self =  
+        new ( ELeave ) CUIStorePopup( aUIStore, aContainer, aRemoteMsg, aPopupPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMsg );
+    CleanupStack::Pop();
+    return self;
+    
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStorePopup
+
+    Method: ~CUIStorePopup
+
+    Description: Destructor
+    
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+CUIStorePopup::~CUIStorePopup()
+    {
+    __TRACE( KPrint, ( _L( "CUIStorePopup::~CUIStorePopup()") ) );
+    Cancel();
+    
+    delete iMsg;
+    delete iRemoteMsg;
+    
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStorePopup
+
+    Method: Start
+
+    Description: Call SETActive and return TRequestStatus member.
+
+    Parameters: None
+
+    Return Values: Symbian OS error code
+    
+    Errors/Exceptions: None
+    
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CUIStorePopup::Start( const TDesC& aLine1, 
+                           const TDesC& aLine2 )
+    {
+    __TRACE( KPrint, ( _L( "CUIStorePopup::Start") ) );
+    
+    if(IsActive())
+    { 
+        __TRACE( KPrint, ( _L( "CUIStorePopup already started") ) );
+       return KErrNone;  
+    }
+          
+    iPopupWindow = iUIStore->iUIStoreIf->PopupMsg( 
+        aLine1, aLine2, KDefaultPopupTimeout, iKey, iStatus );
+    
+    if( iPopupWindow < 0 )
+        {
+        return iPopupWindow;
+        }
+
+    SetActive();
+    return KErrNone;
+    
+    }
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStorePopup
+
+    Method: RunL
+
+    Description: RunL handles completed requests.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
+                       RunError called by CActiveObject
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIStorePopup::RunL()
+    {
+   
+    __TRACE( KPrint, ( _L( "CUIStorePopup::RunL") ) );
+    
+    iUIStore->RemotePopupComplete( this, iStatus.Int(), 
+                                   iContainer, iRemoteMsg, iKey );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CUIStorePopup
+
+    Method: DoCancel
+
+    Description: Cancel active request.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+void CUIStorePopup::DoCancel()
+    {
+    __TRACE( KPrint, ( _L( "CUIStorePopup::DoCancel") ) );
+    
+    iUIStore->iUIStoreIf->Close( iPopupWindow );
+        
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    CActiveTimer: This object prints running seconds to console screen.
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+
+
+// ================= OTHER EXPORTED FUNCTIONS ================================= 
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/CapsModifierXXX/CreateCapsModifier.bat	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,109 @@
+::
+:: 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: This file contains capsmodifier implementation.
+::
+
+@perl -x CreateCapsModifier.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 
+@goto end
+
+#!perl
+use strict;
+use File::Find;
+use File::Path;
+# Verify command line parameters
+if   ($#ARGV == -1 || $#ARGV > 1 )
+{
+	PrintHelp();
+}
+
+# Take module name
+my $moduleName = $ARGV[0];
+my $MODULENAME = $moduleName;
+$MODULENAME =~ tr/[a-z]/[A-Z]/;
+
+# Take target path or use default
+my $targetPath="\\";
+if ( $#ARGV == 1 )
+{
+	$targetPath = $ARGV[1];
+}
+
+
+# Create directory
+my $targetDir = $targetPath.$moduleName."_exe"."\\";
+
+print "Starting module creation to $targetDir\n";
+mkpath($targetDir, 1, 0777) || die ("Can't create directory $targetDir");
+
+# Loop through the file structure
+find(\&renamerename, '.');
+
+unlink $targetDir."CreateCapsModifier.bat";
+print "Module created to $targetDir\n";
+
+# This function will be called for each file or directory
+sub renamerename
+{
+	my $oldName = $_;
+	print "Processing $oldName\n";
+
+	# Construct new filename if that needed
+	s/CapsModifierXXX/$moduleName/i;
+	my $newName = $targetDir.$File::Find::dir."/".$_;  
+
+	# Process directories
+	if (opendir(DIR, $oldName))
+	{
+		closedir (DIR);
+	
+		mkdir $newName, 0777 || die ("Can't create directory $newName");
+		return;
+	}
+                        
+	# Open input file
+	open (INFILE, $oldName ) || die ("Can not find $oldName");
+
+	#Open output file
+	my $newOutput = $newName."new";
+	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
+
+	# Replace text in files
+	while (<INFILE>)
+	{
+	  s/CapsModifierXXX/$moduleName/g;
+	  print OUTFILE $_;
+	}
+
+	# Close filehandles
+	close (INFILE);
+	close (OUTFILE);
+
+	# Rename result file
+	rename $newOutput,$newName;
+}
+
+sub PrintHelp()
+{
+	print "CreateModule ModuleName [path]\n";
+	print "\n";
+	print "Creates a new capsmodifier module\n";
+	print "If [path] is not given, module is created to root of current drive.\n";
+	print "If [path] is given, it must contain the final \'\\\' in path name.\n";
+	print "Command must be executed in directory where the template exist.\n";
+	exit;
+}
+
+
+__END__
+:end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/CapsModifierXXX/group/CapsModifierXXX_exe.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,45 @@
+/*
+* 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: MMP file for STIF Test Framework's CapsModifier 
+* module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          CapsModifierXXX.exe
+TARGETTYPE      exe
+
+/* Specify the capabilities according to your test environment */
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+OS_LAYER_SYSTEMINCLUDE
+
+/* Source files */
+SOURCEPATH      ../src
+
+
+SOURCE          CapsModifierXXX_exe.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/CapsModifierXXX/group/CapsModifierXXX_exe.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+;
+; 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:
+;
+; 	Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; 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\CapsModifierXXX.exe"   -   "!:\Sys\Bin\CapsModifierXXX.exe"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/CapsModifierXXX/group/CapsModifierXXX_exe_nrm.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,44 @@
+/*
+* 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: MMP file for STIF Test Framework's CapsModifier 
+* module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          CapsModifierXXX.exe
+TARGETTYPE      exe
+
+/* Specify the capabilities according to your test environment */
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+OS_LAYER_SYSTEMINCLUDE
+
+/* Source files */
+SOURCEPATH      ../src
+
+SOURCE          CapsModifierXXX_exe.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/CapsModifierXXX/group/bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,39 @@
+/*
+* 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:
+*
+*	bld.inf Toplevel build information for STIF Test Framework's
+*	CapsModifierXXX capability modifier module.
+*/
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+	DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+	CapsModifierXXX_exe_nrm.mmp
+
+PRJ_TESTMMPFILES
+
+	CapsModifierXXX_exe.mmp
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/CapsModifierXXX/src/CapsModifierXXX_exe.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,64 @@
+/*
+* 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: This file contains capsmodifier implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <StifTestInterface.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: 
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+    _LIT( KProcessMsgStart, "New process starting" );
+    RDebug::Print( KProcessMsgStart );
+
+
+    // This starts a new session that get capabilites that is used in 
+    // CapsModifierXXX_exe.mmp file.
+    TInt r = StartSession();
+
+    _LIT( KProcessMsgEnd, "New process ends" );
+    RDebug::Print( KProcessMsgEnd );
+
+    return r;
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/Bmarm/HARDCODEDTESTMODULEXXXU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/Bwins/HARDCODEDTESTMODULEXXXU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/EABI/HardCodedTestModuleXXXU.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/createhardcodedmodule.bat	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,111 @@
+::
+:: 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: This file contains capsmodifier implementation.
+::
+
+@perl -x createhardcodedmodule.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 
+@goto end
+
+#!perl
+use strict;
+use File::Find;
+use File::Path;
+# Verify command line parameters
+if   ($#ARGV == -1 || $#ARGV > 1 )
+{
+	PrintHelp();
+}
+
+# Take module name
+my $moduleName = $ARGV[0];
+my $MODULENAME = $moduleName;
+$MODULENAME =~ tr/[a-z]/[A-Z]/;
+
+# Take target path or use default
+my $targetPath="\\";
+if ( $#ARGV == 1 )
+{
+	$targetPath = $ARGV[1];
+}
+
+
+# Create directory
+my $targetDir = $targetPath.$moduleName."\\";
+
+print "Starting module creation to $targetDir\n";
+mkpath($targetDir, 1, 0777) || die ("Can't create directory $targetDir");
+
+# Loop through the file structure
+find(\&renamerename, '.');
+
+unlink $targetDir."createhardcodedmodule.bat";
+print "Module created to $targetDir\n";
+
+# This function will be called for each file or directory
+sub renamerename
+{
+	my $oldName = $_;
+	print "Processing $oldName\n";
+
+	# Construct new filename if that needed
+	s/HardCodedTestModuleXXX/$moduleName/i;
+	my $newName = $targetDir.$File::Find::dir."/".$_;  
+
+	# Process directories
+	if (opendir(DIR, $oldName))
+	{
+		closedir (DIR);
+		mkdir $newName, 0777 || die ("Can't create directory $newName");
+		return;
+	}
+                        
+	# Open input file
+	open (INFILE, $oldName ) || die ("Can not find $oldName");
+
+	#Open output file
+	my $newOutput = $newName."new";
+	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
+
+	# Replace text in files
+	while (<INFILE>)
+	{
+	  s/HardCodedTestModuleXXX/$moduleName/g;
+	  s/HARDCODEDTESTMODULEXXX/$MODULENAME/g;
+	  s/XXX/$moduleName/g;
+	  s/HardCodedTargetDirYYY/$targetDir/g;
+	  print OUTFILE $_;
+	}
+
+	# Close filehandles
+	close (INFILE);
+	close (OUTFILE);
+
+	# Rename result file
+	rename $newOutput,$newName;
+}
+
+sub PrintHelp()
+{
+	print "createhardcodedmodule ModuleName [path]\n";
+	print "\n";
+	print "Creates a new test module\n";
+	print "If [path] is not given, module is created to root of current drive.\n";
+	print "If [path] is given, it must contain the final \'\\\' in path name.\n";
+	print "Command must be executed in directory where the template exist.\n";
+	exit;
+}
+
+
+__END__
+:end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/Bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+
+	DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in \epoc32\include
+// Example: 
+/*
+\agnmodel\inc\AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+
+	HardCodedTestModuleXXX.mmp
+
+PRJ_MMPFILES
+
+	HardCodedTestModuleXXX_nrm.mmp
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+\agnmodel\group\agnmodel.mmp
+#if defined(MARM)
+\agnmodel\group\agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,73 @@
+/*TYPE HARDCODED*/
+/*
+* 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: MMP file for STIF Test Framework's Hardcoded test 
+* module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          HardCodedTestModuleXXX.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         HardCodedTestModuleXXX.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          HardCodedTestModuleXXX.cpp
+SOURCE          HardCodedTestModuleXXXCases.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+;
+; 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:
+;
+; 	Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; 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\HardCodedTestModuleXXX.dll"   -   "!:\Sys\Bin\HardCodedTestModuleXXX.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX_DoxyFile.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,239 @@
+#
+# 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:
+#
+#
+
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = HardCodedTestModuleXXX
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = HardCodedTargetDirYYY
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = HardCodedTargetDirYYY
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX_nrm.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,73 @@
+/*TYPE HARDCODED*/
+/*
+* 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: MMP file for STIF Test Framework's Hardcoded test 
+* module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          HardCodedTestModuleXXX.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         HardCodedTestModuleXXX.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          HardCodedTestModuleXXX.cpp
+SOURCE          HardCodedTestModuleXXXCases.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/inc/HardCodedTestModuleXXX.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,345 @@
+/*
+* 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: STIF hardcoded module declaration
+*
+*/
+
+#ifndef HARDCODEDTESTMODULEXXX_H
+#define HARDCODEDTESTMODULEXXX_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include <NormalHardcodedAssert.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_MODULE_VERSION_MAJOR 0
+#define TEST_MODULE_VERSION_MINOR 0
+#define TEST_MODULE_VERSION_BUILD 0
+
+// Logging path
+_LIT( KHardCodedTestModuleXXXLogPath, "\\logs\\testframework\\HardCodedTestModuleXXX\\" ); 
+// Log file
+_LIT( KHardCodedTestModuleXXXLogFile, "HardCodedTestModuleXXX.txt" ); 
+_LIT( KHardCodedTestModuleXXXLogFileWithTitle, "HardCodedTestModuleXXX_[%S].txt" );
+
+#define GETPTR &
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CHardCodedTestModuleXXX;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+// A typedef for function that does the actual testing,
+// function is a type 
+// TInt CHardCodedTestModuleXXX::<NameOfFunction> ( TTestResult& aResult )
+typedef TInt (CHardCodedTestModuleXXX::* TestFunction)(TTestResult&);
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText*    iCaseName;
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {
+        };
+
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  This a HardCodedTestModuleXXX class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CHardCodedTestModuleXXX) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHardCodedTestModuleXXX* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHardCodedTestModuleXXX();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the 
+        *       HardCodedTestModuleXXX. It is called once for every instance of 
+        *       TestModuleXXX after its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of HardCodedTestModuleXXX.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from HardCodedTestModuleXXX. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& aFailureType, 
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        *
+        * User may add implementation for OOM test warning handling. Usually no
+        * implementation is required.           
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */); 
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        *
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+        
+        /**
+         * Method used to log version of test module
+         */
+        void SendTestModuleVersion();
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CHardCodedTestModuleXXX();
+
+        /**
+        * 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& );
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        /**
+        * [test case declarations] - do not remove
+        */
+        //ADD NEW METHOD DEC HERE"
+
+        /**
+        * Printing test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt PrintTest( TTestResult& aResult );
+
+        /**
+        * Printing loop test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt LoopTest( TTestResult& aResult );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+        // Pointer to logger
+        CStifLogger * iLog; 
+
+        // Normal logger
+        CStifLogger* iStdLog;
+
+        // Test case logger
+        CStifLogger* iTCLog;
+
+        // Flag saying if test case title should be added to log file name
+        TBool iAddTestCaseTitleToLogName;
+
+        // Flag saying if version of test module was already sent
+        TBool iVersionLogged;
+
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // HARDCODEDTESTMODULEXXX_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/src/HardCodedTestModuleXXX.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,442 @@
+/*
+* 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: This file contains Hardcoded module implementation.
+*
+*/
+
+
+// [INCLUDE FILES] - do not remove
+#include <Stiftestinterface.h>
+#include "HardCodedTestModuleXXX.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::CHardCodedTestModuleXXX
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CHardCodedTestModuleXXX::CHardCodedTestModuleXXX()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::ConstructL
+// Symbian 2nd phase constructor can leave.
+//
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CHardCodedTestModuleXXX::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+    iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle;
+
+    iStdLog = CStifLogger::NewL( KHardCodedTestModuleXXXLogPath, 
+                          KHardCodedTestModuleXXXLogFile);
+    iLog = iStdLog;
+
+    // Sample how to use logging
+    _LIT( KLogStart, "HardCodedTestModuleXXX logging starts!" );
+    iLog->Log( KLogStart );
+
+    iVersionLogged = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHardCodedTestModuleXXX* CHardCodedTestModuleXXX::NewL()
+    {
+    CHardCodedTestModuleXXX* self = new (ELeave) CHardCodedTestModuleXXX;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CHardCodedTestModuleXXX::~CHardCodedTestModuleXXX()
+    {
+    iLog = NULL;
+    delete iStdLog;
+    iStdLog = NULL;
+    delete iTCLog;
+    iTCLog = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CHardCodedTestModuleXXX::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CHardCodedTestModuleXXX::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; 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( Case(i).iCaseName );
+
+        // 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;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CHardCodedTestModuleXXX::RunTestCaseL( 
+    const TInt aCaseNumber,   
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+    if(!iVersionLogged)
+    	{
+    	SendTestModuleVersion();
+    	iVersionLogged = ETrue;
+    	}
+    
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    _LIT( KLogStartTC, "Starting testcase [%S]" );
+    iLog->Log( KLogStartTC, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        //Open new log file with test case title in file name
+        if(iAddTestCaseTitleToLogName)
+            {
+            //Delete test case logger if exists
+            if(iTCLog)
+                {
+                delete iTCLog;
+                iTCLog = NULL;
+                }
+
+            TFileName logFileName;
+            TName title;
+            TestModuleIf().GetTestCaseTitleL(title);
+        
+            logFileName.Format(KHardCodedTestModuleXXXLogFileWithTitle, &title);
+
+            iTCLog = CStifLogger::NewL(KHardCodedTestModuleXXXLogPath, 
+                                       logFileName);
+            iLog = iTCLog;                                       
+            }
+
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        //execStatus  = ( this->*iMethod )( aResult );
+        TRAPD(err, execStatus  = ( this->*iMethod )( aResult ));
+        if(iAddTestCaseTitleToLogName)
+            {
+            //Restore standard log and destroy test case logger
+            iLog = iStdLog;
+            delete iTCLog; //Close test case log
+            iTCLog = NULL;
+            }
+        User::LeaveIfError(err);
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+// -----------------------------------------------------------------------------
+//
+TBool CHardCodedTestModuleXXX::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt aCaseNumber, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& aFirstMemFailure, 
+                                TInt& aLastMemFailure ) 
+    {
+    _LIT( KLogOOMTestQueryL, "CHardCodedTestModuleXXX::OOMTestQueryL" );
+    iLog->Log( KLogOOMTestQueryL );     
+
+    aFirstMemFailure = Case( aCaseNumber ).iFirstMemoryAllocation;
+    aLastMemFailure = Case( aCaseNumber ).iLastMemoryAllocation;
+
+    return Case( aCaseNumber ).iIsOOMTest;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: User may add implementation for OOM test environment initialization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CHardCodedTestModuleXXX::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: User may add implementation for OOM test warning handling. Usually no
+// implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CHardCodedTestModuleXXX::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: User may add implementation for OOM test environment finalization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CHardCodedTestModuleXXX::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+//-----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::SendTestModuleVersion
+// Method used to send version of test module
+//-----------------------------------------------------------------------------
+//
+void CHardCodedTestModuleXXX::SendTestModuleVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("HardCodedTestModuleXXX.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CHardCodedTestModuleXXX::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/HardCodedTestModuleXXX/src/HardCodedTestModuleXXXCases.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,270 @@
+/*
+* 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: This file contains hardcoded module implementation.
+*
+*/
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32math.h>
+#include "HardCodedTestModuleXXX.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::Case
+// Returns a test case by number.
+//
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+// 
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// -----------------------------------------------------------------------------
+//
+const TCaseInfo CHardCodedTestModuleXXX::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /**
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    HardCodedTestModuleXXX.cpp file and to HardCodedTestModuleXXX.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // [test cases entries] - do not remove
+        
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g. 
+        // CHardCodedTestModuleXXX::PrintTest. Otherwise the compiler
+        // gives errors.
+        
+        FUNCENTRY( CHardCodedTestModuleXXX::PrintTest ),
+        ENTRY( "Loop test", CHardCodedTestModuleXXX::LoopTest ),
+        // Example how to use OOM functionality
+        //OOM_ENTRY( "Loop test with OOM", CHardCodedTestModuleXXX::LoopTest, ETrue, 2, 3),
+        //OOM_FUNCENTRY( CHardCodedTestModuleXXX::PrintTest, ETrue, 1, 3 ),
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::PrintTest
+// Simple printing to UI test.
+// -----------------------------------------------------------------------------
+//
+TInt CHardCodedTestModuleXXX::PrintTest( 
+    TTestResult& aResult )
+    {
+     /* Simple print test */
+    _LIT( KPrintTest, "PrintTest" );
+    _LIT( KEnter, "Enter" );
+    _LIT( KOnGoing, "On-going" );
+    _LIT( KExit, "Exit" );
+
+    TestModuleIf().Printf( 0, KPrintTest, KEnter );
+           
+    TestModuleIf().Printf( 1, KPrintTest, KOnGoing );
+    
+    TestModuleIf().Printf( 0, KPrintTest, KExit );
+
+    // Test case passed
+
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "PrintTest passed" );
+    aResult.SetResult( KErrNone, KDescription );
+
+    // Case was executed
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CHardCodedTestModuleXXX::LoopTest
+// Another printing to UI test.
+// -----------------------------------------------------------------------------
+//
+TInt CHardCodedTestModuleXXX::LoopTest( TTestResult& aResult )
+    {
+
+    /* Simple print and wait loop */
+    _LIT( KState, "State" );
+    _LIT( KLooping, "Looping" );
+
+    TestModuleIf().Printf( 0, KState, KLooping );
+
+    _LIT( KRunning, "Running" );
+    _LIT( KLoop, "%d" );
+    for( TInt i=0; i<10; i++)
+        {
+        TestModuleIf().Printf( 1, KRunning, KLoop, i);
+        User::After( 1000000 );
+        }
+
+    _LIT( KFinished, "Finished" );
+    TestModuleIf().Printf( 0, KState, KFinished );
+
+    // Test case passed
+
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "LoopTest passed" );
+    aResult.SetResult( KErrNone, KDescription );
+
+    // Case was executed
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?classname::?member_function(
+   ?arg_type arg,
+   ?arg_type arg )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ?function_name implements...
+// ?implementation_description.
+// Returns: ?value_1: ?description
+//          ?value_n: ?description
+//                    ?description
+// -----------------------------------------------------------------------------
+//
+/*
+?type  ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg )  // ?description
+    {
+
+    ?code
+
+    }
+*/
+//  [End of File] - do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/CreateKernelTestClass.bat	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,111 @@
+::
+:: 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: This file contains capsmodifier implementation.
+::
+
+@perl -x CreateKernelTestClass.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 
+@goto end
+
+#!perl
+use strict;
+use File::Find;
+use File::Path;
+# Verify command line parameters
+if   ($#ARGV == -1 || $#ARGV > 1 )
+{
+	PrintHelp();
+}
+
+# Take module name
+my $moduleName = $ARGV[0];
+my $MODULENAME = $moduleName;
+$MODULENAME =~ tr/[a-z]/[A-Z]/;
+
+# Take target path or use default
+my $targetPath="\\";
+if ( $#ARGV == 1 )
+{
+	$targetPath = $ARGV[1];
+}
+
+
+# Create directory
+my $targetDir = $targetPath.$moduleName."\\";
+
+print "Starting module creation to $targetDir\n";
+mkpath($targetDir, 1, 0777) || die ("Can't create directory $targetDir");
+
+# Loop through the file structure
+find(\&renamerename, '.');
+
+unlink $targetDir."CreateKernelTestClass.bat";
+print "Module created to $targetDir\n";
+
+# This function will be called for each file or directory
+sub renamerename
+{
+	my $oldName = $_;
+	print "Processing $oldName\n";
+
+	# Construct new filename if that needed
+	s/TemplateKernelScriptXXX/$moduleName/i;
+	my $newName = $targetDir.$File::Find::dir."/".$_;  
+
+	# Process directories
+	if (opendir(DIR, $oldName))
+	{
+		closedir (DIR);
+		mkdir $newName, 0777 || die ("Can't create directory $newName");
+		return;
+	}
+                        
+	# Open input file
+	open (INFILE, $oldName ) || die ("Can not find $oldName");
+
+	#Open output file
+	my $newOutput = $newName."new";
+	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
+
+	# Replace text in files
+	while (<INFILE>)
+	{
+	  s/TemplateKernelScriptXXX/$moduleName/g;
+	  s/TEMPLATEKERNELSCRIPTXXX/$MODULENAME/g;
+	  s/XXX/$moduleName/g;
+	  s/TemplateKernelScriptTargetDirYYY/$targetDir/g;
+	  print OUTFILE $_;
+	}
+
+	# Close filehandles
+	close (INFILE);
+	close (OUTFILE);
+
+	# Rename result file
+	rename $newOutput,$newName;
+}
+
+sub PrintHelp()
+{
+	print "CreateScriptModule ScriptModuleName [path]\n";
+	print "\n";
+	print "Creates a new test module\n";
+	print "If [path] is not given, module is created to root of current drive.\n";
+	print "If [path] is given, it must contain the final \'\\\' in path name.\n";
+	print "Command must be executed in directory where the template exist.\n";
+	exit;
+}
+
+
+__END__
+:end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/conf/TemplateKernelScriptXXX.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,8 @@
+[Test]
+title Example
+createkernel TemplateKernelScriptXXX foobar
+foobar Example pa ra me ters
+delete foobar
+[Endtest] 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/Bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,64 @@
+/*
+* 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:
+*
+*/
+
+//
+// TO DO: (mandatory)
+//
+// Add here a definition for your port (as declared in E32PLAT.PM)
+//
+// WINSCW added for debugging test programs
+PRJ_PLATFORMS
+
+	WINSCW
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in \epoc32\include
+// Example: 
+/*
+\agnmodel\inc\AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+
+	TemplateKernelScriptXXX.mmp
+
+PRJ_MMPFILES
+
+	TemplateKernelScriptXXX_nrm.mmp
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+\agnmodel\group\agnmodel.mmp
+#if defined(MARM)
+\agnmodel\group\agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,48 @@
+/*
+* 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: MMP file for STIF Test Framework's Kernel testclass 
+* test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+#include        "kernel/kern_ext.mmh"
+
+CAPABILITY      ALL
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+
+TARGET          TemplateKernelScriptXXX.ldd
+TARGETTYPE      ldd
+UID             0x100000af 0x101FB3E3
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          TemplateKernelScriptXXX.cpp
+SOURCE          TemplateKernelScriptXXXBlocks.cpp
+
+LIBRARY         ekern.lib
+
+
+LIBRARY         StifKernelTestClassBase.lib
+
+LANG            SC
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+;
+; 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:
+;
+; 	Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; 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_abiv2\udeb\TemplateKernelScriptXXX.ldd"   -   "!:\Sys\Bin\TemplateKernelScriptXXX.ldd"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX_DoxyFile.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,239 @@
+#
+# 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:
+#
+#
+
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = TemplateKernelScriptXXX
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = TemplateKernelScriptTargetDirYYY
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = TemplateKernelScriptTargetDirYYY
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX_nrm.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,48 @@
+/*
+* 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: MMP file for STIF Test Framework's Kernel testclass 
+* module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+#include        "kernel/kern_ext.mmh"
+
+CAPABILITY      ALL
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+
+TARGET          TemplateKernelScriptXXX.ldd
+TARGETTYPE      ldd
+UID             0x100000af 0x101FB3E3
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          TemplateKernelScriptXXX.cpp
+SOURCE          TemplateKernelScriptXXXBlocks.cpp
+
+LIBRARY         ekern.lib
+
+
+LIBRARY         StifKernelTestClassBase.lib
+
+LANG            SC
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/inc/TemplateKernelScriptXXX.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,103 @@
+/*
+* 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: Kernel testclass declaration
+*
+*/
+
+#ifndef TEMPLATEKERNELSCRIPTXXX_H
+#define TEMPLATEKERNELSCRIPTXXX_H
+
+//  INCLUDES
+#include <StifKernelTestClassBase.h>
+
+// CONSTANTS
+
+// MACROS
+_LIT( KDriverName, "TemplateKernelScriptXXX" );
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// DATA TYPES
+
+// CLASS DECLARATION
+
+// CLASS DECLARATION
+
+/**
+* DTemplateKernelScriptXXXDriver is the device driver factory that will
+* instantiate the physical channel, which is the actual
+* physical driver.
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class DTemplateKernelScriptXXXDriver : public DStifKernelTestClassBaseDriver
+    {
+
+    public:
+        DTemplateKernelScriptXXXDriver( const TDesC& aName ) :
+            DStifKernelTestClassBaseDriver( aName ){};
+
+    public:
+
+        // Logical Channel creation
+        TInt Create(DLogicalChannelBase*& aChannel);
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  DTemplateKernelScriptXXX is a kernel test class 
+*  for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class DTemplateKernelScriptXXX : public DStifKernelTestClassBase
+    {
+
+    public:
+        DTemplateKernelScriptXXX( DLogicalDevice* aDevice ) : 
+            DStifKernelTestClassBase( aDevice ){};
+        ~DTemplateKernelScriptXXX(){};
+
+    public:
+        // Derived class must implement, runs a script line        
+        TInt RunMethodL( const TDesC& aMethod, const TDesC& aParams );  
+
+        // Second phase constructor for DLogicalChannelBase object in EKA2
+        virtual TInt DoCreate( TInt aUnit, const TDesC8* aInfo, const TVersion& aVer );
+
+        // Called from destructor.
+        void Delete();
+
+    protected: 
+
+    private:
+        /**
+        * Test methods.
+        */
+        TInt ExampleL( const TDesC& aParams );
+
+    private:
+
+    };
+
+#endif      // TEMPLATEKERNELSCRIPTXXX_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/src/TemplateKernelScriptXXX.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,83 @@
+/*
+* 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: This file contains kernel testclass implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "TemplateKernelScriptXXX.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TInt DTSKernelTestDriver::Create(DLogicalChannelBase*& aChannel)
+// Creates the Logical Channel in EKA2
+// -----------------------------------------------------------------------------
+//
+TInt DTemplateKernelScriptXXXDriver::Create(DLogicalChannelBase*& aChannel)
+    {
+    aChannel = new DTemplateKernelScriptXXX( this );
+    return aChannel?KErrNone:KErrNoMemory;
+
+    }
+
+// -----------------------------------------------------------------------------
+// TInt DTSKernelTest::DoCreate
+// Second phase constructor for DLogicalChannelBase object in EKA2
+// -----------------------------------------------------------------------------
+//
+TInt DTemplateKernelScriptXXX::DoCreate( TInt /* aUnit */, 
+                                         const TDesC8* /* anInfo */, 
+                                         const TVersion& /* aVer */ )
+    {   
+    SetDfcQ(Kern::DfcQue0());
+    iMsgQ.Receive();
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// DECLARE_STANDARD_LDD()
+// EKA2 entry point
+// -----------------------------------------------------------------------------
+//
+DECLARE_STANDARD_LDD()
+    {
+    return new DTemplateKernelScriptXXXDriver( KDriverName );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateKernelScriptXXX/src/TemplateKernelScriptXXXBlocks.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,146 @@
+/*
+* 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: This file contains kernel testclass implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "TemplateKernelScriptXXX.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// DTemplateKernelScriptXXX::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void DTemplateKernelScriptXXX::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// DTemplateKernelScriptXXX::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// 
+// Note that in EKA2 methods cannot leave and therefore RunMethodL isn't leaving 
+// function dispite of its name!    
+// -----------------------------------------------------------------------------
+//
+TInt DTemplateKernelScriptXXX::RunMethodL( 
+    const TDesC& aMethod, 
+    const TDesC& aParams )  
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "Example", DTemplateKernelScriptXXX::ExampleL ),
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aMethod, aParams );
+
+    }
+
+// -----------------------------------------------------------------------------
+// DTemplateKernelScriptXXX::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt DTemplateKernelScriptXXX::ExampleL( 
+    const TDesC& aParams )
+    {
+    Kern::Printf( ("DTemplateKernelScriptXXX::ExampleL(%S)"), &aParams );             
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// DTemplateKernelScriptXXX::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+TInt DTemplateKernelScriptXXX::?member_function(
+   const TDesC& aParams )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/Bmarm/TEMPLATESCRIPTXXXU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/Bwins/TEMPLATESCRIPTXXXU.DEF	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/CreateTestClass.bat	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,111 @@
+::
+:: 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: This file contains capsmodifier implementation.
+::
+
+@perl -x createtestclass.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 
+@goto end
+
+#!perl
+use strict;
+use File::Find;
+use File::Path;
+# Verify command line parameters
+if   ($#ARGV == -1 || $#ARGV > 1 )
+{
+	PrintHelp();
+}
+
+# Take module name
+my $moduleName = $ARGV[0];
+my $MODULENAME = $moduleName;
+$MODULENAME =~ tr/[a-z]/[A-Z]/;
+
+# Take target path or use default
+my $targetPath="\\";
+if ( $#ARGV == 1 )
+{
+	$targetPath = $ARGV[1];
+}
+
+
+# Create directory
+my $targetDir = $targetPath.$moduleName."\\";
+
+print "Starting module creation to $targetDir\n";
+mkpath($targetDir, 1, 0777) || die ("Can't create directory $targetDir");
+
+# Loop through the file structure
+find(\&renamerename, '.');
+
+unlink $targetDir."CreateTestClass.bat";
+print "Module created to $targetDir\n";
+
+# This function will be called for each file or directory
+sub renamerename
+{
+	my $oldName = $_;
+	print "Processing $oldName\n";
+
+	# Construct new filename if that needed
+	s/TemplateScriptXXX/$moduleName/i;
+	my $newName = $targetDir.$File::Find::dir."/".$_;  
+
+	# Process directories
+	if (opendir(DIR, $oldName))
+	{
+		closedir (DIR);
+		mkdir $newName, 0777 || die ("Can't create directory $newName");
+		return;
+	}
+                        
+	# Open input file
+	open (INFILE, $oldName ) || die ("Can not find $oldName");
+
+	#Open output file
+	my $newOutput = $newName."new";
+	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
+
+	# Replace text in files
+	while (<INFILE>)
+	{
+	  s/TemplateScriptXXX/$moduleName/g;
+	  s/TEMPLATESCRIPTXXX/$MODULENAME/g;
+	  s/XXX/$moduleName/g;
+	  s/TemplateScriptTargetDirYYY/$targetDir/g;
+	  print OUTFILE $_;
+	}
+
+	# Close filehandles
+	close (INFILE);
+	close (OUTFILE);
+
+	# Rename result file
+	rename $newOutput,$newName;
+}
+
+sub PrintHelp()
+{
+	print "CreateScriptModule ScriptModuleName [path]\n";
+	print "\n";
+	print "Creates a new test module\n";
+	print "If [path] is not given, module is created to root of current drive.\n";
+	print "If [path] is given, it must contain the final \'\\\' in path name.\n";
+	print "Command must be executed in directory where the template exist.\n";
+	exit;
+}
+
+
+__END__
+:end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/EABI/TemplateScriptXXXU.def	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/conf/TemplateScriptXXX.cfg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,8 @@
+[Test]
+title Example
+create TemplateScriptXXX foobar
+foobar Example pa ra me ters
+delete foobar
+[Endtest] 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/Bld.inf	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+	
+	DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in \epoc32\include
+// Example: 
+/*
+\agnmodel\inc\AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+
+	TemplateScriptXXX.mmp
+
+PRJ_MMPFILES
+
+	TemplateScriptXXX_nrm.mmp
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+\agnmodel\group\agnmodel.mmp
+#if defined(MARM)
+\agnmodel\group\agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/TemplateScriptXXX.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,75 @@
+/*TYPE TESTCLASS*/
+/*
+* 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: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          TemplateScriptXXX.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         TemplateScriptXXX.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          TemplateScriptXXX.cpp
+SOURCE          TemplateScriptXXXBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/TemplateScriptXXX.pkg	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,60 @@
+;
+; 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:
+;
+; 	Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; 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\TemplateScriptXXX.dll"   -   "!:\Sys\Bin\TemplateScriptXXX.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/TemplateScriptXXX_DoxyFile.txt	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,239 @@
+#
+# 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:
+#
+#
+
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = TemplateScriptXXX
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = TemplateScriptTargetDirYYY
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = TemplateScriptTargetDirYYY
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/group/TemplateScriptXXX_nrm.mmp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,75 @@
+/*TYPE TESTCLASS*/
+/*
+* 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: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          TemplateScriptXXX.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         TemplateScriptXXX.def
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          TemplateScriptXXX.cpp
+SOURCE          TemplateScriptXXXBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/inc/TemplateScriptXXX.h	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,184 @@
+/*
+* 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: STIF testclass declaration
+*
+*/
+
+#ifndef TEMPLATESCRIPTXXX_H
+#define TEMPLATESCRIPTXXX_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( KTemplateScriptXXXLogPath, "\\logs\\testframework\\TemplateScriptXXX\\" ); 
+// Log file
+_LIT( KTemplateScriptXXXLogFile, "TemplateScriptXXX.txt" ); 
+_LIT( KTemplateScriptXXXLogFileWithTitle, "TemplateScriptXXX_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CTemplateScriptXXX;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  CTemplateScriptXXX test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CTemplateScriptXXX) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTemplateScriptXXX* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTemplateScriptXXX();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTemplateScriptXXX( 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_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt ExampleL( CStifItemParser& aItem );
+        
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // TEMPLATESCRIPTXXX_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/src/TemplateScriptXXX.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,199 @@
+/*
+* 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: This file contains testclass implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "TemplateScriptXXX.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTemplateScriptXXX::CTemplateScriptXXX
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTemplateScriptXXX::CTemplateScriptXXX( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTemplateScriptXXX::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CTemplateScriptXXX::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(KTemplateScriptXXXLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KTemplateScriptXXXLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KTemplateScriptXXXLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// CTemplateScriptXXX::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTemplateScriptXXX* CTemplateScriptXXX::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CTemplateScriptXXX* self = new (ELeave) CTemplateScriptXXX( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CTemplateScriptXXX::~CTemplateScriptXXX()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// CTemplateScriptXXX::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CTemplateScriptXXX::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("TemplateScriptXXX.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) CTemplateScriptXXX::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/TemplateScriptXXX/src/TemplateScriptXXXBlocks.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,162 @@
+/*
+* 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: This file contains testclass implementation.
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "TemplateScriptXXX.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTemplateScriptXXX::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CTemplateScriptXXX::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTemplateScriptXXX::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CTemplateScriptXXX::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "Example", CTemplateScriptXXX::ExampleL ),
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTemplateScriptXXX::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CTemplateScriptXXX::ExampleL( CStifItemParser& aItem )
+    {
+
+    // Print to UI
+    _LIT( KTemplateScriptXXX, "TemplateScriptXXX" );
+    _LIT( KExample, "In Example" );
+    TestModuleIf().Printf( 0, KTemplateScriptXXX, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+
+    TInt i = 0;
+    TPtrC string;
+    _LIT( KParam, "Param[%i]: %S" );
+    while ( aItem.GetNextString ( string ) == KErrNone )
+        {
+        TestModuleIf().Printf( i, KTemplateScriptXXX, 
+                                KParam, i, &string );
+        i++;
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTemplateScriptXXX::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+TInt CTemplateScriptXXX::?member_function(
+   CItemParser& aItem )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/testmoduletemplates/createtestmodule.bat	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,188 @@
+::
+:: 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: This file contains capsmodifier implementation.
+::
+
+@perl -x createtestmodule.bat %*
+@goto end
+
+#!perl -w
+use strict;
+use Term::ReadLine;
+
+my $moduletype = "";
+my $modulename = "";
+my $modulepath = "";
+
+
+my $hardcoded = "hardcoded";
+my $testclass = "testclass";
+my $kerneltestclass = "kerneltest";
+my $capsmodifier = "capsmodifier";
+
+
+my $hardcodedi = "h";
+my $testclassi = "t";
+my $kerneltestclassi = "k";
+my $capsmodifieri = "c";
+
+my $term = new Term::ReadLine 'Simple Perl calc';
+my $prompttype = "Enter ModuleType (name/short cut): ";
+my $promptname = "Enter ModuleName (or exit): ";  
+my $promptpath = "Enter path [default is drive root] (or exit): ";  
+my $exit = "exit";
+my $exiti = "e";   
+  
+sub PrintHelp();
+
+if ( $#ARGV >= 0 )
+{
+    $moduletype = $ARGV[0];
+    if( $moduletype eq "help" )
+    {
+    PrintHelp();
+    }
+}
+else
+{
+    print "Enter ModuleType :\n";
+	
+	print "\t($hardcodedi) $hardcoded = creates test module that uses hardcoded test cases.\n";
+	print "\t($testclassi) $testclass = creates test class which is used with TestScripter.\n";
+	print "\t($kerneltestclassi) $kerneltestclass = creates kernel test class which is used with TestScripter (only for kernel testing!).\n";
+	print "\t($capsmodifieri) $capsmodifier = creates capability modification module\n";
+  print "\t($exiti) $exit = Exit.\n";  
+
+
+    $moduletype = $term->readline($prompttype);
+    if( $moduletype eq $exit || $moduletype eq $exiti)
+    {
+        exit;
+    }
+}
+if(  $moduletype ne $hardcoded && $moduletype ne $testclass && $moduletype ne $kerneltestclass && $moduletype ne $capsmodifier  && $moduletype ne $hardcodedi && $moduletype ne $testclassi && $moduletype ne $kerneltestclassi && $moduletype ne $capsmodifieri )
+    {
+        print "\nInvalid module type\n";
+        print "See createtestmodule help\n";
+        exit;
+    }
+    
+if ( $#ARGV >= 1 )
+{
+    $modulename = $ARGV[1];
+}
+else
+{
+    
+	
+	if( $moduletype eq $hardcoded || $moduletype eq $hardcodedi )
+	{
+   	 	print "$hardcoded module selected.\n";
+	}
+	elsif( $moduletype eq $testclass || $moduletype eq $testclassi )
+	{
+  		print "$testclass module selected.\n";
+	}
+	elsif( $moduletype eq $kerneltestclass || $moduletype eq $kerneltestclassi )
+	{
+  		print "$kerneltestclass module selected.\n";
+	}
+	elsif( $moduletype eq $capsmodifier || $moduletype eq $capsmodifieri )
+	{
+ 		print "$capsmodifier module selected.\n";
+	}
+	
+	print "Enter ModuleName which has to be a valid C++ variable name.\n";
+    
+	$modulename = $term->readline($promptname);
+
+    if( $modulename eq $exit || $modulename eq $exiti)
+    {
+        exit;
+    }
+}
+if ( $#ARGV >= 2 )
+{
+    $modulepath = $ARGV[2];
+}
+else
+{
+    $modulepath = $term->readline($promptpath);
+    if( $modulepath eq $exit || $modulepath eq $exiti )
+    {
+        exit;
+    }
+}
+
+$modulepath.= "\\";
+
+print "Create test module of type $moduletype with name $modulename ";
+
+
+if ( $modulepath eq "" )
+{ 
+    print "to current drive root\n";
+}
+else
+{
+    print "to $modulepath\n";
+}
+
+my @args = ("$modulename", "$modulepath");
+
+
+if( $moduletype eq $hardcoded || $moduletype eq $hardcodedi )
+{
+    chdir "HardCodedTestModuleXXX";
+    system("perl -x createhardcodedmodule.bat @args");
+}
+elsif( $moduletype eq $testclass || $moduletype eq $testclassi )
+{
+    chdir "TemplateScriptXXX";
+    system("perl -x CreateTestClass.bat @args");
+}
+elsif( $moduletype eq $kerneltestclass || $moduletype eq $kerneltestclassi )
+{
+    chdir "TemplateKernelScriptXXX";
+    system("perl -x CreateKernelTestClass.bat @args");
+}
+
+elsif( $moduletype eq $capsmodifier || $moduletype eq $capsmodifieri )
+{
+    chdir "CapsModifierXXX";
+    system("perl -x CreateCapsModifier.bat @args");
+}
+
+
+
+exit;
+
+sub PrintHelp()
+{
+	print "CreateTestModule [ModuleType] [ModuleName] [path]\n";
+	print "\n";
+	print "Creates a new test module\n";
+	print "ModuleType defines the type of test module:.\n";
+  print "\thardcoded = creates test module that uses hardcoded test cases.\n";
+	print "\ttestclass = creates test class which is used with TestScripter.\n";
+	print "\tkerneltestclass = creates kernel test class which is used with TestScripter (only for kernel testing!).\n";
+	print "\tcapsmodifier = creates capability modification module\n";
+	print "If no arguments are given, they are asked from user.\n";
+	print "If [path] is given, it must contain the final \'\\\' in path name.\n";
+	print "Command must be executed in STIFTestFramework\\TestModuleTemplates directory\n";
+	exit;
+}
+
+__END__
+:end
Binary file testexecfw/stf/testmoduletemplates/testmoduletemplates.zip has changed