|
1 // Copyright (c) 2006-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 : twcharserver.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 #include <c32comm.h> |
|
20 |
|
21 #if defined (__WINS__) |
|
22 #define PDD_NAME _L("ECDRV") |
|
23 #else |
|
24 #define PDD_NAME _L("EUART1") |
|
25 #define PDD2_NAME _L("EUART2") |
|
26 #define PDD3_NAME _L("EUART3") |
|
27 #define PDD4_NAME _L("EUART4") |
|
28 #endif |
|
29 |
|
30 #define LDD_NAME _L("ECOMM") |
|
31 |
|
32 /** |
|
33 * @file |
|
34 * |
|
35 * Pipe test server implementation |
|
36 */ |
|
37 #include "twcharserver.h" |
|
38 #include "twchar.h" |
|
39 |
|
40 |
|
41 //_LIT(KServerName, "twcharcap"); |
|
42 |
|
43 CwcharTestServer* CwcharTestServer::NewL() |
|
44 { |
|
45 CwcharTestServer *server = new(ELeave) CwcharTestServer(); |
|
46 CleanupStack::PushL(server); |
|
47 //server->ConstructL(KServerName); |
|
48 RProcess handle = RProcess(); |
|
49 TParsePtrC serverName(handle.FileName()); |
|
50 server->StartL(serverName.Name()); |
|
51 |
|
52 |
|
53 CleanupStack::Pop(server); |
|
54 return server; |
|
55 } |
|
56 |
|
57 static void InitCommsL() |
|
58 { |
|
59 TInt ret = User::LoadPhysicalDevice(PDD_NAME); |
|
60 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
61 #ifndef __WINS__ |
|
62 ret = User::LoadPhysicalDevice(PDD2_NAME); |
|
63 ret = User::LoadPhysicalDevice(PDD3_NAME); |
|
64 ret = User::LoadPhysicalDevice(PDD4_NAME); |
|
65 #endif |
|
66 ret = User::LoadLogicalDevice(LDD_NAME); |
|
67 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
68 ret = StartC32(); |
|
69 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
70 } |
|
71 |
|
72 LOCAL_C void MainL() |
|
73 { |
|
74 // Leave the hooks in for platform security |
|
75 #if (defined __DATA_CAGING__) |
|
76 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
77 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
78 #endif |
|
79 InitCommsL(); |
|
80 |
|
81 CActiveScheduler* sched=NULL; |
|
82 sched=new(ELeave) CActiveScheduler; |
|
83 CActiveScheduler::Install(sched); |
|
84 CwcharTestServer* server = NULL; |
|
85 // Create the CTestServer derived server |
|
86 TRAPD(err, server = CwcharTestServer::NewL()); |
|
87 if(!err) |
|
88 { |
|
89 // Sync with the client and enter the active scheduler |
|
90 RProcess::Rendezvous(KErrNone); |
|
91 sched->Start(); |
|
92 } |
|
93 delete server; |
|
94 delete sched; |
|
95 } |
|
96 |
|
97 /** |
|
98 * Server entry point |
|
99 * @return Standard Epoc error code on exit |
|
100 */ |
|
101 TInt main() |
|
102 { |
|
103 __UHEAP_MARK; |
|
104 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
105 if(cleanup == NULL) |
|
106 { |
|
107 return KErrNoMemory; |
|
108 } |
|
109 TRAP_IGNORE(MainL()); |
|
110 delete cleanup; |
|
111 __UHEAP_MARKEND; |
|
112 |
|
113 return KErrNone; |
|
114 } |
|
115 |
|
116 CTestStep* CwcharTestServer::CreateTestStep(const TDesC& aStepName) |
|
117 { |
|
118 CTestStep* testStep = NULL; |
|
119 |
|
120 // This server creates just one step but create as many as you want |
|
121 // They are created "just in time" when the worker thread is created |
|
122 // install steps |
|
123 |
|
124 //steps for captest. |
|
125 |
|
126 if(aStepName == Kwfopensys) |
|
127 { |
|
128 testStep = new CTestwchar(aStepName); |
|
129 } |
|
130 if(aStepName == Kwfopenprivate) |
|
131 { |
|
132 testStep = new CTestwchar(aStepName); |
|
133 } |
|
134 if(aStepName == Kwmkdirsys) |
|
135 { |
|
136 testStep = new CTestwchar(aStepName); |
|
137 } |
|
138 if(aStepName == Kwmkdirprivate) |
|
139 { |
|
140 testStep = new CTestwchar(aStepName); |
|
141 } |
|
142 if(aStepName == Kwaccesssys) |
|
143 { |
|
144 testStep = new CTestwchar(aStepName); |
|
145 } |
|
146 if(aStepName == Kwaccessprivate) |
|
147 { |
|
148 testStep = new CTestwchar(aStepName); |
|
149 } |
|
150 if(aStepName == Kwchdirsys) |
|
151 { |
|
152 testStep = new CTestwchar(aStepName); |
|
153 } |
|
154 if(aStepName == Kwchdirprivate) |
|
155 { |
|
156 testStep = new CTestwchar(aStepName); |
|
157 } |
|
158 if(aStepName == Kwchmodsys) |
|
159 { |
|
160 testStep = new CTestwchar(aStepName); |
|
161 } |
|
162 if(aStepName == Kwchmodprivate) |
|
163 { |
|
164 testStep = new CTestwchar(aStepName); |
|
165 } |
|
166 if(aStepName == Kwrenamesys) |
|
167 { |
|
168 testStep = new CTestwchar(aStepName); |
|
169 } |
|
170 if(aStepName == Kwrenameprivate) |
|
171 { |
|
172 testStep = new CTestwchar(aStepName); |
|
173 } |
|
174 if(aStepName == Kwopensys) |
|
175 { |
|
176 testStep = new CTestwchar(aStepName); |
|
177 } |
|
178 if(aStepName == Kwopenprivate) |
|
179 { |
|
180 testStep = new CTestwchar(aStepName); |
|
181 } |
|
182 if(aStepName == Kwunlinksys) |
|
183 { |
|
184 testStep = new CTestwchar(aStepName); |
|
185 } |
|
186 if(aStepName == Kwunlinkprivate) |
|
187 { |
|
188 testStep = new CTestwchar(aStepName); |
|
189 } |
|
190 |
|
191 if(aStepName == Kwopensys) |
|
192 { |
|
193 testStep = new CTestwchar(aStepName); |
|
194 } |
|
195 if(aStepName == Kwopenprivate) |
|
196 { |
|
197 testStep = new CTestwchar(aStepName); |
|
198 } |
|
199 if(aStepName == Kwstatsys) |
|
200 { |
|
201 testStep = new CTestwchar(aStepName); |
|
202 } |
|
203 if(aStepName == Kwstatprivate) |
|
204 { |
|
205 testStep = new CTestwchar(aStepName); |
|
206 } |
|
207 if(aStepName == Kwrmdirsys) |
|
208 { |
|
209 testStep = new CTestwchar(aStepName); |
|
210 } |
|
211 if(aStepName == Kwrmdirprivate) |
|
212 { |
|
213 testStep = new CTestwchar(aStepName); |
|
214 } |
|
215 return testStep; |
|
216 } |
|
217 |