|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "engine.h" |
|
21 #include "enginewrapper.h" |
|
22 #include "settingsview.h" |
|
23 #include "loadgen_utils.h" |
|
24 #include "loadgen_cpuload.h" |
|
25 #include "loadgen_memoryeat.h" |
|
26 #include "loadgen_phonecall.h" |
|
27 #include "loadgen_netconn.h" |
|
28 #include "loadgen_keypress.h" |
|
29 #include "loadgen_pointerevent.h" |
|
30 #include "loadgen_messages.h" |
|
31 #include "loadgen_applications.h" |
|
32 #include "loadgen_photocapture.h" |
|
33 #include "loadgen_bluetooth.h" |
|
34 #include "loadgen_traces.h" |
|
35 #include "loadgen_loadattributes.h" |
|
36 #include "loadgen.hrh" |
|
37 |
|
38 //#include "loadgen_editors.h" |
|
39 //#include "loadgen_app.h" |
|
40 //#include "loadgen_settingsviewdlg.h" |
|
41 //#include "loadgen_maincontainer.h" |
|
42 |
|
43 //#include <loadgen.rsg> |
|
44 |
|
45 #include <coeutils.h> |
|
46 #include <bautils.h> |
|
47 #include <eikenv.h> |
|
48 //#include <AknQueryDialog.h> |
|
49 #include <e32math.h> |
|
50 #include <u32hal.h> |
|
51 #include <hal.h> |
|
52 #include <hal_data.h> |
|
53 |
|
54 #include <ecam.h> |
|
55 //#include <aknnotewrappers.h> |
|
56 #include <featdiscovery.h> |
|
57 |
|
58 const TInt KZeroIndex = 0; |
|
59 |
|
60 // ===================================== MEMBER FUNCTIONS ===================================== |
|
61 |
|
62 CEngine* CEngine::NewL(EngineWrapper *aEngineWrapper) |
|
63 { |
|
64 CEngine* self = new(ELeave) CEngine; |
|
65 CleanupStack::PushL(self); |
|
66 self->ConstructL(aEngineWrapper); |
|
67 CleanupStack::Pop(); |
|
68 return self; |
|
69 } |
|
70 |
|
71 // -------------------------------------------------------------------------------------------- |
|
72 |
|
73 CEngine::CEngine() : CActive( EPriorityStandard ), |
|
74 iAsyncRunLoadOperation( CActive::EPriorityStandard ) |
|
75 { |
|
76 TCallBack asyncRunSuspRes( AsyncRunLoadOperation, this ); |
|
77 iAsyncRunLoadOperation.Set(asyncRunSuspRes); |
|
78 } |
|
79 |
|
80 // -------------------------------------------------------------------------------------------- |
|
81 |
|
82 void CEngine::ConstructL(EngineWrapper *aEngineWrapper) |
|
83 { |
|
84 iEngineWrapper = aEngineWrapper; |
|
85 |
|
86 iReferenceNumber = 0; |
|
87 iCurrentItemIndex = 0; |
|
88 iEditExistingLoad = EFalse; |
|
89 |
|
90 iEnv = CEikonEnv::Static(); |
|
91 User::LeaveIfError(iLs.Connect()); |
|
92 |
|
93 iLoadItemList = new(ELeave) CLoadItemList(64); |
|
94 |
|
95 User::LeaveIfError(iTimer.CreateLocal()); |
|
96 CActiveScheduler::Add(this); |
|
97 |
|
98 } |
|
99 |
|
100 // -------------------------------------------------------------------------------------------- |
|
101 TInt CEngine::AsyncRunLoadOperation( TAny* aObject ) |
|
102 { |
|
103 TRAPD( err, static_cast<CEngine*>( aObject )->AsyncRunLoadOperationL() ); |
|
104 return err; |
|
105 } |
|
106 |
|
107 void CEngine::AsyncRunLoadOperationL() |
|
108 { |
|
109 switch(iLoadOperation) |
|
110 { |
|
111 case EEditLoad: |
|
112 break; |
|
113 case ESuspResLoad: |
|
114 SuspendOrResumeSelectedOrHighlightedItemsL(); |
|
115 break; |
|
116 case EStopLoad: |
|
117 if(iSelectionIndexes) |
|
118 { |
|
119 StopSelectedOrHighlightedItemsL(iSelectionIndexes); |
|
120 } |
|
121 break; |
|
122 } |
|
123 } |
|
124 void CEngine::AsyncSuspRes() |
|
125 { |
|
126 iLoadOperation = ESuspResLoad; |
|
127 iAsyncRunLoadOperation.CallBack(); |
|
128 } |
|
129 void CEngine::AsyncStopLoad( const CArrayFix<TInt>* aSelectionIndexes ) |
|
130 { |
|
131 iSelectionIndexes = aSelectionIndexes; |
|
132 iLoadOperation = EStopLoad; |
|
133 iAsyncRunLoadOperation.CallBack(); |
|
134 } |
|
135 void CEngine::AsyncEditLoad() |
|
136 { |
|
137 iLoadOperation = EEditLoad; |
|
138 iAsyncRunLoadOperation.CallBack(); |
|
139 } |
|
140 // -------------------------------------------------------------------------------------------- |
|
141 void CEngine::ActivateEngineL() |
|
142 { |
|
143 // load settings |
|
144 //TRAP_IGNORE(LoadSettingsL()); |
|
145 |
|
146 // RAM |
|
147 TMemoryInfoV1Buf ramMemory; |
|
148 UserHal::MemoryInfo(ramMemory); |
|
149 |
|
150 TInt freeRam = ramMemory().iFreeRamInBytes; |
|
151 |
|
152 |
|
153 // set defaults to attributes |
|
154 iCpuLoadAttributes.iId = 0; |
|
155 iCpuLoadAttributes.iPriority = EThreadPriorityTypeNormal; |
|
156 iCpuLoadAttributes.iMode = ECpuLoadModeYielding; |
|
157 iCpuLoadAttributes.iType = ECpuLoadTypePeriodic; |
|
158 iCpuLoadAttributes.iLength = 4000; |
|
159 iCpuLoadAttributes.iIdle = 2000; |
|
160 iCpuLoadAttributes.iRandomVariance = 0; |
|
161 iCpuLoadAttributes.iCpu = KCPUSelection_FreeScheduling; // set CPU as "undefined" (can be >= 0 only in SMP environments) |
|
162 iCpuLoadAttributes.iCpuCount = UserSvr::HalFunction(EHalGroupKernel, KHalFunction_EKernelHalNumLogicalCpus, 0, 0); |
|
163 if( iCpuLoadAttributes.iCpuCount < 1 || iCpuLoadAttributes.iCpuCount > KMaxCPUs ) |
|
164 { |
|
165 // HAL may not support this function, so let's use CPU count 1: |
|
166 iCpuLoadAttributes.iCpuCount = 1; |
|
167 } |
|
168 iMemoryEatAttributes.iId = 0; |
|
169 iMemoryEatAttributes.iPriority = EThreadPriorityTypeNormal; |
|
170 iMemoryEatAttributes.iSource = 0; |
|
171 iMemoryEatAttributes.iType = EMemoryEatTypeMemoryToBeLeft; |
|
172 iMemoryEatAttributes.iBuffer = 16*1024; |
|
173 iMemoryEatAttributes.iIdle = 0; |
|
174 iMemoryEatAttributes.iAmount = freeRam;//0; |
|
175 iMemoryEatAttributes.iRandomMin = 1000000; |
|
176 iMemoryEatAttributes.iRandomMax = 1500000; |
|
177 iMemoryEatAttributes.iAmountDes.Copy(KNullDesC); |
|
178 iMemoryEatAttributes.iRandomMinDes.Copy(KNullDesC); |
|
179 iMemoryEatAttributes.iRandomMaxDes.Copy(KNullDesC); |
|
180 iMemoryEatAttributes.iRandomVariance = 0; |
|
181 |
|
182 iPhoneCallAttributes.iId = 0; |
|
183 iPhoneCallAttributes.iPriority = EThreadPriorityTypeNormal; |
|
184 iPhoneCallAttributes.iDestination.Copy(_L("+358")); |
|
185 iPhoneCallAttributes.iLength = 60000; |
|
186 iPhoneCallAttributes.iIdle = 10000; |
|
187 iPhoneCallAttributes.iRandomVariance = 0; |
|
188 |
|
189 iNetConnAttributes.iId = 0; |
|
190 iNetConnAttributes.iPriority = EThreadPriorityTypeNormal; |
|
191 iNetConnAttributes.iDestination.Copy(_L("http://www.nokia.com")); |
|
192 iNetConnAttributes.iIdle = 10000; |
|
193 iNetConnAttributes.iRandomVariance = 0; |
|
194 |
|
195 iKeyPressAttributes.iId = 0; |
|
196 iKeyPressAttributes.iPriority = EThreadPriorityTypeNormal; |
|
197 iKeyPressAttributes.iHeartBeat = 100; |
|
198 iKeyPressAttributes.iRandomVariance = 0; |
|
199 |
|
200 iPointerEventAttributes.iId = 0; |
|
201 iPointerEventAttributes.iPriority = EThreadPriorityTypeNormal; |
|
202 iPointerEventAttributes.iHeartBeat = 1000; |
|
203 iPointerEventAttributes.iRandomVariance = 0; |
|
204 |
|
205 iMessageAttributes.iId = 0; |
|
206 iMessageAttributes.iPriority = EThreadPriorityTypeNormal; |
|
207 iMessageAttributes.iMessageType = EMessageTypeSMS; |
|
208 iMessageAttributes.iDestination.Copy(_L("+358")); |
|
209 iMessageAttributes.iAmount = 5; |
|
210 iMessageAttributes.iLength = 160; |
|
211 iMessageAttributes.iIdle = 15000; |
|
212 iMessageAttributes.iRandomVariance = 0; |
|
213 |
|
214 iApplicationsAttributes.iId = 0; |
|
215 iApplicationsAttributes.iLaunchingInterval = 2000; |
|
216 iApplicationsAttributes.iPriority = EThreadPriorityTypeNormal; |
|
217 iApplicationsAttributes.iKeyPressType = EApplicationsKeyPressTypeNone; |
|
218 iApplicationsAttributes.iMaxOpen = 20; |
|
219 iApplicationsAttributes.iHeartBeat = 50; |
|
220 iApplicationsAttributes.iRandomVariance = 0; |
|
221 |
|
222 iPhotoCaptureAttributes.iId = 0; |
|
223 iPhotoCaptureAttributes.iPriority = EThreadPriorityTypeNormal; |
|
224 iPhotoCaptureAttributes.iIdle = 10000; |
|
225 iPhotoCaptureAttributes.iRandomVariance = 0; |
|
226 iPhotoCaptureAttributes.iCameraCount = CCamera::CamerasAvailable(); |
|
227 if(iPhotoCaptureAttributes.iCameraCount > 0) |
|
228 { |
|
229 iPhotoCaptureAttributes.iCamera = 0; // Main camera |
|
230 } |
|
231 else |
|
232 { |
|
233 iPhotoCaptureAttributes.iCamera = -1; |
|
234 } |
|
235 |
|
236 iBluetoothAttributes.iId = 0; |
|
237 iBluetoothAttributes.iPriority = EThreadPriorityTypeNormal; |
|
238 iBluetoothAttributes.iIdle = 10000; |
|
239 iBluetoothAttributes.iRandomVariance = 0; |
|
240 iBluetoothAttributes.iBluetoothSupported = CFeatureDiscovery::IsFeatureSupportedL(KFeatureIdBt); |
|
241 } |
|
242 |
|
243 // -------------------------------------------------------------------------------------------- |
|
244 |
|
245 void CEngine::DeActivateEngineL() |
|
246 { |
|
247 Cancel(); |
|
248 |
|
249 // for a faster exit, send the application to background |
|
250 TApaTask selfTask(iEnv->WsSession()); |
|
251 selfTask.SetWgId(iEnv->RootWin().Identifier()); |
|
252 selfTask.SendToBackground(); |
|
253 } |
|
254 |
|
255 // -------------------------------------------------------------------------------------------- |
|
256 |
|
257 CEngine::~CEngine() |
|
258 { |
|
259 if (iLoadItemList) |
|
260 { |
|
261 DeleteAllLoadItems(); |
|
262 delete iLoadItemList; |
|
263 } |
|
264 if ( iApplicationsAttributes.iAppsArray ) |
|
265 { |
|
266 delete iApplicationsAttributes.iAppsArray; |
|
267 } |
|
268 iTimer.Close(); |
|
269 iLs.Close(); |
|
270 } |
|
271 |
|
272 // -------------------------------------------------------------------------------------------- |
|
273 |
|
274 void CEngine::DoCancel() |
|
275 { |
|
276 iTimer.Cancel(); |
|
277 } |
|
278 |
|
279 // -------------------------------------------------------------------------------------------- |
|
280 |
|
281 void CEngine::RunL() |
|
282 { |
|
283 // continue |
|
284 //iTimer.After(iStatus, 400000); |
|
285 //SetActive(); |
|
286 } |
|
287 |
|
288 // -------------------------------------------------------------------------------------------- |
|
289 |
|
290 void CEngine::StartNewLoadL(TInt aCommand) |
|
291 { |
|
292 // show new load query |
|
293 //CLoadGenLoadTypeEditorBase* dlg = NULL; |
|
294 |
|
295 if(aCommand == ELoadGenCmdNewLoadPhotoCaptures && |
|
296 iPhotoCaptureAttributes.iCameraCount == 0) |
|
297 { |
|
298 _LIT(message, "Cameras not available"); |
|
299 iEngineWrapper->ShowNote(message); |
|
300 return; |
|
301 } |
|
302 if(aCommand == ELoadGenCmdNewLoadBluetooth && |
|
303 iBluetoothAttributes.iBluetoothSupported == EFalse) |
|
304 { |
|
305 _LIT(message, "Bluetooth device not available"); |
|
306 iEngineWrapper->ShowNote(message); |
|
307 return; |
|
308 } |
|
309 /* |
|
310 switch ( aCommand ) |
|
311 { |
|
312 case ELoadGenCmdNewLoadCPULoad: |
|
313 { |
|
314 //dlg = CLoadGenCPULoadEditor::NewL(iCpuLoadAttributes); |
|
315 break; |
|
316 } |
|
317 case ELoadGenCmdNewLoadEatMemory: |
|
318 { |
|
319 //dlg = CLoadGenMemoryEatEditor::NewL(iMemoryEatAttributes); |
|
320 break; |
|
321 } |
|
322 case ELoadGenCmdNewLoadPhoneCall: |
|
323 { |
|
324 //dlg = CLoadGenPhoneCallEditor::NewL(iPhoneCallAttributes); |
|
325 break; |
|
326 } |
|
327 case ELoadGenCmdNewLoadNetConn: |
|
328 { |
|
329 //dlg = CLoadGenNetConnEditor::NewL(iNetConnAttributes); |
|
330 break; |
|
331 } |
|
332 case ELoadGenCmdNewLoadKeyPress: |
|
333 { |
|
334 //dlg = CLoadGenKeyPressEditor::NewL(iKeyPressAttributes); |
|
335 break; |
|
336 } |
|
337 case ELoadGenCmdNewLoadMessages: |
|
338 { |
|
339 //dlg = CLoadGenMessagesEditor::NewL( iMessageAttributes ); |
|
340 break; |
|
341 } |
|
342 case ELoadGenCmdNewLoadApplications: |
|
343 { |
|
344 //dlg = CLoadGenApplicationsEditor::NewL( iApplicationsAttributes ); |
|
345 break; |
|
346 } |
|
347 case ELoadGenCmdNewLoadPhotoCaptures: |
|
348 { |
|
349 if( iPhotoCaptureAttributes.iCameraCount > 0 ) |
|
350 { |
|
351 //dlg = CLoadGenPhotoCaptureEditor::NewL( iPhotoCaptureAttributes ); |
|
352 } |
|
353 else |
|
354 { |
|
355 _LIT(message, "Cameras not available"); |
|
356 iEngineWrapper->ShowNote(message); |
|
357 //CAknErrorNote* errorNote = new(ELeave) CAknErrorNote; |
|
358 //errorNote->ExecuteLD(message); |
|
359 return; |
|
360 } |
|
361 break; |
|
362 } |
|
363 case ELoadGenCmdNewLoadBluetooth: |
|
364 { |
|
365 if( iBluetoothAttributes.iBluetoothSupported ) |
|
366 { |
|
367 //dlg = CLoadGenBluetoothEditor::NewL(iBluetoothAttributes); |
|
368 } |
|
369 else |
|
370 { |
|
371 _LIT(message, "Bluetooth device not available"); |
|
372 iEngineWrapper->ShowNote(message); |
|
373 //CAknErrorNote* errorNote = new(ELeave) CAknErrorNote; |
|
374 //errorNote->ExecuteLD(message); |
|
375 return; |
|
376 } |
|
377 break; |
|
378 } |
|
379 case ELoadGenCmdNewLoadPointerEvent: |
|
380 { |
|
381 //dlg = CLoadGenPointerEventEditor::NewL(iPointerEventAttributes); |
|
382 break; |
|
383 } |
|
384 |
|
385 default: |
|
386 { |
|
387 User::Panic(_L("Wrong new load"), 111); |
|
388 break; |
|
389 } |
|
390 } |
|
391 */ |
|
392 iEditExistingLoad = EFalse; |
|
393 iEngineWrapper->OpenLoadSettings(aCommand, EFalse); // = dlg->RunQueryLD(); |
|
394 |
|
395 // set back title |
|
396 |
|
397 //if (iMainContainer) |
|
398 // iMainContainer->SetDefaultTitlePaneTextL(); |
|
399 |
|
400 // start creating new load if dialog accepted |
|
401 //if (dlgResult) |
|
402 // { |
|
403 // DoStartNewLoadL(aCommand); |
|
404 // } |
|
405 // DoStartNewLoadL() called from engine wrapper slot function newLoadAdded() after |
|
406 // load settings closed by user select: ok. |
|
407 } |
|
408 |
|
409 // -------------------------------------------------------------------------------------------- |
|
410 |
|
411 void CEngine::EditLoadL(TInt aIndex) |
|
412 { |
|
413 CLoadBase* aItem = iLoadItemList->At(aIndex); |
|
414 iCurrentItemIndex = aIndex; |
|
415 iEditExistingLoad = ETrue; |
|
416 // suspend current |
|
417 if (aItem->State() == CLoadBase::ELoadStateRunning) |
|
418 { |
|
419 iLoadStatusBeforeEdit = CLoadBase::ELoadStateRunning; |
|
420 aItem->Suspend(); |
|
421 } |
|
422 |
|
423 // show new load query |
|
424 |
|
425 /* CLoadGenLoadTypeEditorBase* dlg = NULL; |
|
426 |
|
427 |
|
428 switch ( aItem->Type() ) |
|
429 { |
|
430 case ELoadGenCmdNewLoadCPULoad: |
|
431 { |
|
432 //dlg = CLoadGenCPULoadEditor::NewL(static_cast<CCPULoad*>(aItem)->Attributes(), ETrue); |
|
433 break; |
|
434 } |
|
435 case ELoadGenCmdNewLoadEatMemory: |
|
436 { |
|
437 //dlg = CLoadGenMemoryEatEditor::NewL(static_cast<CMemoryEat*>(aItem)->Attributes(), ETrue); |
|
438 break; |
|
439 } |
|
440 case ELoadGenCmdNewLoadPhoneCall: |
|
441 { |
|
442 //dlg = CLoadGenPhoneCallEditor::NewL(static_cast<CPhoneCall*>(aItem)->Attributes(), ETrue); |
|
443 break; |
|
444 } |
|
445 case ELoadGenCmdNewLoadNetConn: |
|
446 { |
|
447 //dlg = CLoadGenNetConnEditor::NewL(static_cast<CNetConn*>(aItem)->Attributes(), ETrue); |
|
448 break; |
|
449 } |
|
450 case ELoadGenCmdNewLoadKeyPress: |
|
451 { |
|
452 //dlg = CLoadGenKeyPressEditor::NewL(static_cast<CKeyPress*>(aItem)->Attributes(), ETrue); |
|
453 break; |
|
454 } |
|
455 case ELoadGenCmdNewLoadMessages: |
|
456 { |
|
457 //dlg = CLoadGenMessagesEditor::NewL(static_cast<CMessages*>(aItem)->Attributes(), ETrue); |
|
458 break; |
|
459 } |
|
460 case ELoadGenCmdNewLoadApplications: |
|
461 { |
|
462 //dlg = CLoadGenApplicationsEditor::NewL( static_cast<CAppLauncher*>(aItem)->Attributes(), ETrue ); |
|
463 break; |
|
464 } |
|
465 case ELoadGenCmdNewLoadPhotoCaptures: |
|
466 { |
|
467 //dlg = CLoadGenPhotoCaptureEditor::NewL( static_cast<CPhotoCapture*>(aItem)->Attributes(), ETrue ); |
|
468 break; |
|
469 } |
|
470 case ELoadGenCmdNewLoadBluetooth: |
|
471 { |
|
472 //dlg = CLoadGenBluetoothEditor::NewL( static_cast<CBluetooth*>(aItem)->Attributes(), ETrue ); |
|
473 break; |
|
474 } |
|
475 case ELoadGenCmdNewLoadPointerEvent: |
|
476 { |
|
477 //dlg = CLoadGenPointerEventEditor::NewL(static_cast<CPointerEvent*>(aItem)->Attributes(), ETrue); |
|
478 break; |
|
479 } |
|
480 default: |
|
481 { |
|
482 User::Panic(_L("Wrong edit load"), 114); |
|
483 break; |
|
484 } |
|
485 } |
|
486 */ |
|
487 iEngineWrapper->OpenLoadSettings(aItem->Type(), iEditExistingLoad); |
|
488 // ExistingLoadEditedL method called from engine wrapper when load settings view close signal received. |
|
489 |
|
490 //TBool dlgResult = ETrue; //dlg->RunQueryLD(); |
|
491 |
|
492 // set back title |
|
493 // TODO: check this. |
|
494 //if (iMainContainer) |
|
495 // iMainContainer->SetDefaultTitlePaneTextL(); |
|
496 |
|
497 // change priority of the load item |
|
498 //aItem->SetPriority(); |
|
499 |
|
500 // resume execution the item |
|
501 //aItem->Resume(); |
|
502 |
|
503 //if (dlgResult) |
|
504 // RefreshViewL(EFalse); |
|
505 } |
|
506 |
|
507 // -------------------------------------------------------------------------------------------- |
|
508 |
|
509 void CEngine::ExistingLoadEditedL() |
|
510 { |
|
511 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
512 // change priority of the load item |
|
513 aItem->SetPriority(); |
|
514 if (iLoadStatusBeforeEdit == CLoadBase::ELoadStateRunning) |
|
515 { |
|
516 // resume execution the item |
|
517 aItem->Resume(); |
|
518 RefreshViewL(EFalse); |
|
519 } |
|
520 // cancel: |
|
521 |
|
522 } |
|
523 |
|
524 // -------------------------------------------------------------------------------------------- |
|
525 |
|
526 void CEngine::ExistingLoadEditCancelled() |
|
527 { |
|
528 if (iLoadStatusBeforeEdit == CLoadBase::ELoadStateRunning) |
|
529 { |
|
530 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
531 // resume execution due to suspend action before edit started: |
|
532 aItem->Resume(); |
|
533 } |
|
534 RefreshViewL(EFalse); |
|
535 } |
|
536 |
|
537 // -------------------------------------------------------------------------------------------- |
|
538 |
|
539 void CEngine::DoStartNewLoadL(TInt aCommand) |
|
540 { |
|
541 CLoadBase* item = NULL; |
|
542 |
|
543 switch ( aCommand ) |
|
544 { |
|
545 case ELoadGenCmdNewLoadCPULoad: |
|
546 { |
|
547 if( iCpuLoadAttributes.iCpu == KCPUSelection_AllCPUs ) |
|
548 { |
|
549 // Call this function recursively for all CPUs: |
|
550 for( TUint i = 0; i < iCpuLoadAttributes.iCpuCount; ++i ) |
|
551 { |
|
552 iCpuLoadAttributes.iCpu = i; |
|
553 DoStartNewLoadL(aCommand); |
|
554 } |
|
555 // And finally set user selection back to "All CPUs" |
|
556 iCpuLoadAttributes.iCpu = KCPUSelection_AllCPUs; |
|
557 return; |
|
558 } |
|
559 else |
|
560 { |
|
561 item = CCPULoad::NewL(iCpuLoadAttributes, iReferenceNumber); |
|
562 } |
|
563 break; |
|
564 } |
|
565 case ELoadGenCmdNewLoadEatMemory: |
|
566 { |
|
567 item = CMemoryEat::NewL(iMemoryEatAttributes, iReferenceNumber); |
|
568 break; |
|
569 } |
|
570 case ELoadGenCmdNewLoadPhoneCall: |
|
571 { |
|
572 item = CPhoneCall::NewL(iPhoneCallAttributes, iReferenceNumber); |
|
573 break; |
|
574 } |
|
575 case ELoadGenCmdNewLoadNetConn: |
|
576 { |
|
577 item = CNetConn::NewL(iNetConnAttributes, iReferenceNumber); |
|
578 break; |
|
579 } |
|
580 |
|
581 case ELoadGenCmdNewLoadKeyPress: |
|
582 { |
|
583 item = CKeyPress::NewL(iKeyPressAttributes, iReferenceNumber); |
|
584 break; |
|
585 } |
|
586 case ELoadGenCmdNewLoadMessages: |
|
587 { |
|
588 item = CMessages::NewL( iMessageAttributes, iReferenceNumber ); |
|
589 break; |
|
590 } |
|
591 case ELoadGenCmdNewLoadApplications: |
|
592 { |
|
593 iApplicationsAttributes.iAppsArray = ListOfAllAppsL(); |
|
594 item = CAppLauncher::NewL( iApplicationsAttributes, iReferenceNumber ); |
|
595 break; |
|
596 } |
|
597 case ELoadGenCmdNewLoadPhotoCaptures: |
|
598 { |
|
599 item = CPhotoCapture::NewL( iPhotoCaptureAttributes, iReferenceNumber); |
|
600 break; |
|
601 } |
|
602 case ELoadGenCmdNewLoadBluetooth: |
|
603 { |
|
604 item = CBluetooth::NewL( iBluetoothAttributes, iReferenceNumber); |
|
605 break; |
|
606 } |
|
607 case ELoadGenCmdNewLoadPointerEvent: |
|
608 { |
|
609 item = CPointerEvent::NewL(iPointerEventAttributes, iReferenceNumber); |
|
610 break; |
|
611 } |
|
612 |
|
613 default: |
|
614 { |
|
615 User::Panic(_L("Wrong new load"), 112); |
|
616 break; |
|
617 } |
|
618 } |
|
619 |
|
620 iReferenceNumber++; |
|
621 |
|
622 // add item to the array |
|
623 AppendToLoadItemListL(item); |
|
624 |
|
625 // update the listbox |
|
626 RefreshViewL(EFalse); |
|
627 |
|
628 // set item index to the end |
|
629 // Check this feature to be done in Orbit UI. |
|
630 // iMainContainer->ListBox()->SetCurrentItemIndexAndDraw( iMainContainer->ListBox()->Model()->NumberOfItems()-1 ); |
|
631 |
|
632 // start the load |
|
633 item->Resume(); |
|
634 |
|
635 // refresh again |
|
636 RefreshViewL(EFalse); |
|
637 } |
|
638 |
|
639 // -------------------------------------------------------------------------------------------- |
|
640 |
|
641 |
|
642 void CEngine::StopAllLoadItemsL() |
|
643 { |
|
644 DeleteAllLoadItems(); |
|
645 |
|
646 RefreshViewL(); |
|
647 } |
|
648 |
|
649 // -------------------------------------------------------------------------------------------- |
|
650 |
|
651 void CEngine::SuspendAllLoadItemsL() |
|
652 { |
|
653 for (TInt i=0; i<LoadItemCount(); i++) |
|
654 { |
|
655 if ( iLoadItemList->At(i) ) |
|
656 { |
|
657 iLoadItemList->At(i)->Suspend(); |
|
658 } |
|
659 } |
|
660 |
|
661 RefreshViewL(); |
|
662 } |
|
663 // -------------------------------------------------------------------------------------------- |
|
664 |
|
665 void CEngine::ResumeAllLoadItemsL() |
|
666 { |
|
667 for (TInt i=0; i<LoadItemCount(); i++) |
|
668 { |
|
669 if ( iLoadItemList->At(i) ) |
|
670 { |
|
671 iLoadItemList->At(i)->Resume(); |
|
672 } |
|
673 } |
|
674 |
|
675 RefreshViewL(); |
|
676 } |
|
677 |
|
678 // -------------------------------------------------------------------------------------------- |
|
679 |
|
680 void CEngine::RefreshViewL(TBool aClearSelection) |
|
681 { |
|
682 // clear selections if any |
|
683 iEngineWrapper->ClearSelection(); |
|
684 if (aClearSelection) |
|
685 { |
|
686 iEngineWrapper->SetCurrentItemIndex(KZeroIndex); |
|
687 } |
|
688 iEngineWrapper->ReFreshView(GenerateListBoxItemTextArrayL()); |
|
689 } |
|
690 |
|
691 // -------------------------------------------------------------------------------------------- |
|
692 |
|
693 CDesCArray* CEngine::GenerateListBoxItemTextArrayL() |
|
694 { |
|
695 CDesCArray* textArray = new(ELeave) CDesCArrayFlat(64); |
|
696 CleanupStack::PushL(textArray); |
|
697 |
|
698 _LIT(KEntryTemplateRedIcon, "1\t%S\t\t"); |
|
699 _LIT(KEntryTemplateGreenIcon, "2\t%S\t\t"); |
|
700 TInt cnt = LoadItemCount(); |
|
701 for (TInt i=0; i< cnt; i++) |
|
702 { |
|
703 // add description from each entry |
|
704 TBuf<256> textEntry; |
|
705 TBuf<256> description = iLoadItemList->At(i)->Description(); |
|
706 |
|
707 if (iLoadItemList->At(i)->State() == CLoadBase::ELoadStateRunning) |
|
708 textEntry.Format(KEntryTemplateGreenIcon, &description); |
|
709 else |
|
710 textEntry.Format(KEntryTemplateRedIcon, &description); |
|
711 |
|
712 textArray->AppendL(textEntry); |
|
713 } |
|
714 |
|
715 CleanupStack::Pop(); //textArray |
|
716 return textArray; |
|
717 } |
|
718 |
|
719 // -------------------------------------------------------------------------------------------- |
|
720 |
|
721 void CEngine::AppendToLoadItemListL(CLoadBase* aItem) |
|
722 { |
|
723 if (iLoadItemList) |
|
724 iLoadItemList->AppendL( aItem ); |
|
725 else |
|
726 User::Leave(KErrNotReady); |
|
727 } |
|
728 |
|
729 // -------------------------------------------------------------------------------------------- |
|
730 |
|
731 void CEngine::DeleteFromLoadItemListL(TInt aIndex) |
|
732 { |
|
733 if (iLoadItemList) |
|
734 { |
|
735 if (iLoadItemList->Count() > aIndex && aIndex >= 0) |
|
736 { |
|
737 // first call delete on the item |
|
738 if (iLoadItemList->At(aIndex)) |
|
739 { |
|
740 delete iLoadItemList->At(aIndex); |
|
741 iLoadItemList->At(aIndex) = NULL; |
|
742 } |
|
743 |
|
744 // and them remove the array entry |
|
745 iLoadItemList->Delete(aIndex); |
|
746 iLoadItemList->Compress(); |
|
747 } |
|
748 else |
|
749 User::Leave(KErrNotFound); |
|
750 } |
|
751 else |
|
752 User::Leave(KErrNotReady); |
|
753 } |
|
754 |
|
755 // -------------------------------------------------------------------------------------------- |
|
756 |
|
757 void CEngine::SuspendOrResumeFromLoadItemListL(TInt aIndex) |
|
758 { |
|
759 if (iLoadItemList) |
|
760 { |
|
761 if (iLoadItemList->Count() > aIndex && aIndex >= 0) |
|
762 { |
|
763 if (iLoadItemList->At(aIndex)) |
|
764 { |
|
765 if (iLoadItemList->At(aIndex)->State() == CLoadBase::ELoadStateRunning) |
|
766 { |
|
767 iLoadItemList->At(aIndex)->Suspend(); |
|
768 } |
|
769 else if (iLoadItemList->At(aIndex)->State() == CLoadBase::ELoadStateSuspended) |
|
770 { |
|
771 iLoadItemList->At(aIndex)->Resume(); |
|
772 } |
|
773 } |
|
774 } |
|
775 else |
|
776 User::Leave(KErrNotFound); |
|
777 } |
|
778 else |
|
779 User::Leave(KErrNotReady); |
|
780 } |
|
781 |
|
782 // -------------------------------------------------------------------------------------------- |
|
783 |
|
784 TInt CEngine::LoadItemCount() const |
|
785 { |
|
786 TInt count(0); |
|
787 |
|
788 if (iLoadItemList) |
|
789 count = iLoadItemList->Count(); |
|
790 |
|
791 return count; |
|
792 } |
|
793 |
|
794 // -------------------------------------------------------------------------------------------- |
|
795 |
|
796 void CEngine::DeleteAllLoadItems() |
|
797 { |
|
798 // call delete for each entry and free memory allocated for the array |
|
799 for (TInt i=0; i<LoadItemCount(); i++) |
|
800 { |
|
801 if ( iLoadItemList->At(i) ) |
|
802 { |
|
803 delete iLoadItemList->At(i); |
|
804 iLoadItemList->At(i) = NULL; |
|
805 } |
|
806 } |
|
807 |
|
808 iLoadItemList->Reset(); |
|
809 } |
|
810 |
|
811 // -------------------------------------------------------------------------------------------- |
|
812 |
|
813 void CEngine::StopSelectedOrHighlightedItemsL(const CArrayFix<TInt>* aSelectionIndexes) |
|
814 { |
|
815 TInt err(KErrNone); |
|
816 |
|
817 // by default use selected items |
|
818 if (aSelectionIndexes && aSelectionIndexes->Count() > 0) |
|
819 { |
|
820 TInt deleteIndexCounter(0); |
|
821 TInt ref(0); |
|
822 TKeyArrayFix key(0, ECmpTUint16); |
|
823 TInt index(0); |
|
824 |
|
825 TInt loadCount = LoadItemCount(); |
|
826 |
|
827 for (TInt i=0; i<loadCount; i++) |
|
828 { |
|
829 ref = i; |
|
830 |
|
831 if (aSelectionIndexes->Find(ref, key, index) == 0) |
|
832 { |
|
833 TRAP(err, DeleteFromLoadItemListL(i-deleteIndexCounter)); |
|
834 deleteIndexCounter++; // amount of indexes decreases after each delete |
|
835 } |
|
836 } |
|
837 |
|
838 RefreshViewL(); |
|
839 User::LeaveIfError(err); |
|
840 } |
|
841 } |
|
842 |
|
843 // -------------------------------------------------------------------------------------------- |
|
844 |
|
845 void CEngine::SuspendOrResumeSelectedOrHighlightedItemsL() |
|
846 { |
|
847 const CArrayFix<TInt>* selectionIndexes = iEngineWrapper->QueryListSelectedIndexesOrCurrentItemL(); //iMainContainer->ListBoxSelectionIndexes(); |
|
848 |
|
849 // by default use selected items |
|
850 if (selectionIndexes && selectionIndexes->Count() > 0) |
|
851 { |
|
852 TInt ref(0); |
|
853 TKeyArrayFix key(0, ECmpTUint16); |
|
854 TInt index(0); |
|
855 |
|
856 for (TInt i=0; i<LoadItemCount(); i++) |
|
857 { |
|
858 ref = i; |
|
859 |
|
860 if (selectionIndexes->Find(ref, key, index) == 0) |
|
861 { |
|
862 SuspendOrResumeFromLoadItemListL(i); |
|
863 } |
|
864 } |
|
865 |
|
866 RefreshViewL(EFalse); |
|
867 } |
|
868 } |
|
869 // -------------------------------------------------------------------------------------------- |
|
870 |
|
871 void CEngine::LoadSettingsL() |
|
872 { |
|
873 } |
|
874 |
|
875 // -------------------------------------------------------------------------------------------- |
|
876 |
|
877 void CEngine::SaveSettingsL() |
|
878 { |
|
879 } |
|
880 |
|
881 // -------------------------------------------------------------------------------------------- |
|
882 |
|
883 TInt CEngine::LaunchSettingsDialogL() |
|
884 { |
|
885 return 0; |
|
886 } |
|
887 |
|
888 // -------------------------------------------------------------------------------------------- |
|
889 CDesCArray* CEngine::ListOfAllAppsL() |
|
890 { |
|
891 const TInt KMaxAppsArraySize=250; |
|
892 RApaLsSession ls; |
|
893 CleanupClosePushL(ls); |
|
894 |
|
895 User::LeaveIfError( ls.Connect() ); |
|
896 CDesCArray* allAppsArray = new(ELeave) CDesCArrayFlat( KMaxAppsArraySize ); |
|
897 CleanupStack::PushL( allAppsArray ); |
|
898 // reset the apps list |
|
899 allAppsArray->Reset(); |
|
900 |
|
901 // search all apps |
|
902 TApaAppInfo appInfo; |
|
903 User::LeaveIfError(ls.GetAllApps()); |
|
904 |
|
905 |
|
906 while ( ls.GetNextApp( appInfo ) == KErrNone ) |
|
907 { |
|
908 allAppsArray->AppendL( appInfo.iFullName ); |
|
909 } |
|
910 CleanupStack::Pop( allAppsArray ); |
|
911 CleanupStack::PopAndDestroy( &ls ); |
|
912 |
|
913 |
|
914 // remove loadgen.* from the list |
|
915 for ( TInt i = 0; i < allAppsArray->MdcaCount(); i++ ) |
|
916 { |
|
917 if ( allAppsArray->MdcaPoint(i).FindF( _L("\\loadgen.") ) != KErrNotFound ) |
|
918 { |
|
919 allAppsArray->Delete(i); |
|
920 allAppsArray->Compress(); |
|
921 break; |
|
922 } |
|
923 } |
|
924 |
|
925 // sort the elements |
|
926 allAppsArray->Sort(); |
|
927 |
|
928 return allAppsArray; // ownership transferred |
|
929 } |
|
930 |
|
931 // -------------------------------------------------------------------------------------------- |
|
932 |
|
933 void CEngine::LaunchPerfMonL() |
|
934 { |
|
935 // launch Performance Monitor |
|
936 const TUid KUidPerfMon = { 0x20011385 }; |
|
937 |
|
938 RWsSession ws; |
|
939 User::LeaveIfError( ws.Connect() ); |
|
940 CleanupClosePushL(ws); |
|
941 |
|
942 RApaLsSession ls; |
|
943 User::LeaveIfError( ls.Connect() ); |
|
944 CleanupClosePushL(ls); |
|
945 |
|
946 |
|
947 // try to find the task of PerfMon |
|
948 TApaTaskList tasklist(ws); |
|
949 TApaTask task = tasklist.FindApp(KUidPerfMon); |
|
950 |
|
951 if (task.Exists()) |
|
952 { |
|
953 // task exists, bring it to foreground |
|
954 task.BringToForeground(); |
|
955 } |
|
956 else |
|
957 { |
|
958 TApaAppInfo appInfo; |
|
959 User::LeaveIfError(ls.GetAppInfo(appInfo, KUidPerfMon)); |
|
960 |
|
961 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
962 cmdLine->SetExecutableNameL(appInfo.iFullName); |
|
963 cmdLine->SetCommandL(EApaCommandBackground); |
|
964 |
|
965 // start the app |
|
966 User::LeaveIfError(ls.StartApp(*cmdLine)); |
|
967 |
|
968 CleanupStack::PopAndDestroy(); //cmdLine |
|
969 } |
|
970 |
|
971 CleanupStack::PopAndDestroy(2); //ws,ls |
|
972 } |
|
973 |
|
974 // -------------------------------------------------------------------------------------------- |
|
975 |
|
976 TCPULoadAttributes CEngine::GetCPULoadAttributes() |
|
977 { |
|
978 if (iEditExistingLoad == EFalse) |
|
979 { |
|
980 return iCpuLoadAttributes; |
|
981 } |
|
982 else |
|
983 { |
|
984 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
985 return (static_cast<CCPULoad*>(aItem)->Attributes()); |
|
986 } |
|
987 } |
|
988 |
|
989 // -------------------------------------------------------------------------------------------- |
|
990 |
|
991 void CEngine::ChangeCPULoadAttributes(const TCPULoadAttributes& aAttributes) |
|
992 { |
|
993 if (iEditExistingLoad == EFalse) |
|
994 { |
|
995 iCpuLoadAttributes = aAttributes; |
|
996 } |
|
997 else |
|
998 { |
|
999 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1000 static_cast<CCPULoad*>(aItem)->SetAttributes(aAttributes); |
|
1001 } |
|
1002 } |
|
1003 |
|
1004 // -------------------------------------------------------------------------------------------- |
|
1005 |
|
1006 TMemoryEatAttributes CEngine::GetMemoryEatAttributes() |
|
1007 { |
|
1008 if (iEditExistingLoad == EFalse) |
|
1009 { |
|
1010 return iMemoryEatAttributes; |
|
1011 } |
|
1012 else |
|
1013 { |
|
1014 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1015 return (static_cast<CMemoryEat*>(aItem)->Attributes()); |
|
1016 } |
|
1017 } |
|
1018 |
|
1019 // -------------------------------------------------------------------------------------------- |
|
1020 |
|
1021 void CEngine::ChangeMemoryEatAttributes(const TMemoryEatAttributes& aAttributes) |
|
1022 { |
|
1023 if (iEditExistingLoad == EFalse) |
|
1024 { |
|
1025 iMemoryEatAttributes = aAttributes; |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1030 static_cast<CMemoryEat*>(aItem)->SetAttributes(aAttributes); |
|
1031 } |
|
1032 } |
|
1033 |
|
1034 // -------------------------------------------------------------------------------------------- |
|
1035 |
|
1036 TPhoneCallAttributes CEngine::GetPhoneCallAttributes() |
|
1037 { |
|
1038 if (iEditExistingLoad == EFalse) |
|
1039 { |
|
1040 return iPhoneCallAttributes; |
|
1041 } |
|
1042 else |
|
1043 { |
|
1044 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1045 return (static_cast<CPhoneCall*>(aItem)->Attributes()); |
|
1046 } |
|
1047 } |
|
1048 |
|
1049 // -------------------------------------------------------------------------------------------- |
|
1050 |
|
1051 void CEngine::ChangePhoneCallAttributes(const TPhoneCallAttributes& aAttributes) |
|
1052 { |
|
1053 if (iEditExistingLoad == EFalse) |
|
1054 { |
|
1055 iPhoneCallAttributes = aAttributes; |
|
1056 } |
|
1057 else |
|
1058 { |
|
1059 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1060 static_cast<CPhoneCall*>(aItem)->SetAttributes(aAttributes); |
|
1061 } |
|
1062 } |
|
1063 |
|
1064 // -------------------------------------------------------------------------------------------- |
|
1065 |
|
1066 TNetConnAttributes CEngine::GetNetConnAttributes() |
|
1067 { |
|
1068 |
|
1069 if (iEditExistingLoad == EFalse) |
|
1070 { |
|
1071 return iNetConnAttributes; |
|
1072 } |
|
1073 else |
|
1074 { |
|
1075 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1076 return (static_cast<CNetConn*>(aItem)->Attributes()); |
|
1077 } |
|
1078 |
|
1079 } |
|
1080 |
|
1081 // -------------------------------------------------------------------------------------------- |
|
1082 |
|
1083 void CEngine::ChangeNetConnAttributes(const TNetConnAttributes& aAttributes) |
|
1084 { |
|
1085 |
|
1086 if (iEditExistingLoad == EFalse) |
|
1087 { |
|
1088 iNetConnAttributes = aAttributes; |
|
1089 } |
|
1090 else |
|
1091 { |
|
1092 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1093 static_cast<CNetConn*>(aItem)->SetAttributes(aAttributes); |
|
1094 } |
|
1095 |
|
1096 } |
|
1097 |
|
1098 // -------------------------------------------------------------------------------------------- |
|
1099 |
|
1100 TKeyPressAttributes CEngine::GetKeyPressAttributes() |
|
1101 { |
|
1102 if (iEditExistingLoad == EFalse) |
|
1103 { |
|
1104 return iKeyPressAttributes; |
|
1105 } |
|
1106 else |
|
1107 { |
|
1108 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1109 return (static_cast<CKeyPress*>(aItem)->Attributes()); |
|
1110 } |
|
1111 } |
|
1112 |
|
1113 |
|
1114 // -------------------------------------------------------------------------------------------- |
|
1115 |
|
1116 void CEngine::ChangeKeyPressAttributes(const TKeyPressAttributes& aAttributes) |
|
1117 { |
|
1118 if (iEditExistingLoad == EFalse) |
|
1119 { |
|
1120 iKeyPressAttributes = aAttributes; |
|
1121 } |
|
1122 else |
|
1123 { |
|
1124 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1125 static_cast<CKeyPress*>(aItem)->SetAttributes(aAttributes); |
|
1126 } |
|
1127 } |
|
1128 |
|
1129 // -------------------------------------------------------------------------------------------- |
|
1130 |
|
1131 TMessageAttributes CEngine::GetMessageAttributes() |
|
1132 { |
|
1133 if (iEditExistingLoad == EFalse) |
|
1134 { |
|
1135 return iMessageAttributes; |
|
1136 } |
|
1137 else |
|
1138 { |
|
1139 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1140 return (static_cast<CMessages*>(aItem)->Attributes()); |
|
1141 } |
|
1142 } |
|
1143 |
|
1144 // -------------------------------------------------------------------------------------------- |
|
1145 |
|
1146 void CEngine::ChangeMessageAttributes(const TMessageAttributes& aAttributes) |
|
1147 { |
|
1148 if (iEditExistingLoad == EFalse) |
|
1149 { |
|
1150 iMessageAttributes = aAttributes; |
|
1151 } |
|
1152 else |
|
1153 { |
|
1154 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1155 static_cast<CMessages*>(aItem)->SetAttributes(aAttributes); |
|
1156 } |
|
1157 } |
|
1158 |
|
1159 // -------------------------------------------------------------------------------------------- |
|
1160 |
|
1161 TApplicationsAttributes CEngine::GetApplicationsAttributes() |
|
1162 { |
|
1163 if (iEditExistingLoad == EFalse) |
|
1164 { |
|
1165 return iApplicationsAttributes; |
|
1166 } |
|
1167 else |
|
1168 { |
|
1169 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1170 return (static_cast<CAppLauncher*>(aItem)->Attributes()); |
|
1171 } |
|
1172 } |
|
1173 |
|
1174 // -------------------------------------------------------------------------------------------- |
|
1175 |
|
1176 void CEngine::ChangeApplicationsAttributes(const TApplicationsAttributes& aAttributes) |
|
1177 { |
|
1178 if (iEditExistingLoad == EFalse) |
|
1179 { |
|
1180 iApplicationsAttributes = aAttributes; |
|
1181 } |
|
1182 else |
|
1183 { |
|
1184 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1185 static_cast<CAppLauncher*>(aItem)->SetAttributes(aAttributes); |
|
1186 } |
|
1187 } |
|
1188 |
|
1189 // -------------------------------------------------------------------------------------------- |
|
1190 |
|
1191 TPhotoCaptureAttributes CEngine::GetPhotoCaptureAttributes() |
|
1192 { |
|
1193 if (iEditExistingLoad == EFalse) |
|
1194 { |
|
1195 return iPhotoCaptureAttributes; |
|
1196 } |
|
1197 else |
|
1198 { |
|
1199 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1200 return (static_cast<CPhotoCapture*>(aItem)->Attributes()); |
|
1201 } |
|
1202 } |
|
1203 |
|
1204 // -------------------------------------------------------------------------------------------- |
|
1205 |
|
1206 void CEngine::ChangePhotoCaptureAttributes(const TPhotoCaptureAttributes& aAttributes) |
|
1207 { |
|
1208 if (iEditExistingLoad == EFalse) |
|
1209 { |
|
1210 iPhotoCaptureAttributes = aAttributes; |
|
1211 } |
|
1212 else |
|
1213 { |
|
1214 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1215 static_cast<CPhotoCapture*>(aItem)->SetAttributes(aAttributes); |
|
1216 } |
|
1217 } |
|
1218 |
|
1219 // -------------------------------------------------------------------------------------------- |
|
1220 |
|
1221 TBluetoothAttributes CEngine::GetBluetoothAttributes() |
|
1222 { |
|
1223 if (iEditExistingLoad == EFalse) |
|
1224 { |
|
1225 return iBluetoothAttributes; |
|
1226 } |
|
1227 else |
|
1228 { |
|
1229 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1230 return (static_cast<CBluetooth*>(aItem)->Attributes()); |
|
1231 } |
|
1232 } |
|
1233 |
|
1234 |
|
1235 // -------------------------------------------------------------------------------------------- |
|
1236 |
|
1237 void CEngine::ChangeBluetoothAttributes(const TBluetoothAttributes& aAttributes) |
|
1238 { |
|
1239 if (iEditExistingLoad == EFalse) |
|
1240 { |
|
1241 iBluetoothAttributes = aAttributes; |
|
1242 } |
|
1243 else |
|
1244 { |
|
1245 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1246 static_cast<CBluetooth*>(aItem)->SetAttributes(aAttributes); |
|
1247 } |
|
1248 } |
|
1249 |
|
1250 // -------------------------------------------------------------------------------------------- |
|
1251 |
|
1252 TPointerEventAttributes CEngine::GetPointerEventAttributes() |
|
1253 { |
|
1254 if (iEditExistingLoad == EFalse) |
|
1255 { |
|
1256 return iPointerEventAttributes; |
|
1257 } |
|
1258 else |
|
1259 { |
|
1260 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1261 return (static_cast<CPointerEvent*>(aItem)->Attributes()); |
|
1262 } |
|
1263 } |
|
1264 |
|
1265 // -------------------------------------------------------------------------------------------- |
|
1266 |
|
1267 void CEngine::ChangePointerEventAttributes(const TPointerEventAttributes& aAttributes) |
|
1268 { |
|
1269 if (iEditExistingLoad == EFalse) |
|
1270 { |
|
1271 iPointerEventAttributes = aAttributes; |
|
1272 } |
|
1273 else |
|
1274 { |
|
1275 CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); |
|
1276 static_cast<CPointerEvent*>(aItem)->SetAttributes(aAttributes); |
|
1277 } |
|
1278 } |
|
1279 |
|
1280 // -------------------------------------------------------------------------------------------- |
|
1281 |
|
1282 // End of File |