|
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 // @file CT_LbsClientServer.cpp |
|
15 // This is the class implementation for the LBS Client Test Server |
|
16 // |
|
17 // |
|
18 |
|
19 // User includes |
|
20 #include "ctlbsclientserver.h" |
|
21 |
|
22 // System includes |
|
23 #include <e32std.h> |
|
24 #include <rsshared.h> |
|
25 |
|
26 // Header files of LBS Client API Test Steps |
|
27 #include "ctlbsstepconfighybridmodule.h" |
|
28 #include "ctlbsclientstepsrvconnectclose.h" |
|
29 #include "ctlbsclientstepnotifyposupdate.h" |
|
30 #include "ctlbsclientstepcellbasednpud.h" |
|
31 #include "ctlbsclientstepmodselect.h" |
|
32 #include "ctlbsclientstepmodinfo.h" |
|
33 #include "ctlbsclientsteplastknownpos.h" |
|
34 #include "ctlbsclientsteplastknownposarea.h" |
|
35 #include "ctlbsclientsteplastknownposareasources.h" |
|
36 #include "ctlbsclientstepconcurrent.h" |
|
37 #include "ctlbsclientstepmultireq.h" |
|
38 #include "ctlbsclientstepmodstatus.h" |
|
39 #include "ctlbsclientstepupdateoptions.h" |
|
40 #include "ctlbsclientstepassistance.h" |
|
41 #include "ctlbsclientsteppartialupdate.h" |
|
42 #include "ctlbsclientsteptracking.h" |
|
43 #include "ctlbsclientstepignoreaccurracysetting.h" |
|
44 #include "ctlbsclientstepignoreaccurracysettingtracking.h" |
|
45 #include "ctlbsclientstep_reset_assistance.h" |
|
46 |
|
47 /** |
|
48 NewL() |
|
49 Constructs a CT_LbsClientServer object. |
|
50 Uses two phase construction and leaves nothing on the CleanupStack. |
|
51 @internalTechnology |
|
52 @param none |
|
53 @return Created object of type CT_LbsClientServer |
|
54 @pre None |
|
55 @post None |
|
56 */ |
|
57 CT_LbsClientServer* CT_LbsClientServer::NewL() |
|
58 { |
|
59 CT_LbsClientServer*server = new(ELeave) CT_LbsClientServer(); |
|
60 CleanupStack::PushL(server); |
|
61 server->ConstructL(KLbsClientTestServer); |
|
62 CleanupStack::Pop(server); |
|
63 return server; |
|
64 } |
|
65 |
|
66 /** |
|
67 MainL() |
|
68 Description : This is the main function which installs the |
|
69 active scheduler and creates an object of the Email server |
|
70 @internalTechnology |
|
71 @param none |
|
72 @return none |
|
73 @pre None |
|
74 @post None |
|
75 */ |
|
76 LOCAL_C void MainL() |
|
77 { |
|
78 __UHEAP_MARK; |
|
79 CActiveScheduler* sched = new (ELeave) CActiveScheduler; |
|
80 CleanupStack::PushL(sched); |
|
81 CActiveScheduler::Install(sched); |
|
82 |
|
83 __UHEAP_MARK; |
|
84 // this registers the server with the active scheduler and calls SetActive |
|
85 CT_LbsClientServer* server = CT_LbsClientServer::NewL(); |
|
86 |
|
87 // signal to the client that we are ready by |
|
88 // rendevousing process |
|
89 RProcess::Rendezvous(KErrNone); |
|
90 |
|
91 // run the active scheduler |
|
92 sched->Start(); |
|
93 |
|
94 // clean up |
|
95 delete server; |
|
96 |
|
97 __UHEAP_MARKEND; |
|
98 |
|
99 CleanupStack::PopAndDestroy(sched); |
|
100 __UHEAP_MARKEND; |
|
101 } |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 /** |
|
107 E32Main() |
|
108 Description : It is the entry point |
|
109 @internalTechnology |
|
110 @param none |
|
111 @return Returns the error code |
|
112 @pre None |
|
113 @post None |
|
114 */ |
|
115 GLDEF_C TInt E32Main() |
|
116 { |
|
117 __UHEAP_MARK; |
|
118 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
119 if(cleanup == NULL) |
|
120 { |
|
121 return KErrNoMemory; |
|
122 } |
|
123 |
|
124 TRAPD(err, MainL()); |
|
125 |
|
126 delete cleanup; |
|
127 __UHEAP_MARKEND; |
|
128 |
|
129 return err; |
|
130 } |
|
131 |
|
132 |
|
133 CT_LbsClientServer::~CT_LbsClientServer() |
|
134 { |
|
135 // DELETE EVERYTHIGN THAT IS ALLOCATED IN THE ConstructL(!) |
|
136 delete iSharedData; |
|
137 iSharedData = NULL; |
|
138 } |
|
139 |
|
140 |
|
141 /** |
|
142 Function : CT_LbsClientServer |
|
143 Description : Constructor |
|
144 @internalTechnology |
|
145 @param : |
|
146 @return : N/A |
|
147 @precondition : none |
|
148 @postcondition : none |
|
149 */ |
|
150 CT_LbsClientServer::CT_LbsClientServer() |
|
151 { |
|
152 } |
|
153 |
|
154 /** |
|
155 Function : ConstructL |
|
156 Description : |
|
157 @internalTechnology |
|
158 @param : |
|
159 @return : N/A |
|
160 @precondition : none |
|
161 @postcondition : none |
|
162 */ |
|
163 void CT_LbsClientServer::ConstructL(const TDesC& aName) |
|
164 { |
|
165 CT_LbsServer::ConstructL(aName); |
|
166 |
|
167 iSharedData = CT_LbsSharedData::NewL(); |
|
168 } |
|
169 |
|
170 |
|
171 /** |
|
172 Function : CreateTestStep |
|
173 Description : Creates a test step based on the step name read from the script file |
|
174 @internalTechnology |
|
175 @param : aStepName The step name which needs to be created |
|
176 @return : Created object of type CTestStep |
|
177 @precondition : none |
|
178 @postcondition : none |
|
179 */ |
|
180 CTestStep* CT_LbsClientServer::CreateTestStep(const TDesC& aStepName) |
|
181 { |
|
182 // NULL if insufficient memory. This suits the API. |
|
183 |
|
184 // Test case test steps, each test step supports one or more test cases. |
|
185 if(aStepName == KLbsStep_ConfigHybridModule) |
|
186 { |
|
187 return CT_LbsStep_ConfigHybridModule::New(*this); |
|
188 } |
|
189 |
|
190 if(aStepName == KLbsClientStep_SrvConnectClose) |
|
191 { |
|
192 return CT_LbsClientStep_SrvConnectClose::New(*this); |
|
193 } |
|
194 |
|
195 |
|
196 if(aStepName == KLbsClientStep_NotifyPosUpdate) |
|
197 { |
|
198 return CT_LbsClientStep_NotifyPosUpdate::New(*this); |
|
199 } |
|
200 |
|
201 if(aStepName == KLbsClientStep_CellBasedNotifyPosUpdate) |
|
202 { |
|
203 return CT_LbsClientStep_CellBasedNotifyPosUpdate::New(*this); |
|
204 } |
|
205 |
|
206 if(aStepName == KLbsClientStep_ModSelect) |
|
207 { |
|
208 return CT_LbsClientStep_ModSelect::New(*this); |
|
209 } |
|
210 |
|
211 if(aStepName == KLbsClientStep_ModInfo) |
|
212 { |
|
213 return CT_LbsClientStep_ModInfo::New(*this); |
|
214 } |
|
215 |
|
216 if(aStepName == KLbsClientStep_LastKnownPos) |
|
217 { |
|
218 return CT_LbsClientStep_LastKnownPos::New(*this); |
|
219 } |
|
220 if(aStepName == KLbsClientStep_LastKnownPosArea) |
|
221 { |
|
222 return CT_LbsClientStep_LastKnownPosArea::New(*this); |
|
223 } |
|
224 if(aStepName == KLbsClientStep_LastKnownPosAreaSources) |
|
225 { |
|
226 return CT_LbsClientStep_LastKnownPosAreaSources::New(*this); |
|
227 } |
|
228 if(aStepName == KLbsClientStepConcurrent) |
|
229 { |
|
230 return CT_LbsClientStep_Concurrent::New(); |
|
231 } |
|
232 if(aStepName == KLbsClientStep_MultiReq) |
|
233 { |
|
234 return CT_LbsClientStep_MultiReq::New(*this); |
|
235 } |
|
236 |
|
237 if(aStepName == KLbsClientStep_ModStatus) |
|
238 { |
|
239 return CT_LbsClientStep_ModStat::New(*this); |
|
240 } |
|
241 |
|
242 if(aStepName == KLbsClientStep_UpdateOptions) |
|
243 { |
|
244 return CT_LbsClientStep_UpdateOptions::New(*this); |
|
245 } |
|
246 |
|
247 if(aStepName == KLbsClientStep_Assistance) |
|
248 { |
|
249 return CT_LbsClientStep_Assistance::New(*this); |
|
250 } |
|
251 |
|
252 if(aStepName == KLbsClientStep_PartialUpdate) |
|
253 { |
|
254 return CT_LbsClientStep_PartialUpdate::New(*this); |
|
255 } |
|
256 if(aStepName == KLbsClientStep_IgnoreAccuracySetting) |
|
257 { |
|
258 return CT_LbsClientStep_IgnoreAccuracySetting::New(*this); |
|
259 } |
|
260 if(aStepName == KLbsClientStep_IgnoreAccuracySettingTracking) |
|
261 { |
|
262 return CT_LbsClientStep_IgnoreAccuracySettingTracking::New(*this); |
|
263 } |
|
264 |
|
265 if (aStepName == KLbsClientStep_Tracking) |
|
266 { |
|
267 return CT_LbsClientStep_Tracking::New(*this); |
|
268 } |
|
269 |
|
270 if (aStepName == KLbsClientStep_Tracking) |
|
271 { |
|
272 return CT_LbsClientStep_Tracking::New(*this); |
|
273 } |
|
274 |
|
275 if (aStepName == KLbsClientStep_ResetAssistance) |
|
276 { |
|
277 return CT_LbsClientStep_ResetAssistance::New(*this); |
|
278 } |
|
279 |
|
280 // Let base class handle any common test steps - will return NULL if test step is not supported. |
|
281 return CT_LbsServer::CreateTestStep(aStepName); |
|
282 } |