|
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 "ctlbsassdataserver.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 "ctlbsassdatastepmain.h" |
|
28 #include "ctlbsroamingstep.h" |
|
29 /** |
|
30 MainL() |
|
31 Description : This is the main function which installs the |
|
32 active scheduler and creates an object of the Email server |
|
33 @internalTechnology |
|
34 @param none |
|
35 @return none |
|
36 @pre None |
|
37 @post None |
|
38 */ |
|
39 LOCAL_C void MainL() |
|
40 { |
|
41 CActiveScheduler* sched = new (ELeave) CActiveScheduler; |
|
42 CleanupStack::PushL(sched); |
|
43 CActiveScheduler::Install(sched); |
|
44 |
|
45 __UHEAP_MARK; |
|
46 // this registers the server with the active scheduler and calls SetActive |
|
47 CT_LbsAssDataServer* server = CT_LbsAssDataServer::NewL(); |
|
48 |
|
49 // signal to the client that we are ready by |
|
50 // rendevousing process |
|
51 RProcess::Rendezvous(KErrNone); |
|
52 |
|
53 // run the active scheduler |
|
54 sched->Start(); |
|
55 |
|
56 // clean up |
|
57 delete server; |
|
58 __UHEAP_MARKEND; |
|
59 CleanupStack::PopAndDestroy(sched); |
|
60 } |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 /** |
|
66 E32Main() |
|
67 Description : It is the entry point |
|
68 @internalTechnology |
|
69 @param none |
|
70 @return Returns the error code |
|
71 @pre None |
|
72 @post None |
|
73 */ |
|
74 GLDEF_C TInt E32Main() |
|
75 { |
|
76 __UHEAP_MARK; |
|
77 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
78 if(cleanup == NULL) |
|
79 { |
|
80 return KErrNoMemory; |
|
81 } |
|
82 |
|
83 TRAPD(err, MainL()); |
|
84 |
|
85 delete cleanup; |
|
86 __UHEAP_MARKEND; |
|
87 |
|
88 return err; |
|
89 } |
|
90 |
|
91 |
|
92 |
|
93 /** |
|
94 NewL() |
|
95 Constructs a CT_LbsClientServer object. |
|
96 Uses two phase construction and leaves nothing on the CleanupStack. |
|
97 @internalTechnology |
|
98 @param none |
|
99 @return Created object of type CT_LbsClientServer |
|
100 @pre None |
|
101 @post None |
|
102 */ |
|
103 CT_LbsAssDataServer* CT_LbsAssDataServer::NewL() |
|
104 { |
|
105 CT_LbsAssDataServer*server = new(ELeave) CT_LbsAssDataServer(); |
|
106 CleanupStack::PushL(server); |
|
107 server->ConstructL(KLbsAssDataTestServer); |
|
108 CleanupStack::Pop(server); |
|
109 return server; |
|
110 } |
|
111 |
|
112 |
|
113 CT_LbsAssDataServer::~CT_LbsAssDataServer() |
|
114 { |
|
115 } |
|
116 |
|
117 |
|
118 /** |
|
119 Function : CT_LbsClientServer |
|
120 Description : Constructor |
|
121 @internalTechnology |
|
122 @param : |
|
123 @return : N/A |
|
124 @precondition : none |
|
125 @postcondition : none |
|
126 */ |
|
127 CT_LbsAssDataServer::CT_LbsAssDataServer() |
|
128 { |
|
129 } |
|
130 |
|
131 /** |
|
132 Function : ConstructL |
|
133 Description : |
|
134 @internalTechnology |
|
135 @param : |
|
136 @return : N/A |
|
137 @precondition : none |
|
138 @postcondition : none |
|
139 */ |
|
140 void CT_LbsAssDataServer::ConstructL(const TDesC& aName) |
|
141 { |
|
142 CT_LbsServer::ConstructL(aName); |
|
143 |
|
144 iSharedData = CT_LbsAssDataSharedData::NewL(); |
|
145 } |
|
146 |
|
147 |
|
148 /** |
|
149 Function : CreateTestStep |
|
150 Description : Creates a test step based on the step name read from the script file |
|
151 @internalTechnology |
|
152 @param : aStepName The step name which needs to be created |
|
153 @return : Created object of type CTestStep |
|
154 @precondition : none |
|
155 @postcondition : none |
|
156 */ |
|
157 CTestStep* CT_LbsAssDataServer::CreateTestStep(const TDesC& aStepName) |
|
158 { |
|
159 // NULL if insufficient memory. This suits the API. |
|
160 |
|
161 // Test case test steps, each test step supports one or more test cases. |
|
162 if(aStepName == KLbsAssDataStep_Main) |
|
163 { |
|
164 return CT_LbsAssDataStep_Main::New(*this); |
|
165 } |
|
166 |
|
167 |
|
168 if(aStepName == KLbsRoamingStep) |
|
169 { |
|
170 return CT_LbsRoamingStep::New(*this); |
|
171 } |
|
172 |
|
173 |
|
174 // Let base class handle any common test steps - will return NULL if test step is not supported. |
|
175 return CT_LbsServer::CreateTestStep(aStepName); |
|
176 } |
|
177 |