|
1 // Copyright (c) 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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : tlocaleserver.cpp |
|
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 "tlocaleserver.h" |
|
39 #include "tlocale.h" |
|
40 |
|
41 |
|
42 _LIT(KServerName, "tlocale"); |
|
43 |
|
44 CLocaleTestServer* CLocaleTestServer::NewL() |
|
45 { |
|
46 CLocaleTestServer *server = new(ELeave) CLocaleTestServer(); |
|
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 CLocaleTestServer* server = NULL; |
|
83 // Create the CTestServer derived server |
|
84 TRAPD(err, server = CLocaleTestServer::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* CLocaleTestServer::CreateTestStep(const TDesC& aStepName) |
|
115 { |
|
116 CTestStep* testStep = NULL; |
|
117 if(aStepName == Ksynclocale) |
|
118 { |
|
119 testStep = new CTestLocale(aStepName); |
|
120 } |
|
121 else if(aStepName == Ksynclocalehybrid) |
|
122 { |
|
123 testStep = new CTestLocale(aStepName); |
|
124 } |
|
125 else if(aStepName == Kstrcoll_locale) |
|
126 { |
|
127 testStep = new CTestLocale(aStepName); |
|
128 } |
|
129 else if(aStepName == Kstrcoll_synclocale) |
|
130 { |
|
131 testStep = new CTestLocale(aStepName); |
|
132 } |
|
133 else if(aStepName == Kclocale) |
|
134 { |
|
135 testStep = new CTestLocale(aStepName); |
|
136 } |
|
137 else if(aStepName == KTestisascii) |
|
138 { |
|
139 testStep = new CTestLocale(aStepName); |
|
140 } |
|
141 else if(aStepName == KTesttoascii) |
|
142 { |
|
143 testStep = new CTestLocale(aStepName); |
|
144 } |
|
145 else if(aStepName == KTestmblen0) |
|
146 { |
|
147 testStep = new CTestLocale(aStepName); |
|
148 } |
|
149 else if(aStepName == KTestmblen1) |
|
150 { |
|
151 testStep = new CTestLocale(aStepName); |
|
152 } |
|
153 else if(aStepName == KTestmblen2) |
|
154 { |
|
155 testStep = new CTestLocale(aStepName); |
|
156 } |
|
157 else if(aStepName == KTestmblen3) |
|
158 { |
|
159 testStep = new CTestLocale(aStepName); |
|
160 } |
|
161 else if(aStepName == KTestmblen4) |
|
162 { |
|
163 testStep = new CTestLocale(aStepName); |
|
164 } |
|
165 else if(aStepName == KTestwctomb0) |
|
166 { |
|
167 testStep = new CTestLocale(aStepName); |
|
168 } |
|
169 else if(aStepName == KTestwctomb1) |
|
170 { |
|
171 testStep = new CTestLocale(aStepName); |
|
172 } |
|
173 else if(aStepName == KTestwctomb2) |
|
174 { |
|
175 testStep = new CTestLocale(aStepName); |
|
176 } |
|
177 else if(aStepName == KTestwctomb3) |
|
178 { |
|
179 testStep = new CTestLocale(aStepName); |
|
180 } |
|
181 else if(aStepName == KTestmbtowc0) |
|
182 { |
|
183 testStep = new CTestLocale(aStepName); |
|
184 } |
|
185 else if(aStepName == KTestmbtowc1) |
|
186 { |
|
187 testStep = new CTestLocale(aStepName); |
|
188 } |
|
189 else if(aStepName == KTestmbstowcs) |
|
190 { |
|
191 testStep = new CTestLocale(aStepName); |
|
192 } |
|
193 else if(aStepName == KTestwcstombs) |
|
194 { |
|
195 testStep = new CTestLocale(aStepName); |
|
196 } |
|
197 else if(aStepName == KTestwcrtomb0) |
|
198 { |
|
199 testStep = new CTestLocale(aStepName); |
|
200 } |
|
201 else if(aStepName == KTestwcrtomb1) |
|
202 { |
|
203 testStep = new CTestLocale(aStepName); |
|
204 } |
|
205 else if(aStepName == KTestwcrtomb_NULL) |
|
206 { |
|
207 testStep = new CTestLocale(aStepName); |
|
208 } |
|
209 else if(aStepName == KTestwcrtomb_Neg1) |
|
210 { |
|
211 testStep = new CTestLocale(aStepName); |
|
212 } |
|
213 else if(aStepName == KTestwcrtomb_Neg2) |
|
214 { |
|
215 testStep = new CTestLocale(aStepName); |
|
216 } |
|
217 else if(aStepName == KTestwcscoll) |
|
218 { |
|
219 testStep = new CTestLocale(aStepName); |
|
220 } |
|
221 else if(aStepName == KTestwcsicoll) |
|
222 { |
|
223 testStep = new CTestLocale(aStepName); |
|
224 } |
|
225 else if(aStepName == KTestwcslwr) |
|
226 { |
|
227 testStep = new CTestLocale(aStepName); |
|
228 } |
|
229 else if(aStepName == KTestwcsupr) |
|
230 { |
|
231 testStep = new CTestLocale(aStepName); |
|
232 } |
|
233 else if(aStepName == KTestwctrans) |
|
234 { |
|
235 testStep = new CTestLocale(aStepName); |
|
236 } |
|
237 else if(aStepName == KTestwctrans_Neg) |
|
238 { |
|
239 testStep = new CTestLocale(aStepName); |
|
240 } |
|
241 else if(aStepName == KTestwctype) |
|
242 { |
|
243 testStep = new CTestLocale(aStepName); |
|
244 } |
|
245 else if(aStepName == KTestwctype_Neg) |
|
246 { |
|
247 testStep = new CTestLocale(aStepName); |
|
248 } |
|
249 else if(aStepName == KTestwcstod) |
|
250 { |
|
251 testStep = new CTestLocale(aStepName); |
|
252 } |
|
253 else if(aStepName == KTestwcstod_Neg) |
|
254 { |
|
255 testStep = new CTestLocale(aStepName); |
|
256 } |
|
257 else if(aStepName == KTestwctob) |
|
258 { |
|
259 testStep = new CTestLocale(aStepName); |
|
260 } |
|
261 else if(aStepName == KTestwctob_Neg) |
|
262 { |
|
263 testStep = new CTestLocale(aStepName); |
|
264 } |
|
265 else if(aStepName == KTestwcswidth) |
|
266 { |
|
267 testStep = new CTestLocale(aStepName); |
|
268 } |
|
269 else if(aStepName == KTestwcswidth_Neg) |
|
270 { |
|
271 testStep = new CTestLocale(aStepName); |
|
272 } |
|
273 else if(aStepName == KTestwcwidth) |
|
274 { |
|
275 testStep = new CTestLocale(aStepName); |
|
276 } |
|
277 else if(aStepName == KTestmbrlen0) |
|
278 { |
|
279 testStep = new CTestLocale(aStepName); |
|
280 } |
|
281 else if(aStepName == KTestmbrlen1) |
|
282 { |
|
283 testStep = new CTestLocale(aStepName); |
|
284 } |
|
285 else if(aStepName == KTestmbrtowc) |
|
286 { |
|
287 testStep = new CTestLocale(aStepName); |
|
288 } |
|
289 else if(aStepName == KTestmbrtowc_Neg) |
|
290 { |
|
291 testStep = new CTestLocale(aStepName); |
|
292 } |
|
293 else if(aStepName == KTestmbsrtowcs) |
|
294 { |
|
295 testStep = new CTestLocale(aStepName); |
|
296 } |
|
297 else if(aStepName == KTestmbsrtowcs1) |
|
298 { |
|
299 testStep = new CTestLocale(aStepName); |
|
300 } |
|
301 else if(aStepName == KTestmbsinit) |
|
302 { |
|
303 testStep = new CTestLocale(aStepName); |
|
304 } |
|
305 else if(aStepName == KTestwcsrtombs) |
|
306 { |
|
307 testStep = new CTestLocale(aStepName); |
|
308 } |
|
309 else if(aStepName == KTestsetlocale) |
|
310 { |
|
311 testStep = new CTestLocale(aStepName); |
|
312 } |
|
313 else if(aStepName == KTestctypeApi) |
|
314 { |
|
315 testStep = new CTestLocale(aStepName); |
|
316 } |
|
317 else if(aStepName == Ktestnewlocale ) |
|
318 { |
|
319 testStep = new CTestLocale(aStepName); |
|
320 } |
|
321 return testStep; |
|
322 } |
|
323 |