os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/CapTestServer/src/CapTestServer.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/CapTestServer/src/CapTestServer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,123 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Test code to develop a TestExecute Server
    1.18 +// for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
    1.19 +// in the process of the client. The client initialises the server by calling the
    1.20 +// one and only ordinal.
    1.21 +// 
    1.22 +//
    1.23 +
    1.24 +/**
    1.25 + @file CapTestServer.cpp
    1.26 +*/
    1.27 +
    1.28 +#include <simulprocclient.h>
    1.29 +
    1.30 +#include "CapTestServer.h"
    1.31 +#include "CapTestStep0012.h"
    1.32 +#include "CapTestStep0014.h"
    1.33 +
    1.34 +
    1.35 +_LIT(KServerName,"CapTestServer");
    1.36 +CCapTestServer* CCapTestServer::NewL()
    1.37 +/**
    1.38 + * @return - Instance of the test server
    1.39 + * Called inside the MainL() function to create and start the
    1.40 + * CTestServer derived server.
    1.41 + */
    1.42 +	{
    1.43 +	CCapTestServer * server = new (ELeave) CCapTestServer();
    1.44 +	CleanupStack::PushL(server);
    1.45 +	
    1.46 +	// Either use a StartL or ConstructL, the latter will permit
    1.47 +	// Server Logging.
    1.48 +	server->StartL(KServerName); 
    1.49 +
    1.50 +	//server-> ConstructL(KServerName);
    1.51 +	CleanupStack::Pop(server);
    1.52 +	return server;
    1.53 +	}
    1.54 +	
    1.55 +CCapTestServer::CCapTestServer()
    1.56 +	{
    1.57 +	}
    1.58 +	
    1.59 +CCapTestServer::~CCapTestServer()
    1.60 +	{
    1.61 +	}
    1.62 +	
    1.63 +
    1.64 +// EKA2 much simpler
    1.65 +// Just an E32Main and a MainL()
    1.66 +LOCAL_C void MainL()
    1.67 +/**
    1.68 + * Much simpler, uses the new Rendezvous() call to sync with the client
    1.69 + */
    1.70 +	{
    1.71 +	// Leave the hooks in for platform security
    1.72 +#if (defined __DATA_CAGING__)
    1.73 +	RProcess().DataCaging(RProcess::EDataCagingOn);
    1.74 +	RProcess().SecureApi(RProcess::ESecureApiOn);
    1.75 +#endif
    1.76 +	CActiveScheduler* sched=NULL;
    1.77 +	sched=new(ELeave) CActiveScheduler;
    1.78 +	CActiveScheduler::Install(sched);
    1.79 +	CCapTestServer* server = NULL;
    1.80 +	// Create the CTestServer derived server
    1.81 +	TRAPD(err,server = CCapTestServer::NewL());
    1.82 +	if(!err)
    1.83 +		{
    1.84 +		// Sync with the client and enter the active scheduler
    1.85 +		RProcess::Rendezvous(KErrNone);
    1.86 +		sched->Start();
    1.87 +		}
    1.88 +	delete server;
    1.89 +	delete sched;
    1.90 +	}
    1.91 +
    1.92 +
    1.93 +GLDEF_C TInt E32Main()
    1.94 +/**
    1.95 + * @return - Standard Epoc error code on exit
    1.96 + */
    1.97 +	{
    1.98 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.99 +	if(cleanup == NULL)
   1.100 +		{
   1.101 +		return KErrNoMemory;
   1.102 +		}
   1.103 +	TRAP_IGNORE(MainL());
   1.104 +	delete cleanup;
   1.105 +	return KErrNone;
   1.106 +    }
   1.107 +
   1.108 +
   1.109 +CSimulProcTestStep* CCapTestServer::CreateTestStep(const TDesC& aStepName) const
   1.110 +/**
   1.111 + * @return - A CTestStep derived instance
   1.112 + * Implementation of CTestServer pure virtual
   1.113 + */
   1.114 +	{
   1.115 +	CSimulProcTestStep* testStep = NULL; 
   1.116 +	// This server creates just one step but create as many as you want
   1.117 +	// They are created "just in time" when the worker thread is created
   1.118 +
   1.119 +	if(aStepName == _L("CapTestStep0012"))
   1.120 +		testStep = CAudPlayUtilTS0012::NewL();
   1.121 +	else if(aStepName == _L("CapTestStep0014"))
   1.122 +		testStep = CAudPlayUtilTS0014::NewL();
   1.123 +
   1.124 +	return testStep;
   1.125 +	}
   1.126 +