author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 2007-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 : ulibzserver.cpp |
sl@0 | 15 |
// |
sl@0 | 16 |
// |
sl@0 | 17 |
|
sl@0 | 18 |
|
sl@0 | 19 |
|
sl@0 | 20 |
#include <c32comm.h> |
sl@0 | 21 |
|
sl@0 | 22 |
#if defined (__WINS__) |
sl@0 | 23 |
#define PDD_NAME _L("ECDRV") |
sl@0 | 24 |
#else |
sl@0 | 25 |
#define PDD_NAME _L("EUART1") |
sl@0 | 26 |
#define PDD2_NAME _L("EUART2") |
sl@0 | 27 |
#define PDD3_NAME _L("EUART3") |
sl@0 | 28 |
#define PDD4_NAME _L("EUART4") |
sl@0 | 29 |
#endif |
sl@0 | 30 |
|
sl@0 | 31 |
#define LDD_NAME _L("ECOMM") |
sl@0 | 32 |
|
sl@0 | 33 |
/** |
sl@0 | 34 |
* @file |
sl@0 | 35 |
* |
sl@0 | 36 |
* Pipe test server implementation |
sl@0 | 37 |
*/ |
sl@0 | 38 |
#include "ulibzserver.h" |
sl@0 | 39 |
#include "ulibz.h" |
sl@0 | 40 |
|
sl@0 | 41 |
|
sl@0 | 42 |
_LIT(KServerName, "ulibz"); |
sl@0 | 43 |
|
sl@0 | 44 |
|
sl@0 | 45 |
ClibzTestServer* ClibzTestServer::NewL() |
sl@0 | 46 |
{ |
sl@0 | 47 |
ClibzTestServer *server = new(ELeave) ClibzTestServer(); |
sl@0 | 48 |
CleanupStack::PushL(server); |
sl@0 | 49 |
server->ConstructL(KServerName); |
sl@0 | 50 |
CleanupStack::Pop(server); |
sl@0 | 51 |
return server; |
sl@0 | 52 |
} |
sl@0 | 53 |
|
sl@0 | 54 |
static void InitCommsL() |
sl@0 | 55 |
{ |
sl@0 | 56 |
TInt ret = User::LoadPhysicalDevice(PDD_NAME); |
sl@0 | 57 |
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
sl@0 | 58 |
|
sl@0 | 59 |
#ifndef __WINS__ |
sl@0 | 60 |
ret = User::LoadPhysicalDevice(PDD2_NAME); |
sl@0 | 61 |
ret = User::LoadPhysicalDevice(PDD3_NAME); |
sl@0 | 62 |
ret = User::LoadPhysicalDevice(PDD4_NAME); |
sl@0 | 63 |
#endif |
sl@0 | 64 |
|
sl@0 | 65 |
ret = User::LoadLogicalDevice(LDD_NAME); |
sl@0 | 66 |
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
sl@0 | 67 |
ret = StartC32(); |
sl@0 | 68 |
User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
sl@0 | 69 |
} |
sl@0 | 70 |
|
sl@0 | 71 |
LOCAL_C void MainL() |
sl@0 | 72 |
{ |
sl@0 | 73 |
// Leave the hooks in for platform security |
sl@0 | 74 |
#if (defined __DATA_CAGING__) |
sl@0 | 75 |
RProcess().DataCaging(RProcess::EDataCagingOn); |
sl@0 | 76 |
RProcess().SecureApi(RProcess::ESecureApiOn); |
sl@0 | 77 |
#endif |
sl@0 | 78 |
//InitCommsL(); |
sl@0 | 79 |
|
sl@0 | 80 |
CActiveScheduler* sched=NULL; |
sl@0 | 81 |
sched=new(ELeave) CActiveScheduler; |
sl@0 | 82 |
CActiveScheduler::Install(sched); |
sl@0 | 83 |
ClibzTestServer* server = NULL; |
sl@0 | 84 |
// Create the CTestServer derived server |
sl@0 | 85 |
TRAPD(err, server = ClibzTestServer::NewL()); |
sl@0 | 86 |
if(!err) |
sl@0 | 87 |
{ |
sl@0 | 88 |
// Sync with the client and enter the active scheduler |
sl@0 | 89 |
RProcess::Rendezvous(KErrNone); |
sl@0 | 90 |
sched->Start(); |
sl@0 | 91 |
} |
sl@0 | 92 |
delete server; |
sl@0 | 93 |
delete sched; |
sl@0 | 94 |
} |
sl@0 | 95 |
|
sl@0 | 96 |
/** |
sl@0 | 97 |
* Server entry point |
sl@0 | 98 |
* @return Standard Epoc error code on exit |
sl@0 | 99 |
*/ |
sl@0 | 100 |
TInt main() |
sl@0 | 101 |
{ |
sl@0 | 102 |
__UHEAP_MARK; |
sl@0 | 103 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
sl@0 | 104 |
if(cleanup == NULL) |
sl@0 | 105 |
{ |
sl@0 | 106 |
return KErrNoMemory; |
sl@0 | 107 |
} |
sl@0 | 108 |
TRAP_IGNORE(MainL()); |
sl@0 | 109 |
delete cleanup; |
sl@0 | 110 |
__UHEAP_MARKEND; |
sl@0 | 111 |
|
sl@0 | 112 |
return KErrNone; |
sl@0 | 113 |
} |
sl@0 | 114 |
|
sl@0 | 115 |
CTestStep* ClibzTestServer::CreateTestStep(const TDesC& aStepName) |
sl@0 | 116 |
{ |
sl@0 | 117 |
CTestStep* testStep = NULL; |
sl@0 | 118 |
|
sl@0 | 119 |
// This server creates just one step but create as many as you want |
sl@0 | 120 |
// They are created "just in time" when the worker thread is created |
sl@0 | 121 |
// install steps |
sl@0 | 122 |
|
sl@0 | 123 |
//steps for captest. |
sl@0 | 124 |
|
sl@0 | 125 |
if(aStepName == KLibzcomp_decomp) |
sl@0 | 126 |
{ |
sl@0 | 127 |
testStep = new CTestlibz(aStepName); |
sl@0 | 128 |
} |
sl@0 | 129 |
|
sl@0 | 130 |
if(aStepName == KLibzdefl_Infl) |
sl@0 | 131 |
{ |
sl@0 | 132 |
testStep = new CTestlibz(aStepName); |
sl@0 | 133 |
} |
sl@0 | 134 |
|
sl@0 | 135 |
if(aStepName == KLibzgzio) |
sl@0 | 136 |
{ |
sl@0 | 137 |
testStep = new CTestlibz(aStepName); |
sl@0 | 138 |
} |
sl@0 | 139 |
if(aStepName == KLibzversion) |
sl@0 | 140 |
{ |
sl@0 | 141 |
testStep = new CTestlibz(aStepName); |
sl@0 | 142 |
} |
sl@0 | 143 |
|
sl@0 | 144 |
return testStep; |
sl@0 | 145 |
} |
sl@0 | 146 |
|
sl@0 | 147 |