stif/StifTFwIf/src/StifTFwIf.cpp
branchRCL_3
changeset 59 8ad140f3dd41
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 2009 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: CStifTFwIf: This object executes test cases from 
       
    15 * STIF Test Framework.
       
    16 *
       
    17 */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include <e32svr.h>
       
    22 #include "UIEngineEvent.h"
       
    23 #include <stifinternal/UIEngineContainer.h>
       
    24 #include "StifTFwIf.h"
       
    25 #include "StifTFw.h"
       
    26 #include "Logging.h"
       
    27 #include "StifPython.h"
       
    28 
       
    29 // EXTERNAL DATA STRUCTURES
       
    30 // None
       
    31 
       
    32 // EXTERNAL FUNCTION PROTOTYPES
       
    33 // None
       
    34 
       
    35 // CONSTANTS
       
    36 // None
       
    37 
       
    38 // MACROS
       
    39 #ifdef LOGGER
       
    40 #undef LOGGER
       
    41 #endif
       
    42 #define LOGGER iStifTFw->iLogger
       
    43 
       
    44 // LOCAL CONSTANTS AND MACROS
       
    45 // None
       
    46 
       
    47 // MODULE DATA STRUCTURES
       
    48 // None
       
    49 
       
    50 // LOCAL FUNCTION PROTOTYPES
       
    51 // None
       
    52 
       
    53 // FORWARD DECLARATIONS
       
    54 // None
       
    55 
       
    56 // ==================== LOCAL FUNCTIONS ======================================= 
       
    57 
       
    58 // ================= MEMBER FUNCTIONS =========================================
       
    59 
       
    60 /*
       
    61 -------------------------------------------------------------------------------
       
    62 
       
    63     Class: CStifTFwIf
       
    64 
       
    65     Method: CStifTFwIf
       
    66 
       
    67     Description: Default constructor
       
    68 
       
    69     C++ default constructor can NOT contain any code, that
       
    70     might leave.
       
    71     
       
    72     Parameters: None
       
    73     
       
    74     Return Values: None
       
    75 
       
    76     Errors/Exceptions: None
       
    77 
       
    78     Status: Draft
       
    79 
       
    80 -------------------------------------------------------------------------------
       
    81 */
       
    82 EXPORT_C CStifTFwIf::CStifTFwIf()
       
    83     {
       
    84     __RDEBUG( _L( "CStifTFwIf::CStifTFwIf()" ) );
       
    85     }
       
    86 
       
    87 
       
    88 /*
       
    89 -------------------------------------------------------------------------------
       
    90 
       
    91     Class: CStifTFwIf
       
    92 
       
    93     Method: ~CStifTFwIf
       
    94 
       
    95     Description: Destructor
       
    96 
       
    97     Parameters: None
       
    98 
       
    99     Return Values: None
       
   100 
       
   101     Errors/Exceptions: None
       
   102 
       
   103     Status: Draft
       
   104 
       
   105 -------------------------------------------------------------------------------
       
   106 */
       
   107 EXPORT_C CStifTFwIf::~CStifTFwIf()
       
   108     {
       
   109     __RDEBUG( _L( "CStifTFwIf::~CStifTFwIf()" ) );
       
   110     }
       
   111 
       
   112 /*
       
   113 -------------------------------------------------------------------------------
       
   114 
       
   115     Class: CStifTFwIf
       
   116 
       
   117     Method: Open
       
   118 
       
   119     Description: Open test engine.
       
   120 
       
   121     Parameters: TDesC& aTestFrameworkIni: in: Initialization file to Test Framework
       
   122 
       
   123     Return Values: Symbian OS error: Error code
       
   124 
       
   125     Errors/Exceptions: None
       
   126 
       
   127     Status: Draft
       
   128 
       
   129 -------------------------------------------------------------------------------
       
   130 */
       
   131 EXPORT_C TInt CStifTFwIf::Open( TDesC& aTestFrameworkIni )
       
   132     {
       
   133     RDebug::Print(_L("CStifTFwIf::Open"));
       
   134     TInt err( KErrNone );
       
   135     TRAP( err,
       
   136         iStifTFw = CStifTFw::NewL( this );
       
   137         )
       
   138 
       
   139     return iStifTFw->iUIEngine->Open( aTestFrameworkIni );
       
   140 
       
   141     }
       
   142 
       
   143 
       
   144 /*
       
   145 -------------------------------------------------------------------------------
       
   146 
       
   147     Class: CStifTFwIf
       
   148 
       
   149     Method: Close
       
   150 
       
   151     Description: Close test engine.
       
   152 
       
   153     Parameters: None
       
   154 
       
   155     Return Values: TInt KErrNone: Always returned KErrNone
       
   156 
       
   157     Errors/Exceptions: None
       
   158 
       
   159     Status: Draft
       
   160 
       
   161 -------------------------------------------------------------------------------
       
   162 */
       
   163 EXPORT_C TInt CStifTFwIf::Close()
       
   164     {
       
   165     RDebug::Print(_L("CStifTFwIf::Close"));
       
   166 
       
   167     iStifTFw->DeleteData(); //Delete objects before closing session to TestEngine server
       
   168     iStifTFw->iUIEngine->Close();
       
   169 
       
   170     delete iStifTFw;
       
   171     iStifTFw = 0;
       
   172 
       
   173     return KErrNone;
       
   174 
       
   175     }
       
   176 
       
   177 
       
   178 /*
       
   179 -------------------------------------------------------------------------------
       
   180 
       
   181     Class: CStifTFwIf
       
   182 
       
   183     Method: SetAttribute
       
   184 
       
   185     Description: Used to set attributes for Test Framework.
       
   186 
       
   187     Parameters: TAttribute aAttribute: in: Attribute type
       
   188                 TDesC& aValue: in: Attribute value
       
   189 
       
   190     Return Values: Symbian OS error: Error code
       
   191 
       
   192     Errors/Exceptions: None
       
   193 
       
   194     Status: Proposal
       
   195 
       
   196 -------------------------------------------------------------------------------
       
   197 */
       
   198 EXPORT_C TInt CStifTFwIf::SetAttribute( TAttribute aAttribute,
       
   199                                         const TDesC& aValue )
       
   200     {
       
   201     RDebug::Print(_L("CStifTFwIf::SetAttribute"));
       
   202     // Check aValue max length
       
   203     if( aValue.Length() > KMaxName )
       
   204         {
       
   205         __TRACE( KPrint, ( CStifLogger::EError, _L( "CStifTFwIf::SetAttribute() method's second parameter length is incorrect" ) ) );
       
   206         return KErrArgument;
       
   207         }
       
   208 
       
   209     TInt ret = iStifTFw->iUIEngine->TestEngine().SetAttribute( aAttribute, aValue );
       
   210 
       
   211     if ( ret != KErrNone )
       
   212         {
       
   213         __TRACE( KPrint, ( _L( "CStifTFwIf::SetAttribute() method fails with error:%d" ), ret  ) );
       
   214         return ret;
       
   215         }
       
   216 
       
   217     return KErrNone;
       
   218 
       
   219     }
       
   220 
       
   221 /*
       
   222 -------------------------------------------------------------------------------
       
   223 
       
   224     Class: CStifTFwIf
       
   225 
       
   226     Method: AddTestModule
       
   227 
       
   228     Description: Add test module to module list of test engine
       
   229 
       
   230     Parameters: TDesC& aModuleName: in: Testmodule, which is added to module list
       
   231                 TDesC& aIniFile: in: Initialization file to the test module
       
   232 
       
   233     Return Values: Symbian OS error: Error code
       
   234 
       
   235     Errors/Exceptions: None
       
   236 
       
   237     Status: Draft
       
   238 
       
   239 -------------------------------------------------------------------------------
       
   240 */
       
   241 EXPORT_C TInt CStifTFwIf::AddTestModule( TDesC& aModuleName,
       
   242                                          TDesC& aIniFile )
       
   243     {
       
   244     RDebug::Print(_L("CStifTFwIf::AddTestModule"));
       
   245 
       
   246     return iStifTFw->iUIEngine->AddTestModule( aModuleName, aIniFile );
       
   247 
       
   248     }
       
   249 
       
   250 
       
   251 /*
       
   252 -------------------------------------------------------------------------------
       
   253 
       
   254     Class: CStifTFwIf
       
   255 
       
   256     Method: RemoveTestModule
       
   257 
       
   258     Description: Add test module to module list of test engine
       
   259 
       
   260     Parameters: TDesC& aModuleName: in: Testmodule, which is removed of module list
       
   261 
       
   262     Return Values: Symbian OS error: Error code
       
   263 
       
   264     Errors/Exceptions: None
       
   265 
       
   266     Status: Draft
       
   267 
       
   268 -------------------------------------------------------------------------------
       
   269 */
       
   270 EXPORT_C TInt CStifTFwIf::RemoveTestModule( TDesC& aModuleName )
       
   271     {
       
   272     RDebug::Print(_L("CStifTFwIf::RemoveTestModule"));
       
   273 
       
   274     return iStifTFw->iUIEngine->RemoveTestModule( aModuleName );
       
   275 
       
   276     }
       
   277 
       
   278 
       
   279 /*
       
   280 -------------------------------------------------------------------------------
       
   281 
       
   282     Class: CStifTFwIf
       
   283 
       
   284     Method: AddTestCaseFile
       
   285 
       
   286     Description: Add test case file to test case file list of test engine
       
   287 
       
   288     Parameters: TDesC& aModuleName: in: Testmodule, which own test cases of test case list.
       
   289                 TDesC& aCaseFile: in: Test case list, which is added to test case list
       
   290 
       
   291     Return Values: Symbian OS error: Error code
       
   292 
       
   293     Errors/Exceptions: None
       
   294 
       
   295     Status: Draft
       
   296 
       
   297 -------------------------------------------------------------------------------
       
   298 */
       
   299 EXPORT_C TInt CStifTFwIf::AddTestCaseFile( TDesC& aModuleName, TDesC& aCaseFile )
       
   300     {
       
   301     RDebug::Print(_L("CStifTFwIf::AddTestCaseFile"));
       
   302 
       
   303     return iStifTFw->iUIEngine->AddTestCaseFile( aModuleName, aCaseFile );
       
   304 
       
   305     }
       
   306 
       
   307 
       
   308 /*
       
   309 -------------------------------------------------------------------------------
       
   310 
       
   311     Class: CStifTFwIf
       
   312 
       
   313     Method: RemoveTestCaseFile
       
   314 
       
   315     Description: Remove test case file of test case file list of test engine
       
   316 
       
   317     Parameters: TDesC& aModuleName: in: Testmodule, which own test cases of test case list
       
   318                 TDesC& aCaseFile: in: Test case list, which is removed of test case list
       
   319 
       
   320     Return Values: Symbian OS error: Error code
       
   321 
       
   322     Errors/Exceptions: None
       
   323 
       
   324     Status: Draft
       
   325 
       
   326 -------------------------------------------------------------------------------
       
   327 */
       
   328 EXPORT_C TInt CStifTFwIf::RemoveTestCaseFile( TDesC& aModuleName, TDesC& aCaseFile )
       
   329     {
       
   330     RDebug::Print(_L("CStifTFwIf::RemoveTestCaseFile"));
       
   331 
       
   332     return iStifTFw->iUIEngine->RemoveTestCaseFile( aModuleName, aCaseFile );
       
   333 
       
   334     }
       
   335 
       
   336 
       
   337 /*
       
   338 -------------------------------------------------------------------------------
       
   339 
       
   340     Class: CStifTFwIf
       
   341 
       
   342     Method: GetTestCases
       
   343 
       
   344     Description: Get test cases of enumerated list of test engine. Method is copied
       
   345                  list of test cases to aTestCaseInfo. Copied tests are test cases
       
   346                  of test module (aTestModule) and defined
       
   347                  in test case file (aTestCaseFile), which are given as argument
       
   348 
       
   349                  Method copied all enumerated test cases if aTestModule
       
   350                  and aTestCaseFile are not defined
       
   351 
       
   352     Parameters: RPointerArray<CTestInfo>& aTestCaseInfo: inout: List of test cases
       
   353                 TDesC& aModuleName: in: Testmodule, which own test cases of test case list
       
   354                 TDesC& aTestCaseFile: in: Test case list, which is got of test case list
       
   355 
       
   356     Return Values: Symbian OS error: Error code
       
   357 
       
   358     Errors/Exceptions: None
       
   359 
       
   360     Status: Draft
       
   361 
       
   362 -------------------------------------------------------------------------------
       
   363 */
       
   364 EXPORT_C TInt CStifTFwIf::GetTestCases( RPointerArray<CTestInfo>& aTestCaseInfo,
       
   365                                         TDesC& aTestModule,
       
   366                                         TDesC& aTestCaseFile )
       
   367     {
       
   368     RDebug::Print(_L("CStifTFwIf::GetTestCases"));
       
   369 
       
   370     TRAPD( ret,
       
   371         ret = iStifTFw->iUIEngine->GetTestCasesL( aTestCaseInfo,
       
   372                                                   aTestModule,
       
   373                                                   aTestCaseFile );
       
   374         );
       
   375 
       
   376     return ret;
       
   377 
       
   378     }
       
   379 
       
   380 
       
   381 /*
       
   382 -------------------------------------------------------------------------------
       
   383 
       
   384     Class: CStifTFwIf
       
   385 
       
   386     Method: StartTestCase
       
   387 
       
   388     Description: Start test case execution.
       
   389 
       
   390     Parameters: TInt& aTestId: in: ID for test case. Test ID given of address of
       
   391                 current CStifTFwIfContainer.
       
   392 
       
   393                 const CTestInfo& aTestInfo: in: Test case information
       
   394 
       
   395     Return Values: Symbian OS error: Error code
       
   396 
       
   397     Errors/Exceptions: None
       
   398 
       
   399     Status: Draft
       
   400 
       
   401 -------------------------------------------------------------------------------
       
   402 */
       
   403 EXPORT_C TInt CStifTFwIf::StartTestCase( TInt& aTestId,
       
   404                                          const CTestInfo& aTestInfo )
       
   405     {
       
   406     RDebug::Print(_L("CStifTFwIf::StartTestCase"));
       
   407 
       
   408     CUIEngineContainer* container = NULL;
       
   409 
       
   410     TInt ret = iStifTFw->iUIEngine->StartTestCase( container,
       
   411                                                    aTestInfo );
       
   412 
       
   413     if( ret != KErrNone )
       
   414         {
       
   415         return ret;
       
   416         }
       
   417 
       
   418     // Add container to test case execution table
       
   419     ret = iStifTFw->iTestExecutionTable.Append( container );
       
   420     if( ret != KErrNone )
       
   421         {
       
   422         iStifTFw->iUIEngine->AbortStartedTestCase( container );
       
   423         return ret;
       
   424         }
       
   425 
       
   426     // Get test id.
       
   427     aTestId = (TInt)container;
       
   428 
       
   429     __TRACE( KPrint, (  _L( "aTestId: %d"), aTestId ) );
       
   430     __TRACE( KPrint, (  _L( "aTest case: %S"), &(aTestInfo.TestCaseTitle()) ) );
       
   431 
       
   432     return ret;
       
   433 
       
   434     }
       
   435 
       
   436 
       
   437 /*
       
   438 -------------------------------------------------------------------------------
       
   439 
       
   440     Class: CStifTFwIf
       
   441 
       
   442     Method: CancelTestCase
       
   443 
       
   444     Description: Cancel test case execution
       
   445 
       
   446     Parameters: TInt& aTestId: in: ID for test case
       
   447 
       
   448     Return Values: Symbian OS error: Error code
       
   449 
       
   450     Errors/Exceptions: None
       
   451 
       
   452     Status: Draft
       
   453 
       
   454 -------------------------------------------------------------------------------
       
   455 */
       
   456 EXPORT_C TInt CStifTFwIf::CancelTestCase( TInt aTestId )
       
   457     {
       
   458     RDebug::Print(_L("CStifTFwIf::CancelTestCase"));
       
   459     TInt ret(KErrNone);
       
   460 
       
   461     // Find test case from execution table
       
   462     TInt index = iStifTFw->iTestExecutionTable.Find( ( CUIEngineContainer* )aTestId );
       
   463 
       
   464     // Check if test id is found
       
   465     if( index < 0)
       
   466         {
       
   467         __TRACE( KPrint, (  _L( "CStifTFwIf::CancelTestCase. Container not found. TestId = %d"), aTestId ) );
       
   468 
       
   469         return index;
       
   470         }
       
   471 
       
   472     // Cancel test
       
   473     ret = iStifTFw->iTestExecutionTable[index]->CancelTest();
       
   474     __TRACE( KPrint, (  _L( "CStifTFwIf::CancelTestCase. Canceled testId %d"), aTestId ) );
       
   475 
       
   476     return ret;
       
   477     }
       
   478 
       
   479 
       
   480 /*
       
   481 -------------------------------------------------------------------------------
       
   482 
       
   483     Class: CStifTFwIf
       
   484 
       
   485     Method: PauseTestCase
       
   486 
       
   487     Description: Pause test case execution
       
   488 
       
   489     Parameters: TInt& aTestId: in: ID for test case
       
   490 
       
   491     Return Values: Symbian OS error: Error code
       
   492 
       
   493     Errors/Exceptions: None
       
   494 
       
   495     Status: Draft
       
   496 
       
   497 -------------------------------------------------------------------------------
       
   498 */
       
   499 EXPORT_C TInt CStifTFwIf::PauseTestCase(  TInt aTestId  )
       
   500     {
       
   501     RDebug::Print(_L("CStifTFwIf::PauseTestCase"));
       
   502     TInt ret(KErrNone);
       
   503 
       
   504     // Find test case from execution table
       
   505     TInt index = iStifTFw->iTestExecutionTable.Find( ( CUIEngineContainer*) aTestId );
       
   506 
       
   507     // Check if test id is found
       
   508     if( index < 0 )
       
   509         {
       
   510         __TRACE( KPrint, (  _L( "CStifTFwIf::PauseTestCase. Container not found: testId = %d"), aTestId ) );
       
   511 
       
   512         return index;
       
   513         }
       
   514 
       
   515     // Pause test
       
   516     ret = iStifTFw->iTestExecutionTable[index]->PauseTest();
       
   517 
       
   518     __TRACE( KPrint, (  _L( "CStifTFwIf::PauseTest. Paused testId %d"), aTestId ) );
       
   519     return ret;
       
   520     }
       
   521 
       
   522 
       
   523 /*
       
   524 -------------------------------------------------------------------------------
       
   525 
       
   526     Class: CStifTFwIf
       
   527 
       
   528     Method: ResumeTestCase
       
   529 
       
   530     Description: Resume test case execution
       
   531 
       
   532     Parameters: TInt& aTestId: in: ID for test case
       
   533 
       
   534     Return Values: Symbian OS error: Error code
       
   535 
       
   536     Errors/Exceptions: None
       
   537 
       
   538     Status: Draft
       
   539 
       
   540 -------------------------------------------------------------------------------
       
   541 */
       
   542 EXPORT_C TInt CStifTFwIf::ResumeTestCase( TInt aTestId )
       
   543     {
       
   544     RDebug::Print(_L("CStifTFwIf::ResumeTestCase"));
       
   545     TInt ret(KErrNone);
       
   546 
       
   547     // Find test case from execution table
       
   548     TInt index = iStifTFw->iTestExecutionTable.Find( ( CUIEngineContainer* ) aTestId );
       
   549 
       
   550     // Check if test id is found
       
   551     if( index < 0 )
       
   552         {
       
   553         __TRACE( KPrint, (  _L( "CStifTFwIf::ResumeTestCase. Container not found: TestId = %d"), aTestId ) );
       
   554 
       
   555         return index;
       
   556         }
       
   557 
       
   558     // Resume test
       
   559     ret = iStifTFw->iTestExecutionTable[index]->ResumeTest();
       
   560 
       
   561     __TRACE( KPrint, ( _L( "CStifTFwIf::ResumeTestCase. Resumed testId %d"), aTestId ) );
       
   562 
       
   563     return ret;
       
   564     }
       
   565 
       
   566 
       
   567 /*
       
   568 -------------------------------------------------------------------------------
       
   569 
       
   570     Class: CStifTFwIf
       
   571 
       
   572     Method: AtsReceive
       
   573 
       
   574     Description: Handles remote protocol message receives
       
   575 
       
   576     Parameters: const TDesC& aMessage: in: Protocol message received
       
   577 
       
   578     Return Values: Symbian OS error code: In oom and is protocol message header
       
   579         parsing fails, i.e. error in <msgtype> <srcid> <dstid>
       
   580 
       
   581     Errors/Exceptions: None
       
   582 
       
   583     Status: Draft
       
   584 
       
   585 -------------------------------------------------------------------------------
       
   586 */
       
   587 EXPORT_C TInt CStifTFwIf::AtsReceive( const TDesC& aMessage )
       
   588     {
       
   589     RDebug::Print(_L("CStifTFwIf::AtsReceive"));
       
   590 
       
   591     CStifTFwIfProt* msg = NULL;
       
   592     CStifTFwIfProt* resp = NULL;
       
   593     TRAPD( err, msg = CStifTFwIfProt::NewL(); );
       
   594     if( err != KErrNone )
       
   595         {
       
   596         return err;
       
   597         }
       
   598     TRAP( err, resp = CStifTFwIfProt::NewL(); );
       
   599     if( err != KErrNone )
       
   600         {
       
   601         delete msg;
       
   602         return err;
       
   603         }
       
   604     TInt error = KErrNone;
       
   605     TInt ret = KErrNone;
       
   606 
       
   607     // Parse received message
       
   608     TRAP( err,
       
   609         error = msg->SetL( aMessage )
       
   610     );
       
   611     if( err != KErrNone )
       
   612         {
       
   613         __TRACE( KError, ( _L( "AtsReceive: message header parsing failed [%d]"), err ) );
       
   614         delete msg;
       
   615         delete resp;
       
   616         return err;
       
   617         }
       
   618 
       
   619     // Create response
       
   620     TRAP( err, resp->CreateL(); );
       
   621     if( err != KErrNone )
       
   622         {
       
   623         delete msg;
       
   624         delete resp;
       
   625         return err;
       
   626         }
       
   627 
       
   628     resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
       
   629 
       
   630     if( error != KErrNone )
       
   631         {
       
   632         __TRACE( KError, ( _L( "AtsReceive: message parsing failed [%d]"), error ) );
       
   633         resp->AppendId( SETID( DevId(), 0 ) );
       
   634         resp->AppendId( msg->SrcId() );
       
   635         resp->Append( CStifTFwIfProt::MsgType, msg->iMsgType );
       
   636         resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
       
   637         AtsSend( resp->Message() );
       
   638 
       
   639         // Error reported with protocol message, return success
       
   640         delete msg;
       
   641         delete resp;
       
   642         return KErrNone;
       
   643         }
       
   644 
       
   645     switch( msg->iMsgType )
       
   646         {
       
   647         case CStifTFwIfProt::EMsgReserve:
       
   648             {
       
   649             if( msg->iRemoteType != CStifTFwIfProt::ERemotePhone )
       
   650                 {
       
   651                 __TRACE( KError, ( _L( "AtsReceive: reserve for illegal type received") ) );
       
   652                 error = KErrGeneral;
       
   653                 }
       
   654             // Check IDs
       
   655             if( ( msg->SrcDevId() == 0 ) ||
       
   656                 ( msg->SrcTestId() == 0 ) )
       
   657                 {
       
   658                 __TRACE( KError, ( _L( "AtsReceive: reserve for illegal srcid received") ) );
       
   659                 error = KErrGeneral;
       
   660                 }
       
   661             if( msg->DstId() != 0 )
       
   662                 {
       
   663                 // Not a broadcast
       
   664                 if( ( msg->DstDevId() != DevId() ) ||
       
   665                     ( msg->DstTestId() != 0 ) )
       
   666                     {
       
   667                     __TRACE( KError, ( _L( "AtsReceive: reserve for illegal dstid received") ) );
       
   668                     error = KErrGeneral;
       
   669                     }
       
   670                 }
       
   671             TInt index = iStifTFw->iMasterArray.Find( msg->SrcId() );
       
   672             if( index >= 0 )
       
   673                 {
       
   674                 error = KErrInUse;
       
   675                 __TRACE( KError, ( _L( "AtsReceive: master has already reserved slave") ) );
       
   676                 }
       
   677             else
       
   678                 {
       
   679                 iStifTFw->iMasterArray.Append( msg->SrcId() );
       
   680                 }
       
   681 
       
   682             resp->AppendId( SETID( DevId(), 0 ) );
       
   683             resp->AppendId( msg->SrcId() );
       
   684             resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgReserve );
       
   685             if( error != KErrNone )
       
   686                 {
       
   687                 resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
       
   688                 }
       
   689             AtsSend( resp->Message() );
       
   690 
       
   691             }
       
   692             break;
       
   693         case CStifTFwIfProt::EMsgRelease:
       
   694             {
       
   695             // Check protocol ids
       
   696             if( ( msg->SrcDevId() == 0 ) ||
       
   697                 ( msg->SrcTestId() == 0 ) ||
       
   698                 ( msg->DstTestId() != 0 ) )
       
   699                 {
       
   700                 __TRACE( KError, ( _L( "AtsReceive: release for illegal srcid or dstid received") ) );
       
   701                 error = KErrGeneral;
       
   702                 }
       
   703             else if( msg->DstDevId() != DevId() )
       
   704                 {
       
   705                 __TRACE( KError, ( _L( "AtsReceive: release for illegal dstid received") ) );
       
   706                 error = KErrNotFound;
       
   707                 }
       
   708             else
       
   709                 {
       
   710                 // Check Master identifier
       
   711                 // First check that specific master has reserved us
       
   712                 TInt index = iStifTFw->iMasterArray.Find( msg->SrcId() );
       
   713                 if( index < 0 )
       
   714                     {
       
   715                     error = KErrNotFound;
       
   716                     }
       
   717                 else
       
   718                     {
       
   719                     // Search test case from execution table
       
   720                     TInt count = iStifTFw->iTestRemoteExecutionTable.Count();
       
   721                     for( TInt ind = 0; ind < count; ind++ )
       
   722                         {
       
   723                         if( iStifTFw->iTestRemoteExecutionTable[ind]->RemoteId() ==
       
   724                             msg->SrcId() )
       
   725                             {
       
   726                             __TRACE( KError, (  _L( "Release: test case running for %x"),
       
   727                                 msg->SrcId() ) );
       
   728                             error = KErrInUse;
       
   729                             break;
       
   730                             }
       
   731                         }
       
   732                     if( error == KErrNone )
       
   733                         {
       
   734                         iStifTFw->iMasterArray.Remove( index );
       
   735                         }
       
   736                     }
       
   737                 }
       
   738 
       
   739             resp->AppendId( msg->DstId() );
       
   740             resp->AppendId( msg->SrcId() );
       
   741             resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRelease );
       
   742 
       
   743             if( error != KErrNone )
       
   744                 {
       
   745                 resp->Append( CStifTFwIfProt::RespParam, CStifTFwIfProt::ERespResult, error );
       
   746                 }
       
   747             AtsSend( resp->Message() );
       
   748             }
       
   749             break;
       
   750         case CStifTFwIfProt::EMsgRemote:
       
   751             {
       
   752             // Check protocol ids
       
   753             TInt index = iStifTFw->iMasterArray.Find( msg->SrcId() );
       
   754             if( ( msg->SrcDevId() == 0 ) ||
       
   755                 ( msg->SrcTestId() == 0 ) ||
       
   756                 ( msg->DstDevId() == 0 ) )
       
   757                 {
       
   758                 __TRACE( KError, ( _L( "AtsReceive: remote for illegal srcid or dstid received") ) );
       
   759                 error = KErrGeneral;
       
   760                 }
       
   761             else if( index < 0 )
       
   762                 {
       
   763                 __TRACE( KError, ( _L( "AtsReceive: remote for illegal srcid received") ) );
       
   764                 error = KErrNotFound;
       
   765                 }
       
   766             else
       
   767                 {
       
   768 
       
   769                 __TRACE( KError, ( _L( "AtsReceive: Call AtsRemote") ) );
       
   770                 RDebug::Print(_L("CStifTFwIf::AtsReceive remote command received, calling AtsRemote"));
       
   771                 error = iStifTFw->AtsRemote( *msg, *resp );
       
   772                 RDebug::Print(_L("CStifTFwIf::AtsReceive remote command received, AtsRemote return"));
       
   773                 }
       
   774 
       
   775             if( error != KErrNone )
       
   776                 {
       
   777                 resp->AppendId( msg->DstId() );
       
   778                 resp->AppendId( msg->SrcId() );
       
   779                 resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
       
   780                 resp->Append( CStifTFwIfProt::CmdType, msg->iCmdType );
       
   781                 resp->Append( CStifTFwIfProt::RespParam,
       
   782                              CStifTFwIfProt::ERespResult,
       
   783                              error );
       
   784                 }
       
   785             AtsSend( resp->Message() );
       
   786             }
       
   787             break;
       
   788         case CStifTFwIfProt::EMsgResponse:
       
   789             {
       
   790             // Responses ae forwarded to master
       
   791             CUIEngineContainer* container = NULL;
       
   792             TInt count = iStifTFw->iTestRemoteExecutionTable.Count();
       
   793             TInt index = 0;
       
   794             for( index = 0 ; index < count; index++ )
       
   795                 {
       
   796                 if( iStifTFw->iTestRemoteExecutionTable[index]->MasterId() ==
       
   797                     msg->SrcId() )
       
   798                     {
       
   799                     __TRACE( KError, (  _L( "Response for %x"),
       
   800                         msg->SrcId() ) );
       
   801                     container = iStifTFw->iTestRemoteExecutionTable[index];
       
   802                     break;
       
   803                     }
       
   804                 }
       
   805             if( container == NULL )
       
   806                 {
       
   807                 count = iStifTFw->iTestExecutionTable.Count();
       
   808                 for( index = 0 ; index < count; index++ )
       
   809                     {
       
   810                     if( iStifTFw->iTestExecutionTable[index]->MasterId() ==
       
   811                         msg->DstId() )
       
   812                         {
       
   813                         __TRACE( KError, (  _L( "Response for %x"),
       
   814                             msg->SrcId() ) );
       
   815                         container = iStifTFw->iTestExecutionTable[index];
       
   816                         break;
       
   817                         }
       
   818                     }
       
   819                 }
       
   820 
       
   821             if( container == NULL )
       
   822                 {
       
   823                 __TRACE( KError, ( _L( "AtsReceive: response to srcid %x that is not a running master"),
       
   824                     msg->SrcId() ) );
       
   825                 ret = KErrNotFound;
       
   826                 }
       
   827             else
       
   828                 {
       
   829                 ret = container->RemoteReceive( aMessage );
       
   830                 }
       
   831             }
       
   832             break;
       
   833         default:
       
   834             __TRACE( KError, ( _L( "AtsReceive: invalid message")) );
       
   835             ret = KErrNotSupported;
       
   836         }
       
   837 
       
   838     delete msg;
       
   839     delete resp;
       
   840     return ret;
       
   841 
       
   842     }
       
   843 
       
   844 /*
       
   845 -------------------------------------------------------------------------------
       
   846 
       
   847     DESCRIPTION
       
   848 
       
   849     CStifTFw: This object executes test cases from STIF Test Framework.
       
   850 
       
   851 -------------------------------------------------------------------------------
       
   852 */
       
   853 
       
   854 // MACROS
       
   855 #ifdef LOGGER
       
   856 #undef LOGGER
       
   857 #endif
       
   858 #define LOGGER iLogger
       
   859 
       
   860 // ================= MEMBER FUNCTIONS =========================================
       
   861 
       
   862 /*
       
   863 -------------------------------------------------------------------------------
       
   864 
       
   865     Class: CStifTFw
       
   866 
       
   867     Method: NewL
       
   868 
       
   869     Description: Construct the CStifTFw class
       
   870 
       
   871     Parameters: None
       
   872 
       
   873     Return Values: CStifTFw*                    New object
       
   874 
       
   875     Errors/Exceptions: Leaves if memory allocation fails or
       
   876                        ConstructL leaves.
       
   877 
       
   878     Status: Draft
       
   879 
       
   880 -------------------------------------------------------------------------------
       
   881 */
       
   882 CStifTFw* CStifTFw::NewL( CStifTFwIf* aStifTFwIf )
       
   883     {
       
   884     RDebug::Print(_L("CStifTFw::NewL"));
       
   885 
       
   886     CStifTFw* self = new ( ELeave ) CStifTFw( aStifTFwIf );
       
   887     CleanupStack::PushL( self );
       
   888     self->ConstructL();
       
   889     CleanupStack::Pop( self );
       
   890 
       
   891     return self;
       
   892 
       
   893     }
       
   894 
       
   895 
       
   896 /*
       
   897 -------------------------------------------------------------------------------
       
   898 
       
   899     Class: CStifTFw
       
   900 
       
   901     Method: ConstructL
       
   902 
       
   903     Description: Second level constructor.
       
   904 
       
   905     Parameters: None
       
   906 
       
   907     Return Values: None
       
   908 
       
   909     Errors/Exceptions: Leaves on error
       
   910 
       
   911     Status: Draft
       
   912 
       
   913 -------------------------------------------------------------------------------
       
   914 */
       
   915 void CStifTFw::ConstructL()
       
   916     {
       
   917     RDebug::Print(_L("CStifTFw::ConstructL"));
       
   918 
       
   919     iUIEngine = CUIEngine::NewL( (CUIIf*) this );
       
   920 
       
   921     }
       
   922 
       
   923 
       
   924 /*
       
   925 -------------------------------------------------------------------------------
       
   926 
       
   927     Class: CStifTFw
       
   928 
       
   929     Method: CStifTFw
       
   930 
       
   931     Description: Default constructor
       
   932 
       
   933     C++ default constructor can NOT contain any code, that
       
   934     might leave.
       
   935 
       
   936     Parameters: None
       
   937 
       
   938     Return Values: None
       
   939 
       
   940     Errors/Exceptions: None
       
   941 
       
   942     Status: Draft
       
   943 
       
   944 -------------------------------------------------------------------------------
       
   945 */
       
   946 CStifTFw::CStifTFw( CStifTFwIf* aStifTFwIf ):
       
   947     iStifTFwIf( aStifTFwIf )
       
   948     {
       
   949 
       
   950     __RDEBUG( _L( "CStifTFw::CStifTFw()" ) );
       
   951 
       
   952     }
       
   953 
       
   954 
       
   955 /*
       
   956 -------------------------------------------------------------------------------
       
   957 
       
   958     Class: CStifTFwIf
       
   959 
       
   960     Method: ~CStifTFwIf
       
   961 
       
   962     Description: Destructor
       
   963 
       
   964     Parameters: None
       
   965 
       
   966     Return Values: None
       
   967 
       
   968     Errors/Exceptions: None
       
   969 
       
   970     Status: Draft
       
   971 
       
   972 -------------------------------------------------------------------------------
       
   973 */
       
   974 CStifTFw::~CStifTFw()
       
   975     {
       
   976     __RDEBUG( _L( "CStifTFw::~CStifTFw() begin" ) );
       
   977 
       
   978     RDebug::Print(_L("CStifTFw::~CStifTFw resetting iTestExecutionTable cnt=%d"), iTestExecutionTable.Count());
       
   979     iTestExecutionTable.Reset();
       
   980     RDebug::Print(_L("CStifTFw::~CStifTFw resetting iTestRemoteExecutionTable cnt=%d"), iTestRemoteExecutionTable.Count());
       
   981     iTestRemoteExecutionTable.Reset();
       
   982     RDebug::Print(_L("CStifTFw::~CStifTFw resetting iEventArray cnt=%d"), iEventArray.Count());
       
   983     iEventArray.ResetAndDestroy();
       
   984     RDebug::Print(_L("CStifTFw::~CStifTFw resetting iMasterArray cnt=%d"), iMasterArray.Count());
       
   985     iMasterArray.Reset();
       
   986 
       
   987     RDebug::Print(_L("CStifTFw::~CStifTFw closing iTestExecutionTable cnt=%d"), iTestExecutionTable.Count());
       
   988     iTestExecutionTable.Close();
       
   989     RDebug::Print(_L("CStifTFw::~CStifTFw closing iTestRemoteExecutionTable cnt=%d"), iTestRemoteExecutionTable.Count());
       
   990     iTestRemoteExecutionTable.Close();
       
   991     RDebug::Print(_L("CStifTFw::~CStifTFw closing iEventArray cnt=%d"), iEventArray.Count());
       
   992     iEventArray.Close();
       
   993     RDebug::Print(_L("CStifTFw::~CStifTFw closing iMasterArray cnt=%d"), iMasterArray.Count());
       
   994     iMasterArray.Close();
       
   995 
       
   996     //Moved from the beginning of destructor, because objects from some arrays during resetting and/or closing
       
   997     //have tried to call methods of iUIEngine.
       
   998     RDebug::Print(_L("CStifTFw::~CStifTFw deleteing iUiEngine address=%d"), iUIEngine);
       
   999     delete iUIEngine;
       
  1000 
       
  1001     RDebug::Print(_L("CStifTFw::~CStifTFw end"));
       
  1002     }
       
  1003 
       
  1004 /*
       
  1005 -------------------------------------------------------------------------------
       
  1006 
       
  1007     Class: CStifTFw
       
  1008 
       
  1009     Method: AtsRemote
       
  1010 
       
  1011     Description: Remote ATS call
       
  1012 
       
  1013     Parameters: const TDesC& aMessage: in:
       
  1014 
       
  1015     Return Values: KErrNotSupported
       
  1016 
       
  1017     Errors/Exceptions: None
       
  1018 
       
  1019     Status: Draft
       
  1020 
       
  1021 -------------------------------------------------------------------------------
       
  1022 */
       
  1023 TInt CStifTFw::AtsRemote( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp )
       
  1024     {
       
  1025     RDebug::Print(_L("CStifTFw::AtsRemote start, iCmdType=%d "), aReq.iCmdType);
       
  1026 
       
  1027     TInt ret = KErrNone;
       
  1028 
       
  1029     switch( aReq.iCmdType )
       
  1030         {
       
  1031         case CStifTFwIfProt::ECmdRun:
       
  1032             {
       
  1033             RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdRun "));
       
  1034             ret = AtsRemoteRun( aReq, aResp );
       
  1035             break;
       
  1036             }
       
  1037         case CStifTFwIfProt::ECmdPause:
       
  1038         case CStifTFwIfProt::ECmdResume:
       
  1039         case CStifTFwIfProt::ECmdCancel:
       
  1040             {
       
  1041             RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdPause,Resume,Cancel "));
       
  1042             ret = AtsRemoteTestCtl( aReq, aResp );
       
  1043             break;
       
  1044             }
       
  1045         case CStifTFwIfProt::ECmdRequest:
       
  1046         case CStifTFwIfProt::ECmdRelease:
       
  1047             {
       
  1048             RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdRequest,Release "));
       
  1049             ret = AtsRemoteEventCtl( aReq, aResp );
       
  1050             break;
       
  1051             }
       
  1052         case CStifTFwIfProt::ECmdSetEvent:
       
  1053         case CStifTFwIfProt::ECmdUnsetEvent:
       
  1054         	{
       
  1055             RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdSetEvent,Unset start "));
       
  1056             ret = AtsRemoteEventCtl( aReq, aResp );
       
  1057             RDebug::Print(_L("CStifTFw::AtsRemote iCmdType CStifTFwIfProt::ECmdSetEvent,Unset end "));
       
  1058             break;
       
  1059 			}
       
  1060         default:
       
  1061             {
       
  1062             RDebug::Print(_L("CStifTFw::AtsRemote iCmdType UNSUPPORTED value=%d "), aReq.iCmdType);
       
  1063             return KErrNotSupported;
       
  1064             }
       
  1065         }
       
  1066 
       
  1067     return ret;
       
  1068     }
       
  1069 
       
  1070 /*
       
  1071 -------------------------------------------------------------------------------
       
  1072 
       
  1073      Class: CStifTFw
       
  1074 
       
  1075      Method: GetCaseNumByTitle
       
  1076 
       
  1077      Description: Enumerates test cases from given module and finds test case index by title
       
  1078 
       
  1079      Parameters:    TDesC& aModule: in: module name
       
  1080                     TDesC& aTestCaseFile: in: cfg file
       
  1081 	                TDesC& aTitle: in: test case title
       
  1082                     TInt& aCaseNum: in out: test case index
       
  1083 
       
  1084      Return Values: KErrNone if everything is ok
       
  1085                     KErrNotFound if there is no such test case
       
  1086 
       
  1087      Errors/Exceptions: None.
       
  1088 
       
  1089      Status: Proposal
       
  1090 
       
  1091 -------------------------------------------------------------------------------
       
  1092 */
       
  1093 TInt CStifTFw::GetCaseNumByTitle(TDesC& aModule, TDesC& aTestCaseFile, TDesC& aTitle, TInt& aCaseNum)
       
  1094     {
       
  1095     RDebug::Print(_L("CStifTFw::GetCaseNumByTitle looking for test case number module=[%S] cfg=[%S] title=[%S]"), &aModule, &aTestCaseFile, &aTitle);
       
  1096 	//Allocate table
       
  1097     RPointerArray<CTestInfo> allTestInfos;
       
  1098     CleanupClosePushL(allTestInfos);
       
  1099     TInt ret = KErrNone;
       
  1100 
       
  1101     //Enumerate test cases
       
  1102     RDebug::Print(_L("CStifTFw::GetCaseNumByTitle enumerating test cases"));
       
  1103     if(aTestCaseFile == _L("dummy.cfg"))
       
  1104         {
       
  1105 		TName t = _L("");
       
  1106         ret = iStifTFwIf->GetTestCases(allTestInfos, aModule, t);
       
  1107 		}
       
  1108     else
       
  1109         {
       
  1110         ret = iStifTFwIf->GetTestCases(allTestInfos, aModule, aTestCaseFile);
       
  1111 		}
       
  1112 
       
  1113     if(ret != KErrNone)
       
  1114         {
       
  1115 		RDebug::Print(_L("Test cases enumeration from module [%S] and file [%S] has returned an error %d"), &aModule, &aTestCaseFile, ret);
       
  1116 		}
       
  1117     else
       
  1118         {
       
  1119 		//Searching through the table
       
  1120         RDebug::Print(_L("CStifTFw::GetCaseNumByTitle searching through the test cases table containing %d cases"), allTestInfos.Count());
       
  1121         ret = KErrNotFound;
       
  1122         for(TInt i = 0; i < allTestInfos.Count(); i++)
       
  1123             {
       
  1124             if(allTestInfos[i]->TestCaseTitle() == aTitle)
       
  1125                 {
       
  1126                 aCaseNum = i;
       
  1127                 //TestScripter relies on 1-based indexing
       
  1128                 if((aModule.Find(KTestScripterName) != KErrNotFound) || (aModule.Find(KPythonScripter) != KErrNotFound) || (aModule.Find(KTestCombinerName) != KErrNotFound)) 
       
  1129                     aCaseNum++;
       
  1130                 ret = KErrNone;
       
  1131                 break;
       
  1132                 }
       
  1133             }
       
  1134 		}
       
  1135 	if(ret == KErrNotFound)
       
  1136 	    {
       
  1137         RDebug::Print(_L("CStifTFw::GetCaseNumByTitle test case not found"));
       
  1138 		}
       
  1139 	else if(ret == KErrNone)
       
  1140 	    {
       
  1141         RDebug::Print(_L("CStifTFw::GetCaseNumByTitle test case number found: %d"), aCaseNum);
       
  1142 		}
       
  1143 	else
       
  1144 	    {
       
  1145         RDebug::Print(_L("CStifTFw::GetCaseNumByTitle error %d"), ret);
       
  1146 		}
       
  1147 
       
  1148     //Some cleaning
       
  1149     allTestInfos.Reset();
       
  1150     CleanupStack::PopAndDestroy();
       
  1151 
       
  1152     return ret;
       
  1153     }
       
  1154 
       
  1155 /*
       
  1156     Class: CStifTFw
       
  1157 
       
  1158     Method: AtsRemoteRun
       
  1159 
       
  1160     Description: Remote run ATS call
       
  1161 
       
  1162     Parameters: const TDesC& aMessage: in:
       
  1163 
       
  1164     Return Values: KErrNotSupported
       
  1165 
       
  1166     Errors/Exceptions: None
       
  1167 
       
  1168     Status: Draft
       
  1169 
       
  1170 -------------------------------------------------------------------------------
       
  1171 */
       
  1172 TInt CStifTFw::AtsRemoteRun( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp )
       
  1173     {
       
  1174     RDebug::Print(_L("CStifTFw::AtsRemoteRun start"));
       
  1175 
       
  1176     TInt ret = KErrNone;
       
  1177     TUint16 testid = 0;
       
  1178 
       
  1179     if( ( aReq.DstDevId() == 0 ) ||
       
  1180         ( aReq.DstTestId() != 0 ) )
       
  1181         {
       
  1182         RDebug::Print(_L("CStifTFw::AtsRemoteRun Protocol violation"));
       
  1183         // Protocol violation
       
  1184         __TRACE( KError, ( _L( "AtsReceive: remote run for illegal dstid received") ) );
       
  1185         return KErrGeneral;
       
  1186         }
       
  1187 
       
  1188     if ( aReq.DstDevId() != iStifTFwIf->DevId() )
       
  1189         {
       
  1190         RDebug::Print(_L("CStifTFw::AtsRemoteRun Not our protocol message"));
       
  1191         // Not our protocol message
       
  1192         __TRACE( KError, ( _L( "AtsReceive: remote run for illegal dstdevid received") ) );
       
  1193         return KErrNotFound;
       
  1194         }
       
  1195 
       
  1196 
       
  1197     if( aReq.iModule.Length() == 0 )
       
  1198         {
       
  1199         RDebug::Print(_L("CStifTFw::AtsRemoteRun No test module name given"));
       
  1200         __TRACE( KError, ( _L("No mandatory test module name given as run parameter") ) );
       
  1201         ret = KErrNotFound;
       
  1202         }
       
  1203     else if(aReq.iTestCaseNumber < 0 && aReq.iTitle.Length() == 0)
       
  1204         {
       
  1205         RDebug::Print(_L("CStifTFw::AtsRemoteRun No test case number given"));
       
  1206         __TRACE( KError, ( _L("No mandatory test case number given as run parameter") ) );
       
  1207         ret = KErrNotFound;
       
  1208         }
       
  1209     else
       
  1210         {
       
  1211         TBufC<KTestScripterNameLength> myTestscripter;
       
  1212         myTestscripter = KTestScripterName;
       
  1213 
       
  1214         if( ( aReq.iModule.Find( myTestscripter ) != KErrNotFound ) )
       
  1215             {
       
  1216             RDebug::Print(_L("CStifTFw::AtsRemoteRun TestScripter module"));
       
  1217             // If testmodule's type is testscripter, then iModule has name
       
  1218             // "testscripter_testcasefile". AddTestModule method takes
       
  1219             // testscripter type of module without _testcasefile, so we cannot
       
  1220             // give iModule name as parameter.
       
  1221 
       
  1222             // Adding testscripter type of testmodule
       
  1223             RDebug::Print(_L("CStifTFw::AtsRemoteRun calling AddTestModule"));
       
  1224             ret = iStifTFwIf->AddTestModule( myTestscripter, aReq.iIniFile );
       
  1225             if( ret != KErrNone )
       
  1226                 {
       
  1227                 __TRACE( KError, ( _L( "CStifTFw::AtsRemoteRun: AddTestModule failed [%d]"), ret ) );
       
  1228 
       
  1229                 // It is ok if test module is already loaded to test engine
       
  1230                 if( ret == KErrAlreadyExists )
       
  1231                     {
       
  1232                     __TRACE( KPrint, ( _L( "Test module already exists at testengine, no problem") ) );
       
  1233                     }
       
  1234                 }
       
  1235             // Adding testscripter testcasefile
       
  1236             RDebug::Print(_L("CStifTFw::AtsRemoteRun calling AddTestCaseFile"));
       
  1237             ret = iStifTFwIf->AddTestCaseFile( myTestscripter, aReq.iTestCaseFile );
       
  1238             if( ret != KErrNone )
       
  1239                 {
       
  1240                 // It is ok if test case file is already loaded to test engine
       
  1241                 if( ret == KErrAlreadyExists )
       
  1242                     {
       
  1243                     __TRACE( KPrint, ( _L( "Testcasefile already exists at testengine, no problem") ) );
       
  1244                     }
       
  1245                 // Got other error, log info about it
       
  1246                 else
       
  1247                     {
       
  1248                     __TRACE( KError, ( _L( "CStifTFw::AtsRemoteRun: AddTestCaseFile failed [%d]"), ret ) );
       
  1249                     __TRACE( KError, ( _L( "Testscripter needs to have test case file loaded successfully, please check path and file name!") ) );
       
  1250                     }
       
  1251                 }
       
  1252             }
       
  1253         else
       
  1254             {
       
  1255             RDebug::Print(_L("CStifTFw::AtsRemoteRun It is not a TestScripter module "));
       
  1256             // For testmodules other than testscripter
       
  1257             RDebug::Print(_L("CStifTFw::AtsRemoteRun calling AddTestModule "));
       
  1258             ret = iStifTFwIf->AddTestModule( aReq.iModule, aReq.iIniFile );
       
  1259             if( ret != KErrNone )
       
  1260                 {
       
  1261                 __TRACE( KError, ( _L( "CStifTFw::AtsRemoteRun: AddTestModule failed [%d]"), ret ) );
       
  1262 
       
  1263                 // It is ok if test module is already loaded to test engine
       
  1264                 if( ret == KErrAlreadyExists )
       
  1265                     {
       
  1266                     __TRACE( KPrint, ( _L( "Test module already exists at testengine, no problem") ) );
       
  1267                     }
       
  1268                 }
       
  1269             }
       
  1270         if(aReq.iTitle.Length() != 0)
       
  1271             {
       
  1272 			aReq.iTestCaseNumber = -1;
       
  1273             //Get test case number from title
       
  1274             ret = GetCaseNumByTitle(aReq.iModule, aReq.iTestCaseFile, aReq.iTitle, aReq.iTestCaseNumber);
       
  1275             //Check test case number
       
  1276             if(aReq.iTestCaseNumber < 0)
       
  1277                 {
       
  1278                 RDebug::Print(_L("CStifTFw::AtsRemoteRun No test case number could be found using given title parameter"));
       
  1279                 __TRACE(KError, (_L("No mandatory test case number could be found using given title parameter")));
       
  1280                 return KErrNotFound;
       
  1281                 }
       
  1282             }
       
  1283 
       
  1284         CTestInfo *testCase = CTestInfo::NewL();
       
  1285         CleanupStack::PushL( testCase );
       
  1286         // Copy to CTestInfo.
       
  1287 
       
  1288         if( ( aReq.iModule.Find( KTestScripterName ) != KErrNotFound ) )
       
  1289             {
       
  1290             testCase->SetModuleName( KTestScripterName );
       
  1291             }
       
  1292         else
       
  1293             {
       
  1294             testCase->SetModuleName(  aReq.iModule );
       
  1295             }
       
  1296         testCase->SetTestCaseNumber( aReq.iTestCaseNumber );
       
  1297         testCase->SetTestCaseFile( aReq.iTestCaseFile );
       
  1298 
       
  1299         // Create container.
       
  1300         CUIEngineContainer* container = NULL;
       
  1301 
       
  1302         RDebug::Print(_L("CStifTFw::AtsRemoteRun calling StartTestCase "));
       
  1303         ret = iUIEngine->StartTestCase( container,
       
  1304                                         *testCase );
       
  1305 
       
  1306         CleanupStack::PopAndDestroy( testCase );
       
  1307 
       
  1308         if( ret != KErrNone )
       
  1309             {
       
  1310             RDebug::Print(_L("CStifTFw::AtsRemoteRun test case starting FAILED "));
       
  1311             __TRACE( KError, ( _L( "Test case starting failed [%d]"), ret ) );
       
  1312             }
       
  1313         else
       
  1314             {
       
  1315             RDebug::Print(_L("CStifTFw::AtsRemoteRun Add container"));
       
  1316             // Add container to test case execution table
       
  1317             container->SetRemoteId( aReq.SrcId() );
       
  1318             testid = TESTID( (TInt)container );
       
  1319             ret = iTestRemoteExecutionTable.Append( container );
       
  1320             __TRACE( KError, ( _L( "Test case started [%x]"), testid ) );
       
  1321             }
       
  1322         }
       
  1323 
       
  1324     aResp.AppendId( SETID( iStifTFwIf->DevId(), testid ) );
       
  1325     aResp.AppendId( aReq.SrcId() );
       
  1326     aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
       
  1327     aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRun );
       
  1328     if( ret != KErrNone )
       
  1329         {
       
  1330         aResp.Append( CStifTFwIfProt::RunStatus,
       
  1331                      CStifTFwIfProt::ERunError );
       
  1332         aResp.Append( CStifTFwIfProt::RunStatusParams,
       
  1333                      CStifTFwIfProt::ERunResult, ret );
       
  1334         }
       
  1335     else
       
  1336         {
       
  1337         aResp.Append( CStifTFwIfProt::RunStatus,
       
  1338                      CStifTFwIfProt::ERunStarted );
       
  1339         }
       
  1340     // Response is created, return success
       
  1341     ret = KErrNone;
       
  1342 
       
  1343     RDebug::Print(_L("CStifTFw::AtsRemoteRun end "));
       
  1344     return ret;
       
  1345 
       
  1346     }
       
  1347 
       
  1348 /*
       
  1349 -------------------------------------------------------------------------------
       
  1350 
       
  1351     Class: CStifTFw
       
  1352 
       
  1353     Method: AtsRemoteTestCtl
       
  1354 
       
  1355     Description: Remote run ATS call
       
  1356 
       
  1357     Parameters: const TDesC& aMessage: in:
       
  1358 
       
  1359     Return Values: KErrNotSupported
       
  1360 
       
  1361     Errors/Exceptions: None
       
  1362 
       
  1363     Status: Draft
       
  1364 
       
  1365 -------------------------------------------------------------------------------
       
  1366 */
       
  1367 TInt CStifTFw::AtsRemoteTestCtl( CStifTFwIfProt& aReq, CStifTFwIfProt& aResp )
       
  1368     {
       
  1369     RDebug::Print(_L("CStifTFw::AtsRemoteTestCtl"));
       
  1370 
       
  1371     TInt ret = KErrNone;
       
  1372 
       
  1373     if( ( aReq.DstDevId() == 0 ) ||
       
  1374         ( aReq.DstTestId() == 0 ) )
       
  1375         {
       
  1376         // Protocol violation
       
  1377         __TRACE( KError, ( _L( "AtsReceive: remote test control for illegal dstid received") ) );
       
  1378         return KErrGeneral;
       
  1379         }
       
  1380 
       
  1381     if ( aReq.DstDevId() != iStifTFwIf->DevId() )
       
  1382         {
       
  1383         // Not our protocol message
       
  1384         __TRACE( KError, ( _L( "AtsReceive: remote test control for illegal dstdevid received") ) );
       
  1385         return KErrNotFound;
       
  1386         }
       
  1387 
       
  1388     // Find test case from execution table
       
  1389     TInt count = iTestRemoteExecutionTable.Count();
       
  1390     TInt index = 0;
       
  1391     for(; index < count; index++ )
       
  1392         {
       
  1393         if( TESTID( iTestRemoteExecutionTable[index] ) ==
       
  1394             aReq.DstTestId() )
       
  1395             {
       
  1396             break;
       
  1397             }
       
  1398         }
       
  1399 
       
  1400     // Check that test id is found
       
  1401     if( index == count )
       
  1402         {
       
  1403         __TRACE( KError, (  _L( "PauseTestCase. Container not found: testId: %x"),
       
  1404             aReq.DstTestId() ) );
       
  1405         return KErrNotFound;
       
  1406         }
       
  1407 
       
  1408     switch( aReq.iCmdType )
       
  1409         {
       
  1410         case CStifTFwIfProt::ECmdPause:
       
  1411             // Pause test
       
  1412             __TRACE( KPrint, (  _L( "PauseTest: %x"), aReq.DstTestId() ) );
       
  1413             ret = iTestRemoteExecutionTable[index]->PauseTest();
       
  1414             break;
       
  1415         case CStifTFwIfProt::ECmdResume:
       
  1416             // Resume test
       
  1417             __TRACE( KPrint, (  _L( "ResumeTestCase: %x"), aReq.DstTestId() ) );
       
  1418             ret = iTestRemoteExecutionTable[index]->ResumeTest();
       
  1419             break;
       
  1420         case CStifTFwIfProt::ECmdCancel:
       
  1421             // Cancel test
       
  1422             __TRACE( KPrint, (  _L( "CancelTestCase: %x"), aReq.DstTestId() ) );
       
  1423             ret = iTestRemoteExecutionTable[index]->CancelTest();
       
  1424             break;
       
  1425         default:
       
  1426             return KErrNotSupported;
       
  1427         }
       
  1428     if( ret == KErrNone )
       
  1429         {
       
  1430         // Success response is created here
       
  1431         aResp.AppendId( aReq.DstId() );
       
  1432         aResp.AppendId( aReq.SrcId() );
       
  1433         aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
       
  1434         aResp.Append( CStifTFwIfProt::CmdType, aReq.iCmdType );
       
  1435         }
       
  1436 
       
  1437     return ret;
       
  1438 
       
  1439     }
       
  1440 
       
  1441 /*
       
  1442 -------------------------------------------------------------------------------
       
  1443 
       
  1444     Class: CStifTFw
       
  1445 
       
  1446     Method: AtsRemoteEventCtl
       
  1447 
       
  1448     Description: Remote run ATS call
       
  1449 
       
  1450     Parameters: const TDesC& aMessage: in:
       
  1451 
       
  1452     Return Values: KErrNotSupported
       
  1453 
       
  1454     Errors/Exceptions: None
       
  1455 
       
  1456     Status: Draft
       
  1457 
       
  1458 -------------------------------------------------------------------------------
       
  1459 */
       
  1460 TInt CStifTFw::AtsRemoteEventCtl( CStifTFwIfProt& aReq,
       
  1461                                     CStifTFwIfProt& aResp )
       
  1462     {
       
  1463     RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl start "));
       
  1464 
       
  1465     if( ( aReq.DstDevId() == 0 ) ||
       
  1466         ( aReq.DstTestId() != 0 ) )
       
  1467         {
       
  1468         // Protocol violation
       
  1469         __TRACE( KError, ( _L( "AtsReceive: remote event control for illegal dstid received") ) );
       
  1470         return KErrGeneral;
       
  1471         }
       
  1472 
       
  1473     if ( aReq.DstDevId() != iStifTFwIf->DevId() )
       
  1474         {
       
  1475         // Not our protocol message
       
  1476         __TRACE( KError, ( _L( "AtsReceive: remote event control for illegal dstdevid received") ) );
       
  1477         return KErrNotFound;
       
  1478         }
       
  1479 
       
  1480     if( aReq.iEventName.Length() == 0 )
       
  1481         {
       
  1482         __TRACE( KError, ( _L("No event name given") ) );
       
  1483         return KErrNotFound;
       
  1484     }
       
  1485 
       
  1486     switch( aReq.iCmdType )
       
  1487         {
       
  1488         case CStifTFwIfProt::ECmdRequest:
       
  1489             {
       
  1490             RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl ECmdRequest "));
       
  1491             CUIEngineEvent* eventCtl = NULL;
       
  1492             TRAPD( err, eventCtl = CUIEngineEvent::NewL( iUIEngine ); );
       
  1493             if( err != KErrNone )
       
  1494                 {
       
  1495                 return err;
       
  1496                 }
       
  1497             err = iEventArray.Append( eventCtl );
       
  1498             if( err != KErrNone )
       
  1499                 {
       
  1500                 delete eventCtl;
       
  1501                 return err;
       
  1502                 }
       
  1503 
       
  1504             eventCtl->Request( aReq.iEventName, aReq.SrcId(),
       
  1505                                SETID( iStifTFwIf->DevId(), 0 ) );
       
  1506 
       
  1507             aResp.AppendId( aReq.DstId() );
       
  1508             aResp.AppendId( aReq.SrcId() );
       
  1509             aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
       
  1510             aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRequest );
       
  1511             aResp.Append( CStifTFwIfProt::EventStatus,
       
  1512                          CStifTFwIfProt::EEventActive );
       
  1513             aResp.Append( aReq.iEventName );
       
  1514 
       
  1515             }
       
  1516             break;
       
  1517         case CStifTFwIfProt::ECmdRelease:
       
  1518             {
       
  1519             RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl ECmdRelease "));
       
  1520             TInt count = iEventArray.Count();
       
  1521             TInt index = 0;
       
  1522             for(; index < count; index++ )
       
  1523                 {
       
  1524                 if( ( iEventArray[index]->EventName() == aReq.iEventName ) &&
       
  1525                     ( iEventArray[index]->Master() == aReq.SrcId() ) )
       
  1526                     {
       
  1527                     // Found correct event
       
  1528                     CUIEngineEvent* eventCtl = iEventArray[index];
       
  1529                     eventCtl->Release();
       
  1530                     iEventArray.Remove(index);
       
  1531                     delete eventCtl;
       
  1532                     break;
       
  1533                     }
       
  1534                 }
       
  1535             if( index == count )
       
  1536                 {
       
  1537                 return KErrNotFound;
       
  1538                 }
       
  1539 
       
  1540             aResp.AppendId( aReq.DstId() );
       
  1541             aResp.AppendId( aReq.SrcId() );
       
  1542             aResp.Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
       
  1543             aResp.Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRelease );
       
  1544             aResp.Append( aReq.iEventName );
       
  1545 
       
  1546             }
       
  1547             break;
       
  1548         default:
       
  1549             RDebug::Print(_L("CStifTFw::AtsRemoteEventCtl NotSupported"));
       
  1550             return KErrNotSupported;
       
  1551         }
       
  1552 
       
  1553     return KErrNone;
       
  1554 
       
  1555     }
       
  1556 
       
  1557 /*
       
  1558 -------------------------------------------------------------------------------
       
  1559 
       
  1560     Class: CStifTFw
       
  1561 
       
  1562     Method: TestExecuted
       
  1563 
       
  1564     Description:
       
  1565 
       
  1566     Parameters: CUIEngineContainer* aContainer: Address of current
       
  1567                 CUIEngineContainer is test case ID.
       
  1568 
       
  1569                 TFullTestResult& aFullTestResult: in: Test result of executed test case
       
  1570 
       
  1571     Return Values: TInt KErrNone: Always returned KErrNone
       
  1572 
       
  1573     Errors/Exceptions: None
       
  1574 
       
  1575     Status: Draft
       
  1576 
       
  1577 -------------------------------------------------------------------------------
       
  1578 */
       
  1579 EXPORT_C void CStifTFw::TestExecuted( CUIEngineContainer* aContainer,
       
  1580                                         TFullTestResult& aFullTestResult )
       
  1581     {
       
  1582     RDebug::Print(_L("CStifTFw::TestExecuted"));
       
  1583     TInt testExecutionResult = aFullTestResult.iCaseExecutionResultCode;
       
  1584     TTestResult testResult = aFullTestResult.iTestResult;
       
  1585 
       
  1586     // Find Container from test execution table
       
  1587     TInt index = iTestExecutionTable.Find( aContainer );
       
  1588     if( index >= 0 )
       
  1589         {
       
  1590         // Remove Container from test case execution table
       
  1591         iTestExecutionTable.Remove( index );
       
  1592 
       
  1593         iStifTFwIf->TestCompleted( (TInt)aContainer, testExecutionResult, testResult );
       
  1594         __TRACE( KPrint, ( _L( "CStifTFw::TestExecuted. TestID %d  executed"), (TInt)aContainer ) );
       
  1595         }
       
  1596      else
       
  1597         {
       
  1598         // Find Container from test remote execution table
       
  1599         index = iTestRemoteExecutionTable.Find( aContainer );
       
  1600         // Check if test id is found from remote tests
       
  1601         if( index >= 0 )
       
  1602             {
       
  1603             // Remove Container from test case execution table
       
  1604             iTestRemoteExecutionTable.Remove( index );
       
  1605 
       
  1606             CStifTFwIfProt* resp = NULL;
       
  1607             TRAPD( err, resp = CStifTFwIfProt::NewL() );
       
  1608             if( err != KErrNone )
       
  1609                 {
       
  1610                 // oom
       
  1611                 return;
       
  1612                 }
       
  1613 
       
  1614             // Create response
       
  1615             TRAP( err, resp->CreateL(); );
       
  1616             if( err != KErrNone )
       
  1617                 {
       
  1618                 delete resp;
       
  1619                 // Oom
       
  1620                 return;
       
  1621                 }
       
  1622             resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgResponse );
       
  1623             resp->AppendId( SETID( iStifTFwIf->DevId(), TESTID( (TInt) aContainer ) ) );
       
  1624             resp->AppendId( aContainer->RemoteId() );
       
  1625             resp->Append( CStifTFwIfProt::MsgType, CStifTFwIfProt::EMsgRemote );
       
  1626             resp->Append( CStifTFwIfProt::CmdType, CStifTFwIfProt::ECmdRun );
       
  1627             resp->Append( CStifTFwIfProt::RunStatus,
       
  1628                          CStifTFwIfProt::ERunReady );
       
  1629             if( testExecutionResult != KErrNone )
       
  1630                 {
       
  1631                 resp->Append( CStifTFwIfProt::RunStatusParams,
       
  1632                              CStifTFwIfProt::ERunResult,
       
  1633                              testExecutionResult );
       
  1634                 switch( aFullTestResult.iCaseExecutionResultType )
       
  1635                     {
       
  1636                     case TFullTestResult::ECasePanic:
       
  1637                         resp->Append( CStifTFwIfProt::RunStatusParams,
       
  1638                                      CStifTFwIfProt::ERunCategory,
       
  1639                                      CStifTFwIfProt::ResultCategory,
       
  1640                                      CStifTFwIfProt::EResultPanic );
       
  1641                         break;
       
  1642                     case TFullTestResult::ECaseTimeout:
       
  1643                         resp->Append( CStifTFwIfProt::RunStatusParams,
       
  1644                                      CStifTFwIfProt::ERunCategory,
       
  1645                                      CStifTFwIfProt::ResultCategory,
       
  1646                                      CStifTFwIfProt::EResultTimeout );
       
  1647                         break;
       
  1648                     case TFullTestResult::ECaseLeave:
       
  1649                         resp->Append( CStifTFwIfProt::RunStatusParams,
       
  1650                                      CStifTFwIfProt::ERunCategory,
       
  1651                                      CStifTFwIfProt::ResultCategory,
       
  1652                                      CStifTFwIfProt::EResultLeave );
       
  1653                         break;
       
  1654                     case TFullTestResult::ECaseException:
       
  1655                         resp->Append( CStifTFwIfProt::RunStatusParams,
       
  1656                                      CStifTFwIfProt::ERunCategory,
       
  1657                                      CStifTFwIfProt::ResultCategory,
       
  1658                                      CStifTFwIfProt::EResultException );
       
  1659                         break;
       
  1660                     default:
       
  1661                         // The rest are normal execution results
       
  1662                         break;
       
  1663                     }
       
  1664                 }
       
  1665             else
       
  1666                 {
       
  1667                 resp->Append( CStifTFwIfProt::RunStatusParams,
       
  1668                              CStifTFwIfProt::ERunResult,
       
  1669                              testResult.iResult );
       
  1670                 }
       
  1671 
       
  1672             iStifTFwIf->AtsSend( resp->Message() );
       
  1673             __TRACE( KPrint, ( _L( "TestExecuted: %x"), TESTID(aContainer) ) );
       
  1674             delete resp;
       
  1675             }
       
  1676         }
       
  1677 
       
  1678     if( index >= 0 )
       
  1679         {
       
  1680         __TRACE( KPrint, ( _L( "Execution result %d"), testExecutionResult ) );
       
  1681         __TRACE( KPrint, ( _L( "Test result(%S) %d"), &testResult.iResultDes, testResult.iResult ) );
       
  1682         }
       
  1683     else
       
  1684         {
       
  1685         __TRACE( KPrint, ( _L( "CStifTFw::TestExecuted. Container not found: TestId = %d"),
       
  1686             (TInt)aContainer ) );
       
  1687         User::Panic( _L("CStifTFw"), KErrNotFound );
       
  1688         }
       
  1689 
       
  1690     }
       
  1691 
       
  1692 /*
       
  1693 -------------------------------------------------------------------------------
       
  1694 
       
  1695     Class: CStifTFw
       
  1696 
       
  1697     Method: PrintProg
       
  1698 
       
  1699     Description:
       
  1700 
       
  1701     Parameters: CUIEngineContainer* aContainer: in: Address of current
       
  1702                 CUIEngineContainer is test case ID
       
  1703 
       
  1704                 TTestProgress& aProgress: in: Progress information from test case
       
  1705 
       
  1706     Return Values: TInt KErrNone: Always returned KErrNone
       
  1707 
       
  1708     Errors/Exceptions: None
       
  1709 
       
  1710     Status: Draft
       
  1711 
       
  1712 -------------------------------------------------------------------------------
       
  1713 */
       
  1714 EXPORT_C TInt CStifTFw::PrintProg( CUIEngineContainer* aContainer,
       
  1715                                      TTestProgress& aProgress )
       
  1716     {
       
  1717     RDebug::Print(_L("CStifTFw::PrintProg"));
       
  1718 
       
  1719     if( aContainer == NULL )
       
  1720         {
       
  1721         return KErrArgument;
       
  1722         }
       
  1723     if( ( aProgress.iDescription.Length() == 0 ) &&
       
  1724         ( aProgress.iText.Length() == 0 ) )
       
  1725 
       
  1726         {
       
  1727         return KErrArgument;
       
  1728         }
       
  1729 
       
  1730 //Stif-50 - the following code has been commented out to get messages on slave
       
  1731 //    // Find Container from test execution table and remove it
       
  1732 //    TInt index = iTestExecutionTable.Find(aContainer);
       
  1733 //
       
  1734 //    // Check if test id is found
       
  1735 //    if( index >= 0 )
       
  1736 //        {
       
  1737 //        // Forward if found, prints are not forwarded from slave to master
       
  1738         iStifTFwIf->Print( (TInt)aContainer, aProgress );
       
  1739 //        }
       
  1740 
       
  1741     return KErrNone;
       
  1742 
       
  1743     }
       
  1744 
       
  1745 /*
       
  1746 -------------------------------------------------------------------------------
       
  1747 
       
  1748     Class: CStifTFw
       
  1749 
       
  1750     Method: RemoteMsg
       
  1751 
       
  1752     Description:
       
  1753 
       
  1754     Parameters: const TDesC& aMessage: in: Remote message
       
  1755 
       
  1756     Return Values: None
       
  1757 
       
  1758     Errors/Exceptions: None
       
  1759 
       
  1760     Status: Draft
       
  1761 
       
  1762 -------------------------------------------------------------------------------
       
  1763 */
       
  1764 EXPORT_C TInt CStifTFw::RemoteMsg( CUIEngineContainer* /*aContainer*/,
       
  1765                                      const TDesC& aMessage)
       
  1766     {
       
  1767     RDebug::Print(_L("CStifTFw::RemoteMsg"));
       
  1768 
       
  1769     if( aMessage.Length() == 0 )
       
  1770         {
       
  1771         return KErrArgument;
       
  1772         }
       
  1773     // Forward message
       
  1774     iStifTFwIf->AtsSend( aMessage );
       
  1775 
       
  1776     return KErrNone;
       
  1777 
       
  1778     }
       
  1779 
       
  1780 /*
       
  1781 -------------------------------------------------------------------------------
       
  1782 
       
  1783     Class: CStifTFw
       
  1784 
       
  1785     Method: RemoteMsg
       
  1786 
       
  1787     Description:
       
  1788 
       
  1789     Parameters: const TDesC& aMessage: in: Remote message
       
  1790 
       
  1791     Return Values: None
       
  1792 
       
  1793     Errors/Exceptions: None
       
  1794 
       
  1795     Status: Draft
       
  1796 
       
  1797 -------------------------------------------------------------------------------
       
  1798 */
       
  1799 EXPORT_C TInt CStifTFw::GoingToReboot( CUIEngineContainer* /*aContainer*/,
       
  1800                                          TRequestStatus& aStatus )
       
  1801     {
       
  1802     RDebug::Print(_L("CStifTFw::GoingToReboot"));
       
  1803 
       
  1804     aStatus = KRequestPending;
       
  1805     // Forward reboot indication
       
  1806     iStifTFwIf->GoingToDoReset();
       
  1807     TRequestStatus* rs = &aStatus;
       
  1808     User::RequestComplete( rs, KErrNone );
       
  1809 
       
  1810     return KErrNone;
       
  1811 
       
  1812     }
       
  1813     
       
  1814 /*
       
  1815 -------------------------------------------------------------------------------
       
  1816 
       
  1817     Class: CStifTFw
       
  1818 
       
  1819     Method: DeleteData
       
  1820 
       
  1821     Description: Delete arrays before closing session to test engine server
       
  1822 
       
  1823     Parameters: None
       
  1824 
       
  1825     Return Values: None
       
  1826 
       
  1827     Errors/Exceptions: None
       
  1828 
       
  1829     Status: Draft
       
  1830 
       
  1831 -------------------------------------------------------------------------------
       
  1832 */
       
  1833 void CStifTFw::DeleteData()
       
  1834     {
       
  1835     RDebug::Print(_L("CStifTFw::DeleteData resetting iTestExecutionTable cnt=%d"), iTestExecutionTable.Count());
       
  1836     iTestExecutionTable.Reset();
       
  1837     RDebug::Print(_L("CStifTFw::DeleteData resetting iTestRemoteExecutionTable cnt=%d"), iTestRemoteExecutionTable.Count());
       
  1838     iTestRemoteExecutionTable.Reset();
       
  1839     RDebug::Print(_L("CStifTFw::DeleteData resetting iEventArray cnt=%d"), iEventArray.Count());
       
  1840     iEventArray.ResetAndDestroy();
       
  1841     RDebug::Print(_L("CStifTFw::DeleteData resetting iMasterArray cnt=%d"), iMasterArray.Count());
       
  1842     iMasterArray.Reset();
       
  1843     }
       
  1844 
       
  1845 // End of File