author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 2 |
// All rights reserved. |
sl@0 | 3 |
// This component and the accompanying materials are made available |
sl@0 | 4 |
// under the terms of "Eclipse Public License v1.0" |
sl@0 | 5 |
// which accompanies this distribution, and is available |
sl@0 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 7 |
// |
sl@0 | 8 |
// Initial Contributors: |
sl@0 | 9 |
// Nokia Corporation - initial contribution. |
sl@0 | 10 |
// |
sl@0 | 11 |
// Contributors: |
sl@0 | 12 |
// |
sl@0 | 13 |
// Description: |
sl@0 | 14 |
// Name : tclockserver.cpp |
sl@0 | 15 |
// |
sl@0 | 16 |
// |
sl@0 | 17 |
|
sl@0 | 18 |
#include <c32comm.h> |
sl@0 | 19 |
|
sl@0 | 20 |
#if defined (__WINS__) |
sl@0 | 21 |
#define PDD_NAME _L("ECDRV") |
sl@0 | 22 |
#else |
sl@0 | 23 |
#define PDD_NAME _L("EUART1") |
sl@0 | 24 |
#define PDD2_NAME _L("EUART2") |
sl@0 | 25 |
#define PDD3_NAME _L("EUART3") |
sl@0 | 26 |
#define PDD4_NAME _L("EUART4") |
sl@0 | 27 |
#endif |
sl@0 | 28 |
|
sl@0 | 29 |
#define LDD_NAME _L("ECOMM") |
sl@0 | 30 |
|
sl@0 | 31 |
#include "tclockserver.h" |
sl@0 | 32 |
#include "tclock.h" |
sl@0 | 33 |
|
sl@0 | 34 |
|
sl@0 | 35 |
_LIT(KServerName, "tclock"); |
sl@0 | 36 |
|
sl@0 | 37 |
CClockTestServer* CClockTestServer::NewL() |
sl@0 | 38 |
{ |
sl@0 | 39 |
CClockTestServer *server = new(ELeave) CClockTestServer(); |
sl@0 | 40 |
CleanupStack::PushL(server); |
sl@0 | 41 |
server->ConstructL(KServerName); |
sl@0 | 42 |
CleanupStack::Pop(server); |
sl@0 | 43 |
return server; |
sl@0 | 44 |
} |
sl@0 | 45 |
|
sl@0 | 46 |
static void InitCommsL() |
sl@0 | 47 |
{ |
sl@0 | 48 |
TInt ret = User::LoadPhysicalDevice(PDD_NAME); |
sl@0 | 49 |
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
sl@0 | 50 |
|
sl@0 | 51 |
#ifndef __WINS__ |
sl@0 | 52 |
ret = User::LoadPhysicalDevice(PDD2_NAME); |
sl@0 | 53 |
ret = User::LoadPhysicalDevice(PDD3_NAME); |
sl@0 | 54 |
ret = User::LoadPhysicalDevice(PDD4_NAME); |
sl@0 | 55 |
#endif |
sl@0 | 56 |
|
sl@0 | 57 |
ret = User::LoadLogicalDevice(LDD_NAME); |
sl@0 | 58 |
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
sl@0 | 59 |
ret = StartC32(); |
sl@0 | 60 |
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
sl@0 | 61 |
} |
sl@0 | 62 |
|
sl@0 | 63 |
LOCAL_C void MainL() |
sl@0 | 64 |
{ |
sl@0 | 65 |
// Leave the hooks in for platform security |
sl@0 | 66 |
#if (defined __DATA_CAGING__) |
sl@0 | 67 |
RProcess().DataCaging(RProcess::EDataCagingOn); |
sl@0 | 68 |
RProcess().SecureApi(RProcess::ESecureApiOn); |
sl@0 | 69 |
#endif |
sl@0 | 70 |
//InitCommsL(); |
sl@0 | 71 |
|
sl@0 | 72 |
CActiveScheduler* sched=NULL; |
sl@0 | 73 |
sched=new(ELeave) CActiveScheduler; |
sl@0 | 74 |
CActiveScheduler::Install(sched); |
sl@0 | 75 |
CClockTestServer* server = NULL; |
sl@0 | 76 |
// Create the CTestServer derived server |
sl@0 | 77 |
TRAPD(err, server = CClockTestServer::NewL()); |
sl@0 | 78 |
if(!err) |
sl@0 | 79 |
{ |
sl@0 | 80 |
// Sync with the client and enter the active scheduler |
sl@0 | 81 |
RProcess::Rendezvous(KErrNone); |
sl@0 | 82 |
sched->Start(); |
sl@0 | 83 |
} |
sl@0 | 84 |
delete server; |
sl@0 | 85 |
delete sched; |
sl@0 | 86 |
} |
sl@0 | 87 |
|
sl@0 | 88 |
/** |
sl@0 | 89 |
* Server entry point |
sl@0 | 90 |
* @return Standard Epoc error code on exit |
sl@0 | 91 |
*/ |
sl@0 | 92 |
TInt main() |
sl@0 | 93 |
{ |
sl@0 | 94 |
__UHEAP_MARK; |
sl@0 | 95 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
sl@0 | 96 |
if(cleanup == NULL) |
sl@0 | 97 |
{ |
sl@0 | 98 |
return KErrNoMemory; |
sl@0 | 99 |
} |
sl@0 | 100 |
TRAP_IGNORE(MainL()); |
sl@0 | 101 |
delete cleanup; |
sl@0 | 102 |
__UHEAP_MARKEND; |
sl@0 | 103 |
|
sl@0 | 104 |
return KErrNone; |
sl@0 | 105 |
} |
sl@0 | 106 |
|
sl@0 | 107 |
CTestStep* CClockTestServer::CreateTestStep(const TDesC& aStepName) |
sl@0 | 108 |
{ |
sl@0 | 109 |
CTestStep* testStep = NULL; |
sl@0 | 110 |
|
sl@0 | 111 |
if(aStepName == KTestgetclockid1) |
sl@0 | 112 |
{ |
sl@0 | 113 |
testStep = new CTestclock(aStepName); |
sl@0 | 114 |
} |
sl@0 | 115 |
if(aStepName == KTestgetclockid2) |
sl@0 | 116 |
{ |
sl@0 | 117 |
testStep = new CTestclock(aStepName); |
sl@0 | 118 |
} |
sl@0 | 119 |
if(aStepName == KTestgetclockid3) |
sl@0 | 120 |
{ |
sl@0 | 121 |
testStep = new CTestclock(aStepName); |
sl@0 | 122 |
} |
sl@0 | 123 |
if(aStepName == KTestgetclockid4) |
sl@0 | 124 |
{ |
sl@0 | 125 |
testStep = new CTestclock(aStepName); |
sl@0 | 126 |
} |
sl@0 | 127 |
if(aStepName == KTestgetclockid5) |
sl@0 | 128 |
{ |
sl@0 | 129 |
testStep = new CTestclock(aStepName); |
sl@0 | 130 |
} |
sl@0 | 131 |
if(aStepName == KTestclockresolution1) |
sl@0 | 132 |
{ |
sl@0 | 133 |
testStep = new CTestclock(aStepName); |
sl@0 | 134 |
} |
sl@0 | 135 |
if(aStepName == KTestclockresolution2) |
sl@0 | 136 |
{ |
sl@0 | 137 |
testStep = new CTestclock(aStepName); |
sl@0 | 138 |
} |
sl@0 | 139 |
if(aStepName == KTestclockresolution3) |
sl@0 | 140 |
{ |
sl@0 | 141 |
testStep = new CTestclock(aStepName); |
sl@0 | 142 |
} |
sl@0 | 143 |
if(aStepName == KTestclocknanosleep1) |
sl@0 | 144 |
{ |
sl@0 | 145 |
testStep = new CTestclock(aStepName); |
sl@0 | 146 |
} |
sl@0 | 147 |
if(aStepName == KTestclocknanosleep2) |
sl@0 | 148 |
{ |
sl@0 | 149 |
testStep = new CTestclock(aStepName); |
sl@0 | 150 |
} |
sl@0 | 151 |
if(aStepName == KTestclocknanosleep3) |
sl@0 | 152 |
{ |
sl@0 | 153 |
testStep = new CTestclock(aStepName); |
sl@0 | 154 |
} |
sl@0 | 155 |
if(aStepName == KTestclocknanosleep4) |
sl@0 | 156 |
{ |
sl@0 | 157 |
testStep = new CTestclock(aStepName); |
sl@0 | 158 |
} |
sl@0 | 159 |
if(aStepName == KTestclocknanosleep5) |
sl@0 | 160 |
{ |
sl@0 | 161 |
testStep = new CTestclock(aStepName); |
sl@0 | 162 |
} |
sl@0 | 163 |
if(aStepName == KTestclocknanosleep6) |
sl@0 | 164 |
{ |
sl@0 | 165 |
testStep = new CTestclock(aStepName); |
sl@0 | 166 |
} |
sl@0 | 167 |
if(aStepName == KTestclockgettime1) |
sl@0 | 168 |
{ |
sl@0 | 169 |
testStep = new CTestclock(aStepName); |
sl@0 | 170 |
} |
sl@0 | 171 |
if(aStepName == KTestclockgettime2) |
sl@0 | 172 |
{ |
sl@0 | 173 |
testStep = new CTestclock(aStepName); |
sl@0 | 174 |
} |
sl@0 | 175 |
if(aStepName == KTestclockgettime3) |
sl@0 | 176 |
{ |
sl@0 | 177 |
testStep = new CTestclock(aStepName); |
sl@0 | 178 |
} |
sl@0 | 179 |
if(aStepName == KTestclocksettime1) |
sl@0 | 180 |
{ |
sl@0 | 181 |
testStep = new CTestclock(aStepName); |
sl@0 | 182 |
} |
sl@0 | 183 |
if(aStepName == KTestclocksettime2) |
sl@0 | 184 |
{ |
sl@0 | 185 |
testStep = new CTestclock(aStepName); |
sl@0 | 186 |
} |
sl@0 | 187 |
if(aStepName == KTestclocksettime3) |
sl@0 | 188 |
{ |
sl@0 | 189 |
testStep = new CTestclock(aStepName); |
sl@0 | 190 |
} |
sl@0 | 191 |
return testStep; |
sl@0 | 192 |
} |
sl@0 | 193 |