|
1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 // INCLUDES |
|
19 #include "ctlbsclientpostp269.h" |
|
20 #include <LbsSatellite.h> |
|
21 #include <EPos_CPosModules.h> |
|
22 #include <EPos_CPosModuleUpdate.h> |
|
23 #include <EPos_CPosModuleIdList.h> |
|
24 #include <e32std.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 const TInt KEspectedErrorCodePSY1Request6 = KErrDied; |
|
29 const TInt KEspectedErrorCodePSY1Request8 = KErrBadPower; |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 |
|
32 // --------------------------------------------------------- |
|
33 // Constructor. |
|
34 // --------------------------------------------------------- |
|
35 CT_LbsClientPosTp269::CT_LbsClientPosTp269(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) |
|
36 { |
|
37 _LIT(KTestName, "Tp269 - Fallback in Default Proxy (CR0526)"); |
|
38 SetTestStepName(KTestName); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // Destructor. |
|
43 // --------------------------------------------------------- |
|
44 CT_LbsClientPosTp269::~CT_LbsClientPosTp269() |
|
45 { |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------- |
|
49 // CT_LbsClientPosTp269::StartL |
|
50 // |
|
51 // (other items were commented in a header). |
|
52 // --------------------------------------------------------- |
|
53 // |
|
54 void CT_LbsClientPosTp269::StartL() |
|
55 { |
|
56 ConnectL(); |
|
57 |
|
58 SetupProxyPSYsL(); |
|
59 |
|
60 TInt err = OpenPositioner(); |
|
61 _LIT(KOpenErr, "Error when opening positioner, %d"); |
|
62 AssertTrueSecL(err == KErrNone, KOpenErr, err); |
|
63 |
|
64 _LIT(KServiceName, "TP269"); |
|
65 iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); |
|
66 |
|
67 TUint request = 0; |
|
68 |
|
69 TPositionInfo posInfo; |
|
70 ///////////////////////////////////////////// |
|
71 // Request 1 |
|
72 ///////////////////////////////////////////// |
|
73 RequestL(posInfo, ++request, KEspectedErrorCodePSY2); |
|
74 |
|
75 // Used test PSYs reports ready when loaded, inactive when unloaded |
|
76 VerifyPsyLoadedL(iUidTestProxyPsy1); |
|
77 VerifyPsyLoadedL(iUidTestProxyPsy2); |
|
78 |
|
79 ///////////////////////////////////////////// |
|
80 // Request 2 |
|
81 ///////////////////////////////////////////// |
|
82 RequestL(posInfo, ++request, KEspectedErrorCodePSY1); |
|
83 VerifyPsyLoadedL(iUidTestProxyPsy1); |
|
84 |
|
85 ///////////////////////////////////////////// |
|
86 // Request 3 |
|
87 ///////////////////////////////////////////// |
|
88 RequestL(posInfo, ++request, KEspectedErrorCodePSY3); |
|
89 VerifyPsyLoadedL(iUidTestProxyPsy1); |
|
90 VerifyPsyLoadedL(iUidTestProxyPsy2); |
|
91 VerifyPsyLoadedL(iUidTestProxyPsy3); |
|
92 |
|
93 ///////////////////////////////////////////// |
|
94 // Request 4 |
|
95 ///////////////////////////////////////////// |
|
96 RequestL(posInfo, ++request, KEspectedErrorCodePSY3); |
|
97 VerifyPsyLoadedL(iUidTestProxyPsy1); |
|
98 VerifyPsyLoadedL(iUidTestProxyPsy2); |
|
99 VerifyPsyLoadedL(iUidTestProxyPsy3); |
|
100 |
|
101 ///////////////////////////////////////////// |
|
102 // Request 5 |
|
103 ///////////////////////////////////////////// |
|
104 RequestL(posInfo, ++request, KEspectedErrorCodePSY2); |
|
105 VerifyPsyLoadedL(iUidTestProxyPsy1); |
|
106 VerifyPsyLoadedL(iUidTestProxyPsy2); |
|
107 |
|
108 ///////////////////////////////////////////// |
|
109 // Request 6 |
|
110 ///////////////////////////////////////////// |
|
111 RequestL(posInfo, ++request, KEspectedErrorCodePSY1Request6); |
|
112 VerifyPsyLoadedL(iUidTestProxyPsy1); |
|
113 VerifyPsyLoadedL(iUidTestProxyPsy2); |
|
114 VerifyPsyLoadedL(iUidTestProxyPsy3); |
|
115 |
|
116 // Switch priority |
|
117 CPosModules* db = CPosModules::OpenL(); |
|
118 CleanupStack::PushL(db); |
|
119 |
|
120 db->SetModulePriorityL(iUidTestProxyPsy3, 1); |
|
121 db->SetModulePriorityL(iUidTestProxyPsy2, 2); |
|
122 |
|
123 ///////////////////////////////////////////// |
|
124 // Request 7 |
|
125 ///////////////////////////////////////////// |
|
126 RequestL(posInfo, ++request, KEspectedErrorCodePSY3); |
|
127 VerifyPsyLoadedL(iUidTestProxyPsy1); |
|
128 VerifyPsyLoadedL(iUidTestProxyPsy3); |
|
129 |
|
130 ///////////////////////////////////////////// |
|
131 // Request 8 |
|
132 ///////////////////////////////////////////// |
|
133 RequestL(posInfo, ++request, KEspectedErrorCodePSY1Request8); |
|
134 VerifyPsyLoadedL(iUidTestProxyPsy1); |
|
135 VerifyPsyLoadedL(iUidTestProxyPsy2); |
|
136 VerifyPsyLoadedL(iUidTestProxyPsy3); |
|
137 |
|
138 // Switch back priority |
|
139 db->SetModulePriorityL(iUidTestProxyPsy2, 1); |
|
140 db->SetModulePriorityL(iUidTestProxyPsy3, 2); |
|
141 |
|
142 CleanupStack::PopAndDestroy(db); |
|
143 |
|
144 ///////////////////////////////////////////// |
|
145 // Request 9 |
|
146 ///////////////////////////////////////////// |
|
147 TPositionSatelliteInfo satInfo; |
|
148 RequestL(satInfo, ++request, KErrArgument); |
|
149 |
|
150 ///////////////////////////////////////////// |
|
151 // Request 10 |
|
152 ///////////////////////////////////////////// |
|
153 TPositionCourseInfo courseInfo; |
|
154 RequestL(courseInfo, ++request, KEspectedErrorCodePSY3); |
|
155 |
|
156 VerifyPsyLoadedL(iUidTestProxyPsy3); |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------- |
|
160 // CT_LbsClientPosTp269::CloseTest |
|
161 // |
|
162 // (other items were commented in a header). |
|
163 // --------------------------------------------------------- |
|
164 // |
|
165 void CT_LbsClientPosTp269::CloseTest() |
|
166 { |
|
167 iPositioner.Close(); |
|
168 iPosServer.Close(); |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------- |
|
172 // CT_LbsClientPosTp269::AssertTrueSecL |
|
173 // |
|
174 // (other items were commented in a header). |
|
175 // --------------------------------------------------------- |
|
176 // |
|
177 void CT_LbsClientPosTp269::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) |
|
178 { |
|
179 if (!aCondition) |
|
180 { |
|
181 TBuf<100> buf; |
|
182 buf.Format(aErrorMsg, aErrorCode); |
|
183 LogErrorAndLeaveL(buf); |
|
184 } |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------- |
|
188 // CT_LbsClientPosTp269::SetupProxyPSYsL |
|
189 // |
|
190 // (other items were commented in a header). |
|
191 // --------------------------------------------------------- |
|
192 // |
|
193 void CT_LbsClientPosTp269::SetupProxyPSYsL() |
|
194 { |
|
195 CPosModules* db = CPosModules::OpenL(); |
|
196 CleanupStack::PushL(db); |
|
197 |
|
198 CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); |
|
199 |
|
200 moduleUpdate->SetUpdateAvailability(EFalse); |
|
201 |
|
202 CPosModuleIdList* prioList = db->ModuleIdListLC(); |
|
203 |
|
204 // Disable all PSY:s except PSYs used by this TP269, TP270 |
|
205 for (TInt i = 0 ; i < prioList->Count(); i++) |
|
206 { |
|
207 if ((*prioList)[i] != iUidTestProxyPsy1 && |
|
208 (*prioList)[i] != iUidTestProxyPsy2 && |
|
209 (*prioList)[i] != iUidTestProxyPsy3) |
|
210 { |
|
211 db->UpdateModuleL((*prioList)[i], *moduleUpdate); |
|
212 } |
|
213 } |
|
214 moduleUpdate->SetUpdateAvailability(ETrue); |
|
215 db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); |
|
216 db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate); |
|
217 db->UpdateModuleL(iUidTestProxyPsy3, *moduleUpdate); |
|
218 |
|
219 db->SetModulePriorityL(iUidTestProxyPsy1, 0); |
|
220 db->SetModulePriorityL(iUidTestProxyPsy2, 1); |
|
221 db->SetModulePriorityL(iUidTestProxyPsy3, 2); |
|
222 |
|
223 CleanupStack::PopAndDestroy(prioList); |
|
224 CleanupStack::PopAndDestroy(moduleUpdate); |
|
225 CleanupStack::PopAndDestroy(db); |
|
226 } |
|
227 |
|
228 // End of File |
|
229 |