|
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 |
|
39 #include "tlinkserver.h" |
|
40 #include "tlink.h" |
|
41 |
|
42 |
|
43 _LIT(KServerName, "tlink"); |
|
44 |
|
45 CLinkTestServer* CLinkTestServer::NewL() |
|
46 { |
|
47 CLinkTestServer *server = new(ELeave) CLinkTestServer(); |
|
48 CleanupStack::PushL(server); |
|
49 server->ConstructL(KServerName); |
|
50 CleanupStack::Pop(server); |
|
51 return server; |
|
52 } |
|
53 |
|
54 static void InitCommsL() |
|
55 { |
|
56 TInt ret = User::LoadPhysicalDevice(PDD_NAME); |
|
57 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
58 |
|
59 #ifndef __WINS__ |
|
60 ret = User::LoadPhysicalDevice(PDD2_NAME); |
|
61 ret = User::LoadPhysicalDevice(PDD3_NAME); |
|
62 ret = User::LoadPhysicalDevice(PDD4_NAME); |
|
63 #endif |
|
64 |
|
65 ret = User::LoadLogicalDevice(LDD_NAME); |
|
66 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
67 ret = StartC32(); |
|
68 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
69 } |
|
70 |
|
71 LOCAL_C void MainL() |
|
72 { |
|
73 // Leave the hooks in for platform security |
|
74 #if (defined __DATA_CAGING__) |
|
75 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
76 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
77 #endif |
|
78 InitCommsL(); |
|
79 |
|
80 CActiveScheduler* sched=NULL; |
|
81 sched=new(ELeave) CActiveScheduler; |
|
82 CActiveScheduler::Install(sched); |
|
83 CLinkTestServer* server = NULL; |
|
84 // Create the CTestServer derived server |
|
85 TRAPD(err, server = CLinkTestServer::NewL()); |
|
86 if(!err) |
|
87 { |
|
88 // Sync with the client and enter the active scheduler |
|
89 RProcess::Rendezvous(KErrNone); |
|
90 sched->Start(); |
|
91 } |
|
92 delete server; |
|
93 delete sched; |
|
94 } |
|
95 |
|
96 /** |
|
97 * Server entry point |
|
98 * @return Standard Epoc error code on exit |
|
99 */ |
|
100 TInt main() |
|
101 { |
|
102 __UHEAP_MARK; |
|
103 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
104 if(cleanup == NULL) |
|
105 { |
|
106 return KErrNoMemory; |
|
107 } |
|
108 TRAP_IGNORE(MainL()); |
|
109 delete cleanup; |
|
110 __UHEAP_MARKEND; |
|
111 |
|
112 return KErrNone; |
|
113 } |
|
114 |
|
115 CTestStep* CLinkTestServer::CreateTestStep(const TDesC& aStepName) |
|
116 { |
|
117 CTestStep* testStep = NULL; |
|
118 |
|
119 // This server creates just one step but create as many as you want |
|
120 // They are created "just in time" when the worker thread is created |
|
121 // install steps |
|
122 |
|
123 if(aStepName == KLink) |
|
124 { |
|
125 testStep = new CTestLink(aStepName); |
|
126 } |
|
127 if(aStepName == KLink1) |
|
128 { |
|
129 testStep = new CTestLink(aStepName); |
|
130 } |
|
131 if(aStepName == KLink2) |
|
132 { |
|
133 testStep = new CTestLink(aStepName); |
|
134 } |
|
135 if(aStepName == KLink3) |
|
136 { |
|
137 testStep = new CTestLink(aStepName); |
|
138 } |
|
139 if(aStepName == KLink4) |
|
140 { |
|
141 testStep = new CTestLink(aStepName); |
|
142 } |
|
143 if(aStepName == KLink5) |
|
144 { |
|
145 testStep = new CTestLink(aStepName); |
|
146 } |
|
147 if(aStepName == KLink6) |
|
148 { |
|
149 testStep = new CTestLink(aStepName); |
|
150 } |
|
151 if(aStepName == KLink7) |
|
152 { |
|
153 testStep = new CTestLink(aStepName); |
|
154 } |
|
155 if(aStepName == KReadWriteLink) |
|
156 { |
|
157 testStep = new CTestLink(aStepName); |
|
158 } |
|
159 if(aStepName == KReadLink) |
|
160 { |
|
161 testStep = new CTestLink(aStepName); |
|
162 } |
|
163 if(aStepName == KReadLink1) |
|
164 { |
|
165 testStep = new CTestLink(aStepName); |
|
166 } |
|
167 if(aStepName == Klinkstat) |
|
168 { |
|
169 testStep = new CTestLink(aStepName); |
|
170 } |
|
171 if(aStepName == KUnlink) |
|
172 { |
|
173 testStep = new CTestLink(aStepName); |
|
174 } |
|
175 if(aStepName == KUnlink1) |
|
176 { |
|
177 testStep = new CTestLink(aStepName); |
|
178 } |
|
179 if(aStepName == KTestUnlinkFifo) |
|
180 { |
|
181 testStep = new CTestLink(aStepName); |
|
182 } |
|
183 if(aStepName == KReadLinkTest) |
|
184 { |
|
185 testStep = new CTestLink(aStepName); |
|
186 } |
|
187 return testStep; |
|
188 } |
|
189 |