|
1 // Copyright (c) 2005-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 // |
|
15 |
|
16 #include "Te_SimPacketTestServer.h" |
|
17 #include "Te_SimPacket.h" |
|
18 |
|
19 CSimPacketTestServer* CSimPacketTestServer::NewL() |
|
20 /** |
|
21 * @return - Instance of the test server |
|
22 * Same code for Secure and non-secure variants |
|
23 * Called inside the MainL() function to create and start the |
|
24 * CTestServer derived server. |
|
25 */ |
|
26 { |
|
27 CSimPacketTestServer * testServer = new (ELeave) CSimPacketTestServer(); |
|
28 CleanupStack::PushL(testServer); |
|
29 |
|
30 RProcess handle = RProcess(); |
|
31 TParsePtrC serverName(handle.FileName()); |
|
32 testServer->ConstructL(serverName.Name()); |
|
33 CleanupStack::Pop(testServer); |
|
34 return testServer; |
|
35 } |
|
36 |
|
37 LOCAL_C void MainL() |
|
38 /** |
|
39 * Secure variant |
|
40 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
41 */ |
|
42 { |
|
43 TInt result = StartC32(); |
|
44 if (result != KErrNone && result != KErrAlreadyExists) |
|
45 { |
|
46 User::Leave(result); |
|
47 } |
|
48 |
|
49 CActiveScheduler* sched=NULL; |
|
50 sched=new(ELeave) CActiveScheduler; |
|
51 CActiveScheduler::Install(sched); |
|
52 |
|
53 // Create the CTestServer derived server |
|
54 CSimPacketTestServer* testServer = NULL; |
|
55 TRAPD(err,testServer = CSimPacketTestServer::NewL()); |
|
56 if(!err) |
|
57 { |
|
58 // Sync with the client and enter the active scheduler |
|
59 RProcess::Rendezvous(KErrNone); |
|
60 sched->Start(); |
|
61 } |
|
62 delete testServer; |
|
63 delete sched; |
|
64 } |
|
65 |
|
66 GLDEF_C TInt E32Main() |
|
67 /** |
|
68 * @return - Standard Epoc error code on process exit |
|
69 * Secure variant only |
|
70 * Process entry point. Called by client using RProcess API |
|
71 */ |
|
72 { |
|
73 __UHEAP_MARK; |
|
74 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
75 if(cleanup == NULL) |
|
76 { |
|
77 return KErrNoMemory; |
|
78 } |
|
79 TRAPD(err,MainL()); |
|
80 delete cleanup; |
|
81 __UHEAP_MARKEND; |
|
82 return err; |
|
83 } |
|
84 |
|
85 CTestStep* CSimPacketTestServer::CreateTestStep(const TDesC& aStepName) |
|
86 /** |
|
87 * @return - A CTestStep derived instance |
|
88 * Secure and non-secure variants |
|
89 * Implementation of CTestServer pure virtual |
|
90 */ |
|
91 { |
|
92 // |
|
93 // Create the required test step... |
|
94 // |
|
95 CTestStep* testStep = NULL; |
|
96 |
|
97 if(aStepName == _L("GprsDefaultContextParamsTest")) |
|
98 { |
|
99 testStep = new CGprsDefaultContextParamsTest(); |
|
100 } |
|
101 else if(aStepName == _L("QoSTest")) |
|
102 { |
|
103 testStep = new CQoSTest(); |
|
104 } |
|
105 else if(aStepName == _L("GprsUnSupportedTest")) |
|
106 { |
|
107 testStep = new CGprsUnSupportedTest(); |
|
108 } |
|
109 else if(aStepName == _L("GprsContextAttachTest")) |
|
110 { |
|
111 testStep = new CGprsContextAttachTest(); |
|
112 } |
|
113 else if(aStepName == _L("GprsContextDeleteTest")) |
|
114 { |
|
115 testStep = new CGprsContextDeleteTest(); |
|
116 } |
|
117 else if(aStepName == _L("GprsContextLoanComport")) |
|
118 { |
|
119 testStep = new CGprsContextLoanComport(); |
|
120 } |
|
121 else if(aStepName == _L("GprsContextUnSupportedTest")) |
|
122 { |
|
123 testStep = new CGprsContextUnSupportedTest(); |
|
124 } |
|
125 else if(aStepName == _L("GprsCancelTest")) |
|
126 { |
|
127 testStep = new CGprsCancelTest(); |
|
128 } |
|
129 else if(aStepName == _L("GprsAttachTest")) |
|
130 { |
|
131 testStep = new CGprsAttachTest(); |
|
132 } |
|
133 else if(aStepName == _L("GprsNotificationTest")) |
|
134 { |
|
135 testStep = new CGprsNotificationTest(); |
|
136 } |
|
137 else if(aStepName == _L("GprsMsClassTest")) |
|
138 { |
|
139 testStep = new CGprsMsClassTest(); |
|
140 } |
|
141 else if(aStepName == _L("GprsContextConfigTest")) |
|
142 { |
|
143 testStep = new CGprsContextConfigTest(); |
|
144 } |
|
145 else if(aStepName == _L("GprsContextConfigNotificationsTest")) |
|
146 { |
|
147 testStep = new CGprsContextConfigNotificationsTest(); |
|
148 } |
|
149 else if(aStepName == _L("OpenGprsMaxContextsTest")) |
|
150 { |
|
151 testStep = new COpenGprsMaxContextsTest(); |
|
152 } |
|
153 else if(aStepName == _L("GprsContextConfigArbitraryAddressTest")) |
|
154 { |
|
155 testStep = new CGprsContextConfigArbitraryAddressTest(); |
|
156 } |
|
157 else if(aStepName == _L("EtelPcktMbmsCap1")) |
|
158 { |
|
159 testStep = new CMbmsOpenNewContextTest(); |
|
160 } |
|
161 else if(aStepName == _L("EtelPcktMbmsCap2")) |
|
162 { |
|
163 testStep = new CMbmsUpdateSessionTest(); |
|
164 } |
|
165 else if(aStepName == _L("EtelPcktMbmsCap3")) |
|
166 { |
|
167 testStep = new CGetMbmsNetworkServiceStatus(); |
|
168 } |
|
169 else if(aStepName == _L("EtelPcktMbmsCap4")) |
|
170 { |
|
171 testStep = new CNotifyMbmsNetworkServiceStatusChange(); |
|
172 } |
|
173 else if(aStepName == _L("EtelPcktMbmsCap5")) |
|
174 { |
|
175 testStep = new CNotifyMbmsServiceAvailabilityChange(); |
|
176 } |
|
177 else if(aStepName == _L("EtelPcktMbmsCap6")) |
|
178 { |
|
179 testStep = new CUpdateMbmsMonitorServiceList(); |
|
180 } |
|
181 else if(aStepName == _L("EtelPcktMbmsCap7")) |
|
182 { |
|
183 testStep = new CEnumerateMbmsActiveServiceList(); |
|
184 } |
|
185 else if(aStepName == _L("EtelPcktMbmsCap8")) |
|
186 { |
|
187 testStep = new CEnumerateMbmsMonitorServiceList(); |
|
188 } |
|
189 else if(aStepName == _L("TestMultipleCompletionWithClosingContext")) |
|
190 { |
|
191 testStep = new CTestMultipleCompletionWithClosingContext(); |
|
192 } |
|
193 else if (aStepName == _L("TestDynamicCaps")) |
|
194 { |
|
195 testStep = new CTestDynamicCaps(); |
|
196 } |
|
197 // |
|
198 // Set the test step name here to save code!!! |
|
199 // |
|
200 if (testStep != NULL) |
|
201 { |
|
202 testStep->SetTestStepName(aStepName); |
|
203 } |
|
204 |
|
205 return testStep; |
|
206 } |
|
207 |
|
208 |
|
209 |
|
210 |