|
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 Combined Test Server |
|
16 // |
|
17 // |
|
18 |
|
19 // System includes |
|
20 #include <e32std.h> |
|
21 #include <rsshared.h> |
|
22 |
|
23 // User includes |
|
24 #include "ctlbshybridcombinedserver.h" |
|
25 #include "ctlbsstepsetuproamselflocate.h" |
|
26 #include "ctlbsstepconfighybridmodule.h" |
|
27 |
|
28 // i don't know why this isn't in the base class.... |
|
29 #include "ctlbsstepsetupprotocolstub.h" |
|
30 |
|
31 #include "ctlbshybridcombinedstep_sequential01.h" |
|
32 #include "ctlbshybridcombinedstep_sequential02.h" |
|
33 #include "ctlbshybridcombinedstep_concurrent01.h" |
|
34 #include "ctlbshybridcombinedstep_concurrent02.h" |
|
35 #include "ctlbshybridcombinedstep_tracking01.h" |
|
36 #include "ctlbshybridcombinedstep_tracking02.h" |
|
37 |
|
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_LbsHybridCombinedServer* server = CT_LbsHybridCombinedServer::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 NewL() |
|
103 Constructs a CT_LbsHybridCombinedServer object. |
|
104 Uses two phase construction and leaves nothing on the CleanupStack. |
|
105 @internalTechnology |
|
106 @param none |
|
107 @return Created object of type CT_LbsHybridCombinedServer |
|
108 @pre None |
|
109 @post None |
|
110 */ |
|
111 CT_LbsHybridCombinedServer* CT_LbsHybridCombinedServer::NewL() |
|
112 { |
|
113 CT_LbsHybridCombinedServer*server = new(ELeave) CT_LbsHybridCombinedServer(); |
|
114 CleanupStack::PushL(server); |
|
115 server->ConstructL(KLbsHybridCombinedTestServer); |
|
116 CleanupStack::Pop(server); |
|
117 return server; |
|
118 } |
|
119 |
|
120 |
|
121 |
|
122 CT_LbsHybridCombinedServer::~CT_LbsHybridCombinedServer() |
|
123 { |
|
124 } |
|
125 |
|
126 |
|
127 /** |
|
128 Function : CT_LbsHybridCombinedServer |
|
129 Description : Constructor |
|
130 @internalTechnology |
|
131 @param : |
|
132 @return : N/A |
|
133 @precondition : none |
|
134 @postcondition : none |
|
135 */ |
|
136 CT_LbsHybridCombinedServer::CT_LbsHybridCombinedServer() |
|
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_LbsHybridCombinedServer::ConstructL(const TDesC& aName) |
|
150 { |
|
151 CT_LbsServer::ConstructL(aName); |
|
152 |
|
153 iSharedData = CT_LbsHybridCombinedSharedData::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_LbsHybridCombinedServer::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 == KLbsStep_SetupRoamSelfLocate) |
|
172 { |
|
173 return CT_LbsStep_SetupRoamSelfLocate::New(*this); |
|
174 } |
|
175 else if(aStepName == KLbsStep_SetupProtocolStub) |
|
176 { |
|
177 return CT_LbsStep_SetupProtocolStub::New(*this); |
|
178 } |
|
179 else if(aStepName == KLbsStep_ConfigHybridModule) |
|
180 { |
|
181 return CT_LbsStep_ConfigHybridModule::New(*this); |
|
182 } |
|
183 |
|
184 else if(aStepName == KLbsHybridCombinedStep_Sequential01) |
|
185 { |
|
186 return CT_LbsHybridCombinedStep_Sequential01::New(*this); |
|
187 } |
|
188 else if(aStepName == KLbsHybridCombinedStep_Sequential02) |
|
189 { |
|
190 return CT_LbsHybridCombinedStep_Sequential02::New(*this); |
|
191 } |
|
192 else if(aStepName == KLbsHybridCombinedStep_Concurrent01) |
|
193 { |
|
194 return CT_LbsHybridCombinedStep_Concurrent01::New(*this); |
|
195 } |
|
196 else if(aStepName == KLbsHybridCombinedStep_Concurrent02) |
|
197 { |
|
198 return CT_LbsHybridCombinedStep_Concurrent02::New(*this); |
|
199 } |
|
200 else if(aStepName == KLbsHybridCombinedStep_Tracking01) |
|
201 { |
|
202 return CT_LbsHybridCombinedStep_Tracking01::New(*this); |
|
203 } |
|
204 else if(aStepName == KLbsHybridCombinedStep_Tracking02) |
|
205 { |
|
206 return CT_LbsHybridCombinedStep_Tracking02::New(*this); |
|
207 } |
|
208 |
|
209 // Let base class handle any common test steps - will return NULL if test step is not supported. |
|
210 return CT_LbsServer::CreateTestStep(aStepName); |
|
211 } |
|
212 |