os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/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 // Example file/test code to demonstrate how to develop a TestExecute Server
15 // Developers should take this project as a template and substitute their own
16 // code at the __EDIT_ME__ tags
17 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
18 // in the process of the client. The client initialises the server by calling the
19 // one and only ordinal.
24 @file CapTestServer.cpp
27 #include <simulprocclient.h>
29 #include "CapTestServer.h"
30 #include "CapTestStep0002.h"
31 #include "CapTestStep0004.h"
32 #include "CapTestStep0006.h"
33 #include "CapTestStep0008.h"
34 #include "CapTestStep0010.h"
35 #include "CapTestStep0036.h"
37 _LIT(KServerName,"SDSCapTestServer");
38 // __EDIT_ME__ - Use your own server class name
39 CCapTestServer* CCapTestServer::NewL()
41 * @return - Instance of the test server
42 * Called inside the MainL() function to create and start the
43 * CTestServer derived server.
46 // __EDIT_ME__ new your server class here
47 CCapTestServer * server = new (ELeave) CCapTestServer();
48 CleanupStack::PushL(server);
50 // Either use a StartL or ConstructL, the latter will permit
53 server->StartL(KServerName);
54 //server-> ConstructL(KServerName);
55 CleanupStack::Pop(server);
59 CSession2* CCapTestServer::NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const
61 // Retrieve client's thread Id
63 aMessage.ClientL(clientThread);
64 const_cast<CCapTestServer*>(this)->iClientThreadId = clientThread.Id();
67 return CSimulProcServer::NewSessionL(aVersion, aMessage);
70 CCapTestServer::CCapTestServer()
74 CCapTestServer::~CCapTestServer()
80 // Just an E32Main and a MainL()
83 * Much simpler, uses the new Rendezvous() call to sync with the client
86 // Leave the hooks in for platform security
87 #if (defined __DATA_CAGING__)
88 RProcess().DataCaging(RProcess::EDataCagingOn);
89 RProcess().SecureApi(RProcess::ESecureApiOn);
91 CActiveScheduler* sched=NULL;
92 sched=new(ELeave) CActiveScheduler;
93 CActiveScheduler::Install(sched);
94 // __EDIT_ME__ Your server name
95 CCapTestServer* server = NULL;
96 // Create the CTestServer derived server
97 // __EDIT_ME__ Your server name
98 TRAPD(err,server = CCapTestServer::NewL());
101 // Sync with the client and enter the active scheduler
102 RProcess::Rendezvous(KErrNone);
110 GLDEF_C TInt E32Main()
112 * @return - Standard Epoc error code on exit
115 CTrapCleanup* cleanup = CTrapCleanup::New();
120 TRAP_IGNORE(MainL());
126 CSimulProcTestStep* CCapTestServer::CreateTestStep(const TDesC& aStepName) const
128 * @return - A CTestStep derived instance
129 * Implementation of CTestServer pure virtual
132 CSimulProcTestStep* testStep = NULL;
133 // __EDIT_ME__ - Create your own test steps here
134 // This server creates just one step but create as many as you want
135 // They are created "just in time" when the worker thread is created
137 if(aStepName == _L("SecDevSndTS0002"))
138 testStep = CSecDevSndTS0002::NewL();
139 else if(aStepName == _L("SecDevSndTS0004"))
140 testStep = CSecDevSndTS0004::NewL();
141 else if(aStepName == _L("SecDevSndTS0006"))
142 testStep = CSecDevSndTS0006::NewL();
143 else if(aStepName == _L("SecDevSndTS0008"))
144 testStep = CSecDevSndTS0008::NewL();
145 else if(aStepName == _L("SecDevSndTS0010"))
146 testStep = CSecDevSndTS0010::NewL();
147 else if(aStepName == _L("SecDevSndTS0036"))
148 testStep = CSecDevSndTS0036::NewL(iClientThreadId);