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: Class declaration for CDiagEngineImpl |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DIAGENGINEIMPL_H |
|
20 #define DIAGENGINEIMPL_H |
|
21 |
|
22 |
|
23 // system includes |
|
24 #include <e32base.h> // CActive |
|
25 #include <DiagEngineCommon.h> // MDiagEngineCommon |
|
26 #include <DiagEngineObserver.h> // MDiagEngineObserver::TSuspendReason |
|
27 #include <DiagResultsDatabase.h> // RDiagResultsDatabase, RDiagResultsDatabaseRecord |
|
28 #include <DiagTestPlugin.h> // MDiagTestPlugin::TStopReason |
|
29 #include <DiagSuitePlugin.h> // MDiagSuitePlugin::TStopReason |
|
30 |
|
31 // user includes. |
|
32 #include "diagenginestatemachineobserver.h" // DiagFwInternal::MStateMachineObserver |
|
33 #include "diagenginestates.h" // DiagFwInternal::TState |
|
34 #include "diagengineevents.h" // DiagFwInternal::TEvent |
|
35 #include "diagenginecallhandlerobserver.h" // MDiagEngineCallHandlerObserver |
|
36 #include "diagexecplanentryimplobserver.h" // MDiagExecPlanEntryImplObserver |
|
37 #include "diagengineconfig.h" // TDiagEngineConfig |
|
38 |
|
39 |
|
40 // Forward declarations |
|
41 class MDiagTestPlugin; |
|
42 class MDiagSuitePlugin; |
|
43 class CDiagPluginPool; |
|
44 class CAknViewAppUi; |
|
45 class CDiagEngineCallHandler; |
|
46 class CDiagPluginExecPlanImpl; |
|
47 class CDiagExecPlanEntryImpl; |
|
48 class CDiagExecPlanEntryImplTest; |
|
49 |
|
50 namespace DiagFwInternal |
|
51 { |
|
52 class CStateMachine; |
|
53 class CEventBasic; |
|
54 class CEventCancel; |
|
55 class CEventSendCompletion; |
|
56 class CEventSuiteContinue; |
|
57 class CEventTestCompleted; |
|
58 class CEventTestProgress; |
|
59 class CEventWatchdog; |
|
60 } |
|
61 |
|
62 /** |
|
63 * Diagnostics Framework Engine Implementation |
|
64 * |
|
65 * This class is the actual class that implements CDiagEngine. |
|
66 * All actual work is done by CDiagEngineImpl class. |
|
67 * |
|
68 */ |
|
69 NONSHARABLE_CLASS( CDiagEngineImpl ) : public CActive, |
|
70 public MDiagEngineCommon, |
|
71 public MDiagExecPlanEntryImplObserver, |
|
72 public DiagFwInternal::MStateMachineObserver, |
|
73 public MDiagEngineCallHandlerObserver |
|
74 { |
|
75 public: |
|
76 |
|
77 /** |
|
78 * Two-phased constructor. |
|
79 * @param aViewAppUi View App Ui that is using this engine. |
|
80 * @param aObserver Engine observer. |
|
81 * @param aDbSession Session to RDiagResultDatabase to create record. |
|
82 * @param aPluginPool Initialized plug-in pool that holds plug-ins. |
|
83 * @param aDisableDependency if ETrue, plug-ins should execute |
|
84 * event if dependencies are not met. |
|
85 * @param aExecutionBatch - array of test uids to execute |
|
86 * |
|
87 * @return new instance of CDiagEngineImpl* |
|
88 */ |
|
89 static CDiagEngineImpl* NewL( CAknViewAppUi& aViewAppUi, |
|
90 MDiagEngineObserver& aObserver, |
|
91 RDiagResultsDatabase& aDbSession, |
|
92 CDiagPluginPool& aPluginPool, |
|
93 TBool aDisableDependency, |
|
94 const RArray< TUid >& aExecutionBatch ); |
|
95 |
|
96 /** |
|
97 * Two-phased constructor. This function is identical to NewL, |
|
98 * except that it pushs created object in clean up stack. |
|
99 * |
|
100 * @param aViewAppUi View App Ui that is using this engine. |
|
101 * @param aObserver Engine observer. |
|
102 * @param aDbSession Session to RDiagResultDatabase to create record. |
|
103 * @param aPluginPool Initialized plug-in pool that holds plug-ins. |
|
104 * @param aDisableDependency if ETrue, plug-ins should execute |
|
105 * event if dependencies are not met. |
|
106 * @param aExecutionBatch - array of test uids to execute |
|
107 * |
|
108 * @return new instance of CDiagEngineImpl* |
|
109 */ |
|
110 static CDiagEngineImpl* NewLC( CAknViewAppUi& aViewAppUi, |
|
111 MDiagEngineObserver& aObserver, |
|
112 RDiagResultsDatabase& aDbSession, |
|
113 CDiagPluginPool& aPluginPool, |
|
114 TBool aDisableDependency, |
|
115 const RArray< TUid >& aExecutionBatch ); |
|
116 |
|
117 |
|
118 /** |
|
119 * Two-phased constructor. |
|
120 * @param aViewAppUi View App Ui that is using this engine. |
|
121 * @param aObserver Engine observer. |
|
122 * @param aDbSession Session to RDiagResultDatabase to create record. |
|
123 * @param aPluginPool Initialized plug-in pool that holds plug-ins. |
|
124 * @param aIncompleteRecordUid - Uid to the record to resume. |
|
125 * |
|
126 * @return new instance of CDiagEngineImpl* |
|
127 */ |
|
128 static CDiagEngineImpl* NewL( CAknViewAppUi& aViewAppUi, |
|
129 MDiagEngineObserver& aObserver, |
|
130 RDiagResultsDatabase& aDbSession, |
|
131 CDiagPluginPool& aPluginPool, |
|
132 TUid aIncompleteRecordUid ); |
|
133 /** |
|
134 * Two-phased constructor. This function is identical to NewL, |
|
135 * except that it pushs created object in clean up stack. |
|
136 * |
|
137 * @param aViewAppUi View App Ui that is using this engine. |
|
138 * @param aObserver Engine observer. |
|
139 * @param aDbSession Session to RDiagResultDatabase to create record. |
|
140 * @param aPluginPool Initialized plug-in pool that holds plug-ins. |
|
141 * @param aIncompleteRecordUid - Uid to the record to resume. |
|
142 * |
|
143 * @return new instance of CDiagEngineImpl* |
|
144 */ |
|
145 static CDiagEngineImpl* NewLC( CAknViewAppUi& aViewAppUi, |
|
146 MDiagEngineObserver& aObserver, |
|
147 RDiagResultsDatabase& aDbSession, |
|
148 CDiagPluginPool& aPluginPool, |
|
149 TUid aIncompleteRecordUid ); |
|
150 |
|
151 |
|
152 /** |
|
153 * Destructor. |
|
154 */ |
|
155 virtual ~CDiagEngineImpl(); |
|
156 |
|
157 /** |
|
158 * Execute tests. This implements CDiagEngine::ExecuteL |
|
159 * |
|
160 * @see CDiagEngine::ExecuteL |
|
161 */ |
|
162 void ExecuteL(); |
|
163 |
|
164 /** |
|
165 * Set custom execution parameter. |
|
166 * |
|
167 * @see CDiagEngine::SetCustomParam |
|
168 */ |
|
169 void SetCustomParam( TAny* aCustomParams ); |
|
170 |
|
171 /** |
|
172 * Suspend execution. |
|
173 * |
|
174 * @see CDiagEngine::SuspendL |
|
175 */ |
|
176 void SuspendL(); |
|
177 |
|
178 /** |
|
179 * Resume suspended execution. This implements CDiagEngine::ResumeL |
|
180 * |
|
181 * @see CDiagEngine::ResumeL |
|
182 */ |
|
183 void ResumeL(); |
|
184 |
|
185 public: // from MDiagEngineCommon |
|
186 /** |
|
187 * Returns current execution plan. |
|
188 * |
|
189 * @see MDiagEngineCommon::ExecutionPlanL |
|
190 */ |
|
191 virtual const MDiagPluginExecPlan& ExecutionPlanL() const; |
|
192 |
|
193 /** |
|
194 * Stop current execution of tests. |
|
195 * |
|
196 * @see MDiagEngineCommon::ExecutionStopL |
|
197 */ |
|
198 virtual void ExecutionStopL( TCancelMode aCancelMode ); |
|
199 |
|
200 /** |
|
201 * Resets test execution watchdog timer. |
|
202 * |
|
203 * @see MDiagEngineCommon::ResetWatchdog |
|
204 */ |
|
205 virtual void ResetWatchdog(); |
|
206 |
|
207 /** |
|
208 * Resets test execution watchdog timer. |
|
209 * @see MDiagEngineCommon::ResetWatchdog |
|
210 */ |
|
211 virtual void ResetWatchdog( TDiagEngineWatchdogTypes aWatchdogType ); |
|
212 |
|
213 /** |
|
214 * Resets test execution watchdog timer. |
|
215 * @see MDiagEngineCommon::ResetWatchdog |
|
216 */ |
|
217 virtual void ResetWatchdog( TTimeIntervalMicroSeconds32 aExpectedTimeToComplete ); |
|
218 |
|
219 /** |
|
220 * Get App Ui reference that launched Diagnostics Engine. |
|
221 * |
|
222 * @see MDiagEngineCommon::ViewAppUi() |
|
223 */ |
|
224 virtual CAknViewAppUi& ViewAppUi(); |
|
225 |
|
226 /** |
|
227 * Get App Ui reference that launched Diagnostics Engine. |
|
228 * |
|
229 * @see MDiagEngineCommon::ViewAppUi() |
|
230 */ |
|
231 virtual const CAknViewAppUi& ViewAppUi() const; |
|
232 |
|
233 /** |
|
234 * Get Database Subsession for record open for writing. |
|
235 * |
|
236 * @see MDiagEngineCommon::DbRecord |
|
237 */ |
|
238 virtual RDiagResultsDatabaseRecord& DbRecord(); |
|
239 |
|
240 /** |
|
241 * Get Database Subsession for record open for writing. |
|
242 * |
|
243 * @see MDiagEngineCommon::DbRecord |
|
244 */ |
|
245 virtual const RDiagResultsDatabaseRecord& DbRecord() const; |
|
246 |
|
247 /** |
|
248 * Get reference to Plugin Pool |
|
249 * |
|
250 * @see MDiagEngineCommon::PluginPool |
|
251 */ |
|
252 virtual CDiagPluginPool& PluginPool(); |
|
253 |
|
254 /** |
|
255 * Get reference to Plugin Pool |
|
256 * |
|
257 * @see MDiagEngineCommon::PluginPool |
|
258 */ |
|
259 virtual const CDiagPluginPool& PluginPool() const; |
|
260 |
|
261 /** |
|
262 * Add a text to configuraiton list option. |
|
263 * |
|
264 * @see MDiagEngineCommon::AddToConfigListL |
|
265 */ |
|
266 virtual void AddToConfigListL( TConfigListType aListType, const TDesC& aText ); |
|
267 |
|
268 /** |
|
269 * Remove a text from configuration list. |
|
270 * |
|
271 * @see MDiagEngineCommon::RemoveFromConfigListL |
|
272 */ |
|
273 virtual void RemoveFromConfigListL( TConfigListType aListType, const TDesC& aText ); |
|
274 |
|
275 /** |
|
276 * Create a common dialog. |
|
277 * @see MDiagEngineCommon::CreateCommonDialogL |
|
278 */ |
|
279 virtual CAknDialog* CreateCommonDialogLC( TDiagCommonDialog aDialogType, |
|
280 TAny* aInitData ); |
|
281 |
|
282 /** |
|
283 * Stop watchdog activity temporarily. |
|
284 * @see MDiagEngineCommon::StopWatchdogTemporarily |
|
285 */ |
|
286 virtual void StopWatchdogTemporarily(); |
|
287 |
|
288 /** |
|
289 * Check if current engine is being executed with dependency disabled. |
|
290 * @see MDiagEngineCommon::IsDependencyDisabled |
|
291 */ |
|
292 virtual TBool IsDependencyDisabled() const; |
|
293 |
|
294 /** |
|
295 * Get custom execution parameter. |
|
296 * @see MDiagEngineCommon::CustomParam |
|
297 */ |
|
298 virtual TAny* CustomParam() const; |
|
299 |
|
300 /** |
|
301 * Send a command to application. |
|
302 * @see MDiagEngineCommon::ExecuteAppCommandL |
|
303 */ |
|
304 virtual void ExecuteAppCommandL( TDiagAppCommand aCommand, |
|
305 TAny* aParam1, |
|
306 TAny* aParam2 ); |
|
307 |
|
308 private: // from MDiagExecPlanEntryImplObserver |
|
309 /** |
|
310 * Observe plugin execution progress |
|
311 * @see MDiagExecPlanEntryImplObserver::ExecPlanEntryProgressL |
|
312 */ |
|
313 virtual void ExecPlanEntryProgressL( CDiagExecPlanEntryImpl& aSender, |
|
314 TUint aCurrentStep, |
|
315 TUint aTotalSteps ); |
|
316 /** |
|
317 * Observe plugin execution completion |
|
318 * @see MDiagExecPlanEntryImplObserver::ExecPlanEntryExecutedL |
|
319 */ |
|
320 virtual void ExecPlanEntryExecutedL( CDiagExecPlanEntryImpl& aSender ); |
|
321 |
|
322 /** |
|
323 * Observer critical error from plug-in execution entry. |
|
324 * @see MDiagExecPlanEntryImplObserver::ExecPlanEntryCriticalError |
|
325 */ |
|
326 virtual void ExecPlanEntryCriticalError( TInt aError ); |
|
327 |
|
328 private: // from DiagFwInternal::MStateMachineObserver |
|
329 /** |
|
330 * Handle state transition |
|
331 * |
|
332 * @see MDiagEngineStateMachineObserver::HandleStateChangedL |
|
333 */ |
|
334 virtual void HandleStateChangedL( DiagFwInternal::TState aPreviousState, |
|
335 DiagFwInternal::TState aCurrentState, |
|
336 const DiagFwInternal::CEventBasic& aEventPreview ); |
|
337 |
|
338 /** |
|
339 * Handle event. |
|
340 * |
|
341 * @see MDiagEngineStateMachineObserver::HandleEventL |
|
342 */ |
|
343 virtual void HandleEventL( DiagFwInternal::CEventBasic& aEvent ); |
|
344 |
|
345 /** |
|
346 * Handle error. |
|
347 * |
|
348 * @see MDiagEngineStateMachineObserver::HandleError |
|
349 */ |
|
350 virtual DiagFwInternal::TState HandleError( DiagFwInternal::TState aCurrentState, |
|
351 TInt aError ); |
|
352 |
|
353 private: // From MDiagEngineCallHandlerObserver |
|
354 /** |
|
355 * Handle call handling state change. |
|
356 * |
|
357 * @see MDiagEngineCallHandlerObserver::CallHandlerStateChangedL |
|
358 */ |
|
359 virtual void CallHandlerStateChangedL( TDiagEngineCallHandlerState aState ); |
|
360 |
|
361 private: // from CActive |
|
362 /** |
|
363 * RunL from CActive |
|
364 * |
|
365 * @see CActive::RunL |
|
366 */ |
|
367 virtual void RunL(); |
|
368 |
|
369 /** |
|
370 * DoCancel from CActive |
|
371 * |
|
372 * @see CActive::DoCancel |
|
373 */ |
|
374 virtual void DoCancel(); |
|
375 |
|
376 /** |
|
377 * Handle error |
|
378 * |
|
379 * @see CActive::RunError |
|
380 */ |
|
381 virtual TInt RunError( TInt aError ); |
|
382 |
|
383 private: // Private Constructors |
|
384 /** |
|
385 * C++ Constrctor |
|
386 * |
|
387 * @param aViewAppUi - Reference to Appui. |
|
388 * @param aObserver - Reference to engine observer. (Generall app) |
|
389 * @param aDbSession - Session to the database. |
|
390 * @param aPluginPool - Reference to plug-in pool. |
|
391 * @param aDisableDependency - Whether to disable dependency check. |
|
392 * @param aIncompleteRecordUid - Uid to the record to resume. |
|
393 * If this UID is aIncompleteRecordUid == TUid::Null(), it will create |
|
394 * a new record. |
|
395 */ |
|
396 CDiagEngineImpl( CAknViewAppUi& aViewAppUi, |
|
397 MDiagEngineObserver& aObserver, |
|
398 RDiagResultsDatabase& aDbSession, |
|
399 CDiagPluginPool& aPluginPool ); |
|
400 |
|
401 /** |
|
402 * Second phase constructor for creating a new record. |
|
403 * |
|
404 * @param aDisableDependency - Whether to disable dependency check |
|
405 * @param aExecutionBatch - Array of plug-in uids to execute |
|
406 */ |
|
407 void ConstructNewRecordL( TBool aDisableDependency, |
|
408 const RArray< TUid >& aExecutionBatch ); |
|
409 |
|
410 /** |
|
411 * Second phase constructor for resuming incomplete record. |
|
412 * |
|
413 * @param aIncompleteRecordUid - Uid of DB record to resume from. |
|
414 */ |
|
415 void ConstructIncompleteRecordL( TUid aIncompleteRecordUid ); |
|
416 |
|
417 /** |
|
418 * Second phase constructor common. |
|
419 * Initializes items that are common to both new session and resuming session. |
|
420 */ |
|
421 void ConstructCommonL(); |
|
422 |
|
423 private: // Event handlers |
|
424 /** |
|
425 * State handler function for EStateCreatingPlan |
|
426 * |
|
427 * @param aEvent - Event to handle. |
|
428 */ |
|
429 void HandleEventInCreatingPlanStateL( DiagFwInternal::CEventBasic& aEvent ); |
|
430 |
|
431 /** |
|
432 * State handler function for EStateRunning |
|
433 * |
|
434 * @param aEvent - Event to handle. |
|
435 */ |
|
436 void HandleEventInRunningStateL( DiagFwInternal::CEventBasic& aEvent ); |
|
437 |
|
438 /** |
|
439 * State handler function for EStateCancelAll |
|
440 * |
|
441 * @param aEvent - Event to handle. |
|
442 */ |
|
443 void HandleEventInCancelAllStateL( DiagFwInternal::CEventBasic& aEvent ); |
|
444 |
|
445 /** |
|
446 * State handler function for EStateSuspended |
|
447 * |
|
448 * @param aEvent - Event to handle. |
|
449 */ |
|
450 void HandleEventInSuspendedStateL( DiagFwInternal::CEventBasic& aEvent ); |
|
451 |
|
452 /** |
|
453 * State handler function for EStateFinalizing |
|
454 * |
|
455 * @param aEvent - Event to handle. |
|
456 */ |
|
457 void HandleEventInFinalizingStateL( DiagFwInternal::CEventBasic& aEvent ); |
|
458 |
|
459 /** |
|
460 * State handler function for EStateStopped |
|
461 * |
|
462 * @param aEvent - Event to handle. |
|
463 */ |
|
464 void HandleEventInStoppedStateL( DiagFwInternal::CEventBasic& aEvent ); |
|
465 |
|
466 private: // Other private functions |
|
467 /** |
|
468 * Start creating execution plan |
|
469 */ |
|
470 void StartCreateExecutionPlanL(); |
|
471 |
|
472 /** |
|
473 * Handle Plan created event |
|
474 */ |
|
475 void HandlePlanCreatedL(); |
|
476 |
|
477 /** |
|
478 * Notify test progress event to engine observer |
|
479 * |
|
480 * @param aEvent - test progress event. |
|
481 */ |
|
482 void NotifyTestProgressL( DiagFwInternal::CEventTestProgress& aEvent ); |
|
483 |
|
484 /** |
|
485 * Report plug-in execution result to observer and continue to the next test. |
|
486 * |
|
487 * @param aError - Error code to report to observer. |
|
488 * @param aResult - result to report to observer. |
|
489 */ |
|
490 void NotifyResultAndContinueL( TInt aError, CDiagResultsDatabaseItem* aResult ); |
|
491 |
|
492 /** |
|
493 * Commit db record to DB. |
|
494 * |
|
495 */ |
|
496 void CommitResultsToDb(); |
|
497 |
|
498 /** |
|
499 * Notify observer that last plugin is completed and engine is now stopped. |
|
500 * This could also mean that execution has failed. |
|
501 * |
|
502 * @param aEvent - last completion event |
|
503 */ |
|
504 void NotifyLastPluginCompletedL( DiagFwInternal::CEventSendCompletion& aEvent ); |
|
505 |
|
506 /** |
|
507 * Execute next plugin in the plan |
|
508 * |
|
509 */ |
|
510 void ExecuteNextPluginL(); |
|
511 |
|
512 /** |
|
513 * Suspend engine |
|
514 * |
|
515 * @param aReason - Reason for suspending. |
|
516 */ |
|
517 void DoSuspendL( MDiagEngineObserver::TSuspendReason aReason ); |
|
518 |
|
519 /** |
|
520 * Add event to state machine. |
|
521 * This functions makes sure that correct resume event is added to |
|
522 * the state machine depending on the previous state. |
|
523 * @param aReason - Resume reason. |
|
524 */ |
|
525 void AddResumeEventL( MDiagEngineObserver::TResumeReason aReason ); |
|
526 |
|
527 /** |
|
528 * Resume engine |
|
529 * |
|
530 */ |
|
531 void DoResumeL(); |
|
532 |
|
533 /** |
|
534 * Handle Skip |
|
535 * |
|
536 */ |
|
537 void HandleSkipL(); |
|
538 |
|
539 /** |
|
540 * Handle cancelling of all plug-ins |
|
541 * |
|
542 */ |
|
543 void HandleCancelAllL(); |
|
544 |
|
545 /** |
|
546 * Start delay timer for test plugin |
|
547 * |
|
548 * @param aPlanEntry - test plugin entry in plan to execute. |
|
549 */ |
|
550 void StartTimerForDelayingTestL( CDiagExecPlanEntryImpl& aPlanEntry ); |
|
551 |
|
552 /** |
|
553 * Start Executing a test plug-in |
|
554 * |
|
555 * @param aPlanEntry - test plugin entry in plan to execute. |
|
556 */ |
|
557 void DoExecuteTestPluginL( CDiagExecPlanEntryImpl& aPlanEntry ); |
|
558 |
|
559 /** |
|
560 * Start Executing a suite plug-in |
|
561 * |
|
562 * @param aPlanEntry - suite plugin entry in plan to execute. |
|
563 */ |
|
564 void DoExecuteSuitePluginL( CDiagExecPlanEntryImpl& aPlanEntry ); |
|
565 |
|
566 /** |
|
567 * Callback function for plugin delay timer expiration. |
|
568 * |
|
569 * @param aPtr - pointer to "this" |
|
570 */ |
|
571 static TInt PluginDelayTimerExpiredL( TAny* aPtr ); |
|
572 |
|
573 /** |
|
574 * Callback function for watchdog timer expiration. |
|
575 * |
|
576 * @param aPtr - pointer to "this" |
|
577 */ |
|
578 static TInt WatchdogTimerExpiredL( TAny* aPtr ); |
|
579 |
|
580 /** |
|
581 * Handle watchdog time expiration. |
|
582 * |
|
583 * @param aEvent - Watchdog event. |
|
584 */ |
|
585 void HandleWatchdogTimeoutL( DiagFwInternal::CEventWatchdog& aEvent ); |
|
586 |
|
587 /** |
|
588 * Function to stop currently executing plugin |
|
589 * |
|
590 * @param aStopMode - Reason for stopping the execution. |
|
591 * @param aIsWatchdog - ETrue if this is because of watchdog timeout. |
|
592 * @return Test Result. NULL if plug-in was a suite. Ownership transferred |
|
593 * to caller. |
|
594 */ |
|
595 CDiagResultsDatabaseItem* StopCurrentPluginL( TCancelMode aStopMode, |
|
596 TBool aIsWatchdog ); |
|
597 |
|
598 /** |
|
599 * Function to stop currently executing test plugin |
|
600 * |
|
601 * @param aStopMode - Reason for stopping the execution. |
|
602 * @param aIsWatchdog - ETrue if this is because of watchdog timeout. |
|
603 * @return Test Result. NULL if plug-in was a suite. Ownership transferred |
|
604 * to caller. |
|
605 */ |
|
606 CDiagResultsDatabaseItem* StopCurrentTestPluginL( TCancelMode aStopMode, |
|
607 TBool aIsWatchdog ); |
|
608 |
|
609 /** |
|
610 * Function to stop currently executing suite plugin |
|
611 * |
|
612 * @param aStopMode - Reason for stopping the execution. |
|
613 * @param aIsWatchdog - ETrue if this is because of watchdog timeout. |
|
614 */ |
|
615 void StopCurrentSuitePluginL( TCancelMode aStopMode, TBool aIsWatchdog ); |
|
616 |
|
617 /** |
|
618 * Function to create test stop reason based on input parameter |
|
619 * |
|
620 * @param aStopMode - Reason for stopping the execution. |
|
621 * @param aIsWatchdog - ETrue if this is because of watchdog timeout. |
|
622 * @return Test stop reason |
|
623 */ |
|
624 MDiagTestPlugin::TStopReason TranslateTestStopReason( TCancelMode aStopMode, |
|
625 TBool aIsWatchdog ); |
|
626 |
|
627 /** |
|
628 * Function to create suite stop reason based on input parameter |
|
629 * |
|
630 * @param aStopMode - Reason for stopping the execution. |
|
631 * @param aIsWatchdog - ETrue if this is because of watchdog timeout. |
|
632 * @return Suite stop reason |
|
633 */ |
|
634 MDiagSuitePlugin::TStopReason TranslateSuiteStopReason( TCancelMode aStopMode, |
|
635 TBool aIsWatchdog ); |
|
636 |
|
637 /** |
|
638 * Function to create database result type based on input parameter |
|
639 * |
|
640 * @param aStopMode - Reason for stopping the execution. |
|
641 * @param aIsWatchdog - ETrue if this is because of watchdog timeout. |
|
642 * @return Database result type. |
|
643 */ |
|
644 CDiagResultsDatabaseItem::TResult ConvertToDbResult( TCancelMode aStopMode, |
|
645 TBool aIsWatchdog ); |
|
646 |
|
647 /** |
|
648 * Create database result item with just result. |
|
649 * |
|
650 * @param aCurrentItem - Currently executing item |
|
651 * @param aResult - Result type |
|
652 * @return Database result item. Ownership transferred to caller. |
|
653 */ |
|
654 CDiagResultsDatabaseItem* CreateDbItemL( |
|
655 CDiagExecPlanEntryImpl& aCurrentItem, |
|
656 CDiagResultsDatabaseItem::TResult aResultType ) const; |
|
657 |
|
658 /** |
|
659 * Call TestSessionEndL on all plug-ins. |
|
660 * |
|
661 */ |
|
662 void NotifyPluginsOfTestSessionEnd(); |
|
663 |
|
664 /** |
|
665 * Stops all active requests |
|
666 */ |
|
667 void StopAllRequests(); |
|
668 |
|
669 /** |
|
670 * Cleans up incomplete test session during engine destruction. |
|
671 * This function should be called only from destructor. |
|
672 */ |
|
673 void CleanupIncompleteTestSession(); |
|
674 |
|
675 /** |
|
676 * Finalizes test session. This will notify plug-ins, finalize DB record and |
|
677 * notify application. |
|
678 */ |
|
679 void FinalizeTestSessionL(); |
|
680 |
|
681 private: // private data |
|
682 /** |
|
683 * iViewAppUi - Reference to View App Ui. Passed to plug-ins to allow |
|
684 * view switching. |
|
685 */ |
|
686 CAknViewAppUi& iViewAppUi; |
|
687 |
|
688 /** |
|
689 * iObserver - reference to engine observer. |
|
690 */ |
|
691 MDiagEngineObserver& iObserver; |
|
692 |
|
693 /** |
|
694 * iDbSession - Database session. |
|
695 */ |
|
696 RDiagResultsDatabase& iDbSession; |
|
697 |
|
698 /** |
|
699 * iDbRecord - New record created for current test session. |
|
700 */ |
|
701 RDiagResultsDatabaseRecord iDbRecord; |
|
702 |
|
703 /** |
|
704 * iRecordId - New record id created for current test session. |
|
705 */ |
|
706 TUid iRecordId; |
|
707 |
|
708 /** |
|
709 * iPluginPool - Reference to the plug-in pool. |
|
710 */ |
|
711 CDiagPluginPool& iPluginPool; |
|
712 |
|
713 /** |
|
714 * iCustomParam - Custom parameter. |
|
715 * Ownership - Client. |
|
716 */ |
|
717 TAny* iCustomParam; |
|
718 |
|
719 /** |
|
720 * iBatch - list of items to execute. |
|
721 * Ownership - Individual elements are owned by plug-in pool. |
|
722 */ |
|
723 RPointerArray< MDiagPlugin > iBatch; |
|
724 |
|
725 /** |
|
726 * iWatchdogTimer - Timer for watchdog. |
|
727 * Ownership - this |
|
728 */ |
|
729 CPeriodic* iWatchdogTimer; |
|
730 |
|
731 /** |
|
732 * iLastWatchdogValue - Last watchdog value set. |
|
733 * This will be used when ResetWatchdog() is called without |
|
734 * any value specified. |
|
735 */ |
|
736 TInt iLastWatchdogValue; |
|
737 |
|
738 /** |
|
739 * iPlan - Execution plan |
|
740 * Ownership - this |
|
741 */ |
|
742 CDiagPluginExecPlanImpl* iPlan; |
|
743 |
|
744 /** |
|
745 * iStateMachine - State machine. |
|
746 * Ownership - this |
|
747 */ |
|
748 DiagFwInternal::CStateMachine* iStateMachine; |
|
749 |
|
750 /** |
|
751 * iSuspendedPrevState - previous state just before suspended. |
|
752 * This is used to resume to correct state. |
|
753 */ |
|
754 DiagFwInternal::TState iSuspendedPrevState; |
|
755 |
|
756 /** |
|
757 * iSuspendReason - Reason why engine was suspended. |
|
758 */ |
|
759 MDiagEngineObserver::TSuspendReason iSuspendReason; |
|
760 |
|
761 /** |
|
762 * iResumeReason - Reason why engine is resumed. |
|
763 */ |
|
764 MDiagEngineObserver::TResumeReason iResumeReason; |
|
765 |
|
766 /** |
|
767 * iSuspendedResult - Temporary result from test plug-in when engine is |
|
768 * suspended. When test is suspended just before being able to save the |
|
769 * test result, its result is saved here, so that when resumed |
|
770 * it will use this result instead of re-executing. |
|
771 * Ownership - this |
|
772 */ |
|
773 CDiagResultsDatabaseItem* iSuspendedResult; |
|
774 |
|
775 /** |
|
776 * iCallHandler - Handles call states |
|
777 * Ownership - this |
|
778 */ |
|
779 CDiagEngineCallHandler* iCallHandler; |
|
780 |
|
781 /** |
|
782 * iContinueIncompleteRecord - Indicates whether engine is supposed to |
|
783 * continue from an incomplete record. |
|
784 * ETrue if engine is working with incomplete record. |
|
785 * EFalse if engine is working with a new record. |
|
786 */ |
|
787 TBool iContinueIncompleteRecord; |
|
788 |
|
789 /** |
|
790 * iEngineConfig - Confiugration information about engine. |
|
791 */ |
|
792 TDiagEngineConfig iEngineConfig; |
|
793 |
|
794 /** |
|
795 * iEngineError - Error code of engine. |
|
796 */ |
|
797 TInt iEngineError; |
|
798 }; |
|
799 |
|
800 #endif // DIAGENGINEIMPL_H |
|
801 |
|
802 // End of File |
|
803 |
|