|
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 CTLbsHybridMTLRServer.cpp |
|
15 // This is the class implementation for the LBS Hybrid MTLR Test Server |
|
16 // |
|
17 // |
|
18 |
|
19 // System includes |
|
20 #include <e32std.h> |
|
21 #include <rsshared.h> |
|
22 |
|
23 // User includes |
|
24 #include "ctlbshybridmtlrserver.h" |
|
25 #include "ctlbsuebasedmtlr.h" |
|
26 #include "ctlbshybridueassistedmtlrnw.h" |
|
27 #include "ctlbshybridueassistedmtlrgpsok.h" |
|
28 #include "ctlbsstepsetupprotocolstub.h" |
|
29 #include "ctlbsstepconfighybridmodule.h" |
|
30 #include "ctlbshybridueassistedmtlrtimeout.h" |
|
31 #include "ctlbshybridueassistedmtlrnogps.h" |
|
32 #include "ctlbshybridmtlrfutile.h" |
|
33 #include "ctlbsmtlrAccRefPos.h" |
|
34 #include "ctlbsmtlrgpsoptions.h" |
|
35 #include "ctlbsmtlrresetassistance.h" |
|
36 #include "ctlbsnetworkinducedmtlr.h" |
|
37 #include "ctlbsoom.h" |
|
38 /** |
|
39 MainL() |
|
40 Description : This is the main function which installs the |
|
41 active scheduler and creates a server |
|
42 @internalTechnology |
|
43 @param none |
|
44 @return none |
|
45 @pre None |
|
46 @post None |
|
47 */ |
|
48 LOCAL_C void MainL() |
|
49 { |
|
50 CActiveScheduler* sched = new (ELeave) CActiveScheduler; |
|
51 CleanupStack::PushL(sched); |
|
52 CActiveScheduler::Install(sched); |
|
53 |
|
54 __UHEAP_MARK; |
|
55 // this registers the server with the active scheduler and calls SetActive |
|
56 CT_LbsHybridMTLRServer* server = CT_LbsHybridMTLRServer::NewL(); |
|
57 |
|
58 // signal to the client that we are ready by |
|
59 // rendevousing process |
|
60 RProcess::Rendezvous(KErrNone); |
|
61 |
|
62 // run the active scheduler |
|
63 sched->Start(); |
|
64 |
|
65 // clean up |
|
66 delete server; |
|
67 __UHEAP_MARKEND; |
|
68 CleanupStack::PopAndDestroy(sched); |
|
69 } |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 /** |
|
75 E32Main() |
|
76 Description : It is the entry point |
|
77 @internalTechnology |
|
78 @param none |
|
79 @return Returns the error code |
|
80 @pre None |
|
81 @post None |
|
82 */ |
|
83 GLDEF_C TInt E32Main() |
|
84 { |
|
85 __UHEAP_MARK; |
|
86 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
87 if(cleanup == NULL) |
|
88 { |
|
89 return KErrNoMemory; |
|
90 } |
|
91 |
|
92 TRAPD(err, MainL()); |
|
93 |
|
94 delete cleanup; |
|
95 __UHEAP_MARKEND; |
|
96 |
|
97 return err; |
|
98 } |
|
99 |
|
100 |
|
101 |
|
102 /** |
|
103 NewL() |
|
104 Constructs a CT_LbsHybridMTLRServer object. |
|
105 Uses two phase construction and leaves nothing on the CleanupStack. |
|
106 @internalTechnology |
|
107 @param none |
|
108 @return Created object of type CT_LbsClientServer |
|
109 @pre None |
|
110 @post None |
|
111 */ |
|
112 CT_LbsHybridMTLRServer* CT_LbsHybridMTLRServer::NewL() |
|
113 { |
|
114 CT_LbsHybridMTLRServer*server = new(ELeave) CT_LbsHybridMTLRServer(); |
|
115 CleanupStack::PushL(server); |
|
116 server->ConstructL(KLbsHybridMTLRTestServer); |
|
117 CleanupStack::Pop(server); |
|
118 return server; |
|
119 } |
|
120 |
|
121 |
|
122 CT_LbsHybridMTLRServer::~CT_LbsHybridMTLRServer() |
|
123 { |
|
124 } |
|
125 |
|
126 |
|
127 /** |
|
128 Function : CT_LbsHybridMTLRServer |
|
129 Description : Constructor |
|
130 @internalTechnology |
|
131 @param : |
|
132 @return : N/A |
|
133 @precondition : none |
|
134 @postcondition : none |
|
135 */ |
|
136 CT_LbsHybridMTLRServer::CT_LbsHybridMTLRServer() |
|
137 { |
|
138 } |
|
139 |
|
140 /** |
|
141 Function : ConstructL |
|
142 Description : |
|
143 @internalTechnology |
|
144 @param : |
|
145 @return : N/A |
|
146 @precondition : none |
|
147 @postcondition : none |
|
148 */ |
|
149 void CT_LbsHybridMTLRServer::ConstructL(const TDesC& aName) |
|
150 { |
|
151 CT_LbsServer::ConstructL(aName); |
|
152 |
|
153 iSharedData = CT_LbsHybridMTLRSharedData::NewL(); |
|
154 } |
|
155 |
|
156 |
|
157 /** |
|
158 Function : CreateTestStep |
|
159 Description : Creates a test step based on the step name read from the script file |
|
160 @internalTechnology |
|
161 @param : aStepName The step name which needs to be created |
|
162 @return : Created object of type CTestStep |
|
163 @precondition : none |
|
164 @postcondition : none |
|
165 */ |
|
166 CTestStep* CT_LbsHybridMTLRServer::CreateTestStep(const TDesC& aStepName) |
|
167 { |
|
168 // NULL if insufficient memory. This suits the API. |
|
169 |
|
170 // Test case test steps, each test step supports one or more test cases. |
|
171 if(aStepName == KLbsUEBasedMTLR) |
|
172 { |
|
173 return CT_LbsUEBasedMTLR::New(*this); |
|
174 } |
|
175 else if(aStepName == KLbsHybridUEAssitedMTLRNW) |
|
176 { |
|
177 return CT_LbsHybridUEAssistedMTLRNW::New(*this); |
|
178 } |
|
179 else if(aStepName == KLbsHybridUEAssistedMTLRGPSOK) |
|
180 { |
|
181 return CT_LbsHybridUEAssistedMTLRGPSOK::New(*this); |
|
182 } |
|
183 else if(aStepName == KLbsStep_SetupProtocolStub) |
|
184 { |
|
185 return CT_LbsStep_SetupProtocolStub::New(*this); |
|
186 } |
|
187 else if(aStepName == KLbsStep_ConfigHybridModule) |
|
188 { |
|
189 return CT_LbsStep_ConfigHybridModule::New(*this); |
|
190 } |
|
191 else if(aStepName == KLbsHybridUEAssitedMTLRTimeout) |
|
192 { |
|
193 return CT_LbsHybridUEAssistedMTLRTimeout::New(*this); |
|
194 } |
|
195 else if(aStepName == KLbsHybridUEAssitedMTLRNoGPS) |
|
196 { |
|
197 return CT_LbsHybridUEAssistedMTLRNoGPS::New(*this); |
|
198 } |
|
199 else if(aStepName == KLbsHybridMTLRFutile) |
|
200 { |
|
201 return CT_LbsHybridMTLRFutile::New(*this); |
|
202 } |
|
203 else if(aStepName == KLbsMTLRAccurateReferencePosition) |
|
204 { |
|
205 return CT_LbsMtlrAccRefPos::New(*this); |
|
206 } |
|
207 else if(aStepName == KLbsMTLRGpsOptions) |
|
208 { |
|
209 return CT_LbsMTLRGpsOptions::New(*this); |
|
210 } |
|
211 else if(aStepName == KLbsMTLRResetAssistance) |
|
212 { |
|
213 return CT_LbsMTLRResetAssistance::New(*this); |
|
214 } |
|
215 else if (aStepName == KLbsNetworkInducedMTLR) |
|
216 { |
|
217 return CT_LbsNetworkInducedMTLR::New(*this); |
|
218 } |
|
219 else if (aStepName == KLbsOom) |
|
220 { |
|
221 return CT_LbsOom::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 } |