|
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 "tctypeserver.h" |
|
39 #include "tctype.h" |
|
40 |
|
41 |
|
42 _LIT(KServerName, "tctype"); |
|
43 |
|
44 CCtypeTestServer* CCtypeTestServer::NewL() |
|
45 { |
|
46 CCtypeTestServer *server = new(ELeave) CCtypeTestServer(); |
|
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 CCtypeTestServer* server = NULL; |
|
83 // Create the CTestServer derived server |
|
84 TRAPD(err, server = CCtypeTestServer::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* CCtypeTestServer::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 == Kisalpha_atoz) |
|
122 { |
|
123 testStep = new CTestCtype(aStepName); |
|
124 } |
|
125 if(aStepName == Kisalpha_num) |
|
126 { |
|
127 testStep = new CTestCtype(aStepName); |
|
128 } |
|
129 if(aStepName == Kisalpha_punc) |
|
130 { |
|
131 testStep = new CTestCtype(aStepName); |
|
132 } |
|
133 if(aStepName == Kisalpha_escape) |
|
134 { |
|
135 testStep = new CTestCtype(aStepName); |
|
136 } |
|
137 |
|
138 if(aStepName == Kisdigit_digit) |
|
139 { |
|
140 testStep = new CTestCtype(aStepName); |
|
141 } |
|
142 if(aStepName == Kisdigit_punc) |
|
143 { |
|
144 testStep = new CTestCtype(aStepName); |
|
145 } |
|
146 if(aStepName == Kisdigit_escape) |
|
147 { |
|
148 testStep = new CTestCtype(aStepName); |
|
149 } |
|
150 if(aStepName == Kisdigit_alpha) |
|
151 { |
|
152 testStep = new CTestCtype(aStepName); |
|
153 } |
|
154 |
|
155 if(aStepName == Kisalnum_alpha) |
|
156 { |
|
157 testStep = new CTestCtype(aStepName); |
|
158 } |
|
159 if(aStepName == Kisalnum_num) |
|
160 { |
|
161 testStep = new CTestCtype(aStepName); |
|
162 } |
|
163 if(aStepName == Kisalnum_punc) |
|
164 { |
|
165 testStep = new CTestCtype(aStepName); |
|
166 } |
|
167 if(aStepName == Kisalnum_escape) |
|
168 { |
|
169 testStep = new CTestCtype(aStepName); |
|
170 } |
|
171 |
|
172 if(aStepName == Kispunct_punct) |
|
173 { |
|
174 testStep = new CTestCtype(aStepName); |
|
175 } |
|
176 if(aStepName == Kispunct_alpha_num) |
|
177 { |
|
178 testStep = new CTestCtype(aStepName); |
|
179 } |
|
180 if(aStepName == Kispunct_cntrl) |
|
181 { |
|
182 testStep = new CTestCtype(aStepName); |
|
183 } |
|
184 |
|
185 if(aStepName == Kisupper_upper) |
|
186 { |
|
187 testStep = new CTestCtype(aStepName); |
|
188 } |
|
189 if(aStepName == Kisupper_lower) |
|
190 { |
|
191 testStep = new CTestCtype(aStepName); |
|
192 } |
|
193 if(aStepName == Kisupper_punc) |
|
194 { |
|
195 testStep = new CTestCtype(aStepName); |
|
196 } |
|
197 if(aStepName == Kisupper_escape) |
|
198 { |
|
199 testStep = new CTestCtype(aStepName); |
|
200 } |
|
201 |
|
202 if(aStepName == Kislower_lower) |
|
203 { |
|
204 testStep = new CTestCtype(aStepName); |
|
205 } |
|
206 if(aStepName == Kislower_upper) |
|
207 { |
|
208 testStep = new CTestCtype(aStepName); |
|
209 } |
|
210 if(aStepName == Kislower_punc) |
|
211 { |
|
212 testStep = new CTestCtype(aStepName); |
|
213 } |
|
214 if(aStepName == Kislower_escape) |
|
215 { |
|
216 testStep = new CTestCtype(aStepName); |
|
217 } |
|
218 |
|
219 if(aStepName == Kisxdigit_xdigit) |
|
220 { |
|
221 testStep = new CTestCtype(aStepName); |
|
222 } |
|
223 if(aStepName == Kisxdigit_escape) |
|
224 { |
|
225 testStep = new CTestCtype(aStepName); |
|
226 } |
|
227 if(aStepName == Kisxdigit_punc) |
|
228 { |
|
229 testStep = new CTestCtype(aStepName); |
|
230 } |
|
231 if(aStepName == Kisxdigit_other_alpha) |
|
232 { |
|
233 testStep = new CTestCtype(aStepName); |
|
234 } |
|
235 |
|
236 if(aStepName == Ktoupper_lower) |
|
237 { |
|
238 testStep = new CTestCtype(aStepName); |
|
239 } |
|
240 if(aStepName == Ktoupper_upper) |
|
241 { |
|
242 testStep = new CTestCtype(aStepName); |
|
243 } |
|
244 if(aStepName == Ktoupper_punc) |
|
245 { |
|
246 testStep = new CTestCtype(aStepName); |
|
247 } |
|
248 if(aStepName == Ktoupper_escape) |
|
249 { |
|
250 testStep = new CTestCtype(aStepName); |
|
251 } |
|
252 |
|
253 if(aStepName == Ktolower_upper) |
|
254 { |
|
255 testStep = new CTestCtype(aStepName); |
|
256 } |
|
257 if(aStepName == Ktolower_lower) |
|
258 { |
|
259 testStep = new CTestCtype(aStepName); |
|
260 } |
|
261 if(aStepName == Ktolower_punc) |
|
262 { |
|
263 testStep = new CTestCtype(aStepName); |
|
264 } |
|
265 if(aStepName == Ktolower_escape) |
|
266 { |
|
267 testStep = new CTestCtype(aStepName); |
|
268 } |
|
269 |
|
270 if(aStepName == Kisspace_space) |
|
271 { |
|
272 testStep = new CTestCtype(aStepName); |
|
273 } |
|
274 if(aStepName == Kisspace_punc) |
|
275 { |
|
276 testStep = new CTestCtype(aStepName); |
|
277 } |
|
278 if(aStepName == Kisspace_alpha) |
|
279 { |
|
280 testStep = new CTestCtype(aStepName); |
|
281 } |
|
282 if(aStepName == Kisspace_num) |
|
283 { |
|
284 testStep = new CTestCtype(aStepName); |
|
285 } |
|
286 |
|
287 if(aStepName == Kiscntrl_cntrl) |
|
288 { |
|
289 testStep = new CTestCtype(aStepName); |
|
290 } |
|
291 if(aStepName == Kiscntrl_other_escape) |
|
292 { |
|
293 testStep = new CTestCtype(aStepName); |
|
294 } |
|
295 if(aStepName == Kiscntrl_alpha_num) |
|
296 { |
|
297 testStep = new CTestCtype(aStepName); |
|
298 } |
|
299 |
|
300 if(aStepName == Kisprint_cntrl) |
|
301 { |
|
302 testStep = new CTestCtype(aStepName); |
|
303 } |
|
304 if(aStepName == Kisprint_alpha_num) |
|
305 { |
|
306 testStep = new CTestCtype(aStepName); |
|
307 } |
|
308 if(aStepName == Kisprint_punc) |
|
309 { |
|
310 testStep = new CTestCtype(aStepName); |
|
311 } |
|
312 if(aStepName == Kisprint_xdigit) |
|
313 { |
|
314 testStep = new CTestCtype(aStepName); |
|
315 } |
|
316 |
|
317 if(aStepName == Kisgraph_escape) |
|
318 { |
|
319 testStep = new CTestCtype(aStepName); |
|
320 } |
|
321 if(aStepName == Kisgraph_alpha_num) |
|
322 { |
|
323 testStep = new CTestCtype(aStepName); |
|
324 } |
|
325 if(aStepName == Kisgraph_punc) |
|
326 { |
|
327 testStep = new CTestCtype(aStepName); |
|
328 } |
|
329 if(aStepName == Kisgraph_xdigit) |
|
330 { |
|
331 testStep = new CTestCtype(aStepName); |
|
332 } |
|
333 if(aStepName == Kisgraph_space) |
|
334 { |
|
335 testStep = new CTestCtype(aStepName); |
|
336 } |
|
337 |
|
338 if(aStepName == Kisascii_ascii) |
|
339 { |
|
340 testStep = new CTestCtype(aStepName); |
|
341 } |
|
342 if(aStepName == Kisascii_bad_param) |
|
343 { |
|
344 testStep = new CTestCtype(aStepName); |
|
345 } |
|
346 |
|
347 if(aStepName == Ktoascii_ascii) |
|
348 { |
|
349 testStep = new CTestCtype(aStepName); |
|
350 } |
|
351 if(aStepName == Ktoascii_bad) |
|
352 { |
|
353 testStep = new CTestCtype(aStepName); |
|
354 } |
|
355 |
|
356 return testStep; |
|
357 } |
|
358 |