sysstatemgmt/systemstateplugins/test/tintadptplugin/src/tiadaptation_plugin.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code 
       
    20 */
       
    21 #include "ssmdebug.h" 
       
    22 #include "tiadaptation_plugin.h"
       
    23 #include "tstate_adaptationplugin_step.h"
       
    24 #include "tstatenotify_adaptationplugin_step.h"
       
    25 #include "tsim_adaptationplugin_step.h"
       
    26 #include "trtc_adaptationplugin_step.h"
       
    27 #include "tmisc_adaptationplugin_step.h"
       
    28 #include "temergencycallrf_adaptationplugin_step.h"
       
    29 
       
    30 
       
    31 CAdaptationPluginTestServer* CAdaptationPluginTestServer::NewLC( )
       
    32 	{
       
    33 	CAdaptationPluginTestServer * server = new (ELeave) CAdaptationPluginTestServer();
       
    34 	CleanupStack::PushL(server);
       
    35 	TParsePtrC serverName(RProcess().FileName());	
       
    36 	server->StartL(serverName.Name());
       
    37 	return server;
       
    38 	}
       
    39 
       
    40 static void MainL()
       
    41 	{
       
    42 	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
       
    43 	CleanupStack::PushL (sched);
       
    44 	CActiveScheduler::Install (sched);
       
    45 
       
    46 	CAdaptationPluginTestServer* server = CAdaptationPluginTestServer::NewLC( );
       
    47 	RProcess::Rendezvous (KErrNone );
       
    48 	sched->Start( );
       
    49 
       
    50 	CleanupStack::PopAndDestroy (server );
       
    51 	CleanupStack::PopAndDestroy (sched );
       
    52 	}
       
    53 
       
    54 /**
       
    55  Process entry point. Called by client using RProcess API
       
    56  @return - Standard Epoc error code on process exit
       
    57  */
       
    58 TInt E32Main(void)
       
    59 	{
       
    60 	__UHEAP_MARK;
       
    61 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    62 	if(cleanup == NULL)
       
    63 		{
       
    64 		return KErrNoMemory;
       
    65 		}
       
    66 	TRAPD(err,MainL());	
       
    67 	if (err)
       
    68 		{
       
    69 #ifdef _DEBUG
       
    70 		_LIT(KMainErrorStatement, "CAdaptationPluginTestServer::MainL - Error: %d");
       
    71 	   	User::Panic(KMainErrorStatement, err);
       
    72 #endif
       
    73 	   	SSMLOGLEAVE(err);
       
    74 		}		
       
    75 	delete cleanup;
       
    76 		
       
    77 	__UHEAP_MARKEND;
       
    78 	return KErrNone;
       
    79 	}
       
    80 
       
    81 /**
       
    82  @return - A CTestStep derived instance
       
    83  */
       
    84 CTestStep* CAdaptationPluginTestServer::CreateTestStep(const TDesC& aStepName )
       
    85 	{
       
    86 	CTestStep* testStep = NULL;
       
    87 	if (aStepName == KTCTestSimAdaptStep)
       
    88 		{
       
    89 		testStep = new CTestSimAdaptStep();
       
    90 		}	
       
    91 	else if (aStepName == KTCTestStateAdaptStep)
       
    92 		{
       
    93 		testStep = new CTestStateAdaptStep();
       
    94 		}
       
    95 	else if (aStepName == KTCTestStateNotifyAdaptStep)
       
    96 		{
       
    97 		testStep = new CTestStateNotifyAdaptStep();
       
    98 		}	
       
    99 	else if (aStepName == KTCTestRtcAdaptStep)
       
   100 		{
       
   101 		testStep = new CTestRtcAdaptStep();
       
   102 		}
       
   103 	else if (aStepName == KTCTestMiscAdaptStep)
       
   104 		{
       
   105 		testStep = new CTestMiscAdaptStep();
       
   106 		}
       
   107 	else if (aStepName == KTCTestEmergencyAdaptStep)
       
   108 		{
       
   109 		testStep = new CTestEmergencyAdaptStep();
       
   110 		}	
       
   111 	else
       
   112 		{
       
   113 		DEBUGPRINT2(_L("Unknown Adaptation step %S"), &aStepName);
       
   114 	   //	User::Panic(KTCTestStateAdaptationPlugin, KErrArgument);
       
   115 		}
       
   116 
       
   117 	return testStep;
       
   118 	}