|
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: Engine implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System Include Files |
|
20 #include <e32std.h> // User |
|
21 #include <f32file.h> // RFs |
|
22 #include <DiagEngine.h> // CDiagEngine |
|
23 #include <DiagPlugin.h> // MDiagPlugin |
|
24 #include <DiagSuitePlugin.h> // MDiagSuitePlugin |
|
25 #include <DiagResultsDatabaseItem.h> // CDiagResultsDatabaseItem |
|
26 #include <DiagPluginPool.h> // CDiagPluginPool |
|
27 #include <DiagResultsDatabaseTestRecordInfo.h> |
|
28 // TDiagResultsDatabaseTestRecordInfo |
|
29 #include <drmserviceapi.h> // CDrmServiceApi |
|
30 #include <e32property.h> // RProperty |
|
31 #include <PSVariables.h> // Property values |
|
32 #include <startupdomainpskeys.h> // Property values |
|
33 #include <centralrepository.h> // CRepository |
|
34 #include <ProfileEngineSDKCRKeys.h> // CR Keys for Profile |
|
35 #include <DiagFrameworkDebug.h> // Debug Logger |
|
36 #include <DiagResultsDbRecordEngineParam.h> |
|
37 |
|
38 // User Include Files |
|
39 #include "devdiagapp.hrh" // UID definition |
|
40 #include "devdiagengine.h" // CDevDiagEngine |
|
41 #include "devdiagengineobserver.h" // CDevDiagEngineObserver |
|
42 #include "devdiagexecutionresults.h" // CDevDiagExecResults |
|
43 #include "devdiag.pan" // Panic |
|
44 #include "devdiagcommoncanceldialogs.h" // CDevDiagCancelExecutionDialog |
|
45 #include "devdiagcommonskipdialogs.h" |
|
46 // Local Constants |
|
47 const TInt KErrDevDiagAlreadyInitialized = ( -1 ); |
|
48 const TInt KErrDevDiagAlreadyLoaded = ( -2 ); |
|
49 const TInt KErrDevDiagUninitialized = ( -3 ); |
|
50 |
|
51 ///@@@KSR: changes for BAD Warnings - #177-D: variable "KErrDevDiagExecuting" was declared but never referenced |
|
52 //const TInt KErrDevDiagExecuting = ( -4 ); |
|
53 |
|
54 const TInt KErrDevDiagAlreadyRunning = ( -5 ); |
|
55 const TInt KErrDevDiagNotRunning = ( -6 ); |
|
56 const TInt KErrDevDiagSuspendResume = ( -7 ); |
|
57 const TUid KUidDevDiagApplication = { _UID3 }; |
|
58 ///@@@KSR: changes for BAD Warnings - #177-D: variable "KProgressGranularity" was declared but never referenced |
|
59 //const TInt KProgressGranularity = ( 2 ); |
|
60 |
|
61 // Local Data Types |
|
62 typedef CArrayFixFlat< TDiagResultsDatabaseTestRecordInfo > CDatabaseRecordInfoArray; |
|
63 |
|
64 const TInt KArrayGranuality(50); |
|
65 |
|
66 |
|
67 // ============================ MEMBER FUNCTIONS ============================= |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // Static two-phase constructor. |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 CDevDiagEngine* CDevDiagEngine::NewL() |
|
74 { |
|
75 LOGSTRING( "CDevDiagEngine::NewL()" ) |
|
76 |
|
77 CDevDiagEngine* self = CDevDiagEngine::NewLC(); |
|
78 CleanupStack::Pop( self ); |
|
79 return self; |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // Static two-phase constructor. |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 CDevDiagEngine* CDevDiagEngine::NewLC() |
|
87 { |
|
88 LOGSTRING( "CDevDiagEngine::NewLC()" ) |
|
89 |
|
90 CDevDiagEngine* self = new ( ELeave ) CDevDiagEngine(); |
|
91 CleanupStack::PushL( self ); |
|
92 self->ConstructL(); |
|
93 return self; |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // Destructor. |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 CDevDiagEngine::~CDevDiagEngine() |
|
101 { |
|
102 LOGSTRING( "CDevDiagEngine::~CDevDiagEngine()" ) |
|
103 |
|
104 // Cancel any outstanding asynchronous requests. |
|
105 Cancel(); |
|
106 |
|
107 // Delete the member variables. |
|
108 delete iResults; |
|
109 delete iDiagEngine; |
|
110 delete iPluginPool; |
|
111 |
|
112 if ( iUids ) |
|
113 { |
|
114 delete iUids; |
|
115 iUids = NULL; |
|
116 } |
|
117 |
|
118 iLastResults.ResetAndDestroy(); |
|
119 iLastResults.Close(); |
|
120 |
|
121 // Close the session with the results database. |
|
122 iResultsDatabase.Close(); |
|
123 } |
|
124 |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // This function allows the UI to receive application engine callbacks by |
|
128 // implementing the MDevDiagEngineObserver interface. |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 void CDevDiagEngine::SetObserver( MDevDiagEngineObserver* aObserver ) |
|
132 { |
|
133 LOGSTRING2( "CDevDiagEngine::SetObserver( 0x%x )", aObserver ) |
|
134 |
|
135 if ( iObserver && aObserver ) |
|
136 { |
|
137 // We have cannot leave here. |
|
138 TRAP_IGNORE( iObserver->HandleEngineCommandL( |
|
139 MDevDiagEngineObserver::EDevDiagEngineCommandObserverChanged, |
|
140 KErrNone, |
|
141 NULL ) ) |
|
142 } |
|
143 |
|
144 iObserver = aObserver; |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // This function begins test execution. It is the responsibility of the |
|
149 // caller to check the runtime requirements prior to calling this function. |
|
150 // This is an asynchronous request. |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 void CDevDiagEngine::ExecuteTestL( TUid aUid, CAknViewAppUi& aAppUi ) |
|
154 { |
|
155 LOGSTRING2( "CDevDiagEngine::ExecuteTestL( 0x%x )", aUid.iUid ) |
|
156 |
|
157 // Reset the member variables to prepare for a new execution run. |
|
158 delete iDiagEngine; |
|
159 iDiagEngine = NULL; |
|
160 delete iResults; |
|
161 iResults = NULL; |
|
162 iSuspendCounter = 0; |
|
163 |
|
164 RArray< TUid > uidArray; |
|
165 uidArray.Append( aUid ); |
|
166 CleanupClosePushL( uidArray ); |
|
167 |
|
168 // Create an engine instance and execute the test or suite. |
|
169 iDiagEngine = CDiagEngine::NewL( aAppUi, |
|
170 *this, |
|
171 iResultsDatabase, |
|
172 *iPluginPool, |
|
173 EFalse, |
|
174 uidArray ); |
|
175 CleanupStack::PopAndDestroy(); // uidArray |
|
176 iDiagEngine->ExecuteL(); |
|
177 |
|
178 // Do the state transition now that we are successfully starting. |
|
179 SetState( EStateStartingExecution ); |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // This function will provides the execution results, which may be from an |
|
184 // execution run which is ongoing, or from logged test results. |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 const CDevDiagExecResults& CDevDiagEngine::ExecutionResults() const |
|
188 { |
|
189 LOGSTRING( "CDevDiagEngine::ExecutionResults()" ) |
|
190 |
|
191 __ASSERT_ALWAYS( HasExecutionResults(), |
|
192 Panic( EDevDiagApplicationNotInitialized ) ); |
|
193 return *iResults; |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // This function will handle getting the results information for the most |
|
198 // recent test execution. |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 void CDevDiagEngine::LoadLastLoggedResultsL() |
|
202 { |
|
203 LOGSTRING( "CDevDiagEngine::LoadLastLoggedResultsL()" ) |
|
204 |
|
205 // Check the state. |
|
206 __ASSERT_ALWAYS( iState == EStateReady, |
|
207 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
208 |
|
209 // If there are any existing results, just use them. |
|
210 if ( iResults ) |
|
211 { |
|
212 return; |
|
213 } |
|
214 |
|
215 // Get info about the last test record. If there are no existing records, |
|
216 // just return -- the caller must check if there are results before they |
|
217 // do anything. |
|
218 TUid lastExecutionRecord; |
|
219 if ( iResultsDatabase.GetLastRecord( lastExecutionRecord ) != KErrNone ) |
|
220 { |
|
221 return; |
|
222 } |
|
223 |
|
224 // Now, load the logged results. |
|
225 iResults = CDevDiagExecResults::NewL( lastExecutionRecord, |
|
226 *iPluginPool, |
|
227 iResultsDatabase ); |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // This function will stop test execution. The argument specifies whether all |
|
232 // execution should be stopped, or just the currently running test. |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 void CDevDiagEngine::ExecutionStopL( TDevDiagAppEngineStopMode aReason ) |
|
236 { |
|
237 LOGSTRING2( "CDevDiagEngine::ExecutionStopL( %d )", aReason ) |
|
238 |
|
239 // Check the state. |
|
240 __ASSERT_ALWAYS( IsRunningPlugins(), |
|
241 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
242 |
|
243 // Stop the execution. |
|
244 switch ( aReason ) |
|
245 { |
|
246 case EStopModeSkip: |
|
247 iDiagEngine->ExecutionStopL( MDiagEngineCommon::ESkip ); |
|
248 break; |
|
249 |
|
250 case EStopModeCancel: |
|
251 SetState( EStateStoppingExecution ); |
|
252 |
|
253 |
|
254 // Start an idle active object, which will handle deleting the |
|
255 // diagnostics engine. This cannot be done here because the |
|
256 // engine may be executing a test which is displaying the "Cancel |
|
257 // Execution" dialog, which calls this function. The priority of |
|
258 // this CIdle MUST be higher than then diagnostics engine and ALL |
|
259 // of its active objects. |
|
260 delete iIdle; |
|
261 iIdle = NULL; |
|
262 iIdle = CIdle::NewL( CActive::EPriorityHigh ); |
|
263 iIdle->Start( TCallBack( HandleExecutionCancelledL, this ) ); |
|
264 |
|
265 // Inform the observer. In the case where the observer is |
|
266 // displaying a dialog, this will allow the observer to cancel it. |
|
267 if ( iObserver ) |
|
268 { |
|
269 iObserver->HandleEngineCommandL( |
|
270 MDevDiagEngineObserver::EDevDiagEngineCommandExecutionStopping, |
|
271 KErrCancel, |
|
272 NULL ); |
|
273 } |
|
274 |
|
275 break; |
|
276 |
|
277 case EStopModeSuspend: |
|
278 // Increment the suspend counter and check the state. |
|
279 LOGSTRING2( "CDevDiagEngine::ExecutionStopL, counter: %d", |
|
280 iSuspendCounter ) |
|
281 iSuspendCounter++; |
|
282 if ( iState == EStateExecutionSuspended ) |
|
283 { |
|
284 // Do nothing - we're already suspended. |
|
285 __ASSERT_DEBUG( iSuspendCounter > 1, |
|
286 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
287 break; |
|
288 } |
|
289 |
|
290 SetState( EStateExecutionSuspended ); |
|
291 iDiagEngine->SuspendL(); |
|
292 break; |
|
293 |
|
294 case EStopModeWatchdog: |
|
295 iDiagEngine->StopWatchdogTemporarily(); |
|
296 break; |
|
297 |
|
298 default: |
|
299 __ASSERT_DEBUG( EFalse, Panic( EDevDiagApplicationInvalidStopMode ) ); |
|
300 break; |
|
301 } |
|
302 } |
|
303 |
|
304 |
|
305 TInt CDevDiagEngine::HandleExecutionCancelledL( TAny* aPtr ) |
|
306 { |
|
307 LOGSTRING2( "CDevDiagEngine::HandleExecutionCancelledL( 0x%x )", aPtr ) |
|
308 |
|
309 CDevDiagEngine* myThis = static_cast< CDevDiagEngine* >( aPtr ); |
|
310 myThis->iResults->Finalize( EFalse ); |
|
311 |
|
312 delete myThis->iDiagEngine; |
|
313 myThis->iDiagEngine = NULL; |
|
314 |
|
315 delete myThis->iIdle; |
|
316 myThis->iIdle = NULL; |
|
317 |
|
318 myThis->SetState( EStateReady ); |
|
319 |
|
320 // Inform the observer object. |
|
321 if ( myThis->iObserver ) |
|
322 { |
|
323 |
|
324 myThis->iObserver->HandleEngineCommandL( |
|
325 MDevDiagEngineObserver::EDevDiagEngineCommandTestExecutionCancelled, |
|
326 KErrCancel, |
|
327 NULL ); |
|
328 |
|
329 } |
|
330 |
|
331 return KErrNone; |
|
332 |
|
333 } |
|
334 // --------------------------------------------------------------------------- |
|
335 // This function will resume suspended test execution. |
|
336 // --------------------------------------------------------------------------- |
|
337 // |
|
338 void CDevDiagEngine::ExecutionResumeL( TDevDiagAppEngineResumeMode aReason ) |
|
339 { |
|
340 LOGSTRING2( "CDevDiagEngine::ExecutionResumeL( %d )", aReason ) |
|
341 |
|
342 // Check the state. |
|
343 __ASSERT_ALWAYS( IsRunningPlugins(), |
|
344 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
345 |
|
346 // Resume the execution. |
|
347 switch ( aReason ) |
|
348 { |
|
349 case EResumeModeResume: |
|
350 { |
|
351 LOGSTRING2( "CDevDiagEngine::ExecutionResumeL, counter: %d", |
|
352 iSuspendCounter ) |
|
353 // Decrement the suspend counter and check the state. |
|
354 --iSuspendCounter; |
|
355 __ASSERT_DEBUG( iSuspendCounter >= 0, |
|
356 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
357 __ASSERT_ALWAYS( iState == EStateExecutionSuspended, |
|
358 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
359 |
|
360 // Resume the execution, but only if there have been enough |
|
361 // "resume" calls to match the number of "suspend" calls. |
|
362 if ( iSuspendCounter == 0 ) |
|
363 { |
|
364 SetState( EStateRunningTests ); |
|
365 iDiagEngine->ResumeL(); |
|
366 } |
|
367 |
|
368 break; |
|
369 } |
|
370 |
|
371 case EResumeModeWatchdog: |
|
372 // iDiagEngine->ResetWatchdogL(); |
|
373 break; |
|
374 |
|
375 default: |
|
376 __ASSERT_DEBUG( EFalse, |
|
377 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
378 break; |
|
379 } |
|
380 } |
|
381 |
|
382 // --------------------------------------------------------------------------- |
|
383 // Returns the plugin pool. |
|
384 // --------------------------------------------------------------------------- |
|
385 // |
|
386 const CDiagPluginPool& CDevDiagEngine::PluginPool() const |
|
387 { |
|
388 LOGSTRING( "CDevDiagEngine::PluginPool()" ) |
|
389 |
|
390 __ASSERT_ALWAYS( ArePluginsLoaded(), |
|
391 Panic( EDevDiagApplicationNotInitialized ) ); |
|
392 return *iPluginPool; |
|
393 } |
|
394 |
|
395 // --------------------------------------------------------------------------- |
|
396 // Returns whether or not tests are running. |
|
397 // --------------------------------------------------------------------------- |
|
398 // |
|
399 TBool CDevDiagEngine::IsRunningPlugins() const |
|
400 { |
|
401 LOGSTRING( "CDevDiagEngine::IsRunningPlugins()" ) |
|
402 |
|
403 return ( iState == EStateStartingExecution || |
|
404 iState == EStateRunningTests || |
|
405 iState == EStateStoppingExecution || |
|
406 iState == EStateExecutionSuspended ); |
|
407 } |
|
408 |
|
409 // --------------------------------------------------------------------------- |
|
410 // Checks if the engine is currently stopping execution. |
|
411 // --------------------------------------------------------------------------- |
|
412 // |
|
413 TBool CDevDiagEngine::IsStoppingExecution() const |
|
414 { |
|
415 LOGSTRING( "CDevDiagEngine::IsStoppingExecution()" ) |
|
416 |
|
417 return ( iState == EStateStoppingExecution ); |
|
418 } |
|
419 |
|
420 // --------------------------------------------------------------------------- |
|
421 // Returns whether or not plugins are done loading. |
|
422 // --------------------------------------------------------------------------- |
|
423 // |
|
424 TBool CDevDiagEngine::ArePluginsLoaded() const |
|
425 { |
|
426 LOGSTRING( "CDevDiagEngine::ArePluginsLoaded()" ) |
|
427 |
|
428 return ( iState != EStateInitial && |
|
429 iState != EStateLoadingPlugins ); |
|
430 } |
|
431 |
|
432 // --------------------------------------------------------------------------- |
|
433 // Returns whether execution results are available. |
|
434 // --------------------------------------------------------------------------- |
|
435 // |
|
436 TBool CDevDiagEngine::HasExecutionResults() const |
|
437 { |
|
438 LOGSTRING( "CDevDiagEngine::HasExecutionResults()" ) |
|
439 |
|
440 if ( iResults ) |
|
441 { |
|
442 return ETrue; |
|
443 } |
|
444 |
|
445 return EFalse; |
|
446 } |
|
447 |
|
448 // --------------------------------------------------------------------------- |
|
449 // The default constructor. |
|
450 // --------------------------------------------------------------------------- |
|
451 // |
|
452 CDevDiagEngine::CDevDiagEngine() : CActive( EPriorityStandard ), |
|
453 iDiagEngine( NULL ) |
|
454 { |
|
455 LOGSTRING( "CDevDiagEngine::CDevDiagEngine()" ) |
|
456 |
|
457 } |
|
458 |
|
459 // --------------------------------------------------------------------------- |
|
460 // The second phase constructor. |
|
461 // --------------------------------------------------------------------------- |
|
462 // |
|
463 void CDevDiagEngine::ConstructL() |
|
464 { |
|
465 LOGSTRING( "CDevDiagEngine::ConstructL()" ) |
|
466 |
|
467 // Connect to the results database. |
|
468 User::LeaveIfError( iResultsDatabase.Connect( KUidDevDiagApplication ) ); |
|
469 LOGSTRING( "CDevDiagEngine::ResultDB connect"); |
|
470 // Load the plugins. |
|
471 iPluginPool = CDiagPluginPool::NewL( *this ); |
|
472 LOGSTRING( "CDevDiagEngine::NewL"); |
|
473 SetState( EStateLoadingPlugins ); |
|
474 iPluginPool->LoadAsyncL( KDiagPluginInterfaceUid ); |
|
475 LOGSTRING( "CDevDiagEngine::LoadPlugin"); |
|
476 // Add the application engine to the active scheduler. |
|
477 CActiveScheduler::Add( this ); |
|
478 } |
|
479 |
|
480 |
|
481 // --------------------------------------------------------------------------- |
|
482 // To obtain the current engine state |
|
483 // --------------------------------------------------------------------------- |
|
484 TInt CDevDiagEngine::GetState() |
|
485 { |
|
486 return iState; |
|
487 } |
|
488 |
|
489 |
|
490 // --------------------------------------------------------------------------- |
|
491 // The state machine transition handler. If there is an error in changing |
|
492 // states, then it will be returned and the state will be left unchanged. |
|
493 // --------------------------------------------------------------------------- |
|
494 // |
|
495 void CDevDiagEngine::SetState( TDevDiagAppEngineState aNextState ) |
|
496 { |
|
497 LOGSTRING3( "CDevDiagEngine::SetState( %d ), iState = %d", |
|
498 aNextState, |
|
499 iState ) |
|
500 |
|
501 // The state transition table. Structure: State in / State to go to. |
|
502 static const TInt KStateTable[ EStateMax ][ EStateMax ] = |
|
503 { |
|
504 // EStateInitial |
|
505 { |
|
506 KErrNone, // To EStateInitial |
|
507 KErrNone, // To EStateLoadingPlugins |
|
508 KErrDevDiagUninitialized, // To EStateReady |
|
509 KErrDevDiagUninitialized, // To EStateStartingExecution |
|
510 KErrDevDiagUninitialized, // To EStateRunningTests |
|
511 KErrDevDiagUninitialized, // To EStateStoppingExecution |
|
512 KErrDevDiagUninitialized // To EStateExecutionSuspended |
|
513 }, |
|
514 |
|
515 // EStateLoadingPlugins |
|
516 { |
|
517 KErrDevDiagAlreadyInitialized, // To EStateInitial |
|
518 KErrNone, // To EStateLoadingPlugins |
|
519 KErrNone, // To EStateReady |
|
520 KErrDevDiagUninitialized, // To EStateStartingExecution |
|
521 KErrDevDiagUninitialized, // To EStateRunningTests |
|
522 KErrDevDiagUninitialized, // To EStateStoppingExecution |
|
523 KErrDevDiagUninitialized // To EStateExecutionSuspended |
|
524 }, |
|
525 |
|
526 // EStateReady |
|
527 { |
|
528 KErrDevDiagAlreadyInitialized, // To EStateInitial |
|
529 KErrDevDiagAlreadyLoaded, // To EStateLoadingPlugins |
|
530 KErrNone, // To EStateReady |
|
531 KErrNone, // To EStateStartingExecution |
|
532 KErrDevDiagNotRunning, // To EStateRunningTests |
|
533 KErrDevDiagNotRunning, // To EStateStoppingExecution |
|
534 KErrDevDiagNotRunning // To EStateExecutionSuspended |
|
535 }, |
|
536 |
|
537 // EStateStartingExecution |
|
538 { |
|
539 KErrDevDiagAlreadyInitialized, // To EStateInitial |
|
540 KErrDevDiagAlreadyLoaded, // To EStateLoadingPlugins |
|
541 KErrNone, // To EStateReady |
|
542 KErrNone, // To EStateStartingExecution |
|
543 KErrNone, // To EStateRunningTests |
|
544 KErrNone, // To EStateStoppingExecution |
|
545 KErrDevDiagNotRunning // To EStateExecutionSuspended |
|
546 }, |
|
547 |
|
548 // EStateRunningTests |
|
549 { |
|
550 KErrDevDiagAlreadyInitialized, // To EStateInitial |
|
551 KErrDevDiagAlreadyLoaded, // To EStateLoadingPlugins |
|
552 KErrNone, // To EStateReady |
|
553 KErrDevDiagAlreadyRunning, // To EStateStartingExecution |
|
554 KErrNone, // To EStateRunningTests |
|
555 KErrNone, // To EStateStoppingExecution |
|
556 KErrNone // To EStateExecutionSuspended |
|
557 }, |
|
558 |
|
559 // EStateStoppingExecution |
|
560 { |
|
561 KErrDevDiagAlreadyInitialized, // To EStateInitial |
|
562 KErrDevDiagAlreadyLoaded, // To EStateLoadingPlugins |
|
563 KErrNone, // To EStateReady |
|
564 KErrDevDiagAlreadyRunning, // To EStateStartingExecution |
|
565 KErrDevDiagAlreadyRunning, // To EStateRunningTests |
|
566 KErrNone, // To EStateStoppingExecution |
|
567 KErrDevDiagNotRunning // To EStateExecutionSuspended |
|
568 }, |
|
569 |
|
570 // EStateExecutionSuspended |
|
571 { |
|
572 KErrDevDiagAlreadyInitialized, // To EStateInitial |
|
573 KErrDevDiagAlreadyLoaded, // To EStateLoadingPlugins |
|
574 KErrDevDiagSuspendResume, // To EStateReady |
|
575 KErrDevDiagAlreadyRunning, // To EStateStartingExecution |
|
576 KErrNone, // To EStateRunningTests |
|
577 KErrNone, // To EStateStoppingExecution |
|
578 KErrNone // To EStateExecutionSuspended |
|
579 } |
|
580 }; |
|
581 |
|
582 // Check if there is an invalid state. |
|
583 __ASSERT_DEBUG( ( iState < EStateMax && aNextState < EStateMax ), |
|
584 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
585 |
|
586 // Change the state if there was no error, and return. |
|
587 __ASSERT_ALWAYS( KStateTable[ iState ][ aNextState ] == KErrNone, |
|
588 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
589 iState = aNextState; |
|
590 |
|
591 } |
|
592 |
|
593 // --------------------------------------------------------------------------- |
|
594 // From class CActive. |
|
595 // The active object completion function. This is only used for checking the |
|
596 // runtime requirements. |
|
597 // --------------------------------------------------------------------------- |
|
598 // |
|
599 void CDevDiagEngine::RunL() |
|
600 { |
|
601 LOGSTRING( "CDevDiagEngine::RunL()" ) |
|
602 |
|
603 if ( iStatus.Int() == KErrNone ) |
|
604 { |
|
605 TInt error = iResultsDatabase.GetLastResults( iLastResults ); |
|
606 |
|
607 if ( error != KErrNone ) |
|
608 { |
|
609 LOGSTRING2( "CDevDiagEngine::RunL GetLastResults error: %d", error ); |
|
610 |
|
611 } |
|
612 |
|
613 if ( iObserver ) |
|
614 { |
|
615 iObserver->HandleEngineCommandL( |
|
616 MDevDiagEngineObserver::EDevDiagEngineCommandGetLastResults, |
|
617 error, |
|
618 &iLastResults ); |
|
619 } |
|
620 } |
|
621 else |
|
622 { |
|
623 LOGSTRING2( "CDevDiagEngine::RunL error: %d", iStatus.Int() ); |
|
624 } |
|
625 |
|
626 } |
|
627 |
|
628 // --------------------------------------------------------------------------- |
|
629 // From class CActive. |
|
630 // The active object cancellation function. |
|
631 // --------------------------------------------------------------------------- |
|
632 // |
|
633 void CDevDiagEngine::DoCancel() |
|
634 { |
|
635 LOGSTRING( "CDevDiagEngine::DoCancel()" ) |
|
636 |
|
637 // Stop plugin loading, if it is ongoing. |
|
638 if ( iState == EStateLoadingPlugins ) |
|
639 { |
|
640 // Cannot leave here. |
|
641 TRAP_IGNORE( iPluginPool->CancelLoadPluginsL() ) |
|
642 } |
|
643 } |
|
644 |
|
645 // --------------------------------------------------------------------------- |
|
646 // From class MDiagEngineObserver. |
|
647 // The callback to indicate that test execution is starting. |
|
648 // --------------------------------------------------------------------------- |
|
649 // |
|
650 void CDevDiagEngine::TestExecutionBeginL() |
|
651 { |
|
652 LOGSTRING( "CDevDiagEngine::TestExecutionBeginL()" ) |
|
653 |
|
654 SetState( EStateRunningTests ); |
|
655 |
|
656 // Get the record info, so we can get the record uid. |
|
657 TDiagResultsDatabaseTestRecordInfo recordInfo; |
|
658 User::LeaveIfError( iDiagEngine->DbRecord().GetRecordInfo( recordInfo ) ); |
|
659 |
|
660 // Get the engine parameters, so we can get the executed uid. |
|
661 CDiagResultsDbRecordEngineParam* execParam; |
|
662 User::LeaveIfError( iDiagEngine->DbRecord().GetEngineParam( execParam ) ); |
|
663 CleanupStack::PushL( execParam ); |
|
664 |
|
665 // Initialize the results data. |
|
666 delete iResults; |
|
667 iResults = NULL; |
|
668 iResults = CDevDiagExecResults::NewL( recordInfo.iRecordId, |
|
669 *iPluginPool, |
|
670 iResultsDatabase, |
|
671 execParam->ExecutionsUidArray()[ 0 ], |
|
672 iDiagEngine ); |
|
673 |
|
674 CleanupStack::PopAndDestroy( execParam ); |
|
675 |
|
676 // Inform the observer object. |
|
677 if ( iObserver ) |
|
678 { |
|
679 iObserver->HandleEngineCommandL( |
|
680 MDevDiagEngineObserver::EDevDiagEngineCommandTestExecutionBegin, |
|
681 KErrNone, |
|
682 NULL ); |
|
683 } |
|
684 } |
|
685 |
|
686 // --------------------------------------------------------------------------- |
|
687 // From class MDiagEngineObserver. |
|
688 // The callback to indicate test progress. |
|
689 // --------------------------------------------------------------------------- |
|
690 // |
|
691 void CDevDiagEngine::TestExecutionProgressL( TUint aCurrentItemStep, |
|
692 TUint aCurrentItemTotalSteps ) |
|
693 { |
|
694 LOGSTRING3( "CDevDiagEngine::TestExecutionProgressL( %d, %d )", |
|
695 aCurrentItemStep, |
|
696 aCurrentItemTotalSteps ) |
|
697 |
|
698 // Update the results data. |
|
699 __ASSERT_ALWAYS( iResults, Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
700 iResults->SetProgressL( aCurrentItemStep, aCurrentItemTotalSteps ); |
|
701 |
|
702 // Inform the observer object. |
|
703 if ( iObserver ) |
|
704 { |
|
705 iObserver->HandleEngineCommandL( |
|
706 MDevDiagEngineObserver::EDevDiagEngineCommandProgressDataUpdated, |
|
707 KErrNone, |
|
708 NULL ); |
|
709 } |
|
710 } |
|
711 |
|
712 |
|
713 // --------------------------------------------------------------------------- |
|
714 // From class MDiagEngineObserver. |
|
715 // The callback to indicate that a plugin has completed and provide the |
|
716 // result. Ownership of aResult is transferred. |
|
717 // --------------------------------------------------------------------------- |
|
718 // |
|
719 void CDevDiagEngine::TestExecutionPluginExecutedL( |
|
720 TInt aError, |
|
721 CDiagResultsDatabaseItem* aResult ) |
|
722 { |
|
723 LOGSTRING3( "CDevDiagEngine::TestExecutionPluginExecutedL( %d, 0x%x )", |
|
724 aError, |
|
725 aResult ) |
|
726 |
|
727 // Update the results data. |
|
728 __ASSERT_ALWAYS( iResults, Panic( EDevDiagApplicationNoExecutionResults ) ); |
|
729 iResults->AddEntryL( aResult, aError ); |
|
730 |
|
731 if ( aResult ) |
|
732 { |
|
733 TInt result = aResult->TestResult(); |
|
734 } |
|
735 |
|
736 |
|
737 const MDiagPlugin& plugin = iResults->CurrentItemL().Plugin(); |
|
738 |
|
739 if ( plugin.Type() == MDiagPlugin::ETypeTestPlugin ) |
|
740 { |
|
741 //Now we are executing a test (NULL indicates a test suite). |
|
742 if ( aResult ) |
|
743 { |
|
744 MDevDiagEngineObserver::TAppEngineCommand cmd = MDevDiagEngineObserver::EDevDiagEngineCommandSinglePluginExecutionDone; |
|
745 if ( iObserver ) |
|
746 iObserver->HandleEngineCommandL(cmd,aError,NULL ); |
|
747 } |
|
748 } |
|
749 |
|
750 /* |
|
751 MDevDiagEngineObserver::TAppEngineCommand cmd; |
|
752 |
|
753 const MDiagPlugin& plugin = iResults->CurrentItemL().Plugin(); |
|
754 |
|
755 if ( plugin.Type() == MDiagPlugin::ETypeTestPlugin ) |
|
756 { |
|
757 //Now we are executing a test (NULL indicates a test suite). |
|
758 if ( aResult ) |
|
759 { javascript:submitForm('CreateAccountServlet', target='/accounts/my/create_selectService.jsp', '') |
|
760 9 |
|
761 cmd = MDevDiagEngineObserver::EDevDiagEngineCommandSinglePluginExecutionDone; |
|
762 |
|
763 } |
|
764 else |
|
765 { |
|
766 //cmd = MDevDiagEngineObserver::EDevDiagEngineCommandGroupExecutionProgress; |
|
767 } |
|
768 |
|
769 if ( iObserver ) |
|
770 { |
|
771 iObserver->HandleEngineCommandL( |
|
772 cmd, |
|
773 aError, |
|
774 NULL ); |
|
775 } |
|
776 } |
|
777 */ |
|
778 } |
|
779 |
|
780 |
|
781 // --------------------------------------------------------------------------- |
|
782 // From class MDiagEngineObserver. |
|
783 // The callback to indicate that the diagnostics engine has finished executing |
|
784 // plugins. This can also indicate a failure to begin executing plugins. |
|
785 // --------------------------------------------------------------------------- |
|
786 // |
|
787 void CDevDiagEngine::TestExecutionCompletedL( TInt aError ) |
|
788 { |
|
789 LOGSTRING2( "CDevDiagEngine::TestExecutionCompletedL( %d )", aError ) |
|
790 |
|
791 SetState( EStateReady ); |
|
792 |
|
793 TBool singleExecution = iResults->SinglePluginExecutionL(); |
|
794 |
|
795 // Clean up the execution information. |
|
796 if ( iResults ) |
|
797 { |
|
798 // The results are fully complete only if execution cannot be resumed, |
|
799 // so these are the only error codes that indicate that. |
|
800 iResults->Finalize( aError == KErrNone || |
|
801 aError == KErrCancel || |
|
802 aError == KErrArgument ); |
|
803 } |
|
804 |
|
805 delete iDiagEngine; |
|
806 iDiagEngine = NULL; |
|
807 |
|
808 // Inform the observer object. |
|
809 if ( iObserver && !singleExecution ) |
|
810 { |
|
811 |
|
812 iObserver->HandleEngineCommandL( |
|
813 MDevDiagEngineObserver::EDevDiagEngineCommandGroupExecutionDone, |
|
814 aError, |
|
815 NULL ); |
|
816 } |
|
817 |
|
818 } |
|
819 |
|
820 // --------------------------------------------------------------------------- |
|
821 // From class MDiagEngineObserver. |
|
822 // The callback to indicate that test execution has been suspended. |
|
823 // --------------------------------------------------------------------------- |
|
824 // |
|
825 void CDevDiagEngine::TestExecutionSuspendedL( TSuspendReason aSuspendReason ) |
|
826 { |
|
827 LOGSTRING2( "CDevDiagEngine::TestExecutionSuspendedL( %d )", |
|
828 aSuspendReason ) |
|
829 |
|
830 // Don't do anything if this suspend came from the application, as this |
|
831 // would duplicate the counter increase. |
|
832 if ( aSuspendReason == ESuspendByClient ) |
|
833 { |
|
834 __ASSERT_DEBUG( |
|
835 ( iSuspendCounter > 0 && iState == EStateExecutionSuspended ), |
|
836 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
837 return; |
|
838 } |
|
839 |
|
840 LOGSTRING3( "CDevDiagEngine::TestExecutionSuspendedL: counter %d, state: %d", |
|
841 iSuspendCounter, |
|
842 iState ) |
|
843 // Increment the suspend counter and check the state. |
|
844 iSuspendCounter++; |
|
845 if ( iState == EStateExecutionSuspended ) |
|
846 { |
|
847 // If we are already suspended, then this suspend has no effect. |
|
848 return; |
|
849 } |
|
850 |
|
851 // Suspend ourself and inform the user. |
|
852 SetState( EStateExecutionSuspended ); |
|
853 if ( iObserver ) |
|
854 { |
|
855 iObserver->HandleEngineCommandL( |
|
856 MDevDiagEngineObserver::EDevDiagEngineCommandTestExecutionSuspended, |
|
857 KErrNone, |
|
858 NULL ); |
|
859 } |
|
860 } |
|
861 |
|
862 // --------------------------------------------------------------------------- |
|
863 // From class MDiagEngineObserver. |
|
864 // The callback to indicate that test execution has been resumed. |
|
865 // --------------------------------------------------------------------------- |
|
866 // |
|
867 void CDevDiagEngine::TestExecutionResumedL( TResumeReason aResumeReason ) |
|
868 { |
|
869 LOGSTRING2( "CDevDiagEngine::TestExecutionResumedL( %d )", aResumeReason ) |
|
870 |
|
871 // Don't do anything if this suspend came from the application, as this |
|
872 // would duplicate the counter decrease. |
|
873 if ( aResumeReason == EResumedByClient ) |
|
874 { |
|
875 return; |
|
876 } |
|
877 |
|
878 LOGSTRING3( "CDevDiagEngine::TestExecutionResumedL: counter %d, state: %d", |
|
879 iSuspendCounter, |
|
880 iState ) |
|
881 // Decrement the suspend counter and check the state. |
|
882 --iSuspendCounter; |
|
883 __ASSERT_DEBUG( iSuspendCounter >= 0, |
|
884 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
885 if ( iState != EStateExecutionSuspended ) |
|
886 { |
|
887 // The resume was already done, so just return. |
|
888 return; |
|
889 } |
|
890 |
|
891 // Resume ourself and inform the user. |
|
892 SetState( EStateRunningTests ); |
|
893 if ( iObserver ) |
|
894 { |
|
895 iObserver->HandleEngineCommandL( |
|
896 MDevDiagEngineObserver::EDevDiagEngineCommandTestExecutionResumed, |
|
897 KErrNone, |
|
898 NULL ); |
|
899 } |
|
900 } |
|
901 |
|
902 // --------------------------------------------------------------------------- |
|
903 // From class MDiagEngineObserver. |
|
904 // The callback to to create a custom common-use dialog. This may ONLY be |
|
905 // called by the Diagnostics Engine. Any application classes must use the |
|
906 // dialog classes directly. |
|
907 // --------------------------------------------------------------------------- |
|
908 // |
|
909 CAknDialog* CDevDiagEngine::CreateCommonDialogLC( TDiagCommonDialog aDialogType, |
|
910 TAny* aInitData ) |
|
911 { |
|
912 LOGSTRING3( "CDevDiagEngine::CreateCommonDialogLC( %d, 0x%x )", |
|
913 aDialogType, |
|
914 aInitData ) |
|
915 |
|
916 switch ( aDialogType ) |
|
917 { |
|
918 case EDiagCommonDialogConfirmCancelAll: |
|
919 { |
|
920 __ASSERT_ALWAYS( !aInitData, |
|
921 Panic( EDevDiagApplicationGeneral ) ); |
|
922 return CDevDiagCommonCancelDialogs::NewLC( *this, EFalse ); |
|
923 } |
|
924 |
|
925 case EDiagCommonDialogConfirmSkipAll: |
|
926 { |
|
927 __ASSERT_ALWAYS( !aInitData, |
|
928 Panic( EDevDiagApplicationGeneral ) ); |
|
929 return CDevDiagCommonSkipDialogs::NewLC( *this, EFalse ); |
|
930 } |
|
931 } |
|
932 |
|
933 __ASSERT_DEBUG( EFalse, Panic( EDevDiagApplicationBadType ) ); |
|
934 return NULL; |
|
935 } |
|
936 |
|
937 |
|
938 |
|
939 // --------------------------------------------------------------------------- |
|
940 // From class MDiagEngineObserver. |
|
941 // The callback to to execute an application command. This may ONLY be |
|
942 // called by the Diagnostics Engine. |
|
943 // --------------------------------------------------------------------------- |
|
944 // |
|
945 void CDevDiagEngine::ExecuteAppCommandL( TDiagAppCommand aCommand, |
|
946 TAny* aParam1, |
|
947 TAny* aParam2 ) |
|
948 { |
|
949 LOGSTRING4( "CDevDiagEngine::ExecuteAppCommandL( %d, 0x%x, 0x%x )", |
|
950 aCommand, |
|
951 aParam1, |
|
952 aParam2 ) |
|
953 |
|
954 switch ( aCommand ) |
|
955 { |
|
956 case EDiagAppCommandSwitchToMainView: |
|
957 { |
|
958 __ASSERT_ALWAYS( ( !aParam1 && !aParam2 ), |
|
959 Panic( EDevDiagApplicationGeneral ) ); |
|
960 if ( iObserver ) |
|
961 { |
|
962 iObserver->HandleEngineCommandL( |
|
963 MDevDiagEngineObserver::EDevDiagEngineCommandViewSwitch, |
|
964 KErrNone, |
|
965 NULL ); |
|
966 } |
|
967 break; |
|
968 } |
|
969 |
|
970 default: |
|
971 User::Leave( KErrNotSupported ); |
|
972 } |
|
973 } |
|
974 |
|
975 // --------------------------------------------------------------------------- |
|
976 // From class MDiagPluginPoolObserver. |
|
977 // The callback to indicate plugin loading progress. |
|
978 // --------------------------------------------------------------------------- |
|
979 // |
|
980 void CDevDiagEngine::LoadProgressL( TUint aCurrentStep, |
|
981 TUint aTotalSteps, |
|
982 const TUid& aLoadedPluginUid ) |
|
983 { |
|
984 |
|
985 LOGSTRING4( "CDevDiagEngine::LoadProgressL( %d, %d, 0x%x )", |
|
986 aCurrentStep, |
|
987 aTotalSteps, |
|
988 aLoadedPluginUid.iUid ) |
|
989 |
|
990 __ASSERT_ALWAYS( iState == EStateLoadingPlugins, |
|
991 Panic( EDevDiagApplicationInvalidEngineState ) ); |
|
992 |
|
993 // Inform the observer with the loading information. |
|
994 if ( iObserver ) |
|
995 { |
|
996 MDiagPlugin* plugin = NULL; |
|
997 iPluginPool->FindPlugin( aLoadedPluginUid, plugin ); |
|
998 |
|
999 iObserver->HandleEngineCommandL( |
|
1000 MDevDiagEngineObserver::EDevDiagEngineCommandPluginLoadProgress, |
|
1001 KErrNone, |
|
1002 plugin ); |
|
1003 } |
|
1004 } |
|
1005 |
|
1006 // --------------------------------------------------------------------------- |
|
1007 // From class MDiagPluginPoolObserver. |
|
1008 // The callback to indicate plugin loading completion. |
|
1009 // --------------------------------------------------------------------------- |
|
1010 // |
|
1011 void CDevDiagEngine::LoadCompletedL( TInt aError ) |
|
1012 { |
|
1013 LOGSTRING2( "CDevDiagEngine::LoadCompletedL( %d )", aError ) |
|
1014 |
|
1015 SetState( EStateReady ); |
|
1016 |
|
1017 // Inform the observer of the loading completion. The observer will |
|
1018 // display error messages for loading failures. |
|
1019 if ( iObserver ) |
|
1020 { |
|
1021 iObserver->HandleEngineCommandL( |
|
1022 MDevDiagEngineObserver::EDevDiagEngineCommandPluginLoadComplete, |
|
1023 aError, |
|
1024 NULL ); |
|
1025 } |
|
1026 } |
|
1027 |
|
1028 // --------------------------------------------------------------------------- |
|
1029 // Get Last results from the Results Database. |
|
1030 // --------------------------------------------------------------------------- |
|
1031 // |
|
1032 void CDevDiagEngine::GetLastResultsL( TUid aParentUid ) |
|
1033 { |
|
1034 LOGSTRING( "CDevDiagEngine::GetLastResultsL"); |
|
1035 |
|
1036 RPointerArray<MDiagPlugin> children; |
|
1037 CleanupClosePushL( children ); |
|
1038 |
|
1039 MDiagPlugin* plugin; |
|
1040 ///@@@KSR: changes for BAD Warnings - #177-D: variable "formattedName" was declared but never referenced |
|
1041 //HBufC* formattedName = NULL; |
|
1042 |
|
1043 if ( PluginPool().FindPlugin( aParentUid, plugin ) == KErrNone ) |
|
1044 { |
|
1045 MDiagSuitePlugin* suite = static_cast< MDiagSuitePlugin* >( plugin ); |
|
1046 suite->GetChildrenL( children, MDiagSuitePlugin::ESortByPosition ); |
|
1047 } |
|
1048 else |
|
1049 { |
|
1050 User::Leave(KErrNotFound); |
|
1051 } |
|
1052 |
|
1053 if ( iUids ) |
|
1054 { |
|
1055 delete iUids; |
|
1056 iUids = NULL; |
|
1057 } |
|
1058 |
|
1059 iUids = new (ELeave) CArrayFixFlat<TUid>( KArrayGranuality ); |
|
1060 |
|
1061 iLastResults.ResetAndDestroy(); |
|
1062 |
|
1063 //Create UID array that is needed when results are searched from the DB. |
|
1064 for ( TInt i = 0; i < children.Count(); ++i ) |
|
1065 { |
|
1066 iUids->AppendL( children[i]->Uid() ); |
|
1067 } |
|
1068 |
|
1069 CleanupStack::PopAndDestroy( &children ); |
|
1070 |
|
1071 //Start search. This is an asynchronous call. |
|
1072 iResultsDatabase.InitiateGetLastResults( *iUids, iStatus ); |
|
1073 |
|
1074 SetActive(); |
|
1075 } |
|
1076 |
|
1077 |
|
1078 // --------------------------------------------------------------------------- |
|
1079 // Get last plug-in that crashed (if any). |
|
1080 // |
|
1081 // CDiagResultsDatabaseItem::EQueuedToRun indicates that the test was not |
|
1082 // executed properly. |
|
1083 // --------------------------------------------------------------------------- |
|
1084 // |
|
1085 TBool CDevDiagEngine::CrashedPluginL( TUid& aPluginUid ) |
|
1086 { |
|
1087 LOGSTRING( "CDevDiagEngine::CrashedPluginL"); |
|
1088 TUid recordUid; |
|
1089 TInt error = iResultsDatabase.GetLastNotCompletedRecord ( recordUid ); |
|
1090 LOGSTRING2("crashedpluginL::dbconnect error %d",error); |
|
1091 TBool found = EFalse; |
|
1092 if ( error == KErrNone ) |
|
1093 { |
|
1094 RDiagResultsDatabaseRecord crashedRecord; |
|
1095 |
|
1096 error = crashedRecord.Connect( iResultsDatabase, recordUid, EFalse ); |
|
1097 CleanupClosePushL( crashedRecord ); |
|
1098 |
|
1099 if ( error != KErrNone ) |
|
1100 { |
|
1101 LOGSTRING2( "CDevDiagEngine::CrashedPluginL connect error: %d", error ); |
|
1102 User::Leave( error ); |
|
1103 } |
|
1104 |
|
1105 //ResetAndDestroy + Close would be better |
|
1106 RPointerArray<CDiagResultsDatabaseItem> resultsArray; |
|
1107 CleanupClosePushL( resultsArray ); |
|
1108 |
|
1109 error = crashedRecord.GetTestResults ( resultsArray ); |
|
1110 |
|
1111 if ( error != KErrNone ) |
|
1112 { |
|
1113 LOGSTRING2( "CDevDiagEngine::CrashedPluginL GetTestResults error: %d", error ); |
|
1114 User::Leave( error ); |
|
1115 } |
|
1116 |
|
1117 for ( TInt i = 0; i < resultsArray.Count(); ++i ) |
|
1118 { |
|
1119 if ( resultsArray[i]->TestResult() == CDiagResultsDatabaseItem::EQueuedToRun ) |
|
1120 { |
|
1121 aPluginUid = resultsArray[i]->TestUid(); |
|
1122 found = ETrue; |
|
1123 break; |
|
1124 } |
|
1125 } |
|
1126 |
|
1127 resultsArray.ResetAndDestroy(); |
|
1128 CleanupStack::PopAndDestroy(); |
|
1129 CleanupStack::PopAndDestroy(); //crashedRecord |
|
1130 } |
|
1131 |
|
1132 LOGSTRING( "CDevDiagEngine::CrashedPluginL end" ); |
|
1133 |
|
1134 return found; |
|
1135 } |
|
1136 |
|
1137 |
|
1138 // --------------------------------------------------------------------------- |
|
1139 // Completes the crashed test record. |
|
1140 // --------------------------------------------------------------------------- |
|
1141 // |
|
1142 ///@@@KSR: changes for Codescanner error val = High |
|
1143 //TInt CDevDiagEngine::CompleteCrashedTestRecord() |
|
1144 TInt CDevDiagEngine::CompleteCrashedTestRecordL() |
|
1145 { |
|
1146 LOGSTRING( "CDevDiagEngine::CompleteCrashedTestRecordL"); |
|
1147 TUid recordUid; |
|
1148 TInt error = iResultsDatabase.GetLastNotCompletedRecord ( recordUid ); |
|
1149 |
|
1150 if ( error == KErrNone ) |
|
1151 { |
|
1152 RDiagResultsDatabaseRecord crashedRecord; |
|
1153 |
|
1154 error = crashedRecord.Connect( iResultsDatabase, recordUid, EFalse ); |
|
1155 CleanupClosePushL( crashedRecord ); |
|
1156 |
|
1157 if ( error != KErrNone ) |
|
1158 { |
|
1159 LOGSTRING2( "CDevDiagEngine::CompleteCrashedTestRecordL connect error: %d", error ); |
|
1160 return error; |
|
1161 } |
|
1162 |
|
1163 error = crashedRecord.TestCompleted( ETrue ); |
|
1164 |
|
1165 if ( error != KErrNone ) |
|
1166 { |
|
1167 LOGSTRING2( "CDevDiagEngine::CompleteCrashedTestRecordL TestCompleted error: %d", error ); |
|
1168 return error; |
|
1169 } |
|
1170 |
|
1171 CleanupStack::PopAndDestroy(); //crashedRecord |
|
1172 } |
|
1173 |
|
1174 LOGSTRING( "CDevDiagEngine::CompleteCrashedTestRecordL end"); |
|
1175 |
|
1176 return error; |
|
1177 } |
|
1178 |
|
1179 |
|
1180 // ADO & Platformization Changes |
|
1181 TBool CDevDiagEngine::GetPluginDependencyL() |
|
1182 { |
|
1183 ///@@@KSR: changes for Codescanner error val = High |
|
1184 //return iDiagEngine->GetPluginDependency(); |
|
1185 return iDiagEngine->GetPluginDependencyL(); |
|
1186 } |
|
1187 |
|
1188 // End of File |