os/ossrv/genericopenlibs/posixrealtimeextensions/test/testclock/src/tclockserver.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 // Name : tclockserver.cpp
20 #if defined (__WINS__)
21 #define PDD_NAME _L("ECDRV")
23 #define PDD_NAME _L("EUART1")
24 #define PDD2_NAME _L("EUART2")
25 #define PDD3_NAME _L("EUART3")
26 #define PDD4_NAME _L("EUART4")
29 #define LDD_NAME _L("ECOMM")
31 #include "tclockserver.h"
35 _LIT(KServerName, "tclock");
37 CClockTestServer* CClockTestServer::NewL()
39 CClockTestServer *server = new(ELeave) CClockTestServer();
40 CleanupStack::PushL(server);
41 server->ConstructL(KServerName);
42 CleanupStack::Pop(server);
46 static void InitCommsL()
48 TInt ret = User::LoadPhysicalDevice(PDD_NAME);
49 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
52 ret = User::LoadPhysicalDevice(PDD2_NAME);
53 ret = User::LoadPhysicalDevice(PDD3_NAME);
54 ret = User::LoadPhysicalDevice(PDD4_NAME);
57 ret = User::LoadLogicalDevice(LDD_NAME);
58 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
60 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
65 // Leave the hooks in for platform security
66 #if (defined __DATA_CAGING__)
67 RProcess().DataCaging(RProcess::EDataCagingOn);
68 RProcess().SecureApi(RProcess::ESecureApiOn);
72 CActiveScheduler* sched=NULL;
73 sched=new(ELeave) CActiveScheduler;
74 CActiveScheduler::Install(sched);
75 CClockTestServer* server = NULL;
76 // Create the CTestServer derived server
77 TRAPD(err, server = CClockTestServer::NewL());
80 // Sync with the client and enter the active scheduler
81 RProcess::Rendezvous(KErrNone);
90 * @return Standard Epoc error code on exit
95 CTrapCleanup* cleanup = CTrapCleanup::New();
100 TRAP_IGNORE(MainL());
107 CTestStep* CClockTestServer::CreateTestStep(const TDesC& aStepName)
109 CTestStep* testStep = NULL;
111 if(aStepName == KTestgetclockid1)
113 testStep = new CTestclock(aStepName);
115 if(aStepName == KTestgetclockid2)
117 testStep = new CTestclock(aStepName);
119 if(aStepName == KTestgetclockid3)
121 testStep = new CTestclock(aStepName);
123 if(aStepName == KTestgetclockid4)
125 testStep = new CTestclock(aStepName);
127 if(aStepName == KTestgetclockid5)
129 testStep = new CTestclock(aStepName);
131 if(aStepName == KTestclockresolution1)
133 testStep = new CTestclock(aStepName);
135 if(aStepName == KTestclockresolution2)
137 testStep = new CTestclock(aStepName);
139 if(aStepName == KTestclockresolution3)
141 testStep = new CTestclock(aStepName);
143 if(aStepName == KTestclocknanosleep1)
145 testStep = new CTestclock(aStepName);
147 if(aStepName == KTestclocknanosleep2)
149 testStep = new CTestclock(aStepName);
151 if(aStepName == KTestclocknanosleep3)
153 testStep = new CTestclock(aStepName);
155 if(aStepName == KTestclocknanosleep4)
157 testStep = new CTestclock(aStepName);
159 if(aStepName == KTestclocknanosleep5)
161 testStep = new CTestclock(aStepName);
163 if(aStepName == KTestclocknanosleep6)
165 testStep = new CTestclock(aStepName);
167 if(aStepName == KTestclockgettime1)
169 testStep = new CTestclock(aStepName);
171 if(aStepName == KTestclockgettime2)
173 testStep = new CTestclock(aStepName);
175 if(aStepName == KTestclockgettime3)
177 testStep = new CTestclock(aStepName);
179 if(aStepName == KTestclocksettime1)
181 testStep = new CTestclock(aStepName);
183 if(aStepName == KTestclocksettime2)
185 testStep = new CTestclock(aStepName);
187 if(aStepName == KTestclocksettime3)
189 testStep = new CTestclock(aStepName);