|
1 /* |
|
2 * Copyright (c) 2003 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: LandmarksUi Content File - |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 /* |
|
24 Change History |
|
25 22-05-2007 To resolve tool IDO warnings Komala Nagaraju |
|
26 */ |
|
27 #define PRINTTOSCREEN |
|
28 #define WRITETOLOG |
|
29 |
|
30 |
|
31 // INCLUDE FILES |
|
32 //#include "BCAppLmkSelectorContainer.h" |
|
33 #include "BCAppLmkSelectorEngine.h" |
|
34 #include <BCAppLmkSelector.rsg> |
|
35 #include <apgtask.h> |
|
36 #include <bacline.h> |
|
37 #include <in_sock.h> |
|
38 #include <coecntrl.h> |
|
39 #include <gulicon.h> |
|
40 #include <eikfrlb.h> |
|
41 #include <AknIconArray.h> |
|
42 #include <in_sock.h> |
|
43 #include <barsread.h> |
|
44 |
|
45 _LIT(KAppName, "BCAppLmkSelector"); |
|
46 |
|
47 |
|
48 // ================= MEMBER FUNCTIONS ======================= |
|
49 |
|
50 /*void CBCAppLmkSelectorEngine::ExecuteTestL() |
|
51 { |
|
52 |
|
53 switch (iCurrentTest) |
|
54 { |
|
55 case 0: |
|
56 { |
|
57 SetTestCase(_L("CLmkLandmarkSelectorDlg"), _L("CLmkLandmarkSelectorDlg::NewL")); |
|
58 |
|
59 CLmkLandmarkSelectorDlg* iLmkSelectDlg = CLmkLandmarkSelectorDlg::NewL(); |
|
60 delete iLmkSelectDlg; |
|
61 iLmkSelectDlg = NULL; |
|
62 } |
|
63 break; |
|
64 |
|
65 case 1: |
|
66 { |
|
67 SetTestCase(_L("CLmkLandmarkSelectorDlg"), _L("CLmkLandmarkSelectorDlg::SetMopParent")); |
|
68 |
|
69 CLmkLandmarkSelectorDlg* iLmkSelectDlg = CLmkLandmarkSelectorDlg::NewL(); |
|
70 iLmkSelectDlg->SetMopParent(this); |
|
71 delete iLmkSelectDlg; |
|
72 iLmkSelectDlg = NULL; |
|
73 } |
|
74 break; |
|
75 |
|
76 case 2: |
|
77 { |
|
78 SetTestCase(_L("CLmkLandmarkSelectorDlg"), _L("CLmkLandmarkSelectorDlg::ExecuteLD")); |
|
79 |
|
80 TLmkItemIdDbCombiInfo selItem; |
|
81 CLmkLandmarkSelectorDlg* iLmkSelectDlg = CLmkLandmarkSelectorDlg::NewL(); |
|
82 TRAPD( result, iLmkSelectDlg->ExecuteLD(selItem)); |
|
83 } |
|
84 break; |
|
85 |
|
86 case 3: |
|
87 { |
|
88 SetTestCase(_L("CLmkLandmarkSelectorDlg"), _L("CLmkLandmarkSelectorDlg::ExecuteLD#1")); |
|
89 |
|
90 RArray<TLmkItemIdDbCombiInfo> selItems; |
|
91 |
|
92 CLmkLandmarkSelectorDlg* iLmkSelectDlg = CLmkLandmarkSelectorDlg::NewL(); |
|
93 TRAPD( result, iLmkSelectDlg->ExecuteLD(selItems)); |
|
94 selItems.Close(); |
|
95 } |
|
96 break; |
|
97 |
|
98 case 4: |
|
99 { |
|
100 SetTestCase(_L("CLmkCategorySelectorDlg"), _L("CLmkCategorySelectorDlg::NewL")); |
|
101 |
|
102 CLmkCategorySelectorDlg* iLmkCategoryDlg = CLmkCategorySelectorDlg::NewL(); |
|
103 delete iLmkCategoryDlg; |
|
104 iLmkCategoryDlg = NULL; |
|
105 } |
|
106 break; |
|
107 |
|
108 case 5: |
|
109 { |
|
110 SetTestCase(_L("CLmkCategorySelectorDlg"), _L("CLmkCategorySelectorDlg::SetMopParent")); |
|
111 |
|
112 CLmkCategorySelectorDlg* iLmkCategoryDlg = CLmkCategorySelectorDlg::NewL(); |
|
113 iLmkCategoryDlg->SetMopParent(this); |
|
114 delete iLmkCategoryDlg; |
|
115 iLmkCategoryDlg = NULL; |
|
116 } |
|
117 break; |
|
118 |
|
119 case 6: |
|
120 { |
|
121 SetTestCase(_L("CLmkCategorySelectorDlg"), _L("CLmkCategorySelectorDlg::ExecuteLD")); |
|
122 |
|
123 TLmkItemIdDbCombiInfo selItem; |
|
124 CLmkCategorySelectorDlg* iLmkCategoryDlg = CLmkCategorySelectorDlg::NewL(); |
|
125 TRAPD( result, iLmkCategoryDlg->ExecuteLD(selItem)); |
|
126 } |
|
127 break; |
|
128 |
|
129 case 7: |
|
130 { |
|
131 SetTestCase(_L("CLmkCategorySelectorDlg"), _L("CLmkCategorySelectorDlg::ExecuteLD#1")); |
|
132 |
|
133 RArray<TLmkItemIdDbCombiInfo> selItems; |
|
134 CLmkCategorySelectorDlg* iLmkCategoryDlg = CLmkCategorySelectorDlg::NewL(); |
|
135 TRAPD( result, iLmkCategoryDlg->ExecuteLD(selItems)); |
|
136 selItems.Close(); |
|
137 } |
|
138 break; |
|
139 |
|
140 default: |
|
141 { |
|
142 iAllTestsDone = ETrue; |
|
143 } |
|
144 } |
|
145 } |
|
146 */ |
|
147 TTypeUid::Ptr CBCAppLmkSelectorEngine::MopSupplyObject(TTypeUid /*aId*/) |
|
148 { |
|
149 } |
|
150 |
|
151 MObjectProvider* CBCAppLmkSelectorEngine:: MopNext() |
|
152 { |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------- |
|
156 |
|
157 CBCAppLmkSelectorEngine* CBCAppLmkSelectorEngine::NewL(/*CBCAppLmkSelectorContainer* aContainer*/) |
|
158 { |
|
159 CBCAppLmkSelectorEngine* self = new(ELeave) CBCAppLmkSelectorEngine; |
|
160 CleanupStack::PushL(self); |
|
161 //self->ConstructL(/*aContainer*/); |
|
162 //self->CreateNewLandmark(); |
|
163 CleanupStack::Pop(); |
|
164 return self; |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------- |
|
168 |
|
169 /*CBCAppLmkSelectorEngine::CBCAppLmkSelectorEngine() : CActive(0) |
|
170 { |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 |
|
175 void CBCAppLmkSelectorEngine::IssueTest() |
|
176 { |
|
177 __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("active"), 1)); |
|
178 |
|
179 iTimer.After(iStatus, 50000); |
|
180 SetActive(); |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------- |
|
184 |
|
185 void CBCAppLmkSelectorEngine::RunL() |
|
186 { |
|
187 |
|
188 // Execute the test case |
|
189 TRAPD(err, ExecuteTestL()); |
|
190 |
|
191 if (iExecuteAllTests) |
|
192 { |
|
193 if (iAllTestsDone) |
|
194 { |
|
195 // All tests are done (don't have to exit the program, just print a text) |
|
196 Print(_L("All tests done.\n")); |
|
197 } |
|
198 else |
|
199 { |
|
200 // We have more tests to be run, move to the next one |
|
201 Print(iCurrentFunctionName); |
|
202 Print(_L("\n")); |
|
203 iCurrentTest++; |
|
204 IssueTest(); |
|
205 } |
|
206 } |
|
207 else |
|
208 { |
|
209 if (iAllTestsDone) |
|
210 { |
|
211 // Signal the main application that there are no more tests to be run |
|
212 Print(_L("All tests done.\n")); |
|
213 User::Exit(7777); |
|
214 } |
|
215 else |
|
216 { |
|
217 // Only one test case executed, exit normally |
|
218 Print(iCurrentFunctionName); |
|
219 Print(_L("\n")); |
|
220 User::Exit(0); |
|
221 } |
|
222 } |
|
223 |
|
224 } |
|
225 |
|
226 // --------------------------------------------------------- |
|
227 |
|
228 void CBCAppLmkSelectorEngine::DoCancel() |
|
229 { |
|
230 iTimer.Cancel(); |
|
231 } |
|
232 |
|
233 // --------------------------------------------------------- |
|
234 |
|
235 void CBCAppLmkSelectorEngine::Init() |
|
236 { |
|
237 iCurrentTest = 0; |
|
238 iWarningIssued = EFalse; |
|
239 iExecuteAllTests = EFalse; |
|
240 iAllTestsDone = EFalse; |
|
241 iText.Append(_L("Setting Title")); |
|
242 } |
|
243 |
|
244 // --------------------------------------------------------- |
|
245 |
|
246 void CBCAppLmkSelectorEngine::Print(const TDesC& aDes) |
|
247 { |
|
248 #ifdef PRINTTOSCREEN |
|
249 iContainer->PrintNotify(aDes, 0); |
|
250 #endif |
|
251 } |
|
252 |
|
253 // --------------------------------------------------------- |
|
254 |
|
255 void CBCAppLmkSelectorEngine::Print(const TDesC8& aDes) |
|
256 { |
|
257 #ifdef PRINTTOSCREEN |
|
258 iContainer->PrintNotify(aDes, 0); |
|
259 #endif |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------- |
|
263 |
|
264 void CBCAppLmkSelectorEngine::Print(TInt aInt) |
|
265 { |
|
266 #ifdef PRINTTOSCREEN |
|
267 iContainer->PrintNotify(aInt); |
|
268 #endif |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------- |
|
272 // --------------------------------------------------------- |
|
273 */ |
|
274 /*void CBCAppLmkSelectorEngine::ConstructL(CBCAppLmkSelectorContainer* aContainer) |
|
275 { |
|
276 iEnv = CEikonEnv::Static(); |
|
277 TInt err = iWs.Connect(); |
|
278 err = err; |
|
279 User::LeaveIfError(iTimer.CreateLocal()); |
|
280 //iContainer = aContainer; |
|
281 |
|
282 Init(); |
|
283 CActiveScheduler::Add(this); |
|
284 |
|
285 |
|
286 // check if BCAppMain is running |
|
287 TApaTaskList taskList(iWs); |
|
288 TApaTask thisTask = taskList.FindApp(TUid::Uid(0x101FD6FF)); |
|
289 |
|
290 if (thisTask.Exists()) |
|
291 { |
|
292 // ask the BCAppMain to send the test case number |
|
293 thisTask.SendMessage(TUid::Uid( KUidApaMessageSwitchOpenFileValue ), _L8("SendNewTestCaseNumber")); |
|
294 iExecuteAllTests = EFalse; |
|
295 } |
|
296 else |
|
297 { |
|
298 // BCAppMain not running, execute all cases immediately |
|
299 iExecuteAllTests = ETrue; |
|
300 IssueTest(); |
|
301 } |
|
302 } |
|
303 */ |
|
304 // --------------------------------------------------------- |
|
305 |
|
306 /*CBCAppLmkSelectorEngine::~CBCAppLmkSelectorEngine() |
|
307 { |
|
308 Cancel(); |
|
309 iWs.Close(); |
|
310 iTimer.Close(); |
|
311 } |
|
312 |
|
313 // --------------------------------------------------------- |
|
314 |
|
315 void CBCAppLmkSelectorEngine::SetTestCase(const TDesC& aHeaderName, const TDesC& aFunctionName) |
|
316 { |
|
317 // copy names to our variables |
|
318 iCurrentHeaderName.Copy(aHeaderName); |
|
319 iCurrentFunctionName.Copy(aFunctionName); |
|
320 |
|
321 // send this information to BCAppMain |
|
322 TApaTaskList taskList(iWs); |
|
323 TApaTask thisTask = taskList.FindApp(TUid::Uid(0x101FD6FF)); |
|
324 |
|
325 if (thisTask.Exists()) |
|
326 { |
|
327 TBuf8<400> msg; |
|
328 msg.Copy(iCurrentHeaderName); |
|
329 msg.Append(_L8("@")); |
|
330 msg.Append(iCurrentFunctionName); |
|
331 thisTask.SendMessage(TUid::Uid( KUidApaMessageSwitchOpenFileValue ), msg); |
|
332 |
|
333 // now start waiting till BCAppMain has acknowledged our message |
|
334 iWait.Start(); |
|
335 } |
|
336 |
|
337 } |
|
338 |
|
339 // --------------------------------------------------------- |
|
340 |
|
341 void CBCAppLmkSelectorEngine::ExecuteTestCase() |
|
342 { |
|
343 // stop waiting |
|
344 iWait.AsyncStop(); |
|
345 } |
|
346 |
|
347 // --------------------------------------------------------- |
|
348 |
|
349 void CBCAppLmkSelectorEngine::SetTestCaseNumber(const TDesC8 &aNumber) |
|
350 { |
|
351 // set the test case number |
|
352 TLex8 msgConv(aNumber); |
|
353 msgConv.Val(iCurrentTest); |
|
354 |
|
355 // start the active object |
|
356 IssueTest(); |
|
357 } |
|
358 |
|
359 // --------------------------------------------------------- |
|
360 |
|
361 // --------------------------------------------------------- |
|
362 |
|
363 void CBCAppLmkSelectorEngine::CreateNewLandmark() |
|
364 { |
|
365 |
|
366 TRAP_IGNORE( |
|
367 CPosLandmarkDatabase* dBase = CPosLandmarkDatabase::OpenL(); |
|
368 CleanupStack::PushL( dBase ); |
|
369 if (dBase->IsInitializingNeeded()) |
|
370 { |
|
371 ExecuteAndDeleteLD(dBase->InitializeL()); // Synchronous since no argument |
|
372 } |
|
373 |
|
374 CPosLmItemIterator* iterator = dBase->LandmarkIteratorL(); |
|
375 CleanupStack::PushL(iterator); |
|
376 |
|
377 |
|
378 if( iterator->NumOfItemsL() == 0 ) |
|
379 { |
|
380 CPosLandmark* landmark = CPosLandmark::NewL(); |
|
381 CleanupStack::PushL( landmark ); |
|
382 |
|
383 landmark->SetLandmarkNameL(_L("Nokia")); |
|
384 |
|
385 dBase->AddLandmarkL(*landmark); |
|
386 CleanupStack::PopAndDestroy();//landmark |
|
387 } |
|
388 |
|
389 CleanupStack::PopAndDestroy(2); //iterator,dBase |
|
390 ) |
|
391 } |
|
392 */ |
|
393 |
|
394 // End of File |