os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/CapTestServer/src/CapTestServer.cpp
Update contrib.
1 // Copyright (c) 2002-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Test code to develop a TestExecute Server
15 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
16 // in the process of the client. The client initialises the server by calling the
17 // one and only ordinal.
22 @file CapTestServer.cpp
25 #include <simulprocclient.h>
27 #include "CapTestServer.h"
28 #include "CapTestStep0012.h"
29 #include "CapTestStep0014.h"
32 _LIT(KServerName,"CapTestServer");
33 CCapTestServer* CCapTestServer::NewL()
35 * @return - Instance of the test server
36 * Called inside the MainL() function to create and start the
37 * CTestServer derived server.
40 CCapTestServer * server = new (ELeave) CCapTestServer();
41 CleanupStack::PushL(server);
43 // Either use a StartL or ConstructL, the latter will permit
45 server->StartL(KServerName);
47 //server-> ConstructL(KServerName);
48 CleanupStack::Pop(server);
52 CCapTestServer::CCapTestServer()
56 CCapTestServer::~CCapTestServer()
62 // Just an E32Main and a MainL()
65 * Much simpler, uses the new Rendezvous() call to sync with the client
68 // Leave the hooks in for platform security
69 #if (defined __DATA_CAGING__)
70 RProcess().DataCaging(RProcess::EDataCagingOn);
71 RProcess().SecureApi(RProcess::ESecureApiOn);
73 CActiveScheduler* sched=NULL;
74 sched=new(ELeave) CActiveScheduler;
75 CActiveScheduler::Install(sched);
76 CCapTestServer* server = NULL;
77 // Create the CTestServer derived server
78 TRAPD(err,server = CCapTestServer::NewL());
81 // Sync with the client and enter the active scheduler
82 RProcess::Rendezvous(KErrNone);
90 GLDEF_C TInt E32Main()
92 * @return - Standard Epoc error code on exit
95 CTrapCleanup* cleanup = CTrapCleanup::New();
100 TRAP_IGNORE(MainL());
106 CSimulProcTestStep* CCapTestServer::CreateTestStep(const TDesC& aStepName) const
108 * @return - A CTestStep derived instance
109 * Implementation of CTestServer pure virtual
112 CSimulProcTestStep* testStep = NULL;
113 // This server creates just one step but create as many as you want
114 // They are created "just in time" when the worker thread is created
116 if(aStepName == _L("CapTestStep0012"))
117 testStep = CAudPlayUtilTS0012::NewL();
118 else if(aStepName == _L("CapTestStep0014"))
119 testStep = CAudPlayUtilTS0014::NewL();