|
1 // Copyright (c) 2007-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 ctlbshybridx3pserver.h.cpp |
|
15 // System includes |
|
16 // |
|
17 // |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <rsshared.h> |
|
21 |
|
22 // User includes |
|
23 #include "ctlbshybridx3pserver.h" |
|
24 #include "ctlbsuebasedx3p.h" |
|
25 #include "ctlbshybridueassistedx3pnogps.h" |
|
26 #include "ctlbshybridueassistedx3paccurategps.h" |
|
27 #include "ctlbsstepsetupprotocolstub.h" |
|
28 #include "ctlbsstepconfighybridmodule.h" |
|
29 #include "ctlbshybridueassistedx3pnogpstimeout.h" |
|
30 #include "ctlbshybridueassistedx3paccurategpstimeout.h" |
|
31 #include "ctlbshybriduebasedx3pgpsfutile.h" |
|
32 #include "ctlbshybridueassistedx3pgpsfutile.h" |
|
33 #include "ctlbshybridueassistedx3pclienttimeout.h" |
|
34 #include "ctlbsx3pAccRefPos.h" |
|
35 #include "ctlbsx3pgpsoptions.h" |
|
36 #include "ctlbsx3presetassistance.h" |
|
37 |
|
38 // Header files of LBS Client API Test Steps |
|
39 |
|
40 /** |
|
41 MainL() |
|
42 Description : This is the main function which installs the |
|
43 active scheduler and creates an object of the Email server |
|
44 @internalTechnology |
|
45 @param none |
|
46 @return none |
|
47 @pre None |
|
48 @post None |
|
49 */ |
|
50 LOCAL_C void MainL() |
|
51 { |
|
52 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
53 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
54 CActiveScheduler* sched = new (ELeave) CActiveScheduler; |
|
55 CleanupStack::PushL(sched); |
|
56 CActiveScheduler::Install(sched); |
|
57 |
|
58 __UHEAP_MARK; |
|
59 // this registers the server with the active scheduler and calls SetActive |
|
60 CT_LbsHybridX3PServer* server = CT_LbsHybridX3PServer::NewL(); |
|
61 |
|
62 // signal to the client that we are ready by |
|
63 // rendevousing process |
|
64 RProcess::Rendezvous(KErrNone); |
|
65 |
|
66 // run the active scheduler |
|
67 sched->Start(); |
|
68 |
|
69 // clean up |
|
70 delete server; |
|
71 __UHEAP_MARKEND; |
|
72 CleanupStack::PopAndDestroy(sched); |
|
73 } |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 /** |
|
79 E32Main() |
|
80 Description : It is the entry point |
|
81 @internalTechnology |
|
82 @param none |
|
83 @return Returns the error code |
|
84 @pre None |
|
85 @post None |
|
86 */ |
|
87 GLDEF_C TInt E32Main() |
|
88 { |
|
89 __UHEAP_MARK; |
|
90 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
91 if(cleanup == NULL) |
|
92 { |
|
93 return KErrNoMemory; |
|
94 } |
|
95 |
|
96 TRAPD(err, MainL()); |
|
97 |
|
98 delete cleanup; |
|
99 __UHEAP_MARKEND; |
|
100 |
|
101 return err; |
|
102 } |
|
103 |
|
104 |
|
105 |
|
106 /** |
|
107 NewL() |
|
108 Constructs a CT_LbsClientServer object. |
|
109 Uses two phase construction and leaves nothing on the CleanupStack. |
|
110 @internalTechnology |
|
111 @param none |
|
112 @return Created object of type CT_LbsClientServer |
|
113 @pre None |
|
114 @post None |
|
115 */ |
|
116 CT_LbsHybridX3PServer* CT_LbsHybridX3PServer::NewL() |
|
117 { |
|
118 CT_LbsHybridX3PServer* server = new(ELeave) CT_LbsHybridX3PServer(); |
|
119 CleanupStack::PushL(server); |
|
120 server->ConstructL(KLbsHybridX3PTestServer); |
|
121 CleanupStack::Pop(server); |
|
122 return server; |
|
123 } |
|
124 |
|
125 |
|
126 CT_LbsHybridX3PServer::~CT_LbsHybridX3PServer() |
|
127 { |
|
128 } |
|
129 |
|
130 |
|
131 /** |
|
132 Function : CT_LbsClientServer |
|
133 Description : Constructor |
|
134 @internalTechnology |
|
135 @param : |
|
136 @return : N/A |
|
137 @precondition : none |
|
138 @postcondition : none |
|
139 */ |
|
140 CT_LbsHybridX3PServer::CT_LbsHybridX3PServer() |
|
141 { |
|
142 } |
|
143 |
|
144 /** |
|
145 Function : ConstructL |
|
146 Description : |
|
147 @internalTechnology |
|
148 @param : |
|
149 @return : N/A |
|
150 @precondition : none |
|
151 @postcondition : none |
|
152 */ |
|
153 void CT_LbsHybridX3PServer::ConstructL(const TDesC& aName) |
|
154 { |
|
155 CT_LbsServer::ConstructL(aName); |
|
156 iSharedData = CT_LbsSharedData::NewL(); |
|
157 } |
|
158 |
|
159 |
|
160 /** |
|
161 Function : CreateTestStep |
|
162 Description : Creates a test step based on the step name read from the script file |
|
163 @internalTechnology |
|
164 @param : aStepName The step name which needs to be created |
|
165 @return : Created object of type CTestStep |
|
166 @precondition : none |
|
167 @postcondition : none |
|
168 */ |
|
169 CTestStep* CT_LbsHybridX3PServer::CreateTestStep(const TDesC& aStepName) |
|
170 { |
|
171 if(aStepName == KLbsStep_SetupProtocolStub) |
|
172 { |
|
173 return CT_LbsStep_SetupProtocolStub::New(*this); |
|
174 } |
|
175 else if(aStepName == KLbsStep_ConfigHybridModule) |
|
176 { |
|
177 return CT_LbsStep_ConfigHybridModule::New(*this); |
|
178 } |
|
179 else if (aStepName == KLbsUEBasedX3P) |
|
180 { |
|
181 return CT_LbsUEBasedX3P::New(*this); |
|
182 } |
|
183 else if(aStepName == KLbsHybridUEAssistedX3PNoGPS) |
|
184 { |
|
185 return CT_LbsHybridUEAssistedX3PNoGPS::New(*this); |
|
186 } |
|
187 else if(aStepName == KLbsHybridUEAssistedX3PAccurateGPS) |
|
188 { |
|
189 return CT_LbsHybridUEAssistedX3PAccurateGPS::New(*this); |
|
190 } |
|
191 else if(aStepName == KLbsHybridUEAssistedX3PNoGPSTimeout) |
|
192 { |
|
193 return CT_LbsHybridUEAssistedX3PNoGPSTimeout::New(*this); |
|
194 } |
|
195 else if(aStepName == KLbsHybridUEAssistedX3PAccurateGPSTimeout) |
|
196 { |
|
197 return CT_LbsHybridUEAssistedX3PAccurateGPSTimeout::New(*this); |
|
198 } |
|
199 else if (aStepName == KLbsHybridUEBasedX3PGPSFutile) |
|
200 { |
|
201 return CT_LbsHybridUEBasedX3PGPSFutile::New(*this); |
|
202 } |
|
203 else if (aStepName == KLbsHybridUEAssistedX3PGPSFutile) |
|
204 { |
|
205 return CT_LbsHybridUEAssistedX3PGPSFutile::New(*this); |
|
206 } |
|
207 else if(aStepName == KLbsHybridUEAssistedX3PClientTimeout) |
|
208 { |
|
209 return CT_LbsHybridUEAssistedX3PClientTimeout::New(*this); |
|
210 } |
|
211 else if(aStepName == KLbsX3pAccurateReferencePosition) |
|
212 { |
|
213 return CT_LbsX3pAccRefPos::New(*this); |
|
214 } |
|
215 else if (aStepName == KLbsX3PGpsOptions) |
|
216 { |
|
217 return CT_LbsX3PGpsOptions::New(*this); |
|
218 } |
|
219 else if (aStepName == KLbsX3PResetAssistance) |
|
220 { |
|
221 return CT_LbsX3PResetAssistance::New(*this); |
|
222 } |
|
223 // Let base class handle any common test steps - will return NULL if test step is not supported. |
|
224 return CT_LbsServer::CreateTestStep(aStepName); |
|
225 } |
|
226 |