lbstest/lbstestproduct/lbsfeatures/src/ctlbsfeaturesserver.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     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 // @file CTLbsFeaturesServer.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 // System includes
       
    19 #include <e32std.h>
       
    20 
       
    21 // User includes
       
    22 #include "ctlbsfeaturesserver.h"
       
    23 #include "te_lbsfeaturespsystep.h"
       
    24 #include "ctlbsfeaturesbtpsystep.h"
       
    25 
       
    26 /**
       
    27   MainL()
       
    28   Description :		This is the main function which installs the 
       
    29 					active scheduler and creates a server
       
    30   @internalTechnology
       
    31   @param  none
       
    32   @return none
       
    33   @pre    None
       
    34   @post   None
       
    35 */
       
    36 LOCAL_C void MainL()
       
    37 	{
       
    38 	CActiveScheduler* sched = new (ELeave) CActiveScheduler;
       
    39 	CleanupStack::PushL(sched);
       
    40 	CActiveScheduler::Install(sched);
       
    41 
       
    42 	__UHEAP_MARK;
       
    43 	// this registers the server with the active scheduler and calls SetActive
       
    44 	CT_LbsFeaturesServer* server = CT_LbsFeaturesServer::NewL();
       
    45 
       
    46 	// signal to the client that we are ready by
       
    47 	// rendevousing process
       
    48 	RProcess::Rendezvous(KErrNone);
       
    49 
       
    50 	// run the active scheduler
       
    51 	sched->Start();
       
    52 
       
    53 	// clean up
       
    54 	delete server;
       
    55 	__UHEAP_MARKEND;
       
    56 	CleanupStack::PopAndDestroy(sched);
       
    57 	}
       
    58 
       
    59 
       
    60 
       
    61 
       
    62 /**
       
    63   E32Main()
       
    64   Description :	It is the entry point 
       
    65   @internalTechnology
       
    66   @param  none
       
    67   @return Returns the error code
       
    68   @pre    None
       
    69   @post   None
       
    70 */
       
    71 GLDEF_C TInt E32Main()
       
    72 	{
       
    73 	__UHEAP_MARK;
       
    74 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    75 	if(cleanup == NULL)
       
    76 		{
       
    77 		return KErrNoMemory;
       
    78 		}
       
    79 
       
    80 	TRAPD(err, MainL());
       
    81 
       
    82 	delete cleanup;
       
    83 	__UHEAP_MARKEND;
       
    84 
       
    85 	return err;
       
    86 	}
       
    87     
       
    88 
       
    89 
       
    90 /**
       
    91   NewL()
       
    92   Constructs a CT_LbsFeaturesServer object.
       
    93   Uses two phase construction and leaves nothing on the CleanupStack.
       
    94   @internalTechnology
       
    95   @param  none
       
    96   @return Created object of type CT_LbsClientServer
       
    97   @pre    None
       
    98   @post   None
       
    99 */
       
   100 CT_LbsFeaturesServer* CT_LbsFeaturesServer::NewL()
       
   101 	{
       
   102 	CT_LbsFeaturesServer* server = new(ELeave) CT_LbsFeaturesServer();
       
   103 	CleanupStack::PushL(server);
       
   104 	server->ConstructL(KLbsFeaturesTestServer);
       
   105 	CleanupStack::Pop(server);
       
   106 	return server;
       
   107 	}
       
   108 
       
   109 
       
   110 CT_LbsFeaturesServer::~CT_LbsFeaturesServer()
       
   111 	{
       
   112 	}
       
   113 	
       
   114 	
       
   115 /**
       
   116   Function : CT_LbsFeaturesServer
       
   117   Description : Constructor
       
   118   @internalTechnology
       
   119   @param :
       
   120   @return : N/A
       
   121   @precondition : none
       
   122   @postcondition : none
       
   123 */
       
   124 CT_LbsFeaturesServer::CT_LbsFeaturesServer()
       
   125 	{
       
   126 	}
       
   127 
       
   128 /**
       
   129   Function : ConstructL
       
   130   Description : 
       
   131   @internalTechnology
       
   132   @param :
       
   133   @return : N/A
       
   134   @precondition : none
       
   135   @postcondition : none
       
   136 */
       
   137 void CT_LbsFeaturesServer::ConstructL(const TDesC& aName)
       
   138 	{
       
   139 	CTestServer::ConstructL(aName);
       
   140 	}
       
   141 
       
   142 	
       
   143 /**
       
   144   Function : CreateTestStep
       
   145   Description : Creates a test step based on the step name read from the script file
       
   146   @internalTechnology
       
   147   @param : aStepName   The step name which needs to be created
       
   148   @return : Created object of type CTestStep
       
   149   @precondition : none
       
   150   @postcondition : none
       
   151 */
       
   152 CTestStep* CT_LbsFeaturesServer::CreateTestStep(const TDesC& aStepName)
       
   153 	{
       
   154 	// NULL if insufficient memory. This suits the API.
       
   155 
       
   156 	// Test case test steps, each test step supports one or more test cases.
       
   157 	if(aStepName == KLbsFeaturesPsy)
       
   158 		{
       
   159 		return CT_LbsFeaturesPsyStep::New();
       
   160 		}
       
   161 	if (aStepName == KLbsFeaturesBTPSY)	
       
   162 		{
       
   163 		return CT_LbsFeaturesBTPSYStep::New();
       
   164 		}
       
   165 		
       
   166 	// Let base class handle any common test steps - will return NULL if test step is not supported.
       
   167 	return NULL;
       
   168 	}
       
   169