# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1264511793 -7200 # Node ID 9736f095102e85a4a5b665c748800eab4ce3c407 Revision: 201004 diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,28 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 automated smoketest +// + + +#include "../Utils/group/bld.inf" +#include "../agenda/Group/bld.inf" +#include "../contacts/group/bld.inf" +#include "../messaging/Group/bld.inf" +#include "../Timew/Group/bld.inf" +#include "../TestApps/Group/bld.inf" + +PRJ_TESTEXPORTS +../autorom/smoketests.oby /epoc32/rom/include/smoketests.oby + + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Group/testtools_autosmoketest.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Group/testtools_autosmoketest.mrp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +# + +component testtools_autosmoketest +source \sf\app\techview\buildverification\autosmoketest +exports \sf\app\techview\buildverification\autosmoketest\Group +# binary \sf\app\techview\buildverification\autosmoketest\group all + +notes_source \component_defs\release.src + +ipr T + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/TestApps/Scripts/smoketest_TestApps.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/TestApps/Scripts/smoketest_TestApps.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// +// Run smoke test steps to check for successful execution of apps + +LOAD_SUITE Smoketest_TestApp_Server + +RUN_UTILS MkDir c:\autosmoketest\ +RUN_UTILS CopyFile z:\autosmoketest\smoketest_TestApps.ini c:\autosmoketest\smoketest_TestApps.ini + + +START_TESTCASE RUN_PHONE_APP +RUN_TEST_STEP 100 Smoketest_TestApp_Server TestAppStep1 c:\autosmoketest\smoketest_TestApps.ini PhoneApp +END_TESTCASE RUN_PHONE_APP + + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/TestApps/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/TestApps/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -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: +* +*/ + + +PRJ_TESTEXPORTS + +../Scripts/smoketest_TestApps.script /epoc32/release/wins/udeb/z/autosmoketest/smoketest_TestApps.script +../Scripts/smoketest_TestApps.script /epoc32/release/wins/urel/z/autosmoketest/smoketest_TestApps.script +../Scripts/smoketest_TestApps.script /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_TestApps.script +../Scripts/smoketest_TestApps.script /epoc32/release/winscw/urel/z/autosmoketest/smoketest_TestApps.script + +../TestData/smoketest_TestApps.ini /epoc32/release/wins/udeb/z/autosmoketest/smoketest_TestApps.ini +../TestData/smoketest_TestApps.ini /epoc32/release/wins/urel/z/autosmoketest/smoketest_TestApps.ini +../TestData/smoketest_TestApps.ini /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_TestApps.ini +../TestData/smoketest_TestApps.ini /epoc32/release/winscw/urel/z/autosmoketest/smoketest_TestApps.ini + + + +PRJ_TESTMMPFILES +smoketest_TestApp.mmp diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/TestApps/group/smoketest_TestApp.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/TestApps/group/smoketest_TestApp.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +TARGET Smoketest_TestApp_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F777C +VENDORID 0x70000001 +CAPABILITY PowerMgmt // Required to kill running processes + +SOURCEPATH ..\src +SOURCE TestAppServer.cpp +SOURCE TestAppStep.cpp + +USERINCLUDE ..\inc +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY testexecuteutils.lib +LIBRARY efsrv.lib +LIBRARY testexecutelogclient.lib + +SMPSAFE diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/TestApps/inc/TestAppServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/TestApps/inc/TestAppServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +* +*/ + + +#if (!defined __TESTAPP_SERVER_H__) +#define __TESTAPP_SERVER_H__ +#include + +class CTestAppServer : public CTestServer + { +public: + static CTestAppServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + //RFs& Fs(){return iFs;}; + +private: + //RFs iFs; + }; +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/TestApps/inc/TestAppStep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/TestApps/inc/TestAppStep.h Tue Jan 26 15:16:33 2010 +0200 @@ -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 __TESTAPP_STEP_H__) +#define __TESTAPP_STEP_H__ +#include +#include "TestAppServer.h" + + +_LIT(KSampleStep1,"TestAppStep1"); + +class CTestAppStep1 : public CTestStep + { +public: + CTestAppStep1(); + ~CTestAppStep1(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepPostambleL(); + virtual TVerdict doTestStepL(); +private: + }; + + + +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/TestApps/src/TestAppServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/TestApps/src/TestAppServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -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 "TestAppServer.h" +#include "TestAppStep.h" + + +_LIT(KServerName,"Smoketest_TestApp_Server"); + +CTestAppServer* CTestAppServer::NewL() +/** + * @return - Instance of the test server + * Called inside the MainL() function to create and start the + * CTestServer derived server. + */ + { + CTestAppServer * server = new (ELeave) CTestAppServer(); + CleanupStack::PushL(server); + + server-> ConstructL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +LOCAL_C void MainL() + { + // 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); + + CTestAppServer* server = NULL; + TRAPD(err,server = CTestAppServer::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 exit + */ + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAP_IGNORE(MainL()); + delete cleanup; + return KErrNone; + } + + +CTestStep* CTestAppServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + */ + { + CTestStep* testStep = NULL; + + if(aStepName == KSampleStep1) + testStep = new CTestAppStep1(); + + return testStep; + } + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/TestApps/src/TestAppStep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/TestApps/src/TestAppStep.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "TestAppStep.h" + + +CTestAppStep1::~CTestAppStep1() +/** + * Destructor + */ + { + } + +CTestAppStep1::CTestAppStep1() +/** + * Constructor + */ + { + // Call base class method to set up the human readable name for logging + SetTestStepName(KSampleStep1); + } + +TVerdict CTestAppStep1::doTestStepPreambleL() +/** + * @return - TVerdict code + */ + { + SetTestStepResult(EPass); + return TestStepResult(); + } + +TVerdict CTestAppStep1::doTestStepL() +/** + * @return - TVerdict code + * Smoke test step for a techview application. + * Retrieves an exe name and corresponding uid from the config file. + * Runs the exe. Delays for 20 secs. Checks that the exe is still running. + */ + { + INFO_PRINTF1(_L("In Test Step CTestAppStep1")); + SetTestStepResult(EFail); + + // Get the name of the app to run from the .ini configuration file. + TPtrC exeToRun; + _LIT(KExeName, "exename"); + GetStringFromConfig(ConfigSection(),KExeName,exeToRun); + INFO_PRINTF2(_L("The exe to run is %S"), &exeToRun); + + // Create a new process to run the executable in + RProcess testProcess; + if(testProcess.Create(exeToRun, KNullDesC()) == KErrNone) + {testProcess.Resume();} + else + {return TestStepResult();} + + // Retrieve the UID of the app in order to check that it is running. + TInt uidValue; + _LIT(KUidKey, "uid"); + if (!GetHexFromConfig(ConfigSection(), KUidKey, uidValue)) + { + ERR_PRINTF1(_L("Cannot read UID from config section.")); + return TestStepResult(); + } + TUid exeUid; + exeUid.iUid = uidValue; + + // In order to test this test code the process can be forced to panic + // _LIT(KTestPanic, "test panic"); + // testProcess.Panic(KTestPanic, 123); + + // Make sure app has stayed up for at least 20 secs + User::After(2000000); + INFO_PRINTF2(_L("Check that %S is still running after at least 20 seconds"), &exeToRun); + + // Loop through each process (match against default of *) + TFindProcess findProcess; + TFullName fullName; + + + while((findProcess.Next(fullName) == KErrNone)) //&& (TestStepResult() == EFail)) + { + RProcess process; + TInt ret=KErrNone; + TInt count=0; + + // Open a handle to the process + do + { + //INFO_PRINTF2(_L("process running is %S"), &fullName); + count++; + ret=process.Open(findProcess); + if (ret!=KErrNone) + { + User::After(200000); + } + }while (ret!=KErrNone && count<=10); + + if (ret!=KErrNone) + { + User::Leave(ret); + } + + // Extract any panic characteristics + TUidType uid = process.Type(); + TExitType exitType = process.ExitType(); + TExitCategoryName exitCategory = process.ExitCategory(); + TInt exitReason = process.ExitReason(); + process.Close(); + + // If the uid being searched for is found and is running set the test step result to + // pass. + if(uid[2] == exeUid) + { + if (exitType == EExitPending) + { + INFO_PRINTF2(_L("A running process has been found with UID 0x%x"), exeUid ); + SetTestStepResult(EPass); + } + else { + if (exitType == EExitPanic) //print for debugging purposes + { + INFO_PRINTF2(_L("The process with UID 0x%x has exited due to a panic"), exeUid ); + INFO_PRINTF3(_L("The exit Reason is %d, The exit category is \"%S\""), exitReason, &exitCategory); + } + } + } // uid[2] == exeUid + } // while + + // clean up + testProcess.Kill(KErrNone); + testProcess.Close(); + + return TestStepResult(); + } + +TVerdict CTestAppStep1::doTestStepPostambleL() +/** + * @return - TVerdict code + * Override of base class virtual + */ + { + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/TestApps/testdata/smoketest_TestApps.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/TestApps/testdata/smoketest_TestApps.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,3 @@ +[PhoneApp] +uid=101F7858 +exename=Z:\sys\bin\phone.exe diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/ConsoleAlarmAlertServer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/ConsoleAlarmAlertServer.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,46 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET ConsoleAlarmAlertServer.dll +TARGETTYPE dll +CAPABILITY All -TCB +UID 0x1000008D 0x101F502A +VENDORID 0x70000001 + +SOURCEPATH ..\ConsoleAlarmAlertServer\Source + +SOURCE ConsoleAlarmAlertServer.cpp +SOURCE ConsoleAlarmAlertSession.cpp +SOURCE ConsoleAlarmAlertConsole.cpp +SOURCE ConsoleAlarmAlertServerMain.cpp +SOURCE ConsoleAlarmAlertLEDFlasher.cpp + +USERINCLUDE ..\ConsoleAlarmAlertServer\Include +//USERINCLUDE ..\AlarmAlert\Shared +//USERINCLUDE ..\Shared\Include + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY hal.lib +LIBRARY AlarmShared.lib + +DEFFILE ConsoleAlarmAlertServer.DEF + +START WINS + baseaddress 0x40700000 +END + +SMPSAFE diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertConsole.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertConsole.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,91 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __CONSOLEALARMALERTCONSOLE_H__ +#define __CONSOLEALARMALERTCONSOLE_H__ + +// System includes +#include + +// User includes +#include "asaltdefs.h" + +// Type definitions + +// Constants + +// Classes referenced +class CConsoleAlarmAlertSession; + +// Enumerations + + +// +// ----> CConsoleAlarmAlertConsole (header) +// +class CConsoleAlarmAlertConsole : public CActive + { +// +public: // CONSTRUCT / DESTRUCT +// + CConsoleAlarmAlertConsole(CConsoleAlarmAlertSession& aSession); + ~CConsoleAlarmAlertConsole(); + +// +public: // ACCESS +// + void GetKey(); + void CancelKey(); + void DecCounter(); + void UpdateDisplay(); + TInt GetTimeInterval() const; + void SetVisibility(TInt aVis); + void SetAlertState(TInt aFlags); + +// +protected: // FROM CActive +// + void RunL(); + void DoCancel(); + +// +protected: // INTERNAL METHODS +// + void Hide(); + void CreateWin(); + void DoDeferTime(TASAltAlertServerResponse aResponse); + + static TBool CountDownCallBack(TAny* aSelf); + +// +private: // MEMBER DATA +// + + TInt iAlertState; + + TInt iTimeInterval; + + CPeriodic* iCountDown; + + CConsoleBase* iWin; + + CConsoleAlarmAlertSession& iSession; + + friend class CConsoleAlarmAlertSession; + + TInt iInstructionIndex; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertLEDFlasher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertLEDFlasher.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,75 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __CONSOLEALARMALERTLEDFLASHER_H__ +#define __CONSOLEALARMALERTLEDFLASHER_H__ + +// System includes +#include + +// User includes + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + + +// +// ----> CConsoleAlarmAlertLEDFlasher (header) +// +class CConsoleAlarmAlertLEDFlasher : public CTimer + { +// +public: // STATIC CONSTRUCT +// + static CConsoleAlarmAlertLEDFlasher* NewL(); + +// +private: // INTERNAL CONSTRUCT +// + CConsoleAlarmAlertLEDFlasher(); + +// +public: // ACCESS +// + + TInt Start(); + + void Stop(); + +// +private: // FROM CActive +// + + void RunL(); + +// +private: // INTERNAL +// + + TInt SetRedLedOn(TBool aOn); + +// +private: // MEMBER DATA +// + + TBool iLedOn; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,87 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TALARMALERTSERVER.H +// +// + +#ifndef __CONSOLEALARMALERTSERVER_H__ +#define __CONSOLEALARMALERTSERVER_H__ + +// System includes +#include + +// User includes + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced +class CTestAlarmAlertConsole; +class CConsoleAlarmAlertSession; + +// +// ----> CConsoleAlarmAlertServer (header) +// +class CConsoleAlarmAlertServer : public CPolicyServer + { +// +public: // STATIC CONSTRUCT / DESTRUCT +// + static CConsoleAlarmAlertServer* NewLC(); + ~CConsoleAlarmAlertServer(); + +public: + inline void AddResponseArray(TAny* aResponseArray); + void SetAttachment(HBufC8* aData); + inline HBufC8* Attachment() const; + inline TAny* ResponseArray() const; + inline CConsoleAlarmAlertSession* WaitingSession() const; + inline void SetNotifying(TBool aIsNotifying); + inline TBool IsNotifying() const; +// +private: // INTERNAL CONSTRUCT +// + CConsoleAlarmAlertServer(); + void ConstructL(); + +// +public: // FROM CServer2 +// + CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; + +// +private: // FROM CActive +// + TInt RunError(TInt aError); + +// +private: // MEMBER DATA +// + TAny* iInstructionSet; + HBufC8* iAttachment; + CConsoleAlarmAlertSession* iWaitingSession; + TBool iIsNotifying; + }; + +// inline functions +void CConsoleAlarmAlertServer::AddResponseArray(TAny* aResponseArray) { iInstructionSet = aResponseArray; } +HBufC8* CConsoleAlarmAlertServer::Attachment() const { return iAttachment; } +TAny* CConsoleAlarmAlertServer::ResponseArray() const { return iInstructionSet; } +CConsoleAlarmAlertSession* CConsoleAlarmAlertServer::WaitingSession() const { return iWaitingSession; } +void CConsoleAlarmAlertServer::SetNotifying(TBool aIsNotifying) { iIsNotifying = aIsNotifying; } +TBool CConsoleAlarmAlertServer::IsNotifying() const { return iIsNotifying; } +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertServerMain.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertServerMain.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __CONSOLEALARMALERTSERVERMAIN_H__ +#define __CONSOLEALARMALERTSERVERMAIN_H__ + +// System includes +#include + +// User includes + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + + +// +// ----> ConsoleAlarmAlertServer (header) +// +class ConsoleAlarmAlertServer +/** +@internalAll +@released +*/ + { +// +public: // ACCESS +// + IMPORT_C static void StartConsoleAlarmAlertServerL(TAny* instructionSet = NULL); + +// +private: // INTERNAL +// + static TInt StartServerThreadFunction(TAny* instructionSet = NULL); + static void StartServerL(TAny* instructionSet = NULL); + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertSession.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,137 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __CONSOLEALARMALERTSESSION_H__ +#define __CONSOLEALARMALERTSESSION_H__ + +// System includes +#include + +// User includes +#include "asaltdefs.h" +#include "asshdalarm.h" + +// Type definitions + +// Constants + +// Classes referenced +class CConsoleAlarmAlertConsole; +class CConsoleAlarmAlertLEDFlasher; +class CConsoleAlarmAlertServer; +// Enumerations + + +struct TAgnAlarmInfo + /** + Copy of System-Wide Unique Agenda Entry Reference defined in agmalarm.h + */ + { + TUid iAlarmCategory; + TUint32 iAgnUniqueId; + TFileName iFileName; + }; + +// +// ----> CConsoleAlarmAlertSession (header) +// +class CConsoleAlarmAlertSession : public CSession2 + { +// +public: // STATIC CONSTRUCT / DESTRUCT +// + static CConsoleAlarmAlertSession* NewL(CConsoleAlarmAlertServer* aServer); + ~CConsoleAlarmAlertSession(); + +// +private: // INTERNAL CONSTRUCT +// + CConsoleAlarmAlertSession(CConsoleAlarmAlertServer* aServer); + void ConstructL(); + +// +public: // ACCESS +// + + TTime DeferTime() const; + + inline const TASShdAlarm& Alarm() const { return iAlarm; } + + inline TInt AlarmDataSize() const { return iAlarmAssociatedDataSize; } + + inline const TAgnAlarmInfo& AlarmData() const { return iAlarmData; } + + void Notify(TASAltAlertServerResponse aFlag); + + void Notify(TASAltAlertServerResponse aFlag, const TTime& aDeferTime); + + TAny * InstructionSet(); + +// +private: // FROM CSession2 +// + void ServiceL(const RMessage2& aMessage); + +// +private: // CMD - DEBUG ONLY +// + TBool CmdL(); + +// +private: // INTERNAL METHODS +// + + void SetAlarmL(const RMessage2& aMessage); + + void GetUserTimeL(const RMessage2& aMessage); + + void SetDeferTimeL(const RMessage2& aMessage); + + static TBool SoundPlaybackCallbackL(TAny* aSelf); + +// +private: // MEMBER DATA +// + + TTime iDeferTime; + + TASShdAlarm iAlarm; + + TInt iAlarmAssociatedDataSize; + + TAgnAlarmInfo iAlarmData; + + TBool iLoggedOn; + + TBool iHasMessage; + + TBool iMsgComplete; + + RMessage2 iMsgPtr; + + CPeriodic* iSoundCallbackTimer; + + CConsoleAlarmAlertLEDFlasher* iSoundLEDFlasher; + + CConsoleAlarmAlertConsole* iConsole; + + CConsoleAlarmAlertServer* iServer; + + TAny* iInstructionSet; + + TBool iInstructionSetFound; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertConsole.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertConsole.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,404 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertconsole.h" + +// System includes +#include +#include +#include + +// User includes +#include "asaltdefs.h" +#include "consolealarmalertsession.h" + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + + +// +// ----> CConsoleAlarmAlertConsole (source) +// + +//************************************************************************************* +CConsoleAlarmAlertConsole::CConsoleAlarmAlertConsole(CConsoleAlarmAlertSession& aSession) +: CActive(CActive::EPriorityLow), iSession(aSession), iInstructionIndex(0) + { + CActiveScheduler::Add(this); + } + + +//************************************************************************************* +CConsoleAlarmAlertConsole::~CConsoleAlarmAlertConsole() + { + Cancel(); + Hide(); + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::GetKey() + { + if (iWin && !IsActive()) + { + SetActive(); + iWin->Read(iStatus); + } + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::CancelKey() + { + if (IsActive()) + Cancel(); + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::DecCounter() + { + if (iTimeInterval > 0) + { + --iTimeInterval; + UpdateDisplay(); + } + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::UpdateDisplay() + { + TBuf<180> buf; + _LIT(KEalwlAlarmSoundOff, "Off"); + _LIT(KEalwlAlarmSoundOn, "On"); + _LIT(KEalwlStatusEnabled, "Are"); + _LIT(KEalwlStatusNotEnabled, "Are Not"); + _LIT(KEalwlStatusIs, "Is"); + _LIT(KEalwlStatusIsNo, "Is No"); + // + if (!iWin) + return; + iWin->SetCursorPosAbs(TPoint(0,0)); + + // MESSAGE + buf.Format(_L("Message : %S"), &iSession.Alarm().Message()); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // DATA + if (iSession.Alarm().HasAssociatedData()) + { + const TAgnAlarmInfo data = iSession.AlarmData(); + const TUid KUidAgendaModelAlarmCategory = { 0x101F4A70 }; + if (data.iAlarmCategory == KUidAgendaModelAlarmCategory) + { + _LIT(KEalwlAgendaData,"\ndata: agenda filename \"%S\""); + if (data.iFileName.Length() < 40) + buf.Format(KEalwlAgendaData,&data.iFileName); + else + { + TBuf<40> temp = data.iFileName.Left(40); + buf.Format(KEalwlAgendaData,&temp); + } + } + else + buf.Format(_L("\nAlarm has %d data bytes"), iSession.AlarmDataSize()); + } + else + { + buf = _L("\nAlarm has no associated data"); + } + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // DEFER TIME + if (iSession.DeferTime() != Time::NullTTime()) + { + TDateTime dateTime(iSession.DeferTime().DateTime()); + buf.Format(_L("\nDefer : %02d:%02d"), dateTime.Hour(), dateTime.Minute()); + } + else + buf=_L("\nNULL defer time"); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // TIME INTERVAL + buf.Format(_L("\nCurrent time interval is %d minutes"), GetTimeInterval()); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // STATE FLAGS + buf.Format(_L("\nAlarm sounds are %S"),(iAlertState&EASAltStateFlagsSilentRunning)?&KEalwlAlarmSoundOff:&KEalwlAlarmSoundOn); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nAlarm sounds %S paused"),(iAlertState&EASAltStateFlagsSoundIsPaused)?&KEalwlStatusEnabled:&KEalwlStatusNotEnabled); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nAlarm sounds %S deferred"),(iAlertState&EASAltStateFlagsInQuietPeriod)?&KEalwlStatusEnabled:&KEalwlStatusNotEnabled); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nThere %S more than one unacknowledged alarms"),(iAlertState&EASAltStateFlagsMoreThanOneDueAlarm)?&KEalwlStatusEnabled:&KEalwlStatusNotEnabled); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nThere %S memory to snooze alarms"),(iAlertState&EASAltStateFlagsNoMemoryForSnoozeAlarm)?&KEalwlStatusIsNo:&KEalwlStatusIs); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nThere %S an alarm sound to play"),(iAlertState&EASAltStateFlagsAlarmHasNoSoundFileName)?&KEalwlStatusIsNo:&KEalwlStatusIs); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // COMMAND PROMPTS + iWin->Write(_L("\nENTER = Silence alarm SPACE = Quiet Period")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\nESCAPE = Acknowledge alarm A = Acknowledge all")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\nP = Pause alarm sound TAB = Snooze alarm")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\n1 = 1 min sound interval 0 = 0 mins sound interval")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\n+ = Increase int. and pause - = Decrease int. and pause")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\n! = Kill alarm alert server")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\n")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\r")); + // + if(!iSession.InstructionSet()) //Get user input if instruction set unspecified. + GetKey(); + else if (iInstructionIndex >= static_cast*>(iSession.InstructionSet())->Count()) //Get user input if program has already iterated thru entire instruction set. + GetKey(); + else //Use the command in the instruction set, instead of waiting for user input. + { + if(!IsActive()) + { + iStatus = KRequestPending; + TRequestStatus* ptrStatus = &iStatus; + User::RequestComplete( ptrStatus, KErrNone ); + SetActive(); + } + } + } + +//************************************************************************************* +TInt CConsoleAlarmAlertConsole::GetTimeInterval() const + { + return(iTimeInterval); + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::SetVisibility(TInt aVis) + { + if (!aVis) + Hide(); + else if (!iWin) + { + // Create a new window, since cannot set order of console windows + CreateWin(); + UpdateDisplay(); + } + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::SetAlertState(TInt aFlags) + { + iAlertState = aFlags; + UpdateDisplay(); + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::RunL() + { + if (iStatus.Int() == KErrCancel) + return; + + __ASSERT_DEBUG(iWin, User::Invariant()); + TInt key = iWin->KeyCode(); + if(iSession.InstructionSet() && iInstructionIndex < static_cast*>(iSession.InstructionSet())->Count()) + { + RArray* temp = static_cast*>(iSession.InstructionSet()); + key = (*temp)[iInstructionIndex++]; + GetKey(); + } + else + { + GetKey(); + if ((key>=EKeyF1 && key<=EKeyF12) || key==EKeyTab) + { + DoDeferTime(EASAltAlertServerResponseSnooze); + } + } + + switch (key) + { + // ACKNOWLEDGE CURRENT + case EKeyEscape: + iSession.Notify(EASAltAlertServerResponseClear); + return; + // ACKNOWLEDGE ALL + case 'a': + case 'A': + iSession.Notify(EASAltAlertServerResponseClearAll); + return; + // QUIET PERIOD + case EKeySpace: + DoDeferTime(EASAltAlertServerResponseQuietPeriod); + break; + // PAUSE SOUND + case 'p': + case 'P': + DoDeferTime(EASAltAlertServerResponsePauseSound); + break; + // SILENCE ALL SOUND + case EKeyEnter: + iSession.Notify(EASAltAlertServerResponseSilence); + break; + // INTERVAL 1 MINUTE + case '1': + iTimeInterval=1; + iSession.Notify(EASAltAlertServerResponsePauseSound); + break; + // INTERVAL 0 MINUTES + case '0': + iTimeInterval=0; + iSession.Notify(EASAltAlertServerResponsePauseSound); + break; + // PAUSE + + case '=': + case '+': + iTimeInterval++; + iSession.Notify(EASAltAlertServerResponsePauseSound); + break; + // PAUSE - + case '-': + iTimeInterval--; + iSession.Notify(EASAltAlertServerResponsePauseSound); + break; + + // QUIT + case '!': + CActiveScheduler::Stop(); + break; + } + + TBuf<10> buf; + buf.Format(_L("'%c',"), key); + iWin->Write(buf); + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::DoCancel() + { + __ASSERT_DEBUG(iWin, User::Invariant()); + iWin->ReadCancel(); + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::Hide() + { + if (iWin) + CancelKey(); + // + delete iWin; + iWin = NULL; + // + if (iCountDown) + iCountDown->Cancel(); + // + delete iCountDown; + iCountDown=NULL; + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::CreateWin() + { + _LIT(KAlarmAlertConsoleCaption, "Test Alarm Alert Server Console"); + // + __ASSERT_DEBUG(!iWin, User::Invariant()); + __ASSERT_DEBUG(!iCountDown, User::Invariant()); + // + TRAPD(trapCheck, iWin = Console::NewL(KAlarmAlertConsoleCaption, TSize(KConsFullScreen, KConsFullScreen))); + if (trapCheck) + { + iWin=NULL; + return; + } + + TRAP(trapCheck, iCountDown = CPeriodic::NewL(CActive::EPriorityIdle)); + if (trapCheck) + { + iCountDown=NULL; + return; + } + // + const TTimeIntervalMicroSeconds32 interval(60000000); + iCountDown->Start(interval, interval, TCallBack(&CountDownCallBack, this)); + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::DoDeferTime(TASAltAlertServerResponse aResponse) + { + if (++iTimeInterval > 60) + { + iTimeInterval = 5; + User::Beep(440, 12); + } + // + TTime now; + now.HomeTime(); + now += TTimeIntervalMinutes(iTimeInterval); + // + iSession.Notify(aResponse, now); + } + + +//************************************************************************************* +TBool CConsoleAlarmAlertConsole::CountDownCallBack(TAny* aSelf) + { + CConsoleAlarmAlertConsole& self = *reinterpret_cast(aSelf); + self.DecCounter(); + // + return EFalse; + } + + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertLEDFlasher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertLEDFlasher.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,130 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertledflasher.h" + +// System includes +#include + +// User includes +#include "asaltdefs.h" + +// Type definitions + +// Constants +const TInt KFlasherPeriodicity = 500000; + +// Enumerations + +// Classes referenced + + +// +// ----> CConsoleAlarmAlertLEDFlasher (source) +// + +//************************************************************************************* +CConsoleAlarmAlertLEDFlasher::CConsoleAlarmAlertLEDFlasher() +: CTimer(CActive::EPriorityIdle) + { + CActiveScheduler::Add(this); + } + + +//************************************************************************************* +CConsoleAlarmAlertLEDFlasher* CConsoleAlarmAlertLEDFlasher::NewL() + { + CConsoleAlarmAlertLEDFlasher* self = new(ELeave) CConsoleAlarmAlertLEDFlasher(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// +// +// + + +//************************************************************************************* +/** + * Start the flasher, if not busy + */ +TInt CConsoleAlarmAlertLEDFlasher::Start() + { + Stop(); + After(KFlasherPeriodicity); + return(SetRedLedOn(ETrue)); + } + + +//************************************************************************************* +/** + * Stop the LED flashing + */ +void CConsoleAlarmAlertLEDFlasher::Stop() + { + Cancel(); + SetRedLedOn(EFalse); + } + + +// +// +// + + +//************************************************************************************* +/** + * @see CActive + */ +void CConsoleAlarmAlertLEDFlasher::RunL() + { + if (iStatus!=KErrNone) + { + SetRedLedOn(EFalse); + return; + } + SetRedLedOn(!iLedOn); + After(KFlasherPeriodicity); + } + + +// +// +// + + +//************************************************************************************* +/** + * Turn the LED on or off + */ +TInt CConsoleAlarmAlertLEDFlasher::SetRedLedOn(TBool aOn) + { + const TInt KClearAllLeds = 0; + const TInt KLedMaskRed1 = 1; + + iLedOn = aOn; + if (iLedOn) + { + return HAL::Set(HAL::ELEDmask, KLedMaskRed1); + } + else + { + return HAL::Set(HAL::ELEDmask, KClearAllLeds); + } + } + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,131 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertserver.h" + +// System includes + +// User includes +#include "asaltdefs.h" +// +#include "consolealarmalertsession.h" + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + +// The Console Alarm Alert Server is migrated to a secure server in EKA2 +#include + + + +const TUint KRangeCount = 1; + +const TInt KOpCodeRanges[KRangeCount] = + { + 0 // All Op Codes from 0 to KMaxInt should pass. No restrictions + }; + + +const TUint8 KElementsIndex[KRangeCount] = + { + CPolicyServer::EAlwaysPass, //All OP Codes Allways passing no capability required + }; + + +const CPolicyServer::TPolicy KConsoleAlarmAlertServerPolicy = + { + CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass + KRangeCount, + KOpCodeRanges, + KElementsIndex, // what each range is compared to + KNullHandle //Since we have no specific policy checking + }; + + + +// +// ----> CConsoleAlarmAlertServer (source) +// + +//************************************************************************************* +CConsoleAlarmAlertServer::CConsoleAlarmAlertServer() + :CPolicyServer(CActive::EPriorityStandard, KConsoleAlarmAlertServerPolicy), iInstructionSet(NULL) + { + } + + + +//************************************************************************************* +CConsoleAlarmAlertServer::~CConsoleAlarmAlertServer() + { + if (iAttachment) + delete iAttachment; + } + + +//************************************************************************************* +void CConsoleAlarmAlertServer::ConstructL() + { + StartL(KAlarmAlertServerName); + } + + +//************************************************************************************* +CConsoleAlarmAlertServer* CConsoleAlarmAlertServer::NewLC() + { + CConsoleAlarmAlertServer* self = new(ELeave) CConsoleAlarmAlertServer(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// +// +// + + +//************************************************************************************* +CSession2* CConsoleAlarmAlertServer::NewSessionL(const TVersion& aVersion,const RMessage2& /*aMessage*/) const + { + const TVersion KServerVersion(KASAltVersionMajor, KASAltVersionMinor, KASAltVersionBuild); + if (!User::QueryVersionSupported(KServerVersion, aVersion)) + User::Leave(KErrNotSupported); + // + return CConsoleAlarmAlertSession::NewL((CConsoleAlarmAlertServer*)this); + } + + +// +// +// + + +//************************************************************************************* +TInt CConsoleAlarmAlertServer::RunError(TInt /*Error*/) + { + return KErrNone; + } + +void CConsoleAlarmAlertServer::SetAttachment(HBufC8* data) + { + if (iAttachment) + delete iAttachment; + iAttachment = data; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServerMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServerMain.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,117 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertservermain.h" + +// System includes + +// User includes +#include "asaltdefs.h" +// +#include "consolealarmalertserver.h" + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + + +// +// ----> ConsoleAlarmAlertServer (source) +// + +//************************************************************************************* +EXPORT_C void ConsoleAlarmAlertServer::StartConsoleAlarmAlertServerL(TAny* instructionSet) + { + _LIT(KAlarmAlertServerThreadName, "ConsoleAlarmAlertServerThread"); + // + const TInt KStackSize = 0x0002000; // 8KB + const TInt KInitHeapSize = 0x0001000; // 4KB + const TInt KHeapSize = 0x1000000; // 16MB + // + // Is the alarm alert server already running? If so, don't + // start a new one... + TFullName name; + TFindServer finder(KAlarmAlertServerName); + if (finder.Next(name) == KErrNone) + return; + + RThread serverThread; + const TInt error = serverThread.Create(KAlarmAlertServerThreadName, + &StartServerThreadFunction, + KStackSize, + KInitHeapSize, + KHeapSize, + instructionSet + ); + User::LeaveIfError(error); + // + serverThread.SetPriority(EPriorityMore); + serverThread.Resume(); + // + User::After(2000000); // 2 seconds + } + + +// +// +// + + +//************************************************************************************* +TInt ConsoleAlarmAlertServer::StartServerThreadFunction(TAny* instructionSet) + { + __UHEAP_MARK; + // + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (!cleanup) + User::Invariant(); + // + TRAPD(err, StartServerL(instructionSet)); + delete cleanup; + // + __UHEAP_MARKEND; + return err; + } + + +//************************************************************************************* +void ConsoleAlarmAlertServer::StartServerL(TAny* instructionSet) + { + CActiveScheduler* scheduler = new CActiveScheduler(); + CleanupStack::PushL(scheduler); + CActiveScheduler::Install(scheduler); + // + + CConsoleAlarmAlertServer * tmp = CConsoleAlarmAlertServer::NewLC(); + tmp->AddResponseArray(instructionSet); + CActiveScheduler::Start(); + // + CleanupStack::PopAndDestroy(2, scheduler); + } + + + + + + +// +// ----> ConsoleAlarmAlertServer (source) +// + +//************************************************************************************* diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertSession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertSession.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,335 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertsession.h" + +// System includes + +#include "e32svr.h" +// User includes +#include "asaltdefs.h" +//#include "..\..\Test\ConsoleANTestClient.h" +// +#include "consolealarmalertsession.h" +#include "consolealarmalertconsole.h" +#include "consolealarmalertledflasher.h" +#include "consolealarmalertserver.h" //for inter-session communication + +// Type definitions + +// Constants +const TInt KSlot0 = 0; +const TInt KSlot1 = 1; +const TInt KSlot2 = 2; + +// Enumerations + +// Classes referenced + + +// +// ----> CConsoleAlarmAlertSession (source) +// + +//************************************************************************************* +CConsoleAlarmAlertSession::CConsoleAlarmAlertSession(CConsoleAlarmAlertServer* aServer) +: iServer(aServer), iInstructionSet(NULL), iInstructionSetFound(EFalse) + { + } + + +//************************************************************************************* +CConsoleAlarmAlertSession::~CConsoleAlarmAlertSession() + { + CConsoleAlarmAlertSession* session = iServer->WaitingSession(); + session = NULL; + delete iSoundLEDFlasher; + delete iSoundCallbackTimer; + delete iConsole; + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::ConstructL() + { + iSoundLEDFlasher = CConsoleAlarmAlertLEDFlasher::NewL(); + iSoundCallbackTimer = CPeriodic::NewL(CActive::EPriorityIdle); + iConsole = new(ELeave) CConsoleAlarmAlertConsole(*this); + } + + +//************************************************************************************* +CConsoleAlarmAlertSession* CConsoleAlarmAlertSession::NewL(CConsoleAlarmAlertServer* aServer) + { + CConsoleAlarmAlertSession* self = new(ELeave) CConsoleAlarmAlertSession(aServer); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// +// +// + + +//************************************************************************************* +TTime CConsoleAlarmAlertSession::DeferTime() const + { + return iDeferTime; + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::Notify(TASAltAlertServerResponse aFlag) + { + if (iHasMessage) + { + iMsgPtr.Complete(aFlag); + iHasMessage = EFalse; + } + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::Notify(TASAltAlertServerResponse aFlag, const TTime& aDeferTime) + { + if (iHasMessage) + { + TPckgC time(aDeferTime); + TRAPD(err, iMsgPtr.WriteL(KSlot0, time)); + __ASSERT_DEBUG(err == KErrNone, User::Invariant()); + Notify(aFlag); + } + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertSession::ServiceL(const RMessage2& aMessage) + { + iMsgComplete = ETrue; + const TInt function = aMessage.Function(); + + //see if the server holds a set of instructions to be followed, + //rather than waiting for user input. + if(!iInstructionSetFound) //go look for it now. + { + //we will enter into this code only once + const CServer2* tmpServ = Server(); + const CConsoleAlarmAlertServer* specific = reinterpret_cast(tmpServ); + iInstructionSet = const_cast(specific)->ResponseArray(); + iInstructionSetFound = ETrue; + } + + // + switch(function) + { + case EASAltOpCodeNotify: + { + __ASSERT_ALWAYS(!iHasMessage, User::Invariant()); + iMsgComplete = EFalse; + iMsgPtr = aMessage; + iHasMessage = ETrue; + CConsoleAlarmAlertSession* session = iServer->WaitingSession(); + session = this; + break; + } + + case EASAltOpCodeNotifyCancel: + if (iHasMessage) + { + iHasMessage=EFalse; + iMsgPtr.Complete(KErrCancel); + } + break; + + case EASAltOpCodeVisible: + { + TBool isVisible = aMessage.Int0(); + iConsole->SetVisibility(isVisible); + iServer->SetNotifying(isVisible); + break; + } + + case EASAltOpCodeSetState: + iConsole->SetAlertState(aMessage.Int0()); + break; + + case EASAltOpCodeSetAlarm: + SetAlarmL(aMessage); + iConsole->iTimeInterval=0; + iConsole->UpdateDisplay(); + break; + + case EASAltOpCodeGetUserTime: + GetUserTimeL(aMessage); + break; + + case EASAltOpCodeSetDeferTime: + SetDeferTimeL(aMessage); + iConsole->UpdateDisplay(); + break; + + case EASAltOpCodeLogon: + __ASSERT_ALWAYS(!iLoggedOn, User::Invariant()); + iMsgComplete=EFalse; + iLoggedOn=ETrue; + break; + + case EASAltOpCodeStartPlayingSound: + { + iSoundLEDFlasher->Start(); + TCallBack callback(SoundPlaybackCallbackL, this); + iSoundCallbackTimer->Start(TTimeIntervalMicroSeconds32(0), TTimeIntervalMicroSeconds32(3000000), callback); + break; + } + + case EASAltOpCodeStopPlayingSound: + iSoundLEDFlasher->Stop(); + iSoundCallbackTimer->Cancel(); + break; + +#if 0 +//Test code + case EASAltTestOpCodeAcknowledgeAlarm: + if (iServer->WaitingSession()) + iServer->WaitingSession()->Notify(EASAltAlertServerResponseClear); + break; + + case EASAltTestOpCodeGetAttachment: + { + if (iServer->Attachment() != NULL) + { + const TDes8& data = iServer->Attachment()->Des(); + const TInt maxLength = static_cast(aMessage.Int0()); + if (data.Size() > maxLength) + User::Panic(_L("Client's buffer is too short"), KErrOverflow); + else + { + if (data.Length() == 0) + { + _LIT8(KEmpty,"Empty"); + aMessage.WriteL(KSlot1, KEmpty); + } + else + { + aMessage.WriteL(KSlot1, data); + } + iServer->SetAttachment(NULL); + } + } + } + break; + + case EASAltTestOpCodeGetIsNotifying: + { + TPckgC ret = iServer->IsNotifying(); + aMessage.WriteL(KSlot0, ret); + break; + } +#endif + default: + User::Invariant(); + break; + } + + if (iMsgComplete) + aMessage.Complete(KErrNone); + } + + +// +// +// + + +//************************************************************************************* +TBool CConsoleAlarmAlertSession::CmdL() + { + return KErrNone; + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertSession::SetAlarmL(const RMessage2& aMessage) + { + TPckg pA(iAlarm); + aMessage.ReadL(KSlot0, pA); + if (iAlarm.HasAssociatedData()) + { + iAlarmAssociatedDataSize = aMessage.GetDesLength(2); + TPckg pB(iAlarmData); + aMessage.ReadL(KSlot2, pB); + + //Storing the data in the server for the test session to read.. + HBufC8* data = HBufC8::NewLC(iAlarmAssociatedDataSize); + TPtr8 pData(data->Des()); + aMessage.ReadL(KSlot2, pData); + iServer->SetAttachment(data); //Server takes an ownership + CleanupStack::Pop(data); + } + else + iAlarmAssociatedDataSize = 0; + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::GetUserTimeL(const RMessage2& aMessage) + { + TTime time; + time.HomeTime(); + time+=TTimeIntervalMinutes(iConsole->GetTimeInterval()); + TPtrC8 pTime((TUint8 *)&time,sizeof(TTime)); + aMessage.WriteL(KSlot0,pTime); + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::SetDeferTimeL(const RMessage2& aMessage) + { + TPckg pTime(iDeferTime); + aMessage.ReadL(KSlot0, pTime); + } + + +//************************************************************************************* +TBool CConsoleAlarmAlertSession::SoundPlaybackCallbackL(TAny* /*aSelf*/) + { +// _LIT(KPlayingSound, "Playing sound"); +// User::InfoPrint(KPlayingSound); + return ETrue; + } + +//************************************************************************************** +TAny * CConsoleAlarmAlertSession::InstructionSet() + { + return iInstructionSet; + } + + + + + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/ConsoleAlarmAlertServer/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,19 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 ConsoleAlarmAlertServer +// +// + +PRJ_TESTMMPFILES +ConsoleAlarmAlertServer.mmp diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Group/Smoketest_Timew.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Group/Smoketest_Timew.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,64 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + + +TARGET Smoketest_Timew_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7775 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY WriteUserData ReadUserData + +SOURCEPATH ..\Src + +SOURCE TestTimewServer.cpp +SOURCE TestTimewSetAlarm.cpp +SOURCE TestTimewBase.cpp +SOURCE SM_ALM.CPP +SOURCE SM_UTL.CPP +SOURCE SM_MOD.CPP +SOURCE SM_RSP.CPP + +USERINCLUDE ..\Inc ..\..\Group +USERINCLUDE ..\ConsoleAlarmAlertServer\Include + + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +library BAFL.LIB +library FBSCLI.LIB +library WS32.LIB +library CONE.LIB +library DIAL.LIB +library FEPBASE.LIB +LIBRARY apparc.lib +LIBRARY etext.lib +LIBRARY estor.lib +LIBRARY efsrv.lib + +library AlarmClient.lib +library AlarmShared.lib +library EUSER.LIB +LIBRARY ecom.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib + +SMPSAFE + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 Timew smoketest +// + + +PRJ_TESTEXPORTS + + +../Scripts/Smoketest_Timew.script /epoc32/release/wins/udeb/z/autosmoketest/smoketest_timew.script +../Scripts/Smoketest_Timew.script /epoc32/release/wins/urel/z/autosmoketest/smoketest_timew.script +../Scripts/Smoketest_Timew.script /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_timew.script +../Scripts/Smoketest_Timew.script /epoc32/release/winscw/urel/z/autosmoketest/smoketest_timew.script + +../TestData/Smoketest_Timew.ini /epoc32/release/wins/udeb/z/autosmoketest/smoketest_timew.ini +../TestData/Smoketest_Timew.ini /epoc32/release/wins/urel/z/autosmoketest/smoketest_timew.ini +../TestData/Smoketest_Timew.ini /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_timew.ini +../TestData/Smoketest_Timew.ini /epoc32/release/winscw/urel/z/autosmoketest/smoketest_timew.ini + + +PRJ_TESTMMPFILES +Smoketest_Timew.mmp diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Inc/ALMMOD.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Inc/ALMMOD.H Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,121 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __ALMMOD_H__ +#define __ALMMOD_H__ + +// System includes +#include + +// User includes +#include "timewmod.h" + +// Constants +const TInt KArrayOfAlarmIdsGranularity = 64; +const TInt KPriorityAlarmIdleObserver=-0x0010; +const TInt KPriorityAlarmResponder=-0x0005; // Idle observer priority must be lower than this + +// The alarm model gives a general notification only +// +class CAlmIdleObserver : public CIdleObserver + { +public: + static CAlmIdleObserver* NewL(MTimewModelObserver* aObserver,TInt aIdlePriority); + }; + +class CAlmModel : public CModelBase + { +public: + ~CAlmModel(); + static CAlmModel* NewL(MTimewModelObserver* aObserver,TInt aResponderPriority); + virtual void ProcessResponder(TInt aStatus); +public: + TInt AlarmQuietPeriodMinutes() const; + TInt AlarmQuietPeriodSet(TInt aMinutes); + inline void AlarmQuietPeriodCancel(); + TTime AlarmQuietPeriodEnd() const; + // + void AlarmSoundToggle(); + TInt AlarmSoundStateSet(TBool aSoundOn); + TTimeWAlarmSoundState AlarmSoundState() const; + // + TInt ClockAlarmDelete(TInt aAlarmIndex); + TInt ClockAlarmEnable(TInt aAlarmIndex,TTimeWClockAlarmState aClockAlarmState); + TTimeWClockAlarmState ClockAlarmState(TInt aAlarmIndex) const; + TInt ClockAlarmSet(TInt aAlarmIndex,const TASShdAlarm& aInfo); + TInt ClockAlarmInfo(TInt aAlarmIndex,TASShdAlarm& aInfo); + // + void NextAlarmResetListL(); + void NextAlarmClearList(); + TInt NextAlarmNumber() const; + TInt NextAlarmDelete(TInt aIndex); + TBool NextAlarmCanDelete(TInt aIndex) const; + TInt NextAlarm(TFullName& aOwner, TASShdAlarm& aInfo) const; + TInt NextAlarmInfo(TInt aIndex, TFullName& aOwner, TASShdAlarm& aInfo) const; + // + TInt OrphanAlarmNumber() const; + inline TInt UnacknowledgedAlarmNumber() const; + // + void ReviewAlarmResetListL(); + void ReviewAlarmClearList(); + TInt ReviewAlarmNumber() const; + TInt ReviewAlarmInfo(TInt aIndex, TASShdAlarm& aInfo) const; + +private: + CAlmModel(); + void ConstructL(MTimewModelObserver* aObserver,TInt aResponderPriority); + +private: + + /** + * The list of clock alarms. Note that although there is always 8 + * alarms in this list, not all will be active. + */ + RPointerArray iClockAlarms; + + /** + * + */ + RASCliSession iAlmSvr; + + /** + * + */ + TRequestStatus iStatus; + + /** + * + */ + RArray iNextAlarmIds; + + /** + * + */ + RArray iReviewAlarmIds; + }; + + +TInt CAlmModel::UnacknowledgedAlarmNumber() const + { + TInt count = iAlmSvr.AlarmCountByState(EAlarmStateWaitingToNotify); + return (count + iAlmSvr.AlarmCountByState(EAlarmStateNotifying)); + } + +void CAlmModel::AlarmQuietPeriodCancel() + { + iAlmSvr.CancelAlarmSilence(); + } + +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Inc/ALMMOD.INL --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Inc/ALMMOD.INL Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +// class CAlmModel +inline TAlarmSoundState CAlmModel::AlarmSoundState() const + { + return(iAlmSvr.AlarmSoundState()); + } +inline void CAlmModel::AlarmSoundStateSet(TBool aSoundOn) + { + iAlmSvr.SetAlarmSoundOn(aSoundOn); + } +inline void CAlmModel::AlarmSoundToggle() + { + iAlmSvr.SetAlarmSoundOn(iAlmSvr.AlarmSoundState()==EAlarmSoundOff); + } +inline TTime CAlmModel::AlarmQuietPeriodEnd() const + { + return(iAlmSvr.QuietPeriodUntil()); + } +inline void CAlmModel::AlarmQuietPeriodCancel() + { + iAlmSvr.QuietPeriodCancel(); + } +inline TInt CAlmModel::ClockAlarmDelete(TInt aClockAlarmNum) + { + __ASSERT_DEBUG(aClockAlarmNumReset(); + } +inline TInt CAlmModel::NextAlarmNumber() const + { + return(iAlmSvr.AlarmCount(RAlarmServer::ECountNext)); + } +inline void CAlmModel::ReviewAlarmResetListL() + { + iAlmSvr.AlarmArrayPopulateL(*iReviewAlarms,RAlarmServer::EArrayReview); + } +inline void CAlmModel::ReviewAlarmClearList() + { + iReviewAlarms->Reset(); + } +inline TInt CAlmModel::ReviewAlarmNumber() const + { + return(iAlmSvr.AlarmCount(RAlarmServer::ECountReview)); + } +inline TInt CAlmModel::OrphanAlarmNumber() const + { + return(iAlmSvr.AlarmCount(RAlarmServer::ECountOrphan)); + } +inline TInt CAlmModel::UnacknowledgedAlarmNumber() const + { + return(iAlmSvr.AlarmCount(RAlarmServer::ECountUnacknowledged)); + } + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Inc/SM_STD.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Inc/SM_STD.H Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,55 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __SM_STD_H__ +#define __SM_STD_H__ + +// System includes +#include +#include +#include + +// User includes +#include "timewmod.h" + +class CModelResponder : public CActive + { +public: + void Start(); + virtual void RunL(); + virtual void DoStart()=0; + virtual void DoCancel()=0; +protected: + CModelResponder(CModelBase &aModel,TInt aPriority); +private: + void NotifyModel(TInt aNotification); +private: + CModelBase *iModel; + }; + +class CAlmModel; +class CAlmResponder : public CModelResponder + { +public: + CAlmResponder(RASCliSession& aSvr,CAlmModel& aModel,TInt aResponderPriority); +public: + virtual void DoStart(); + virtual void DoCancel(); +private: + TAlarmId iAlarmId; + RASCliSession* iAlmSvr; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Inc/TIMEWMOD.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Inc/TIMEWMOD.H Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,145 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __TIMEWMOD_H__ +#define __TIMEWMOD_H__ + +// System includes +#include + +// Constants +const TInt KMaxClockAlarms = 8; + +/** + * From the old T32Alm.h file. Encapsulates the idea of + * a "Not set" alarm, which the new AlarmServer doesn't + * support. + */ +enum TTimeWClockAlarmState + { + ETimeWClockAlarmStateNotSet = 0, + ETimeWClockAlarmStateSet, + ETimeWClockAlarmStateDisabled + }; + +/** + * + */ +enum TTimeWAlarmSoundState + { + ETimeWAlarmSoundOn = 0, + ETimeWAlarmSoundOff, + ETimeWAlarmQuietPeriod + }; + +/** + * + */ +enum TInternalClockAlarmFlags + { + EClockAlarmFlagsIsSet = 1 + }; + +enum TModelPanic + { + EModelWorld = 0, + EModelObserver, + EModelOutOfRange, + EModel + }; +enum TModelFault + { + EModelfIdleObj = 0, + EModelfPriorityInvalid, + EModelfIdleArgument, + EModelfNoNotifier, + EModelfOutOfRange, + EModelfTime, + EModelfTryingToChangeStateOfNullClockAlarm, + EModelfTryingToGetInfoAboutNullClockAlarm, + EModelfTryingToOrphanClockAlarm + }; + +GLREF_C void Panic(TModelPanic aPanic); +GLREF_C void Fault(TModelFault aFault); + +class MTimewModelObserver + { +public: + virtual void HandleUpdate(TInt aNotification)=0; + }; + +class CIntermediateObserver : public CBase, public MTimewModelObserver + { +public: + CIntermediateObserver(); + virtual void HandleUpdate(TInt aNotification); + void SetTimewModelObserver(MTimewModelObserver* aObserver); +protected: + void Notify(TInt aNotification); +private: + MTimewModelObserver* iObserver; + }; + +class CIdleObserver : public CIntermediateObserver + { +public: + CIdleObserver(); + ~CIdleObserver(); + void ConstructL(MTimewModelObserver* aObserver,TInt aPriority); +public: + void CancelIdleRefresh(); + virtual void HandleUpdate(TInt aNotification); +protected: + virtual void DoIdleCancel(); + virtual void DoIdleNotify(); +private: + void StartIdleRefresh(); + static TInt IdleCallBack(TAny* aPtr); +private: + TInt iNotification; + CIdle* iIdle; + }; + +class CModelResponder; +class CModelBase : public CBase + { +protected: + CModelBase(); + +public: + ~CModelBase(); + +public: + void Stop(); + void Start(); + void SetTimewModelObserver(MTimewModelObserver* aObserver); + +protected: + void Notify(TInt aNotification); + virtual void ProcessResponder(TInt aStatus)=0; + void SetResponderActive(CModelResponder* aResponder); + +private: + void DoObserverNotify(TInt aNotification); + +private: + TBool iDoingViewNotify; + MTimewModelObserver* iObserver; + CModelResponder* iResponder; + friend class CModelResponder; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Inc/TestTimewBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Inc/TestTimewBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewBase which is the base class for all +// the Psd Agx suite test steps +// +// + +#ifndef TEST_TIMEW_BASE_H +#define TEST_TIMEW_BASE_H + +#include "almmod.h" +#include + + +class CTestTimewBase : public CTestStep +{ +public: + CTestTimewBase(); + ~CTestTimewBase(); + virtual enum TVerdict doTestStepPreambleL(); + virtual enum TVerdict doTestStepPostambleL(); CAlmModel* Model(); + +private: + CActiveScheduler* iSchedular; + +protected: CAlmModel* iModel;}; + +#endif /* TEST_TIMEW_BASE_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Inc/TestTimewServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Inc/TestTimewServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewServer +// +// + +#ifndef TEST_TIMEW_SERVER_H +#define TEST_TIMEW_SERVER_H + +#include + +class CTestTimewServer : public CTestServer +{ +public: + static CTestTimewServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + +private: + void ConstructL(); +}; + +#endif /* TEST_TIMEW_SERVER_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Inc/TestTimewSetAlarm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Inc/TestTimewSetAlarm.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewSetAlarm +// +// + +#ifndef TEST_TIMEW_SET_ALARM_H +#define TEST_TIMEW_SET_ALARM_H + +#include "TestTimewBase.h" +#include + +class CTestTimewSetAlarm : public CTestTimewBase +{ +public: + CTestTimewSetAlarm(); + virtual ~CTestTimewSetAlarm(); + +public: + virtual enum TVerdict doTestStepL( void ); + +private: + void SetAlarmL( void ); + TASShdAlarm iAlarmData; +}; + +#endif /* TEST_TIMEW_SET_ALARM_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Scripts/Smoketest_Timew.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Scripts/Smoketest_Timew.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Timew smoketest +// +RUN_WS_PROGRAM 10 z:\sys\bin\timew.exe +// +DELAY 1500 +// +LOAD_SUITE Smoketest_Timew_Server +// +RUN_UTILS MkDir c:\autoSmoketest\ + +RUN_UTILS CopyFile z:\autosmoketest\smoketest_timew.ini c:\autosmoketest\smoketest_timew.ini +RUN_UTILS MakeReadWrite c:\autosmoketest\smoketest_timew.ini +// +START_TESTCASE 8979 +RUN_TEST_STEP 1000 Smoketest_Timew_Server SetAlarm c:\autosmoketest\Smoketest_Timew.ini 24560_SetAlarm +END_TESTCASE 8979 diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Src/SM_ALM.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Src/SM_ALM.CPP Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,489 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "almmod.h" +#include "sm_std.h" +#include + +// +// class CAlmModel +// + +CAlmModel::CAlmModel() +// +// Constructor +// + { + } + +CAlmModel::~CAlmModel() +// +// Destructor +// + { + Stop(); + iClockAlarms.ResetAndDestroy(); + iClockAlarms.Close(); + iReviewAlarmIds.Close(); + iNextAlarmIds.Close(); + iAlmSvr.Close(); + REComSession::FinalClose(); + } + +void CAlmModel::ConstructL(MTimewModelObserver* aObserver,TInt aResponderPriority) +// +// Construct the alarm engine components +// + { + SetTimewModelObserver(aObserver); + // + iReviewAlarmIds = RArray(KArrayOfAlarmIdsGranularity); + iNextAlarmIds = RArray(KArrayOfAlarmIdsGranularity); + // + const TInt r = iAlmSvr.Connect(); + User::LeaveIfError(r); + // + TInt i; + iClockAlarms = RPointerArray(KMaxClockAlarms); + for(i=0; i clockIds(KMaxClockAlarms); + CleanupClosePushL(clockIds); + iAlmSvr.GetAlarmIdListForCategoryL(KASCliCategoryClock, clockIds); + + // Put them in the slots - we can only display KMaxClockAlarms alarms + // so any beyond that are ignored. + TInt slotsUsedSoFar = 0; + const TInt count = Min(KMaxClockAlarms, clockIds.Count()); + for(i=0; iState() != EAlarmStateNotified) + { + // If we don't do this, then the alarm slot is treated + // as available. + ++slotsUsedSoFar; + alarm->ClientFlags().Set(EClockAlarmFlagsIsSet); + } + } + CleanupStack::PopAndDestroy(&clockIds); + // + CAlmResponder* pR=new(ELeave) CAlmResponder(iAlmSvr,*this,aResponderPriority); + SetResponderActive(pR); + } + +CAlmModel* CAlmModel::NewL(MTimewModelObserver* aObserver,TInt aResponderPriority) +// +// Create a new alarm engine +// + { + CAlmModel* model=new(ELeave) CAlmModel; + CleanupStack::PushL(model); + model->ConstructL(aObserver,aResponderPriority); + CleanupStack::Pop(model); + return(model); + } + +void CAlmModel::ProcessResponder(TInt aStatus) +// +// Interpret responder status +// + { + // FIX + if (aStatus!=KErrCancel && aStatus!=KErrNone) + Notify(aStatus); + else + Notify(0); + } + +TInt CAlmModel::AlarmQuietPeriodMinutes() const +// +// Return the time that sound is delayed until +// + { + TTime timeNow; + timeNow.HomeTime(); + TTime timeQuiet=AlarmQuietPeriodEnd(); + TInt quietMinutes; + if (timeQuiet<=timeNow || timeQuiet==Time::NullTTime()) + quietMinutes=0; + else + { + TTimeIntervalMinutes minutes; + timeQuiet.MinutesFrom(timeNow,minutes); + quietMinutes=minutes.Int()+1; + } + return(quietMinutes); + } + +TInt CAlmModel::AlarmQuietPeriodSet(TInt aMinutes) +// +// Delay alarm sounds for a given number of minutes +// + { + TInt ret = KErrNone; + // + if (!aMinutes) + ret = iAlmSvr.CancelAlarmSilence(); + else + ret = iAlmSvr.SetAlarmSoundsSilentFor(TTimeIntervalMinutes(aMinutes)); + // + return ret; + } + +TInt CAlmModel::ClockAlarmEnable(TInt aAlarmIndex, TTimeWClockAlarmState aClockAlarmState) +// +// Enable or disable a clock alarm +// + { + __ASSERT_DEBUG(aAlarmIndex < KMaxClockAlarms, Panic(EModelOutOfRange)); + // + TAlarmStatus newStatus; + switch(aClockAlarmState) + { + case ETimeWClockAlarmStateNotSet: + return ClockAlarmDelete(aAlarmIndex); + + case ETimeWClockAlarmStateSet: + newStatus = EAlarmStatusEnabled; + break; + + default: + case ETimeWClockAlarmStateDisabled: + newStatus = EAlarmStatusDisabled; + break; + } + + TASShdAlarm* alarm = iClockAlarms[aAlarmIndex]; + __ASSERT_ALWAYS(alarm->Id() != KNullAlarmId, Fault(EModelfTryingToChangeStateOfNullClockAlarm)); + TInt error = iAlmSvr.SetAlarmStatus(alarm->Id(), newStatus); + if (error != KErrNone) + return error; + + // Refetch alarm from server (will update status) + error = iAlmSvr.GetAlarmDetails(alarm->Id(), *alarm); + if (error == KErrNone) + alarm->ClientFlags().Set(EClockAlarmFlagsIsSet); + return error; + } + +TInt CAlmModel::ClockAlarmSet(TInt aAlarmIndex, const TASShdAlarm& aInfo) +// +// Set a clock alarm +// + { + __ASSERT_DEBUG(aAlarmIndex < KMaxClockAlarms, Panic(EModelOutOfRange)); + // + TInt error = KErrNone; + TASShdAlarm* alarm = iClockAlarms[aAlarmIndex]; + if (alarm->Id() != KNullAlarmId) + { + // There is already an alarm set in this slot. Delete + // the old, replace it with the new. + error = iAlmSvr.AlarmDelete(alarm->Id()); + if (error != KErrNone) + return error; + alarm->ClientFlags().Clear(EClockAlarmFlagsIsSet); + } + + // Add alarm (will also update cached alarm details) + *alarm = aInfo; + alarm->Category() = KASCliCategoryClock; + error = iAlmSvr.AlarmAdd(*alarm); + if (error == KErrNone) + alarm->ClientFlags().Set(EClockAlarmFlagsIsSet); + return error; + } + +TInt CAlmModel::ClockAlarmInfo(TInt aAlarmIndex,TASShdAlarm& aInfo) +// +// Get information about a clock alarm +// + { + __ASSERT_DEBUG(aAlarmIndex < KMaxClockAlarms, Panic(EModelOutOfRange)); + // + TInt error = KErrNone; + aInfo = *(iClockAlarms[aAlarmIndex]); + if (aInfo.Id() != KNullAlarmId && aInfo.ClientFlags().IsSet(EClockAlarmFlagsIsSet)) + { + // Preserve flags + const TBitFlags16 flags = aInfo.ClientFlags(); + + // Fetch alarm details + error = iAlmSvr.GetAlarmDetails(aInfo.Id(), aInfo); + + // Restore flags + if (error == KErrNone) + { + // Has the alarm already notified? + if (aInfo.State() != EAlarmStateQueued && aInfo.State() != EAlarmStateNotifying) + { + // Treat this slot as free + TASShdAlarm* alarm = iClockAlarms[aAlarmIndex]; + alarm->Reset(); + aInfo = *alarm; + } + else + aInfo.ClientFlags() = flags; + } + else if (error == KErrNotFound) + { + // Alarm has been deleted + TASShdAlarm* alarm = iClockAlarms[aAlarmIndex]; + alarm->Reset(); + aInfo = *alarm; + } + } + return error; + } + +TInt CAlmModel::ClockAlarmDelete(TInt aClockAlarmNum) + { + __ASSERT_DEBUG(aClockAlarmNum < KMaxClockAlarms, Panic(EModelOutOfRange)); + TASShdAlarm* alarm = iClockAlarms[aClockAlarmNum]; + __ASSERT_ALWAYS(alarm->Id() != KNullAlarmId, Fault(EModelfTryingToChangeStateOfNullClockAlarm)); + const TInt error = iAlmSvr.AlarmDelete(alarm->Id()); + if (error == KErrNone || error == KErrNotFound) + { + // Update cached representation of deleted alarm + alarm->Reset(); + } + return error; + } + +TTimeWClockAlarmState CAlmModel::ClockAlarmState(TInt aClockAlarmNum) const + { + __ASSERT_DEBUG(aClockAlarmNum < KMaxClockAlarms, Panic(EModelOutOfRange)); + // + const TASShdAlarm* alarm = iClockAlarms[aClockAlarmNum]; + if (alarm->ClientFlags().IsSet(EClockAlarmFlagsIsSet)) + { + switch(alarm->Status()) + { + case EAlarmStatusEnabled: + return ETimeWClockAlarmStateSet; + case EAlarmStatusDisabled: + return ETimeWClockAlarmStateDisabled; + } + } + return ETimeWClockAlarmStateNotSet; + } + +void CAlmModel::NextAlarmResetListL() +// +// Fetch a list of ids of all the alarms that are pending +// within the alarm server. +// + { + iAlmSvr.GetAlarmIdListByStateL(EAlarmStateQueued, iNextAlarmIds); + } + +void CAlmModel::NextAlarmClearList() + { + iNextAlarmIds.Reset(); + } + +TInt CAlmModel::NextAlarmNumber() const + { + return iAlmSvr.NumberOfAlarmsActiveInQueue(); + } + +TInt CAlmModel::NextAlarmDelete(TInt aIndex) +// +// Delete one of the next alarms +// + { + TInt ret = KErrNotFound; + if (aIndex < iNextAlarmIds.Count()) + { + const TAlarmId id = iNextAlarmIds[aIndex]; + ret = iAlmSvr.AlarmDelete(id); + } + return ret; + } + +TBool CAlmModel::NextAlarmCanDelete(TInt aIndex) const +// +// Determine whether can delete the specified alarm. +// + { + __ASSERT_DEBUG(aIndex < iNextAlarmIds.Count(), Panic(EModelOutOfRange)); + // + const TAlarmId id = iNextAlarmIds[aIndex]; + // + TASShdAlarm alarm; + if (iAlmSvr.GetAlarmDetails(id, alarm) == KErrNone) + { + return ( + alarm.Category() == KASCliCategoryClock || + alarm.State() == EAlarmStateSnoozed || + !alarm.HasOwningSession() + ); + } + return EFalse; + } + +TInt CAlmModel::NextAlarm(TFullName& aOwner, TASShdAlarm& aInfo) const +// +// Get information about the next alarm +// + { + aOwner = KNullDesC; + // + TAlarmId id = KNullAlarmId; + TInt ret = iAlmSvr.GetNextDueAlarmId(id); + if (ret == KErrNone) + { + if (id == KNullAlarmId) + { + aInfo.Reset(); + ret = KErrNotFound; + } + else + { + ret = iAlmSvr.GetAlarmDetails(id, aInfo); + if (ret == KErrNone) + ret = iAlmSvr.GetAlarmOwner(id, aOwner); + } + } + return ret; + } + +TInt CAlmModel::NextAlarmInfo(TInt aIndex, TFullName& aOwner, TASShdAlarm& aInfo) const +// +// Get info about the next alarm +// + { + TInt ret = KErrNotFound; + if (aIndex < iNextAlarmIds.Count()) + { + const TAlarmId id = iNextAlarmIds[aIndex]; + ret = iAlmSvr.GetAlarmDetails(id, aInfo); + if (ret == KErrNone) + { + ret = iAlmSvr.GetAlarmOwner(id, aOwner); + } + } + return ret; + } + +void CAlmModel::ReviewAlarmResetListL() + { + iAlmSvr.GetAlarmIdListByStateL(EAlarmStateNotified, iReviewAlarmIds); + } + +void CAlmModel::ReviewAlarmClearList() + { + iReviewAlarmIds.Reset(); + } + +TInt CAlmModel::ReviewAlarmNumber() const + { + return iAlmSvr.AlarmCountByState(EAlarmStateNotified); + } + +TInt CAlmModel::ReviewAlarmInfo(TInt aIndex, TASShdAlarm& aInfo) const +// +// Get information about a past alarm +// + { + TInt ret = KErrNotFound; + if (aIndex < iReviewAlarmIds.Count()) + { + const TAlarmId id = iReviewAlarmIds[aIndex]; + ret = iAlmSvr.GetAlarmDetails(id, aInfo); + } + return ret; + } + +void CAlmModel::AlarmSoundToggle() + { + TTimeWAlarmSoundState soundState = AlarmSoundState(); + if (soundState == ETimeWAlarmSoundOn) + AlarmSoundStateSet(EFalse); + else + AlarmSoundStateSet(ETrue); + } + +TInt CAlmModel::AlarmSoundStateSet(TBool aSoundOn) + { + TAlarmGlobalSoundState state = EAlarmGlobalSoundStateOn; + if (!aSoundOn) + state = EAlarmGlobalSoundStateOff; + + return iAlmSvr.SetAlarmSoundState(state); + } + +TTimeWAlarmSoundState CAlmModel::AlarmSoundState() const + { + // First check whether we're in a silent period + if (iAlmSvr.AlarmSoundsTemporarilySilenced()) + return ETimeWAlarmQuietPeriod; + + // We're not, so check global sound state and map + // to TimeW settings + TAlarmGlobalSoundState state = EAlarmGlobalSoundStateOff; + if (iAlmSvr.GetAlarmSoundState(state) == KErrNone) + { + if (state == EAlarmGlobalSoundStateOn) + return ETimeWAlarmSoundOn; + } + return ETimeWAlarmSoundOff; + } + +TTime CAlmModel::AlarmQuietPeriodEnd() const + { + TTime endTime; + if (iAlmSvr.GetAlarmSoundsSilentUntil(endTime) == KErrNone) + return endTime; + // + endTime.HomeTime(); + return endTime; + } + +TInt CAlmModel::OrphanAlarmNumber() const + { + // Get the alarms + RArray clockIds(KMaxClockAlarms); + CleanupClosePushL(clockIds); + iAlmSvr.GetAlarmIdListForCategoryL(KASCliCategoryClock, clockIds); + + //which are orphaned? + TInt count = clockIds.Count(); + TInt orphaned = 0; + for (TInt ii=0; iiHandleUpdate(aNotification); + iDoingViewNotify=EFalse; + } + +void CModelBase::SetResponderActive(CModelResponder* aResponder) +// +// Set the engines responder +// + { + iResponder=aResponder; + if (iResponder) + CActiveScheduler::Add(iResponder); + } + +void CModelBase::Start() +// +// Start the responder +// The engine requires that an active scheduler be installed +// + { + iResponder->Start(); + } + +void CModelBase::Stop() +// +// Stop the responder and the engine +// + { + if (iResponder) + iResponder->Cancel(); + } + +void CModelBase::SetTimewModelObserver(MTimewModelObserver *aObserver) +// +// Register the observer of the engine +// + { + iObserver=aObserver; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Src/SM_RSP.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Src/SM_RSP.CPP Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,91 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "sm_std.h" +#include "almmod.h" + +// +// class CModelResponder +// + +CModelResponder::CModelResponder(CModelBase& aModel,TInt aPriority) +// +// Base class constructor +// + : CActive(aPriority), iModel(&aModel) + { + } + +void CModelResponder::NotifyModel(TInt aStatus) +// +// Funnel all response to the engine +// + { + iModel->ProcessResponder(aStatus); + } + +void CModelResponder::RunL() +// +// Handle changes in the servers +// + { +// Reset the status request before notifiying the view +// so that it can catch anything untoward that the view does + TInt v=iStatus.Int(); + Start(); + NotifyModel(v); + } + +void CModelResponder::Start() +// +// Start the response +// + { + if (!IsActive()) + { + SetActive(); + DoStart(); + } + } + +// +// class CAlmResponder +// + +CAlmResponder::CAlmResponder(RASCliSession& aSvr,CAlmModel& aModel,TInt aResponderPriority) +// +// Protected constructor +// + : CModelResponder(aModel,aResponderPriority),iAlmSvr(&aSvr) + { + } + +void CAlmResponder::DoStart() +// +// Start a repsonse +// + { + iAlmSvr->NotifyChange(iStatus, iAlarmId); + } + +void CAlmResponder::DoCancel() +// +// Stop the response +// + { + if (iStatus == KRequestPending) + iAlmSvr->NotifyChangeCancel(); + } + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Src/SM_UTL.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Src/SM_UTL.CPP Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,34 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "sm_std.h" + + +GLDEF_C void Panic(TModelPanic aPanic) +// +// Panic in the engine +// + { + User::Panic(_L("TW-ENG-PANIC"),aPanic); + } + +GLDEF_C void Fault(TModelFault aFault) +// +// Fault in the engine +// + { + User::Panic(_L("TW-ENG-FAULT"),aFault); + } + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Src/TestTimewBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Src/TestTimewBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,62 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewCase which is the base class for all the Timew TestCase DLL +// +// + +// EPOC includes +#include +#include +#include +#include +#include "TestTimewbase.h" + +CTestTimewBase::CTestTimewBase() +: CTestStep() +, iSchedular(NULL) +, iModel(NULL) + { + } + +// destructor +CTestTimewBase::~CTestTimewBase() + { + delete iSchedular; + iSchedular=NULL; + } + +enum TVerdict CTestTimewBase::doTestStepPreambleL() + { + iSchedular=new CActiveScheduler(); + CActiveScheduler::Install(iSchedular); + + return CTestStep::doTestStepPreambleL(); + } + +enum TVerdict CTestTimewBase::doTestStepPostambleL() + { + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + + return CTestStep::doTestStepPostambleL(); + } + +CAlmModel* CTestTimewBase::Model(void) +/** +returns a pointer to an instance of CAgnModel +*/ + { + return iModel; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Src/TestTimewServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Src/TestTimewServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,106 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 main DLL entry point for the Smoketest_Timew.dll +// +// + + +// EPOC includes +#include + +#include "TestTimewServer.h" +#include "TestTimewSetAlarm.h" + + +_LIT(KServerName,"Smoketest_Timew_Server"); + +CTestTimewServer* CTestTimewServer::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. + */ + { + CTestTimewServer* server = new (ELeave) CTestTimewServer(); + CleanupStack::PushL(server); + // CServer base class call + server->StartL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +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().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTestTimewServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTestTimewServer::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()); + if (!err) { } + + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + } + + +CTestStep* CTestTimewServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Secure and non-secure variants + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep = NULL; + + if(aStepName == _L("SetAlarm")) + testStep = new CTestTimewSetAlarm(); + return testStep; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/Src/TestTimewSetAlarm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/Src/TestTimewSetAlarm.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,84 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewSetAlarm +// +// + +#include + +#include "TestTimewSetAlarm.h" + + +_LIT(KHour, "hour"); +_LIT(KMinute,"minute"); +_LIT(KMessage,"message"); +_LIT(KBells,"bells"); + + +// constructor +CTestTimewSetAlarm::CTestTimewSetAlarm() + { + SetTestStepName(_L("SetAlarm")); + } + +// destructor +CTestTimewSetAlarm::~CTestTimewSetAlarm() + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestTimewSetAlarm::doTestStepL( void ) + { + // Printing to the console and log file + INFO_PRINTF1(_L("TEST-> SETTING AN ALARM")); + TRAPD(r, SetAlarmL()); + + if (r!=KErrNone) + SetTestStepResult(EFail); + + // test steps return a result + return TestStepResult(); + } + +void CTestTimewSetAlarm::SetAlarmL( void ) + { + TInt hour; + TInt minute; + TPtrC ptrMessage; + + TTime alarmTime; + alarmTime.HomeTime(); + + if ( !GetIntFromConfig(ConfigSection(), KHour(), hour) ) + hour=alarmTime.DateTime().Hour(); + + if ( !GetIntFromConfig(ConfigSection(), KMinute(), minute) ) + minute=0; + + GetStringFromConfig(ConfigSection(), KMessage(), ptrMessage); + + + TDateTime dateTime=alarmTime.DateTime(); + dateTime.SetHour(hour); + dateTime.SetMinute(minute); + dateTime.SetSecond(0); + dateTime.SetMicroSecond(0); + iAlarmData.NextDueTime()=dateTime; + iAlarmData.RepeatDefinition()=(TAlarmRepeatDefinition)EAlarmRepeatDefintionRepeatNext24Hours; + iAlarmData.Message() = ptrMessage; + iAlarmData.SoundName()=KBells(); + iModel = CAlmModel::NewL(NULL,KPriorityAlarmResponder); + Model()->ClockAlarmSet(0,iAlarmData); + delete iModel; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Timew/TestData/Smoketest_Timew.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Timew/TestData/Smoketest_Timew.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,5 @@ +[24560_SetAlarm] +hour =9 +min =0 +message =make a cup of tea + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Inc/SmokeTestActive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Inc/SmokeTestActive.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,115 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestActive +// +// + +#if (!defined __SMOKETEST_ACTIVE_H__) +#define __SMOKETEST_ACTIVE_H__ + +#include + +/** + * Multimedia test timer completion callback + */ +class MTestActiveCallback + { +public: + /** + * Method from which CTestActive informs the user RunL call + */ + virtual void RunL() = 0; + /** + * Method from which CTestActive informs the user DoCancel call + */ + virtual void DoCancel() = 0; + }; + +/** + * Test Active Notification class + * + */ +class CTestActive : public CActive +{ +public: + /** + * Destructor + */ + IMPORT_C virtual ~CTestActive(); + + /** + * Two phase constructor that allocates and constructs + * a new Active object whos actions are performed by a callback + * + * \param aTestActiveCallback object to inform on RunL. + * \param aPriority priority of active object. + * \return New Callback active object. + */ + IMPORT_C static CTestActive* NewL(MTestActiveCallback& aTestActiveCallback, TInt aPriority=EPriorityStandard); + + /** + * Two phase constructor that allocates and constructs + * a new Active object whos actions are performed by a callback + * + * \param aTestActiveCallback object to inform on RunL. + * \param aPriority priority of active object. + * \return New Callback active object. + */ + IMPORT_C static CTestActive* NewLC(MTestActiveCallback& aTestActiveCallback, TInt aPriority=EPriorityStandard); + + /** + * Activate the object + */ + IMPORT_C void Activate(); + + /** + * Active object RunL implementation. + * + * Calls the MTestActiveCallback::RunL to inform user that the RunL has been reached. + */ + void RunL(); + /** + * Active object DoCancel implementation. + * + * Calls the MTestActiveCallback::DoCancel to inform user that the DoCancel has been reached. + */ + void DoCancel(); + +protected: + /** + * 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. + */ + CTestActive(MTestActiveCallback& aTestActiveCallback, TInt aPriority); + +private: + /** + * This is internal and not intended for use. + * + * Second phase of two phase constructor. + */ + void ConstructL(); + +private: + /** + * This is internal and not intended for use. + */ + MTestActiveCallback& iTestActiveCallback; +}; + +#endif /* __SMOKETEST_ACTIVE_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Inc/SmokeTestProperty.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Inc/SmokeTestProperty.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,93 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestProperty +// +// + +#if (!defined __SMOKETEST_PROPERTY_H__) +#define __SMOKETEST_PROPERTY_H__ + +// EPOC includes +#include +#include + +/** + This class contains generic utility method to set system wide variable usign publish and subscribe +*/ +class CTestProperty : public CBase +{ +public: + IMPORT_C CTestProperty(CTestStep& aTestStep); + IMPORT_C ~CTestProperty(); + + /** + * Set a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key + */ + IMPORT_C TInt SetPropertyL(const TUid aCategory, const TInt aKey, const TInt aValue); + + /** + * Set a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key + */ + IMPORT_C TInt SetPropertyL(const TUid aCategory, const TInt aKey, const TDesC8& aValue); + + /** + * Set a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key + */ + IMPORT_C TInt SetPropertyL(const TUid aCategory, const TInt aKey, const TDesC16& aValue); + + /** + * Get a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key returned + */ + IMPORT_C TInt GetPropertyL(const TUid aCategory, const TInt aKey, TInt& aValue); + + /** + * Get a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key returned + */ + IMPORT_C TInt GetPropertyL(const TUid aCategory, const TInt aKey, TDes8& aValue); + + /** + * Get a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key returned + */ + IMPORT_C TInt GetPropertyL(const TUid aCategory, const TInt aKey, TDes16& aValue); + +private: + CTestStep& iTestStep; + RProperty iProperty; +}; + +#endif /* __SMOKETEST_PROPERTY_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Inc/SmokeTestSecureFSclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Inc/SmokeTestSecureFSclient.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +#ifndef __SMOKETEST_SECURE_FS_CLIENT_H__ +#define __SMOKETEST_SECURE_FS_CLIENT_H__ + +#include + +class RTestSecureFSclient : public RSessionBase + { +public: + IMPORT_C TInt Connect(); + IMPORT_C TInt SetHomeTime(const TTime& aTime); + IMPORT_C TInt DeleteFileL(const TDesC& aFileName); + IMPORT_C void KillProcessL(const TDesC& aProcessName); + IMPORT_C TInt ChangeLocaleName(const TDesC& aLocaleDllName); + IMPORT_C TInt CheckForFile(const TDesC& aFileName); + IMPORT_C TInt CopyFile(const TDesC& Source, const TDesC& Dest); + IMPORT_C void SetUpFbs(); + }; + +#endif // __SMOKETEST_SECURE_FS_CLIENT_H__ \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Inc/SmokeTestSecureFSclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Inc/SmokeTestSecureFSclientserver.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// clientserver - shared client/server definitions +// +// + +#ifndef __SMOKETEST_SECURE_FS_CLIENT_SERVER_H__ +#define __SMOKETEST_SECURE_FS_CLIENT_SERVER_H__ + +#include + +_LIT(KTestServerName,"SmokeTestSecureFSserver"); +_LIT(KTestServerImg,"SmokeTestSecureFSserver"); // EXE name +const TUid KServerUid3={0x101FF346}; + +const TInt KMaxTestMessage=8; + +enum TTestIpc + { + ETestIpcSetHomeTime, + ETestIpcDeleteFile, + ETestIpcKillProcess, + ETestIpcChangeLocale, + ETestIpcCheckForFile, + ETestIpcCopyFile, + ETestIpcSetUpFbs, + }; + +#endif // __SMOKETEST_SECURE_FS_CLIENT_SERVER_H__ \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Inc/SmokeTestSecureFSserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Inc/SmokeTestSecureFSserver.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// TestServer - server classes +// +// + +#ifndef __SMOKETEST_SECURE_FS_SERVER_H__ +#define __SMOKETEST_SECURE_FS_SERVER_H__ + +#include +#include "SmokeTestSecureFSclientserver.h" + +enum TTestPanic + { + EPanicBadDescriptor, + EPanicIllegalFunction, + EPanicAlreadyReceiving + }; + +void PanicClient(const RMessage2& aMessage,TTestPanic TMyPanic); + +class CTestSecureFSshutdown : public CTimer + { + enum {KMyShutdownDelay=0x500000}; // approx 5s +public: + inline CTestSecureFSshutdown(); + inline void ConstructL(); + inline void Start(); +private: + void RunL(); + }; + +class CTestSecureFSserver : public CServer2 + { +public: + static CServer2* NewLC(); + void AddSession(); + void DropSession(); + void Send(const TDesC& aMessage); +private: + CTestSecureFSserver(); + void ConstructL(); + // CSharableSession* NewSessionL(const TVersion& aVersion, const RMessage& aMessage) const; + CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; +private: + TInt iSessionCount; + CTestSecureFSshutdown iShutdown; + }; + +//class CTestSecureFSSession : public CSharableSession +class CTestSecureFSSession : public CSession2 + { +public: + CTestSecureFSSession(); + void CreateL(); + void Send(const TDesC& aMessage); +private: + ~CTestSecureFSSession(); + inline CTestSecureFSserver& Server(); + void ServiceL(const RMessage2& aMessage); + void ServiceError(const RMessage2& aMessage,TInt aError); + inline TBool ReceivePending() const; +private: + void DoSetHomeTime(const RMessage2& aMessage); + + // General File Manipulation + TInt DoDeleteFileL(const RMessage2& aMessage); + + // Power User + void DoKillProcess(const RMessage2& aMessage); + TInt DoChangeLocale(const RMessage2& aMessage); + TInt DoCheckForFile(const RMessage2& aMessage); + TInt DoCopyFile(const RMessage2& aMessage); + void DoSetUpFbs(); + +private: + RMessage2 iReceive; + }; + +#endif // __SMOKETEST_SECURE_FS_SERVER_H__ \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Inc/SmokeTestTimeOutTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Inc/SmokeTestTimeOutTimer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,102 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimeOutTimer +// +// + +#if (!defined __SMOKETEST_TIMEOUT_TIMER_H_) +#define __SMOKETEST_TIMEOUT_TIMER_H_ + +#include + +/** + * Multimedia test timer completion callback + */ +class MTestTimeOutTimerCallback + { +public: + /** + * Method from which CTestTimeOutTimer informs the user of the timer completion. + */ + virtual void TimerCompleted() = 0; + }; + +/** + * Multimedia test timer active object. + * + * On timer completion MTestTimeOutTimerCallback::TimerCompleted is called + * to inform the user off the completion + */ +class CTestTimeOutTimer : public CTimer +{ +public: + /** + * Destructor + */ + IMPORT_C virtual ~CTestTimeOutTimer(); + + /** + * Two phase constructor that allocates and constructs + * a new Multimedia timer a timer completion callback and priority. + * + * \param aTestTimerCallback object to inform on timer completion. + * \param aPriority priority of active object. + * \return New Multimedia test timer active object. + */ + IMPORT_C static CTestTimeOutTimer* NewL(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority=EPriorityStandard); + + /** + * Two phase constructor that allocates and constructs + * a new Multimedia timer a timer completion callback and priority. + * + * \param aTestTimerCallback object to inform on timer completion. + * \param aPriority priority of active object. + * \return New Multimedia test timer active object. + */ + IMPORT_C static CTestTimeOutTimer* NewLC(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority=EPriorityStandard); + + /** + * Active object RunL implementation. + * + * Calls the MTestTimeOutTimerCallback::TimerCompleted to inform user that the timer has completed. + */ + void RunL(); + +protected: + /** + * 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. + */ + CTestTimeOutTimer(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority); + +private: + /** + * This is internal and not intended for use. + * + * Second phase of two phase constructor. + */ + void ConstructL(); + +private: + /** + * This is internal and not intended for use. + */ + MTestTimeOutTimerCallback& iTestTimerCallback; +}; + +#endif /* __SMOKETEST_TIMEOUT_TIMER_H_ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Inc/TestStepSmokeTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Inc/TestStepSmokeTest.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,77 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestStepSmokeTest + +#if (!defined __TEST_STEP_SMOKETEST_H__) +#define __TEST_STEP_SMOKETEST_H__ + +//TEF include +#include + +enum TTestLoggingDetail + { + ETestLoggingDetail_Min, + ETestLoggingDetail_Normal, + ETestLoggingDetail_Max, + }; + +#if (defined __VERSION_70S__) +enum TCapability + { + ECapabilityTCB = 0, + }; +#endif + +/** + This class is the base class for all the test steps in smoketest. +*/ +class CTestStepSmokeTest : public CTestStep + { +public: + //Destructor + IMPORT_C virtual ~CTestStepSmokeTest(); + + /** + Pure virtual, to be implemented by the derived test steps. + It implements the required functionality of the test step. + @return TVerdict - result of the test step + @leave - System wide error codes + */ + IMPORT_C virtual enum TVerdict doTestStepL() = 0; + + //Implements the preoperational functionalities for a test step + IMPORT_C virtual enum TVerdict doTestStepPreambleL(); + + //Implements the post operational fucntionalities for a test step + IMPORT_C virtual enum TVerdict doTestStepPostambleL(); + + TTestLoggingDetail LoggingDetail() const { return iLoggingDetail; } + TInt Repetition() const { return iRepetition; } + +protected: + //Constructor + IMPORT_C CTestStepSmokeTest(); + + //Gets the TCapability value for the capabilty string literal + IMPORT_C TInt GetCapability(TPtrC aCapability, TCapability& aCapabilityValue); + + //Verifies the given time is nearly eaual to current UTC time + IMPORT_C TBool VerifyUTCTime(TTime aTime); + +private: + TTestLoggingDetail iLoggingDetail; + TInt iRepetition; + }; + +#endif /* __TEST_STEP_SMOKETEST_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Src/SmokeTestActive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Src/SmokeTestActive.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,69 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// SmokeTestTestActive.h +// This contains CTestActive +// +// + +#include "SmokeTestActive.h" + + +// +// Construction/Destruction +// + +EXPORT_C CTestActive::~CTestActive() + { + } + +EXPORT_C CTestActive* CTestActive::NewL(MTestActiveCallback& aTestActiveCallback, TInt aPriority) + { + CTestActive* self=NewLC(aTestActiveCallback, aPriority); + CleanupStack::Pop(); + return self; + } + +EXPORT_C CTestActive* CTestActive::NewLC(MTestActiveCallback& aTestActiveCallback, TInt aPriority) + { + CTestActive* self=new(ELeave) CTestActive(aTestActiveCallback, aPriority); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +EXPORT_C void CTestActive::Activate() + { + SetActive(); + } + +CTestActive::CTestActive(MTestActiveCallback& aTestActiveCallback, TInt aPriority) +: CActive(aPriority) +, iTestActiveCallback(aTestActiveCallback) + { + } + +void CTestActive::ConstructL() + { + CActiveScheduler::Add(this); + } + +void CTestActive::RunL() + { + iTestActiveCallback.RunL(); + } + +void CTestActive::DoCancel() + { + iTestActiveCallback.DoCancel(); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Src/SmokeTestProperty.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Src/SmokeTestProperty.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,140 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestProperty +// +// + +#include "SmokeTestProperty.h" + +// EPOC32 include +#include + +EXPORT_C CTestProperty::CTestProperty(CTestStep& aTestStep) +: CBase() +, iTestStep(aTestStep) + { + } + +EXPORT_C CTestProperty::~CTestProperty() + { + } + +EXPORT_C TInt CTestProperty::SetPropertyL(const TUid aCategory, const TInt aKey, const TInt aValue) + { + //Define the property, in case it is being used for the first time. + TInt ret=RProperty::Define(aCategory, aKey, RProperty::EInt); + if ( (ret==KErrNone) || (ret== KErrAlreadyExists) ) + { + //Attach to the property so that you can track any chnages to it. + ret=iProperty.Attach(aCategory, aKey); + if ( ret==KErrNone ) + { + //Set the new test number and wait until the change is in effect. + TRequestStatus status; + iProperty.Subscribe(status); + ret=iProperty.Set(aCategory, aKey, aValue); + if ( ret==KErrNone ) + { + User::WaitForRequest(status); + ret=status.Int(); + if ( ret != KErrNone ) + { + iTestStep.INFO_PRINTF2(_L("request complete error=%d"), ret); + } + } + else + { + iTestStep.INFO_PRINTF2(_L("RProperty::Set error=%d"), ret); + } + iProperty.Close(); + } + else + { + iTestStep.INFO_PRINTF2(_L("RProperty::Attach error=%d"), ret); + } + } + else + { + iTestStep.INFO_PRINTF2(_L("RProperty::Define error=%d"), ret); + } + + return ret; + } + +EXPORT_C TInt CTestProperty::SetPropertyL(const TUid aCategory, const TInt aKey, const TDesC8& aValue) + { + //Define the property, in case it is being used for the first time. + TInt ret=RProperty::Define(aCategory, aKey, RProperty::EByteArray); + if ( (ret==KErrNone) || (ret== KErrAlreadyExists) ) + { + //Attach to the property so that you can track any chnages to it. + ret=iProperty.Attach(aCategory, aKey); + if ( ret==KErrNone ) + { + //Set the new test number and wait until the change is in effect. + TRequestStatus status; + iProperty.Subscribe(status); + ret=iProperty.Set(aCategory, aKey, aValue); + if ( ret==KErrNone ) + { + User::WaitForRequest(status); + ret=status.Int(); + } + iProperty.Close(); + } + } + + return ret; + } + +EXPORT_C TInt CTestProperty::SetPropertyL(const TUid aCategory, const TInt aKey, const TDesC16& aValue) + { + //Define the property, in case it is being used for the first time. + TInt ret=RProperty::Define(aCategory, aKey, RProperty::EText); + if ( (ret==KErrNone) || (ret== KErrAlreadyExists) ) + { + //Attach to the property so that you can track any chnages to it. + ret=iProperty.Attach(aCategory, aKey); + if ( ret==KErrNone ) + { + //Set the new test number and wait until the change is in effect. + TRequestStatus status; + iProperty.Subscribe(status); + ret=iProperty.Set(aCategory, aKey, aValue); + if ( ret==KErrNone ) + { + User::WaitForRequest(status); + ret=status.Int(); + } + iProperty.Close(); + } + } + + return ret; + } + +EXPORT_C TInt CTestProperty::GetPropertyL(const TUid aCategory, const TInt aKey, TInt& aValue) + { + return RProperty::Get(aCategory, aKey, aValue); + } + +EXPORT_C TInt CTestProperty::GetPropertyL(const TUid aCategory, const TInt aKey, TDes8& aValue) + { + return RProperty::Get(aCategory, aKey, aValue); + } + +EXPORT_C TInt CTestProperty::GetPropertyL(const TUid aCategory, const TInt aKey, TDes16& aValue) + { + return RProperty::Get(aCategory, aKey, aValue); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Src/SmokeTestSecureFSclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Src/SmokeTestSecureFSclient.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,113 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 - client interface implementation +// +// + +#include +#include +#include "SmokeTestSecureFSclientserver.h" +#include "SmokeTestSecureFSclient.h" + +static TInt StartServer() +// +// Start the server process. Simultaneous launching +// of two such processes should be detected when the second one attempts to +// create the server object, failing with KErrAlreadyExists. +// + { + const TUidType serverUid(KNullUid,KNullUid,KServerUid3); + + + RProcess server; + TInt r=server.Create(KTestServerImg, KNullDesC, serverUid); + + 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 + // 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 + r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); + server.Close(); + return r; + } + +EXPORT_C TInt RTestSecureFSclient::Connect() + {// Connect to the server, attempting to start it if necessary + TInt retry=2; + for (;;) + { + TInt r=CreateSession(KTestServerName,TVersion(0,0,0),1); + if (r!=KErrNotFound && r!=KErrServerTerminated) + return r; + if (--retry==0) + return r; + r=StartServer(); + if (r!=KErrNone && r!=KErrAlreadyExists) + return r; + User::After(1000000); //Let server load up (in EKA2) + + } + } + +EXPORT_C TInt RTestSecureFSclient::SetHomeTime(const TTime& aTime) + { + TPckg pckg(aTime); + return SendReceive(ETestIpcSetHomeTime,TIpcArgs(&pckg)); + } + +EXPORT_C TInt RTestSecureFSclient::DeleteFileL(const TDesC& aFileName) + { + TIpcArgs args(&aFileName); + return SendReceive(ETestIpcDeleteFile,args); + } + +EXPORT_C void RTestSecureFSclient::KillProcessL(const TDesC& aProcessName) + { + TIpcArgs args(&aProcessName); + User::LeaveIfError(SendReceive(ETestIpcKillProcess,args)); + } + +EXPORT_C TInt RTestSecureFSclient::ChangeLocaleName(const TDesC& aLocaleDllName) + { + TIpcArgs args(&aLocaleDllName); + return SendReceive(ETestIpcChangeLocale,args); + } + +EXPORT_C TInt RTestSecureFSclient::CheckForFile(const TDesC& aFileName) + { + TIpcArgs args(&aFileName); + return SendReceive(ETestIpcCheckForFile,args); + } + +EXPORT_C TInt RTestSecureFSclient::CopyFile(const TDesC& Source, const TDesC& Dest) + { + TIpcArgs args(&Source, &Dest); + return SendReceive(ETestIpcCopyFile,args); + } + +EXPORT_C void RTestSecureFSclient::SetUpFbs() + { + SendReceive(ETestIpcSetUpFbs); + } + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Src/SmokeTestSecureFSserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Src/SmokeTestSecureFSserver.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,393 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestServer - server implementation +// +// + +#include "e32std.h" +#include "SmokeTestSecureFSserver.h" +#include + +TRequestStatus aStatus; +TRequestStatus* aSt = &aStatus; + + +inline CTestSecureFSshutdown::CTestSecureFSshutdown() + :CTimer(-1) + {CActiveScheduler::Add(this);} +inline void CTestSecureFSshutdown::ConstructL() + {CTimer::ConstructL();} +inline void CTestSecureFSshutdown::Start() + {After(KMyShutdownDelay);} + +inline CTestSecureFSserver::CTestSecureFSserver() + :CServer2(0,ESharableSessions) + {} + +inline CTestSecureFSSession::CTestSecureFSSession() + {} +inline CTestSecureFSserver& CTestSecureFSSession::Server() + {return *static_cast(const_cast(CSession2::Server()));} +inline TBool CTestSecureFSSession::ReceivePending() const + {return !iReceive.IsNull();} + +// + +void CTestSecureFSSession::CreateL() +// +// 2nd phase construct for sessions - called by the CServer framework +// + { + //RDebug::Print(_L("Server::CTestSecureFSSession::CreateL - start")); + + Server().AddSession(); + //RDebug::Print(_L("Server::CTestSecureFSSession::CreateL - end")); + } + +CTestSecureFSSession::~CTestSecureFSSession() + { + Server().DropSession(); + } + +void CTestSecureFSSession::Send(const TDesC& aMessage) +// +// Deliver the message to the client, truncating if required +// If the write fails, panic the client, not the sender +// + { + if (ReceivePending()) + { + TPtrC m(aMessage); + if (iReceive.Int1() pckg; + aMessage.Read(0,pckg); + User::SetHomeTime(pckg()); + } + +TInt CTestSecureFSSession::DoDeleteFileL(const RMessage2& aMessage) + { + RFs fs; + TFileName* const fileName=new(ELeave) TFileName; + CleanupStack::PushL(fileName); + User::LeaveIfError(fs.Connect()); + + CleanupClosePushL(fs); + aMessage.ReadL(0,*fileName); + TInt err=fs.Delete(*fileName); + if (!(err==KErrNone || err==KErrNotFound || err==KErrPathNotFound)) // ignore not found error + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(&fs); + CleanupStack::PopAndDestroy(fileName); + return err; + } + +void CTestSecureFSSession::DoKillProcess(const RMessage2& aMessage) + { + TFullName* name = new(ELeave) TFullName; + CleanupStack::PushL(name); + + aMessage.ReadL(0,*name); + TFindProcess* finder = new (ELeave) TFindProcess(*name); + CleanupStack::PushL(finder); + RProcess* process = new (ELeave) RProcess; + CleanupStack::PushL(process); + + if (finder->Next(*name) == KErrNone) + { + if (process->Open(*name) == KErrNone) + { + process->Kill(KErrNone); + } + } + + if (process != NULL) + { + process->Close(); + } + CleanupStack::PopAndDestroy(process); + CleanupStack::PopAndDestroy(finder); + CleanupStack::PopAndDestroy(name); + } + + +TInt CTestSecureFSSession::DoChangeLocale(const RMessage2& aMessage) + { + TBuf<50> locname; + TInt result; + aMessage.ReadL(0,locname); + + result = UserSvr::ChangeLocale(locname); + + return result; + } + +TInt CTestSecureFSSession::DoCheckForFile(const RMessage2& aMessage) +{ + RFs fs; + TInt err; + TFileName* const fileName=new(ELeave) TFileName; + CleanupStack::PushL(fileName); + User::LeaveIfError(fs.Connect()); + + CleanupClosePushL(fs); + aMessage.ReadL(0,*fileName); + + TUint attribs; + err=fs.Att(*fileName, attribs); + fs.Close(); + + CleanupStack::PopAndDestroy(&fs); + CleanupStack::PopAndDestroy(fileName); + return err; + +} + +TInt CTestSecureFSSession::DoCopyFile(const RMessage2& aMessage) +{ + + RFs fs; + TInt result; + + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + TFileName fileSource; + TFileName fileDest; + + aMessage.ReadL(0,fileSource); + aMessage.ReadL(1,fileDest); + + CFileMan* fileMan = NULL; + + fileMan = CFileMan::NewL(fs); + CleanupStack::PushL( fileMan ); + + fs.MkDirAll(fileDest); + result = fileMan->Copy( fileSource, fileDest, CFileMan::EOverWrite ); + + User::LeaveIfError(fs.Connect()); + fs.SetAtt(fileDest,KEntryAttNormal,KEntryAttReadOnly); + fs.Close(); + + CleanupStack::PopAndDestroy(fileMan); + CleanupStack::PopAndDestroy(&fs); + return result; + +} + +void CTestSecureFSSession::DoSetUpFbs() +{ +// FbsStartup(); +// User::LeaveIfError( RFbsSession::Connect() ); +// CleanupStack::PushL( TCleanupItem( TCleanupOperation(&RFbsSession::Disconnect ), NULL ) ); +} + +// + +void CTestSecureFSSession::ServiceError(const RMessage2& aMessage,TInt aError) +// +// Handle an error from CMySession::ServiceL() +// A bad descriptor error implies a badly programmed client, so panic it; +// otherwise use the default handling (report the error to the client) +// + { + if (aError==KErrBadDescriptor) + PanicClient(aMessage,EPanicBadDescriptor); + CSession2::ServiceError(aMessage,aError); + } + +void CTestSecureFSshutdown::RunL() +// +// Initiate server exit when the timer expires +// + { + CActiveScheduler::Stop(); + } + +CServer2* CTestSecureFSserver::NewLC() + { + CTestSecureFSserver* self=new(ELeave) CTestSecureFSserver; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +void CTestSecureFSserver::ConstructL() +// +// 2nd phase construction - ensure the timer and server objects are running +// + { + StartL(KTestServerName); + iShutdown.ConstructL(); + // ensure that the server still exits even if the 1st client fails to connect + iShutdown.Start(); + } + + +CSession2* CTestSecureFSserver::NewSessionL(const TVersion&,const RMessage2&) const +// +// Cretae a new client session. This should really check the version number. +// + { + return new(ELeave) CTestSecureFSSession(); + } + +void CTestSecureFSserver::AddSession() +// +// A new session is being created +// Cancel the shutdown timer if it was running +// + { + ++iSessionCount; + iShutdown.Cancel(); + } + +void CTestSecureFSserver::DropSession() +// +// A session is being destroyed +// Start the shutdown timer if it is the last session. +// + { + if (--iSessionCount==0) + iShutdown.Start(); + } + +void CTestSecureFSserver::Send(const TDesC& aMessage) +// +// Pass on the signal to all clients +// + { + iSessionIter.SetToFirst(); + CSession2* s; + while ((s=iSessionIter++)!=0) + static_cast(s)->Send(aMessage); + } + +void PanicClient(const RMessage2& aMessage,TTestPanic aPanic) +// +// RMessage::Panic() also completes the message. This is: +// (a) important for efficient cleanup within the kernel +// (b) a problem if the message is completed a second time +// + { + _LIT(KPanic,"TestServer"); + aMessage.Panic(KPanic,aPanic); + } + + + +/** +Perform all server initialisation, in particular creation of the +scheduler and server and then run the scheduler +*/ + +static void RunServerL() + { + // naming the server thread after the server helps to debug panics + User::LeaveIfError(RThread::RenameMe(KTestServerName)); + // create and install the active scheduler we need + CActiveScheduler* s=new(ELeave) CActiveScheduler; + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + CTestSecureFSserver::NewLC(); // create the server (leave it on the cleanup stack) + RProcess::Rendezvous(KErrNone); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy(2); // Cleanup the server and scheduler + } + + + + +TInt E32Main() +// +// Server process entry-point +// + { + __UHEAP_MARK; + // + RDebug::Print(_L("Server::E32Main Version 0.0.0")); + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,RunServerL()); + delete cleanup; + } + // + __UHEAP_MARKEND; + return r; + } + + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Src/SmokeTestTimeOutTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Src/SmokeTestTimeOutTimer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,59 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// SmokeTestTimeOutTimer.h +// This contains CTestTimeOutTimer +// +// + +#include "SmokeTestTimeOutTimer.h" + +// +// Construction/Destruction +// + +EXPORT_C CTestTimeOutTimer::~CTestTimeOutTimer() + { + } + +EXPORT_C CTestTimeOutTimer* CTestTimeOutTimer::NewL(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority) + { + CTestTimeOutTimer* self=NewLC(aTestTimerCallback, aPriority); + CleanupStack::Pop(); + return self; + } + +EXPORT_C CTestTimeOutTimer* CTestTimeOutTimer::NewLC(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority) + { + CTestTimeOutTimer* self=new(ELeave) CTestTimeOutTimer(aTestTimerCallback, aPriority); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CTestTimeOutTimer::CTestTimeOutTimer(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority) +: CTimer(aPriority) +, iTestTimerCallback(aTestTimerCallback) + { + } + +void CTestTimeOutTimer::ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + +void CTestTimeOutTimer::RunL() + { + iTestTimerCallback.TimerCompleted(); + }; diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/Src/TestStepSmokeTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/Src/TestStepSmokeTest.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,345 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestStepSmokeTest +// +// + +//user include +#include "TestStepSmokeTest.h" + +//Epoc include +#include +#include +#include + +/*@{*/ +_LIT(KExpectedCapCheckResult, "ExpectedCapCheckResult"); +_LIT(KConfigFile, "C:\\plattest\\platsec\\plattest_capabilities.config"); +_LIT(KDefault, "default"); +_LIT(KCapTest, "CapabilityTest"); +_LIT(KNo, "No"); + +_LIT(KLogging, "logging"); +_LIT(KLoggingMin, "min"); +_LIT(KLoggingNormal, "normal"); +_LIT(KLoggingMax, "max"); + +_LIT(KRepetition, "repetition"); +/*@}*/ + +// +// Construction/Destruction +// + +/** + Constructor +*/ +EXPORT_C CTestStepSmokeTest::CTestStepSmokeTest() +: CTestStep() +, iLoggingDetail(ETestLoggingDetail_Normal) +, iRepetition(1) + { + } + +/** + Destructor +*/ +EXPORT_C CTestStepSmokeTest::~CTestStepSmokeTest() + { + } + + +/** + The overriden implementation of CTestStep::doTestStepPreambleL() + @return TVerdict- result of the test step + @leave - system wide error codes +*/ +EXPORT_C TVerdict CTestStepSmokeTest::doTestStepPreambleL() + { + TVerdict ret = CTestStep::doTestStepPreambleL(); + + // Get logging + TPtrC logging; + if ( GetStringFromConfig(ConfigSection(), KLogging, logging) ) + { + INFO_PRINTF2(_L("Logging value %S"), &logging); + if ( logging.Compare(KLoggingMin) == 0 ) + { + iLoggingDetail=ETestLoggingDetail_Min; + } + else if ( logging.Compare(KLoggingNormal) == 0 ) + { + iLoggingDetail=ETestLoggingDetail_Normal; + } + else if ( logging.Compare(KLoggingMax) == 0 ) + { + iLoggingDetail=ETestLoggingDetail_Max; + } + else + { + ERR_PRINTF1(_L("Illegal logging value, use min, normal or max.")); + ret=EFail; + } + } + + // Get repetition count of test + GetIntFromConfig(ConfigSection(), KRepetition, iRepetition); + INFO_PRINTF2(_L("Repetition %d"), iRepetition); + + return ret; + } + +/** + The overriden implementation of CTestStep::doTestStepPostambleL() + It implements the functionality of capability checking if + _PLATTEST_CAPTEST_ is ON. + @return TVerdict- result of the test step + @leave - system wide error codes +*/ + +EXPORT_C TVerdict CTestStepSmokeTest::doTestStepPostambleL() + { + + //Read whether to do capability testing.. + TPtrC captest(KNo); + GetStringFromConfig(KDefault, KCapTest, captest); + if( captest.Compare(_L("YES")) == 0) + { + INFO_PRINTF1(_L("---Capability Testing---")); + //Gets the capabilities config file + TBuf scriptFile; + scriptFile.Copy(KConfigFile); + INFO_PRINTF2(_L("The config file %S"), &scriptFile); + + TBuf8 scriptSection; + scriptSection.Copy(_L("Capabilities")); + + TPtrC serverName = GetServerName(); + INFO_PRINTF2(_L("The server name is %S"), &serverName); + HBufC8 *scriptItem = HBufC8::NewLC(serverName.Length()); + scriptItem->Des().Copy(serverName); + + //Get the file server session object + RFs rFs; + TInt err=rFs.Connect(); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Failed to connect with File server")); + SetTestStepResult(EFail); + } + else + { + CleanupClosePushL(rFs); + //Get the config file + CTestConfig* configFile = CTestConfig::NewLC(rFs, KNullDesC, scriptFile); + if( configFile == NULL) + { + WARN_PRINTF1(_L("NO Config file found -- Plattest_capabilites.config")); + } + else + { + //Get the item value from config file + TBuf8 itemValue; + itemValue = configFile->Section(scriptSection)->Item(scriptItem->Des())->Value(); + TLex8 capabilityParser(itemValue); + TBool capCheckResult= ETrue; + + while(!capabilityParser.Eos()) + { + //Parse the capabilities + TPtrC8 capability(capabilityParser.NextToken()); + + HBufC* capabilityRead = HBufC::NewLC(capability.Length()); + capabilityRead->Des().Copy(capability); + INFO_PRINTF2(_L("Capability Read is %S"), capabilityRead); + + //Get the capability value + TCapability capabilityValue; + TPtrC ptrCapabilty(capabilityRead->Des()); + TInt err = GetCapability(ptrCapabilty, capabilityValue); + if( err != KErrNone) + { + WARN_PRINTF1(_L("The capability is not found")); + } + else + { + //Check if the current process posses the required capability + if( !RProcess().HasCapability(capabilityValue) ) + { + INFO_PRINTF2(_L("The capability %S is not possesed."), capabilityRead); + capCheckResult=EFalse; + } + else + { + INFO_PRINTF2(_L("The capability %S is possesed."), capabilityRead); + } + } + CleanupStack::PopAndDestroy(capabilityRead); + } + + //read the expected capability check result + TBool expectedCapCheckResult = ETrue; + GetBoolFromConfig(ConfigSection(), KExpectedCapCheckResult, expectedCapCheckResult); + INFO_PRINTF2(_L("The expected cap check result is %D"), expectedCapCheckResult); + INFO_PRINTF2(_L("The cap check result is %D"), capCheckResult); + + if(expectedCapCheckResult == capCheckResult) + { + SetTestStepResult(EPass); + } + else + { + SetTestStepResult(EFail); + } + } + CleanupStack::PopAndDestroy(2, &rFs); + } + CleanupStack::PopAndDestroy(scriptItem); + if(TestStepError() == KErrPermissionDenied) + { + INFO_PRINTF1(_L(" The failure is due to Platform Security")); + } + } + + TVerdict ret = CTestStep::doTestStepPostambleL(); + return ret; + } + +/** + 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 +*/ +EXPORT_C TInt CTestStepSmokeTest::GetCapability(TPtrC aCapability, TCapability& aCapabilityValue) + { + INFO_PRINTF2(_L("The capability get is %S"), &aCapability); + TInt ret=KErrNone; + + TBuf 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("none"))) + { + aCapabilityValue=ECapability_None; + } + else + { + INFO_PRINTF2(_L("Unrecognised capability %S, will be rejected"), &capCaseValue); + ret=KErrNotFound; + } + + return ret; + } + + +/** + Verifies the given time is nearly equal to current UTC time. + @param aTime - Time needs to be verified + @return TBool - Returns ETrue if aTime is nearly equal to current UTC + time, otherwise EFalse + @leave - None +*/ +EXPORT_C TBool CTestStepSmokeTest::VerifyUTCTime(TTime aTime) + { + TTime homeTime; + TTimeIntervalSeconds utcOffset; + + homeTime.HomeTime(); + homeTime.SecondsFrom(aTime, utcOffset); + INFO_PRINTF2(_L("Calculated utcOffset: %D"), utcOffset.Int()); + if(Abs(utcOffset.Int()) <= (User::UTCOffset().Int()+120) + && Abs(utcOffset.Int()) >= (User::UTCOffset().Int()-120)) + { + return ETrue; + } + else + { + return EFalse; + } + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/bwins/SmokeTestSecureFSClientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/bwins/SmokeTestSecureFSClientU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,10 @@ +EXPORTS + ?ChangeLocaleName@RTestSecureFSclient@@QAEHABVTDesC16@@@Z @ 1 NONAME ; int RTestSecureFSclient::ChangeLocaleName(class TDesC16 const &) + ?CheckForFile@RTestSecureFSclient@@QAEHABVTDesC16@@@Z @ 2 NONAME ; int RTestSecureFSclient::CheckForFile(class TDesC16 const &) + ?Connect@RTestSecureFSclient@@QAEHXZ @ 3 NONAME ; int RTestSecureFSclient::Connect(void) + ?CopyFile@RTestSecureFSclient@@QAEHABVTDesC16@@0@Z @ 4 NONAME ; int RTestSecureFSclient::CopyFile(class TDesC16 const &, class TDesC16 const &) + ?DeleteFileL@RTestSecureFSclient@@QAEHABVTDesC16@@@Z @ 5 NONAME ; int RTestSecureFSclient::DeleteFileL(class TDesC16 const &) + ?KillProcessL@RTestSecureFSclient@@QAEXABVTDesC16@@@Z @ 6 NONAME ; void RTestSecureFSclient::KillProcessL(class TDesC16 const &) + ?SetHomeTime@RTestSecureFSclient@@QAEHABVTTime@@@Z @ 7 NONAME ; int RTestSecureFSclient::SetHomeTime(class TTime const &) + ?SetUpFbs@RTestSecureFSclient@@QAEXXZ @ 8 NONAME ; void RTestSecureFSclient::SetUpFbs(void) + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/bwins/SmokeTest_UtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/bwins/SmokeTest_UtilsU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,23 @@ +EXPORTS + ??0CTestProperty@@QAE@AAVCTestStep@@@Z @ 1 NONAME ; CTestProperty::CTestProperty(class CTestStep &) + ??0CTestStepSmokeTest@@IAE@XZ @ 2 NONAME ; CTestStepSmokeTest::CTestStepSmokeTest(void) + ??1CTestActive@@UAE@XZ @ 3 NONAME ; CTestActive::~CTestActive(void) + ??1CTestProperty@@UAE@XZ @ 4 NONAME ; CTestProperty::~CTestProperty(void) + ??1CTestStepSmokeTest@@UAE@XZ @ 5 NONAME ; CTestStepSmokeTest::~CTestStepSmokeTest(void) + ??1CTestTimeOutTimer@@UAE@XZ @ 6 NONAME ; CTestTimeOutTimer::~CTestTimeOutTimer(void) + ?Activate@CTestActive@@QAEXXZ @ 7 NONAME ; void CTestActive::Activate(void) + ?GetCapability@CTestStepSmokeTest@@IAEHVTPtrC16@@AAW4TCapability@@@Z @ 8 NONAME ; int CTestStepSmokeTest::GetCapability(class TPtrC16, enum TCapability &) + ?GetPropertyL@CTestProperty@@QAEHVTUid@@HAAH@Z @ 9 NONAME ; int CTestProperty::GetPropertyL(class TUid, int, int &) + ?GetPropertyL@CTestProperty@@QAEHVTUid@@HAAVTDes16@@@Z @ 10 NONAME ; int CTestProperty::GetPropertyL(class TUid, int, class TDes16 &) + ?GetPropertyL@CTestProperty@@QAEHVTUid@@HAAVTDes8@@@Z @ 11 NONAME ; int CTestProperty::GetPropertyL(class TUid, int, class TDes8 &) + ?NewL@CTestActive@@SAPAV1@AAVMTestActiveCallback@@H@Z @ 12 NONAME ; class CTestActive * CTestActive::NewL(class MTestActiveCallback &, int) + ?NewL@CTestTimeOutTimer@@SAPAV1@AAVMTestTimeOutTimerCallback@@H@Z @ 13 NONAME ; class CTestTimeOutTimer * CTestTimeOutTimer::NewL(class MTestTimeOutTimerCallback &, int) + ?NewLC@CTestActive@@SAPAV1@AAVMTestActiveCallback@@H@Z @ 14 NONAME ; class CTestActive * CTestActive::NewLC(class MTestActiveCallback &, int) + ?NewLC@CTestTimeOutTimer@@SAPAV1@AAVMTestTimeOutTimerCallback@@H@Z @ 15 NONAME ; class CTestTimeOutTimer * CTestTimeOutTimer::NewLC(class MTestTimeOutTimerCallback &, int) + ?SetPropertyL@CTestProperty@@QAEHVTUid@@HABVTDesC16@@@Z @ 16 NONAME ; int CTestProperty::SetPropertyL(class TUid, int, class TDesC16 const &) + ?SetPropertyL@CTestProperty@@QAEHVTUid@@HABVTDesC8@@@Z @ 17 NONAME ; int CTestProperty::SetPropertyL(class TUid, int, class TDesC8 const &) + ?SetPropertyL@CTestProperty@@QAEHVTUid@@HH@Z @ 18 NONAME ; int CTestProperty::SetPropertyL(class TUid, int, int) + ?VerifyUTCTime@CTestStepSmokeTest@@IAEHVTTime@@@Z @ 19 NONAME ; int CTestStepSmokeTest::VerifyUTCTime(class TTime) + ?doTestStepPostambleL@CTestStepSmokeTest@@UAE?AW4TVerdict@@XZ @ 20 NONAME ; enum TVerdict CTestStepSmokeTest::doTestStepPostambleL(void) + ?doTestStepPreambleL@CTestStepSmokeTest@@UAE?AW4TVerdict@@XZ @ 21 NONAME ; enum TVerdict CTestStepSmokeTest::doTestStepPreambleL(void) + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/eabi/SmokeTestSecureFSclientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/eabi/SmokeTestSecureFSclientU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,10 @@ +EXPORTS + _ZN19RTestSecureFSclient11DeleteFileLERK7TDesC16 @ 1 NONAME + _ZN19RTestSecureFSclient11SetHomeTimeERK5TTime @ 2 NONAME + _ZN19RTestSecureFSclient12CheckForFileERK7TDesC16 @ 3 NONAME + _ZN19RTestSecureFSclient12KillProcessLERK7TDesC16 @ 4 NONAME + _ZN19RTestSecureFSclient16ChangeLocaleNameERK7TDesC16 @ 5 NONAME + _ZN19RTestSecureFSclient7ConnectEv @ 6 NONAME + _ZN19RTestSecureFSclient8CopyFileERK7TDesC16S2_ @ 7 NONAME + _ZN19RTestSecureFSclient8SetUpFbsEv @ 8 NONAME + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/eabi/SmokeTest_UtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/eabi/SmokeTest_UtilsU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,40 @@ +EXPORTS + _ZN11CTestActive4NewLER19MTestActiveCallbacki @ 1 NONAME + _ZN11CTestActive5NewLCER19MTestActiveCallbacki @ 2 NONAME + _ZN11CTestActive8ActivateEv @ 3 NONAME + _ZN11CTestActiveD0Ev @ 4 NONAME + _ZN11CTestActiveD1Ev @ 5 NONAME + _ZN11CTestActiveD2Ev @ 6 NONAME + _ZN13CTestProperty12GetPropertyLE4TUidiR5TDes8 @ 7 NONAME + _ZN13CTestProperty12GetPropertyLE4TUidiR6TDes16 @ 8 NONAME + _ZN13CTestProperty12GetPropertyLE4TUidiRi @ 9 NONAME + _ZN13CTestProperty12SetPropertyLE4TUidiRK6TDesC8 @ 10 NONAME + _ZN13CTestProperty12SetPropertyLE4TUidiRK7TDesC16 @ 11 NONAME + _ZN13CTestProperty12SetPropertyLE4TUidii @ 12 NONAME + _ZN13CTestPropertyC1ER9CTestStep @ 13 NONAME + _ZN13CTestPropertyC2ER9CTestStep @ 14 NONAME + _ZN13CTestPropertyD0Ev @ 15 NONAME + _ZN13CTestPropertyD1Ev @ 16 NONAME + _ZN13CTestPropertyD2Ev @ 17 NONAME + _ZN18CTestStepSmokeTest13GetCapabilityE7TPtrC16R11TCapability @ 18 NONAME + _ZN18CTestStepSmokeTest13VerifyUTCTimeE5TTime @ 19 NONAME + _ZN18CTestStepSmokeTest19doTestStepPreambleLEv @ 20 NONAME + _ZN18CTestStepSmokeTest20doTestStepPostambleLEv @ 21 NONAME + _ZN18CTestStepSmokeTestC2Ev @ 22 NONAME + _ZN18CTestStepSmokeTestD0Ev @ 23 NONAME + _ZN18CTestStepSmokeTestD1Ev @ 24 NONAME + _ZN18CTestStepSmokeTestD2Ev @ 25 NONAME + _ZN17CTestTimeOutTimer4NewLER25MTestTimeOutTimerCallbacki @ 26 NONAME + _ZN17CTestTimeOutTimer5NewLCER25MTestTimeOutTimerCallbacki @ 27 NONAME + _ZN17CTestTimeOutTimerD0Ev @ 28 NONAME + _ZN17CTestTimeOutTimerD1Ev @ 29 NONAME + _ZN17CTestTimeOutTimerD2Ev @ 30 NONAME + _ZTI11CTestActive @ 31 NONAME ; ## + _ZTI13CTestProperty @ 32 NONAME ; ## + _ZTI18CTestStepSmokeTest @ 33 NONAME ; ## + _ZTI17CTestTimeOutTimer @ 34 NONAME ; ## + _ZTV11CTestActive @ 35 NONAME ; ## + _ZTV13CTestProperty @ 36 NONAME ; ## + _ZTV18CTestStepSmokeTest @ 37 NONAME ; ## + _ZTV17CTestTimeOutTimer @ 38 NONAME ; ## + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/group/SmokeTestSecureFSclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/group/SmokeTestSecureFSclient.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// TestSecureFSclient.mmp +// +// + +TARGET SmokeTestSecureFSclient.dll +TARGETTYPE dll +CAPABILITY All + +UID 0x1000008D 0x101FF347 +VENDORID 0x70000001 + +USERINCLUDE ..\Inc +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ..\src +SOURCE SmokeTestSecureFSclient.cpp + +LIBRARY euser.lib + +SMPSAFE diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/group/SmokeTestSecureFSserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/group/SmokeTestSecureFSserver.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// TestSecureFSserver.mmp +// +// + + +UID 0x1000008D 0x101FF346 +VENDORID 0x70000001 + +TARGET SmokeTestSecureFSserver.exe +TARGETTYPE EXE +CAPABILITY ALL + +USERINCLUDE ..\Inc +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ..\SRC +SOURCE SmokeTestSecureFSserver.cpp + +SOURCEPATH . + +LIBRARY euser.lib +LIBRARY efsrv.lib + + +SMPSAFE diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/group/SmokeTest_Utils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/group/SmokeTest_Utils.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: + + + +TARGET SmokeTest_Utils.dll +TARGETTYPE dll +UID 0x1000008D 0x101FF341 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY All -TCB + +SOURCEPATH ..\Src + +SOURCE SmokeTestTimeOutTimer.cpp +SOURCE SmokeTestActive.cpp +SOURCE TestStepSmokeTest.cpp +SOURCE SmokeTestProperty.cpp + +USERINCLUDE ..\Inc +USERINCLUDE ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib +LIBRARY TestConfigFileParser.lib + +// We're quite heavy on the stack... 4k in WinS isn't enough... +EPOCSTACKSIZE 0x6000 + +SMPSAFE diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/Utils/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/Utils/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,31 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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_TESTEXPORTS +// For Emulator +../Inc/SmokeTestTimeOutTimer.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketesttimeouttimer.h) +../Inc/SmokeTestActive.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestactive.h) +../Inc/TestStepSmokeTest.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/teststepsmoketest.h) +../Inc/SmokeTestProperty.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestproperty.h) +../Inc/SmokeTestSecureFSclientserver.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestsecurefsclientserver.h) +../Inc/SmokeTestSecureFSclient.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestsecurefsclient.h) +../Inc/SmokeTestSecureFSserver.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestsecurefsserver.h) + +PRJ_TESTMMPFILES +SmokeTestSecureFSclient.mmp +SmokeTestSecureFSserver.mmp +SmokeTest_Utils.mmp diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Group/Smoketest_Agenda.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Group/Smoketest_Agenda.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,52 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + + +TARGET Smoketest_Agenda_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7771 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +//CAPABILITY WriteUserData ReadUserData +CAPABILITY All -TCB + + +SOURCEPATH ..\Src + +SOURCE TestAgendaServer.cpp +SOURCE TestAgendaAddAppt.cpp +SOURCE TestAgendaBase.cpp +SOURCE TestAgendaCreateDB.cpp +SOURCE TestAgendaServerLaunchProgress.cpp + +USERINCLUDE ..\Inc ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY apparc.lib +LIBRARY euser.lib +LIBRARY calinterimapi.lib +LIBRARY etext.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib + +SMPSAFE diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 Agenda smoketest +// + + + +PRJ_TESTEXPORTS + +../Scripts/Smoketest_Agenda.script /epoc32/release/wins/udeb/z/autosmoketest/smoketest_agenda.script +../Scripts/Smoketest_Agenda.script /epoc32/release/wins/urel/z/autosmoketest/smoketest_agenda.script +../Scripts/Smoketest_Agenda.script /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_agenda.script +../Scripts/Smoketest_Agenda.script /epoc32/release/winscw/urel/z/autosmoketest/smoketest_agenda.script + +../TestData/Smoketest_Agenda.ini /epoc32/release/wins/udeb/z/autosmoketest/smoketest_agenda.ini +../TestData/Smoketest_Agenda.ini /epoc32/release/wins/urel/z/autosmoketest/smoketest_agenda.ini +../TestData/Smoketest_Agenda.ini /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_agenda.ini +../TestData/Smoketest_Agenda.ini /epoc32/release/winscw/urel/z/autosmoketest/smoketest_agenda.ini + + +PRJ_TESTMMPFILES +Smoketest_Agenda.mmp diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Inc/TestAgendaAddAppt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Inc/TestAgendaAddAppt.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestAgendaCreateDB.h +// This contains CTestAgendaAddAppt +// +// + +#ifndef TEST_AGENDA_ADD_APPT_H +#define TEST_AGENDA_ADD_APPT_H + +#include "TestAgendaBase.h" + +class CTestAgendaAddAppt : public CTestAgendaBase +{ +public: + CTestAgendaAddAppt(); + virtual ~CTestAgendaAddAppt(); + +public: + virtual enum TVerdict doTestStepL( void ); + +private: + void AddEntriesL( void ); +}; + +#endif /* TEST_AGENDA_ADD_APPT_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Inc/TestAgendaBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Inc/TestAgendaBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,91 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaBase which is the base class for all +// the Psd Agx suite test steps +// +// + +#ifndef TEST_AGENDA_BASE_H +#define TEST_AGENDA_BASE_H + +#include +#include +#include + + + +//forward declarations +class CCalSession; + +#define KMaxDateStringLength 30 +#define KMaxTimeStringLength 30 + +#define KMaxDateStringLength 30 +#define KMaxTimeStringLength 30 + +class CTestAgendaPicture :public MPictureFactory +/** +* Picture class for the agenda model +*/ +{ +/************************************************************** +* An object of this class is used for setting the picture factory +* of an Agenda model, although our code does not use any of the +* functionality provided by this class, it is created with empty +* implementation and set to satisfy the compiler as it uses +* an assert macro to check if this object is set before saving +* the agenda model entries into a file +*************************************************************/ + +public: + CTestAgendaPicture(); + virtual ~CTestAgendaPicture(); + virtual void NewPictureL(TPictureHeader& aHeader,const CStreamStore& aDeferredPictureStore)const; +}; + + +class CTestAgendaBase : public CTestStep +{ +public: + CTestAgendaBase(); + ~CTestAgendaBase(); + + virtual enum TVerdict doTestStepPreambleL(); + virtual enum TVerdict doTestStepPostambleL(); + + CCalSession& CTestAgendaBase::CalSession(); + void SetCalEntryView(CCalEntryView* calEntryViewPtr); + +protected: + void CreateDatabaseL(); + void OpenDatabaseL(); + void CleanupDatabase(); + +private: + CActiveScheduler* iSchedular; + TBool iEnteredBlocked; + TBool iExitedBlocked; + +protected: + RFs iFs; + TBool iSessionConnected; + CCalEntryView* iCalEntryViewBase; + /** + To store the models entries + */ + CFileStore* iStore; + CCalSession* iCalSession; +}; + +#endif /* TEST_AGENDA_BASE_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Inc/TestAgendaCreateDB.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Inc/TestAgendaCreateDB.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,34 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaCreateDB +// +// + +#ifndef TEST_AGENDA_CREATE_DB_H +#define TEST_AGENDA_CREATE_DB_H + +#include "TestAgendaBase.h" + +class CTestAgendaCreateDB : public CTestAgendaBase +{ +public: + CTestAgendaCreateDB(); + virtual ~CTestAgendaCreateDB(); + +public: + virtual enum TVerdict doTestStepL( void ); + +}; + +#endif /* TEST_AGENDA_CREATE_DB_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Inc/TestAgendaServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Inc/TestAgendaServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaServer +// +// + +#ifndef TEST_AGENDA_SERVER_H +#define TEST_AGENDA_SERVER_H + +#include + +class CTestAgendaServer : public CTestServer +{ +public: + static CTestAgendaServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + +private: + void ConstructL(); +}; + +#endif /* TEST_AGENDA_SERVER_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Inc/TestAgendaServerLaunchProgress.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Inc/TestAgendaServerLaunchProgress.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,75 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaServerLaunchProgress +// +// + +#ifndef TEST_AGENDA_SERVER_LAUNCH_PROGRESS_H +#define TEST_AGENDA_SERVER_LAUNCH_PROGRESS_H + +#include "TestAgendabase.h" +#include +#include + + +//forward declaration +//class CTestAgendaBase; +class CCalEntryView; + + +class CTestAgendaServerLaunchProgress : public CActive, private MCalProgressCallBack +/** +* This class provides an implementationfor the pure virtual functions +* declared in MAgnProgressCallBack. The framework makes calls to the +* functions indidcating the status of the operation. +*/ +{ +public: + static CTestAgendaServerLaunchProgress* NewL(CTestAgendaBase* aAgendaBase); + virtual ~CTestAgendaServerLaunchProgress(); + void Start(); + + //from CActive + virtual void RunL(); + virtual void DoCancel(); + +private: + CTestAgendaServerLaunchProgress(CTestAgendaBase* aAgendaBase); + void ConstructL(); + + //from MAgnProgressCallBack + virtual void Completed(TInt aError = KErrNone); + virtual void Progress(TInt aPercentageCompleted); + virtual TBool NotifyProgress(); + +private: + /** + pointer to the CTestAgendaBase object. + */ + CTestAgendaBase* iAgendaBase; + CCalEntryView* iCalEntryView; + + /** + file in which the entries are present + */ + TPtrC iFileName; + + /** + file server session + */ + RFs iFs; + +}; + +#endif TEST_AGENDA_SERVER_LAUNCH_PROGRESS_H diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Scripts/Smoketest_Agenda.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Scripts/Smoketest_Agenda.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Agenda smoketest +// +RUN_UTILS MkDir c:\autoSmoketest\ +RUN_UTILS CopyFile z:\autosmoketest\smoketest_agenda.ini c:\autosmoketest\smoketest_agenda.ini +RUN_UTILS MakeReadWrite c:\autosmoketest\smoketest_agenda.ini +// +RUN_WS_PROGRAM 10 z:\sys\bin\agenda.exe +// +DELAY 1500 +// +LOAD_SUITE Smoketest_Agenda_Server +// +START_TESTCASE 8981 +RUN_TEST_STEP 100 Smoketest_Agenda_Server CreateDB c:\autosmoketest\Smoketest_Agenda.ini 18920_CreateDB +END_TESTCASE 8981 +START_TESTCASE 8979 +RUN_TEST_STEP 1000 Smoketest_Agenda_Server AddAppt c:\autosmoketest\Smoketest_Agenda.ini 24560_AddAppts +END_TESTCASE 8979 diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Src/TestAgendaAddAppt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Src/TestAgendaAddAppt.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,191 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaAddAppt +// +// + +#include +#include +#include + + +#include "TestAgendaAddAppt.h" + +_LIT(KCount, "count"); +_LIT(KYear, "year%d"); +_LIT(KMonth, "month%d"); +_LIT(KDay, "day%d"); +_LIT(KHour, "hour%d"); +_LIT(KMinute, "min%d"); +_LIT(KDuration, "duration%d"); +_LIT(KMessage, "message%d"); +_LIT(KAlarm, "alarm%d"); +_LIT(KAlarmSound, "alarmsound%d"); + +// constructor +CTestAgendaAddAppt::CTestAgendaAddAppt() + { + SetTestStepName(_L("AddAppt")); + } + +// destructor +CTestAgendaAddAppt::~CTestAgendaAddAppt() + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestAgendaAddAppt::doTestStepL( void ) + { + // Printing to the console and log file + INFO_PRINTF1(_L("TEST-> ADDING APPOINTMENT ENTRIES")); + + OpenDatabaseL(); + if ( TestStepResult() == EPass ) + { + TRAPD(r, AddEntriesL()); + if (r!=KErrNone) + SetTestStepResult(EFail); + } + CleanupDatabase(); + + // test steps return a result + return TestStepResult(); + } + +// Destroy the RPointerArray +void DestroyRPointerArray(TAny* aPtr) + { + RPointerArray* self = static_cast*> (aPtr); + self->ResetAndDestroy(); + } + + +void CTestAgendaAddAppt::AddEntriesL( void ) + { + TInt count=1; + if ( !GetIntFromConfig(ConfigSection(), KCount, count) ) + count=1; + + TBuf tempStore; + TInt year; + TInt month; + TInt day; + TInt hour; + TInt minute; + TInt duration; + TInt alarm; + TPtrC ptrAlarmSound; + TPtrC ptrMessage; + TBuf dateString; + _LIT(KDateString,"%*E%*D%X%*N%*Y %1 %2 '%3"); + + RPointerArray array; + CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &array)); + + for (TInt entry=0; entryDes(); + uidP.Append(count); + + CCalEntry* calEntry = CCalEntry::NewL(CCalEntry::EAppt, uid, CCalEntry::EMethodNone, 0); + + CleanupStack::Pop(); //uid + CleanupStack::PushL(calEntry); + + TCalTime calStartTime, calEndTime; + + calStartTime.SetTimeLocalL(startTime); + calEndTime.SetTimeLocalL(endTime); + + calEntry->SetStartAndEndTimeL(calStartTime, calEndTime); + + tempStore.Format(KAlarm(), entry); + if ( GetIntFromConfig(ConfigSection(), tempStore, alarm) ) + { + TTimeIntervalMinutes currentTime((hour*60) + minute); + TTimeIntervalMinutes alarmTime(currentTime.Int()); + + CCalAlarm* calAlarm = CCalAlarm::NewL(); + CleanupStack::PushL(calAlarm); + + calAlarm->SetTimeOffset(alarmTime); + + tempStore.Format(KAlarmSound(), entry); + if ( GetStringFromConfig(ConfigSection(), tempStore, ptrAlarmSound) ) + calAlarm->SetAlarmSoundNameL(ptrAlarmSound); + else + calAlarm->SetAlarmSoundNameL(_L("Bells")); + + calEntry->SetAlarmL(calAlarm); + CleanupStack::PopAndDestroy(); //calAlarm + } + //Store in the array + array.AppendL(calEntry); + + CleanupStack::Pop(); //calEntry + } + INFO_PRINTF1(_L("About to store appointments now")); + TInt success(0); + TRAPD(storeError, iCalEntryViewBase->StoreL(array, success)); + INFO_PRINTF2(_L("Store result is %d"), storeError); + if (success != count && storeError == KErrNone) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&array); + + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Src/TestAgendaBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Src/TestAgendaBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,225 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaCase which is the base class for all the Agenda TestCase DLL +// +// + +// EPOC includes +#include +#include +#include +#include +#include "TestAgendabase.h" +#include "TestAgendaServerLaunchProgress.h" + +#include + + + +_LIT(KDef, "default"); +_LIT(KFileName, "filenameSecure"); + +void CTestAgendaPicture::NewPictureL(TPictureHeader& /*aHeader*/,const CStreamStore& /*aDeferredPictureStore*/)const +/** +Creates a new Picture object for use by agenda model, currently the implementation is empty as our code +does not use any the functionality. +*/ + { + //empty implementation + } + +CTestAgendaPicture::CTestAgendaPicture() +/** +constructor, currently the implementation is empty +*/ + { + //empty implementation + } + +CTestAgendaPicture::~CTestAgendaPicture() +/** +destructor, currently the implementation is empty +*/ + { + //empty implementation + } + +CTestAgendaBase::CTestAgendaBase() +: CTestStep() +, iSchedular(NULL) +, iEnteredBlocked(EFalse) +, iExitedBlocked(EFalse) +, iSessionConnected(EFalse) +, iCalEntryViewBase(NULL) +, iStore(NULL) +, iCalSession(NULL) + { + } + +// destructor +CTestAgendaBase::~CTestAgendaBase() + { + delete iSchedular; + iSchedular=NULL; + + } + +enum TVerdict CTestAgendaBase::doTestStepPreambleL() + { + TVerdict ret = CTestStep::doTestStepPreambleL(); + + INFO_PRINTF1(_L("doTestStepPreambleL")); + iSchedular=new (ELeave) CActiveScheduler(); + CActiveScheduler::Install(iSchedular); + + iCalSession = CCalSession::NewL(); + + return ret; + } + +enum TVerdict CTestAgendaBase::doTestStepPostambleL() + { + + delete iCalEntryViewBase; + iCalEntryViewBase=NULL; + + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + + + return CTestStep::doTestStepPostambleL(); + } + +// Create a new database +void CTestAgendaBase::CreateDatabaseL( void ) + { + TPtrC ptrFileName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KFileName, ptrFileName); + if ( !returnValue ) + returnValue=GetStringFromConfig(KDef, KFileName, ptrFileName); + + if (returnValue) + { + INFO_PRINTF2(_L("filename = %S"), &ptrFileName); + } + else + { + User::Leave(KErrNotFound); + } + + // Connect file server + User::LeaveIfError(iFs.Connect()); + iSessionConnected=ETrue; + + TInt r; + if (iCalSession) + { + TRAP(r, iCalSession->CreateCalFileL(ptrFileName)); + } + + if (r == KErrAlreadyExists) + { + TRAP_IGNORE(iCalSession->DeleteCalFileL(ptrFileName)); + TRAP(r, iCalSession->CreateCalFileL(ptrFileName)); + } + + + if (r!=KErrNone && r!=KErrAlreadyExists) + { + ERR_PRINTF2(_L("Creating Agenda file failed with error %d"), r); + SetTestStepResult(EFail); + } + } + +void CTestAgendaBase::OpenDatabaseL( void ) + { + TPtrC ptrFileName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KFileName, ptrFileName); + if ( !returnValue ) + returnValue=GetStringFromConfig(KDef, KFileName, ptrFileName); + + + if (returnValue) + { + INFO_PRINTF2(_L("filename = %S"), &ptrFileName); + } + else + { + User::Leave(KErrNotFound); + } + + // Connect file server + User::LeaveIfError(iFs.Connect()); + iSessionConnected=ETrue; + + + if (iCalSession) + { + iCalSession->OpenL(ptrFileName); + } + + //open the database by creating an object of CTestAgendaServerLaunchProgress + CTestAgendaServerLaunchProgress* progress = CTestAgendaServerLaunchProgress::NewL(this); + CleanupStack::PushL(progress); + + //kick start the launching process + progress->Start(); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy(progress); + + } + +void CTestAgendaBase::CleanupDatabase( void ) + { + if (iCalEntryViewBase) + { + delete iCalEntryViewBase; + iCalEntryViewBase = NULL; + } + +/* if (iCalSession) + { + delete iCalSession; + iCalSession=NULL; + }*/ + + + if (iSessionConnected) + { + iFs.Close(); + iSessionConnected=EFalse; + } + } + +void CTestAgendaBase::SetCalEntryView(CCalEntryView* calEntryViewPtr) + { + iCalEntryViewBase = calEntryViewPtr; + } + +CCalSession& CTestAgendaBase::CalSession() + { + if (iCalSession) + { + return *iCalSession; + } + else + { + iCalSession = CCalSession::NewL(); + + return *iCalSession; + } + } + + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Src/TestAgendaCreateDB.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Src/TestAgendaCreateDB.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,43 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaCreateDB +// +// + +#include + +#include "TestAgendaCreateDB.h" + +// constructor +CTestAgendaCreateDB::CTestAgendaCreateDB() + { + SetTestStepName(_L("CreateDB")); + } + +// destructor +CTestAgendaCreateDB::~CTestAgendaCreateDB() + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestAgendaCreateDB::doTestStepL( void ) + { + // Printing to the console and log file + INFO_PRINTF1(_L("TEST-> CREATING OUR AGENDA DATABASE")); + + CreateDatabaseL(); + + // test steps return a result + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Src/TestAgendaServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Src/TestAgendaServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,107 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 main DLL entry point for the Smoketest_Agenda.dll +// +// + + +// EPOC includes +#include + +#include "TestAgendaServer.h" +#include "TestAgendaAddAppt.h" +#include "TestAgendaCreateDB.h" + + +_LIT(KServerName,"Smoketest_Agenda_Server"); + +CTestAgendaServer* CTestAgendaServer::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. + */ + { + CTestAgendaServer* server = new (ELeave) CTestAgendaServer(); + CleanupStack::PushL(server); + // CServer base class call + server->StartL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +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().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTestAgendaServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTestAgendaServer::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* CTestAgendaServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Secure and non-secure variants + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep = NULL; + + if(aStepName == _L("AddAppt")) + testStep = new CTestAgendaAddAppt(); + else if(aStepName == _L("CreateDB")) + testStep = new CTestAgendaCreateDB(); + return testStep; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Src/TestAgendaServerLaunchProgress.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Src/TestAgendaServerLaunchProgress.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,120 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaServerLaunchProgress +// +// + +#include "TestAgendaServerLaunchProgress.h" +#include + +CTestAgendaServerLaunchProgress* CTestAgendaServerLaunchProgress::NewL(CTestAgendaBase* aAgendaBase) +/** + * @return - Instance of the agenda progress callback + */ + { + CTestAgendaServerLaunchProgress* progress = new (ELeave) CTestAgendaServerLaunchProgress(aAgendaBase); + CleanupStack::PushL(progress); + progress->ConstructL(); + CleanupStack::Pop(progress); + return progress; + } + +CTestAgendaServerLaunchProgress::CTestAgendaServerLaunchProgress(CTestAgendaBase* aAgendaBase) +: CActive(EPriorityStandard) +, iAgendaBase(aAgendaBase) +/** +constructor +*/ + { + } + +void CTestAgendaServerLaunchProgress::ConstructL() +/** +constructor +*/ + { + //adding this active object into an active scheduler + CActiveScheduler::Add(this); + } + +CTestAgendaServerLaunchProgress::~CTestAgendaServerLaunchProgress() +/** +destructor +*/ + { + } + +void CTestAgendaServerLaunchProgress::Completed(TInt aError) +/** +callback function invoked after the file is completely loaded. +@param TInt aError +*/ + { + if(aError != KErrNone) + { + iAgendaBase ->INFO_PRINTF2(_L("Opening the agenda database file failed with error %D"),aError); + iAgendaBase ->SetTestStepResult(EFail); + } + else + { + iAgendaBase ->INFO_PRINTF1(_L("Opening the Agenda database succesful")); + } + CActiveScheduler::Stop(); + } + +void CTestAgendaServerLaunchProgress::Progress(TInt aPercentageCompleted) +/** +callback function invoked to indicate the progress +@param aPercentageCompleted percent file loaded +*/ + { + //log the progress percentage of saving the entries + iAgendaBase ->INFO_PRINTF2(_L("%D%% completed opening the agenda database"),aPercentageCompleted); + } + +TBool CTestAgendaServerLaunchProgress::NotifyProgress() + { + return ETrue; + } + +void CTestAgendaServerLaunchProgress::RunL() +/** +RunL from CActive class, opens the agenda database file, and builds the indices +@leave system wide error code +*/ + { + CCalEntryView* calEntryViewPtr = CCalEntryView::NewL(iAgendaBase->CalSession(), *this); + iAgendaBase->SetCalEntryView(calEntryViewPtr); + } + +void CTestAgendaServerLaunchProgress::DoCancel() +/** +DoCancel of the active object +*/ + { + iAgendaBase ->INFO_PRINTF1(_L("Inside do cancel of the active object")); + } + + +void CTestAgendaServerLaunchProgress::Start(void) +/** +starts the saving process +*/ + { + TRequestStatus *threadStatus=&iStatus; + User::RequestComplete(threadStatus,KErrNone); + SetActive(); + } + + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/Src/sm_agenda.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/Src/sm_agenda.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,1 @@ +[Files MRU] diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/agenda/TestData/Smoketest_Agenda.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/agenda/TestData/Smoketest_Agenda.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,35 @@ +[default] +filename =c:\smoketest\Smoketest_Agenda +filenameSecure =c:Smoketest_Agenda + +[18920_CreateDB] + +[24560_AddAppts] +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 +alarm2 =15 + +year3 =2002 +month3 =9 +day3 =15 +hour3 =12 +min3 =0 +duration3 =30 +message3 =have lunch +alarm3 =15 + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/autorom/smoketests.oby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/autorom/smoketests.oby Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __SMOKETESTS_IBY__ +#define __SMOKETESTS_IBY__ + +#include "testexecute.iby" +#include "thindump.iby" + + + +file=ABI_DIR\DEBUG_DIR\runtests.exe \sys\bin\runtests.exe +file=ABI_DIR\BUILD_DIR\smoketest_agenda_server.exe \sys\bin\smoketest_agenda_server.exe +file=ABI_DIR\BUILD_DIR\smoketest_contacts_server.exe \sys\bin\smoketest_contacts_server.exe +file=ABI_DIR\BUILD_DIR\smoketest_mess_server.exe \sys\bin\smoketest_mess_server.exe +file=ABI_DIR\BUILD_DIR\smoketest_timew_server.exe \sys\bin\smoketest_timew_server.exe + +//required by messaging tests +file=ABI_DIR\BUILD_DIR\SmokeTest_Utils.dll \sys\bin\SmokeTest_Utils.dll +file=ABI_DIR\BUILD_DIR\testconfigfileparser.dll \bin\testconfigfileparser.dll + + +data = \epoc32\release\winscw\udeb\z\autosmoketest\smoketest_agenda.script \autosmoketest\smoketest_agenda.script +data = \epoc32\release\winscw\udeb\z\autosmoketest\smoketest_agenda.ini \autosmoketest\smoketest_agenda.ini + +data = \epoc32\release\winscw\udeb\z\autosmoketest\smoketest_contacts.script \autosmoketest\smoketest_contacts.script +data = \epoc32\release\winscw\udeb\z\autosmoketest\smoketest_contacts.ini \autosmoketest\smoketest_contacts.ini + +data = \epoc32\release\winscw\udeb\z\autosmoketest\smoketest_mess.script \autosmoketest\smoketest_mess.script +data = \epoc32\release\winscw\udeb\z\autosmoketest\sms\message1.txt \autosmoketest\sms\message1.txt +data = \epoc32\release\winscw\udeb\z\autosmoketest\smoketest_mess.ini \autosmoketest\smoketest_mess.ini + +data = \epoc32\release\winscw\udeb\z\autosmoketest\smoketest_timew.script \autosmoketest\smoketest_timew.script +data = \epoc32\release\winscw\udeb\z\autosmoketest\smoketest_timew.ini \autosmoketest\smoketest_timew.ini + + +#endif \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/TestData/Smoketest_Contacts.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/TestData/Smoketest_Contacts.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +[default] +filename =c:\autosmoketest\smoketest_contacts.cdb +filenameSecure =c:smoketest_contacts.cdb + +[18807_CreateDB] + +[18927_AddEntries] +count =5 + +firstname1 =Feroz +lastname1 =Uddin +company1 =Symbian +job1 =Cricket fan +workphone1 =0207 +workemail1 =feroz.uddin@symbian.com + +firstname2 =Louis +lastname2 =Nayegon +company2 =Symbian +job2 =Lazy Git +workphone2 =01452 812178 +workemail2 =louis.nayegon@symbian.com + +firstname3 =Alf +lastname3 =Garnett +company3 =BBC +job3 =star +workphone3 =0207 777 +workmobile3 =07790 +homephone3 =0208 888 +homemobile3 =07792 +fax3 =0208 999 +workemail3 =alf.garnett@bbc.co.uk +internet3 =www.bbc.co.uk +street3 =Marylebone Road +town3 =London +county3 =LondonCounty +postcode3 =W1 +country3 =England +notes3 =Small minded bigot + +firstname4 =Tom +lastname4 =Jones +company4 =Music +job4 =Singer +workemail4 =tom.jones@music.com + +firstname5 =Alan +lastname5 =Shearer +company5 =Newcastle United FC +job5 =Footballer +FirstNamePrn5 =Al-an +LastNamePrn5 =Shea-rer +CompanyNamePrn5 =New-cas-el You-Nigh-Ted diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/group/Smoketest_Contacts.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/group/Smoketest_Contacts.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,52 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + +TARGET Smoketest_Contacts_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7772 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY ReadUserData WriteUserData + +SOURCEPATH ..\Src + +SOURCE SmoketestContactsServer.cpp +SOURCE TestContact.cpp +SOURCE TestContactsAddEntries.cpp +SOURCE TestContactsBase.cpp +SOURCE TestContactsCreateDB.cpp + +USERINCLUDE ..\Inc ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY charconv.lib +LIBRARY cntview.lib +LIBRARY euser.lib +LIBRARY cntmodel.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib + +// We're quite heavy on the stack... 4k in WinS isn't enough... +EPOCSTACKSIZE 0x6000 + +SMPSAFE diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,32 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 automated contacts smoketest +// + + +PRJ_TESTEXPORTS + +../scripts/Smoketest_Contacts.script /epoc32/release/wins/udeb/z/autosmoketest/smoketest_contacts.script +../scripts/Smoketest_Contacts.script /epoc32/release/wins/urel/z/autosmoketest/smoketest_contacts.script +../scripts/Smoketest_Contacts.script /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_contacts.script +../scripts/Smoketest_Contacts.script /epoc32/release/winscw/urel/z/autosmoketest/smoketest_contacts.script + + +../TestData/Smoketest_Contacts.ini /epoc32/release/wins/udeb/z/autosmoketest/smoketest_contacts.ini +../TestData/Smoketest_Contacts.ini /epoc32/release/wins/urel/z/autosmoketest/smoketest_contacts.ini +../TestData/Smoketest_Contacts.ini /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_contacts.ini +../TestData/Smoketest_Contacts.ini /epoc32/release/winscw/urel/z/autosmoketest/smoketest_contacts.ini + +PRJ_TESTMMPFILES +Smoketest_Contacts.mmp diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/inc/SmoketestContactsServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/inc/SmoketestContactsServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,36 @@ +/** +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 SmoketestContactsServer.h +*/ +#if (!defined __SMOKETESTCONTACTS_SERVER_H__) +#define __SMOKTETESTCONTACTS_SERVER_H__ +#include + +class CSmoketestContactsServer : public CTestServer + { +public: + static CSmoketestContactsServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + +private: + void ConstructL(); + }; +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/inc/TestContact.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/inc/TestContact.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,100 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContact +// +// + +#ifndef TEST_CONTACT_H +#define TEST_CONTACT_H + +#include + +class MTestContactInstrumentation +{ +public: + virtual void RaiseInstrumentationEventNotificationL(TInt aEventTag) = 0; +}; + +class CTestContact : public CBase + { +public: + static CTestContact* NewL(CContactItem& aSeedContact); + static CTestContact* NewLC(CContactItem& aSeedContact); + static CTestContact* NewL(CContactItem* aSeedContact); + static CTestContact* NewLC(CContactItem* aSeedContact); + ~CTestContact(); + + CContactItem& ContactItem(); + const TPtrC FirstNameL(); + const TPtrC LastNameL(); + const TPtrC CompanyNameL(); + const TPtrC JobTitleL(); + const TPtrC WorkPhoneL(); + const TPtrC WorkMobileL(); + const TPtrC HomePhoneL(); + const TPtrC HomeMobileL(); + const TPtrC FaxL(); + const TPtrC EmailAddressL(); + const TPtrC InternetAddressL(); + const TPtrC StreetL(); + const TPtrC TownL(); + const TPtrC CountyL(); + const TPtrC PostCodeL(); + const TPtrC CountryL(); + const TPtrC NotesL(); + const TPtrC NickNameL(); + const TPtrC PictureL(); + + void SetFirstNameL(const TDesC& aFirstName); + void SetLastNameL(const TDesC& aLastName); + void SetCompanyNameL(const TDesC& aCompanyName); + void SetJobTitleL(const TDesC& aJobTitle); + void SetWorkPhoneL(const TDesC& aWorkPhone); + void SetWorkMobileL(const TDesC& aWorkMobile); + void SetHomePhoneL(const TDesC& aHomePhone); + void SetHomeMobileL(const TDesC& aHomeMobile); + void SetFaxL(const TDesC& aFax); + void SetHomeEmailAddressL(const TDesC& aEmailAddress); + void SetWorkEmailAddressL(const TDesC& aEmailAddress); + void SetInternetAddressL(const TDesC& aInternetAddress); + void SetStreetL(const TDesC& aStreet); + void SetTownL(const TDesC& aTown); + void SetCountyL(const TDesC& aCounty); + void SetPostCodeL(const TDesC& aPostCode); + void SetCountryL(const TDesC& aCountry); + void SetNotesL(const TDesC& aNotes); + void SetNickNameL(const TDesC& aNickName); + void SetPictureL(const TDesC8& aPicture); + +private: + CTestContact(); + void ConstructL(CContactItem& aSeedContact); + void ConstructL(CContactItem* aSeedContact); + const TPtrC TextFieldL(TFieldType aFieldType) const; + const TPtrC TextFieldL(const CContentType& aTypesToMatch) const; + void SetTextFieldL(const CContentType& aTypesToMatch,const TDesC& aText) const; + void SetTextFieldL(TFieldType aFieldType, const TDesC& aText); + void SetTextFieldL(TFieldType aFieldType, const TDesC& aText, TUid aAddOnContentType); + CContactItemField& FindFieldL(TFieldType aFieldType) const; + CContactItemField& FindFieldL(const CContentType& aTypesToMatch) const; + void SetPictureFieldL(const TDesC8& aPicture) const; + TInt FindField(TFieldType aFieldType) const; + void InsertTextFieldL(TUid aID, const TDesC& aStringOfStuff); + +private: + CContactItem* iContactItem; + TBool iDestroyOnExit; + }; + +#endif /* __TEST_CONTACT_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/inc/TestContactsAddEntries.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/inc/TestContactsAddEntries.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,35 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestSuiteContacts +// +// + +#ifndef TEST_CONTACTS_ADD_ENTRIES_H +#define TEST_CONTACTS_ADD_ENTRIES_H + +#include "TestContactsBase.h" + +class CTestContactsAddEntries : public CTestContactsBase +{ +public: + CTestContactsAddEntries(); + virtual ~CTestContactsAddEntries(); + + virtual enum TVerdict doTestStepL( void ); + +private: + void AddEntriesL( void ); +}; + +#endif TEST_CONTACTS_ADD_ENTRIES_H diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/inc/TestContactsBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/inc/TestContactsBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,53 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsBase +// +// + +#ifndef TEST_CONTACTS_BASE_H +#define TEST_CONTACTS_BASE_H + + +#include +#include +#include + +#include "TestContact.h" + +const TInt KMaxScriptLineLength = 200; + +class CTestContactsBase : public CTestStep, protected MTestContactInstrumentation +{ +public: + CTestContactsBase(); + ~CTestContactsBase(); + virtual enum TVerdict doTestStepPreambleL(); + virtual enum TVerdict doTestStepPostambleL(); + +protected: + void CreateDatabase(); + void OpenDatabase(); + void CleanupDatabase(); + void RaiseInstrumentationEventNotificationL(TInt aEventTag); + CContactIdArray* SearchEntriesL(); + +protected: + CContactDatabase* iDatabase; + CContactItemFieldDef* iFieldDef; + +private: + CActiveScheduler* iSchedular; +}; + +#endif /* TEST_CONTACTS_BASE_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/inc/TestContactsCreateDB.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/inc/TestContactsCreateDB.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsCreateDB +// +// + +#ifndef TEST_CONTACTS_CREATE_DB_H +#define TEST_CONTACTS_CREATE_DB_H + +#include "TestContactsBase.h" + +class CTestContactsCreateDB : public CTestContactsBase +{ +public: + CTestContactsCreateDB(); + virtual ~CTestContactsCreateDB(); + + virtual enum TVerdict doTestStepL( void ); + +}; + +#endif /* TEST_CONTACTS_CREATE_DB_H */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/scripts/Smoketest_Contacts.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/scripts/Smoketest_Contacts.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Contacts smoketest +// +RUN_UTILS MkDir c:\smoketest\ +RUN_UTILS CopyFile z:\smoketest\smoketest_contacts.ini c:\autosmoketest\smoketest_contacts.ini +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_contacts.ini +// +RUN_WS_PROGRAM 10 z:\sys\bin\contacts.exe +// +DELAY 1500 +// +LOAD_SUITE Smoketest_Contacts_Server +// +START_TESTCASE 9094 +RUN_TEST_STEP 100 Smoketest_Contacts_Server CreateDB c:\autosmoketest\Smoketest_Contacts.ini 18807_CreateDB +END_TESTCASE 9094 +START_TESTCASE 9082 +RUN_TEST_STEP 1000 Smoketest_Contacts_Server AddEntries c:\autosmoketest\Smoketest_Contacts.ini 18927_AddEntries +END_TESTCASE 9082 diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/src/SmoketestContactsServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/src/SmoketestContactsServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,108 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 SmoketestContactsServer.cpp +*/ + +#include "SmoketestContactsServer.h" +#include "TestContactsCreateDB.h" +#include "TestContactsAddEntries.h" + +// __EDIT_ME__ - Substitute the name of the test server +_LIT(KServerName,"Smoketest_Contacts_Server"); +// __EDIT_ME__ - Use your own server class name +CSmoketestContactsServer* CSmoketestContactsServer::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. + */ + { + CSmoketestContactsServer * server = new (ELeave) CSmoketestContactsServer(); + CleanupStack::PushL(server); + // CServer base class call + server->StartL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +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().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CSmoketestContactsServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CSmoketestContactsServer::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()); + + if (!err) { } + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + } + + +// __EDIT_ME__ - Use your own server class name +CTestStep* CSmoketestContactsServer::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 + if(aStepName == _L("AddEntries")) + testStep = new CTestContactsAddEntries(); + if(aStepName == _L("CreateDB")) + testStep = new CTestContactsCreateDB(); + + return testStep; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/src/TestContact.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/src/TestContact.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,491 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContact +// +// + +#include + +#include "TestContact.h" + +CTestContact* CTestContact::NewL(CContactItem& aSeedContact) + { + CTestContact* self=CTestContact::NewLC(aSeedContact); + CleanupStack::Pop(); + return self; + } + +CTestContact* CTestContact::NewLC(CContactItem& aSeedContact) + { + CTestContact* self=new(ELeave) CTestContact(); + CleanupStack::PushL(self); + self->ConstructL(aSeedContact); + return self; + } + +CTestContact* CTestContact::NewL(CContactItem* aSeedContact) + { + CTestContact* self=CTestContact::NewLC(aSeedContact); + CleanupStack::Pop(); + return self; + } + +CTestContact* CTestContact::NewLC(CContactItem* aSeedContact) + { + CTestContact* self=new(ELeave) CTestContact(); + CleanupStack::PushL(self); + self->ConstructL(aSeedContact); + return self; + } + +CTestContact::CTestContact() : iDestroyOnExit(EFalse) + { + } + +void CTestContact::ConstructL(CContactItem& aSeedContact) + { + iDestroyOnExit=ETrue; + iContactItem=CContactCard::NewL(&aSeedContact); + } + +void CTestContact::ConstructL(CContactItem* aSeedContact) + { + iDestroyOnExit=EFalse; + iContactItem=aSeedContact; + } + +CTestContact::~CTestContact() + { + if (iDestroyOnExit) + delete iContactItem; + iContactItem=NULL; + } + +CContactItem& CTestContact::ContactItem() + { + return *iContactItem; + } + +const TPtrC CTestContact::FirstNameL() + { + return TextFieldL(KUidContactFieldGivenName); + } + +const TPtrC CTestContact::LastNameL() + { + return TextFieldL(KUidContactFieldFamilyName); + } + +const TPtrC CTestContact::CompanyNameL() + { + return TextFieldL(KUidContactFieldCompanyName); + } + +const TPtrC CTestContact::JobTitleL() + { + return TextFieldL(KUidContactFieldJobTitle); + } + +const TPtrC CTestContact::WorkPhoneL() + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + const TPtrC text=TextFieldL(*contentType); + CleanupStack::PopAndDestroy(); // contentType. + return text; + } + +const TPtrC CTestContact::WorkMobileL() + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + contentType->AddFieldTypeL(KUidContactFieldVCardMapCELL); + const TPtrC text=TextFieldL(*contentType); + CleanupStack::PopAndDestroy(); // contentType. + return text; + } + +const TPtrC CTestContact::HomePhoneL() + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + const TPtrC text=TextFieldL(*contentType); + CleanupStack::PopAndDestroy(); // contentType. + return text; + } + +const TPtrC CTestContact::HomeMobileL() + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + contentType->AddFieldTypeL(KUidContactFieldVCardMapCELL); + const TPtrC text=TextFieldL(*contentType); + CleanupStack::PopAndDestroy(); // contentType. + return text; + } + +const TPtrC CTestContact::FaxL() + { + return TextFieldL(KUidContactFieldFax); + } + +const TPtrC CTestContact::EmailAddressL() + { + return TextFieldL(KUidContactFieldEMail); + } + +const TPtrC CTestContact::InternetAddressL() + { + return TextFieldL(KUidContactFieldUrl); + } + +const TPtrC CTestContact::StreetL() + { + return TextFieldL(KUidContactFieldAddress); + } + +const TPtrC CTestContact::TownL() + { + return TextFieldL(KUidContactFieldLocality); + } + +const TPtrC CTestContact::CountyL() + { + return TextFieldL(KUidContactFieldRegion); + } + +const TPtrC CTestContact::PostCodeL() + { + return TextFieldL(KUidContactFieldPostcode); + } + +const TPtrC CTestContact::CountryL() + { + return TextFieldL(KUidContactFieldCountry); + } + +const TPtrC CTestContact::NotesL() + { + return TextFieldL(KUidContactFieldNote); + } + +const TPtrC CTestContact::NickNameL() + { + return TextFieldL(KUidContactFieldSecondName); + } + +const TPtrC CTestContact::PictureL() + { + return TextFieldL(KUidContactFieldPicture); + } + +void CTestContact::SetFirstNameL(const TDesC& aFirstName) + { + SetTextFieldL(KUidContactFieldGivenName, aFirstName, KUidContactFieldVCardMapUnusedN); + } + +void CTestContact::SetLastNameL(const TDesC& aLastName) + { + SetTextFieldL(KUidContactFieldFamilyName, aLastName, KUidContactFieldVCardMapUnusedN); + } + +void CTestContact::SetCompanyNameL(const TDesC& aCompanyName) + { + SetTextFieldL(KUidContactFieldCompanyName, aCompanyName, KUidContactFieldVCardMapORG); + } + +void CTestContact::SetJobTitleL(const TDesC& aJobTitle) + { + SetTextFieldL(KUidContactFieldJobTitle,aJobTitle); + } + +void CTestContact::SetWorkPhoneL(const TDesC& aWorkPhone) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + SetTextFieldL(*contentType,aWorkPhone); + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetWorkMobileL(const TDesC& aWorkMobile) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + contentType->AddFieldTypeL(KUidContactFieldVCardMapCELL); + SetTextFieldL(*contentType,aWorkMobile); + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetHomePhoneL(const TDesC& aHomePhone) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + SetTextFieldL(*contentType,aHomePhone); + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetHomeMobileL(const TDesC& aHomeMobile) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + contentType->AddFieldTypeL(KUidContactFieldVCardMapCELL); + SetTextFieldL(*contentType,aHomeMobile); + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetFaxL(const TDesC& aFax) + { + SetTextFieldL(KUidContactFieldFax,aFax); + } + +void CTestContact::SetHomeEmailAddressL(const TDesC& aEmailAddress) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldEMail); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + SetTextFieldL(*contentType,aEmailAddress); + CleanupStack::PopAndDestroy(contentType); + } + +void CTestContact::SetWorkEmailAddressL(const TDesC& aEmailAddress) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldEMail); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + SetTextFieldL(*contentType,aEmailAddress); + CleanupStack::PopAndDestroy(contentType); + } + + +void CTestContact::SetInternetAddressL(const TDesC& aInternetAddress) + { + SetTextFieldL(KUidContactFieldUrl,aInternetAddress); + } + +void CTestContact::SetStreetL(const TDesC& aStreet) + { + SetTextFieldL(KUidContactFieldAddress,aStreet); + } + +void CTestContact::SetTownL(const TDesC& aTown) + { + SetTextFieldL(KUidContactFieldLocality,aTown); + } + +void CTestContact::SetCountyL(const TDesC& aCounty) + { + SetTextFieldL(KUidContactFieldRegion,aCounty); + } + +void CTestContact::SetPostCodeL(const TDesC& aPostCode) + { + SetTextFieldL(KUidContactFieldPostcode,aPostCode); + } + +void CTestContact::SetCountryL(const TDesC& aCountry) + { + SetTextFieldL(KUidContactFieldCountry,aCountry); + } + +void CTestContact::SetNotesL(const TDesC& aNotes) + { + SetTextFieldL(KUidContactFieldNote,aNotes); + } + +void CTestContact::SetNickNameL(const TDesC& aNickName) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldSecondName); + TRAPD(err, SetTextFieldL(*contentType,aNickName)); + if (!err) { } + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetPictureL(const TDesC8& aPicture) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPicture); + SetPictureFieldL(aPicture); + CleanupStack::PopAndDestroy(contentType); + } + +const TPtrC CTestContact::TextFieldL(TFieldType aFieldType) const + { + CContactItemField& field=FindFieldL(aFieldType); + ASSERT(field.StorageType()==KStorageTypeText); + return STATIC_CAST(CContactTextField*,(field.Storage()))->Text(); + } + +const TPtrC CTestContact::TextFieldL(const CContentType& aTypesToMatch) const + { + CContactItemField& field=FindFieldL(aTypesToMatch); + ASSERT(field.StorageType()==KStorageTypeText); + return STATIC_CAST(CContactTextField*,field.Storage())->Text(); + } + +void CTestContact::InsertTextFieldL(TFieldType aID, const TDesC& aStringOfStuff ) + { + CContactItemField* itemFieldPtr = NULL; + CContactTextField* textStoragePtr = NULL; + + itemFieldPtr = CContactItemField::NewLC( KStorageTypeText, aID ); + textStoragePtr = itemFieldPtr->TextStorage(); // we don't have ownership here, hence no stack. + + textStoragePtr->SetTextL( aStringOfStuff ); + textStoragePtr = NULL; // we've finished with this ptr now. + + iContactItem->AddFieldL( *itemFieldPtr ); // hand ownership over here + CleanupStack::Pop( itemFieldPtr ); // and pop, + } + +void CTestContact::SetTextFieldL(TFieldType aFieldType,const TDesC& aText) + { + TInt fieldIndex=FindField(aFieldType); + + if ( fieldIndex > KErrNotFound ) + { + CContactItemField& field=FindFieldL(aFieldType); + ASSERT(field.StorageType()==KStorageTypeText); + STATIC_CAST(CContactTextField*,field.Storage())->SetText(aText.AllocL()); + } + else + { + InsertTextFieldL(aFieldType, aText); + } + } + +void CTestContact::SetTextFieldL(const CContentType& aTypesToMatch,const TDesC& aText) const + { + CContactItemField& field=FindFieldL(aTypesToMatch); + ASSERT(field.StorageType()==KStorageTypeText); + STATIC_CAST(CContactTextField*,field.Storage())->SetText(aText.AllocL()); + } + +CContactItemField& CTestContact::FindFieldL(TFieldType aFieldType) const + { + CContactItemFieldSet& fields=iContactItem->CardFields(); + TInt index=fields.Find(aFieldType); + User::LeaveIfError(index); + return fields[index]; + } + +void CTestContact::SetTextFieldL(TFieldType aFieldType, const TDesC& aText, TUid aAddOnContentType) + { + CContactItemFieldSet& fields = iContactItem->CardFields(); + CContactTextField* textField = NULL; + TInt fieldIndex = 0; + + fieldIndex = FindField( aFieldType ); + + if (fieldIndex == KErrNotFound ) + { + InsertTextFieldL( aFieldType, aText ); + fieldIndex = FindField( aFieldType ); + CContactItemField& field = fields[ fieldIndex ]; + field.AddFieldTypeL( aAddOnContentType ); + } + else if (fieldIndex >= KErrNone ) + { + CContactItemField& field = fields[ fieldIndex ]; + ASSERT(field.StorageType()==KStorageTypeText); + textField = static_cast(field.Storage()); + textField->SetText( aText.AllocL() ); + field.AddFieldTypeL( aAddOnContentType ); + } + } + +TInt CTestContact::FindField(TFieldType aFieldType) const + { + return iContactItem->CardFields().Find( aFieldType ); + } + +CContactItemField& CTestContact::FindFieldL(const CContentType& aTypesToMatch) const + { + CContactItemFieldSet& fields=iContactItem->CardFields(); + const TInt numTypesToMatch(aTypesToMatch.FieldTypeCount()); + const TFieldType mainFieldType(aTypesToMatch.FieldType(0)); + TInt index=-1; + FOREVER + { + index=fields.FindNext(mainFieldType,index+1); + User::LeaveIfError(index); + + CContactItemField& thisPhoneField=fields[index]; + const CContentType& thisPhoneFieldTypes=thisPhoneField.ContentType(); + const TInt numFieldTypes(thisPhoneFieldTypes.FieldTypeCount()); + + if (numFieldTypes!=numTypesToMatch) + { + continue; + } + + TInt numTypesLeftToMatch=numTypesToMatch; + for (TInt ii=0;iiCardFields(); + TInt pos; + pos=fieldSet.Find(KUidContactFieldPicture); + User::LeaveIfError(pos); + fieldSet[pos].StoreStorage()->SetThingL(aPicture); + + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/src/TestContactsAddEntries.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/src/TestContactsAddEntries.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,408 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsAddEntries +// +// + +// Epoc include +#include + +// User include +#include "TestContactsAddEntries.h" +#include "TestContact.h" + +/*@{*/ +// Literal constants +_LIT(KCardTemplateName, "TestTemplate"); +_LIT(KCount, "count"); +_LIT(KFirstName, "firstname%d"); +_LIT(KLastName, "lastname%d"); +_LIT(KCompanyName, "company%d"); +_LIT(KJobTitle, "job%d"); +_LIT(KWorkPhone, "workphone%d"); +_LIT(KWorkMobile, "workmobile%d"); +_LIT(KHomePhone, "homephone%d"); +_LIT(KHomeMobile, "homemobile%d"); +_LIT(KFax, "fax%d"); +_LIT(KWorkEmailAddress, "workemail%d"); +_LIT(KInternetAddress, "internet%d"); +_LIT(KStreet, "street%d"); +_LIT(KTown, "town%d"); +_LIT(KCounty, "county%d"); +_LIT(KPostCode, "postcode%d"); +_LIT(KCountry, "country%d"); +_LIT(KNotes, "notes%d"); +_LIT(KNickName, "nickName%d"); +_LIT(KPictureName, "picturename%d"); +_LIT(KGroupName, "groupname%d"); +_LIT(KTemplateName, "templatename%d"); +_LIT(KOneFieldTemplate, "OneFieldTemplate"); +/*@}*/ + + +CTestContactsAddEntries::CTestContactsAddEntries() +/** +Default Constructor + */ + { + SetTestStepName(_L("AddEntries")); + } + +CTestContactsAddEntries::~CTestContactsAddEntries() +/** +Destructor + */ + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestContactsAddEntries::doTestStepL() +/** +invoked by the test execute framework for exercising the +functionality under test +@return EPass: The test passed succesfully; + EFail: The test failed; + EInconclusive: The result of the test was inconclusive; + ETestSuiteError: Error in the test suite; + EAbort: The test was aborted; + EIgnore: The test was unexecuted +@leave system wide error codes +*/ + { + + // Printing to the console and log file + INFO_PRINTF1(_L("Contacts Add Entries Test")); + + OpenDatabase(); + if ( TestStepResult() == EPass ) + { + TRAPD(r, AddEntriesL()); + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Test step failed with error code = %d"), r); + SetTestStepResult(EFail); + } + } + CleanupDatabase(); + + // test steps return a result + return TestStepResult(); + } + +void CTestContactsAddEntries::AddEntriesL() +/** +This function adds contact entries to the database depending on entry type. +If the entry contains the group name then the contact will be added to the +particular group specified in the entry. If the entry contains the template +name then the contact item depending on the specified template name will be +created and added to the database. + +@leave system wide error code + */ + { + TBool groupExists = EFalse; + TBool templateFound = EFalse; + TInt count=1; + + if ( !GetIntFromConfig(ConfigSection(), KCount, count) ) + { + count=1; + } + + INFO_PRINTF2(_L("Number of Entries to Add = %d"), count); + + TBuf tempStore; + TPtrC ptrString; + + /******************************************************************* + To Create a contact card template depending upon the contact item + on which the new template's field set is based. The template name + on which the new template is based is read from the ini file. + *******************************************************************/ + + for (TInt entry=0; entryCreateContactCardTemplateLC(KCardTemplateName); + } + else + { + INFO_PRINTF2(_L("Template Name = %S"), &ptrString); + CContactIdArray* templateList = NULL; + CContactItem* tempTemplate = NULL; + + // Returns a copy of the database's template ID list + templateList = iDatabase->GetCardTemplateIdListL(); + CleanupStack::PushL(templateList); + + // Returns the number of contact card templates that currently exist in the database. + TInt tCount = iDatabase->TemplateCount(); + INFO_PRINTF2(_L("Number of existing templates = %d"), tCount); + + // Search for template in the template ID list + for(TInt i = 0; iReadContactLC((*templateList)[i])); + + // Gets the label for a contact card template. + TPtrC tempLabel = STATIC_CAST(CContactCardTemplate*,tempTemplate)->GetTemplateLabelL(); + + // Compare the template label + if(!(tempLabel.Compare(ptrString))) + { + INFO_PRINTF2(_L("Template %S found"), &tempLabel); + + // Creates a contact card template and adds it to the database + item = iDatabase->CreateContactCardTemplateLC(tempTemplate,tempLabel); + + // Compare the template label with OneFieldTemplate and add field to it. + if(!(tempLabel.Compare(KOneFieldTemplate))) + { + // Allocates and constructs a contact item field + CContactItemField* field=CContactItemField::NewLC(KStorageTypeText,KUidContactFieldGivenName); + item->AddFieldL(*field); + CleanupStack::Pop(field); // field + } + CleanupStack::Pop(item); + templateFound = ETrue; + } + CleanupStack::PopAndDestroy(tempTemplate); + } + + if (!templateFound) + { + ERR_PRINTF2(_L("Ini Template %S does not match existing templates"), &ptrString); + SetTestStepResult(EFail); + } + + // Set templateFound to false for next entry + templateFound = EFalse; + + CleanupStack::PopAndDestroy(templateList); + CleanupStack::PushL(item); + } + + CTestContact* contact=CTestContact::NewLC(*item); + + tempStore.Format(KFirstName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("firstname = %S"), &ptrString); + contact->SetFirstNameL(ptrString); + } + + tempStore.Format(KNickName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("NickName = %S"), &ptrString); + TRAPD(err, contact->SetNickNameL(ptrString)); + if ( err != KErrNone ) + { + ERR_PRINTF2(_L("SetNickNameL Leave = %d"), err); + SetTestStepResult(EFail); + } + } + + tempStore.Format(KLastName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("lastname = %S"), &ptrString); + contact->SetLastNameL(ptrString); + } + + tempStore.Format(KCompanyName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("company = %S"), &ptrString); + contact->SetCompanyNameL(ptrString); + } + + tempStore.Format(KJobTitle(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("job = %S"), &ptrString); + contact->SetJobTitleL(ptrString); + } + + tempStore.Format(KWorkPhone(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("work phone = %S"), &ptrString); + contact->SetWorkPhoneL(ptrString); + } + + tempStore.Format(KWorkMobile(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("work mobile = %S"), &ptrString); + contact->SetWorkMobileL(ptrString); + } + + tempStore.Format(KHomePhone(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("home phone = %S"), &ptrString); + contact->SetHomePhoneL(ptrString); + } + + tempStore.Format(KHomeMobile(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("home mobile = %S"), &ptrString); + contact->SetHomeMobileL(ptrString); + } + + tempStore.Format(KFax(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("fax = %S"), &ptrString); + contact->SetFaxL(ptrString); + } + + tempStore.Format(KWorkEmailAddress(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("work email = %S"), &ptrString); + contact->SetWorkEmailAddressL(ptrString); + } + + tempStore.Format(KInternetAddress(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("internet = %S"), &ptrString); + contact->SetInternetAddressL(ptrString); + } + + tempStore.Format(KStreet(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("street = %S"), &ptrString); + contact->SetStreetL(ptrString); + } + + tempStore.Format(KTown(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("town = %S"), &ptrString); + contact->SetTownL(ptrString); + } + + tempStore.Format(KCounty(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("county = %S"), &ptrString); + contact->SetCountyL(ptrString); + } + + tempStore.Format(KPostCode(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("post code = %S"), &ptrString); + contact->SetPostCodeL(ptrString); + } + + tempStore.Format(KCountry(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("country = %S"), &ptrString); + contact->SetCountryL(ptrString); + } + + tempStore.Format(KNotes(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("notes = %S"), &ptrString); + contact->SetNotesL(ptrString); + } + + tempStore.Format(KPictureName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("Picture Name = %S"), &ptrString); + + HBufC8* pictureName8 = HBufC8::NewLC(ptrString.Length()); + pictureName8->Des().Copy(ptrString); + + contact->SetPictureL(*pictureName8); + + CleanupStack::PopAndDestroy(pictureName8); + } + + tempStore.Format(KGroupName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("Group Name = %S"), &ptrString); + + // Flag for adding contacts to group. + groupExists = ETrue; + } + + const TContactItemId id = iDatabase->AddNewContactL(contact->ContactItem()); + + /******************************************************************** + This is for adding the contact entry to the specified group. + ********************************************************************/ + if(groupExists) + { + INFO_PRINTF1(_L("Adding Item ")); + CContactIdArray* groupList = NULL; + + // Returns a copy of the database's group ID list + groupList = iDatabase->GetGroupIdListL(); + CleanupStack::PushL(groupList); + + // Returns the number of groups that currently exist in the database + TInt groupCount = iDatabase->GroupCount(); + + + // Search for the group + for(TInt i = 0; iReadContactLC((*groupList)[i])); + + // Gets the contact item's ID. + const TContactItemId groupId1 = group->Id(); + + // Gets the group label. + TPtrC label = group->GetGroupLabelL(); + // Compare the group label with group name read from ini file. + if(!(label.Compare(ptrString))) + { + /** + Sets a contact item which already exists in the database + to be a member of a contact group + */ + iDatabase->AddContactToGroupL(id, groupId1); + INFO_PRINTF1(_L("Item added successfully")); + groupExists = EFalse; + } + CleanupStack::PopAndDestroy(group); + + } + CleanupStack::PopAndDestroy(groupList); + } + + CleanupStack::PopAndDestroy(contact); + CleanupStack::PopAndDestroy(item); + + } + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/src/TestContactsBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/src/TestContactsBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,176 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsBase +// +// + +// EPOC includes +#include +#include +#include +#include + +// User include +#include "TestContactsBase.h" + +/*@{*/ +// Literal constants +_LIT(KDef, "default"); +_LIT(KFileName, "filenameSecure"); +_LIT(KKey, "key"); +/*@}*/ + + +// constructor +CTestContactsBase::CTestContactsBase() +: iDatabase(NULL) +, iFieldDef(NULL) +, iSchedular(NULL) + { + } + +// destructor +CTestContactsBase::~CTestContactsBase() + { + delete iFieldDef; + iFieldDef=NULL; + + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + } + +enum TVerdict CTestContactsBase::doTestStepPreambleL() + { + iSchedular=new (ELeave)CActiveScheduler(); + CActiveScheduler::Install(iSchedular); + + iFieldDef=new(ELeave) CContactItemFieldDef; + iFieldDef->AppendL(KUidContactFieldFamilyName); + iFieldDef->AppendL(KUidContactFieldGivenName); + return CTestStep::doTestStepPreambleL(); + } + +enum TVerdict CTestContactsBase::doTestStepPostambleL() + { + delete iFieldDef; + iFieldDef=NULL; + + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + + return CTestStep::doTestStepPostambleL(); + } + +// Create a new database +void CTestContactsBase::CreateDatabase() + { + TPtrC ptrFileName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KFileName, ptrFileName); + if (!returnValue) + returnValue=GetStringFromConfig(KDef, KFileName, ptrFileName); + + // Create database + if (returnValue) + { + INFO_PRINTF2(_L("filename = %S"), &ptrFileName); + TRAPD(r, iDatabase=CContactDatabase::ReplaceL(ptrFileName)) + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Creating Contacts file failed. Error %d"), r); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF1(_L("No Contacts file specified. Open default file.")); + TRAPD(r, iDatabase=CContactDatabase::ReplaceL()) + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Creating Contacts file failed. Error %d"), r); + SetTestStepResult(EFail); + } + } + } + +void CTestContactsBase::OpenDatabase() + { + TPtrC ptrFileName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KFileName, ptrFileName); + if (!returnValue) + returnValue=GetStringFromConfig(KDef, KFileName, ptrFileName); + + // Open database + if (returnValue) + { + INFO_PRINTF2(_L("filename = %S"), &ptrFileName); + RaiseInstrumentationEventNotificationL(17); + TRAPD(r, iDatabase=CContactDatabase::OpenL(ptrFileName)); + RaiseInstrumentationEventNotificationL(18); + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Opening Contacts file failed. Error %d"), r); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF1(_L("No Contacts file specified. Open default file.")); + RaiseInstrumentationEventNotificationL(17); + TRAPD(r, iDatabase=CContactDatabase::OpenL()); + RaiseInstrumentationEventNotificationL(18); + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Opening Contacts file failed. Error %d"), r); + SetTestStepResult(EFail); + } + } + } + +void CTestContactsBase::CleanupDatabase() + { + delete iDatabase; + iDatabase=NULL; + } + +void CTestContactsBase::RaiseInstrumentationEventNotificationL(TInt aEventTag) + { + INFO_PRINTF2(_L("RaiseEventNotification %d"), aEventTag); + } + +CContactIdArray* CTestContactsBase::SearchEntriesL() +/** +This function searches in the contacts database and populates an array +with ids' of the contacts which satisfy the search criterion +read from the ini file. +@return - Pointer to the contact ID array +@leave system wide error code + */ + { + TPtrC ptrKey; + if (!GetStringFromConfig(ConfigSection(), KKey, ptrKey)) + { + ERR_PRINTF1(_L("No key value for entry")); + SetTestStepResult(EFail); + } + INFO_PRINTF2(_L("Key Value for Entry Search = %S"), &ptrKey); + + // The function searches the fields contained in the field definition + INFO_PRINTF1(_L("Searching through the database for entry")); + + CContactIdArray* ret=iDatabase->FindLC(ptrKey, iFieldDef); + CleanupStack::Pop(ret); + return ret; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/src/TestContactsCreateDB.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/src/TestContactsCreateDB.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsCreateDB +// +// + +#include + +#include "TestContactsCreateDB.h" + +CTestContactsCreateDB::CTestContactsCreateDB() + { + SetTestStepName(_L("CreateDB")); + } + +CTestContactsCreateDB::~CTestContactsCreateDB() + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestContactsCreateDB::doTestStepL() + { + // Printing to the console and log file + INFO_PRINTF1(_L("Contacts CreateDB Test")); + + CreateDatabase(); + CleanupDatabase(); + + // test steps return a result + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/contacts/src/sm_contacts.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/contacts/src/sm_contacts.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,2 @@ +[Files MRU] +0=m:\src\common\generic\smoketest\agenda\src\TestAgendaServerLaunchProgress.cpp diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Group/Smoketest_Mess.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Group/Smoketest_Mess.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,83 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + +TARGET Smoketest_Mess_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7774 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY ReadUserData WriteUserData WriteDeviceData NetworkServices + +#if (defined _PLATTEST_CDMA_) +MACRO CDMA_API_ENABLED +MACRO GSM_COMPATIBILITY_MODE +#endif + +SOURCEPATH ..\Src + +SOURCE TestMessServer.cpp +SOURCE TestMessSession.cpp +SOURCE TestMessSharedData.cpp +SOURCE TestMessWatcher.cpp +SOURCE TestMessProcessor.cpp +SOURCE TestMessTimer.cpp +SOURCE TestMessBase.cpp +SOURCE TestMessCleanMessageFolder.cpp +SOURCE TestMessCreateSmsAccount.cpp +SOURCE TestMessSetDefaultSc.cpp +SOURCE TestMessCreateSMS.cpp +SOURCE TestMessCreateGsmSmsUtil.cpp +#ifdef _PLATTEST_CDMA_ +SOURCE TestMessCreateCdmaSmsUtil.cpp +#endif +SOURCE TestMessCreateSmsUtilBase.cpp +SOURCE TestMessProcessExistingMsg.cpp +SOURCE TestMessEditEntry.cpp +SOURCE TestMessStoreProcessUtil.cpp +SOURCE TestMessEditEntryUtil.cpp +SOURCE TestMessPrintEntryUtil.cpp + +USERINCLUDE ..\Inc +USERINCLUDE ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY etel.lib +LIBRARY schsend.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY msgs.lib +LIBRARY fbscli.lib +LIBRARY imcm.lib +LIBRARY efsrv.lib +LIBRARY sendas2.lib +LIBRARY etext.lib +LIBRARY smcm.lib + +LIBRARY gsmu.lib +LIBRARY esock.lib +LIBRARY smsu.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib +LIBRARY SmokeTest_Utils.lib +LIBRARY etelmm.lib + +SMPSAFE diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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_TESTEXPORTS + + +../Scripts/Smoketest_Mess.script /epoc32/release/wins/udeb/z/autosmoketest/smoketest_mess.script +../Scripts/Smoketest_Mess.script /epoc32/release/wins/urel/z/autosmoketest/smoketest_mess.script +../Scripts/Smoketest_Mess.script /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_mess.script +../Scripts/Smoketest_Mess.script /epoc32/release/winscw/urel/z/autosmoketest/smoketest_mess.script + +../TestData/Sms/Message1.txt /epoc32/release/wins/udeb/z/autosmoketest/sms/message1.txt +../TestData/Sms/Message1.txt /epoc32/release/wins/urel/z/autosmoketest/sms/message1.txt +../TestData/Sms/Message1.txt /epoc32/release/winscw/udeb/z/autosmoketest/sms/message1.txt +../TestData/Sms/Message1.txt /epoc32/release/winscw/urel/z/autosmoketest/sms/message1.txt + +../TestData/Smoketest_Mess.ini /epoc32/release/wins/udeb/z/autosmoketest/smoketest_mess.ini +../TestData/Smoketest_Mess.ini /epoc32/release/wins/urel/z/autosmoketest/smoketest_mess.ini +../TestData/Smoketest_Mess.ini /epoc32/release/winscw/udeb/z/autosmoketest/smoketest_mess.ini +../TestData/Smoketest_Mess.ini /epoc32/release/winscw/urel/z/autosmoketest/smoketest_mess.ini + + +PRJ_TESTMMPFILES +Smoketest_Mess.mmp diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMess.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// This contains CTestMess which contains common constants +// +// + +#if (!defined __TEST_MESS_H__) +#define __TEST_MESS_H__ + +/*@{*/ +// Literals defined for SMS account details +_LIT(KSmsAccountName, "Short Message"); +/*@}*/ + +#endif /* __TEST_MESS_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,125 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessBase which is the base class for all +// messaging test steps +// +// + + +#if (!defined __TEST_MESS_BASE_H__) +#define __TEST_MESS_BASE_H__ + + +#include +#include +#include +#include +#include +#include +#include + +#include "TestMessProcessor.h" +#include "TestMessTimer.h" + +#include +#include +#include +#if (defined CDMA_API_ENABLED) +#include +#include +#endif +#include + +#include +//To check whether the reply quoted is set +_LIT(KReplyQuoted, "SmsReplyQuoted"); + +const TUid KUidMsvSMSHeaderStream = {0x10001834}; +const TUid KUidMsgFileInternetAccessPreferences = {0x1000924B}; +const TUid KUidMsvDefaultServices = {0x100017FD}; + +const TInt KOneSecond = 1000000; + +class CParaFormatLayer; +class CCharFormatLayer; +class CRichText; + +class CTestMessBase : public CTestStepSmokeTest, private MMsvSessionObserver + { +public: + CTestMessBase(TBool aSetDirectory); + virtual ~CTestMessBase(); + + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepPostambleL(); + + void SetEntryL(TMsvId aId); + CMsvEntry& EntryL(); + TBool HasEntry() const { return iEntry!=NULL; } + const TMsvSelectionOrdering& SelectionOrdering() const { return iOrder; } + CMsvSession& Session() const { return *iSession; } + void PrintEntryL(CMsvEntry& aEntry); + CEmsPreDefSoundIE* NewPreDefSoundL(const TDesC& aPreDefType); + + +protected: + // MMsvSessionObserver + void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*); + + // Utilities + static HBufC8* CopyToBuf8LC(const TDesC& aPtrC); + static HBufC* CopyToBufLC(const TDesC8& aPtr8); + void PrintTreeL(TMsvId aRoot); + void IssueTimerRequest(); + + + void PrepareSmsHeaderFromIniFileL(CSmsHeader& aSmsHeader); + + //reads the schedule time from ini file + TTimeIntervalMinutes ReadScheduleTime(); + +private: + // PrintEntry helper functions + void PrintStoreL(CMsvEntry& aEntry); + void PrintStoreSmtpL(CMsvEntry& aEntry); + void PrintStorePop3L(CMsvEntry& aEntry); + void PrintStoreImap4L(CMsvEntry& aEntry); + void PrintStoreSmsL(CMsvEntry& aEntry); + + // PrepareSmsHeaderFromIniFileL helper functions + void SetAlignmentFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aAlignment); + void SetFontSizeFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aFontSize); + + CEmsPreDefAnimationIE* NewPreDefAnimationL(const TDesC& aPreDefType); + CFbsBitmap* NewBitmapL(const TParse& aFileName, const TDesC& aObjectSize); + +protected: + CMsvSession* iSession; + CTestMessProcessor* iMessageProcessor; + CParaFormatLayer* iParaFormatLayer; + CCharFormatLayer* iCharFormatLayer; + CRichText* iBodyText; + TBool iBodyAvailable; + + +private: + TBool iCheckForSim; + TBool iSetDirectory; + CTestMessTimer* iMessageTimer; + CActiveScheduler* iSchedular; + CMsvEntry* iEntry; + TMsvSelectionOrdering iOrder; + }; + +#endif /* __TEST_MESS_BASE_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessCleanMessageFolder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessCleanMessageFolder.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCleanMessageFolder which cleans out all the +// message folders +// +// + +#if (!defined __TEST_MESS_CLEAN_MESSAGE_FOLDER_H__) +#define __TEST_MESS_CLEAN_MESSAGE_FOLDER_H__ + +#include "TestMessBase.h" + +class CTestMessCleanMessageFolder : public CTestMessBase +{ +public: + CTestMessCleanMessageFolder(); + + virtual TVerdict doTestStepL(); + +private: + void CleanFolders(const TMsvId aEntryId); + +private: + TInt iNumberOfMessagesToDelete; +}; + +#endif /* __TEST_MESS_CLEAN_MESSAGE_FOLDER_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessCreateCdmaSmsUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessCreateCdmaSmsUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 creates a Cdma sms header and service settings. It sets the fields by reading +// from the ini file +// +// + + +#if (!defined __TEST_MESS_CREATE_CDMA_SMS_UTIL_H__) +#define __TEST_MESS_CREATE_CDMA_SMS_UTIL_H__ + +#include "TestMessCreateSmsUtilBase.h" + +/** + This class creates a Cdma sms header and service settings.It sets the fields by reading + from the ini file +*/ +class CTestMessCreateCdmaSmsUtil : public CTestMessCreateSmsUtilBase +{ +public: + //Constructor + CTestMessCreateCdmaSmsUtil(CTestMessBase &aTestStep); + + //Creates a new header + CSmsHeader* NewHeaderL(CRichText &aBodyText); + + //Sets the fields of the header + void PrepareHeaderL(CSmsHeader &aSmsHeader); + + //Sets the account settings. + void SetSmsAccountSettings(CSmsSettings &aSmsSettings); + +private: + //Gets the message type of the SMS + TSmsMessageType GetMessageTypeId(TPtrC aMessageType); + + //Gets the tele service ID + tia637::TTeleserviceId GetTeleServiceId(TPtrC aTeleService); + + //Gets the message conversion ID + TSmsPIDConversion GetMessageConversionId(TPtrC aMessageConversion); + +}; + +#endif /* __TEST_MESS_CREATE_CDMA_SMS_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessCreateGsmSmsUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessCreateGsmSmsUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 creates the Gsm sms header and service settings. It fills up the +// fields using data read from the ini file +// +// + + +#if (!defined __TEST_MESS_CREATE_GSM_SMS_UTIL_H__) +#define __TEST_MESS_CREATE_GSM_SMS_UTIL_H__ + +#include "TestMessCreateSmsUtilBase.h" + +/** + This class creates the Gsm sms header and the GSM SMS service settings. + The data is read from the ini file. +*/ +class CTestMessCreateGsmSmsUtil : public CTestMessCreateSmsUtilBase + { +public: + //Constructor + CTestMessCreateGsmSmsUtil(CTestMessBase &aTestStep); + + /** + Prepare sms account details + */ + virtual void PrepareAccountL(CMsvSession& aSession); + + /** + Creates the new header object + */ + virtual CSmsHeader* NewHeaderL(CRichText &aBodyText); + + /** + Fills up the fields of the sms header object + */ + virtual void PrepareHeaderL(CSmsHeader &aSmsHeader); + + /** + Fills up the fields of the sms account settings + */ + virtual void SetSmsAccountSettings(CSmsSettings &aSmsSettings); + }; + +#endif /* __TEST_MESS_CREATE_GSM_SMS_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessCreateSMS.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessCreateSMS.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,64 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCreateSMS. This class creates the sms message +// for GSM or CDMA. For CDMA mtm, it uses utility classes to create +// the respective GSM or CDMA sms message +// +// + +#if (!defined __TEST_MESS_CREATE_SMS_H__) +#define __TEST_MESS_CREATE_SMS_H__ + +//Epoc include +#include +#include +#include +#include + +#include "TestMessBase.h" +#include "TestMessCreateSmsUtilBase.h" + +/** + This class creates the sms message for GSM or CDMA. For CDMA mtm, it + uses utility classes to create the respective GSM or CDMA sms message +*/ +class CTestMessCreateSMS : public CTestMessBase +, private MTestActiveCallback + { +public: + CTestMessCreateSMS(); + + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + +protected: + virtual void AddMtmCapabilitiesL(RSendAs& aSendAs); + virtual void PrepareSendAsL(RSendAsMessage& aSendAs); + virtual void PrepareHeaderL(CTestMessCreateSmsUtilBase& aCreateUtil, CSmsHeader& aSmsHeader); + void ConCatMessageTextL(CSmsHeader& aHeader); + void CreateSmsL(const TMsvId aMsvId, TTimeIntervalMinutes aScheduledTime); + +private: + virtual void RunL() { CActiveScheduler::Stop(); } + /** + * Method from which CTestActive informs the user DoCancel call + */ + virtual void DoCancel() { } + +private: + TBool iSimInDatabase; + RMobilePhone::TMobileAddress iSimPhoneNumber; + }; + +#endif /* __TEST_MESS_CREATE_SMS_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessCreateSMSaccount.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessCreateSMSaccount.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,36 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessCreateSmsAccount.cpp +// This contains CTestMessCreateSmsAccount which creates an SMS +// account folder for GSM or CDMA +// +// + +#if (!defined __TEST_MESS_CREATE_SMS_ACCOUNT_H__) +#define __TEST_MESS_CREATE_SMS_ACCOUNT_H__ + +#include "TestMessBase.h" + +/** + This class creates an SMS account folder for GSM or CDMA +*/ +class CTestMessCreateSmsAccount : public CTestMessBase + { +public: + CTestMessCreateSmsAccount(); + + virtual TVerdict doTestStepL(); + }; + +#endif /* __TEST_MESS_CREATE_SMS_ACCOUNT_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessCreateSmsUtilBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessCreateSmsUtilBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,81 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 is the base class for create CDMA or GSM SMS utility class +// +// + +#if (!defined __TEST_MESS_CREATE_SMS_UTIL_BASE_H__) +#define __TEST_MESS_CREATE_SMS_UTIL_BASE_H__ + +#include "TestMessBase.h" + +// EPOC includes +#include +#include + +#include + +/*@{*/ +_LIT(KBearer, "bearer"); +_LIT(KEncoding, "encoding"); +_LIT(KDef, "default"); +_LIT(KDefBearer, "smsbearer"); +_LIT(KDefEncoding, "smsencoding"); +_LIT(KDefDeliveryReport, "smsDeliveryReport"); +_LIT(KDeliveryReport, "DeliveryReport"); +_LIT(KRejectDuplicate, "SmsRejectDuplicate"); +_LIT(KReplyPath, "SmsReplyPath"); +_LIT(KConCatenate, "SmsConCatenate"); + +_LIT(KBearerWap, "wap"); +_LIT(KBearerWapSecure, "wapsecure"); +/*@}*/ + +/** + This class is the base class for create GSM or CDMA SMS utility classes +*/ +class CTestMessCreateSmsUtilBase : public CBase + { +public: + //Constructor + CTestMessCreateSmsUtilBase(CTestMessBase &aTestStep); + + /** + Prepare sms account details + */ + virtual void PrepareAccountL(CMsvSession& aSession) = 0; + + /** + Creates the new header object + */ + virtual CSmsHeader* NewHeaderL(CRichText &aBodyText) = 0; + + /** + Fills up the fields of the sms header object + */ + virtual void PrepareHeaderL(CSmsHeader &aSmsHeader) =0; + + /** + Fills up the fields of the sms account settings + */ + virtual void SetSmsAccountSettings(CSmsSettings &aSmsSettings) =0; + +protected: + /** + Reference to the test step which creates the utility class + */ + CTestMessBase& iTestStep; + }; + +#endif /* __TEST_MESS_CREATE_SMS_UTIL_BASE_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessEditEntry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessEditEntry.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,64 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntry which edits the entry characterstics +// +// + + +#if (!defined __TEST_MESS_EDIT_ENTRY_H__) +#define __TEST_MESS_EDIT_ENTRY_H__ + +#include "TestMessProcessExistingMsg.h" + +/** + This class edits the entry characteristics +*/ +class CTestMessEditEntry : public CTestMessProcessExistingMsg +{ +public: + CTestMessEditEntry() { SetTestStepName(_L("EditEntry")); } + + virtual void ProcessMessageL(CBaseMtm& aBaseMtm, TMsvId aMsgId); + + //Move the message to different folder + void MoveMessageL(TMsvId aMessageId,TMsvId aFolderId); + + /** + This class is used for asynchronous operation for move + message operation + */ + class CMoveOperation: public CActive + { + public: + //Pure virtual implementation of CActive + void RunL(); + + //Pure virtual implementation of CActive + void DoCancel(); + + //Set the operation as active + void SetOperation(); + + //Two phase construction + static CMoveOperation* NewL(); + private: + //Second phase construction + void ConstructL(); + + //Constructor + CMoveOperation(); + }; +}; + +#endif /* __TEST_MESS_EDIT_ENTRY_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessEditEntryUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessEditEntryUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntryUtil. A utility to edit an entry +// +// + +#if (!defined __TEST_MESS_EDIT_ENTRY_UTIL_H__) +#define __TEST_MESS_EDIT_ENTRY_UTIL_H__ + +#include "TestMessStoreProcessUtil.h" + +/** + This class is a utility to edit an entry +*/ +class CTestMessEditEntryUtil : public CTestMessStoreProcessUtil +{ +public: + CTestMessEditEntryUtil(CTestMessBase& aTestStep, TBool aSimChecked, TBool aSimInDatabase, RMobilePhone::TMobileAddress aSimPhoneNumber); + +protected: + // Process the CImHeader information + virtual void ProcessImHeaderL(CImHeader& aHeader); + + // Process the CImMimeHeader information + virtual void ProcessImMimeHeaderL(CImMimeHeader& aHeader); + + // Process the CImIAPPreferences information + virtual void ProcessInternetAccessPreferencesL(CImIAPPreferences& aPreferences); + + // Process the CSmsHeader information + virtual void ProcessSmsHeaderStreamL(CSmsHeader& aHeader); + + + // Process the CRichText information + virtual void ProcessRichTextBodyL(CRichText& aBodyText); + +private: + TBool iSimChecked; + TBool iSimInDatabase; + RMobilePhone::TMobileAddress iSimPhoneNumber; +}; + +#endif /* __TEST_MESS_EDIT_ENTRY_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessPrintEntryUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessPrintEntryUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +/** +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CTestMessEditEntryUtil. A utility to edit an entry +* +* +*/ + + + +/** + @file TestMessPrintEntryUtil.h +*/ + +#if (!defined __TEST_MESS_PRINT_ENTRY_UTIL_H__) +#define __TEST_MESS_PRINT_ENTRY_UTIL_H__ + +#include "TestMessStoreProcessUtil.h" + +class CTestMessPrintEntryUtil : public CTestMessStoreProcessUtil +{ +public: + CTestMessPrintEntryUtil(CTestMessBase& aTestStep); + +protected: + // Process the CImHeader information + virtual void ProcessImHeaderL(CImHeader& aHeader); + + // Process the CImMimeHeader information + virtual void ProcessImMimeHeaderL(CImMimeHeader& aHeader); + + // Process the CImIAPPreferences information + virtual void ProcessInternetAccessPreferencesL(CImIAPPreferences& aPreferences); + + // Process the CSmsHeader information + virtual void ProcessSmsHeaderStreamL(CSmsHeader& aHeader); + + + // Process the CRichText information + virtual void ProcessRichTextBodyL(CRichText& aBodyText); +}; + +#endif /* __TEST_MESS_PRINT_ENTRY_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessProcessExistingMsg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessProcessExistingMsg.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,43 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessProcessExistingMsg.cpp +// This contains CTestMessProcessExistingMsg +// Base class for processing an existing message +// +// + +#if (!defined __TEST_MESS_PROCESS_EXISTING_MSG__) +#define __TEST_MESS_PROCESS_EXISTING_MSG__ + +#include "TestMessBase.h" + +#include + +class CTestMessProcessExistingMsg : public CTestMessBase +{ +public: + CTestMessProcessExistingMsg(); + + virtual TVerdict doTestStepL(); + +protected: + virtual void ProcessMessageL(CBaseMtm& aBaseMtm, TMsvId aMsgId) = 0; + virtual void PostProcessMessageL(); + TUid MtmID() const { return iMtmID; } + +private: + TUid iMtmID; +}; + +#endif /* __TEST_MESS_PROCESS_EXISTING_MSG__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessProcessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessProcessor.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,86 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessProcessor.cpp +// This contains CTestMessProcessor which an active object utility +// used for send/recieving or any time consuming +// +// + +#if (!defined __TEST_MESS_PROCESSOR_H__) +#define __TEST_MESS_PROCESSOR_H__ + +//Epoc Include +#include +#include +#include + +class CTestStep; + +class MTestMessProcessorClient + { +public: + virtual TBool MoreOperations() const = 0; + virtual CMsvOperation* CreateOperationL(TRequestStatus& aStatus) = 0; + virtual TInt DisplayProgressL(TBool aFinalProgress, CMsvOperation* aMsvOperation) = 0; + }; + +/** + This class is an active object utility used for send/recieving + or any time consuming +*/ +class CTestMessProcessor : public CActive + { +public: + virtual ~CTestMessProcessor(); + static CTestMessProcessor* NewL(CTestStep& aTestStep, CMsvSession& aSession); + + void RunL(); + + void DisplayProgress(); + void SendEmailMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient); + + //Sends the SMS message + void SendSmsMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient, TBool aCancelSms); + void SendMmsMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient); + void MtmRequestL(TMsvId aAccountId, MTestMessProcessorClient* aClient); + +protected: + CTestMessProcessor(CTestStep& aTestStep, CMsvSession& aSession /*, MTestInstrumentation& aInstrumentation */); + void ConstructL(); + void DoCancel(); + +private: + enum EState + { + EStatePrepareToSendMsg, + EStateRequest, + }; + + EState iState; + CTestStep& iTestStep; + CMsvSession& iSession; + + // Send message parameters saved for RunL + CMsvEntry* iEntry; + TMsvId iMsgId; + MTestMessProcessorClient* iClient; + TMsvEntry iMsgEntry; + CMsvOperation* iMsvOperation; + /** + Boolean value for the Cancel sms flag + */ + TBool iCancelSms; +}; + +#endif /* __TEST_MESS_PROCESSOR_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessServer +// +// + +#if (!defined __TEST_MESS_SERVER_H_) +#define __TEST_MESS_SERVER_H_ + +#include "TestMessWatcher.h" +#include "TestMessSharedData.h" + +#include + +class CMsvSession; + +class CTestMessServer : public CTestServer +{ +public: + static CTestMessServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + ~CTestMessServer(); + CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; +protected: + CTestMessServer(); + void ConstructL(const TDesC& aName); + +private: + +private: + CTestMessSharedData* iSharedData; +}; + +#endif /* __TEST_MESS_SERVER_H_ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessSession.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,35 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessSession +// +// + +#if (!defined __TEST_MESS_SESSION_H__) +#define __TEST_MESS_SESSION_H__ + +#include +#include "TestMessSharedData.h" + +class CTestMessSession : public CTestSession +{ +public: + CTestMessSession(CTestMessSharedData* aSharedData); + virtual void ServiceL(const RMessage2& aMessage); + + +private: + CTestMessSharedData* iSharedData; +}; + +#endif /* __TEST_MESS_SESSION_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessSetDefaultSc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessSetDefaultSc.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessSetDefaultSc.cpp +// This contains TestMessSetDefaultSc which sets an SMS +// SC as default SC. +// +// + +#if (!defined __TEST_MESS_SET_DEFAULT_SC_H__) +#define __TEST_MESS_SET_DEFAULT_SC_H__ + +#include "TestMessBase.h" + +class CTestMessSetDefaultSc : public CTestMessBase +{ +public: + CTestMessSetDefaultSc(); + + virtual TVerdict doTestStepL(); +}; + +#endif /* __TEST_MESS_SET_DEFAULT_SC_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessSharedData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessSharedData.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,102 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessSharedData +// +// + +#if (!defined __TEST_MESS_SHARED_DATA_H__) +#define __TEST_MESS_SHARED_DATA_H__ + +#include +#include +#include +#include + +class CTestMessSharedData : public CBase, private MMsvSessionObserver +{ +public: + static CTestMessSharedData* NewL(); + ~CTestMessSharedData(); + + void IMAP4ConnectAndSyncCompleteAfterDisconnectL(TUid aMtmId, TMsvId aMsvId, CTestStep& aStep); + TInt DeleteEntryL(CTestStep& aStep); + + void DoProcessL(); + +protected: + CTestMessSharedData(); + +private: + void ConstructL(); + + // MMsvSessionObserver implementation + virtual void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {} + +private: + class CMsgEntry : public CActive + { + public: + ~CMsgEntry(); + + virtual void DoCancel(); + virtual void RunL(); + virtual void DoProcessL(CClientMtmRegistry& aMtmRegistry) = 0; + virtual void DoCancelProcessL() = 0; + + protected: + CMsgEntry(CMsgEntry* aList); + + void ConstructL(CTestStep& aStep); + + public: + TName iName; + CMsgEntry* iNext; + TBool iReadyToBeDeleted; + }; + class CMsgIMAP4ConnectAndSyncComplete : public CMsgEntry, public MMsvImapConnectionObserver + { + public: + static CMsgIMAP4ConnectAndSyncComplete* NewL(TUid aMtmId, TMsvId aMsvId, CTestStep& aStep, CMsgEntry* aList); + ~CMsgIMAP4ConnectAndSyncComplete(); + + virtual void RunL(); + virtual void DoProcessL(CClientMtmRegistry& aMtmRegistry); + virtual void DoCancelProcessL(); + + protected: + CMsgIMAP4ConnectAndSyncComplete(TUid aMtmId, TMsvId aMsvId, CMsgEntry* aList); + + private: + // MMsvImapConnectionObserver implementation + void HandleImapConnectionEvent(TImapConnectionEvent aConnectionEvent); + + private: + TUid iMtmId; + TMsvId iMsvId; + CBaseMtm* iBaseMtm; + CMsvOperation* iOperation; + + }; + +public: + CMsvSession* iSession; + CClientMtmRegistry* iMtmRegistry; + CMsgEntry* iList; + +private: + CMsgEntry* iAnyPostStepToDo; + TBool iDeleteTestStep; +}; + +#endif /* __TEST_MESS_SHARED_DATA_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessStoreProcessUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessStoreProcessUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,81 @@ +/** +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CTestMessStoreProcessUtil. Base class process what is in the message store +* +* +*/ + + + +/** + @file TestMessStoreProcessUtil.h +*/ + +#if (!defined __TEST_MESS_STORE_PROCESS_UTIL_H__) +#define __TEST_MESS_STORE_PROCESS_UTIL_H__ + +#include "TestMessBase.h" + +class CTestMessStoreProcessUtil : public CBase +{ +public: + CTestMessStoreProcessUtil(CTestMessBase& aTestStep, TBool aReadOnly); + + // + TInt ProcessEntryL(TMsvId aMsvId); + +protected: + // Process the CImHeader information + virtual void ProcessImHeaderL(CImHeader& aHeader) = 0; + + // Process the CImMimeHeader information + virtual void ProcessImMimeHeaderL(CImMimeHeader& aHeader) = 0; + + // Process the CImIAPPreferences information + virtual void ProcessInternetAccessPreferencesL(CImIAPPreferences& aPreferences) = 0; + + // Process the CSmsHeader information + virtual void ProcessSmsHeaderStreamL(CSmsHeader& aHeader) = 0; + + + // Process the CRichText information + virtual void ProcessRichTextBodyL(CRichText& aBodyText) = 0; + + // Convert Text to character set information + TBool ValidCharacterSetInfo(const TPtrC& aCharacterSetType, TUint &aCharSetVal); + +private: + // Process the CImHeader information + void ProcessImHeaderL(CMsvStore& aStore); + + // Process the CImMimeHeader information + void ProcessImMimeHeaderL(CMsvStore& aStore); + + + // Process the CSmsHeader information + void ProcessSmsHeaderStreamL(CMsvStore& aStore); + + + // Process the CRichText information + void ProcessRichTextBodyL(CMsvStore& aStore); + +protected: + CTestMessBase& iTestStep; + +private: + TBool iReadOnly; +}; + +#endif /* __TEST_MESS_STORE_PROCESS_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessTimer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessTimer +// +// + +#if (!defined __TEST_MESS_TIMER_H_) +#define __TEST_MESS_TIMER_H_ + +#include + +class CTestMessProcessor; + +class CTestMessTimer : public CTimer +{ +public: + virtual ~CTestMessTimer(); + static CTestMessTimer* NewL(TTimeIntervalMicroSeconds32 aInterval, CTestMessProcessor& aProcessor); + + void RunL(); + + void IssueRequest(); + +protected: + CTestMessTimer(TTimeIntervalMicroSeconds32 aInterval, CTestMessProcessor& aProcessor); + void ConstructL(); + +private: + TTimeIntervalMicroSeconds32 iInterval; + CTestMessProcessor& iProcessor; +}; + +#endif /* __TEST_MESS_TIMER_H_ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Inc/TestMessWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Inc/TestMessWatcher.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessWatcher which starts the message watchers +// +// + +#if (!defined __TEST_MESS_WATCHER_H__) +#define __TEST_MESS_WATCHER_H__ + +#include +#include + +const TInt KTestUtilsWatcherStarterMin = 5000000; + +class CTestMessWatcher : public CActive +{ +public: + static CTestMessWatcher* NewL(TInt aPriority = EPriorityStandard); + ~CTestMessWatcher(); + +private: + CTestMessWatcher(TInt aPriority); + void RunL(); + void DoCancel(); + void ConstructL(); + +private: + RTimer iTimer; + RProcess iWatcher; + TBool iConstructed; + TTimeIntervalMicroSeconds32 iTimeLeft; +}; + +#endif /* __TEST_MESS_WATCHER_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Scripts/Smoketest_CreateSmsAccount.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Scripts/Smoketest_CreateSmsAccount.script Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,20 @@ +// +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 Create SMS account with vodaphone service centre +// +LOAD_SUITE Smoketest_Mess_Server +RUN_TEST_STEP 10000 Smoketest_Mess_Server CreateSmsAccount c:\smoketest\smoketest_mess.ini 27029_SmsVodafoneAccount diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Scripts/Smoketest_Mess.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Scripts/Smoketest_Mess.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Mesaging smoketest +// +RUN_WS_PROGRAM 10 z:\sys\bin\mcentre.exe +// +DELAY 1500 +// +LOAD_SUITE Smoketest_Mess_Server +// Wait for watchers to start +DELAY 1000 +// +RUN_UTILS MkDir c:\autosmoketest\ +RUN_UTILS MkDir c:\autosmoketest\sms\ +RUN_UTILS CopyFile z:\autosmoketest\smoketest_mess.ini c:\autosmoketest\smoketest_mess.ini +RUN_UTILS MakeReadWrite c:\autosmoketest\smoketest_mess.ini +RUN_UTILS CopyFile z:\autosmoketest\sms\message1.txt c:\autosmoketest\sms\message1.txt +RUN_UTILS MakeReadWrite c:\autosmoketest\sms\message1.txt +// +RUN_TEST_STEP 10000 Smoketest_Mess_Server CleanMessageFolder c:\autosmoketest\Smoketest_mess.ini 27595_SmsCount01 +DELAY 500 +PRINT Create SMS account with vodaphone service centre +// +RUN_TEST_STEP 10000 Smoketest_Mess_Server CreateSmsAccount c:\autosmoketest\smoketest_mess.ini 27029_SmsVodafoneAccount +// +RUN_TEST_STEP 10000 Smoketest_Mess_Server SetSmsSc c:\autosmoketest\Smoketest_mess.ini 27029_SmsVodafoneAccount +DELAY 500 +RUN_TEST_STEP 10000 Smoketest_Mess_Server CreateSms c:\autosmoketest\Smoketest_mess.ini 27584_SmsMessage01 diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,1517 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestCase which is the base class for all the TestCase DLLs +// +// + +#include "TestMessBase.h" +#include "TestMessProcessor.h" +#include "TestMessTimer.h" +#include "TestMessPrintEntryUtil.h" + +// EPOC includes +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __MESSAGING_API_V2__ +#include +#include +#include +#include +#endif +/** + * @name Constant Literals used. + */ +/*@{*/ +_LIT(KDepth, "depth"); +_LIT(KFolder, "folder%d"); + +// Default value for depth of the count +#define KDefaultDepthCount 1 + +// Default value for depth of the count +#define KDefaultDepthCount 1 + +_LIT(KDefault, "default"); + +_LIT(KScheduled, "scheduled"); +_LIT(KProgress, "progress"); + +//_LIT(KIap, "iap"); +//_LIT(KIapName, "iapname"); + +_LIT(KElements, "elements"); +_LIT(KStartPosition, "StartPosition%d"); +_LIT(KFile, "File%d"); +_LIT(KType, "Type%d"); +_LIT(KTypeFormat, "Format"); +_LIT(KTypeSound, "Sound"); +_LIT(KTypePreDefSound, "PreDefSound"); +_LIT(KTypeAnimation, "Animation"); +_LIT(KTypePreDefAnimation, "PreDefAnimation"); +_LIT(KTypePicture, "Picture"); +_LIT(KTypeUserPrompt, "UserPrompt"); +_LIT(KFormatLength, "FormatLength%d"); +_LIT(KBold, "Bold%d"); +_LIT(KItalic, "Italic%d"); +_LIT(KUnderline, "Underline%d"); +_LIT(KStrikethrough, "Strikethrough%d"); +_LIT(KAlignment, "Alignment%d"); +_LIT(KFontSize, "FontSize%d"); + +_LIT(KLeftAlign, "LeftAlign"); +_LIT(KRightAlign, "RightAlign"); +_LIT(KCenterAlign, "CenterAlign"); +_LIT(KLangDepend, "LangDepend"); + +_LIT(KNormal, "Normal"); +_LIT(KLarge, "Large"); +_LIT(KSmall, "Small"); +_LIT(KVariable, "Variable"); +_LIT(KReserved, "Reserved"); + +_LIT(KEmsPreDef, "emspredef%d"); + +_LIT(KEmsAnimTypeFlirty, "a0"); +_LIT(KEmsAnimTypeGlad, "a1"); +_LIT(KEmsAnimTypeSceptic, "a2"); +_LIT(KEmsAnimTypeSad, "a3"); +_LIT(KEmsAnimTypeWow, "a4"); +_LIT(KEmsAnimTypeCrying, "a5"); +_LIT(KEmsAnimTypeWinking, "a6"); +_LIT(KEmsAnimTypeLaughing, "a7"); +_LIT(KEmsAnimTypeIndifferent, "a8"); +_LIT(KEmsAnimTypeKissing, "a9"); +_LIT(KEmsAnimTypeConfused, "a10"); +_LIT(KEmsAnimTypeTongueOut, "a11"); +_LIT(KEmsAnimTypeAngry, "a12"); +_LIT(KEmsAnimTypeGlasses, "a13"); +_LIT(KEmsAnimTypeDevil, "a14"); + +_LIT(KEmsSoundTypeChimesHigh, "s0"); +_LIT(KEmsSoundTypeChimesLow, "s1"); +_LIT(KEmsSoundTypeDing, "s2"); +_LIT(KEmsSoundTypeTaDa, "s3"); +_LIT(KEmsSoundTypeNotify, "s4"); +_LIT(KEmsSoundTypeDrum, "s5"); +_LIT(KEmsSoundTypeClaps, "s6"); +_LIT(KEmsSoundTypeFanFar, "s7"); +_LIT(KEmsSoundTypeChordHigh, "s8"); +_LIT(KEmsSoundTypeChordLow, "s9"); + +/* +_LIT(KBioIAP, "IAP"); +_LIT(KBioEmailNotification, "EmailNotification"); +_LIT(KBioBusinessCard, "BusinessCard"); +_LIT(KBioWAPAccessPoint, "WAPAccessPoint"); +_LIT(KBioVCalendar, "VCalendar"); +_LIT(KBioVCard, "VCard"); +_LIT(KBioRingingTones, "RingingTones"); +_LIT(KBioOperatorLogo, "OperatorLogo"); +_LIT(KBioWPRV, "WPRV"); +_LIT(KBioCLILogo, "CLILogo"); +*/ +_LIT(KObjectSize, "ObjectSize%d"); +_LIT(KBody, "body"); +/*@}*/ + +const TInt KSmallObject = 0; +const TInt KLargeObject = 1; +const TInt KVariableObject = 2; + +const TInt KDefaultStartPos = 1; + +/** + * Constructor. + * @return - None + * +*/ +CTestMessBase::CTestMessBase(TBool aSetDirectory) +: CTestStepSmokeTest() +, iSession(NULL) +, iMessageProcessor(NULL) +, iParaFormatLayer(NULL) +, iCharFormatLayer(NULL) +, iBodyText(NULL) +, iBodyAvailable(EFalse) +, iSetDirectory(aSetDirectory) +, iMessageTimer(NULL) +, iSchedular(NULL) +, iEntry(NULL) +, iOrder(KMsvGroupByType|KMsvGroupByStandardFolders, EMsvSortById, ETrue) + { + } + +CTestMessBase::~CTestMessBase() + { + delete iEntry; + iEntry=NULL; + delete iMessageTimer; + iMessageTimer=NULL; + delete iMessageProcessor; + iMessageProcessor=NULL; + delete iSession; + iSession=NULL; + delete iSchedular; + iSchedular=NULL; + delete iBodyText; + iBodyText=NULL; + delete iCharFormatLayer; + iCharFormatLayer=NULL; + delete iParaFormatLayer; + iParaFormatLayer=NULL; + } + +enum TVerdict CTestMessBase::doTestStepPreambleL() + { + TVerdict ret=CTestStepSmokeTest::doTestStepPreambleL(); + + // Printing to the console and log file + const TDesC& stepName=TestStepName(); + INFO_PRINTF2(_L("%S"), &stepName); + + iSchedular=new (ELeave) CActiveScheduler(); + CActiveScheduler::Install(iSchedular); + iSession=CMsvSession::OpenSyncL(*this); + + // Get progress + TInt progress=0; + TBool hasProgress=GetIntFromConfig(ConfigSection(), KProgress, progress); + if ( !hasProgress ) + { + hasProgress=GetIntFromConfig(KDefault, KProgress, progress); + } + + iMessageProcessor=CTestMessProcessor::NewL(*this, *iSession); + if ( hasProgress ) + { + iMessageTimer=CTestMessTimer::NewL(progress*KOneSecond, *iMessageProcessor); + } + + if ( iSetDirectory ) + { + TInt depth=KDefaultDepthCount; + TBool returnValue=GetIntFromConfig(ConfigSection(), KDepth, depth); + if ( !returnValue ) + { + depth=KDefaultDepthCount; + } + INFO_PRINTF2(_L("Depth = %d"), depth); + + // Searce for the entry + TRAPD(error,SetEntryL(KMsvRootIndexEntryId)); + if( error != KErrNone) + { + INFO_PRINTF2(_L("Set Entry failed, Error %D"),error); + SetTestStepError(error); + ret=EFail; + } + else + { + + TBuf tempStore; + TBool found=ETrue; + for (TInt entry=0; entryCount(); + + found=EFalse; + for (TInt i=count; i>0 && !found; ) + { + TMsvId childId=selection->At(--i); + + SetEntryL(childId); + INFO_PRINTF2(_L("Entry Detail : %S"), &(EntryL().Entry().iDetails)); + INFO_PRINTF2(_L("Entry Description: %S"), &(EntryL().Entry().iDescription)); + if ( subject.Compare(EntryL().Entry().iDetails) == 0 || + subject.Compare(EntryL().Entry().iDescription) == 0 ) + { + found=ETrue; + } + } + CleanupStack::PopAndDestroy(selection); + } + + if ( !found ) + { + ERR_PRINTF1(_L("Folder not found")); + ret=EFail; + } + } + } + if (TestStepResult() == EPass) + { + //Get body(file path) from ini file and read respective file. Store it into CRichText format. + iParaFormatLayer=CParaFormatLayer::NewL(); + iCharFormatLayer=CCharFormatLayer::NewL(); + iBodyText=CRichText::NewL(iParaFormatLayer, iCharFormatLayer); + iBodyAvailable=EFalse; + + TPtrC body; + if(GetStringFromConfig(ConfigSection(), KBody, body)) + { + INFO_PRINTF2(_L("Body = %S"), &body); + iBodyAvailable=ETrue; + } + else + { + INFO_PRINTF1(_L("No Body")); + } + + if ( iBodyAvailable ) + { + // open the file + RFile file; + + TInt anError = file.Open(iSession->FileSession(), body, EFileShareAny); + if(anError == KErrNone) + { + TBool reading=ETrue; + TInt pos=0; + TBuf8<1> charIn; + while (reading) + { + file.Read(charIn, 1); + if(charIn.Length()) + { + switch ( charIn[0] ) + { + case '\r': + iBodyText->InsertL(pos++, CEditableText::ELineBreak); + case '\n': + break; + default: + iBodyText->InsertL(pos++, TChar(charIn[0])); + } + } + else + { + reading = EFalse; // stop at the end of the file + } + } + iBodyAvailable=ETrue; + file.Close(); + } + else + { + INFO_PRINTF2(_L("Cannot open file = %S"), &body); + iBodyAvailable=EFalse; + } + }//End of read file. + } + + SetTestStepResult(ret); + return ret; + } + +enum TVerdict CTestMessBase::doTestStepPostambleL() + { + delete iEntry; + iEntry=NULL; + delete iMessageTimer; + iMessageTimer=NULL; + delete iMessageProcessor; + iMessageProcessor=NULL; + delete iSession; + iSession=NULL; + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + return CTestStepSmokeTest::doTestStepPostambleL(); + } + +void CTestMessBase::SetEntryL(TMsvId aId) + { + delete iEntry; + iEntry=NULL; + iEntry=iSession->GetEntryL(aId); + } + +CMsvEntry& CTestMessBase::EntryL() + { + if ( iEntry == NULL ) + { + User::Leave(KErrGeneral); + } + + return *iEntry; + } + + +HBufC8* CTestMessBase::CopyToBuf8LC(const TDesC& aDesC) +// +// @return - HBufC8* +// Converts TDesC to HBufC8*. +// + { + HBufC8* itemBuff8 = HBufC8::NewLC(aDesC.Length()); + itemBuff8->Des().Copy(aDesC); + + return itemBuff8; + } + +HBufC* CTestMessBase::CopyToBufLC(const TDesC8& aDesC) +// +// @return - HBufC8* +// Converts TDesC to HBufC8*. +// + { + HBufC* itemBuff = HBufC::NewLC(aDesC.Length()); + itemBuff->Des().Copy(aDesC); + + return itemBuff; + } + + +#ifndef __MESSAGING_API_V2__ +void CTestMessBase::SetDefaultServiceL(TUid aMtm, TMsvId aService) const + { + // --- Now restore the default services from the root store --- + CMsvEntry* rootEntry=iSession->GetEntryL(KMsvRootIndexEntryIdValue); + CleanupStack::PushL(rootEntry); + CMsvStore* store = rootEntry->EditStoreL(); + CleanupStack::PushL(store); + CMsvDefaultServices* services = new(ELeave)CMsvDefaultServices; + CleanupStack::PushL(services); + services->RestoreL(*store); + + // --- And now re-set the default service for the MTM to the one given --- + TMsvDefaultService defaultService; + defaultService.iMtm=aMtm; + defaultService.iService=aService; + services->ChangeDefaultServiceL(defaultService); + services->StoreL(*store); + store->CommitL(); + CleanupStack::PopAndDestroy(3, rootEntry); + } + +TInt CTestMessBase::DefaultServiceL(TUid aMtm, TMsvId& aService) const + { + // --- Now restore the default services from the root store --- + CMsvEntry* rootEntry=iSession->GetEntryL(KMsvRootIndexEntryIdValue); + CleanupStack::PushL(rootEntry); + CMsvStore* store=rootEntry->ReadStoreL(); + CleanupStack::PushL(store); + CMsvDefaultServices* services=new(ELeave)CMsvDefaultServices; + CleanupStack::PushL(services); + services->RestoreL(*store); + + TInt ret=services->DefaultService(aMtm, aService); + + CleanupStack::PopAndDestroy(3, rootEntry); + + return ret; + } +#endif + +void CTestMessBase::PrintTreeL(TMsvId aRoot) + { + INFO_PRINTF1(_L("PrintTreeL In")); + CMsvEntry* entry=iSession->GetEntryL(aRoot); + CleanupStack::PushL(entry); + entry->SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=entry->ChildrenL(); + CleanupStack::PushL(selection); + + PrintEntryL(*entry); + for (TInt i=0; iCount(); ) + { + PrintTreeL(selection->At(i++)); + } + + CleanupStack::PopAndDestroy(2, entry); + INFO_PRINTF1(_L("PrintTreeL Out")); + } + +void CTestMessBase::PrintEntryL(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + + INFO_PRINTF2(_L("Entry Detail : %S"), &(entry.iDetails)); + INFO_PRINTF2(_L(" Description: %S"), &(entry.iDescription)); + INFO_PRINTF2(_L(" Id : %x"), entry.Id()); + INFO_PRINTF2(_L(" Parent Id : %x"), entry.Parent()); + INFO_PRINTF2(_L(" Service Id : %x"), entry.iServiceId); + if ( entry.iRelatedId != 0 ) + { + INFO_PRINTF2(_L(" Related Id : %x"), entry.iRelatedId); + } + INFO_PRINTF2(_L(" Type : %x"), entry.iType); + INFO_PRINTF2(_L(" Mtm : %x"), entry.iMtm); + + + if ( entry.iSize != 0 ) + { + INFO_PRINTF2(_L(" Size : %x"), entry.iSize); + } + if ( entry.iError != 0 ) + { + INFO_PRINTF2(_L(" Error : %d"), entry.iError); + } + if ( entry.iBioType != 0 ) + { + INFO_PRINTF2(_L(" BioType : %x"), entry.iBioType); + } + if ( entry.MtmData1() != 0 ) + { + INFO_PRINTF2(_L(" MtmData1 : %x"), entry.MtmData1()); + } + if ( entry.MtmData2() != 0 ) + { + INFO_PRINTF2(_L(" MtmData2 : %x"), entry.MtmData2()); + } + if ( entry.MtmData3() != 0 ) + { + INFO_PRINTF2(_L(" MtmData3 : %x"), entry.MtmData3()); + } + if ( entry.Attachment() != 0 ) + { + INFO_PRINTF2(_L(" Attachment : %x"), entry.Attachment()); + } + if ( entry.Complete() != 0 ) + { + INFO_PRINTF2(_L(" Complete : %x"), entry.Complete()); + } + if ( entry.Connected() != 0 ) + { + INFO_PRINTF2(_L(" Connected : %x"), entry.Connected()); + } + if ( entry.Deleted() != 0 ) + { + INFO_PRINTF2(_L(" Deleted : %x"), entry.Deleted()); + } + if ( entry.Failed() != 0 ) + { + INFO_PRINTF2(_L(" Failed : %x"), entry.Failed()); + } + if ( entry.InPreparation() != 0 ) + { + INFO_PRINTF2(_L(" InPrep : %x"), entry.InPreparation()); + } + if ( entry.MultipleRecipients() != 0 ) + { + INFO_PRINTF2(_L(" MultiRecip : %x"), entry.MultipleRecipients()); + } + if ( entry.OffPeak() != 0 ) + { + INFO_PRINTF2(_L(" OffPeak : %x"), entry.OffPeak()); + } + if ( entry.Operation() != 0 ) + { + INFO_PRINTF2(_L(" Operation : %x"), entry.Operation()); + } + if ( entry.Owner() != 0 ) + { + INFO_PRINTF2(_L(" Owner : %x"), entry.Owner()); + } + if ( entry.PcSyncCount() != 0 ) + { + INFO_PRINTF2(_L(" PcSyncCount: %x"), entry.PcSyncCount()); + } + if ( entry.Priority() != 0 ) + { + INFO_PRINTF2(_L(" Priority : %x"), entry.Priority()); + } + if ( entry.ReadOnly() != 0 ) + { + INFO_PRINTF2(_L(" ReadOnly : %x"), entry.ReadOnly()); + } + if ( entry.Scheduled() != 0 ) + { + INFO_PRINTF2(_L(" Scheduled : %x"), entry.Scheduled()); + } + if ( entry.SendingState() != 0 ) + { + INFO_PRINTF2(_L(" Send State : %x"), entry.SendingState()); + } + if ( entry.StandardFolder() != 0 ) + { + INFO_PRINTF2(_L(" StdFolder : %x"), entry.StandardFolder()); + } + if ( entry.Unread() != 0 ) + { + INFO_PRINTF2(_L(" Unread : %x"), entry.Unread()); + } + if ( entry.Visible() != 0 ) + { + INFO_PRINTF2(_L(" Visible : %x"), entry.Visible()); + } + +#if (!defined CDMA_API_ENABLED) + if ( aEntry.HasStoreL() ) + { + PrintStoreL(aEntry); + } +#endif + } + +void CTestMessBase::PrintStoreL(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CTestMessPrintEntryUtil* printUtil=new (ELeave) CTestMessPrintEntryUtil(*this); + CleanupStack::PushL(printUtil); + + printUtil->ProcessEntryL(entry.Id()); + CleanupStack::PopAndDestroy(printUtil); + + if ( entry.iMtm==KUidMsgTypeSMTP ) + { + PrintStoreSmtpL(aEntry); + } + else if ( entry.iMtm == KUidMsgTypePOP3 ) + { + PrintStorePop3L(aEntry); + } + else if ( entry.iMtm == KUidMsgTypeIMAP4 ) + { + PrintStoreImap4L(aEntry); + } + else if ( entry.iMtm == KUidMsgTypeSMS ) + { + PrintStoreSmsL(aEntry); + } + } + +void CTestMessBase::PrintStoreSmtpL(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CMsvStore* store=aEntry.ReadStoreL(); + CleanupStack::PushL(store); + + TPtrC ptrTemp; + if ( entry.iType == KUidMsvServiceEntry ) + { + CImSmtpSettings* settings = new(ELeave) CImSmtpSettings(); + CleanupStack::PushL(settings); +#ifdef __MESSAGING_API_V2__ + CEmailAccounts* accounts = CEmailAccounts::NewLC(); + TSmtpAccount smtpAccountId; + accounts->GetSmtpAccountL(aEntry.EntryId(), smtpAccountId); + TRAPD(err, accounts->LoadSmtpSettingsL(smtpAccountId, *settings)); + CleanupStack::PopAndDestroy(accounts); +#else + TRAPD(err, settings->RestoreL(*store)); +#endif + if ( err == KErrNone ) + { + ptrTemp.Set(settings->ServerAddress()); + INFO_PRINTF2(_L(" ServerAddress : %S"), &ptrTemp); +#ifndef __MESSAGING_API_V2__ + ptrTemp.Set(settings->UserAddress()); + INFO_PRINTF2(_L(" UserAddress : %S"), &ptrTemp); + INFO_PRINTF2(_L(" Version : %x"), (TUint)settings->Version()); +#endif + INFO_PRINTF2(_L(" Port : %x"), settings->Port()); + INFO_PRINTF2(_L(" SecureSockets : %x"), (TUint)settings->SecureSockets()); + ptrTemp.Set(settings->EmailAlias()); + INFO_PRINTF2(_L(" EmailAlias : %S"), &ptrTemp); + ptrTemp.Set(settings->EmailAddress()); + INFO_PRINTF2(_L(" EmailAddress : %S"), &ptrTemp); + ptrTemp.Set(settings->ReplyToAddress()); + INFO_PRINTF2(_L(" ReplyToAddress : %S"), &ptrTemp); + ptrTemp.Set(settings->ReceiptAddress()); + INFO_PRINTF2(_L(" ReceiptAddress : %S"), &ptrTemp); + if ( settings->RequestReceipts() != 0 ) + { + INFO_PRINTF2(_L(" RequestReceipts : %x"), (TUint)settings->RequestReceipts()); + } + if ( settings->SendCopyToSelf() != 0 ) + { + INFO_PRINTF2(_L(" SendCopyToSelf : %x"), (TUint)settings->SendCopyToSelf()); + } + INFO_PRINTF2(_L(" SendMessageOption : %x"), (TUint)settings->SendMessageOption()); + } + CleanupStack::PopAndDestroy(settings); + } + + CleanupStack::PopAndDestroy(store); + } + +void CTestMessBase::PrintStorePop3L(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CMsvStore* store=aEntry.ReadStoreL(); + CleanupStack::PushL(store); + + TPtrC ptrTemp; + if ( entry.iType == KUidMsvServiceEntry ) + { + CImPop3Settings* settings = new(ELeave) CImPop3Settings(); + CleanupStack::PushL(settings); + +#ifdef __MESSAGING_API_V2__ + CEmailAccounts* accounts = CEmailAccounts::NewLC(); + TPopAccount popAccountId; + accounts->GetPopAccountL(aEntry.EntryId(), popAccountId); + TRAPD(err, accounts->LoadPopSettingsL(popAccountId, *settings)); + CleanupStack::PopAndDestroy(accounts); +#else + TRAPD(err, settings->RestoreL(*store)); +#endif + if ( err == KErrNone ) + { + ptrTemp.Set(settings->ServerAddress()); + INFO_PRINTF2(_L(" ServerAddress : %S"), &ptrTemp); +#ifndef __MESSAGING_API_V2__ + ptrTemp.Set(settings->UserAddress()); + INFO_PRINTF2(_L(" UserAddress : %S"), &ptrTemp); + INFO_PRINTF2(_L(" Version : %x"), (TUint)settings->Version()); +#endif + INFO_PRINTF2(_L(" Port : %x"), settings->Port()); + INFO_PRINTF2(_L(" SecureSockets : %x"), (TUint)settings->SecureSockets()); + HBufC* loginName=CopyToBufLC(settings->LoginName()); + INFO_PRINTF2(_L(" LoginName : %S"), loginName); + CleanupStack::PopAndDestroy(loginName); + if ( settings->AutoSendOnConnect() != 0 ) + { + INFO_PRINTF2(_L(" AutoSendOnConnect : %x"), (TUint)settings->AutoSendOnConnect()); + } + if ( settings->Apop() != 0 ) + { + INFO_PRINTF2(_L(" Apop : %x"), (TUint)settings->Apop()); + } + if ( settings->DisconnectedUserMode() != 0 ) + { + INFO_PRINTF2(_L(" DisconnectedUserMode : %x"), (TUint)settings->DisconnectedUserMode()); + } + if ( settings->DeleteEmailsWhenDisconnecting() != 0 ) + { + INFO_PRINTF2(_L(" DeleteEmailsWhenDisconnecting: %x"), (TUint)settings->DeleteEmailsWhenDisconnecting()); + } + if ( settings->AcknowledgeReceipts() != 0 ) + { + INFO_PRINTF2(_L(" AcknowledgeReceipts : %x"), (TUint)settings->AcknowledgeReceipts()); + } + if ( settings->MaxEmailSize() != 0 ) + { + INFO_PRINTF2(_L(" MaxEmailSize : %x"), (TUint)settings->MaxEmailSize()); + } + if ( settings->GetMailOptions() != 0 ) + { + INFO_PRINTF2(_L(" GetMailOptions : %x"), (TUint)settings->GetMailOptions()); + } + if ( settings->InboxSynchronisationLimit() != 0 ) + { + INFO_PRINTF2(_L(" InboxSynchronisationLimit : %x"), (TUint)settings->InboxSynchronisationLimit()); + } + } + CleanupStack::PopAndDestroy(settings); + } + + CleanupStack::PopAndDestroy(store); + } + +void CTestMessBase::PrintStoreImap4L(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CMsvStore* store=aEntry.ReadStoreL(); + CleanupStack::PushL(store); + + TPtrC ptrTemp; + if ( entry.iType == KUidMsvServiceEntry ) + { + CImImap4Settings* settings = new(ELeave) CImImap4Settings(); + CleanupStack::PushL(settings); + +#ifdef __MESSAGING_API_V2__ + CEmailAccounts* accounts = CEmailAccounts::NewLC(); + TImapAccount imapAccountId; + accounts->GetImapAccountL(aEntry.EntryId(), imapAccountId); + TRAPD(err, accounts->LoadImapSettingsL(imapAccountId, *settings)); + CleanupStack::PopAndDestroy(accounts); +#else + TRAPD(err, settings->RestoreL(*store)); +#endif + if ( err == KErrNone ) + { + ptrTemp.Set(settings->ServerAddress()); + INFO_PRINTF2(_L(" ServerAddress : %S"), &ptrTemp); +#ifndef __MESSAGING_API_V2__ + ptrTemp.Set(settings->UserAddress()); + INFO_PRINTF2(_L(" UserAddress : %S"), &ptrTemp); + INFO_PRINTF2(_L(" Version : %x"), (TUint)settings->Version()); +#endif + INFO_PRINTF2(_L(" Port : %x"), settings->Port()); + INFO_PRINTF2(_L(" SecureSockets : %x"), (TUint)settings->SecureSockets()); + + HBufC* loginName=CopyToBufLC(settings->LoginName()); + INFO_PRINTF2(_L(" LoginName : %S"), loginName); + HBufC* folderPath=CopyToBufLC(settings->FolderPath()); + INFO_PRINTF2(_L(" FolderPath : %S"), folderPath); + CleanupStack::PopAndDestroy(2, loginName); + if ( settings->PathSeparator() != 0 ) + { + INFO_PRINTF2(_L(" PathSeparator : %c"), (TText)settings->PathSeparator()); + } + if ( settings->DisconnectedUserMode() != 0 ) + { + INFO_PRINTF2(_L(" DisconnectedUserMode : %x"), (TUint)settings->DisconnectedUserMode()); + } + if ( settings->Synchronise() != 0 ) + { + INFO_PRINTF2(_L(" Synchronise : %x"), (TUint)settings->Synchronise()); + } + if ( settings->Subscribe() != 0 ) + { + INFO_PRINTF2(_L(" Subscribe : %x"), (TUint)settings->Subscribe()); + } + if ( settings->AutoSendOnConnect() != 0 ) + { + INFO_PRINTF2(_L(" AutoSendOnConnect : %x"), (TUint)settings->AutoSendOnConnect()); + } + if ( settings->MaxEmailSize() != 0 ) + { + INFO_PRINTF2(_L(" MaxEmailSize : %x"), (TUint)settings->MaxEmailSize()); + } + if ( settings->DeleteEmailsWhenDisconnecting() != 0 ) + { + INFO_PRINTF2(_L(" DeleteEmailsWhenDisconnecting: %x"), (TUint)settings->DeleteEmailsWhenDisconnecting()); + } + if ( settings->AcknowledgeReceipts() != 0 ) + { + INFO_PRINTF2(_L(" AcknowledgeReceipts : %x"), (TUint)settings->AcknowledgeReceipts()); + } + if ( settings->GetMailOptions() != 0 ) + { + INFO_PRINTF2(_L(" GetMailOptions : %x"), (TUint)settings->GetMailOptions()); + } + if ( settings->InboxSynchronisationLimit() != 0 ) + { + INFO_PRINTF2(_L(" InboxSynchronisationLimit : %x"), (TUint)settings->InboxSynchronisationLimit()); + } + if ( settings->MailboxSynchronisationLimit() != 0 ) + { + INFO_PRINTF2(_L(" MailboxSynchronisationLimit : %x"), (TUint)settings->MailboxSynchronisationLimit()); + } + } + CleanupStack::PopAndDestroy(settings); + } + + CleanupStack::PopAndDestroy(store); + } + +void CTestMessBase::PrintStoreSmsL(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CMsvStore* store=aEntry.ReadStoreL(); + CleanupStack::PushL(store); + + TPtrC ptrTemp; + if ( entry.iType == KUidMsvServiceEntry ) + { + CSmsSettings* settings = CSmsSettings::NewL(); + CleanupStack::PushL(settings); + +#ifdef __MESSAGING_API_V2__ + CSmsAccount* smsAccount = CSmsAccount::NewLC(); + TRAPD(err, smsAccount->LoadSettingsL(*settings)); + CleanupStack::PopAndDestroy(smsAccount); +#else + TRAPD(err, settings->RestoreL(*store)); +#endif + if ( err == KErrNone ) + { + TSmsDelivery delivery(settings->Delivery()); + INFO_PRINTF2(_L(" Delivery : %d"), delivery); + CSmsSettings::TSmsReportHandling reportHandling(settings->StatusReportHandling()); + INFO_PRINTF2(_L(" StatusReportHandling : %d"), reportHandling); + CSmsSettings::TSmsReportHandling specialMsgHandling(settings->SpecialMessageHandling()); + INFO_PRINTF2(_L(" SpecialMessageHandling : %d"), specialMsgHandling); + INFO_PRINTF2(_L(" ReplyQuoted : %d"), settings->ReplyQuoted()); +#ifdef __MESSAGING_API_V2__ + const TInt numSCAddr = settings->ServiceCenterCount(); +#else + const TInt numSCAddr = settings->NumSCAddresses(); +#endif + for( TInt index=0;indexGetServiceCenter(index); +#else + CSmsNumber& scAddr = settings->SCAddress(index); +#endif + ptrTemp.Set(scAddr.Name()); + INFO_PRINTF2(_L(" SC Name : %S"), &ptrTemp); + ptrTemp.Set(scAddr.Address()); + INFO_PRINTF2(_L(" SC Address : %S"), &ptrTemp); + } + CSmsSettings::TSmsSettingsCommDbAction commDbAction(settings->SmsBearerAction()); + INFO_PRINTF2(_L(" SmsBearerAction : %d"), commDbAction); + + CSmsSettings::TMobileSmsBearer smsBearer(settings->SmsBearer()); + INFO_PRINTF2(_L(" SmsBearer : %d"), smsBearer); + } + CleanupStack::PopAndDestroy(settings); + } + + CleanupStack::PopAndDestroy(store); + } + +void CTestMessBase::IssueTimerRequest() + { + if (iMessageTimer!= NULL) + { + iMessageTimer->IssueRequest(); + } + } + +void CTestMessBase::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny*, TAny*) +/** + Handler for the Session Event + @param aEvent - TMsvSessionEvent object + @param aArg1 - TAny object pointer, used to store the argument for the event + @leave - System wide error codes +*/ + { + TBool printSelection=EFalse; + + switch (aEvent) + { + case EMsvEntriesCreated: + INFO_PRINTF1(_L("EMsvEntriesCreated")); + printSelection=ETrue; + break; + case EMsvEntriesChanged: + INFO_PRINTF1(_L("EMsvEntriesChanged")); + printSelection=ETrue; + break; + case EMsvEntriesDeleted: + INFO_PRINTF1(_L("EMsvEntriesDeleted")); + break; + case EMsvEntriesMoved: + INFO_PRINTF1(_L("EMsvEntriesMoved")); + printSelection=ETrue; + break; + case EMsvMtmGroupInstalled: + INFO_PRINTF1(_L("EMsvMtmGroupInstalled")); + break; + case EMsvMtmGroupDeInstalled: + INFO_PRINTF1(_L("EMsvMtmGroupDeInstalled")); + break; + case EMsvGeneralError: + INFO_PRINTF1(_L("EMsvGeneralError")); + break; + case EMsvCloseSession: + INFO_PRINTF1(_L("EMsvCloseSession")); + break; + case EMsvServerReady: + INFO_PRINTF1(_L("EMsvServerReady")); + break; + case EMsvServerFailedToStart: + INFO_PRINTF1(_L("EMsvServerFailedToStart")); + break; + case EMsvCorruptedIndexRebuilt: + INFO_PRINTF1(_L("EMsvCorruptedIndexRebuilt")); + break; + case EMsvServerTerminated: + INFO_PRINTF1(_L("EMsvServerTerminated")); + break; + case EMsvMediaChanged: + INFO_PRINTF1(_L("EMsvMediaChanged")); + break; + case EMsvMediaUnavailable: + INFO_PRINTF1(_L("EMsvMediaUnavailable")); + break; + case EMsvMediaAvailable: + INFO_PRINTF1(_L("EMsvMediaAvailable")); + break; + case EMsvMediaIncorrect: + INFO_PRINTF1(_L("EMsvMediaIncorrect")); + break; + case EMsvCorruptedIndexRebuilding: + INFO_PRINTF1(_L("EMsvCorruptedIndexRebuilding")); + break; + default: + INFO_PRINTF2(_L("EMsv Unknown event:%d"), aEvent); + break; + } + + if ( printSelection ) + { + CMsvEntrySelection* selection=STATIC_CAST(CMsvEntrySelection*, aArg1); + CMsvEntry* entry=NULL; + for ( int i=0; iCount(); ) + { + entry=iSession->GetEntryL(selection->At(i++)); + CleanupStack::PushL(entry); + PrintEntryL(*entry); + CleanupStack::PopAndDestroy(entry); + } + } + } + + +void CTestMessBase::PrepareSmsHeaderFromIniFileL(CSmsHeader& aSmsHeader) + { + // Starts the Bitmap server + FbsStartup(); + // start the server + RFbsSession::Connect(); + + // Add the Fromating required for EMS if required + TInt emsElements=0; + if ( !GetIntFromConfig(ConfigSection(), KElements, emsElements) ) + { + ERR_PRINTF1(_L("Elements not set")); + SetTestStepResult(EFail); + } + +// Macro usage for CDMA mtm +#if (defined CDMA_API_ENABLED) + TMsvMessageSms& message=aSmsHeader.SmsMessage(); +#else + CSmsMessage& message=aSmsHeader.Message(); +#endif + + TBuf tempStore; + for ( TInt element=0; elementSetStartPosition(startPosition); + + TInt intTemp; + TBool boolTemp; + TPtrC alignment; + TPtrC fontSize; + + // Set the Format length and other information + tempStore.Format(KFormatLength, element); + if ( GetIntFromConfig(ConfigSection(), tempStore, intTemp) ) + { + INFO_PRINTF2(_L("Format Length %d"), intTemp); + newElement->SetFormatLength(intTemp); + } + tempStore.Format(KBold, element); + if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) ) + { + INFO_PRINTF2(_L("Bold %d"), boolTemp); + newElement->SetBold(boolTemp); + } + tempStore.Format(KItalic, element); + if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) ) + { + INFO_PRINTF2(_L("Italic %d"), boolTemp); + newElement->SetItalic(boolTemp); + } + tempStore.Format(KUnderline, element); + if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) ) + { + INFO_PRINTF2(_L("Underline %d"), boolTemp); + newElement->SetUnderline(boolTemp); + } + tempStore.Format(KStrikethrough, element); + if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) ) + { + INFO_PRINTF2(_L("Strikethrough %d"), boolTemp); + newElement->SetStrikethrough(boolTemp); + } + tempStore.Format(KAlignment,element); + if(GetStringFromConfig(ConfigSection(),tempStore,alignment)) + { + SetAlignmentFormat(*newElement, alignment); + } + + tempStore.Format(KFontSize,element); + if(GetStringFromConfig(ConfigSection(),tempStore,fontSize)) + { + // + SetFontSizeFormat(*newElement, fontSize); + } + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(newElement); + } + else if ( type.Compare(KTypeSound) == 0 ) + { + // === Process sound Information Element === + if ( hasFile ) + { + HBufC8* buffFile=CopyToBuf8LC(fileName.FullName()); + CEmsSoundIE* newElement=CEmsSoundIE::NewL(buffFile->Des()); + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(2, buffFile); + } + else + { + ERR_PRINTF1(_L("No Sound file name")); + SetTestStepResult(EFail); + } + } + else if ( type.Compare(KTypePreDefSound) == 0 ) + { + // === Process predefined sound Information Element === + TPtrC preDefSound; + tempStore.Format(KEmsPreDef, element); + if ( !GetStringFromConfig(ConfigSection(),tempStore, preDefSound)) + { + ERR_PRINTF1(_L("Predefined sound not present")); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("Predefined sound %S"), &preDefSound); + CEmsPreDefSoundIE* newElement=NewPreDefSoundL(preDefSound); + + if ( newElement != NULL ) + { + //Assign the predef animation element to newElement + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(newElement); + } + else + { + ERR_PRINTF1(_L("Unable to create predefined sound")); + SetTestStepResult(EFail); + } + } + } + else if ( type.Compare(KTypeAnimation) == 0 ) + { + // === Process animation Information Element === + if ( hasFile ) + { + TPtrC objectSize; + + tempStore.Format(KObjectSize, element); + if ( !GetStringFromConfig(ConfigSection(),tempStore,objectSize) ) + { + ERR_PRINTF1(_L("No size provided")); + SetTestStepResult(EFail); + } + else + { + CFbsBitmap* bmp=NewBitmapL(fileName, objectSize); + if ( bmp == NULL ) + { + ERR_PRINTF1(_L("Failed to Load Animation File. Error %d")); + SetTestStepResult(EFail); + } + else + { + CleanupStack::PushL(bmp); + CEmsAnimationIE* newElement=CEmsAnimationIE::NewL(*bmp); + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(2, bmp); + } + } + } + else + { + ERR_PRINTF1(_L("No Animation file name")); + SetTestStepResult(EFail); + } + } + else if ( type.Compare(KTypePreDefAnimation) == 0 ) + { + // === Process predefined animation Information Element === + TPtrC preDefAnim; + tempStore.Format(KEmsPreDef, element); + if ( !GetStringFromConfig(ConfigSection(),tempStore, preDefAnim) ) + { + ERR_PRINTF1(_L("Predefined animations not present")); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("Predefined animation %S"), &preDefAnim); + CEmsPreDefAnimationIE* newElement=NewPreDefAnimationL(preDefAnim); + + if ( newElement != NULL ) + { + //Assign the predef animation element to newElement + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(newElement); + } + else + { + ERR_PRINTF1(_L("Unable to create predefined animation")); + SetTestStepResult(EFail); + } + } + } + else if ( type.Compare(KTypePicture) == 0 ) + { + // === Process picture Information Element === + if ( hasFile ) + { + TPtrC objectSize; + + tempStore.Format(KObjectSize, element); + if ( !GetStringFromConfig(ConfigSection(),tempStore,objectSize) ) + { + ERR_PRINTF1(_L("No size provided")); + SetTestStepResult(EFail); + } + else + { + CFbsBitmap* bmp=NewBitmapL(fileName, objectSize); + if ( bmp == NULL ) + { + ERR_PRINTF1(_L("Failed to Load Animation File. Error %d")); + SetTestStepResult(EFail); + } + else + { + CleanupStack::PushL(bmp); + CEmsPictureIE* newElement=CEmsPictureIE::NewL(*bmp); + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(2, bmp); + } + } + } + else + { + ERR_PRINTF1(_L("No Picture file name")); + SetTestStepResult(EFail); + } + } + else if ( type.Compare(KTypeUserPrompt) == 0 ) + { + // === Process user prompt Information Element === + CEmsUserPrompt* newElement=CEmsUserPrompt::NewL(2); + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(newElement); + } + else + { + ERR_PRINTF2(_L("Unknown element type %S"), &type); + SetTestStepResult(EFail); + } + } + else + { + ERR_PRINTF1(_L("No type given")); + SetTestStepResult(EFail); + } + } + + RFbsSession::Disconnect(); + } + +/** + This function reads the schedule time from ini file + @return - returns the schedule time read from the ini file +*/ +TTimeIntervalMinutes CTestMessBase::ReadScheduleTime() + { + // Read the schedule time from ini file. Add this schedule time to current time. + // This time will be set as the scheduled time for sending the SMS message from task scheduler + // By default schedule time will be 1 min + TInt scheduled=0; + GetIntFromConfig(ConfigSection(), KScheduled, scheduled); + INFO_PRINTF2(_L("Scheduled Time in minutes is %d"), scheduled); + return TTimeIntervalMinutes(scheduled); + } + +void CTestMessBase::SetAlignmentFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aAlignment) + { + //Sets the alignment to the text + INFO_PRINTF2(_L("Alignment %S"), &aAlignment); + if( aAlignment.Compare(KLeftAlign)== 0 ) + { + aEmsFormatIE.SetAlignment(CEmsFormatIE::ELeft); + } + else if( aAlignment.Compare(KRightAlign)== 0 ) + { + aEmsFormatIE.SetAlignment(CEmsFormatIE::ERight); + } + else if( aAlignment.Compare(KCenterAlign)== 0 ) + { + aEmsFormatIE.SetAlignment(CEmsFormatIE::ECenter); + } + else if( aAlignment.Compare(KLangDepend)== 0 ) + { + aEmsFormatIE.SetAlignment(CEmsFormatIE::ELangDepend); + } + else + { + ERR_PRINTF1(_L("Illegal alignment value")); + SetTestStepResult(EFail); + } + } + +void CTestMessBase::SetFontSizeFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aFontSize) + { + //Sets the specified font to the text + INFO_PRINTF2(_L("FontSize %S"), &aFontSize); + if( aFontSize.Compare(KNormal)== 0 ) + { + aEmsFormatIE.SetFontSize(CEmsFormatIE::ENormal); + } + else if( aFontSize.Compare(KLarge)== 0 ) + { + aEmsFormatIE.SetFontSize(CEmsFormatIE::ELarge); + } + else if( aFontSize.Compare(KSmall)== 0 ) + { + aEmsFormatIE.SetFontSize(CEmsFormatIE::ESmall); + } + else if( aFontSize.Compare(KReserved)== 0 ) + { + aEmsFormatIE.SetFontSize(CEmsFormatIE::EReserved); + } + else + { + ERR_PRINTF1(_L("Illegal fonst size value")); + SetTestStepResult(EFail); + } + } + +CEmsPreDefAnimationIE* CTestMessBase::NewPreDefAnimationL(const TDesC& aPreDefType) +// +// Attaches the required predef animation. +// Arguments - aString - holds the TAnim type to be attached +// Return Value - Returns a Pointer of CEmsPreDefAnimationIE +// + { + //Initialize emsPreDef to NULL + CEmsPreDefAnimationIE::TAnimType animType=CEmsPreDefAnimationIE::EFlirty; + TBool validType=ETrue; + + //Set a value for emsPreDef + if ( aPreDefType.Compare(KEmsAnimTypeFlirty) == 0 ) + { + animType = CEmsPreDefAnimationIE::EFlirty; + } + else if ( aPreDefType.Compare(KEmsAnimTypeGlad) == 0 ) + { + animType = CEmsPreDefAnimationIE::EGlad; + } + else if ( aPreDefType.Compare(KEmsAnimTypeSceptic) == 0 ) + { + animType = CEmsPreDefAnimationIE::ESceptic; + } + else if ( aPreDefType.Compare(KEmsAnimTypeSad) == 0 ) + { + animType = CEmsPreDefAnimationIE::ESad; + } + else if ( aPreDefType.Compare(KEmsAnimTypeWow) == 0 ) + { + animType = CEmsPreDefAnimationIE::EWow; + } + else if ( aPreDefType.Compare(KEmsAnimTypeCrying) == 0 ) + { + animType = CEmsPreDefAnimationIE::ECrying; + } + else if ( aPreDefType.Compare(KEmsAnimTypeWinking) == 0 ) + { + animType = CEmsPreDefAnimationIE::EWinking; + } + else if ( aPreDefType.Compare(KEmsAnimTypeLaughing) == 0 ) + { + animType = CEmsPreDefAnimationIE::ELaughing; + } + else if ( aPreDefType.Compare(KEmsAnimTypeIndifferent) == 0 ) + { + animType = CEmsPreDefAnimationIE::EIndifferent; + } + else if ( aPreDefType.Compare(KEmsAnimTypeKissing) == 0 ) + { + animType = CEmsPreDefAnimationIE::EKissing; + } + else if ( aPreDefType.Compare(KEmsAnimTypeConfused) == 0 ) + { + animType = CEmsPreDefAnimationIE::EConfused; + } + else if ( aPreDefType.Compare(KEmsAnimTypeTongueOut) == 0 ) + { + animType = CEmsPreDefAnimationIE::ETongueOut; + } + else if ( aPreDefType.Compare(KEmsAnimTypeAngry) == 0 ) + { + animType = CEmsPreDefAnimationIE::EAngry; + } + else if ( aPreDefType.Compare(KEmsAnimTypeGlasses) == 0 ) + { + animType = CEmsPreDefAnimationIE::EGlasses; + } + else if ( aPreDefType.Compare(KEmsAnimTypeDevil) == 0 ) + { + animType = CEmsPreDefAnimationIE::EDevil; + } + else + { + validType=EFalse; + } + + CEmsPreDefAnimationIE* emsPreDef=NULL; + if ( validType ) + { + emsPreDef=CEmsPreDefAnimationIE::NewL(animType); + } + + return emsPreDef; + } + +CEmsPreDefSoundIE* CTestMessBase::NewPreDefSoundL(const TDesC& aPreDefType) +// +// Attaches the required predef animation. +// Arguments - aString - holds the TAnim type to be attached +// Return Value - Returns a Pointer of CEmsPreDefAnimationIE +// + { + //Initialize emsPreDef to NULL + CEmsPreDefSoundIE::TPredefinedSound soundType=CEmsPreDefSoundIE::EChimesHigh; + TBool validType=ETrue; + + //Set a value for emsPreDef + if ( aPreDefType.Compare(KEmsSoundTypeChimesHigh) == 0 ) + { + soundType = CEmsPreDefSoundIE::EChimesHigh; + } + else if ( aPreDefType.Compare(KEmsSoundTypeChimesLow) == 0 ) + { + soundType = CEmsPreDefSoundIE::EChimesLow; + } + else if ( aPreDefType.Compare(KEmsSoundTypeDing) == 0 ) + { + soundType = CEmsPreDefSoundIE::EDing; + } + else if ( aPreDefType.Compare(KEmsSoundTypeTaDa) == 0 ) + { + soundType = CEmsPreDefSoundIE::ETaDa; + } + else if ( aPreDefType.Compare(KEmsSoundTypeNotify) == 0 ) + { + soundType = CEmsPreDefSoundIE::ENotify; + } + else if ( aPreDefType.Compare(KEmsSoundTypeDrum) == 0 ) + { + soundType = CEmsPreDefSoundIE::EDrum; + } + else if ( aPreDefType.Compare(KEmsSoundTypeClaps) == 0 ) + { + soundType = CEmsPreDefSoundIE::EClaps; + } + else if ( aPreDefType.Compare(KEmsSoundTypeFanFar) == 0 ) + { + soundType = CEmsPreDefSoundIE::EFanFar; + } + else if ( aPreDefType.Compare(KEmsSoundTypeChordHigh) == 0 ) + { + soundType = CEmsPreDefSoundIE::EChordHigh; + } + else if ( aPreDefType.Compare(KEmsSoundTypeChordLow) == 0 ) + { + soundType = CEmsPreDefSoundIE::EChordLow; + } + else + { + validType=EFalse; + } + + CEmsPreDefSoundIE* emsPreDef=NULL; + if ( validType ) + { + emsPreDef=CEmsPreDefSoundIE::NewL(soundType); + } + + return emsPreDef; + } + +CFbsBitmap* CTestMessBase::NewBitmapL(const TParse& aFileName, const TDesC& aObjectSize) + { + TInt bitmapType=KSmallObject; + TBool validType=ETrue; + if( aObjectSize.Compare(KSmall) == 0 ) + { + bitmapType=KSmallObject; + } + else if ( aObjectSize.Compare(KLarge) == 0 ) + { + bitmapType=KLargeObject; + } + else if ( aObjectSize.Compare(KVariable) == 0 ) + { + bitmapType=KVariableObject; + } + else + { + ERR_PRINTF2(_L("Invalid bitmap type %S"), &aObjectSize); + validType=EFalse; + } + + CFbsBitmap* bmp = NULL; + if ( validType ) + { + bmp = new (ELeave) CFbsBitmap(); + + TInt error = bmp->Load(aFileName.FullName(), bitmapType, EFalse); + INFO_PRINTF2(_L("Bimap load %d"), error); + if ( error != KErrNone) + { + delete bmp; + bmp=NULL; + } + } + + return bmp; + } + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessCleanMessageFolder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessCleanMessageFolder.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,172 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCleanMessageFolder which cleans out all the +// message folders +// +// + +#include "TestMessCleanMessageFolder.h" + +// EPOC includes +#include +#include + +#ifdef __MESSAGING_API_V2__ +#include +#endif + +_LIT(KMessageCount, "messagecount"); + +CTestMessCleanMessageFolder::CTestMessCleanMessageFolder() +: CTestMessBase(ETrue) +, iNumberOfMessagesToDelete(-1) // Negative value implies delete all + { + SetTestStepName(_L("CleanMessageFolder")); + } + +TVerdict CTestMessCleanMessageFolder::doTestStepL() + { + INFO_PRINTF1(_L("Clean message folder")); + + if ( GetIntFromConfig(ConfigSection(), KMessageCount, iNumberOfMessagesToDelete) ) + { + INFO_PRINTF2(_L("Message count read from the ini file is %D"), iNumberOfMessagesToDelete); + } + else + { + WARN_PRINTF1(_L("No Count specified in the ini file")); + WARN_PRINTF1(_L("All the messages will be deleted")); + } + + if ( TestStepResult() == EPass ) + { + //delete the contents of the folder + CleanFolders(EntryL().EntryId()); + + if ( iNumberOfMessagesToDelete<=0 ) + { + INFO_PRINTF1(_L("Messages deleted")); + } + else + { + ERR_PRINTF2(_L("%d Outstanding entries not deleted."), iNumberOfMessagesToDelete); + SetTestStepResult(EFail); + } + } + + return TestStepResult(); + } + +void CTestMessCleanMessageFolder::CleanFolders(const TMsvId aEntryId) + { +#ifdef __MESSAGING_API_V2__ + if ( aEntryId == KMsvRootIndexEntryId ) + { + CEmailAccounts* accounts = CEmailAccounts::NewLC(); + + RArray pop3Accounts; + CleanupClosePushL(pop3Accounts); + accounts->GetPopAccountsL(pop3Accounts); + TInt count = pop3Accounts.Count(); + TInt index=0; + for( index = 0; index < count; index++ ) + { + TPopAccount id = pop3Accounts[index]; + accounts->DeletePopAccountL( id ); + } + + RArray imap4Accounts; + CleanupClosePushL(imap4Accounts); + accounts->GetImapAccountsL(imap4Accounts); + count = imap4Accounts.Count(); + for( TInt index = 0; index < count; index++ ) + { + TImapAccount id = imap4Accounts[index]; + accounts->DeleteImapAccountL( id ); + } + + CleanupStack::PopAndDestroy(3, accounts); + } +#endif + + SetEntryL(aEntryId); + EntryL().SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=EntryL().ChildrenL(); + CleanupStack::PushL(selection); + TInt count=selection->Count(); + TInt i; + for (i=count; i>0; ) + { + TMsvId childId=selection->At(--i); + + SetEntryL(aEntryId); + if( iNumberOfMessagesToDelete!=0 ) + { + TRAPD(err, EntryL().DeleteL(childId)); + switch ( err ) + { + case KErrNone: + INFO_PRINTF2(_L("DeletedId : %x"), childId); + if ( iNumberOfMessagesToDelete > 0 ) + { + --iNumberOfMessagesToDelete; + } + break; + case KErrAccessDenied: + INFO_PRINTF2(_L("Access Denied : %x"), childId); + break; + default: + ERR_PRINTF3(_L("Deletion Error : %d , Id : %x "), err, childId); + SetTestStepResult(EFail); + break; + } + } + } + CleanupStack::PopAndDestroy(selection); + + EntryL().SetSortTypeL(SelectionOrdering()); + selection=EntryL().ChildrenL(); + CleanupStack::PushL(selection); + count=selection->Count(); + for (i=count; i>0; ) + { + TMsvId childId=selection->At(--i); + + // Log child + CleanFolders(childId); + + SetEntryL(aEntryId); + + TRAPD(err, EntryL().DeleteL(childId)); + switch ( err ) + { + case KErrNone: + INFO_PRINTF2(_L("DeletedId : %x"), childId); + if ( iNumberOfMessagesToDelete > 0 ) + { + --iNumberOfMessagesToDelete; + } + break; + case KErrAccessDenied: + INFO_PRINTF2(_L("Access Denied : %x"), childId); + break; + default: + ERR_PRINTF3(_L("Deletion Error : %d , Id : %x "), err, childId); + SetTestStepResult(EFail); + break; + } + } + CleanupStack::PopAndDestroy(selection); + } + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessCreateCdmaSmsUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessCreateCdmaSmsUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,433 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessCreateCdmsSmsUtil.cpp +// This class creates the Cdma sms header and the service settings +// +// + +#include "TestMessCreateCdmaSmsUtil.h" +#include "TestMessCreateSmsAccount.h" + +// EPOC includes +#include + +/*@{*/ +_LIT(KPtDeliveryAck, "DeliveryAck"); +_LIT(KPtUserAck, "UserAck"); +_LIT(KPtReadAck, "ReadAck"); +_LIT(KPtMessageConversion, "MessageConversion"); +_LIT(KPtPriorityIndicator, "PriorityIndicator"); +_LIT(KPtPrivacyIndicator, "PrivacyIndicator"); +_LIT(KPtReplyOption, "ReplyOption"); +_LIT(KPtAlertonDelivery, "AlertonDelivery"); +_LIT(KPtLanguageIndicator, "LanguageIndicator"); + +//Constants used +_LIT(KPtTeleService, "TeleService"); +_LIT(KPtSubmit, "Submit"); +_LIT(KPtCancel, "Cancel"); + +// Supported Teleservices +_LIT(KPtTeleWmt, "WMT"); +_LIT(KPtTeleWemt, "WEMT"); +_LIT(KPtTeleWpt, "WPT"); +_LIT(KPtTeleVmn, "VMN"); +_LIT(KPtTeleScpt, "SCPT"); +_LIT(KPtTeleCatpt, "CATPT"); +_LIT(KPtTeleCmt91, "CMT91"); +_LIT(KPtTeleWap, "WAP"); + +// Supported message conversion formats +_LIT(KPtPidFax, "Fax"); +_LIT(KPtPidX400, "X400"); +_LIT(KPtPidPaging, "Paging"); +_LIT(KPtPidMail, "Mail"); +_LIT(KPtPidErmes, "Ermes"); +_LIT(KPtPidSpeech, "Speech"); +/*@}*/ + +/** + Constructor +*/ +CTestMessCreateCdmaSmsUtil ::CTestMessCreateCdmaSmsUtil(CTestMessBase& aTestStep) +: CTestMessCreateSmsUtilBase(aTestStep) + { + aTestStep.INFO_PRINTF1(_L("The CDMA SMS util is created")); + } + +/** + Prepares the SMS account details for CSendAs/RSendAs + @leave - KErrNoMemory + @leave - System wide error codes +*/ +void CTestMessCreateCdmaSmsUtil::PrepareAccountL(CMsvSession& /*aSession*/) + { + // Reads the teleservice + tia637::TTeleserviceId teleServiceId=tia637::KTeleserviceWMT; + TPtrC ptrTeleService; + if( !(iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KPtTeleService, ptrTeleService))) + { + iTestStep.INFO_PRINTF1(_L("Teleservice is not provided. Default teleservice (WMT) is used")); + } + else + { + iTestStep.INFO_PRINTF2(_L("Teleservice to be set is : %S"), &ptrTeleService); + + //Get the teleservice Id + teleServiceId = GetTeleServiceId(ptrTeleService); + } + + if ( teleServiceId!=tia637::KTeleserviceWEMT ) + { + teleServiceId=tia637::KTeleserviceWMT; + } + + CSmsSettings* smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + + CSmsAccount* smsAccount=CSmsAccount::NewLC(); + smsAccount->LoadSettingsL(*smsSettings); + smsSettings->SetDefaultTeleservice(teleServiceId); + smsAccount->SaveSettingsL(*smsSettings); + CleanupStack::PopAndDestroy(smsAccount); + CleanupStack::PopAndDestroy(smsSettings); + } + +/** + Creates a new CDMA sms header object + @param aBodyText - body text of the message + @return CSmsHeader - pointer of the CSmsHeader object + @leave - KErrNoMemory + @leave - System wide error codes +*/ +CSmsHeader* CTestMessCreateCdmaSmsUtil::NewHeaderL(CRichText& aBodyText) + { + return CSmsHeader::NewL(KSmsTypeSubmit, aBodyText); + } + +/** + Fill up the header object with data read from the ini file + @param aSmsHeader - reference for the sms header object + @leave - System wide error codes +*/ +void CTestMessCreateCdmaSmsUtil::PrepareHeaderL(CSmsHeader& aSmsHeader) + { + // Get bearer data + TPtrC ptrBearer; + TBool returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KBearer, ptrBearer); + if ( !returnValue ) + { + //If no bearer provided, the bearer is read from the default section ofthe + // ini file + returnValue=iTestStep.GetStringFromConfig(KDef, KDefBearer, ptrBearer); + } + + if ( returnValue ) + { + //default value for the bearer + TBioMsgIdType bearer = EBioMsgIdNbs; + + iTestStep.INFO_PRINTF2(_L("Bearer = %S"), &ptrBearer); + if (ptrBearer.CompareF(KBearerWap) == 0) + { + //Wap message ID + bearer = EBioMsgIdWap; + } + else if (ptrBearer.CompareF(KBearerWapSecure) == 0) + { + //WapSecure message ID + bearer = EBioMsgIdWapSecure; + } + else + { + iTestStep.ERR_PRINTF1(_L("No bearer provided. Default is used")); + } + + //Set the BIO Message ID type + aSmsHeader.BioMessage().SetBioMsgIdType(bearer); + } + + // Get encoding data + TInt encoding; + returnValue=iTestStep.GetIntFromConfig(iTestStep.ConfigSection(), KEncoding, encoding); + if ( !returnValue ) + { + //If no encoding is provided, the encoding is read from the default section + //of the ini file + returnValue=iTestStep.GetIntFromConfig(KDef, KDefEncoding, encoding); + } + if ( returnValue ) + { + //Default encoding value. + TSmsCharacterEncoding charEncoding = KSmsEncodingUnicode; + + iTestStep.INFO_PRINTF2(_L("Encoding = %d"), encoding); + switch (encoding) + { + case 7: + //7 bit encoding format + charEncoding = KSmsEncoding7BitASCII; + break; + case 8: + //8 bit encoding format + charEncoding = KSmsEncodingBinary; + break; + case 16: + //unicode encoding format + charEncoding = KSmsEncodingUnicode; + break; + default: + //default encoding format + charEncoding = KSmsEncodingUnicode; + break; + } + //Set the character encoding format + aSmsHeader.BioMessage().SetEncoding(charEncoding); + } + + + TBool deliveryAck = EFalse; + TBool userAck = EFalse; + TBool readAck = EFalse; + + // Get acknowledgements report request + TPtrC ptrDeliveryReport; + returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KDeliveryReport, ptrDeliveryReport); + if ( !returnValue ) + { + returnValue=iTestStep.GetStringFromConfig(KDef, KDefDeliveryReport, ptrDeliveryReport); + } + if ( returnValue ) + { + iTestStep.INFO_PRINTF2(_L("The acknowledgement request flag : %S"), &ptrDeliveryReport); + if(ptrDeliveryReport.Compare(_L("NO")) == 0) + { + deliveryAck = EFalse; + userAck = EFalse; + readAck = EFalse; + } + if(ptrDeliveryReport.Compare(_L("YES")) == 0) + { + // Read different type of acknowledgements + iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtDeliveryAck, deliveryAck); + iTestStep.INFO_PRINTF2(_L("The Delivery acknowledgement request flag : %d"), deliveryAck); + iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtUserAck, userAck); + iTestStep.INFO_PRINTF2(_L("The User acknowledgement request flag : %d"), userAck); + iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtReadAck, readAck); + iTestStep.INFO_PRINTF2(_L("The Read acknowledgement request flag : %d"), readAck); + } + } + + aSmsHeader.SetAcknowledgementRequest(ESmsAckTypeDelivery, deliveryAck); + aSmsHeader.SetAcknowledgementRequest(ESmsAckTypeUser, userAck); + aSmsHeader.SetAcknowledgementRequest(ESmsAckTypeRead, readAck); + + //Get the message conversion type + TPtrC ptrMessageConversion; + TSmsPIDConversion smsPidConversion = ESmsConvPIDNone; + returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KPtMessageConversion, ptrMessageConversion); + if ( !returnValue ) + { + iTestStep.INFO_PRINTF1(_L("The message conversion is not provided. Default (PIDNone) is taken")); + } + if ( returnValue ) + { + iTestStep.INFO_PRINTF2(_L("The message conversion to be set is : %S"), &ptrMessageConversion); + //Get the Message conversion id + smsPidConversion = GetMessageConversionId(ptrMessageConversion); + } + //Set the message conversion. + CSmsSettings *smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + aSmsHeader.GetDefaultMessageSettingsL(*smsSettings); + smsSettings->SetMessageConversion(smsPidConversion); + CleanupStack::Pop(smsSettings); + + // Set the other message settings + aSmsHeader.CdmaMessage().SetPrivacyIndicatorL(tia637::KBdRestricted); + aSmsHeader.CdmaMessage().SetPriorityIndicatorL(tia637::KBdUrgent); + aSmsHeader.CdmaMessage().SetAlertOnDeliveryL(tia637::KBdUseMediumPriorityAlert); + aSmsHeader.CdmaMessage().SetLanguageIndicatorL(tia637::KLanguageEnglish); + } + +/** + Sets the cdma sms service settings fields using data read from the + ini file. If no data is provided/read from ini file, the default + account settings is used. + @param aSmsSettings - reference of the CSmsSettings +*/ +void CTestMessCreateCdmaSmsUtil::SetSmsAccountSettings(CSmsSettings& aSmsSettings) + { + iTestStep.INFO_PRINTF1(_L("Set SMS account Settings....")); + TBool boolTemp; + + // Set the Reply quoted setting. + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KReplyQuoted, boolTemp) ) + { + aSmsSettings.SetReplyQuoted(boolTemp); + } + + // Set the priority indicator + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtPriorityIndicator, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTPriorityIndicator, boolTemp); + } + + //Set the Privacy Indicator + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtPrivacyIndicator, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTPrivacyIndicator, boolTemp); + } + + //Set the Reply option + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtReplyOption, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTReplyOption, boolTemp); + } + + //Set the alert on Message deliver + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtAlertonDelivery, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTAlertOnMessageDelivery, boolTemp); + } + + //Set the Language Indicator + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtLanguageIndicator, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTLanguageIndicator, boolTemp); + } + + aSmsSettings.SetValidityPeriod(ESmsVPWeek); // week + aSmsSettings.SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFInteger); //relative + aSmsSettings.SetDelivery(ESmsDeliveryImmediately); + } + +/** + Get the message type id + @param aMessageType - TPtrC object holding the message type + @return TSmsMessageType - message type id +*/ +TSmsMessageType CTestMessCreateCdmaSmsUtil::GetMessageTypeId(const TDesC& aMessageType) + { + //Default message type is assigned + TSmsMessageType smsMessageType = KSmsTypeSubmit; + + if( aMessageType.Compare(KPtSubmit) ==0) + { + smsMessageType = KSmsTypeSubmit; + } + else if( aMessageType.Compare(KPtCancel) ==0) + { + smsMessageType = KSmsTypeCdmaCancellation; + } + else + { + iTestStep.WARN_PRINTF1(_L("Invalid message type provided. Default is used")); + } + return smsMessageType; + } + +/** + Gets the Teleservice Id + @param aTeleService - TPtrC holding the tele service name + @return tia637::TTeleserviceId - teleservice id +*/ +tia637::TTeleserviceId CTestMessCreateCdmaSmsUtil::GetTeleServiceId(const TDesC& aTeleService) + { + //default teleservice ID assigned + tia637::TTeleserviceId teleServiceId = tia637::KTeleserviceWMT; + + iTestStep.INFO_PRINTF2(_L("Teleservice set is : %S"), &aTeleService); + if( aTeleService.Compare(KPtTeleScpt) ==0) + { + teleServiceId = tia637::KTeleserviceSCPT; + } + else if( aTeleService.Compare(KPtTeleCatpt) ==0) + { + teleServiceId = tia637::KTeleserviceCATPT; + } + else if( aTeleService.Compare(KPtTeleCmt91) ==0) + { + teleServiceId = tia637::KTeleserviceCMT91; + } + else if( aTeleService.Compare(KPtTeleVmn) ==0) + { + teleServiceId = tia637::KTeleserviceVMN; + } + else if( aTeleService.Compare(KPtTeleWap) ==0) + { + teleServiceId = tia637::KTeleserviceWAP; + } + else if( aTeleService.Compare(KPtTeleWemt) ==0) + { + teleServiceId = tia637::KTeleserviceWEMT; + } + else if( aTeleService.Compare(KPtTeleWmt) ==0) + { + teleServiceId = tia637::KTeleserviceWMT; + } + else if( aTeleService.Compare(KPtTeleWpt) ==0) + { + teleServiceId = tia637::KTeleserviceWPT; + } + else + { + iTestStep.WARN_PRINTF1(_L("Invalid Teleservice provided. Default WMT used")); + } + + return teleServiceId; + } + +/** + Gets the Message Conversion Id + @param aTeleService - TPtrC holding the tele service name + @return tia637::TTeleserviceId - teleservice id +*/ +TSmsPIDConversion CTestMessCreateCdmaSmsUtil::GetMessageConversionId(const TDesC& aMessageConversion) + { + TSmsPIDConversion smsPidConv = ESmsConvPIDNone; + + iTestStep.INFO_PRINTF2(_L("The message conversion set is : %S"), &aMessageConversion); + if( aMessageConversion.Compare(KPtPidFax) ==0) + { + smsPidConv = ESmsConvFax; + } + else if( aMessageConversion.Compare(KPtPidX400) ==0) + { + smsPidConv = ESmsConvX400; + } + else if( aMessageConversion.Compare(KPtPidPaging) ==0) + { + smsPidConv = ESmsConvPaging; + } + else if( aMessageConversion.Compare(KPtPidMail) ==0) + { + smsPidConv = ESmsConvMail; + } + else if( aMessageConversion.Compare(KPtPidErmes) ==0) + { + smsPidConv = ESmsConvErmes; + } + else if( aMessageConversion.Compare(KPtPidSpeech) ==0) + { + smsPidConv = ESmsConvSpeech; + } + else + { + iTestStep.INFO_PRINTF1(_L("The message conversion provided is invalid")); + iTestStep.INFO_PRINTF1(_L("The default NONE message conversion is set")); + } + + return smsPidConv; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessCreateGsmSmsUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessCreateGsmSmsUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,259 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 creates the Gsm sms header and service settings. It fills up the +// fields using data read from the ini file + + +#include "TestMessCreateGsmSmsUtil.h" + +/** + Constructor +*/ +CTestMessCreateGsmSmsUtil::CTestMessCreateGsmSmsUtil(CTestMessBase &aTestStep) +: CTestMessCreateSmsUtilBase(aTestStep) + { + aTestStep.INFO_PRINTF1(_L("The GSM SMS util is created")); + } + +/** + Prepares the SMS account details for CSendAs/RSendAs + @leave - KErrNoMemory + @leave - System wide error codes +*/ +void CTestMessCreateGsmSmsUtil::PrepareAccountL(CMsvSession& /*aSession*/) + { + } + +/** + Creates the header object for the GSM sms message + @param aBodyText - body text of the message + @return CSmsHeader* - pointer to CSmsHeader + @leave - KErrNoMemory + @leave - system wide error codes +*/ +CSmsHeader* CTestMessCreateGsmSmsUtil::NewHeaderL(CRichText &aBodyText) + { + return CSmsHeader::NewL(CSmsPDU::ESmsSubmit, aBodyText); + } + +/** + Fills up the header object with the data read from the ini file. + @param aSmsHeader - sms header object ofthe sms message + @leave - system wide error codes +*/ +void CTestMessCreateGsmSmsUtil::PrepareHeaderL(CSmsHeader &aSmsHeader) + { + // Get bearer data + TPtrC ptrBearer; + TBool returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KBearer, ptrBearer); + if ( !returnValue ) + { + //If bearer is not provided, read from the default section of the ini file + returnValue=iTestStep.GetStringFromConfig(KDef, KDefBearer, ptrBearer); + } + + if ( returnValue ) + { + //default value for Bio message ID type + TBioMsgIdType bearer = EBioMsgIdNbs; + + iTestStep.INFO_PRINTF2(_L("Bearer = %S"), &ptrBearer); + if (ptrBearer.CompareF(KBearerWap) == 0) + { + //Set Wap message ID + bearer = EBioMsgIdWap; + } + else if (ptrBearer.CompareF(KBearerWapSecure) == 0) + { + //Set WapSecure message ID + bearer = EBioMsgIdWapSecure; + } + else + { + iTestStep.INFO_PRINTF1(_L("No supported bearer is provided. Default is used")); + } + + //Set the Bio message ID type. +#if (defined CDMA_API_ENABLED) + aSmsHeader.BioMessage().SetBioMsgIdType(bearer); +#else + aSmsHeader.SetBioMsgIdType(bearer); +#endif + } + + // Get encoding data + TInt encoding; + returnValue=iTestStep.GetIntFromConfig(iTestStep.ConfigSection(), KEncoding, encoding); + if ( !returnValue ) + { + //If encoding is not provied, read it from the default section of the ini file + returnValue=iTestStep.GetIntFromConfig(KDef, KDefEncoding, encoding); + } + if ( returnValue ) + { + iTestStep.INFO_PRINTF2(_L("Encoding = %d"), encoding); +#if (defined CDMA_API_ENABLED) + TSmsCharacterEncoding charEncoding; + + switch (encoding) + { + case 7: + //7 bit encoding format + charEncoding = KSmsEncoding7BitGsm; + break; + case 8: + //8 bit encoding format + charEncoding = KSmsEncodingBinary; + break; + case 16: + //Unicode encoding format + charEncoding = KSmsEncodingUnicode; + break; + default: + //default encoding format + charEncoding = KSmsEncoding7BitGsm; + break; + } + + //Set the character encoding + aSmsHeader.BioMessage().SetEncoding(charEncoding); +#else + TSmsDataCodingScheme::TSmsAlphabet alpha = TSmsDataCodingScheme::ESmsAlphabet7Bit; + + switch (encoding) + { + case 7: + alpha = TSmsDataCodingScheme::ESmsAlphabet7Bit; + break; + case 8: + alpha = TSmsDataCodingScheme::ESmsAlphabet8Bit; + break; + case 16: + alpha = TSmsDataCodingScheme::ESmsAlphabetUCS2; + break; + default: + alpha = TSmsDataCodingScheme::ESmsAlphabet7Bit; + break; + } + + CSmsPDU& pdu=aSmsHeader.Message().SmsPDU(); + if ( pdu.DataCodingSchemePresent() ) + { + pdu.SetAlphabet(alpha); + } +#endif + } + + // Get delivery report data + TPtrC ptrDeliveryReport; + returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KDeliveryReport, ptrDeliveryReport); + if ( !returnValue ) + { + returnValue=iTestStep.GetStringFromConfig(KDef, KDefDeliveryReport, ptrDeliveryReport); + } + if ( returnValue ) + { + TBool changeDR = EFalse; + TBool deliveryReport = EFalse; + + iTestStep.INFO_PRINTF2(_L("Delivery Report = %S"), &ptrDeliveryReport); + if (ptrDeliveryReport.CompareF(_L("NO")) == 0) + { + changeDR = ETrue; + deliveryReport = EFalse; + } + else if (ptrDeliveryReport.CompareF(_L("YES")) == 0) + { + changeDR = ETrue; + deliveryReport = ETrue; + } + + if ( changeDR ) + { +#if (defined CDMA_API_ENABLED) + aSmsHeader.SetAcknowledgementRequest(ESmsAckTypeDelivery, deliveryReport); +#else + switch ( aSmsHeader.Type() ) + { + case CSmsPDU::ESmsSubmit: + aSmsHeader.Submit().SetStatusReportRequest(deliveryReport); + break; + case CSmsPDU::ESmsCommand: + aSmsHeader.Command().SetStatusReportRequest(deliveryReport); + break; + default: + User::Leave(KErrNotSupported); + } +#endif + } + } + } +/** + Sets the fields for the sms account settings using data read from the ini file + If no data is given in ini file, the default settings in the account is used. + @param aSmsSettings - CSmsSettings reference +*/ +void CTestMessCreateGsmSmsUtil::SetSmsAccountSettings(CSmsSettings &aSmsSettings) + { + iTestStep.INFO_PRINTF1(_L("Set SMS account Settings....")); + TBool boolTemp; + + // Set the Reply quoted setting. + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KReplyQuoted, boolTemp) ) + { + aSmsSettings.SetReplyQuoted(boolTemp); + } + + // Set the Reject duplicate settings. + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KRejectDuplicate, boolTemp) ) + { +#if (defined CDMA_API_ENABLED) + aSmsSettings.MessageSettings().Gsm().SetRejectDuplicate(boolTemp); +#else + aSmsSettings.SetRejectDuplicate(boolTemp); +#endif + } + + // Set the option for delivery report. + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KDeliveryReport, boolTemp) ) + { + aSmsSettings.SetDeliveryReport(boolTemp); + } + + // Set the concatenate feature + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KConCatenate, boolTemp) ) + { +#if (defined CDMA_API_ENABLED) + aSmsSettings.MessageSettings().Gsm().SetCanConcatenate(boolTemp); +#else + aSmsSettings.SetCanConcatenate(boolTemp); +#endif + } + + // Set whether to use the same path while replying. + if(iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KReplyPath, boolTemp)) + { +#if (defined CDMA_API_ENABLED) + aSmsSettings.MessageSettings().Gsm().SetReplyPath(boolTemp); +#else + aSmsSettings.SetReplyPath(boolTemp); +#endif + } + + //can implement these features later... + aSmsSettings.SetValidityPeriod(ESmsVPWeek); // week + aSmsSettings.SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFInteger); //relative + aSmsSettings.SetDelivery(ESmsDeliveryImmediately); + aSmsSettings.SetMessageConversion(ESmsConvPIDNone); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessCreateSMS.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessCreateSMS.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,416 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCreateSMS. This class creates the sms message +// for GSM or CDMA. For CDMA mtm, it uses utility classes to create +// the respective GSM or CDMA sms message +// +// + + +#include "TestMessCreateSMS.h" +#include "TestMessEditEntryUtil.h" + +//Usage of macros of Cdma mtm +#include "TestMessCreateGsmSmsUtil.h" +#if (defined CDMA_API_ENABLED) +#include "TestMessCreateCdmaSmsUtil.h" +#endif + +// EPOC includes +#include +#include +#include +#include +#include //For CSmsMessageSettings + +/*@{*/ +// Literal constants read from the ini file +_LIT(KRecipients, "recipients"); +_LIT(KTo, "to%d"); +_LIT(KPtSaveDraft, "SaveInDraft"); +_LIT(KDefTo, "smsto"); + +_LIT(KPtMsgBearerGsm, "GSM"); +//Usage of macros for Cdma mtm +#if (defined CDMA_API_ENABLED) +_LIT(KPtMsgBearerType, "MessageBearerType"); +_LIT(KPtMsgBearerCdma, "CDMA"); +#endif +/*@}*/ + +#if (defined CDMA_API_ENABLED) +#define KPtDefaultCount 1 +#endif + +CTestMessCreateSMS::CTestMessCreateSMS() +: CTestMessBase(EFalse) +, iSimInDatabase(EFalse) + { + SetTestStepName(_L("CreateSms")); + } + +/** + Creates the SMS message for GSM or CDMA. + @return TVerdict +*/ + +TVerdict CTestMessCreateSMS::doTestStepPreambleL() + { + TVerdict ret=CTestMessBase::doTestStepPreambleL(); + // IMK iSimInDatabase=(GetPhoneSmsNumberL(iSimPhoneNumber)==KErrNone); + iSimInDatabase=false; //IMK (GetPhoneSmsNumberL(iSimPhoneNumber)==KErrNone); + return ret; + } + +/** + Creates the SMS message for GSM or CDMA. + @return TVerdict +*/ +TVerdict CTestMessCreateSMS::doTestStepL() + { + // Get scheduling data + TTimeIntervalMinutes scheduledTime=ReadScheduleTime(); + + //create the message + TBool saveDraft = EFalse; + GetBoolFromConfig(ConfigSection(), KPtSaveDraft, saveDraft); + + if ( saveDraft ) + { + //Create the message in Draft + CreateSmsL(KMsvDraftEntryId, scheduledTime); + } + else + { + //Creates the message in Outbox + CreateSmsL(KMsvGlobalOutBoxIndexEntryId, scheduledTime); + } + + return TestStepResult(); + } + +void CTestMessCreateSMS::CreateSmsL(const TMsvId aMsvId, TTimeIntervalMinutes aScheduledTime) + { + // Get the bearertype (CDMA/GSM) + TPtrC messageBearerType; + messageBearerType.Set(KPtMsgBearerGsm); +#if (defined CDMA_API_ENABLED) + GetStringFromConfig(ConfigSection(), KPtMsgBearerType, messageBearerType); + INFO_PRINTF2(_L("The message bearertype is : %S"), &messageBearerType); +#endif + + CTestMessCreateSmsUtilBase* createSmsUtil = NULL; + // Create the repective util class + if ( messageBearerType.Compare(KPtMsgBearerGsm)==0 ) + { + createSmsUtil=new (ELeave) CTestMessCreateGsmSmsUtil(*this); + } +#if (defined CDMA_API_ENABLED) + else if ( messageBearerType.Compare(KPtMsgBearerCdma)==0 ) + { + createSmsUtil=new (ELeave) CTestMessCreateCdmaSmsUtil(*this); + } +#endif + else + { + WARN_PRINTF1(_L("Unknown bearer type using Gsm")); + createSmsUtil=new (ELeave) CTestMessCreateGsmSmsUtil(*this); + } + CleanupStack::PushL(createSmsUtil); + +// All references to PrepareAccountL can be removed when DEF054045 is fixed +// createSmsUtil->PrepareAccountL(*iSession); + + if(!iBodyAvailable) + { + ERR_PRINTF1(_L("No Body")); + SetTestStepResult(EFail); + } + + if ( TestStepResult()==EPass ) + { + TInt err=KErrNone; + RSendAs sendAsServer; + User::LeaveIfError(sendAsServer.Connect()); + CleanupClosePushL(sendAsServer); + AddMtmCapabilitiesL(sendAsServer); + + RSendAsMessage sendAs; + TRAP(err, sendAs.CreateL(sendAsServer, KUidMsgTypeSMS)); + PrepareSendAsL(sendAs); + + if ( err!=KErrNone ) + { + SetTestStepError(err); + } + else + { + INFO_PRINTF1(_L("sendAs.SetBodyTextL")); + sendAs.SetBodyTextL(*iBodyText); + +#if (!defined CDMA_API_ENABLED) + TInt recipients=1; + GetIntFromConfig(ConfigSection(), KRecipients, recipients); + + TPtrC to(iSimPhoneNumber.iTelNumber); + TBool returnValue=ETrue; + for ( TInt recipient=0; (recipient tempStore; + tempStore.Format(KTo(), recipient); + returnValue=GetStringFromConfig(ConfigSection(), tempStore, to); + if ( !returnValue ) + { + returnValue=GetStringFromConfig(KDef, KDefTo, to); + } + } + if ( !returnValue ) + { + ERR_PRINTF1(_L("No To")); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("To = %S"), &to); + sendAs.AddRecipientL(to, RSendAsMessage::ESendAsRecipientTo); + } + } +#endif + + TRAP(err, sendAs.SaveMessageAndCloseL()); + if ( err!=KErrNone ) + { + ERR_PRINTF1(_L("Save Message Failiure")); + SetTestStepResult(EFail); + sendAs.Close(); + } + else + { + TMsvId messageId=KMsvNullIndexEntryId; + CMsvEntry* parent=iSession->GetEntryL(KMsvDraftEntryIdValue); + CleanupStack::PushL(parent); + parent->SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=parent->ChildrenL(); + CleanupStack::PushL(selection); + + if ( selection->Count()>0 ) + { + messageId=selection->At(0); + } + if ( messageId!=KMsvNullIndexEntryId ) + { + SetEntryL(messageId); + TMsvEntry child=EntryL().Entry(); + + //Get the message header + CSmsHeader* smsHeader = createSmsUtil->NewHeaderL(*iBodyText); + CleanupStack::PushL(smsHeader); + + //If message is too big lets concatenate..... + ConCatMessageTextL(*smsHeader); + + CMsvStore* store =NULL; + TRAPD(error, store = EntryL().EditStoreL()); + if(error != KErrNone) + { + ERR_PRINTF2(_L("Edit Store Failed. Error %d"), error); + SetTestStepError(error); + } + else + { + CleanupStack::PushL(store); + smsHeader->RestoreL(*store); +#if (defined CDMA_API_ENABLED) + //Adding the recipients... + CArrayPtrFlat& recips = smsHeader->Recipients(); + + TInt recipients=KPtDefaultCount; + GetIntFromConfig(ConfigSection(), KRecipients, recipients); + + TBool returnValue; + for ( TInt recipient=1; recipient<=recipients; recipient++) + { + TBuf tempStore; + + tempStore.Format(KTo(), recipient); + + TPtrC to; + returnValue=GetStringFromConfig(ConfigSection(), tempStore, to); + if ( !returnValue ) + { + returnValue=GetStringFromConfig(KDef, KDefTo, to); + } + if ( !returnValue ) + { + ERR_PRINTF1(_L("No To")); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("To = %S"), &to); + + //Get the recipient array + CSmsNumber* newRecip = CSmsNumber::NewL(); + CleanupStack::PushL(newRecip); + + // Check for the email address in recipient + // This is for email over sms feature + if(to.Locate('@') != KErrNotFound) + { + newRecip->SetAddressL(to, EMsvAddressTypeEMail); + } + else + { + newRecip->SetAddressL(to, EMsvAddressTypeISDN); + } + + //Append the recipients + recips.AppendL(newRecip); + CleanupStack::Pop(newRecip); + } + } +#endif + child.SetSendingState(KMsvSendStateSuspended); + child.SetInPreparation(EFalse); + child.SetVisible(ETrue); + + //Get the details + TBuf details; + +//Usage of macros of Cdma mtm +#if (!defined CDMA_API_ENABLED) + if ( TSmsUtilities::GetDetails(EntryL().Session().FileSession(), smsHeader->Message(), details) == KErrNone ) + { + child.iDetails.Set(details); + } +#else + //if ( TSmsUtilities::GetDetails(EntryL().Session().FileSession(), smsHeader->Message(), details) == KErrNone ) + CArrayPtrFlat& smsNumberArray = smsHeader->Recipients(); + if ( smsNumberArray.Count() ) + { + details.Copy(smsNumberArray[0]->Address()); + } + if ( details.Length() ) + { + child.iDetails.Set(details); + } +#endif + + //Get the description + TBuf desc; + if ( TSmsUtilities::GetDescription(smsHeader->Message(), desc) == KErrNone ) + { + child.iDescription.Set(desc); + } + + //fill up the fields of the message header + PrepareHeaderL(*createSmsUtil, *smsHeader); + + //set the scheduled time if any + if ( aScheduledTime!=TTimeIntervalMinutes(0) ) + { + child.SetSendingState(KMsvSendStateScheduled); + child.SetScheduled(ETrue); + child.iDate.UniversalTime(); + child.iDate+=aScheduledTime; + } + + // Update entry with data set from .ini file + EntryL().ChangeL(child); + smsHeader->StoreL(*store); + store->CommitL(); + CleanupStack::PopAndDestroy(store); + + CTestMessEditEntryUtil* editUtil=new (ELeave) CTestMessEditEntryUtil(*this, ETrue, iSimInDatabase, iSimPhoneNumber); + CleanupStack::PushL(editUtil); + editUtil->ProcessEntryL(EntryL().EntryId()); + CleanupStack::PopAndDestroy(editUtil); + + if ( aMsvId==KMsvGlobalOutBoxIndexEntryId ) + { + // Move the selected message to out box + CTestActive* active=CTestActive::NewLC(*this); + CMsvOperation* op=parent->MoveL(child.Id(), KMsvGlobalOutBoxIndexEntryIdValue, active->iStatus); + CleanupStack::PushL(op); + active->Activate(); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy(2, active); + } + } + CleanupStack::PopAndDestroy(smsHeader); + } + CleanupStack::PopAndDestroy(2, parent); + } + } + + CleanupStack::PopAndDestroy(&sendAsServer); + } + CleanupStack::PopAndDestroy(createSmsUtil); + } + +void CTestMessCreateSMS::AddMtmCapabilitiesL(RSendAs& aSendAs) + { + aSendAs.ResetMessageFilter(); + } + +void CTestMessCreateSMS::PrepareSendAsL(RSendAsMessage& /*aSendAs*/) + { + } + +void CTestMessCreateSMS::PrepareHeaderL(CTestMessCreateSmsUtilBase& aCreateUtil, CSmsHeader& aSmsHeader) + { + aCreateUtil.PrepareHeaderL(aSmsHeader); + } + +//Usage of macro for CDMA mtm +#if (defined CDMA_API_ENABLED) +void CTestMessCreateSMS::ConCatMessageTextL(CSmsHeader& /*aHeader*/) + { + } +#else +void CTestMessCreateSMS::ConCatMessageTextL(CSmsHeader& aHeader) + //Doxygen compatible comments + /** + This method Concatenates the long message. Checks for the length of + body, if it is greater than 160 characters sets the concatenation + option on for the Sms. + + @param aHeader + Header for which the concatenation option is set on... + + */ + { + CSmsSettings* smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + //if the length of the iBodyText is greater than the sms maximum length + //i.e 160 chars...Set the Concatenation On.... + if( aHeader.Message().MessageLengthL() > aHeader.Message().MaxMessageLength() ) + { + INFO_PRINTF1(_L("Concatenate Message...")); + INFO_PRINTF1(_L("Message Exceeds max length setting Concatenate On...")); + aHeader.GetSmsSettingsL(*smsSettings); + smsSettings->SetCanConcatenate(ETrue); + aHeader.SetSmsSettingsL(*smsSettings); + } + CleanupStack::PopAndDestroy(smsSettings); + } +#endif diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessCreateSMSaccount.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessCreateSMSaccount.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,151 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCreateSmsAccount which creates an SMS +// account folder for GSM or CDMA + +#include "TestMessCreateSmsAccount.h" +#include "TestMess.h" + +// EPOC includes +#include +#include +#include + +#include "TestMessCreateGsmSmsUtil.h" +//Usage of Macro for CDMA mtm +#if (defined CDMA_API_ENABLED) +#include "TestMessCreateCdmaSmsUtil.h" +#endif + +#include +#include +#include +#include +#include + +/*@{*/ +_LIT(KSCName, "scname"); +_LIT(KSCNumber, "scnumber"); + +_LIT(KPtGSM, "GSM"); +#if (defined CDMA_API_ENABLED) +_LIT(KPtMessageBearerType, "MessageBearerType"); +_LIT(KPtCDMA, "CDMA"); +#endif +/*@}*/ + +CTestMessCreateSmsAccount::CTestMessCreateSmsAccount() +: CTestMessBase(EFalse) + { + SetTestStepName(_L("CreateSmsAccount")); + } + +/** + Creates the SMS account folder for GSM or CDMA. For CDMA mtm, + it creates the respective utility class for creating the account + @return TVerdict +*/ +TVerdict CTestMessCreateSmsAccount::doTestStepL() + { + // Printing to the console and log file + INFO_PRINTF1(_L("Create SMS account")); + + TPtrC ptrSCName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KSCName, ptrSCName); + INFO_PRINTF2(_L("SC Name = %S"), &ptrSCName); + + TPtrC ptrSCNumber; + returnValue =GetStringFromConfig(ConfigSection(), KSCNumber, ptrSCNumber); + INFO_PRINTF2(_L("SC Number = %S"), &ptrSCNumber); + + CSmsAccount* smsAccount = CSmsAccount::NewLC(); + CMsvScheduleSettings* scheduleSetting = CMsvScheduleSettings::NewLC(); + CMsvOffPeakTimes* offPeakTimes=new (ELeave) CMsvOffPeakTimes(); + CleanupStack::PushL(offPeakTimes); + CMsvSendErrorActions* errorActions=CMsvSendErrorActions::NewLC(); + CMsvSysAgentActions* sysAgentActions=new (ELeave) CMsvSysAgentActions(); + CleanupStack::PushL(sysAgentActions); + CSmsSettings* smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + SetEntryL(KMsvRootIndexEntryId); + + EntryL().SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=EntryL().ChildrenWithTypeL(KUidMsvServiceEntry); + CleanupStack::PushL(selection); + TInt count=selection->Count(); + TBool found=EFalse; + for (TInt i=count; i>0 && !found; ) + { + SetEntryL(selection->At(--i)); + + // Only one Sms Service allowed + if ( EntryL().Entry().iMtm == KUidMsgTypeSMS && + EntryL().Entry().iType == KUidMsvServiceEntry + ) + { + found=ETrue; + } + } + + if ( !found ) + { + smsAccount->InitialiseDefaultSettingsL(*smsSettings); + smsAccount->InitialiseDefaultSettingsL(*scheduleSetting, *offPeakTimes, *errorActions, *sysAgentActions); + + TPtrC messageBearerType; + messageBearerType.Set(KPtGSM); +#if (defined CDMA_API_ENABLED) + GetStringFromConfig(ConfigSection(), KPtMessageBearerType, messageBearerType); + INFO_PRINTF2(_L("The message bearer type is : %S"), &messageBearerType); +#endif + + CTestMessCreateSmsUtilBase* createSmsUtil = NULL; + //Creates the util class for GSM or CDMA + if ( messageBearerType.Compare(KPtGSM)==0 ) + { + createSmsUtil = new (ELeave) CTestMessCreateGsmSmsUtil(*this); + } +#if (defined CDMA_API_ENABLED) + else if( messageBearerType.Compare(KPtCDMA)==0 ) + { + createSmsUtil = new (ELeave) CTestMessCreateCdmaSmsUtil(*this); + } +#endif + else + { + WARN_PRINTF1(_L("Unknown bearer type using Gsm")); + createSmsUtil= new (ELeave) CTestMessCreateGsmSmsUtil(*this); + } + CleanupStack::PushL(createSmsUtil); + + //Changes the new account settings + createSmsUtil->SetSmsAccountSettings(*smsSettings); + CleanupStack::PopAndDestroy(createSmsUtil); + + smsAccount->SaveSettingsL(*smsSettings); + smsAccount->SaveSettingsL(*scheduleSetting, *offPeakTimes, *errorActions, *sysAgentActions); + } + + if ( TestStepResult()==EPass ) + { + smsAccount->LoadSettingsL(*smsSettings); + smsSettings->AddServiceCenterL(ptrSCName, ptrSCNumber); + smsAccount->SaveSettingsL(*smsSettings); + } + + CleanupStack::PopAndDestroy(2, smsSettings); + CleanupStack::PopAndDestroy(5, smsAccount); + + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessCreateSmsUtilBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessCreateSmsUtilBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,27 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 is the base class for create CDMA or GSM SMS utility class +// +// + + +#include "TestMessCreateSmsUtilBase.h" + +/** + Constructor +*/ +CTestMessCreateSmsUtilBase::CTestMessCreateSmsUtilBase(CTestMessBase &aTestStep) +: iTestStep(aTestStep) + { + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessEditEntry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessEditEntry.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,170 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntry which edits the entry characterstics +// +// + +#include "TestMessEditEntry.h" +#include "TestMessEditEntryUtil.h" + +/** + * @name Constant Literals used. + */ +/*@{*/ +_LIT(KPtSaveToOutbox, "SaveToOutbox"); +/*@}*/ + +// Default value for depth of the count +#define KDefaultDepthCount 1 + +/** + * Override of base class pure virtual + * @param None + * @return TVerdict - return TVerdict codes + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessEditEntry::ProcessMessageL(CBaseMtm& /*aBaseMtm*/, TMsvId /*aMsgId*/) + { + // Printing to the console and log file + INFO_PRINTF1(_L("Edit Entry")); + + if ( TestStepResult() == EPass ) + { + CTestMessEditEntryUtil* editUtil=new (ELeave) CTestMessEditEntryUtil(*this, EFalse, EFalse, RMobilePhone::TMobileAddress()); + CleanupStack::PushL(editUtil); + + editUtil->ProcessEntryL(EntryL().EntryId()); + + //Read whether the message is saved in outbox + TBool saveOutbox; + if( ! GetBoolFromConfig(ConfigSection(), KPtSaveToOutbox, saveOutbox)) + { + saveOutbox = EFalse; + } + + INFO_PRINTF2(_L("The message saved in outbox flag is : %S"), &saveOutbox); + if(saveOutbox) + { + //Move the message to outbox + MoveMessageL(EntryL().EntryId(), KMsvGlobalOutBoxIndexEntryId); + } + else + { + INFO_PRINTF1(_L("Entry is not moved")); + } + + CleanupStack::PopAndDestroy(editUtil); + } + } + +/** + Move the message the destination folder + @param aMessageId - TMsvId of the message + @param aFolderId - TMsvId of the destination folder + @leave KErrNoMemory + @leave KErrNotFound +*/ +void CTestMessEditEntry::MoveMessageL(TMsvId aMessageId,TMsvId aFolderId) + { + // Get CMsvEntry object and the TMsvEntry of the message + CMsvEntry* msgvEntry = iSession->GetEntryL(aMessageId); + CleanupStack::PushL(msgvEntry); + TMsvEntry entry= msgvEntry->Entry(); + + // Get the parent folder Id of the messaage and create the CMsvEntry + TMsvId parentId = entry.Parent(); + CMsvEntry* msvEntry = iSession->GetEntryL(parentId); + CleanupStack::PushL(msvEntry); + + // Create the active object for handling asynchronous request + CMoveOperation* activeOperation = CMoveOperation::NewL(); + CleanupStack::PushL(activeOperation); + + // Move the selected message to given target folder + CMsvOperation* op = msvEntry->MoveL(aMessageId, aFolderId, activeOperation->iStatus); + CleanupStack::PushL(op); + + // Start the Active scheduler + activeOperation->SetOperation(); + CActiveScheduler::Start(); + TInt error = activeOperation->iStatus.Int(); + if(error == KErrNone) + { + INFO_PRINTF1(_L("message moved successfully")); + } + else + { + INFO_PRINTF2(_L("message failed to be moved. Error : %d"),error); + SetTestStepResult(EFail); + } + //Destroy the object + CleanupStack::PopAndDestroy(4, msgvEntry); + } + +/** + Constructor for CMoveOperation +*/ +CTestMessEditEntry::CMoveOperation::CMoveOperation() +: CActive(CActive::EPriorityStandard) + { + } + +/** + Two phase constructor + @return CTestMessEditEntry::CMoveOperation* - pointer of CTestMessEditEntry::CMoveOperation + @leave - KErrNoMemory + @leave - System wide error codes +*/ +CTestMessEditEntry::CMoveOperation* CTestMessEditEntry::CMoveOperation::NewL() + { + CMoveOperation* self = new (ELeave) CMoveOperation(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + Second phase construction + @leave - sytem wide error codes +*/ +void CTestMessEditEntry::CMoveOperation::ConstructL() + { + CActiveScheduler::Add(this); + } + +/** + Sets the operation as active +*/ +void CTestMessEditEntry::CMoveOperation::SetOperation() + { + SetActive(); + } + +/** + Operation completed event handler. +*/ +void CTestMessEditEntry::CMoveOperation::RunL() + { + CActiveScheduler::Stop(); + } + +/** + Cancels the active operation +*/ +void CTestMessEditEntry::CMoveOperation::DoCancel() + { + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessEditEntryUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessEditEntryUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,249 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntryUtil. A utility to edit an entry +// +// + + +#include "TestMessEditEntryUtil.h" + +// EPOC includes + +#include +#include +#include + +/** + * @name Constant Literals used. + */ +/*@{*/ +_LIT(KToRecipients, "toRecipients"); +_LIT(KTo, "to%d"); +_LIT(KDef, "default"); +_LIT(KDefTo, "emailto"); + +// Literal constants used +_LIT(KCharacterSetType, "characterSetType"); +_LIT(KPtEditBody, "EditBody"); +_LIT(KPtEditRecipients, "EditRecipients"); +_LIT(KPtRecipient, "recipient%d"); +/*@}*/ + +CTestMessEditEntryUtil::CTestMessEditEntryUtil(CTestMessBase& aTestStep, TBool aSimChecked, TBool aSimInDatabase, RMobilePhone::TMobileAddress aSimPhoneNumber) +: CTestMessStoreProcessUtil(aTestStep, EFalse) +, iSimChecked(aSimChecked) +, iSimInDatabase(aSimInDatabase) +, iSimPhoneNumber(aSimPhoneNumber) + { + } + +/** + * Edits the ImHeaders of the Entry + * @param CImHeader& aHeader - Im Header to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessEditEntryUtil::ProcessImHeaderL(CImHeader& aHeader) + { + // Edit the CImHeader information + TInt recipients; + if ( !iTestStep.GetIntFromConfig(iTestStep.ConfigSection(), KToRecipients, recipients) ) + { + recipients=0; + } + + for ( TInt recipient=1; recipient<=recipients; recipient++) + { + TBuf tempStore; + tempStore.Format(KTo(), recipient); + + TPtrC to; + TInt returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), tempStore, to); + if ( !returnValue ) + { + returnValue=iTestStep.GetStringFromConfig(KDef, KDefTo, to); + } + if ( !returnValue ) + { + iTestStep.ERR_PRINTF1(_L("No To")); + iTestStep.SetTestStepResult(EFail); + } + else + { + iTestStep.INFO_PRINTF2(_L("To = %S"), &to); + aHeader.ToRecipients().AppendL(to); + } + } + } + +/** + * Edits the ImMimeHeaders of the message entry + * @param CImMimeHeader& aHeader - Mime Header to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessEditEntryUtil::ProcessImMimeHeaderL(CImMimeHeader& aHeader) + { + // Update the character set info + TPtrC charSetType; + if ( iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KCharacterSetType, charSetType) ) + { + TUint charSetVal; + if ( ValidCharacterSetInfo(charSetType, charSetVal) ) + { + aHeader.SetMimeCharset(charSetVal); + } + } + } + +/** + * Edits the ImIAPPreferences of the entry + * @param CImIAPPreferences& aPreferences - IAP Preferences to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessEditEntryUtil::ProcessInternetAccessPreferencesL(CImIAPPreferences& /*aPreferences*/) + { + } + +/** + Edits the CSmsHeader of the entry + @param CSmsHeader& aHeader - Sms Header to edit + @return None + @panic None + @leave KErrNoMemory +*/ +void CTestMessEditEntryUtil::ProcessSmsHeaderStreamL(CSmsHeader& aSmsHeader) + { + // Get the number of recipients + TInt recipients = 0; + if ( !iTestStep.GetIntFromConfig(iTestStep.ConfigSection(), KPtEditRecipients, recipients) ) + { + recipients=0; + iTestStep.INFO_PRINTF1(_L("No Recipients edited/added")); + } + iTestStep.INFO_PRINTF2(_L("The number of recipients : %d"), recipients); + + if ( !iSimChecked ) + { + //IMK iSimInDatabase=(iTestStep.GetPhoneSmsNumberL(iSimPhoneNumber)==KErrNone); + iSimInDatabase=0; + } + TPtrC to(iSimPhoneNumber.iTelNumber); + TInt returnValue=ETrue; + for ( TInt recipient=0; (recipient tempStore; + tempStore.Format(KPtRecipient(), recipient); + + //Get the recipient address + returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), tempStore, to); + if ( !returnValue ) + { + returnValue=iTestStep.GetStringFromConfig(KDef, KDefTo, to); + } + } + if ( !returnValue ) + { + iTestStep.ERR_PRINTF1(_L("Recipient number is not Provided")); + iTestStep.SetTestStepResult(EFail); + } + else + { + //Append the recipient address in recipient list + CSmsNumber* smsNumber = CSmsNumber::NewL(); + CleanupStack::PushL(smsNumber); + iTestStep.INFO_PRINTF2(_L("To = %S"), &to); + smsNumber->SetAddressL(to); + aSmsHeader.Recipients().AppendL(smsNumber); + //No need to destory CSmsNumber. CSmsHeader destroys it + CleanupStack::Pop(smsNumber); + } + } + } + + +/** + Edits the CRichText of the entry + @param CRichText& aBodyText - Text to edit + @return None + @panic None + @leave KErrNoMemory +*/ +void CTestMessEditEntryUtil::ProcessRichTextBodyL(CRichText& aBodyText) + { + TPtrC ptrBody; + //Get the body text file + TBool returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KPtEditBody, ptrBody); + if ( !returnValue ) + { + iTestStep.INFO_PRINTF1(_L("Body is not edited")); + } + else + { + iTestStep.INFO_PRINTF2(_L("Body = %S"), &ptrBody); + + // open the file + RFs rfs; + rfs.Connect(); + RFile file; + + //Append the body text of the entry + TInt anError = file.Open(rfs, ptrBody, EFileShareAny); + if(anError == KErrNone) + { + TBool reading=ETrue; + TInt pos = aBodyText.LdDocumentLength(); + TBuf8<1> charIn; + while (reading) + { + file.Read(charIn, 1); + if(charIn.Length()) + switch ( charIn[0] ) + { + case '\r': + aBodyText.InsertL(pos++, CEditableText::ELineBreak); + case '\n': + break; + default: + aBodyText.InsertL(pos++, TChar(charIn[0])); + } + else + { + reading = FALSE; // stop at the end of the file + } + } + file.Close(); + rfs.Close(); + } + else + { + iTestStep.ERR_PRINTF2(_L("Cannot open file = %S"), &ptrBody); + iTestStep.SetTestStepResult(EFail); + } + } + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessPrintEntryUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessPrintEntryUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,115 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntryUtil. A utility to edit an entry +// + + +#include "TestMessPrintEntryUtil.h" + +CTestMessPrintEntryUtil::CTestMessPrintEntryUtil(CTestMessBase& aTestStep) +: CTestMessStoreProcessUtil(aTestStep, ETrue) + { + } + +/** + * Prints the ImHeaders of the Entry + * @param CImHeader& aHeader - Im Header to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessPrintEntryUtil::ProcessImHeaderL(CImHeader& aHeader) + { + TPtrC ptrTemp; + + ptrTemp.Set(aHeader.From()); + iTestStep.INFO_PRINTF2(_L(" From : %S"), &ptrTemp); + ptrTemp.Set(aHeader.ReceiptAddress()); + iTestStep.INFO_PRINTF2(_L(" ReceiptAddress : %S"), &ptrTemp); + ptrTemp.Set(aHeader.ReplyTo()); + iTestStep.INFO_PRINTF2(_L(" ReplyTo : %S"), &ptrTemp); + ptrTemp.Set(aHeader.Subject()); + iTestStep.INFO_PRINTF2(_L(" Subject : %S"), &ptrTemp); + } + +/** + * Prints the ImMimeHeaders of the message entry + * @param CImMimeHeader& aHeader - Mime Header to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessPrintEntryUtil::ProcessImMimeHeaderL(CImMimeHeader& /*aHeader*/) + { + } + +/** + * Prints the ImIAPPreferences of the entry + * @param CImIAPPreferences& aPreferences - IAP Preferences to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessPrintEntryUtil::ProcessInternetAccessPreferencesL(CImIAPPreferences& aPreferences) + { + TInt prefs=aPreferences.NumberOfIAPs(); + for ( TInt pref=0; prefReplyPath(); + CleanupStack::PopAndDestroy(smsSettings); +#else + CSmsPDU::TSmsPDUType pduType=aHeader.Type(); + TBool replyPath = aHeader.ReplyPathProvided(); +#endif + iTestStep.INFO_PRINTF2(_L(" pduType : %d"), pduType); + iTestStep.INFO_PRINTF2(_L(" replyPathProvided : %d"), replyPath); + } + + +/** + * Prints the CRichText of the entry + * @param CRichText& aBodyText - Text to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessPrintEntryUtil::ProcessRichTextBodyL(CRichText& /*aBodyText*/) + { + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessProcessExistingMsg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessProcessExistingMsg.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,89 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessProcessExistingMsg +// Base class for processing an existing message +// +// + +/** + @file TestMessProcessExistingMsg.cpp +*/ + +#include "TestMessProcessExistingMsg.h" + +// EPOC includes +#include +#include +#include +#include +#include + +/** + * Constructor. + * @return - None + * +*/ +CTestMessProcessExistingMsg::CTestMessProcessExistingMsg() +: CTestMessBase(ETrue) + { + } + +/** + * Override of base class pure virtual function + * @return - TVerdict code + * @leave - KErrNoMemory - memory allocatior failure + * @leave - KErrBadLibraryEntryPoint - Malformed MTM + * @leave - KErrNotFound - Not found the mtmUid and StepStepResult set to Fail + * +*/ +TVerdict CTestMessProcessExistingMsg::doTestStepL() + { + if ( TestStepResult() == EPass ) + { + CClientMtmRegistry* clientMtmRegistry=CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL(clientMtmRegistry); + + iMtmID=EntryL().Entry().iMtm; + + CBaseMtm* baseMtm=clientMtmRegistry->NewMtmL(iMtmID); + CleanupStack::PushL(baseMtm); + + // switch the context + TMsvId msgId=EntryL().EntryId(); + PrintEntryL(EntryL()); + baseMtm->SwitchCurrentEntryL(msgId); + baseMtm->LoadMessageL(); + + ProcessMessageL(*baseMtm, msgId); + + if ( TestStepResult() == EPass ) + { + PostProcessMessageL(); + } + + CleanupStack::PopAndDestroy(2, clientMtmRegistry); + } + + return TestStepResult(); + } + +/** + * Nothing done for open + * @return None + * @leave KErrNone and TestStepResult set to EFail + * +*/ +void CTestMessProcessExistingMsg::PostProcessMessageL() + { + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessProcessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessProcessor.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,288 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessProcessor which an active object utility +// used for send/recieving or any time consuming +// +// + +#include "TestMessProcessor.h" +#include "TestMessBase.h" + +CTestMessProcessor* CTestMessProcessor::NewL(CTestStep& aTestStep, CMsvSession& aSession) + { + CTestMessProcessor* self=new(ELeave) CTestMessProcessor(aTestStep, aSession); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CTestMessProcessor::CTestMessProcessor(CTestStep& aTestStep, CMsvSession& aSession) +: CActive(EPriorityStandard) +, iState(EStatePrepareToSendMsg) +, iTestStep(aTestStep) +, iSession(aSession) +, iEntry(NULL) +, iMsgId(KMsvRootIndexEntryId) +, iClient(NULL) +, iMsvOperation(NULL) +, iCancelSms(EFalse) + { + } + +CTestMessProcessor::~CTestMessProcessor() + { + delete iEntry; + iEntry=NULL; + delete iMsvOperation; + iMsvOperation=NULL; + } + +void CTestMessProcessor::ConstructL() + { + CActiveScheduler::Add(this); + } + +void CTestMessProcessor::DoCancel() + { + iTestStep.INFO_PRINTF1(_L("Cancel operation")); + iMsvOperation->Cancel(); + } + +void CTestMessProcessor::DisplayProgress() + { + // display the current progress + switch(iState) + { + case EStatePrepareToSendMsg: + { + TMsvLocalOperationProgress temp; + TPckgC progress(temp); + + progress.Set(iMsvOperation->ProgressL()); + iTestStep.INFO_PRINTF1(_L(" Progress")); + iTestStep.INFO_PRINTF2(_L(" Operation :%d"), progress().iType); + iTestStep.INFO_PRINTF2(_L(" Total Number Of Entries:%d"), progress().iTotalNumberOfEntries); + iTestStep.INFO_PRINTF2(_L(" Number Completed :%d"), progress().iNumberCompleted); + iTestStep.INFO_PRINTF2(_L(" Number Failed :%d"), progress().iNumberFailed); + iTestStep.INFO_PRINTF2(_L(" Number Remaining :%d"), progress().iNumberRemaining); + iTestStep.INFO_PRINTF2(_L(" Error :%d"), progress().iError); + iTestStep.INFO_PRINTF2(_L(" Id :%x"), progress().iId); + } + break; + case EStateRequest: + iClient->DisplayProgressL(EFalse, iMsvOperation); + break; + default: + break; + } + } + +void CTestMessProcessor::SendEmailMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient) + { + iMsgId=aMsgId; + iClient=aClient; + iState=EStatePrepareToSendMsg; + + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iMsgEntry=iEntry->Entry(); + iMsgEntry.SetSendingState(KMsvSendStateWaiting); + delete iMsvOperation; + iMsvOperation=NULL; + iMsvOperation=iEntry->ChangeL(iMsgEntry, iStatus); + SetActive(); + } + +/** + Sends the sms message. It sets the fields of the enty. + @param aMsgId - TMsvId of the message + @param aClient - Pointer to the MTestMessProcessClient + @param aCancelSms - Bool value for the Cancel sms flag +*/ +void CTestMessProcessor::SendSmsMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient, TBool aCancelSms) + { + iMsgId=aMsgId; + iClient=aClient; + iState=EStatePrepareToSendMsg; + iCancelSms = aCancelSms; + + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iMsgEntry=iEntry->Entry(); + iMsgEntry.SetConnected(ETrue); + iMsgEntry.SetFailed(EFalse); + iMsgEntry.SetSendingState(KMsvSendStateWaiting); + iMsgEntry.iError = KErrNone; + delete iMsvOperation; + iMsvOperation=NULL; + iMsvOperation=iEntry->ChangeL(iMsgEntry, iStatus); + SetActive(); + } + +void CTestMessProcessor::SendMmsMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient) + { + iMsgId=aMsgId; + iClient=aClient; + iState=EStatePrepareToSendMsg; + + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iMsgEntry=iEntry->Entry(); + iMsgEntry.SetSendingState(KMsvSendStateWaiting); + delete iMsvOperation; + iMsvOperation=NULL; + iMsvOperation=iEntry->ChangeL(iMsgEntry, iStatus); + SetActive(); + } + +void CTestMessProcessor::MtmRequestL(TMsvId aAccountId, MTestMessProcessorClient* aClient) + { + iMsgId=aAccountId; + iClient=aClient; + iState=EStateRequest; + + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iStatus = KRequestPending; + delete iMsvOperation; + iMsvOperation=NULL; + TRAPD(err, iMsvOperation=iClient->CreateOperationL(iStatus)); + if ( iTestStep.TestStepResult() == EPass && err==KErrNone ) + { + SetActive(); + } + } + +void CTestMessProcessor::RunL() + { + switch(iState) + { + case EStatePrepareToSendMsg: + switch (iStatus.Int()) + { + case KErrNone: + { + delete iMsvOperation; + iMsvOperation=NULL; + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iMsgEntry=iEntry->Entry(); + iMsgEntry.SetSendingState(KMsvSendStateWaiting); + iEntry->ChangeL(iMsgEntry); + if ( iMsgEntry.SendingState() == KMsvSendStateWaiting ) + { + iState=EStateRequest; + iStatus = KRequestPending; + TRAPD(err, iMsvOperation=iClient->CreateOperationL(iStatus)); + if ( iTestStep.TestStepResult() == EPass && err==KErrNone ) + { + SetActive(); + } + else + { + CActiveScheduler::Stop(); + } + } + else + { + iTestStep.ERR_PRINTF2(_L("Sending State not Waiting :%d"), iMsgEntry.SendingState()); + iTestStep.SetTestStepResult(EFail); + CActiveScheduler::Stop(); + } + } + break; + case KErrCancel: + { + if(iCancelSms) + { + iTestStep.INFO_PRINTF1(_L("Sending of the mesage Cancelled successfully")); + } + else + { + iTestStep.ERR_PRINTF2(_L("Message failed to Send, Error = %d"), iStatus.Int()); + iTestStep.SetTestStepResult(EFail); + } + CActiveScheduler::Stop(); + break; + } + default: + iTestStep.ERR_PRINTF2(_L("Unknown Event :%d"), iStatus.Int()); + iTestStep.SetTestStepResult(EFail); + CActiveScheduler::Stop(); + } + break; + case EStateRequest: + switch (iStatus.Int()) + { + case KErrNone: + { + TInt error=iClient->DisplayProgressL(ETrue, iMsvOperation); + if ( error != KErrNone ) + { + iTestStep.ERR_PRINTF2(_L("Progress Error:%d"), error); + iTestStep.SetTestStepResult(EFail); + } + delete iMsvOperation; + iMsvOperation=NULL; + + // Is there another operation + if ( iClient->MoreOperations() ) + { + iStatus = KRequestPending; + TRAPD(err, iMsvOperation=iClient->CreateOperationL(iStatus)); + if ( iTestStep.TestStepResult() == EPass && err==KErrNone ) + { + SetActive(); + } + else + { + CActiveScheduler::Stop(); + } + } + else + { + CActiveScheduler::Stop(); + } + } + break; + case KErrServerTerminated: + { + TInt error=iClient->DisplayProgressL(ETrue, iMsvOperation); + if ( error != KErrServerTerminated ) + { + iTestStep.ERR_PRINTF2(_L("Progress Error:%d"), error); + iTestStep.SetTestStepResult(EFail); + } + delete iMsvOperation; + iMsvOperation=NULL; + CActiveScheduler::Stop(); + } + default: + iTestStep.ERR_PRINTF2(_L("Unknown Event :%d"), iStatus.Int()); + iTestStep.SetTestStepResult(EFail); + CActiveScheduler::Stop(); + } + break; + default: + iTestStep.ERR_PRINTF1(_L("No handler found in CTestMessProcessor class")); + iTestStep.SetTestStepResult(EFail); + CActiveScheduler::Stop(); + } + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,192 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "TestMessServer.h" +#include "TestMessSession.h" +#include "TestMessCleanMessageFolder.h" +#include "TestMessCreateSmsAccount.h" +//IMK #include "TestMessCreatePopAccount.h" +//IMK #include "TestMessCreateImapAccount.h" +#include "TestMessSetDefaultSc.h" +//IMK #include "TestMessCreateBIO.h" +//IMK #include "TestMessCreateEmail.h" +//IMK #include "TestMessCreateBulkEmail.h" +//IMK #include "TestMessCreateEMS.h" +#include "TestMessCreateSMS.h" +//IMK #include "TestMessCreateBulkSMS.h" +//IMK #include "TestMessEntryCount.h" +//IMK #include "TestMessSendEmail.h" +//IMK #include "TestMessSendBulkEmail.h" +//IMK #include "TestMessSendSms.h" +//IMK #include "TestMessDeleteEmailImap.h" +//IMK #include "TestMessDeleteEmailPop.h" +//IMK #include "TestMessFullSyncImap.h" +//IMK #include "TestMessReceiveEmailImap.h" +//IMK #include "TestMessReceiveEmailPop.h" +//IMK #include "TestMessOpen.h" +//IMK #include "TestMessVerifyEntry.h" +//IMK #include "TestMessReply.h" +//IMK #include "TestMessForward.h" +//IMK #include "TestMessCompareMessages.h" +//IMK #include "TestMessSetSyncRateImap.h" +//IMK #include "TestMessDeleteSharedData.h" +#include "TestMessEditEntry.h" +//IMK #include "TestMessSaveEmailAttachments.h" +//IMK #include "TestMessDeleteFolder.h" +//IMK #include "TestMessCreateFolder.h" +//IMK #include "TestMessRenameFolder.h" +//IMK #include "TestMessMoveMessages.h" +//IMK #include "TestMessSearchMessage.h" +//IMK #include "TestMessDeleteMessages.h" +//IMK #include "TestMessScheduleSendSMS.h" +//IMK #include "TestMessCancelScheduledSMS.h" +//IMK #include "TestMessVerifyScheduleSMS.h" +//IMK #include "TestMessBackupStore.h" +//IMK #include "TestMessRestoreStore.h" +//IMK #include "TestMessReceiveHeadersEmailPop.h" +//IMK #if (defined _PLATTEST_CDMA_) +//IMK #include "TestMessCreateCancelSms.h" +//IMK #endif + + +// EPOC includes +#include +#include +#include +#include + +/** + * @name Constant Literals used. + */ +/*@{*/ +/*@}*/ + + +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().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTestMessServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTestMessServer::NewL()); + if ( err==KErrNone ) + { + // 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; + } +#if (defined TRAP_IGNORE) + TRAP_IGNORE(MainL()); +#else + TRAPD(err,MainL()); +#endif + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + } + + +CTestMessServer* CTestMessServer::NewL() + { + CTestMessServer* server=new(ELeave) CTestMessServer(); + CleanupStack::PushL(server); + RProcess handle = RProcess(); + TParsePtrC serverName(handle.FileName()); + server->ConstructL(serverName.Name()); + CleanupStack::Pop(); + return server; + } + +CTestMessServer::CTestMessServer() +: CTestServer() +, iSharedData(NULL) + { + } + +void CTestMessServer::ConstructL(const TDesC& aName) + { + CTestServer::ConstructL(aName); + iSharedData=CTestMessSharedData::NewL(); + } + +CTestMessServer::~CTestMessServer() + { + delete iSharedData; + iSharedData=NULL; + } + +CSession2* CTestMessServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const +/** + * @param RMessage - RMessage for the session open + * Secure version + */ + { + CTestSession* session = new (ELeave) CTestMessSession(iSharedData); + CONST_CAST(CTestMessServer*,this)->IncSessionCount(); + return session; + } + +// constructor for ESOCK test suite +// this creates all the ESOCK test steps and +// stores them inside CTestSuiteEsock +CTestStep* CTestMessServer::CreateTestStep(const TDesC& aStepName) + { + CTestMessBase* testStep = NULL; + + if(aStepName == _L("CleanMessageFolder")) + { + testStep = new CTestMessCleanMessageFolder(); + } + else if(aStepName == _L("CreateSms")) + { + testStep = new CTestMessCreateSMS(); + } + else if(aStepName == _L("CreateSmsAccount")) + { + testStep = new CTestMessCreateSmsAccount(); + } + else if(aStepName == _L("SetSmsSc")) + { + testStep = new CTestMessSetDefaultSc(); + } + return testStep; +} + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessSession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessSession.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,50 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "TestMessSession.h" + +CTestMessSession::CTestMessSession(CTestMessSharedData* aSharedData) +: CTestSession() +, iSharedData(aSharedData) + { + } + + +void CTestMessSession::ServiceL(const RMessage2& aMessage) + { + CTestSession::ServiceL(aMessage); + switch(aMessage.Function()) + { + case EOpenTestStep : + { + } + break; + case ERunTestStep : + { + iSharedData->DoProcessL(); + } + break; + case EAbortTestStep : + { + } + break; + case ECloseTestStep : + { + } + break; + default: + break; + } + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessSetDefaultSC.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessSetDefaultSC.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,122 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 TestMessSetDefaultSc which sets an SMS +// SC as default SC. +// +// + +#include "TestMessSetDefaultSC.h" + +// EPOC includes +#include +#include +#include +#include +#include +#include + +_LIT(KSCName, "scname"); + +CTestMessSetDefaultSc::CTestMessSetDefaultSc() +: CTestMessBase(EFalse) + { + SetTestStepName(_L("SetSmsSc")); + } + +TVerdict CTestMessSetDefaultSc::doTestStepL() + { + // Printing to the console and log file + INFO_PRINTF1(_L("Set Default Service Center")); + + CSmsSettings* smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + SetEntryL(KMsvRootIndexEntryId); + + EntryL().SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=EntryL().ChildrenWithTypeL(KUidMsvServiceEntry); + CleanupStack::PushL(selection); + TInt count=selection->Count(); + TBool found=EFalse; + for (TInt i=count; i>0 && !found; ) + { + SetEntryL(selection->At(--i)); + + // Log child + if ( EntryL().Entry().iMtm == KUidMsgTypeSMS && + EntryL().Entry().iType == KUidMsvServiceEntry + ) + { + found=ETrue; + } + } + + if ( !found ) + { + ERR_PRINTF1(_L("No SMS Account found")); + SetTestStepResult(EFail); + } + + TName network; +//IMK TBool returnValue=(GetPhoneSmsNetworkL(network)==KErrNone); +TBool returnValue=false; //IMK + TPtrC ptrSCName(network); + + if ( !returnValue ) + { + returnValue=GetStringFromConfig(ConfigSection(), KSCName, ptrSCName); + } + if ( !returnValue ) + { + ERR_PRINTF1(_L("No SC specified in script/ini file")); + SetTestStepResult(EFail); + } + + INFO_PRINTF2(_L("SC Name = %S"), &ptrSCName); + + if ( TestStepResult()==EPass ) + { + CSmsAccount* smsAccount = CSmsAccount::NewLC(); + smsAccount->LoadSettingsL(*smsSettings); + const TInt numSCAddr = smsSettings->ServiceCenterCount(); + + if( !numSCAddr ) + { + ERR_PRINTF1(_L("No SC found")); + SetTestStepResult(EFail); + } + + TBool scFound = EFalse; + for( TInt index=0; (indexGetServiceCenter(index); + if( (scAddr.Name()).CompareF(ptrSCName) == 0) + { + smsSettings->SetDefaultServiceCenter(index); + smsAccount->SaveSettingsL(*smsSettings); + scFound = ETrue; + } + } + + if ( !scFound ) + { + ERR_PRINTF2(_L("%S NOT Found"), &ptrSCName); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(smsAccount); + } + CleanupStack::PopAndDestroy(2, smsSettings); + + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessSharedData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessSharedData.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,276 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessSharedData +// +// + +#include "TestMessSharedData.h" + +#include +#include +#include +#include + +_LIT(KName, "name"); + +CTestMessSharedData* CTestMessSharedData::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. + */ + { + CTestMessSharedData* sharedData = new (ELeave) CTestMessSharedData(); + CleanupStack::PushL(sharedData); + sharedData->ConstructL(); + CleanupStack::Pop(sharedData); + return sharedData; + } + +CTestMessSharedData::CTestMessSharedData() +: CBase() +, iSession(NULL) +, iMtmRegistry(NULL) +, iList(NULL) +, iAnyPostStepToDo(NULL) +, iDeleteTestStep(EFalse) + { + } + +void CTestMessSharedData::ConstructL() + { + iSession=CMsvSession::OpenSyncL(*this); + iMtmRegistry=CClientMtmRegistry::NewL(*iSession); + } + +CTestMessSharedData::~CTestMessSharedData() + { + while ( iList != NULL ) + { + CMsgEntry* entry=iList; + iList=iList->iNext; + delete entry; + } + delete iMtmRegistry; + iMtmRegistry=NULL; + delete iSession; + iSession=NULL; + } + +void CTestMessSharedData::DoProcessL() + { + if ( iAnyPostStepToDo != NULL ) + { + if (iDeleteTestStep) + { + iAnyPostStepToDo->DoCancelProcessL(); + iDeleteTestStep=EFalse; + } + else + { + iAnyPostStepToDo->DoProcessL(*iMtmRegistry); + } + iAnyPostStepToDo=NULL; + } + } + +void CTestMessSharedData::IMAP4ConnectAndSyncCompleteAfterDisconnectL(TUid aMtmId, TMsvId aMsvId, CTestStep& aStep) + { + iList=CMsgIMAP4ConnectAndSyncComplete::NewL(aMtmId, aMsvId, aStep, iList); + iAnyPostStepToDo=iList; + } + +TInt CTestMessSharedData::DeleteEntryL(CTestStep& aStep) + { + TInt ret=KErrNone; + TPtrC name; + + if ( !aStep.GetStringFromConfig(aStep.ConfigSection(), KName, name) ) + { + aStep.ERR_PRINTF1(_L("Name not found")); + aStep.SetTestStepResult(EFail); + ret=KErrArgument; + } + else + { + aStep.INFO_PRINTF2(_L("Name : %S"), &name); + + CMsgEntry* msgParent=NULL; + CMsgEntry* msgEntry=iList; + TBool found=EFalse; + + while ( (msgEntry!=NULL) && !found ) + { + if ( msgEntry->iName.Compare(name) == 0 ) + { + if ( msgParent!=NULL ) + { + msgParent->iNext=msgEntry->iNext; + } + else + { + iList=msgEntry->iNext; + } + iDeleteTestStep=ETrue; + iAnyPostStepToDo=msgEntry; + found=ETrue; + } + else + { + msgParent=msgEntry; + msgEntry=msgEntry->iNext; + } + } + + if ( !found ) + { + aStep.ERR_PRINTF1(_L("Message Entry not found")); + aStep.SetTestStepResult(EFail); + ret=KErrNotFound; + } + } + + return ret; + } + +CTestMessSharedData::CMsgEntry::CMsgEntry(CMsgEntry* aList) +: CActive(EPriorityStandard) +, iNext(aList) +, iReadyToBeDeleted(EFalse) + { + } + +void CTestMessSharedData::CMsgEntry::ConstructL(CTestStep& aStep) + { + TPtrC name; + + // Read in name tag + if ( !aStep.GetStringFromConfig(aStep.ConfigSection(), KName, name) ) + { + aStep.ERR_PRINTF1(_L("Name not found")); + aStep.SetTestStepResult(EFail); + } + else + { + aStep.INFO_PRINTF2(_L("Name : %S"), &name); + iName.Copy(name); + } + } + +CTestMessSharedData::CMsgEntry::~CMsgEntry() + { + } + +void CTestMessSharedData::CMsgEntry::DoCancel() + { + } + +void CTestMessSharedData::CMsgEntry::RunL() + { + iReadyToBeDeleted=ETrue; + } + +CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete* CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::NewL(TUid aMtmId, TMsvId aMsvId, CTestStep& aStep, CMsgEntry* aList) + { + CMsgIMAP4ConnectAndSyncComplete* self= new (ELeave) CMsgIMAP4ConnectAndSyncComplete(aMtmId, aMsvId, aList); + CleanupStack::PushL(self); + self->ConstructL(aStep); + CleanupStack::Pop(self); + return self; + } + +CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::CMsgIMAP4ConnectAndSyncComplete(TUid aMtmId, TMsvId aMsvId, CMsgEntry* aList) +: CMsgEntry(aList) +, iMtmId(aMtmId) +, iMsvId(aMsvId) +, iBaseMtm(NULL) +, iOperation(NULL) + { + } + +CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::~CMsgIMAP4ConnectAndSyncComplete() + { + if ( iOperation != NULL ) + { + delete iOperation; + iOperation=NULL; + } + delete iBaseMtm; + iBaseMtm=NULL; + } + +void CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::RunL() + { + CMsgEntry::RunL(); + delete iOperation; + iOperation=NULL; + delete iBaseMtm; + iBaseMtm=NULL; + + } + +void CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::DoProcessL(CClientMtmRegistry& aMtmRegistry) + { + iBaseMtm=aMtmRegistry.NewMtmL(iMtmId); + CActiveScheduler::Add(this); + + iBaseMtm->SwitchCurrentEntryL(iMsvId); + CMsvEntrySelection* selection=new (ELeave) CMsvEntrySelection(); + CleanupStack::PushL(selection); + selection->Reset(); + selection->AppendL(iMsvId); + selection->AppendL(iMsvId); // remote inbox + + TPckg parameter(this); + iOperation=iBaseMtm->InvokeAsyncFunctionL(KIMAP4MTMConnectAndSyncCompleteAfterDisconnect, *selection, parameter, iStatus); + CleanupStack::PopAndDestroy(selection); + SetActive(); + } + +void CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::DoCancelProcessL() + { + if ( iOperation != NULL ) + { + iOperation->Cancel(); + } + } + +void CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::HandleImapConnectionEvent(TImapConnectionEvent aConnectionEvent) + { + switch (aConnectionEvent) + { + /** Connecting to server. */ + case EConnectingToServer: + break; + /** Synchronising folder list. */ + case ESynchronisingFolderList: + break; + /** Synchronising inbox. */ + case ESynchronisingInbox: + break; + /** Synchronising folders. */ + case ESynchronisingFolders: + break; + /** Synchronisation complete. */ + case ESynchronisationComplete: + break; + /** Disconnecting. */ + case EDisconnecting: + break; + /** Connection completed. */ + case EConnectionCompleted: + break; + } + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessStoreProcessUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessStoreProcessUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,256 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessStoreProcessUtil. Base class process what is in the message store +// +// + +/** + @file TestMessStoreProcessUtil.cpp +*/ + +#include "TestMessStoreProcessUtil.h" + +// EPOC include +#include + +/** + * @name Constant Literals used. + */ +/*@{*/ +// Literal constants used for the character set +_LIT(KChineseGB2312, "ChineseGB2312"); +_LIT(KChineseHz, "ChineseHz"); +_LIT(KChineseBig5, "ChineseBig5"); +/*@}*/ + +CTestMessStoreProcessUtil::CTestMessStoreProcessUtil(CTestMessBase& aTestStep, TBool aReadOnly) +: CBase() +, iTestStep(aTestStep) +, iReadOnly(aReadOnly) + { + } + +/** + * Process the message entry + * @param TMsvId aMsvId - Id of message to edit + * @return TInt - return TErrNone if all worked + * +*/ +TInt CTestMessStoreProcessUtil::ProcessEntryL(TMsvId aMsvId) + { + TInt ret=KErrNone; + CMsvEntry* msvEntry=iTestStep.Session().GetEntryL(aMsvId); + CleanupStack::PushL(msvEntry); + + if ( msvEntry->HasStoreL() ) + { + CMsvStore* store=NULL; + if ( iReadOnly ) + { + store=msvEntry->ReadStoreL(); + } + else + { + store=msvEntry->EditStoreL(); + } + CleanupStack::PushL(store); + + RArray ids; + ids.Append(KUidMsgFileIMailHeader); + ids.Append(KUidMsgFileMimeHeader); + ids.Append(KUidMsgFileInternetAccessPreferences); + ids.Append(KUidMsvSMSHeaderStream); + ids.Append(KUidMsvDefaultServices); + ids.Append(KMsvEntryRichTextBody); + for ( TUint uidIndex=ids.Count(); uidIndex>0; ) + { + TUid uid=ids[--uidIndex]; + + if ( store->IsPresentL(uid) ) + { + if ( uid==KUidMsgFileIMailHeader ) + { + // Process the CImHeader info + ProcessImHeaderL(*store); + } + else if ( uid==KUidMsgFileMimeHeader ) + { + // Process the CImMimeHeader info + ProcessImMimeHeaderL(*store); + } + else if ( uid==KUidMsgFileInternetAccessPreferences ) + { + } + else if ( uid==KUidMsvSMSHeaderStream ) + { + // Process the CSmsHeader info + ProcessSmsHeaderStreamL(*store); + } + else if ( uid==KUidMsvDefaultServices ) + { + } + else if ( uid==KMsvEntryRichTextBody ) + { + // Process the CRichText info + ProcessRichTextBodyL(*store); + } + else + { + iTestStep.INFO_PRINTF2(_L("Cannot process %x"), uid.iUid); + } + } + } + + // Commit to the store + if ( !iReadOnly ) + { + store->CommitL(); + } + CleanupStack::PopAndDestroy(store); + } + + CleanupStack::PopAndDestroy(msvEntry); + + return ret; + } + +// Process the CImHeader information +void CTestMessStoreProcessUtil::ProcessImHeaderL(CMsvStore& aStore) + { + CImHeader* header=CImHeader::NewLC(); + TRAPD(err, header->RestoreL(aStore)); + + if ( err==KErrNone ) + { + ProcessImHeaderL(*header); + if ( !iReadOnly ) + { + header->StoreL(aStore); + } + } + + CleanupStack::PopAndDestroy(header); + } + +// Process the CImMimeHeader information +void CTestMessStoreProcessUtil::ProcessImMimeHeaderL(CMsvStore& aStore) + { + CImMimeHeader* header=CImMimeHeader::NewLC(); + TRAPD(err, header->RestoreL(aStore)); + + if ( err==KErrNone ) + { + ProcessImMimeHeaderL(*header); + if ( !iReadOnly ) + { + header->StoreL(aStore); + } + } + + CleanupStack::PopAndDestroy(header); + } + + +// Process the CSmsHeader information +void CTestMessStoreProcessUtil::ProcessSmsHeaderStreamL(CMsvStore& aStore) + { + CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL(); + CleanupStack::PushL(paraFormatLayer); + + CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); + CleanupStack::PushL(charFormatLayer); + + CRichText* bodyText=CRichText::NewL(paraFormatLayer, charFormatLayer); + CleanupStack::PushL(bodyText); + + CSmsHeader* header = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *bodyText); + CleanupStack::PushL(header); + + TRAPD(err, header->RestoreL(aStore)); + if ( err == KErrNone ) + { + ProcessSmsHeaderStreamL(*header); + if ( !iReadOnly ) + { + header->StoreL(aStore); + } + } + + CleanupStack::PopAndDestroy(4, paraFormatLayer); + } + + +// Process the CRichText information +void CTestMessStoreProcessUtil::ProcessRichTextBodyL(CMsvStore& aStore) + { + CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL(); + CleanupStack::PushL(paraFormatLayer); + + CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); + CleanupStack::PushL(charFormatLayer); + + CRichText* bodyText=CRichText::NewL(paraFormatLayer, charFormatLayer); + CleanupStack::PushL(bodyText); + + TRAPD(err, aStore.RestoreBodyTextL(*bodyText)); + if ( err == KErrNone ) + { + ProcessRichTextBodyL(*bodyText); + if ( !iReadOnly ) + { + aStore.StoreBodyTextL(*bodyText); + } + } + + CleanupStack::PopAndDestroy(3, paraFormatLayer); + } + +/** + * Saves the new character set to the message + * @param TPtrC aCharacterSetType - New Character set type to be stored for the received message + * @param TUint &aCharSetVal - character set value + * @return TBool + * @panic None + * @leave None + * +*/ +TBool CTestMessStoreProcessUtil::ValidCharacterSetInfo(const TPtrC& aCharacterSetType, TUint &aCharSetVal) + { + TBool hasSet = ETrue; + + if ( aCharacterSetType.Compare(KChineseGB2312) == 0 ) + { + iTestStep.INFO_PRINTF1(_L("Character set set to Chinese GB2312")); + aCharSetVal = KCharacterSetIdentifierGb2312; + } + else if (aCharacterSetType.Compare(KChineseHz) == 0) + { + iTestStep.INFO_PRINTF1(_L("Character set set to Chinese Hz")); + aCharSetVal = KCharacterSetIdentifierHz; + } + else if ( aCharacterSetType.Compare(KChineseBig5) == 0 ) + { + iTestStep.INFO_PRINTF1(_L("Character set set to Chinese Big5")); + aCharSetVal = KCharacterSetIdentifierBig5; + } + else + { + // To be updated later + hasSet= EFalse; + iTestStep.ERR_PRINTF2(_L("Character not supported in test code: %S"), &aCharacterSetType); + iTestStep.SetTestStepResult(EFail); + } + + return hasSet; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessTimer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,63 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessTimer.h +// This contains CTestMessTimer +// EPOC includes +// +// + +#include "TestMessTimer.h" +#include "TestMessProcessor.h" + +// +// Construction/Destruction +// + +CTestMessTimer* CTestMessTimer::NewL(TTimeIntervalMicroSeconds32 aInterval, CTestMessProcessor& aProcessor) + { + CTestMessTimer* self=new(ELeave) CTestMessTimer(aInterval, aProcessor); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CTestMessTimer::CTestMessTimer(TTimeIntervalMicroSeconds32 aInterval, CTestMessProcessor& aProcessor) +: CTimer(EPriorityStandard) +, iInterval(aInterval) +, iProcessor(aProcessor) + { + } + +void CTestMessTimer::ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + + +CTestMessTimer::~CTestMessTimer() + { + } + +void CTestMessTimer::RunL() + { + iProcessor.DisplayProgress(); + IssueRequest(); + }; + +void CTestMessTimer::IssueRequest() + { + After(iInterval); + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/Src/TestMessWatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/Src/TestMessWatcher.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessWatcher which starts the message watchers +// +// + +#include "TestMessWatcher.h" + +_LIT(KWatcherExe, "z:\\system\\libs\\watcher.exe"); + +CTestMessWatcher* CTestMessWatcher::NewL(TInt aPriority) + { + CTestMessWatcher* self = new (ELeave) CTestMessWatcher(aPriority); + CleanupStack::PushL(self); + + self->ConstructL(); + + CleanupStack::Pop(self); + return self; + } + +CTestMessWatcher::~CTestMessWatcher() + { + Cancel(); + iTimer.Close(); + if (iConstructed) + iWatcher.Kill(KErrNone); + + iWatcher.Close(); + } + +CTestMessWatcher::CTestMessWatcher(TInt aPriority) +: CActive(aPriority) +, iConstructed(EFalse) + { + CActiveScheduler::Add(this); + } + +void CTestMessWatcher::ConstructL() + { + TInt ret=iWatcher.Create(KWatcherExe, KNullDesC); + switch ( ret ) + { + case KErrNone: + iWatcher.Resume(); + iConstructed = ETrue; + case KErrAlreadyExists: + break; + default: + User::Leave(ret); + } + } + +void CTestMessWatcher::RunL() + { + } + +void CTestMessWatcher::DoCancel() + { + iTimer.Cancel(); + iStatus=KErrCancel; + } diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/TestData/Smoketest_Mess.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/TestData/Smoketest_Mess.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,751 @@ +[default] +smsto=07769588944 +smsbearer=NBS +smsencoding=7 +smsDeliveryReport=NO +mmsto=07769588944 +mmsDeliveryReport=NO +progress=120 + +[19101_RootFolder] +depth=0 + +[27030_SmsO2Account] +scname=O2 +scnumber=+447802000332 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[27031_SmsOrangeAccount] +scname=Orange +scnumber=+447973100973 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[27032_SmsTMobileAccount] +scname=TMobile +scnumber=+447958879879 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[27029_SmsVodafoneAccount] +scname=Vodafone +scnumber=+447785016005 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[21770_SmsAirtelAccount] +MessageBearerType=CDMA +scname=Airtel +scnumber=919845087001 +SmsRejectDuplicate=TRUE +SmsReplyPath=TRUE +SmsConCatenate=TRUE +SmsDeliveryReport=TRUE +SmsReplyQuoted=TRUE + +[SmsHutchAccount] +scname=Hutch +scnumber=919886005444 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[28206_MmsAccount] +accountname=Multimedia Messaging +serveraddr=http://10.22.64.20 +fromaddr=07769588944 +automaticfetch=TRUE +iap=14 + +[27028_ImapAccount] +accountname=smoketest Imap Account +myname=Symbian smoketest +username=mdgi15 +password=vethihiz +emailaddress=mdgi15@dial.pipex.com +outserver=smtp.dial.pipex.com +inserver=imap.dial.pipex.com +SyncRate=120 +iap=6 + +[27027_PopAccount] +accountname=smoketest Pop Account +myname=Symbian smoketest +username=mdgi15 +password=vethihiz +emailaddress=mdgi15@dial.pipex.com +outserver=smtp.dial.pipex.com +inserver=pop.dial.pipex.com +iap=6 + +[21558_ImapAccountAuth] +accountname=smoketest ImapAuth Account +myname=Symbian smoketest +username=mailtst1 +password=mailtest1 +auth=TRUE +authUserName=mailtst1 +authPassword=mailtest1 +emailaddress=mailtst1@trmai01.it.cellulardata.com +outserver=trmai01.it.cellulardata.com +inserver=cyrus.cellulardata.com +iap=7 + +[27035_PopAccountAuth] +accountname=smoketest PopAuth Account +myname=Symbian smoketest +username=mailtst1 +password=mailtest1 +auth=TRUE +authUserName=mailtst1 +authPassword=mailtest1 +emailaddress=mailtst1@trmai01.it.cellulardata.com +outserver=trmai01.it.cellulardata.com +inserver=cyrus.cellulardata.com +iap=7 + +[28381_ImapAccountSSL] +accountname=smoketest ImapSSL Account +myname=Symbian smoketest +username=mailtst1 +password=mailtest1 +auth=TRUE +sslwrapper=yes +sslport=993 +authUserName=mailtst1 +authPassword=mailtest1 +emailaddress=mailtst1@trmai01.it.cellulardata.com +outserver=trmai01.it.cellulardata.com +inserver=cyrus.cellulardata.com +iap=7 + +[28382_PopAccountSSL] +accountname=smoketest PopSSL Account +myname=Symbian smoketest +username=mailtst1 +password=mailtest1 +auth=TRUE +sslwrapper=yes +sslport=995 +authUserName=mailtst1 +authPassword=mailtest1 +emailaddress=mailtst1@trmai01.it.cellulardata.com +outserver=trmai01.it.cellulardata.com +inserver=cyrus.cellulardata.com +iap=7 + +[27027_VodafoneGprsAccount] +accountname=Vodafone Gprs Account +myname=Symbian smoketest +username=mdgi15 +password=vethihiz +emailaddress=mdgi15@dial.pipex.com +outserver=smtp.vizzavi.co.uk +inserver=pop.dial.pipex.com +iap=13 + +[o2GprsAccount] +accountname=O2 Gprs Account +myname=Symbian smoketest +username=mdgi15 +password=vethihiz +emailaddress=mdgi15@dial.pipex.com +outserver=smtp.o2.co.uk +inserver=pop.dial.pipex.com +iap=17 + +[MmsCount01] +count=7 +depth=2 +folder1=Local +folder2=Inbox + +[MmsMessage01] +from=Multimedia Messaging +subject=mms test1 +priority=high + +textmimetype1=text/plain +textfile1=c:\autosmoketest\Mms\Message1.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +[MmsMessage02] +from=Multimedia Messaging +subject=mms test2 +priority=high + +textmimetype1=text/plain +textfile1=c:\autosmoketest\Mms\Message2.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +imgmimetype1=image/gif +imgfile1=c:\autosmoketest\Mms\Image2.gif +imgmimeheaders1=1 +imgmimeheader1name1=content-type +imgmimeheader1type1=image/gif + +[MmsMessage03] +from=Multimedia Messaging +subject=mms test3 +priority=high + +textmimetype1=text/plain +textfile1=c:\autosmoketest\Mms\Message3.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +imgmimetype1=image/gif +imgfile1=c:\autosmoketest\Mms\Image3.gif +imgmimeheaders1=1 +imgmimeheader1name1=content-type +imgmimeheader1type1=image/gif + +audiomimetype1=audio/basic +audiofile1=c:\autosmoketest\Mms\Audio3.wav +audiomimeheaders1=1 +audiomimeheader1name1=content-type +audiomimeheader1type1=audio/basic + +[MmsMessage04] +from=Multimedia Messaging +subject=mms test4 +priority=high +slides=2 + +textmimetype1=text/plain +textfile1=c:\autosmoketest\Mms\Message4.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +imgmimetype2=image/gif +imgfile2=c:\autosmoketest\Mms\Image4.gif +imgmimeheaders2=1 +imgmimeheader2name1=content-type +imgmimeheader2type1=image/gif + +[MmsMessage05] +from=Multimedia Messaging +subject=mms test5 +priority=high +slides=2 + +textmimetype1=text/plain +textfile1=c:\autosmoketest\Mms\Message5.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +imgmimetype2=image/gif +imgfile2=c:\autosmoketest\Mms\Image5.gif +imgmimeheaders2=1 +imgmimeheader2name1=content-type +imgmimeheader2type1=image/gif + +audiomimetype2=audio/basic +audiofile2=c:\autosmoketest\Mms\Audio5.wav +audiomimeheaders2=1 +audiomimeheader2name1=content-type +audiomimeheader2type1=audio/basic + +[MmsMessage06] +from=Multimedia Messaging +subject=mms test6 +priority=high +slides=3 + +textmimetype1=text/plain +textfile1=c:\autosmoketest\Mms\Message6.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +audiomimetype2=audio/basic +audiofile2=c:\autosmoketest\Mms\Audio6.wav +audiomimeheaders2=1 +audiomimeheader2name1=content-type +audiomimeheader2type1=audio/basic + +imgmimetype3=image/gif +imgfile3=c:\autosmoketest\Mms\Image6.gif +imgmimeheaders3=1 +imgmimeheader3name1=content-type +imgmimeheader3type1=image/gif + +[27584_SmsMessage01] +recipients=2 +body=c:\autosmoketest\Sms\Message1.txt + +[27596_SmsMessage02] +body=c:\autosmoketest\Sms\Message2.txt + +[27587_SmsMessage03] +body=c:\autosmoketest\Sms\Message3.txt +encoding=8 + +[27589_SmsMessage04] +body=c:\autosmoketest\Sms\Message4.txt +DeliveryReport=NO + +[27591_SmsMessage05] +body=c:\autosmoketest\Sms\Message5.txt + +[27593_SmsMessage06] +body=c:\autosmoketest\Sms\Message6.txt +encoding=8 +scheduled=120 + +[27577_SmsSend01] +text=This message is going + +[20388_SmsSend02] +text=Hello, this is a plain + +[20389_SmsSend03] +text=Hello, this is a 8-bit + +[20390_SmsSend04] +text=No status report requested + +[20392_SmsSend05] +text=A big message to ya! + +[20391_SmsSend06] +text=This is a big 8-bit + +[27595_SmsCount01] +count=7 +depth=2 +folder1=Local +folder2=Inbox + +[27033_PopMessage01] +from=smoketest Pop Account +to=mdgi15@dial.pipex.com +subject=PopMessage01 +body=c:\autosmoketest\EMail\PopTestMsg01.txt +priority=high +count=1 +depth=2 +folder1=smoketest Pop Account +folder2=PopMessage01 + +[27044_PopMessage02] +from=smoketest Pop Account +to=mdgi15@dial.pipex.com +subject=PopMessage02 +body=c:\autosmoketest\EMail\PopTestMsg02.txt +priority=low +attachments=1 +attachment1=c:\autosmoketest\EMail\Attachment01.txt +count=2 +depth=3 +folder1=smoketest Pop Account +folder2=PopMessage02 + +[27040_PopMessage03] +from=smoketest Pop Account +to=mdgi15@dial.pipex.com +subject=PopMessage03 +body=c:\autosmoketest\EMail\PopTestMsg03.txt +priority=low +attachments=3 +attachment1=c:\autosmoketest\EMail\Attachment02.txt +attachment2=c:\autosmoketest\EMail\Attachment02.txt +attachment3=c:\autosmoketest\EMail\Attachment02.txt +count=4 +depth=3 +folder1=smoketest Pop Account +folder2=PopMessage03 + +[19103_PopMessage04] +from=smoketest Pop Account +to=mdgi15@dial.pipex.com +subject=PopMessage04 +body=c:\autosmoketest\EMail\PopTestMsg04.txt +priority=low +attachments=2 +attachment1=c:\autosmoketest\EMail\Attachment01.txt +attachment2=c:\autosmoketest\EMail\Typhoon.zip +count=3 +depth=3 +folder1=smoketest Pop Account +folder2=PopMessage04 + +[27041_PopBox01] +from=smoketest Pop Account + +[28111_PopSend01] +subject=PopMessage01 + +[28112_PopSend02] +subject=PopMessage02 + +[28114_PopSend03] +subject=PopMessage03 + +[28113_PopSend04] +subject=PopMessage04 + +[19102_PopCount01] +count=4 +depth=1 +folder1=smoketest Pop Account + +[19102_PopCount01_MadcowSanity] +count=3 +depth=1 +folder1=smoketest Pop Account + +[28360_ImapMessage01] +from=smoketest Imap Account +to=mdgi15@dial.pipex.com +subject=ImapMessage01 +body=c:\autosmoketest\EMail\PopTestMsg01.txt +priority=high +count=0 +depth=3 +folder1=smoketest Imap Account +folder2=Inbox +folder3=ImapMessage01 + +[28361_ImapMessage02] +from=smoketest Imap Account +to=mdgi15@dial.pipex.com +subject=ImapMessage02 +body=c:\autosmoketest\EMail\PopTestMsg02.txt +priority=low +attachments=1 +attachment1=c:\autosmoketest\EMail\Attachment01.txt +count=0 +depth=3 +folder1=smoketest Imap Account +folder2=Inbox +folder3=ImapMessage02 + +[28362_ImapMessage03] +from=smoketest Imap Account +to=mdgi15@dial.pipex.com +subject=ImapMessage03 +body=c:\autosmoketest\EMail\PopTestMsg03.txt +priority=low +attachments=3 +attachment1=c:\autosmoketest\EMail\Attachment02.txt +attachment2=c:\autosmoketest\EMail\Attachment02.txt +attachment3=c:\autosmoketest\EMail\Attachment02.txt +count=0 +depth=3 +folder1=smoketest Imap Account +folder2=Inbox +folder3=ImapMessage03 + +[28363_ImapMessage04] +from=smoketest Imap Account +to=mdgi15@dial.pipex.com +subject=ImapMessage04 +body=c:\autosmoketest\EMail\PopTestMsg04.txt +priority=low +attachments=2 +attachment1=c:\autosmoketest\EMail\Attachment01.txt +attachment2=c:\autosmoketest\EMail\Typhoon.zip +count=0 +depth=3 +folder1=smoketest Imap Account +folder2=Inbox +folder3=ImapMessage04 + +[19104_ImapBox01] +name=imapsync +from=smoketest Imap Account +depth=1 +folder1=Inbox + +[28118_ImapSend01] +subject=ImapMessage01 + +[28117_ImapSend02] +subject=ImapMessage02 + +[28115_ImapSend03] +subject=ImapMessage03 + +[28116_ImapSend04] +subject=ImapMessage04 + +[28359_ImapCount01] +count=4 +depth=2 +folder1=smoketest Imap Account +folder2=Inbox + +[28359_ImapCount01MadcowSanity] +count=3 +depth=2 +folder1=smoketest Imap Account +folder2=Inbox + +[27048_PopMessage06] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage06 +body=c:\autosmoketest\EMail\PopTestMsg06.txt +priority=high +count=1 +depth=2 +folder1=smoketest PopAuth Account +folder2=PopMessage06 + +[28364_PopMessage07] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage07 +body=c:\autosmoketest\EMail\PopTestMsg07.txt +priority=low +attachments=1 +attachment1=c:\autosmoketest\EMail\Attachment01.txt +count=2 +depth=3 +folder1=smoketest PopAuth Account +folder2=PopMessage07 + +[28365_PopMessage08] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage08 +body=c:\autosmoketest\EMail\PopTestMsg08.txt +priority=low +attachments=3 +attachment1=c:\autosmoketest\EMail\Attachment02.txt +attachment2=c:\autosmoketest\EMail\Attachment02.txt +attachment3=c:\autosmoketest\EMail\Attachment02.txt +count=4 +depth=3 +folder1=smoketest PopAuth Account +folder2=PopMessage08 + +[28366_PopMessage09] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage09 +body=c:\autosmoketest\EMail\PopTestMsg09.txt +priority=low +attachments=2 +attachment1=c:\autosmoketest\EMail\Attachment01.txt +attachment2=c:\autosmoketest\EMail\Typhoon.zip +count=3 +depth=3 +folder1=smoketest PopAuth Account +folder2=PopMessage09 + +[28394_PopMessage10] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage10 +body=c:\autosmoketest\EMail\PopTestMsg06.txt +priority=high +count=1 +depth=2 +folder1=smoketest PopAuth Account +folder2=PopMessage10 + +[28395_PopMessage11] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage11 +body=c:\autosmoketest\EMail\PopTestMsg08.txt +priority=low +attachments=3 +attachment1=c:\autosmoketest\EMail\Attachment02.txt +attachment2=c:\autosmoketest\EMail\Attachment02.txt +attachment3=c:\autosmoketest\EMail\Attachment02.txt +count=4 +depth=3 +folder1=smoketest PopAuth Account +folder2=PopMessage11 + +[27043_PopBox02] +from=smoketest PopAuth Account + +[21560_PopSend06] +subject=PopMessage06 + +[27042_PopSend07] +subject=PopMessage07 + +[27039_PopSend08] +subject=PopMessage08 + +[28367_PopSend09] +subject=PopMessage09 + +[28396_PopSend10] +subject=PopMessage10 + +[28397_PopSend11] +subject=PopMessage11 + +[28368_PopCount02] +count=4 +depth=1 +folder1=smoketest PopAuth Account + +[28373_ImapMessage06] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage06 +body=c:\autosmoketest\EMail\PopTestMsg06.txt +priority=high +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage06 + +[28374_ImapMessage07] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage07 +body=c:\autosmoketest\EMail\PopTestMsg07.txt +priority=low +attachments=1 +attachment1=c:\autosmoketest\EMail\Attachment01.txt +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage07 + +[28375_ImapMessage08] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage08 +body=c:\autosmoketest\EMail\PopTestMsg08.txt +priority=low +attachments=3 +attachment1=c:\autosmoketest\EMail\Attachment02.txt +attachment2=c:\autosmoketest\EMail\Attachment02.txt +attachment3=c:\autosmoketest\EMail\Attachment02.txt +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage08 + +[28376_ImapMessage09] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage09 +body=c:\autosmoketest\EMail\PopTestMsg09.txt +priority=low +attachments=2 +attachment1=c:\autosmoketest\EMail\Attachment01.txt +attachment2=c:\autosmoketest\EMail\Typhoon.zip +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage09 + +[28387_ImapMessage10] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage10 +body=c:\autosmoketest\EMail\PopTestMsg06.txt +priority=high +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage10 + +[28388_ImapMessage11] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage11 +body=c:\autosmoketest\EMail\PopTestMsg08.txt +priority=low +attachments=3 +attachment1=c:\autosmoketest\EMail\Attachment02.txt +attachment2=c:\autosmoketest\EMail\Attachment02.txt +attachment3=c:\autosmoketest\EMail\Attachment02.txt +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage11 + +[27037_ImapBox02] +from=smoketest ImapAuth Account +depth=1 +folder1=Inbox + +[27036_ImapSend06] +subject=ImapMessage06 + +[28377_ImapSend07] +subject=ImapMessage07 + +[28378_ImapSend08] +subject=ImapMessage08 + +[28379_ImapSend09] +subject=ImapMessage09 + +[28389_ImapSend10] +subject=ImapMessage10 + +[28390_ImapSend11] +subject=ImapMessage11 + +[28380_ImapCount02] +count=4 +depth=2 +folder1=smoketest ImapAuth Account +folder2=Inbox + +[28398_PopBox03] +from=smoketest PopSSL Account + +[28399_PopCount03] +count=2 +depth=1 +folder1=smoketest PopSSL Account + +[28391_ImapBox03] +from=smoketest ImapSSL Account +depth=1 +folder1=Inbox + +[28392_ImapCount03] +count=2 +depth=2 +folder1=smoketest ImapSSL Account +folder2=Inbox + +[28383_HangUpPipex] +iap=6 + +[28384_HangUpNokia] +iap=7 + + diff -r 000000000000 -r 9736f095102e buildverification/autosmoketest/messaging/TestData/Sms/Message1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/autosmoketest/messaging/TestData/Sms/Message1.txt Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,1 @@ +This message is going to my two buddies \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/FileRead.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/FileRead.pm Tue Jan 26 15:16:33 2010 +0200 @@ -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: +# + +#!/usr/bin/perl -w +package FileRead; +use strict; +########################################################################## +# +# Name : file_read() +# Synopsis: Reads in the contents of a file into an array +# Inputs : Filename +# Outputs : array +# +########################################################################## +sub file_read +{ + my ($filename) = @_; + + local($/) = undef; + local(*FILE); + + open(FILE, "<$filename") || die "open $filename: $!"; + my @slurparr = ; + close(FILE) || die "close $filename: $!"; + + return $slurparr[0]; +} + +1; \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/8.0a/configuration.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/8.0a/configuration.cfg Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ +// Copyright (c) 2004-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: +// Version 8.0a +// +// + +#if !defined (CONFIGURATION_CFG) +#define CONFIGURATION_CFG + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/8.0b/configuration.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/8.0b/configuration.cfg Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ +// Copyright (c) 2004-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: +// Version 8.0b +// +// + +#if !defined (CONFIGURATION_CFG) +#define CONFIGURATION_CFG + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/8.1a/configuration.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/8.1a/configuration.cfg Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ +// Copyright (c) 2004-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: +// Version 8.1a +// +// + +#if !defined (CONFIGURATION_CFG) +#define CONFIGURATION_CFG + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/8.1b/configuration.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/8.1b/configuration.cfg Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ +// Copyright (c) 2004-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: +// Version 8.1b +// +// + +#if !defined (CONFIGURATION_CFG) +#define CONFIGURATION_CFG + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/9.0/configuration.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/9.0/configuration.cfg Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ +// Copyright (c) 2004-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: +// Version 9.0 +// +// + +#if !defined (CONFIGURATION_CFG) +#define CONFIGURATION_CFG + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/9.1/configuration.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/9.1/configuration.cfg Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ +// Copyright (c) 2004-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: +// Version 9.1 +// +// + +#if !defined (CONFIGURATION_CFG) +#define CONFIGURATION_CFG + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,32 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 automated smoketest +// +// + +#include "../Utils/group/bld.inf" +#include "../agenda/Group/bld.inf" +#include "../contacts/group/bld.inf" +#include "../messaging/Group/bld.inf" +#include "../Timew/Group/bld.inf" +#include "../SyncMLApp/group/bld.inf" +#include "../Phone/group/bld.inf" +#include "../System/Group/bld.inf" + +PRJ_TESTEXPORTS +../autorom/autoexec.bat /epoc32/release/winscw/udeb/z/smoketest/autoexec.bat +../autorom/dummytest.txt /epoc32/release/winscw/udeb/z/smoketest/dummytest.txt +../autorom/smoketests.bat /epoc32/release/winscw/udeb/z/smoketest/smoketests.bat +../autorom/smoketests.oby /epoc32/rom/include/smoketests.oby + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/configuration.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/configuration.cfg Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ +// Copyright (c) 2004-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: +// Version 8.1b +// +// + +#if !defined (CONFIGURATION_CFG) +#define CONFIGURATION_CFG + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/testtools_smoketest.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/testtools_smoketest.history.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Group/testtools_smoketest.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Group/testtools_smoketest.mrp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +# + +component testtools_smoketest +source \sf\app\techview\buildverification\smoketest +exports \sf\app\techview\buildverification\smoketest\Group +# binary \sf\app\techview\buildverification\smoketest\group all + +notes_source \component_defs\release.src + +ipr T + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Phone/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Phone/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,27 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 phone app smoketest +// +// + +PRJ_EXPORTS + +// For testexecute on eka2 emulators +../scripts/smoketest_phone.script /epoc32/release/wins/udeb/z/smoketest/smoketest_phone.script +../scripts/smoketest_phone.script /epoc32/release/wins/urel/z/smoketest/smoketest_phone.script +../scripts/smoketest_phone.script /epoc32/release/winscw/udeb/z/smoketest/smoketest_phone.script +../scripts/smoketest_phone.script /epoc32/release/winscw/urel/z/smoketest/smoketest_phone.script + +PRJ_MMPFILES + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Phone/scripts/smoketest_phone.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Phone/scripts/smoketest_phone.script Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,19 @@ +// +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 phone app for 10 seconds +// +RUN_WS_PROGRAM 10 z:\sys\bin\phone.exe diff -r 000000000000 -r 9736f095102e buildverification/smoketest/SmokeTest.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/SmokeTest.pm Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,434 @@ +# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# SmokeTestSuite.pm +# The SmokeTestSuite package contains subroutines that are needed to build a +# testdriver test suite. +# This script was born on 18/04/2005 +# +# + +#!/usr/bin/perl -w +package SmokeTest; +use SmokeTestROM; +use SmokeTestSuite; +use FindBin; +use lib "$FindBin::Bin\\..\\..\\generic\\utils\\GenResult\\"; +use FileRead; #Need to include a Findbin::path +use strict; + +# +# Global Variables +# +our $BuildDir = $ENV{'BuildDir'}; # usually M: +our $serverpool = $ENV{'SmokeTestServerPool'}; +our $buildNo = $ENV{'BuildShortName'}; # Eg. 9.1 +# The Client is run from the dir where SmokeTestClient.pl is located +# This is to ensure that any ROMs and test packages created are stored there. +our $sourceDir = "$BuildDir\\src\\common\\testtools"; +our $TestSuite = "SmokeTest"; +our $SmokeTestDir; +our $NandDir; +our $TestDriverLocation = "\\epoc32\\tools\\TDEP"; # location for TD zips +our $TestDriverDrive = "M:"; +our $TestDriverCmd = "$TestDriverDrive\\testdriver\\testdriver.cmd"; +our $TestDriverXML; + +# Publish details +our $PublishServer = $ENV{'PublishLocation'}; +our $ProductType = $ENV{'Type'}; +our $BuildNum = $ENV{'BuildNumber'}; +our $LogsDir = $ENV{'LogsDir'}; + +# Epocwind.out +my $tempDirLocation = $ENV{'TEMP'}; + +# +# CheckVars: ensures that the essential environment vars and directories exist +# +sub CheckVars +{ + print "\n** Settings **\n"; + print "Build Drive = $BuildDir\n"; + print "Smoke Test Server Pool = $serverpool\n"; + print "Build Product = $buildNo\n"; + print "TestDriver Zip Location = $TestDriverLocation\n"; + print "TestDriver XML Location = $TestDriverXML\n"; + print "TestDriver Source Location = $sourceDir\n"; + print "TestDriver Drive = $TestDriverDrive\n"; + print "SmokeTest working directory= $SmokeTestDir\n"; + print "NAND build directory = $NandDir\n"; + + print "\n** Publishing Information **\n"; + + print "Publish server = $PublishServer\n"; + print "Product Type = $ProductType\n"; + print "Build Number = $BuildNum\n"; + + DieLog("CheckVars: \"Build Directory\" not defined") if !defined $BuildDir; + DieLog("CheckVars: \"Smoke Test Server Pool\" not defined") if !defined $serverpool; + DieLog("CheckVars: \"Build Product\" not defined") if !defined $buildNo; + DieLog("CheckVars: \"Publish server\" not defined") if !defined $PublishServer; + DieLog("CheckVars: \"Product Type\" not defined") if !defined $ProductType; + DieLog("CheckVars: \"Build Number\" not defined") if !defined $BuildNum; + DieLog("CheckVars: Directory \"SmokeTest working directory\" does not exist") if ! -e $SmokeTestDir; + DieLog("CheckVars: Directory \"TestDriver Zip Location\" does not exist") if ! -e $TestDriverLocation; +} + +sub main +{ + print "\n\n*** START OF SMOKE TEST ***\n\n"; + + PrintDateTime(); + + my ($iSourceDir, $iTestSuite, $iProduct, $iServerPool, $iProductType, + $iPublishLocation, $iBuildNumber, $iXML, $iUnzip, $iBuildDrive, $iTDDrive) = @_; + + $TestSuite = $iTestSuite if defined $iTestSuite; + $BuildDir = $iBuildDrive if defined $iBuildDrive; + $sourceDir = $BuildDir.$iSourceDir if defined $iSourceDir; + $buildNo = $iProduct if defined $iProduct; + $serverpool = $iServerPool if defined $iServerPool; + $ProductType = $iProductType if defined $iProductType; + $PublishServer = $iPublishLocation if defined $iPublishLocation; + $BuildNum = $iBuildNumber if defined $iBuildNumber; + $TestDriverDrive = $iTDDrive if defined $iTDDrive; + + $SmokeTestDir = "$sourceDir\\$TestSuite"; + if (defined $iXML) + { + $TestDriverXML = $iXML; + } + else + { + $TestDriverXML = $SmokeTestDir."\\xml"; + } + $NandDir = "$BuildDir\\src\\cedar\\generic\\base\\e32\\rombuild"; + + CheckVars(); + + # change dir to Smoketest dir + chdir "$SmokeTestDir" or DieLog("Can't cd to $SmokeTestDir"); + + # unzip latest version of TD + if (defined $iUnzip) + { + unpackTestDriver2(); + } + + # configure TD + configureTestDriver2(); + + # + # Copy the correct configuration.cfg file + # But such source only exists for these products: 8.0a, 8.0b, 8.1a, 8.1b, 9.0, 9.1 + # + print "\n#\n# Copy the correct configuration.cfg file\n#\n"; + ExecCommand("COPY /Y $SmokeTestDir\\Group\\$buildNo\\configuration.cfg $SmokeTestDir\\Group\\configuration.cfg"); + + #Read in hash of smoketests to be run for each product. + my ($iCfgFileLocation) = "$FindBin::Bin\\..\\..\\generic\\utils\\GenResult"; + + #Read in the smoketest list from a cfg file + my $text = &FileRead::file_read ("$iCfgFileLocation\\Product.cfg"); + #Search for an entry matching (At the beginning of line there should be 1 or more alphanumberic chars + #Followed by a "."(optional to allow codenames) followed by more alphanumberic chars followed by 0 or more spaces then an = then 0 + #or more spaces then any amount of chars till the end of the line. + #8.1b = EMULATOR_WINSCW ARM4_LUBBOCK ARMV5_LUBBOCK + my %iProducts = $text =~ /^\s*(\w+\.?\w+)\s*=\s*(.+)$/mg ; + + #Get the list of platforms to be smoketested for the product. + #Need to turn the hash value into an array using split + my @iPlatforms = split (/ /,$iProducts{$buildNo}); + #Build and Execute Test package for each platform as read from configuration file and create and zip rom. + ProcessPlatforms (@iPlatforms); + + # + # Build Test Package for ROMs + # + if ($buildNo eq '8.1a' || $buildNo eq '8.1b') + { + &SmokeTestSuite::BuildAndPackage("ARM4"); + } + + if ($buildNo ne '8.1a') + { + &SmokeTestSuite::BuildAndPackage("ARMv5"); + } + + # + # Find out which server to use + # + print "\n#\n# Find out which server to use\n#\n"; + ProcessPlatformsforSmoketest(@iPlatforms); + + # + # End of Smoke Test + # + print "\n\n*** END OF SMOKE TEST ***\n\n"; +} + +# +# DieLog: Exits script and inserts a Remark in the build log, which will be picked up by htmlscanlog +# +sub DieLog +{ + die "\nREMARK: $_[0]\n $!\n\n\n"; +} + + +# +# Build and publish based on entries in the Product.cfg file +# +sub ProcessPlatforms +{ + +my $i = 0; +my @temp; +my @iPlatforms = @_; + +foreach my $platform (@iPlatforms) + { + undef @temp; + @temp = split (/_/,$iPlatforms[$i]); + $i++; + + if( $temp[0] eq "EMULATOR") + { + &SmokeTestSuite::BuildAndPublish("$temp[1]"); + CheckPlatsecErrors("$temp[1]"); + } + else + { + + if(3 == scalar(@temp)) # there are 3 arguments, so this will be a NAND ROM + { + if((lc($temp[1]) eq "h4hrp") && (lc($temp[2]) eq "nand\(dp\)" )) # H4HRP Demand Paging ROM options is -D_NAND2 + { + &SmokeTestROM::CreateAndZipROM("$temp[0]", "$temp[1]", "pagedrom", "PlatSec", "$buildNo", "-D_NAND2" ); + } + elsif((lc($temp[1]) eq "h4hrp") && (lc($temp[2]) eq "nand" )) # H4 options is -D_NAND2 + { + &SmokeTestROM::CreateAndZipROM("$temp[0]", "$temp[1]", "-DRVCT", "PlatSec", "$buildNo", "-D_NAND2"); + } + elsif(lc($temp[1]) eq "h2") # H2 options is -D_NAND# H2 option is NAND2 due to CR 0844 (Both H2 and H4 use -D_NAND2) + { + &SmokeTestROM::CreateAndZipROM("$temp[0]", "$temp[1]", "-DRVCT", "PlatSec", "$buildNo", "-D_NAND2"); + } + else # Bad option entered + { + die "SmokeTest::ProcessPlatforms error: invalid board type entered: $temp[1]. Check that Product.cfg is correct.\n"; + } + } + else # This is the NOR ROM. + { + &SmokeTestROM::CreateAndZipROM("$temp[0]", "$temp[1]", "-DRVCT", "PlatSec", "$buildNo"); + } + } + + } + +} + +# +# Build and publish based on entries in the Product.cfg file +# +sub ProcessPlatformsforSmoketest +{ + +my $i = 0; +my @temp; +my @iPlatforms = @_; + +foreach my $platform (@iPlatforms) + { + undef @temp; + @temp = split (/_/,$iPlatforms[$i]); + $i++; + if( $temp[0] eq "EMULATOR") + { + next; + } + my $mServ = &SmokeTestSuite::PollServers("$temp[1]"); + unless (defined $mServ) + { + next; + } + if(3 == scalar(@temp)) + { + if(lc($temp[2]) eq "nand\(dp\)" ) + { + &SmokeTestSuite::RunRemote("$temp[0]", "$temp[1]", $mServ, "NAND\(DP\)\\"); + } + elsif(lc($temp[2]) eq "nand") + { + &SmokeTestSuite::RunRemote("$temp[0]", "$temp[1]", $mServ, "NAND\\"); + } + } + else + { + &SmokeTestSuite::RunRemote("$temp[0]", "$temp[1]", $mServ); + } + } +} + +# +# Check for platsec errors - checks the epocwind.out on build machine +# +sub CheckPlatsecErrors +{ + print "\n"; + print "#\n# Check for platsec errors\n#\n"; + print "\n"; + PrintDateTime(); + + # open epocwind.out and parse for both errors and warnings + open EPOCWIND, "$tempDirLocation\\epocwind.out" or print "\nERROR: Cannot open EPOCWIND.OUT\n"; + my @epocWind = ; + close EPOCWIND; + + foreach my $tempEW (@epocWind) + { + if ($tempEW =~ m/(\*PlatSec\* ERROR)(.*)/i) + { + print "\nERROR: $_[0] - $1$2"; + } + elsif ($tempEW =~ m/(\*PlatSec\* WARNING)(.*)/i) + { + print "\nWARNING: $_[0] - $1$2"; + } + } +} + +# +# Take TestDriver and unpack into a given location. +# +sub unpackTestDriver2() +{ + # + # Unzip TestDriver + # + print "\n#\n# Unzip TestDriver\n#\n"; + PrintDateTime(); + + # first remove the "old" version of test driver + print "\n"; + ExecCommand("RMDIR $TestDriverDrive\\testdriver\\ /Q /S"); + + # now unzip the latest version of testdriver which has been synced down + ExecCommand("%EPOCROOT%epoc32\\tools\\unzip.exe $TestDriverLocation\\TestDriver2.zip -d $TestDriverDrive\\testdriver\\"); + + # now copy the latest version of testdriver_new.cmd which has been obtained + ExecCommand("COPY \\\\builds01\\devbuilds\\buildteam\\testdriverv2\\testdriver_new.cmd $TestDriverCmd"); + + # now copy the latest version of logging.properties which has been obtained + ExecCommand("COPY \\\\builds01\\devbuilds\\buildteam\\testdriverv2\\logging.properties $TestDriverDrive\\testdriver\\"); + + # 11-08-08 - additional steps required for SITK1.2 version of TD2 + ExecCommand("MKDIR $TestDriverDrive\\testdriver\\eclipse\\links\\"); + + ExecCommand("COPY \\\\builds01\\devbuilds\\buildteam\\testdriverv2\\testdriver.link $TestDriverDrive\\testdriver\\eclipse\\links\\"); + + # + # Unzip JRE v1.5 + # + print "\n"; + print "#\n# Unzip JRE 1.5 required by TestDriver v2\n#\n"; + print "\n"; + + ExecCommand("%EPOCROOT%epoc32\\tools\\unzip.exe \\\\builds01\\devbuilds\\BuildPCs\\Software\\JDK1.5.0_13\\jre1.5.zip -d $TestDriverDrive\\testdriver\\"); + +} + +sub configureTestDriver2() +{ + # + # Configure TestDriver + # + print "\n"; + print "#\n# Configure TestDriver\n#\n"; + print "\n"; + my $localtimes = localtime; + PrintDateTime(); + + ExecCommand("$TestDriverDrive\\testdriver\\testdriver.cmd config -e $BuildDir\\ + -x $TestDriverXML + -l $TestDriverDrive\\TestDriver\\Results + --source $sourceDir + -s smoketest + -r $TestDriverDrive\\TestDriver\\Repos + -c $TestDriverDrive\\TestDriver\\Results"); + + ExecCommand("$TestDriverDrive\\testdriver\\testdriver.cmd config --commdb overwrite"); + ExecCommand("$TestDriverDrive\\testdriver\\testdriver.cmd config --bldclean off"); + + # platsec for > 9.x only + if ($buildNo ne "8.1a" && $buildNo ne "8.1b") + { + ExecCommand("$TestDriverDrive\\testdriver\\testdriver.cmd config -p ON"); + } + + # Setup commdb for WINSCW smoketest + print "\n*** Setup commdb for WINSCW to use WinTAP ***\n"; + + # export smoketest_commdb.xml to a place that ced.exe can see it + ExecCommand("copy $SmokeTestDir\\smoketest_commdb.xml $BuildDir\\epoc32\\WINSCW\\c\\"); + ExecCommand("$BuildDir\\epoc32\\release\\WINSCW\\udeb\\ced.exe c:\\smoketest_commdb.xml"); + + print "\n*** Confirm TestDriver Config ***\n"; + ExecCommand("$TestDriverDrive\\testdriver\\testdriver.cmd config"); + print "\n"; +} + +# ExecCommand +# +# Execute a system command, having first echoed it. Display and return the output of the command. +# +# Input: Command string (without final newline) +# +# Output: Command output (including STDERR) to STDOUT +# +# Return: Command output (including STDERR) +# +sub ExecCommand +{ + my $iCmd = shift; + print "\n================================================================\n"; + print "Command: $iCmd\n"; + print "----------------------------------------------------------------\n"; + my $iRet = `$iCmd 2>&1`; + chomp $iRet; + print "Return: $iRet\n"; + print "================================================================\n"; + return $iRet; +} + +# PrintDateTime +# +# Print to STDOUT, Current Date and Time +# +# Input: none +# +# Output: text to STDOUT +# +sub PrintDateTime +{ + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + #### my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time); + $year += 1900; + $mon += 1; + printf "\n*** Current Time: %04d/%02d/%02d %02d:%02d:%02d ***\n", $year,$mon,$mday,$hour,$min,$sec; +} + +1; + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/SmokeTestClient.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/SmokeTestClient.pl Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,80 @@ +# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 script was born on 07/10/2004 +# +# + +#!/usr/bin/perl -w +use strict; +use SmokeTest; +use Getopt::Long; + +# Process the commandline +my ($iSourceDir, $iTestSuite, $iProduct, $iServerPool, $iProductType, $iPublishLocation, $iBuildNumber, $iXML, $iUnzip, $iBuildDrive, $iTDDrive) = ProcessCommandLine(); + +&SmokeTest::main($iSourceDir, $iTestSuite, $iProduct, $iServerPool, $iProductType, $iPublishLocation, $iBuildNumber, $iXML, $iUnzip, $iBuildDrive, $iTDDrive); + +# ProcessCommandLine +# +# Description +# This function processes the commandline + +sub ProcessCommandLine +{ + my ($iHelp); + + GetOptions('h' => \$iHelp, 'src=s' => \$iSourceDir, 'pool=s' => \$iServerPool, 'product=s' => \$iProduct, 'suite=s' => \$iTestSuite, 'type=s' => \$iProductType, 'publish=s' => \$iPublishLocation, 'build=s' => \$iBuildNumber, , 'xml=s' => \$iXML, 'unziptd' => \$iUnzip, 'builddrive=s' => \$iBuildDrive, 'tddrive=s' => \$iTDDrive); + + if (($iHelp) || (!defined $iSourceDir) || (!defined $iTestSuite) || (!defined $iProduct) || (!defined $iBuildDrive)) + { + Usage(); + } + + return ($iSourceDir, $iTestSuite, $iProduct, $iServerPool, $iProductType, $iPublishLocation, $iBuildNumber, $iXML, $iUnzip, $iBuildDrive, $iTDDrive); +} + +# Usage +# +# Output Usage Information. +# + +sub Usage +{ + print <= 9.5 || $iProductNum eq 'tb92' || $iProductNum eq 'tb101sf') + { +####????DavidZjang#$buildrom = SmokeTest::ExecCommand ("buildrom -D_STARTUPMODE2 -D_EABI=ARMV5 -fm=\\epoc32\\rom\\include\\featuredatabase.xml h4hrp techview statauto.iby -osys$rom.bin"); +####????MCL########$buildrom = SmokeTest::ExecCommand ("buildrom -D_STARTUPMODE2 $eabi -fm=\\epoc32\\rom\\include\\featuredatabase.XML GTC_Standard statauto.iby testconfigfileparser.iby"); + $buildrom = SmokeTest::ExecCommand ("buildrom -D_STARTUPMODE2 $eabi -fm=\\epoc32\\rom\\include\\featuredatabase.XML GTC_Standard_H4 statauto.iby testconfigfileparser.iby"); + } + else + { + $buildrom = SmokeTest::ExecCommand ("buildrom -D_STARTUPMODE2 $eabi -fr=\\epoc32\\rom\\include\\featureUIDs.XML GTC_Standard_H4 statauto.iby testconfigfileparser.iby"); + } + print $buildrom; + + if ( ($buildrom =~ m/rombuild.*failed/i) ) + { + print "\n*** Error In Smoke Test ***\n Building the ROM failed\n$!\n"; + #&SmokeTest::DieLog("Error In Smoke Test: Building the ROM failed"); + } + else + { + print "\n*** ROM built successfully ***\n"; + } + + if ($nandROM =~ /-D_NAND/) + { + # Need to rename each on individually as there are several files ending in ".img" + print "\n"; + print "#\n# Renaming NAND ROMs\n#\n"; + print "\n"; + SmokeTest::ExecCommand ("MOVE /Y $ROFSImage $newROFSImage"); + SmokeTest::ExecCommand ("MOVE /Y $coreImage $newCoreImage"); + + # Copy each of the image files to the \epoc32\rom directory + print "\n"; + print "#\n# Copying NAND ROMs\n#\n"; + print "\n"; + SmokeTest::ExecCommand ("COPY $newROFSImage \\epoc32\\rom\\"); + SmokeTest::ExecCommand ("COPY $newCoreImage \\epoc32\\rom\\"); + + # Delete the images + print "\n"; + print "#\n# Deleting images\n#\n"; + print "\n"; + SmokeTest::ExecCommand ("DEL *.img"); + +# passing $args[1] i.e. h2 / h4hrp to PrepareNANDROM due to CR 0844 (Both H2 and H4 use -D_NAND2) + &PrepareNANDROM("$args[1]"); + } + + # Rename the IMG file to sys$rom.bin + my $ImgDir = SmokeTest::ExecCommand ("DIR *.img"); + + $ImgDir =~ /(\S+\.img)/i; + + #&SmokeTest::DieLog("Building ROMs failed: Cannot find .IMG file") unless defined $1; + print "Name of ROM : $1 \n"; + SmokeTest::ExecCommand ("MOVE /Y $1 sys\$rom.bin"); + print "\n"; + + # + # ZIP ROM using \epoc32\tools\zip.exe + # + print "\n"; + print "#\n# ZIP ROM using \\epoc32\\tools\\zip.exe\n#\n"; + print "\n"; + SmokeTest::PrintDateTime(); + + # Now zip the file + my $zipresult = SmokeTest::ExecCommand ("$SmokeTest::BuildDir$ENV{EPOCROOT}epoc32\\tools\\zip.exe -Tv sys\$rom sys\$rom.bin"); + print "\n"; + + # Test for zip errors + if ($zipresult =~ m/No errors detected/i) # Good case: no errors detected. + { + print "*** ROM zip successful: no errors detected ***\n"; + } + elsif ($zipresult =~ m/zip error/i) # Zip error + { + print "*** Error In Smoke Test ***\n Zipping the ROM failed $!\n"; + #&SmokeTest::DieLog("Error In Smoke Test: Zipping the ROM failed"); + } + else # Worst case + { + print "*** Error In Smoke Test ***\n Zipping unable to start $!\n"; + } + + # Form the string for the temporary zip file locations + my $tempZipLocation = "$SmokeTest::SmokeTestDir\\$args[0]\\$args[1]"; + if ($nandROM =~ /-D_NAND/) # Add \NAND folder if a NAND ROM is being built + { + + if ($args[2] eq "pagedrom") # Add \NAND_DP folder if a Demand Paging NAND ROM is being built + { + $tempZipLocation .= "\\NAND\(DP\)"; + } + else + { + $tempZipLocation .= "\\NAND"; + } + } + + # Make the temp zip folder + SmokeTest::ExecCommand ("MKDIR $tempZipLocation"); + print "\n"; + + # Copy the ROM to the appropriate directory to be copied later + SmokeTest::ExecCommand ("MOVE /Y sys\$rom.zip $tempZipLocation\\sys\$rom.zip"); + + print "\n"; + + SmokeTest::PrintDateTime(); +} + +1; diff -r 000000000000 -r 9736f095102e buildverification/smoketest/SmokeTestServer.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/SmokeTestServer.pl Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,334 @@ +# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# TestServer.pl +# This script was born on 19/10/2004 +# +# + +use strict; + +my $jobsfolder = "d:\\Jobs\\"; + +# Loop forever +while (1) +{ + open LogFile, ">>d:\\SmokeTestServerLog.txt" or die "Cannot open log file: $!"; + + print "\n***********************\n"; + print "\n*** START PUBLISHER ***\n"; + print "\n***********************\n"; + print "\n"; + print LogFile "\n***********************\n"; + print LogFile "\n*** START PUBLISHER ***\n"; + print LogFile "\n***********************\n"; + print LogFile "\n"; + + my $localtimes = localtime; + print "\n*** Current Time: $localtimes ***\n"; + print LogFile "\n*** Current Time: $localtimes ***\n"; + + # + # Check if there are any results ready for publishing + # + print "\n"; + print "#\n# Check if there are any results ready for publishing\n#\n"; + print "\n"; + print LogFile "\n"; + print LogFile "#\n# Check if there are any results ready for publishing\n#\n"; + print LogFile "\n"; + + opendir JobDir, $jobsfolder or die "Cannot open jobs dir $jobsfolder: $!"; + + my @jobs = readdir(JobDir); + + # to remove "." and ".." from this list + shift @jobs; + shift @jobs; + + if (!scalar(@jobs)) + { + print "\nNo Jobs to publish\n"; + print LogFile "\nNo Jobs to publish\n"; + } + else + { + # + # Loop though each directory and publish logs + # + print "\n"; + print "#\n# Loop though each directory and publish logs\n#\n"; + print "\n"; + print LogFile "\n"; + print LogFile "#\n# Loop though each directory and publish logs\n#\n"; + print LogFile "\n"; + + foreach my $name (sort { $a <=> $b } @jobs) + { + if ( -d $jobsfolder.$name) + { + print "\n*** Found Job: $name ***\n"; + print LogFile "\n*** Found Job: $name ***\n"; + + # Check to see if job has been completed. + if (isJobFinished($name)) + { + # + # Publish the results + # + print "\n"; + print "#\n# Publish the results\n#\n"; + print "\n"; + print LogFile "\n"; + print LogFile "#\n# Publish the results\n#\n"; + print LogFile "\n"; + + my $publishfile = $jobsfolder.$name."\\publish.txt"; + + if (-r $publishfile) + { + open (PUBLISH, $publishfile) or GoNext("Cannot find publish details for $name"); + my $count = 0; + my $index = 0; + while (my $publishlocation = ) + { + chomp $publishlocation; + + $index++; + + print "\nPublish Location = $publishlocation\n"; + print LogFile "\nPublish Location = $publishlocation\n"; + + `mkdir $publishlocation`; # or GoNext("$publishlocation\\$name\\"); + + my $lookIn = "$jobsfolder$name\\output"; + my ($source,$runid,$buildname) = getSourceDir($lookIn); + + my $srcdir = $source."\\xml"; + my $trgtdir= $publishlocation."xml\\"; + + my $xcopycmd= "xcopy /C /Y /E $srcdir $trgtdir "; + print `$xcopycmd`; + + # + # Copy the contents of Output and reports - + # + # runXX__SymbianOS_vYY.xml/html to _Symbian_OS_vYY.xml/html + # + + my $xmlfile = "$source\\run".$runid."_".$buildname."\.xml"; + my $htmlfile = "$source\\run".$runid."_".$buildname."\.html"; + + if (-e $xmlfile) { + + print "copy $xmlfile to $buildname.xml"; + system "copy $xmlfile $publishlocation\\$buildname.xml"; + } + + if (-e $htmlfile) { + + print "copy $htmlfile to $buildname.html"; + system "copy $htmlfile $publishlocation\\$buildname.html"; + } + + print "\nNumber of Files Copied = $1\n" if $xcopycmd =~ m/(\d+)\s\w+/; + print LogFile "\nNumber of Files Copied = $1\n" if $xcopycmd =~ m/(\d+)\s\w+/; + + $count += $1; + + # The input should be copied onto \\devbuilds\master\.. but not \\devbuilds\logs\master\.. + if ($index < 2) + { + print "\n\nCopy the Input\n"; + $source = "$jobsfolder$name\\input\\*"; + + # Copy the contents of Input + print "\ncmd: xcopy /C /Y /E $source $publishlocation 2>&1\n"; + print LogFile "\ncmd: xcopy /C /Y /E $source $publishlocation 2>&1\n"; + my $xcopy = `xcopy /C /Y /E $source $publishlocation 2>&1`; + print $xcopy; + + print "\nNumber of Files Copied = $1\n" if $xcopy =~ m/(\d+)\s\w+/; + print LogFile "\nNumber of Files Copied = $1\n" if $xcopy =~ m/(\d+)\s\w+/; + $count += $1; + } + } + close Publish; + + print "\nTotal Number of files copied = $count\n"; + print LogFile "\nTotal Number of files copied = $count\n"; + + # Minimum 3 files have to be copied - Trace.txt, sys$rom.bin and armX.tpkg + if ($count >= 3) + { + # it is fine to delete the jobs dir + print "\ncmd: rd $jobsfolder$name /Q /S 2>&1\n"; + print LogFile "\ncmd: rd $jobsfolder$name /Q /S 2>&1\n"; + print `rd $jobsfolder$name /Q /S 2>&1`; + } + } + else + { + print "\n*** Error publishing results ***\n Cannot open publish file: $jobsfolder"."$name"."\\publish.txt\n"; + print LogFile "\n*** Error publishing results ***\n Cannot open publish file: $jobsfolder"."$name"."\\publish.txt\n"; + } + } + else + { + print "\nThe Job $name is either still running or has encountered an error\n"; + print LogFile "\nThe Job $name is either still running or has encountered an error\n"; + } + } + else + { + print "*** Error ***\nDir does not exist! $jobsfolder.$name\n"; + print LogFile "*** Error ***\nDir does not exist! $jobsfolder.$name\n"; + } + } + } + close JobDir; + + my $localtimes = localtime; + print "\n*** Current Time: $localtimes ***\n"; + print LogFile "\n*** Current Time: $localtimes ***\n"; + + print "\n"; + print "\n*********************\n"; + print "\n*** END PUBLISHER ***\n"; + print "\n*********************\n"; + print "\n"; + print "\n"; + print LogFile "\n"; + print LogFile "\n*********************\n"; + print LogFile "\n*** END PUBLISHER ***\n"; + print LogFile "\n*********************\n"; + print LogFile "\n"; + print LogFile "\n"; + + close LogFile; + sleep 900; +} + +sub GoNext +{ + print "\n*** Error in Publisher ***\n $_[0] $!\n"; + print LogFile "\n*** Error in Publisher ***\n $_[0] $!\n"; + next; +} + +# identify if a job has finished +sub isJobFinished($) { + + my $jobid = shift; + my @cmd_out = `testdriver.cmd jobstatus -j $jobid 2>&1`; + + foreach (@cmd_out) { + if (m/completed/) { return 1; } + } + + return 0; +} + +sub getSourceDir($) +{ + my $source = shift; + my $runid = 0; + my $buildname; + + # + # Find the correct directory to publish + # + + if (opendir RESULTS, $source) + { + my @dirArray = readdir(RESULTS); + + #print "@results"; + # to remove "." and ".." from this list + shift @dirArray; + shift @dirArray; + + if (!scalar(@dirArray)) + { + print "REMARK: The result for $_[0] has an empty $source directory"; + return; + } + else + { + print "\nContents of $source = @dirArray\n"; + $source .= "\\$dirArray[0]"; + # dirArray should always have just the one subdir - 0XXXX_Symbian_OS_vX.X + + $buildname = $dirArray[0]; + + if (opendir tempDir, "$source") + { + # to remove "." and ".." from this list + my @dirArray = readdir(tempDir); + shift @dirArray; + shift @dirArray; + + print "\nContents of $source = @dirArray\n"; + + foreach my $directory (@dirArray) + { + if ($directory =~ /(?:$_[0])/i) + { + $source .= "\\$directory"; + + # added this to remove udeb/xx + if (opendir tempDir, "$source") + { + # to remove "." and ".." from this list + @dirArray = readdir(tempDir); + shift @dirArray; + shift @dirArray; + + print "\nContents of $source = @dirArray\n"; + + foreach my $directory (@dirArray) + { + if ($directory =~ /(udeb|urel)/i) + { + $source .= "\\$directory"; + if (opendir tempDir, "$source") + { + # to remove "." and ".." from this list + @dirArray = readdir(tempDir); + shift @dirArray; + shift @dirArray; + + print "\nContents of $source = @dirArray\n"; + + foreach my $directory (@dirArray) + { + if ($directory =~ /(^[0-9]+)/i) + { + $source .= "\\$directory"; + $runid = $directory; + last; + } + } + } + last; + } + } + } + + } + } + } + } + } + return ($source, $runid, $buildname); +} \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/SmokeTestSuite.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/SmokeTestSuite.pm Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,501 @@ +# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# The SmokeTestSuite package contains subroutines that are needed to build a +# testdriver test suite. +# This script was born on 18/04/2005 +# +# + +#!/usr/bin/perl -w +package SmokeTestSuite; +use strict; + +my $servicename; + +# +# BuildAndPackage: Used to create a test package for remote execution on the ROM +# +sub BuildAndPackage +{ + # + # Build Test Package for $_[0] + # + print "\n#\n# Build Test Package for $_[0]\n#\n"; + SmokeTest::PrintDateTime(); + my $testbuild = SmokeTest::ExecCommand ("$SmokeTest::TestDriverCmd build -p $_[0] -b udeb -s $SmokeTest::TestSuite"); + + # now check for results + $testbuild =~ m/fail\:\s(\d+)\s\%/i; + + if ( ($testbuild =~ m/\*\*error\:/i) || $1 == 100 ) + { + print "\nREMARK: Smoke Test *** Building the Test failed $!\n"; + #&SmokeTest::DieLog("Error In Smoke Test: Building the Test failed"); + } + else + { + print "\n*** Test Building successful ***\n"; + } + + SmokeTest::PrintDateTime(); + + my $testpackage = SmokeTest::ExecCommand ("$SmokeTest::TestDriverCmd package -p $_[0] -b udeb -s $SmokeTest::TestSuite --tp $SmokeTest::SmokeTestDir\\$_[0].tpkg"); + print "\n"; + + if (($testpackage =~ m/\*\*error/i)) + { + print "\nREMARK: Smoke Test *** Building the Test Package failed\n\"$1\"\n"; + #&SmokeTest::DieLog("Error In Smoke Test: Building the Test Package failed"); + } + else + { + print "\n*** Building the Test Package successful ***\n"; + } + + SmokeTest::PrintDateTime(); +} + +# +# BuildAndPublish: used to build and test the smoketest test suite on an Emulator +# +sub BuildAndPublish +{ + my $runid = 0; + my $buildname; + + # + # Build Test Suite for $_[0] + # + print "\n#\n# Build Test Suite for $_[0]\n#\n"; + SmokeTest::PrintDateTime(); + my $testbuildwinscw = SmokeTest::ExecCommand ("$SmokeTest::TestDriverCmd build -p $_[0] -b udeb -s $SmokeTest::TestSuite"); + + # now check for results + $testbuildwinscw =~ m/fail\:\s(\d+)\s\%/i; + + if ( ($testbuildwinscw =~ m/\*\*error\:/i) || $1 == 100 ) + { + print "\nREMARK: Smoke Test *** Building the Test for $_[0] failed $!\n"; + #&SmokeTest::DieLog("Error In Smoke Test: Building the Test failed"); + } + else + { + print "\n*** Test Build successful ***\n"; + } + + # + # Run Test Suite for $_[0] + # + print "\n"; + print "#\n# Run Test Package for $_[0]\n#\n"; + print "\n"; + SmokeTest::PrintDateTime(); + + SmokeTest::ExecCommand ("$SmokeTest::TestDriverCmd run -p $_[0] -b udeb -s $SmokeTest::TestSuite"); + + SmokeTest::PrintDateTime(); + + # + # Publish results of emulator onto publish server + # + print "\n"; + print "#\n# Publish results of emulator onto publish server\n#\n"; + print "\n"; + + # + # Find the correct directory to publish + # + my $source = "$SmokeTest::TestDriverDrive\\TestDriver\\Results"; + if (opendir Results, $source) + { + my @dirArray = readdir(Results); + + #print "@results"; + # to remove "." and ".." from this list + shift @dirArray; + shift @dirArray; + + if (!scalar(@dirArray)) + { + print "REMARK: The emulator for $_[0] has an empty $source directory"; + return; + } + else + { + print "\nContents of $source = @dirArray\n"; + $source .= "\\$dirArray[0]"; + # dirArray should always have just the one subdir - 0XXXX_Symbian_OS_vX.X + + $buildname = $dirArray[0]; + + if (opendir tempDir, "$source") + { + # to remove "." and ".." from this list + @dirArray = readdir(tempDir); + shift @dirArray; + shift @dirArray; + + print "\nContents of $source = @dirArray\n"; + + foreach my $directory (@dirArray) + { + if ($directory =~ /(?:$_[0])/i) + { + $source .= "\\$directory"; + + # added this to remove udeb/xx + if (opendir tempDir, "$source") + { + # to remove "." and ".." from this list + @dirArray = readdir(tempDir); + shift @dirArray; + shift @dirArray; + + print "\nContents of $source = @dirArray\n"; + + foreach my $directory (@dirArray) + { + if ($directory =~ /(udeb|urel)/i) + { + $source .= "\\$directory"; + if (opendir tempDir, "$source") + { + # to remove "." and ".." from this list + @dirArray = readdir(tempDir); + shift @dirArray; + shift @dirArray; + + print "\nContents of $source = @dirArray\n"; + + my @iNumericDirList = (); + foreach my $directory (@dirArray) + { + if ($directory =~ /(^[0-9]+)/i) + { + push @iNumericDirList, $directory; + } + } + @iNumericDirList = sort { $b <=> $a } @iNumericDirList; + $runid = $iNumericDirList[0]; + $source .= "\\$runid"; + last; + } + last; + } + } + } + + } + } + + print "\nThe final source directory = $source\n"; + } + else + { + print "REMARK: The emulator for $_[0] has an empty $source directory"; + return; + } + } + my $emulatorpublish = "$SmokeTest::PublishServer\\$SmokeTest::ProductType\\$SmokeTest::BuildNum\\logs\\SmokeTest\\Emulator\\$_[0]"; + + SmokeTest::ExecCommand ("MKDIR $emulatorpublish"); # or GoNext("$publishlocation\\$name\\"); + + SmokeTest::ExecCommand ("XCOPY /C /Y /E $source\\xml $emulatorpublish\\xml\\"); + + # + # Copy runXX__SymbianOS_vYY.xml/html to _Symbian_OS_vYY.xml/html + # + + my $xmlfile = "$source\\run".$runid."_".$buildname."\.xml"; + my $htmlfile = "$source\\run".$runid."_".$buildname."\.html"; + + if (-e $xmlfile) + { + SmokeTest::ExecCommand ("COPY $xmlfile $emulatorpublish\\$buildname.xml"); + } + + if (-e $htmlfile) + { + SmokeTest::ExecCommand ("COPY $htmlfile $emulatorpublish\\$buildname.html"); + } + + # + # Publish results of emulator onto logs dir + # + print "\n"; + print "#\n# Publish results of emulator onto Logs Dir\n#\n"; + print "\n"; + + my $emulatorpublish = "$SmokeTest::LogsDir\\SmokeTest\\Emulator\\$_[0]\\"; + + SmokeTest::ExecCommand ("MKDIR $emulatorpublish"); # or GoNext("$publishlocation\\$name\\"); + + SmokeTest::ExecCommand ("XCOPY /C /Y /E $source $emulatorpublish"); + } + else + { + print "REMARK: Cannot open dir $source: $!"; + return; + } + SmokeTest::PrintDateTime(); +} + +# +# PollServers: Polls all the servers from the Pool and picks out the one with the shortest queue. +# +sub PollServers +{ + # + # Parse ENV and create an array of smoketest servers for $_[0] + # + print "\n"; + print "#\n# Parse ENV and create an array of smoketest servers for $_[0]\n#\n"; + print "\n"; + SmokeTest::PrintDateTime(); + + if (($_[0] eq "Lubbock") || ($_[0] eq "LUBBOCK")) + { + $SmokeTest::servicename = "RemoteTestDriverLubbock"; + } + elsif ($_[0] eq "H2") + { + $SmokeTest::servicename = "RemoteTestDriverH2"; + } + elsif ($_[0] eq "H4HRP") + { + $SmokeTest::servicename = "RemoteTestDriverH4HRP"; + } + else + { + &SmokeTest::DieLog("Cannot poll serverpool for pool \"$_[0]\""); + } + + my @servers = split /\#/, $SmokeTest::serverpool; + if (@servers < 1) + { + &SmokeTest::DieLog("*** Error In Smoke Test ***\nNo SmokeTest Servers specified for $_[0]$!\n"); + } + else + { + print "\n*** Retrieved Pool of Smoke Test Servers from ENV for $_[0]***\n"; + } + + # + # Poll each of the smoke test servers and parse the results + # + print "\n"; + print "#\n# Poll each of the smoke test servers and parse the results\n#\n"; + print "\n"; + + my %serverlist; + + print "Checking TestDriver Version\n"; + SmokeTest::ExecCommand ("$SmokeTest::TestDriverCmd version"); + + foreach my $server (@servers) + { + print "Polling Server: $server\n"; + my $masterstatus = SmokeTest::ExecCommand ("$SmokeTest::TestDriverCmd masterstatus --srv //$server/$SmokeTest::servicename"); + + my $value = -2; + if ($masterstatus =~ m/Master: TestDriver is currently (....)/i) + { + if ($1 eq 'free') + { + #print "Free!\n"; + $value = 0; + } + else + { + $masterstatus =~ m/are\s+(\w+)\s+jobs/i; + if ($1 =~ m/\D+/) + { + $value = 1; + } + else + { + $value = $1 + 1; + } + } + } + else + { + # The master is not running a service + $value = -1; + } + $serverlist{$server} = $value; + print "\n"; + } + + # + # Decide which server to use + # + print "\n"; + print "#\n# STEP8 Decide which server to use\n#\n"; + print "\n"; + + my $masterserver; + + # Loop through first time only to print out all the available servers + print "\nAvailable Servers\n"; + foreach my $servername (sort { $serverlist{$a} <=> $serverlist{$b} } keys %serverlist) + { + print "\n$servername : number in queue are $serverlist{$servername}\n"; + } + + # Loop through second time to actually select the correct server + foreach my $servername (sort { $serverlist{$a} <=> $serverlist{$b} } keys %serverlist) + { + if ($serverlist{$servername} > -1) + { + $masterserver = $servername; + last; + } + } + + if (defined $masterserver) + { + print "\n*** The Smoke Test Server to be used for $_[0] is $masterserver ***\n"; + } + else + { + print "\nREMARK: Smoke Test *** No available Smoke Test Servers for $_[0] \n"; + #&SmokeTest::DieLog("Error In Smoke Test: No available Smoke Test Servers for $_[0]"); + } + SmokeTest::PrintDateTime(); + return $masterserver; +} + +# +# Usage: RunRemote(Architecture, Testing Board, Server) +# +sub RunRemote +{ + my $masterserver = $_[2]; + + + # + # Call TestDriver runremote for $_[0] + # + print "\n"; + print "#\n# Call TestDriver runremote for $_[0]\n#\n"; + print "\n"; + SmokeTest::PrintDateTime(); + + my $tempZipLocation = "$SmokeTest::SmokeTestDir\\$_[0]\\$_[1]"; + if ($_[3] eq "NAND\\") + { + $tempZipLocation .= "\\NAND"; + } + elsif ($_[3] eq "NAND\(DP\)\\") + { + $tempZipLocation .= "\\NAND\(DP\)"; + } + + SmokeTest::ExecCommand ("COPY /Y $tempZipLocation\\sys\$rom.zip $SmokeTest::SmokeTestDir\\sys\$rom.zip"); + + # Decide whether this is a platsec ROM or not + my $platsec; + if ($SmokeTest::buildNo eq "9.1" || $SmokeTest::buildNo eq "9.2" || $SmokeTest::buildNo eq "9.3" || $SmokeTest::buildNo eq "Future" || $SmokeTest::buildNo eq "9.4" || $SmokeTest::buildNo eq "9.5" || $SmokeTest::buildNo eq "9.6" || $SmokeTest::buildNo eq "tb92" || $SmokeTest::buildNo eq "tb101sf") + { + $platsec = "ON"; + } + else + { + $platsec = "OFF"; + } + + # calling testdriver for $_[0] + my $runremote = SmokeTest::ExecCommand ("$SmokeTest::TestDriverCmd runremote -m async -i $SmokeTest::SmokeTestDir --tp $_[0].tpkg -r sys\$rom.zip --srv //$masterserver/$SmokeTest::servicename --platsec $platsec --testexec ON"); + + # + # Parse output to get the job number or error + # + print "\n"; + print "#\n# Parse output to get the job number or error\n#\n"; + print "\n"; + + my $jobid; + + if ($runremote =~ m/job id/i) + { + $runremote =~ m/job id: (\d+)/i; + $jobid = $1; + print "\n*** Job submitted successfully ***\n\nJob Id = $jobid\n"; + } + else + { + print "\nREMARK: Smoke Test Job Submission failed\n"; + #&SmokeTest::DieLog("Error In Smoke Test: Submitting the Job failed"); + return; + } + + # + # Create a text file with publish details + # + print "\n"; + print "#\n# Create a text file with publish details\n#\n"; + print "\n"; + + my $publishstring; + + $publishstring = "Publish: $SmokeTest::PublishServer\\$SmokeTest::ProductType\\$SmokeTest::BuildNum\\logs\\Smoketest\\$_[0]\\$_[1]\\"; + print "$publishstring"; + + if ( (defined $SmokeTest::PublishServer) && (defined $SmokeTest::ProductType) && (defined $SmokeTest::BuildNum) ) + { + open PublishFile, ">$_[0]$_[1].txt" or &SmokeTest::DieLog("Cannot open File $_[0]$_[1].txt: $!\n"); + $publishstring = "$SmokeTest::PublishServer\\$SmokeTest::ProductType\\$SmokeTest::BuildNum\\logs\\Smoketest\\$_[0]\\$_[1]\\"; + if ($_[3] eq "NAND\\") + { + $publishstring .= "NAND\\"; + } + elsif ($_[3] eq "NAND\(DP\)\\") + { + $publishstring .= "NAND\(DP\)\\"; + } + print PublishFile "$publishstring"; + $publishstring = "\n$SmokeTest::PublishServer\\$SmokeTest::ProductType\\logs\\$SmokeTest::BuildNum\\Smoketest\\$_[0]\\$_[1]\\"; + if ($_[3] eq "NAND\\") + { + $publishstring .= "NAND\\"; + } + elsif ($_[3] eq "NAND\(DP\)\\") + { + $publishstring .= "NAND\(DP\)\\"; + } + print PublishFile "$publishstring"; + close PublishFile; + print "\n*** Publish file created successfully ***\n"; + } + else + { + print "\nREMARK: Smoke Test *** Could not Create Publish File\n$!"; + #&SmokeTest::DieLog("Error In Smoke Test: Could not Create Publish File"); + } + + # + # Copy This publish file to the correct directory + # + print "\n"; + print "#\n# Copy This publish file to the correct directory \n#\n"; + print "\n"; + + ###print "\nabout to move /Y $_[0]$_[1].txt \\\\$masterserver\\Jobs\\$jobid\\publish.txt\n"; + SmokeTest::ExecCommand ("MOVE /Y $_[0]$_[1].txt \\\\$masterserver\\Jobs\\$jobid\\publish.txt"); + + SmokeTest::PrintDateTime(); +} + +1; \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/SyncMLApp/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/SyncMLApp/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,27 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 SnyncMLApp smoketest +// +// + +PRJ_EXPORTS + +../scripts/smoketest_syncmlapp.script /epoc32/release/wins/udeb/z/smoketest/smoketest_syncmlapp.script +../scripts/smoketest_syncmlapp.script /epoc32/release/wins/urel/z/smoketest/smoketest_syncmlapp.script +../scripts/smoketest_syncmlapp.script /epoc32/release/winscw/udeb/z/smoketest/smoketest_syncmlapp.script +../scripts/smoketest_syncmlapp.script /epoc32/release/winscw/urel/z/smoketest/smoketest_syncmlapp.script + +PRJ_MMPFILES + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/SyncMLApp/scripts/smoketest_syncmlapp.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/SyncMLApp/scripts/smoketest_syncmlapp.script Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,19 @@ +// +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 smlapplication for 10 seconds +// +RUN_WS_PROGRAM 10 z:\sys\bin\smlapplication.exe diff -r 000000000000 -r 9736f095102e buildverification/smoketest/System/Group/Smoketest_System.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/System/Group/Smoketest_System.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,40 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Smoketest_Agenda.mmp +// using relative paths for sourcepath and user includes +// +// + +TARGET Smoketest_System.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7773 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY WriteUserData ReadUserData + +SOURCEPATH ..\Src + +SOURCE TestSystemBase.cpp + +USERINCLUDE ..\Inc ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY EUSER.LIB +LIBRARY EIKSRV.LIB +LIBRARY TESTEXECUTELOGCLIENT.LIB + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/System/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/System/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 System smoketest +// +// + +PRJ_EXPORTS + +../scripts/smoketest_system.script /epoc32/release/wins/udeb/z/smoketest/smoketest_system.script +../scripts/smoketest_system.script /epoc32/release/wins/urel/z/smoketest/smoketest_system.script +../scripts/smoketest_system.script /epoc32/release/winscw/udeb/z/smoketest/smoketest_system.script +../scripts/smoketest_system.script /epoc32/release/winscw/urel/z/smoketest/smoketest_system.script + +PRJ_TESTMMPFILES +Smoketest_System.mmp diff -r 000000000000 -r 9736f095102e buildverification/smoketest/System/Inc/TestSystemBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/System/Inc/TestSystemBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + + +#ifndef TEST_SYSTEM_BASE_H +#define TEST_SYSTEM_BASE_H + +#include +#include + +class CEikUndertaker; + +class CSystemTestBase : public MEikUndertakerObserver + { +public: + static CSystemTestBase* NewL(); + ~CSystemTestBase(); + +protected: + CSystemTestBase(); + void ConstructL(); + +protected: // From MEikUndertakerObserver + void HandleThreadExitL(RThread& aThread); + +protected: + CEikUndertaker* iUndertaker; + RTestExecuteLogServ iLogger; + TInt iExitReason; + TExitCategoryName iExitCategory; + }; + + +#endif // TEST_SYSTEM_BASE_H diff -r 000000000000 -r 9736f095102e buildverification/smoketest/System/Src/TestSystemBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/System/Src/TestSystemBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +#include "TestSystemBase.h" + +// Global Vars +_LIT(KTestExecuteLog,"c:\\Logs\\TestExecute\\smoketest_system_temp.htm"); +_LIT(KPanicText,"The following Panic has occured: Thread Name = %S Exit Reason = %d Exit Category = %S"); + +CSystemTestBase* CSystemTestBase::NewL() + { + CSystemTestBase* self=new(ELeave) CSystemTestBase; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); // self + return(self); + } + +void CSystemTestBase::ConstructL() + { + iUndertaker=CEikUndertaker::NewL(*this); + User::LeaveIfError(iLogger.Connect()); + User::LeaveIfError(iLogger.CreateLog(KTestExecuteLog,RTestExecuteLogServ::ELogModeAppend)); + } + +CSystemTestBase::CSystemTestBase() + { + // do nothing + } + +CSystemTestBase::~CSystemTestBase() + { + delete iUndertaker; + iLogger.Close(); + } + +void CSystemTestBase::HandleThreadExitL(RThread& aThread) + { + TExitType exitType=aThread.ExitType(); + if (exitType==EExitPanic) + { + CActiveScheduler::Stop(); + iExitReason = aThread.ExitReason(); + iExitCategory = aThread.ExitCategory(); + TBuf<100> iName(aThread.FullName()); + iLogger.WriteFormat(KPanicText, &iName, iExitReason, &iExitCategory); + User::Panic(iExitCategory,iExitReason); + } + } + +//LOCAL_C TInt PanicThread(TAny*) +// { +// _LIT(PanicReason, "Just, why not"); +// TInt iPanicInt = 666; +// User::Panic(PanicReason, iPanicInt); +// return iPanicInt; +// } + +LOCAL_C void MainL() + { + // Construct and install the active scheduler + CActiveScheduler* myScheduler = new(ELeave) CActiveScheduler; + CleanupStack::PushL(myScheduler); + CActiveScheduler::Install(myScheduler); + + CSystemTestBase* iTempBase = CSystemTestBase::NewL(); + + // The following is just test code that spawns a thread and makes it panic + //RThread iPanicThread; + //_LIT(PanicThreadTest, "Undertaker Panic Thread Test"); + + //User::LeaveIfError(iPanicThread.Create(PanicThreadTest(), &PanicThread, KDefaultStackSize, 0x100, 0x100, NULL)); + //iPanicThread.SetPriority(EPriorityAbsoluteHigh); + //iPanicThread.Resume(); + + CActiveScheduler::Start(); + + for (;;) + { + User::After(100000); + } + } + +GLDEF_C TInt E32Main() +/** + * Executable Entry Point + * Top level always creates TRAP harness. + * Calls MainL() inside the TRAP harness + */ + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()); + // should never reach this point if some thread has panicked already + _LIT(KTestPanicReason,"Trap"); + __ASSERT_ALWAYS(!err, User::Panic(KTestPanicReason,err)); + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/System/scripts/smoketest_system.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/System/scripts/smoketest_system.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Smoke Test System for 20 seconds +// +RUN_WS_PROGRAM 20 z:\sys\bin\Smoketest_System.exe +// +PRINT Finished Running Smoke Test System for 20 seconds \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/ConsoleAlarmAlertServer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/ConsoleAlarmAlertServer.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET ConsoleAlarmAlertServer.dll +TARGETTYPE dll +CAPABILITY All -TCB +UID 0x1000008D 0x101F502A +VENDORID 0x70000001 + +SOURCEPATH ..\ConsoleAlarmAlertServer\Source + +SOURCE ConsoleAlarmAlertServer.cpp +SOURCE ConsoleAlarmAlertSession.cpp +SOURCE ConsoleAlarmAlertConsole.cpp +SOURCE ConsoleAlarmAlertServerMain.cpp +SOURCE ConsoleAlarmAlertLEDFlasher.cpp + +USERINCLUDE ..\ConsoleAlarmAlertServer\Include +//USERINCLUDE ..\AlarmAlert\Shared +//USERINCLUDE ..\Shared\Include + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY hal.lib +LIBRARY AlarmShared.lib + +DEFFILE ConsoleAlarmAlertServer.DEF + +START WINS + baseaddress 0x40700000 +END diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertConsole.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertConsole.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,91 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __CONSOLEALARMALERTCONSOLE_H__ +#define __CONSOLEALARMALERTCONSOLE_H__ + +// System includes +#include + +// User includes +#include "asaltdefs.h" + +// Type definitions + +// Constants + +// Classes referenced +class CConsoleAlarmAlertSession; + +// Enumerations + + +// +// ----> CConsoleAlarmAlertConsole (header) +// +class CConsoleAlarmAlertConsole : public CActive + { +// +public: // CONSTRUCT / DESTRUCT +// + CConsoleAlarmAlertConsole(CConsoleAlarmAlertSession& aSession); + ~CConsoleAlarmAlertConsole(); + +// +public: // ACCESS +// + void GetKey(); + void CancelKey(); + void DecCounter(); + void UpdateDisplay(); + TInt GetTimeInterval() const; + void SetVisibility(TInt aVis); + void SetAlertState(TInt aFlags); + +// +protected: // FROM CActive +// + void RunL(); + void DoCancel(); + +// +protected: // INTERNAL METHODS +// + void Hide(); + void CreateWin(); + void DoDeferTime(TASAltAlertServerResponse aResponse); + + static TBool CountDownCallBack(TAny* aSelf); + +// +private: // MEMBER DATA +// + + TInt iAlertState; + + TInt iTimeInterval; + + CPeriodic* iCountDown; + + CConsoleBase* iWin; + + CConsoleAlarmAlertSession& iSession; + + friend class CConsoleAlarmAlertSession; + + TInt iInstructionIndex; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertLEDFlasher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertLEDFlasher.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,75 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __CONSOLEALARMALERTLEDFLASHER_H__ +#define __CONSOLEALARMALERTLEDFLASHER_H__ + +// System includes +#include + +// User includes + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + + +// +// ----> CConsoleAlarmAlertLEDFlasher (header) +// +class CConsoleAlarmAlertLEDFlasher : public CTimer + { +// +public: // STATIC CONSTRUCT +// + static CConsoleAlarmAlertLEDFlasher* NewL(); + +// +private: // INTERNAL CONSTRUCT +// + CConsoleAlarmAlertLEDFlasher(); + +// +public: // ACCESS +// + + TInt Start(); + + void Stop(); + +// +private: // FROM CActive +// + + void RunL(); + +// +private: // INTERNAL +// + + TInt SetRedLedOn(TBool aOn); + +// +private: // MEMBER DATA +// + + TBool iLedOn; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,87 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TALARMALERTSERVER.H +// +// + +#ifndef __CONSOLEALARMALERTSERVER_H__ +#define __CONSOLEALARMALERTSERVER_H__ + +// System includes +#include + +// User includes + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced +class CTestAlarmAlertConsole; +class CConsoleAlarmAlertSession; + +// +// ----> CConsoleAlarmAlertServer (header) +// +class CConsoleAlarmAlertServer : public CPolicyServer + { +// +public: // STATIC CONSTRUCT / DESTRUCT +// + static CConsoleAlarmAlertServer* NewLC(); + ~CConsoleAlarmAlertServer(); + +public: + inline void AddResponseArray(TAny* aResponseArray); + void SetAttachment(HBufC8* aData); + inline HBufC8* Attachment() const; + inline TAny* ResponseArray() const; + inline CConsoleAlarmAlertSession* WaitingSession() const; + inline void SetNotifying(TBool aIsNotifying); + inline TBool IsNotifying() const; +// +private: // INTERNAL CONSTRUCT +// + CConsoleAlarmAlertServer(); + void ConstructL(); + +// +public: // FROM CServer2 +// + CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; + +// +private: // FROM CActive +// + TInt RunError(TInt aError); + +// +private: // MEMBER DATA +// + TAny* iInstructionSet; + HBufC8* iAttachment; + CConsoleAlarmAlertSession* iWaitingSession; + TBool iIsNotifying; + }; + +// inline functions +void CConsoleAlarmAlertServer::AddResponseArray(TAny* aResponseArray) { iInstructionSet = aResponseArray; } +HBufC8* CConsoleAlarmAlertServer::Attachment() const { return iAttachment; } +TAny* CConsoleAlarmAlertServer::ResponseArray() const { return iInstructionSet; } +CConsoleAlarmAlertSession* CConsoleAlarmAlertServer::WaitingSession() const { return iWaitingSession; } +void CConsoleAlarmAlertServer::SetNotifying(TBool aIsNotifying) { iIsNotifying = aIsNotifying; } +TBool CConsoleAlarmAlertServer::IsNotifying() const { return iIsNotifying; } +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertServerMain.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertServerMain.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __CONSOLEALARMALERTSERVERMAIN_H__ +#define __CONSOLEALARMALERTSERVERMAIN_H__ + +// System includes +#include + +// User includes + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + + +// +// ----> ConsoleAlarmAlertServer (header) +// +class ConsoleAlarmAlertServer +/** +@internalAll +@released +*/ + { +// +public: // ACCESS +// + IMPORT_C static void StartConsoleAlarmAlertServerL(TAny* instructionSet = NULL); + +// +private: // INTERNAL +// + static TInt StartServerThreadFunction(TAny* instructionSet = NULL); + static void StartServerL(TAny* instructionSet = NULL); + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Include/ConsoleAlarmAlertSession.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,137 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __CONSOLEALARMALERTSESSION_H__ +#define __CONSOLEALARMALERTSESSION_H__ + +// System includes +#include + +// User includes +#include "asaltdefs.h" +#include "asshdalarm.h" + +// Type definitions + +// Constants + +// Classes referenced +class CConsoleAlarmAlertConsole; +class CConsoleAlarmAlertLEDFlasher; +class CConsoleAlarmAlertServer; +// Enumerations + + +struct TAgnAlarmInfo + /** + Copy of System-Wide Unique Agenda Entry Reference defined in agmalarm.h + */ + { + TUid iAlarmCategory; + TUint32 iAgnUniqueId; + TFileName iFileName; + }; + +// +// ----> CConsoleAlarmAlertSession (header) +// +class CConsoleAlarmAlertSession : public CSession2 + { +// +public: // STATIC CONSTRUCT / DESTRUCT +// + static CConsoleAlarmAlertSession* NewL(CConsoleAlarmAlertServer* aServer); + ~CConsoleAlarmAlertSession(); + +// +private: // INTERNAL CONSTRUCT +// + CConsoleAlarmAlertSession(CConsoleAlarmAlertServer* aServer); + void ConstructL(); + +// +public: // ACCESS +// + + TTime DeferTime() const; + + inline const TASShdAlarm& Alarm() const { return iAlarm; } + + inline TInt AlarmDataSize() const { return iAlarmAssociatedDataSize; } + + inline const TAgnAlarmInfo& AlarmData() const { return iAlarmData; } + + void Notify(TASAltAlertServerResponse aFlag); + + void Notify(TASAltAlertServerResponse aFlag, const TTime& aDeferTime); + + TAny * InstructionSet(); + +// +private: // FROM CSession2 +// + void ServiceL(const RMessage2& aMessage); + +// +private: // CMD - DEBUG ONLY +// + TBool CmdL(); + +// +private: // INTERNAL METHODS +// + + void SetAlarmL(const RMessage2& aMessage); + + void GetUserTimeL(const RMessage2& aMessage); + + void SetDeferTimeL(const RMessage2& aMessage); + + static TBool SoundPlaybackCallbackL(TAny* aSelf); + +// +private: // MEMBER DATA +// + + TTime iDeferTime; + + TASShdAlarm iAlarm; + + TInt iAlarmAssociatedDataSize; + + TAgnAlarmInfo iAlarmData; + + TBool iLoggedOn; + + TBool iHasMessage; + + TBool iMsgComplete; + + RMessage2 iMsgPtr; + + CPeriodic* iSoundCallbackTimer; + + CConsoleAlarmAlertLEDFlasher* iSoundLEDFlasher; + + CConsoleAlarmAlertConsole* iConsole; + + CConsoleAlarmAlertServer* iServer; + + TAny* iInstructionSet; + + TBool iInstructionSetFound; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertConsole.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertConsole.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,404 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertconsole.h" + +// System includes +#include +#include +#include + +// User includes +#include "asaltdefs.h" +#include "consolealarmalertsession.h" + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + + +// +// ----> CConsoleAlarmAlertConsole (source) +// + +//************************************************************************************* +CConsoleAlarmAlertConsole::CConsoleAlarmAlertConsole(CConsoleAlarmAlertSession& aSession) +: CActive(CActive::EPriorityLow), iSession(aSession), iInstructionIndex(0) + { + CActiveScheduler::Add(this); + } + + +//************************************************************************************* +CConsoleAlarmAlertConsole::~CConsoleAlarmAlertConsole() + { + Cancel(); + Hide(); + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::GetKey() + { + if (iWin && !IsActive()) + { + SetActive(); + iWin->Read(iStatus); + } + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::CancelKey() + { + if (IsActive()) + Cancel(); + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::DecCounter() + { + if (iTimeInterval > 0) + { + --iTimeInterval; + UpdateDisplay(); + } + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::UpdateDisplay() + { + TBuf<180> buf; + _LIT(KEalwlAlarmSoundOff, "Off"); + _LIT(KEalwlAlarmSoundOn, "On"); + _LIT(KEalwlStatusEnabled, "Are"); + _LIT(KEalwlStatusNotEnabled, "Are Not"); + _LIT(KEalwlStatusIs, "Is"); + _LIT(KEalwlStatusIsNo, "Is No"); + // + if (!iWin) + return; + iWin->SetCursorPosAbs(TPoint(0,0)); + + // MESSAGE + buf.Format(_L("Message : %S"), &iSession.Alarm().Message()); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // DATA + if (iSession.Alarm().HasAssociatedData()) + { + const TAgnAlarmInfo data = iSession.AlarmData(); + const TUid KUidAgendaModelAlarmCategory = { 0x101F4A70 }; + if (data.iAlarmCategory == KUidAgendaModelAlarmCategory) + { + _LIT(KEalwlAgendaData,"\ndata: agenda filename \"%S\""); + if (data.iFileName.Length() < 40) + buf.Format(KEalwlAgendaData,&data.iFileName); + else + { + TBuf<40> temp = data.iFileName.Left(40); + buf.Format(KEalwlAgendaData,&temp); + } + } + else + buf.Format(_L("\nAlarm has %d data bytes"), iSession.AlarmDataSize()); + } + else + { + buf = _L("\nAlarm has no associated data"); + } + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // DEFER TIME + if (iSession.DeferTime() != Time::NullTTime()) + { + TDateTime dateTime(iSession.DeferTime().DateTime()); + buf.Format(_L("\nDefer : %02d:%02d"), dateTime.Hour(), dateTime.Minute()); + } + else + buf=_L("\nNULL defer time"); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // TIME INTERVAL + buf.Format(_L("\nCurrent time interval is %d minutes"), GetTimeInterval()); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // STATE FLAGS + buf.Format(_L("\nAlarm sounds are %S"),(iAlertState&EASAltStateFlagsSilentRunning)?&KEalwlAlarmSoundOff:&KEalwlAlarmSoundOn); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nAlarm sounds %S paused"),(iAlertState&EASAltStateFlagsSoundIsPaused)?&KEalwlStatusEnabled:&KEalwlStatusNotEnabled); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nAlarm sounds %S deferred"),(iAlertState&EASAltStateFlagsInQuietPeriod)?&KEalwlStatusEnabled:&KEalwlStatusNotEnabled); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nThere %S more than one unacknowledged alarms"),(iAlertState&EASAltStateFlagsMoreThanOneDueAlarm)?&KEalwlStatusEnabled:&KEalwlStatusNotEnabled); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nThere %S memory to snooze alarms"),(iAlertState&EASAltStateFlagsNoMemoryForSnoozeAlarm)?&KEalwlStatusIsNo:&KEalwlStatusIs); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + buf.Format(_L("\nThere %S an alarm sound to play"),(iAlertState&EASAltStateFlagsAlarmHasNoSoundFileName)?&KEalwlStatusIsNo:&KEalwlStatusIs); + iWin->Write(buf); + iWin->ClearToEndOfLine(); + + // COMMAND PROMPTS + iWin->Write(_L("\nENTER = Silence alarm SPACE = Quiet Period")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\nESCAPE = Acknowledge alarm A = Acknowledge all")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\nP = Pause alarm sound TAB = Snooze alarm")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\n1 = 1 min sound interval 0 = 0 mins sound interval")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\n+ = Increase int. and pause - = Decrease int. and pause")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\n! = Kill alarm alert server")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\n")); + iWin->ClearToEndOfLine(); + iWin->Write(_L("\r")); + // + if(!iSession.InstructionSet()) //Get user input if instruction set unspecified. + GetKey(); + else if (iInstructionIndex >= static_cast*>(iSession.InstructionSet())->Count()) //Get user input if program has already iterated thru entire instruction set. + GetKey(); + else //Use the command in the instruction set, instead of waiting for user input. + { + if(!IsActive()) + { + iStatus = KRequestPending; + TRequestStatus* ptrStatus = &iStatus; + User::RequestComplete( ptrStatus, KErrNone ); + SetActive(); + } + } + } + +//************************************************************************************* +TInt CConsoleAlarmAlertConsole::GetTimeInterval() const + { + return(iTimeInterval); + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::SetVisibility(TInt aVis) + { + if (!aVis) + Hide(); + else if (!iWin) + { + // Create a new window, since cannot set order of console windows + CreateWin(); + UpdateDisplay(); + } + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::SetAlertState(TInt aFlags) + { + iAlertState = aFlags; + UpdateDisplay(); + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::RunL() + { + if (iStatus.Int() == KErrCancel) + return; + + __ASSERT_DEBUG(iWin, User::Invariant()); + TInt key = iWin->KeyCode(); + if(iSession.InstructionSet() && iInstructionIndex < static_cast*>(iSession.InstructionSet())->Count()) + { + RArray* temp = static_cast*>(iSession.InstructionSet()); + key = (*temp)[iInstructionIndex++]; + GetKey(); + } + else + { + GetKey(); + if ((key>=EKeyF1 && key<=EKeyF12) || key==EKeyTab) + { + DoDeferTime(EASAltAlertServerResponseSnooze); + } + } + + switch (key) + { + // ACKNOWLEDGE CURRENT + case EKeyEscape: + iSession.Notify(EASAltAlertServerResponseClear); + return; + // ACKNOWLEDGE ALL + case 'a': + case 'A': + iSession.Notify(EASAltAlertServerResponseClearAll); + return; + // QUIET PERIOD + case EKeySpace: + DoDeferTime(EASAltAlertServerResponseQuietPeriod); + break; + // PAUSE SOUND + case 'p': + case 'P': + DoDeferTime(EASAltAlertServerResponsePauseSound); + break; + // SILENCE ALL SOUND + case EKeyEnter: + iSession.Notify(EASAltAlertServerResponseSilence); + break; + // INTERVAL 1 MINUTE + case '1': + iTimeInterval=1; + iSession.Notify(EASAltAlertServerResponsePauseSound); + break; + // INTERVAL 0 MINUTES + case '0': + iTimeInterval=0; + iSession.Notify(EASAltAlertServerResponsePauseSound); + break; + // PAUSE + + case '=': + case '+': + iTimeInterval++; + iSession.Notify(EASAltAlertServerResponsePauseSound); + break; + // PAUSE - + case '-': + iTimeInterval--; + iSession.Notify(EASAltAlertServerResponsePauseSound); + break; + + // QUIT + case '!': + CActiveScheduler::Stop(); + break; + } + + TBuf<10> buf; + buf.Format(_L("'%c',"), key); + iWin->Write(buf); + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::DoCancel() + { + __ASSERT_DEBUG(iWin, User::Invariant()); + iWin->ReadCancel(); + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::Hide() + { + if (iWin) + CancelKey(); + // + delete iWin; + iWin = NULL; + // + if (iCountDown) + iCountDown->Cancel(); + // + delete iCountDown; + iCountDown=NULL; + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::CreateWin() + { + _LIT(KAlarmAlertConsoleCaption, "Test Alarm Alert Server Console"); + // + __ASSERT_DEBUG(!iWin, User::Invariant()); + __ASSERT_DEBUG(!iCountDown, User::Invariant()); + // + TRAPD(trapCheck, iWin = Console::NewL(KAlarmAlertConsoleCaption, TSize(KConsFullScreen, KConsFullScreen))); + if (trapCheck) + { + iWin=NULL; + return; + } + + TRAP(trapCheck, iCountDown = CPeriodic::NewL(CActive::EPriorityIdle)); + if (trapCheck) + { + iCountDown=NULL; + return; + } + // + const TTimeIntervalMicroSeconds32 interval(60000000); + iCountDown->Start(interval, interval, TCallBack(&CountDownCallBack, this)); + } + + +//************************************************************************************* +void CConsoleAlarmAlertConsole::DoDeferTime(TASAltAlertServerResponse aResponse) + { + if (++iTimeInterval > 60) + { + iTimeInterval = 5; + User::Beep(440, 12); + } + // + TTime now; + now.HomeTime(); + now += TTimeIntervalMinutes(iTimeInterval); + // + iSession.Notify(aResponse, now); + } + + +//************************************************************************************* +TBool CConsoleAlarmAlertConsole::CountDownCallBack(TAny* aSelf) + { + CConsoleAlarmAlertConsole& self = *reinterpret_cast(aSelf); + self.DecCounter(); + // + return EFalse; + } + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertLEDFlasher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertLEDFlasher.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,130 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertledflasher.h" + +// System includes +#include + +// User includes +#include "asaltdefs.h" + +// Type definitions + +// Constants +const TInt KFlasherPeriodicity = 500000; + +// Enumerations + +// Classes referenced + + +// +// ----> CConsoleAlarmAlertLEDFlasher (source) +// + +//************************************************************************************* +CConsoleAlarmAlertLEDFlasher::CConsoleAlarmAlertLEDFlasher() +: CTimer(CActive::EPriorityIdle) + { + CActiveScheduler::Add(this); + } + + +//************************************************************************************* +CConsoleAlarmAlertLEDFlasher* CConsoleAlarmAlertLEDFlasher::NewL() + { + CConsoleAlarmAlertLEDFlasher* self = new(ELeave) CConsoleAlarmAlertLEDFlasher(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// +// +// + + +//************************************************************************************* +/** + * Start the flasher, if not busy + */ +TInt CConsoleAlarmAlertLEDFlasher::Start() + { + Stop(); + After(KFlasherPeriodicity); + return(SetRedLedOn(ETrue)); + } + + +//************************************************************************************* +/** + * Stop the LED flashing + */ +void CConsoleAlarmAlertLEDFlasher::Stop() + { + Cancel(); + SetRedLedOn(EFalse); + } + + +// +// +// + + +//************************************************************************************* +/** + * @see CActive + */ +void CConsoleAlarmAlertLEDFlasher::RunL() + { + if (iStatus!=KErrNone) + { + SetRedLedOn(EFalse); + return; + } + SetRedLedOn(!iLedOn); + After(KFlasherPeriodicity); + } + + +// +// +// + + +//************************************************************************************* +/** + * Turn the LED on or off + */ +TInt CConsoleAlarmAlertLEDFlasher::SetRedLedOn(TBool aOn) + { + const TInt KClearAllLeds = 0; + const TInt KLedMaskRed1 = 1; + + iLedOn = aOn; + if (iLedOn) + { + return HAL::Set(HAL::ELEDmask, KLedMaskRed1); + } + else + { + return HAL::Set(HAL::ELEDmask, KClearAllLeds); + } + } + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,131 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertserver.h" + +// System includes + +// User includes +#include "asaltdefs.h" +// +#include "consolealarmalertsession.h" + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + +// The Console Alarm Alert Server is migrated to a secure server in EKA2 +#include + + + +const TUint KRangeCount = 1; + +const TInt KOpCodeRanges[KRangeCount] = + { + 0 // All Op Codes from 0 to KMaxInt should pass. No restrictions + }; + + +const TUint8 KElementsIndex[KRangeCount] = + { + CPolicyServer::EAlwaysPass, //All OP Codes Allways passing no capability required + }; + + +const CPolicyServer::TPolicy KConsoleAlarmAlertServerPolicy = + { + CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass + KRangeCount, + KOpCodeRanges, + KElementsIndex, // what each range is compared to + KNullHandle //Since we have no specific policy checking + }; + + + +// +// ----> CConsoleAlarmAlertServer (source) +// + +//************************************************************************************* +CConsoleAlarmAlertServer::CConsoleAlarmAlertServer() + :CPolicyServer(CActive::EPriorityStandard, KConsoleAlarmAlertServerPolicy), iInstructionSet(NULL) + { + } + + + +//************************************************************************************* +CConsoleAlarmAlertServer::~CConsoleAlarmAlertServer() + { + if (iAttachment) + delete iAttachment; + } + + +//************************************************************************************* +void CConsoleAlarmAlertServer::ConstructL() + { + StartL(KAlarmAlertServerName); + } + + +//************************************************************************************* +CConsoleAlarmAlertServer* CConsoleAlarmAlertServer::NewLC() + { + CConsoleAlarmAlertServer* self = new(ELeave) CConsoleAlarmAlertServer(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// +// +// + + +//************************************************************************************* +CSession2* CConsoleAlarmAlertServer::NewSessionL(const TVersion& aVersion,const RMessage2& /*aMessage*/) const + { + const TVersion KServerVersion(KASAltVersionMajor, KASAltVersionMinor, KASAltVersionBuild); + if (!User::QueryVersionSupported(KServerVersion, aVersion)) + User::Leave(KErrNotSupported); + // + return CConsoleAlarmAlertSession::NewL((CConsoleAlarmAlertServer*)this); + } + + +// +// +// + + +//************************************************************************************* +TInt CConsoleAlarmAlertServer::RunError(TInt /*Error*/) + { + return KErrNone; + } + +void CConsoleAlarmAlertServer::SetAttachment(HBufC8* data) + { + if (iAttachment) + delete iAttachment; + iAttachment = data; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServerMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServerMain.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,117 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertservermain.h" + +// System includes + +// User includes +#include "asaltdefs.h" +// +#include "consolealarmalertserver.h" + +// Type definitions + +// Constants + +// Enumerations + +// Classes referenced + + +// +// ----> ConsoleAlarmAlertServer (source) +// + +//************************************************************************************* +EXPORT_C void ConsoleAlarmAlertServer::StartConsoleAlarmAlertServerL(TAny* instructionSet) + { + _LIT(KAlarmAlertServerThreadName, "ConsoleAlarmAlertServerThread"); + // + const TInt KStackSize = 0x0002000; // 8KB + const TInt KInitHeapSize = 0x0001000; // 4KB + const TInt KHeapSize = 0x1000000; // 16MB + // + // Is the alarm alert server already running? If so, don't + // start a new one... + TFullName name; + TFindServer finder(KAlarmAlertServerName); + if (finder.Next(name) == KErrNone) + return; + + RThread serverThread; + const TInt error = serverThread.Create(KAlarmAlertServerThreadName, + &StartServerThreadFunction, + KStackSize, + KInitHeapSize, + KHeapSize, + instructionSet + ); + User::LeaveIfError(error); + // + serverThread.SetPriority(EPriorityMore); + serverThread.Resume(); + // + User::After(2000000); // 2 seconds + } + + +// +// +// + + +//************************************************************************************* +TInt ConsoleAlarmAlertServer::StartServerThreadFunction(TAny* instructionSet) + { + __UHEAP_MARK; + // + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (!cleanup) + User::Invariant(); + // + TRAPD(err, StartServerL(instructionSet)); + delete cleanup; + // + __UHEAP_MARKEND; + return err; + } + + +//************************************************************************************* +void ConsoleAlarmAlertServer::StartServerL(TAny* instructionSet) + { + CActiveScheduler* scheduler = new CActiveScheduler(); + CleanupStack::PushL(scheduler); + CActiveScheduler::Install(scheduler); + // + + CConsoleAlarmAlertServer * tmp = CConsoleAlarmAlertServer::NewLC(); + tmp->AddResponseArray(instructionSet); + CActiveScheduler::Start(); + // + CleanupStack::PopAndDestroy(2, scheduler); + } + + + + + + +// +// ----> ConsoleAlarmAlertServer (source) +// + +//************************************************************************************* diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertSession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertSession.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,335 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "consolealarmalertsession.h" + +// System includes + +#include "e32svr.h" +// User includes +#include "asaltdefs.h" +//#include "..\..\Test\ConsoleANTestClient.h" +// +#include "consolealarmalertsession.h" +#include "consolealarmalertconsole.h" +#include "consolealarmalertledflasher.h" +#include "consolealarmalertserver.h" //for inter-session communication + +// Type definitions + +// Constants +const TInt KSlot0 = 0; +const TInt KSlot1 = 1; +const TInt KSlot2 = 2; + +// Enumerations + +// Classes referenced + + +// +// ----> CConsoleAlarmAlertSession (source) +// + +//************************************************************************************* +CConsoleAlarmAlertSession::CConsoleAlarmAlertSession(CConsoleAlarmAlertServer* aServer) +: iServer(aServer), iInstructionSet(NULL), iInstructionSetFound(EFalse) + { + } + + +//************************************************************************************* +CConsoleAlarmAlertSession::~CConsoleAlarmAlertSession() + { + CConsoleAlarmAlertSession* session = iServer->WaitingSession(); + session = NULL; + delete iSoundLEDFlasher; + delete iSoundCallbackTimer; + delete iConsole; + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::ConstructL() + { + iSoundLEDFlasher = CConsoleAlarmAlertLEDFlasher::NewL(); + iSoundCallbackTimer = CPeriodic::NewL(CActive::EPriorityIdle); + iConsole = new(ELeave) CConsoleAlarmAlertConsole(*this); + } + + +//************************************************************************************* +CConsoleAlarmAlertSession* CConsoleAlarmAlertSession::NewL(CConsoleAlarmAlertServer* aServer) + { + CConsoleAlarmAlertSession* self = new(ELeave) CConsoleAlarmAlertSession(aServer); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// +// +// + + +//************************************************************************************* +TTime CConsoleAlarmAlertSession::DeferTime() const + { + return iDeferTime; + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::Notify(TASAltAlertServerResponse aFlag) + { + if (iHasMessage) + { + iMsgPtr.Complete(aFlag); + iHasMessage = EFalse; + } + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::Notify(TASAltAlertServerResponse aFlag, const TTime& aDeferTime) + { + if (iHasMessage) + { + TPckgC time(aDeferTime); + TRAPD(err, iMsgPtr.WriteL(KSlot0, time)); + __ASSERT_DEBUG(err == KErrNone, User::Invariant()); + Notify(aFlag); + } + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertSession::ServiceL(const RMessage2& aMessage) + { + iMsgComplete = ETrue; + const TInt function = aMessage.Function(); + + //see if the server holds a set of instructions to be followed, + //rather than waiting for user input. + if(!iInstructionSetFound) //go look for it now. + { + //we will enter into this code only once + const CServer2* tmpServ = Server(); + const CConsoleAlarmAlertServer* specific = reinterpret_cast(tmpServ); + iInstructionSet = const_cast(specific)->ResponseArray(); + iInstructionSetFound = ETrue; + } + + // + switch(function) + { + case EASAltOpCodeNotify: + { + __ASSERT_ALWAYS(!iHasMessage, User::Invariant()); + iMsgComplete = EFalse; + iMsgPtr = aMessage; + iHasMessage = ETrue; + CConsoleAlarmAlertSession* session = iServer->WaitingSession(); + session = this; + break; + } + + case EASAltOpCodeNotifyCancel: + if (iHasMessage) + { + iHasMessage=EFalse; + iMsgPtr.Complete(KErrCancel); + } + break; + + case EASAltOpCodeVisible: + { + TBool isVisible = aMessage.Int0(); + iConsole->SetVisibility(isVisible); + iServer->SetNotifying(isVisible); + break; + } + + case EASAltOpCodeSetState: + iConsole->SetAlertState(aMessage.Int0()); + break; + + case EASAltOpCodeSetAlarm: + SetAlarmL(aMessage); + iConsole->iTimeInterval=0; + iConsole->UpdateDisplay(); + break; + + case EASAltOpCodeGetUserTime: + GetUserTimeL(aMessage); + break; + + case EASAltOpCodeSetDeferTime: + SetDeferTimeL(aMessage); + iConsole->UpdateDisplay(); + break; + + case EASAltOpCodeLogon: + __ASSERT_ALWAYS(!iLoggedOn, User::Invariant()); + iMsgComplete=EFalse; + iLoggedOn=ETrue; + break; + + case EASAltOpCodeStartPlayingSound: + { + iSoundLEDFlasher->Start(); + TCallBack callback(SoundPlaybackCallbackL, this); + iSoundCallbackTimer->Start(TTimeIntervalMicroSeconds32(0), TTimeIntervalMicroSeconds32(3000000), callback); + break; + } + + case EASAltOpCodeStopPlayingSound: + iSoundLEDFlasher->Stop(); + iSoundCallbackTimer->Cancel(); + break; + +#if 0 +//Test code + case EASAltTestOpCodeAcknowledgeAlarm: + if (iServer->WaitingSession()) + iServer->WaitingSession()->Notify(EASAltAlertServerResponseClear); + break; + + case EASAltTestOpCodeGetAttachment: + { + if (iServer->Attachment() != NULL) + { + const TDes8& data = iServer->Attachment()->Des(); + const TInt maxLength = static_cast(aMessage.Int0()); + if (data.Size() > maxLength) + User::Panic(_L("Client's buffer is too short"), KErrOverflow); + else + { + if (data.Length() == 0) + { + _LIT8(KEmpty,"Empty"); + aMessage.WriteL(KSlot1, KEmpty); + } + else + { + aMessage.WriteL(KSlot1, data); + } + iServer->SetAttachment(NULL); + } + } + } + break; + + case EASAltTestOpCodeGetIsNotifying: + { + TPckgC ret = iServer->IsNotifying(); + aMessage.WriteL(KSlot0, ret); + break; + } +#endif + default: + User::Invariant(); + break; + } + + if (iMsgComplete) + aMessage.Complete(KErrNone); + } + + +// +// +// + + +//************************************************************************************* +TBool CConsoleAlarmAlertSession::CmdL() + { + return KErrNone; + } + + +// +// +// + + +//************************************************************************************* +void CConsoleAlarmAlertSession::SetAlarmL(const RMessage2& aMessage) + { + TPckg pA(iAlarm); + aMessage.ReadL(KSlot0, pA); + if (iAlarm.HasAssociatedData()) + { + iAlarmAssociatedDataSize = aMessage.GetDesLength(2); + TPckg pB(iAlarmData); + aMessage.ReadL(KSlot2, pB); + + //Storing the data in the server for the test session to read.. + HBufC8* data = HBufC8::NewLC(iAlarmAssociatedDataSize); + TPtr8 pData(data->Des()); + aMessage.ReadL(KSlot2, pData); + iServer->SetAttachment(data); //Server takes an ownership + CleanupStack::Pop(data); + } + else + iAlarmAssociatedDataSize = 0; + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::GetUserTimeL(const RMessage2& aMessage) + { + TTime time; + time.HomeTime(); + time+=TTimeIntervalMinutes(iConsole->GetTimeInterval()); + TPtrC8 pTime((TUint8 *)&time,sizeof(TTime)); + aMessage.WriteL(KSlot0,pTime); + } + + +//************************************************************************************* +void CConsoleAlarmAlertSession::SetDeferTimeL(const RMessage2& aMessage) + { + TPckg pTime(iDeferTime); + aMessage.ReadL(KSlot0, pTime); + } + + +//************************************************************************************* +TBool CConsoleAlarmAlertSession::SoundPlaybackCallbackL(TAny* /*aSelf*/) + { +// _LIT(KPlayingSound, "Playing sound"); +// User::InfoPrint(KPlayingSound); + return ETrue; + } + +//************************************************************************************** +TAny * CConsoleAlarmAlertSession::InstructionSet() + { + return iInstructionSet; + } + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/ConsoleAlarmAlertServer/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/ConsoleAlarmAlertServer/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,19 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 ConsoleAlarmAlertServer +// +// + +PRJ_TESTMMPFILES +ConsoleAlarmAlertServer.mmp diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Group/Smoketest_Timew.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Group/Smoketest_Timew.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,63 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + + +TARGET Smoketest_Timew_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7775 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY WriteUserData ReadUserData + +SOURCEPATH ..\Src + +SOURCE TestTimewServer.cpp +SOURCE TestTimewSetAlarm.cpp +SOURCE TestTimewBase.cpp +SOURCE SM_ALM.CPP +SOURCE SM_UTL.CPP +SOURCE SM_MOD.CPP +SOURCE SM_RSP.CPP + +USERINCLUDE ..\Inc ..\..\Group +USERINCLUDE ..\ConsoleAlarmAlertServer\Include + + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +library BAFL.LIB +library FBSCLI.LIB +library WS32.LIB +library CONE.LIB +library DIAL.LIB +library FEPBASE.LIB +LIBRARY apparc.lib +LIBRARY etext.lib +LIBRARY estor.lib +LIBRARY efsrv.lib + +library AlarmClient.lib +library AlarmShared.lib +library EUSER.LIB +LIBRARY ecom.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 Timew smoketest +// +// + +PRJ_EXPORTS + +../Scripts/setup_Smoketest_Timew.script /epoc32/release/wins/udeb/z/smoketest/setup_smoketest_timew.script +../Scripts/setup_Smoketest_Timew.script /epoc32/release/wins/urel/z/smoketest/setup_smoketest_timew.script +../Scripts/setup_Smoketest_Timew.script /epoc32/release/winscw/udeb/z/smoketest/setup_smoketest_timew.script +../Scripts/setup_Smoketest_Timew.script /epoc32/release/winscw/urel/z/smoketest/setup_smoketest_timew.script + +../Scripts/Smoketest_Timew.script /epoc32/release/wins/udeb/z/smoketest/smoketest_timew.script +../Scripts/Smoketest_Timew.script /epoc32/release/wins/urel/z/smoketest/smoketest_timew.script +../Scripts/Smoketest_Timew.script /epoc32/release/winscw/udeb/z/smoketest/smoketest_timew.script +../Scripts/Smoketest_Timew.script /epoc32/release/winscw/urel/z/smoketest/smoketest_timew.script + +../TestData/Smoketest_Timew.ini /epoc32/release/wins/udeb/z/smoketest/smoketest_timew.ini +../TestData/Smoketest_Timew.ini /epoc32/release/wins/urel/z/smoketest/smoketest_timew.ini +../TestData/Smoketest_Timew.ini /epoc32/release/winscw/udeb/z/smoketest/smoketest_timew.ini +../TestData/Smoketest_Timew.ini /epoc32/release/winscw/urel/z/smoketest/smoketest_timew.ini + + +PRJ_TESTMMPFILES +Smoketest_Timew.mmp diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Inc/ALMMOD.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Inc/ALMMOD.H Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,121 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __ALMMOD_H__ +#define __ALMMOD_H__ + +// System includes +#include + +// User includes +#include "timewmod.h" + +// Constants +const TInt KArrayOfAlarmIdsGranularity = 64; +const TInt KPriorityAlarmIdleObserver=-0x0010; +const TInt KPriorityAlarmResponder=-0x0005; // Idle observer priority must be lower than this + +// The alarm model gives a general notification only +// +class CAlmIdleObserver : public CIdleObserver + { +public: + static CAlmIdleObserver* NewL(MTimewModelObserver* aObserver,TInt aIdlePriority); + }; + +class CAlmModel : public CModelBase + { +public: + ~CAlmModel(); + static CAlmModel* NewL(MTimewModelObserver* aObserver,TInt aResponderPriority); + virtual void ProcessResponder(TInt aStatus); +public: + TInt AlarmQuietPeriodMinutes() const; + TInt AlarmQuietPeriodSet(TInt aMinutes); + inline void AlarmQuietPeriodCancel(); + TTime AlarmQuietPeriodEnd() const; + // + void AlarmSoundToggle(); + TInt AlarmSoundStateSet(TBool aSoundOn); + TTimeWAlarmSoundState AlarmSoundState() const; + // + TInt ClockAlarmDelete(TInt aAlarmIndex); + TInt ClockAlarmEnable(TInt aAlarmIndex,TTimeWClockAlarmState aClockAlarmState); + TTimeWClockAlarmState ClockAlarmState(TInt aAlarmIndex) const; + TInt ClockAlarmSet(TInt aAlarmIndex,const TASShdAlarm& aInfo); + TInt ClockAlarmInfo(TInt aAlarmIndex,TASShdAlarm& aInfo); + // + void NextAlarmResetListL(); + void NextAlarmClearList(); + TInt NextAlarmNumber() const; + TInt NextAlarmDelete(TInt aIndex); + TBool NextAlarmCanDelete(TInt aIndex) const; + TInt NextAlarm(TFullName& aOwner, TASShdAlarm& aInfo) const; + TInt NextAlarmInfo(TInt aIndex, TFullName& aOwner, TASShdAlarm& aInfo) const; + // + TInt OrphanAlarmNumber() const; + inline TInt UnacknowledgedAlarmNumber() const; + // + void ReviewAlarmResetListL(); + void ReviewAlarmClearList(); + TInt ReviewAlarmNumber() const; + TInt ReviewAlarmInfo(TInt aIndex, TASShdAlarm& aInfo) const; + +private: + CAlmModel(); + void ConstructL(MTimewModelObserver* aObserver,TInt aResponderPriority); + +private: + + /** + * The list of clock alarms. Note that although there is always 8 + * alarms in this list, not all will be active. + */ + RPointerArray iClockAlarms; + + /** + * + */ + RASCliSession iAlmSvr; + + /** + * + */ + TRequestStatus iStatus; + + /** + * + */ + RArray iNextAlarmIds; + + /** + * + */ + RArray iReviewAlarmIds; + }; + + +TInt CAlmModel::UnacknowledgedAlarmNumber() const + { + TInt count = iAlmSvr.AlarmCountByState(EAlarmStateWaitingToNotify); + return (count + iAlmSvr.AlarmCountByState(EAlarmStateNotifying)); + } + +void CAlmModel::AlarmQuietPeriodCancel() + { + iAlmSvr.CancelAlarmSilence(); + } + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Inc/ALMMOD.INL --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Inc/ALMMOD.INL Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +// class CAlmModel +inline TAlarmSoundState CAlmModel::AlarmSoundState() const + { + return(iAlmSvr.AlarmSoundState()); + } +inline void CAlmModel::AlarmSoundStateSet(TBool aSoundOn) + { + iAlmSvr.SetAlarmSoundOn(aSoundOn); + } +inline void CAlmModel::AlarmSoundToggle() + { + iAlmSvr.SetAlarmSoundOn(iAlmSvr.AlarmSoundState()==EAlarmSoundOff); + } +inline TTime CAlmModel::AlarmQuietPeriodEnd() const + { + return(iAlmSvr.QuietPeriodUntil()); + } +inline void CAlmModel::AlarmQuietPeriodCancel() + { + iAlmSvr.QuietPeriodCancel(); + } +inline TInt CAlmModel::ClockAlarmDelete(TInt aClockAlarmNum) + { + __ASSERT_DEBUG(aClockAlarmNumReset(); + } +inline TInt CAlmModel::NextAlarmNumber() const + { + return(iAlmSvr.AlarmCount(RAlarmServer::ECountNext)); + } +inline void CAlmModel::ReviewAlarmResetListL() + { + iAlmSvr.AlarmArrayPopulateL(*iReviewAlarms,RAlarmServer::EArrayReview); + } +inline void CAlmModel::ReviewAlarmClearList() + { + iReviewAlarms->Reset(); + } +inline TInt CAlmModel::ReviewAlarmNumber() const + { + return(iAlmSvr.AlarmCount(RAlarmServer::ECountReview)); + } +inline TInt CAlmModel::OrphanAlarmNumber() const + { + return(iAlmSvr.AlarmCount(RAlarmServer::ECountOrphan)); + } +inline TInt CAlmModel::UnacknowledgedAlarmNumber() const + { + return(iAlmSvr.AlarmCount(RAlarmServer::ECountUnacknowledged)); + } + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Inc/SM_STD.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Inc/SM_STD.H Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,55 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __SM_STD_H__ +#define __SM_STD_H__ + +// System includes +#include +#include +#include + +// User includes +#include "timewmod.h" + +class CModelResponder : public CActive + { +public: + void Start(); + virtual void RunL(); + virtual void DoStart()=0; + virtual void DoCancel()=0; +protected: + CModelResponder(CModelBase &aModel,TInt aPriority); +private: + void NotifyModel(TInt aNotification); +private: + CModelBase *iModel; + }; + +class CAlmModel; +class CAlmResponder : public CModelResponder + { +public: + CAlmResponder(RASCliSession& aSvr,CAlmModel& aModel,TInt aResponderPriority); +public: + virtual void DoStart(); + virtual void DoCancel(); +private: + TAlarmId iAlarmId; + RASCliSession* iAlmSvr; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Inc/TIMEWMOD.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Inc/TIMEWMOD.H Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,145 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __TIMEWMOD_H__ +#define __TIMEWMOD_H__ + +// System includes +#include + +// Constants +const TInt KMaxClockAlarms = 8; + +/** + * From the old T32Alm.h file. Encapsulates the idea of + * a "Not set" alarm, which the new AlarmServer doesn't + * support. + */ +enum TTimeWClockAlarmState + { + ETimeWClockAlarmStateNotSet = 0, + ETimeWClockAlarmStateSet, + ETimeWClockAlarmStateDisabled + }; + +/** + * + */ +enum TTimeWAlarmSoundState + { + ETimeWAlarmSoundOn = 0, + ETimeWAlarmSoundOff, + ETimeWAlarmQuietPeriod + }; + +/** + * + */ +enum TInternalClockAlarmFlags + { + EClockAlarmFlagsIsSet = 1 + }; + +enum TModelPanic + { + EModelWorld = 0, + EModelObserver, + EModelOutOfRange, + EModel + }; +enum TModelFault + { + EModelfIdleObj = 0, + EModelfPriorityInvalid, + EModelfIdleArgument, + EModelfNoNotifier, + EModelfOutOfRange, + EModelfTime, + EModelfTryingToChangeStateOfNullClockAlarm, + EModelfTryingToGetInfoAboutNullClockAlarm, + EModelfTryingToOrphanClockAlarm + }; + +GLREF_C void Panic(TModelPanic aPanic); +GLREF_C void Fault(TModelFault aFault); + +class MTimewModelObserver + { +public: + virtual void HandleUpdate(TInt aNotification)=0; + }; + +class CIntermediateObserver : public CBase, public MTimewModelObserver + { +public: + CIntermediateObserver(); + virtual void HandleUpdate(TInt aNotification); + void SetTimewModelObserver(MTimewModelObserver* aObserver); +protected: + void Notify(TInt aNotification); +private: + MTimewModelObserver* iObserver; + }; + +class CIdleObserver : public CIntermediateObserver + { +public: + CIdleObserver(); + ~CIdleObserver(); + void ConstructL(MTimewModelObserver* aObserver,TInt aPriority); +public: + void CancelIdleRefresh(); + virtual void HandleUpdate(TInt aNotification); +protected: + virtual void DoIdleCancel(); + virtual void DoIdleNotify(); +private: + void StartIdleRefresh(); + static TInt IdleCallBack(TAny* aPtr); +private: + TInt iNotification; + CIdle* iIdle; + }; + +class CModelResponder; +class CModelBase : public CBase + { +protected: + CModelBase(); + +public: + ~CModelBase(); + +public: + void Stop(); + void Start(); + void SetTimewModelObserver(MTimewModelObserver* aObserver); + +protected: + void Notify(TInt aNotification); + virtual void ProcessResponder(TInt aStatus)=0; + void SetResponderActive(CModelResponder* aResponder); + +private: + void DoObserverNotify(TInt aNotification); + +private: + TBool iDoingViewNotify; + MTimewModelObserver* iObserver; + CModelResponder* iResponder; + friend class CModelResponder; + }; + +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Inc/TestTimewBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Inc/TestTimewBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewBase which is the base class for all +// the Psd Agx suite test steps +// +// + +#ifndef TEST_TIMEW_BASE_H +#define TEST_TIMEW_BASE_H + +#include "almmod.h" +#include + + +class CTestTimewBase : public CTestStep +{ +public: + CTestTimewBase(); + ~CTestTimewBase(); + virtual enum TVerdict doTestStepPreambleL(); + virtual enum TVerdict doTestStepPostambleL(); CAlmModel* Model(); + +private: + CActiveScheduler* iSchedular; + +protected: CAlmModel* iModel;}; + +#endif /* TEST_TIMEW_BASE_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Inc/TestTimewServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Inc/TestTimewServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewServer +// +// + +#ifndef TEST_TIMEW_SERVER_H +#define TEST_TIMEW_SERVER_H + +#include + +class CTestTimewServer : public CTestServer +{ +public: + static CTestTimewServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + +private: + void ConstructL(); +}; + +#endif /* TEST_TIMEW_SERVER_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Inc/TestTimewSetAlarm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Inc/TestTimewSetAlarm.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewSetAlarm +// +// + +#ifndef TEST_TIMEW_SET_ALARM_H +#define TEST_TIMEW_SET_ALARM_H + +#include "TestTimewBase.h" +#include + +class CTestTimewSetAlarm : public CTestTimewBase +{ +public: + CTestTimewSetAlarm(); + virtual ~CTestTimewSetAlarm(); + +public: + virtual enum TVerdict doTestStepL( void ); + +private: + void SetAlarmL( void ); + TASShdAlarm iAlarmData; +}; + +#endif /* TEST_TIMEW_SET_ALARM_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Scripts/Smoketest_Timew.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Scripts/Smoketest_Timew.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Timew smoketest +// +RUN_WS_PROGRAM 10 z:\sys\bin\timew.exe +// +DELAY 1500 +// +LOAD_SUITE Smoketest_Timew_Server +// +START_TESTCASE 8979 +RUN_TEST_STEP 1000 Smoketest_Timew_Server SetAlarm c:\Smoketest\Smoketest_Timew.ini 24560_SetAlarm +END_TESTCASE 8979 diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Scripts/setup_Smoketest_Timew.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Scripts/setup_Smoketest_Timew.script Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,22 @@ +// +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +RUN_UTILS MkDir c:\Smoketest\ + +RUN_UTILS CopyFile z:\smoketest\smoketest_timew.ini c:\smoketest\smoketest_timew.ini +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_timew.ini + +// RUN_SCRIPT Smoketest_Timew.script diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Src/SM_ALM.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Src/SM_ALM.CPP Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,489 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "almmod.h" +#include "sm_std.h" +#include + +// +// class CAlmModel +// + +CAlmModel::CAlmModel() +// +// Constructor +// + { + } + +CAlmModel::~CAlmModel() +// +// Destructor +// + { + Stop(); + iClockAlarms.ResetAndDestroy(); + iClockAlarms.Close(); + iReviewAlarmIds.Close(); + iNextAlarmIds.Close(); + iAlmSvr.Close(); + REComSession::FinalClose(); + } + +void CAlmModel::ConstructL(MTimewModelObserver* aObserver,TInt aResponderPriority) +// +// Construct the alarm engine components +// + { + SetTimewModelObserver(aObserver); + // + iReviewAlarmIds = RArray(KArrayOfAlarmIdsGranularity); + iNextAlarmIds = RArray(KArrayOfAlarmIdsGranularity); + // + const TInt r = iAlmSvr.Connect(); + User::LeaveIfError(r); + // + TInt i; + iClockAlarms = RPointerArray(KMaxClockAlarms); + for(i=0; i clockIds(KMaxClockAlarms); + CleanupClosePushL(clockIds); + iAlmSvr.GetAlarmIdListForCategoryL(KASCliCategoryClock, clockIds); + + // Put them in the slots - we can only display KMaxClockAlarms alarms + // so any beyond that are ignored. + TInt slotsUsedSoFar = 0; + const TInt count = Min(KMaxClockAlarms, clockIds.Count()); + for(i=0; iState() != EAlarmStateNotified) + { + // If we don't do this, then the alarm slot is treated + // as available. + ++slotsUsedSoFar; + alarm->ClientFlags().Set(EClockAlarmFlagsIsSet); + } + } + CleanupStack::PopAndDestroy(&clockIds); + // + CAlmResponder* pR=new(ELeave) CAlmResponder(iAlmSvr,*this,aResponderPriority); + SetResponderActive(pR); + } + +CAlmModel* CAlmModel::NewL(MTimewModelObserver* aObserver,TInt aResponderPriority) +// +// Create a new alarm engine +// + { + CAlmModel* model=new(ELeave) CAlmModel; + CleanupStack::PushL(model); + model->ConstructL(aObserver,aResponderPriority); + CleanupStack::Pop(model); + return(model); + } + +void CAlmModel::ProcessResponder(TInt aStatus) +// +// Interpret responder status +// + { + // FIX + if (aStatus!=KErrCancel && aStatus!=KErrNone) + Notify(aStatus); + else + Notify(0); + } + +TInt CAlmModel::AlarmQuietPeriodMinutes() const +// +// Return the time that sound is delayed until +// + { + TTime timeNow; + timeNow.HomeTime(); + TTime timeQuiet=AlarmQuietPeriodEnd(); + TInt quietMinutes; + if (timeQuiet<=timeNow || timeQuiet==Time::NullTTime()) + quietMinutes=0; + else + { + TTimeIntervalMinutes minutes; + timeQuiet.MinutesFrom(timeNow,minutes); + quietMinutes=minutes.Int()+1; + } + return(quietMinutes); + } + +TInt CAlmModel::AlarmQuietPeriodSet(TInt aMinutes) +// +// Delay alarm sounds for a given number of minutes +// + { + TInt ret = KErrNone; + // + if (!aMinutes) + ret = iAlmSvr.CancelAlarmSilence(); + else + ret = iAlmSvr.SetAlarmSoundsSilentFor(TTimeIntervalMinutes(aMinutes)); + // + return ret; + } + +TInt CAlmModel::ClockAlarmEnable(TInt aAlarmIndex, TTimeWClockAlarmState aClockAlarmState) +// +// Enable or disable a clock alarm +// + { + __ASSERT_DEBUG(aAlarmIndex < KMaxClockAlarms, Panic(EModelOutOfRange)); + // + TAlarmStatus newStatus; + switch(aClockAlarmState) + { + case ETimeWClockAlarmStateNotSet: + return ClockAlarmDelete(aAlarmIndex); + + case ETimeWClockAlarmStateSet: + newStatus = EAlarmStatusEnabled; + break; + + default: + case ETimeWClockAlarmStateDisabled: + newStatus = EAlarmStatusDisabled; + break; + } + + TASShdAlarm* alarm = iClockAlarms[aAlarmIndex]; + __ASSERT_ALWAYS(alarm->Id() != KNullAlarmId, Fault(EModelfTryingToChangeStateOfNullClockAlarm)); + TInt error = iAlmSvr.SetAlarmStatus(alarm->Id(), newStatus); + if (error != KErrNone) + return error; + + // Refetch alarm from server (will update status) + error = iAlmSvr.GetAlarmDetails(alarm->Id(), *alarm); + if (error == KErrNone) + alarm->ClientFlags().Set(EClockAlarmFlagsIsSet); + return error; + } + +TInt CAlmModel::ClockAlarmSet(TInt aAlarmIndex, const TASShdAlarm& aInfo) +// +// Set a clock alarm +// + { + __ASSERT_DEBUG(aAlarmIndex < KMaxClockAlarms, Panic(EModelOutOfRange)); + // + TInt error = KErrNone; + TASShdAlarm* alarm = iClockAlarms[aAlarmIndex]; + if (alarm->Id() != KNullAlarmId) + { + // There is already an alarm set in this slot. Delete + // the old, replace it with the new. + error = iAlmSvr.AlarmDelete(alarm->Id()); + if (error != KErrNone) + return error; + alarm->ClientFlags().Clear(EClockAlarmFlagsIsSet); + } + + // Add alarm (will also update cached alarm details) + *alarm = aInfo; + alarm->Category() = KASCliCategoryClock; + error = iAlmSvr.AlarmAdd(*alarm); + if (error == KErrNone) + alarm->ClientFlags().Set(EClockAlarmFlagsIsSet); + return error; + } + +TInt CAlmModel::ClockAlarmInfo(TInt aAlarmIndex,TASShdAlarm& aInfo) +// +// Get information about a clock alarm +// + { + __ASSERT_DEBUG(aAlarmIndex < KMaxClockAlarms, Panic(EModelOutOfRange)); + // + TInt error = KErrNone; + aInfo = *(iClockAlarms[aAlarmIndex]); + if (aInfo.Id() != KNullAlarmId && aInfo.ClientFlags().IsSet(EClockAlarmFlagsIsSet)) + { + // Preserve flags + const TBitFlags16 flags = aInfo.ClientFlags(); + + // Fetch alarm details + error = iAlmSvr.GetAlarmDetails(aInfo.Id(), aInfo); + + // Restore flags + if (error == KErrNone) + { + // Has the alarm already notified? + if (aInfo.State() != EAlarmStateQueued && aInfo.State() != EAlarmStateNotifying) + { + // Treat this slot as free + TASShdAlarm* alarm = iClockAlarms[aAlarmIndex]; + alarm->Reset(); + aInfo = *alarm; + } + else + aInfo.ClientFlags() = flags; + } + else if (error == KErrNotFound) + { + // Alarm has been deleted + TASShdAlarm* alarm = iClockAlarms[aAlarmIndex]; + alarm->Reset(); + aInfo = *alarm; + } + } + return error; + } + +TInt CAlmModel::ClockAlarmDelete(TInt aClockAlarmNum) + { + __ASSERT_DEBUG(aClockAlarmNum < KMaxClockAlarms, Panic(EModelOutOfRange)); + TASShdAlarm* alarm = iClockAlarms[aClockAlarmNum]; + __ASSERT_ALWAYS(alarm->Id() != KNullAlarmId, Fault(EModelfTryingToChangeStateOfNullClockAlarm)); + const TInt error = iAlmSvr.AlarmDelete(alarm->Id()); + if (error == KErrNone || error == KErrNotFound) + { + // Update cached representation of deleted alarm + alarm->Reset(); + } + return error; + } + +TTimeWClockAlarmState CAlmModel::ClockAlarmState(TInt aClockAlarmNum) const + { + __ASSERT_DEBUG(aClockAlarmNum < KMaxClockAlarms, Panic(EModelOutOfRange)); + // + const TASShdAlarm* alarm = iClockAlarms[aClockAlarmNum]; + if (alarm->ClientFlags().IsSet(EClockAlarmFlagsIsSet)) + { + switch(alarm->Status()) + { + case EAlarmStatusEnabled: + return ETimeWClockAlarmStateSet; + case EAlarmStatusDisabled: + return ETimeWClockAlarmStateDisabled; + } + } + return ETimeWClockAlarmStateNotSet; + } + +void CAlmModel::NextAlarmResetListL() +// +// Fetch a list of ids of all the alarms that are pending +// within the alarm server. +// + { + iAlmSvr.GetAlarmIdListByStateL(EAlarmStateQueued, iNextAlarmIds); + } + +void CAlmModel::NextAlarmClearList() + { + iNextAlarmIds.Reset(); + } + +TInt CAlmModel::NextAlarmNumber() const + { + return iAlmSvr.NumberOfAlarmsActiveInQueue(); + } + +TInt CAlmModel::NextAlarmDelete(TInt aIndex) +// +// Delete one of the next alarms +// + { + TInt ret = KErrNotFound; + if (aIndex < iNextAlarmIds.Count()) + { + const TAlarmId id = iNextAlarmIds[aIndex]; + ret = iAlmSvr.AlarmDelete(id); + } + return ret; + } + +TBool CAlmModel::NextAlarmCanDelete(TInt aIndex) const +// +// Determine whether can delete the specified alarm. +// + { + __ASSERT_DEBUG(aIndex < iNextAlarmIds.Count(), Panic(EModelOutOfRange)); + // + const TAlarmId id = iNextAlarmIds[aIndex]; + // + TASShdAlarm alarm; + if (iAlmSvr.GetAlarmDetails(id, alarm) == KErrNone) + { + return ( + alarm.Category() == KASCliCategoryClock || + alarm.State() == EAlarmStateSnoozed || + !alarm.HasOwningSession() + ); + } + return EFalse; + } + +TInt CAlmModel::NextAlarm(TFullName& aOwner, TASShdAlarm& aInfo) const +// +// Get information about the next alarm +// + { + aOwner = KNullDesC; + // + TAlarmId id = KNullAlarmId; + TInt ret = iAlmSvr.GetNextDueAlarmId(id); + if (ret == KErrNone) + { + if (id == KNullAlarmId) + { + aInfo.Reset(); + ret = KErrNotFound; + } + else + { + ret = iAlmSvr.GetAlarmDetails(id, aInfo); + if (ret == KErrNone) + ret = iAlmSvr.GetAlarmOwner(id, aOwner); + } + } + return ret; + } + +TInt CAlmModel::NextAlarmInfo(TInt aIndex, TFullName& aOwner, TASShdAlarm& aInfo) const +// +// Get info about the next alarm +// + { + TInt ret = KErrNotFound; + if (aIndex < iNextAlarmIds.Count()) + { + const TAlarmId id = iNextAlarmIds[aIndex]; + ret = iAlmSvr.GetAlarmDetails(id, aInfo); + if (ret == KErrNone) + { + ret = iAlmSvr.GetAlarmOwner(id, aOwner); + } + } + return ret; + } + +void CAlmModel::ReviewAlarmResetListL() + { + iAlmSvr.GetAlarmIdListByStateL(EAlarmStateNotified, iReviewAlarmIds); + } + +void CAlmModel::ReviewAlarmClearList() + { + iReviewAlarmIds.Reset(); + } + +TInt CAlmModel::ReviewAlarmNumber() const + { + return iAlmSvr.AlarmCountByState(EAlarmStateNotified); + } + +TInt CAlmModel::ReviewAlarmInfo(TInt aIndex, TASShdAlarm& aInfo) const +// +// Get information about a past alarm +// + { + TInt ret = KErrNotFound; + if (aIndex < iReviewAlarmIds.Count()) + { + const TAlarmId id = iReviewAlarmIds[aIndex]; + ret = iAlmSvr.GetAlarmDetails(id, aInfo); + } + return ret; + } + +void CAlmModel::AlarmSoundToggle() + { + TTimeWAlarmSoundState soundState = AlarmSoundState(); + if (soundState == ETimeWAlarmSoundOn) + AlarmSoundStateSet(EFalse); + else + AlarmSoundStateSet(ETrue); + } + +TInt CAlmModel::AlarmSoundStateSet(TBool aSoundOn) + { + TAlarmGlobalSoundState state = EAlarmGlobalSoundStateOn; + if (!aSoundOn) + state = EAlarmGlobalSoundStateOff; + + return iAlmSvr.SetAlarmSoundState(state); + } + +TTimeWAlarmSoundState CAlmModel::AlarmSoundState() const + { + // First check whether we're in a silent period + if (iAlmSvr.AlarmSoundsTemporarilySilenced()) + return ETimeWAlarmQuietPeriod; + + // We're not, so check global sound state and map + // to TimeW settings + TAlarmGlobalSoundState state = EAlarmGlobalSoundStateOff; + if (iAlmSvr.GetAlarmSoundState(state) == KErrNone) + { + if (state == EAlarmGlobalSoundStateOn) + return ETimeWAlarmSoundOn; + } + return ETimeWAlarmSoundOff; + } + +TTime CAlmModel::AlarmQuietPeriodEnd() const + { + TTime endTime; + if (iAlmSvr.GetAlarmSoundsSilentUntil(endTime) == KErrNone) + return endTime; + // + endTime.HomeTime(); + return endTime; + } + +TInt CAlmModel::OrphanAlarmNumber() const + { + // Get the alarms + RArray clockIds(KMaxClockAlarms); + CleanupClosePushL(clockIds); + iAlmSvr.GetAlarmIdListForCategoryL(KASCliCategoryClock, clockIds); + + //which are orphaned? + TInt count = clockIds.Count(); + TInt orphaned = 0; + for (TInt ii=0; iiHandleUpdate(aNotification); + iDoingViewNotify=EFalse; + } + +void CModelBase::SetResponderActive(CModelResponder* aResponder) +// +// Set the engines responder +// + { + iResponder=aResponder; + if (iResponder) + CActiveScheduler::Add(iResponder); + } + +void CModelBase::Start() +// +// Start the responder +// The engine requires that an active scheduler be installed +// + { + iResponder->Start(); + } + +void CModelBase::Stop() +// +// Stop the responder and the engine +// + { + if (iResponder) + iResponder->Cancel(); + } + +void CModelBase::SetTimewModelObserver(MTimewModelObserver *aObserver) +// +// Register the observer of the engine +// + { + iObserver=aObserver; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Src/SM_RSP.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Src/SM_RSP.CPP Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,91 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "sm_std.h" +#include "almmod.h" + +// +// class CModelResponder +// + +CModelResponder::CModelResponder(CModelBase& aModel,TInt aPriority) +// +// Base class constructor +// + : CActive(aPriority), iModel(&aModel) + { + } + +void CModelResponder::NotifyModel(TInt aStatus) +// +// Funnel all response to the engine +// + { + iModel->ProcessResponder(aStatus); + } + +void CModelResponder::RunL() +// +// Handle changes in the servers +// + { +// Reset the status request before notifiying the view +// so that it can catch anything untoward that the view does + TInt v=iStatus.Int(); + Start(); + NotifyModel(v); + } + +void CModelResponder::Start() +// +// Start the response +// + { + if (!IsActive()) + { + SetActive(); + DoStart(); + } + } + +// +// class CAlmResponder +// + +CAlmResponder::CAlmResponder(RASCliSession& aSvr,CAlmModel& aModel,TInt aResponderPriority) +// +// Protected constructor +// + : CModelResponder(aModel,aResponderPriority),iAlmSvr(&aSvr) + { + } + +void CAlmResponder::DoStart() +// +// Start a repsonse +// + { + iAlmSvr->NotifyChange(iStatus, iAlarmId); + } + +void CAlmResponder::DoCancel() +// +// Stop the response +// + { + if (iStatus == KRequestPending) + iAlmSvr->NotifyChangeCancel(); + } + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Src/SM_UTL.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Src/SM_UTL.CPP Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,34 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "sm_std.h" + + +GLDEF_C void Panic(TModelPanic aPanic) +// +// Panic in the engine +// + { + User::Panic(_L("TW-ENG-PANIC"),aPanic); + } + +GLDEF_C void Fault(TModelFault aFault) +// +// Fault in the engine +// + { + User::Panic(_L("TW-ENG-FAULT"),aFault); + } + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Src/TestTimewBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Src/TestTimewBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,62 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewCase which is the base class for all the Timew TestCase DLL +// +// + +// EPOC includes +#include +#include +#include +#include +#include "TestTimewbase.h" + +CTestTimewBase::CTestTimewBase() +: CTestStep() +, iSchedular(NULL) +, iModel(NULL) + { + } + +// destructor +CTestTimewBase::~CTestTimewBase() + { + delete iSchedular; + iSchedular=NULL; + } + +enum TVerdict CTestTimewBase::doTestStepPreambleL() + { + iSchedular=new CActiveScheduler(); + CActiveScheduler::Install(iSchedular); + + return CTestStep::doTestStepPreambleL(); + } + +enum TVerdict CTestTimewBase::doTestStepPostambleL() + { + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + + return CTestStep::doTestStepPostambleL(); + } + +CAlmModel* CTestTimewBase::Model(void) +/** +returns a pointer to an instance of CAgnModel +*/ + { + return iModel; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Src/TestTimewServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Src/TestTimewServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,106 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 main DLL entry point for the Smoketest_Timew.dll +// +// + + +// EPOC includes +#include + +#include "TestTimewServer.h" +#include "TestTimewSetAlarm.h" + + +_LIT(KServerName,"Smoketest_Timew_Server"); + +CTestTimewServer* CTestTimewServer::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. + */ + { + CTestTimewServer* server = new (ELeave) CTestTimewServer(); + CleanupStack::PushL(server); + // CServer base class call + server->StartL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +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().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTestTimewServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTestTimewServer::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()); + if (!err) { } + + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + } + + +CTestStep* CTestTimewServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Secure and non-secure variants + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep = NULL; + + if(aStepName == _L("SetAlarm")) + testStep = new CTestTimewSetAlarm(); + return testStep; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/Src/TestTimewSetAlarm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/Src/TestTimewSetAlarm.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,84 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimewSetAlarm +// +// + +#include + +#include "TestTimewSetAlarm.h" + + +_LIT(KHour, "hour"); +_LIT(KMinute,"minute"); +_LIT(KMessage,"message"); +_LIT(KBells,"bells"); + + +// constructor +CTestTimewSetAlarm::CTestTimewSetAlarm() + { + SetTestStepName(_L("SetAlarm")); + } + +// destructor +CTestTimewSetAlarm::~CTestTimewSetAlarm() + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestTimewSetAlarm::doTestStepL( void ) + { + // Printing to the console and log file + INFO_PRINTF1(_L("TEST-> SETTING AN ALARM")); + TRAPD(r, SetAlarmL()); + + if (r!=KErrNone) + SetTestStepResult(EFail); + + // test steps return a result + return TestStepResult(); + } + +void CTestTimewSetAlarm::SetAlarmL( void ) + { + TInt hour; + TInt minute; + TPtrC ptrMessage; + + TTime alarmTime; + alarmTime.HomeTime(); + + if ( !GetIntFromConfig(ConfigSection(), KHour(), hour) ) + hour=alarmTime.DateTime().Hour(); + + if ( !GetIntFromConfig(ConfigSection(), KMinute(), minute) ) + minute=0; + + GetStringFromConfig(ConfigSection(), KMessage(), ptrMessage); + + + TDateTime dateTime=alarmTime.DateTime(); + dateTime.SetHour(hour); + dateTime.SetMinute(minute); + dateTime.SetSecond(0); + dateTime.SetMicroSecond(0); + iAlarmData.NextDueTime()=dateTime; + iAlarmData.RepeatDefinition()=(TAlarmRepeatDefinition)EAlarmRepeatDefintionRepeatNext24Hours; + iAlarmData.Message() = ptrMessage; + iAlarmData.SoundName()=KBells(); + iModel = CAlmModel::NewL(NULL,KPriorityAlarmResponder); + Model()->ClockAlarmSet(0,iAlarmData); + delete iModel; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/TestData/Smoketest_Timew.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/TestData/Smoketest_Timew.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,5 @@ +[24560_SetAlarm] +hour =9 +min =0 +message =make a cup of tea + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/bmarm/CONSOLEALARMALERTSERVERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/bmarm/CONSOLEALARMALERTSERVERU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,2 @@ +EXPORTS + StartConsoleAlarmAlertServerL__23ConsoleAlarmAlertServerPv @1 NONAME ; public: static void __cdecl ConsoleAlarmAlertServer::StartConsoleAlarmAlertServerL(void *) diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/bwins/CONSOLEALARMALERTSERVERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/bwins/CONSOLEALARMALERTSERVERU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?StartConsoleAlarmAlertServerL@ConsoleAlarmAlertServer@@SAXPAX@Z @ 1 NONAME ; public: static void __cdecl ConsoleAlarmAlertServer::StartConsoleAlarmAlertServerL(void *) + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/bwins/SMOKETEST_TIMEW_SERVERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/bwins/SMOKETEST_TIMEW_SERVERU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewServer@@YAHXZ @ 1 NONAME ; int __cdecl NewServer(void) + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Timew/eabi/ConsoleAlarmAlertServerU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Timew/eabi/ConsoleAlarmAlertServerU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,11 @@ +EXPORTS + _ZN23ConsoleAlarmAlertServer29StartConsoleAlarmAlertServerLEPv @ 1 NONAME + _ZTI24CConsoleAlarmAlertServer @ 2 NONAME ; ## + _ZTI25CConsoleAlarmAlertConsole @ 3 NONAME ; ## + _ZTI25CConsoleAlarmAlertSession @ 4 NONAME ; ## + _ZTI28CConsoleAlarmAlertLEDFlasher @ 5 NONAME ; ## + _ZTV24CConsoleAlarmAlertServer @ 6 NONAME ; ## + _ZTV25CConsoleAlarmAlertConsole @ 7 NONAME ; ## + _ZTV25CConsoleAlarmAlertSession @ 8 NONAME ; ## + _ZTV28CConsoleAlarmAlertLEDFlasher @ 9 NONAME ; ## + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Inc/SmokeTestActive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Inc/SmokeTestActive.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,115 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestActive +// +// + +#if (!defined __SMOKETEST_ACTIVE_H__) +#define __SMOKETEST_ACTIVE_H__ + +#include + +/** + * Multimedia test timer completion callback + */ +class MTestActiveCallback + { +public: + /** + * Method from which CTestActive informs the user RunL call + */ + virtual void RunL() = 0; + /** + * Method from which CTestActive informs the user DoCancel call + */ + virtual void DoCancel() = 0; + }; + +/** + * Test Active Notification class + * + */ +class CTestActive : public CActive +{ +public: + /** + * Destructor + */ + IMPORT_C virtual ~CTestActive(); + + /** + * Two phase constructor that allocates and constructs + * a new Active object whos actions are performed by a callback + * + * \param aTestActiveCallback object to inform on RunL. + * \param aPriority priority of active object. + * \return New Callback active object. + */ + IMPORT_C static CTestActive* NewL(MTestActiveCallback& aTestActiveCallback, TInt aPriority=EPriorityStandard); + + /** + * Two phase constructor that allocates and constructs + * a new Active object whos actions are performed by a callback + * + * \param aTestActiveCallback object to inform on RunL. + * \param aPriority priority of active object. + * \return New Callback active object. + */ + IMPORT_C static CTestActive* NewLC(MTestActiveCallback& aTestActiveCallback, TInt aPriority=EPriorityStandard); + + /** + * Activate the object + */ + IMPORT_C void Activate(); + + /** + * Active object RunL implementation. + * + * Calls the MTestActiveCallback::RunL to inform user that the RunL has been reached. + */ + void RunL(); + /** + * Active object DoCancel implementation. + * + * Calls the MTestActiveCallback::DoCancel to inform user that the DoCancel has been reached. + */ + void DoCancel(); + +protected: + /** + * 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. + */ + CTestActive(MTestActiveCallback& aTestActiveCallback, TInt aPriority); + +private: + /** + * This is internal and not intended for use. + * + * Second phase of two phase constructor. + */ + void ConstructL(); + +private: + /** + * This is internal and not intended for use. + */ + MTestActiveCallback& iTestActiveCallback; +}; + +#endif /* __SMOKETEST_ACTIVE_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Inc/SmokeTestProperty.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Inc/SmokeTestProperty.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,93 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestProperty +// +// + +#if (!defined __SMOKETEST_PROPERTY_H__) +#define __SMOKETEST_PROPERTY_H__ + +// EPOC includes +#include +#include + +/** + This class contains generic utility method to set system wide variable usign publish and subscribe +*/ +class CTestProperty : public CBase +{ +public: + IMPORT_C CTestProperty(CTestStep& aTestStep); + IMPORT_C ~CTestProperty(); + + /** + * Set a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key + */ + IMPORT_C TInt SetPropertyL(const TUid aCategory, const TInt aKey, const TInt aValue); + + /** + * Set a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key + */ + IMPORT_C TInt SetPropertyL(const TUid aCategory, const TInt aKey, const TDesC8& aValue); + + /** + * Set a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key + */ + IMPORT_C TInt SetPropertyL(const TUid aCategory, const TInt aKey, const TDesC16& aValue); + + /** + * Get a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key returned + */ + IMPORT_C TInt GetPropertyL(const TUid aCategory, const TInt aKey, TInt& aValue); + + /** + * Get a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key returned + */ + IMPORT_C TInt GetPropertyL(const TUid aCategory, const TInt aKey, TDes8& aValue); + + /** + * Get a property + * + * \param aCategory catagory of the RProperty + * \param aKey key of the catagory + * \param aValue value of the key returned + */ + IMPORT_C TInt GetPropertyL(const TUid aCategory, const TInt aKey, TDes16& aValue); + +private: + CTestStep& iTestStep; + RProperty iProperty; +}; + +#endif /* __SMOKETEST_PROPERTY_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Inc/SmokeTestSecureFSclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Inc/SmokeTestSecureFSclient.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +#ifndef __SMOKETEST_SECURE_FS_CLIENT_H__ +#define __SMOKETEST_SECURE_FS_CLIENT_H__ + +#include + +class RTestSecureFSclient : public RSessionBase + { +public: + IMPORT_C TInt Connect(); + IMPORT_C TInt SetHomeTime(const TTime& aTime); + IMPORT_C TInt DeleteFileL(const TDesC& aFileName); + IMPORT_C void KillProcessL(const TDesC& aProcessName); + IMPORT_C TInt ChangeLocaleName(const TDesC& aLocaleDllName); + IMPORT_C TInt CheckForFile(const TDesC& aFileName); + IMPORT_C TInt CopyFile(const TDesC& Source, const TDesC& Dest); + IMPORT_C void SetUpFbs(); + }; + +#endif // __SMOKETEST_SECURE_FS_CLIENT_H__ \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Inc/SmokeTestSecureFSclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Inc/SmokeTestSecureFSclientserver.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// clientserver - shared client/server definitions +// +// + +#ifndef __SMOKETEST_SECURE_FS_CLIENT_SERVER_H__ +#define __SMOKETEST_SECURE_FS_CLIENT_SERVER_H__ + +#include + +_LIT(KTestServerName,"SmokeTestSecureFSserver"); +_LIT(KTestServerImg,"SmokeTestSecureFSserver"); // EXE name +const TUid KServerUid3={0x101FF346}; + +const TInt KMaxTestMessage=8; + +enum TTestIpc + { + ETestIpcSetHomeTime, + ETestIpcDeleteFile, + ETestIpcKillProcess, + ETestIpcChangeLocale, + ETestIpcCheckForFile, + ETestIpcCopyFile, + ETestIpcSetUpFbs, + }; + +#endif // __SMOKETEST_SECURE_FS_CLIENT_SERVER_H__ \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Inc/SmokeTestSecureFSserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Inc/SmokeTestSecureFSserver.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// TestServer - server classes +// +// + +#ifndef __SMOKETEST_SECURE_FS_SERVER_H__ +#define __SMOKETEST_SECURE_FS_SERVER_H__ + +#include +#include "SmokeTestSecureFSclientserver.h" + +enum TTestPanic + { + EPanicBadDescriptor, + EPanicIllegalFunction, + EPanicAlreadyReceiving + }; + +void PanicClient(const RMessage2& aMessage,TTestPanic TMyPanic); + +class CTestSecureFSshutdown : public CTimer + { + enum {KMyShutdownDelay=0x500000}; // approx 5s +public: + inline CTestSecureFSshutdown(); + inline void ConstructL(); + inline void Start(); +private: + void RunL(); + }; + +class CTestSecureFSserver : public CServer2 + { +public: + static CServer2* NewLC(); + void AddSession(); + void DropSession(); + void Send(const TDesC& aMessage); +private: + CTestSecureFSserver(); + void ConstructL(); + // CSharableSession* NewSessionL(const TVersion& aVersion, const RMessage& aMessage) const; + CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; +private: + TInt iSessionCount; + CTestSecureFSshutdown iShutdown; + }; + +//class CTestSecureFSSession : public CSharableSession +class CTestSecureFSSession : public CSession2 + { +public: + CTestSecureFSSession(); + void CreateL(); + void Send(const TDesC& aMessage); +private: + ~CTestSecureFSSession(); + inline CTestSecureFSserver& Server(); + void ServiceL(const RMessage2& aMessage); + void ServiceError(const RMessage2& aMessage,TInt aError); + inline TBool ReceivePending() const; +private: + void DoSetHomeTime(const RMessage2& aMessage); + + // General File Manipulation + TInt DoDeleteFileL(const RMessage2& aMessage); + + // Power User + void DoKillProcess(const RMessage2& aMessage); + TInt DoChangeLocale(const RMessage2& aMessage); + TInt DoCheckForFile(const RMessage2& aMessage); + TInt DoCopyFile(const RMessage2& aMessage); + void DoSetUpFbs(); + +private: + RMessage2 iReceive; + }; + +#endif // __SMOKETEST_SECURE_FS_SERVER_H__ \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Inc/SmokeTestTimeOutTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Inc/SmokeTestTimeOutTimer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,102 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestTimeOutTimer +// +// + +#if (!defined __SMOKETEST_TIMEOUT_TIMER_H_) +#define __SMOKETEST_TIMEOUT_TIMER_H_ + +#include + +/** + * Multimedia test timer completion callback + */ +class MTestTimeOutTimerCallback + { +public: + /** + * Method from which CTestTimeOutTimer informs the user of the timer completion. + */ + virtual void TimerCompleted() = 0; + }; + +/** + * Multimedia test timer active object. + * + * On timer completion MTestTimeOutTimerCallback::TimerCompleted is called + * to inform the user off the completion + */ +class CTestTimeOutTimer : public CTimer +{ +public: + /** + * Destructor + */ + IMPORT_C virtual ~CTestTimeOutTimer(); + + /** + * Two phase constructor that allocates and constructs + * a new Multimedia timer a timer completion callback and priority. + * + * \param aTestTimerCallback object to inform on timer completion. + * \param aPriority priority of active object. + * \return New Multimedia test timer active object. + */ + IMPORT_C static CTestTimeOutTimer* NewL(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority=EPriorityStandard); + + /** + * Two phase constructor that allocates and constructs + * a new Multimedia timer a timer completion callback and priority. + * + * \param aTestTimerCallback object to inform on timer completion. + * \param aPriority priority of active object. + * \return New Multimedia test timer active object. + */ + IMPORT_C static CTestTimeOutTimer* NewLC(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority=EPriorityStandard); + + /** + * Active object RunL implementation. + * + * Calls the MTestTimeOutTimerCallback::TimerCompleted to inform user that the timer has completed. + */ + void RunL(); + +protected: + /** + * 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. + */ + CTestTimeOutTimer(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority); + +private: + /** + * This is internal and not intended for use. + * + * Second phase of two phase constructor. + */ + void ConstructL(); + +private: + /** + * This is internal and not intended for use. + */ + MTestTimeOutTimerCallback& iTestTimerCallback; +}; + +#endif /* __SMOKETEST_TIMEOUT_TIMER_H_ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Inc/TestStepSmokeTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Inc/TestStepSmokeTest.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,80 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestStepSmokeTest +// +// + +#if (!defined __TEST_STEP_SMOKETEST_H__) +#define __TEST_STEP_SMOKETEST_H__ + +//TEF include +#include +#include "Configuration.cfg" + +enum TTestLoggingDetail + { + ETestLoggingDetail_Min, + ETestLoggingDetail_Normal, + ETestLoggingDetail_Max, + }; + +#if (defined __VERSION_70S__) +enum TCapability + { + ECapabilityTCB = 0, + }; +#endif + +/** + This class is the base class for all the test steps in smoketest. +*/ +class CTestStepSmokeTest : public CTestStep + { +public: + //Destructor + IMPORT_C virtual ~CTestStepSmokeTest(); + + /** + Pure virtual, to be implemented by the derived test steps. + It implements the required functionality of the test step. + @return TVerdict - result of the test step + @leave - System wide error codes + */ + IMPORT_C virtual enum TVerdict doTestStepL() = 0; + + //Implements the preoperational functionalities for a test step + IMPORT_C virtual enum TVerdict doTestStepPreambleL(); + + //Implements the post operational fucntionalities for a test step + IMPORT_C virtual enum TVerdict doTestStepPostambleL(); + + TTestLoggingDetail LoggingDetail() const { return iLoggingDetail; } + TInt Repetition() const { return iRepetition; } + +protected: + //Constructor + IMPORT_C CTestStepSmokeTest(); + + //Gets the TCapability value for the capabilty string literal + IMPORT_C TInt GetCapability(TPtrC aCapability, TCapability& aCapabilityValue); + + //Verifies the given time is nearly eaual to current UTC time + IMPORT_C TBool VerifyUTCTime(TTime aTime); + +private: + TTestLoggingDetail iLoggingDetail; + TInt iRepetition; + }; + +#endif /* __TEST_STEP_SMOKETEST_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Src/SmokeTestActive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Src/SmokeTestActive.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,69 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// SmokeTestTestActive.h +// This contains CTestActive +// +// + +#include "SmokeTestActive.h" + + +// +// Construction/Destruction +// + +EXPORT_C CTestActive::~CTestActive() + { + } + +EXPORT_C CTestActive* CTestActive::NewL(MTestActiveCallback& aTestActiveCallback, TInt aPriority) + { + CTestActive* self=NewLC(aTestActiveCallback, aPriority); + CleanupStack::Pop(); + return self; + } + +EXPORT_C CTestActive* CTestActive::NewLC(MTestActiveCallback& aTestActiveCallback, TInt aPriority) + { + CTestActive* self=new(ELeave) CTestActive(aTestActiveCallback, aPriority); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +EXPORT_C void CTestActive::Activate() + { + SetActive(); + } + +CTestActive::CTestActive(MTestActiveCallback& aTestActiveCallback, TInt aPriority) +: CActive(aPriority) +, iTestActiveCallback(aTestActiveCallback) + { + } + +void CTestActive::ConstructL() + { + CActiveScheduler::Add(this); + } + +void CTestActive::RunL() + { + iTestActiveCallback.RunL(); + } + +void CTestActive::DoCancel() + { + iTestActiveCallback.DoCancel(); + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Src/SmokeTestProperty.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Src/SmokeTestProperty.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,140 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestProperty +// +// + +#include "SmokeTestProperty.h" + +// EPOC32 include +#include + +EXPORT_C CTestProperty::CTestProperty(CTestStep& aTestStep) +: CBase() +, iTestStep(aTestStep) + { + } + +EXPORT_C CTestProperty::~CTestProperty() + { + } + +EXPORT_C TInt CTestProperty::SetPropertyL(const TUid aCategory, const TInt aKey, const TInt aValue) + { + //Define the property, in case it is being used for the first time. + TInt ret=RProperty::Define(aCategory, aKey, RProperty::EInt); + if ( (ret==KErrNone) || (ret== KErrAlreadyExists) ) + { + //Attach to the property so that you can track any chnages to it. + ret=iProperty.Attach(aCategory, aKey); + if ( ret==KErrNone ) + { + //Set the new test number and wait until the change is in effect. + TRequestStatus status; + iProperty.Subscribe(status); + ret=iProperty.Set(aCategory, aKey, aValue); + if ( ret==KErrNone ) + { + User::WaitForRequest(status); + ret=status.Int(); + if ( ret != KErrNone ) + { + iTestStep.INFO_PRINTF2(_L("request complete error=%d"), ret); + } + } + else + { + iTestStep.INFO_PRINTF2(_L("RProperty::Set error=%d"), ret); + } + iProperty.Close(); + } + else + { + iTestStep.INFO_PRINTF2(_L("RProperty::Attach error=%d"), ret); + } + } + else + { + iTestStep.INFO_PRINTF2(_L("RProperty::Define error=%d"), ret); + } + + return ret; + } + +EXPORT_C TInt CTestProperty::SetPropertyL(const TUid aCategory, const TInt aKey, const TDesC8& aValue) + { + //Define the property, in case it is being used for the first time. + TInt ret=RProperty::Define(aCategory, aKey, RProperty::EByteArray); + if ( (ret==KErrNone) || (ret== KErrAlreadyExists) ) + { + //Attach to the property so that you can track any chnages to it. + ret=iProperty.Attach(aCategory, aKey); + if ( ret==KErrNone ) + { + //Set the new test number and wait until the change is in effect. + TRequestStatus status; + iProperty.Subscribe(status); + ret=iProperty.Set(aCategory, aKey, aValue); + if ( ret==KErrNone ) + { + User::WaitForRequest(status); + ret=status.Int(); + } + iProperty.Close(); + } + } + + return ret; + } + +EXPORT_C TInt CTestProperty::SetPropertyL(const TUid aCategory, const TInt aKey, const TDesC16& aValue) + { + //Define the property, in case it is being used for the first time. + TInt ret=RProperty::Define(aCategory, aKey, RProperty::EText); + if ( (ret==KErrNone) || (ret== KErrAlreadyExists) ) + { + //Attach to the property so that you can track any chnages to it. + ret=iProperty.Attach(aCategory, aKey); + if ( ret==KErrNone ) + { + //Set the new test number and wait until the change is in effect. + TRequestStatus status; + iProperty.Subscribe(status); + ret=iProperty.Set(aCategory, aKey, aValue); + if ( ret==KErrNone ) + { + User::WaitForRequest(status); + ret=status.Int(); + } + iProperty.Close(); + } + } + + return ret; + } + +EXPORT_C TInt CTestProperty::GetPropertyL(const TUid aCategory, const TInt aKey, TInt& aValue) + { + return RProperty::Get(aCategory, aKey, aValue); + } + +EXPORT_C TInt CTestProperty::GetPropertyL(const TUid aCategory, const TInt aKey, TDes8& aValue) + { + return RProperty::Get(aCategory, aKey, aValue); + } + +EXPORT_C TInt CTestProperty::GetPropertyL(const TUid aCategory, const TInt aKey, TDes16& aValue) + { + return RProperty::Get(aCategory, aKey, aValue); + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Src/SmokeTestSecureFSclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Src/SmokeTestSecureFSclient.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,113 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 - client interface implementation +// +// + +#include +#include +#include "SmokeTestSecureFSclientserver.h" +#include "SmokeTestSecureFSclient.h" + +static TInt StartServer() +// +// Start the server process. Simultaneous launching +// of two such processes should be detected when the second one attempts to +// create the server object, failing with KErrAlreadyExists. +// + { + const TUidType serverUid(KNullUid,KNullUid,KServerUid3); + + + RProcess server; + TInt r=server.Create(KTestServerImg, KNullDesC, serverUid); + + 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 + // 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 + r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); + server.Close(); + return r; + } + +EXPORT_C TInt RTestSecureFSclient::Connect() + {// Connect to the server, attempting to start it if necessary + TInt retry=2; + for (;;) + { + TInt r=CreateSession(KTestServerName,TVersion(0,0,0),1); + if (r!=KErrNotFound && r!=KErrServerTerminated) + return r; + if (--retry==0) + return r; + r=StartServer(); + if (r!=KErrNone && r!=KErrAlreadyExists) + return r; + User::After(1000000); //Let server load up (in EKA2) + + } + } + +EXPORT_C TInt RTestSecureFSclient::SetHomeTime(const TTime& aTime) + { + TPckg pckg(aTime); + return SendReceive(ETestIpcSetHomeTime,TIpcArgs(&pckg)); + } + +EXPORT_C TInt RTestSecureFSclient::DeleteFileL(const TDesC& aFileName) + { + TIpcArgs args(&aFileName); + return SendReceive(ETestIpcDeleteFile,args); + } + +EXPORT_C void RTestSecureFSclient::KillProcessL(const TDesC& aProcessName) + { + TIpcArgs args(&aProcessName); + User::LeaveIfError(SendReceive(ETestIpcKillProcess,args)); + } + +EXPORT_C TInt RTestSecureFSclient::ChangeLocaleName(const TDesC& aLocaleDllName) + { + TIpcArgs args(&aLocaleDllName); + return SendReceive(ETestIpcChangeLocale,args); + } + +EXPORT_C TInt RTestSecureFSclient::CheckForFile(const TDesC& aFileName) + { + TIpcArgs args(&aFileName); + return SendReceive(ETestIpcCheckForFile,args); + } + +EXPORT_C TInt RTestSecureFSclient::CopyFile(const TDesC& Source, const TDesC& Dest) + { + TIpcArgs args(&Source, &Dest); + return SendReceive(ETestIpcCopyFile,args); + } + +EXPORT_C void RTestSecureFSclient::SetUpFbs() + { + SendReceive(ETestIpcSetUpFbs); + } + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Src/SmokeTestSecureFSserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Src/SmokeTestSecureFSserver.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,393 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestServer - server implementation +// +// + +#include "e32std.h" +#include "SmokeTestSecureFSserver.h" +#include + +TRequestStatus aStatus; +TRequestStatus* aSt = &aStatus; + + +inline CTestSecureFSshutdown::CTestSecureFSshutdown() + :CTimer(-1) + {CActiveScheduler::Add(this);} +inline void CTestSecureFSshutdown::ConstructL() + {CTimer::ConstructL();} +inline void CTestSecureFSshutdown::Start() + {After(KMyShutdownDelay);} + +inline CTestSecureFSserver::CTestSecureFSserver() + :CServer2(0,ESharableSessions) + {} + +inline CTestSecureFSSession::CTestSecureFSSession() + {} +inline CTestSecureFSserver& CTestSecureFSSession::Server() + {return *static_cast(const_cast(CSession2::Server()));} +inline TBool CTestSecureFSSession::ReceivePending() const + {return !iReceive.IsNull();} + +// + +void CTestSecureFSSession::CreateL() +// +// 2nd phase construct for sessions - called by the CServer framework +// + { + //RDebug::Print(_L("Server::CTestSecureFSSession::CreateL - start")); + + Server().AddSession(); + //RDebug::Print(_L("Server::CTestSecureFSSession::CreateL - end")); + } + +CTestSecureFSSession::~CTestSecureFSSession() + { + Server().DropSession(); + } + +void CTestSecureFSSession::Send(const TDesC& aMessage) +// +// Deliver the message to the client, truncating if required +// If the write fails, panic the client, not the sender +// + { + if (ReceivePending()) + { + TPtrC m(aMessage); + if (iReceive.Int1() pckg; + aMessage.Read(0,pckg); + User::SetHomeTime(pckg()); + } + +TInt CTestSecureFSSession::DoDeleteFileL(const RMessage2& aMessage) + { + RFs fs; + TFileName* const fileName=new(ELeave) TFileName; + CleanupStack::PushL(fileName); + User::LeaveIfError(fs.Connect()); + + CleanupClosePushL(fs); + aMessage.ReadL(0,*fileName); + TInt err=fs.Delete(*fileName); + if (!(err==KErrNone || err==KErrNotFound || err==KErrPathNotFound)) // ignore not found error + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(&fs); + CleanupStack::PopAndDestroy(fileName); + return err; + } + +void CTestSecureFSSession::DoKillProcess(const RMessage2& aMessage) + { + TFullName* name = new(ELeave) TFullName; + CleanupStack::PushL(name); + + aMessage.ReadL(0,*name); + TFindProcess* finder = new (ELeave) TFindProcess(*name); + CleanupStack::PushL(finder); + RProcess* process = new (ELeave) RProcess; + CleanupStack::PushL(process); + + if (finder->Next(*name) == KErrNone) + { + if (process->Open(*name) == KErrNone) + { + process->Kill(KErrNone); + } + } + + if (process != NULL) + { + process->Close(); + } + CleanupStack::PopAndDestroy(process); + CleanupStack::PopAndDestroy(finder); + CleanupStack::PopAndDestroy(name); + } + + +TInt CTestSecureFSSession::DoChangeLocale(const RMessage2& aMessage) + { + TBuf<50> locname; + TInt result; + aMessage.ReadL(0,locname); + + result = UserSvr::ChangeLocale(locname); + + return result; + } + +TInt CTestSecureFSSession::DoCheckForFile(const RMessage2& aMessage) +{ + RFs fs; + TInt err; + TFileName* const fileName=new(ELeave) TFileName; + CleanupStack::PushL(fileName); + User::LeaveIfError(fs.Connect()); + + CleanupClosePushL(fs); + aMessage.ReadL(0,*fileName); + + TUint attribs; + err=fs.Att(*fileName, attribs); + fs.Close(); + + CleanupStack::PopAndDestroy(&fs); + CleanupStack::PopAndDestroy(fileName); + return err; + +} + +TInt CTestSecureFSSession::DoCopyFile(const RMessage2& aMessage) +{ + + RFs fs; + TInt result; + + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + TFileName fileSource; + TFileName fileDest; + + aMessage.ReadL(0,fileSource); + aMessage.ReadL(1,fileDest); + + CFileMan* fileMan = NULL; + + fileMan = CFileMan::NewL(fs); + CleanupStack::PushL( fileMan ); + + fs.MkDirAll(fileDest); + result = fileMan->Copy( fileSource, fileDest, CFileMan::EOverWrite ); + + User::LeaveIfError(fs.Connect()); + fs.SetAtt(fileDest,KEntryAttNormal,KEntryAttReadOnly); + fs.Close(); + + CleanupStack::PopAndDestroy(fileMan); + CleanupStack::PopAndDestroy(&fs); + return result; + +} + +void CTestSecureFSSession::DoSetUpFbs() +{ +// FbsStartup(); +// User::LeaveIfError( RFbsSession::Connect() ); +// CleanupStack::PushL( TCleanupItem( TCleanupOperation(&RFbsSession::Disconnect ), NULL ) ); +} + +// + +void CTestSecureFSSession::ServiceError(const RMessage2& aMessage,TInt aError) +// +// Handle an error from CMySession::ServiceL() +// A bad descriptor error implies a badly programmed client, so panic it; +// otherwise use the default handling (report the error to the client) +// + { + if (aError==KErrBadDescriptor) + PanicClient(aMessage,EPanicBadDescriptor); + CSession2::ServiceError(aMessage,aError); + } + +void CTestSecureFSshutdown::RunL() +// +// Initiate server exit when the timer expires +// + { + CActiveScheduler::Stop(); + } + +CServer2* CTestSecureFSserver::NewLC() + { + CTestSecureFSserver* self=new(ELeave) CTestSecureFSserver; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +void CTestSecureFSserver::ConstructL() +// +// 2nd phase construction - ensure the timer and server objects are running +// + { + StartL(KTestServerName); + iShutdown.ConstructL(); + // ensure that the server still exits even if the 1st client fails to connect + iShutdown.Start(); + } + + +CSession2* CTestSecureFSserver::NewSessionL(const TVersion&,const RMessage2&) const +// +// Cretae a new client session. This should really check the version number. +// + { + return new(ELeave) CTestSecureFSSession(); + } + +void CTestSecureFSserver::AddSession() +// +// A new session is being created +// Cancel the shutdown timer if it was running +// + { + ++iSessionCount; + iShutdown.Cancel(); + } + +void CTestSecureFSserver::DropSession() +// +// A session is being destroyed +// Start the shutdown timer if it is the last session. +// + { + if (--iSessionCount==0) + iShutdown.Start(); + } + +void CTestSecureFSserver::Send(const TDesC& aMessage) +// +// Pass on the signal to all clients +// + { + iSessionIter.SetToFirst(); + CSession2* s; + while ((s=iSessionIter++)!=0) + static_cast(s)->Send(aMessage); + } + +void PanicClient(const RMessage2& aMessage,TTestPanic aPanic) +// +// RMessage::Panic() also completes the message. This is: +// (a) important for efficient cleanup within the kernel +// (b) a problem if the message is completed a second time +// + { + _LIT(KPanic,"TestServer"); + aMessage.Panic(KPanic,aPanic); + } + + + +/** +Perform all server initialisation, in particular creation of the +scheduler and server and then run the scheduler +*/ + +static void RunServerL() + { + // naming the server thread after the server helps to debug panics + User::LeaveIfError(RThread::RenameMe(KTestServerName)); + // create and install the active scheduler we need + CActiveScheduler* s=new(ELeave) CActiveScheduler; + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + CTestSecureFSserver::NewLC(); // create the server (leave it on the cleanup stack) + RProcess::Rendezvous(KErrNone); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy(2); // Cleanup the server and scheduler + } + + + + +TInt E32Main() +// +// Server process entry-point +// + { + __UHEAP_MARK; + // + RDebug::Print(_L("Server::E32Main Version 0.0.0")); + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,RunServerL()); + delete cleanup; + } + // + __UHEAP_MARKEND; + return r; + } + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Src/SmokeTestTimeOutTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Src/SmokeTestTimeOutTimer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,59 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// SmokeTestTimeOutTimer.h +// This contains CTestTimeOutTimer +// +// + +#include "SmokeTestTimeOutTimer.h" + +// +// Construction/Destruction +// + +EXPORT_C CTestTimeOutTimer::~CTestTimeOutTimer() + { + } + +EXPORT_C CTestTimeOutTimer* CTestTimeOutTimer::NewL(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority) + { + CTestTimeOutTimer* self=NewLC(aTestTimerCallback, aPriority); + CleanupStack::Pop(); + return self; + } + +EXPORT_C CTestTimeOutTimer* CTestTimeOutTimer::NewLC(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority) + { + CTestTimeOutTimer* self=new(ELeave) CTestTimeOutTimer(aTestTimerCallback, aPriority); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CTestTimeOutTimer::CTestTimeOutTimer(MTestTimeOutTimerCallback& aTestTimerCallback, TInt aPriority) +: CTimer(aPriority) +, iTestTimerCallback(aTestTimerCallback) + { + } + +void CTestTimeOutTimer::ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + +void CTestTimeOutTimer::RunL() + { + iTestTimerCallback.TimerCompleted(); + }; diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/Src/TestStepSmokeTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/Src/TestStepSmokeTest.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,345 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestStepSmokeTest +// +// + +//user include +#include "TestStepSmokeTest.h" + +//Epoc include +#include +#include +#include + +/*@{*/ +_LIT(KExpectedCapCheckResult, "ExpectedCapCheckResult"); +_LIT(KConfigFile, "C:\\plattest\\platsec\\plattest_capabilities.config"); +_LIT(KDefault, "default"); +_LIT(KCapTest, "CapabilityTest"); +_LIT(KNo, "No"); + +_LIT(KLogging, "logging"); +_LIT(KLoggingMin, "min"); +_LIT(KLoggingNormal, "normal"); +_LIT(KLoggingMax, "max"); + +_LIT(KRepetition, "repetition"); +/*@}*/ + +// +// Construction/Destruction +// + +/** + Constructor +*/ +EXPORT_C CTestStepSmokeTest::CTestStepSmokeTest() +: CTestStep() +, iLoggingDetail(ETestLoggingDetail_Normal) +, iRepetition(1) + { + } + +/** + Destructor +*/ +EXPORT_C CTestStepSmokeTest::~CTestStepSmokeTest() + { + } + + +/** + The overriden implementation of CTestStep::doTestStepPreambleL() + @return TVerdict- result of the test step + @leave - system wide error codes +*/ +EXPORT_C TVerdict CTestStepSmokeTest::doTestStepPreambleL() + { + TVerdict ret = CTestStep::doTestStepPreambleL(); + + // Get logging + TPtrC logging; + if ( GetStringFromConfig(ConfigSection(), KLogging, logging) ) + { + INFO_PRINTF2(_L("Logging value %S"), &logging); + if ( logging.Compare(KLoggingMin) == 0 ) + { + iLoggingDetail=ETestLoggingDetail_Min; + } + else if ( logging.Compare(KLoggingNormal) == 0 ) + { + iLoggingDetail=ETestLoggingDetail_Normal; + } + else if ( logging.Compare(KLoggingMax) == 0 ) + { + iLoggingDetail=ETestLoggingDetail_Max; + } + else + { + ERR_PRINTF1(_L("Illegal logging value, use min, normal or max.")); + ret=EFail; + } + } + + // Get repetition count of test + GetIntFromConfig(ConfigSection(), KRepetition, iRepetition); + INFO_PRINTF2(_L("Repetition %d"), iRepetition); + + return ret; + } + +/** + The overriden implementation of CTestStep::doTestStepPostambleL() + It implements the functionality of capability checking if + _PLATTEST_CAPTEST_ is ON. + @return TVerdict- result of the test step + @leave - system wide error codes +*/ + +EXPORT_C TVerdict CTestStepSmokeTest::doTestStepPostambleL() + { + + //Read whether to do capability testing.. + TPtrC captest(KNo); + GetStringFromConfig(KDefault, KCapTest, captest); + if( captest.Compare(_L("YES")) == 0) + { + INFO_PRINTF1(_L("---Capability Testing---")); + //Gets the capabilities config file + TBuf scriptFile; + scriptFile.Copy(KConfigFile); + INFO_PRINTF2(_L("The config file %S"), &scriptFile); + + TBuf8 scriptSection; + scriptSection.Copy(_L("Capabilities")); + + TPtrC serverName = GetServerName(); + INFO_PRINTF2(_L("The server name is %S"), &serverName); + HBufC8 *scriptItem = HBufC8::NewLC(serverName.Length()); + scriptItem->Des().Copy(serverName); + + //Get the file server session object + RFs rFs; + TInt err=rFs.Connect(); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Failed to connect with File server")); + SetTestStepResult(EFail); + } + else + { + CleanupClosePushL(rFs); + //Get the config file + CTestConfig* configFile = CTestConfig::NewLC(rFs, KNullDesC, scriptFile); + if( configFile == NULL) + { + WARN_PRINTF1(_L("NO Config file found -- Plattest_capabilites.config")); + } + else + { + //Get the item value from config file + TBuf8 itemValue; + itemValue = configFile->Section(scriptSection)->Item(scriptItem->Des())->Value(); + TLex8 capabilityParser(itemValue); + TBool capCheckResult= ETrue; + + while(!capabilityParser.Eos()) + { + //Parse the capabilities + TPtrC8 capability(capabilityParser.NextToken()); + + HBufC* capabilityRead = HBufC::NewLC(capability.Length()); + capabilityRead->Des().Copy(capability); + INFO_PRINTF2(_L("Capability Read is %S"), capabilityRead); + + //Get the capability value + TCapability capabilityValue; + TPtrC ptrCapabilty(capabilityRead->Des()); + TInt err = GetCapability(ptrCapabilty, capabilityValue); + if( err != KErrNone) + { + WARN_PRINTF1(_L("The capability is not found")); + } + else + { + //Check if the current process posses the required capability + if( !RProcess().HasCapability(capabilityValue) ) + { + INFO_PRINTF2(_L("The capability %S is not possesed."), capabilityRead); + capCheckResult=EFalse; + } + else + { + INFO_PRINTF2(_L("The capability %S is possesed."), capabilityRead); + } + } + CleanupStack::PopAndDestroy(capabilityRead); + } + + //read the expected capability check result + TBool expectedCapCheckResult = ETrue; + GetBoolFromConfig(ConfigSection(), KExpectedCapCheckResult, expectedCapCheckResult); + INFO_PRINTF2(_L("The expected cap check result is %D"), expectedCapCheckResult); + INFO_PRINTF2(_L("The cap check result is %D"), capCheckResult); + + if(expectedCapCheckResult == capCheckResult) + { + SetTestStepResult(EPass); + } + else + { + SetTestStepResult(EFail); + } + } + CleanupStack::PopAndDestroy(2, &rFs); + } + CleanupStack::PopAndDestroy(scriptItem); + if(TestStepError() == KErrPermissionDenied) + { + INFO_PRINTF1(_L(" The failure is due to Platform Security")); + } + } + + TVerdict ret = CTestStep::doTestStepPostambleL(); + return ret; + } + +/** + 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 +*/ +EXPORT_C TInt CTestStepSmokeTest::GetCapability(TPtrC aCapability, TCapability& aCapabilityValue) + { + INFO_PRINTF2(_L("The capability get is %S"), &aCapability); + TInt ret=KErrNone; + + TBuf 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("none"))) + { + aCapabilityValue=ECapability_None; + } + else + { + INFO_PRINTF2(_L("Unrecognised capability %S, will be rejected"), &capCaseValue); + ret=KErrNotFound; + } + + return ret; + } + + +/** + Verifies the given time is nearly equal to current UTC time. + @param aTime - Time needs to be verified + @return TBool - Returns ETrue if aTime is nearly equal to current UTC + time, otherwise EFalse + @leave - None +*/ +EXPORT_C TBool CTestStepSmokeTest::VerifyUTCTime(TTime aTime) + { + TTime homeTime; + TTimeIntervalSeconds utcOffset; + + homeTime.HomeTime(); + homeTime.SecondsFrom(aTime, utcOffset); + INFO_PRINTF2(_L("Calculated utcOffset: %D"), utcOffset.Int()); + if(Abs(utcOffset.Int()) <= (User::UTCOffset().Int()+120) + && Abs(utcOffset.Int()) >= (User::UTCOffset().Int()-120)) + { + return ETrue; + } + else + { + return EFalse; + } + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/bwins/SmokeTestSecureFSClientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/bwins/SmokeTestSecureFSClientU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,10 @@ +EXPORTS + ?ChangeLocaleName@RTestSecureFSclient@@QAEHABVTDesC16@@@Z @ 1 NONAME ; int RTestSecureFSclient::ChangeLocaleName(class TDesC16 const &) + ?CheckForFile@RTestSecureFSclient@@QAEHABVTDesC16@@@Z @ 2 NONAME ; int RTestSecureFSclient::CheckForFile(class TDesC16 const &) + ?Connect@RTestSecureFSclient@@QAEHXZ @ 3 NONAME ; int RTestSecureFSclient::Connect(void) + ?CopyFile@RTestSecureFSclient@@QAEHABVTDesC16@@0@Z @ 4 NONAME ; int RTestSecureFSclient::CopyFile(class TDesC16 const &, class TDesC16 const &) + ?DeleteFileL@RTestSecureFSclient@@QAEHABVTDesC16@@@Z @ 5 NONAME ; int RTestSecureFSclient::DeleteFileL(class TDesC16 const &) + ?KillProcessL@RTestSecureFSclient@@QAEXABVTDesC16@@@Z @ 6 NONAME ; void RTestSecureFSclient::KillProcessL(class TDesC16 const &) + ?SetHomeTime@RTestSecureFSclient@@QAEHABVTTime@@@Z @ 7 NONAME ; int RTestSecureFSclient::SetHomeTime(class TTime const &) + ?SetUpFbs@RTestSecureFSclient@@QAEXXZ @ 8 NONAME ; void RTestSecureFSclient::SetUpFbs(void) + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/bwins/SmokeTest_UtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/bwins/SmokeTest_UtilsU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,23 @@ +EXPORTS + ??0CTestProperty@@QAE@AAVCTestStep@@@Z @ 1 NONAME ; CTestProperty::CTestProperty(class CTestStep &) + ??0CTestStepSmokeTest@@IAE@XZ @ 2 NONAME ; CTestStepSmokeTest::CTestStepSmokeTest(void) + ??1CTestActive@@UAE@XZ @ 3 NONAME ; CTestActive::~CTestActive(void) + ??1CTestProperty@@UAE@XZ @ 4 NONAME ; CTestProperty::~CTestProperty(void) + ??1CTestStepSmokeTest@@UAE@XZ @ 5 NONAME ; CTestStepSmokeTest::~CTestStepSmokeTest(void) + ??1CTestTimeOutTimer@@UAE@XZ @ 6 NONAME ; CTestTimeOutTimer::~CTestTimeOutTimer(void) + ?Activate@CTestActive@@QAEXXZ @ 7 NONAME ; void CTestActive::Activate(void) + ?GetCapability@CTestStepSmokeTest@@IAEHVTPtrC16@@AAW4TCapability@@@Z @ 8 NONAME ; int CTestStepSmokeTest::GetCapability(class TPtrC16, enum TCapability &) + ?GetPropertyL@CTestProperty@@QAEHVTUid@@HAAH@Z @ 9 NONAME ; int CTestProperty::GetPropertyL(class TUid, int, int &) + ?GetPropertyL@CTestProperty@@QAEHVTUid@@HAAVTDes16@@@Z @ 10 NONAME ; int CTestProperty::GetPropertyL(class TUid, int, class TDes16 &) + ?GetPropertyL@CTestProperty@@QAEHVTUid@@HAAVTDes8@@@Z @ 11 NONAME ; int CTestProperty::GetPropertyL(class TUid, int, class TDes8 &) + ?NewL@CTestActive@@SAPAV1@AAVMTestActiveCallback@@H@Z @ 12 NONAME ; class CTestActive * CTestActive::NewL(class MTestActiveCallback &, int) + ?NewL@CTestTimeOutTimer@@SAPAV1@AAVMTestTimeOutTimerCallback@@H@Z @ 13 NONAME ; class CTestTimeOutTimer * CTestTimeOutTimer::NewL(class MTestTimeOutTimerCallback &, int) + ?NewLC@CTestActive@@SAPAV1@AAVMTestActiveCallback@@H@Z @ 14 NONAME ; class CTestActive * CTestActive::NewLC(class MTestActiveCallback &, int) + ?NewLC@CTestTimeOutTimer@@SAPAV1@AAVMTestTimeOutTimerCallback@@H@Z @ 15 NONAME ; class CTestTimeOutTimer * CTestTimeOutTimer::NewLC(class MTestTimeOutTimerCallback &, int) + ?SetPropertyL@CTestProperty@@QAEHVTUid@@HABVTDesC16@@@Z @ 16 NONAME ; int CTestProperty::SetPropertyL(class TUid, int, class TDesC16 const &) + ?SetPropertyL@CTestProperty@@QAEHVTUid@@HABVTDesC8@@@Z @ 17 NONAME ; int CTestProperty::SetPropertyL(class TUid, int, class TDesC8 const &) + ?SetPropertyL@CTestProperty@@QAEHVTUid@@HH@Z @ 18 NONAME ; int CTestProperty::SetPropertyL(class TUid, int, int) + ?VerifyUTCTime@CTestStepSmokeTest@@IAEHVTTime@@@Z @ 19 NONAME ; int CTestStepSmokeTest::VerifyUTCTime(class TTime) + ?doTestStepPostambleL@CTestStepSmokeTest@@UAE?AW4TVerdict@@XZ @ 20 NONAME ; enum TVerdict CTestStepSmokeTest::doTestStepPostambleL(void) + ?doTestStepPreambleL@CTestStepSmokeTest@@UAE?AW4TVerdict@@XZ @ 21 NONAME ; enum TVerdict CTestStepSmokeTest::doTestStepPreambleL(void) + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/eabi/SmokeTestSecureFSclientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/eabi/SmokeTestSecureFSclientU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,10 @@ +EXPORTS + _ZN19RTestSecureFSclient11DeleteFileLERK7TDesC16 @ 1 NONAME + _ZN19RTestSecureFSclient11SetHomeTimeERK5TTime @ 2 NONAME + _ZN19RTestSecureFSclient12CheckForFileERK7TDesC16 @ 3 NONAME + _ZN19RTestSecureFSclient12KillProcessLERK7TDesC16 @ 4 NONAME + _ZN19RTestSecureFSclient16ChangeLocaleNameERK7TDesC16 @ 5 NONAME + _ZN19RTestSecureFSclient7ConnectEv @ 6 NONAME + _ZN19RTestSecureFSclient8CopyFileERK7TDesC16S2_ @ 7 NONAME + _ZN19RTestSecureFSclient8SetUpFbsEv @ 8 NONAME + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/eabi/SmokeTest_UtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/eabi/SmokeTest_UtilsU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,40 @@ +EXPORTS + _ZN11CTestActive4NewLER19MTestActiveCallbacki @ 1 NONAME + _ZN11CTestActive5NewLCER19MTestActiveCallbacki @ 2 NONAME + _ZN11CTestActive8ActivateEv @ 3 NONAME + _ZN11CTestActiveD0Ev @ 4 NONAME + _ZN11CTestActiveD1Ev @ 5 NONAME + _ZN11CTestActiveD2Ev @ 6 NONAME + _ZN13CTestProperty12GetPropertyLE4TUidiR5TDes8 @ 7 NONAME + _ZN13CTestProperty12GetPropertyLE4TUidiR6TDes16 @ 8 NONAME + _ZN13CTestProperty12GetPropertyLE4TUidiRi @ 9 NONAME + _ZN13CTestProperty12SetPropertyLE4TUidiRK6TDesC8 @ 10 NONAME + _ZN13CTestProperty12SetPropertyLE4TUidiRK7TDesC16 @ 11 NONAME + _ZN13CTestProperty12SetPropertyLE4TUidii @ 12 NONAME + _ZN13CTestPropertyC1ER9CTestStep @ 13 NONAME + _ZN13CTestPropertyC2ER9CTestStep @ 14 NONAME + _ZN13CTestPropertyD0Ev @ 15 NONAME + _ZN13CTestPropertyD1Ev @ 16 NONAME + _ZN13CTestPropertyD2Ev @ 17 NONAME + _ZN18CTestStepSmokeTest13GetCapabilityE7TPtrC16R11TCapability @ 18 NONAME + _ZN18CTestStepSmokeTest13VerifyUTCTimeE5TTime @ 19 NONAME + _ZN18CTestStepSmokeTest19doTestStepPreambleLEv @ 20 NONAME + _ZN18CTestStepSmokeTest20doTestStepPostambleLEv @ 21 NONAME + _ZN18CTestStepSmokeTestC2Ev @ 22 NONAME + _ZN18CTestStepSmokeTestD0Ev @ 23 NONAME + _ZN18CTestStepSmokeTestD1Ev @ 24 NONAME + _ZN18CTestStepSmokeTestD2Ev @ 25 NONAME + _ZN17CTestTimeOutTimer4NewLER25MTestTimeOutTimerCallbacki @ 26 NONAME + _ZN17CTestTimeOutTimer5NewLCER25MTestTimeOutTimerCallbacki @ 27 NONAME + _ZN17CTestTimeOutTimerD0Ev @ 28 NONAME + _ZN17CTestTimeOutTimerD1Ev @ 29 NONAME + _ZN17CTestTimeOutTimerD2Ev @ 30 NONAME + _ZTI11CTestActive @ 31 NONAME ; ## + _ZTI13CTestProperty @ 32 NONAME ; ## + _ZTI18CTestStepSmokeTest @ 33 NONAME ; ## + _ZTI17CTestTimeOutTimer @ 34 NONAME ; ## + _ZTV11CTestActive @ 35 NONAME ; ## + _ZTV13CTestProperty @ 36 NONAME ; ## + _ZTV18CTestStepSmokeTest @ 37 NONAME ; ## + _ZTV17CTestTimeOutTimer @ 38 NONAME ; ## + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/group/SmokeTestSecureFSclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/group/SmokeTestSecureFSclient.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// TestSecureFSclient.mmp +// +// + +TARGET SmokeTestSecureFSclient.dll +TARGETTYPE dll +CAPABILITY All + +UID 0x1000008D 0x101FF347 +VENDORID 0x70000001 + +USERINCLUDE ..\Inc +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ..\src +SOURCE SmokeTestSecureFSclient.cpp + +LIBRARY euser.lib diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/group/SmokeTestSecureFSserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/group/SmokeTestSecureFSserver.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// TestSecureFSserver.mmp +// +// + + +UID 0x1000008D 0x101FF346 +VENDORID 0x70000001 + +TARGET SmokeTestSecureFSserver.exe +TARGETTYPE EXE +CAPABILITY ALL + +USERINCLUDE ..\Inc +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ..\SRC +SOURCE SmokeTestSecureFSserver.cpp + +SOURCEPATH . + +LIBRARY euser.lib +LIBRARY efsrv.lib + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/group/SmokeTest_Utils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/group/SmokeTest_Utils.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,49 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "..\..\Group\Configuration.cfg" + +TARGET SmokeTest_Utils.dll +TARGETTYPE dll +UID 0x1000008D 0x101FF341 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY All -TCB + +SOURCEPATH ..\Src + +SOURCE SmokeTestTimeOutTimer.cpp +SOURCE SmokeTestActive.cpp +SOURCE TestStepSmokeTest.cpp +SOURCE SmokeTestProperty.cpp + +USERINCLUDE ..\Inc +USERINCLUDE ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib +LIBRARY TestConfigFileParser.lib + +// We're quite heavy on the stack... 4k in WinS isn't enough... +EPOCSTACKSIZE 0x6000 diff -r 000000000000 -r 9736f095102e buildverification/smoketest/Utils/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/Utils/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,31 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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_TESTEXPORTS +// For Emulator +../Inc/SmokeTestTimeOutTimer.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketesttimeouttimer.h) +../Inc/SmokeTestActive.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestactive.h) +../Inc/TestStepSmokeTest.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/teststepsmoketest.h) +../Inc/SmokeTestProperty.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestproperty.h) +../Inc/SmokeTestSecureFSclientserver.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestsecurefsclientserver.h) +../Inc/SmokeTestSecureFSclient.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestsecurefsclient.h) +../Inc/SmokeTestSecureFSserver.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(test/smoketestsecurefsserver.h) + +PRJ_TESTMMPFILES +SmokeTestSecureFSclient.mmp +SmokeTestSecureFSserver.mmp +SmokeTest_Utils.mmp diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Group/Smoketest_Agenda.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Group/Smoketest_Agenda.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,50 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + + +TARGET Smoketest_Agenda_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7771 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +//CAPABILITY WriteUserData ReadUserData +CAPABILITY All -TCB + + +SOURCEPATH ..\Src + +SOURCE TestAgendaServer.cpp +SOURCE TestAgendaAddAppt.cpp +SOURCE TestAgendaBase.cpp +SOURCE TestAgendaCreateDB.cpp +SOURCE TestAgendaServerLaunchProgress.cpp + +USERINCLUDE ..\Inc ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY apparc.lib +LIBRARY euser.lib +LIBRARY calinterimapi.lib +LIBRARY etext.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 Agenda smoketest +// +// + +PRJ_EXPORTS + +../Scripts/setup_Smoketest_Agenda.script /epoc32/release/wins/udeb/z/smoketest/setup_smoketest_agenda.script +../Scripts/setup_Smoketest_Agenda.script /epoc32/release/wins/urel/z/smoketest/setup_smoketest_agenda.script +../Scripts/setup_Smoketest_Agenda.script /epoc32/release/winscw/udeb/z/smoketest/setup_smoketest_agenda.script +../Scripts/setup_Smoketest_Agenda.script /epoc32/release/winscw/urel/z/smoketest/setup_smoketest_agenda.script + +../Scripts/Smoketest_Agenda.script /epoc32/release/wins/udeb/z/smoketest/smoketest_agenda.script +../Scripts/Smoketest_Agenda.script /epoc32/release/wins/urel/z/smoketest/smoketest_agenda.script +../Scripts/Smoketest_Agenda.script /epoc32/release/winscw/udeb/z/smoketest/smoketest_agenda.script +../Scripts/Smoketest_Agenda.script /epoc32/release/winscw/urel/z/smoketest/smoketest_agenda.script + +../TestData/Smoketest_Agenda.ini /epoc32/release/wins/udeb/z/smoketest/smoketest_agenda.ini +../TestData/Smoketest_Agenda.ini /epoc32/release/wins/urel/z/smoketest/smoketest_agenda.ini +../TestData/Smoketest_Agenda.ini /epoc32/release/winscw/udeb/z/smoketest/smoketest_agenda.ini +../TestData/Smoketest_Agenda.ini /epoc32/release/winscw/urel/z/smoketest/smoketest_agenda.ini + + +PRJ_TESTMMPFILES +Smoketest_Agenda.mmp diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Inc/TestAgendaAddAppt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Inc/TestAgendaAddAppt.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestAgendaCreateDB.h +// This contains CTestAgendaAddAppt +// +// + +#ifndef TEST_AGENDA_ADD_APPT_H +#define TEST_AGENDA_ADD_APPT_H + +#include "TestAgendaBase.h" + +class CTestAgendaAddAppt : public CTestAgendaBase +{ +public: + CTestAgendaAddAppt(); + virtual ~CTestAgendaAddAppt(); + +public: + virtual enum TVerdict doTestStepL( void ); + +private: + void AddEntriesL( void ); +}; + +#endif /* TEST_AGENDA_ADD_APPT_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Inc/TestAgendaBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Inc/TestAgendaBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,91 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaBase which is the base class for all +// the Psd Agx suite test steps +// +// + +#ifndef TEST_AGENDA_BASE_H +#define TEST_AGENDA_BASE_H + +#include +#include +#include + + + +//forward declarations +class CCalSession; + +#define KMaxDateStringLength 30 +#define KMaxTimeStringLength 30 + +#define KMaxDateStringLength 30 +#define KMaxTimeStringLength 30 + +class CTestAgendaPicture :public MPictureFactory +/** +* Picture class for the agenda model +*/ +{ +/************************************************************** +* An object of this class is used for setting the picture factory +* of an Agenda model, although our code does not use any of the +* functionality provided by this class, it is created with empty +* implementation and set to satisfy the compiler as it uses +* an assert macro to check if this object is set before saving +* the agenda model entries into a file +*************************************************************/ + +public: + CTestAgendaPicture(); + virtual ~CTestAgendaPicture(); + virtual void NewPictureL(TPictureHeader& aHeader,const CStreamStore& aDeferredPictureStore)const; +}; + + +class CTestAgendaBase : public CTestStep +{ +public: + CTestAgendaBase(); + ~CTestAgendaBase(); + + virtual enum TVerdict doTestStepPreambleL(); + virtual enum TVerdict doTestStepPostambleL(); + + CCalSession& CTestAgendaBase::CalSession(); + void SetCalEntryView(CCalEntryView* calEntryViewPtr); + +protected: + void CreateDatabaseL(); + void OpenDatabaseL(); + void CleanupDatabase(); + +private: + CActiveScheduler* iSchedular; + TBool iEnteredBlocked; + TBool iExitedBlocked; + +protected: + RFs iFs; + TBool iSessionConnected; + CCalEntryView* iCalEntryViewBase; + /** + To store the models entries + */ + CFileStore* iStore; + CCalSession* iCalSession; +}; + +#endif /* TEST_AGENDA_BASE_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Inc/TestAgendaCreateDB.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Inc/TestAgendaCreateDB.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,34 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaCreateDB +// +// + +#ifndef TEST_AGENDA_CREATE_DB_H +#define TEST_AGENDA_CREATE_DB_H + +#include "TestAgendaBase.h" + +class CTestAgendaCreateDB : public CTestAgendaBase +{ +public: + CTestAgendaCreateDB(); + virtual ~CTestAgendaCreateDB(); + +public: + virtual enum TVerdict doTestStepL( void ); + +}; + +#endif /* TEST_AGENDA_CREATE_DB_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Inc/TestAgendaServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Inc/TestAgendaServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaServer +// +// + +#ifndef TEST_AGENDA_SERVER_H +#define TEST_AGENDA_SERVER_H + +#include + +class CTestAgendaServer : public CTestServer +{ +public: + static CTestAgendaServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + +private: + void ConstructL(); +}; + +#endif /* TEST_AGENDA_SERVER_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Inc/TestAgendaServerLaunchProgress.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Inc/TestAgendaServerLaunchProgress.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,75 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaServerLaunchProgress +// +// + +#ifndef TEST_AGENDA_SERVER_LAUNCH_PROGRESS_H +#define TEST_AGENDA_SERVER_LAUNCH_PROGRESS_H + +#include "TestAgendabase.h" +#include +#include + + +//forward declaration +//class CTestAgendaBase; +class CCalEntryView; + + +class CTestAgendaServerLaunchProgress : public CActive, private MCalProgressCallBack +/** +* This class provides an implementationfor the pure virtual functions +* declared in MAgnProgressCallBack. The framework makes calls to the +* functions indidcating the status of the operation. +*/ +{ +public: + static CTestAgendaServerLaunchProgress* NewL(CTestAgendaBase* aAgendaBase); + virtual ~CTestAgendaServerLaunchProgress(); + void Start(); + + //from CActive + virtual void RunL(); + virtual void DoCancel(); + +private: + CTestAgendaServerLaunchProgress(CTestAgendaBase* aAgendaBase); + void ConstructL(); + + //from MAgnProgressCallBack + virtual void Completed(TInt aError = KErrNone); + virtual void Progress(TInt aPercentageCompleted); + virtual TBool NotifyProgress(); + +private: + /** + pointer to the CTestAgendaBase object. + */ + CTestAgendaBase* iAgendaBase; + CCalEntryView* iCalEntryView; + + /** + file in which the entries are present + */ + TPtrC iFileName; + + /** + file server session + */ + RFs iFs; + +}; + +#endif TEST_AGENDA_SERVER_LAUNCH_PROGRESS_H diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Scripts/Smoketest_Agenda.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Scripts/Smoketest_Agenda.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Agenda smoketest +// +RUN_WS_PROGRAM 10 z:\sys\bin\agenda.exe +// +DELAY 1500 +// +LOAD_SUITE Smoketest_Agenda_Server +// +START_TESTCASE 8981 +RUN_TEST_STEP 100 Smoketest_Agenda_Server CreateDB c:\Smoketest\Smoketest_Agenda.ini 18920_CreateDB +END_TESTCASE 8981 +START_TESTCASE 8979 +RUN_TEST_STEP 1000 Smoketest_Agenda_Server AddAppt c:\Smoketest\Smoketest_Agenda.ini 24560_AddAppts +END_TESTCASE 8979 diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Scripts/setup_Smoketest_Agenda.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Scripts/setup_Smoketest_Agenda.script Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,22 @@ +// +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +RUN_UTILS MkDir c:\Smoketest\ + +RUN_UTILS CopyFile z:\smoketest\smoketest_agenda.ini c:\smoketest\smoketest_agenda.ini +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_agenda.ini + +// RUN_SCRIPT Smoketest_Agenda.script diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Src/TestAgendaAddAppt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Src/TestAgendaAddAppt.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,191 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaAddAppt +// +// + +#include +#include +#include + + +#include "TestAgendaAddAppt.h" + +_LIT(KCount, "count"); +_LIT(KYear, "year%d"); +_LIT(KMonth, "month%d"); +_LIT(KDay, "day%d"); +_LIT(KHour, "hour%d"); +_LIT(KMinute, "min%d"); +_LIT(KDuration, "duration%d"); +_LIT(KMessage, "message%d"); +_LIT(KAlarm, "alarm%d"); +_LIT(KAlarmSound, "alarmsound%d"); + +// constructor +CTestAgendaAddAppt::CTestAgendaAddAppt() + { + SetTestStepName(_L("AddAppt")); + } + +// destructor +CTestAgendaAddAppt::~CTestAgendaAddAppt() + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestAgendaAddAppt::doTestStepL( void ) + { + // Printing to the console and log file + INFO_PRINTF1(_L("TEST-> ADDING APPOINTMENT ENTRIES")); + + OpenDatabaseL(); + if ( TestStepResult() == EPass ) + { + TRAPD(r, AddEntriesL()); + if (r!=KErrNone) + SetTestStepResult(EFail); + } + CleanupDatabase(); + + // test steps return a result + return TestStepResult(); + } + +// Destroy the RPointerArray +void DestroyRPointerArray(TAny* aPtr) + { + RPointerArray* self = static_cast*> (aPtr); + self->ResetAndDestroy(); + } + + +void CTestAgendaAddAppt::AddEntriesL( void ) + { + TInt count=1; + if ( !GetIntFromConfig(ConfigSection(), KCount, count) ) + count=1; + + TBuf tempStore; + TInt year; + TInt month; + TInt day; + TInt hour; + TInt minute; + TInt duration; + TInt alarm; + TPtrC ptrAlarmSound; + TPtrC ptrMessage; + TBuf dateString; + _LIT(KDateString,"%*E%*D%X%*N%*Y %1 %2 '%3"); + + RPointerArray array; + CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &array)); + + for (TInt entry=0; entryDes(); + uidP.Append(count); + + CCalEntry* calEntry = CCalEntry::NewL(CCalEntry::EAppt, uid, CCalEntry::EMethodNone, 0); + + CleanupStack::Pop(); //uid + CleanupStack::PushL(calEntry); + + TCalTime calStartTime, calEndTime; + + calStartTime.SetTimeLocalL(startTime); + calEndTime.SetTimeLocalL(endTime); + + calEntry->SetStartAndEndTimeL(calStartTime, calEndTime); + + tempStore.Format(KAlarm(), entry); + if ( GetIntFromConfig(ConfigSection(), tempStore, alarm) ) + { + TTimeIntervalMinutes currentTime((hour*60) + minute); + TTimeIntervalMinutes alarmTime(currentTime.Int()); + + CCalAlarm* calAlarm = CCalAlarm::NewL(); + CleanupStack::PushL(calAlarm); + + calAlarm->SetTimeOffset(alarmTime); + + tempStore.Format(KAlarmSound(), entry); + if ( GetStringFromConfig(ConfigSection(), tempStore, ptrAlarmSound) ) + calAlarm->SetAlarmSoundNameL(ptrAlarmSound); + else + calAlarm->SetAlarmSoundNameL(_L("Bells")); + + calEntry->SetAlarmL(calAlarm); + CleanupStack::PopAndDestroy(); //calAlarm + } + //Store in the array + array.AppendL(calEntry); + + CleanupStack::Pop(); //calEntry + } + INFO_PRINTF1(_L("About to store appointments now")); + TInt success(0); + TRAPD(storeError, iCalEntryViewBase->StoreL(array, success)); + INFO_PRINTF2(_L("Store result is %d"), storeError); + if (success != count && storeError == KErrNone) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&array); + + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Src/TestAgendaBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Src/TestAgendaBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,225 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaCase which is the base class for all the Agenda TestCase DLL +// +// + +// EPOC includes +#include +#include +#include +#include +#include "TestAgendabase.h" +#include "TestAgendaServerLaunchProgress.h" + +#include + + + +_LIT(KDef, "default"); +_LIT(KFileName, "filenameSecure"); + +void CTestAgendaPicture::NewPictureL(TPictureHeader& /*aHeader*/,const CStreamStore& /*aDeferredPictureStore*/)const +/** +Creates a new Picture object for use by agenda model, currently the implementation is empty as our code +does not use any the functionality. +*/ + { + //empty implementation + } + +CTestAgendaPicture::CTestAgendaPicture() +/** +constructor, currently the implementation is empty +*/ + { + //empty implementation + } + +CTestAgendaPicture::~CTestAgendaPicture() +/** +destructor, currently the implementation is empty +*/ + { + //empty implementation + } + +CTestAgendaBase::CTestAgendaBase() +: CTestStep() +, iSchedular(NULL) +, iEnteredBlocked(EFalse) +, iExitedBlocked(EFalse) +, iSessionConnected(EFalse) +, iCalEntryViewBase(NULL) +, iStore(NULL) +, iCalSession(NULL) + { + } + +// destructor +CTestAgendaBase::~CTestAgendaBase() + { + delete iSchedular; + iSchedular=NULL; + + } + +enum TVerdict CTestAgendaBase::doTestStepPreambleL() + { + TVerdict ret = CTestStep::doTestStepPreambleL(); + + INFO_PRINTF1(_L("doTestStepPreambleL")); + iSchedular=new (ELeave) CActiveScheduler(); + CActiveScheduler::Install(iSchedular); + + iCalSession = CCalSession::NewL(); + + return ret; + } + +enum TVerdict CTestAgendaBase::doTestStepPostambleL() + { + + delete iCalEntryViewBase; + iCalEntryViewBase=NULL; + + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + + + return CTestStep::doTestStepPostambleL(); + } + +// Create a new database +void CTestAgendaBase::CreateDatabaseL( void ) + { + TPtrC ptrFileName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KFileName, ptrFileName); + if ( !returnValue ) + returnValue=GetStringFromConfig(KDef, KFileName, ptrFileName); + + if (returnValue) + { + INFO_PRINTF2(_L("filename = %S"), &ptrFileName); + } + else + { + User::Leave(KErrNotFound); + } + + // Connect file server + User::LeaveIfError(iFs.Connect()); + iSessionConnected=ETrue; + + TInt r; + if (iCalSession) + { + TRAP(r, iCalSession->CreateCalFileL(ptrFileName)); + } + + if (r == KErrAlreadyExists) + { + TRAP_IGNORE(iCalSession->DeleteCalFileL(ptrFileName)); + TRAP(r, iCalSession->CreateCalFileL(ptrFileName)); + } + + + if (r!=KErrNone && r!=KErrAlreadyExists) + { + ERR_PRINTF2(_L("Creating Agenda file failed with error %d"), r); + SetTestStepResult(EFail); + } + } + +void CTestAgendaBase::OpenDatabaseL( void ) + { + TPtrC ptrFileName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KFileName, ptrFileName); + if ( !returnValue ) + returnValue=GetStringFromConfig(KDef, KFileName, ptrFileName); + + + if (returnValue) + { + INFO_PRINTF2(_L("filename = %S"), &ptrFileName); + } + else + { + User::Leave(KErrNotFound); + } + + // Connect file server + User::LeaveIfError(iFs.Connect()); + iSessionConnected=ETrue; + + + if (iCalSession) + { + iCalSession->OpenL(ptrFileName); + } + + //open the database by creating an object of CTestAgendaServerLaunchProgress + CTestAgendaServerLaunchProgress* progress = CTestAgendaServerLaunchProgress::NewL(this); + CleanupStack::PushL(progress); + + //kick start the launching process + progress->Start(); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy(progress); + + } + +void CTestAgendaBase::CleanupDatabase( void ) + { + if (iCalEntryViewBase) + { + delete iCalEntryViewBase; + iCalEntryViewBase = NULL; + } + +/* if (iCalSession) + { + delete iCalSession; + iCalSession=NULL; + }*/ + + + if (iSessionConnected) + { + iFs.Close(); + iSessionConnected=EFalse; + } + } + +void CTestAgendaBase::SetCalEntryView(CCalEntryView* calEntryViewPtr) + { + iCalEntryViewBase = calEntryViewPtr; + } + +CCalSession& CTestAgendaBase::CalSession() + { + if (iCalSession) + { + return *iCalSession; + } + else + { + iCalSession = CCalSession::NewL(); + + return *iCalSession; + } + } + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Src/TestAgendaCreateDB.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Src/TestAgendaCreateDB.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,43 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaCreateDB +// +// + +#include + +#include "TestAgendaCreateDB.h" + +// constructor +CTestAgendaCreateDB::CTestAgendaCreateDB() + { + SetTestStepName(_L("CreateDB")); + } + +// destructor +CTestAgendaCreateDB::~CTestAgendaCreateDB() + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestAgendaCreateDB::doTestStepL( void ) + { + // Printing to the console and log file + INFO_PRINTF1(_L("TEST-> CREATING OUR AGENDA DATABASE")); + + CreateDatabaseL(); + + // test steps return a result + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Src/TestAgendaServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Src/TestAgendaServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,107 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 main DLL entry point for the Smoketest_Agenda.dll +// +// + + +// EPOC includes +#include + +#include "TestAgendaServer.h" +#include "TestAgendaAddAppt.h" +#include "TestAgendaCreateDB.h" + + +_LIT(KServerName,"Smoketest_Agenda_Server"); + +CTestAgendaServer* CTestAgendaServer::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. + */ + { + CTestAgendaServer* server = new (ELeave) CTestAgendaServer(); + CleanupStack::PushL(server); + // CServer base class call + server->StartL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +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().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTestAgendaServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTestAgendaServer::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* CTestAgendaServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Secure and non-secure variants + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep = NULL; + + if(aStepName == _L("AddAppt")) + testStep = new CTestAgendaAddAppt(); + else if(aStepName == _L("CreateDB")) + testStep = new CTestAgendaCreateDB(); + return testStep; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Src/TestAgendaServerLaunchProgress.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Src/TestAgendaServerLaunchProgress.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,120 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestAgendaServerLaunchProgress +// +// + +#include "TestAgendaServerLaunchProgress.h" +#include + +CTestAgendaServerLaunchProgress* CTestAgendaServerLaunchProgress::NewL(CTestAgendaBase* aAgendaBase) +/** + * @return - Instance of the agenda progress callback + */ + { + CTestAgendaServerLaunchProgress* progress = new (ELeave) CTestAgendaServerLaunchProgress(aAgendaBase); + CleanupStack::PushL(progress); + progress->ConstructL(); + CleanupStack::Pop(progress); + return progress; + } + +CTestAgendaServerLaunchProgress::CTestAgendaServerLaunchProgress(CTestAgendaBase* aAgendaBase) +: CActive(EPriorityStandard) +, iAgendaBase(aAgendaBase) +/** +constructor +*/ + { + } + +void CTestAgendaServerLaunchProgress::ConstructL() +/** +constructor +*/ + { + //adding this active object into an active scheduler + CActiveScheduler::Add(this); + } + +CTestAgendaServerLaunchProgress::~CTestAgendaServerLaunchProgress() +/** +destructor +*/ + { + } + +void CTestAgendaServerLaunchProgress::Completed(TInt aError) +/** +callback function invoked after the file is completely loaded. +@param TInt aError +*/ + { + if(aError != KErrNone) + { + iAgendaBase ->INFO_PRINTF2(_L("Opening the agenda database file failed with error %D"),aError); + iAgendaBase ->SetTestStepResult(EFail); + } + else + { + iAgendaBase ->INFO_PRINTF1(_L("Opening the Agenda database succesful")); + } + CActiveScheduler::Stop(); + } + +void CTestAgendaServerLaunchProgress::Progress(TInt aPercentageCompleted) +/** +callback function invoked to indicate the progress +@param aPercentageCompleted percent file loaded +*/ + { + //log the progress percentage of saving the entries + iAgendaBase ->INFO_PRINTF2(_L("%D%% completed opening the agenda database"),aPercentageCompleted); + } + +TBool CTestAgendaServerLaunchProgress::NotifyProgress() + { + return ETrue; + } + +void CTestAgendaServerLaunchProgress::RunL() +/** +RunL from CActive class, opens the agenda database file, and builds the indices +@leave system wide error code +*/ + { + CCalEntryView* calEntryViewPtr = CCalEntryView::NewL(iAgendaBase->CalSession(), *this); + iAgendaBase->SetCalEntryView(calEntryViewPtr); + } + +void CTestAgendaServerLaunchProgress::DoCancel() +/** +DoCancel of the active object +*/ + { + iAgendaBase ->INFO_PRINTF1(_L("Inside do cancel of the active object")); + } + + +void CTestAgendaServerLaunchProgress::Start(void) +/** +starts the saving process +*/ + { + TRequestStatus *threadStatus=&iStatus; + User::RequestComplete(threadStatus,KErrNone); + SetActive(); + } + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/Src/sm_agenda.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/Src/sm_agenda.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,1 @@ +[Files MRU] diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/TestData/Smoketest_Agenda.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/TestData/Smoketest_Agenda.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,35 @@ +[default] +filename =c:\smoketest\Smoketest_Agenda +filenameSecure =c:Smoketest_Agenda + +[18920_CreateDB] + +[24560_AddAppts] +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 +alarm2 =15 + +year3 =2002 +month3 =9 +day3 =15 +hour3 =12 +min3 =0 +duration3 =30 +message3 =have lunch +alarm3 =15 + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/agenda/bwins/SMOKETEST_AGENDA_SERVERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/agenda/bwins/SMOKETEST_AGENDA_SERVERU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewServer@@YAHXZ @ 1 NONAME ; int __cdecl NewServer(void) + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/autoexec.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/autoexec.bat Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,19 @@ +@rem +@rem Copyright (c) 2009 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 +REM Auto Hardware Tests Wrapper +z: +smoketests.bat +REM RUNTESTS z:\dummytest.txt -p \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/build_smoketest_code.mbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/build_smoketest_code.mbc Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,12 @@ +SECTION_COMMANDS +bldmake bldfiles +abld reallyclean +abld test reallyclean +abld build winscw +abld test build winscw +abld build armv5 +abld test build armv5 + +SECTION_DIRS +..\group + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/dummytest.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/dummytest.txt Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,3 @@ +Dummy file. Used at the end of a test run with -p option +(RUNTESTS z:\dummytest.txt -p) +in order to reboot the board ready for the next rom. diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/readme.txt Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,49 @@ +24/11/2008 - Temporary AutoRom solution +======================================== + +Code +===== +The code in this directory is temporary code which enables smoke testing while a fully automated replacement for testdriver is being implemented. + +The code changes made are: + +Additon of directory common\testtools\smoketest\autorom containing the files: +build_smoketest_code.mbc, smoketests.oby, smoketests.bat, dummytest.txt, autoexec.bat, smoketest_romspec_9.5.xml, smoketest_romspec_9.5.xml and smoketest_romspec_future.xml + +The autorom building is invoked by changes to +//EPOC/master/cedar/generic/utils/Symbian_OS_v9.5.xml +//EPOC/master/cedar/generic/utils/Symbian_OS_v9.6.xml +//EPOC/master/cedar/generic/utils/Symbian_OS_vFuture.xml + +( + +) + + +Location of Roms +================ +The resulting roms can be found in : +src\cedar\generic\base\e32\rombuild + +H4 Core : h4hrp_smoketest_autorom_temp.img +H4 Rofs : h4hrp_smoketest_autorom_temp.rofs.img +H6 Core : h6_smoketest_autorom_temp.img +H6 Rofs : h6_smoketest_autorom_temp.rofs.img +Naviengine : NE1S_smoketest_autorom_temp.img + + +Location of build logs +========================== +The log for building the smoketest code is located in: +logs\cedar\smoketest_autorom_build.log + +The rom building logs can be found in : +logs\cedar\techviewroms%buildnum%_smoketest_autorom_temp.log + +Executing the smoke tests +========================== +Put the roms onto an MMC card in the normal way. Tests will execute automatically and write results to the MMC card (E:\testresults) +Retrieve the results from the MMC card. +Check that all tests have passed by checking each html results file in testresults. +Update the ESR with the results. + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/smoketest_romspec_9.5.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/smoketest_romspec_9.5.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/smoketest_romspec_9.6.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/smoketest_romspec_9.6.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/smoketest_romspec_future.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/smoketest_romspec_future.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/smoketest_romspec_tb101sf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/smoketest_romspec_tb101sf.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/smoketest_romspec_tb92sf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/smoketest_romspec_tb92sf.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/smoketest_romspec_vFuture.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/smoketest_romspec_vFuture.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/smoketests.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/smoketests.bat Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,57 @@ +@rem +@rem Copyright (c) 2009 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 +REM Run auto smoke tests on hardware + + +REM create testresults directory +md c:\testresults +md e:\testresults + + +testexecute z:\smoketest\smoketest_system.script +move c:\logs\testexecute\smoketest_system.htm e:\testresults\smoketest_system.htm + +testexecute z:\smoketest\setup_smoketest_agenda.script +move c:\logs\testexecute\setup_smoketest_agenda.htm e:\testresults\setup_smoketest_agenda.htm + +testexecute z:\smoketest\smoketest_agenda.script +move c:\logs\testexecute\smoketest_agenda.htm e:\testresults\smoketest_agenda.htm + +testexecute z:\smoketest\setup_smoketest_contacts.script +move c:\logs\testexecute\setup_smoketest_contacts.htm e:\testresults\setup_smoketest_contacts.htm + +testexecute z:\smoketest\smoketest_contacts.script +move c:\logs\testexecute\smoketest_contacts.htm e:\testresults\smoketest_contacts.htm + +testexecute z:\smoketest\setup_smoketest_mess.script +move c:\logs\testexecute\setup_smoketest_mess.htm e:\testresults\setup_smoketest_mess.htm + +testexecute z:\smoketest\smoketest_mess.script +move c:\logs\testexecute\smoketest_mess.htm e:\testresults\smoketest_mess.htm + +testexecute z:\smoketest\setup_smoketest_timew.script +move c:\logs\testexecute\setup_smoketest_timew.htm e:\testresults\setup_smoketest_timew.htm + +testexecute z:\smoketest\smoketest_timew.script +move c:\logs\testexecute\smoketest_timew.htm e:\testresults\smoketest_timew.htm + +testexecute z:\smoketest\smoketest_phone.script +move c:\logs\testexecute\smoketest_phone.htm e:\testresults\smoketest_phone.htm + +testexecute z:\smoketest\smoketest_syncmlapp.script +move c:\logs\testexecute\smoketest_syncmlapp.htm e:\testresults\smoketest_syncmlapp.htm + + \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/autorom/smoketests.oby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/autorom/smoketests.oby Tue Jan 26 15:16:33 2010 +0200 @@ -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: +* +*/ +#ifndef __SMOKETESTS_IBY__ +#define __SMOKETESTS_IBY__ + +#include "testexecute.iby" + +data = \epoc32\release\winscw\udeb\z\smoketest\autoexec.bat \autoexec.bat +data = \epoc32\release\winscw\udeb\z\smoketest\smoketests.bat \smoketests.bat +data = \epoc32\release\winscw\udeb\z\smoketest\dummytest.txt \dummytest.txt + + + + +file=ABI_DIR\BUILD_DIR\smoketest_agenda_server.exe sys\bin\smoketest_agenda_server.exe +file=ABI_DIR\BUILD_DIR\smoketest_contacts_server.exe sys\bin\smoketest_contacts_server.exe +file=ABI_DIR\BUILD_DIR\smoketest_mess_server.exe sys\bin\smoketest_mess_server.exe +file=ABI_DIR\BUILD_DIR\smoketest_system.exe sys\bin\smoketest_system.exe +file=ABI_DIR\BUILD_DIR\smoketest_timew_server.exe sys\bin\smoketest_timew_server.exe + +//required by messaging tests +file=ABI_DIR\BUILD_DIR\SmokeTest_Utils.dll sys\bin\SmokeTest_Utils.dll +file=ABI_DIR\BUILD_DIR\testconfigfileparser.dll \bin\testconfigfileparser.dll + +data = \epoc32\release\winscw\udeb\z\smoketest\setup_smoketest_agenda.script \smoketest\setup_smoketest_agenda.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_agenda.script \smoketest\smoketest_agenda.script +data = \epoc32\release\winscw\udeb\z\smoketest\setup_smoketest_contacts.script \smoketest\setup_smoketest_contacts.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_contacts.script \smoketest\smoketest_contacts.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_createsmsaccount.script \smoketest\smoketest_createsmsaccount.script +data = \epoc32\release\winscw\udeb\z\smoketest\setup_smoketest_mess.script \smoketest\setup_smoketest_mess.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_mess.script \smoketest\smoketest_mess.script +data = \epoc32\release\winscw\udeb\z\smoketest\setup_smoketest_timew.script \smoketest\setup_smoketest_timew.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_timew.script \smoketest\smoketest_timew.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_phone.script \smoketest\smoketest_phone.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_syncmlapp.script \smoketest\smoketest_syncmlapp.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_system.script \smoketest\smoketest_system.script +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_agenda.ini \smoketest\smoketest_agenda.ini +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_contacts.ini \smoketest\smoketest_contacts.ini +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_mess.ini \smoketest\smoketest_mess.ini +data = \epoc32\release\winscw\udeb\z\smoketest\sms\message1.txt \smoketest\sms\message1.txt +data = \epoc32\release\winscw\udeb\z\smoketest\smoketest_timew.ini \smoketest\smoketest_timew.ini + +#endif \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/TestData/Smoketest_Contacts.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/TestData/Smoketest_Contacts.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +[default] +filename =c:\smoketest\smoketest_contacts.cdb +filenameSecure =c:smoketest_contacts.cdb + +[18807_CreateDB] + +[18927_AddEntries] +count =5 + +firstname1 =Feroz +lastname1 =Uddin +company1 =Symbian +job1 =Cricket fan +workphone1 =0207 +workemail1 =feroz.uddin@symbian.com + +firstname2 =Louis +lastname2 =Nayegon +company2 =Symbian +job2 =Lazy Git +workphone2 =01452 812178 +workemail2 =louis.nayegon@symbian.com + +firstname3 =Alf +lastname3 =Garnett +company3 =BBC +job3 =star +workphone3 =0207 777 +workmobile3 =07790 +homephone3 =0208 888 +homemobile3 =07792 +fax3 =0208 999 +workemail3 =alf.garnett@bbc.co.uk +internet3 =www.bbc.co.uk +street3 =Marylebone Road +town3 =London +county3 =LondonCounty +postcode3 =W1 +country3 =England +notes3 =Small minded bigot + +firstname4 =Tom +lastname4 =Jones +company4 =Music +job4 =Singer +workemail4 =tom.jones@music.com + +firstname5 =Alan +lastname5 =Shearer +company5 =Newcastle United FC +job5 =Footballer +FirstNamePrn5 =Al-an +LastNamePrn5 =Shea-rer +CompanyNamePrn5 =New-cas-el You-Nigh-Ted diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/bwins/SMOKETEST_CONTACTS_SERVERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/bwins/SMOKETEST_CONTACTS_SERVERU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewServer@@YAHXZ @ 1 NONAME ; int __cdecl NewServer(void) + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/group/Smoketest_Contacts.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/group/Smoketest_Contacts.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,50 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + +TARGET Smoketest_Contacts_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7772 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY ReadUserData WriteUserData + +SOURCEPATH ..\Src + +SOURCE SmoketestContactsServer.cpp +SOURCE TestContact.cpp +SOURCE TestContactsAddEntries.cpp +SOURCE TestContactsBase.cpp +SOURCE TestContactsCreateDB.cpp + +USERINCLUDE ..\Inc ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY charconv.lib +LIBRARY cntview.lib +LIBRARY euser.lib +LIBRARY cntmodel.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib + +// We're quite heavy on the stack... 4k in WinS isn't enough... +EPOCSTACKSIZE 0x6000 diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,36 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 automated contacts smoketest +// +// + +PRJ_EXPORTS + +../scripts/Smoketest_Contacts.script /epoc32/release/wins/udeb/z/smoketest/smoketest_contacts.script +../scripts/Smoketest_Contacts.script /epoc32/release/wins/urel/z/smoketest/smoketest_contacts.script +../scripts/Smoketest_Contacts.script /epoc32/release/winscw/udeb/z/smoketest/smoketest_contacts.script +../scripts/Smoketest_Contacts.script /epoc32/release/winscw/urel/z/smoketest/smoketest_contacts.script + +../scripts/setup_Smoketest_Contacts.script /epoc32/release/wins/udeb/z/smoketest/setup_smoketest_contacts.script +../scripts/setup_Smoketest_Contacts.script /epoc32/release/wins/urel/z/smoketest/setup_smoketest_contacts.script +../scripts/setup_Smoketest_Contacts.script /epoc32/release/winscw/udeb/z/smoketest/setup_smoketest_contacts.script +../scripts/setup_Smoketest_Contacts.script /epoc32/release/winscw/urel/z/smoketest/setup_smoketest_contacts.script + +../TestData/Smoketest_Contacts.ini /epoc32/release/wins/udeb/z/smoketest/smoketest_contacts.ini +../TestData/Smoketest_Contacts.ini /epoc32/release/wins/urel/z/smoketest/smoketest_contacts.ini +../TestData/Smoketest_Contacts.ini /epoc32/release/winscw/udeb/z/smoketest/smoketest_contacts.ini +../TestData/Smoketest_Contacts.ini /epoc32/release/winscw/urel/z/smoketest/smoketest_contacts.ini + +PRJ_TESTMMPFILES +Smoketest_Contacts.mmp diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/inc/SmoketestContactsServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/inc/SmoketestContactsServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,36 @@ +/** +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 SmoketestContactsServer.h +*/ +#if (!defined __SMOKETESTCONTACTS_SERVER_H__) +#define __SMOKTETESTCONTACTS_SERVER_H__ +#include + +class CSmoketestContactsServer : public CTestServer + { +public: + static CSmoketestContactsServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + +private: + void ConstructL(); + }; +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/inc/TestContact.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/inc/TestContact.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,100 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContact +// +// + +#ifndef TEST_CONTACT_H +#define TEST_CONTACT_H + +#include + +class MTestContactInstrumentation +{ +public: + virtual void RaiseInstrumentationEventNotificationL(TInt aEventTag) = 0; +}; + +class CTestContact : public CBase + { +public: + static CTestContact* NewL(CContactItem& aSeedContact); + static CTestContact* NewLC(CContactItem& aSeedContact); + static CTestContact* NewL(CContactItem* aSeedContact); + static CTestContact* NewLC(CContactItem* aSeedContact); + ~CTestContact(); + + CContactItem& ContactItem(); + const TPtrC FirstNameL(); + const TPtrC LastNameL(); + const TPtrC CompanyNameL(); + const TPtrC JobTitleL(); + const TPtrC WorkPhoneL(); + const TPtrC WorkMobileL(); + const TPtrC HomePhoneL(); + const TPtrC HomeMobileL(); + const TPtrC FaxL(); + const TPtrC EmailAddressL(); + const TPtrC InternetAddressL(); + const TPtrC StreetL(); + const TPtrC TownL(); + const TPtrC CountyL(); + const TPtrC PostCodeL(); + const TPtrC CountryL(); + const TPtrC NotesL(); + const TPtrC NickNameL(); + const TPtrC PictureL(); + + void SetFirstNameL(const TDesC& aFirstName); + void SetLastNameL(const TDesC& aLastName); + void SetCompanyNameL(const TDesC& aCompanyName); + void SetJobTitleL(const TDesC& aJobTitle); + void SetWorkPhoneL(const TDesC& aWorkPhone); + void SetWorkMobileL(const TDesC& aWorkMobile); + void SetHomePhoneL(const TDesC& aHomePhone); + void SetHomeMobileL(const TDesC& aHomeMobile); + void SetFaxL(const TDesC& aFax); + void SetHomeEmailAddressL(const TDesC& aEmailAddress); + void SetWorkEmailAddressL(const TDesC& aEmailAddress); + void SetInternetAddressL(const TDesC& aInternetAddress); + void SetStreetL(const TDesC& aStreet); + void SetTownL(const TDesC& aTown); + void SetCountyL(const TDesC& aCounty); + void SetPostCodeL(const TDesC& aPostCode); + void SetCountryL(const TDesC& aCountry); + void SetNotesL(const TDesC& aNotes); + void SetNickNameL(const TDesC& aNickName); + void SetPictureL(const TDesC8& aPicture); + +private: + CTestContact(); + void ConstructL(CContactItem& aSeedContact); + void ConstructL(CContactItem* aSeedContact); + const TPtrC TextFieldL(TFieldType aFieldType) const; + const TPtrC TextFieldL(const CContentType& aTypesToMatch) const; + void SetTextFieldL(const CContentType& aTypesToMatch,const TDesC& aText) const; + void SetTextFieldL(TFieldType aFieldType, const TDesC& aText); + void SetTextFieldL(TFieldType aFieldType, const TDesC& aText, TUid aAddOnContentType); + CContactItemField& FindFieldL(TFieldType aFieldType) const; + CContactItemField& FindFieldL(const CContentType& aTypesToMatch) const; + void SetPictureFieldL(const TDesC8& aPicture) const; + TInt FindField(TFieldType aFieldType) const; + void InsertTextFieldL(TUid aID, const TDesC& aStringOfStuff); + +private: + CContactItem* iContactItem; + TBool iDestroyOnExit; + }; + +#endif /* __TEST_CONTACT_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/inc/TestContactsAddEntries.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/inc/TestContactsAddEntries.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,35 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestSuiteContacts +// +// + +#ifndef TEST_CONTACTS_ADD_ENTRIES_H +#define TEST_CONTACTS_ADD_ENTRIES_H + +#include "TestContactsBase.h" + +class CTestContactsAddEntries : public CTestContactsBase +{ +public: + CTestContactsAddEntries(); + virtual ~CTestContactsAddEntries(); + + virtual enum TVerdict doTestStepL( void ); + +private: + void AddEntriesL( void ); +}; + +#endif TEST_CONTACTS_ADD_ENTRIES_H diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/inc/TestContactsBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/inc/TestContactsBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,53 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsBase +// +// + +#ifndef TEST_CONTACTS_BASE_H +#define TEST_CONTACTS_BASE_H + + +#include +#include +#include + +#include "TestContact.h" + +const TInt KMaxScriptLineLength = 200; + +class CTestContactsBase : public CTestStep, protected MTestContactInstrumentation +{ +public: + CTestContactsBase(); + ~CTestContactsBase(); + virtual enum TVerdict doTestStepPreambleL(); + virtual enum TVerdict doTestStepPostambleL(); + +protected: + void CreateDatabase(); + void OpenDatabase(); + void CleanupDatabase(); + void RaiseInstrumentationEventNotificationL(TInt aEventTag); + CContactIdArray* SearchEntriesL(); + +protected: + CContactDatabase* iDatabase; + CContactItemFieldDef* iFieldDef; + +private: + CActiveScheduler* iSchedular; +}; + +#endif /* TEST_CONTACTS_BASE_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/inc/TestContactsCreateDB.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/inc/TestContactsCreateDB.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsCreateDB +// +// + +#ifndef TEST_CONTACTS_CREATE_DB_H +#define TEST_CONTACTS_CREATE_DB_H + +#include "TestContactsBase.h" + +class CTestContactsCreateDB : public CTestContactsBase +{ +public: + CTestContactsCreateDB(); + virtual ~CTestContactsCreateDB(); + + virtual enum TVerdict doTestStepL( void ); + +}; + +#endif /* TEST_CONTACTS_CREATE_DB_H */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/scripts/Smoketest_Contacts.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/scripts/Smoketest_Contacts.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Contacts smoketest +// +RUN_WS_PROGRAM 10 z:\sys\bin\contacts.exe +// +DELAY 1500 +// +LOAD_SUITE Smoketest_Contacts_Server +// +START_TESTCASE 9094 +RUN_TEST_STEP 100 Smoketest_Contacts_Server CreateDB c:\smoketest\Smoketest_Contacts.ini 18807_CreateDB +END_TESTCASE 9094 +START_TESTCASE 9082 +RUN_TEST_STEP 1000 Smoketest_Contacts_Server AddEntries c:\smoketest\Smoketest_Contacts.ini 18927_AddEntries +END_TESTCASE 9082 diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/scripts/setup_Smoketest_Contacts.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/scripts/setup_Smoketest_Contacts.script Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,22 @@ +// +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +RUN_UTILS MkDir c:\smoketest\ + +RUN_UTILS CopyFile z:\smoketest\smoketest_contacts.ini c:\smoketest\smoketest_contacts.ini +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_contacts.ini + +// RUN_SCRIPT Smoketest_Contacts.script \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/src/SmoketestContactsServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/src/SmoketestContactsServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,108 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 SmoketestContactsServer.cpp +*/ + +#include "SmoketestContactsServer.h" +#include "TestContactsCreateDB.h" +#include "TestContactsAddEntries.h" + +// __EDIT_ME__ - Substitute the name of the test server +_LIT(KServerName,"Smoketest_Contacts_Server"); +// __EDIT_ME__ - Use your own server class name +CSmoketestContactsServer* CSmoketestContactsServer::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. + */ + { + CSmoketestContactsServer * server = new (ELeave) CSmoketestContactsServer(); + CleanupStack::PushL(server); + // CServer base class call + server->StartL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +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().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CSmoketestContactsServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CSmoketestContactsServer::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()); + + if (!err) { } + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + } + + +// __EDIT_ME__ - Use your own server class name +CTestStep* CSmoketestContactsServer::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 + if(aStepName == _L("AddEntries")) + testStep = new CTestContactsAddEntries(); + if(aStepName == _L("CreateDB")) + testStep = new CTestContactsCreateDB(); + + return testStep; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/src/TestContact.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/src/TestContact.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,491 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContact +// +// + +#include + +#include "TestContact.h" + +CTestContact* CTestContact::NewL(CContactItem& aSeedContact) + { + CTestContact* self=CTestContact::NewLC(aSeedContact); + CleanupStack::Pop(); + return self; + } + +CTestContact* CTestContact::NewLC(CContactItem& aSeedContact) + { + CTestContact* self=new(ELeave) CTestContact(); + CleanupStack::PushL(self); + self->ConstructL(aSeedContact); + return self; + } + +CTestContact* CTestContact::NewL(CContactItem* aSeedContact) + { + CTestContact* self=CTestContact::NewLC(aSeedContact); + CleanupStack::Pop(); + return self; + } + +CTestContact* CTestContact::NewLC(CContactItem* aSeedContact) + { + CTestContact* self=new(ELeave) CTestContact(); + CleanupStack::PushL(self); + self->ConstructL(aSeedContact); + return self; + } + +CTestContact::CTestContact() : iDestroyOnExit(EFalse) + { + } + +void CTestContact::ConstructL(CContactItem& aSeedContact) + { + iDestroyOnExit=ETrue; + iContactItem=CContactCard::NewL(&aSeedContact); + } + +void CTestContact::ConstructL(CContactItem* aSeedContact) + { + iDestroyOnExit=EFalse; + iContactItem=aSeedContact; + } + +CTestContact::~CTestContact() + { + if (iDestroyOnExit) + delete iContactItem; + iContactItem=NULL; + } + +CContactItem& CTestContact::ContactItem() + { + return *iContactItem; + } + +const TPtrC CTestContact::FirstNameL() + { + return TextFieldL(KUidContactFieldGivenName); + } + +const TPtrC CTestContact::LastNameL() + { + return TextFieldL(KUidContactFieldFamilyName); + } + +const TPtrC CTestContact::CompanyNameL() + { + return TextFieldL(KUidContactFieldCompanyName); + } + +const TPtrC CTestContact::JobTitleL() + { + return TextFieldL(KUidContactFieldJobTitle); + } + +const TPtrC CTestContact::WorkPhoneL() + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + const TPtrC text=TextFieldL(*contentType); + CleanupStack::PopAndDestroy(); // contentType. + return text; + } + +const TPtrC CTestContact::WorkMobileL() + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + contentType->AddFieldTypeL(KUidContactFieldVCardMapCELL); + const TPtrC text=TextFieldL(*contentType); + CleanupStack::PopAndDestroy(); // contentType. + return text; + } + +const TPtrC CTestContact::HomePhoneL() + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + const TPtrC text=TextFieldL(*contentType); + CleanupStack::PopAndDestroy(); // contentType. + return text; + } + +const TPtrC CTestContact::HomeMobileL() + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + contentType->AddFieldTypeL(KUidContactFieldVCardMapCELL); + const TPtrC text=TextFieldL(*contentType); + CleanupStack::PopAndDestroy(); // contentType. + return text; + } + +const TPtrC CTestContact::FaxL() + { + return TextFieldL(KUidContactFieldFax); + } + +const TPtrC CTestContact::EmailAddressL() + { + return TextFieldL(KUidContactFieldEMail); + } + +const TPtrC CTestContact::InternetAddressL() + { + return TextFieldL(KUidContactFieldUrl); + } + +const TPtrC CTestContact::StreetL() + { + return TextFieldL(KUidContactFieldAddress); + } + +const TPtrC CTestContact::TownL() + { + return TextFieldL(KUidContactFieldLocality); + } + +const TPtrC CTestContact::CountyL() + { + return TextFieldL(KUidContactFieldRegion); + } + +const TPtrC CTestContact::PostCodeL() + { + return TextFieldL(KUidContactFieldPostcode); + } + +const TPtrC CTestContact::CountryL() + { + return TextFieldL(KUidContactFieldCountry); + } + +const TPtrC CTestContact::NotesL() + { + return TextFieldL(KUidContactFieldNote); + } + +const TPtrC CTestContact::NickNameL() + { + return TextFieldL(KUidContactFieldSecondName); + } + +const TPtrC CTestContact::PictureL() + { + return TextFieldL(KUidContactFieldPicture); + } + +void CTestContact::SetFirstNameL(const TDesC& aFirstName) + { + SetTextFieldL(KUidContactFieldGivenName, aFirstName, KUidContactFieldVCardMapUnusedN); + } + +void CTestContact::SetLastNameL(const TDesC& aLastName) + { + SetTextFieldL(KUidContactFieldFamilyName, aLastName, KUidContactFieldVCardMapUnusedN); + } + +void CTestContact::SetCompanyNameL(const TDesC& aCompanyName) + { + SetTextFieldL(KUidContactFieldCompanyName, aCompanyName, KUidContactFieldVCardMapORG); + } + +void CTestContact::SetJobTitleL(const TDesC& aJobTitle) + { + SetTextFieldL(KUidContactFieldJobTitle,aJobTitle); + } + +void CTestContact::SetWorkPhoneL(const TDesC& aWorkPhone) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + SetTextFieldL(*contentType,aWorkPhone); + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetWorkMobileL(const TDesC& aWorkMobile) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + contentType->AddFieldTypeL(KUidContactFieldVCardMapCELL); + SetTextFieldL(*contentType,aWorkMobile); + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetHomePhoneL(const TDesC& aHomePhone) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + SetTextFieldL(*contentType,aHomePhone); + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetHomeMobileL(const TDesC& aHomeMobile) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPhoneNumber); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE); + contentType->AddFieldTypeL(KUidContactFieldVCardMapCELL); + SetTextFieldL(*contentType,aHomeMobile); + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetFaxL(const TDesC& aFax) + { + SetTextFieldL(KUidContactFieldFax,aFax); + } + +void CTestContact::SetHomeEmailAddressL(const TDesC& aEmailAddress) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldEMail); + contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME); + SetTextFieldL(*contentType,aEmailAddress); + CleanupStack::PopAndDestroy(contentType); + } + +void CTestContact::SetWorkEmailAddressL(const TDesC& aEmailAddress) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldEMail); + contentType->AddFieldTypeL(KUidContactFieldVCardMapWORK); + SetTextFieldL(*contentType,aEmailAddress); + CleanupStack::PopAndDestroy(contentType); + } + + +void CTestContact::SetInternetAddressL(const TDesC& aInternetAddress) + { + SetTextFieldL(KUidContactFieldUrl,aInternetAddress); + } + +void CTestContact::SetStreetL(const TDesC& aStreet) + { + SetTextFieldL(KUidContactFieldAddress,aStreet); + } + +void CTestContact::SetTownL(const TDesC& aTown) + { + SetTextFieldL(KUidContactFieldLocality,aTown); + } + +void CTestContact::SetCountyL(const TDesC& aCounty) + { + SetTextFieldL(KUidContactFieldRegion,aCounty); + } + +void CTestContact::SetPostCodeL(const TDesC& aPostCode) + { + SetTextFieldL(KUidContactFieldPostcode,aPostCode); + } + +void CTestContact::SetCountryL(const TDesC& aCountry) + { + SetTextFieldL(KUidContactFieldCountry,aCountry); + } + +void CTestContact::SetNotesL(const TDesC& aNotes) + { + SetTextFieldL(KUidContactFieldNote,aNotes); + } + +void CTestContact::SetNickNameL(const TDesC& aNickName) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldSecondName); + TRAPD(err, SetTextFieldL(*contentType,aNickName)); + if (!err) { } + CleanupStack::PopAndDestroy(); // contentType. + } + +void CTestContact::SetPictureL(const TDesC8& aPicture) + { + CContentType* contentType=CContentType::NewL(); + CleanupStack::PushL(contentType); + contentType->AddFieldTypeL(KUidContactFieldPicture); + SetPictureFieldL(aPicture); + CleanupStack::PopAndDestroy(contentType); + } + +const TPtrC CTestContact::TextFieldL(TFieldType aFieldType) const + { + CContactItemField& field=FindFieldL(aFieldType); + ASSERT(field.StorageType()==KStorageTypeText); + return STATIC_CAST(CContactTextField*,(field.Storage()))->Text(); + } + +const TPtrC CTestContact::TextFieldL(const CContentType& aTypesToMatch) const + { + CContactItemField& field=FindFieldL(aTypesToMatch); + ASSERT(field.StorageType()==KStorageTypeText); + return STATIC_CAST(CContactTextField*,field.Storage())->Text(); + } + +void CTestContact::InsertTextFieldL(TFieldType aID, const TDesC& aStringOfStuff ) + { + CContactItemField* itemFieldPtr = NULL; + CContactTextField* textStoragePtr = NULL; + + itemFieldPtr = CContactItemField::NewLC( KStorageTypeText, aID ); + textStoragePtr = itemFieldPtr->TextStorage(); // we don't have ownership here, hence no stack. + + textStoragePtr->SetTextL( aStringOfStuff ); + textStoragePtr = NULL; // we've finished with this ptr now. + + iContactItem->AddFieldL( *itemFieldPtr ); // hand ownership over here + CleanupStack::Pop( itemFieldPtr ); // and pop, + } + +void CTestContact::SetTextFieldL(TFieldType aFieldType,const TDesC& aText) + { + TInt fieldIndex=FindField(aFieldType); + + if ( fieldIndex > KErrNotFound ) + { + CContactItemField& field=FindFieldL(aFieldType); + ASSERT(field.StorageType()==KStorageTypeText); + STATIC_CAST(CContactTextField*,field.Storage())->SetText(aText.AllocL()); + } + else + { + InsertTextFieldL(aFieldType, aText); + } + } + +void CTestContact::SetTextFieldL(const CContentType& aTypesToMatch,const TDesC& aText) const + { + CContactItemField& field=FindFieldL(aTypesToMatch); + ASSERT(field.StorageType()==KStorageTypeText); + STATIC_CAST(CContactTextField*,field.Storage())->SetText(aText.AllocL()); + } + +CContactItemField& CTestContact::FindFieldL(TFieldType aFieldType) const + { + CContactItemFieldSet& fields=iContactItem->CardFields(); + TInt index=fields.Find(aFieldType); + User::LeaveIfError(index); + return fields[index]; + } + +void CTestContact::SetTextFieldL(TFieldType aFieldType, const TDesC& aText, TUid aAddOnContentType) + { + CContactItemFieldSet& fields = iContactItem->CardFields(); + CContactTextField* textField = NULL; + TInt fieldIndex = 0; + + fieldIndex = FindField( aFieldType ); + + if (fieldIndex == KErrNotFound ) + { + InsertTextFieldL( aFieldType, aText ); + fieldIndex = FindField( aFieldType ); + CContactItemField& field = fields[ fieldIndex ]; + field.AddFieldTypeL( aAddOnContentType ); + } + else if (fieldIndex >= KErrNone ) + { + CContactItemField& field = fields[ fieldIndex ]; + ASSERT(field.StorageType()==KStorageTypeText); + textField = static_cast(field.Storage()); + textField->SetText( aText.AllocL() ); + field.AddFieldTypeL( aAddOnContentType ); + } + } + +TInt CTestContact::FindField(TFieldType aFieldType) const + { + return iContactItem->CardFields().Find( aFieldType ); + } + +CContactItemField& CTestContact::FindFieldL(const CContentType& aTypesToMatch) const + { + CContactItemFieldSet& fields=iContactItem->CardFields(); + const TInt numTypesToMatch(aTypesToMatch.FieldTypeCount()); + const TFieldType mainFieldType(aTypesToMatch.FieldType(0)); + TInt index=-1; + FOREVER + { + index=fields.FindNext(mainFieldType,index+1); + User::LeaveIfError(index); + + CContactItemField& thisPhoneField=fields[index]; + const CContentType& thisPhoneFieldTypes=thisPhoneField.ContentType(); + const TInt numFieldTypes(thisPhoneFieldTypes.FieldTypeCount()); + + if (numFieldTypes!=numTypesToMatch) + { + continue; + } + + TInt numTypesLeftToMatch=numTypesToMatch; + for (TInt ii=0;iiCardFields(); + TInt pos; + pos=fieldSet.Find(KUidContactFieldPicture); + User::LeaveIfError(pos); + fieldSet[pos].StoreStorage()->SetThingL(aPicture); + + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/src/TestContactsAddEntries.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/src/TestContactsAddEntries.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,408 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsAddEntries +// +// + +// Epoc include +#include + +// User include +#include "TestContactsAddEntries.h" +#include "TestContact.h" + +/*@{*/ +// Literal constants +_LIT(KCardTemplateName, "TestTemplate"); +_LIT(KCount, "count"); +_LIT(KFirstName, "firstname%d"); +_LIT(KLastName, "lastname%d"); +_LIT(KCompanyName, "company%d"); +_LIT(KJobTitle, "job%d"); +_LIT(KWorkPhone, "workphone%d"); +_LIT(KWorkMobile, "workmobile%d"); +_LIT(KHomePhone, "homephone%d"); +_LIT(KHomeMobile, "homemobile%d"); +_LIT(KFax, "fax%d"); +_LIT(KWorkEmailAddress, "workemail%d"); +_LIT(KInternetAddress, "internet%d"); +_LIT(KStreet, "street%d"); +_LIT(KTown, "town%d"); +_LIT(KCounty, "county%d"); +_LIT(KPostCode, "postcode%d"); +_LIT(KCountry, "country%d"); +_LIT(KNotes, "notes%d"); +_LIT(KNickName, "nickName%d"); +_LIT(KPictureName, "picturename%d"); +_LIT(KGroupName, "groupname%d"); +_LIT(KTemplateName, "templatename%d"); +_LIT(KOneFieldTemplate, "OneFieldTemplate"); +/*@}*/ + + +CTestContactsAddEntries::CTestContactsAddEntries() +/** +Default Constructor + */ + { + SetTestStepName(_L("AddEntries")); + } + +CTestContactsAddEntries::~CTestContactsAddEntries() +/** +Destructor + */ + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestContactsAddEntries::doTestStepL() +/** +invoked by the test execute framework for exercising the +functionality under test +@return EPass: The test passed succesfully; + EFail: The test failed; + EInconclusive: The result of the test was inconclusive; + ETestSuiteError: Error in the test suite; + EAbort: The test was aborted; + EIgnore: The test was unexecuted +@leave system wide error codes +*/ + { + + // Printing to the console and log file + INFO_PRINTF1(_L("Contacts Add Entries Test")); + + OpenDatabase(); + if ( TestStepResult() == EPass ) + { + TRAPD(r, AddEntriesL()); + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Test step failed with error code = %d"), r); + SetTestStepResult(EFail); + } + } + CleanupDatabase(); + + // test steps return a result + return TestStepResult(); + } + +void CTestContactsAddEntries::AddEntriesL() +/** +This function adds contact entries to the database depending on entry type. +If the entry contains the group name then the contact will be added to the +particular group specified in the entry. If the entry contains the template +name then the contact item depending on the specified template name will be +created and added to the database. + +@leave system wide error code + */ + { + TBool groupExists = EFalse; + TBool templateFound = EFalse; + TInt count=1; + + if ( !GetIntFromConfig(ConfigSection(), KCount, count) ) + { + count=1; + } + + INFO_PRINTF2(_L("Number of Entries to Add = %d"), count); + + TBuf tempStore; + TPtrC ptrString; + + /******************************************************************* + To Create a contact card template depending upon the contact item + on which the new template's field set is based. The template name + on which the new template is based is read from the ini file. + *******************************************************************/ + + for (TInt entry=0; entryCreateContactCardTemplateLC(KCardTemplateName); + } + else + { + INFO_PRINTF2(_L("Template Name = %S"), &ptrString); + CContactIdArray* templateList = NULL; + CContactItem* tempTemplate = NULL; + + // Returns a copy of the database's template ID list + templateList = iDatabase->GetCardTemplateIdListL(); + CleanupStack::PushL(templateList); + + // Returns the number of contact card templates that currently exist in the database. + TInt tCount = iDatabase->TemplateCount(); + INFO_PRINTF2(_L("Number of existing templates = %d"), tCount); + + // Search for template in the template ID list + for(TInt i = 0; iReadContactLC((*templateList)[i])); + + // Gets the label for a contact card template. + TPtrC tempLabel = STATIC_CAST(CContactCardTemplate*,tempTemplate)->GetTemplateLabelL(); + + // Compare the template label + if(!(tempLabel.Compare(ptrString))) + { + INFO_PRINTF2(_L("Template %S found"), &tempLabel); + + // Creates a contact card template and adds it to the database + item = iDatabase->CreateContactCardTemplateLC(tempTemplate,tempLabel); + + // Compare the template label with OneFieldTemplate and add field to it. + if(!(tempLabel.Compare(KOneFieldTemplate))) + { + // Allocates and constructs a contact item field + CContactItemField* field=CContactItemField::NewLC(KStorageTypeText,KUidContactFieldGivenName); + item->AddFieldL(*field); + CleanupStack::Pop(field); // field + } + CleanupStack::Pop(item); + templateFound = ETrue; + } + CleanupStack::PopAndDestroy(tempTemplate); + } + + if (!templateFound) + { + ERR_PRINTF2(_L("Ini Template %S does not match existing templates"), &ptrString); + SetTestStepResult(EFail); + } + + // Set templateFound to false for next entry + templateFound = EFalse; + + CleanupStack::PopAndDestroy(templateList); + CleanupStack::PushL(item); + } + + CTestContact* contact=CTestContact::NewLC(*item); + + tempStore.Format(KFirstName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("firstname = %S"), &ptrString); + contact->SetFirstNameL(ptrString); + } + + tempStore.Format(KNickName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("NickName = %S"), &ptrString); + TRAPD(err, contact->SetNickNameL(ptrString)); + if ( err != KErrNone ) + { + ERR_PRINTF2(_L("SetNickNameL Leave = %d"), err); + SetTestStepResult(EFail); + } + } + + tempStore.Format(KLastName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("lastname = %S"), &ptrString); + contact->SetLastNameL(ptrString); + } + + tempStore.Format(KCompanyName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("company = %S"), &ptrString); + contact->SetCompanyNameL(ptrString); + } + + tempStore.Format(KJobTitle(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("job = %S"), &ptrString); + contact->SetJobTitleL(ptrString); + } + + tempStore.Format(KWorkPhone(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("work phone = %S"), &ptrString); + contact->SetWorkPhoneL(ptrString); + } + + tempStore.Format(KWorkMobile(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("work mobile = %S"), &ptrString); + contact->SetWorkMobileL(ptrString); + } + + tempStore.Format(KHomePhone(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("home phone = %S"), &ptrString); + contact->SetHomePhoneL(ptrString); + } + + tempStore.Format(KHomeMobile(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("home mobile = %S"), &ptrString); + contact->SetHomeMobileL(ptrString); + } + + tempStore.Format(KFax(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("fax = %S"), &ptrString); + contact->SetFaxL(ptrString); + } + + tempStore.Format(KWorkEmailAddress(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("work email = %S"), &ptrString); + contact->SetWorkEmailAddressL(ptrString); + } + + tempStore.Format(KInternetAddress(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("internet = %S"), &ptrString); + contact->SetInternetAddressL(ptrString); + } + + tempStore.Format(KStreet(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("street = %S"), &ptrString); + contact->SetStreetL(ptrString); + } + + tempStore.Format(KTown(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("town = %S"), &ptrString); + contact->SetTownL(ptrString); + } + + tempStore.Format(KCounty(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("county = %S"), &ptrString); + contact->SetCountyL(ptrString); + } + + tempStore.Format(KPostCode(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("post code = %S"), &ptrString); + contact->SetPostCodeL(ptrString); + } + + tempStore.Format(KCountry(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("country = %S"), &ptrString); + contact->SetCountryL(ptrString); + } + + tempStore.Format(KNotes(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("notes = %S"), &ptrString); + contact->SetNotesL(ptrString); + } + + tempStore.Format(KPictureName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("Picture Name = %S"), &ptrString); + + HBufC8* pictureName8 = HBufC8::NewLC(ptrString.Length()); + pictureName8->Des().Copy(ptrString); + + contact->SetPictureL(*pictureName8); + + CleanupStack::PopAndDestroy(pictureName8); + } + + tempStore.Format(KGroupName(), entry); + if (GetStringFromConfig(ConfigSection(), tempStore, ptrString)) + { + INFO_PRINTF2(_L("Group Name = %S"), &ptrString); + + // Flag for adding contacts to group. + groupExists = ETrue; + } + + const TContactItemId id = iDatabase->AddNewContactL(contact->ContactItem()); + + /******************************************************************** + This is for adding the contact entry to the specified group. + ********************************************************************/ + if(groupExists) + { + INFO_PRINTF1(_L("Adding Item ")); + CContactIdArray* groupList = NULL; + + // Returns a copy of the database's group ID list + groupList = iDatabase->GetGroupIdListL(); + CleanupStack::PushL(groupList); + + // Returns the number of groups that currently exist in the database + TInt groupCount = iDatabase->GroupCount(); + + + // Search for the group + for(TInt i = 0; iReadContactLC((*groupList)[i])); + + // Gets the contact item's ID. + const TContactItemId groupId1 = group->Id(); + + // Gets the group label. + TPtrC label = group->GetGroupLabelL(); + // Compare the group label with group name read from ini file. + if(!(label.Compare(ptrString))) + { + /** + Sets a contact item which already exists in the database + to be a member of a contact group + */ + iDatabase->AddContactToGroupL(id, groupId1); + INFO_PRINTF1(_L("Item added successfully")); + groupExists = EFalse; + } + CleanupStack::PopAndDestroy(group); + + } + CleanupStack::PopAndDestroy(groupList); + } + + CleanupStack::PopAndDestroy(contact); + CleanupStack::PopAndDestroy(item); + + } + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/src/TestContactsBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/src/TestContactsBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,176 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsBase +// +// + +// EPOC includes +#include +#include +#include +#include + +// User include +#include "TestContactsBase.h" + +/*@{*/ +// Literal constants +_LIT(KDef, "default"); +_LIT(KFileName, "filenameSecure"); +_LIT(KKey, "key"); +/*@}*/ + + +// constructor +CTestContactsBase::CTestContactsBase() +: iDatabase(NULL) +, iFieldDef(NULL) +, iSchedular(NULL) + { + } + +// destructor +CTestContactsBase::~CTestContactsBase() + { + delete iFieldDef; + iFieldDef=NULL; + + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + } + +enum TVerdict CTestContactsBase::doTestStepPreambleL() + { + iSchedular=new (ELeave)CActiveScheduler(); + CActiveScheduler::Install(iSchedular); + + iFieldDef=new(ELeave) CContactItemFieldDef; + iFieldDef->AppendL(KUidContactFieldFamilyName); + iFieldDef->AppendL(KUidContactFieldGivenName); + return CTestStep::doTestStepPreambleL(); + } + +enum TVerdict CTestContactsBase::doTestStepPostambleL() + { + delete iFieldDef; + iFieldDef=NULL; + + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + + return CTestStep::doTestStepPostambleL(); + } + +// Create a new database +void CTestContactsBase::CreateDatabase() + { + TPtrC ptrFileName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KFileName, ptrFileName); + if (!returnValue) + returnValue=GetStringFromConfig(KDef, KFileName, ptrFileName); + + // Create database + if (returnValue) + { + INFO_PRINTF2(_L("filename = %S"), &ptrFileName); + TRAPD(r, iDatabase=CContactDatabase::ReplaceL(ptrFileName)) + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Creating Contacts file failed. Error %d"), r); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF1(_L("No Contacts file specified. Open default file.")); + TRAPD(r, iDatabase=CContactDatabase::ReplaceL()) + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Creating Contacts file failed. Error %d"), r); + SetTestStepResult(EFail); + } + } + } + +void CTestContactsBase::OpenDatabase() + { + TPtrC ptrFileName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KFileName, ptrFileName); + if (!returnValue) + returnValue=GetStringFromConfig(KDef, KFileName, ptrFileName); + + // Open database + if (returnValue) + { + INFO_PRINTF2(_L("filename = %S"), &ptrFileName); + RaiseInstrumentationEventNotificationL(17); + TRAPD(r, iDatabase=CContactDatabase::OpenL(ptrFileName)); + RaiseInstrumentationEventNotificationL(18); + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Opening Contacts file failed. Error %d"), r); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF1(_L("No Contacts file specified. Open default file.")); + RaiseInstrumentationEventNotificationL(17); + TRAPD(r, iDatabase=CContactDatabase::OpenL()); + RaiseInstrumentationEventNotificationL(18); + if (r!=KErrNone) + { + ERR_PRINTF2(_L("Opening Contacts file failed. Error %d"), r); + SetTestStepResult(EFail); + } + } + } + +void CTestContactsBase::CleanupDatabase() + { + delete iDatabase; + iDatabase=NULL; + } + +void CTestContactsBase::RaiseInstrumentationEventNotificationL(TInt aEventTag) + { + INFO_PRINTF2(_L("RaiseEventNotification %d"), aEventTag); + } + +CContactIdArray* CTestContactsBase::SearchEntriesL() +/** +This function searches in the contacts database and populates an array +with ids' of the contacts which satisfy the search criterion +read from the ini file. +@return - Pointer to the contact ID array +@leave system wide error code + */ + { + TPtrC ptrKey; + if (!GetStringFromConfig(ConfigSection(), KKey, ptrKey)) + { + ERR_PRINTF1(_L("No key value for entry")); + SetTestStepResult(EFail); + } + INFO_PRINTF2(_L("Key Value for Entry Search = %S"), &ptrKey); + + // The function searches the fields contained in the field definition + INFO_PRINTF1(_L("Searching through the database for entry")); + + CContactIdArray* ret=iDatabase->FindLC(ptrKey, iFieldDef); + CleanupStack::Pop(ret); + return ret; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/src/TestContactsCreateDB.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/src/TestContactsCreateDB.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestContactsCreateDB +// +// + +#include + +#include "TestContactsCreateDB.h" + +CTestContactsCreateDB::CTestContactsCreateDB() + { + SetTestStepName(_L("CreateDB")); + } + +CTestContactsCreateDB::~CTestContactsCreateDB() + { + } + +// Each test step must supply a implementation for doTestStepL +enum TVerdict CTestContactsCreateDB::doTestStepL() + { + // Printing to the console and log file + INFO_PRINTF1(_L("Contacts CreateDB Test")); + + CreateDatabase(); + CleanupDatabase(); + + // test steps return a result + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/contacts/src/sm_contacts.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/contacts/src/sm_contacts.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,2 @@ +[Files MRU] +0=m:\src\common\generic\smoketest\agenda\src\TestAgendaServerLaunchProgress.cpp diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Group/Smoketest_Mess.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Group/Smoketest_Mess.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,81 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + +TARGET Smoketest_Mess_Server.exe +TARGETTYPE exe +UID 0x1000007A 0x101F7774 + +#if (!defined __NO_VENDORID__) +VENDORID 0x70000001 +#endif + +CAPABILITY ReadUserData WriteUserData WriteDeviceData NetworkServices + +#if (defined _PLATTEST_CDMA_) +MACRO CDMA_API_ENABLED +MACRO GSM_COMPATIBILITY_MODE +#endif + +SOURCEPATH ..\Src + +SOURCE TestMessServer.cpp +SOURCE TestMessSession.cpp +SOURCE TestMessSharedData.cpp +SOURCE TestMessWatcher.cpp +SOURCE TestMessProcessor.cpp +SOURCE TestMessTimer.cpp +SOURCE TestMessBase.cpp +SOURCE TestMessCleanMessageFolder.cpp +SOURCE TestMessCreateSmsAccount.cpp +SOURCE TestMessSetDefaultSc.cpp +SOURCE TestMessCreateSMS.cpp +SOURCE TestMessCreateGsmSmsUtil.cpp +#ifdef _PLATTEST_CDMA_ +SOURCE TestMessCreateCdmaSmsUtil.cpp +#endif +SOURCE TestMessCreateSmsUtilBase.cpp +SOURCE TestMessProcessExistingMsg.cpp +SOURCE TestMessEditEntry.cpp +SOURCE TestMessStoreProcessUtil.cpp +SOURCE TestMessEditEntryUtil.cpp +SOURCE TestMessPrintEntryUtil.cpp + +USERINCLUDE ..\Inc +USERINCLUDE ..\..\Group + +APP_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY etel.lib +LIBRARY schsend.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY msgs.lib +LIBRARY fbscli.lib +LIBRARY imcm.lib +LIBRARY efsrv.lib +LIBRARY sendas2.lib +LIBRARY etext.lib +LIBRARY smcm.lib + +LIBRARY gsmu.lib +LIBRARY esock.lib +LIBRARY smsu.lib +LIBRARY TestExecuteUtils.lib +LIBRARY TestExecuteLogClient.lib +LIBRARY SmokeTest_Utils.lib +LIBRARY etelmm.lib diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,46 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +../Scripts/Smoketest_CreateSmsAccount.script /epoc32/release/wins/udeb/z/smoketest/smoketest_createsmsaccount.script +../Scripts/Smoketest_CreateSmsAccount.script /epoc32/release/wins/urel/z/smoketest/smoketest_createsmsaccount.script +../Scripts/Smoketest_CreateSmsAccount.script /epoc32/release/winscw/udeb/z/smoketest/smoketest_createsmsaccount.script +../Scripts/Smoketest_CreateSmsAccount.script /epoc32/release/winscw/urel/z/smoketest/smoketest_createsmsaccount.script + +../Scripts/setup_Smoketest_Mess.script /epoc32/release/wins/udeb/z/smoketest/setup_smoketest_mess.script +../Scripts/setup_Smoketest_Mess.script /epoc32/release/wins/urel/z/smoketest/setup_smoketest_mess.script +../Scripts/setup_Smoketest_Mess.script /epoc32/release/winscw/udeb/z/smoketest/setup_smoketest_mess.script +../Scripts/setup_Smoketest_Mess.script /epoc32/release/winscw/urel/z/smoketest/setup_smoketest_mess.script + +../Scripts/Smoketest_Mess.script /epoc32/release/wins/udeb/z/smoketest/smoketest_mess.script +../Scripts/Smoketest_Mess.script /epoc32/release/wins/urel/z/smoketest/smoketest_mess.script +../Scripts/Smoketest_Mess.script /epoc32/release/winscw/udeb/z/smoketest/smoketest_mess.script +../Scripts/Smoketest_Mess.script /epoc32/release/winscw/urel/z/smoketest/smoketest_mess.script + +../TestData/Sms/Message1.txt /epoc32/release/wins/udeb/z/smoketest/sms/message1.txt +../TestData/Sms/Message1.txt /epoc32/release/wins/urel/z/smoketest/sms/message1.txt +../TestData/Sms/Message1.txt /epoc32/release/winscw/udeb/z/smoketest/sms/message1.txt +../TestData/Sms/Message1.txt /epoc32/release/winscw/urel/z/smoketest/sms/message1.txt + +../TestData/Smoketest_Mess.ini /epoc32/release/wins/udeb/z/smoketest/smoketest_mess.ini +../TestData/Smoketest_Mess.ini /epoc32/release/wins/urel/z/smoketest/smoketest_mess.ini +../TestData/Smoketest_Mess.ini /epoc32/release/winscw/udeb/z/smoketest/smoketest_mess.ini +../TestData/Smoketest_Mess.ini /epoc32/release/winscw/urel/z/smoketest/smoketest_mess.ini + + +PRJ_TESTMMPFILES +Smoketest_Mess.mmp diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMess.h Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// This contains CTestMess which contains common constants +// +// + +#if (!defined __TEST_MESS_H__) +#define __TEST_MESS_H__ + +/*@{*/ +// Literals defined for SMS account details +_LIT(KSmsAccountName, "Short Message"); +/*@}*/ + +#endif /* __TEST_MESS_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,126 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessBase which is the base class for all +// messaging test steps +// +// + + +#if (!defined __TEST_MESS_BASE_H__) +#define __TEST_MESS_BASE_H__ + +#include "Configuration.cfg" + +#include +#include +#include +#include +#include +#include +#include + +#include "TestMessProcessor.h" +#include "TestMessTimer.h" + +#include +#include +#include +#if (defined CDMA_API_ENABLED) +#include +#include +#endif +#include + +#include +//To check whether the reply quoted is set +_LIT(KReplyQuoted, "SmsReplyQuoted"); + +const TUid KUidMsvSMSHeaderStream = {0x10001834}; +const TUid KUidMsgFileInternetAccessPreferences = {0x1000924B}; +const TUid KUidMsvDefaultServices = {0x100017FD}; + +const TInt KOneSecond = 1000000; + +class CParaFormatLayer; +class CCharFormatLayer; +class CRichText; + +class CTestMessBase : public CTestStepSmokeTest, private MMsvSessionObserver + { +public: + CTestMessBase(TBool aSetDirectory); + virtual ~CTestMessBase(); + + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepPostambleL(); + + void SetEntryL(TMsvId aId); + CMsvEntry& EntryL(); + TBool HasEntry() const { return iEntry!=NULL; } + const TMsvSelectionOrdering& SelectionOrdering() const { return iOrder; } + CMsvSession& Session() const { return *iSession; } + void PrintEntryL(CMsvEntry& aEntry); + CEmsPreDefSoundIE* NewPreDefSoundL(const TDesC& aPreDefType); + + +protected: + // MMsvSessionObserver + void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*); + + // Utilities + static HBufC8* CopyToBuf8LC(const TDesC& aPtrC); + static HBufC* CopyToBufLC(const TDesC8& aPtr8); + void PrintTreeL(TMsvId aRoot); + void IssueTimerRequest(); + + + void PrepareSmsHeaderFromIniFileL(CSmsHeader& aSmsHeader); + + //reads the schedule time from ini file + TTimeIntervalMinutes ReadScheduleTime(); + +private: + // PrintEntry helper functions + void PrintStoreL(CMsvEntry& aEntry); + void PrintStoreSmtpL(CMsvEntry& aEntry); + void PrintStorePop3L(CMsvEntry& aEntry); + void PrintStoreImap4L(CMsvEntry& aEntry); + void PrintStoreSmsL(CMsvEntry& aEntry); + + // PrepareSmsHeaderFromIniFileL helper functions + void SetAlignmentFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aAlignment); + void SetFontSizeFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aFontSize); + + CEmsPreDefAnimationIE* NewPreDefAnimationL(const TDesC& aPreDefType); + CFbsBitmap* NewBitmapL(const TParse& aFileName, const TDesC& aObjectSize); + +protected: + CMsvSession* iSession; + CTestMessProcessor* iMessageProcessor; + CParaFormatLayer* iParaFormatLayer; + CCharFormatLayer* iCharFormatLayer; + CRichText* iBodyText; + TBool iBodyAvailable; + + +private: + TBool iCheckForSim; + TBool iSetDirectory; + CTestMessTimer* iMessageTimer; + CActiveScheduler* iSchedular; + CMsvEntry* iEntry; + TMsvSelectionOrdering iOrder; + }; + +#endif /* __TEST_MESS_BASE_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessCleanMessageFolder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessCleanMessageFolder.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCleanMessageFolder which cleans out all the +// message folders +// +// + +#if (!defined __TEST_MESS_CLEAN_MESSAGE_FOLDER_H__) +#define __TEST_MESS_CLEAN_MESSAGE_FOLDER_H__ + +#include "TestMessBase.h" + +class CTestMessCleanMessageFolder : public CTestMessBase +{ +public: + CTestMessCleanMessageFolder(); + + virtual TVerdict doTestStepL(); + +private: + void CleanFolders(const TMsvId aEntryId); + +private: + TInt iNumberOfMessagesToDelete; +}; + +#endif /* __TEST_MESS_CLEAN_MESSAGE_FOLDER_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessCreateCdmaSmsUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessCreateCdmaSmsUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 creates a Cdma sms header and service settings. It sets the fields by reading +// from the ini file +// +// + + +#if (!defined __TEST_MESS_CREATE_CDMA_SMS_UTIL_H__) +#define __TEST_MESS_CREATE_CDMA_SMS_UTIL_H__ + +#include "TestMessCreateSmsUtilBase.h" + +/** + This class creates a Cdma sms header and service settings.It sets the fields by reading + from the ini file +*/ +class CTestMessCreateCdmaSmsUtil : public CTestMessCreateSmsUtilBase +{ +public: + //Constructor + CTestMessCreateCdmaSmsUtil(CTestMessBase &aTestStep); + + //Creates a new header + CSmsHeader* NewHeaderL(CRichText &aBodyText); + + //Sets the fields of the header + void PrepareHeaderL(CSmsHeader &aSmsHeader); + + //Sets the account settings. + void SetSmsAccountSettings(CSmsSettings &aSmsSettings); + +private: + //Gets the message type of the SMS + TSmsMessageType GetMessageTypeId(TPtrC aMessageType); + + //Gets the tele service ID + tia637::TTeleserviceId GetTeleServiceId(TPtrC aTeleService); + + //Gets the message conversion ID + TSmsPIDConversion GetMessageConversionId(TPtrC aMessageConversion); + +}; + +#endif /* __TEST_MESS_CREATE_CDMA_SMS_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessCreateGsmSmsUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessCreateGsmSmsUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 creates the Gsm sms header and service settings. It fills up the +// fields using data read from the ini file +// +// + + +#if (!defined __TEST_MESS_CREATE_GSM_SMS_UTIL_H__) +#define __TEST_MESS_CREATE_GSM_SMS_UTIL_H__ + +#include "TestMessCreateSmsUtilBase.h" + +/** + This class creates the Gsm sms header and the GSM SMS service settings. + The data is read from the ini file. +*/ +class CTestMessCreateGsmSmsUtil : public CTestMessCreateSmsUtilBase + { +public: + //Constructor + CTestMessCreateGsmSmsUtil(CTestMessBase &aTestStep); + + /** + Prepare sms account details + */ + virtual void PrepareAccountL(CMsvSession& aSession); + + /** + Creates the new header object + */ + virtual CSmsHeader* NewHeaderL(CRichText &aBodyText); + + /** + Fills up the fields of the sms header object + */ + virtual void PrepareHeaderL(CSmsHeader &aSmsHeader); + + /** + Fills up the fields of the sms account settings + */ + virtual void SetSmsAccountSettings(CSmsSettings &aSmsSettings); + }; + +#endif /* __TEST_MESS_CREATE_GSM_SMS_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessCreateSMS.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessCreateSMS.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,64 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCreateSMS. This class creates the sms message +// for GSM or CDMA. For CDMA mtm, it uses utility classes to create +// the respective GSM or CDMA sms message +// +// + +#if (!defined __TEST_MESS_CREATE_SMS_H__) +#define __TEST_MESS_CREATE_SMS_H__ + +//Epoc include +#include +#include +#include +#include + +#include "TestMessBase.h" +#include "TestMessCreateSmsUtilBase.h" + +/** + This class creates the sms message for GSM or CDMA. For CDMA mtm, it + uses utility classes to create the respective GSM or CDMA sms message +*/ +class CTestMessCreateSMS : public CTestMessBase +, private MTestActiveCallback + { +public: + CTestMessCreateSMS(); + + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + +protected: + virtual void AddMtmCapabilitiesL(RSendAs& aSendAs); + virtual void PrepareSendAsL(RSendAsMessage& aSendAs); + virtual void PrepareHeaderL(CTestMessCreateSmsUtilBase& aCreateUtil, CSmsHeader& aSmsHeader); + void ConCatMessageTextL(CSmsHeader& aHeader); + void CreateSmsL(const TMsvId aMsvId, TTimeIntervalMinutes aScheduledTime); + +private: + virtual void RunL() { CActiveScheduler::Stop(); } + /** + * Method from which CTestActive informs the user DoCancel call + */ + virtual void DoCancel() { } + +private: + TBool iSimInDatabase; + RMobilePhone::TMobileAddress iSimPhoneNumber; + }; + +#endif /* __TEST_MESS_CREATE_SMS_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessCreateSMSaccount.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessCreateSMSaccount.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,36 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessCreateSmsAccount.cpp +// This contains CTestMessCreateSmsAccount which creates an SMS +// account folder for GSM or CDMA +// +// + +#if (!defined __TEST_MESS_CREATE_SMS_ACCOUNT_H__) +#define __TEST_MESS_CREATE_SMS_ACCOUNT_H__ + +#include "TestMessBase.h" + +/** + This class creates an SMS account folder for GSM or CDMA +*/ +class CTestMessCreateSmsAccount : public CTestMessBase + { +public: + CTestMessCreateSmsAccount(); + + virtual TVerdict doTestStepL(); + }; + +#endif /* __TEST_MESS_CREATE_SMS_ACCOUNT_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessCreateSmsUtilBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessCreateSmsUtilBase.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,81 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 is the base class for create CDMA or GSM SMS utility class +// +// + +#if (!defined __TEST_MESS_CREATE_SMS_UTIL_BASE_H__) +#define __TEST_MESS_CREATE_SMS_UTIL_BASE_H__ + +#include "TestMessBase.h" + +// EPOC includes +#include +#include + +#include + +/*@{*/ +_LIT(KBearer, "bearer"); +_LIT(KEncoding, "encoding"); +_LIT(KDef, "default"); +_LIT(KDefBearer, "smsbearer"); +_LIT(KDefEncoding, "smsencoding"); +_LIT(KDefDeliveryReport, "smsDeliveryReport"); +_LIT(KDeliveryReport, "DeliveryReport"); +_LIT(KRejectDuplicate, "SmsRejectDuplicate"); +_LIT(KReplyPath, "SmsReplyPath"); +_LIT(KConCatenate, "SmsConCatenate"); + +_LIT(KBearerWap, "wap"); +_LIT(KBearerWapSecure, "wapsecure"); +/*@}*/ + +/** + This class is the base class for create GSM or CDMA SMS utility classes +*/ +class CTestMessCreateSmsUtilBase : public CBase + { +public: + //Constructor + CTestMessCreateSmsUtilBase(CTestMessBase &aTestStep); + + /** + Prepare sms account details + */ + virtual void PrepareAccountL(CMsvSession& aSession) = 0; + + /** + Creates the new header object + */ + virtual CSmsHeader* NewHeaderL(CRichText &aBodyText) = 0; + + /** + Fills up the fields of the sms header object + */ + virtual void PrepareHeaderL(CSmsHeader &aSmsHeader) =0; + + /** + Fills up the fields of the sms account settings + */ + virtual void SetSmsAccountSettings(CSmsSettings &aSmsSettings) =0; + +protected: + /** + Reference to the test step which creates the utility class + */ + CTestMessBase& iTestStep; + }; + +#endif /* __TEST_MESS_CREATE_SMS_UTIL_BASE_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessEditEntry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessEditEntry.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,64 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntry which edits the entry characterstics +// +// + + +#if (!defined __TEST_MESS_EDIT_ENTRY_H__) +#define __TEST_MESS_EDIT_ENTRY_H__ + +#include "TestMessProcessExistingMsg.h" + +/** + This class edits the entry characteristics +*/ +class CTestMessEditEntry : public CTestMessProcessExistingMsg +{ +public: + CTestMessEditEntry() { SetTestStepName(_L("EditEntry")); } + + virtual void ProcessMessageL(CBaseMtm& aBaseMtm, TMsvId aMsgId); + + //Move the message to different folder + void MoveMessageL(TMsvId aMessageId,TMsvId aFolderId); + + /** + This class is used for asynchronous operation for move + message operation + */ + class CMoveOperation: public CActive + { + public: + //Pure virtual implementation of CActive + void RunL(); + + //Pure virtual implementation of CActive + void DoCancel(); + + //Set the operation as active + void SetOperation(); + + //Two phase construction + static CMoveOperation* NewL(); + private: + //Second phase construction + void ConstructL(); + + //Constructor + CMoveOperation(); + }; +}; + +#endif /* __TEST_MESS_EDIT_ENTRY_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessEditEntryUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessEditEntryUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntryUtil. A utility to edit an entry +// +// + +#if (!defined __TEST_MESS_EDIT_ENTRY_UTIL_H__) +#define __TEST_MESS_EDIT_ENTRY_UTIL_H__ + +#include "TestMessStoreProcessUtil.h" + +/** + This class is a utility to edit an entry +*/ +class CTestMessEditEntryUtil : public CTestMessStoreProcessUtil +{ +public: + CTestMessEditEntryUtil(CTestMessBase& aTestStep, TBool aSimChecked, TBool aSimInDatabase, RMobilePhone::TMobileAddress aSimPhoneNumber); + +protected: + // Process the CImHeader information + virtual void ProcessImHeaderL(CImHeader& aHeader); + + // Process the CImMimeHeader information + virtual void ProcessImMimeHeaderL(CImMimeHeader& aHeader); + + // Process the CImIAPPreferences information + virtual void ProcessInternetAccessPreferencesL(CImIAPPreferences& aPreferences); + + // Process the CSmsHeader information + virtual void ProcessSmsHeaderStreamL(CSmsHeader& aHeader); + + + // Process the CRichText information + virtual void ProcessRichTextBodyL(CRichText& aBodyText); + +private: + TBool iSimChecked; + TBool iSimInDatabase; + RMobilePhone::TMobileAddress iSimPhoneNumber; +}; + +#endif /* __TEST_MESS_EDIT_ENTRY_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessPrintEntryUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessPrintEntryUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +/** +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CTestMessEditEntryUtil. A utility to edit an entry +* +* +*/ + + + +/** + @file TestMessPrintEntryUtil.h +*/ + +#if (!defined __TEST_MESS_PRINT_ENTRY_UTIL_H__) +#define __TEST_MESS_PRINT_ENTRY_UTIL_H__ + +#include "TestMessStoreProcessUtil.h" + +class CTestMessPrintEntryUtil : public CTestMessStoreProcessUtil +{ +public: + CTestMessPrintEntryUtil(CTestMessBase& aTestStep); + +protected: + // Process the CImHeader information + virtual void ProcessImHeaderL(CImHeader& aHeader); + + // Process the CImMimeHeader information + virtual void ProcessImMimeHeaderL(CImMimeHeader& aHeader); + + // Process the CImIAPPreferences information + virtual void ProcessInternetAccessPreferencesL(CImIAPPreferences& aPreferences); + + // Process the CSmsHeader information + virtual void ProcessSmsHeaderStreamL(CSmsHeader& aHeader); + + + // Process the CRichText information + virtual void ProcessRichTextBodyL(CRichText& aBodyText); +}; + +#endif /* __TEST_MESS_PRINT_ENTRY_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessProcessExistingMsg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessProcessExistingMsg.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,43 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessProcessExistingMsg.cpp +// This contains CTestMessProcessExistingMsg +// Base class for processing an existing message +// +// + +#if (!defined __TEST_MESS_PROCESS_EXISTING_MSG__) +#define __TEST_MESS_PROCESS_EXISTING_MSG__ + +#include "TestMessBase.h" + +#include + +class CTestMessProcessExistingMsg : public CTestMessBase +{ +public: + CTestMessProcessExistingMsg(); + + virtual TVerdict doTestStepL(); + +protected: + virtual void ProcessMessageL(CBaseMtm& aBaseMtm, TMsvId aMsgId) = 0; + virtual void PostProcessMessageL(); + TUid MtmID() const { return iMtmID; } + +private: + TUid iMtmID; +}; + +#endif /* __TEST_MESS_PROCESS_EXISTING_MSG__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessProcessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessProcessor.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,86 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessProcessor.cpp +// This contains CTestMessProcessor which an active object utility +// used for send/recieving or any time consuming +// +// + +#if (!defined __TEST_MESS_PROCESSOR_H__) +#define __TEST_MESS_PROCESSOR_H__ + +//Epoc Include +#include +#include +#include + +class CTestStep; + +class MTestMessProcessorClient + { +public: + virtual TBool MoreOperations() const = 0; + virtual CMsvOperation* CreateOperationL(TRequestStatus& aStatus) = 0; + virtual TInt DisplayProgressL(TBool aFinalProgress, CMsvOperation* aMsvOperation) = 0; + }; + +/** + This class is an active object utility used for send/recieving + or any time consuming +*/ +class CTestMessProcessor : public CActive + { +public: + virtual ~CTestMessProcessor(); + static CTestMessProcessor* NewL(CTestStep& aTestStep, CMsvSession& aSession); + + void RunL(); + + void DisplayProgress(); + void SendEmailMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient); + + //Sends the SMS message + void SendSmsMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient, TBool aCancelSms); + void SendMmsMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient); + void MtmRequestL(TMsvId aAccountId, MTestMessProcessorClient* aClient); + +protected: + CTestMessProcessor(CTestStep& aTestStep, CMsvSession& aSession /*, MTestInstrumentation& aInstrumentation */); + void ConstructL(); + void DoCancel(); + +private: + enum EState + { + EStatePrepareToSendMsg, + EStateRequest, + }; + + EState iState; + CTestStep& iTestStep; + CMsvSession& iSession; + + // Send message parameters saved for RunL + CMsvEntry* iEntry; + TMsvId iMsgId; + MTestMessProcessorClient* iClient; + TMsvEntry iMsgEntry; + CMsvOperation* iMsvOperation; + /** + Boolean value for the Cancel sms flag + */ + TBool iCancelSms; +}; + +#endif /* __TEST_MESS_PROCESSOR_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessServer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessServer +// +// + +#if (!defined __TEST_MESS_SERVER_H_) +#define __TEST_MESS_SERVER_H_ + +#include "TestMessWatcher.h" +#include "TestMessSharedData.h" + +#include + +class CMsvSession; + +class CTestMessServer : public CTestServer +{ +public: + static CTestMessServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + ~CTestMessServer(); + CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; +protected: + CTestMessServer(); + void ConstructL(const TDesC& aName); + +private: + +private: + CTestMessSharedData* iSharedData; +}; + +#endif /* __TEST_MESS_SERVER_H_ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessSession.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,35 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessSession +// +// + +#if (!defined __TEST_MESS_SESSION_H__) +#define __TEST_MESS_SESSION_H__ + +#include +#include "TestMessSharedData.h" + +class CTestMessSession : public CTestSession +{ +public: + CTestMessSession(CTestMessSharedData* aSharedData); + virtual void ServiceL(const RMessage2& aMessage); + + +private: + CTestMessSharedData* iSharedData; +}; + +#endif /* __TEST_MESS_SESSION_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessSetDefaultSc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessSetDefaultSc.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessSetDefaultSc.cpp +// This contains TestMessSetDefaultSc which sets an SMS +// SC as default SC. +// +// + +#if (!defined __TEST_MESS_SET_DEFAULT_SC_H__) +#define __TEST_MESS_SET_DEFAULT_SC_H__ + +#include "TestMessBase.h" + +class CTestMessSetDefaultSc : public CTestMessBase +{ +public: + CTestMessSetDefaultSc(); + + virtual TVerdict doTestStepL(); +}; + +#endif /* __TEST_MESS_SET_DEFAULT_SC_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessSharedData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessSharedData.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,102 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessSharedData +// +// + +#if (!defined __TEST_MESS_SHARED_DATA_H__) +#define __TEST_MESS_SHARED_DATA_H__ + +#include +#include +#include +#include + +class CTestMessSharedData : public CBase, private MMsvSessionObserver +{ +public: + static CTestMessSharedData* NewL(); + ~CTestMessSharedData(); + + void IMAP4ConnectAndSyncCompleteAfterDisconnectL(TUid aMtmId, TMsvId aMsvId, CTestStep& aStep); + TInt DeleteEntryL(CTestStep& aStep); + + void DoProcessL(); + +protected: + CTestMessSharedData(); + +private: + void ConstructL(); + + // MMsvSessionObserver implementation + virtual void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {} + +private: + class CMsgEntry : public CActive + { + public: + ~CMsgEntry(); + + virtual void DoCancel(); + virtual void RunL(); + virtual void DoProcessL(CClientMtmRegistry& aMtmRegistry) = 0; + virtual void DoCancelProcessL() = 0; + + protected: + CMsgEntry(CMsgEntry* aList); + + void ConstructL(CTestStep& aStep); + + public: + TName iName; + CMsgEntry* iNext; + TBool iReadyToBeDeleted; + }; + class CMsgIMAP4ConnectAndSyncComplete : public CMsgEntry, public MMsvImapConnectionObserver + { + public: + static CMsgIMAP4ConnectAndSyncComplete* NewL(TUid aMtmId, TMsvId aMsvId, CTestStep& aStep, CMsgEntry* aList); + ~CMsgIMAP4ConnectAndSyncComplete(); + + virtual void RunL(); + virtual void DoProcessL(CClientMtmRegistry& aMtmRegistry); + virtual void DoCancelProcessL(); + + protected: + CMsgIMAP4ConnectAndSyncComplete(TUid aMtmId, TMsvId aMsvId, CMsgEntry* aList); + + private: + // MMsvImapConnectionObserver implementation + void HandleImapConnectionEvent(TImapConnectionEvent aConnectionEvent); + + private: + TUid iMtmId; + TMsvId iMsvId; + CBaseMtm* iBaseMtm; + CMsvOperation* iOperation; + + }; + +public: + CMsvSession* iSession; + CClientMtmRegistry* iMtmRegistry; + CMsgEntry* iList; + +private: + CMsgEntry* iAnyPostStepToDo; + TBool iDeleteTestStep; +}; + +#endif /* __TEST_MESS_SHARED_DATA_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessStoreProcessUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessStoreProcessUtil.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,81 @@ +/** +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 CTestMessStoreProcessUtil. Base class process what is in the message store +* +* +*/ + + + +/** + @file TestMessStoreProcessUtil.h +*/ + +#if (!defined __TEST_MESS_STORE_PROCESS_UTIL_H__) +#define __TEST_MESS_STORE_PROCESS_UTIL_H__ + +#include "TestMessBase.h" + +class CTestMessStoreProcessUtil : public CBase +{ +public: + CTestMessStoreProcessUtil(CTestMessBase& aTestStep, TBool aReadOnly); + + // + TInt ProcessEntryL(TMsvId aMsvId); + +protected: + // Process the CImHeader information + virtual void ProcessImHeaderL(CImHeader& aHeader) = 0; + + // Process the CImMimeHeader information + virtual void ProcessImMimeHeaderL(CImMimeHeader& aHeader) = 0; + + // Process the CImIAPPreferences information + virtual void ProcessInternetAccessPreferencesL(CImIAPPreferences& aPreferences) = 0; + + // Process the CSmsHeader information + virtual void ProcessSmsHeaderStreamL(CSmsHeader& aHeader) = 0; + + + // Process the CRichText information + virtual void ProcessRichTextBodyL(CRichText& aBodyText) = 0; + + // Convert Text to character set information + TBool ValidCharacterSetInfo(const TPtrC& aCharacterSetType, TUint &aCharSetVal); + +private: + // Process the CImHeader information + void ProcessImHeaderL(CMsvStore& aStore); + + // Process the CImMimeHeader information + void ProcessImMimeHeaderL(CMsvStore& aStore); + + + // Process the CSmsHeader information + void ProcessSmsHeaderStreamL(CMsvStore& aStore); + + + // Process the CRichText information + void ProcessRichTextBodyL(CMsvStore& aStore); + +protected: + CTestMessBase& iTestStep; + +private: + TBool iReadOnly; +}; + +#endif /* __TEST_MESS_STORE_PROCESS_UTIL_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessTimer.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessTimer +// +// + +#if (!defined __TEST_MESS_TIMER_H_) +#define __TEST_MESS_TIMER_H_ + +#include + +class CTestMessProcessor; + +class CTestMessTimer : public CTimer +{ +public: + virtual ~CTestMessTimer(); + static CTestMessTimer* NewL(TTimeIntervalMicroSeconds32 aInterval, CTestMessProcessor& aProcessor); + + void RunL(); + + void IssueRequest(); + +protected: + CTestMessTimer(TTimeIntervalMicroSeconds32 aInterval, CTestMessProcessor& aProcessor); + void ConstructL(); + +private: + TTimeIntervalMicroSeconds32 iInterval; + CTestMessProcessor& iProcessor; +}; + +#endif /* __TEST_MESS_TIMER_H_ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Inc/TestMessWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Inc/TestMessWatcher.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessWatcher which starts the message watchers +// +// + +#if (!defined __TEST_MESS_WATCHER_H__) +#define __TEST_MESS_WATCHER_H__ + +#include +#include + +const TInt KTestUtilsWatcherStarterMin = 5000000; + +class CTestMessWatcher : public CActive +{ +public: + static CTestMessWatcher* NewL(TInt aPriority = EPriorityStandard); + ~CTestMessWatcher(); + +private: + CTestMessWatcher(TInt aPriority); + void RunL(); + void DoCancel(); + void ConstructL(); + +private: + RTimer iTimer; + RProcess iWatcher; + TBool iConstructed; + TTimeIntervalMicroSeconds32 iTimeLeft; +}; + +#endif /* __TEST_MESS_WATCHER_H__ */ diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Scripts/Smoketest_CreateSmsAccount.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Scripts/Smoketest_CreateSmsAccount.script Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,20 @@ +// +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 Create SMS account with vodaphone service centre +// +LOAD_SUITE Smoketest_Mess_Server +RUN_TEST_STEP 10000 Smoketest_Mess_Server CreateSmsAccount c:\smoketest\smoketest_mess.ini 27029_SmsVodafoneAccount diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Scripts/Smoketest_Mess.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Scripts/Smoketest_Mess.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +PRINT Run Mesaging smoketest +// +RUN_WS_PROGRAM 10 z:\sys\bin\mcentre.exe +// +DELAY 1500 +// +LOAD_SUITE Smoketest_Mess_Server +// Wait for watchers to start +DELAY 1000 +// +RUN_TEST_STEP 10000 Smoketest_Mess_Server CleanMessageFolder c:\smoketest\Smoketest_mess.ini 27595_SmsCount01 +DELAY 500 +RUN_SCRIPT c:\smoketest\Smoketest_CreateSmsAccount.script +RUN_TEST_STEP 10000 Smoketest_Mess_Server SetSmsSc c:\smoketest\Smoketest_mess.ini 27029_SmsVodafoneAccount +DELAY 500 +RUN_TEST_STEP 10000 Smoketest_Mess_Server CreateSms c:\smoketest\Smoketest_mess.ini 27584_SmsMessage01 diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Scripts/setup_Smoketest_Mess.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Scripts/setup_Smoketest_Mess.script Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// + +RUN_UTILS MkDir c:\smoketest\ +RUN_UTILS MkDir c:\smoketest\sms\ + +RUN_UTILS CopyFile z:\smoketest\smoketest_mess.ini c:\smoketest\smoketest_mess.ini +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_mess.ini +RUN_UTILS CopyFile z:\smoketest\sms\message1.txt c:\smoketest\sms\message1.txt +RUN_UTILS MakeReadWrite c:\smoketest\sms\message1.txt +RUN_UTILS CopyFile z:\smoketest\smoketest_createsmsaccount.script c:\smoketest\smoketest_createsmsaccount.script +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_createsmsaccount.script + +// RUN_SCRIPT c:\Smoketest\Smoketest_Mess.script diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,1519 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestCase which is the base class for all the TestCase DLLs +// +// + +#include "Configuration.cfg" + +#include "TestMessBase.h" +#include "TestMessProcessor.h" +#include "TestMessTimer.h" +#include "TestMessPrintEntryUtil.h" + +// EPOC includes +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __MESSAGING_API_V2__ +#include +#include +#include +#include +#endif +/** + * @name Constant Literals used. + */ +/*@{*/ +_LIT(KDepth, "depth"); +_LIT(KFolder, "folder%d"); + +// Default value for depth of the count +#define KDefaultDepthCount 1 + +// Default value for depth of the count +#define KDefaultDepthCount 1 + +_LIT(KDefault, "default"); + +_LIT(KScheduled, "scheduled"); +_LIT(KProgress, "progress"); + +//_LIT(KIap, "iap"); +//_LIT(KIapName, "iapname"); + +_LIT(KElements, "elements"); +_LIT(KStartPosition, "StartPosition%d"); +_LIT(KFile, "File%d"); +_LIT(KType, "Type%d"); +_LIT(KTypeFormat, "Format"); +_LIT(KTypeSound, "Sound"); +_LIT(KTypePreDefSound, "PreDefSound"); +_LIT(KTypeAnimation, "Animation"); +_LIT(KTypePreDefAnimation, "PreDefAnimation"); +_LIT(KTypePicture, "Picture"); +_LIT(KTypeUserPrompt, "UserPrompt"); +_LIT(KFormatLength, "FormatLength%d"); +_LIT(KBold, "Bold%d"); +_LIT(KItalic, "Italic%d"); +_LIT(KUnderline, "Underline%d"); +_LIT(KStrikethrough, "Strikethrough%d"); +_LIT(KAlignment, "Alignment%d"); +_LIT(KFontSize, "FontSize%d"); + +_LIT(KLeftAlign, "LeftAlign"); +_LIT(KRightAlign, "RightAlign"); +_LIT(KCenterAlign, "CenterAlign"); +_LIT(KLangDepend, "LangDepend"); + +_LIT(KNormal, "Normal"); +_LIT(KLarge, "Large"); +_LIT(KSmall, "Small"); +_LIT(KVariable, "Variable"); +_LIT(KReserved, "Reserved"); + +_LIT(KEmsPreDef, "emspredef%d"); + +_LIT(KEmsAnimTypeFlirty, "a0"); +_LIT(KEmsAnimTypeGlad, "a1"); +_LIT(KEmsAnimTypeSceptic, "a2"); +_LIT(KEmsAnimTypeSad, "a3"); +_LIT(KEmsAnimTypeWow, "a4"); +_LIT(KEmsAnimTypeCrying, "a5"); +_LIT(KEmsAnimTypeWinking, "a6"); +_LIT(KEmsAnimTypeLaughing, "a7"); +_LIT(KEmsAnimTypeIndifferent, "a8"); +_LIT(KEmsAnimTypeKissing, "a9"); +_LIT(KEmsAnimTypeConfused, "a10"); +_LIT(KEmsAnimTypeTongueOut, "a11"); +_LIT(KEmsAnimTypeAngry, "a12"); +_LIT(KEmsAnimTypeGlasses, "a13"); +_LIT(KEmsAnimTypeDevil, "a14"); + +_LIT(KEmsSoundTypeChimesHigh, "s0"); +_LIT(KEmsSoundTypeChimesLow, "s1"); +_LIT(KEmsSoundTypeDing, "s2"); +_LIT(KEmsSoundTypeTaDa, "s3"); +_LIT(KEmsSoundTypeNotify, "s4"); +_LIT(KEmsSoundTypeDrum, "s5"); +_LIT(KEmsSoundTypeClaps, "s6"); +_LIT(KEmsSoundTypeFanFar, "s7"); +_LIT(KEmsSoundTypeChordHigh, "s8"); +_LIT(KEmsSoundTypeChordLow, "s9"); + +/* +_LIT(KBioIAP, "IAP"); +_LIT(KBioEmailNotification, "EmailNotification"); +_LIT(KBioBusinessCard, "BusinessCard"); +_LIT(KBioWAPAccessPoint, "WAPAccessPoint"); +_LIT(KBioVCalendar, "VCalendar"); +_LIT(KBioVCard, "VCard"); +_LIT(KBioRingingTones, "RingingTones"); +_LIT(KBioOperatorLogo, "OperatorLogo"); +_LIT(KBioWPRV, "WPRV"); +_LIT(KBioCLILogo, "CLILogo"); +*/ +_LIT(KObjectSize, "ObjectSize%d"); +_LIT(KBody, "body"); +/*@}*/ + +const TInt KSmallObject = 0; +const TInt KLargeObject = 1; +const TInt KVariableObject = 2; + +const TInt KDefaultStartPos = 1; + +/** + * Constructor. + * @return - None + * +*/ +CTestMessBase::CTestMessBase(TBool aSetDirectory) +: CTestStepSmokeTest() +, iSession(NULL) +, iMessageProcessor(NULL) +, iParaFormatLayer(NULL) +, iCharFormatLayer(NULL) +, iBodyText(NULL) +, iBodyAvailable(EFalse) +, iSetDirectory(aSetDirectory) +, iMessageTimer(NULL) +, iSchedular(NULL) +, iEntry(NULL) +, iOrder(KMsvGroupByType|KMsvGroupByStandardFolders, EMsvSortById, ETrue) + { + } + +CTestMessBase::~CTestMessBase() + { + delete iEntry; + iEntry=NULL; + delete iMessageTimer; + iMessageTimer=NULL; + delete iMessageProcessor; + iMessageProcessor=NULL; + delete iSession; + iSession=NULL; + delete iSchedular; + iSchedular=NULL; + delete iBodyText; + iBodyText=NULL; + delete iCharFormatLayer; + iCharFormatLayer=NULL; + delete iParaFormatLayer; + iParaFormatLayer=NULL; + } + +enum TVerdict CTestMessBase::doTestStepPreambleL() + { + TVerdict ret=CTestStepSmokeTest::doTestStepPreambleL(); + + // Printing to the console and log file + const TDesC& stepName=TestStepName(); + INFO_PRINTF2(_L("%S"), &stepName); + + iSchedular=new (ELeave) CActiveScheduler(); + CActiveScheduler::Install(iSchedular); + iSession=CMsvSession::OpenSyncL(*this); + + // Get progress + TInt progress=0; + TBool hasProgress=GetIntFromConfig(ConfigSection(), KProgress, progress); + if ( !hasProgress ) + { + hasProgress=GetIntFromConfig(KDefault, KProgress, progress); + } + + iMessageProcessor=CTestMessProcessor::NewL(*this, *iSession); + if ( hasProgress ) + { + iMessageTimer=CTestMessTimer::NewL(progress*KOneSecond, *iMessageProcessor); + } + + if ( iSetDirectory ) + { + TInt depth=KDefaultDepthCount; + TBool returnValue=GetIntFromConfig(ConfigSection(), KDepth, depth); + if ( !returnValue ) + { + depth=KDefaultDepthCount; + } + INFO_PRINTF2(_L("Depth = %d"), depth); + + // Searce for the entry + TRAPD(error,SetEntryL(KMsvRootIndexEntryId)); + if( error != KErrNone) + { + INFO_PRINTF2(_L("Set Entry failed, Error %D"),error); + SetTestStepError(error); + ret=EFail; + } + else + { + + TBuf tempStore; + TBool found=ETrue; + for (TInt entry=0; entryCount(); + + found=EFalse; + for (TInt i=count; i>0 && !found; ) + { + TMsvId childId=selection->At(--i); + + SetEntryL(childId); + INFO_PRINTF2(_L("Entry Detail : %S"), &(EntryL().Entry().iDetails)); + INFO_PRINTF2(_L("Entry Description: %S"), &(EntryL().Entry().iDescription)); + if ( subject.Compare(EntryL().Entry().iDetails) == 0 || + subject.Compare(EntryL().Entry().iDescription) == 0 ) + { + found=ETrue; + } + } + CleanupStack::PopAndDestroy(selection); + } + + if ( !found ) + { + ERR_PRINTF1(_L("Folder not found")); + ret=EFail; + } + } + } + if (TestStepResult() == EPass) + { + //Get body(file path) from ini file and read respective file. Store it into CRichText format. + iParaFormatLayer=CParaFormatLayer::NewL(); + iCharFormatLayer=CCharFormatLayer::NewL(); + iBodyText=CRichText::NewL(iParaFormatLayer, iCharFormatLayer); + iBodyAvailable=EFalse; + + TPtrC body; + if(GetStringFromConfig(ConfigSection(), KBody, body)) + { + INFO_PRINTF2(_L("Body = %S"), &body); + iBodyAvailable=ETrue; + } + else + { + INFO_PRINTF1(_L("No Body")); + } + + if ( iBodyAvailable ) + { + // open the file + RFile file; + + TInt anError = file.Open(iSession->FileSession(), body, EFileShareAny); + if(anError == KErrNone) + { + TBool reading=ETrue; + TInt pos=0; + TBuf8<1> charIn; + while (reading) + { + file.Read(charIn, 1); + if(charIn.Length()) + { + switch ( charIn[0] ) + { + case '\r': + iBodyText->InsertL(pos++, CEditableText::ELineBreak); + case '\n': + break; + default: + iBodyText->InsertL(pos++, TChar(charIn[0])); + } + } + else + { + reading = EFalse; // stop at the end of the file + } + } + iBodyAvailable=ETrue; + file.Close(); + } + else + { + INFO_PRINTF2(_L("Cannot open file = %S"), &body); + iBodyAvailable=EFalse; + } + }//End of read file. + } + + SetTestStepResult(ret); + return ret; + } + +enum TVerdict CTestMessBase::doTestStepPostambleL() + { + delete iEntry; + iEntry=NULL; + delete iMessageTimer; + iMessageTimer=NULL; + delete iMessageProcessor; + iMessageProcessor=NULL; + delete iSession; + iSession=NULL; + delete iSchedular; + iSchedular=NULL; + CActiveScheduler::Install(NULL); + return CTestStepSmokeTest::doTestStepPostambleL(); + } + +void CTestMessBase::SetEntryL(TMsvId aId) + { + delete iEntry; + iEntry=NULL; + iEntry=iSession->GetEntryL(aId); + } + +CMsvEntry& CTestMessBase::EntryL() + { + if ( iEntry == NULL ) + { + User::Leave(KErrGeneral); + } + + return *iEntry; + } + + +HBufC8* CTestMessBase::CopyToBuf8LC(const TDesC& aDesC) +// +// @return - HBufC8* +// Converts TDesC to HBufC8*. +// + { + HBufC8* itemBuff8 = HBufC8::NewLC(aDesC.Length()); + itemBuff8->Des().Copy(aDesC); + + return itemBuff8; + } + +HBufC* CTestMessBase::CopyToBufLC(const TDesC8& aDesC) +// +// @return - HBufC8* +// Converts TDesC to HBufC8*. +// + { + HBufC* itemBuff = HBufC::NewLC(aDesC.Length()); + itemBuff->Des().Copy(aDesC); + + return itemBuff; + } + + +#ifndef __MESSAGING_API_V2__ +void CTestMessBase::SetDefaultServiceL(TUid aMtm, TMsvId aService) const + { + // --- Now restore the default services from the root store --- + CMsvEntry* rootEntry=iSession->GetEntryL(KMsvRootIndexEntryIdValue); + CleanupStack::PushL(rootEntry); + CMsvStore* store = rootEntry->EditStoreL(); + CleanupStack::PushL(store); + CMsvDefaultServices* services = new(ELeave)CMsvDefaultServices; + CleanupStack::PushL(services); + services->RestoreL(*store); + + // --- And now re-set the default service for the MTM to the one given --- + TMsvDefaultService defaultService; + defaultService.iMtm=aMtm; + defaultService.iService=aService; + services->ChangeDefaultServiceL(defaultService); + services->StoreL(*store); + store->CommitL(); + CleanupStack::PopAndDestroy(3, rootEntry); + } + +TInt CTestMessBase::DefaultServiceL(TUid aMtm, TMsvId& aService) const + { + // --- Now restore the default services from the root store --- + CMsvEntry* rootEntry=iSession->GetEntryL(KMsvRootIndexEntryIdValue); + CleanupStack::PushL(rootEntry); + CMsvStore* store=rootEntry->ReadStoreL(); + CleanupStack::PushL(store); + CMsvDefaultServices* services=new(ELeave)CMsvDefaultServices; + CleanupStack::PushL(services); + services->RestoreL(*store); + + TInt ret=services->DefaultService(aMtm, aService); + + CleanupStack::PopAndDestroy(3, rootEntry); + + return ret; + } +#endif + +void CTestMessBase::PrintTreeL(TMsvId aRoot) + { + INFO_PRINTF1(_L("PrintTreeL In")); + CMsvEntry* entry=iSession->GetEntryL(aRoot); + CleanupStack::PushL(entry); + entry->SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=entry->ChildrenL(); + CleanupStack::PushL(selection); + + PrintEntryL(*entry); + for (TInt i=0; iCount(); ) + { + PrintTreeL(selection->At(i++)); + } + + CleanupStack::PopAndDestroy(2, entry); + INFO_PRINTF1(_L("PrintTreeL Out")); + } + +void CTestMessBase::PrintEntryL(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + + INFO_PRINTF2(_L("Entry Detail : %S"), &(entry.iDetails)); + INFO_PRINTF2(_L(" Description: %S"), &(entry.iDescription)); + INFO_PRINTF2(_L(" Id : %x"), entry.Id()); + INFO_PRINTF2(_L(" Parent Id : %x"), entry.Parent()); + INFO_PRINTF2(_L(" Service Id : %x"), entry.iServiceId); + if ( entry.iRelatedId != 0 ) + { + INFO_PRINTF2(_L(" Related Id : %x"), entry.iRelatedId); + } + INFO_PRINTF2(_L(" Type : %x"), entry.iType); + INFO_PRINTF2(_L(" Mtm : %x"), entry.iMtm); + + + if ( entry.iSize != 0 ) + { + INFO_PRINTF2(_L(" Size : %x"), entry.iSize); + } + if ( entry.iError != 0 ) + { + INFO_PRINTF2(_L(" Error : %d"), entry.iError); + } + if ( entry.iBioType != 0 ) + { + INFO_PRINTF2(_L(" BioType : %x"), entry.iBioType); + } + if ( entry.MtmData1() != 0 ) + { + INFO_PRINTF2(_L(" MtmData1 : %x"), entry.MtmData1()); + } + if ( entry.MtmData2() != 0 ) + { + INFO_PRINTF2(_L(" MtmData2 : %x"), entry.MtmData2()); + } + if ( entry.MtmData3() != 0 ) + { + INFO_PRINTF2(_L(" MtmData3 : %x"), entry.MtmData3()); + } + if ( entry.Attachment() != 0 ) + { + INFO_PRINTF2(_L(" Attachment : %x"), entry.Attachment()); + } + if ( entry.Complete() != 0 ) + { + INFO_PRINTF2(_L(" Complete : %x"), entry.Complete()); + } + if ( entry.Connected() != 0 ) + { + INFO_PRINTF2(_L(" Connected : %x"), entry.Connected()); + } + if ( entry.Deleted() != 0 ) + { + INFO_PRINTF2(_L(" Deleted : %x"), entry.Deleted()); + } + if ( entry.Failed() != 0 ) + { + INFO_PRINTF2(_L(" Failed : %x"), entry.Failed()); + } + if ( entry.InPreparation() != 0 ) + { + INFO_PRINTF2(_L(" InPrep : %x"), entry.InPreparation()); + } + if ( entry.MultipleRecipients() != 0 ) + { + INFO_PRINTF2(_L(" MultiRecip : %x"), entry.MultipleRecipients()); + } + if ( entry.OffPeak() != 0 ) + { + INFO_PRINTF2(_L(" OffPeak : %x"), entry.OffPeak()); + } + if ( entry.Operation() != 0 ) + { + INFO_PRINTF2(_L(" Operation : %x"), entry.Operation()); + } + if ( entry.Owner() != 0 ) + { + INFO_PRINTF2(_L(" Owner : %x"), entry.Owner()); + } + if ( entry.PcSyncCount() != 0 ) + { + INFO_PRINTF2(_L(" PcSyncCount: %x"), entry.PcSyncCount()); + } + if ( entry.Priority() != 0 ) + { + INFO_PRINTF2(_L(" Priority : %x"), entry.Priority()); + } + if ( entry.ReadOnly() != 0 ) + { + INFO_PRINTF2(_L(" ReadOnly : %x"), entry.ReadOnly()); + } + if ( entry.Scheduled() != 0 ) + { + INFO_PRINTF2(_L(" Scheduled : %x"), entry.Scheduled()); + } + if ( entry.SendingState() != 0 ) + { + INFO_PRINTF2(_L(" Send State : %x"), entry.SendingState()); + } + if ( entry.StandardFolder() != 0 ) + { + INFO_PRINTF2(_L(" StdFolder : %x"), entry.StandardFolder()); + } + if ( entry.Unread() != 0 ) + { + INFO_PRINTF2(_L(" Unread : %x"), entry.Unread()); + } + if ( entry.Visible() != 0 ) + { + INFO_PRINTF2(_L(" Visible : %x"), entry.Visible()); + } + +#if (!defined CDMA_API_ENABLED) + if ( aEntry.HasStoreL() ) + { + PrintStoreL(aEntry); + } +#endif + } + +void CTestMessBase::PrintStoreL(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CTestMessPrintEntryUtil* printUtil=new (ELeave) CTestMessPrintEntryUtil(*this); + CleanupStack::PushL(printUtil); + + printUtil->ProcessEntryL(entry.Id()); + CleanupStack::PopAndDestroy(printUtil); + + if ( entry.iMtm==KUidMsgTypeSMTP ) + { + PrintStoreSmtpL(aEntry); + } + else if ( entry.iMtm == KUidMsgTypePOP3 ) + { + PrintStorePop3L(aEntry); + } + else if ( entry.iMtm == KUidMsgTypeIMAP4 ) + { + PrintStoreImap4L(aEntry); + } + else if ( entry.iMtm == KUidMsgTypeSMS ) + { + PrintStoreSmsL(aEntry); + } + } + +void CTestMessBase::PrintStoreSmtpL(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CMsvStore* store=aEntry.ReadStoreL(); + CleanupStack::PushL(store); + + TPtrC ptrTemp; + if ( entry.iType == KUidMsvServiceEntry ) + { + CImSmtpSettings* settings = new(ELeave) CImSmtpSettings(); + CleanupStack::PushL(settings); +#ifdef __MESSAGING_API_V2__ + CEmailAccounts* accounts = CEmailAccounts::NewLC(); + TSmtpAccount smtpAccountId; + accounts->GetSmtpAccountL(aEntry.EntryId(), smtpAccountId); + TRAPD(err, accounts->LoadSmtpSettingsL(smtpAccountId, *settings)); + CleanupStack::PopAndDestroy(accounts); +#else + TRAPD(err, settings->RestoreL(*store)); +#endif + if ( err == KErrNone ) + { + ptrTemp.Set(settings->ServerAddress()); + INFO_PRINTF2(_L(" ServerAddress : %S"), &ptrTemp); +#ifndef __MESSAGING_API_V2__ + ptrTemp.Set(settings->UserAddress()); + INFO_PRINTF2(_L(" UserAddress : %S"), &ptrTemp); + INFO_PRINTF2(_L(" Version : %x"), (TUint)settings->Version()); +#endif + INFO_PRINTF2(_L(" Port : %x"), settings->Port()); + INFO_PRINTF2(_L(" SecureSockets : %x"), (TUint)settings->SecureSockets()); + ptrTemp.Set(settings->EmailAlias()); + INFO_PRINTF2(_L(" EmailAlias : %S"), &ptrTemp); + ptrTemp.Set(settings->EmailAddress()); + INFO_PRINTF2(_L(" EmailAddress : %S"), &ptrTemp); + ptrTemp.Set(settings->ReplyToAddress()); + INFO_PRINTF2(_L(" ReplyToAddress : %S"), &ptrTemp); + ptrTemp.Set(settings->ReceiptAddress()); + INFO_PRINTF2(_L(" ReceiptAddress : %S"), &ptrTemp); + if ( settings->RequestReceipts() != 0 ) + { + INFO_PRINTF2(_L(" RequestReceipts : %x"), (TUint)settings->RequestReceipts()); + } + if ( settings->SendCopyToSelf() != 0 ) + { + INFO_PRINTF2(_L(" SendCopyToSelf : %x"), (TUint)settings->SendCopyToSelf()); + } + INFO_PRINTF2(_L(" SendMessageOption : %x"), (TUint)settings->SendMessageOption()); + } + CleanupStack::PopAndDestroy(settings); + } + + CleanupStack::PopAndDestroy(store); + } + +void CTestMessBase::PrintStorePop3L(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CMsvStore* store=aEntry.ReadStoreL(); + CleanupStack::PushL(store); + + TPtrC ptrTemp; + if ( entry.iType == KUidMsvServiceEntry ) + { + CImPop3Settings* settings = new(ELeave) CImPop3Settings(); + CleanupStack::PushL(settings); + +#ifdef __MESSAGING_API_V2__ + CEmailAccounts* accounts = CEmailAccounts::NewLC(); + TPopAccount popAccountId; + accounts->GetPopAccountL(aEntry.EntryId(), popAccountId); + TRAPD(err, accounts->LoadPopSettingsL(popAccountId, *settings)); + CleanupStack::PopAndDestroy(accounts); +#else + TRAPD(err, settings->RestoreL(*store)); +#endif + if ( err == KErrNone ) + { + ptrTemp.Set(settings->ServerAddress()); + INFO_PRINTF2(_L(" ServerAddress : %S"), &ptrTemp); +#ifndef __MESSAGING_API_V2__ + ptrTemp.Set(settings->UserAddress()); + INFO_PRINTF2(_L(" UserAddress : %S"), &ptrTemp); + INFO_PRINTF2(_L(" Version : %x"), (TUint)settings->Version()); +#endif + INFO_PRINTF2(_L(" Port : %x"), settings->Port()); + INFO_PRINTF2(_L(" SecureSockets : %x"), (TUint)settings->SecureSockets()); + HBufC* loginName=CopyToBufLC(settings->LoginName()); + INFO_PRINTF2(_L(" LoginName : %S"), loginName); + CleanupStack::PopAndDestroy(loginName); + if ( settings->AutoSendOnConnect() != 0 ) + { + INFO_PRINTF2(_L(" AutoSendOnConnect : %x"), (TUint)settings->AutoSendOnConnect()); + } + if ( settings->Apop() != 0 ) + { + INFO_PRINTF2(_L(" Apop : %x"), (TUint)settings->Apop()); + } + if ( settings->DisconnectedUserMode() != 0 ) + { + INFO_PRINTF2(_L(" DisconnectedUserMode : %x"), (TUint)settings->DisconnectedUserMode()); + } + if ( settings->DeleteEmailsWhenDisconnecting() != 0 ) + { + INFO_PRINTF2(_L(" DeleteEmailsWhenDisconnecting: %x"), (TUint)settings->DeleteEmailsWhenDisconnecting()); + } + if ( settings->AcknowledgeReceipts() != 0 ) + { + INFO_PRINTF2(_L(" AcknowledgeReceipts : %x"), (TUint)settings->AcknowledgeReceipts()); + } + if ( settings->MaxEmailSize() != 0 ) + { + INFO_PRINTF2(_L(" MaxEmailSize : %x"), (TUint)settings->MaxEmailSize()); + } + if ( settings->GetMailOptions() != 0 ) + { + INFO_PRINTF2(_L(" GetMailOptions : %x"), (TUint)settings->GetMailOptions()); + } + if ( settings->InboxSynchronisationLimit() != 0 ) + { + INFO_PRINTF2(_L(" InboxSynchronisationLimit : %x"), (TUint)settings->InboxSynchronisationLimit()); + } + } + CleanupStack::PopAndDestroy(settings); + } + + CleanupStack::PopAndDestroy(store); + } + +void CTestMessBase::PrintStoreImap4L(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CMsvStore* store=aEntry.ReadStoreL(); + CleanupStack::PushL(store); + + TPtrC ptrTemp; + if ( entry.iType == KUidMsvServiceEntry ) + { + CImImap4Settings* settings = new(ELeave) CImImap4Settings(); + CleanupStack::PushL(settings); + +#ifdef __MESSAGING_API_V2__ + CEmailAccounts* accounts = CEmailAccounts::NewLC(); + TImapAccount imapAccountId; + accounts->GetImapAccountL(aEntry.EntryId(), imapAccountId); + TRAPD(err, accounts->LoadImapSettingsL(imapAccountId, *settings)); + CleanupStack::PopAndDestroy(accounts); +#else + TRAPD(err, settings->RestoreL(*store)); +#endif + if ( err == KErrNone ) + { + ptrTemp.Set(settings->ServerAddress()); + INFO_PRINTF2(_L(" ServerAddress : %S"), &ptrTemp); +#ifndef __MESSAGING_API_V2__ + ptrTemp.Set(settings->UserAddress()); + INFO_PRINTF2(_L(" UserAddress : %S"), &ptrTemp); + INFO_PRINTF2(_L(" Version : %x"), (TUint)settings->Version()); +#endif + INFO_PRINTF2(_L(" Port : %x"), settings->Port()); + INFO_PRINTF2(_L(" SecureSockets : %x"), (TUint)settings->SecureSockets()); + + HBufC* loginName=CopyToBufLC(settings->LoginName()); + INFO_PRINTF2(_L(" LoginName : %S"), loginName); + HBufC* folderPath=CopyToBufLC(settings->FolderPath()); + INFO_PRINTF2(_L(" FolderPath : %S"), folderPath); + CleanupStack::PopAndDestroy(2, loginName); + if ( settings->PathSeparator() != 0 ) + { + INFO_PRINTF2(_L(" PathSeparator : %c"), (TText)settings->PathSeparator()); + } + if ( settings->DisconnectedUserMode() != 0 ) + { + INFO_PRINTF2(_L(" DisconnectedUserMode : %x"), (TUint)settings->DisconnectedUserMode()); + } + if ( settings->Synchronise() != 0 ) + { + INFO_PRINTF2(_L(" Synchronise : %x"), (TUint)settings->Synchronise()); + } + if ( settings->Subscribe() != 0 ) + { + INFO_PRINTF2(_L(" Subscribe : %x"), (TUint)settings->Subscribe()); + } + if ( settings->AutoSendOnConnect() != 0 ) + { + INFO_PRINTF2(_L(" AutoSendOnConnect : %x"), (TUint)settings->AutoSendOnConnect()); + } + if ( settings->MaxEmailSize() != 0 ) + { + INFO_PRINTF2(_L(" MaxEmailSize : %x"), (TUint)settings->MaxEmailSize()); + } + if ( settings->DeleteEmailsWhenDisconnecting() != 0 ) + { + INFO_PRINTF2(_L(" DeleteEmailsWhenDisconnecting: %x"), (TUint)settings->DeleteEmailsWhenDisconnecting()); + } + if ( settings->AcknowledgeReceipts() != 0 ) + { + INFO_PRINTF2(_L(" AcknowledgeReceipts : %x"), (TUint)settings->AcknowledgeReceipts()); + } + if ( settings->GetMailOptions() != 0 ) + { + INFO_PRINTF2(_L(" GetMailOptions : %x"), (TUint)settings->GetMailOptions()); + } + if ( settings->InboxSynchronisationLimit() != 0 ) + { + INFO_PRINTF2(_L(" InboxSynchronisationLimit : %x"), (TUint)settings->InboxSynchronisationLimit()); + } + if ( settings->MailboxSynchronisationLimit() != 0 ) + { + INFO_PRINTF2(_L(" MailboxSynchronisationLimit : %x"), (TUint)settings->MailboxSynchronisationLimit()); + } + } + CleanupStack::PopAndDestroy(settings); + } + + CleanupStack::PopAndDestroy(store); + } + +void CTestMessBase::PrintStoreSmsL(CMsvEntry& aEntry) + { + TMsvEntry entry=aEntry.Entry(); + CMsvStore* store=aEntry.ReadStoreL(); + CleanupStack::PushL(store); + + TPtrC ptrTemp; + if ( entry.iType == KUidMsvServiceEntry ) + { + CSmsSettings* settings = CSmsSettings::NewL(); + CleanupStack::PushL(settings); + +#ifdef __MESSAGING_API_V2__ + CSmsAccount* smsAccount = CSmsAccount::NewLC(); + TRAPD(err, smsAccount->LoadSettingsL(*settings)); + CleanupStack::PopAndDestroy(smsAccount); +#else + TRAPD(err, settings->RestoreL(*store)); +#endif + if ( err == KErrNone ) + { + TSmsDelivery delivery(settings->Delivery()); + INFO_PRINTF2(_L(" Delivery : %d"), delivery); + CSmsSettings::TSmsReportHandling reportHandling(settings->StatusReportHandling()); + INFO_PRINTF2(_L(" StatusReportHandling : %d"), reportHandling); + CSmsSettings::TSmsReportHandling specialMsgHandling(settings->SpecialMessageHandling()); + INFO_PRINTF2(_L(" SpecialMessageHandling : %d"), specialMsgHandling); + INFO_PRINTF2(_L(" ReplyQuoted : %d"), settings->ReplyQuoted()); +#ifdef __MESSAGING_API_V2__ + const TInt numSCAddr = settings->ServiceCenterCount(); +#else + const TInt numSCAddr = settings->NumSCAddresses(); +#endif + for( TInt index=0;indexGetServiceCenter(index); +#else + CSmsNumber& scAddr = settings->SCAddress(index); +#endif + ptrTemp.Set(scAddr.Name()); + INFO_PRINTF2(_L(" SC Name : %S"), &ptrTemp); + ptrTemp.Set(scAddr.Address()); + INFO_PRINTF2(_L(" SC Address : %S"), &ptrTemp); + } + CSmsSettings::TSmsSettingsCommDbAction commDbAction(settings->SmsBearerAction()); + INFO_PRINTF2(_L(" SmsBearerAction : %d"), commDbAction); + + CSmsSettings::TMobileSmsBearer smsBearer(settings->SmsBearer()); + INFO_PRINTF2(_L(" SmsBearer : %d"), smsBearer); + } + CleanupStack::PopAndDestroy(settings); + } + + CleanupStack::PopAndDestroy(store); + } + +void CTestMessBase::IssueTimerRequest() + { + if (iMessageTimer!= NULL) + { + iMessageTimer->IssueRequest(); + } + } + +void CTestMessBase::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny*, TAny*) +/** + Handler for the Session Event + @param aEvent - TMsvSessionEvent object + @param aArg1 - TAny object pointer, used to store the argument for the event + @leave - System wide error codes +*/ + { + TBool printSelection=EFalse; + + switch (aEvent) + { + case EMsvEntriesCreated: + INFO_PRINTF1(_L("EMsvEntriesCreated")); + printSelection=ETrue; + break; + case EMsvEntriesChanged: + INFO_PRINTF1(_L("EMsvEntriesChanged")); + printSelection=ETrue; + break; + case EMsvEntriesDeleted: + INFO_PRINTF1(_L("EMsvEntriesDeleted")); + break; + case EMsvEntriesMoved: + INFO_PRINTF1(_L("EMsvEntriesMoved")); + printSelection=ETrue; + break; + case EMsvMtmGroupInstalled: + INFO_PRINTF1(_L("EMsvMtmGroupInstalled")); + break; + case EMsvMtmGroupDeInstalled: + INFO_PRINTF1(_L("EMsvMtmGroupDeInstalled")); + break; + case EMsvGeneralError: + INFO_PRINTF1(_L("EMsvGeneralError")); + break; + case EMsvCloseSession: + INFO_PRINTF1(_L("EMsvCloseSession")); + break; + case EMsvServerReady: + INFO_PRINTF1(_L("EMsvServerReady")); + break; + case EMsvServerFailedToStart: + INFO_PRINTF1(_L("EMsvServerFailedToStart")); + break; + case EMsvCorruptedIndexRebuilt: + INFO_PRINTF1(_L("EMsvCorruptedIndexRebuilt")); + break; + case EMsvServerTerminated: + INFO_PRINTF1(_L("EMsvServerTerminated")); + break; + case EMsvMediaChanged: + INFO_PRINTF1(_L("EMsvMediaChanged")); + break; + case EMsvMediaUnavailable: + INFO_PRINTF1(_L("EMsvMediaUnavailable")); + break; + case EMsvMediaAvailable: + INFO_PRINTF1(_L("EMsvMediaAvailable")); + break; + case EMsvMediaIncorrect: + INFO_PRINTF1(_L("EMsvMediaIncorrect")); + break; + case EMsvCorruptedIndexRebuilding: + INFO_PRINTF1(_L("EMsvCorruptedIndexRebuilding")); + break; + default: + INFO_PRINTF2(_L("EMsv Unknown event:%d"), aEvent); + break; + } + + if ( printSelection ) + { + CMsvEntrySelection* selection=STATIC_CAST(CMsvEntrySelection*, aArg1); + CMsvEntry* entry=NULL; + for ( int i=0; iCount(); ) + { + entry=iSession->GetEntryL(selection->At(i++)); + CleanupStack::PushL(entry); + PrintEntryL(*entry); + CleanupStack::PopAndDestroy(entry); + } + } + } + + +void CTestMessBase::PrepareSmsHeaderFromIniFileL(CSmsHeader& aSmsHeader) + { + // Starts the Bitmap server + FbsStartup(); + // start the server + RFbsSession::Connect(); + + // Add the Fromating required for EMS if required + TInt emsElements=0; + if ( !GetIntFromConfig(ConfigSection(), KElements, emsElements) ) + { + ERR_PRINTF1(_L("Elements not set")); + SetTestStepResult(EFail); + } + +// Macro usage for CDMA mtm +#if (defined CDMA_API_ENABLED) + TMsvMessageSms& message=aSmsHeader.SmsMessage(); +#else + CSmsMessage& message=aSmsHeader.Message(); +#endif + + TBuf tempStore; + for ( TInt element=0; elementSetStartPosition(startPosition); + + TInt intTemp; + TBool boolTemp; + TPtrC alignment; + TPtrC fontSize; + + // Set the Format length and other information + tempStore.Format(KFormatLength, element); + if ( GetIntFromConfig(ConfigSection(), tempStore, intTemp) ) + { + INFO_PRINTF2(_L("Format Length %d"), intTemp); + newElement->SetFormatLength(intTemp); + } + tempStore.Format(KBold, element); + if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) ) + { + INFO_PRINTF2(_L("Bold %d"), boolTemp); + newElement->SetBold(boolTemp); + } + tempStore.Format(KItalic, element); + if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) ) + { + INFO_PRINTF2(_L("Italic %d"), boolTemp); + newElement->SetItalic(boolTemp); + } + tempStore.Format(KUnderline, element); + if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) ) + { + INFO_PRINTF2(_L("Underline %d"), boolTemp); + newElement->SetUnderline(boolTemp); + } + tempStore.Format(KStrikethrough, element); + if ( GetBoolFromConfig(ConfigSection(), tempStore, boolTemp) ) + { + INFO_PRINTF2(_L("Strikethrough %d"), boolTemp); + newElement->SetStrikethrough(boolTemp); + } + tempStore.Format(KAlignment,element); + if(GetStringFromConfig(ConfigSection(),tempStore,alignment)) + { + SetAlignmentFormat(*newElement, alignment); + } + + tempStore.Format(KFontSize,element); + if(GetStringFromConfig(ConfigSection(),tempStore,fontSize)) + { + // + SetFontSizeFormat(*newElement, fontSize); + } + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(newElement); + } + else if ( type.Compare(KTypeSound) == 0 ) + { + // === Process sound Information Element === + if ( hasFile ) + { + HBufC8* buffFile=CopyToBuf8LC(fileName.FullName()); + CEmsSoundIE* newElement=CEmsSoundIE::NewL(buffFile->Des()); + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(2, buffFile); + } + else + { + ERR_PRINTF1(_L("No Sound file name")); + SetTestStepResult(EFail); + } + } + else if ( type.Compare(KTypePreDefSound) == 0 ) + { + // === Process predefined sound Information Element === + TPtrC preDefSound; + tempStore.Format(KEmsPreDef, element); + if ( !GetStringFromConfig(ConfigSection(),tempStore, preDefSound)) + { + ERR_PRINTF1(_L("Predefined sound not present")); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("Predefined sound %S"), &preDefSound); + CEmsPreDefSoundIE* newElement=NewPreDefSoundL(preDefSound); + + if ( newElement != NULL ) + { + //Assign the predef animation element to newElement + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(newElement); + } + else + { + ERR_PRINTF1(_L("Unable to create predefined sound")); + SetTestStepResult(EFail); + } + } + } + else if ( type.Compare(KTypeAnimation) == 0 ) + { + // === Process animation Information Element === + if ( hasFile ) + { + TPtrC objectSize; + + tempStore.Format(KObjectSize, element); + if ( !GetStringFromConfig(ConfigSection(),tempStore,objectSize) ) + { + ERR_PRINTF1(_L("No size provided")); + SetTestStepResult(EFail); + } + else + { + CFbsBitmap* bmp=NewBitmapL(fileName, objectSize); + if ( bmp == NULL ) + { + ERR_PRINTF1(_L("Failed to Load Animation File. Error %d")); + SetTestStepResult(EFail); + } + else + { + CleanupStack::PushL(bmp); + CEmsAnimationIE* newElement=CEmsAnimationIE::NewL(*bmp); + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(2, bmp); + } + } + } + else + { + ERR_PRINTF1(_L("No Animation file name")); + SetTestStepResult(EFail); + } + } + else if ( type.Compare(KTypePreDefAnimation) == 0 ) + { + // === Process predefined animation Information Element === + TPtrC preDefAnim; + tempStore.Format(KEmsPreDef, element); + if ( !GetStringFromConfig(ConfigSection(),tempStore, preDefAnim) ) + { + ERR_PRINTF1(_L("Predefined animations not present")); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("Predefined animation %S"), &preDefAnim); + CEmsPreDefAnimationIE* newElement=NewPreDefAnimationL(preDefAnim); + + if ( newElement != NULL ) + { + //Assign the predef animation element to newElement + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(newElement); + } + else + { + ERR_PRINTF1(_L("Unable to create predefined animation")); + SetTestStepResult(EFail); + } + } + } + else if ( type.Compare(KTypePicture) == 0 ) + { + // === Process picture Information Element === + if ( hasFile ) + { + TPtrC objectSize; + + tempStore.Format(KObjectSize, element); + if ( !GetStringFromConfig(ConfigSection(),tempStore,objectSize) ) + { + ERR_PRINTF1(_L("No size provided")); + SetTestStepResult(EFail); + } + else + { + CFbsBitmap* bmp=NewBitmapL(fileName, objectSize); + if ( bmp == NULL ) + { + ERR_PRINTF1(_L("Failed to Load Animation File. Error %d")); + SetTestStepResult(EFail); + } + else + { + CleanupStack::PushL(bmp); + CEmsPictureIE* newElement=CEmsPictureIE::NewL(*bmp); + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(2, bmp); + } + } + } + else + { + ERR_PRINTF1(_L("No Picture file name")); + SetTestStepResult(EFail); + } + } + else if ( type.Compare(KTypeUserPrompt) == 0 ) + { + // === Process user prompt Information Element === + CEmsUserPrompt* newElement=CEmsUserPrompt::NewL(2); + CleanupStack::PushL(newElement); + newElement->SetStartPosition(startPosition); + message.AddEMSInformationElementL(*newElement); + CleanupStack::PopAndDestroy(newElement); + } + else + { + ERR_PRINTF2(_L("Unknown element type %S"), &type); + SetTestStepResult(EFail); + } + } + else + { + ERR_PRINTF1(_L("No type given")); + SetTestStepResult(EFail); + } + } + + RFbsSession::Disconnect(); + } + +/** + This function reads the schedule time from ini file + @return - returns the schedule time read from the ini file +*/ +TTimeIntervalMinutes CTestMessBase::ReadScheduleTime() + { + // Read the schedule time from ini file. Add this schedule time to current time. + // This time will be set as the scheduled time for sending the SMS message from task scheduler + // By default schedule time will be 1 min + TInt scheduled=0; + GetIntFromConfig(ConfigSection(), KScheduled, scheduled); + INFO_PRINTF2(_L("Scheduled Time in minutes is %d"), scheduled); + return TTimeIntervalMinutes(scheduled); + } + +void CTestMessBase::SetAlignmentFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aAlignment) + { + //Sets the alignment to the text + INFO_PRINTF2(_L("Alignment %S"), &aAlignment); + if( aAlignment.Compare(KLeftAlign)== 0 ) + { + aEmsFormatIE.SetAlignment(CEmsFormatIE::ELeft); + } + else if( aAlignment.Compare(KRightAlign)== 0 ) + { + aEmsFormatIE.SetAlignment(CEmsFormatIE::ERight); + } + else if( aAlignment.Compare(KCenterAlign)== 0 ) + { + aEmsFormatIE.SetAlignment(CEmsFormatIE::ECenter); + } + else if( aAlignment.Compare(KLangDepend)== 0 ) + { + aEmsFormatIE.SetAlignment(CEmsFormatIE::ELangDepend); + } + else + { + ERR_PRINTF1(_L("Illegal alignment value")); + SetTestStepResult(EFail); + } + } + +void CTestMessBase::SetFontSizeFormat(CEmsFormatIE& aEmsFormatIE, const TDesC& aFontSize) + { + //Sets the specified font to the text + INFO_PRINTF2(_L("FontSize %S"), &aFontSize); + if( aFontSize.Compare(KNormal)== 0 ) + { + aEmsFormatIE.SetFontSize(CEmsFormatIE::ENormal); + } + else if( aFontSize.Compare(KLarge)== 0 ) + { + aEmsFormatIE.SetFontSize(CEmsFormatIE::ELarge); + } + else if( aFontSize.Compare(KSmall)== 0 ) + { + aEmsFormatIE.SetFontSize(CEmsFormatIE::ESmall); + } + else if( aFontSize.Compare(KReserved)== 0 ) + { + aEmsFormatIE.SetFontSize(CEmsFormatIE::EReserved); + } + else + { + ERR_PRINTF1(_L("Illegal fonst size value")); + SetTestStepResult(EFail); + } + } + +CEmsPreDefAnimationIE* CTestMessBase::NewPreDefAnimationL(const TDesC& aPreDefType) +// +// Attaches the required predef animation. +// Arguments - aString - holds the TAnim type to be attached +// Return Value - Returns a Pointer of CEmsPreDefAnimationIE +// + { + //Initialize emsPreDef to NULL + CEmsPreDefAnimationIE::TAnimType animType=CEmsPreDefAnimationIE::EFlirty; + TBool validType=ETrue; + + //Set a value for emsPreDef + if ( aPreDefType.Compare(KEmsAnimTypeFlirty) == 0 ) + { + animType = CEmsPreDefAnimationIE::EFlirty; + } + else if ( aPreDefType.Compare(KEmsAnimTypeGlad) == 0 ) + { + animType = CEmsPreDefAnimationIE::EGlad; + } + else if ( aPreDefType.Compare(KEmsAnimTypeSceptic) == 0 ) + { + animType = CEmsPreDefAnimationIE::ESceptic; + } + else if ( aPreDefType.Compare(KEmsAnimTypeSad) == 0 ) + { + animType = CEmsPreDefAnimationIE::ESad; + } + else if ( aPreDefType.Compare(KEmsAnimTypeWow) == 0 ) + { + animType = CEmsPreDefAnimationIE::EWow; + } + else if ( aPreDefType.Compare(KEmsAnimTypeCrying) == 0 ) + { + animType = CEmsPreDefAnimationIE::ECrying; + } + else if ( aPreDefType.Compare(KEmsAnimTypeWinking) == 0 ) + { + animType = CEmsPreDefAnimationIE::EWinking; + } + else if ( aPreDefType.Compare(KEmsAnimTypeLaughing) == 0 ) + { + animType = CEmsPreDefAnimationIE::ELaughing; + } + else if ( aPreDefType.Compare(KEmsAnimTypeIndifferent) == 0 ) + { + animType = CEmsPreDefAnimationIE::EIndifferent; + } + else if ( aPreDefType.Compare(KEmsAnimTypeKissing) == 0 ) + { + animType = CEmsPreDefAnimationIE::EKissing; + } + else if ( aPreDefType.Compare(KEmsAnimTypeConfused) == 0 ) + { + animType = CEmsPreDefAnimationIE::EConfused; + } + else if ( aPreDefType.Compare(KEmsAnimTypeTongueOut) == 0 ) + { + animType = CEmsPreDefAnimationIE::ETongueOut; + } + else if ( aPreDefType.Compare(KEmsAnimTypeAngry) == 0 ) + { + animType = CEmsPreDefAnimationIE::EAngry; + } + else if ( aPreDefType.Compare(KEmsAnimTypeGlasses) == 0 ) + { + animType = CEmsPreDefAnimationIE::EGlasses; + } + else if ( aPreDefType.Compare(KEmsAnimTypeDevil) == 0 ) + { + animType = CEmsPreDefAnimationIE::EDevil; + } + else + { + validType=EFalse; + } + + CEmsPreDefAnimationIE* emsPreDef=NULL; + if ( validType ) + { + emsPreDef=CEmsPreDefAnimationIE::NewL(animType); + } + + return emsPreDef; + } + +CEmsPreDefSoundIE* CTestMessBase::NewPreDefSoundL(const TDesC& aPreDefType) +// +// Attaches the required predef animation. +// Arguments - aString - holds the TAnim type to be attached +// Return Value - Returns a Pointer of CEmsPreDefAnimationIE +// + { + //Initialize emsPreDef to NULL + CEmsPreDefSoundIE::TPredefinedSound soundType=CEmsPreDefSoundIE::EChimesHigh; + TBool validType=ETrue; + + //Set a value for emsPreDef + if ( aPreDefType.Compare(KEmsSoundTypeChimesHigh) == 0 ) + { + soundType = CEmsPreDefSoundIE::EChimesHigh; + } + else if ( aPreDefType.Compare(KEmsSoundTypeChimesLow) == 0 ) + { + soundType = CEmsPreDefSoundIE::EChimesLow; + } + else if ( aPreDefType.Compare(KEmsSoundTypeDing) == 0 ) + { + soundType = CEmsPreDefSoundIE::EDing; + } + else if ( aPreDefType.Compare(KEmsSoundTypeTaDa) == 0 ) + { + soundType = CEmsPreDefSoundIE::ETaDa; + } + else if ( aPreDefType.Compare(KEmsSoundTypeNotify) == 0 ) + { + soundType = CEmsPreDefSoundIE::ENotify; + } + else if ( aPreDefType.Compare(KEmsSoundTypeDrum) == 0 ) + { + soundType = CEmsPreDefSoundIE::EDrum; + } + else if ( aPreDefType.Compare(KEmsSoundTypeClaps) == 0 ) + { + soundType = CEmsPreDefSoundIE::EClaps; + } + else if ( aPreDefType.Compare(KEmsSoundTypeFanFar) == 0 ) + { + soundType = CEmsPreDefSoundIE::EFanFar; + } + else if ( aPreDefType.Compare(KEmsSoundTypeChordHigh) == 0 ) + { + soundType = CEmsPreDefSoundIE::EChordHigh; + } + else if ( aPreDefType.Compare(KEmsSoundTypeChordLow) == 0 ) + { + soundType = CEmsPreDefSoundIE::EChordLow; + } + else + { + validType=EFalse; + } + + CEmsPreDefSoundIE* emsPreDef=NULL; + if ( validType ) + { + emsPreDef=CEmsPreDefSoundIE::NewL(soundType); + } + + return emsPreDef; + } + +CFbsBitmap* CTestMessBase::NewBitmapL(const TParse& aFileName, const TDesC& aObjectSize) + { + TInt bitmapType=KSmallObject; + TBool validType=ETrue; + if( aObjectSize.Compare(KSmall) == 0 ) + { + bitmapType=KSmallObject; + } + else if ( aObjectSize.Compare(KLarge) == 0 ) + { + bitmapType=KLargeObject; + } + else if ( aObjectSize.Compare(KVariable) == 0 ) + { + bitmapType=KVariableObject; + } + else + { + ERR_PRINTF2(_L("Invalid bitmap type %S"), &aObjectSize); + validType=EFalse; + } + + CFbsBitmap* bmp = NULL; + if ( validType ) + { + bmp = new (ELeave) CFbsBitmap(); + + TInt error = bmp->Load(aFileName.FullName(), bitmapType, EFalse); + INFO_PRINTF2(_L("Bimap load %d"), error); + if ( error != KErrNone) + { + delete bmp; + bmp=NULL; + } + } + + return bmp; + } + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessCleanMessageFolder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessCleanMessageFolder.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,172 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCleanMessageFolder which cleans out all the +// message folders +// +// + +#include "TestMessCleanMessageFolder.h" + +// EPOC includes +#include +#include + +#ifdef __MESSAGING_API_V2__ +#include +#endif + +_LIT(KMessageCount, "messagecount"); + +CTestMessCleanMessageFolder::CTestMessCleanMessageFolder() +: CTestMessBase(ETrue) +, iNumberOfMessagesToDelete(-1) // Negative value implies delete all + { + SetTestStepName(_L("CleanMessageFolder")); + } + +TVerdict CTestMessCleanMessageFolder::doTestStepL() + { + INFO_PRINTF1(_L("Clean message folder")); + + if ( GetIntFromConfig(ConfigSection(), KMessageCount, iNumberOfMessagesToDelete) ) + { + INFO_PRINTF2(_L("Message count read from the ini file is %D"), iNumberOfMessagesToDelete); + } + else + { + WARN_PRINTF1(_L("No Count specified in the ini file")); + WARN_PRINTF1(_L("All the messages will be deleted")); + } + + if ( TestStepResult() == EPass ) + { + //delete the contents of the folder + CleanFolders(EntryL().EntryId()); + + if ( iNumberOfMessagesToDelete<=0 ) + { + INFO_PRINTF1(_L("Messages deleted")); + } + else + { + ERR_PRINTF2(_L("%d Outstanding entries not deleted."), iNumberOfMessagesToDelete); + SetTestStepResult(EFail); + } + } + + return TestStepResult(); + } + +void CTestMessCleanMessageFolder::CleanFolders(const TMsvId aEntryId) + { +#ifdef __MESSAGING_API_V2__ + if ( aEntryId == KMsvRootIndexEntryId ) + { + CEmailAccounts* accounts = CEmailAccounts::NewLC(); + + RArray pop3Accounts; + CleanupClosePushL(pop3Accounts); + accounts->GetPopAccountsL(pop3Accounts); + TInt count = pop3Accounts.Count(); + TInt index=0; + for( index = 0; index < count; index++ ) + { + TPopAccount id = pop3Accounts[index]; + accounts->DeletePopAccountL( id ); + } + + RArray imap4Accounts; + CleanupClosePushL(imap4Accounts); + accounts->GetImapAccountsL(imap4Accounts); + count = imap4Accounts.Count(); + for( TInt index = 0; index < count; index++ ) + { + TImapAccount id = imap4Accounts[index]; + accounts->DeleteImapAccountL( id ); + } + + CleanupStack::PopAndDestroy(3, accounts); + } +#endif + + SetEntryL(aEntryId); + EntryL().SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=EntryL().ChildrenL(); + CleanupStack::PushL(selection); + TInt count=selection->Count(); + TInt i; + for (i=count; i>0; ) + { + TMsvId childId=selection->At(--i); + + SetEntryL(aEntryId); + if( iNumberOfMessagesToDelete!=0 ) + { + TRAPD(err, EntryL().DeleteL(childId)); + switch ( err ) + { + case KErrNone: + INFO_PRINTF2(_L("DeletedId : %x"), childId); + if ( iNumberOfMessagesToDelete > 0 ) + { + --iNumberOfMessagesToDelete; + } + break; + case KErrAccessDenied: + INFO_PRINTF2(_L("Access Denied : %x"), childId); + break; + default: + ERR_PRINTF3(_L("Deletion Error : %d , Id : %x "), err, childId); + SetTestStepResult(EFail); + break; + } + } + } + CleanupStack::PopAndDestroy(selection); + + EntryL().SetSortTypeL(SelectionOrdering()); + selection=EntryL().ChildrenL(); + CleanupStack::PushL(selection); + count=selection->Count(); + for (i=count; i>0; ) + { + TMsvId childId=selection->At(--i); + + // Log child + CleanFolders(childId); + + SetEntryL(aEntryId); + + TRAPD(err, EntryL().DeleteL(childId)); + switch ( err ) + { + case KErrNone: + INFO_PRINTF2(_L("DeletedId : %x"), childId); + if ( iNumberOfMessagesToDelete > 0 ) + { + --iNumberOfMessagesToDelete; + } + break; + case KErrAccessDenied: + INFO_PRINTF2(_L("Access Denied : %x"), childId); + break; + default: + ERR_PRINTF3(_L("Deletion Error : %d , Id : %x "), err, childId); + SetTestStepResult(EFail); + break; + } + } + CleanupStack::PopAndDestroy(selection); + } + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessCreateCdmaSmsUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessCreateCdmaSmsUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,433 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessCreateCdmsSmsUtil.cpp +// This class creates the Cdma sms header and the service settings +// +// + +#include "TestMessCreateCdmaSmsUtil.h" +#include "TestMessCreateSmsAccount.h" + +// EPOC includes +#include + +/*@{*/ +_LIT(KPtDeliveryAck, "DeliveryAck"); +_LIT(KPtUserAck, "UserAck"); +_LIT(KPtReadAck, "ReadAck"); +_LIT(KPtMessageConversion, "MessageConversion"); +_LIT(KPtPriorityIndicator, "PriorityIndicator"); +_LIT(KPtPrivacyIndicator, "PrivacyIndicator"); +_LIT(KPtReplyOption, "ReplyOption"); +_LIT(KPtAlertonDelivery, "AlertonDelivery"); +_LIT(KPtLanguageIndicator, "LanguageIndicator"); + +//Constants used +_LIT(KPtTeleService, "TeleService"); +_LIT(KPtSubmit, "Submit"); +_LIT(KPtCancel, "Cancel"); + +// Supported Teleservices +_LIT(KPtTeleWmt, "WMT"); +_LIT(KPtTeleWemt, "WEMT"); +_LIT(KPtTeleWpt, "WPT"); +_LIT(KPtTeleVmn, "VMN"); +_LIT(KPtTeleScpt, "SCPT"); +_LIT(KPtTeleCatpt, "CATPT"); +_LIT(KPtTeleCmt91, "CMT91"); +_LIT(KPtTeleWap, "WAP"); + +// Supported message conversion formats +_LIT(KPtPidFax, "Fax"); +_LIT(KPtPidX400, "X400"); +_LIT(KPtPidPaging, "Paging"); +_LIT(KPtPidMail, "Mail"); +_LIT(KPtPidErmes, "Ermes"); +_LIT(KPtPidSpeech, "Speech"); +/*@}*/ + +/** + Constructor +*/ +CTestMessCreateCdmaSmsUtil ::CTestMessCreateCdmaSmsUtil(CTestMessBase& aTestStep) +: CTestMessCreateSmsUtilBase(aTestStep) + { + aTestStep.INFO_PRINTF1(_L("The CDMA SMS util is created")); + } + +/** + Prepares the SMS account details for CSendAs/RSendAs + @leave - KErrNoMemory + @leave - System wide error codes +*/ +void CTestMessCreateCdmaSmsUtil::PrepareAccountL(CMsvSession& /*aSession*/) + { + // Reads the teleservice + tia637::TTeleserviceId teleServiceId=tia637::KTeleserviceWMT; + TPtrC ptrTeleService; + if( !(iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KPtTeleService, ptrTeleService))) + { + iTestStep.INFO_PRINTF1(_L("Teleservice is not provided. Default teleservice (WMT) is used")); + } + else + { + iTestStep.INFO_PRINTF2(_L("Teleservice to be set is : %S"), &ptrTeleService); + + //Get the teleservice Id + teleServiceId = GetTeleServiceId(ptrTeleService); + } + + if ( teleServiceId!=tia637::KTeleserviceWEMT ) + { + teleServiceId=tia637::KTeleserviceWMT; + } + + CSmsSettings* smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + + CSmsAccount* smsAccount=CSmsAccount::NewLC(); + smsAccount->LoadSettingsL(*smsSettings); + smsSettings->SetDefaultTeleservice(teleServiceId); + smsAccount->SaveSettingsL(*smsSettings); + CleanupStack::PopAndDestroy(smsAccount); + CleanupStack::PopAndDestroy(smsSettings); + } + +/** + Creates a new CDMA sms header object + @param aBodyText - body text of the message + @return CSmsHeader - pointer of the CSmsHeader object + @leave - KErrNoMemory + @leave - System wide error codes +*/ +CSmsHeader* CTestMessCreateCdmaSmsUtil::NewHeaderL(CRichText& aBodyText) + { + return CSmsHeader::NewL(KSmsTypeSubmit, aBodyText); + } + +/** + Fill up the header object with data read from the ini file + @param aSmsHeader - reference for the sms header object + @leave - System wide error codes +*/ +void CTestMessCreateCdmaSmsUtil::PrepareHeaderL(CSmsHeader& aSmsHeader) + { + // Get bearer data + TPtrC ptrBearer; + TBool returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KBearer, ptrBearer); + if ( !returnValue ) + { + //If no bearer provided, the bearer is read from the default section ofthe + // ini file + returnValue=iTestStep.GetStringFromConfig(KDef, KDefBearer, ptrBearer); + } + + if ( returnValue ) + { + //default value for the bearer + TBioMsgIdType bearer = EBioMsgIdNbs; + + iTestStep.INFO_PRINTF2(_L("Bearer = %S"), &ptrBearer); + if (ptrBearer.CompareF(KBearerWap) == 0) + { + //Wap message ID + bearer = EBioMsgIdWap; + } + else if (ptrBearer.CompareF(KBearerWapSecure) == 0) + { + //WapSecure message ID + bearer = EBioMsgIdWapSecure; + } + else + { + iTestStep.ERR_PRINTF1(_L("No bearer provided. Default is used")); + } + + //Set the BIO Message ID type + aSmsHeader.BioMessage().SetBioMsgIdType(bearer); + } + + // Get encoding data + TInt encoding; + returnValue=iTestStep.GetIntFromConfig(iTestStep.ConfigSection(), KEncoding, encoding); + if ( !returnValue ) + { + //If no encoding is provided, the encoding is read from the default section + //of the ini file + returnValue=iTestStep.GetIntFromConfig(KDef, KDefEncoding, encoding); + } + if ( returnValue ) + { + //Default encoding value. + TSmsCharacterEncoding charEncoding = KSmsEncodingUnicode; + + iTestStep.INFO_PRINTF2(_L("Encoding = %d"), encoding); + switch (encoding) + { + case 7: + //7 bit encoding format + charEncoding = KSmsEncoding7BitASCII; + break; + case 8: + //8 bit encoding format + charEncoding = KSmsEncodingBinary; + break; + case 16: + //unicode encoding format + charEncoding = KSmsEncodingUnicode; + break; + default: + //default encoding format + charEncoding = KSmsEncodingUnicode; + break; + } + //Set the character encoding format + aSmsHeader.BioMessage().SetEncoding(charEncoding); + } + + + TBool deliveryAck = EFalse; + TBool userAck = EFalse; + TBool readAck = EFalse; + + // Get acknowledgements report request + TPtrC ptrDeliveryReport; + returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KDeliveryReport, ptrDeliveryReport); + if ( !returnValue ) + { + returnValue=iTestStep.GetStringFromConfig(KDef, KDefDeliveryReport, ptrDeliveryReport); + } + if ( returnValue ) + { + iTestStep.INFO_PRINTF2(_L("The acknowledgement request flag : %S"), &ptrDeliveryReport); + if(ptrDeliveryReport.Compare(_L("NO")) == 0) + { + deliveryAck = EFalse; + userAck = EFalse; + readAck = EFalse; + } + if(ptrDeliveryReport.Compare(_L("YES")) == 0) + { + // Read different type of acknowledgements + iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtDeliveryAck, deliveryAck); + iTestStep.INFO_PRINTF2(_L("The Delivery acknowledgement request flag : %d"), deliveryAck); + iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtUserAck, userAck); + iTestStep.INFO_PRINTF2(_L("The User acknowledgement request flag : %d"), userAck); + iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtReadAck, readAck); + iTestStep.INFO_PRINTF2(_L("The Read acknowledgement request flag : %d"), readAck); + } + } + + aSmsHeader.SetAcknowledgementRequest(ESmsAckTypeDelivery, deliveryAck); + aSmsHeader.SetAcknowledgementRequest(ESmsAckTypeUser, userAck); + aSmsHeader.SetAcknowledgementRequest(ESmsAckTypeRead, readAck); + + //Get the message conversion type + TPtrC ptrMessageConversion; + TSmsPIDConversion smsPidConversion = ESmsConvPIDNone; + returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KPtMessageConversion, ptrMessageConversion); + if ( !returnValue ) + { + iTestStep.INFO_PRINTF1(_L("The message conversion is not provided. Default (PIDNone) is taken")); + } + if ( returnValue ) + { + iTestStep.INFO_PRINTF2(_L("The message conversion to be set is : %S"), &ptrMessageConversion); + //Get the Message conversion id + smsPidConversion = GetMessageConversionId(ptrMessageConversion); + } + //Set the message conversion. + CSmsSettings *smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + aSmsHeader.GetDefaultMessageSettingsL(*smsSettings); + smsSettings->SetMessageConversion(smsPidConversion); + CleanupStack::Pop(smsSettings); + + // Set the other message settings + aSmsHeader.CdmaMessage().SetPrivacyIndicatorL(tia637::KBdRestricted); + aSmsHeader.CdmaMessage().SetPriorityIndicatorL(tia637::KBdUrgent); + aSmsHeader.CdmaMessage().SetAlertOnDeliveryL(tia637::KBdUseMediumPriorityAlert); + aSmsHeader.CdmaMessage().SetLanguageIndicatorL(tia637::KLanguageEnglish); + } + +/** + Sets the cdma sms service settings fields using data read from the + ini file. If no data is provided/read from ini file, the default + account settings is used. + @param aSmsSettings - reference of the CSmsSettings +*/ +void CTestMessCreateCdmaSmsUtil::SetSmsAccountSettings(CSmsSettings& aSmsSettings) + { + iTestStep.INFO_PRINTF1(_L("Set SMS account Settings....")); + TBool boolTemp; + + // Set the Reply quoted setting. + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KReplyQuoted, boolTemp) ) + { + aSmsSettings.SetReplyQuoted(boolTemp); + } + + // Set the priority indicator + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtPriorityIndicator, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTPriorityIndicator, boolTemp); + } + + //Set the Privacy Indicator + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtPrivacyIndicator, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTPrivacyIndicator, boolTemp); + } + + //Set the Reply option + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtReplyOption, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTReplyOption, boolTemp); + } + + //Set the alert on Message deliver + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtAlertonDelivery, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTAlertOnMessageDelivery, boolTemp); + } + + //Set the Language Indicator + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KPtLanguageIndicator, boolTemp) ) + { + aSmsSettings.MessageSettings().Cdma().ActivateMessageSetting(tia637::KTLanguageIndicator, boolTemp); + } + + aSmsSettings.SetValidityPeriod(ESmsVPWeek); // week + aSmsSettings.SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFInteger); //relative + aSmsSettings.SetDelivery(ESmsDeliveryImmediately); + } + +/** + Get the message type id + @param aMessageType - TPtrC object holding the message type + @return TSmsMessageType - message type id +*/ +TSmsMessageType CTestMessCreateCdmaSmsUtil::GetMessageTypeId(const TDesC& aMessageType) + { + //Default message type is assigned + TSmsMessageType smsMessageType = KSmsTypeSubmit; + + if( aMessageType.Compare(KPtSubmit) ==0) + { + smsMessageType = KSmsTypeSubmit; + } + else if( aMessageType.Compare(KPtCancel) ==0) + { + smsMessageType = KSmsTypeCdmaCancellation; + } + else + { + iTestStep.WARN_PRINTF1(_L("Invalid message type provided. Default is used")); + } + return smsMessageType; + } + +/** + Gets the Teleservice Id + @param aTeleService - TPtrC holding the tele service name + @return tia637::TTeleserviceId - teleservice id +*/ +tia637::TTeleserviceId CTestMessCreateCdmaSmsUtil::GetTeleServiceId(const TDesC& aTeleService) + { + //default teleservice ID assigned + tia637::TTeleserviceId teleServiceId = tia637::KTeleserviceWMT; + + iTestStep.INFO_PRINTF2(_L("Teleservice set is : %S"), &aTeleService); + if( aTeleService.Compare(KPtTeleScpt) ==0) + { + teleServiceId = tia637::KTeleserviceSCPT; + } + else if( aTeleService.Compare(KPtTeleCatpt) ==0) + { + teleServiceId = tia637::KTeleserviceCATPT; + } + else if( aTeleService.Compare(KPtTeleCmt91) ==0) + { + teleServiceId = tia637::KTeleserviceCMT91; + } + else if( aTeleService.Compare(KPtTeleVmn) ==0) + { + teleServiceId = tia637::KTeleserviceVMN; + } + else if( aTeleService.Compare(KPtTeleWap) ==0) + { + teleServiceId = tia637::KTeleserviceWAP; + } + else if( aTeleService.Compare(KPtTeleWemt) ==0) + { + teleServiceId = tia637::KTeleserviceWEMT; + } + else if( aTeleService.Compare(KPtTeleWmt) ==0) + { + teleServiceId = tia637::KTeleserviceWMT; + } + else if( aTeleService.Compare(KPtTeleWpt) ==0) + { + teleServiceId = tia637::KTeleserviceWPT; + } + else + { + iTestStep.WARN_PRINTF1(_L("Invalid Teleservice provided. Default WMT used")); + } + + return teleServiceId; + } + +/** + Gets the Message Conversion Id + @param aTeleService - TPtrC holding the tele service name + @return tia637::TTeleserviceId - teleservice id +*/ +TSmsPIDConversion CTestMessCreateCdmaSmsUtil::GetMessageConversionId(const TDesC& aMessageConversion) + { + TSmsPIDConversion smsPidConv = ESmsConvPIDNone; + + iTestStep.INFO_PRINTF2(_L("The message conversion set is : %S"), &aMessageConversion); + if( aMessageConversion.Compare(KPtPidFax) ==0) + { + smsPidConv = ESmsConvFax; + } + else if( aMessageConversion.Compare(KPtPidX400) ==0) + { + smsPidConv = ESmsConvX400; + } + else if( aMessageConversion.Compare(KPtPidPaging) ==0) + { + smsPidConv = ESmsConvPaging; + } + else if( aMessageConversion.Compare(KPtPidMail) ==0) + { + smsPidConv = ESmsConvMail; + } + else if( aMessageConversion.Compare(KPtPidErmes) ==0) + { + smsPidConv = ESmsConvErmes; + } + else if( aMessageConversion.Compare(KPtPidSpeech) ==0) + { + smsPidConv = ESmsConvSpeech; + } + else + { + iTestStep.INFO_PRINTF1(_L("The message conversion provided is invalid")); + iTestStep.INFO_PRINTF1(_L("The default NONE message conversion is set")); + } + + return smsPidConv; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessCreateGsmSmsUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessCreateGsmSmsUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,262 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 creates the Gsm sms header and service settings. It fills up the +// fields using data read from the ini file +// +// + +#include "Configuration.cfg" + +#include "TestMessCreateGsmSmsUtil.h" + +/** + Constructor +*/ +CTestMessCreateGsmSmsUtil::CTestMessCreateGsmSmsUtil(CTestMessBase &aTestStep) +: CTestMessCreateSmsUtilBase(aTestStep) + { + aTestStep.INFO_PRINTF1(_L("The GSM SMS util is created")); + } + +/** + Prepares the SMS account details for CSendAs/RSendAs + @leave - KErrNoMemory + @leave - System wide error codes +*/ +void CTestMessCreateGsmSmsUtil::PrepareAccountL(CMsvSession& /*aSession*/) + { + } + +/** + Creates the header object for the GSM sms message + @param aBodyText - body text of the message + @return CSmsHeader* - pointer to CSmsHeader + @leave - KErrNoMemory + @leave - system wide error codes +*/ +CSmsHeader* CTestMessCreateGsmSmsUtil::NewHeaderL(CRichText &aBodyText) + { + return CSmsHeader::NewL(CSmsPDU::ESmsSubmit, aBodyText); + } + +/** + Fills up the header object with the data read from the ini file. + @param aSmsHeader - sms header object ofthe sms message + @leave - system wide error codes +*/ +void CTestMessCreateGsmSmsUtil::PrepareHeaderL(CSmsHeader &aSmsHeader) + { + // Get bearer data + TPtrC ptrBearer; + TBool returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KBearer, ptrBearer); + if ( !returnValue ) + { + //If bearer is not provided, read from the default section of the ini file + returnValue=iTestStep.GetStringFromConfig(KDef, KDefBearer, ptrBearer); + } + + if ( returnValue ) + { + //default value for Bio message ID type + TBioMsgIdType bearer = EBioMsgIdNbs; + + iTestStep.INFO_PRINTF2(_L("Bearer = %S"), &ptrBearer); + if (ptrBearer.CompareF(KBearerWap) == 0) + { + //Set Wap message ID + bearer = EBioMsgIdWap; + } + else if (ptrBearer.CompareF(KBearerWapSecure) == 0) + { + //Set WapSecure message ID + bearer = EBioMsgIdWapSecure; + } + else + { + iTestStep.INFO_PRINTF1(_L("No supported bearer is provided. Default is used")); + } + + //Set the Bio message ID type. +#if (defined CDMA_API_ENABLED) + aSmsHeader.BioMessage().SetBioMsgIdType(bearer); +#else + aSmsHeader.SetBioMsgIdType(bearer); +#endif + } + + // Get encoding data + TInt encoding; + returnValue=iTestStep.GetIntFromConfig(iTestStep.ConfigSection(), KEncoding, encoding); + if ( !returnValue ) + { + //If encoding is not provied, read it from the default section of the ini file + returnValue=iTestStep.GetIntFromConfig(KDef, KDefEncoding, encoding); + } + if ( returnValue ) + { + iTestStep.INFO_PRINTF2(_L("Encoding = %d"), encoding); +#if (defined CDMA_API_ENABLED) + TSmsCharacterEncoding charEncoding; + + switch (encoding) + { + case 7: + //7 bit encoding format + charEncoding = KSmsEncoding7BitGsm; + break; + case 8: + //8 bit encoding format + charEncoding = KSmsEncodingBinary; + break; + case 16: + //Unicode encoding format + charEncoding = KSmsEncodingUnicode; + break; + default: + //default encoding format + charEncoding = KSmsEncoding7BitGsm; + break; + } + + //Set the character encoding + aSmsHeader.BioMessage().SetEncoding(charEncoding); +#else + TSmsDataCodingScheme::TSmsAlphabet alpha = TSmsDataCodingScheme::ESmsAlphabet7Bit; + + switch (encoding) + { + case 7: + alpha = TSmsDataCodingScheme::ESmsAlphabet7Bit; + break; + case 8: + alpha = TSmsDataCodingScheme::ESmsAlphabet8Bit; + break; + case 16: + alpha = TSmsDataCodingScheme::ESmsAlphabetUCS2; + break; + default: + alpha = TSmsDataCodingScheme::ESmsAlphabet7Bit; + break; + } + + CSmsPDU& pdu=aSmsHeader.Message().SmsPDU(); + if ( pdu.DataCodingSchemePresent() ) + { + pdu.SetAlphabet(alpha); + } +#endif + } + + // Get delivery report data + TPtrC ptrDeliveryReport; + returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KDeliveryReport, ptrDeliveryReport); + if ( !returnValue ) + { + returnValue=iTestStep.GetStringFromConfig(KDef, KDefDeliveryReport, ptrDeliveryReport); + } + if ( returnValue ) + { + TBool changeDR = EFalse; + TBool deliveryReport = EFalse; + + iTestStep.INFO_PRINTF2(_L("Delivery Report = %S"), &ptrDeliveryReport); + if (ptrDeliveryReport.CompareF(_L("NO")) == 0) + { + changeDR = ETrue; + deliveryReport = EFalse; + } + else if (ptrDeliveryReport.CompareF(_L("YES")) == 0) + { + changeDR = ETrue; + deliveryReport = ETrue; + } + + if ( changeDR ) + { +#if (defined CDMA_API_ENABLED) + aSmsHeader.SetAcknowledgementRequest(ESmsAckTypeDelivery, deliveryReport); +#else + switch ( aSmsHeader.Type() ) + { + case CSmsPDU::ESmsSubmit: + aSmsHeader.Submit().SetStatusReportRequest(deliveryReport); + break; + case CSmsPDU::ESmsCommand: + aSmsHeader.Command().SetStatusReportRequest(deliveryReport); + break; + default: + User::Leave(KErrNotSupported); + } +#endif + } + } + } +/** + Sets the fields for the sms account settings using data read from the ini file + If no data is given in ini file, the default settings in the account is used. + @param aSmsSettings - CSmsSettings reference +*/ +void CTestMessCreateGsmSmsUtil::SetSmsAccountSettings(CSmsSettings &aSmsSettings) + { + iTestStep.INFO_PRINTF1(_L("Set SMS account Settings....")); + TBool boolTemp; + + // Set the Reply quoted setting. + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KReplyQuoted, boolTemp) ) + { + aSmsSettings.SetReplyQuoted(boolTemp); + } + + // Set the Reject duplicate settings. + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KRejectDuplicate, boolTemp) ) + { +#if (defined CDMA_API_ENABLED) + aSmsSettings.MessageSettings().Gsm().SetRejectDuplicate(boolTemp); +#else + aSmsSettings.SetRejectDuplicate(boolTemp); +#endif + } + + // Set the option for delivery report. + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KDeliveryReport, boolTemp) ) + { + aSmsSettings.SetDeliveryReport(boolTemp); + } + + // Set the concatenate feature + if ( iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KConCatenate, boolTemp) ) + { +#if (defined CDMA_API_ENABLED) + aSmsSettings.MessageSettings().Gsm().SetCanConcatenate(boolTemp); +#else + aSmsSettings.SetCanConcatenate(boolTemp); +#endif + } + + // Set whether to use the same path while replying. + if(iTestStep.GetBoolFromConfig(iTestStep.ConfigSection(), KReplyPath, boolTemp)) + { +#if (defined CDMA_API_ENABLED) + aSmsSettings.MessageSettings().Gsm().SetReplyPath(boolTemp); +#else + aSmsSettings.SetReplyPath(boolTemp); +#endif + } + + //can implement these features later... + aSmsSettings.SetValidityPeriod(ESmsVPWeek); // week + aSmsSettings.SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFInteger); //relative + aSmsSettings.SetDelivery(ESmsDeliveryImmediately); + aSmsSettings.SetMessageConversion(ESmsConvPIDNone); + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessCreateSMS.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessCreateSMS.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,417 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCreateSMS. This class creates the sms message +// for GSM or CDMA. For CDMA mtm, it uses utility classes to create +// the respective GSM or CDMA sms message +// +// + +#include "Configuration.cfg" + +#include "TestMessCreateSMS.h" +#include "TestMessEditEntryUtil.h" + +//Usage of macros of Cdma mtm +#include "TestMessCreateGsmSmsUtil.h" +#if (defined CDMA_API_ENABLED) +#include "TestMessCreateCdmaSmsUtil.h" +#endif + +// EPOC includes +#include +#include +#include +#include +#include //For CSmsMessageSettings + +/*@{*/ +// Literal constants read from the ini file +_LIT(KRecipients, "recipients"); +_LIT(KTo, "to%d"); +_LIT(KPtSaveDraft, "SaveInDraft"); +_LIT(KDefTo, "smsto"); + +_LIT(KPtMsgBearerGsm, "GSM"); +//Usage of macros for Cdma mtm +#if (defined CDMA_API_ENABLED) +_LIT(KPtMsgBearerType, "MessageBearerType"); +_LIT(KPtMsgBearerCdma, "CDMA"); +#endif +/*@}*/ + +#if (defined CDMA_API_ENABLED) +#define KPtDefaultCount 1 +#endif + +CTestMessCreateSMS::CTestMessCreateSMS() +: CTestMessBase(EFalse) +, iSimInDatabase(EFalse) + { + SetTestStepName(_L("CreateSms")); + } + +/** + Creates the SMS message for GSM or CDMA. + @return TVerdict +*/ + +TVerdict CTestMessCreateSMS::doTestStepPreambleL() + { + TVerdict ret=CTestMessBase::doTestStepPreambleL(); + // IMK iSimInDatabase=(GetPhoneSmsNumberL(iSimPhoneNumber)==KErrNone); + iSimInDatabase=false; //IMK (GetPhoneSmsNumberL(iSimPhoneNumber)==KErrNone); + return ret; + } + +/** + Creates the SMS message for GSM or CDMA. + @return TVerdict +*/ +TVerdict CTestMessCreateSMS::doTestStepL() + { + // Get scheduling data + TTimeIntervalMinutes scheduledTime=ReadScheduleTime(); + + //create the message + TBool saveDraft = EFalse; + GetBoolFromConfig(ConfigSection(), KPtSaveDraft, saveDraft); + + if ( saveDraft ) + { + //Create the message in Draft + CreateSmsL(KMsvDraftEntryId, scheduledTime); + } + else + { + //Creates the message in Outbox + CreateSmsL(KMsvGlobalOutBoxIndexEntryId, scheduledTime); + } + + return TestStepResult(); + } + +void CTestMessCreateSMS::CreateSmsL(const TMsvId aMsvId, TTimeIntervalMinutes aScheduledTime) + { + // Get the bearertype (CDMA/GSM) + TPtrC messageBearerType; + messageBearerType.Set(KPtMsgBearerGsm); +#if (defined CDMA_API_ENABLED) + GetStringFromConfig(ConfigSection(), KPtMsgBearerType, messageBearerType); + INFO_PRINTF2(_L("The message bearertype is : %S"), &messageBearerType); +#endif + + CTestMessCreateSmsUtilBase* createSmsUtil = NULL; + // Create the repective util class + if ( messageBearerType.Compare(KPtMsgBearerGsm)==0 ) + { + createSmsUtil=new (ELeave) CTestMessCreateGsmSmsUtil(*this); + } +#if (defined CDMA_API_ENABLED) + else if ( messageBearerType.Compare(KPtMsgBearerCdma)==0 ) + { + createSmsUtil=new (ELeave) CTestMessCreateCdmaSmsUtil(*this); + } +#endif + else + { + WARN_PRINTF1(_L("Unknown bearer type using Gsm")); + createSmsUtil=new (ELeave) CTestMessCreateGsmSmsUtil(*this); + } + CleanupStack::PushL(createSmsUtil); + +// All references to PrepareAccountL can be removed when DEF054045 is fixed +// createSmsUtil->PrepareAccountL(*iSession); + + if(!iBodyAvailable) + { + ERR_PRINTF1(_L("No Body")); + SetTestStepResult(EFail); + } + + if ( TestStepResult()==EPass ) + { + TInt err=KErrNone; + RSendAs sendAsServer; + User::LeaveIfError(sendAsServer.Connect()); + CleanupClosePushL(sendAsServer); + AddMtmCapabilitiesL(sendAsServer); + + RSendAsMessage sendAs; + TRAP(err, sendAs.CreateL(sendAsServer, KUidMsgTypeSMS)); + PrepareSendAsL(sendAs); + + if ( err!=KErrNone ) + { + SetTestStepError(err); + } + else + { + INFO_PRINTF1(_L("sendAs.SetBodyTextL")); + sendAs.SetBodyTextL(*iBodyText); + +#if (!defined CDMA_API_ENABLED) + TInt recipients=1; + GetIntFromConfig(ConfigSection(), KRecipients, recipients); + + TPtrC to(iSimPhoneNumber.iTelNumber); + TBool returnValue=ETrue; + for ( TInt recipient=0; (recipient tempStore; + tempStore.Format(KTo(), recipient); + returnValue=GetStringFromConfig(ConfigSection(), tempStore, to); + if ( !returnValue ) + { + returnValue=GetStringFromConfig(KDef, KDefTo, to); + } + } + if ( !returnValue ) + { + ERR_PRINTF1(_L("No To")); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("To = %S"), &to); + sendAs.AddRecipientL(to, RSendAsMessage::ESendAsRecipientTo); + } + } +#endif + + TRAP(err, sendAs.SaveMessageAndCloseL()); + if ( err!=KErrNone ) + { + ERR_PRINTF1(_L("Save Message Failiure")); + SetTestStepResult(EFail); + sendAs.Close(); + } + else + { + TMsvId messageId=KMsvNullIndexEntryId; + CMsvEntry* parent=iSession->GetEntryL(KMsvDraftEntryIdValue); + CleanupStack::PushL(parent); + parent->SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=parent->ChildrenL(); + CleanupStack::PushL(selection); + + if ( selection->Count()>0 ) + { + messageId=selection->At(0); + } + if ( messageId!=KMsvNullIndexEntryId ) + { + SetEntryL(messageId); + TMsvEntry child=EntryL().Entry(); + + //Get the message header + CSmsHeader* smsHeader = createSmsUtil->NewHeaderL(*iBodyText); + CleanupStack::PushL(smsHeader); + + //If message is too big lets concatenate..... + ConCatMessageTextL(*smsHeader); + + CMsvStore* store =NULL; + TRAPD(error, store = EntryL().EditStoreL()); + if(error != KErrNone) + { + ERR_PRINTF2(_L("Edit Store Failed. Error %d"), error); + SetTestStepError(error); + } + else + { + CleanupStack::PushL(store); + smsHeader->RestoreL(*store); +#if (defined CDMA_API_ENABLED) + //Adding the recipients... + CArrayPtrFlat& recips = smsHeader->Recipients(); + + TInt recipients=KPtDefaultCount; + GetIntFromConfig(ConfigSection(), KRecipients, recipients); + + TBool returnValue; + for ( TInt recipient=1; recipient<=recipients; recipient++) + { + TBuf tempStore; + + tempStore.Format(KTo(), recipient); + + TPtrC to; + returnValue=GetStringFromConfig(ConfigSection(), tempStore, to); + if ( !returnValue ) + { + returnValue=GetStringFromConfig(KDef, KDefTo, to); + } + if ( !returnValue ) + { + ERR_PRINTF1(_L("No To")); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("To = %S"), &to); + + //Get the recipient array + CSmsNumber* newRecip = CSmsNumber::NewL(); + CleanupStack::PushL(newRecip); + + // Check for the email address in recipient + // This is for email over sms feature + if(to.Locate('@') != KErrNotFound) + { + newRecip->SetAddressL(to, EMsvAddressTypeEMail); + } + else + { + newRecip->SetAddressL(to, EMsvAddressTypeISDN); + } + + //Append the recipients + recips.AppendL(newRecip); + CleanupStack::Pop(newRecip); + } + } +#endif + child.SetSendingState(KMsvSendStateSuspended); + child.SetInPreparation(EFalse); + child.SetVisible(ETrue); + + //Get the details + TBuf details; + +//Usage of macros of Cdma mtm +#if (!defined CDMA_API_ENABLED) + if ( TSmsUtilities::GetDetails(EntryL().Session().FileSession(), smsHeader->Message(), details) == KErrNone ) + { + child.iDetails.Set(details); + } +#else + //if ( TSmsUtilities::GetDetails(EntryL().Session().FileSession(), smsHeader->Message(), details) == KErrNone ) + CArrayPtrFlat& smsNumberArray = smsHeader->Recipients(); + if ( smsNumberArray.Count() ) + { + details.Copy(smsNumberArray[0]->Address()); + } + if ( details.Length() ) + { + child.iDetails.Set(details); + } +#endif + + //Get the description + TBuf desc; + if ( TSmsUtilities::GetDescription(smsHeader->Message(), desc) == KErrNone ) + { + child.iDescription.Set(desc); + } + + //fill up the fields of the message header + PrepareHeaderL(*createSmsUtil, *smsHeader); + + //set the scheduled time if any + if ( aScheduledTime!=TTimeIntervalMinutes(0) ) + { + child.SetSendingState(KMsvSendStateScheduled); + child.SetScheduled(ETrue); + child.iDate.UniversalTime(); + child.iDate+=aScheduledTime; + } + + // Update entry with data set from .ini file + EntryL().ChangeL(child); + smsHeader->StoreL(*store); + store->CommitL(); + CleanupStack::PopAndDestroy(store); + + CTestMessEditEntryUtil* editUtil=new (ELeave) CTestMessEditEntryUtil(*this, ETrue, iSimInDatabase, iSimPhoneNumber); + CleanupStack::PushL(editUtil); + editUtil->ProcessEntryL(EntryL().EntryId()); + CleanupStack::PopAndDestroy(editUtil); + + if ( aMsvId==KMsvGlobalOutBoxIndexEntryId ) + { + // Move the selected message to out box + CTestActive* active=CTestActive::NewLC(*this); + CMsvOperation* op=parent->MoveL(child.Id(), KMsvGlobalOutBoxIndexEntryIdValue, active->iStatus); + CleanupStack::PushL(op); + active->Activate(); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy(2, active); + } + } + CleanupStack::PopAndDestroy(smsHeader); + } + CleanupStack::PopAndDestroy(2, parent); + } + } + + CleanupStack::PopAndDestroy(&sendAsServer); + } + CleanupStack::PopAndDestroy(createSmsUtil); + } + +void CTestMessCreateSMS::AddMtmCapabilitiesL(RSendAs& aSendAs) + { + aSendAs.ResetMessageFilter(); + } + +void CTestMessCreateSMS::PrepareSendAsL(RSendAsMessage& /*aSendAs*/) + { + } + +void CTestMessCreateSMS::PrepareHeaderL(CTestMessCreateSmsUtilBase& aCreateUtil, CSmsHeader& aSmsHeader) + { + aCreateUtil.PrepareHeaderL(aSmsHeader); + } + +//Usage of macro for CDMA mtm +#if (defined CDMA_API_ENABLED) +void CTestMessCreateSMS::ConCatMessageTextL(CSmsHeader& /*aHeader*/) + { + } +#else +void CTestMessCreateSMS::ConCatMessageTextL(CSmsHeader& aHeader) + //Doxygen compatible comments + /** + This method Concatenates the long message. Checks for the length of + body, if it is greater than 160 characters sets the concatenation + option on for the Sms. + + @param aHeader + Header for which the concatenation option is set on... + + */ + { + CSmsSettings* smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + //if the length of the iBodyText is greater than the sms maximum length + //i.e 160 chars...Set the Concatenation On.... + if( aHeader.Message().MessageLengthL() > aHeader.Message().MaxMessageLength() ) + { + INFO_PRINTF1(_L("Concatenate Message...")); + INFO_PRINTF1(_L("Message Exceeds max length setting Concatenate On...")); + aHeader.GetSmsSettingsL(*smsSettings); + smsSettings->SetCanConcatenate(ETrue); + aHeader.SetSmsSettingsL(*smsSettings); + } + CleanupStack::PopAndDestroy(smsSettings); + } +#endif diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessCreateSMSaccount.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessCreateSMSaccount.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,154 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessCreateSmsAccount which creates an SMS +// account folder for GSM or CDMA +// +// + +#include "TestMessCreateSmsAccount.h" +#include "TestMess.h" +#include "Configuration.cfg" + +// EPOC includes +#include +#include +#include + +#include "TestMessCreateGsmSmsUtil.h" +//Usage of Macro for CDMA mtm +#if (defined CDMA_API_ENABLED) +#include "TestMessCreateCdmaSmsUtil.h" +#endif + +#include +#include +#include +#include +#include + +/*@{*/ +_LIT(KSCName, "scname"); +_LIT(KSCNumber, "scnumber"); + +_LIT(KPtGSM, "GSM"); +#if (defined CDMA_API_ENABLED) +_LIT(KPtMessageBearerType, "MessageBearerType"); +_LIT(KPtCDMA, "CDMA"); +#endif +/*@}*/ + +CTestMessCreateSmsAccount::CTestMessCreateSmsAccount() +: CTestMessBase(EFalse) + { + SetTestStepName(_L("CreateSmsAccount")); + } + +/** + Creates the SMS account folder for GSM or CDMA. For CDMA mtm, + it creates the respective utility class for creating the account + @return TVerdict +*/ +TVerdict CTestMessCreateSmsAccount::doTestStepL() + { + // Printing to the console and log file + INFO_PRINTF1(_L("Create SMS account")); + + TPtrC ptrSCName; + TBool returnValue =GetStringFromConfig(ConfigSection(), KSCName, ptrSCName); + INFO_PRINTF2(_L("SC Name = %S"), &ptrSCName); + + TPtrC ptrSCNumber; + returnValue =GetStringFromConfig(ConfigSection(), KSCNumber, ptrSCNumber); + INFO_PRINTF2(_L("SC Number = %S"), &ptrSCNumber); + + CSmsAccount* smsAccount = CSmsAccount::NewLC(); + CMsvScheduleSettings* scheduleSetting = CMsvScheduleSettings::NewLC(); + CMsvOffPeakTimes* offPeakTimes=new (ELeave) CMsvOffPeakTimes(); + CleanupStack::PushL(offPeakTimes); + CMsvSendErrorActions* errorActions=CMsvSendErrorActions::NewLC(); + CMsvSysAgentActions* sysAgentActions=new (ELeave) CMsvSysAgentActions(); + CleanupStack::PushL(sysAgentActions); + CSmsSettings* smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + SetEntryL(KMsvRootIndexEntryId); + + EntryL().SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=EntryL().ChildrenWithTypeL(KUidMsvServiceEntry); + CleanupStack::PushL(selection); + TInt count=selection->Count(); + TBool found=EFalse; + for (TInt i=count; i>0 && !found; ) + { + SetEntryL(selection->At(--i)); + + // Only one Sms Service allowed + if ( EntryL().Entry().iMtm == KUidMsgTypeSMS && + EntryL().Entry().iType == KUidMsvServiceEntry + ) + { + found=ETrue; + } + } + + if ( !found ) + { + smsAccount->InitialiseDefaultSettingsL(*smsSettings); + smsAccount->InitialiseDefaultSettingsL(*scheduleSetting, *offPeakTimes, *errorActions, *sysAgentActions); + + TPtrC messageBearerType; + messageBearerType.Set(KPtGSM); +#if (defined CDMA_API_ENABLED) + GetStringFromConfig(ConfigSection(), KPtMessageBearerType, messageBearerType); + INFO_PRINTF2(_L("The message bearer type is : %S"), &messageBearerType); +#endif + + CTestMessCreateSmsUtilBase* createSmsUtil = NULL; + //Creates the util class for GSM or CDMA + if ( messageBearerType.Compare(KPtGSM)==0 ) + { + createSmsUtil = new (ELeave) CTestMessCreateGsmSmsUtil(*this); + } +#if (defined CDMA_API_ENABLED) + else if( messageBearerType.Compare(KPtCDMA)==0 ) + { + createSmsUtil = new (ELeave) CTestMessCreateCdmaSmsUtil(*this); + } +#endif + else + { + WARN_PRINTF1(_L("Unknown bearer type using Gsm")); + createSmsUtil= new (ELeave) CTestMessCreateGsmSmsUtil(*this); + } + CleanupStack::PushL(createSmsUtil); + + //Changes the new account settings + createSmsUtil->SetSmsAccountSettings(*smsSettings); + CleanupStack::PopAndDestroy(createSmsUtil); + + smsAccount->SaveSettingsL(*smsSettings); + smsAccount->SaveSettingsL(*scheduleSetting, *offPeakTimes, *errorActions, *sysAgentActions); + } + + if ( TestStepResult()==EPass ) + { + smsAccount->LoadSettingsL(*smsSettings); + smsSettings->AddServiceCenterL(ptrSCName, ptrSCNumber); + smsAccount->SaveSettingsL(*smsSettings); + } + + CleanupStack::PopAndDestroy(2, smsSettings); + CleanupStack::PopAndDestroy(5, smsAccount); + + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessCreateSmsUtilBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessCreateSmsUtilBase.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,27 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 is the base class for create CDMA or GSM SMS utility class +// +// + + +#include "TestMessCreateSmsUtilBase.h" + +/** + Constructor +*/ +CTestMessCreateSmsUtilBase::CTestMessCreateSmsUtilBase(CTestMessBase &aTestStep) +: iTestStep(aTestStep) + { + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessEditEntry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessEditEntry.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,170 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntry which edits the entry characterstics +// +// + +#include "TestMessEditEntry.h" +#include "TestMessEditEntryUtil.h" + +/** + * @name Constant Literals used. + */ +/*@{*/ +_LIT(KPtSaveToOutbox, "SaveToOutbox"); +/*@}*/ + +// Default value for depth of the count +#define KDefaultDepthCount 1 + +/** + * Override of base class pure virtual + * @param None + * @return TVerdict - return TVerdict codes + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessEditEntry::ProcessMessageL(CBaseMtm& /*aBaseMtm*/, TMsvId /*aMsgId*/) + { + // Printing to the console and log file + INFO_PRINTF1(_L("Edit Entry")); + + if ( TestStepResult() == EPass ) + { + CTestMessEditEntryUtil* editUtil=new (ELeave) CTestMessEditEntryUtil(*this, EFalse, EFalse, RMobilePhone::TMobileAddress()); + CleanupStack::PushL(editUtil); + + editUtil->ProcessEntryL(EntryL().EntryId()); + + //Read whether the message is saved in outbox + TBool saveOutbox; + if( ! GetBoolFromConfig(ConfigSection(), KPtSaveToOutbox, saveOutbox)) + { + saveOutbox = EFalse; + } + + INFO_PRINTF2(_L("The message saved in outbox flag is : %S"), &saveOutbox); + if(saveOutbox) + { + //Move the message to outbox + MoveMessageL(EntryL().EntryId(), KMsvGlobalOutBoxIndexEntryId); + } + else + { + INFO_PRINTF1(_L("Entry is not moved")); + } + + CleanupStack::PopAndDestroy(editUtil); + } + } + +/** + Move the message the destination folder + @param aMessageId - TMsvId of the message + @param aFolderId - TMsvId of the destination folder + @leave KErrNoMemory + @leave KErrNotFound +*/ +void CTestMessEditEntry::MoveMessageL(TMsvId aMessageId,TMsvId aFolderId) + { + // Get CMsvEntry object and the TMsvEntry of the message + CMsvEntry* msgvEntry = iSession->GetEntryL(aMessageId); + CleanupStack::PushL(msgvEntry); + TMsvEntry entry= msgvEntry->Entry(); + + // Get the parent folder Id of the messaage and create the CMsvEntry + TMsvId parentId = entry.Parent(); + CMsvEntry* msvEntry = iSession->GetEntryL(parentId); + CleanupStack::PushL(msvEntry); + + // Create the active object for handling asynchronous request + CMoveOperation* activeOperation = CMoveOperation::NewL(); + CleanupStack::PushL(activeOperation); + + // Move the selected message to given target folder + CMsvOperation* op = msvEntry->MoveL(aMessageId, aFolderId, activeOperation->iStatus); + CleanupStack::PushL(op); + + // Start the Active scheduler + activeOperation->SetOperation(); + CActiveScheduler::Start(); + TInt error = activeOperation->iStatus.Int(); + if(error == KErrNone) + { + INFO_PRINTF1(_L("message moved successfully")); + } + else + { + INFO_PRINTF2(_L("message failed to be moved. Error : %d"),error); + SetTestStepResult(EFail); + } + //Destroy the object + CleanupStack::PopAndDestroy(4, msgvEntry); + } + +/** + Constructor for CMoveOperation +*/ +CTestMessEditEntry::CMoveOperation::CMoveOperation() +: CActive(CActive::EPriorityStandard) + { + } + +/** + Two phase constructor + @return CTestMessEditEntry::CMoveOperation* - pointer of CTestMessEditEntry::CMoveOperation + @leave - KErrNoMemory + @leave - System wide error codes +*/ +CTestMessEditEntry::CMoveOperation* CTestMessEditEntry::CMoveOperation::NewL() + { + CMoveOperation* self = new (ELeave) CMoveOperation(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + Second phase construction + @leave - sytem wide error codes +*/ +void CTestMessEditEntry::CMoveOperation::ConstructL() + { + CActiveScheduler::Add(this); + } + +/** + Sets the operation as active +*/ +void CTestMessEditEntry::CMoveOperation::SetOperation() + { + SetActive(); + } + +/** + Operation completed event handler. +*/ +void CTestMessEditEntry::CMoveOperation::RunL() + { + CActiveScheduler::Stop(); + } + +/** + Cancels the active operation +*/ +void CTestMessEditEntry::CMoveOperation::DoCancel() + { + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessEditEntryUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessEditEntryUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,249 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntryUtil. A utility to edit an entry +// +// + + +#include "TestMessEditEntryUtil.h" + +// EPOC includes + +#include +#include +#include + +/** + * @name Constant Literals used. + */ +/*@{*/ +_LIT(KToRecipients, "toRecipients"); +_LIT(KTo, "to%d"); +_LIT(KDef, "default"); +_LIT(KDefTo, "emailto"); + +// Literal constants used +_LIT(KCharacterSetType, "characterSetType"); +_LIT(KPtEditBody, "EditBody"); +_LIT(KPtEditRecipients, "EditRecipients"); +_LIT(KPtRecipient, "recipient%d"); +/*@}*/ + +CTestMessEditEntryUtil::CTestMessEditEntryUtil(CTestMessBase& aTestStep, TBool aSimChecked, TBool aSimInDatabase, RMobilePhone::TMobileAddress aSimPhoneNumber) +: CTestMessStoreProcessUtil(aTestStep, EFalse) +, iSimChecked(aSimChecked) +, iSimInDatabase(aSimInDatabase) +, iSimPhoneNumber(aSimPhoneNumber) + { + } + +/** + * Edits the ImHeaders of the Entry + * @param CImHeader& aHeader - Im Header to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessEditEntryUtil::ProcessImHeaderL(CImHeader& aHeader) + { + // Edit the CImHeader information + TInt recipients; + if ( !iTestStep.GetIntFromConfig(iTestStep.ConfigSection(), KToRecipients, recipients) ) + { + recipients=0; + } + + for ( TInt recipient=1; recipient<=recipients; recipient++) + { + TBuf tempStore; + tempStore.Format(KTo(), recipient); + + TPtrC to; + TInt returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), tempStore, to); + if ( !returnValue ) + { + returnValue=iTestStep.GetStringFromConfig(KDef, KDefTo, to); + } + if ( !returnValue ) + { + iTestStep.ERR_PRINTF1(_L("No To")); + iTestStep.SetTestStepResult(EFail); + } + else + { + iTestStep.INFO_PRINTF2(_L("To = %S"), &to); + aHeader.ToRecipients().AppendL(to); + } + } + } + +/** + * Edits the ImMimeHeaders of the message entry + * @param CImMimeHeader& aHeader - Mime Header to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessEditEntryUtil::ProcessImMimeHeaderL(CImMimeHeader& aHeader) + { + // Update the character set info + TPtrC charSetType; + if ( iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KCharacterSetType, charSetType) ) + { + TUint charSetVal; + if ( ValidCharacterSetInfo(charSetType, charSetVal) ) + { + aHeader.SetMimeCharset(charSetVal); + } + } + } + +/** + * Edits the ImIAPPreferences of the entry + * @param CImIAPPreferences& aPreferences - IAP Preferences to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessEditEntryUtil::ProcessInternetAccessPreferencesL(CImIAPPreferences& /*aPreferences*/) + { + } + +/** + Edits the CSmsHeader of the entry + @param CSmsHeader& aHeader - Sms Header to edit + @return None + @panic None + @leave KErrNoMemory +*/ +void CTestMessEditEntryUtil::ProcessSmsHeaderStreamL(CSmsHeader& aSmsHeader) + { + // Get the number of recipients + TInt recipients = 0; + if ( !iTestStep.GetIntFromConfig(iTestStep.ConfigSection(), KPtEditRecipients, recipients) ) + { + recipients=0; + iTestStep.INFO_PRINTF1(_L("No Recipients edited/added")); + } + iTestStep.INFO_PRINTF2(_L("The number of recipients : %d"), recipients); + + if ( !iSimChecked ) + { + //IMK iSimInDatabase=(iTestStep.GetPhoneSmsNumberL(iSimPhoneNumber)==KErrNone); + iSimInDatabase=0; + } + TPtrC to(iSimPhoneNumber.iTelNumber); + TInt returnValue=ETrue; + for ( TInt recipient=0; (recipient tempStore; + tempStore.Format(KPtRecipient(), recipient); + + //Get the recipient address + returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), tempStore, to); + if ( !returnValue ) + { + returnValue=iTestStep.GetStringFromConfig(KDef, KDefTo, to); + } + } + if ( !returnValue ) + { + iTestStep.ERR_PRINTF1(_L("Recipient number is not Provided")); + iTestStep.SetTestStepResult(EFail); + } + else + { + //Append the recipient address in recipient list + CSmsNumber* smsNumber = CSmsNumber::NewL(); + CleanupStack::PushL(smsNumber); + iTestStep.INFO_PRINTF2(_L("To = %S"), &to); + smsNumber->SetAddressL(to); + aSmsHeader.Recipients().AppendL(smsNumber); + //No need to destory CSmsNumber. CSmsHeader destroys it + CleanupStack::Pop(smsNumber); + } + } + } + + +/** + Edits the CRichText of the entry + @param CRichText& aBodyText - Text to edit + @return None + @panic None + @leave KErrNoMemory +*/ +void CTestMessEditEntryUtil::ProcessRichTextBodyL(CRichText& aBodyText) + { + TPtrC ptrBody; + //Get the body text file + TBool returnValue=iTestStep.GetStringFromConfig(iTestStep.ConfigSection(), KPtEditBody, ptrBody); + if ( !returnValue ) + { + iTestStep.INFO_PRINTF1(_L("Body is not edited")); + } + else + { + iTestStep.INFO_PRINTF2(_L("Body = %S"), &ptrBody); + + // open the file + RFs rfs; + rfs.Connect(); + RFile file; + + //Append the body text of the entry + TInt anError = file.Open(rfs, ptrBody, EFileShareAny); + if(anError == KErrNone) + { + TBool reading=ETrue; + TInt pos = aBodyText.LdDocumentLength(); + TBuf8<1> charIn; + while (reading) + { + file.Read(charIn, 1); + if(charIn.Length()) + switch ( charIn[0] ) + { + case '\r': + aBodyText.InsertL(pos++, CEditableText::ELineBreak); + case '\n': + break; + default: + aBodyText.InsertL(pos++, TChar(charIn[0])); + } + else + { + reading = FALSE; // stop at the end of the file + } + } + file.Close(); + rfs.Close(); + } + else + { + iTestStep.ERR_PRINTF2(_L("Cannot open file = %S"), &ptrBody); + iTestStep.SetTestStepResult(EFail); + } + } + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessPrintEntryUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessPrintEntryUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,117 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessEditEntryUtil. A utility to edit an entry +// +// + +#include "Configuration.cfg" + +#include "TestMessPrintEntryUtil.h" + +CTestMessPrintEntryUtil::CTestMessPrintEntryUtil(CTestMessBase& aTestStep) +: CTestMessStoreProcessUtil(aTestStep, ETrue) + { + } + +/** + * Prints the ImHeaders of the Entry + * @param CImHeader& aHeader - Im Header to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessPrintEntryUtil::ProcessImHeaderL(CImHeader& aHeader) + { + TPtrC ptrTemp; + + ptrTemp.Set(aHeader.From()); + iTestStep.INFO_PRINTF2(_L(" From : %S"), &ptrTemp); + ptrTemp.Set(aHeader.ReceiptAddress()); + iTestStep.INFO_PRINTF2(_L(" ReceiptAddress : %S"), &ptrTemp); + ptrTemp.Set(aHeader.ReplyTo()); + iTestStep.INFO_PRINTF2(_L(" ReplyTo : %S"), &ptrTemp); + ptrTemp.Set(aHeader.Subject()); + iTestStep.INFO_PRINTF2(_L(" Subject : %S"), &ptrTemp); + } + +/** + * Prints the ImMimeHeaders of the message entry + * @param CImMimeHeader& aHeader - Mime Header to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessPrintEntryUtil::ProcessImMimeHeaderL(CImMimeHeader& /*aHeader*/) + { + } + +/** + * Prints the ImIAPPreferences of the entry + * @param CImIAPPreferences& aPreferences - IAP Preferences to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessPrintEntryUtil::ProcessInternetAccessPreferencesL(CImIAPPreferences& aPreferences) + { + TInt prefs=aPreferences.NumberOfIAPs(); + for ( TInt pref=0; prefReplyPath(); + CleanupStack::PopAndDestroy(smsSettings); +#else + CSmsPDU::TSmsPDUType pduType=aHeader.Type(); + TBool replyPath = aHeader.ReplyPathProvided(); +#endif + iTestStep.INFO_PRINTF2(_L(" pduType : %d"), pduType); + iTestStep.INFO_PRINTF2(_L(" replyPathProvided : %d"), replyPath); + } + + +/** + * Prints the CRichText of the entry + * @param CRichText& aBodyText - Text to edit + * @return None + * @panic None + * @leave KErrNoMemory + * +*/ +void CTestMessPrintEntryUtil::ProcessRichTextBodyL(CRichText& /*aBodyText*/) + { + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessProcessExistingMsg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessProcessExistingMsg.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,89 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessProcessExistingMsg +// Base class for processing an existing message +// +// + +/** + @file TestMessProcessExistingMsg.cpp +*/ + +#include "TestMessProcessExistingMsg.h" + +// EPOC includes +#include +#include +#include +#include +#include + +/** + * Constructor. + * @return - None + * +*/ +CTestMessProcessExistingMsg::CTestMessProcessExistingMsg() +: CTestMessBase(ETrue) + { + } + +/** + * Override of base class pure virtual function + * @return - TVerdict code + * @leave - KErrNoMemory - memory allocatior failure + * @leave - KErrBadLibraryEntryPoint - Malformed MTM + * @leave - KErrNotFound - Not found the mtmUid and StepStepResult set to Fail + * +*/ +TVerdict CTestMessProcessExistingMsg::doTestStepL() + { + if ( TestStepResult() == EPass ) + { + CClientMtmRegistry* clientMtmRegistry=CClientMtmRegistry::NewL(*iSession); + CleanupStack::PushL(clientMtmRegistry); + + iMtmID=EntryL().Entry().iMtm; + + CBaseMtm* baseMtm=clientMtmRegistry->NewMtmL(iMtmID); + CleanupStack::PushL(baseMtm); + + // switch the context + TMsvId msgId=EntryL().EntryId(); + PrintEntryL(EntryL()); + baseMtm->SwitchCurrentEntryL(msgId); + baseMtm->LoadMessageL(); + + ProcessMessageL(*baseMtm, msgId); + + if ( TestStepResult() == EPass ) + { + PostProcessMessageL(); + } + + CleanupStack::PopAndDestroy(2, clientMtmRegistry); + } + + return TestStepResult(); + } + +/** + * Nothing done for open + * @return None + * @leave KErrNone and TestStepResult set to EFail + * +*/ +void CTestMessProcessExistingMsg::PostProcessMessageL() + { + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessProcessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessProcessor.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,288 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessProcessor which an active object utility +// used for send/recieving or any time consuming +// +// + +#include "TestMessProcessor.h" +#include "TestMessBase.h" + +CTestMessProcessor* CTestMessProcessor::NewL(CTestStep& aTestStep, CMsvSession& aSession) + { + CTestMessProcessor* self=new(ELeave) CTestMessProcessor(aTestStep, aSession); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CTestMessProcessor::CTestMessProcessor(CTestStep& aTestStep, CMsvSession& aSession) +: CActive(EPriorityStandard) +, iState(EStatePrepareToSendMsg) +, iTestStep(aTestStep) +, iSession(aSession) +, iEntry(NULL) +, iMsgId(KMsvRootIndexEntryId) +, iClient(NULL) +, iMsvOperation(NULL) +, iCancelSms(EFalse) + { + } + +CTestMessProcessor::~CTestMessProcessor() + { + delete iEntry; + iEntry=NULL; + delete iMsvOperation; + iMsvOperation=NULL; + } + +void CTestMessProcessor::ConstructL() + { + CActiveScheduler::Add(this); + } + +void CTestMessProcessor::DoCancel() + { + iTestStep.INFO_PRINTF1(_L("Cancel operation")); + iMsvOperation->Cancel(); + } + +void CTestMessProcessor::DisplayProgress() + { + // display the current progress + switch(iState) + { + case EStatePrepareToSendMsg: + { + TMsvLocalOperationProgress temp; + TPckgC progress(temp); + + progress.Set(iMsvOperation->ProgressL()); + iTestStep.INFO_PRINTF1(_L(" Progress")); + iTestStep.INFO_PRINTF2(_L(" Operation :%d"), progress().iType); + iTestStep.INFO_PRINTF2(_L(" Total Number Of Entries:%d"), progress().iTotalNumberOfEntries); + iTestStep.INFO_PRINTF2(_L(" Number Completed :%d"), progress().iNumberCompleted); + iTestStep.INFO_PRINTF2(_L(" Number Failed :%d"), progress().iNumberFailed); + iTestStep.INFO_PRINTF2(_L(" Number Remaining :%d"), progress().iNumberRemaining); + iTestStep.INFO_PRINTF2(_L(" Error :%d"), progress().iError); + iTestStep.INFO_PRINTF2(_L(" Id :%x"), progress().iId); + } + break; + case EStateRequest: + iClient->DisplayProgressL(EFalse, iMsvOperation); + break; + default: + break; + } + } + +void CTestMessProcessor::SendEmailMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient) + { + iMsgId=aMsgId; + iClient=aClient; + iState=EStatePrepareToSendMsg; + + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iMsgEntry=iEntry->Entry(); + iMsgEntry.SetSendingState(KMsvSendStateWaiting); + delete iMsvOperation; + iMsvOperation=NULL; + iMsvOperation=iEntry->ChangeL(iMsgEntry, iStatus); + SetActive(); + } + +/** + Sends the sms message. It sets the fields of the enty. + @param aMsgId - TMsvId of the message + @param aClient - Pointer to the MTestMessProcessClient + @param aCancelSms - Bool value for the Cancel sms flag +*/ +void CTestMessProcessor::SendSmsMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient, TBool aCancelSms) + { + iMsgId=aMsgId; + iClient=aClient; + iState=EStatePrepareToSendMsg; + iCancelSms = aCancelSms; + + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iMsgEntry=iEntry->Entry(); + iMsgEntry.SetConnected(ETrue); + iMsgEntry.SetFailed(EFalse); + iMsgEntry.SetSendingState(KMsvSendStateWaiting); + iMsgEntry.iError = KErrNone; + delete iMsvOperation; + iMsvOperation=NULL; + iMsvOperation=iEntry->ChangeL(iMsgEntry, iStatus); + SetActive(); + } + +void CTestMessProcessor::SendMmsMessageL(TMsvId aMsgId, MTestMessProcessorClient* aClient) + { + iMsgId=aMsgId; + iClient=aClient; + iState=EStatePrepareToSendMsg; + + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iMsgEntry=iEntry->Entry(); + iMsgEntry.SetSendingState(KMsvSendStateWaiting); + delete iMsvOperation; + iMsvOperation=NULL; + iMsvOperation=iEntry->ChangeL(iMsgEntry, iStatus); + SetActive(); + } + +void CTestMessProcessor::MtmRequestL(TMsvId aAccountId, MTestMessProcessorClient* aClient) + { + iMsgId=aAccountId; + iClient=aClient; + iState=EStateRequest; + + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iStatus = KRequestPending; + delete iMsvOperation; + iMsvOperation=NULL; + TRAPD(err, iMsvOperation=iClient->CreateOperationL(iStatus)); + if ( iTestStep.TestStepResult() == EPass && err==KErrNone ) + { + SetActive(); + } + } + +void CTestMessProcessor::RunL() + { + switch(iState) + { + case EStatePrepareToSendMsg: + switch (iStatus.Int()) + { + case KErrNone: + { + delete iMsvOperation; + iMsvOperation=NULL; + delete iEntry; + iEntry=NULL; + iEntry=iSession.GetEntryL(iMsgId); + iMsgEntry=iEntry->Entry(); + iMsgEntry.SetSendingState(KMsvSendStateWaiting); + iEntry->ChangeL(iMsgEntry); + if ( iMsgEntry.SendingState() == KMsvSendStateWaiting ) + { + iState=EStateRequest; + iStatus = KRequestPending; + TRAPD(err, iMsvOperation=iClient->CreateOperationL(iStatus)); + if ( iTestStep.TestStepResult() == EPass && err==KErrNone ) + { + SetActive(); + } + else + { + CActiveScheduler::Stop(); + } + } + else + { + iTestStep.ERR_PRINTF2(_L("Sending State not Waiting :%d"), iMsgEntry.SendingState()); + iTestStep.SetTestStepResult(EFail); + CActiveScheduler::Stop(); + } + } + break; + case KErrCancel: + { + if(iCancelSms) + { + iTestStep.INFO_PRINTF1(_L("Sending of the mesage Cancelled successfully")); + } + else + { + iTestStep.ERR_PRINTF2(_L("Message failed to Send, Error = %d"), iStatus.Int()); + iTestStep.SetTestStepResult(EFail); + } + CActiveScheduler::Stop(); + break; + } + default: + iTestStep.ERR_PRINTF2(_L("Unknown Event :%d"), iStatus.Int()); + iTestStep.SetTestStepResult(EFail); + CActiveScheduler::Stop(); + } + break; + case EStateRequest: + switch (iStatus.Int()) + { + case KErrNone: + { + TInt error=iClient->DisplayProgressL(ETrue, iMsvOperation); + if ( error != KErrNone ) + { + iTestStep.ERR_PRINTF2(_L("Progress Error:%d"), error); + iTestStep.SetTestStepResult(EFail); + } + delete iMsvOperation; + iMsvOperation=NULL; + + // Is there another operation + if ( iClient->MoreOperations() ) + { + iStatus = KRequestPending; + TRAPD(err, iMsvOperation=iClient->CreateOperationL(iStatus)); + if ( iTestStep.TestStepResult() == EPass && err==KErrNone ) + { + SetActive(); + } + else + { + CActiveScheduler::Stop(); + } + } + else + { + CActiveScheduler::Stop(); + } + } + break; + case KErrServerTerminated: + { + TInt error=iClient->DisplayProgressL(ETrue, iMsvOperation); + if ( error != KErrServerTerminated ) + { + iTestStep.ERR_PRINTF2(_L("Progress Error:%d"), error); + iTestStep.SetTestStepResult(EFail); + } + delete iMsvOperation; + iMsvOperation=NULL; + CActiveScheduler::Stop(); + } + default: + iTestStep.ERR_PRINTF2(_L("Unknown Event :%d"), iStatus.Int()); + iTestStep.SetTestStepResult(EFail); + CActiveScheduler::Stop(); + } + break; + default: + iTestStep.ERR_PRINTF1(_L("No handler found in CTestMessProcessor class")); + iTestStep.SetTestStepResult(EFail); + CActiveScheduler::Stop(); + } + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessServer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,192 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "TestMessServer.h" +#include "TestMessSession.h" +#include "TestMessCleanMessageFolder.h" +#include "TestMessCreateSmsAccount.h" +//IMK #include "TestMessCreatePopAccount.h" +//IMK #include "TestMessCreateImapAccount.h" +#include "TestMessSetDefaultSc.h" +//IMK #include "TestMessCreateBIO.h" +//IMK #include "TestMessCreateEmail.h" +//IMK #include "TestMessCreateBulkEmail.h" +//IMK #include "TestMessCreateEMS.h" +#include "TestMessCreateSMS.h" +//IMK #include "TestMessCreateBulkSMS.h" +//IMK #include "TestMessEntryCount.h" +//IMK #include "TestMessSendEmail.h" +//IMK #include "TestMessSendBulkEmail.h" +//IMK #include "TestMessSendSms.h" +//IMK #include "TestMessDeleteEmailImap.h" +//IMK #include "TestMessDeleteEmailPop.h" +//IMK #include "TestMessFullSyncImap.h" +//IMK #include "TestMessReceiveEmailImap.h" +//IMK #include "TestMessReceiveEmailPop.h" +//IMK #include "TestMessOpen.h" +//IMK #include "TestMessVerifyEntry.h" +//IMK #include "TestMessReply.h" +//IMK #include "TestMessForward.h" +//IMK #include "TestMessCompareMessages.h" +//IMK #include "TestMessSetSyncRateImap.h" +//IMK #include "TestMessDeleteSharedData.h" +#include "TestMessEditEntry.h" +//IMK #include "TestMessSaveEmailAttachments.h" +//IMK #include "TestMessDeleteFolder.h" +//IMK #include "TestMessCreateFolder.h" +//IMK #include "TestMessRenameFolder.h" +//IMK #include "TestMessMoveMessages.h" +//IMK #include "TestMessSearchMessage.h" +//IMK #include "TestMessDeleteMessages.h" +//IMK #include "TestMessScheduleSendSMS.h" +//IMK #include "TestMessCancelScheduledSMS.h" +//IMK #include "TestMessVerifyScheduleSMS.h" +//IMK #include "TestMessBackupStore.h" +//IMK #include "TestMessRestoreStore.h" +//IMK #include "TestMessReceiveHeadersEmailPop.h" +//IMK #if (defined _PLATTEST_CDMA_) +//IMK #include "TestMessCreateCancelSms.h" +//IMK #endif + + +// EPOC includes +#include +#include +#include +#include + +/** + * @name Constant Literals used. + */ +/*@{*/ +/*@}*/ + + +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().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTestMessServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTestMessServer::NewL()); + if ( err==KErrNone ) + { + // 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; + } +#if (defined TRAP_IGNORE) + TRAP_IGNORE(MainL()); +#else + TRAPD(err,MainL()); +#endif + delete cleanup; + __UHEAP_MARKEND; + return KErrNone; + } + + +CTestMessServer* CTestMessServer::NewL() + { + CTestMessServer* server=new(ELeave) CTestMessServer(); + CleanupStack::PushL(server); + RProcess handle = RProcess(); + TParsePtrC serverName(handle.FileName()); + server->ConstructL(serverName.Name()); + CleanupStack::Pop(); + return server; + } + +CTestMessServer::CTestMessServer() +: CTestServer() +, iSharedData(NULL) + { + } + +void CTestMessServer::ConstructL(const TDesC& aName) + { + CTestServer::ConstructL(aName); + iSharedData=CTestMessSharedData::NewL(); + } + +CTestMessServer::~CTestMessServer() + { + delete iSharedData; + iSharedData=NULL; + } + +CSession2* CTestMessServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const +/** + * @param RMessage - RMessage for the session open + * Secure version + */ + { + CTestSession* session = new (ELeave) CTestMessSession(iSharedData); + CONST_CAST(CTestMessServer*,this)->IncSessionCount(); + return session; + } + +// constructor for ESOCK test suite +// this creates all the ESOCK test steps and +// stores them inside CTestSuiteEsock +CTestStep* CTestMessServer::CreateTestStep(const TDesC& aStepName) + { + CTestMessBase* testStep = NULL; + + if(aStepName == _L("CleanMessageFolder")) + { + testStep = new CTestMessCleanMessageFolder(); + } + else if(aStepName == _L("CreateSms")) + { + testStep = new CTestMessCreateSMS(); + } + else if(aStepName == _L("CreateSmsAccount")) + { + testStep = new CTestMessCreateSmsAccount(); + } + else if(aStepName == _L("SetSmsSc")) + { + testStep = new CTestMessSetDefaultSc(); + } + return testStep; +} + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessSession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessSession.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,50 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "TestMessSession.h" + +CTestMessSession::CTestMessSession(CTestMessSharedData* aSharedData) +: CTestSession() +, iSharedData(aSharedData) + { + } + + +void CTestMessSession::ServiceL(const RMessage2& aMessage) + { + CTestSession::ServiceL(aMessage); + switch(aMessage.Function()) + { + case EOpenTestStep : + { + } + break; + case ERunTestStep : + { + iSharedData->DoProcessL(); + } + break; + case EAbortTestStep : + { + } + break; + case ECloseTestStep : + { + } + break; + default: + break; + } + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessSetDefaultSC.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessSetDefaultSC.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,122 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 TestMessSetDefaultSc which sets an SMS +// SC as default SC. +// +// + +#include "TestMessSetDefaultSC.h" + +// EPOC includes +#include +#include +#include +#include +#include +#include + +_LIT(KSCName, "scname"); + +CTestMessSetDefaultSc::CTestMessSetDefaultSc() +: CTestMessBase(EFalse) + { + SetTestStepName(_L("SetSmsSc")); + } + +TVerdict CTestMessSetDefaultSc::doTestStepL() + { + // Printing to the console and log file + INFO_PRINTF1(_L("Set Default Service Center")); + + CSmsSettings* smsSettings = CSmsSettings::NewL(); + CleanupStack::PushL(smsSettings); + SetEntryL(KMsvRootIndexEntryId); + + EntryL().SetSortTypeL(SelectionOrdering()); + CMsvEntrySelection* selection=EntryL().ChildrenWithTypeL(KUidMsvServiceEntry); + CleanupStack::PushL(selection); + TInt count=selection->Count(); + TBool found=EFalse; + for (TInt i=count; i>0 && !found; ) + { + SetEntryL(selection->At(--i)); + + // Log child + if ( EntryL().Entry().iMtm == KUidMsgTypeSMS && + EntryL().Entry().iType == KUidMsvServiceEntry + ) + { + found=ETrue; + } + } + + if ( !found ) + { + ERR_PRINTF1(_L("No SMS Account found")); + SetTestStepResult(EFail); + } + + TName network; +//IMK TBool returnValue=(GetPhoneSmsNetworkL(network)==KErrNone); +TBool returnValue=false; //IMK + TPtrC ptrSCName(network); + + if ( !returnValue ) + { + returnValue=GetStringFromConfig(ConfigSection(), KSCName, ptrSCName); + } + if ( !returnValue ) + { + ERR_PRINTF1(_L("No SC specified in script/ini file")); + SetTestStepResult(EFail); + } + + INFO_PRINTF2(_L("SC Name = %S"), &ptrSCName); + + if ( TestStepResult()==EPass ) + { + CSmsAccount* smsAccount = CSmsAccount::NewLC(); + smsAccount->LoadSettingsL(*smsSettings); + const TInt numSCAddr = smsSettings->ServiceCenterCount(); + + if( !numSCAddr ) + { + ERR_PRINTF1(_L("No SC found")); + SetTestStepResult(EFail); + } + + TBool scFound = EFalse; + for( TInt index=0; (indexGetServiceCenter(index); + if( (scAddr.Name()).CompareF(ptrSCName) == 0) + { + smsSettings->SetDefaultServiceCenter(index); + smsAccount->SaveSettingsL(*smsSettings); + scFound = ETrue; + } + } + + if ( !scFound ) + { + ERR_PRINTF2(_L("%S NOT Found"), &ptrSCName); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(smsAccount); + } + CleanupStack::PopAndDestroy(2, smsSettings); + + return TestStepResult(); + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessSharedData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessSharedData.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,276 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessSharedData +// +// + +#include "TestMessSharedData.h" + +#include +#include +#include +#include + +_LIT(KName, "name"); + +CTestMessSharedData* CTestMessSharedData::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. + */ + { + CTestMessSharedData* sharedData = new (ELeave) CTestMessSharedData(); + CleanupStack::PushL(sharedData); + sharedData->ConstructL(); + CleanupStack::Pop(sharedData); + return sharedData; + } + +CTestMessSharedData::CTestMessSharedData() +: CBase() +, iSession(NULL) +, iMtmRegistry(NULL) +, iList(NULL) +, iAnyPostStepToDo(NULL) +, iDeleteTestStep(EFalse) + { + } + +void CTestMessSharedData::ConstructL() + { + iSession=CMsvSession::OpenSyncL(*this); + iMtmRegistry=CClientMtmRegistry::NewL(*iSession); + } + +CTestMessSharedData::~CTestMessSharedData() + { + while ( iList != NULL ) + { + CMsgEntry* entry=iList; + iList=iList->iNext; + delete entry; + } + delete iMtmRegistry; + iMtmRegistry=NULL; + delete iSession; + iSession=NULL; + } + +void CTestMessSharedData::DoProcessL() + { + if ( iAnyPostStepToDo != NULL ) + { + if (iDeleteTestStep) + { + iAnyPostStepToDo->DoCancelProcessL(); + iDeleteTestStep=EFalse; + } + else + { + iAnyPostStepToDo->DoProcessL(*iMtmRegistry); + } + iAnyPostStepToDo=NULL; + } + } + +void CTestMessSharedData::IMAP4ConnectAndSyncCompleteAfterDisconnectL(TUid aMtmId, TMsvId aMsvId, CTestStep& aStep) + { + iList=CMsgIMAP4ConnectAndSyncComplete::NewL(aMtmId, aMsvId, aStep, iList); + iAnyPostStepToDo=iList; + } + +TInt CTestMessSharedData::DeleteEntryL(CTestStep& aStep) + { + TInt ret=KErrNone; + TPtrC name; + + if ( !aStep.GetStringFromConfig(aStep.ConfigSection(), KName, name) ) + { + aStep.ERR_PRINTF1(_L("Name not found")); + aStep.SetTestStepResult(EFail); + ret=KErrArgument; + } + else + { + aStep.INFO_PRINTF2(_L("Name : %S"), &name); + + CMsgEntry* msgParent=NULL; + CMsgEntry* msgEntry=iList; + TBool found=EFalse; + + while ( (msgEntry!=NULL) && !found ) + { + if ( msgEntry->iName.Compare(name) == 0 ) + { + if ( msgParent!=NULL ) + { + msgParent->iNext=msgEntry->iNext; + } + else + { + iList=msgEntry->iNext; + } + iDeleteTestStep=ETrue; + iAnyPostStepToDo=msgEntry; + found=ETrue; + } + else + { + msgParent=msgEntry; + msgEntry=msgEntry->iNext; + } + } + + if ( !found ) + { + aStep.ERR_PRINTF1(_L("Message Entry not found")); + aStep.SetTestStepResult(EFail); + ret=KErrNotFound; + } + } + + return ret; + } + +CTestMessSharedData::CMsgEntry::CMsgEntry(CMsgEntry* aList) +: CActive(EPriorityStandard) +, iNext(aList) +, iReadyToBeDeleted(EFalse) + { + } + +void CTestMessSharedData::CMsgEntry::ConstructL(CTestStep& aStep) + { + TPtrC name; + + // Read in name tag + if ( !aStep.GetStringFromConfig(aStep.ConfigSection(), KName, name) ) + { + aStep.ERR_PRINTF1(_L("Name not found")); + aStep.SetTestStepResult(EFail); + } + else + { + aStep.INFO_PRINTF2(_L("Name : %S"), &name); + iName.Copy(name); + } + } + +CTestMessSharedData::CMsgEntry::~CMsgEntry() + { + } + +void CTestMessSharedData::CMsgEntry::DoCancel() + { + } + +void CTestMessSharedData::CMsgEntry::RunL() + { + iReadyToBeDeleted=ETrue; + } + +CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete* CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::NewL(TUid aMtmId, TMsvId aMsvId, CTestStep& aStep, CMsgEntry* aList) + { + CMsgIMAP4ConnectAndSyncComplete* self= new (ELeave) CMsgIMAP4ConnectAndSyncComplete(aMtmId, aMsvId, aList); + CleanupStack::PushL(self); + self->ConstructL(aStep); + CleanupStack::Pop(self); + return self; + } + +CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::CMsgIMAP4ConnectAndSyncComplete(TUid aMtmId, TMsvId aMsvId, CMsgEntry* aList) +: CMsgEntry(aList) +, iMtmId(aMtmId) +, iMsvId(aMsvId) +, iBaseMtm(NULL) +, iOperation(NULL) + { + } + +CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::~CMsgIMAP4ConnectAndSyncComplete() + { + if ( iOperation != NULL ) + { + delete iOperation; + iOperation=NULL; + } + delete iBaseMtm; + iBaseMtm=NULL; + } + +void CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::RunL() + { + CMsgEntry::RunL(); + delete iOperation; + iOperation=NULL; + delete iBaseMtm; + iBaseMtm=NULL; + + } + +void CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::DoProcessL(CClientMtmRegistry& aMtmRegistry) + { + iBaseMtm=aMtmRegistry.NewMtmL(iMtmId); + CActiveScheduler::Add(this); + + iBaseMtm->SwitchCurrentEntryL(iMsvId); + CMsvEntrySelection* selection=new (ELeave) CMsvEntrySelection(); + CleanupStack::PushL(selection); + selection->Reset(); + selection->AppendL(iMsvId); + selection->AppendL(iMsvId); // remote inbox + + TPckg parameter(this); + iOperation=iBaseMtm->InvokeAsyncFunctionL(KIMAP4MTMConnectAndSyncCompleteAfterDisconnect, *selection, parameter, iStatus); + CleanupStack::PopAndDestroy(selection); + SetActive(); + } + +void CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::DoCancelProcessL() + { + if ( iOperation != NULL ) + { + iOperation->Cancel(); + } + } + +void CTestMessSharedData::CMsgIMAP4ConnectAndSyncComplete::HandleImapConnectionEvent(TImapConnectionEvent aConnectionEvent) + { + switch (aConnectionEvent) + { + /** Connecting to server. */ + case EConnectingToServer: + break; + /** Synchronising folder list. */ + case ESynchronisingFolderList: + break; + /** Synchronising inbox. */ + case ESynchronisingInbox: + break; + /** Synchronising folders. */ + case ESynchronisingFolders: + break; + /** Synchronisation complete. */ + case ESynchronisationComplete: + break; + /** Disconnecting. */ + case EDisconnecting: + break; + /** Connection completed. */ + case EConnectionCompleted: + break; + } + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessStoreProcessUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessStoreProcessUtil.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,256 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessStoreProcessUtil. Base class process what is in the message store +// +// + +/** + @file TestMessStoreProcessUtil.cpp +*/ + +#include "TestMessStoreProcessUtil.h" + +// EPOC include +#include + +/** + * @name Constant Literals used. + */ +/*@{*/ +// Literal constants used for the character set +_LIT(KChineseGB2312, "ChineseGB2312"); +_LIT(KChineseHz, "ChineseHz"); +_LIT(KChineseBig5, "ChineseBig5"); +/*@}*/ + +CTestMessStoreProcessUtil::CTestMessStoreProcessUtil(CTestMessBase& aTestStep, TBool aReadOnly) +: CBase() +, iTestStep(aTestStep) +, iReadOnly(aReadOnly) + { + } + +/** + * Process the message entry + * @param TMsvId aMsvId - Id of message to edit + * @return TInt - return TErrNone if all worked + * +*/ +TInt CTestMessStoreProcessUtil::ProcessEntryL(TMsvId aMsvId) + { + TInt ret=KErrNone; + CMsvEntry* msvEntry=iTestStep.Session().GetEntryL(aMsvId); + CleanupStack::PushL(msvEntry); + + if ( msvEntry->HasStoreL() ) + { + CMsvStore* store=NULL; + if ( iReadOnly ) + { + store=msvEntry->ReadStoreL(); + } + else + { + store=msvEntry->EditStoreL(); + } + CleanupStack::PushL(store); + + RArray ids; + ids.Append(KUidMsgFileIMailHeader); + ids.Append(KUidMsgFileMimeHeader); + ids.Append(KUidMsgFileInternetAccessPreferences); + ids.Append(KUidMsvSMSHeaderStream); + ids.Append(KUidMsvDefaultServices); + ids.Append(KMsvEntryRichTextBody); + for ( TUint uidIndex=ids.Count(); uidIndex>0; ) + { + TUid uid=ids[--uidIndex]; + + if ( store->IsPresentL(uid) ) + { + if ( uid==KUidMsgFileIMailHeader ) + { + // Process the CImHeader info + ProcessImHeaderL(*store); + } + else if ( uid==KUidMsgFileMimeHeader ) + { + // Process the CImMimeHeader info + ProcessImMimeHeaderL(*store); + } + else if ( uid==KUidMsgFileInternetAccessPreferences ) + { + } + else if ( uid==KUidMsvSMSHeaderStream ) + { + // Process the CSmsHeader info + ProcessSmsHeaderStreamL(*store); + } + else if ( uid==KUidMsvDefaultServices ) + { + } + else if ( uid==KMsvEntryRichTextBody ) + { + // Process the CRichText info + ProcessRichTextBodyL(*store); + } + else + { + iTestStep.INFO_PRINTF2(_L("Cannot process %x"), uid.iUid); + } + } + } + + // Commit to the store + if ( !iReadOnly ) + { + store->CommitL(); + } + CleanupStack::PopAndDestroy(store); + } + + CleanupStack::PopAndDestroy(msvEntry); + + return ret; + } + +// Process the CImHeader information +void CTestMessStoreProcessUtil::ProcessImHeaderL(CMsvStore& aStore) + { + CImHeader* header=CImHeader::NewLC(); + TRAPD(err, header->RestoreL(aStore)); + + if ( err==KErrNone ) + { + ProcessImHeaderL(*header); + if ( !iReadOnly ) + { + header->StoreL(aStore); + } + } + + CleanupStack::PopAndDestroy(header); + } + +// Process the CImMimeHeader information +void CTestMessStoreProcessUtil::ProcessImMimeHeaderL(CMsvStore& aStore) + { + CImMimeHeader* header=CImMimeHeader::NewLC(); + TRAPD(err, header->RestoreL(aStore)); + + if ( err==KErrNone ) + { + ProcessImMimeHeaderL(*header); + if ( !iReadOnly ) + { + header->StoreL(aStore); + } + } + + CleanupStack::PopAndDestroy(header); + } + + +// Process the CSmsHeader information +void CTestMessStoreProcessUtil::ProcessSmsHeaderStreamL(CMsvStore& aStore) + { + CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL(); + CleanupStack::PushL(paraFormatLayer); + + CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); + CleanupStack::PushL(charFormatLayer); + + CRichText* bodyText=CRichText::NewL(paraFormatLayer, charFormatLayer); + CleanupStack::PushL(bodyText); + + CSmsHeader* header = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *bodyText); + CleanupStack::PushL(header); + + TRAPD(err, header->RestoreL(aStore)); + if ( err == KErrNone ) + { + ProcessSmsHeaderStreamL(*header); + if ( !iReadOnly ) + { + header->StoreL(aStore); + } + } + + CleanupStack::PopAndDestroy(4, paraFormatLayer); + } + + +// Process the CRichText information +void CTestMessStoreProcessUtil::ProcessRichTextBodyL(CMsvStore& aStore) + { + CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL(); + CleanupStack::PushL(paraFormatLayer); + + CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); + CleanupStack::PushL(charFormatLayer); + + CRichText* bodyText=CRichText::NewL(paraFormatLayer, charFormatLayer); + CleanupStack::PushL(bodyText); + + TRAPD(err, aStore.RestoreBodyTextL(*bodyText)); + if ( err == KErrNone ) + { + ProcessRichTextBodyL(*bodyText); + if ( !iReadOnly ) + { + aStore.StoreBodyTextL(*bodyText); + } + } + + CleanupStack::PopAndDestroy(3, paraFormatLayer); + } + +/** + * Saves the new character set to the message + * @param TPtrC aCharacterSetType - New Character set type to be stored for the received message + * @param TUint &aCharSetVal - character set value + * @return TBool + * @panic None + * @leave None + * +*/ +TBool CTestMessStoreProcessUtil::ValidCharacterSetInfo(const TPtrC& aCharacterSetType, TUint &aCharSetVal) + { + TBool hasSet = ETrue; + + if ( aCharacterSetType.Compare(KChineseGB2312) == 0 ) + { + iTestStep.INFO_PRINTF1(_L("Character set set to Chinese GB2312")); + aCharSetVal = KCharacterSetIdentifierGb2312; + } + else if (aCharacterSetType.Compare(KChineseHz) == 0) + { + iTestStep.INFO_PRINTF1(_L("Character set set to Chinese Hz")); + aCharSetVal = KCharacterSetIdentifierHz; + } + else if ( aCharacterSetType.Compare(KChineseBig5) == 0 ) + { + iTestStep.INFO_PRINTF1(_L("Character set set to Chinese Big5")); + aCharSetVal = KCharacterSetIdentifierBig5; + } + else + { + // To be updated later + hasSet= EFalse; + iTestStep.ERR_PRINTF2(_L("Character not supported in test code: %S"), &aCharacterSetType); + iTestStep.SetTestStepResult(EFail); + } + + return hasSet; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessTimer.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,63 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TestMessTimer.h +// This contains CTestMessTimer +// EPOC includes +// +// + +#include "TestMessTimer.h" +#include "TestMessProcessor.h" + +// +// Construction/Destruction +// + +CTestMessTimer* CTestMessTimer::NewL(TTimeIntervalMicroSeconds32 aInterval, CTestMessProcessor& aProcessor) + { + CTestMessTimer* self=new(ELeave) CTestMessTimer(aInterval, aProcessor); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CTestMessTimer::CTestMessTimer(TTimeIntervalMicroSeconds32 aInterval, CTestMessProcessor& aProcessor) +: CTimer(EPriorityStandard) +, iInterval(aInterval) +, iProcessor(aProcessor) + { + } + +void CTestMessTimer::ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add(this); + } + + +CTestMessTimer::~CTestMessTimer() + { + } + +void CTestMessTimer::RunL() + { + iProcessor.DisplayProgress(); + IssueRequest(); + }; + +void CTestMessTimer::IssueRequest() + { + After(iInterval); + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/Src/TestMessWatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/Src/TestMessWatcher.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 CTestMessWatcher which starts the message watchers +// +// + +#include "TestMessWatcher.h" + +_LIT(KWatcherExe, "z:\\system\\libs\\watcher.exe"); + +CTestMessWatcher* CTestMessWatcher::NewL(TInt aPriority) + { + CTestMessWatcher* self = new (ELeave) CTestMessWatcher(aPriority); + CleanupStack::PushL(self); + + self->ConstructL(); + + CleanupStack::Pop(self); + return self; + } + +CTestMessWatcher::~CTestMessWatcher() + { + Cancel(); + iTimer.Close(); + if (iConstructed) + iWatcher.Kill(KErrNone); + + iWatcher.Close(); + } + +CTestMessWatcher::CTestMessWatcher(TInt aPriority) +: CActive(aPriority) +, iConstructed(EFalse) + { + CActiveScheduler::Add(this); + } + +void CTestMessWatcher::ConstructL() + { + TInt ret=iWatcher.Create(KWatcherExe, KNullDesC); + switch ( ret ) + { + case KErrNone: + iWatcher.Resume(); + iConstructed = ETrue; + case KErrAlreadyExists: + break; + default: + User::Leave(ret); + } + } + +void CTestMessWatcher::RunL() + { + } + +void CTestMessWatcher::DoCancel() + { + iTimer.Cancel(); + iStatus=KErrCancel; + } diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/TestData/Smoketest_Mess.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/TestData/Smoketest_Mess.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,751 @@ +[default] +smsto=07769588944 +smsbearer=NBS +smsencoding=7 +smsDeliveryReport=NO +mmsto=07769588944 +mmsDeliveryReport=NO +progress=120 + +[19101_RootFolder] +depth=0 + +[27030_SmsO2Account] +scname=O2 +scnumber=+447802000332 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[27031_SmsOrangeAccount] +scname=Orange +scnumber=+447973100973 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[27032_SmsTMobileAccount] +scname=TMobile +scnumber=+447958879879 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[27029_SmsVodafoneAccount] +scname=Vodafone +scnumber=+447785016005 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[21770_SmsAirtelAccount] +MessageBearerType=CDMA +scname=Airtel +scnumber=919845087001 +SmsRejectDuplicate=TRUE +SmsReplyPath=TRUE +SmsConCatenate=TRUE +SmsDeliveryReport=TRUE +SmsReplyQuoted=TRUE + +[SmsHutchAccount] +scname=Hutch +scnumber=919886005444 +SmsReplyQuoted=TRUE +SmsRejectDuplicate=TRUE +SmsReplyPath=FALSE +SmsConCatenate=TRUE +SmsDeliveryReport=FALSE + +[28206_MmsAccount] +accountname=Multimedia Messaging +serveraddr=http://10.22.64.20 +fromaddr=07769588944 +automaticfetch=TRUE +iap=14 + +[27028_ImapAccount] +accountname=smoketest Imap Account +myname=Symbian smoketest +username=mdgi15 +password=vethihiz +emailaddress=mdgi15@dial.pipex.com +outserver=smtp.dial.pipex.com +inserver=imap.dial.pipex.com +SyncRate=120 +iap=6 + +[27027_PopAccount] +accountname=smoketest Pop Account +myname=Symbian smoketest +username=mdgi15 +password=vethihiz +emailaddress=mdgi15@dial.pipex.com +outserver=smtp.dial.pipex.com +inserver=pop.dial.pipex.com +iap=6 + +[21558_ImapAccountAuth] +accountname=smoketest ImapAuth Account +myname=Symbian smoketest +username=mailtst1 +password=mailtest1 +auth=TRUE +authUserName=mailtst1 +authPassword=mailtest1 +emailaddress=mailtst1@trmai01.it.cellulardata.com +outserver=trmai01.it.cellulardata.com +inserver=cyrus.cellulardata.com +iap=7 + +[27035_PopAccountAuth] +accountname=smoketest PopAuth Account +myname=Symbian smoketest +username=mailtst1 +password=mailtest1 +auth=TRUE +authUserName=mailtst1 +authPassword=mailtest1 +emailaddress=mailtst1@trmai01.it.cellulardata.com +outserver=trmai01.it.cellulardata.com +inserver=cyrus.cellulardata.com +iap=7 + +[28381_ImapAccountSSL] +accountname=smoketest ImapSSL Account +myname=Symbian smoketest +username=mailtst1 +password=mailtest1 +auth=TRUE +sslwrapper=yes +sslport=993 +authUserName=mailtst1 +authPassword=mailtest1 +emailaddress=mailtst1@trmai01.it.cellulardata.com +outserver=trmai01.it.cellulardata.com +inserver=cyrus.cellulardata.com +iap=7 + +[28382_PopAccountSSL] +accountname=smoketest PopSSL Account +myname=Symbian smoketest +username=mailtst1 +password=mailtest1 +auth=TRUE +sslwrapper=yes +sslport=995 +authUserName=mailtst1 +authPassword=mailtest1 +emailaddress=mailtst1@trmai01.it.cellulardata.com +outserver=trmai01.it.cellulardata.com +inserver=cyrus.cellulardata.com +iap=7 + +[27027_VodafoneGprsAccount] +accountname=Vodafone Gprs Account +myname=Symbian smoketest +username=mdgi15 +password=vethihiz +emailaddress=mdgi15@dial.pipex.com +outserver=smtp.vizzavi.co.uk +inserver=pop.dial.pipex.com +iap=13 + +[o2GprsAccount] +accountname=O2 Gprs Account +myname=Symbian smoketest +username=mdgi15 +password=vethihiz +emailaddress=mdgi15@dial.pipex.com +outserver=smtp.o2.co.uk +inserver=pop.dial.pipex.com +iap=17 + +[MmsCount01] +count=7 +depth=2 +folder1=Local +folder2=Inbox + +[MmsMessage01] +from=Multimedia Messaging +subject=mms test1 +priority=high + +textmimetype1=text/plain +textfile1=c:\smoketest\Mms\Message1.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +[MmsMessage02] +from=Multimedia Messaging +subject=mms test2 +priority=high + +textmimetype1=text/plain +textfile1=c:\smoketest\Mms\Message2.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +imgmimetype1=image/gif +imgfile1=c:\smoketest\Mms\Image2.gif +imgmimeheaders1=1 +imgmimeheader1name1=content-type +imgmimeheader1type1=image/gif + +[MmsMessage03] +from=Multimedia Messaging +subject=mms test3 +priority=high + +textmimetype1=text/plain +textfile1=c:\smoketest\Mms\Message3.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +imgmimetype1=image/gif +imgfile1=c:\smoketest\Mms\Image3.gif +imgmimeheaders1=1 +imgmimeheader1name1=content-type +imgmimeheader1type1=image/gif + +audiomimetype1=audio/basic +audiofile1=c:\smoketest\Mms\Audio3.wav +audiomimeheaders1=1 +audiomimeheader1name1=content-type +audiomimeheader1type1=audio/basic + +[MmsMessage04] +from=Multimedia Messaging +subject=mms test4 +priority=high +slides=2 + +textmimetype1=text/plain +textfile1=c:\smoketest\Mms\Message4.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +imgmimetype2=image/gif +imgfile2=c:\smoketest\Mms\Image4.gif +imgmimeheaders2=1 +imgmimeheader2name1=content-type +imgmimeheader2type1=image/gif + +[MmsMessage05] +from=Multimedia Messaging +subject=mms test5 +priority=high +slides=2 + +textmimetype1=text/plain +textfile1=c:\smoketest\Mms\Message5.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +imgmimetype2=image/gif +imgfile2=c:\smoketest\Mms\Image5.gif +imgmimeheaders2=1 +imgmimeheader2name1=content-type +imgmimeheader2type1=image/gif + +audiomimetype2=audio/basic +audiofile2=c:\smoketest\Mms\Audio5.wav +audiomimeheaders2=1 +audiomimeheader2name1=content-type +audiomimeheader2type1=audio/basic + +[MmsMessage06] +from=Multimedia Messaging +subject=mms test6 +priority=high +slides=3 + +textmimetype1=text/plain +textfile1=c:\smoketest\Mms\Message6.txt +textmimeheaders1=1 +textmimeheader1name1=content-type +textmimeheader1type1=text/plain + +audiomimetype2=audio/basic +audiofile2=c:\smoketest\Mms\Audio6.wav +audiomimeheaders2=1 +audiomimeheader2name1=content-type +audiomimeheader2type1=audio/basic + +imgmimetype3=image/gif +imgfile3=c:\smoketest\Mms\Image6.gif +imgmimeheaders3=1 +imgmimeheader3name1=content-type +imgmimeheader3type1=image/gif + +[27584_SmsMessage01] +recipients=2 +body=c:\smoketest\Sms\Message1.txt + +[27596_SmsMessage02] +body=c:\smoketest\Sms\Message2.txt + +[27587_SmsMessage03] +body=c:\smoketest\Sms\Message3.txt +encoding=8 + +[27589_SmsMessage04] +body=c:\smoketest\Sms\Message4.txt +DeliveryReport=NO + +[27591_SmsMessage05] +body=c:\smoketest\Sms\Message5.txt + +[27593_SmsMessage06] +body=c:\smoketest\Sms\Message6.txt +encoding=8 +scheduled=120 + +[27577_SmsSend01] +text=This message is going + +[20388_SmsSend02] +text=Hello, this is a plain + +[20389_SmsSend03] +text=Hello, this is a 8-bit + +[20390_SmsSend04] +text=No status report requested + +[20392_SmsSend05] +text=A big message to ya! + +[20391_SmsSend06] +text=This is a big 8-bit + +[27595_SmsCount01] +count=7 +depth=2 +folder1=Local +folder2=Inbox + +[27033_PopMessage01] +from=smoketest Pop Account +to=mdgi15@dial.pipex.com +subject=PopMessage01 +body=c:\smoketest\EMail\PopTestMsg01.txt +priority=high +count=1 +depth=2 +folder1=smoketest Pop Account +folder2=PopMessage01 + +[27044_PopMessage02] +from=smoketest Pop Account +to=mdgi15@dial.pipex.com +subject=PopMessage02 +body=c:\smoketest\EMail\PopTestMsg02.txt +priority=low +attachments=1 +attachment1=c:\smoketest\EMail\Attachment01.txt +count=2 +depth=3 +folder1=smoketest Pop Account +folder2=PopMessage02 + +[27040_PopMessage03] +from=smoketest Pop Account +to=mdgi15@dial.pipex.com +subject=PopMessage03 +body=c:\smoketest\EMail\PopTestMsg03.txt +priority=low +attachments=3 +attachment1=c:\smoketest\EMail\Attachment02.txt +attachment2=c:\smoketest\EMail\Attachment02.txt +attachment3=c:\smoketest\EMail\Attachment02.txt +count=4 +depth=3 +folder1=smoketest Pop Account +folder2=PopMessage03 + +[19103_PopMessage04] +from=smoketest Pop Account +to=mdgi15@dial.pipex.com +subject=PopMessage04 +body=c:\smoketest\EMail\PopTestMsg04.txt +priority=low +attachments=2 +attachment1=c:\smoketest\EMail\Attachment01.txt +attachment2=c:\smoketest\EMail\Typhoon.zip +count=3 +depth=3 +folder1=smoketest Pop Account +folder2=PopMessage04 + +[27041_PopBox01] +from=smoketest Pop Account + +[28111_PopSend01] +subject=PopMessage01 + +[28112_PopSend02] +subject=PopMessage02 + +[28114_PopSend03] +subject=PopMessage03 + +[28113_PopSend04] +subject=PopMessage04 + +[19102_PopCount01] +count=4 +depth=1 +folder1=smoketest Pop Account + +[19102_PopCount01_MadcowSanity] +count=3 +depth=1 +folder1=smoketest Pop Account + +[28360_ImapMessage01] +from=smoketest Imap Account +to=mdgi15@dial.pipex.com +subject=ImapMessage01 +body=c:\smoketest\EMail\PopTestMsg01.txt +priority=high +count=0 +depth=3 +folder1=smoketest Imap Account +folder2=Inbox +folder3=ImapMessage01 + +[28361_ImapMessage02] +from=smoketest Imap Account +to=mdgi15@dial.pipex.com +subject=ImapMessage02 +body=c:\smoketest\EMail\PopTestMsg02.txt +priority=low +attachments=1 +attachment1=c:\smoketest\EMail\Attachment01.txt +count=0 +depth=3 +folder1=smoketest Imap Account +folder2=Inbox +folder3=ImapMessage02 + +[28362_ImapMessage03] +from=smoketest Imap Account +to=mdgi15@dial.pipex.com +subject=ImapMessage03 +body=c:\smoketest\EMail\PopTestMsg03.txt +priority=low +attachments=3 +attachment1=c:\smoketest\EMail\Attachment02.txt +attachment2=c:\smoketest\EMail\Attachment02.txt +attachment3=c:\smoketest\EMail\Attachment02.txt +count=0 +depth=3 +folder1=smoketest Imap Account +folder2=Inbox +folder3=ImapMessage03 + +[28363_ImapMessage04] +from=smoketest Imap Account +to=mdgi15@dial.pipex.com +subject=ImapMessage04 +body=c:\smoketest\EMail\PopTestMsg04.txt +priority=low +attachments=2 +attachment1=c:\smoketest\EMail\Attachment01.txt +attachment2=c:\smoketest\EMail\Typhoon.zip +count=0 +depth=3 +folder1=smoketest Imap Account +folder2=Inbox +folder3=ImapMessage04 + +[19104_ImapBox01] +name=imapsync +from=smoketest Imap Account +depth=1 +folder1=Inbox + +[28118_ImapSend01] +subject=ImapMessage01 + +[28117_ImapSend02] +subject=ImapMessage02 + +[28115_ImapSend03] +subject=ImapMessage03 + +[28116_ImapSend04] +subject=ImapMessage04 + +[28359_ImapCount01] +count=4 +depth=2 +folder1=smoketest Imap Account +folder2=Inbox + +[28359_ImapCount01MadcowSanity] +count=3 +depth=2 +folder1=smoketest Imap Account +folder2=Inbox + +[27048_PopMessage06] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage06 +body=c:\smoketest\EMail\PopTestMsg06.txt +priority=high +count=1 +depth=2 +folder1=smoketest PopAuth Account +folder2=PopMessage06 + +[28364_PopMessage07] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage07 +body=c:\smoketest\EMail\PopTestMsg07.txt +priority=low +attachments=1 +attachment1=c:\smoketest\EMail\Attachment01.txt +count=2 +depth=3 +folder1=smoketest PopAuth Account +folder2=PopMessage07 + +[28365_PopMessage08] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage08 +body=c:\smoketest\EMail\PopTestMsg08.txt +priority=low +attachments=3 +attachment1=c:\smoketest\EMail\Attachment02.txt +attachment2=c:\smoketest\EMail\Attachment02.txt +attachment3=c:\smoketest\EMail\Attachment02.txt +count=4 +depth=3 +folder1=smoketest PopAuth Account +folder2=PopMessage08 + +[28366_PopMessage09] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage09 +body=c:\smoketest\EMail\PopTestMsg09.txt +priority=low +attachments=2 +attachment1=c:\smoketest\EMail\Attachment01.txt +attachment2=c:\smoketest\EMail\Typhoon.zip +count=3 +depth=3 +folder1=smoketest PopAuth Account +folder2=PopMessage09 + +[28394_PopMessage10] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage10 +body=c:\smoketest\EMail\PopTestMsg06.txt +priority=high +count=1 +depth=2 +folder1=smoketest PopAuth Account +folder2=PopMessage10 + +[28395_PopMessage11] +from=smoketest PopAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=PopMessage11 +body=c:\smoketest\EMail\PopTestMsg08.txt +priority=low +attachments=3 +attachment1=c:\smoketest\EMail\Attachment02.txt +attachment2=c:\smoketest\EMail\Attachment02.txt +attachment3=c:\smoketest\EMail\Attachment02.txt +count=4 +depth=3 +folder1=smoketest PopAuth Account +folder2=PopMessage11 + +[27043_PopBox02] +from=smoketest PopAuth Account + +[21560_PopSend06] +subject=PopMessage06 + +[27042_PopSend07] +subject=PopMessage07 + +[27039_PopSend08] +subject=PopMessage08 + +[28367_PopSend09] +subject=PopMessage09 + +[28396_PopSend10] +subject=PopMessage10 + +[28397_PopSend11] +subject=PopMessage11 + +[28368_PopCount02] +count=4 +depth=1 +folder1=smoketest PopAuth Account + +[28373_ImapMessage06] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage06 +body=c:\smoketest\EMail\PopTestMsg06.txt +priority=high +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage06 + +[28374_ImapMessage07] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage07 +body=c:\smoketest\EMail\PopTestMsg07.txt +priority=low +attachments=1 +attachment1=c:\smoketest\EMail\Attachment01.txt +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage07 + +[28375_ImapMessage08] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage08 +body=c:\smoketest\EMail\PopTestMsg08.txt +priority=low +attachments=3 +attachment1=c:\smoketest\EMail\Attachment02.txt +attachment2=c:\smoketest\EMail\Attachment02.txt +attachment3=c:\smoketest\EMail\Attachment02.txt +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage08 + +[28376_ImapMessage09] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage09 +body=c:\smoketest\EMail\PopTestMsg09.txt +priority=low +attachments=2 +attachment1=c:\smoketest\EMail\Attachment01.txt +attachment2=c:\smoketest\EMail\Typhoon.zip +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage09 + +[28387_ImapMessage10] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage10 +body=c:\smoketest\EMail\PopTestMsg06.txt +priority=high +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage10 + +[28388_ImapMessage11] +from=smoketest ImapAuth Account +to=mailtst1@trmai01.it.cellulardata.com +subject=ImapMessage11 +body=c:\smoketest\EMail\PopTestMsg08.txt +priority=low +attachments=3 +attachment1=c:\smoketest\EMail\Attachment02.txt +attachment2=c:\smoketest\EMail\Attachment02.txt +attachment3=c:\smoketest\EMail\Attachment02.txt +count=0 +depth=3 +folder1=smoketest ImapAuth Account +folder2=Inbox +folder3=ImapMessage11 + +[27037_ImapBox02] +from=smoketest ImapAuth Account +depth=1 +folder1=Inbox + +[27036_ImapSend06] +subject=ImapMessage06 + +[28377_ImapSend07] +subject=ImapMessage07 + +[28378_ImapSend08] +subject=ImapMessage08 + +[28379_ImapSend09] +subject=ImapMessage09 + +[28389_ImapSend10] +subject=ImapMessage10 + +[28390_ImapSend11] +subject=ImapMessage11 + +[28380_ImapCount02] +count=4 +depth=2 +folder1=smoketest ImapAuth Account +folder2=Inbox + +[28398_PopBox03] +from=smoketest PopSSL Account + +[28399_PopCount03] +count=2 +depth=1 +folder1=smoketest PopSSL Account + +[28391_ImapBox03] +from=smoketest ImapSSL Account +depth=1 +folder1=Inbox + +[28392_ImapCount03] +count=2 +depth=2 +folder1=smoketest ImapSSL Account +folder2=Inbox + +[28383_HangUpPipex] +iap=6 + +[28384_HangUpNokia] +iap=7 + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/TestData/Sms/Message1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/TestData/Sms/Message1.txt Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,1 @@ +This message is going to my two buddies \ No newline at end of file diff -r 000000000000 -r 9736f095102e buildverification/smoketest/messaging/bwins/SMOKETEST_MESS_SERVERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/messaging/bwins/SMOKETEST_MESS_SERVERU.DEF Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewServer@@YAHXZ @ 1 NONAME ; int __cdecl NewServer(void) + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/smoketest_commdb.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/smoketest_commdb.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,2022 @@ + + + + + + + + + + + + + Intranet + + + mRouter + + + + + + Ethernet WinTAP + LANService.Ethernet WinTAP + LANBearer.Ethernet WinTAP + Network.Intranet + 0 + Location.Office + + + NT RAS with Null Modem + DialOutISP.NT RAS + ModemBearer.Null Modem 115200bps + Network.Intranet + 0 + Location.Office + + + Ethernet with DHCP + LANService.Ethernet Dynamic IP + LANBearer.EKA1 Emulator Ethernet + Network.Intranet + 0 + Location.Office + + + + + + Default Modem + CSD.agt + PPP + COMM::0 + MM + ECUART + 8 + 1 + NONE + 115200 + 0 + 0 + 0 + 0 + AUTO + NEVER + QUIET + AT + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + Null Modem 115200bps + CSD.agt + PPP + COMM::0 + MM + ECUART + 8 + 1 + NONE + 115200 + 52 + 0 + 0 + 0 + AUTO + NEVER + QUIET + AT + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + TRUE + 9905 + 180 + 30 + 60 + 0 + 0 + + + US Robotics Sportster + CSD.agt + PPP + COMM::0 + MM + ECUART + 8 + 1 + NONE + 57600 + 244 + 0 + 0 + 0 + AUTO + AFTERDIALUNTILANSWER + QUIET + AT&F1 + AT + AT&d2 + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + Dacom Surfer + CSD.agt + PPP + COMM::0 + MM + ECUART + 8 + 1 + NONE + 57600 + 244 + 0 + 0 + 0 + AUTO + AFTERDIALUNTILANSWER + QUIET + AT&F + AT + AT&d2 + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + GSM Mobile Phone via Infrared + CSD.agt + PPP + IRCOMM::0 + MM + IRCOMM + 8 + 1 + NONE + 115200 + 196 + 0 + 17 + 19 + AUTO + NEVER + QUIET + ATZ + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + GSM Mobile Phone via Serial + CSD.agt + PPP + COMM::0 + MM + ECUART + 8 + 1 + NONE + 19200 + 196 + 0 + 17 + 19 + AUTO + NEVER + QUIET + ATZ + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + GPRS Ericsson R520m via IR + PSD.agt + PPP + IRCOMM::0 + MM + IRCOMM + 8 + 1 + NONE + 115200 + 4 + 0 + 17 + 19 + AUTO + NEVER + QUIET + ATZ + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + GPRS Ericsson R520m/T68i via Serial + PSD.agt + PPP + COMM::0 + MM + ECUART + 8 + 1 + NONE + 19200 + 4 + 0 + 17 + 19 + AUTO + NEVER + QUIET + ATZ + AT + AT + *99***1# + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + GPRS Motorola Mobile Phone via Serial + PSD.agt + PPP + COMM::0 + MM + ECUART + 8 + 1 + NONE + 57600 + 4 + 0 + 17 + 19 + AUTO + NEVER + QUIET + ATZ + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + WinTunnel Modem + null.agt + PPP + COMM::6 + MM + ECUART + 8 + 1 + NONE + 115200 + 52 + 0 + 0 + 0 + AUTO + NEVER + QUIET + AT + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 180 + 30 + 60 + 0 + 0 + + + mRouterWinsBearer + mRouterAgent.agt + PPP + WINS::0 + MM + WINSCSY + 8 + 1 + NONE + 115200 + 52 + 0 + 0 + 0 + AUTO + NEVER + QUIET + AT + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 9999 + 180 + 30 + 0 + 0 + + + mRouterRs232Bearer + mRouterAgent.agt + PPP + COMM::0 + MM + ECUART + 8 + 1 + NONE + 115200 + 52 + 0 + 0 + 0 + AUTO + NEVER + QUIET + AT + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 9999 + 180 + 30 + 0 + 0 + + + mRouterIrBearer + mRouterAgent.agt + PPP + IRCOMM::0 + MM + IRCOMM + 8 + 1 + NONE + 115200 + 52 + 0 + 0 + 0 + AUTO + NEVER + QUIET + AT + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 9999 + 180 + 30 + 0 + 0 + + + mRouterBtBearer + mRouterAgent.agt + PPP + BTCOMM::0 + MM + BTCOMM + 8 + 1 + NONE + 115200 + 52 + 0 + 0 + 0 + AUTO + NEVER + QUIET + AT + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 9999 + 180 + 30 + 0 + 0 + + + mRouterUsbBearer + mRouterAgent.agt + PPP + ACM::0 + MM + ECACM + 8 + 1 + NONE + 115200 + 52 + 0 + 0 + 0 + AUTO + NEVER + QUIET + AT + AT + AT + S8= + L0 + L1 + L2 + M0 + M1 + M2 + M3 + W + X1 + X2 + X3 + X4 + E0 + V1 + Q0 + Q1 + ; + O + Z + &F + &C1 + &D2 + &S0 + &K3 + &K4 + + + S12 + NO DIAL TONE + BUSY + NO ANSWER + CARRIER + CONNECT + COMPRESSION:CLASS 5 + COMPRESSION:V.42 bis + COMPRESSION:NONE + PROTOCOL:LAPD + PROTOCOL:ALT + PROTOCOL:ALT-CELLULAR + PROTOCOL:NONE + +44123456789 + 1440 + FALSE + 9905 + 9999 + 180 + 30 + 0 + 0 + + + + + + Ethernet WinTAP + nullagt.agt + ethint + enet + =Ethernet + ethertap + Ethertap.Wins + EtherPkt.drv + -1 + -1 + -1 + + + EKA1 Target Ethernet + nullagt.agt + ethint + ethercard + EtherCard + EtherSmc + EtherCard.Smc + EtherPkt.drv + -1 + -1 + -1 + + + EKA1 Emulator Ethernet + nullagt.agt + ethint + ethercard + Ethercard + etherwins + Ethercard.wins + EtherPkt.drv + -1 + -1 + -1 + + + EKA1 WINTAP Ethernet + nullagt.agt + ethint + ethercard + Ethercard + ethertap + Ethertap.wins + EtherPkt.drv + -1 + -1 + -1 + + + + + + Ethernet WinTAP + ip + 255.255.255.0 + 192.168.0.1 + FALSE + 192.168.0.3 + FALSE + 10.16.59.15 + 10.23.58.12 + FALSE + + + Ethernet Dynamic IP + ip + 255.255.255.0 + 10.32.194.254 + TRUE + 10.32.194.251 + TRUE + 194.72.6.51 + 194.72.6.52 + ConfigDaemonManager + DhcpServ + + + Ethernet Static 1 + ip + 255.255.255.0 + 192.168.0.1 + FALSE + 192.168.0.2 + FALSE + 10.16.59.15 + 10.23.58.12 + FALSE + + + + + + Default Dial In ISP + Default Dial In ISP + FALSE + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + FALSE + + + Dial In ISP01 + Dial In ISP01 + FALSE + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + FALSE + + + + + + Default Dial Out ISP + Default Dial Out ISP + Default Dial Out ISP + TRUE + FALSE + TRUE + 1 + 1 + FALSE + 0 + 0 + TRUE + 1 + 1 + FALSE + 0 + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + 0 + UNSPECIFIED + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + + + NT RAS + Test + INTERNETONLY + INTERNETONLY + TRUE + TRUE + CHARMAP \[windows-1252\]\nLOOP 10\n{\nSEND "CLIENT"+<0x0d>\nWAIT 3\n{\n"SERVER" OK\n}\n}\nEXIT KErrNoAnswer$\n\nOK:\nEXIT\n + FALSE + 0 + 0 + FALSE + 0 + ip + FALSE + RasUser + pass + 0 + FALSE + 0 + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + 0 + UNSPECIFIED + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + + + ISP01 + PlaceHolder for ISP01 + INTERNETONLY + INTERNETONLY + TRUE + FALSE + FALSE + 0 + 0 + FALSE + 0 + ip + TRUE + xxx + yyy + 0 + FALSE + 0 + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + 0 + UNSPECIFIED + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + + + ISP02 + PlaceHolder for ISP02 + INTERNETONLY + INTERNETONLY + TRUE + FALSE + FALSE + 0 + 0 + FALSE + 0 + ip + TRUE + xxx + yyy + 0 + FALSE + 0 + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + 0 + UNSPECIFIED + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + + + ISP03 + PlaceHolder for ISP03 + INTERNETONLY + INTERNETONLY + TRUE + FALSE + FALSE + 0 + 0 + FALSE + 0 + ip + TRUE + xxx + yyy + 0 + FALSE + 0 + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + 0 + UNSPECIFIED + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + + + ISP04 + PlaceHolder for ISP04 + INTERNETONLY + INTERNETONLY + TRUE + FALSE + FALSE + 0 + 0 + FALSE + 0 + ip + TRUE + xxx + yyy + 0 + FALSE + 0 + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + 0 + UNSPECIFIED + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + + + ISP05 + PlaceHolder for ISP05 + INTERNETONLY + INTERNETONLY + TRUE + FALSE + FALSE + 0 + 0 + FALSE + 0 + ip + TRUE + xxx + yyy + 0 + FALSE + 0 + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + 0 + UNSPECIFIED + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + + + mRouterDialOutIsp + mRouterDialOutIsp + INTERNETONLY + INTERNETONLY + TRUE + FALSE + FALSE + 0 + 0 + FALSE + 0 + ip + FALSE + IfAuthPass= + AuthRetries=0 + 0 + FALSE + 0 + TRUE + 1 + 1 + 1 + TRUE + 1 + 1 + FALSE + FALSE + FALSE + FALSE + 0 + UNSPECIFIED + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + + + + + + + + + + + + + + + Dummy BT Chargecard + 144,12345678 + 0000 + HG + HFG + HEFG + + + Dummy Mercury Chargecard + 0500800800,,12345678 + **** + HG + J,K,0FG + HEFG + + + + + + ConnectionPreferencesTable1 + 1 + OUTGOING + LAN + DONOTPROMPT + IAP.Ethernet WinTAP + + + + + + GlobalSettingsTable1 + WAPAccessPoint.Default Dial In ISP + 3 + 1 + 2 + 1 + 1 + GSM + 2 + 2 + 2 + Location.Office + Location.Office + Network.Intranet + mm + + + + + + Incoming GPRS Settings PlaceHolder + Test + IPV4 + 0.0.0.0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + FALSE + FALSE + FALSE + FALSE + ip + FALSE + RasUser + pass + 1 + TRUE + TRUE + 0.0.0.0 + 0.0.0.0 + FALSE + FALSE + + + + + + GPRS01 + gprs01APNPlaceHolder + IPV4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + FALSE + FALSE + ip + FALSE + 1 + TRUE + FALSE + FALSE + FALSE + 0 + 0 + + + GPRS02 + gprs02APNPlaceHolder + IPV4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + FALSE + FALSE + ip + FALSE + 1 + TRUE + FALSE + FALSE + FALSE + 0 + 0 + + + GPRS03 + gprs03APNPlaceHolder + IPV4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + FALSE + FALSE + FALSE + FALSE + ip + FALSE + 1 + TRUE + FALSE + FALSE + FALSE + 0 + 0 + + + + + + Dummy Default GPRS Settings + 1 + Access point name + IPV6 + www.wid.com + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + TRUE + TRUE + FALSE + TRUE + + + + + + ProxyTable1 + DialOutISP.NT RAS + TRUE + www.dummyproxy.com + http + 80 + www.dummyproxy.com/exception + + + + + + Default Location + + + 0 + 44 + 44 + 44 + 44 + TRUE + FALSE + FALSE + 0 + + + Office + 00 + 0 + 44 + 171 + 9, + 9, + FALSE + FALSE + FALSE + 0 + + + Office Direct Dial + 00 + 0 + 44 + 171 + 171 + 171 + FALSE + FALSE + FALSE + 0 + + + Mobile + + + 0 + 44 + 44 + 44 + 44 + TRUE + FALSE + FALSE + 0 + + + Home + 00 + 0 + 44 + 181 + 181 + 181 + FALSE + TRUE + TRUE + 0 + + + + + + SecureSocketTable1 + ssl3.0 + ssladaptor.dll + + + SecureSocketTable2 + tls1.0 + ssladaptor.dll + + + + + + + + + + + + + + + + + + Default Dial In ISP + WAPIPBearer + + + Dummy WAP Settings + WAPIPBearer + www.wapstart.com + + + + + + WAPIPBearerTable1 + WAPAccessPoint.-1 + 0 + IAP.-1 + CONNECTIONLESS + FALSE + 0 + 0 + 0 + + + WAPIPBearerTable2 + WAPAccessPoint.Dummy WAP Settings + www.wapgateway.com + IAP.Ethernet WinTAP + CONNECTIONORIENTED + FALSE + 1 + 1 + 1 + + + + + + WAPSMSBearerTable1 + WAPAccessPoint.-1 + 0 + 0 + CONNECTIONLESS + FALSE + + + WAPSMSBearerTable2 + WAPAccessPoint.Dummy WAP Settings + +4412345678901 + +442071234567 + CONNECTIONORIENTED + FALSE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,19 @@ + + + + smoketest + + smoketest_system + smoketest_agenda + smoketest_mess + smoketest_timew + smoketest_phone + smoketest_contacts + + + smoketest_agenda_server + smoketest_contacts_server + smoketest_mess_server + smoketest_timew_server + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/smoketest_agenda.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/smoketest_agenda.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ + + + + smoketest_agenda + 1000 + + + + + smoketest_agenda_server + + + + \epoc32\release\winscw\udeb\z\smoketest\smoketest_agenda.ini + c:\smoketest\smoketest_agenda.ini + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/smoketest_contacts.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/smoketest_contacts.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ + + + + smoketest_contacts + 1000 + + + + + smoketest_contacts_server + + + + \epoc32\release\winscw\udeb\z\smoketest\smoketest_contacts.ini + c:\smoketest\smoketest_contacts.ini + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/smoketest_mess.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/smoketest_mess.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,30 @@ + + + + smoketest_mess + 1000 + + + + + smoketest_mess_server + + + + \epoc32\release\winscw\udeb\z\smoketest\smoketest_mess.ini + c:\smoketest\smoketest_mess.ini + + + \epoc32\release\winscw\udeb\z\smoketest\sms\message1.txt + c:\smoketest\sms\message1.txt + + + \epoc32\release\winscw\udeb\z\smoketest\smoketest_createsmsaccount.script + c:\smoketest\smoketest_createsmsaccount.script + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/smoketest_phone.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/smoketest_phone.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,12 @@ + + + + smoketest_phone + 1000 + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/smoketest_syncmlapp.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/smoketest_syncmlapp.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,12 @@ + + + + smoketest_syncmlapp + 1000 + + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/smoketest_system.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/smoketest_system.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,20 @@ + + + + smoketest_system + 1000 + + + + + + \epoc32\release\winscw\udeb\smoketest_system.exe + c:\sys\bin\smoketest_system.exe + smoketest_system.mmp + smoketest\system\group\bld.inf + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/smoketest_timew.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/smoketest_timew.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,21 @@ + + + + smoketest_timew + 1000 + + + + + smoketest_timew_server + + + + \epoc32\release\winscw\udeb\z\smoketest\smoketest_timew.ini + c:\smoketest\smoketest_timew.ini + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/testexecuteservers/smoketest_agenda_server.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/testexecuteservers/smoketest_agenda_server.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,7 @@ + + + + smoketest_agenda_server + smoketest_agenda.mmp + smoketest\agenda\group\bld.inf + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/testexecuteservers/smoketest_contacts_server.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/testexecuteservers/smoketest_contacts_server.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,7 @@ + + + + smoketest_contacts_server + smoketest_contacts.mmp + smoketest\contacts\group\bld.inf + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/testexecuteservers/smoketest_mess_server.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/testexecuteservers/smoketest_mess_server.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,27 @@ + + + + smoketest_mess_server + smoketest_mess.mmp + smoketest\messaging\group\bld.inf + + + smoketest_utils.dll + c:\system\libs\smoketest_utils.dll + smoketest_utils.mmp + smoketest\utils\group\bld.inf + + + SmokeTestSecureFSclient.dll + c:\system\libs\SmokeTestSecureFSclient.dll + SmokeTestSecureFSclient.mmp + smoketest\utils\group\bld.inf + + + SmokeTestSecureFSserver.exe + c:\system\libs\SmokeTestSecureFSserver.exe + SmokeTestSecureFSserver.mmp + smoketest\utils\group\bld.inf + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/smoketest/testexecuteservers/smoketest_timew_server.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/smoketest/testexecuteservers/smoketest_timew_server.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,15 @@ + + + + smoketest_timew_server + smoketest_timew.mmp + smoketest\timew\group\bld.inf + + + consolealarmalertserver.dll + c:\system\libs\consolealarmalertserver.dll + consolealarmalertserver.mmp + smoketest\timew\consolealarmalertserver\bld.inf + + + diff -r 000000000000 -r 9736f095102e buildverification/smoketest/xml/xml.driver --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildverification/smoketest/xml/xml.driver Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,78 @@ + + + + + + + smoketest_agenda + + + smoketest_contacts + + + smoketest_utils + smoketestsecurefsclient + smoketestsecurefsserver + + + smoketest_mess + + + consolealarmalertserver + + + smoketest_timew + + + + + + smoketest_system + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/data/ipadm.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/data/ipadm.rss Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,180 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ipadm.rss - IP adminstration tool resource file +// + +NAME IPAD + +#include + +#include "ipadm.hrh" + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf=""; } + +RESOURCE EIK_APP_INFO + { + menubar=r_IpAdm_menubar; + hotkeys=r_IpAdm_hotkeys; +#ifdef CRYSTAL + cba = r_IpAdm_cba; +#else + toolbar=r_IpAdm_toolbar; +#endif + } + +#ifdef CRYSTAL + +RESOURCE CBA r_IpAdm_cba +{ + buttons = + { + CBA_BUTTON + { + id=EIpAdmInterfaces; + txt="Interfaces"; + }, + CBA_BUTTON + { + id=EIpAdmRoutes; + txt="Routes"; + }, + CBA_BUTTON + { + id=EEikCmdExit; + txt="Exit"; + } + }; +} + +#else // not CRYSTAL (Pre-ER6 and Hurricane) + +RESOURCE TOOLBAR r_IpAdm_toolbar + { + controls= + { + TBAR_CTRL + { + id=EIpAdmFilename; + type=EEikCtFileNameLabel; + flags=EEikToolBarCtrlHasSetMinLength; + length=KEikStdFileNameLabelHeight; + }, + TBAR_BUTTON + { + flags=EEikToolBarCtrlIsStretchable; + id=EIpAdmInterfaces; + txt="Interfaces"; + }, + TBAR_BUTTON + { + flags=EEikToolBarCtrlIsStretchable; + id=EIpAdmRoutes; + txt="Routes"; + }, + TBAR_BUTTON + { + flags=EEikToolBarCtrlIsStretchable; + id=EIpAdmAddRoutes; + txt="AddRoutes"; + } + }; + } +#endif //CRYSTAL + +RESOURCE HOTKEYS r_IpAdm_hotkeys + { + control= + { + HOTKEY { command=EEikCmdExit; key='e'; } + }; + } + +RESOURCE MENU_BAR r_IpAdm_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_IpAdm_file_menu; txt="File"; }, + MENU_TITLE { menu_pane=r_IpAdm_console_menu; txt="Console"; } + }; + } + +RESOURCE MENU_PANE r_IpAdm_file_menu + { + items= + { + MENU_ITEM { command=EIpAdmInterfaces; txt="Interfaces"; }, + MENU_ITEM { command=EIpAdmRoutes; txt="Routes"; }, + MENU_ITEM { command=EIpAdmAddRoutes; txt="Add Routes"; }, + MENU_ITEM { command=EEikCmdExit; txt="Exit"; } + }; + } + +RESOURCE MENU_PANE r_IpAdm_console_menu + { + items= + { + MENU_ITEM + { + command=EIpAdmClearScreen; + txt="ClearScreen"; + }, + MENU_ITEM + { + command=EConsolFontDialog; + txt="Set font…"; + }, + MENU_ITEM + { + command=EConsolHistoryDialog; + txt="History size…"; + }, + MENU_ITEM + { + cascade=r_IpAdm_toolbars_menu; + txt="Toolbars"; + } + + }; + } + +RESOURCE MENU_PANE r_IpAdm_toolbars_menu + { + items= + { + MENU_ITEM + { + command=EConsolScrollNone; + txt="None"; + }, + MENU_ITEM + { + command=EConsolScrollHor; + txt="Horiz only"; + }, + MENU_ITEM + { + command=EConsolScrollVert; + txt="Vert only"; + }, + MENU_ITEM + { + command=EConsolScrollBoth; + txt="Both scrollbars"; + } + }; + } + +RESOURCE TBUF r_busy { buf="Busy…"; } diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/data/ipadm_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/data/ipadm_reg.rss Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 + +UID2 KUidAppRegistrationResourceFile +UID3 0x10000887 // Ipadm UID + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "ipadm"; + } diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/data/route.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/data/route.ini Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,54 @@ +# Copyright (c) 2004-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: +# // route.ini - a configuration file for ipadm +# THIS IS AN EXAMPLE FILE +# This file should be located in C:\Data\IpAdm\route.ini. +# This file is processed by IpAdm when you push the +# Add Routes -button. +# Each line starting with route-add followed by positional +# parameters is directly used as a KSoInetAddRoute parameter: +# route-add [interface] +# If optional parameter interface is omitted, gateway address +# determines the interface. With this command you can add static +# routes into the routing table. +# Some 6to4 route examples +# route-add 2001:: ffff:: 1 2002:c171:3a50::c171:3a50 +# route-add 3ffe:: ffff:: 1 2002:c171:3a50::c171:3a50 +# route-add 2001:: ffff:: 1 2002:836b:4179::836b:4179 +# route-add 3ffe:: ffff:: 1 2002:836b:4179::836b:4179 +# Some other examples +# route-add 172.21.40.1 255.255.254.0 1 - 172.21.40.106 +# route-add 3ffe:501:fffff:ff05:: ffff:ffff:ffff:ffff:: 1 3ffe:501:ffff:ff03:200:ff:fe00:a0a0 fe80::260:63ff:fe01:d6a9 +# To add a default route, use zero address and prefix +# route-add :: :: 1 3ffe:501:ffff:ff03:200:ff:fe00:a0a0 fe80::260:63ff:fe01:d6a9 +# route-add 0.0.0.0 0.0.0.0 1 172.21.40.1 182.21.40.106 +# Similarly you can configure interfaces with ifconfig +# ifconfig prefix ["alias"] ["up"/"down"] ["delete"] +# ifconfig ethernet 10.0.5.3 alias +# ifconfig ethernet 3ffe:501:ffff:100:: prefix 64 alias +# ifconfig ethernet fe80::200:ff:f00:a0a0 prefix 64 delete +# ifconfig ethernet fe80::260:63ff:fe01:d6a9 prefix 64 up +# If you want to initiate DAD on the fly you need to remove +# all addresses of specific interface identifier from an interface +# and then define a new interface identifier to be checked by DAD: +# ifconfig ethernet 3ffe:501:ffff:100:200:ff:fe00:a0a0 prefix 64 delete +# ifconfig ethernet fe80::200:ff:fe00:a0a0 prefix 64 delete +# ifconfig ethernet fe80::260:63ff:fe01:d6a9 prefix 64 delete +# ifconfig ethernet fe80::260:63ff:fe01:d6a9 prefix 64 up +# The above method is handy for example when running the TAHI +# stateless address autoconfiguration tests requiring frequently +# all addresses to be removed and DAD to be performed for link-local +# address. With EPOC you don't need to reboot, just have appropriate +# settings in route.ini and push the Add Routes button in IpAdm. +# diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,66 @@ +// 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: +// bld.inf - IP administration tool. +// IP administration tool. +// + + + +/** + @file +*/ + +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 + +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 + +PRJ_TESTEXPORTS + +../group/ipadm.iby /epoc32/rom/include/ipadm.iby + +../data/route.ini /epoc32/wins/c/private/10000887/route.ini +../data/route.ini /epoc32/winscw/c/private/10000887/route.ini + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. Note that you should specify any .mmp files for test +// programs further down the file. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released to the rest of the company +// specify "ignore" if the MMP file exists but should be +// ignored. + + +PRJ_TESTMMPFILES +// specify the .mmp files required for building any test programs here +// +// You can specify "manual" to denote that a test should be listed in a +// generated batch file for running a group of tests +// which require user input during testing. +// You can specify "support" to denote that a file is a test support file +// and shouldn't be listed in a batch file for running a group of tests +// By default, each test will be listed in a batch file for running a group +// of tests which can be left to run without requiring watching over +// by the person running the tests, i.e. tests where no user +// input is required. The default will apply if neither "manual" +// or "support" is specified. + +ipadm.mmp diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/group/ipadm.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/group/ipadm.iby Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __IPADM_IBY__ +#define __IPADM_IBY__ + +REM static dependencies +#include +#include + +file=ABI_DIR\DEBUG_DIR\ipadm.exe sys\bin\ipadm.exe +data=MULTI_LINGUIFY(RSC EPOCROOT##epoc32\data\Z\resource\Apps\ipadm resource\Apps\ipadm) +data=MULTI_LINGUIFY(RSC EPOCROOT##epoc32\data\Z\private\10003a3f\Apps\ipadm_reg private\10003a3f\Apps\ipadm_reg) + +#endif // __IPADM_IBY__ diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/group/ipadm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/group/ipadm.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +// ipadm.mmp - IP administration tool MMP file +// IP administration tool. +// + + + +/** + @file +*/ + +MACRO EPOC_SDK=0x08000000 + +TARGET ipadm.exe +TARGETTYPE exe +MACRO MAKE_EXE_APPLICATION +UID 0 0x10000887 + +EPOCSTACKSIZE 0x5000 +TARGETPATH /sys/bin + +SOURCEPATH ../src + +SOURCE ipadm.cpp engine.cpp uniload.cpp + + +// UI FW v2 RESOURCE section begins +START RESOURCE ../data/ipadm.rss +HEADER +TARGETPATH /resource/apps +END + +START RESOURCE ../data/ipadm_reg.rss +TARGETPATH /private/10003a3f/apps +END + +// UI FW v2 RESOURCE section ends + + +USERINCLUDE ../inc +SYSTEMINCLUDE ../../../../../os/networkingsrv/networkprotocols/iphook/inhook6/inc + +SYSTEMINCLUDE /epoc32/include/techview +SYSTEMINCLUDE /epoc32/include + +LIBRARY euser.lib apparc.lib +LIBRARY cone.lib eikcore.lib eikcoctl.lib +LIBRARY efsrv.lib eikcdlg.lib etext.lib +LIBRARY esock.lib insock.lib + +CAPABILITY ALL -Tcb + +VENDORID 0x70000001 + +SMPSAFE diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/group/networking_ipadm.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/group/networking_ipadm.history.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/group/networking_ipadm.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/group/networking_ipadm.mrp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +# + +component networking_ipadm +source \sf\app\techview\networkingutils\ipadministrationtool +notes_source \component_defs\release.src + +# == comments appear after the line they describe == +ipr T +# Can be distributed with Cust Kits +# Cannot be distributed with Dev Kits + diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/inc/engine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/inc/engine.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// engine.h - IP administration tool engine +// + + + +/** + @internalComponent +*/ + +#ifndef __ENGINE_H +#define __ENGINE_H + +#include +#include +#include +#include +#include + +class CIpAdmView; + +class CIpAdmEngine : public CBase + { +public: + CIpAdmEngine(CIpAdmView *aView) : iAppView(aView) {} + ~CIpAdmEngine(); + void ConstructL(); + void HandleCommandL(TInt aCommand); +private: + CIpAdmView *iAppView; + void Show(TInt aVersion, const TSoInetInterfaceInfo &aInfo); + void Show(TInt aVersion, const TSoInetRouteInfo &aInfo); + void ListInterfaces(TInt aVersion, const TDesC &aProtocol); + void ListRoutes(TInt aVersion, const TDesC &aProtocol); + void AddRoutes(const TDesC &aProtocol); +public: + RFs iFS; + RSocketServ iSS; + void CheckResultL(const TDesC &aText, TInt aResult); + TInt CheckResult(const TDesC &aText, TInt aResult); + void ShowText(const TDesC &aText); + }; + +#endif diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/inc/ipadm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/inc/ipadm.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,155 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ipadm.h - IP administration tool main module +// + + + +/** + @internalComponent +*/ + +#ifndef __IPADM_H +#define __IPADM_H + +//#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include "ipadm.hrh" + +const TUid KUidIpAdmApp = {0x10000887}; +// +// CSimpleConsole +// +enum TMessageControlFontStyle + { + EStyleElementBold=EMenuCommandBold, + EStyleElementItalic=EMenuCommandItalic, + EStyleElementInverse=EMenuCommandInverse, + EStyleElementUnderline=EMenuCommandUnderline, + EStyleElementColor=EMenuCommandColor + }; + +class CConsoleControl : public CCoeControl + { +public: + CConsoleControl() {} + ~CConsoleControl(); + void ConstructL(const TPoint& aLeftTop, const TSize& aSize, TInt aFlags); + void HandleCommandL(TInt aCommand); + void ActivateL(); + void SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility); + void DrawCursor(); + void Write(const TDesC &aDes); + CEikConsoleControl *ConsoleControl() const; + TBool UpdateScrollBars(); + void ClearScreen(); + void Redraw(const TRect &aRect); + void Lf(); +protected: + void FocusChanged(TDrawNow aDrawNow); +private: + void ToggleFontStyleAndRedrawL(TMessageControlFontStyle aStyleElement); + +private: + CEikConsoleScreen* iConsole; + TInt iHistory; + }; + + +// +// class CIpAdmView +// +class CIpAdmEngine; +class CIpAdmView : public CCoeControl, public MCoeControlBrushContext + { +public: + ~CIpAdmView(); + void ConstructL(const TRect& aRect); + + void StartL(); + void StopL(); + TInt CountComponentControls() const; + CCoeControl* ComponentControl(TInt aIndex) const; + void Write(const TDesC &aDes); + void ClearScreenL(); + void ShowError(TInt aId); + + void HandleCommandL(TInt aCommand); +private: + void Draw(const TRect& /*aRect*/) const; + + //Component Controls + void CreateBigConsoleL(TInt aFlags); + + void ShowError(const TDes &msg); + void ShowError(const TDes &msg, TInt aErr); + +private: + CConsoleControl* iConsole; + + CIpAdmEngine *iModel; + TBool iRunning; + }; + + +// +// CIpAdmAppUi +// +class CIpAdmAppUi : public CEikAppUi + { +public: + void ConstructL(); + ~CIpAdmAppUi(); + +private: + void HandleCommandL(TInt aCommand); + // TBool LaunchOptionsDialog(CUDPSendEngine* aModel); + // void LaunchAboutDialog(); +private: + CIpAdmView* iAppView; +// CHelpTask *iHelp; + }; + +// +// CIpAdmDocument +// +class CIpAdmDocument : public CEikDocument + { +public: + CIpAdmDocument(CEikApplication& aApp); +private: + CEikAppUi* CreateAppUiL(); + }; + +// +// CIpAdmAppUi +// +class CIpAdmApplication : public CEikApplication + { +private: // from CApaApplication + CApaDocument* CreateDocumentL(); + TUid AppDllUid() const; + }; + + +#endif diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/inc/ipadm.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/inc/ipadm.hrh Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,57 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ipadm.hrh - IP administration tool ui constants +// + + + +/** + @internalComponent +*/ + +enum TIpAdmMenuCommands + { + EIpAdmFilename = 100, + EIpAdmInterfaces, + EIpAdmRoutes, + EIpAdmAddRoutes, + EIpAdmCache, + EIpAdmUpdates, + + EConsolHistoryDialog, + EConsolFontDialog, + EConsolScrollNone, + EConsolScrollHor, + EConsolScrollVert, + EConsolScrollBoth, + + EIpAdmClearScreen, + + EMenuCommandLongLine, + EMenuScreenSize, + EMenuCursorSize, + EMenuWindowType , + EMenuCommandFileExit, + + EMenuCommandHideCursor, + EMenuCommandIgnoreCursor, + EMenuCommandScrollLock, + EMenuCommandPrintable, + + EMenuCommandInverse, + EMenuCommandBold, + EMenuCommandItalic, + EMenuCommandUnderline, + EMenuCommandColor + }; diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/inc/uniload.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/inc/uniload.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,36 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// uniload.h - Universal file load (work for narrow or wide builds) +// + + + +/** + @internalComponent +*/ + +#ifndef __UNILOAD_H__ +#define __UNILOAD_H__ + +#include +#include + +class UnicodeLoad + { +public: + static HBufC *LoadL(RFs &aFs, const TDesC &aName); + }; + +#endif + diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/src/engine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/src/engine.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,859 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// engine.cpp - IP administration tool engine +// + +#include +#include "ipadm.h" +#include "engine.h" + +#include "uniload.h" + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + +#ifndef __SECURE_DATA__ +#define DEFAULT_ROUTES_FILE _L("C:\\Data\\IpAdm\\route.ini") +#else +#define DEFAULT_ROUTES_FILE _L("route.ini") +#endif + +LOCAL_C void AppendInterfaceStatus(TDes& buf, const TInt aStatus) + { + switch (aStatus) + { + case EIfPending: buf.Append(_L("PEND ")); break; + case EIfUp: break; + case EIfBusy: buf.Append(_L("BUSY ")); break; + case EIfDown: buf.Append(_L("DOWN ")); break; + default: buf.Append(_L("???? ")); break; + } + } + +LOCAL_C void AppendInterfaceName(TDes& buf, const TName& aName) + { + if (aName.Length() > 0) + { + buf.Append(aName); + } + else + { + buf.Append(_L("default")); + } + } + +LOCAL_C void AppendRouteType(TDes& buf, const TInt aType) + { + switch (aType) + { + case ERtNormal: buf.Append(_L(" ")); break; + case ERtUser: buf.Append(_L("u ")); break; + case ERtIcmpAdd: buf.Append(_L("- ")); break; // for IPv6, this is ND entry + case ERtIcmpDel: buf.Append(_L("d ")); break; + default: buf.Append(_L("? ")); break; + } + } + +LOCAL_C void AppendRouteState(TDes& buf, const TInt aState) + { + switch (aState) + { + case ERtNone: buf.Append(_L("NONE ")); break; + case ERtPending: buf.Append(_L("PEND ")); break; + case ERtBusy: buf.Append(_L("BUSY ")); break; + case ERtReady: break; + case ERtDown: buf.Append(_L("DOWN ")); break; + default: buf.Append(_L("???? ")); break; + } + } + +// +// +// Just count the number of rightmost zeroes in an IPv6 address +// and return (128 - count). +// +LOCAL_C TInt MaskLength(const TIp6Addr &aAddr) + { + TInt count = 0; + for (TInt i = sizeof(aAddr.u.iAddr8) / sizeof(aAddr.u.iAddr8[0]); --i >= 0; ) + { + if (aAddr.u.iAddr8[i]) + { + TUint8 nonZeroByte = aAddr.u.iAddr8[i]; + while ((nonZeroByte & 1) == 0) + { + count += 1; + nonZeroByte >>= 1; + } + break; + } + count += 8; + } + return 128-count; + } + + +LOCAL_C TInt MaskLength(TUint32 aAddr) + { + TInt count = 0; + // obviously, this is "brute force" counting + while (aAddr & 0x80000000) + { + count++; + aAddr <<= 1; + } + return count; + } + + +// TRawAddr +// ********* +// Lightweight internal help class for handling the link layer addresses +// +class TRawAddr : public TSockAddr + { +public: + + void Output(TDes& aBuf) const + { + TUint8* p = (TUint8*)UserPtr(); + TInt len = ((TSockAddr *)this)->GetUserLen(); //lint !e1773 // it's a kludge but works anyway + + aBuf.SetLength(0); + if (len == 0) + return; + if (aBuf.MaxLength() < len * 4) + { + aBuf.Fill('*', aBuf.MaxLength()); + return; + } + if (len == 0) + return; + for (;;) + { + aBuf.AppendFormat(_L("%02X"), *p++ & 0xFF); + if (--len == 0) + break; + aBuf.Append(TChar(':')); + } + } + + inline static TRawAddr& Cast(const TSockAddr& aAddr) + { + return *((TRawAddr *)&aAddr); //lint !e1773 // standard way to implement Cast + } + inline static TRawAddr& Cast(const TSockAddr* aAddr) + { + return *((TRawAddr *)aAddr); //lint !e1773 // standard way to implement Cast + } + }; + +// +CIpAdmEngine::~CIpAdmEngine() + { + // + // Ordering is important... Do not close iSS before + // all sockets associated with it have been closed! + // + iFS.Close(); + iSS.Close(); + } + +void CIpAdmEngine::ConstructL() + { + // + // Start Socket Reader activity + // + CheckResultL(_L("Active Scheduler"), CActiveScheduler::Current() == NULL); + CheckResultL(_L("Connect to File server"), iFS.Connect()); + CheckResultL(_L("Connect to Socket server"), iSS.Connect()); + } + + +LOCAL_C void AppendIpAddress(TDes &buf, const TDesC &aLabel, const TInetAddr &aAddr, TInt aSkip = 1) + { + if (aSkip && aAddr.IsUnspecified()) + return; + TBuf<64> out; + buf.Append(aLabel); +#ifdef HURRICANE_INSOCK + aAddr.Output(out); +#else + aAddr.OutputWithScope(out); +#endif + buf.Append(out); + } + +LOCAL_C void AppendRawAddress(TDes &buf, const TDesC &aLabel, const TSockAddr &aAddr) + { + if (aAddr.Family() == KAFUnspec) + return; + TBuf<100> out; + buf.Append(aLabel); + TRawAddr::Cast(aAddr).Output(out); + buf.Append(out); + } + +LOCAL_C void AppendIpMask(TDes &buf, const TInetAddr &aAddr) + { + if (aAddr.Family() == KAfInet6) + buf.AppendFormat(_L("/%d"), MaskLength(aAddr.Ip6Address())); + else + buf.AppendFormat(_L("/%d"), MaskLength(aAddr.Address())); + } + +void CIpAdmEngine::Show(TInt /*aVersion*/, const TSoInetInterfaceInfo &aInfo) + { + TBuf<1000> buf; + buf = _L("if "); + AppendInterfaceStatus(buf, aInfo.iState); + AppendInterfaceName(buf, aInfo.iName); + AppendIpAddress(buf, _L(" addr="), (const TInetAddr &)aInfo.iAddress, 0); + AppendIpMask(buf, (const TInetAddr &)aInfo.iNetMask); + AppendIpAddress(buf, _L(" bcast="), (const TInetAddr &)aInfo.iBrdAddr); + AppendIpAddress(buf, _L(" gw="), (const TInetAddr &)aInfo.iDefGate); + AppendIpAddress(buf, _L(" ns1="), (const TInetAddr &)aInfo.iNameSer1); + AppendIpAddress(buf, _L(" ns2="), (const TInetAddr &)aInfo.iNameSer2); + AppendRawAddress(buf, _L(" hwa="), aInfo.iHwAddr); + buf.AppendFormat(_L(" Mtu=%d, SM=%d, F=%x"), aInfo.iMtu, aInfo.iSpeedMetric, (TUint)aInfo.iFeatures); + ShowText(buf); + } + +void CIpAdmEngine::Show(TInt /*aVersion*/, const TSoInetRouteInfo &aInfo) + { + TBuf<1000> buf; + buf = _L("rt"); + AppendRouteType(buf, aInfo.iType); + AppendRouteState(buf, aInfo.iState); + AppendIpAddress(buf, _L(""), (const TInetAddr &)aInfo.iDstAddr, 0); + AppendIpMask(buf, (const TInetAddr &)aInfo.iNetMask); + // the iIfAddr is actually the src address to be used for this route destination + AppendIpAddress(buf, _L(" src="), (const TInetAddr &)aInfo.iIfAddr); + if (aInfo.iGateway.Family() == KAfInet6 || aInfo.iGateway.Family() == KAfInet) + AppendIpAddress(buf, _L(" gw="), (const TInetAddr &)aInfo.iGateway); + else + AppendRawAddress(buf, _L(" hwa="), aInfo.iGateway); + buf.AppendFormat(_L(" M=%d"), aInfo.iMetric); + ShowText(buf); + } + +void CIpAdmEngine::ListInterfaces(TInt aVersion, const TDesC &aProtocol) + { + RSocket socket; + + if (CheckResult(aProtocol, socket.Open(iSS, aProtocol)) != KErrNone) + return; + if (socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl) == KErrNone) + { + TPckgBuf opt; + while (socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, opt) == KErrNone) + Show(aVersion, opt()); + } + socket.Close(); + } + +void CIpAdmEngine::ListRoutes(TInt aVersion, const TDesC &aProtocol) + { + RSocket socket; + + if (CheckResult(aProtocol, socket.Open(iSS, aProtocol)) != KErrNone) + return; + if (socket.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl) == KErrNone) + { + TPckgBuf opt; + while (socket.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, opt) == KErrNone) + Show(aVersion, opt()); + } + socket.Close(); + } + +class TParser : public TLex + { +public: + TParser(const TDesC &aStr); + void NextToken(); + int SkipSpaceAndMark(); + TInt ParameterValue(const TDesC &aKey, TInt &aValue, const TInt aDefault = 0); + TInt ParameterValue(const TDesC &aKey, TInetAddr &aValue); + TLexMark iLine; + TLexMark iCurrent; + TPtrC iLastLine; + TPtrC Line(); + inline void MarkLine() { iCurrent = iLine; iOpen = 1; } + TPtrC iToken; + TInt iOpen; + TInt iFirst; // Non-zero, if next token is first in line + }; + +#pragma warning (disable:4097) +TParser::TParser(const TDesC &aStr) : TLex(aStr), iLine(), iCurrent(), iLastLine(), iToken(), iOpen(0), iFirst(1) + { + Mark(iLine); + MarkLine(); + } +#pragma warning (default:4097) + +// +// Return current line as a descriptor +// (and skip to the next line, if not fully parsed) +// +TPtrC TParser::Line() + { + if (iOpen) + { + // Line not fully parsed yet, search to the EOL + while (!Eos()) + { + TChar ch = Get(); + if (ch == '\n' || ch == '\r') + { + iLastLine.Set(MarkedToken(iCurrent)); + iOpen = 0; + Mark(iLine); + break; + } + } + } + return iLastLine; + } +// +// Skip white space and mark, including comments! +// +int TParser::SkipSpaceAndMark() + { + TChar ch; + TInt comment = 0; + TInt newline = 0; + + while (!Eos()) + { + ch = Get(); + if (ch =='\n') + { + comment = 0; + newline = 1; + if (iOpen) + { + iLastLine.Set(MarkedToken(iCurrent)); + iOpen = 0; + } + Mark(iLine); + } + else if (comment || ch == '#') + comment = 1; + else if (!ch.IsSpace()) + { + UnGet(); + break; + } + } + Mark(); + return newline; + } + +// +// Extract Next token and return +// +void TParser::NextToken() + { + if (SkipSpaceAndMark()) + iFirst = 1; // New line! + if (Eos()) + { + iFirst = -1; + return; + } + while (!Eos()) + { + TChar ch = Peek(); + if (ch == '#' || ch.IsSpace()) + break; + Inc(); + } + iToken.Set(MarkedToken()); + iFirst = SkipSpaceAndMark(); + } + +TInt TParser::ParameterValue(const TDesC &aKey, TInt &aValue, const TInt aDefault) + { + if (aKey.Compare(iToken) != 0) + return KErrNotFound; // Doesn't match, do nothing + // + // When the keyword matches, return is always KErrNone + // (caller must deduce errors by aDefault. + // + if (iFirst) + aValue = aDefault; + else if (Val(aValue) == KErrNone) + iFirst = SkipSpaceAndMark(); + else + aValue = aDefault; + return KErrNone; + } + +TInt TParser::ParameterValue(const TDesC &aKey, TInetAddr &aValue) + { + if (aKey.Compare(iToken) != 0) + return KErrNotFound; // Doesn't match, do nothing + // + // When the keyword matches, return is always KErrNone + // (caller must deduce errors by aDefault. + // + if (!iFirst) + { + NextToken(); + if (aValue.Input(iToken) == KErrNone) + return KErrNone; + } + aValue.SetFamily(0); + return KErrNone; + } + + +void CIpAdmEngine::AddRoutes(const TDesC &aProtocol) + { + TInt err = KErrNone; + RSocket socket; + + if (CheckResult(aProtocol, socket.Open(iSS, aProtocol)) != KErrNone) + return; + + HBufC *buf = NULL; +#ifndef __DATA_CAGING__ + TRAP(err, buf = UnicodeLoad::LoadL(iFS, DEFAULT_ROUTES_FILE)); + if (CheckResult(DEFAULT_ROUTES_FILE, err)) +#else // __DATA_CAGING__ +// get private path + TFileName filename; + RFs theFS; + + theFS.Connect(); + theFS.PrivatePath(filename); + theFS.Close(); + filename.Append(DEFAULT_ROUTES_FILE); + + TRAP(err, buf = UnicodeLoad::LoadL(iFS, filename)); + if (CheckResult(filename, err)) +#endif // __DATA_CAGING__ + { + socket.Close(); + return; + } + //lint -save -e613 Trapped above + TParser inifile(*buf); //lint -restore + TInt route_count = 0; + TInt if_count = 0; + while (!err) + { + // Skip until first token in line + while (inifile.iFirst == 0) + inifile.NextToken(); + if (inifile.iFirst < 0) + break; + + // + // The route file is a simple list of lines with following format + // + inifile.NextToken(); + inifile.MarkLine(); + if ((inifile.iToken.Compare(_L("route-add")) == 0)) + { + // route-add destination netmask metric gateway interface + // + // all except the "metric" are assumed to be addresses + // + TPckgBuf opt; + opt().iType = ERtUser; + opt().iState = ERtReady; + opt().iIfAddr.SetFamily(KAFUnspec); + for (int i = 0; !err && inifile.iFirst == 0; ++i) + { + switch (i) + { + case 0: // Destination + inifile.NextToken(); + err = (TInetAddr::Cast(opt().iDstAddr)).Input(inifile.iToken); + break; + case 1: // Netmask + inifile.NextToken(); + err = (TInetAddr::Cast(opt().iNetMask)).Input(inifile.iToken); + break; + case 2: // metric + err = inifile.Val(opt().iMetric); + break; + case 3: // Gateway + inifile.NextToken(); + if (inifile.iToken.Compare(_L("-")) == 0) + opt().iGateway.SetFamily(KAFUnspec); + else + err = (TInetAddr::Cast(opt().iGateway)).Input(inifile.iToken); + break; + case 4: // Interface + inifile.NextToken(); + if (inifile.iToken.Compare(_L("-")) == 0) + opt().iIfAddr.SetFamily(KAFUnspec); + else + err = (TInetAddr::Cast(opt().iIfAddr)).Input(inifile.iToken); + break; + default: + inifile.NextToken(); + break; + } + inifile.SkipSpaceAndMark(); + } + if (err) + { + ShowText(_L("Syntax error on line")); + ShowText(inifile.Line()); + break; + } + else if (CheckResult(inifile.Line(), socket.SetOpt(KSoInetAddRoute, KSolInetRtCtrl, opt)) == KErrNone) + route_count++; + } + else if ((inifile.iToken.Compare(_L("ifconfig")) == 0)) + { + // + // For now only simple format + // + // ifconfig interface [address [remote]] [parameters] + // + // perameters can be + // + // prefix n netmask (ip4)/prefix (ip6) [default 32/128]. This *IS* not same + // as Unix ifconfig. Here the value tells whether a "single address" + // or netmask/prefix configuration is to be performed. + // + // *NOTE* prefix splits the bits in the address into two sections: (prefix,id) + // if prefix part is non-ZERO, it will be added as if router had sent + // RA with prefix option with L=1, A=1 + // if id part is non-ZERO, it will be processed as interface id (alias + // keyword will control whether this is primary or additional). + // + // *NOTE* prefix 128 => id part is zero length, assumed ZERO + // prefix 0 => prefix part is zero length, and treated as ZERO + // + // *NOTE* If configuring for single address, do not specify prefix! + // + // alias specify additional network address ([address] required) + // 'alias' is not present, but [address] is, then the primary + // network address is configured. + // delete remove specified network address + // down mark interface down + // up mark interface up + // metric n set metric to n + // mtu n set MTU to n + // ns1 address nameserver 1 address + // ns2 address nameserver 2 address + // proxy speficy address as proxy + // anycast specify address as anycast + // + + TPckgBuf opt; +#if 1 + opt().iDoState = 0; + opt().iDoId = 0; + opt().iDoPrefix = 0; + opt().iDoAnycast = 0; +#ifndef HURRICANE_INSOCK + opt().iDoProxy = 0; +#endif + opt().iAlias = 0; + opt().iDelete = 0; + opt().iAddress.SetFamily(0); + opt().iDefGate.SetFamily(0); + opt().iNetMask.SetFamily(0); + opt().iNameSer1.SetFamily(0); + opt().iNameSer2.SetFamily(0); + opt().iMtu = 0; + opt().iSpeedMetric = 0; +#else + // unfortunately, this does not work.. "has initialized data" in MARM compile! + static const TSoInet6InterfaceInfo init_opt; + opt() = init_opt; +#endif + TInt prefix = -1; + for (int i = 0; !err && inifile.iFirst == 0; ++i) + { + inifile.NextToken(); + switch (i) + { + case 0: // Interface Name + opt().iName = inifile.iToken; + opt().iTag = inifile.iToken; + break; + case 1: // Address + if ((TInetAddr::Cast(opt().iAddress)).Input(inifile.iToken) != KErrNone) + { + i = 2; // We won't have remote address either! + goto parameters; //lint !e801 // no clean way to do it without goto + } + break; + case 2: // Remote Address + if ((TInetAddr::Cast(opt().iDefGate)).Input(inifile.iToken) == KErrNone) + break; + //lint -fallthrough + default: +parameters: + if (opt().iDoState == 0) + { + if (inifile.iToken.Compare(_L("down")) == 0) + { + opt().iState = EIfDown; + opt().iDoState = 1; + break; + } + if (inifile.iToken.Compare(_L("up")) == 0) + { + opt().iState = EIfUp; + opt().iDoState = 1; + break; + } + } + if (opt().iDoAnycast == 0 && +#ifndef HURRICANE_INSOCK + opt().iDoProxy == 0 && +#endif + prefix < 0) + { + // Only one of 'proxy' or 'anycast' can be present. Also, prefix must not + // be present. + if (inifile.iToken.Compare(_L("anycast")) == 0) + { + opt().iDoAnycast = 1; + break; + } + else if (inifile.iToken.Compare(_L("proxy")) == 0) + { +#ifndef HURRICANE_INSOCK + opt().iDoProxy = 1; +#endif + break; + } + } + if (opt().iNameSer1.Family() == 0 && inifile.ParameterValue(_L("ns1"), opt().iNameSer1) == KErrNone) + break; + if (opt().iNameSer2.Family() == 0 && inifile.ParameterValue(_L("ns2"), opt().iNameSer2) == KErrNone) + break; + if (opt().iDelete == 0 && inifile.iToken.Compare(_L("delete")) == 0) + { + opt().iDelete = 1; + break; + } + if (opt().iAlias == 0 && inifile.iToken.Compare(_L("alias")) == 0) + { + opt().iAlias = 1; + break; + } + if (opt().iMtu == 0 && inifile.ParameterValue(_L("mtu"), opt().iMtu) == KErrNone) + break; + if (opt().iSpeedMetric == 0 && inifile.ParameterValue(_L("metric"), opt().iSpeedMetric) == KErrNone) + break; + if (opt().iDoAnycast == 0 && +#ifndef HURRICANE_INSOCK + opt().iDoProxy == 0 && +#endif + prefix < 0 && + inifile.ParameterValue(_L("prefix"), prefix, 129) == KErrNone) + { + // prefix == 129, if value is missing => Error + if (prefix > 128) + err = KErrArgument; + break; + } + err = KErrGeneral; + break; + } + inifile.SkipSpaceAndMark(); + } + if (!err) + { + // Munge the prefix information into TSoInet6InterfaceInfo + if (prefix < 0) + { + // No prefix present, iNetMask is left unspecified, + // request "single address" processing (prefix = 128) + opt().iDoId = 1; + opt().iDoPrefix = 1; + } + else if (opt().iAddress.Family() == KAfInet && prefix <= 32) + { + // IPv4 processing -- defines the netmask + const TUint32 mask = ~0UL << (32 - prefix); + const TUint32 addr = opt().iAddress.Address(); + TInetAddr::Cast(opt().iNetMask).SetAddress(mask); + if (mask & addr) + opt().iDoPrefix = 1; + if ((~mask) & addr) + opt().iDoId = 1; + } + else if (opt().iAddress.Family() == KAfInet6 && prefix <= 128) + { + // IPv6 processing + TInetAddr p; + // Is Prefix part all zeroes? + p.Prefix(TInetAddr::Cast(opt().iAddress), prefix); + if (!p.Ip6Address().IsUnspecified()) + opt().iDoPrefix = 1; + TInetAddr::Cast(opt().iNetMask).PrefixMask(prefix); + // Is Id part all zeroes? + p.SetAddress(TInetAddr::Cast(opt().iAddress).Ip6Address()); + const TIp6Addr addr = p.Ip6Address(); + const TIp6Addr mask = TInetAddr::Cast(opt().iNetMask).Ip6Address(); + if ((addr.u.iAddr32[0] & ~mask.u.iAddr32[0]) != 0 || + (addr.u.iAddr32[1] & ~mask.u.iAddr32[1]) != 0 || + (addr.u.iAddr32[2] & ~mask.u.iAddr32[2]) != 0 || + (addr.u.iAddr32[3] & ~mask.u.iAddr32[3]) != 0) + opt().iDoId = 1; + } + else + { + // incorrect of prefix value + err = KErrArgument; + } + } + if (err) + { + ShowText(_L("Syntax error on line")); + ShowText(inifile.Line()); + break; + } + else if (CheckResult(inifile.Line(), socket.SetOpt(KSoInetConfigInterface, KSolInetIfCtrl, opt)) == KErrNone) + if_count++; + } +#ifndef HURRICANE_INSOCK + else if ((inifile.iToken.Compare(_L("setscope")) == 0)) + { + // + // For now only simple format + // + // setscope interface interface2 level + // + // perameters can be + // + // interface the name of the interface to be change + // interface2 the name of the interface to used as a source for the scope values + // scope the scope of the join point [2..16] + + TPckgBuf opt1; + TPckgBuf opt2; + TInt scope = -1; + TInt i = 0; + for (i = 0; !err && inifile.iFirst == 0; ++i) + { + inifile.NextToken(); + switch (i) + { + case 0: // Interface Name (to modify) + opt1().iName = inifile.iToken; + err = CheckResult(inifile.iToken, socket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, opt1)); + break; + case 1: // Interface Name (the source) + opt2().iName = inifile.iToken; + err = CheckResult(inifile.iToken, socket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, opt2)); + break; + case 2: // Scope Level + err = inifile.ParameterValue(_L("level"), scope); + break; + default: + err = KErrArgument; + break; + } + inifile.SkipSpaceAndMark(); + } + if (err || scope < 2 || scope > 16) + { + ShowText(_L("Syntax error on line")); + ShowText(inifile.Line()); + break; + } + // + // Build a new scope id vector + // + scope -= 1; // scope array is indexed from 0 +#if 0 + for (i = 0; ++i < scope;) + opt1().iZone[i] = ~opt1().iZone[0]; + for ( ;scope < STATIC_CAST(TInt, sizeof(opt1().iZone) / sizeof(opt1().iZone[0])); ++scope) + opt1().iZone[scope] = opt2().iZone[scope]; +#else + opt1().iZone[scope] = opt2().iZone[scope]; +#endif + opt1().iIndex = opt1().iZone[0]; + err = CheckResult(inifile.Line(), socket.SetOpt(KSoInetIfQuerySetScope, KSolInetIfQuery, opt1)); + } +#endif + } + delete buf; + TBuf<80> text; + text.Format(_L("Added %d routes, configured %d interfaces"), route_count, if_count); + ShowText(text); + socket.Close(); + } + +void CIpAdmEngine::HandleCommandL(TInt aCommand) + { + switch (aCommand) + { + case EIpAdmInterfaces: + ListInterfaces(4,_L("udp")); +// ListInterfaces(6,_L("udp6")); + break; + case EIpAdmRoutes: + ListRoutes(4, _L("udp")); +// ListRoutes(6, _L("udp6")); + break; + case EIpAdmAddRoutes: + AddRoutes(_L("udp")); + break; + default: + break; + } + } + + +// +// CIpAdmEngine::CheckResult +// Output success or fail message, returns the error code +// +TInt CIpAdmEngine::CheckResult(const TDesC &aText, TInt aResult) + { + if (aResult == KErrNone) + return KErrNone; + + TBuf<100> err; + CEikonEnv::Static()->GetErrorText(err, aResult); + + TBuf<200> str(aText); + str.AppendFormat(_L(" returned with [%s] "), err.PtrZ()); + iAppView->Write(str); + + return aResult; + } +// +// CIpAdmEngine::CheckResultL +// Output success or fail message, and Leave if the code is not +// KErrNone. +// +void CIpAdmEngine::CheckResultL(const TDesC &aText, TInt aResult) + { + if (CheckResult(aText, aResult) != KErrNone) + User::Leave(aResult); + } + +void CIpAdmEngine::ShowText(const TDesC &aText) + { + iAppView->Write(aText); + } + diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/src/ipadm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/src/ipadm.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,468 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ipadm.cpp - IP administration tool main module +// + +#include +#ifndef CALYPSO +#include +#endif + +#if EPOC_SDK < 0x06000000 +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#endif + +#ifdef MAKE_EXE_APPLICATION +#include +#endif + +#include "ipadm.h" +#include "engine.h" + +// +// CConsoleControl +// +CConsoleControl::~CConsoleControl() + { + delete iConsole; + } + +void CConsoleControl::ConstructL(const TPoint& aTopLeft, const TSize& aSize, TInt aFlags) + { + TRect rect(aTopLeft,aTopLeft + aSize.AsPoint()); +#if EPOC_SDK >= 0x06000000 + SetRect(rect); +#else + SetRectL(rect); +#endif + iConsole= new (ELeave) CEikConsoleScreen; + iConsole->ConstructL(_L("TEST"),aTopLeft,aSize,aFlags,EEikConsWinInPixels); + iConsole->SetHistorySizeL(200,0); + //iConsole->SetAllPrintable(ETrue); + iHistory=200; + } + +void CConsoleControl::ActivateL() + { + CCoeControl::ActivateL(); + iConsole->SetKeepCursorInSight(TRUE); + iConsole->DrawCursor(); + iConsole->SetAtt(ATT_NORMAL); + } + +void CConsoleControl::HandleCommandL(TInt aCommand) + { + switch (aCommand) + { + case EConsolFontDialog: +#if EPOC_SDK >= 0x06000000 + { +#ifndef CALYPSO + TCharFormat charFormat; + charFormat.iFontSpec = iConsole->Font(); + TCharFormatMask dummy; + if (CEikFontDialog::RunDlgLD(charFormat, dummy)) + { + //charFormat.iFontSpec.iTypeface.SetIsProportional(EFalse); + iConsole->SetFontL(charFormat.iFontSpec); + } +#endif + } +#else + { + TCharFormat charFormat; + charFormat.iFontSpec = iConsole->Font(); + TCharFormatMask dummy; + CEikFontDialog* dialog=new(ELeave) CEikFontDialog(charFormat,dummy); + if (dialog->ExecuteLD(R_EIK_DIALOG_FONT)) + { + //charFormat.iFontSpec.iTypeface.SetIsProportional(EFalse); + iConsole->SetFontL(charFormat.iFontSpec); + } + } +#endif + break; +#if 0 + case EConsolHistory: + { + CHistoryDialog* dialog2 = new(ELeave) CHistoryDialog(&iHistory); + if (dialog2->ExecuteLD(R_KMD_HISTORY_DIALOG)) + iConsole->SetHistorySizeL(iHistory,0); + } + break; +#endif + case EConsolScrollNone: + iConsole->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOff); + break; + case EConsolScrollHor: + iConsole->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto,CEikScrollBarFrame::EOff); + break; + case EConsolScrollVert: + iConsole->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto); + break; + case EConsolScrollBoth: + iConsole->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto,CEikScrollBarFrame::EAuto); + break; + default: + break; + } + } + +void CConsoleControl::FocusChanged(TDrawNow aDrawNow) + { + iConsole->ConsoleControl()->SetFocus(IsFocused(), aDrawNow); + } + +void CConsoleControl::ToggleFontStyleAndRedrawL(TMessageControlFontStyle aStyleElement) + { + switch (aStyleElement) + { + case EStyleElementColor: + if ( iConsole->Att() & ATT_COLORMASK ) // color? + iConsole->SetAtt(ATT_NORMAL); // then set normal + else // else + iConsole->SetAtt(4,11); // set 4 (darkgray) on 11 (lightgray) + break; + case EStyleElementBold: + // clear color flag (just to be sure) and switch bold flag + iConsole->SetAtt( (iConsole->Att()&(~ATT_COLORMASK)) ^ ATT_BOLD ); + break; + case EStyleElementItalic: + // clear color flag (just to be sure) and switch italic flag + iConsole->SetAtt( (iConsole->Att()&(~ATT_COLORMASK)) ^ ATT_ITALIC ); + break; + case EStyleElementInverse: + // clear color flag (just to be sure) and switch inverse flag + iConsole->SetAtt( (iConsole->Att()&(~ATT_COLORMASK)) ^ ATT_INVERSE ); + break; + case EStyleElementUnderline: + // clear color flag (just to be sure) and switch underline flag + iConsole->SetAtt( (iConsole->Att()&(~ATT_COLORMASK)) ^ ATT_UNDERLINE ); + break; + } + } + +void CConsoleControl::SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility) + { + iConsole->SetScrollBarVisibilityL(aHBarVisibility,aVBarVisibility); + iConsole->ConsoleControl()->UpdateArea(); + iConsole->UpdateScrollBars(); + iConsole->ConsoleControl()->UpdateArea(); + //TBool b=iConsole->RecalculateSize(); + } + + +void CConsoleControl::DrawCursor() + { + iConsole->DrawCursor(); + } + + +void CConsoleControl::Write(const TDesC &aMsg) + { + iConsole->Write(aMsg); + iConsole->FlushChars(); + } + +CEikConsoleControl *CConsoleControl::ConsoleControl() const + { + return iConsole->ConsoleControl(); + } + +TBool CConsoleControl::UpdateScrollBars() + { + return iConsole->UpdateScrollBars(); + } + +void CConsoleControl::ClearScreen() + { + iConsole->ClearScreen(); + } + + +void CConsoleControl::Redraw(const TRect &aRect) + { + iConsole->Redraw(aRect); + } + +void CConsoleControl::Lf() + { + iConsole->Lf(); + } + + + +// **************** +// APPLICATION VIEW +// **************** +// +void CIpAdmView::ConstructL(const TRect& aRect) + { + CreateWindowL(); +#if EPOC_SDK >= 0x06000000 + SetRect(aRect); +#else + SetRectL(aRect); +#endif + iContext = this; + iBrushStyle = CGraphicsContext::ESolidBrush; + iBrushColor = KRgbWhite; + CreateBigConsoleL(CEikConsoleScreen::ENoInitialCursor); + + StartL(); + + ActivateL(); + } + +void CIpAdmView::CreateBigConsoleL(TInt aFlags) + { + iConsole =new(ELeave) CConsoleControl; +// TRect rect=Rect(); +// rect.Shrink(3,3); + iConsole->ConstructL(Position(),Rect().Size(),aFlags); + iConsole->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto); + + } + +CIpAdmView::~CIpAdmView() + { + delete iConsole; + delete iModel; + } + +TInt CIpAdmView::CountComponentControls() const + { + return 1; + } + +CCoeControl* CIpAdmView::ComponentControl(TInt aIndex) const + { + switch (aIndex) + { + case 0: + return iConsole; + default: + return 0; + } + } + +void CIpAdmView::Draw(const TRect& /*aRect*/) const + { +#if 0 + CWindowGc& gc = SystemGc(); + + gc.SetPenStyle(CGraphicsContext::ESolidPen); + TSize penSizeBold(3,3); + gc.SetPenSize(penSizeBold); + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + + TRect rect=iConsole->Rect(); //Lines around the Console + rect.Grow(3,3); + gc.DrawRect(rect); +#endif + } + +void CIpAdmView::StartL() + { + TInt err; + + if (!iModel) + { + iModel = new CIpAdmEngine(this); + CEikonEnv::Static()->BusyMsgL(R_BUSY); + TRAP(err, iModel->ConstructL()); + CEikonEnv::Static()->BusyMsgCancel(); + if (err!=KErrNone) + { + TBuf<50> msg; + msg.Format(_L("Error initializing: %d"), err); + ShowError(msg); + StopL(); + } + } + else + CEikonEnv::Static()->InfoMsg(_L("Already Running!")); + } + + +void CIpAdmView::Write(const TDesC &aMsg) + { + iConsole->Write(aMsg); + iConsole->Write(_L("\n")); + } + +void CIpAdmView::ShowError(TInt aId) + { + iEikonEnv->InfoMsg(aId); + } + +void CIpAdmView::ShowError(const TDes &msg) + { + iEikonEnv->InfoMsg(msg); + } + +void CIpAdmView::ShowError(const TDes &msg, TInt aErr) + { + TBuf<100> txt; + TBuf<100> txt2; + + txt.Format(msg); + iEikonEnv->GetErrorText(txt2,aErr); + txt.AppendFormat(txt2); + iEikonEnv->InfoMsg(txt); + } + +void CIpAdmView::StopL() + { + if (iModel) + { + CEikonEnv::Static()->BusyMsgL(R_BUSY); + delete iModel; + CEikonEnv::Static()->BusyMsgCancel(); + Write(_L("*Stopped*")); + } + else + CEikonEnv::Static()->InfoMsg(_L("Not running!")); + iModel = NULL; + } + + +void CIpAdmView::ClearScreenL() + { + delete iConsole; + iConsole = NULL; + CreateBigConsoleL(CEikConsoleScreen::ENoInitialCursor); + } + +void CIpAdmView::HandleCommandL(TInt aCommand) + { + switch (aCommand) + { + case EIpAdmClearScreen: + ClearScreenL(); + break; + + default: + ASSERT(iConsole != NULL); + iConsole->HandleCommandL(aCommand); + if (iModel) + iModel->HandleCommandL(aCommand); + break; + } + } + +// ************** +// APPLICATION UI +// ************** +// +void CIpAdmAppUi::ConstructL() + { + BaseConstructL(); + + iAppView= new (ELeave) CIpAdmView; + iAppView->ConstructL(ClientRect()); + +#if EPOC_SDK < 0x06000000 + CEikFileNameLabel* filenameLabel=STATIC_CAST(CEikFileNameLabel*, iToolBar->ControlById(EIpAdmFilename)); + filenameLabel->UpdateL(); +#endif + } + +void CIpAdmAppUi::HandleCommandL(TInt aCommand) + { + switch (aCommand) + { + case EEikCmdExit: + Exit(); + return; + default: + iAppView->HandleCommandL(aCommand); + } + } + +CIpAdmAppUi::~CIpAdmAppUi() + { +#ifndef CALYPSO + RemoveFromStack(iAppView); +#endif + delete iAppView; + } + +// ******** +// DOCUMENT +// ******** +CIpAdmDocument::CIpAdmDocument(CEikApplication& aApp) + : CEikDocument(aApp) + { + } + +CEikAppUi* CIpAdmDocument::CreateAppUiL() + { + return new (ELeave) CIpAdmAppUi; + } + +// *********** +// APPLICATION +// *********** +// +TUid CIpAdmApplication::AppDllUid() const + { + return KUidIpAdmApp; + } + +CApaDocument* CIpAdmApplication::CreateDocumentL() + { + return new(ELeave) CIpAdmDocument(*this); + } + +// **** +// MAIN +// **** +// +EXPORT_C CApaApplication* NewApplication() + { + return new CIpAdmApplication; + } + + +#ifdef MAKE_EXE_APPLICATION + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + +#else + +#ifndef EKA2 +GLDEF_C TInt E32Dll(TDllReason /*aReason*/) + { + return KErrNone; + } +#endif + +#endif // MAKE_EXE_APPLICATION diff -r 000000000000 -r 9736f095102e networkingutils/ipadministrationtool/src/uniload.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/ipadministrationtool/src/uniload.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,90 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// uniload.cpp - universal file load (work for narrow or wide builds) +// + +#include "uniload.h" + +HBufC *UnicodeLoad::LoadL(RFs &aFs, const TDesC &aName) + { + RFile pf; + TInt size; + User::LeaveIfError(pf.Open(aFs, aName, EFileShareAny)); + pf.Size(size); + // + // For narrow build, this allocates exactly right amount + // of space, for Unicode build, this allocates the size + // doubled in bytes, which is exactly what we want, if + // we need to widen the narrow Ascii control file (this + // is assumed to be the default case). For UNICODE file + // in UNICODE environment, this allocates too much space. + // + HBufC *data = HBufC::New(size); + + if (data == NULL) + { + pf.Close(); + User::Leave(KErrNoMemory); + } + // + // buf is "native" pointer, either 16 or 8 wide + // + TPtr buf(data->Des()); +#ifdef __WINS__ + buf.Set(data->Des()); // VC6 kludge +#endif + // + // ptr is always 8 wide + // + TPtr8 ptr((TUint8 *)buf.Ptr(), size, size); + pf.Read(ptr); + pf.Close(); + + if (size >= 2 && ptr[0] == 0xFF && ptr[1] == 0xFE) + { + // + // The file is presented as UNICODE text + // (for now, only one byte order supported) + // + size -= 2; +#ifdef _UNICODE + Mem::Copy((TUint8 *)ptr.Ptr(), ptr.Ptr() + 2, size); + buf.SetLength(size / 2); // True number of Unicode characters. +#else + // Trying to load a Unicode file for Narrow build + size = size / 2; + for (TInt i = 1; i < size; ++i) + { + if (ptr[2*i] != 0) + ptr[i] = 0x01; // Substitute too wide stuff with 0x1 + else + ptr[i] = ptr[2*i + 1]; + } + buf.SetLength(size); +#endif + } + else + { + // + // The file is narrow, 8 bit characters + // + buf.SetLength(size); +#ifdef _UNICODE + // Must "widen" the characters for unicode. + for (TInt i = size; --i >= 0; ) + buf[i] = ptr[i]; +#endif + } + return data; + } diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/data/nslookup.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/data/nslookup.rss Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,249 @@ + +// nslookup.rss + +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// SOME PING SPECIFIC STUFF HAS BEEN LEFT IN AS A TEMPLATE FOR +// IMPLEMENTING SOME ADVANCED NSLOOKUP OPTIONS THAT MAY REQUIRE +// COMPLEX PANELS! -- msa +// + + +NAME NAPP + +#include +#include + +#include "nslookup.hrh" + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf=""; } + +RESOURCE EIK_APP_INFO + { + menubar=r_nslookup_menubar; + hotkeys=r_nslookup_hotkeys; + toolbar=r_nslookup_toolbar; + //cba = r_nslookup_cba; + } + + +RESOURCE DIALOG r_nslookup_about //About Dialog + { + title="About Nslookup"; + buttons=R_EIK_BUTTONS_CONTINUE; + flags=EEikDialogFlagButtonsBelow; + items= + { + DLG_LINE + { + type=EEikCtLabel; + prompt=""; + id=ENslookupAboutText; + control=LABEL + { + txt="EPOC32 Nslookup"; + }; + }, + DLG_LINE + { + type=EEikCtLabel; + prompt=""; + id=ENslookupAboutText; + control=LABEL + { + txt="By Markku Savela"; + }; + }, + DLG_LINE + { + type=EEikCtLabel; + prompt=""; + id=ENslookupAboutText; + control=LABEL + { + txt="July 2001"; + }; + } + }; + } + + + +RESOURCE DIALOG r_nslookup_hostname + { + title="EPOC32 Nslookup"; + buttons=R_EIK_BUTTONS_CANCEL_OK; + flags=EEikDialogFlagWait|EEikDialogFlagButtonsBelow|EEikDialogFlagNotifyEsc; + items= + { + DLG_LINE + { + type=EEikCtEdwin; + prompt="Hostname"; + id=ENslookupHostName; + control=EDWIN + { + width=15; + lines=1; + maxlength=80; + flags=0; + }; + }, + DLG_LINE + { + type=EEikCtChoiceList; + prompt="Query Type"; + id=ENslookupQueryType; + control=CHOICELIST + { + array_id=r_querytype_list; + }; + }, + DLG_LINE + { + type=EEikCtCheckBox; + prompt="Show source address"; + id=ENslookupShowSource; + } + }; + } + + +RESOURCE ARRAY r_querytype_list + { + items= + { + LBUF { txt="Default (GetName)"; }, + LBUF { txt="Query A"; }, + LBUF { txt="Query NS"; }, + LBUF { txt="Query CNAME"; }, + LBUF { txt="Query WKS"; }, + LBUF { txt="Query PTR"; }, + LBUF { txt="Query HINFO"; }, + LBUF { txt="Query MX"; }, + LBUF { txt="Query TXT"; }, + LBUF { txt="Query AAAA"; }, + LBUF { txt="Query SRV"; }, + LBUF { txt="Query NAPTR"; }, + LBUF { txt="Query Any"; }, + LBUF { txt="Clear Cache"; } + }; + } + + +/* +RESOURCE CBA r_nslookup_cba +{ + //LONG flags=EEikButtonGroupAddToStack; + //WORD breadth=80; // !!! make this accessible from LAF + //LLINK related_buttons=0; + buttons = + { + CBA_BUTTON + { + id=ENslookupStart; + txt="Start"; + }, + CBA_BUTTON + { + id=ENslookupStop; + txt="Stop"; + }, + CBA_BUTTON + { + id=EEikCmdExit; + txt="Exit"; + } + }; +} +*/ + +RESOURCE TOOLBAR r_nslookup_toolbar + { + flags=EEikToolBarDistributeControlsEvenlyBetweenLines; + breadth=KEikStdToolBarWidth+8; + controls= + { + TBAR_CTRL + { + id=ENslookupCmdFileName; + type=EEikCtFileNameLabel; + flags=EEikToolBarCtrlHasSetMinLength; + length=KEikStdFileNameLabelHeight; + }, + TBAR_BUTTON + { + flags=EEikToolBarCtrlIsStretchable; + id=ENslookupStart; + txt="Start"; + }, + TBAR_BUTTON + { + flags=EEikToolBarCtrlIsStretchable; + id=ENslookupStop; + txt="Stop"; + }, + TBAR_BUTTON + { + flags=EEikToolBarCtrlIsStretchable; + id=EEikCmdExit; + txt="Exit"; + } + }; + } + +RESOURCE HOTKEYS r_nslookup_hotkeys + { + control= + { + HOTKEY { command=EEikCmdExit; key='e'; }, + HOTKEY { command=ENslookupStart; key='s'; }, + HOTKEY { command=ENslookupStop; key='c'; }, + HOTKEY { command=ENslookupReset; key='r'; }, + HOTKEY { command=ENslookupAbout; key='a'; } + }; + } + +RESOURCE MENU_BAR r_nslookup_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_nslookup_file_menu; txt="File"; }, + MENU_TITLE { menu_pane=r_nslookup_tools_menu; txt="Tools"; } + }; + } + +RESOURCE MENU_PANE r_nslookup_file_menu + { + items= + { + MENU_ITEM { command=EEikCmdExit; txt="Exit"; } + }; + } + +RESOURCE MENU_PANE r_nslookup_tools_menu + { + items= + { + MENU_ITEM { command=ENslookupStart; txt="Start"; }, + MENU_ITEM { command=ENslookupStop; txt="Stop"; }, + MENU_ITEM { command=ENslookupReset; txt="Reset Screen"; }, + MENU_ITEM { command=ENslookupAbout; txt="About..."; } + }; + } + +RESOURCE TBUF r_resolving_name { buf="Resolving name..."; } + diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/data/nslookup_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/data/nslookup_reg.rss Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 + +UID2 KUidAppRegistrationResourceFile +UID3 0x10000892 // nslookup UID + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "nslookup"; + } diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/group/bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,35 @@ +// 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: +// bld.inf - Name resolver utility +// Name resolver utility +// + + + +/** + @file +*/ + +PRJ_PLATFORMS + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +../group/nslookup.iby /epoc32/rom/include/nslookup.iby + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +nslookup.mmp + diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/group/networking_nslookup.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/group/networking_nslookup.history.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/group/networking_nslookup.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/group/networking_nslookup.mrp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,24 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies 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 networking_nslookup +source \sf\app\techview\networkingutils\nameresolverutility +notes_source \component_defs\release.src + + +# == comments appear after the line they describe == +ipr T + diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/group/nslookup.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/group/nslookup.iby Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __NSLOOKUP_IBY__ +#define __NSLOOKUP_IBY__ + +REM static dependencies +#include +#include + +file=ABI_DIR\DEBUG_DIR\nslookup.exe sys\bin\nslookup.exe +data=MULTI_LINGUIFY(RSC EPOCROOT##epoc32\data\Z\resource\Apps\nslookup resource\Apps\nslookup) +data=MULTI_LINGUIFY(RSC EPOCROOT##epoc32\data\Z\private\10003a3f\Apps\nslookup_reg private\10003a3f\Apps\nslookup_reg) + +#endif // __NSLOOKUP_IBY__ diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/group/nslookup.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/group/nslookup.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,66 @@ +// 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: +// nslookup.mmp - Name resolver utility +// Name resolver utility +// + + + +/** + @file +*/ + +MACRO EPOC_SDK=0x08000000 +MACRO __RHOSTRESOLV_QUERY_IF +MACRO DND_DCM_EXTENSION + +TARGET nslookup.exe +TARGETTYPE exe +MACRO MAKE_EXE_APPLICATION +UID 0 0x10000892 + +EPOCSTACKSIZE 0x5000 +TARGETPATH /sys/bin + +SOURCEPATH ../src + +SOURCE engine.cpp nslookup.cpp + +START RESOURCE ../data/nslookup.rss +HEADER +TARGETPATH /resource/apps +END + +START RESOURCE ../data/nslookup_reg.rss +TARGETPATH /private/10003a3f/apps +END + +USERINCLUDE ../inc +SYSTEMINCLUDE ../../../../../os/networkingsrv/networkprotocols/iphook/inhook6/inc + +SYSTEMINCLUDE /epoc32/include/techview +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/networking // dns_qry.* + +LIBRARY euser.lib apparc.lib ws32.lib +LIBRARY cone.lib +LIBRARY esock.lib insock.lib +LIBRARY plpremlink.lib +LIBRARY eikcore.lib eikcoctl.lib eikdlg.lib + +CAPABILITY ALL -Tcb + +VENDORID 0x70000001 + +SMPSAFE diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/inc/engine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/inc/engine.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,97 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// pingmodel.h - icmp echo client engine +// + + + +/** + @internalComponent +*/ +#ifndef __ENGINE_H +#define __ENGINE_H + +#include +#include + +//#include + +const TInt KHostNameLimit = 80; + +class CNslookupContainer; + +const TUint KPingQuiet = 0x01; +const TUint KPingVerbose = 0x02; +const TUint KPingPackLimit = 0x04; +const TUint KPingDebug = 0x08; + +//Contains engine's saved preferences +class TPreferences + { +public: + TBuf<80> iHostname; + }; + + +class CNslookup : public CActive + { +public: + CNslookup(); + ~CNslookup(); + + void ConstructL(const TPreferences& aPref); + + //return the current preferences + void GetPreferences(TPreferences &aPref) const; + static void DefaultPreferences(TPreferences &aPref); + void SetConsole(CNslookupContainer *aConsole); + const TDesC* GetHostName() const; + void SetHostName(const TDes& ahostname); + + void EndNslookup(); + TBool IsRunning() const; + void BeginL(); + +protected: + void RunL(); //Segment of code to execute + void DoCancel(); //Stops Execution of Ping + +private: + void DisableRemoteLink(); + void Error(const TDesC& string, TInt error); + void Stop(); + + /** + * Outputs some text about the Resolver Query() response to the console + */ + void QueryResponse(); + +private: + + CNslookupContainer *iConsole; + RSocketServ iSockServ; // Socket Server + RHostResolver iHostResolv; // Resolver + TBuf iHostname; // Contains name to resolve + TInetAddr iAddress; // Address to reverse + TInt iCount; // Successful resolves. + TNameEntry iEntry; //contains address resolution data + TBuf8<1024> iResult; + +public: + TInetAddr iHostAddr; //Address to Ping + TUint iQueryType; //< Query type select from the dialog choice list. + TBool iShowSource; //< Show source address for each resolved address. + }; + +#endif diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/inc/nslookup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/inc/nslookup.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,332 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// nslookup.h - nslookup client main module +// + + + +/** + @internalComponent +*/ +#ifndef __NSLOOKUP_H +#define __NSLOOKUP_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CALYPSO +#include +#include +#include +#endif + + +// UID of app + + +const TUid KUidNslookupApp = { 0x10000892 } ; +const TUid KUidNslookupVersionUid = { 0x10000892 } ; + +#ifdef CALYPSO + +class CNslookupBinaryPopupSettingItem : public CAknBinaryPopupSettingItem + { + public: + CNslookupBinaryPopupSettingItem( TInt aIdentifier, TBool& aBinaryValue ); + + virtual void LoadL(); + }; + +class CNslookupTextSettingItem : public CAknSettingItem + { + public: + CNslookupTextSettingItem( TInt aIdentifier, TDes& aText ); + CNslookupTextSettingItem::~CNslookupTextSettingItem(); + virtual void StoreL(); + virtual void LoadL(); // Called from 2nd stage constructors + virtual const TDesC& SettingTextL(); + virtual void EditItemL( TBool aCalledFromMenu ); + + protected: + TPtr& InternalTextPtr(); + TPtrC ExternalText(); + void SetExternalText( TDesC& aNewExternalText ); + + private: + TDes& iExternalText; + HBufC* iInternalText; + TPtr iInternalTextPtr; + }; + +class CSettingView : public CAknSettingItemList, public MEikCommandObserver + { + public: + CSettingView(CNslookup *aModel); + ~CSettingView(); + void ConstructL(const TRect& aRect); + void ProcessCommandL(TInt aCommand); + CAknSettingItem* CreateSettingItemL( TInt identifier ); + TBool SaveSettingsL(); + + private: + TBool iLimitPacketCount; // Indicates if unlimited packet number + TBuf<5> iMaxPacketCount; // Number of ICMP Echo Request packets to send + TBuf<5> iPacketDataSize; // Default data size (not including ICMP header) + TBuf<5> iWaitTime; // Time between sent packets (default 1 second) + TBuf<5> iLastWaitTime; // Time to wait for the last packet (default 2 seconds) + TBuf iPattern; // Pattern to fill the packet (default 0xFF) + TBool iQuiet; // No packet info, just statistics + TBool iVerbose; // Verbose Output. All ICMP packets, not only Echo reply + TBool iDebug; // Set the SO_DEBUG flag in the socket + + CNslookup *iModel; + }; + +#endif // #ifdef CALYPSO + +// +// CSimpleConsole +// +/* +enum TMessageControlFontStyle +{ + EStyleElementBold=EMenuCommandBold, + EStyleElementItalic=EMenuCommandItalic, + EStyleElementInverse=EMenuCommandInverse, + EStyleElementUnderline=EMenuCommandUnderline, + EStyleElementColor=EMenuCommandColor +}; +*/ +class CConsoleControl : public CCoeControl +{ +public: + CConsoleControl() {} + ~CConsoleControl(); + //void ConstructL(TInt aFlags); + //void ConstructL(TPoint aLeftTop,const TSize& aSize,TInt aFlags,CCoeControl *aParent); + void ConstructL(const TPoint& aTopLeft,const TSize& aSize,TInt aFlags); + //TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + //void HandlePointerEventL(const TPointerEvent& aPointerEvent); + //void DynInitMenuPaneL(TInt aMenuId,CEikMenuPane* aMenuPane); + void HandleCommandL(TInt aCommand); + void ActivateL(); + void SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility); + void DrawCursor(); + void Write(const TDesC &aDes); + CEikConsoleControl *ConsoleControl() const; + TBool UpdateScrollBars(); + void ClearScreen(); + void Redraw(const TRect &aRect); + void Lf(); + TSize ScreenSize() const; +protected: + void FocusChanged(TDrawNow aDrawNow); +private: + //void ToggleFontStyleAndRedrawL(TMessageControlFontStyle aStyleElement); + +private: + CEikConsoleScreen* iConsole; + TInt iHistory; + //TInt iAllPrintable,iScrollLock,iIgnoreCursor,iHideCursor; + //TDesC* iSelBufPtr; + //TInt iSmallScreen; + //TInt iHighCursor; +}; + + +class CNslookupContainer: public CCoeControl, public MCoeControlObserver +{ +public: + // Construction + CNslookupContainer(CNslookup* aModel); + void ConstructL(const TRect& aRect); + + // Destruction + ~CNslookupContainer(); + //void ConstructFromResourceL(TResourceReader& aReader); + //void CSmileyContainer::PrepareForFocusLossL(); + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + void WriteHostL(const TDesC& aHostname); + void WriteLine(const TDesC& abuf); + void ResetScreen(); + +//protected: + //void FocusChanged(TDrawNow aDrawNow); +private: + // Virtual, defined by CCoeControl; replaces the default implementation + // provided by CCoeControl. + void Draw(const TRect& aRect) const; + + // Virtual, defined by CCoeControl; replaces the default implementation + // provided by CCoeControl. + TInt CountComponentControls() const; + + // Virtual, defined by CCoeControl; replaces the default implementation + // provided by CCoeControl. + CCoeControl* ComponentControl(TInt aIndex) const; + + // Defined as pure virtual by the mixin class MCoeControlObserver + // inherited by CCoeControl. An empty implementation provided by + // this class (its containees do not report events). + void HandleControlEventL(CCoeControl* aControl, + TCoeEvent aEventType); + + void CreateConsoleL(const TRect& aRect); +private: + // Member functions defined and used by this class +private: + // Data members defined and used by this class. + CNslookup *iModel; + CEikLabel* iLabel; // label for status messages + CEikLabel* iLabel2; // label for status messages + + CConsoleControl* iConsole; + }; + + + + + + +// +// class CNslookupView +// + +class CNslookupView : public CCoeControl, public MCoeControlBrushContext + { +public: + CNslookupView(CNslookup *aModel); + void ConstructL(const TRect& aRect); + ~CNslookupView(); + // changing view + void ConstructViewL(); + void ResetScreen(); + // various types of update + + +private: // from CCoeControl + void Draw(const TRect& /*aRect*/) const; + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + TInt CountComponentControls() const; + CCoeControl* ComponentControl(TInt aIndex) const; +private: // new function + void CreateLabelL(); +private: // data + CNslookup *iModel; + CNslookupContainer* iContainer; + }; + +#ifdef CALYPSO +class CHostNameDialog : public CAknTextQueryDialog +#else +class CHostNameDialog : public CEikDialog +#endif + { +public: +#ifdef CALYPSO + CHostNameDialog(TDes& aHostname); +#else + CHostNameDialog(CNslookup *aModel); +#endif + +private: + TBool OkToExitL(TInt aButton); + void PreLayoutDynInitL(); +private: + TBool iOKPressed; + CNslookup *iModel; + }; + +// +// CNslookupAppUi +// + +#ifdef CALYPSO +class CNslookupAppUi : public CAknAppUi +#else +class CNslookupAppUi : public CEikAppUi +#endif + { +public: + void ConstructL(); + ~CNslookupAppUi(); + +#ifdef CALYPSO + +private: + TBool iAppViewOnStack; + TBool iSettingViewOnStack; + void AppViewToStackL(); + void AppViewFromStack(); + void SettingViewToStackL(); + void SettingViewFromStack(); + void ShowAppViewL(); + void ShowSettingViewL(); + CSettingView* iSettingView; + +#endif // #ifdef CALYPSO + +private: // from CEikAppUi + static TInt Launcher(TAny* x); + void InitModelL(); + void HandleCommandL(TInt aCommand); + void CreateOptionsDialog(); + TBool CreateHostNameDialogL(); + void CreateAboutDialogL() const; + void RestorePreferencesL(TPreferences& aPreferences) const; + void StorePreferencesL(const TPreferences &aPreferences) const; + //void UnDimStop(); + //void DimStop(); + +private: + CNslookupView* iAppView; + CNslookup *iModel; //contains all related Data + //TBossPuzzle* iModel; + }; + +// +// CExampleShellDocument +// + +class CNslookupDocument : public CEikDocument + { +public: + CNslookupDocument(CEikApplication& aApp); + //CNslookupDocument(CEikApplication& aApp): CEikDocument(aApp) { } + //TBossPuzzle* Model() { return(&iModel); } +private: // from CEikDocument + CEikAppUi* CreateAppUiL(); +private: + //TBossPuzzle iModel; + }; + +// +// CNslookupApplication +// + +class CNslookupApplication : public CEikApplication + { +private: // from CApaApplication + CApaDocument* CreateDocumentL(); + TUid AppDllUid() const; + }; + +#endif diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/inc/nslookup.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/inc/nslookup.hrh Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// nslookup.hrh - nslookup client UI constants +// + + + +/** + @internalComponent +*/ +enum TNslookupMenuCommands + { + ENslookupStart=100, + ENslookupStop=101, + ENslookupLabel=102, + ENslookupHostName=103, + ENslookupAbout=104, + ENslookupReset=105, + + ENslookupCmdFileName=106, + ENslookupQueryType=107, + ENslookupShowSource=108, + + // Controls + ENslookupAboutText=215 + }; diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/src/engine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/src/engine.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,575 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// engine.cpp - nslookup client engine +// + +#include +#include +#include +#include //Used for RRemoteLink +#include +#include +#include +#include "engine.h" +#include +#include "nslookup.h" + +CNslookup::CNslookup(): CActive(EPriorityStandard) + { + CActiveScheduler::Add(this); //Adds itself to the scheduler only the first time + } + +//Sets the remote link to off +void CNslookup::DisableRemoteLink() + { + RRemoteLink link; + TRemoteLinkStatus state; + + TInt err=link.Open(); + if (err==KErrNone) + { + if (link.Status(state)!=KErrNone) + return; + if (state.iStatus!=TRemoteLinkStatus::EDisabled) + { + iConsole->WriteLine(_L("Disabling Remote link\n")); + link.Disable(); + } + link.Close(); + } + } + +//Sets all default values. Actually it's no more a L function +void CNslookup::ConstructL(const TPreferences& aPref) + { + + // Base class second-phase construction. + + iHostname=aPref.iHostname; + } + +//return the current preferences +void CNslookup::GetPreferences(TPreferences &aPref) const + { + aPref.iHostname=iHostname; //Address to Ping + } + +void CNslookup::DefaultPreferences(TPreferences &aPref) + { + aPref.iHostname=_L("127.0.0.1"); + } + + +const TDesC* CNslookup::GetHostName() const + { + return &iHostname; + } + +void CNslookup::SetHostName(const TDes& aHostname) + { + iHostname = aHostname; + } + +void CNslookup::SetConsole(CNslookupContainer* aConsole) + { + iConsole = aConsole; + } + +CNslookup::~CNslookup() + { + Cancel(); + } + +//Shows the error and set the application as not running. +//Requires a return after calling it! + +void CNslookup::Error(const TDesC& string,TInt error) + { + TBuf<150> aux; + TBuf<100> errtxt; + + CEikonEnv::Static()->GetErrorText( errtxt,error); + aux.Append(string); + aux.Append(_L(": ")); + aux.Append(errtxt); + aux.AppendFormat(_L(" (%d)\n"), error); + iConsole->WriteLine(aux); + } + + +void CNslookup::Stop() + { + iHostResolv.Close(); + iSockServ.Close(); + CEikonEnv::Static()->BusyMsgCancel(); + } + + +void CNslookup::BeginL() + { + TInt err=0; + + if (IsRunning()) // There's another instance running + return; + + //INITIALIZATION + + DisableRemoteLink(); + + iConsole->WriteHostL(iHostname); + + //connecting the Socket Server + err = iSockServ.Connect(); //KESockDefaultMessageSlots + if (err!=KErrNone) + { + Error(_L("Socket Server Error (Connect)"),err); + return; + } + + err = iHostResolv.Open(iSockServ, KAfInet, KProtocolInetUdp); // Address Resolver + if (err != KErrNone) + { + Error(_L("Resolver Error (Open)"),err); + iSockServ.Close(); + return; + } + iConsole->WriteLine(_L("\nResolving...\n")); + CEikonEnv::Static()->BusyMsgL(R_RESOLVING_NAME); + + TUint16 querytype = KDnsRRTypeInvalid; + + // This lengthy code checks what the user selected as query type in UI dialog + switch (iQueryType) + { + case 0: // Default (GetName) + break; + + case 1: // Query A + querytype = KDnsRRTypeA; + break; + + case 2: // Query NS + querytype = KDnsRRTypeNS; + break; + + case 3: // Query CNAME + querytype = KDnsRRTypeCNAME; + break; + + case 4: // Query WKS + querytype = KDnsRRTypeWKS; + break; + + case 5: // Query PTR + querytype = KDnsRRTypePTR; + break; + + case 6: // Query HINFO + querytype = KDnsRRTypeHINFO; + break; + + case 7: // Query MX + querytype = KDnsRRTypeMX; + break; + + case 8: // Query TXT + querytype = KDnsRRTypeTXT; + break; + + case 9: // Query AAAA + querytype = KDnsRRTypeAAAA; + break; + + case 10: // Query SRV + querytype = KDnsRRTypeSRV; + break; + + case 11: // Query NAPTR + querytype = KDnsRRTypeNAPTR; + break; + + case 12: // Query Any + querytype = KDnsQTypeANY; + break; + +#ifdef DND_DCM_EXTENSION + case 13: // Cache Clear + querytype = KDnsQTypeCacheClear; + break; +#endif + + default: + break; + } + + // If query type was something else than default using GetName(), use the new + // Query() interface instead + if (querytype != KDnsRRTypeInvalid) + { +#ifdef __RHOSTRESOLV_QUERY_IF + TBuf8 name8; + name8.Copy(iHostname); + TDnsQuery query(name8, querytype); + TPckgC querybuf(query); + + // Hmm... Esock seems to use the current length when allocating a buffer for result + // output. It should use MaxLength() instead, and now we have to do this to get + // over with it + iResult.SetLength(iResult.MaxLength()); + iHostResolv.Query(querybuf, iResult, iStatus); +#else + TBuf<80> aux; + aux.Copy(_L("Query() interface not supported\n")); + iConsole->WriteLine(aux); + iQueryType = 0; + Stop(); + return; +#endif + } + else + { + if (iAddress.Input(iHostname) == KErrNone) + { + iHostResolv.GetByAddress(iAddress, iEntry, iStatus); + } + else + { + iHostResolv.GetByName(iHostname, iEntry, iStatus); + } + } + + iCount = 0; + SetActive(); //Sets the object as Active. + } + +static TPtrC ErrorTextL(const TInt aCode) + { + switch (aCode) + { + case KErrNotFound: return _L("Name not found"); + +// case KErrDndTimedOut: return _L("timed out"); +// case KErrDndNoHost: return _L("no host"); // [dubious error code -- eliminate? ] +// case KErrDndNoMemorySend: return _L("Out of memory on send"); +// case KErrDndNotSent: return _L("Query not sent"); + case KErrDndCache: return _L("Cache error"); + + case KErrDndFormat: return _L("Bad DNS reply format"); + case KErrDndServerFailure: return _L("DNS server failed"); + case KErrDndBadName: return _L("Name does not exist in DNS"); + case KErrDndNotImplemented: return _L("Query not implemented by DNS server"); + case KErrDndRefused: return _L("DNS Server refused query"); + +// case KErrDndNoMemoryProc: return _L("Insufficient memory - can not process the response"); + case KErrDndNoRecord: return _L("No record found of the desired type and class"); + case KErrDndNameTooBig: return _L("Buffer overflow"); + case KErrDndUnknown: return _L("Error in DND"); + case KErrDndServerUnusable: return _L("No answer available from current server"); + default: + break; + + } + User::Leave(aCode); + // NOTREACHED + return _L(""); // to make compiler happy + } + +void CNslookup::RunL() + { + TInt src_addr = 0; + + TBuf<100> textIPaddress; //text address to be displayed + TBuf<356> aux; + + if (iStatus != KErrNone) + { + if (iCount == 0) + { + // An error message is only shown, if the primary query + // failes, and not for subsequent Next() operations. + TBuf<100> msg(iHostname); + + TRAPD(err, + TPtrC errText = ErrorTextL(iStatus.Int()); + msg.AppendFormat(_L(" - %S\n"), &errText)); + if (err == KErrNone) + iConsole->WriteLine(msg); + else + Error(msg, iStatus.Int()); + } + Stop(); + return; + } + + // Check if we are using the query interface instead of GetName() + if (iQueryType != KDnsRRTypeInvalid) + { +#ifdef __RHOSTRESOLV_QUERY_IF + QueryResponse(); + + // See explanation of this SetLength() hack above + iResult.SetLength(iResult.MaxLength()); + iHostResolv.QueryGetNext(iResult, iStatus); + iCount++; + SetActive(); +#endif + return; + } + + aux.Append(iEntry().iName); // maybe the main name is not the entered + switch (iEntry().iAddr.Family()) + { + case KAfInet: + case KAfInet6: + aux.Append(_L(" is ")); + iHostAddr = TInetAddr::Cast(iEntry().iAddr); //host address + iHostAddr.Output(textIPaddress); + aux.Append(textIPaddress); + src_addr = iShowSource && !iHostAddr.IsUnspecified(); + break; + case KAfDns: + { + SDnsRR &rr = TInetDnsRR::Cast(iEntry().iAddr).RR(); + if (rr.iClass == 1 /* IN */) + { + if (rr.iType == 2 /* NS */) + { + aux.Append(_L(" NS")); + break; + } + else if (rr.iType == 6 /* SOA */) + { + aux.AppendFormat(_L(" SOA serial=%u refresh=%u retry=%u expire=%u min=%u"), + (TUint)rr.iSOA.iSerial, + (TUint)rr.iSOA.iRefresh, + (TUint)rr.iSOA.iRetry, + (TUint)rr.iSOA.iExpire, + (TUint)rr.iSOA.iMinimum); + break; + } + else if (rr.iType == 15 /* MX */) + { + aux.AppendFormat(_L(" MX preference=%d"), (TInt)rr.iMX.iPreference); + break; + } + else if (rr.iType == 33 /* SRV */) + { + aux.AppendFormat(_L(" SRV port=%d priority=%d weight=%d"), + (TInt)iEntry().iAddr.Port(), (TInt)rr.iSRV.iPriority, (TInt)rr.iSRV.iWeight); + break; + } + else if (rr.iType == 35 /* NAPTR */) + { + TPtrC replacement = rr.iNAPTR.REPLACEMENT(iEntry().iName); + TPtrC services = rr.iNAPTR.SERVICES(iEntry().iName); + TPtrC regexp = rr.iNAPTR.REGEXP(iEntry().iName); + + aux.AppendFormat(_L(" NAPTR order=%d, preference=%d repl=%S services=%S regexp=%S"), + (TInt)rr.iNAPTR.iOrder, + (TInt)rr.iNAPTR.iPreference, + &replacement, + &services, + ®exp); + + break; + } + } + aux.AppendFormat(_L(" class=%d type=%d"), (TInt)rr.iClass, (TInt)rr.iType); + } + break; + default: + break; + } + + const TUint flags = iEntry().iFlags; + if (flags) + { + aux.Append(_L(" ( ")); + if (flags & EDnsAlias) + aux.Append(_L("Alias ")); + if (flags & EDnsAuthoritive) + aux.Append(_L("Authoritative ")); + if (flags & EDnsHostsFile) + aux.Append(_L("Hostfile ")); + if (flags & EDnsServer) + aux.Append(_L("DNS ")); + if (flags & EDnsHostName) + aux.Append(_L("MyName ")); + if (flags & EDnsCache) + aux.Append(_L("Cached ")); + aux.Append(')'); + } + aux.Append(_L("\n")); + iConsole->WriteLine(aux); + iCount++; + if (src_addr) + { + // Show a matching SRC address. + RSocket socket; + TPckgBuf opt; + opt().iDstAddr = iHostAddr; + if (socket.Open(iSockServ, KAfInet, KSockDatagram, KProtocolInetUdp) == KErrNone) + { + _LIT(KIsVIF, " (VIF)"); + _LIT(KIsIF, ""); + _LIT(KNoRoute, "(no route)"); + + (void)socket.GetOpt(KSoInetIfQueryByDstAddr, KSolInetIfQuery, opt); + socket.Close(); + opt().iSrcAddr.OutputWithScope(textIPaddress); + aux.Format(_L(" src= %S @ %S%S\n"), &textIPaddress, &opt().iName, + opt().iName.Length() == 0 ? &KNoRoute() : opt().iIsUp ? &KIsIF() : &KIsVIF()); + iConsole->WriteLine(aux); + } + else + iConsole->WriteLine(_L("cannot find src, UDP socket open failed\n")); + } + // + // Get next address + // + iHostResolv.Next(iEntry, iStatus); + SetActive(); + } + +void CNslookup::DoCancel() + { + // Called only from Cancel() if there is pending resolve going on... (IsActive()) + iHostResolv.Cancel(); + } + + +// Outputs some text about the Query() response to the console +void CNslookup::QueryResponse() + { + TBuf<256> aux; + TBuf<128> addrbuf; + + if (iResult.Length() < (TInt)sizeof(TDnsQryRespBase)) + { + aux.AppendFormat(_L("Malformed response (length: %d)\n"), iResult.Length()); + return; + } + + TDnsQryRespBase *respbase = (TDnsQryRespBase *)iResult.Ptr(); //lint !e826 // area length checked above + aux.Append(iHostname); + aux.AppendFormat(_L(": cl: %d ttl: %d "), + respbase->RRClass(), respbase->RRTtl()); + + // ugh... I'll do this the hard way: temporary buffer for converting from 8-bit + // DNS result descriptors to 16-bit descriptor and the append to output buffer. + // A better solution will follow a bit later... + switch(respbase->RRType()) + { + case KDnsRRTypeA: + { + const TDnsRespA *const respA = (TDnsRespA *) respbase; + respA->HostAddress().Output(addrbuf); + aux.Append(_L("type: A ")); + aux.Append(_L("addr: ")); + aux.Append(addrbuf); + } + break; + + case KDnsRRTypeAAAA: + { + const TDnsRespAAAA *const respAAAA = (TDnsRespAAAA *) respbase; + respAAAA->HostAddress().Output(addrbuf); + aux.Append(_L("type: AAAA ")); + aux.Append(_L("addr: ")); + aux.Append(addrbuf); + } + break; + + case KDnsRRTypePTR: + { + const TDnsRespPTR *const respPTR = (TDnsRespPTR *) respbase; + aux.Append(_L("type: PTR ")); + aux.Append(_L("name: ")); + addrbuf.Copy(respPTR->HostName()); + aux.Append(addrbuf); + } + break; + + case KDnsRRTypeMX: + { + const TDnsRespMX *const respMX = (TDnsRespMX *) respbase; + aux.Append(_L("type: MX ")); + aux.AppendFormat(_L("pref: %d "), respMX->Pref()); + aux.Append(_L("name: ")); + addrbuf.Copy(respMX->HostName()); + aux.Append(addrbuf); + } + break; + + case KDnsRRTypeSRV: + { + const TDnsRespSRV *const respSRV = (TDnsRespSRV *) respbase; + aux.Append(_L("type: SRV ")); + aux.AppendFormat(_L("prio: %d wght: %d port: %d targ: "), + respSRV->Priority(), respSRV->Weight(), respSRV->Port()); + addrbuf.Copy(respSRV->Target()); + aux.Append(addrbuf); + } + break; + + case KDnsRRTypeNAPTR: + { + const TDnsRespNAPTR *const respNAPTR = (TDnsRespNAPTR *) respbase; + aux.Append(_L("type: NAPTR ")); + aux.AppendFormat(_L("ordr: %d pref: %d flag: ")); + addrbuf.Copy(respNAPTR->Flags()); + aux.Append(addrbuf); + aux.Append(_L(" serv: ")); + addrbuf.Copy(respNAPTR->Service()); + aux.Append(addrbuf); + aux.Append(_L(" regx: ")); + addrbuf.Copy(respNAPTR->Regexp()); + aux.Append(addrbuf); + aux.Append(_L(" repl: ")); + addrbuf.Copy(respNAPTR->Replacement()); + aux.Append(addrbuf); + } + break; + +#ifdef DND_DCM_EXTENSION + case KDnsQTypeCacheClear: + { + aux.Append(_L(" OK")); + break; + } +#endif + + default: + aux.AppendFormat(_L("Unknown response type: %d"), respbase->RRType()); + break; + } + + aux.Append(_L("\n")); + iConsole->WriteLine(aux); + } + +// Stops NSLOOKUP + +void CNslookup::EndNslookup() + { + Cancel(); + Stop(); + } + +// Just checks if sending packets from a previous ping + +TBool CNslookup::IsRunning() const + { + return IsActive(); + } diff -r 000000000000 -r 9736f095102e networkingutils/nameresolverutility/src/nslookup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networkingutils/nameresolverutility/src/nslookup.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,989 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// nslookup.cpp - nslookup client main module +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if EPOC_SDK >= 0x06000000 +# include +#else +# include +# include +# include +#endif + +#ifdef MAKE_EXE_APPLICATION +#include +#endif + +#include +#include "engine.h" +#include "nslookup.hrh" +#include "nslookup.h" + +#ifdef CALYPSO +#include +#endif + +// +// CConsoleControl +// + + +CConsoleControl::~CConsoleControl() + { + delete iConsole; + } + +void CConsoleControl::ConstructL(const TPoint& aTopLeft, const TSize& aSize, TInt aFlags) + { + TRect rect(aTopLeft,aTopLeft + aSize.AsPoint()); +#if EPOC_SDK >= 0x06000000 + SetRect(rect); +#else + SetRectL(rect); +#endif + iConsole=new(ELeave) CEikConsoleScreen; + iConsole->ConstructL(_L("TEST"),aTopLeft,aSize,aFlags,EEikConsWinInPixels); + iConsole->SetHistorySizeL(200,0); + iHistory=200; + } + +void CConsoleControl::ActivateL() + { + CCoeControl::ActivateL(); + iConsole->SetKeepCursorInSight(TRUE); + iConsole->DrawCursor(); + iConsole->SetAtt(ATT_NORMAL); + } + + +void CConsoleControl::HandleCommandL(TInt /* aCommand */) + { + } + +void CConsoleControl::FocusChanged(TDrawNow aDrawNow) + { + iConsole->ConsoleControl()->SetFocus(IsFocused(), aDrawNow); + } + + +void CConsoleControl::SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility) + { + iConsole->SetScrollBarVisibilityL(aHBarVisibility,aVBarVisibility); + iConsole->ConsoleControl()->UpdateArea(); + iConsole->UpdateScrollBars(); + iConsole->ConsoleControl()->UpdateArea(); + } + + +void CConsoleControl::DrawCursor() + { + iConsole->DrawCursor(); + } + + +void CConsoleControl::Write(const TDesC &aMsg) + { + iConsole->Write(aMsg); + iConsole->FlushChars(); + } + + + +CEikConsoleControl *CConsoleControl::ConsoleControl() const + { + return iConsole->ConsoleControl(); + } + +TBool CConsoleControl::UpdateScrollBars() + { + return iConsole->UpdateScrollBars(); + } + +void CConsoleControl::ClearScreen() + { + iConsole->ClearScreen(); + } + + +void CConsoleControl::Redraw(const TRect &aRect) + { + iConsole->Redraw(aRect); + } + +void CConsoleControl::Lf() + { + iConsole->Lf(); + } + + +TSize CConsoleControl::ScreenSize() const + { + return iConsole->ScreenSize(); + } + + +CNslookupView::CNslookupView(CNslookup *aModel) + { + iModel = aModel; + } + +void CNslookupView::ConstructL(const TRect& aRect) +{ + CreateWindowL(); + Window().SetShadowDisabled(ETrue); + iContext=this; + iBrushStyle=CGraphicsContext::ESolidBrush; + iBrushColor=KRgbWhite; +#if EPOC_SDK >= 0x06000000 + SetRect(aRect); +#else + SetRectL(aRect); +#endif + + // Create its only component, a CNslookupContainer + + iContainer = new(ELeave) CNslookupContainer(iModel); + iContainer->SetContainerWindowL(*this); + TRect containerRect = Rect(); + iContainer->ConstructL(containerRect); + + ActivateL(); + DrawNow(); +} + +CNslookupView::~CNslookupView() + { + + delete iContainer; + } + +TInt CNslookupView::CountComponentControls() const + { + return 1; //Just the container + } + +CCoeControl* CNslookupView::ComponentControl(TInt /*aIndex*/) const + { + return iContainer; + } + + +void CNslookupView::ResetScreen() +{ + iContainer->ResetScreen(); +} + + +TKeyResponse CNslookupView::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) +{ + return EKeyWasNotConsumed; +} + +void CNslookupView::Draw(const TRect& /*aRect*/) const + { + + CWindowGc& gc = SystemGc(); + gc.SetPenStyle(CGraphicsContext::ENullPen); + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + gc.DrawRect(Rect()); + + } + + +// +// CNslookupcontainer +// +const TInt KLabelHeight=25; + + + // Construction +CNslookupContainer::CNslookupContainer(CNslookup* aModel) + { + iModel = aModel; + } + + +// Destruction +CNslookupContainer::~CNslookupContainer() +{ + delete iLabel; + delete iLabel2; + delete iConsole; +} + +void CNslookupContainer::ConstructL(const TRect& aRect) +{ + iModel->SetConsole(this); + +#if EPOC_SDK >= 0x06000000 + SetRect(aRect); +#else + SetRectL(aRect); +#endif + + TRect rect=Rect(); + rect.iTl.iY += KLabelHeight; // make way for top label + rect.iBr.iY -= KLabelHeight; // make way for bottom label + + CreateConsoleL(rect); + + //Bottom label + iLabel=new (ELeave) CEikLabel; + rect=Rect(); + rect.iTl.iY=rect.iBr.iY-KLabelHeight; // make it bottom 20 pixels + iLabel->SetContainerWindowL(*this); +#if EPOC_SDK >= 0x06000000 + iLabel->SetRect(rect); +#else + iLabel->SetRectL(rect); +#endif + iLabel->SetAlignment(EHLeftVCenter); // center text + iLabel->SetBufferReserveLengthL(500); // nice long buffer + iLabel->SetTextL(_L("ok")); // Label needs to have some content to prevent panics.. + //Top label + iLabel2=new (ELeave) CEikLabel; + rect=Rect(); + rect.iBr.iY=rect.iTl.iY+KLabelHeight; // make it top 20 pixels + iLabel2->SetContainerWindowL(*this); +#if EPOC_SDK >= 0x06000000 + iLabel2->SetRect(rect); +#else + iLabel2->SetRectL(rect); +#endif + iLabel2->SetAlignment(EHLeftVCenter); // center text + iLabel2->SetBufferReserveLengthL(500); // nice long buffer + WriteHostL(_L("")); + ActivateL(); +} + + +void CNslookupContainer::CreateConsoleL(const TRect& aRect) +{ + iConsole = new(ELeave) CConsoleControl; +#if defined(CRYSTAL) //This is a patch to put the console in the right place. + //For some unknown reason appears displaced. + aRect.iBr.iX += 92; + aRect.iTl.iX += 92; + iConsole->ConstructL(aRect.iTl, aRect.Size(), CEikConsoleScreen::ENoInitialCursor); +#elif defined(CALYPSO) + TSize size; + size.iHeight = aRect.iBr.iY - aRect.iTl.iY; + size.iWidth = aRect.iBr.iX - aRect.iTl.iX - 10; // -10 to leave some space on the right + // (based on trial and error) + TPoint position; + position.iY = 70; // To skip the status pane and host name field (based on trial and error) + position.iX = 5; // 5 to leave some space on the left (based on trial and error) + + iConsole->ConstructL(position, size, CEikConsoleScreen::ENoInitialCursor); +#else + iConsole->ConstructL(aRect.iTl, aRect.Size(), CEikConsoleScreen::ENoInitialCursor); +#endif + + iConsole->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto); +} + +void CNslookupContainer::ResetScreen() + { + iConsole->ClearScreen(); + } + +void CNslookupContainer::WriteHostL(const TDesC& aHostname) +{ + TBuf<100> aux; + + aux.Append(aHostname); + + iLabel2->SetTextL(aux); + iLabel2->DrawNow(); +} + + +void CNslookupContainer::WriteLine(const TDesC& abuf) + { + iConsole->Write(abuf); + } + +TKeyResponse CNslookupContainer::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// Virtual, defined by CCoeControl; replaces the default implementation +// provided by CCoeControl. +void CNslookupContainer::Draw(const TRect& aRect) const +{ + CWindowGc& gc = SystemGc(); + gc.SetClippingRect(aRect); + gc.DrawRect(Rect()); + +} + +// Virtual, defined by CCoeControl; replaces the default implementation +// provided by CCoeControl. +TInt CNslookupContainer::CountComponentControls() const +{ + return 3; +} + +// Virtual, defined by CCoeControl; replaces the default implementation +// provided by CCoeControl. +CCoeControl* CNslookupContainer::ComponentControl(TInt aIndex) const +{ + switch (aIndex) + { + case 0: return iLabel; + case 1: return iLabel2; + case 2: return iConsole; + //case 2: return iEdit; + default: break; + } + + return NULL; +} + +// Defined as pure virtual by the mixin class MCoeControlObserver +// inherited by CCoeControl. An empty implementation provided by +// this class (its containees do not report events). +void CNslookupContainer::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) +{ + + +} + + +// +// CHostNameDialog +// +#ifdef CALYPSO +CHostNameDialog::CHostNameDialog(TDes& aHostname) : CAknTextQueryDialog(aHostname) +{ +} +#else +CHostNameDialog::CHostNameDialog(CNslookup *aModel):CEikDialog() +{ + iModel=aModel; +} +#endif + +// Checks if data entered by user is correct +// returns ETrue to exit dialog anf EFalse to not exit it (no name entered) + +#ifdef CALYPSO +TBool CHostNameDialog::OkToExitL(TInt aButton) +{ + return CAknTextQueryDialog::OkToExitL(aButton); +} +#else +TBool CHostNameDialog::OkToExitL(TInt aButton) +{ + iModel->iQueryType = ChoiceListCurrentItem(ENslookupQueryType); + iModel->iShowSource = (CheckBoxState(ENslookupShowSource)== CEikButtonBase::ESet); + + TBuf hostname(_L("")); + if (aButton==EEikBidCancel) //CANCEL BUTTON + { + iOKPressed=EFalse; + return ETrue; + } + + GetEdwinText(hostname,ENslookupHostName); + + if (hostname.Length()!=0) + { + iModel->SetHostName(hostname); + return ETrue; + } + else + return EFalse; //If no hostname specified can't continue + +} +#endif // CALYPSO + +//To initialize dialog data +#ifdef CALYPSO +void CHostNameDialog::PreLayoutDynInitL() +{ + CAknTextQueryDialog::PreLayoutDynInitL(); +} +#else +void CHostNameDialog::PreLayoutDynInitL() +{ + SetCheckBoxState(ENslookupShowSource, iModel->iShowSource ? CEikButtonBase::ESet : CEikButtonBase::EClear); + SetChoiceListCurrentItem(ENslookupQueryType, iModel->iQueryType); + SetEdwinTextL(ENslookupHostName,iModel->GetHostName()); +} +#endif + + + +// +// CNslookupAppUi +// + +void CNslookupAppUi::ConstructL() +{ + BaseConstructL(); + + InitModelL(); + iAppView=new(ELeave) CNslookupView(iModel); + iAppView->ConstructL(ClientRect()); + +#if EPOC_SDK < 0x06000000 + //Just to watch the name of the file on the top of the toolbar + CEikFileNameLabel* pingLabel=(CEikFileNameLabel*)iToolBar->ControlById(ENslookupCmdFileName); + pingLabel->UpdateL(); +#endif + +#ifndef CALYPSO + + // add app view to stack; enables key event handling. + AddToStackL(iAppView); + +#else // if CALYPSO defined + + AppViewToStackL(); + + iAppView->ActivateL(); + + iSettingView = new (ELeave) CSettingView(iModel); + iSettingView->ConstructL(ClientRect()); + iSettingView->SetComponentsToInheritVisibility( ETrue ); + + SettingViewToStackL(); + + iSettingView->ActivateL(); + + ShowAppViewL(); + +#endif +} + +#ifdef CALYPSO + +void CNslookupAppUi::ShowAppViewL() +{ + iSettingView->MakeVisible( EFalse ); + SettingViewFromStack(); + AppViewToStackL(); + iAppView->MakeVisible( ETrue ); + iAppView->DrawNow(); + + CEikButtonGroupContainer *cba = ((CAknAppUi*)CEikonEnv::Static()->EikAppUi())->Cba(); + cba->SetCommandSetL(R_NSLOOKUP_CBA); + cba->DrawDeferred(); + + // Make sure that setting view's scroll indicators are not shown in the app view + iSettingView->ListBox()->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); + iSettingView->ListBox()->UpdateScrollBarsL(); +} + +void CNslookupAppUi::ShowSettingViewL() +{ + iAppView->MakeVisible( EFalse ); + AppViewFromStack(); + SettingViewToStackL(); + iSettingView->MakeVisible( ETrue ); + iSettingView->DrawNow(); + + CEikButtonGroupContainer *cba = ((CAknAppUi*)CEikonEnv::Static()->EikAppUi())->Cba(); + cba->SetCommandSetL(R_SETTINGS_CBA); + cba->DrawDeferred(); + + // Make sure that scroll bars are shown if needed + iSettingView->ListBox()->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto); + iSettingView->ListBox()->UpdateScrollBarsL(); +} + +void CNslookupAppUi::AppViewToStackL() +{ + if (!iAppViewOnStack) + { + AddToStackL(iAppView); + iAppViewOnStack = ETrue; + } +} + +void CNslookupAppUi::SettingViewToStackL() +{ + if (!iSettingViewOnStack) + { + AddToStackL(iSettingView); + iSettingViewOnStack = ETrue; + } +} + +void CNslookupAppUi::AppViewFromStack() +{ + if (iAppViewOnStack) + { + RemoveFromStack(iAppView); + iAppViewOnStack = EFalse; + } +} + +void CNslookupAppUi::SettingViewFromStack() +{ + if (iSettingViewOnStack) + { + RemoveFromStack(iSettingView); + iSettingViewOnStack = EFalse; + } +} + +#endif // #ifdef CALYPSO + +void CNslookupAppUi::InitModelL() +{ + TPreferences param; + + RestorePreferencesL(param); //Reads the .ini file + + iModel= new (ELeave) CNslookup(); + iModel->ConstructL(param); +} + +void CNslookupAppUi::HandleCommandL(TInt aCommand) +{ + TPreferences param; + + switch (aCommand) + { + case ENslookupStart: + if (!(iModel->IsRunning())) + if (CreateHostNameDialogL()) + iModel->BeginL(); + break; + + case ENslookupStop: //Stop ping + if (iModel->IsRunning()) + iModel->EndNslookup(); + break; + + case ENslookupReset: + iAppView->ResetScreen(); + break; + + case ENslookupAbout: + CreateAboutDialogL(); + break; + + case EEikCmdExit: + if (iModel->IsRunning()) + iModel->EndNslookup(); + iModel->GetPreferences(param); + StorePreferencesL(param); +#ifdef CALYPSO + AppViewFromStack(); + SettingViewFromStack(); +#endif + Exit(); + return; + +#ifdef CALYPSO + + case ENslookupSave: + // Try to save settings data + if ( iSettingView->SaveSettingsL() ) + { + // Switch back to the normal view + ShowAppViewL(); + } + break; + + case ENslookupCancel: + // Simply switch back to the normal view + ShowAppViewL(); + break; + +#endif // #ifdef CALYPSO + + default: + break; + } +} + + +// Launches a dialog to show an about box +void CNslookupAppUi::CreateAboutDialogL() const + { + CEikDialog* dialog = new (ELeave) CEikDialog(); + dialog->ExecuteLD(R_NSLOOKUP_ABOUT); //Final D means the dialog is destructed by itself + } + + +//Launches a dialog to specify a hostname and returns if Ok has been pressed to +// +#ifdef CALYPSO +TBool CNslookupAppUi::CreateHostNameDialogL() +{ + TBuf hostname; + + hostname.Copy(*(iModel->GetHostName())); + + CAknTextQueryDialog* dialog = new (ELeave) CHostNameDialog(hostname); + + TInt button = dialog->ExecuteLD(R_NSLOOKUP_HOSTNAME_AVKON); + + if ((button == EAknSoftkeyOk) && (hostname.Length() != 0)) + { + iModel->SetHostName(hostname); + return ETrue; + } + else + { + return EFalse; + } +} +#else +TBool CNslookupAppUi::CreateHostNameDialogL() + { + CEikDialog* dialog = new (ELeave) CHostNameDialog(iModel); + TInt button=dialog->ExecuteLD(R_NSLOOKUP_HOSTNAME); //Final D means the dialog is destructed by itself + return (button==EEikBidOk); // If button is CANCEL then the ping is not executed + } +#endif // CALYPSO + +void CNslookupAppUi::RestorePreferencesL(TPreferences& aPreferences) const +{ + CNslookup::DefaultPreferences(aPreferences); +} + + +void CNslookupAppUi::StorePreferencesL(const TPreferences & /*aPreferences*/) const +{ + // not supported +} + + + +CNslookupAppUi::~CNslookupAppUi() + { +#ifndef CALYPSO + RemoveFromStack(iAppView); +#endif + delete iAppView; +#ifdef CALYPSO + delete iSettingView; +#endif + delete iModel; + } + +// +// CNslookupDocument +// + +CNslookupDocument::CNslookupDocument(CEikApplication& aApp) + : CEikDocument(aApp) + { + } + +CEikAppUi* CNslookupDocument::CreateAppUiL() + { + return(new(ELeave) CNslookupAppUi); + } + +// +// CNslookupApplication +// + +TUid CNslookupApplication::AppDllUid() const + { + return KUidNslookupApp; + } + + +CApaDocument* CNslookupApplication::CreateDocumentL() + { + return new(ELeave) CNslookupDocument(*this); + } + +// +// EXPORTed functions +// + +EXPORT_C CApaApplication* NewApplication() + { + return new CNslookupApplication; + } + + +#ifdef MAKE_EXE_APPLICATION + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + +#else + + +#endif // MAKE_EXE_APPLICATION + +#ifdef CALYPSO + +//------------------------------------------------------------------ +// CNslookupBinaryPopupSettingItem +// +// NOTE. This class is implemented only to circumvent +// a bug (?) in CAknBinaryPopupSettingItem::Load +//------------------------------------------------------------------ + +CNslookupBinaryPopupSettingItem::CNslookupBinaryPopupSettingItem( TInt aIdentifier, TBool& aBinaryValue ) : + CAknBinaryPopupSettingItem( aIdentifier, aBinaryValue ) + { + } + +void CNslookupBinaryPopupSettingItem::LoadL() + { + // Call CAknEnumeratedTextPopupSettingItem::LoadL to copy + // the external boolean value to an internal value + // NOTE. CAknBinaryPopupSettingItem::LoadL must NOT be called + CAknEnumeratedTextPopupSettingItem::LoadL(); + } + +//----------------------------------------------------------------- +// CNslookupTextSettingItem +// +// NOTE. This is a re-implementation/copy of CAknTextSettingItem +// (the only difference is in the LoadL method) due to a bug/ +// feature in CAknTextSettingItem::LoadL() +//----------------------------------------------------------------- + +CNslookupTextSettingItem::CNslookupTextSettingItem( TInt aIdentifier, TDes& aText ) : + CAknSettingItem(aIdentifier), iExternalText( aText ), iInternalTextPtr(0,0) + { + } + +CNslookupTextSettingItem::~CNslookupTextSettingItem() + { + delete iInternalText; + } + +void CNslookupTextSettingItem::StoreL() + { + // Copy the internal to the external + iExternalText.Copy(iInternalText->Des() ); + } + +// NOTE. This is the only method that has changed from CAknTextSettingItem +void CNslookupTextSettingItem::LoadL() + { + delete iInternalText; + iInternalText = 0; + // NOTE. The difference is below + // OLD CODE: + // iInternalText = iExternalText.AllocL(); + // END OF OLD CODE + // NEW CODE: + iInternalText = HBufC::NewL( iExternalText.MaxLength() ); + TPtr ptrText = iInternalText->Des(); + ptrText.Copy( iExternalText ); + // END OF NEW CODE + // Use Set so that the whole TPtr is just overwritten - and gets a new buffer + iInternalTextPtr.Set(iInternalText->Des() ); + } + +const TDesC& CNslookupTextSettingItem::SettingTextL() +{ + return *iInternalText; +} + +void CNslookupTextSettingItem::EditItemL( TBool /* aCalledFromMenu */) + { + CAknSettingPage* dlg = new( ELeave )CAknTextSettingPage( SettingPageResourceId(), iInternalTextPtr, 0 ); + SetSettingPage( dlg ); + SettingPage()->SetSettingPageObserver(this); + SetUpStandardSettingPageL(); + SettingPage()->ExecuteLD(CAknSettingPage::EUpdateWhenChanged); + } + +TPtr& CNslookupTextSettingItem::InternalTextPtr() +{ + return iInternalTextPtr; +} + +TPtrC CNslookupTextSettingItem::ExternalText() +{ + return (TPtrC)(iExternalText); +} + +void CNslookupTextSettingItem::SetExternalText( TDesC& aNewExternalText ) +{ + iExternalText.Copy( aNewExternalText ); +} + +//----------------------------------------------------------------- +// CSettingView +//----------------------------------------------------------------- + +void CSettingView::ConstructL(const TRect& /*aRect*/) +{ + // Copy data from the model to member variables + + iLimitPacketCount = iModel->iPackLimit ? ETrue : EFalse; + iMaxPacketCount.Num( iModel->iTotalPackets ); + iPacketDataSize.Num( iModel->iPacketDataSize ); + iWaitTime.Num( iModel->iSecWait ); + iLastWaitTime.Num( iModel->iLastSecWait ); + + iPattern.Copy( iModel->iPattern ); + iQuiet = iModel->iQuiet ? ETrue : EFalse; + iVerbose = iModel->iVerbose ? ETrue : EFalse; + iDebug = iModel->iDebug ? ETrue : EFalse; + + CAknSettingItemList::ConstructFromResourceL( R_NSLOOKUP_SETTINGS ); +} + +CSettingView::CSettingView(CNslookup *aModel) + { + iModel = aModel; + } + +CSettingView::~CSettingView() + { + } + +void CSettingView::ProcessCommandL(TInt /*aCommand*/) + { + } + +CAknSettingItem* CSettingView::CreateSettingItemL( TInt identifier ) + { + CAknSettingItem* settingItem; + + switch (identifier) + { + case 1: + settingItem = new (ELeave) CNslookupBinaryPopupSettingItem( identifier, iLimitPacketCount ); + return settingItem; + break; + case 2: + settingItem = new (ELeave) CNslookupTextSettingItem( identifier, iMaxPacketCount ); + return settingItem; + break; + case 3: + settingItem = new (ELeave) CNslookupTextSettingItem(identifier, iPacketDataSize); + return settingItem; + break; + case 4: + settingItem = new (ELeave) CNslookupTextSettingItem(identifier, iWaitTime); + return settingItem; + break; + case 5: + settingItem = new (ELeave) CNslookupTextSettingItem(identifier, iLastWaitTime); + return settingItem; + break; + case 6: + settingItem = new (ELeave) CNslookupTextSettingItem(identifier, iPattern); + return settingItem; + break; + case 7: + settingItem = new (ELeave) CNslookupBinaryPopupSettingItem( identifier, iQuiet ); + return settingItem; + break; + case 8: + settingItem = new (ELeave) CNslookupBinaryPopupSettingItem( identifier, iVerbose ); + return settingItem; + break; + case 9: + settingItem = new (ELeave) CNslookupBinaryPopupSettingItem( identifier, iDebug ); + return settingItem; + break; + default: + settingItem = new (ELeave) CAknSettingItem(identifier); + return settingItem; + break; + } +} + +TBool CSettingView::SaveSettingsL() + { + // Save settings to the member variables + + StoreSettingsL(); + + // Validate input + + TLex lex; + + TInt maxPacketCount; + lex.Assign( iMaxPacketCount ); + if ( lex.Val( maxPacketCount ) != KErrNone ) + { + CEikonEnv::Static()->InfoMsg(_L("Packet count must be numeric")); + return EFalse; + } + + TInt packetDataSize; + lex.Assign( iPacketDataSize ); + if ( lex.Val( packetDataSize ) != KErrNone ) + { + CEikonEnv::Static()->InfoMsg(_L("Packet size must be numeric")); + return EFalse; + } + + TInt waitTime; + lex.Assign( iWaitTime ); + if ( lex.Val( waitTime ) != KErrNone ) + { + CEikonEnv::Static()->InfoMsg(_L("Wait time must be numeric")); + return EFalse; + } + + TInt lastWaitTime; + lex.Assign( iLastWaitTime ); + if ( lex.Val( lastWaitTime ) != KErrNone ) + { + CEikonEnv::Static()->InfoMsg(_L("Last wait time must be numeric")); + return EFalse; + } + + lex.Assign( iPattern ); + while (!lex.Eos()) + { + if (!lex.Get().IsHexDigit()) + { + CEikonEnv::Static()->InfoMsg(_L("Pattern must be hexadecimal")); + return EFalse; + } + } + + // Validation OK, so save settings to the model + + iModel->iPackLimit = iLimitPacketCount; + iModel->iTotalPackets = maxPacketCount; + iModel->iPacketDataSize = packetDataSize; + iModel->iSecWait = waitTime; + iModel->iLastSecWait = lastWaitTime; + iModel->iPattern.Copy(iPattern); + iModel->iQuiet = iQuiet; + iModel->iVerbose = iVerbose; + iModel->iDebug = iDebug; + + return ETrue; +} + +#endif // #ifdef CALYPSO diff -r 000000000000 -r 9736f095102e package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e package_definition_v2.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition_v2.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 9736f095102e techview_info/techview_metadata/techview_metadata.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/techview_info/techview_metadata/techview_metadata.mrp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +# + +component techview_metadata +source \sf\app\techview\techview_info\techview_metadata +source \sf\app\techview\package_definition.xml +source \sf\app\techview\distribution.policy.s60 +source \sf\app\techview\package_definition_v2.xml +notes_source \component_defs\release.src +ipr T diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/inc/ResourceHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/inc/ResourceHandler.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,356 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __ResourceHandler_H +#define __ResourceHandler_H + + +#include "ResourceHandler.hrh" +//for storing resource data +#include "ResourceHandler_DataStructs.h" + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "ResourceHandler_Dialogs.h" // may not need for S60 + +#include +#include +#include +#include + +#include +#include + +#ifdef UIQ +#include +#include +#endif + + +#ifdef TV + +#include +// for CEikNumberEditor +#include +// for CEikButtonGroupContainer +#include +// for CEikNumberEditor +#include +#endif + +#include //for column list box +#include // for CColumnListBoxData in TV/UIQ + +#include +// for CEikButtonGroupContainer +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// copy from k32std.h +#define KHARDWARE 0x00000001 +#define KBOOT 0x00000002 +#define KSERVER 0x00000004 +#define KMMU 0x00000008 +#define KSEMAPHORE 0x00000010 +#define KSCHED 0x00000020 +#define KPROC 0x00000040 +#define KEXEC 0x00000080 +#define KEXECFAST 0x00000100 +#define KTHREAD 0x00000200 +#define KDLL 0x00000400 +#define KLOGON 0x00000800 +#define KPBUS1 0x00001000 +#define KPBUS2 0x00002000 +#define KPBUSDRV 0x00004000 +#define KPOWER 0x00008000 +#define KTIMING 0x00010000 +#define KEVENT 0x00020000 +#define KMEMTRACE 0x00080000 +#define KIPC 0x00100000 +#define KDEBUGGER 0x00200000 +#define KVIDEO 0x00800000 +#define KUSB 0x01000000 +#define KPANIC 0x80000000 + +_LIT(KFormatDec, "%d"); +_LIT(KFormatDec64, "%ld"); +_LIT(KFormatUDec,"%u"); +_LIT(KFormatHex, "%x"); +_LIT(KAsterisk, "*"); +_LIT(KFillName, "ResMan"); + +enum TMemorySizes +{ + K4k = 0x00001000, // 4,096 + K8k = 0x00002000, // 8,192 + K16k = 0x00004000, // 16,384 + K32k = 0x00008000, + K64k = 0x00010000, // 65,536 + K128k = 0x00020000, + K256k = 0x00040000, // 262,144 + K512k = 0x00080000, + K1M = 0x00100000, + K2M = 0x00200000, + K4M = 0x00400000, + K8M = 0x00800000, //8,388,608 + K16M = 0x01000000 +}; + +enum TObjectsViewed + { + EObjectNone, + EObjectProcess, + EObjectThread, + EObjectChunk, + EObjectLibrary, + EObjectServer, + EObjectSemaphore, + EObjectMutex, + EObjectLogicalDevice, + EObjectPhysicalDevice, + EObjectLogicalChannel, + EObjectWindow, + EObjectDrive, + EObjectHal + }; + +// Forward declarations + +class CResourceAppUi; +class CResourceAppView; +class CResourceListView; +class CResourceView; + +// +// +// CResourceApplication +// +// + +class CResourceApplication : public CXKNAPPLICATION + { +private: + // Inherited from class CApaApplication + CApaDocument* CreateDocumentL(); + TUid AppDllUid() const; + }; +// +// +// CResourceDocument +// +// +class CResourceDocument : public CXKNDOCUMENT + { +public: + static CResourceDocument* NewL(CEikApplication& aApp); + CResourceDocument(CEikApplication& aApp); + void ConstructL(); +private: + // Inherited from CXKNDOCUMENT + CEikAppUi* CreateAppUiL(); + }; +// +// +// CResourceAppUi +// +// +class CResourceAppUi : public CXKNAPPUI + { +public: + void ConstructL(); + ~CResourceAppUi(); + +private: + // Inherited from class CXKNAPPUI + void HandleCommandL(TInt aCommand); + +private: + CResourceView* iListBoxView; + void SetProcess(void); + void SetThread(void); + void SetDebug(void); + void SetRam(void); + void SetDrive(void); + + void AppendDesc(TDes& root, TDes& add); + + }; + +// +// +// CResourceDetails - stores resource names and details. +// Used for resources for which not just the name but additional +// details are displayed. +// +// +class TResourceDetails +{ +protected: + TProcessData iProcessData; + TThreadData iThreadData; + TChunkData iChunkData; + TSemaphoreData iSemaphoreData; + TMutexData iMutexData; + TDriveData iDriveData; + THalData iHalData; + TListData iListData; + void GetProcessData(TDesC& aProcessName); + void GetThreadData(TDesC& aThreadName); + void GetChunkData(TFindChunk findHb, TDesC& aChunkName); + void GetSemaphoreData(TFindSemaphore& findHb, TDesC& aSemaphoreName); + void GetMutexData(TFindMutex& findHb, TDesC& aMutexName); + void GetDriveData(TInt aValidDriveNum, TDriveUnit aDriveUnit, TVolumeInfo aVolumeInfo); + void GetHalData(TInt aEntryNum, HAL::SEntry*); +private: + void AppendDotsToResourceName(TFullName& aResourceName); + +}; +// +// +// CResourceList +// +// +class CResourceList: public CCoeControl, public MCoeControlObserver, public TResourceDetails +{ +public: + void ConstructL(TInt aTablePosition); + ~CResourceList(); +protected: + void UpdateResourceCount(TUint aNumberOfResource) {iResourceCount = aNumberOfResource;} + void UpdateListData(); + + CCoeControl* GetListBox() const; + +private: + void SetUpProcessTable(); + void SetUpThreadTable(); + void SetUpChunkTable(); + void SetUpSemaphoreTable(); + void SetUpMutexTable(); + void SetUpDriveTable(); + void SetUpHalTable(); + void SetUpList(); //uses single column tables + + void GetResourceList(); + void AddRow(const TProcessData& aProcessData); + void AddRow(const TThreadData& aThreadData); + void AddRow(const TChunkData& aChunkData); + void AddRow(const TSemaphoreData& aSemaphoreData); + void AddRow(const TMutexData& aMutexData); + void AddRow(const TDriveData& aDriveData); + void AddRow(const THalData& aHalData); + void AddRow(const TListData& aListData); + + void GetThreadList(void); + void GetProcessList(void); + void GetChunkList(void); + void GetLibraryList(void); + void GetServerList(void); + void GetSemaphoreList(void); + void GetMutexList(void); + void GetLogicalDeviceList(void); + void GetPhysicalDeviceList(void); + void GetLogicalChannelList(void); + void GetWindowList(void); + void GetDriveList(void); + void GetHalList(void); + + void EmptyList(); + + CEikColumnListBox* iListBox; + CTextListBoxModel* iModel; + MDesCArray* iTextArray; + CDesCArray* iListBoxItems; + CColumnListBoxData* iListBoxData; +protected: + TInt iBorder; + TUint iResourceCount; // Count of number of items in table + TObjectsViewed iObjectsViewed; // What view is showing + +}; + +// +// +// CResourceView +// +// +class CResourceView : public CResourceList + { +public: + static CResourceView* NewL(const TRect& aRect, CResourceAppUi* aAppUi); + + ~CResourceView(); + + void SetCurrentObjects(TObjectsViewed aViewed) + {iObjectsViewed = aViewed;}; + + void UpdateView(); + +private: + // Private constructor to force NewL + CResourceView(); + void ConstructL(const TRect& aRect, CResourceAppUi* aAppUi); + void InvalidateView(void) const; + void UpdateTitle(void); +protected: + + // Inherited from CCoeControl + virtual TInt CountComponentControls() const; + virtual CCoeControl* ComponentControl(TInt aIndex) const; + virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); + +private: + + // Inherited from CCoeControl + void Draw(const TRect& /*aRect*/) const; + +private: + + CResourceAppUi* iAppUi; + + // State Data + TBuf<27> iTitle; // Title above table + // Controls + CEikCommandButton* iCommandButton; + }; + +#endif + diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/inc/ResourceHandler.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/inc/ResourceHandler.hrh Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,207 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "ResourceHandlerPlatform.hrh" + +#ifdef UIQ +#define A_NUMBER_EDITOR QIK_NUMBER_EDITOR +#define EXIKCTNUMBEREDITOR EQikCtNumberEditor +#define CXIKNUMBEREDITOR CQikNumberEditor +#define NUMBERVALUE Value +#define SETNUMBERVALUEL SetValueL +#define CXIKOPTIONBUTTONLIST CQikVertOptionButtonList +#define EXIKCTOPTIONBUTLIST EQikCtVertOptionButtonList +#define OPBUTLIST QIK_VERTOPBUT +#define ITEMFLAG_USEFULLWIDTH itemflags=EQikDlgItemUseFullWidth; +#define ITEMFLAG_DENSELYPACKED itemflags=EQikDlgItemDenselyPacked; +#define ITEMFLAG_NONFOCUSING itemflags = EEikDlgItemNonFocusing; +#endif + +#ifdef TV +#define A_NUMBER_EDITOR NUMBER_EDITOR +#define EXIKCTNUMBEREDITOR EEikCtNumberEditor +#define CXIKNUMBEREDITOR CEikNumberEditor +#define NUMBERVALUE Number +#define SETNUMBERVALUEL SetNumber +#define CXIKOPTIONBUTTONLIST CEikHorOptionButtonList +#define EXIKCTOPTIONBUTLIST EEikCtHorOptionButList +#define OPBUTLIST HOROPBUT +#define LABELITEMFLAGS +#define ITEMFLAG_USEFULLWIDTH +#define ITEMFLAG_DENSELYPACKED +#define ITEMFLAG_NONFOCUSING +#endif + +#define CXKNAPPLICATION CEikApplication +#define CXKNDOCUMENT CEikDocument +#define CXKNAPPUI CEikAppUi + + + +enum TResourceMenuCommands + { + EResourceMenu1Item0 = 200, + EResourceMenu1Item1, + EResourceMenu1Item2, + EResourceMenu1Item3, + EResourceMenu1Item4, + EResourceMenu1Item5, + EResourceMenu1Item6, + EResourceMenu1Item7, + EResourceMenu1Item8, + EResourceMenu1Item9, + EResourceMenu2Item0 = 300, + EResourceMenu2Item1, + EResourceMenu2Item2, + EResourceMenu3Item0 = 400, + EResourceMenu3Item1, + EResourceMenu3Item2, + EResourceMenu3Item3, + EResourceMenu3Item4 + }; + +enum TResourceDialogControls + { + EThreadNumberCtl = 1000, + EThreadSystemCtl, + EThreadProtectedCtl, + EThreadPageGeneral, + EThreadPagePriority, + EThreadPageOther, + EThreadPriorityPrompt, + EThreadPriorityButtonCtl, + EThreadPriorityText, + EThreadSetButtonCtl, + EThreadGetButtonCtl, + EThreadKillButtonCtl, + EThreadLabelTop, + EThreadLabelThreadName,//UIQ + EThreadLabelProcessName,//UIQ + EThreadLabelThreadAndProcessName,//TV + + EProcessNumberCtl = 1100, + EProcessPriorityText, + EProcessSystemCtl, + EProcessProtectedCtl, + EProcessPageGeneral, + EProcessPagePriority, + EProcessPageOther, + EProcessPriorityButtonCtl, + EProcessGetButtonCtl, + EProcessKillButtonCtl, + EProcessSetButtonCtl, + EProcessLabelTop, + EProcessLabelProcessName, + + EDebugSetButtonCtl, + EDebugPortCtl = 1200, + + EDebugFileServerCtl, + EDebugFATCtl, + EDebugLoaderCtl, + + EDebugPagePort, + EDebugPageKernel, + EDebugPageFiles, + + EDebugFileLabel, + EDebugPortLabel, + EDebugKernelLabel, + + EDebugKernelKHARDWARE, + EDebugKernelKBOOT, + EDebugKernelKSERVER, + EDebugKernelKMMU, + EDebugKernelKSEMAPHORE, + EDebugKernelKSCHED, + EDebugKernelKPROC, + EDebugKernelKEXEC, + EDebugKernelKEXECFAST, + EDebugKernelKTHREAD, + EDebugKernelKDLL, + EDebugKernelKLOGON, + EDebugKernelKPBUS1, + EDebugKernelKPBUS2, + EDebugKernelKPBUSDRV, + EDebugKernelKPOWER, + EDebugKernelKTIMING, + EDebugKernelKEVENT, + EDebugKernelKMEMTRACE, + EDebugKernelKIPC, + EDebugKernelKDEBUGGER, + EDebugKernelKVIDEO, + EDebugKernelKUSB, + EDebugKernelKPANIC, + + ERamLabel1, + ERamLabel2, + ERamTotal, + ERamFree, + ERamToLeaveButtonCtl, + ERamSetButtonCtl, + ERamUndoFillButtonCtl, + + EDriveLabel1, + EDriveFormatButtonCtl, + EDriveUndoFillButtonCtl, + EDriveFillButtonCtl, + EDriveChoiceList, + EDriveToLeaveButtonCtl, + + EDriveLeave4K, + EDriveLeave8K, + EDriveLeave16K, + EDriveLeave64K, + EDriveLeave256K + }; + +enum TThreadPriorities + { + EThreadPm30_Null, + EThreadPm20_MuchLess, + EThreadPm10_Less, + EThreadP0_Normal, + EThreadP10_More, + EThreadP20_MuchMore, + EThreadP30_RealTime, + EThreadP100_AbsoluteVeryLow, + EThreadP200_AbsoluteLow, + EThreadP300_AbsoluteBackground, + EThreadP400_AbsoluteForeground, + EThreadP500_AbsoluteHigh, + EThreadP_NotStandard + }; + +enum TProcessPriorities + { + EProcessP150_PriorityLow, + EProcessP250_PriorityBackground, + EProcessP350_PriorityForeground, + EProcessP450_PriorityHigh, + EProcessP650_PriorityWindowServer, + EProcessP750_PriorityFileServer, + EProcessP850_PriorityRealTimeServer, + EProcessP950_PrioritySupervisor, + EProcessPriorityNotStandard + }; + +enum TRAMToLeave + { + ERamLeave4K, + ERamLeave8K, + ERamLeave16K, + ERamLeave64K, + ERamLeave256K + }; diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/inc/ResourceHandler_DataStructs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/inc/ResourceHandler_DataStructs.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,112 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 __ResourceHandler_DataStructs_H +#define __ResourceHandler_DataStructs_H + + +#include //descriptors, TUidType etc + +struct TListData +/** Stores library, server, device and logical channel data */ +{ + TFullName iName; +}; + +struct TProcessData +/** Stores process details */ + { + TBuf<8> iIdString; + TFullName iProcessName; // this is a TBuf (big) + TBuf<8> iPriorityString; + TBuf<1> iProtectedIndicator; + TBuf<1> iSystemIndicator; + TBuf<8> iOwnerIdString; + TBuf<15> iExitTypeString; + TBuf<8> iExitReasonString; + TExitCategoryName iExitCategoryName; // this is a TBuf + TBuf iUidType0String; //Note: buffer could be shorter as UID is converted to hexadecimal format + TBuf iUidType1String; + TBuf iUidType2String; + TFileName iFileName; // this is a TBuf + }; + +struct TThreadData +/** Stores thread details */ + { + TBuf<8> iIdString; + TFullName iThreadName; // this is a TBuf (big) + TBuf<10> iPriorityString; + TBuf<8> iOwnerIdString; + TBuf<8> iStackSizeString; + TBuf<8> iHeapSizeString; + TBuf<1> iProtectedIndicator; + TBuf<1> iSystemIndicator; + TBuf<15> iExitTypeString; + TBuf<8> iExitReasonString; + TExitCategoryName iExitCategoryName; // this is a TBuf + }; + + + +struct TChunkData +/** Stores chunk details */ + { + TFullName iChunkName; // this is a TBuf (big) + TBuf<8> iSizeString; + TBuf<8> iMaxSizeString; + TBuf<1> iReadableIndicator; + TBuf<1> iWritableIndicator; + }; + +struct TSemaphoreData +/** Stores semaphore details */ + { + TFullName iSemaphoreName; // this is a TBuf (big) + TBuf<8> iHexCountString; + TBuf<8> iDecCountString; + }; + +struct TMutexData +/** Stores mutex details */ + { + TFullName iMutexName; // this is a TBuf (big) + TBuf<8> iHexCountString; + TBuf<8> iDecCountString; + }; + +struct TDriveData +/** Stores drive details */ + { + TFullName iDriveName; // this is a TBuf (big) + TFullName iVolumeName; // this is a TBuf (big) //volume mounted on drive + TBuf<2> iDriveNumberString; + TBuf<20> iMediaString; //Media mounted on drive + TBuf<12> iAttributesString; + TBuf<12> iSpaceString; + TBuf<12> iFreeSpaceString; + }; + +struct THalData +/**Stores HAL attributes data*/ +{ + TBuf<4> iNumberString; //sequential number for each item + TBuf<30> iName; + TBuf<1> iDynamicIndicator; + TBuf<12> iDecValString; //Decimal attribute value - not sure of purpose of this + TBuf<12> iHexValString; //Hex attribute value - not sure of purpose of this +}; + +#endif diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/inc/ResourceHandler_Dialogs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/inc/ResourceHandler_Dialogs.h Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,118 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 RESOURCEHANDLER_DIALOGS_H +#define RESOURCEHANDLER_DIALOGS_H + +#include + +class CDialogBase : public CEikDialog + { +public: + // constructor + CDialogBase(); +public: + void DisplayError(TDesC& aMessage, TInt aErrorNumber); + void DisplayError(TDesC& aMessage); + }; + +class CThreadNumberDialog : public CDialogBase + { +public: + // constructor + CThreadNumberDialog(); +private: + void PreLayoutDynInitL(); + void PostLayoutDynInitL(); + TBool OkToExitL(TInt aKeycode); + void SetThread(); + void UpdateDialogData(void); + void UpdateDialogDataReal(void); + void UpdateDialogDataAll(void); + void UpdatePriorityText(void); //updates the priority number value to correspond to the priority option selected + void HandleControlStateChangeL(TInt aControlId); + +private: + TThreadId iThreadID; + }; + +class CProcessNumberDialog : public CDialogBase + { +public: + // constructor + CProcessNumberDialog(); +private: + void PreLayoutDynInitL(); + void PostLayoutDynInitL(); + TBool OkToExitL(TInt aKeycode); + void UpdateDialogData(void); + void UpdatePriorityText(void); + void UpdateProcessId(void); + void SetProcess(); + void HandleControlStateChangeL(TInt aControlId); + +private: + TProcessId iProcessID; + }; + +class CDebugDialog : public CDialogBase + { +public: + // constructor + CDebugDialog(); +private: + void PreLayoutDynInitL(); + void GetKernelOptions(); + void GetPortNumber(); + TBool OkToExitL(TInt aKeycode); + void SetDebugOptions(); +private: + TInt iCurrentDebugPort; + }; + +class CRamDialog : public CDialogBase + { +public: + // constructor + CRamDialog(); + +private: + void PreLayoutDynInitL(); + TBool OkToExitL(TInt aKeycode); + void FillRam(); + void UndoFillRam(); + void UpdateDialogData(); + +private: + RChunk chunks[10000]; + TUint noChunks; + }; + +class CDriveDialog : public CDialogBase + { +public: + // constructor + CDriveDialog(); + ~CDriveDialog(); + void UpdateDialogLeaveSpace(); +private: + void PreLayoutDynInitL(); + TBool OkToExitL(TInt aKeycode); +private: + CDesCArrayFlat* iDriveName; + CArrayFixFlat* iDriveLetter; + }; + +#endif diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/rsc/ResourceHandler.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/rsc/ResourceHandler.rss Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,899 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +NAME RES + +#include "ResourceHandler.hrh" + +#include + +#include +// for symbolic definition of buttons +#include //for runtime +// for various constants +#include //for runtime + +#ifdef UIQ +// for QIK_NUMBER_EDITOR/QIK_VERTOPBUT/EQikDlgItemUseFullWidth +#include +// for various constants +#include //for runtime +#endif + +#ifdef TV +// for CEikNumberEditor +#include +#include +#endif + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf=""; } + +RESOURCE EIK_APP_INFO + { + menubar=r_resource_menubar; + } + +// +// Menus +// + +RESOURCE MENU_BAR r_resource_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_resource_menu_1; txt="Kernel"; }, + MENU_TITLE { menu_pane=r_resource_menu_2; txt="System"; }, + MENU_TITLE { menu_pane=r_resource_menu_3; txt="Tools"; } + }; + } + +RESOURCE MENU_PANE r_resource_menu_1 + { + items= + { + MENU_ITEM { command=EResourceMenu1Item0; txt="Process"; }, + MENU_ITEM { command=EResourceMenu1Item1; txt="Thread"; }, + MENU_ITEM { command=EResourceMenu1Item2; txt="Chunk"; }, + MENU_ITEM { command=EResourceMenu1Item3; txt="Library"; }, + MENU_ITEM { command=EResourceMenu1Item4; txt="Server"; }, + MENU_ITEM { command=EResourceMenu1Item5; txt="Semaphore"; }, + MENU_ITEM { command=EResourceMenu1Item6; txt="Mutex"; }, + MENU_ITEM { command=EResourceMenu1Item7; txt="Log Device"; }, + MENU_ITEM { command=EResourceMenu1Item8; txt="Phy Device"; }, + MENU_ITEM { command=EResourceMenu1Item9; txt="Log Chan"; } + + }; + } + +RESOURCE MENU_PANE r_resource_menu_2 + { + items= + { + MENU_ITEM { command=EResourceMenu2Item0; txt="Window Grp"; }, + MENU_ITEM { command=EResourceMenu2Item1; txt="Drive"; }, + MENU_ITEM { command=EResourceMenu2Item2; txt="HAL"; } + }; + } + +RESOURCE MENU_PANE r_resource_menu_3 + { + items= + { + MENU_ITEM { command=EResourceMenu3Item1; txt="Thread Tool"; }, + MENU_ITEM { command=EResourceMenu3Item2; txt="Process Tool"; }, + MENU_ITEM { command=EResourceMenu3Item3; txt="RAM Tool"; }, + MENU_ITEM { command=EResourceMenu3Item4; txt="Drive Tool"; } + }; + } + +// +// Debug dialog +// + +RESOURCE DIALOG r_debug_dialog + { + title = "Debug Tool"; + flags = EEikDialogFlagWait; + buttons = r_debug_dialog_buttons; + pages = r_debug_dialog_pages; + + } + +RESOURCE DLG_BUTTONS r_debug_dialog_buttons + { + buttons= + { + DLG_BUTTON + { + id=EDebugSetButtonCtl; + button=CMBUT { txt="Set";}; + hotkey = 'S'; + }, + DLG_BUTTON + { + id=EEikBidCancel; + button=CMBUT { txt="Cancel";}; + hotkey = 'C'; + }, + DLG_BUTTON + { + id=EEikBidOk; + button=CMBUT { txt="Done";}; + hotkey = 'D'; + } + }; + } + +RESOURCE ARRAY r_debug_dialog_pages + { + items = + { + PAGE + { + text = "Port"; + id = EDebugPagePort; + lines = r_debug_dialog_page_port; + }, + PAGE + { + text = "Kernel"; + id = EDebugPageKernel; + lines = r_debug_dialog_page_kernel; + }, + PAGE + { + text = "FS"; + id = EDebugPageFiles; + lines = r_debug_dialog_page_file_s; + } + }; + } + + +RESOURCE ARRAY r_debug_dialog_page_kernel + { + items = + { + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = EDebugKernelLabel; + control=LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Select debugging information to be printed.\nNote: must have debug version of ekern.exe in ROM.\nNote: not all combinations may be possible."; + }; + }, + DLG_LINE { type=EEikCtCheckBox; prompt="KHARDWARE"; id = EDebugKernelKHARDWARE;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KBOOT"; id = EDebugKernelKBOOT;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KSERVER"; id = EDebugKernelKSERVER;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KMMU"; id = EDebugKernelKMMU;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KSEMAPHORE"; id = EDebugKernelKSEMAPHORE;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KSCHED"; id = EDebugKernelKSCHED;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KPROC"; id = EDebugKernelKPROC;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KEXEC"; id = EDebugKernelKEXEC;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KEXECFAST"; id = EDebugKernelKEXECFAST;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KTHREAD"; id = EDebugKernelKTHREAD;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KDLL"; id = EDebugKernelKDLL;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KLOGON"; id = EDebugKernelKLOGON;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KPBUS1"; id = EDebugKernelKPBUS1;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KPBUS2"; id = EDebugKernelKPBUS2;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KPBUSDRV"; id = EDebugKernelKPBUSDRV;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KPOWER"; id = EDebugKernelKPOWER;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KTIMING"; id = EDebugKernelKTIMING;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KEVENT"; id = EDebugKernelKEVENT;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KMEMTRACE"; id = EDebugKernelKMEMTRACE;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KIPC"; id = EDebugKernelKIPC;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KDEBUGGER"; id = EDebugKernelKDEBUGGER;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KVIDEO"; id = EDebugKernelKVIDEO;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KUSB"; id = EDebugKernelKUSB;}, + DLG_LINE { type=EEikCtCheckBox; prompt="KPANIC"; id = EDebugKernelKPANIC;} + }; + } + + +RESOURCE ARRAY r_debug_dialog_page_file_s + { + items = + { + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH //needed? + id = EDebugFileLabel; + control=LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Select debugging information to be printed.\nMust have debug version of efile.exe in ROM. Or define\n_DEBUG_RELEASE in f32dbg.h. \nNote: these values are not readable."; + }; + }, + DLG_LINE + { + type=EEikCtCheckBox; + prompt="File Server"; + id = EDebugFileServerCtl; + }, + DLG_LINE + { + type=EEikCtCheckBox; + prompt="FAT File System"; + id = EDebugFATCtl; + }, + DLG_LINE + { + type=EEikCtCheckBox; + prompt="Loader"; + id = EDebugLoaderCtl; + } + + }; + + } + + +RESOURCE ARRAY r_debug_dialog_page_port + { + items = + { + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = EDebugPortLabel; + control=LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Set the port number for debug output. (-1 means no port is set)."; + }; + }, + DLG_LINE + { + type = EXIKCTNUMBEREDITOR; + prompt = "Debug Port "; + id = EDebugPortCtl; + control = A_NUMBER_EDITOR + { + min = -1; + max = 1023; + }; + //itemflags = EEikDlgItemNoBorder | EEikDlgItemNonFocusing; + ITEMFLAG_NONFOCUSING + } + }; + } + + +// +// Thread Dialog +// + +RESOURCE DIALOG r_thread_dialog + { + title = "Thread Tool"; + buttons = r_thread_dialog_buttons; + flags = EEikDialogFlagWait; + pages = r_thread_dialog_pages; + } + + +RESOURCE DLG_BUTTONS r_thread_dialog_buttons + { + buttons= + { + DLG_BUTTON + { + id=EThreadKillButtonCtl; + button=CMBUT { txt="Kill!";}; + hotkey = 'K'; + }, + DLG_BUTTON + { + id=EThreadSetButtonCtl; + button=CMBUT { txt="Set";}; + hotkey = 'S'; + }, + DLG_BUTTON + { + id=EEikBidCancel; + button=CMBUT { txt="Cancel";}; + hotkey = 'C'; + }, + DLG_BUTTON + { + id=EEikBidOk; + button=CMBUT { txt="Done";}; + hotkey = 'D'; + } + }; + } + +RESOURCE ARRAY r_thread_dialog_pages + { + items = + { + PAGE + { + text = "Thread"; + id = EThreadPageGeneral; + lines = r_thread_dialog_page_general; + //buttons=r_thread_dialog_buttonbar; + }, + PAGE + { + text = "Priority"; + id = EThreadPagePriority; + lines = r_thread_dialog_page_priority; + }, + PAGE + { + text = "Other"; + id = EThreadPageOther; + lines = r_thread_dialog_page_other; + } + }; + } + +RESOURCE ARRAY r_thread_dialog_page_general + { + items = + { + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = EThreadLabelTop; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Enter thread id number and hit 'Get Thread' to find and change \nthread attributes. (Zero for all threads)"; + }; + }, + DLG_LINE + { + type = EXIKCTNUMBEREDITOR; + prompt = "Thread Number"; + id = EThreadNumberCtl; + control = A_NUMBER_EDITOR + { + min = 0; + max = 1023; + }; + //itemflags = EEikDlgItemNoBorder | EEikDlgItemNonFocusing; + ITEMFLAG_NONFOCUSING + }, +//The process and thread name are defined on one line in TV and 2 lines in UIQ, due to restricted dialog space in TV. +#ifdef TV + DLG_LINE + { + type=EEikCtLabel; + prompt = "Thread/Process:"; + id = EThreadLabelThreadAndProcessName; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt=""; + }; + }, +#endif +#ifdef UIQ + DLG_LINE + { + type=EEikCtLabel; + prompt = "Process:"; + ITEMFLAG_DENSELYPACKED//ITEMFLAG_USEFULLWIDTH + id = EThreadLabelProcessName; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt=""; + }; + }, + DLG_LINE + { + type=EEikCtLabel; + prompt = "Thread:"; + ITEMFLAG_DENSELYPACKED//ITEMFLAG_USEFULLWIDTH + id = EThreadLabelThreadName; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt=""; + }; + }, +#endif + DLG_LINE + { + type=EEikCtCommandButton; + ITEMFLAG_USEFULLWIDTH + id = EThreadGetButtonCtl; + control = CMBUT + { + txt="GET Thread"; + }; + }, + DLG_LINE //create space between buttons + { + type=EEikCtLabel; + id = EThreadLabelThreadName; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt=" "; + }; + } + }; + } + +RESOURCE ARRAY r_thread_dialog_page_priority + { + items = + { + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = EThreadPriorityPrompt; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt=""; + }; + }, + DLG_LINE + { + prompt="Priority"; + type=EEikCtChoiceList; + id=EThreadPriorityButtonCtl; + control=CHOICELIST + { + array_id=r_thread_priority_buttons; + }; + }, + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = EThreadPriorityText; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt=""; + }; + } + }; + } + + +RESOURCE ARRAY r_thread_dialog_page_other + { + items = + { + DLG_LINE + { + type=EEikCtCheckBox; + prompt="System"; + id = EThreadSystemCtl; + }, + DLG_LINE + { + type=EEikCtCheckBox; + prompt="Protected"; + id = EThreadProtectedCtl; + } + }; + } + + + +RESOURCE ARRAY r_thread_priority_buttons + { + items= + { + LBUF { txt="PriorityNull=-30";}, // EThreadPm30_Null + LBUF { txt="PriorityMuchLess=-20";}, // EThreadPm20_MuchLess + LBUF { txt="PriorityLess=-10";}, // EThreadPm10_Less + LBUF { txt="PriorityNormal=0";}, // EThreadP0_Normal + LBUF { txt="PriorityMore=10"; }, // EThreadP10_More + LBUF { txt="PriorityMuchMore=20"; }, // EThreadP20_MuchMore + LBUF { txt="PriorityRealTime=30"; }, // EThreadP30_RealTime + LBUF { txt="PriorityAbsoluteVeryLow=100";}, // EThreadP100_AbsoluteVeryLow + LBUF { txt="PriorityAbsoluteLow=200";}, // EThreadP200_AbsoluteLow + LBUF { txt="PriorityAbsoluteBackground=300";}, // EThreadP300_AbsoluteBackground + LBUF { txt="PriorityAbsoluteForeground=400";}, // EThreadP400_AbsoluteForeground + LBUF { txt="PriorityAbsoluteHigh=500";}, // EThreadP500_AbsoluteHigh + LBUF { txt = "Not Standard";} // EThreadP_NotStandard + }; + } +// +// Process Dialog +// + +RESOURCE DIALOG r_process_number_dialog + { + title = "Process Tool"; + buttons = r_process_dialog_buttons; + flags = EEikDialogFlagWait; + pages = r_process_dialog_pages; + } + +RESOURCE DLG_BUTTONS r_process_dialog_buttons + { + buttons= + { + DLG_BUTTON + { + id=EProcessKillButtonCtl; + button=CMBUT { txt="Kill";}; + hotkey = 'K'; + }, + DLG_BUTTON + { + id=EProcessSetButtonCtl; + button=CMBUT { txt="Set";}; + hotkey = 'S'; + }, + DLG_BUTTON + { + id=EEikBidCancel; + button=CMBUT { txt="Cancel";}; + hotkey = 'C'; + }, + DLG_BUTTON + { + id=EEikBidOk; + button=CMBUT { txt="Done";}; + hotkey = 'D'; + } + }; + } + +RESOURCE ARRAY r_process_dialog_pages + { + items = + { + PAGE + { + text = "Process"; + id = EProcessPageGeneral; + lines = r_process_dialog_page_general; + }, + PAGE + { + text = "Priority"; + id = EProcessPagePriority; + lines = r_process_dialog_page_priority; + }, + PAGE + { + text = "Other"; + id = EProcessPageOther; + lines = r_process_dialog_page_other; + } + }; + } + + +RESOURCE ARRAY r_process_dialog_page_general + { + items = + { + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH//itemflags=EEikDlgItemCtlSharesWidth;? + id = EProcessLabelTop; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Enter process id number and hit 'Get Process' to find and \nchange process attributes"; + }; + }, + DLG_LINE + { + type = EXIKCTNUMBEREDITOR; + prompt = "Process Number"; + id = EProcessNumberCtl; + control = A_NUMBER_EDITOR + { + min = 0; + max = 1023; + }; + //itemflags = EEikDlgItemNoBorder | EEikDlgItemNonFocusing; + ITEMFLAG_NONFOCUSING + }, + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_DENSELYPACKED + prompt = "Process: "; + id = EProcessLabelProcessName; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt=""; + }; + }, + DLG_LINE + { + type=EEikCtCommandButton; + ITEMFLAG_USEFULLWIDTH + id = EProcessGetButtonCtl; + control = CMBUT + { + txt="Get Process"; + }; + } + }; + } + +RESOURCE ARRAY r_process_dialog_page_priority + { + items = + { + DLG_LINE + { + prompt="Priority"; + type=EEikCtChoiceList; + id=EProcessPriorityButtonCtl; + control=CHOICELIST + { + array_id=r_process_priority_buttons; + }; + }, + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + //prompt = "Priority"; + id = EProcessPriorityText; + control = LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt=""; + }; + } + }; + } + +RESOURCE ARRAY r_process_dialog_page_other + { + items = + { + DLG_LINE + { + type=EEikCtCheckBox; + prompt="System"; + id = EProcessSystemCtl; + }, + DLG_LINE + { + type=EEikCtCheckBox; + prompt="Protected"; + id = EProcessProtectedCtl; + } + }; + } + +RESOURCE ARRAY r_process_priority_buttons + { + items= + { + LBUF { txt="EPriorityLow=150"; }, // EProcessP150_PriorityLow + LBUF { txt="EPriorityBackground=250"; }, // EProcessP250_PriorityBackground + LBUF { txt="EPriorityForeground=350"; }, // EProcessP350_PriorityForeground + LBUF { txt="EPriorityHigh=450";}, // EProcessP450_PriorityHigh + LBUF { txt="EPriorityWindowServer=650";}, // EProcessP650_PriorityWindowServer + LBUF { txt="EPriorityFileServer=750";}, // EProcessP750_PriorityFileServer + LBUF { txt="EPriorityRealTimeServer=850";}, // EProcessP850_PriorityRealTimeServer + LBUF { txt="EPrioritySupervisor=950";}, // EProcessP950_PrioritySupervisor + LBUF { txt ="PriorityNotStandard"; } // EProcessPriorityNotStandard + }; + } +// +// Ram Dialog +// + +RESOURCE DIALOG r_ram_dialog + { + title = "RAM Tool"; + buttons = r_ram_dialog_buttons; + flags = EEikDialogFlagWait; + items = + { + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = ERamLabel1; + control=LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Fill the RAM by tapping OK. This will use RAM up to the amount specified"; + }; + }, + DLG_LINE + { + prompt="Leave RAM"; + type=EXIKCTOPTIONBUTLIST; + id=ERamToLeaveButtonCtl; + control=OPBUTLIST + { + array_id=r_ram_to_leave_buttons; + }; + }, + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = ERamTotal; + control=LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Total"; + }; + }, + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = ERamFree; + control=LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Free"; + }; + }, + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH + id = ERamLabel2; + control=LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="To relinquish RAM kill this thread with the thread tool"; + }; + } + }; + } + +RESOURCE DLG_BUTTONS r_ram_dialog_buttons + { + buttons= + { + DLG_BUTTON + { + id=ERamSetButtonCtl; + button=CMBUT { txt="Fill";}; + hotkey = 'F'; + }, + DLG_BUTTON + { + id=ERamUndoFillButtonCtl; + button=CMBUT { txt="Undo Fill(s)";}; + hotkey = 'U'; + }, + DLG_BUTTON + { + id=EEikBidCancel; + button=CMBUT { txt="Close";}; + hotkey = 'C'; + } + }; + } + +RESOURCE ARRAY r_ram_to_leave_buttons + { + items= + { + OPBUT { id = ERamLeave4K; text="<4K"; }, + OPBUT { id = ERamLeave8K; text="<8K"; }, + OPBUT { id = ERamLeave16K; text="<16K"; }, + OPBUT { id = ERamLeave64K; text="<64K"; }, + OPBUT { id = ERamLeave256K; text="<256K"; } + }; + } + +// +// Drive Dialog +// + +RESOURCE DIALOG r_drive_dialog + { + title = "Drive Tool"; + buttons = r_drive_dialog_buttons; + flags = EEikDialogFlagWait; + items = + { + DLG_LINE + { + type=EEikCtLabel; + ITEMFLAG_USEFULLWIDTH //EEikDlgItemCtlGetsWidthFirst + id = ERamLabel1; + control=LABEL + { + horiz_align=EEikLabelAlignHLeft; + txt="Pick a drive. Fill the drive by tapping Fill. This will use space up to the \namount specified. This can be undone by tapping Undo Fill"; + }; + + }, + DLG_LINE + { + prompt="Drive"; + type=EEikCtChoiceList; + id=EDriveChoiceList; + control=CHOICELIST + { + + }; + }, + DLG_LINE + { + prompt="Leave space"; + type=EXIKCTOPTIONBUTLIST;//EQikCtVertOptionButtonList; + id=EDriveToLeaveButtonCtl; + control=OPBUTLIST + { + array_id=r_drive_to_leave_buttons; + }; + } + }; + } + +RESOURCE DLG_BUTTONS r_drive_dialog_buttons + { + buttons= + { + DLG_BUTTON + { + id=EDriveFormatButtonCtl; + button=CMBUT { txt="Format";}; + hotkey = 'T'; + }, + DLG_BUTTON + { + id=EDriveFillButtonCtl; + button=CMBUT { txt="Fill";}; + hotkey = 'F'; + }, + DLG_BUTTON + { + id=EDriveUndoFillButtonCtl; + button=CMBUT { txt="Undo Fill(s)";}; + hotkey = 'U'; + }, + DLG_BUTTON + { + id=EEikBidCancel; + button=CMBUT { txt="Close";}; + hotkey = 'C'; + } + }; + } + +RESOURCE ARRAY r_drive_to_leave_buttons + { + items= + { + OPBUT { id = EDriveLeave4K; text="<4K"; }, + OPBUT { id = EDriveLeave8K; text="<8K"; }, + OPBUT { id = EDriveLeave16K; text="<16K"; }, + OPBUT { id = EDriveLeave64K; text="<64K"; }, + OPBUT { id = EDriveLeave256K; text="<256K"; } + }; + } diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/rsc/ResourceHandler_loc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/rsc/ResourceHandler_loc.rss Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ResourceHandler_loc.rss -- ResourceHandler localised resource file +// System Headers +// +// + +#include + +/******************************************************************************** + * + * Local Headers + * + *******************************************************************************/ + +/******************************************************************************** + * + * Resources + * + *******************************************************************************/ +RESOURCE LOCALISABLE_APP_INFO + { + short_caption = "ResHan"; + caption_and_icon = + { + CAPTION_AND_ICON_INFO + { + caption = "ResourceHandler"; + } + }; + } diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/rsc/ResourceHandler_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/rsc/ResourceHandler_reg.rss Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,43 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ResourceHandler_reg.rss -- ResourceHandler application registration file +// System Headers +// +// + +#include + +/******************************************************************************** + * + * Local Headers + * + *******************************************************************************/ + +/******************************************************************************** + * + * Resources + * + *******************************************************************************/ +UID2 KUidAppRegistrationResourceFile + +UID3 0x101FD147 + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "ResourceHandler"; + localisable_resource_file = "\\resource\\apps\\ResourceHandler_loc"; + hidden = KAppNotHidden; + embeddability = KAppNotEmbeddable; + newfile = KAppDoesNotSupportNewFile; + } diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/rsc/ResourceHandleraif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/rsc/ResourceHandleraif.rss Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ResourceHandler -- Application Information Resource file +// System Includes +// +// + +#include + +/******************************************************************************** + * + * Application Information + * + *******************************************************************************/ +RESOURCE AIF_DATA +{ + app_uid = 0x101FD147; + + caption_list= + { + CAPTION { code = ELangEnglish; caption = "ResourceHandler"; } + }; + + embeddability = KAppNotEmbeddable; + hidden = KAppNotHidden ; + newfile = KAppDoesNotSupportNewFile; +} diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/src/ResourceHandler_AppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/src/ResourceHandler_AppUi.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,184 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "ResourceHandler.h" + +void CResourceAppUi::ConstructL() + { + BaseConstructL(); + iListBoxView = CResourceView::NewL(ClientRect(), this); + //construct a default view + HandleCommandL(EResourceMenu1Item0); + } + +CResourceAppUi::~CResourceAppUi() + { + delete iListBoxView; + } + +void CResourceAppUi::HandleCommandL(TInt aCommand) + { + // Increase this threads priority for a proper snapshot + RThread thisThread; + thisThread.SetPriority(EPriorityAbsoluteHigh); + thisThread.Close(); + + TObjectsViewed aObjectViewed = EObjectNone; + + switch (aCommand) + { + + // Menu 1 + + case EResourceMenu1Item0: + aObjectViewed = EObjectProcess; + break; + + case EResourceMenu1Item1: + aObjectViewed = EObjectThread; + break; + + case EResourceMenu1Item2: + aObjectViewed = EObjectChunk; + break; + + case EResourceMenu1Item3: + aObjectViewed = EObjectLibrary; + break; + + case EResourceMenu1Item4: + aObjectViewed = EObjectServer; + break; + + case EResourceMenu1Item5: + aObjectViewed = EObjectSemaphore; + break; + + case EResourceMenu1Item6: + aObjectViewed = EObjectMutex; + break; + + case EResourceMenu1Item7: + aObjectViewed = EObjectLogicalDevice; + break; + + case EResourceMenu1Item8: + aObjectViewed = EObjectPhysicalDevice; + break; + + case EResourceMenu1Item9: + aObjectViewed = EObjectLogicalChannel; + break; + + // Menu 2 + + case EResourceMenu2Item0: + aObjectViewed = EObjectWindow; + break; + + case EResourceMenu2Item1: + aObjectViewed = EObjectDrive; + break; + + case EResourceMenu2Item2: + aObjectViewed = EObjectHal; + break; + + // Menu 3 + case EResourceMenu3Item0: + SetDebug(); + break; + case EResourceMenu3Item1: + SetThread(); + break; + case EResourceMenu3Item2: + SetProcess(); + break; + case EResourceMenu3Item3: + SetRam(); + break; + case EResourceMenu3Item4: + SetDrive(); + break; + case EEikCmdExit: // necessary for uninstalling + Exit(); + break; + default: + break; + } + + // Set view data + if (aObjectViewed != EObjectNone) + { + iListBoxView->SetCurrentObjects(aObjectViewed); + iListBoxView->UpdateView(); + } + + // ResetPriority + RThread thisThread2; + thisThread2.SetPriority(EPriorityNormal); + thisThread2.Close(); + + } + +void CResourceAppUi::SetProcess() + { + CProcessNumberDialog* dialog = new(ELeave) CProcessNumberDialog(); + + dialog->ExecuteLD(R_PROCESS_NUMBER_DIALOG); + + } + +void CResourceAppUi::SetThread() + { + CThreadNumberDialog* dialog = new(ELeave) CThreadNumberDialog(); + + dialog->ExecuteLD(R_THREAD_DIALOG); + + } + +void CResourceAppUi::SetDebug() + { + CDebugDialog* dialog = new(ELeave) CDebugDialog(); + + dialog->ExecuteLD(R_DEBUG_DIALOG); + + } + +void CResourceAppUi::SetRam() + { + CRamDialog* dialog = new(ELeave) CRamDialog(); + + dialog->ExecuteLD(R_RAM_DIALOG); + + } + +void CResourceAppUi::SetDrive() + { + CDriveDialog* dialog = new(ELeave) CDriveDialog(); + + dialog->ExecuteLD(R_DRIVE_DIALOG); + + } + +void CResourceAppUi::AppendDesc(TDes& root, TDes& add) + { + add.Trim(); + root.Append(add); + root.Append(_L(", ")); + } + + diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/src/ResourceHandler_Application.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/src/ResourceHandler_Application.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "ResourceHandler.h" + + +TUid CResourceApplication::AppDllUid() const + { + TUid KUidResourceHandler = { 0x101FD147 }; + return KUidResourceHandler; + } + +CApaDocument* CResourceApplication::CreateDocumentL() + { + return new (ELeave) CResourceDocument(*this); + } + diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/src/ResourceHandler_Dialogs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/src/ResourceHandler_Dialogs.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,1325 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +#include "ResourceHandler.h" + +// +// Thread Dialog +// + +CThreadNumberDialog::CThreadNumberDialog() + { + } + +void CThreadNumberDialog::PreLayoutDynInitL() + { + // to start use the thread ID of this thread + iThreadID = RThread().Id(); + UpdateDialogData(); + } + +void CThreadNumberDialog::PostLayoutDynInitL() + { + + } + +void CThreadNumberDialog::UpdateDialogData() + { + if (iThreadID > 0) UpdateDialogDataReal(); // Real thread + else UpdateDialogDataAll(); // 0 for all unprotected threads + } + +void CThreadNumberDialog::UpdateDialogDataAll() +//update dialog - set for all threads + { + // match controls and set values + CXIKNUMBEREDITOR *thisNumberEditor; + thisNumberEditor = STATIC_CAST(CXIKNUMBEREDITOR*, Control(EThreadNumberCtl)); + thisNumberEditor->SETNUMBERVALUEL(0); + + CEikCheckBox *sysCheckBox, *protCheckBox; + sysCheckBox = STATIC_CAST(CEikCheckBox*,Control(EThreadSystemCtl)); + protCheckBox = STATIC_CAST(CEikCheckBox*,Control(EThreadProtectedCtl)); + + CEikCommandButton *killBut, *okBut, *setBut; + killBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EThreadKillButtonCtl)); + okBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EEikBidOk)); + setBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EThreadSetButtonCtl)); + CEikLabel *priorityDialogPrompt, *priorityNumberLabel; + priorityNumberLabel = STATIC_CAST(CEikLabel*, Control(EThreadPriorityText)); + priorityDialogPrompt = STATIC_CAST(CEikLabel*, Control(EThreadPriorityPrompt)); + + priorityDialogPrompt->SetTextL(_L("Cannot set priority for all threads.")); + +#ifdef UIQ + CEikLabel *theThreadLabel, *theProcessLabel; + theThreadLabel = STATIC_CAST(CEikLabel*, Control(EThreadLabelThreadName)); + theProcessLabel = STATIC_CAST(CEikLabel*, Control(EThreadLabelProcessName)); + theProcessLabel->SetTextL(_L("Various")); + theThreadLabel->SetTextL(_L("All unprotected")); +#endif +#ifdef TV + CEikLabel *threadAndProcessLabel; + threadAndProcessLabel = STATIC_CAST(CEikLabel*, Control(EThreadLabelThreadAndProcessName)); + threadAndProcessLabel->SetTextL(_L("All threads/processes")); +#endif + CEikChoiceList *prioritySelector; + prioritySelector = STATIC_CAST(CEikChoiceList*, Control(EThreadPriorityButtonCtl)); + + + // Change the dimming on the component controls as appropriate for all threads + protCheckBox->SetDimmed(ETrue); + sysCheckBox->SetDimmed(EFalse); + + prioritySelector->MakeVisible(EFalse); + + priorityNumberLabel->MakeVisible(EFalse); + + killBut->SetDimmed(ETrue); + okBut->SetDimmed(EFalse); + setBut->SetDimmed(EFalse); + DrawNow(); + + } + +//updates dialog depending on iThreadID +void CThreadNumberDialog::UpdateDialogDataReal() + { + // match controls + CXIKNUMBEREDITOR *thisNumberEditor; + thisNumberEditor = STATIC_CAST(CXIKNUMBEREDITOR*, Control(EThreadNumberCtl)); + thisNumberEditor->SETNUMBERVALUEL(0); + + CEikCheckBox *sysCheckBox, *protCheckBox; + sysCheckBox = STATIC_CAST(CEikCheckBox*,Control(EThreadSystemCtl)); + protCheckBox = STATIC_CAST(CEikCheckBox*,Control(EThreadProtectedCtl)); + + CEikCommandButton *killBut, *okBut, *setBut; + okBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EEikBidOk)); + setBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EThreadSetButtonCtl)); + killBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EThreadKillButtonCtl)); + +#ifdef UIQ + CEikLabel *theThreadLabel, *theProcessLabel; + theThreadLabel = STATIC_CAST(CEikLabel*, Control(EThreadLabelThreadName)); + theProcessLabel = STATIC_CAST(CEikLabel*, Control(EThreadLabelProcessName)); +#endif +#ifdef TV + CEikLabel *threadAndProcessLabel; + threadAndProcessLabel = STATIC_CAST(CEikLabel*, Control(EThreadLabelThreadAndProcessName)); +#endif + + CEikChoiceList *priorityOpButs; + priorityOpButs = STATIC_CAST(CEikChoiceList*, Control(EThreadPriorityButtonCtl)); + + // + //Update dialog info with thread details + // + + RThread thread; + TInt err = KErrNone; + + err = thread.Open(iThreadID); + + if (err!=KErrNone) + { + thread.Close(); + TBuf<70> errorMessage(_L("Cannot get thread number ")); + errorMessage.AppendNum(iThreadID); + errorMessage.Append(_L(". Thread::Open()")); + DisplayError(errorMessage, err); + thread.Open(RThread().Id()); // Get this thread + } + + thisNumberEditor->SETNUMBERVALUEL(thread.Id()); + +#ifdef UIQ + theThreadLabel->SetTextL(thread.Name()); +#endif +#ifdef TV + TBuf<150> lProcessAndThread(thread.Name()); +#endif + + RProcess process; + thread.Process(process); +#ifdef UIQ + theProcessLabel->SetTextL(process.Name()); +#endif +#ifdef TV + lProcessAndThread.Append(_L("/")); + lProcessAndThread.Append(process.Name()); + threadAndProcessLabel->SetTextL(lProcessAndThread); +#endif + process.Close(); + + CEikLabel *priorityDialogPrompt, *priorityNumberLabel; + + priorityDialogPrompt = STATIC_CAST(CEikLabel*, Control(EThreadPriorityPrompt)); + if ( iThreadID == RThread().Id()) priorityDialogPrompt->SetTextL(_L("The priority of the current thread cannot be reset from within this application.")); + else priorityDialogPrompt->SetTextL(_L("Set the priority.")); + + priorityNumberLabel = STATIC_CAST(CEikLabel*, Control(EThreadPriorityText)); + TBuf<30> priorityText(_L("Priority Value: ")); + TBuf<4> priorityNumber; + + priorityNumber.Format(KFormatDec,thread.Priority()); + priorityText.Append(priorityNumber); + priorityNumberLabel->SetTextL(priorityText); + + TThreadPriority lThreadPriority = thread.Priority(); + TInt lThreadPrioritySetting; + switch (lThreadPriority) + { + case(EPriorityAbsoluteHigh): lThreadPrioritySetting = EThreadP500_AbsoluteHigh; break; + case(EPriorityAbsoluteForeground): lThreadPrioritySetting = EThreadP400_AbsoluteForeground; break; + case(EPriorityAbsoluteBackground): lThreadPrioritySetting = EThreadP300_AbsoluteBackground; break; + case(EPriorityAbsoluteLow): lThreadPrioritySetting = EThreadP200_AbsoluteLow; break; + case(EPriorityAbsoluteVeryLow): lThreadPrioritySetting = EThreadP100_AbsoluteVeryLow; break; + case(EPriorityRealTime): lThreadPrioritySetting = EThreadP30_RealTime; break; + case(EPriorityMuchMore): lThreadPrioritySetting = EThreadP20_MuchMore; break; + case(EPriorityMore): lThreadPrioritySetting = EThreadP10_More; break; + case(EPriorityNormal): lThreadPrioritySetting = EThreadP0_Normal; break; + case(EPriorityLess): lThreadPrioritySetting = EThreadPm10_Less; break; + case(EPriorityMuchLess): lThreadPrioritySetting = EThreadPm20_MuchLess; break; + case(EPriorityNull): lThreadPrioritySetting = EThreadPm30_Null; break; + default: lThreadPrioritySetting = EThreadP_NotStandard; break; + } + + priorityOpButs->SetCurrentItem(lThreadPrioritySetting); + + sysCheckBox->SetState(CEikButtonBase::EIndeterminate); + protCheckBox->SetState(CEikButtonBase::EIndeterminate); + + // Change the dimming on the component controls depending on the thread + sysCheckBox->SetDimmed(EFalse); + + if ( iThreadID == RThread().Id()) priorityOpButs->SetDimmed(ETrue); + else priorityOpButs->SetDimmed(EFalse); + + killBut->SetDimmed(EFalse); + okBut->SetDimmed(EFalse); + setBut->SetDimmed(EFalse); + + if (iThreadID == RThread().Id()) + { + // can change the protection on this thread + protCheckBox->SetDimmed(EFalse); + } + else + { + // cannot change protection + protCheckBox->SetDimmed(ETrue); + if (true) // If we are in secure then we ensure that the + // user can not change anything. + { + // cannot change anything + sysCheckBox->SetDimmed(ETrue); + priorityOpButs->SetDimmed(ETrue); + killBut->SetDimmed(ETrue); + okBut->SetDimmed(ETrue); + setBut->SetDimmed(ETrue); + } + + } + + thread.Close(); + DrawNow(); + + } + +void CThreadNumberDialog::UpdatePriorityText() +//updates the priority number value to correspond to the priority option selected + { + + } + +void CThreadNumberDialog::HandleControlStateChangeL(TInt aControlId) + { + if (aControlId == EThreadGetButtonCtl) + { + CXIKNUMBEREDITOR *thisNumberEditor; + thisNumberEditor = STATIC_CAST(CXIKNUMBEREDITOR*, Control(EThreadNumberCtl)); + iThreadID = (TThreadId)thisNumberEditor->NUMBERVALUE(); + // re-evaluate everything + UpdateDialogData(); + + // re-draw + PageChangedL(EThreadPageGeneral); + PageChangedL(EThreadPagePriority); + PageChangedL(EThreadPageOther); + DrawNow(); + } + } + +void CThreadNumberDialog::SetThread() + { + //change thread parameters + if (iThreadID > 0) + { + // only get here if thread is not protected + + + RThread thread; + TInt err = thread.Open(iThreadID); + + if (err == KErrNone) + { + // This is the current thread + if ( iThreadID == RThread().Id()) + { + } + + + + CEikChoiceList *opButs; + opButs = STATIC_CAST(CEikChoiceList*, Control(EThreadPriorityButtonCtl)); + + TThreadPriority threadPrioritySet = EPriorityNull; + TInt currentItem = opButs->CurrentItem(); + + switch (currentItem) + { + case (EThreadP500_AbsoluteHigh): threadPrioritySet=EPriorityAbsoluteHigh; break; + case (EThreadP400_AbsoluteForeground): threadPrioritySet=EPriorityAbsoluteForeground; break; + case (EThreadP300_AbsoluteBackground): threadPrioritySet=EPriorityAbsoluteBackground; break; + case (EThreadP200_AbsoluteLow): threadPrioritySet=EPriorityAbsoluteLow; break; + case (EThreadP100_AbsoluteVeryLow): threadPrioritySet=EPriorityAbsoluteVeryLow; break; + case (EThreadP30_RealTime): threadPrioritySet=EPriorityRealTime; break; + case (EThreadP20_MuchMore): threadPrioritySet=EPriorityMuchMore; break; + case (EThreadP10_More): threadPrioritySet=EPriorityMore; break; + case (EThreadP0_Normal): threadPrioritySet=EPriorityNormal; break; + case (EThreadPm10_Less): threadPrioritySet=EPriorityLess; break; + case (EThreadPm20_MuchLess): threadPrioritySet=EPriorityMuchLess; break; + case (EThreadPm30_Null): threadPrioritySet=EPriorityNull; + iEikonEnv->InfoWinL(_L("Error"), _L("Cannot change thread priority to Null")); + break; + default: iEikonEnv->InfoWinL(_L("Error"), _L("Invalid priority: cannot change thread priority to Not Standard")); + + }; + + if (threadPrioritySet != EPriorityNull) + { + thread.SetPriority(threadPrioritySet); + + TThreadPriority threadPriorityGot = thread.Priority(); + if (threadPrioritySet!=threadPriorityGot) + { + iEikonEnv->InfoWinL(_L("Error"), _L("Thread priority not set: RThread::SetPriority() unsuccessful!")); + } + thread.Close(); + } + } + } + else //all threads selected - only changes system setting + { + + TName prefix(KAsterisk); + TFindThread findHb; + findHb.Find(prefix); + TFullName name; // this is a TBuf + RThread thread; + + while (findHb.Next(name)==KErrNone) + { + TInt err = thread.Open(name); + if (err != KErrNone) + { + TBuf<70> errorMessage(_L("Cannot get thread ")); + errorMessage.Append(name); + errorMessage.Append(_L(". RThread::Open()")); + DisplayError(errorMessage, err); + } + + if (err == KErrNone) + { + + + thread.Close(); + } + } + } + } + +TBool CThreadNumberDialog::OkToExitL(TInt aButtonId) + { + if (aButtonId == EEikBidCancel) + { + return ETrue; + } + else if (aButtonId == EThreadSetButtonCtl) + { + SetThread(); + UpdateDialogData(); + iEikonEnv->InfoMsg(_L("Attribute(s) set as displayed")); + return EFalse; + } + else if (aButtonId == EEikBidOk) + { + SetThread(); + return ETrue; + } + else if (aButtonId == EThreadKillButtonCtl) + { + RThread thread; + TInt err = thread.Open(iThreadID); + if (err == KErrNone) + { + thread.Kill(KErrNone); + iEikonEnv->InfoMsg(_L("Thread Killed")); + } + else iEikonEnv->InfoWinL(_L("Error"), _L("Attempt to open thread for modification unsuccessful.")); + thread.Close(); + return EFalse; + } + return ETrue; + } + +// +// +// Process Dialog +// +// + +CProcessNumberDialog::CProcessNumberDialog() + { + } + +void CProcessNumberDialog::PreLayoutDynInitL() + { + // to start use the thread ID of this Process + iProcessID = RProcess().Id(); + UpdateDialogData(); + } + +void CProcessNumberDialog::PostLayoutDynInitL() + { + } + +void CProcessNumberDialog::UpdateDialogData() +//Updates GUI data + { + // match the controls + CXIKNUMBEREDITOR *thisNumberEditor; + thisNumberEditor = STATIC_CAST(CXIKNUMBEREDITOR*, Control(EProcessNumberCtl)); + CEikLabel *priorityTextLabel; + priorityTextLabel = STATIC_CAST(CEikLabel*, Control(EProcessPriorityText)); + + CEikCheckBox *sysCheckBox, *protCheckBox; + sysCheckBox = STATIC_CAST(CEikCheckBox*,Control(EProcessSystemCtl)); + protCheckBox = STATIC_CAST(CEikCheckBox*,Control(EProcessProtectedCtl)); + + CEikCommandButton *killBut, *okBut, *setBut; + killBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EProcessKillButtonCtl)); + okBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EEikBidOk)); + setBut = STATIC_CAST(CEikCommandButton*, ButtonGroupContainer().CommandButtonOrNull(EProcessSetButtonCtl)); + + CEikLabel *theProcessLabel; + theProcessLabel = STATIC_CAST(CEikLabel*, Control(EProcessLabelProcessName)); + + CEikChoiceList *opButs; + opButs = STATIC_CAST(CEikChoiceList*, Control(EProcessPriorityButtonCtl)); + + //open a process and update GUI data + RProcess process; + TInt err = KErrNone; + + err = process.Open(iProcessID); // Opens a handle to a process + + if (err!=KErrNone) + { + TBuf<70> errorMessage(_L("Cannot get process number ")); + errorMessage.AppendNum(iProcessID); + errorMessage.Append(_L(". System error number ")); + errorMessage.AppendNum(err); + + iEikonEnv->InfoWinL(_L("Error"), errorMessage); + iProcessID = RProcess().Id(); + process.Open(iProcessID); // Opens a handle to this Process + } + + thisNumberEditor->SETNUMBERVALUEL(process.Id()); + theProcessLabel->SetTextL(process.Name()); + + TBuf<30> priorityText(_L("Priority Value: ")); + TBuf<10> priorityNumber; + priorityNumber.Format(KFormatDec,process.Priority()); + priorityText.Append(priorityNumber); + priorityTextLabel->SetTextL(priorityText); + if (process.Priority()==EPriorityLow) opButs->SetCurrentItem(EProcessP150_PriorityLow); + else if (process.Priority()==EPriorityBackground) opButs->SetCurrentItem(EProcessP250_PriorityBackground); + else if (process.Priority()==EPriorityForeground) opButs->SetCurrentItem(EProcessP350_PriorityForeground); + else if (process.Priority()==EPriorityHigh) opButs->SetCurrentItem(EProcessP450_PriorityHigh); + else if (process.Priority()==EPriorityWindowServer) opButs->SetCurrentItem(EProcessP650_PriorityWindowServer); + else if (process.Priority()==EPriorityFileServer) opButs->SetCurrentItem(EProcessP750_PriorityFileServer); + else if (process.Priority()==EPriorityRealTimeServer) opButs->SetCurrentItem(EProcessP850_PriorityRealTimeServer); + else if (process.Priority()==EPrioritySupervisor) opButs->SetCurrentItem(EProcessP950_PrioritySupervisor); + else (opButs->SetCurrentItem(EProcessPriorityNotStandard)); + + + sysCheckBox->SetState(CEikButtonBase::EIndeterminate); + protCheckBox->SetState(CEikButtonBase::EIndeterminate); + + + // Change the dimming on the component controls depending on the Process + sysCheckBox->SetDimmed(EFalse); + opButs->SetDimmed(EFalse); + #ifdef WINS + opButs->SetDimmed(ETrue); + #endif + + killBut->SetDimmed(EFalse); + okBut->SetDimmed(EFalse); + setBut->SetDimmed(EFalse); + if (iProcessID == RProcess().Id()) + { + // can change the protection on this Process + protCheckBox->SetDimmed(EFalse); + } + else + { + // cannot change protection + protCheckBox->SetDimmed(ETrue); + if (true) // If we are in secure then we ensure that the + // user can not change anything. + { + // cannot change anything + sysCheckBox->SetDimmed(ETrue); + opButs->SetDimmed(ETrue); + killBut->SetDimmed(ETrue); + okBut->SetDimmed(ETrue); + setBut->SetDimmed(ETrue); + } + } + process.Close(); // Closes the handle + DrawNow(); + + } + +void CProcessNumberDialog::SetProcess() +{ + // only get here if Process is not protected + + + RProcess process; + TInt err = process.Open(iProcessID); + + if (err == KErrNone) + { + // This is the current Process + if ( iProcessID == RProcess().Id()) + { + } + + + + CEikChoiceList *opButs; + TProcessPriority processPrioritySelected = EPriorityLow; + + opButs = STATIC_CAST(CEikChoiceList*, Control(EProcessPriorityButtonCtl)); + + TInt currentItem = opButs->CurrentItem(); + TBool validPrioritySelected = ETrue; + + switch (currentItem) + { + case (EProcessP150_PriorityLow): processPrioritySelected=EPriorityLow; break; + case (EProcessP250_PriorityBackground): processPrioritySelected=EPriorityBackground; break; + case (EProcessP350_PriorityForeground): processPrioritySelected=EPriorityForeground; break; + case (EProcessP450_PriorityHigh): processPrioritySelected=EPriorityHigh; break; + case (EProcessP650_PriorityWindowServer): + case (EProcessP750_PriorityFileServer): + case (EProcessP850_PriorityRealTimeServer): + case (EProcessP950_PrioritySupervisor): + default: iEikonEnv->InfoWinL(_L("Error"), _L("This is an internal priority and cannot be explicitly set")); + validPrioritySelected = EFalse; + break; + } + if (validPrioritySelected == 1) process.SetPriority(processPrioritySelected); + + } + process.Close(); + } + +void CProcessNumberDialog::HandleControlStateChangeL(TInt aControlId) + { + if (aControlId == EProcessGetButtonCtl) + { + CXIKNUMBEREDITOR *thisNumberEditor; + thisNumberEditor = STATIC_CAST(CXIKNUMBEREDITOR*, Control(EProcessNumberCtl)); + iProcessID = (TProcessId)thisNumberEditor->NUMBERVALUE(); + // re-evaluate everything + UpdateDialogData(); + + // re-draw + PageChangedL(EProcessPageGeneral); + PageChangedL(EProcessPagePriority); + PageChangedL(EProcessPageOther); + DrawNow(); + } + } + +TBool CProcessNumberDialog::OkToExitL(TInt aButtonId) + { + if (aButtonId == EEikBidCancel) // do nothing + { + return ETrue; + } + else if (aButtonId == EProcessSetButtonCtl) + { + SetProcess(); + UpdateDialogData(); + iEikonEnv->InfoMsg(_L("Attribute(s) set as displayed")); + return EFalse; + } + else if (aButtonId == EProcessKillButtonCtl) + { + RProcess Process; + TInt err = Process.Open(iProcessID); + if (err == KErrNone) + { + iEikonEnv->InfoMsg(_L("Killing Process")); + Process.Kill(KErrNone); + } + Process.Close(); + iEikonEnv->InfoMsg(_L("Process killed")); + return EFalse; + } + + else if (aButtonId == EEikBidOk) + { + SetProcess(); + return ETrue; + } + else return ETrue; + } + + +// +// +// Debug Dialog +// +// + +CDebugDialog::CDebugDialog() + { + } + +void CDebugDialog::PreLayoutDynInitL() + { + GetPortNumber(); + GetKernelOptions(); + } + +void CDebugDialog::GetPortNumber() + { + //map the control + CXIKNUMBEREDITOR *thisNumberEditor; + thisNumberEditor = static_cast(Control(EDebugPortCtl)); + //set control value + TInt debugPort, err; + err = HAL::Get(HAL::EDebugPort, debugPort); + if (err == KErrNone) + { + thisNumberEditor->SETNUMBERVALUEL(debugPort); + iCurrentDebugPort = debugPort; + } + else + { + thisNumberEditor->SETNUMBERVALUEL(-1); + iCurrentDebugPort = -1; + } + + } + +void CDebugDialog::GetKernelOptions() + { + // Kernel debug mask + + TUint32 debugMask = UserSvr::DebugMask(); + //map the controls (check boxes) and set the control values + + CEikCheckBox *aCheckBox; + + aCheckBox = static_cast(Control(EDebugKernelKHARDWARE)); + aCheckBox->SetState(debugMask & KHARDWARE ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKBOOT)); + aCheckBox->SetState(debugMask & KBOOT ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKSERVER)); + aCheckBox->SetState(debugMask & KSERVER ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKMMU)); + aCheckBox->SetState(debugMask & KMMU ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKSEMAPHORE)); + aCheckBox->SetState(debugMask & KSEMAPHORE ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKSCHED)); + aCheckBox->SetState(debugMask & KSCHED ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKPROC)); + aCheckBox->SetState(debugMask & KPROC ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKEXEC)); + aCheckBox->SetState(debugMask & KEXEC ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKEXECFAST)); + aCheckBox->SetState(debugMask & KEXECFAST ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKTHREAD)); + aCheckBox->SetState(debugMask & KTHREAD ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKDLL)); + aCheckBox->SetState(debugMask & KDLL ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKLOGON)); + aCheckBox->SetState(debugMask & KLOGON ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKPBUS1)); + aCheckBox->SetState(debugMask & KPBUS1 ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKPBUS2)); + aCheckBox->SetState(debugMask & KPBUS2 ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKPBUSDRV)); + aCheckBox->SetState(debugMask & KPBUSDRV ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKPOWER)); + aCheckBox->SetState(debugMask & KPOWER ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKTIMING)); + aCheckBox->SetState(debugMask & KTIMING ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKEVENT)); + aCheckBox->SetState(debugMask & KEVENT ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKMEMTRACE)); + aCheckBox->SetState(debugMask & KMEMTRACE ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKIPC)); + aCheckBox->SetState(debugMask & KIPC ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKDEBUGGER)); + aCheckBox->SetState(debugMask & KDEBUGGER ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKVIDEO)); + aCheckBox->SetState(debugMask & KVIDEO ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKUSB)); + aCheckBox->SetState(debugMask & KUSB ? CEikButtonBase::ESet : CEikButtonBase::EClear); + + aCheckBox = static_cast(Control(EDebugKernelKPANIC)); + aCheckBox->SetState(debugMask & KPANIC ? CEikButtonBase::ESet : CEikButtonBase::EClear); + } + +void CDebugDialog::SetDebugOptions() + { + TBuf<800> errorMssg; //to show where updates unsuccessful + //set new debug port + CXIKNUMBEREDITOR *thisNumberEditor; + thisNumberEditor = static_cast(Control(EDebugPortCtl)); + TInt newDebugPort = thisNumberEditor->NUMBERVALUE(); + + TInt err; + if (newDebugPort!=-1) + { + err = HAL::Set(HAL::EDebugPort, newDebugPort); + if (err==KErrNone) iCurrentDebugPort = newDebugPort; + else + { + TBuf<3> errorCode; + errorCode.Format(KFormatDec,err); + errorMssg.Append(_L("Cannot set port: System error ")); + errorMssg.Append(errorCode); + errorMssg.Append('\n'); + thisNumberEditor->SETNUMBERVALUEL(iCurrentDebugPort); + } + } + //set new Kernel debug values + CEikCheckBox *aCheckBox; + TUint32 debugMask = 0; + aCheckBox = static_cast(Control(EDebugKernelKHARDWARE)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KHARDWARE; + + aCheckBox = static_cast(Control(EDebugKernelKBOOT)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KBOOT; + + aCheckBox = static_cast(Control(EDebugKernelKSERVER)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KSERVER; + + aCheckBox = static_cast(Control(EDebugKernelKMMU)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KMMU; + + aCheckBox = static_cast(Control(EDebugKernelKSEMAPHORE)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KSEMAPHORE; + + aCheckBox = static_cast(Control(EDebugKernelKSCHED)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KSCHED; + + aCheckBox = static_cast(Control(EDebugKernelKPROC)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KPROC; + + aCheckBox = static_cast(Control(EDebugKernelKEXEC)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KEXEC; + + aCheckBox = static_cast(Control(EDebugKernelKEXECFAST)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KEXECFAST; + + aCheckBox = static_cast(Control(EDebugKernelKTHREAD)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KTHREAD; + + aCheckBox = static_cast(Control(EDebugKernelKDLL)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KDLL; + + aCheckBox = static_cast(Control(EDebugKernelKLOGON)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KLOGON; + + aCheckBox = static_cast(Control(EDebugKernelKPBUS1)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KPBUS1; + + aCheckBox = static_cast(Control(EDebugKernelKPBUS2)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KPBUS2; + + aCheckBox = static_cast(Control(EDebugKernelKPBUSDRV)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KPBUSDRV; + + aCheckBox = static_cast(Control(EDebugKernelKPOWER)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KPOWER; + + aCheckBox = static_cast(Control(EDebugKernelKTIMING)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KTIMING; + + aCheckBox = static_cast(Control(EDebugKernelKEVENT)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KEVENT; + + aCheckBox = static_cast(Control(EDebugKernelKMEMTRACE)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KMEMTRACE; + + aCheckBox = static_cast(Control(EDebugKernelKIPC)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KIPC; + + aCheckBox = static_cast(Control(EDebugKernelKDEBUGGER)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KDEBUGGER; + + aCheckBox = static_cast(Control(EDebugKernelKVIDEO)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KVIDEO; + + aCheckBox = static_cast(Control(EDebugKernelKUSB)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KUSB; + + aCheckBox = static_cast(Control(EDebugKernelKPANIC)); + if (aCheckBox->State()==CEikButtonBase::ESet) debugMask|=KPANIC; + + User::SetDebugMask(debugMask); + TUint32 updatedDebugMask = UserSvr::DebugMask(); + if (debugMask != updatedDebugMask) + { + errorMssg.Append(_L("Unable to set kernel options selected. Note that KPanic must be selected if any other options are selected. View the \nupdated dialog to see which Kernel options are set")); + GetKernelOptions(); + } + + + CEikCheckBox *thisCheckBox, *thisCheckBox2, *thisCheckBox3; + thisCheckBox = static_cast(Control(EDebugFileServerCtl)); + thisCheckBox2 = static_cast(Control(EDebugFATCtl)); + thisCheckBox3 = static_cast(Control(EDebugLoaderCtl)); + + TInt fsDebugMask = 0; + if (thisCheckBox->State()==CEikButtonBase::ESet) fsDebugMask|=KFSERV; + if (thisCheckBox2->State()==CEikButtonBase::ESet) fsDebugMask|=KFSYS; + if (thisCheckBox3->State()==CEikButtonBase::ESet) fsDebugMask|=KFLDR; + + RFs aRFs; + err = aRFs.Connect(); + if (err == KErrNone) + { + err = aRFs.SetDebugRegister(fsDebugMask); + if (err != KErrNone) + errorMssg.Append(_L("Unable to set FS options: RFs::SetDebugRegister() fails with System error number ")); + TBuf<3> errorCode; + errorCode.Format(KFormatDec, err); + errorMssg.Append(errorCode); + } + else + { + errorMssg.Append(_L("\nRFs::Connect() fails with System error number ")); + TBuf<3> errorCode; + errorCode.Format(KFormatDec, err); + errorMssg.Append(errorCode); + thisCheckBox->SetState(CEikButtonBase::EClear); + thisCheckBox2->SetState(CEikButtonBase::EClear); + thisCheckBox3->SetState(CEikButtonBase::EClear); + } + aRFs.Close(); + + if (errorMssg.Length() != 0) + { + _LIT(KDialogTitle, "Error"); + iEikonEnv->InfoWinL(KDialogTitle, errorMssg); + } + } + +TBool CDebugDialog::OkToExitL(TInt aButtonId) + { + if (aButtonId == EDebugSetButtonCtl) + { + SetDebugOptions(); + DrawNow(); + return EFalse; + } + if (aButtonId == EEikBidOk) + { + SetDebugOptions(); + } + else if (aButtonId == EEikBidCancel) + { + // Do Nothing + } + return ETrue; + } + +// +// +// Ram Dialog +// +// + +CRamDialog::CRamDialog() + { + noChunks = 0; + } + +void CRamDialog::PreLayoutDynInitL() + { + UpdateDialogData(); + } + +void CRamDialog::UpdateDialogData() + { + CEikLabel *theTotalLabel, *theFreeLabel; + theTotalLabel = STATIC_CAST(CEikLabel*, Control(ERamTotal)); + theFreeLabel = STATIC_CAST(CEikLabel*, Control(ERamFree)); + + TMemoryInfoV1Buf memorybuf; + UserHal::MemoryInfo(memorybuf); + TInt total=memorybuf().iTotalRamInBytes; + TInt free=memorybuf().iFreeRamInBytes; + + TBuf<40> totalTxt; + totalTxt.Format(_L("Total RAM (bytes) %d"),total); + TBuf<40> freeTxt; + freeTxt.Format(_L("Free RAM (bytes) %d"),free); + + theTotalLabel->SetTextL(totalTxt); + theFreeLabel->SetTextL(freeTxt); + + CXIKOPTIONBUTTONLIST *fillSpaceOpButs; + fillSpaceOpButs = STATIC_CAST(CXIKOPTIONBUTTONLIST*, Control(ERamToLeaveButtonCtl)); + + // All buttons invisible + fillSpaceOpButs->ComponentControl(0)->MakeVisible(ETrue); + fillSpaceOpButs->ComponentControl(1)->MakeVisible(ETrue); + fillSpaceOpButs->ComponentControl(2)->MakeVisible(ETrue); + fillSpaceOpButs->ComponentControl(3)->MakeVisible(ETrue); + fillSpaceOpButs->ComponentControl(4)->MakeVisible(ETrue); + + if (freeComponentControl(0)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(1)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(2)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(3)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(4)->MakeVisible(EFalse); + } + else if (free>=K4k && freeComponentControl(1)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(2)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(3)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(4)->MakeVisible(EFalse); + fillSpaceOpButs->SetButtonById(ERamLeave4K); + } + else if (free>=K8k && freeComponentControl(2)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(3)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(4)->MakeVisible(EFalse); + fillSpaceOpButs->SetButtonById(ERamLeave8K); + } + else if (free>=K16k && freeComponentControl(3)->MakeVisible(EFalse); + fillSpaceOpButs->ComponentControl(4)->MakeVisible(EFalse); + fillSpaceOpButs->SetButtonById(ERamLeave16K); + } + else if (free>= K64k && freeComponentControl(4)->MakeVisible(EFalse); + fillSpaceOpButs->SetButtonById(ERamLeave64K); + } + else + { + fillSpaceOpButs->SetButtonById(ERamLeave256K); + } + } + +void CRamDialog::UndoFillRam() + { + if (noChunks == 0) iEikonEnv->InfoMsg(_L("Undo fill invalid")); + else + { + while (noChunks>0) + { + chunks[--noChunks].Close(); + } + } +} +void CRamDialog::FillRam() + { + iEikonEnv->BusyMsgL(_L("Filling RAM")); + + CXIKOPTIONBUTTONLIST *opButs; + opButs = STATIC_CAST(CXIKOPTIONBUTTONLIST*, Control(ERamToLeaveButtonCtl)); + + TUint ramToLeave=K4k; + if (opButs->LabeledButtonId()==ERamLeave4K) ramToLeave=K4k; + else if (opButs->LabeledButtonId()==ERamLeave8K) ramToLeave=K8k; + else if (opButs->LabeledButtonId()==ERamLeave16K) ramToLeave=K16k; + else if (opButs->LabeledButtonId()==ERamLeave64K) ramToLeave=K64k; + else if (opButs->LabeledButtonId()==ERamLeave256K) ramToLeave=K256k; + + + TUint chunkSize; + TInt err = KErrNone; + TBuf<20> aName; + TTime time; + + TMemoryInfoV1Buf memorybuf; + UserHal::MemoryInfo(memorybuf); + + // Fill the RAM up with various chunks + for (chunkSize = K8M; chunkSize>=ramToLeave; chunkSize>>=1) + { + TUint KMaxChunks = 10000; + for (err=KErrNone; err==KErrNone && noChunks(&(time.Int64())))); + + err = chunks[noChunks].CreateGlobal(aName, chunkSize, chunkSize); + // ensure RAM is committed by filling it + if (err==KErrNone) + { + Mem::Fill(chunks[noChunks++].Base(),chunkSize,'A'); + } + User::CompressAllHeaps(); + } ; + } + iEikonEnv->BusyMsgCancel(); + if (err == KErrNone) iEikonEnv->InfoMsg(_L("Fill Complete")); + } + +TBool CRamDialog::OkToExitL(TInt aButtonId) + { + if (aButtonId == EEikBidCancel) + { + return ETrue; + } + else if (aButtonId == ERamSetButtonCtl) + { + FillRam(); + UpdateDialogData(); + DrawNow(); + return EFalse; + } + else if (aButtonId == ERamUndoFillButtonCtl) + { + UndoFillRam(); + UpdateDialogData(); + DrawNow(); + return EFalse; + } + return ETrue; + } + +// +// +// Drive Dialog +// +// + +CDriveDialog::CDriveDialog() : iDriveName(NULL), iDriveLetter(NULL) + { + } + +CDriveDialog::~CDriveDialog() + { + delete iDriveLetter; + delete iDriveName; + } + +void CDriveDialog::PreLayoutDynInitL() + { + iDriveName = new (ELeave) CDesCArrayFlat(KMaxLocalDrives); + iDriveLetter = new CArrayFixFlat(KMaxLocalDrives); + + TBuf<40> string; // displayed in choice box + RFs rfs; + User::LeaveIfError(rfs.Connect()); + TDriveInfo driveInfo; + TVolumeInfo volumeInfo; + TDriveUnit driveUnit(EDriveA); + TInt err1,err2,drive=0,number=0; + + do { + + driveUnit = drive; + err1 = rfs.Volume(volumeInfo,driveUnit); + err2 = rfs.Drive(driveInfo, driveUnit); + if (err1==KErrNone && err2==KErrNone) + { + + // Only interested if not ROM and local + + if (volumeInfo.iDrive.iType != EMediaRom && + (volumeInfo.iDrive.iDriveAtt | KDriveAttLocal)) + { + number++; + + string.Delete(0,string.MaxLength()); + + string=driveUnit.Name(); + + string.Append(_L(" ")); + string.Append(volumeInfo.iName); + + iDriveName->AppendL(string); + iDriveLetter->AppendL(drive); + } + } + + drive++; + + } while (drive <= EDriveZ && number < KMaxLocalDrives); + + rfs.Close(); + + CEikChoiceList *driveChoice; + driveChoice = STATIC_CAST(CEikChoiceList*, Control(EDriveChoiceList)); + driveChoice->SetArrayL(iDriveName); + driveChoice->SetArrayExternalOwnership(ETrue); + + + CXIKOPTIONBUTTONLIST *fillSpaceOpButs; + fillSpaceOpButs = STATIC_CAST(CXIKOPTIONBUTTONLIST*, Control(EDriveToLeaveButtonCtl)); + fillSpaceOpButs->SetButtonById(EDriveLeave256K); + } + + +void UpdateDialogLeaveSpace() + { + } + +TBool CDriveDialog::OkToExitL(TInt aButtonId) + { + if (aButtonId == EEikBidCancel) + { + delete iDriveName; + delete iDriveLetter; + return ETrue; + } + else + { + CEikChoiceList *driveChoice; + driveChoice = STATIC_CAST(CEikChoiceList*, Control(EDriveChoiceList)); + TInt choice = driveChoice->CurrentItem(); + TDriveUnit driveUnit; + driveUnit = (*iDriveLetter)[choice]; + + RFs aRfs; + User::LeaveIfError(aRfs.Connect()); + + CXIKOPTIONBUTTONLIST *fillSpaceOpButs; + fillSpaceOpButs = STATIC_CAST(CXIKOPTIONBUTTONLIST*, Control(EDriveToLeaveButtonCtl)); + + if (aButtonId==EDriveFillButtonCtl) + { + iEikonEnv->BusyMsgL(_L("Filling Drive")); + // need a unique file name + TInt i=0,err = KErrNone; + TFileName fileName; + TTime time; + + TInt fileSize; + + CXIKOPTIONBUTTONLIST *fillSpaceOpButs; + fillSpaceOpButs = STATIC_CAST(CXIKOPTIONBUTTONLIST*, Control(EDriveToLeaveButtonCtl)); + + TInt spaceToLeave=K4k; + if (fillSpaceOpButs->LabeledButtonId()==EDriveLeave4K) spaceToLeave=K4k; + else if (fillSpaceOpButs->LabeledButtonId()==EDriveLeave8K) spaceToLeave=K8k; + else if (fillSpaceOpButs->LabeledButtonId()==EDriveLeave16K) spaceToLeave=K16k; + else if (fillSpaceOpButs->LabeledButtonId()==EDriveLeave64K) spaceToLeave=K64k; + else if (fillSpaceOpButs->LabeledButtonId()==EDriveLeave256K) spaceToLeave=K256k; + + for (fileSize = K1M; fileSize>=spaceToLeave; fileSize>>=1) + { + + do { + time.UniversalTime(); + TDriveName driveName = driveUnit.Name(); + fileName.Format(_L("%S\\%S%06d-%08x"),&driveName,&KFillName,++i,*(reinterpret_cast(&(time.Int64())))); + + // create a file of this file size + RFile file; + err=file.Create(aRfs, fileName, EFileRead|EFileWrite); + if (err!=KErrNone) + { + TBuf<70> errorMessage(_L("Cannot complete fill. RFile::Create() failed with error no. ")); + errorMessage.AppendNum(err); + iEikonEnv->InfoWinL(_L("Error"), errorMessage); + } + + // fill file up to fileSize + if (err==KErrNone) + { + const TInt MaxBufSize=512; + TBuf8 buf; + buf.SetLength(MaxBufSize); + Mem::Fill((void*)buf.Ptr(),MaxBufSize,0xef); + TInt rem=fileSize; + while(rem) + { + TInt s=Min(MaxBufSize,rem); + err=file.Write(buf,s); + if (err!=KErrNone) break; + rem-=s; + } + } + + file.Close(); + if(err!=KErrNone) aRfs.Delete(fileName); + } while (err==KErrNone && i<100); + } + iEikonEnv->BusyMsgCancel(); + iEikonEnv->InfoMsg(_L("Drive filled")); + } + else if (aButtonId==EDriveUndoFillButtonCtl) + { + iEikonEnv->BusyMsgL(_L("Undo Drive Fill")); + TFindFile fileFinder(aRfs); + CDir* fileList; + + TBuf<10> name; + name=KFillName; + name.Append(KAsterisk); + + TBuf<3> driveName; + driveName=driveUnit.Name(); + driveName.Append(_L("\\")); + + TInt findErr = fileFinder.FindWildByPath(name,&driveName,fileList); + TInt deleteErr = KErrNone; + + if (findErr == KErrNone) + { + for (TInt i=0;iCount();++i) + { + TBuf<100> filePath(driveName); + filePath.Append((*fileList)[i].iName); + + deleteErr = aRfs.Delete(filePath); + } + } + iEikonEnv->BusyMsgCancel(); + + if (deleteErr !=KErrNone) + { + TBufC<15> function(_L("RFs::Delete()")); + DisplayError(function, deleteErr); + } + if (findErr == KErrNone && deleteErr == KErrNone) + { + fillSpaceOpButs->ComponentControl(0)->MakeVisible(ETrue); + fillSpaceOpButs->ComponentControl(1)->MakeVisible(ETrue); + fillSpaceOpButs->ComponentControl(2)->MakeVisible(ETrue); + fillSpaceOpButs->ComponentControl(3)->MakeVisible(ETrue); + fillSpaceOpButs->ComponentControl(4)->MakeVisible(ETrue); + iEikonEnv->InfoMsg(_L("Undo Fill Complete")); + } + + else iEikonEnv->InfoMsg(_L("Undo Fill Invalid")); + delete fileList; + } + else if (aButtonId==EDriveFormatButtonCtl) + { + TInt count; + RFormat format; + TInt err=format.Open(aRfs,driveUnit.Name(),EHighDensity,count); + if (err==KErrNone) + { + iEikonEnv->BusyMsgL(_L("Formatting Drive")); + while (count && err==KErrNone) + { + err = format.Next(count); + if (err != KErrNone) + { + TBufC<15> function(_L("RFormat::Next()")); + DisplayError(function, err); + } + } + iEikonEnv->BusyMsgCancel(); + } + else + { + TBuf<70> errorMessage(_L("RFormat::Open() failed with system error no.")); + errorMessage.AppendNum(err); + iEikonEnv->InfoWinL(_L("Error"), errorMessage); + } + format.Close(); + } + + aRfs.Close(); + } + return EFalse; + } + +CDialogBase::CDialogBase() + { + } + +void CDialogBase::DisplayError(TDesC& aMessage, TInt aErrorNumber) + { + //could check doesn't go out of bounds + TBuf<250> errorMssge(aMessage); + errorMssge.Append(_L(" fails with system error no. ")); + TBuf<3> errorNum; + _LIT(KFormatDec, "%d"); + errorNum.Format(KFormatDec, aErrorNumber); + errorMssge.Append(errorNum); + iEikonEnv->InfoWinL(_L("Error"), errorMssge); + } + +void CDialogBase::DisplayError(TDesC& aMessage) + { + //could check don't go out of bounds + TBuf<250> errorMssge(aMessage); + iEikonEnv->InfoWinL(_L("Error"), errorMssge); + } + diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/src/ResourceHandler_Document.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/src/ResourceHandler_Document.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,36 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "ResourceHandler.h" + +// The constructor of the document class just passes the +// supplied reference to the constructor initialisation list. +// The document has no real work to do in this application. +// +CResourceDocument::CResourceDocument(CEikApplication& aApp) + : CXKNDOCUMENT(aApp) + { + } + + +// This is called by the UI framework as soon as the +// document has been created. It creates an instance +// of the ApplicationUI. The Application UI class is +// an instance of a CEikAppUi derived class. +// +CEikAppUi* CResourceDocument::CreateAppUiL() + { + return new(ELeave) CResourceAppUi; + } diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/src/ResourceHandler_Main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/src/ResourceHandler_Main.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,53 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "ResourceHandler.h" +#ifdef TV +#include +#endif + +// The entry point for the application code. It creates +// an instance of the CApaApplication derived +// class, CResourceApplication. +// + + +#ifdef UIQ +EXPORT_C CApaApplication* NewApplication() + { + return new CResourceApplication; + } + +// This function is required by all EPOC32 DLLs. In this +// Resource, it does nothing. +// +GLDEF_C TInt E32Dll(TDllReason) + { + return KErrNone; + } +#endif + +#ifdef TV +LOCAL_C CApaApplication* NewApplication() + { + return new CResourceApplication; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + +#endif diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/src/ResourceHandler_ResourceDetails.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/src/ResourceHandler_ResourceDetails.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,405 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "ResourceHandler.h" + +/** +Gets process details for a process with the given name - assumed to be a valid process +name. +*/ +void TResourceDetails::GetProcessData(TDesC& aProcessName) + { + RProcess process; + process.Open(aProcessName); + + // ID + iProcessData.iIdString.Format(KFormatDec,process.Id().Id()); + + // Store Process Name + iProcessData.iProcessName.Copy(aProcessName); + //to increase readability of resource table + AppendDotsToResourceName(iProcessData.iProcessName); + + // Priority + iProcessData.iPriorityString.Format(KFormatDec,process.Priority()); + + // Protected + + // System + + // Owner + RProcess owner; + TInt err = KErrNotSupported; + if (err == KErrNone) + { + iProcessData.iOwnerIdString.Format(KFormatHex,owner.Id().Id()); + } + else + { + iProcessData.iOwnerIdString.Format(KFormatHex,0); + } + + // Exit Type + TExitType et = process.ExitType(); + switch(et) + { + case(0): iProcessData.iExitTypeString.Copy((_L("Kill"))); break; + case(1): iProcessData.iExitTypeString.Copy((_L("Terminate"))); break; + case(2): iProcessData.iExitTypeString.Copy((_L("Panic"))); break; + case(3): iProcessData.iExitTypeString.Copy((_L("Pending"))); break; + default: iProcessData.iExitTypeString.Copy((_L("Error!"))); break; + }; + + // Exit Reason + TInt er = process.ExitReason(); + if (er==0) iProcessData.iExitReasonString.Copy(_L("n/a")); + else + { + iProcessData.iExitReasonString.Format(KFormatHex,(TInt)er); + } + + // Exit Category + TExitCategoryName ec; + ec = process.ExitCategory(); + if (ec.Length() == 0) iProcessData.iExitCategoryName.Copy(_L("n/a")); + else iProcessData.iExitCategoryName.Copy(ec); + + // UIDs + TUidType uids = process.Type(); + iProcessData.iUidType0String.Format(KFormatHex, uids[0].iUid); + iProcessData.iUidType1String.Format(KFormatHex, uids[1].iUid); + iProcessData.iUidType2String.Format(KFormatHex, uids[2].iUid); + + // File + iProcessData.iFileName = process.FileName(); + + process.Close(); + } + +/** +Gets process details for a drive with the properties. These properties are assumed +to be a valid. +*/ +void TResourceDetails::GetDriveData(TInt aValidDriveNum, TDriveUnit aDriveUnit, TVolumeInfo aVolumeInfo) + { + iDriveData.iDriveName.Copy(aDriveUnit.Name()); + iDriveData.iVolumeName.Copy(aVolumeInfo.iName); + iDriveData.iDriveNumberString.Format(KFormatDec, aValidDriveNum); + + TBufC<20> mediaInfo; + switch (aVolumeInfo.iDrive.iType) + { + case EMediaNotPresent:mediaInfo=_L("EMediaNotPresent");break; + case EMediaUnknown:mediaInfo=_L("EMediaUnknown");break; + case EMediaFloppy:mediaInfo=_L("EMediaFloppy");break; + case EMediaHardDisk:mediaInfo=_L("EMediaHardDisk");break; + case EMediaCdRom:mediaInfo=_L("EMediaCdRom");break; + case EMediaRam:mediaInfo=_L("EMediaRam");break; + case EMediaFlash:mediaInfo=_L("EMediaFlash");break; + case EMediaRom:mediaInfo=_L("EMediaRom");break; + case EMediaRemote:mediaInfo=_L("EMediaRemote");break; + default:mediaInfo=_L("Other");break; + } + + iDriveData.iMediaString.Copy(mediaInfo); + iDriveData.iAttributesString.Format(KFormatHex,aVolumeInfo.iDrive.iDriveAtt); + iDriveData.iSpaceString.Format(KFormatDec64,aVolumeInfo.iSize); + #if defined(WINS) + iDriveData.iFreeSpaceString.Copy(_L("Unavail.")); + #else + if (aVolumeInfo.iFree.GetTInt() > aVolumeInfo.iSize.GetTInt()) // this value is odd on wins + { + iDriveData.iFreeSpaceString.Format(KFormatDec,aVolumeInfo.iSize.GetTInt()); + } + else if (aVolumeInfo.iFree.GetTInt() < 0) + { + iDriveData.iFreeSpaceString.Copy(_L("InvalidVal")); + } + else + { + iDriveData.iFreeSpaceString.Format(KFormatDec,aVolumeInfo.iFree.GetTInt()); + } + #endif + } + +/** +Gets thread details for a thread with the given name - assumed to be a valid name. +*/ +void TResourceDetails::GetThreadData(TDesC& aThreadName) + { + RThread thread; + TInt err = thread.Open(aThreadName); + if (err == KErrNone) + { + // ID + iThreadData.iIdString.Format(KFormatDec,thread.Id().Id()); + + // Name + iThreadData.iThreadName.Copy(aThreadName); + + //to increase readability of resource table + AppendDotsToResourceName(iThreadData.iThreadName); + + // Priority + iThreadData.iPriorityString.Format(KFormatDec,thread.Priority()); + + // Owner Process + RProcess owner; + thread.Process(owner); + iThreadData.iOwnerIdString.Format(KFormatDec,owner.Id().Id()); + + owner.Close(); + + // Stack Size + + TInt aHeapSize = 0, aStackSize = 0; + iThreadData.iStackSizeString.Format(KFormatHex,aStackSize); + iThreadData.iHeapSizeString.Format(KFormatHex,aHeapSize); + + // Protected + + // System + + // Exit Type + TExitType et = thread.ExitType(); + switch(et) + { + case(0): iThreadData.iExitTypeString.Copy((_L("Kill"))); break; + case(1): iThreadData.iExitTypeString.Copy((_L("Terminate"))); break; + case(2): iThreadData.iExitTypeString.Copy((_L("Panic"))); break; + case(3): iThreadData.iExitTypeString.Copy((_L("Pending"))); break; + default: iThreadData.iExitTypeString.Copy((_L("Error!"))); break; + }; + + // Exit Reason + + TInt er = thread.ExitReason(); + if (er==0) iThreadData.iExitReasonString.Copy(_L("n/a")); + else iThreadData.iExitReasonString.Format(KFormatHex,(TInt)er); + + // Exit Category + + TExitCategoryName ec; + ec = thread.ExitCategory(); + if (ec.Length() == 0) iThreadData.iExitCategoryName.Copy(_L("n/a")); + else iThreadData.iExitCategoryName.Copy(ec); + + thread.Close(); + } + } + +/** +Gets details for a chunk using the given TFindChunk and name. +*/ +void TResourceDetails::GetChunkData(TFindChunk findHb, TDesC& aChunkName) + { + RChunk chunk; + chunk.Open(findHb); + + // Name + iChunkData.iChunkName.Copy(aChunkName); + + //to increase readability of resource table + AppendDotsToResourceName(iChunkData.iChunkName); + + // Size + TInt chunkSize = 0; + iChunkData.iSizeString.Format(KFormatHex,chunkSize); + + // Max Size + + TInt chunkMaxSize = 0; + iChunkData.iMaxSizeString.Format(KFormatHex,chunkMaxSize); + + // Readable + if (chunk.IsReadable()) iChunkData.iReadableIndicator.Copy(_L("R")); + else iChunkData.iReadableIndicator.Copy(_L("-")); + + // Writeable + if (chunk.IsWritable()) iChunkData.iWritableIndicator.Copy(_L("W")); + else iChunkData.iWritableIndicator.Copy(_L("-")); + + chunk.Close(); + } + +/** +Gets details for a mutex using the given TFindMutex and name. +*/ +void TResourceDetails::GetMutexData(TFindMutex& findHb, TDesC& aMutexName) + { + RMutex mutex; + + // Name + iMutexData.iMutexName.Copy(aMutexName); + + //to increase readability of resource table + AppendDotsToResourceName(iMutexData.iMutexName); + + // Count + mutex.Open(findHb); + TInt count = 0; + iMutexData.iHexCountString.Format(KFormatHex, count); + iMutexData.iDecCountString.Format(KFormatDec, count); + mutex.Close(); + } + +/** +Gets details for a mutex using the given TFindSemaphore and name. +*/ +void TResourceDetails::GetSemaphoreData(TFindSemaphore& findHb, TDesC& aSemaphoreName) + { + RSemaphore sem; + // Name + iSemaphoreData.iSemaphoreName.Copy(aSemaphoreName); + //to increase readability of resource table + AppendDotsToResourceName(iSemaphoreData.iSemaphoreName); + iSemaphoreData.iSemaphoreName.AppendFill('.', KMaxFullName - iSemaphoreData.iSemaphoreName.Length()); + + // Count + sem.Open(findHb); + TInt count = 0; + iSemaphoreData.iHexCountString.Format(KFormatHex,count); + + iSemaphoreData.iDecCountString.Format(KFormatDec,count); + + sem.Close(); + } + +/** +Gets details for a HAL entry. Assumes that the parameters are valid. +*/ +void TResourceDetails::GetHalData(TInt aValidEntryNum, HAL::SEntry* aSEntry) + { + iHalData.iNumberString.Format(KFormatDec,aValidEntryNum); + + TBuf<100> halName; + switch (aValidEntryNum) + { + case HALData::EManufacturer: halName=_L("EManufacturer");break; + case HALData::EManufacturerHardwareRev: halName=_L("EManufacturerHardwareRev");break; + case HALData::EManufacturerSoftwareRev: halName=_L("EManufacturerSoftwareRev");break; + case HALData::EManufacturerSoftwareBuild: halName=_L("EManufacturerSoftwareBuild");break; + case HALData::EModel: halName=_L("EModel");break; + case HALData::EMachineUid: halName=_L("EMachineUid");break; + case HALData::EDeviceFamily: halName=_L("EDeviceFamily");break; + case HALData::EDeviceFamilyRev: halName=_L("EDeviceFamilyRev");break; + case HALData::ECPU: halName=_L("ECPU");break; + case HALData::ECPUArch: halName=_L("ECPUArch");break; + case HALData::ECPUABI: halName=_L("ECPUABI");break; + case HALData::ECPUSpeed: halName=_L("ECPUSpeed");break; + case HALData::ESystemStartupReason: halName=_L("ESystemStartupReason");break; + case HALData::ESystemException: halName=_L("ESystemException");break; + case HALData::ESystemTickPeriod: halName=_L("ESystemTickPeriod");break; + case HALData::EMemoryRAM: halName=_L("EMemoryRAM");break; + case HALData::EMemoryRAMFree: halName=_L("EMemoryRAMFree");break; + case HALData::EMemoryROM: halName=_L("EMemoryROM");break; + case HALData::EMemoryPageSize: halName=_L("EMemoryPageSize");break; + case HALData::EPowerGood: halName=_L("EPowerGood");break; + case HALData::EPowerBatteryStatus: halName=_L("EPowerBatteryStatus");break; + case HALData::EPowerBackup: halName=_L("EPowerBackup");break; + case HALData::EPowerBackupStatus: halName=_L("EPowerBackupStatus");break; + case HALData::EPowerExternal: halName=_L("EPowerExternal");break; + case HALData::EKeyboard: halName=_L("EKeyboard");break; + case HALData::EKeyboardDeviceKeys: halName=_L("EKeyboardDeviceKeys");break; + case HALData::EKeyboardAppKeys: halName=_L("EKeyboardAppKeys");break; + case HALData::EKeyboardClick: halName=_L("EKeyboardClick");break; + case HALData::EKeyboardClickState: halName=_L("EKeyboardClickState");break; + case HALData::EKeyboardClickVolume: halName=_L("EKeyboardClickVolume");break; + case HALData::EKeyboardClickVolumeMax: halName=_L("EKeyboardClickVolumeMax");break; + case HALData::EDisplayXPixels: halName=_L("EDisplayXPixels");break; + case HALData::EDisplayYPixels: halName=_L("EDisplayYPixels");break; + case HALData::EDisplayXTwips: halName=_L("EDisplayXTwips");break; + case HALData::EDisplayYTwips: halName=_L("EDisplayYTwips");break; + case HALData::EDisplayColors: halName=_L("EDisplayColors");break; + case HALData::EDisplayState: halName=_L("EDisplayState");break; + case HALData::EDisplayContrast: halName=_L("EDisplayContrast");break; + case HALData::EDisplayContrastMax: halName=_L("EDisplayContrastMax");break; + case HALData::EBacklight: halName=_L("EBacklight");break; + case HALData::EBacklightState: halName=_L("EBacklightState");break; + case HALData::EPen: halName=_L("EPen");break; + case HALData::EPenX: halName=_L("EPenX");break; + case HALData::EPenY: halName=_L("EPenY");break; + case HALData::EPenDisplayOn: halName=_L("EPenDisplayOn");break; + case HALData::EPenClick: halName=_L("EPenClick");break; + case HALData::EPenClickState: halName=_L("EPenClickState");break; + case HALData::EPenClickVolume: halName=_L("EPenClickVolume");break; + case HALData::EPenClickVolumeMax: halName=_L("EPenClickVolumeMax");break; + case HALData::EMouse: halName=_L("EMouse");break; + case HALData::EMouseX: halName=_L("EMouseX");break; + case HALData::EMouseY: halName=_L("EMouseY");break; + case HALData::EMouseState: halName=_L("EMouseState");break; + case HALData::EMouseSpeed: halName=_L("EMouseSpeed");break; + case HALData::EMouseAcceleration: halName=_L("EMouseAcceleration");break; + case HALData::EMouseButtons: halName=_L("EMouseButtons");break; + case HALData::EMouseButtonState: halName=_L("EMouseButtonState");break; + case HALData::ECaseState: halName=_L("ECaseState");break; + case HALData::ECaseSwitch: halName=_L("ECaseSwitch");break; + case HALData::ECaseSwitchDisplayOn: halName=_L("ECaseSwitchDisplayOn");break; + case HALData::ECaseSwitchDisplayOff: halName=_L("ECaseSwitchDisplayOff");break; + case HALData::ELEDs: halName=_L("ELEDs");break; + case HALData::ELEDmask: halName=_L("ELEDmask");break; + case HALData::EIntegratedPhone: halName=_L("EIntegratedPhone");break; + case HALData::EDisplayBrightness: halName=_L("EDisplayBrightness");break; + case HALData::EDisplayBrightnessMax: halName=_L("EDisplayBrightnessMax");break; + case HALData::EKeyboardBacklightState: halName=_L("EKeyboardBacklightState");break; + case HALData::EAccessoryPower: halName=_L("EAccessoryPower");break; + case HALData::ELanguageIndex: halName=_L("ELanguageIndex");break; + case HALData::EKeyboardIndex: halName=_L("EKeyboardIndex");break; + case HALData::EMaxRAMDriveSize: halName=_L("EMaxRAMDriveSize");break; + case HALData::EKeyboardState: halName=_L("EKeyboardState");break; + case HALData::ESystemDrive: halName=_L("ESystemDrive");break; + case HALData::EPenState: halName=_L("EPenState");break; + case HALData::EDisplayIsMono: halName=_L("EDisplayIsMono");break; + case HALData::EDisplayIsPalettized: halName=_L("EDisplayIsPalettized");break; + case HALData::EDisplayBitsPerPixel: halName=_L("EDisplayBitsPerPixel");break; + case HALData::EDisplayNumModes: halName=_L("EDisplayNumModes");break; + case HALData::EDisplayMemoryAddress: halName=_L("EDisplayMemoryAddress");break; + case HALData::EDisplayOffsetToFirstPixel: halName=_L("EDisplayOffsetToFirstPixel");break; + case HALData::EDisplayOffsetBetweenLines: halName=_L("EDisplayOffsetBetweenLines");break; + case HALData::EDisplayPaletteEntry: halName=_L("EDisplayPaletteEntry");break; + case HALData::EDisplayIsPixelOrderRGB: halName=_L("EDisplayIsPixelOrderRGB");break; + case HALData::EDisplayIsPixelOrderLandscape: halName=_L("EDisplayIsPixelOrderLandscape");break; + case HALData::EDisplayMode: halName=_L("EDisplayMode");break; + case HALData::ESwitches: halName=_L("ESwitches");break; + case HALData::EDebugPort: halName=_L("EDebugPort");break; + case HALData::ELocaleLoaded: halName=_L("ELocaleLoaded");break; + case HALData::ENumHalAttributes: halName=_L("ENumHalAttributes");break; + default:halName=_L("Unknown");break; + } + + iHalData.iName.Copy(halName); + + if (aSEntry[aValidEntryNum].iProperties & HAL::EEntryDynamic) + iHalData.iDynamicIndicator=_L("D"); + else iHalData.iDynamicIndicator=_L("-"); + + iHalData.iDecValString.Format(KFormatDec,aSEntry[aValidEntryNum].iValue); + + iHalData.iHexValString.Format(KFormatHex,aSEntry[aValidEntryNum].iValue); + } + +/** +Appends dots (after 3 spaces) to a resource name. +Used for names of resources in a table - so you can follow the dots to read the +resource details. +*/ +void TResourceDetails::AppendDotsToResourceName(TFullName& aResourceName) + { + if (aResourceName.Length() < KMaxFullName - 3) + aResourceName.AppendFill(' ', 3); + aResourceName.AppendFill('.', KMaxFullName - aResourceName.Length()); + } + diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/src/ResourceHandler_ResourceList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/src/ResourceHandler_ResourceList.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,764 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 "ResourceHandler.h" + +#include //CTextListBoxModel + +void CResourceList::ConstructL(TInt aTablePosition) + { + // Create the basic list box + iListBox = new(ELeave) CEikColumnListBox; + iListBox->ConstructL( this ); //This view is parent. No flags. Also constructs the associated list box model and item drawer for the list box. + + iListBox->SetContainerWindowL( *this ); + iListBox->CreateScrollBarFrameL( ); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto); + + iListBox->SetPosition(TPoint(iBorder, aTablePosition + iBorder)); + + iListBox->SetSize(Rect().Size()-TSize(0, aTablePosition) -TSize(iBorder*2,iBorder*2)); + + iListBox->ActivateL(); + + iModel = iListBox->Model(); + + iTextArray = iModel->ItemTextArray(); + iListBoxItems = static_cast(iTextArray); + iListBoxData = STATIC_CAST(CColumnListBoxItemDrawer*,iListBox->View()->ItemDrawer())->ColumnData(); + + } + +CResourceList::~CResourceList() + { + delete iListBox; + iModel = NULL; + iTextArray = NULL; + iListBoxItems = NULL; + iListBoxData = NULL; + } + +CCoeControl* CResourceList::GetListBox() const + { + return iListBox; + } + +void CResourceList::EmptyList() + { + iListBoxItems->Reset(); + iListBox->Reset(); + } + +#ifdef UIQ +#define CW_Id 40 +#define CW_HalId 35 +#define CW_DriveAtt 35 +#define CW_Short 45 +#define CW_UID 75 +#define CW_ExT_R 50 +#define CW_Medium 60 +#define CW_Long 90 +#define CW_Priority 60 +#define CW_ProcessId 70 +#define CW_Read 50 +#define CW_Writeable 70 +#define CW_Dynamic 60 +#define CW_List 60 +#define CW_DriveSize 70 +#define CW_Count 80 +#define CW_MemSize 90 +#define CW_HalName 200 +#define CW_MutexName 280 +#define CW_Media 120 +#define CW_Name 135 +#define CW_ProcessName 220 +#define CW_ExitCat 80 +#define CW_ChunkName 380 +#define CW_SemName 300 +#define CW_ThreadName 370 +#define CW_LongName 250 +#define CW_Message 250 +#define CW_FileName 400 +#define GapWidth 10 +#endif +#ifdef TV +#define CW_Id 25 +#define CW_HalId 45 +#define CW_DriveAtt 60 +#define CW_Short 60 +#define CW_UID 100 +#define CW_Medium 90 +#define CW_Long 115 +#define CW_Priority 85 +#define CW_ProcessId 95 +#define CW_Writeable 90 +#define CW_Read 70 +#define CW_Name 195 +#define CW_ProcessName 195 +#define CW_ExitCat 185 +#define CW_ChunkName 350 +#define CW_SemName 305 +#define CW_HalName 260 +#define CW_ThreadName 380 +#define CW_LongName 380 +#define CW_Message 380 +#define CW_ExT_R 70 +#define CW_MutexName 305 +#define CW_FileName 500 +#define CW_Media 140 +#define CW_List 150 +#define CW_Dynamic 100 +#define CW_Count 115 +#define CW_MemSize 130 +#define GapWidth 25 +#endif + +void CResourceList::SetUpProcessTable() +{ + // deal with the columns + iListBoxData->SetColumnWidthPixelL( 0, CW_Id ); + iListBoxData->SetColumnWidthPixelL( 1, CW_ProcessName ); + iListBoxData->SetColumnAlignmentL( 1, CGraphicsContext::ELeft); + iListBoxData->SetColumnWidthPixelL( 2, CW_Medium ); //Priority + iListBoxData->SetColumnAlignmentL( 2, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 3, CW_Short ); //Prot? + iListBoxData->SetColumnAlignmentL( 3, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 4, CW_Short ); //Sys? + iListBoxData->SetColumnAlignmentL( 4, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 5, CW_Short ); //Owner Id + iListBoxData->SetColumnAlignmentL( 5, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 6, CW_Medium ); //Exit T. + iListBoxData->SetColumnAlignmentL( 6, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 7, CW_Short ); // Exit R + iListBoxData->SetColumnAlignmentL( 7, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 8, CW_Short ); // Exit C + iListBoxData->SetColumnAlignmentL( 8, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 9, CW_UID ); // Uid 0 + iListBoxData->SetColumnAlignmentL( 9, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 10, CW_UID ); //Uid 1 + iListBoxData->SetColumnAlignmentL( 10, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 11, CW_UID + GapWidth ); // Uid 2 + iListBoxData->SetColumnAlignmentL( 11, CGraphicsContext::ERight); + iListBoxData->SetColumnHorizontalGapL(11, GapWidth); + iListBoxData->SetColumnWidthPixelL( 12, CW_FileName ); // File Name + iListBoxData->SetColumnHorizontalGapL(12, GapWidth); + + TBuf<1000> titles(_L("Id\tName\tPriority\tProt?\tSys?\tOwner\tExit T.\tExit R.\tExit C.\tUid 0\tUid 1\tUid 2\tExecutable File")); + iListBoxItems->AppendL(titles); +} + +void CResourceList::SetUpThreadTable() +{ + iListBoxData->SetColumnWidthPixelL( 0, CW_Id ); + iListBoxData->SetColumnWidthPixelL( 1, CW_ThreadName ); + iListBoxData->SetColumnAlignmentL( 1, CGraphicsContext::ELeft); + iListBoxData->SetColumnWidthPixelL( 2, CW_Priority ); //Priority + iListBoxData->SetColumnAlignmentL( 2, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 3, CW_ProcessId ); //ProcessId + iListBoxData->SetColumnAlignmentL( 3, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 4, CW_Medium ); //Stack Sz + iListBoxData->SetColumnAlignmentL( 4, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 5, CW_Medium ); //Heap Sz + iListBoxData->SetColumnAlignmentL( 5, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 6, CW_Short ); //Prot? + iListBoxData->SetColumnAlignmentL( 6, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 7, CW_Short ); //Sys? + iListBoxData->SetColumnAlignmentL( 7, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 8, CW_Medium ); //Exit T. + iListBoxData->SetColumnAlignmentL( 8, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 9, CW_Short ); //Exit R. + iListBoxData->SetColumnAlignmentL( 9, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 10, CW_Short ); //Exit C. + iListBoxData->SetColumnAlignmentL( 10, CGraphicsContext::ERight); + + TBuf<1000> titles(_L("Id\tName\tPriority\tProcess\tStack Sz\tHeap Sz\tProt?\tSys?\tExit T.\tExit R.\tExit C.")); + iListBoxItems->AppendL(titles); +} + +void CResourceList::SetUpChunkTable() +{ + iListBoxData->SetColumnWidthPixelL( 0, CW_ChunkName ); + iListBoxData->SetColumnWidthPixelL( 1, CW_Medium ); + iListBoxData->SetColumnAlignmentL(1, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 2, CW_Medium + GapWidth ); + iListBoxData->SetColumnAlignmentL(2, CGraphicsContext::ERight); + iListBoxData->SetColumnHorizontalGapL( 2, GapWidth); + iListBoxData->SetColumnWidthPixelL( 3, CW_Read ); + iListBoxData->SetColumnAlignmentL( 3, CGraphicsContext::ELeft); + iListBoxData->SetColumnWidthPixelL( 4, CW_Writeable ); + iListBoxData->SetColumnAlignmentL( 4, CGraphicsContext::ELeft); + + TBuf<1000> titles(_L("Name\tSize\tMax Size\tRead-/\tWrite-able")); + iListBoxItems->AppendL(titles); +} + +void CResourceList::SetUpSemaphoreTable() +{ + iListBoxData->SetColumnWidthPixelL( 0, CW_SemName ); + iListBoxData->SetColumnWidthPixelL( 1, CW_Count ); + iListBoxData->SetColumnAlignmentL(1, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 2, CW_Count ); + iListBoxData->SetColumnAlignmentL(2, CGraphicsContext::ERight); + + TBuf<1000> titles(_L("Name\tHex Count\tDec Count")); + iListBoxItems->AppendL(titles); +} + +void CResourceList::SetUpMutexTable() +{ + iListBoxData->SetColumnWidthPixelL( 0, CW_MutexName ); + iListBoxData->SetColumnWidthPixelL( 1, CW_Count ); + iListBoxData->SetColumnAlignmentL(1, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 2, CW_Count ); + iListBoxData->SetColumnAlignmentL(2, CGraphicsContext::ERight); + + TBuf<1000> titles(_L("Name\tHex Count\tDec Count")); + iListBoxItems->AppendL(titles); +} + + +void CResourceList::SetUpDriveTable() +{ + iListBoxData->SetColumnWidthPixelL( 0, CW_Short ); + iListBoxData->SetColumnWidthPixelL( 1, CW_Long ); + iListBoxData->SetColumnAlignmentL( 1, CGraphicsContext::ELeft); + iListBoxData->SetColumnHorizontalGapL( 1, GapWidth); + iListBoxData->SetColumnWidthPixelL( 2, CW_Short + GapWidth ); + iListBoxData->SetColumnAlignmentL( 2, CGraphicsContext::ELeft); + iListBoxData->SetColumnHorizontalGapL(2, GapWidth); + iListBoxData->SetColumnWidthPixelL( 3, CW_Media ); //Media + iListBoxData->SetColumnAlignmentL( 3, CGraphicsContext::ELeft); + iListBoxData->SetColumnWidthPixelL( 4, CW_DriveAtt ); //Attr. + iListBoxData->SetColumnAlignmentL( 4, CGraphicsContext::ELeft); + iListBoxData->SetColumnWidthPixelL( 5, CW_MemSize ); + iListBoxData->SetColumnAlignmentL(5, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 6, CW_MemSize ); + iListBoxData->SetColumnAlignmentL(6, CGraphicsContext::ERight); + #if defined(WINS) + iListBoxData->SetColumnWidthPixelL( 7, CW_Message ); + iListBoxData->SetColumnAlignmentL(7, CGraphicsContext::ELeft); + #endif + + TBuf<1000> titles(_L("Drive\tVol. name\tNo.\tMedia\tAtt.\tSize (bytes)\tFree (bytes)")); + #if defined(WINS) + titles.Append(_L("\t(not retrievable in WINS)")); + #endif + iListBoxItems->AppendL(titles); +} + +void CResourceList::SetUpHalTable() +{ + iListBoxData->SetColumnWidthPixelL( 0, CW_HalId ); + iListBoxData->SetColumnWidthPixelL( 1, CW_HalName ); + iListBoxData->SetColumnAlignmentL(1, CGraphicsContext::ELeft); + iListBoxData->SetColumnWidthPixelL( 2, CW_Dynamic ); + iListBoxData->SetColumnAlignmentL( 2, CGraphicsContext::ECenter); + iListBoxData->SetColumnWidthPixelL( 3, CW_MemSize ); + iListBoxData->SetColumnAlignmentL(3, CGraphicsContext::ERight); + iListBoxData->SetColumnWidthPixelL( 4, CW_MemSize ); + iListBoxData->SetColumnAlignmentL(4, CGraphicsContext::ERight); + + TBuf<1000> titles(_L("No.\tName\tDynamic\tDec Value\tHex Value")); + iListBoxItems->AppendL(titles); +} + +void CResourceList::SetUpList() +{ + iListBoxData->SetColumnWidthPixelL( 0, 300 ); +} + +void CResourceList::UpdateListData() + { + CResourceList::EmptyList(); + + switch (iObjectsViewed) + { + case EObjectProcess: + SetUpProcessTable(); + break; + case EObjectThread: + SetUpThreadTable(); + break; + case EObjectChunk: + SetUpChunkTable(); + break; + case EObjectLibrary: + SetUpList(); + break; + case EObjectServer: + SetUpList(); + break; + case EObjectSemaphore: + SetUpSemaphoreTable(); + break; + case EObjectMutex: + SetUpMutexTable(); + break; + case EObjectLogicalDevice: + SetUpList(); + break; + case EObjectPhysicalDevice: + SetUpList(); + break; + case EObjectLogicalChannel: + SetUpList(); + break; + case EObjectWindow: + SetUpList(); + break; + case EObjectDrive: + SetUpDriveTable(); + break; + case EObjectHal: + SetUpHalTable(); + break; + default: break; + } + GetResourceList(); + } + +void CResourceList::GetResourceList() + { + switch(iObjectsViewed) + { + case EObjectProcess: + GetProcessList(); + break; + case EObjectThread: + GetThreadList(); + break; + case EObjectChunk: + GetChunkList(); + break; + case EObjectLibrary: + GetLibraryList(); + break; + case EObjectServer: + GetServerList(); + break; + case EObjectSemaphore: + GetSemaphoreList(); + break; + case EObjectMutex: + GetMutexList(); + break; + case EObjectLogicalDevice: + GetLogicalDeviceList(); + break; + case EObjectPhysicalDevice: + GetPhysicalDeviceList(); + break; + case EObjectLogicalChannel: + GetLogicalChannelList(); + break; + case EObjectWindow: + GetWindowList(); + break; + case EObjectDrive: + GetDriveList(); + break; + case EObjectHal: + GetHalList(); + break; + default: + break; + } + } + +void CResourceList::GetProcessList(void) + { + TName prefix(KAsterisk); + TFindProcess findHb; + findHb.Find(prefix); + TFullName name; + + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + GetProcessData(name); + AddRow( iProcessData); + } + UpdateResourceCount(number); + } + +void CResourceList::GetThreadList(void) + { + TName prefix(KAsterisk); + TFindThread findHb; + findHb.Find(prefix); + TFullName name; + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + GetThreadData(name); + AddRow( iThreadData); + } + UpdateResourceCount(number); + } + + +void CResourceList::GetChunkList(void) + { + TName prefix(KAsterisk); + TFindChunk findHb; + findHb.Find(prefix); + TFullName name; + + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + GetChunkData(findHb, name); + + AddRow(iChunkData); + } + + UpdateResourceCount(number); + } + +void CResourceList::GetLibraryList(void) + { + TName prefix(KAsterisk); + TFindLibrary findHb; + findHb.Find(prefix); + TFullName name; + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + // Name + iListData.iName.Copy(name); + AddRow(iListData); + } + + UpdateResourceCount(number); + } + +void CResourceList::GetServerList(void) + { + TName prefix(KAsterisk); + TFindServer findHb; + findHb.Find(prefix); + TFullName name; + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + iListData.iName.Copy(name); + AddRow(iListData); + + } + + UpdateResourceCount(number); + } + +void CResourceList::GetSemaphoreList(void) + { + TName prefix(KAsterisk); + TFindSemaphore findHb; + findHb.Find(prefix); + TFullName name; + + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + GetSemaphoreData(findHb, name); + AddRow(iSemaphoreData); + } + + UpdateResourceCount(number); + } + +void CResourceList::GetMutexList(void) + { + TName prefix(KAsterisk); + TFindMutex findHb; + findHb.Find(prefix); + TFullName name; + + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + GetMutexData(findHb, name); + AddRow(iMutexData); + } + + UpdateResourceCount(number); + } + +void CResourceList::GetLogicalDeviceList(void) + { + TName prefix(KAsterisk); + TFindLogicalDevice findHb; + findHb.Find(prefix); + TFullName name; + + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + iListData.iName.Copy(name); + AddRow(iListData); + } + + UpdateResourceCount(number); + } + +void CResourceList::GetPhysicalDeviceList(void) + { + TName prefix(KAsterisk); + TFindPhysicalDevice findHb; + findHb.Find(prefix); + TFullName name; + + TInt number=0; + while (findHb.Next(name)==KErrNone) + { + number++; + iListData.iName.Copy(name); + AddRow(iListData); + + } + + UpdateResourceCount(number); + } + +void CResourceList::GetLogicalChannelList(void) + { + UpdateResourceCount(0); + } + +void CResourceList::GetWindowList(void) + { + RWsSession ws; + TInt err = ws.Connect(); + if (err == KErrNone) + { + + TInt number = ws.NumWindowGroups(0); + + CArrayFixFlat* wgIds = new(ELeave) CArrayFixFlat(number); + + ws.WindowGroupList(0,wgIds); + + CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(ws); + + for (TInt i=0; iConstructFromWgIdL(wgId); + iListData.iName.Copy(wgName->Caption()); + AddRow(iListData); + + } + CleanupStack::PopAndDestroy(wgName); + + delete wgIds; + wgIds = NULL; + + UpdateResourceCount(number); + + ws.Close(); + } + } + +void CResourceList::GetDriveList() + { + RFs fileServer; + User::LeaveIfError(fileServer.Connect()); + TInt err1,err2; + TInt number=0; + TInt driveNum=0; + + TDriveInfo driveInfo; + TVolumeInfo volumeInfo; + TDriveUnit driveUnit(EDriveA); + + + do { + driveUnit = driveNum; + err1 = fileServer.Volume(volumeInfo,driveUnit); + err2 = fileServer.Drive(driveInfo, driveUnit); + if (err1==KErrNone && err2==KErrNone) + { + GetDriveData(driveNum, driveUnit, volumeInfo); //sets drive data to iDriveData + AddRow(iDriveData); + number++; + } + driveNum++; + } while (driveNum <= EDriveZ); + fileServer.Close(); + UpdateResourceCount(number); + } + +void CResourceList::GetHalList() + { + TInt number=0; + + HAL::SEntry* aSEntry = NULL; + TInt numOfEntries, error; + error = HAL::GetAll(numOfEntries, aSEntry); + + if (error ==KErrNone) + { + for (TInt iEntryNum=0; iEntryNum item; + item.Format(_L("%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t"), &aProcessData.iIdString, + &aProcessData.iProcessName, + &aProcessData.iPriorityString, + &aProcessData.iProtectedIndicator, + &aProcessData.iSystemIndicator, + &aProcessData.iOwnerIdString, + &aProcessData.iExitTypeString, + &aProcessData.iExitReasonString, + &aProcessData.iExitCategoryName, + &aProcessData.iUidType0String, + &aProcessData.iUidType1String, + &aProcessData.iUidType2String, + &aProcessData.iFileName); + + iListBoxItems->AppendL(item); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); +} + +void CResourceList::AddRow(const TChunkData& aChunkData) +{ + // The actual item text format depends on the listbox type, see tables with listbox types + TBuf<1000> item; + item.Format(_L("%S\t%S\t%S\t%S\t%S"), &aChunkData.iChunkName, + &aChunkData.iSizeString, + &aChunkData.iMaxSizeString, + &aChunkData.iReadableIndicator, + &aChunkData.iWritableIndicator); + + iListBoxItems->AppendL(item); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); +} + +void CResourceList::AddRow(const TThreadData& aThreadData) +{ + // The actual item text format depends on the listbox type, see tables with listbox types + TBuf<1000> item; + item.Format(_L("%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t%S\t"), &aThreadData.iIdString, + &aThreadData.iThreadName, + &aThreadData.iPriorityString, + &aThreadData.iOwnerIdString, + &aThreadData.iStackSizeString, + &aThreadData.iHeapSizeString, + &aThreadData.iProtectedIndicator, + &aThreadData.iSystemIndicator, + &aThreadData.iExitTypeString, + &aThreadData.iExitReasonString, + &aThreadData.iExitCategoryName); + + iListBoxItems->AppendL(item); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); +} + +void CResourceList::AddRow(const TSemaphoreData& aSemaphoreData) +{ + // The actual item text format depends on the listbox type, see tables with listbox types + TBuf<1000> item; + item.Format(_L("%S\t%S\t%S\t"), &aSemaphoreData.iSemaphoreName, + &aSemaphoreData.iHexCountString, + &aSemaphoreData.iDecCountString); + + iListBoxItems->AppendL(item); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); +} + +void CResourceList::AddRow(const TMutexData& aMutexData) +{ + // The actual item text format depends on the listbox type, see tables with listbox types + TBuf<1000> item; + item.Format(_L("%S\t%S\t%S\t"), &aMutexData.iMutexName, + &aMutexData.iHexCountString, + &aMutexData.iDecCountString); + + iListBoxItems->AppendL(item); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); +} + +void CResourceList::AddRow(const TDriveData& aDriveData) +{ + // The actual item text format depends on the listbox type, see tables with listbox types + TBuf<1000> item; + item.Format(_L("%S\t%S\t%S\t%S\t%S\t%S\t%S\t"), &aDriveData.iDriveName, + &aDriveData.iVolumeName, + &aDriveData.iDriveNumberString, + &aDriveData.iMediaString, + &aDriveData.iAttributesString, + &aDriveData.iSpaceString, + &aDriveData.iFreeSpaceString); + + iListBoxItems->AppendL(item); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); +} + +void CResourceList::AddRow(const THalData& aHalData) +{ + // The actual item text format depends on the listbox type, see tables with listbox types + TBuf<1000> item; + item.Format(_L("%S\t%S\t%S\t%S\t%S\t"), &aHalData.iNumberString, + &aHalData.iName, + &aHalData.iDynamicIndicator, + &aHalData.iDecValString, + &aHalData.iHexValString); + + iListBoxItems->AppendL(item); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); +} + +void CResourceList::AddRow(const TListData& aListData) +{ + // The actual item text format depends on the listbox type, see tables with listbox types + TBuf<1000> item; + item.Format(_L("%S"), &aListData.iName); + + iListBoxItems->AppendL(item); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); +} diff -r 000000000000 -r 9736f095102e testapps/rschandler/Common/src/ResourceHandler_ResourceView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/Common/src/ResourceHandler_ResourceView.cpp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,186 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 implementation of the +// application view class - CResourceView +// +// + +#include "ResourceHandler.h" + +CResourceView::CResourceView() + { + } + +CResourceView* CResourceView::NewL(const TRect& aRect, CResourceAppUi *aAppUi) + { + CResourceView* self = new(ELeave) CResourceView(); + CleanupStack::PushL(self); + self->ConstructL(aRect, aAppUi); + CleanupStack::Pop(); + return self; + } + +CResourceView::~CResourceView() + { + delete iCommandButton; + } + +void CResourceView::ConstructL(const TRect& aRect, CResourceAppUi* aAppUi) + { + // Initialisation + iAppUi = aAppUi; + iObjectsViewed = EObjectProcess; + + CreateWindowL(); + + // Whole extent of view + SetRect(aRect); + + // Border around components in pixels + iBorder = 1; + + // Place the refresh button + iCommandButton = new(ELeave) CEikCommandButton; + iCommandButton->SetTextL(_L("Refresh")); + iCommandButton->SetSize(iCommandButton->MinimumSize()); + iCommandButton->SetPosition(TPoint(Rect().Width() - iCommandButton->Size().iWidth - iBorder, iBorder)); + iCommandButton->SetContainerWindowL(*this); + iCommandButton->SetObserver(this); + TInt buttonHeight = iCommandButton->Size().iHeight; + + // Get the title font height + TInt titleHeight = iEikonEnv->TitleFont()->HeightInPixels(); + TInt tablePosition = 0; + if (titleHeight>=buttonHeight) + tablePosition=titleHeight; + else + tablePosition=buttonHeight; + + CResourceList::ConstructL(tablePosition); +// Activate the main window control - this will also activate the contained controls + + ActivateL(); + DrawNow(); + } + + +void CResourceView::Draw(const TRect& /*aRect*/) const + { + CWindowGc& gc = SystemGc(); + + gc.Clear(); + + // Put title on view + const CFont* fontUsed = iEikonEnv->TitleFont(); + gc.UseFont(fontUsed); + gc.SetPenColor(KRgbBlack); + TPoint pos(iBorder,fontUsed->AscentInPixels()+iBorder); + gc.DrawText(iTitle, pos); + + gc.DiscardFont(); + } + + + +TInt CResourceView::CountComponentControls() const + { + return 2; + } + + +CCoeControl* CResourceView::ComponentControl(TInt aIndex) const + { + if (aIndex == 0) + return iCommandButton; + else + return CResourceList::GetListBox(); + } + + +// for use by refresh button control +void CResourceView::HandleControlEventL(CCoeControl* aControl,TCoeEvent /*aEventType*/) + { + if (aControl == iCommandButton) + { + UpdateView(); + } + } + +void CResourceView::InvalidateView(void) const + { + Window().Invalidate(Rect()); //calls Draw() + } + +void CResourceView::UpdateView(void) + { + CResourceList::UpdateListData(); + UpdateTitle(); + InvalidateView(); + } + +void CResourceView::UpdateTitle(void) + { + // assume the table data, iResourceCount and iObjectViewed data are up to date + TBufC<20> title; + + // Set the title appropriately + switch (iObjectsViewed) + { + case EObjectProcess: + title = _L("Processes"); + break; + case EObjectThread: + title = _L("Threads"); + break; + case EObjectChunk: + title = _L("Chunks"); + break; + case EObjectLibrary: + title = _L("Libraries"); + break; + case EObjectServer: + title = _L("Servers"); + break; + case EObjectSemaphore: + title = _L("Semaphores"); + break; + case EObjectMutex: + title = _L("Mutexes"); + break; + case EObjectLogicalDevice: + title = _L("Log. Devices"); + break; + case EObjectPhysicalDevice: + title = _L("Phy. Devices"); + break; + case EObjectLogicalChannel: + title = _L("Log. Channels"); + break; + case EObjectWindow: + title = _L("Window Grps"); + break; + case EObjectDrive: + title = _L("Drives"); + break; + case EObjectHal: + title = _L("HALs"); + break; + default: break; + } + + //set title and resource count + TBuf<2> openingBracket(_L(" (")); + TBuf<1> closingBracket(_L(")")); + iTitle.Format(_L("%S%S%u%S"), &title, &openingBracket, iResourceCount, &closingBracket); + } diff -r 000000000000 -r 9736f095102e testapps/rschandler/TVResourceHandler/group/ABLD.BAT --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/TVResourceHandler/group/ABLD.BAT Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,15 @@ +@ECHO OFF + +REM Bldmake-generated batch file - ABLD.BAT +REM ** DO NOT EDIT ** + +perl -S ABLD.PL "\sf\app\techview\testapps\rschandler\TVResourceHandler\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 +if errorlevel==1 goto CheckPerl +goto End + +:CheckPerl +perl -v >NUL +if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? +goto End + +:End diff -r 000000000000 -r 9736f095102e testapps/rschandler/TVResourceHandler/group/Bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/TVResourceHandler/group/Bld.inf Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,19 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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_MMPFILES + +ResourceHandler.mmp diff -r 000000000000 -r 9736f095102e testapps/rschandler/TVResourceHandler/group/ResourceHandler.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/TVResourceHandler/group/ResourceHandler.mmp Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,67 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies 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 +// +// + +#define TV + + +TARGET resourcehandler.exe +TARGETTYPE exe + +epocstacksize 0x5000 + +UID 0x100039CE 0x101FD147 + +CAPABILITY ProtServ DiskAdmin + +SOURCEPATH ../../Common/src +SOURCE ResourceHandler_Main.cpp +SOURCE ResourceHandler_Application.cpp +SOURCE ResourceHandler_Document.cpp +SOURCE ResourceHandler_AppUi.cpp +SOURCE ResourceHandler_ResourceView.cpp +SOURCE ResourceHandler_Dialogs.cpp +SOURCE ResourceHandler_ResourceList.cpp +SOURCE ResourceHandler_ResourceDetails.cpp + +USERINCLUDE . ../inc ../../Common/inc +APP_LAYER_SYSTEMINCLUDE_SYMBIAN +#ifdef TV +#endif + + +START RESOURCE ../rsc/ResourceHandler.rss + HEADER + TARGETPATH /resource/apps +END + +START RESOURCE ../rsc/ResourceHandler_loc.rss + TARGETPATH /resource/apps +END + +START RESOURCE ../rsc/ResourceHandler_reg.rss + TARGETPATH /private/10003a3f/apps +END + + +LIBRARY euser.lib apparc.lib cone.lib eikcore.lib ws32.lib apgrfx.lib +LIBRARY eikcoctl.lib efsrv.lib eikctl.lib gdi.lib +LIBRARY eikdlg.lib bafl.lib hal.lib +#ifdef UIQ +LIBRARY qikctl.lib +#endif + +VENDORID 0x70000001 diff -r 000000000000 -r 9736f095102e testapps/rschandler/TVResourceHandler/group/Testtools_ResourceHandler_gt.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/TVResourceHandler/group/Testtools_ResourceHandler_gt.mrp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +# + +component Testtools_ResourceHandler_GT + +# This component includes source for Techview, UIQ and Series 60 +# versions of the ResourceHandler application. +# The source is provided as part of the GT package but the +# component will only build when the Techview system +# files are available. + +source \sf\app\techview\testapps\rschandler + +notes_source \component_defs\release.src + + + +ipr T +ipr B \sf\app\techview\testapps\rschandler\docs + diff -r 000000000000 -r 9736f095102e testapps/rschandler/TVResourceHandler/group/Testtools_ResourceHandler_techview.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/TVResourceHandler/group/Testtools_ResourceHandler_techview.mrp Tue Jan 26 15:16:33 2010 +0200 @@ -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: +# + +component Testtools_ResourceHandler_Techview + +# The source is provided as part of the GT package but the +# component will only build when the Techview system +# files are available. + +exports \sf\app\techview\testapps\rschandler\TVResourceHandler\group +binary \sf\app\techview\testapps\rschandler\TVResourceHandler\group all + +notes_source \component_defs\release.src + diff -r 000000000000 -r 9736f095102e testapps/rschandler/TVResourceHandler/group/testtools_resourcehandler_gt.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/TVResourceHandler/group/testtools_resourcehandler_gt.history.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 9736f095102e testapps/rschandler/TVResourceHandler/group/testtools_resourcehandler_techview.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/TVResourceHandler/group/testtools_resourcehandler_techview.history.xml Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 9736f095102e testapps/rschandler/TVResourceHandler/inc/ResourceHandlerPlatform.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testapps/rschandler/TVResourceHandler/inc/ResourceHandlerPlatform.hrh Tue Jan 26 15:16:33 2010 +0200 @@ -0,0 +1,17 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#define TV +#define WINS