|
1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <c32comm.h> |
|
21 |
|
22 #if defined (__WINS__) |
|
23 #define PDD_NAME _L("ECDRV") |
|
24 #else |
|
25 #define PDD_NAME _L("EUART1") |
|
26 #define PDD2_NAME _L("EUART2") |
|
27 #define PDD3_NAME _L("EUART3") |
|
28 #define PDD4_NAME _L("EUART4") |
|
29 #endif |
|
30 |
|
31 #define LDD_NAME _L("ECOMM") |
|
32 |
|
33 /** |
|
34 * @file |
|
35 * |
|
36 * Pipe test server implementation |
|
37 */ |
|
38 #include "twctypeserver.h" |
|
39 #include "twctype.h" |
|
40 |
|
41 |
|
42 _LIT(KServerName, "twctype"); |
|
43 |
|
44 CWctypeTestServer* CWctypeTestServer::NewL() |
|
45 { |
|
46 CWctypeTestServer *server = new(ELeave) CWctypeTestServer(); |
|
47 CleanupStack::PushL(server); |
|
48 server->ConstructL(KServerName); |
|
49 CleanupStack::Pop(server); |
|
50 return server; |
|
51 } |
|
52 |
|
53 static void InitCommsL() |
|
54 { |
|
55 TInt ret = User::LoadPhysicalDevice(PDD_NAME); |
|
56 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
57 |
|
58 #ifndef __WINS__ |
|
59 ret = User::LoadPhysicalDevice(PDD2_NAME); |
|
60 ret = User::LoadPhysicalDevice(PDD3_NAME); |
|
61 ret = User::LoadPhysicalDevice(PDD4_NAME); |
|
62 #endif |
|
63 |
|
64 ret = User::LoadLogicalDevice(LDD_NAME); |
|
65 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
66 ret = StartC32(); |
|
67 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
68 } |
|
69 |
|
70 LOCAL_C void MainL() |
|
71 { |
|
72 // Leave the hooks in for platform security |
|
73 #if (defined __DATA_CAGING__) |
|
74 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
75 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
76 #endif |
|
77 InitCommsL(); |
|
78 |
|
79 CActiveScheduler* sched=NULL; |
|
80 sched=new(ELeave) CActiveScheduler; |
|
81 CActiveScheduler::Install(sched); |
|
82 CWctypeTestServer* server = NULL; |
|
83 // Create the CTestServer derived server |
|
84 TRAPD(err, server = CWctypeTestServer::NewL()); |
|
85 if(!err) |
|
86 { |
|
87 // Sync with the client and enter the active scheduler |
|
88 RProcess::Rendezvous(KErrNone); |
|
89 sched->Start(); |
|
90 } |
|
91 delete server; |
|
92 delete sched; |
|
93 } |
|
94 |
|
95 /** |
|
96 * Server entry point |
|
97 * @return Standard Epoc error code on exit |
|
98 */ |
|
99 TInt main() |
|
100 { |
|
101 __UHEAP_MARK; |
|
102 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
103 if(cleanup == NULL) |
|
104 { |
|
105 return KErrNoMemory; |
|
106 } |
|
107 TRAP_IGNORE(MainL()); |
|
108 delete cleanup; |
|
109 __UHEAP_MARKEND; |
|
110 |
|
111 return KErrNone; |
|
112 } |
|
113 |
|
114 CTestStep* CWctypeTestServer::CreateTestStep(const TDesC& aStepName) |
|
115 { |
|
116 CTestStep* testStep = NULL; |
|
117 |
|
118 // This server creates just one step but create as many as you want |
|
119 // They are created "just in time" when the worker thread is created |
|
120 // install steps |
|
121 if(aStepName == Ktest_iswalpha) |
|
122 { |
|
123 testStep = new CTestWctype(aStepName); |
|
124 } |
|
125 else if(aStepName == Ktest_iswalnum) |
|
126 { |
|
127 testStep = new CTestWctype(aStepName); |
|
128 } |
|
129 else if(aStepName == Ktest_iswdigit) |
|
130 { |
|
131 testStep = new CTestWctype(aStepName); |
|
132 } |
|
133 else if(aStepName == Ktest_iswcntrl) |
|
134 { |
|
135 testStep = new CTestWctype(aStepName); |
|
136 } |
|
137 else if(aStepName == Ktest_iswxdigit) |
|
138 { |
|
139 testStep = new CTestWctype(aStepName); |
|
140 } |
|
141 else if(aStepName == Ktest_iswspace) |
|
142 { |
|
143 testStep = new CTestWctype(aStepName); |
|
144 } |
|
145 else if(aStepName == Ktest_iswblank) |
|
146 { |
|
147 testStep = new CTestWctype(aStepName); |
|
148 } |
|
149 else if(aStepName == Ktest_iswpunct) |
|
150 { |
|
151 testStep = new CTestWctype(aStepName); |
|
152 } |
|
153 else if(aStepName == Ktest_iswlower) |
|
154 { |
|
155 testStep = new CTestWctype(aStepName); |
|
156 } |
|
157 else if(aStepName == Ktest_iswupper) |
|
158 { |
|
159 testStep = new CTestWctype(aStepName); |
|
160 } |
|
161 else if(aStepName == Ktest_iswprint) |
|
162 { |
|
163 testStep = new CTestWctype(aStepName); |
|
164 } |
|
165 else if(aStepName == Ktest_iswgraph) |
|
166 { |
|
167 testStep = new CTestWctype(aStepName); |
|
168 } |
|
169 else if(aStepName == Ktest_iswctype) |
|
170 { |
|
171 testStep = new CTestWctype(aStepName); |
|
172 } |
|
173 return testStep; |
|
174 } |
|
175 |