os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/mmddtestserver.cpp
Update contrib.
1 // Copyright (c) 2008-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 mmddtestserver.cpp
27 #include <simulprocclient.h>
28 #include "mmddtestserver.h"
29 #include "mmddteststep0036.h"
31 _LIT(KServerName,"SDSMMDDTestServer");
32 // __EDIT_ME__ - Use your own server class name
33 CMMDDTestServer* CMMDDTestServer::NewL()
35 * @return - Instance of the test server
36 * Called inside the MainL() function to create and start the
37 * CMMDDTestServer derived server.
40 // __EDIT_ME__ new your server class here
41 CMMDDTestServer * server = new (ELeave) CMMDDTestServer();
42 CleanupStack::PushL(server);
44 // Either use a StartL or ConstructL, the latter will permit
47 server->StartL(KServerName);
48 //server-> ConstructL(KServerName);
49 CleanupStack::Pop(server);
53 CSession2* CMMDDTestServer::NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const
55 // Retrieve client's thread Id
57 aMessage.ClientL(clientThread);
58 const_cast<CMMDDTestServer*>(this)->iClientThreadId = clientThread.Id();
61 return CSimulProcServer::NewSessionL(aVersion, aMessage);
64 CMMDDTestServer::CMMDDTestServer()
68 CMMDDTestServer::~CMMDDTestServer()
74 // Just an E32Main and a MainL()
77 * Much simpler, uses the new Rendezvous() call to sync with the client
80 // Leave the hooks in for platform security
81 #if (defined __DATA_CAGING__)
82 RProcess().DataCaging(RProcess::EDataCagingOn);
83 RProcess().SecureApi(RProcess::ESecureApiOn);
85 CActiveScheduler* sched=NULL;
86 sched=new(ELeave) CActiveScheduler;
87 CActiveScheduler::Install(sched);
88 // __EDIT_ME__ Your server name
89 CMMDDTestServer* server = NULL;
90 // Create the CMMDDTestServer derived server
91 // __EDIT_ME__ Your server name
92 TRAPD(err,server = CMMDDTestServer::NewL());
95 // Sync with the client and enter the active scheduler
96 RProcess::Rendezvous(KErrNone);
104 GLDEF_C TInt E32Main()
106 * @return - Standard Epoc error code on exit
109 CTrapCleanup* cleanup = CTrapCleanup::New();
114 TRAP_IGNORE(MainL());
120 CSimulProcTestStep* CMMDDTestServer::CreateTestStep(const TDesC& aStepName) const
122 * @return - A CTestStep derived instance
123 * Implementation of CTestServer pure virtual
126 CSimulProcTestStep* testStep = NULL;
127 // __EDIT_ME__ - Create your own test steps here
128 // This server creates just one step but create as many as you want
129 // They are created "just in time" when the worker thread is created
131 if(aStepName == _L("SecDevSndTS0036"))
132 testStep = CSecDevSndTS0036::NewL(iClientThreadId);