os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/DSCapTestServer/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/DSCapTestServer/CapTestServer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,135 @@
     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 +// Example file/test code to demonstrate how to develop a TestExecute Server
    1.18 +// Developers should take this project as a template and substitute their own
    1.19 +// code at the __EDIT_ME__ tags
    1.20 +// for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
    1.21 +// in the process of the client. The client initialises the server by calling the
    1.22 +// one and only ordinal.
    1.23 +// 
    1.24 +//
    1.25 +
    1.26 +/**
    1.27 + @file CapTestServer.cpp
    1.28 +*/
    1.29 +
    1.30 +#include <simulprocclient.h>
    1.31 +
    1.32 +#include "CapTestServer.h"
    1.33 +//#include "CapTestStep.h"
    1.34 +#include "DevSoundServerTestStep.h"
    1.35 +
    1.36 +
    1.37 +
    1.38 +_LIT(KServerName,"DSCapTestServer");
    1.39 +// __EDIT_ME__ - Use your own server class name
    1.40 +CCapTestServer* CCapTestServer::NewL()
    1.41 +/**
    1.42 + * @return - Instance of the test server
    1.43 + * Called inside the MainL() function to create and start the
    1.44 + * CTestServer derived server.
    1.45 + */
    1.46 +	{
    1.47 +	// __EDIT_ME__ new your server class here
    1.48 +	CCapTestServer * server = new (ELeave) CCapTestServer();
    1.49 +	CleanupStack::PushL(server);
    1.50 +	
    1.51 +	// Either use a StartL or ConstructL, the latter will permit
    1.52 +	// Server Logging.
    1.53 +
    1.54 +	server->StartL(KServerName); 
    1.55 +	//server-> ConstructL(KServerName);
    1.56 +	CleanupStack::Pop(server);
    1.57 +	return server;
    1.58 +	}
    1.59 +	
    1.60 +CCapTestServer::CCapTestServer()
    1.61 +	{
    1.62 +	}
    1.63 +	
    1.64 +CCapTestServer::~CCapTestServer()
    1.65 +	{
    1.66 +	}
    1.67 +	
    1.68 +
    1.69 +// EKA2 much simpler
    1.70 +// Just an E32Main and a MainL()
    1.71 +LOCAL_C void MainL()
    1.72 +/**
    1.73 + * Much simpler, uses the new Rendezvous() call to sync with the client
    1.74 + */
    1.75 +	{
    1.76 +	// Leave the hooks in for platform security
    1.77 +#if (defined __DATA_CAGING__)
    1.78 +	RProcess().DataCaging(RProcess::EDataCagingOn);
    1.79 +	RProcess().SecureApi(RProcess::ESecureApiOn);
    1.80 +#endif
    1.81 +	CActiveScheduler* sched=NULL;
    1.82 +	sched=new(ELeave) CActiveScheduler;
    1.83 +	CActiveScheduler::Install(sched);
    1.84 +	// __EDIT_ME__ Your server name
    1.85 +	CCapTestServer* server = NULL;
    1.86 +	// Create the CTestServer derived server
    1.87 +	// __EDIT_ME__ Your server name
    1.88 +	TRAPD(err,server = CCapTestServer::NewL());
    1.89 +	if(!err)
    1.90 +		{
    1.91 +		// Sync with the client and enter the active scheduler
    1.92 +		RProcess::Rendezvous(KErrNone);
    1.93 +		sched->Start();
    1.94 +		}
    1.95 +	delete server;
    1.96 +	delete sched;
    1.97 +	}
    1.98 +
    1.99 +
   1.100 +GLDEF_C TInt E32Main()
   1.101 +/**
   1.102 + * @return - Standard Epoc error code on exit
   1.103 + */
   1.104 +	{
   1.105 +	CTrapCleanup* cleanup = CTrapCleanup::New();
   1.106 +	if(cleanup == NULL)
   1.107 +		{
   1.108 +		return KErrNoMemory;
   1.109 +		}
   1.110 +	TRAP_IGNORE(MainL());
   1.111 +	delete cleanup;
   1.112 +	return KErrNone;
   1.113 +    }
   1.114 +
   1.115 +
   1.116 +//Add TestStep
   1.117 +CSimulProcTestStep* CCapTestServer::CreateTestStep(const TDesC& aStepName) const
   1.118 +/**
   1.119 + * @return - A CTestStep derived instance
   1.120 + * Implementation of CTestServer pure virtual
   1.121 + */
   1.122 +	{
   1.123 +	CSimulProcTestStep* testStep = NULL; 
   1.124 +	// __EDIT_ME__ - Create your own test steps here
   1.125 +	// This server creates just one step but create as many as you want
   1.126 +	// They are created "just in time" when the worker thread is created
   1.127 +	
   1.128 +	//
   1.129 +	//1) SDevSound IntTest: Access DevSoundServer test mm-mmf-sdevsound-i-0016
   1.130 +	if(aStepName == _L("CSDevSoundTestStep1"))
   1.131 +		{
   1.132 +		testStep = CSDevSoundTestStep1::NewL();
   1.133 +		}
   1.134 +	
   1.135 +
   1.136 +	return testStep;
   1.137 +	}
   1.138 +