messagingappbase/smsmtm/clientmtm/test/src/smcmserver.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "smcmserver.h"
       
    17 
       
    18 #include "smcmstepinitialise.h"
       
    19 #include "smcmstepfind.h"
       
    20 #include "smcmstepfindalias.h"
       
    21 #include "smcmstepforward.h"
       
    22 #include "smcmstepforwardemail.h"
       
    23 #include "smcmstepreply.h"
       
    24 #include "smcmstepreplyemail.h"
       
    25 #include "smcmstepquerycapabilities.h"
       
    26 #include "smcmstepsettings.h"
       
    27 
       
    28 
       
    29 _LIT(KServerName,"smcmsuite_gsm");
       
    30 
       
    31 CSmsServer::CSmsServer( )
       
    32 	{
       
    33 
       
    34 	}
       
    35 
       
    36 
       
    37 // @return - Instance of the test server
       
    38 // Called inside the MainL() function to create and start the
       
    39 // CTestServer derived server.
       
    40 CSmsServer* CSmsServer::NewL()
       
    41 	{
       
    42 	CSmsServer* server = new (ELeave) CSmsServer();
       
    43 	CleanupStack::PushL(server);
       
    44 	server->ConstructL(KServerName);
       
    45 
       
    46 	CleanupStack::Pop(server);
       
    47 	return server;
       
    48 	}
       
    49 
       
    50 void CSmsServer::ConstructL( const TDesC& aName )
       
    51 	{
       
    52 	CTestServer::ConstructL( aName );
       
    53 	}
       
    54 	
       
    55 LOCAL_C void MainL()
       
    56 	{
       
    57 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    58  	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    59 		
       
    60 	CActiveScheduler* sched=NULL;
       
    61 	sched=new(ELeave) CActiveScheduler;
       
    62 	CActiveScheduler::Install(sched);
       
    63 	CSmsServer* server = NULL;
       
    64 	// Create the CTestServer derived server
       
    65 	TRAPD(err,server = CSmsServer::NewL());
       
    66 	if(!err)
       
    67 		{
       
    68 		// Sync with the client and enter the active scheduler
       
    69 		RProcess::Rendezvous(KErrNone);
       
    70 		sched->Start();
       
    71 		}
       
    72 	delete server;
       
    73 	server = NULL;
       
    74 	delete sched;
       
    75 	}
       
    76 
       
    77 
       
    78 // @return - Standard Epoc error code on exit
       
    79 GLDEF_C TInt E32Main()
       
    80 	{
       
    81 	__UHEAP_MARK;
       
    82 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    83 	if(cleanup == NULL)
       
    84 		{
       
    85 		return KErrNoMemory;
       
    86 		}
       
    87 	TRAPD(err,MainL());
       
    88 	delete cleanup;
       
    89 	__UHEAP_MARKEND;
       
    90 	return err;
       
    91     }
       
    92 
       
    93 
       
    94 // @return - A CTestStep derived instance
       
    95 // Implementation of CTestServer pure virtual
       
    96 CTestStep* CSmsServer::CreateTestStep(const TDesC& aStepName)
       
    97 	{
       
    98 	CTestStep* testStep = NULL;
       
    99 
       
   100 	//StaticSystemInformation
       
   101 	if( aStepName == KSMCMStepInitialise )
       
   102 		{
       
   103 		testStep = new CSMCMStepInitialise( );
       
   104 		}
       
   105 	else if ( aStepName == KSMCMStepFind )
       
   106 		{
       
   107 		testStep = new CSMCMStepFind( );
       
   108 		}
       
   109 	else if ( aStepName == KSMCMStepFindAlias )
       
   110 		{
       
   111 		testStep = new CSMCMStepFindAlias( );
       
   112 		}
       
   113 	else if ( aStepName == KSMCMStepForward )
       
   114 		{
       
   115 		testStep = new CSMCMStepForward( );
       
   116 		}
       
   117 	else if ( aStepName == KSMCMStepForwardEmail )
       
   118 		{
       
   119 		testStep = new CSMCMStepForwardEmail( );
       
   120 		}
       
   121 	else if ( aStepName == KSMCMStepQueryCapabilities )
       
   122 		{
       
   123 		testStep = new CSMCMStepQueryCapabilities( );
       
   124 		}
       
   125 	else if ( aStepName == KSMCMStepReply )
       
   126 		{
       
   127 		testStep = new CSMCMStepReply( );
       
   128 		}
       
   129 	else if ( aStepName == KSMCMStepReplyEmail )
       
   130 		{
       
   131 		testStep = new CSMCMStepReplyEmail( );
       
   132 		}
       
   133 	else if ( aStepName == KSMCMStepSettings )
       
   134 		{
       
   135 		testStep = new CSMCMStepSettings( );
       
   136 		}
       
   137 
       
   138 	return testStep;
       
   139 	
       
   140 	}