1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Test Module DLL to Location Settings Launch API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // System Includes |
|
21 #include <locsettingsuiclient.h> |
|
22 #include <w32std.h> |
|
23 #include <coemain.h> |
|
24 #include <eikon.hrh> |
|
25 |
|
26 // User Includes |
|
27 #include "testlocsettingsuiclientao.h" |
|
28 |
|
29 |
|
30 // Constant Declarations |
|
31 |
|
32 |
|
33 // ======== MEMBER FUNCTIONS ======== |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // C++ Default Constructor |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CTestLocSettingsUiClientAO* CTestLocSettingsUiClientAO::NewL(CStifLogger* aLog) |
|
40 { |
|
41 CTestLocSettingsUiClientAO* self = new(ELeave) CTestLocSettingsUiClientAO(aLog); |
|
42 CleanupStack::PushL(self); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop(self); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // C++ Default Constructor |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void CTestLocSettingsUiClientAO::ConstructL() |
|
53 { |
|
54 iLocSettingsUiClient = CLocSettingsUiClient::NewL(); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // C++ Default Constructor |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CTestLocSettingsUiClientAO::CTestLocSettingsUiClientAO(CStifLogger* aLog) |
|
62 :CActive(0),iLog(aLog),iErr(0) |
|
63 { |
|
64 CActiveScheduler::Add(this); |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // C++ Destructor |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CTestLocSettingsUiClientAO::~CTestLocSettingsUiClientAO() |
|
72 { |
|
73 if( IsActive() ) |
|
74 { |
|
75 Cancel(); |
|
76 } |
|
77 |
|
78 if(iLocSettingsUiClient) |
|
79 { |
|
80 delete iLocSettingsUiClient; |
|
81 iLocSettingsUiClient = NULL; |
|
82 } |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------- |
|
86 // CTestLocSettingsUiClientAO::RunL |
|
87 // |
|
88 // RunL to Handle Completed Request |
|
89 // --------------------------------------------------------- |
|
90 // |
|
91 void CTestLocSettingsUiClientAO::RunL() |
|
92 { |
|
93 switch(iState) |
|
94 { |
|
95 case EStart: |
|
96 switch(iFunction) |
|
97 { |
|
98 case ELaunchPosSettingsL: |
|
99 iState = ECompleted; |
|
100 iLocSettingsUiClient->LaunchPosSettingsL(iStatus); |
|
101 SetActive(); |
|
102 break; |
|
103 case ELaunchPosSettingsAsEmbeddedAppL: |
|
104 iState = ECompleted; |
|
105 iLocSettingsUiClient->LaunchPosSettingsAsEmbeddedAppL(iStatus); |
|
106 SetActive(); |
|
107 case ELaunchSettingsUiL: |
|
108 iState = ECompleted; |
|
109 iLocSettingsUiClient->LaunchSettingsUiL(iTUid,iParam,iStatus); |
|
110 SetActive(); |
|
111 break; |
|
112 case ELaunchSettingsUiAsEmbeddedAppL: |
|
113 iState = ECompleted; |
|
114 iLocSettingsUiClient->LaunchSettingsUiAsEmbeddedAppL(iTUid,iParam,iStatus); |
|
115 SetActive(); |
|
116 break; |
|
117 |
|
118 case ELaunchSettingsUiLOverLoaded: |
|
119 iState = ECompleted; |
|
120 iLocSettingsUiClient->LaunchSettingsUiL(iTUid,iParamString,iStatus); |
|
121 SetActive(); |
|
122 break; |
|
123 |
|
124 case ELaunchSettingsUiAsEmbeddedAppLOverLoaded: |
|
125 iState = ECompleted; |
|
126 iLocSettingsUiClient->LaunchSettingsUiAsEmbeddedAppL(iTUid,iParamString,iStatus); |
|
127 SetActive(); |
|
128 break; |
|
129 } |
|
130 break; |
|
131 case ECompleted: |
|
132 { |
|
133 |
|
134 iLog->Log(_L("RunL %d"),iStatus.Int()); |
|
135 CActiveScheduler::Stop(); |
|
136 } |
|
137 break; |
|
138 } |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------- |
|
142 // CTestLocSettingsUiClientAO::DoCancel |
|
143 // |
|
144 // To Handle Cancel Request |
|
145 // --------------------------------------------------------- |
|
146 // |
|
147 void CTestLocSettingsUiClientAO::DoCancel() |
|
148 { |
|
149 // TInt err = iPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); |
|
150 // iLog->Log(_L("CancelL %d"),err); |
|
151 |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------- |
|
155 // CTestLocSettingsUiClientAO::RunError |
|
156 // |
|
157 // To Handle Error in RunL |
|
158 // --------------------------------------------------------- |
|
159 // |
|
160 TInt CTestLocSettingsUiClientAO::RunError(TInt aError) |
|
161 { |
|
162 iErr = aError; |
|
163 iLog->Log(_L("Leave in RunError %d"),aError); |
|
164 CActiveScheduler::Stop(); |
|
165 return KErrNone; |
|
166 } |
|
167 |
|
168 // --------------------------------------------------------- |
|
169 // CTestLocSettingsUiClientAO::TestNewL |
|
170 // |
|
171 // (other items are commented in a header). |
|
172 // --------------------------------------------------------- |
|
173 // |
|
174 TInt CTestLocSettingsUiClientAO::TestNewL() |
|
175 { |
|
176 CLocSettingsUiClient* aLocSettingsUiClient = CLocSettingsUiClient::NewL(); |
|
177 if(aLocSettingsUiClient) |
|
178 { |
|
179 delete aLocSettingsUiClient; |
|
180 aLocSettingsUiClient = NULL; |
|
181 } |
|
182 return KErrNone; |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------- |
|
186 // CTestLocSettingsUiClientAO::TestNewLC |
|
187 // |
|
188 // (other items are commented in a header). |
|
189 // --------------------------------------------------------- |
|
190 // |
|
191 TInt CTestLocSettingsUiClientAO::TestNewLC() |
|
192 { |
|
193 CLocSettingsUiClient* aLocSettingsUiClient = CLocSettingsUiClient::NewLC(); |
|
194 CleanupStack::PopAndDestroy(aLocSettingsUiClient); |
|
195 return KErrNone; |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------- |
|
199 // CTestLocSettingsUiClientAO::TestLaunchSettingsL |
|
200 // |
|
201 // (other items are commented in a header). |
|
202 // --------------------------------------------------------- |
|
203 // |
|
204 TInt CTestLocSettingsUiClientAO::TestLaunchSettingsL(CStifItemParser& aItem) |
|
205 { |
|
206 TInt choice; |
|
207 User::LeaveIfError(aItem.GetNextInt(choice)); |
|
208 switch(choice) |
|
209 { |
|
210 case 0: |
|
211 IssueRequestL(ELaunchPosSettingsL); |
|
212 break; |
|
213 case 1: |
|
214 IssueRequestL(ELaunchPosSettingsAsEmbeddedAppL); |
|
215 break; |
|
216 case 2: |
|
217 TUint UidInInt; |
|
218 TInt param; |
|
219 if(aItem.GetNextInt(UidInInt, EHex) != KErrNotFound && |
|
220 aItem.GetNextInt(param) != KErrNotFound ) |
|
221 { |
|
222 iTUid.iUid = UidInInt; |
|
223 iParam = param; |
|
224 IssueRequestL(ELaunchSettingsUiL); |
|
225 } |
|
226 else |
|
227 { |
|
228 return KErrGeneral; |
|
229 } |
|
230 break; |
|
231 case 3: |
|
232 TUint UidInInt1; |
|
233 TInt param1; |
|
234 if(aItem.GetNextInt(UidInInt1, EHex) != KErrNotFound && |
|
235 aItem.GetNextInt(param1) != KErrNotFound ) |
|
236 { |
|
237 iTUid.iUid = UidInInt1; |
|
238 iParam = param1; |
|
239 IssueRequestL(ELaunchSettingsUiAsEmbeddedAppL); |
|
240 } |
|
241 else |
|
242 { |
|
243 return KErrGeneral; |
|
244 } |
|
245 break; |
|
246 |
|
247 case 4: |
|
248 TUint UidInInt2; |
|
249 TPtrC param2; |
|
250 if(aItem.GetNextInt(UidInInt2, EHex) != KErrNotFound && |
|
251 aItem.GetNextString(param2) != KErrNotFound ) |
|
252 { |
|
253 iTUid.iUid = UidInInt2; |
|
254 iParamString.Copy(param2); |
|
255 IssueRequestL(ELaunchSettingsUiLOverLoaded); |
|
256 } |
|
257 else |
|
258 { |
|
259 return KErrGeneral; |
|
260 } |
|
261 break; |
|
262 |
|
263 case 5: |
|
264 TUint UidInInt3; |
|
265 TPtrC param3; |
|
266 if(aItem.GetNextInt(UidInInt3, EHex) != KErrNotFound && |
|
267 aItem.GetNextString(param3) != KErrNotFound ) |
|
268 { |
|
269 iTUid.iUid = UidInInt3; |
|
270 iParamString.Copy(param3); |
|
271 IssueRequestL(ELaunchSettingsUiAsEmbeddedAppLOverLoaded); |
|
272 } |
|
273 else |
|
274 { |
|
275 return KErrGeneral; |
|
276 } |
|
277 break; |
|
278 |
|
279 default: |
|
280 return KErrGeneral; |
|
281 } |
|
282 CActiveScheduler::Start(); |
|
283 |
|
284 if(iErr != KErrNone) |
|
285 { |
|
286 iLog->Log(_L("TestLaunchPosSettingsAsEmbeddedAppL - %d"),iErr); |
|
287 } |
|
288 |
|
289 return iErr; |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------- |
|
293 // CTestLocSettingsUiClientAO::IssueRequestL |
|
294 // |
|
295 // (other items are commented in a header). |
|
296 // --------------------------------------------------------- |
|
297 // |
|
298 void CTestLocSettingsUiClientAO::IssueRequestL(TFunction aFunction) |
|
299 { |
|
300 SetActive(); |
|
301 iFunction = aFunction; |
|
302 iState = EStart; |
|
303 TRequestStatus* status = &iStatus; |
|
304 User::RequestComplete(status, KErrNone); |
|
305 } |
|
306 |
|
307 // --------------------------------------------------------- |
|
308 // CTestLocSettingsUiClientAO::TestCancelLaunchedSettingsUi |
|
309 // |
|
310 // (other items are commented in a header). |
|
311 // --------------------------------------------------------- |
|
312 // |
|
313 TInt CTestLocSettingsUiClientAO::TestCancelLaunchedSettingsUi(CStifItemParser& aItem) |
|
314 { |
|
315 TUint UidInInt1; |
|
316 TInt param1; |
|
317 User::LeaveIfError(aItem.GetNextInt(UidInInt1, EHex)); |
|
318 User::LeaveIfError(aItem.GetNextInt(param1)); |
|
319 iTUid.iUid = UidInInt1; |
|
320 iParam = param1; |
|
321 |
|
322 iLocSettingsUiClient->LaunchSettingsUiAsEmbeddedAppL(iTUid,iParam,iStatus); |
|
323 TInt err = iLocSettingsUiClient->CancelLaunchedSettingsUi(); |
|
324 return err; |
|
325 } |
|
326 |
|
327 // --------------------------------------------------------- |
|
328 // CTestLocSettingsUiClientAO::TestCancelLaunchedSettingsUi |
|
329 // |
|
330 // (other items are commented in a header). |
|
331 // --------------------------------------------------------- |
|
332 // |
|
333 TInt CTestLocSettingsUiClientAO::TestCancelLaunchedSettingsUiErr() |
|
334 { |
|
335 TInt err = iLocSettingsUiClient->CancelLaunchedSettingsUi(); |
|
336 return err; |
|
337 } |
|
338 |
|
339 // --------------------------------------------------------- |
|
340 // CTestLocSettingsUiClientAO::TestClosePosSettings |
|
341 // |
|
342 // (other items are commented in a header). |
|
343 // --------------------------------------------------------- |
|
344 // |
|
345 TInt CTestLocSettingsUiClientAO::TestClosePosSettings() |
|
346 { |
|
347 iLocSettingsUiClient->LaunchPosSettingsL(iStatus); |
|
348 SetActive(); |
|
349 TInt err = iLocSettingsUiClient->ClosePosSettings(); |
|
350 return err; |
|
351 } |
|
352 |
|
353 // --------------------------------------------------------- |
|
354 // CTestLocSettingsUiClientAO::TestClosePosSettingsErr |
|
355 // |
|
356 // (other items are commented in a header). |
|
357 // --------------------------------------------------------- |
|
358 // |
|
359 TInt CTestLocSettingsUiClientAO::TestClosePosSettingsErr() |
|
360 { |
|
361 TInt err = iLocSettingsUiClient->ClosePosSettings(); |
|
362 return err; |
|
363 } |
|
364 |
|