stif/TestCombiner/src/TestCombinerUtils.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: This module contains the implementation of 
       
    15 * CStartInfo class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <f32file.h>
       
    22 #include <StifLogger.h>
       
    23 #include "TestCombinerUtils.h"
       
    24 #include "Logging.h"
       
    25 
       
    26 // EXTERNAL DATA STRUCTURES
       
    27 // None
       
    28 
       
    29 // EXTERNAL FUNCTION PROTOTYPES  
       
    30 // None
       
    31 
       
    32 // CONSTANTS
       
    33 // None
       
    34 
       
    35 // MACROS
       
    36 #ifdef LOGGER
       
    37 #undef LOGGER
       
    38 #endif
       
    39 #define LOGGER iLog
       
    40 
       
    41 // LOCAL CONSTANTS AND MACROS
       
    42 // None
       
    43  
       
    44 // MODULE DATA STRUCTURES
       
    45 // None
       
    46 
       
    47 // LOCAL FUNCTION PROTOTYPES
       
    48 // None
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 // None
       
    52 
       
    53 // ==================== LOCAL FUNCTIONS =======================================
       
    54 // None
       
    55 
       
    56 // ================= MEMBER FUNCTIONS =========================================
       
    57 
       
    58 /*
       
    59 -------------------------------------------------------------------------------
       
    60 
       
    61      Class: CStartInfo
       
    62 
       
    63      Method: CStartInfo
       
    64 
       
    65      Description: Default constructor
       
    66 
       
    67      C++ default constructor can NOT contain any code, that
       
    68      might leave.
       
    69      
       
    70      Parameters: None
       
    71 
       
    72      Return Values: None
       
    73 
       
    74      Errors/Exceptions: None
       
    75 
       
    76      Status: Draft
       
    77     
       
    78 -------------------------------------------------------------------------------
       
    79 */
       
    80 CStartInfo::CStartInfo():
       
    81     iModule(0,0),
       
    82     iCaseNum(0),
       
    83     iExpectedResult(0),
       
    84     iTimeout(0),
       
    85     iModuleBuf(0),
       
    86     iIniFileBuf(0),
       
    87     iConfigBuf(0),
       
    88     iTestIdBuf(0),
       
    89     iTitleBuf(0),
       
    90 	iTestCaseArgumentsBuf(0)
       
    91     {
       
    92 
       
    93     iCategory = TFullTestResult::ECaseExecuted; 
       
    94 
       
    95     };
       
    96      
       
    97 /*
       
    98 -------------------------------------------------------------------------------
       
    99 
       
   100      Class: CStartInfo
       
   101 
       
   102      Method: ConstructL
       
   103 
       
   104      Description: Symbian OS second phase constructor
       
   105 
       
   106      Symbian OS default constructor can leave.
       
   107 
       
   108      Parameters:    None
       
   109      
       
   110      Return Values: None
       
   111 
       
   112      Errors/Exceptions: None
       
   113 
       
   114      Status: Draft
       
   115     
       
   116 -------------------------------------------------------------------------------
       
   117 */
       
   118 void CStartInfo::ConstructL()
       
   119     {    
       
   120     }
       
   121 
       
   122 /*
       
   123 -------------------------------------------------------------------------------
       
   124 
       
   125      Class: CStartInfo
       
   126 
       
   127      Method: NewL
       
   128 
       
   129      Description: Two-phased constructor.
       
   130           
       
   131      Parameters:    None
       
   132      
       
   133      Return Values: CStartInfo*: new object
       
   134 
       
   135      Errors/Exceptions: Leaves if new or ConstructL leaves.
       
   136 
       
   137      Status: Draft
       
   138     
       
   139 -------------------------------------------------------------------------------
       
   140 */
       
   141 CStartInfo* CStartInfo::NewL()
       
   142     {
       
   143 
       
   144     CStartInfo* self = new (ELeave) CStartInfo();
       
   145      
       
   146     CleanupStack::PushL( self );
       
   147     self->ConstructL();
       
   148     CleanupStack::Pop();
       
   149 
       
   150     return self;
       
   151 
       
   152     }    
       
   153     
       
   154 /*
       
   155 -------------------------------------------------------------------------------
       
   156 
       
   157      Class: CStartInfo
       
   158 
       
   159      Method: ~CStartInfo
       
   160 
       
   161      Description: Destructor
       
   162      
       
   163      Parameters:    None
       
   164 
       
   165      Return Values: None
       
   166 
       
   167      Errors/Exceptions: None
       
   168 
       
   169      Status: Draft
       
   170     
       
   171 -------------------------------------------------------------------------------
       
   172 */     
       
   173 CStartInfo::~CStartInfo()
       
   174     {
       
   175 
       
   176     delete iModuleBuf;
       
   177     delete iIniFileBuf;
       
   178     delete iConfigBuf;
       
   179     delete iTestIdBuf;
       
   180     delete iTitleBuf;
       
   181 	delete iTestCaseArgumentsBuf;
       
   182     }
       
   183 
       
   184 /*
       
   185 -------------------------------------------------------------------------------
       
   186 
       
   187      Class: CStartInfo
       
   188 
       
   189      Method: SetModuleNameL
       
   190 
       
   191      Description: Set module name.
       
   192      
       
   193      Parameters: TDesC& aModule: in: Module name 
       
   194                  TInt aExtLength: in: Extra length reserved for buffer
       
   195      
       
   196      Return Values: None
       
   197 
       
   198      Errors/Exceptions: None
       
   199 
       
   200      Status: Proposal
       
   201     
       
   202 -------------------------------------------------------------------------------
       
   203 */
       
   204  void CStartInfo::SetModuleNameL( TDesC& aModule, TInt aExtLength )
       
   205     {
       
   206 
       
   207     iModuleBuf = HBufC::NewL( aModule.Length() + aExtLength );
       
   208     iModule.Set( iModuleBuf->Des() );
       
   209     iModule.Append( aModule );
       
   210     
       
   211     // Remove optional '.DLL' from file name
       
   212     iModule.LowerCase();
       
   213     TParse parse;
       
   214     parse.Set( iModule, NULL, NULL );
       
   215     
       
   216     if ( parse.Ext() == _L(".dll") )
       
   217         {
       
   218         const TInt len = parse.Ext().Length();
       
   219         iModule.Delete ( iModule.Length()-len, len );
       
   220         }
       
   221 
       
   222 
       
   223     };
       
   224             
       
   225 /*
       
   226 -------------------------------------------------------------------------------
       
   227 
       
   228      Class: CStartInfo
       
   229 
       
   230      Method: SetIniFileL
       
   231 
       
   232      Description: Set initialization file name name.
       
   233      
       
   234      Parameters: TDesC& aIni: in: Initialization file name
       
   235      
       
   236      Return Values: None
       
   237 
       
   238      Errors/Exceptions: None
       
   239 
       
   240      Status: Proposal
       
   241     
       
   242 -------------------------------------------------------------------------------
       
   243 */        
       
   244 void CStartInfo::SetIniFileL( TDesC& aIni )
       
   245     {
       
   246 
       
   247     iIniFileBuf = aIni.AllocL();
       
   248     iIniFile.Set( iIniFileBuf->Des() );
       
   249 
       
   250     };
       
   251             
       
   252 /*
       
   253 -------------------------------------------------------------------------------
       
   254 
       
   255      Class: CStartInfo
       
   256 
       
   257      Method: SetConfigL
       
   258 
       
   259      Description: Set configuration file name name.
       
   260      
       
   261      Parameters: TDesC& aConfig: in: Configuration file name
       
   262      
       
   263      Return Values: None
       
   264 
       
   265      Errors/Exceptions: None
       
   266 
       
   267      Status: Proposal
       
   268     
       
   269 -------------------------------------------------------------------------------
       
   270 */        
       
   271 void CStartInfo::SetConfigL( TDesC& aConfig )
       
   272     {
       
   273 
       
   274     iConfigBuf = aConfig.AllocL();
       
   275     iConfig.Set( iConfigBuf->Des() );
       
   276 
       
   277     };
       
   278             
       
   279 /*
       
   280 -------------------------------------------------------------------------------
       
   281 
       
   282      Class: CStartInfo
       
   283 
       
   284      Method: SetTestIdL
       
   285 
       
   286      Description: Set test identifier.
       
   287      
       
   288      Parameters: TDesC& aTestId: in: test identifier
       
   289      
       
   290      Return Values: None
       
   291 
       
   292      Errors/Exceptions: None
       
   293 
       
   294      Status: Proposal
       
   295     
       
   296 -------------------------------------------------------------------------------
       
   297 */        
       
   298 void CStartInfo::SetTestIdL( TDesC& aTestId )
       
   299     {
       
   300 
       
   301     iTestIdBuf = aTestId.AllocL();
       
   302     iTestId.Set( iTestIdBuf->Des() );
       
   303 
       
   304     };
       
   305 
       
   306 /*
       
   307 -------------------------------------------------------------------------------
       
   308 
       
   309      Class: CStartInfo
       
   310 
       
   311      Method: DeleteModuleName
       
   312 
       
   313      Description: Delete module name buffer for creating new module name.
       
   314      
       
   315      Parameters: None
       
   316      
       
   317      Return Values: None
       
   318 
       
   319      Errors/Exceptions: None
       
   320 
       
   321      Status: Proposal
       
   322     
       
   323 -------------------------------------------------------------------------------
       
   324 */        
       
   325 void CStartInfo::DeleteModuleName()
       
   326     {
       
   327     delete iModuleBuf;
       
   328 	iModuleBuf = NULL;
       
   329     };
       
   330 
       
   331 /*
       
   332 -------------------------------------------------------------------------------
       
   333 
       
   334      Class: CStartInfo
       
   335 
       
   336      Method: SetTitleL
       
   337 
       
   338      Description: Set title.
       
   339      
       
   340      Parameters: TDesC& aTitle: in: Test case title
       
   341      
       
   342      Return Values: None
       
   343 
       
   344      Errors/Exceptions: None
       
   345 
       
   346      Status: Proposal
       
   347     
       
   348 -------------------------------------------------------------------------------
       
   349 */        
       
   350 void CStartInfo::SetTitleL(TDesC& aTitle)
       
   351     {
       
   352 
       
   353     iTitleBuf = aTitle.AllocL();
       
   354     iTitle.Set(iTitleBuf->Des());
       
   355     }
       
   356 
       
   357 /*
       
   358 -------------------------------------------------------------------------------
       
   359 
       
   360      Class: CStartInfo
       
   361 
       
   362      Method: SetTestCaseArguments
       
   363 
       
   364      Description: Sets test case arguments
       
   365      
       
   366      Parameters:  const TDesC& aTestCaseArguments: in: test case arguments.
       
   367      
       
   368      Return Values: None
       
   369 
       
   370      Errors/Exceptions: None
       
   371 
       
   372      Status: Proposal
       
   373     
       
   374 -------------------------------------------------------------------------------
       
   375 */        
       
   376 void CStartInfo::SetTestCaseArgumentsL( const TDesC& aTestCaseArguments )
       
   377     {
       
   378     delete iTestCaseArgumentsBuf;
       
   379 	iTestCaseArgumentsBuf = NULL;
       
   380     iTestCaseArgumentsBuf = aTestCaseArguments.AllocL();
       
   381 	iTestCaseArguments.Set( iTestCaseArgumentsBuf->Des() );
       
   382     }
       
   383 
       
   384 
       
   385 /*
       
   386 -------------------------------------------------------------------------------
       
   387 
       
   388     DESCRIPTION
       
   389 
       
   390     This module contains the implementation of CSlaveInfo class 
       
   391     member functions.
       
   392 
       
   393 -------------------------------------------------------------------------------
       
   394 */
       
   395 
       
   396 // ================= MEMBER FUNCTIONS =========================================
       
   397 
       
   398 /*
       
   399 -------------------------------------------------------------------------------
       
   400 
       
   401      Class: CSlaveInfo
       
   402 
       
   403      Method: CSlaveInfo
       
   404 
       
   405      Description: Default constructor
       
   406 
       
   407      C++ default constructor can NOT contain any code, that
       
   408      might leave.
       
   409      
       
   410      Parameters: TUint32 aMaster: in: Master id
       
   411 
       
   412      Return Values: None
       
   413 
       
   414      Errors/Exceptions: None
       
   415 
       
   416      Status: Draft
       
   417     
       
   418 -------------------------------------------------------------------------------
       
   419 */
       
   420 CSlaveInfo::CSlaveInfo( TUint32 aMaster ):
       
   421     iState(ESlaveIdle),
       
   422     iMasterId(aMaster),
       
   423     iSlaveDevId(0)
       
   424     {
       
   425     
       
   426     }
       
   427      
       
   428 /*
       
   429 -------------------------------------------------------------------------------
       
   430 
       
   431      Class: CSlaveInfo
       
   432 
       
   433      Method: ConstructL
       
   434 
       
   435      Description: Symbian OS second phase constructor
       
   436 
       
   437      Symbian OS default constructor can leave.
       
   438 
       
   439      Parameters:    TDesC& aName: in: Slave name
       
   440 
       
   441      Return Values: None
       
   442 
       
   443      Errors/Exceptions: None
       
   444 
       
   445      Status: Draft
       
   446     
       
   447 -------------------------------------------------------------------------------
       
   448 */
       
   449 void CSlaveInfo::ConstructL( TDesC& aName )
       
   450     {    
       
   451 
       
   452     iNameBuf = aName.AllocL();
       
   453     iName.Set( iNameBuf->Des() );
       
   454             
       
   455     }
       
   456 
       
   457 /*
       
   458 -------------------------------------------------------------------------------
       
   459 
       
   460      Class: CSlaveInfo
       
   461 
       
   462      Method: NewL
       
   463 
       
   464      Description: Two-phased constructor.
       
   465           
       
   466      Parameters:    TDesC& aName: in: Slave name
       
   467                     TUint32 aMaster: in: Master id
       
   468 
       
   469      Return Values: CSlaveInfo*: new object
       
   470 
       
   471      Errors/Exceptions: Leaves if new or ConstructL leaves.
       
   472 
       
   473      Status: Draft
       
   474     
       
   475 -------------------------------------------------------------------------------
       
   476 */
       
   477 CSlaveInfo* CSlaveInfo::NewL( TDesC& aName, TUint32 aMaster )
       
   478     {
       
   479 
       
   480     CSlaveInfo* self = new (ELeave) CSlaveInfo( aMaster);
       
   481      
       
   482     CleanupStack::PushL( self );
       
   483     self->ConstructL( aName );
       
   484     CleanupStack::Pop();
       
   485 
       
   486     return self;
       
   487 
       
   488     }    
       
   489     
       
   490 /*
       
   491 -------------------------------------------------------------------------------
       
   492 
       
   493      Class: CSlaveInfo
       
   494 
       
   495      Method: ~CSlaveInfo
       
   496 
       
   497      Description: Destructor
       
   498      
       
   499      Parameters:    None
       
   500 
       
   501      Return Values: None
       
   502 
       
   503      Errors/Exceptions: None
       
   504 
       
   505      Status: Draft
       
   506     
       
   507 -------------------------------------------------------------------------------
       
   508 */     
       
   509 CSlaveInfo::~CSlaveInfo()
       
   510     {
       
   511     
       
   512     iEvents.ResetAndDestroy();
       
   513     iEvents.Close();
       
   514     delete iNameBuf;
       
   515     
       
   516     }
       
   517     
       
   518 /*
       
   519 -------------------------------------------------------------------------------
       
   520 
       
   521      Class: CSlaveInfo
       
   522 
       
   523      Method: GetEvent
       
   524 
       
   525      Description: Returns event with given name.
       
   526 
       
   527      Parameters:  TDesC& aEventName: in; Event name
       
   528 
       
   529      Return Values: TEventTc: Event structure
       
   530 
       
   531      Errors/Exceptions: None
       
   532 
       
   533      Status: Draft
       
   534     
       
   535 -------------------------------------------------------------------------------
       
   536 */
       
   537 TEventTc* CSlaveInfo::GetEvent( TDesC& aEventName )
       
   538     {
       
   539     
       
   540     TInt count = iEvents.Count();
       
   541     for( TInt i = 0; i < count; i++ )
       
   542         {
       
   543         if( iEvents[i]->Name() == aEventName )
       
   544             {
       
   545             return iEvents[i];
       
   546             }
       
   547         }
       
   548     return NULL;
       
   549     
       
   550     }
       
   551     
       
   552 /*
       
   553 -------------------------------------------------------------------------------
       
   554 
       
   555     DESCRIPTION
       
   556 
       
   557     This module contains the implementation of CDefinedValue class 
       
   558     member functions.
       
   559 
       
   560 -------------------------------------------------------------------------------
       
   561 */
       
   562 
       
   563 // ================= MEMBER FUNCTIONS =========================================
       
   564 
       
   565 /*
       
   566 -------------------------------------------------------------------------------
       
   567 
       
   568      Class: CDefinedValue
       
   569 
       
   570      Method: CDefinedValue
       
   571 
       
   572      Description: Default constructor
       
   573 
       
   574      C++ default constructor can NOT contain any code, that
       
   575      might leave.
       
   576      
       
   577      Parameters: None
       
   578 
       
   579      Return Values: None
       
   580 
       
   581      Errors/Exceptions: None
       
   582 
       
   583      Status: Draft
       
   584     
       
   585 -------------------------------------------------------------------------------
       
   586 */
       
   587 CDefinedValue::CDefinedValue()
       
   588     {
       
   589     }
       
   590      
       
   591 /*
       
   592 -------------------------------------------------------------------------------
       
   593 
       
   594      Class: CDefinedValue
       
   595 
       
   596      Method: ConstructL
       
   597 
       
   598      Description: Symbian OS second phase constructor
       
   599 
       
   600      Symbian OS default constructor can leave.
       
   601 
       
   602      Parameters:    TDesC& aName: in: Define name
       
   603                     TDesC& aValue: in: Define value
       
   604 
       
   605      Return Values: None
       
   606 
       
   607      Errors/Exceptions: None
       
   608 
       
   609      Status: Draft
       
   610     
       
   611 -------------------------------------------------------------------------------
       
   612 */
       
   613 void CDefinedValue::ConstructL( TDesC& aName, TDesC& aValue )
       
   614     {    
       
   615 
       
   616     iNameBuf = aName.AllocLC();
       
   617     iName.Set( iNameBuf->Des() );
       
   618     iValueBuf = aValue.AllocLC();
       
   619     iValue.Set( iValueBuf->Des() );
       
   620     CleanupStack::Pop( iValueBuf );
       
   621     CleanupStack::Pop( iNameBuf );
       
   622 
       
   623     }
       
   624 
       
   625 /*
       
   626 -------------------------------------------------------------------------------
       
   627 
       
   628      Class: CDefinedValue
       
   629 
       
   630      Method: NewL
       
   631 
       
   632      Description: Two-phased constructor.
       
   633           
       
   634      Parameters:    TDesC& aName: in: Define name
       
   635                     TDesC& aValue: in: Define value
       
   636 
       
   637      Return Values: CDefinedValue*: new object
       
   638 
       
   639      Errors/Exceptions: Leaves if new or ConstructL leaves.
       
   640 
       
   641      Status: Draft
       
   642     
       
   643 -------------------------------------------------------------------------------
       
   644 */
       
   645 CDefinedValue* CDefinedValue::NewL( TDesC& aName, TDesC& aValue )
       
   646     {
       
   647 
       
   648     CDefinedValue* self = new (ELeave) CDefinedValue();
       
   649      
       
   650     CleanupStack::PushL( self );
       
   651     self->ConstructL( aName, aValue );
       
   652     CleanupStack::Pop();
       
   653 
       
   654     return self;
       
   655 
       
   656     }    
       
   657     
       
   658 /*
       
   659 -------------------------------------------------------------------------------
       
   660 
       
   661      Class: CDefinedValue
       
   662 
       
   663      Method: ~CDefinedValue
       
   664 
       
   665      Description: Destructor
       
   666      
       
   667      Parameters:    None
       
   668 
       
   669      Return Values: None
       
   670 
       
   671      Errors/Exceptions: None
       
   672 
       
   673      Status: Draft
       
   674     
       
   675 -------------------------------------------------------------------------------
       
   676 */     
       
   677 CDefinedValue::~CDefinedValue()
       
   678     {
       
   679     
       
   680     delete iValueBuf;
       
   681     delete iNameBuf;
       
   682     
       
   683     }
       
   684     
       
   685 /*
       
   686 -------------------------------------------------------------------------------
       
   687 
       
   688      Class: CDefinedValue
       
   689 
       
   690      Method: SetValueL
       
   691 
       
   692      Description: Set new define value
       
   693 
       
   694      Parameters:    TDesC& aValue: in: Define value
       
   695 
       
   696      Return Values: None
       
   697 
       
   698      Errors/Exceptions: Leaves on error.
       
   699 
       
   700      Status: Draft
       
   701     
       
   702 -------------------------------------------------------------------------------
       
   703 */
       
   704 void CDefinedValue::SetValueL( TDesC& aValue )
       
   705     {
       
   706     delete iValueBuf;
       
   707     iValueBuf = 0;
       
   708     iValueBuf = aValue.AllocLC();
       
   709     iValue.Set( iValueBuf->Des() );
       
   710     CleanupStack::Pop( iValueBuf );
       
   711     
       
   712     }
       
   713 
       
   714     
       
   715 /*
       
   716 -------------------------------------------------------------------------------
       
   717 
       
   718      Class: CDefinedValue
       
   719 
       
   720      Method: Name
       
   721 
       
   722      Description: Returns define name.
       
   723 
       
   724      Parameters:  None
       
   725 
       
   726      Return Values: TDesC: Define name
       
   727 
       
   728      Errors/Exceptions: None
       
   729 
       
   730      Status: Draft
       
   731     
       
   732 -------------------------------------------------------------------------------
       
   733 */
       
   734 TDesC& CDefinedValue::Name()
       
   735     { 
       
   736     return iName; 
       
   737     }
       
   738         
       
   739 /*
       
   740 -------------------------------------------------------------------------------
       
   741 
       
   742      Class: CDefinedValue
       
   743 
       
   744      Method: Value
       
   745 
       
   746      Description: Returns define value.
       
   747 
       
   748      Parameters:  None
       
   749 
       
   750      Return Values: TDesC: Define value
       
   751 
       
   752      Errors/Exceptions: None
       
   753 
       
   754      Status: Draft
       
   755     
       
   756 -------------------------------------------------------------------------------
       
   757 */
       
   758 TDesC& CDefinedValue::Value()
       
   759     { 
       
   760     return iValue; 
       
   761     }    
       
   762     
       
   763 /*
       
   764 -------------------------------------------------------------------------------
       
   765 
       
   766     DESCRIPTION
       
   767 
       
   768     This module contains the implementation of TEventTc class 
       
   769     member functions. 
       
   770 
       
   771 -------------------------------------------------------------------------------
       
   772 */
       
   773 // MACROS
       
   774 #ifdef LOGGER
       
   775 #undef LOGGER
       
   776 #endif
       
   777 #define LOGGER iLogger
       
   778 
       
   779 // ================= MEMBER FUNCTIONS =========================================
       
   780 
       
   781 /*
       
   782 -------------------------------------------------------------------------------
       
   783 
       
   784      Class: TEventTc
       
   785 
       
   786      Method: TEventTc
       
   787 
       
   788      Description: Default constructor
       
   789 
       
   790      C++ default constructor can NOT contain any code, that
       
   791      might leave.
       
   792      
       
   793      Parameters: None
       
   794      
       
   795      Return Values: None
       
   796 
       
   797      Errors/Exceptions: None
       
   798 
       
   799      Status: Proposal
       
   800     
       
   801 -------------------------------------------------------------------------------
       
   802 */
       
   803 TEventTc::TEventTc( CStifLogger* aLogger ):
       
   804     iReq(NULL),
       
   805     iLogger( aLogger )
       
   806     {
       
   807     __TRACE( KMessage, (_L("TEventTc::TEventTc") ) );
       
   808     }
       
   809         
       
   810 /*
       
   811 -------------------------------------------------------------------------------
       
   812 
       
   813      Class: TEventTc
       
   814 
       
   815      Method: TEventTc
       
   816 
       
   817      Description: Parametric constructor
       
   818 
       
   819      Parameters: None
       
   820      
       
   821      Return Values: None
       
   822 
       
   823      Errors/Exceptions: None
       
   824 
       
   825      Status: Proposal
       
   826     
       
   827 -------------------------------------------------------------------------------
       
   828 */ 
       
   829 TEventTc::TEventTc( TName& aEventName, CStifLogger* aLogger ):
       
   830     iReq(NULL),
       
   831     iLogger( aLogger )
       
   832     {
       
   833     SetName( aEventName );
       
   834     SetType( EReqEvent );
       
   835     __TRACE( KMessage, (_L("TEventTc::TEventTc %S"), &aEventName ) );
       
   836     __TRACE( KMessage, (_L("TEvent::SetType Req") ) );
       
   837     }
       
   838 
       
   839 /*
       
   840 -------------------------------------------------------------------------------
       
   841 
       
   842      Class: TEventTc
       
   843 
       
   844      Method: ~TEventTc
       
   845 
       
   846      Description: Destructor
       
   847 
       
   848      Parameters: None
       
   849      
       
   850      Return Values: None
       
   851 
       
   852      Errors/Exceptions: None
       
   853 
       
   854      Status: Proposal
       
   855     
       
   856 -------------------------------------------------------------------------------
       
   857 */ 
       
   858 TEventTc::~TEventTc()
       
   859     { 
       
   860     __TRACE( KMessage, (_L("TEventTc::~TEventTc %S"), &Name() ) );
       
   861     Complete( KErrNone ); 
       
   862     }
       
   863 /*
       
   864 -------------------------------------------------------------------------------
       
   865 
       
   866      Class: TEventTc
       
   867 
       
   868      Method: SetRequestStatus
       
   869 
       
   870      Description: Set request status member.
       
   871 
       
   872      Parameters: None
       
   873      
       
   874      Return Values: None
       
   875 
       
   876      Errors/Exceptions: None
       
   877 
       
   878      Status: Proposal
       
   879     
       
   880 -------------------------------------------------------------------------------
       
   881 */ 
       
   882 void TEventTc::SetRequestStatus( TRequestStatus* aStatus )
       
   883     { 
       
   884     iReq = aStatus; 
       
   885     *iReq = KRequestPending;
       
   886     __TRACE( KMessage, (_L("TEventTc::SetRequestStatus %S"), &Name() ) );
       
   887     }
       
   888 
       
   889 /*
       
   890 -------------------------------------------------------------------------------
       
   891 
       
   892      Class: TEventTc
       
   893 
       
   894      Method: Complete
       
   895 
       
   896      Description: Complete request status member.
       
   897      
       
   898      Parameters: None
       
   899      
       
   900      Return Values: None
       
   901 
       
   902      Errors/Exceptions: None
       
   903 
       
   904      Status: Proposal
       
   905     
       
   906 -------------------------------------------------------------------------------
       
   907 */ 
       
   908 void TEventTc::Complete( TInt aError )
       
   909     { 
       
   910     if( iReq )
       
   911         { 
       
   912         __TRACE( KMessage, (_L("TEventTc::Complete %S"), &Name() ) );
       
   913         User::RequestComplete(iReq, aError ); 
       
   914         }
       
   915     }
       
   916 
       
   917 /*
       
   918 -------------------------------------------------------------------------------
       
   919 
       
   920      Class: TEventTc
       
   921 
       
   922      Method: SetEvent
       
   923 
       
   924      Description: Set event pending.
       
   925      
       
   926      Parameters: None
       
   927      
       
   928      Return Values: None
       
   929 
       
   930      Errors/Exceptions: None
       
   931 
       
   932      Status: Proposal
       
   933     
       
   934 -------------------------------------------------------------------------------
       
   935 */ 
       
   936 void TEventTc::SetEvent( TEventType aEventType )
       
   937     {
       
   938     __TRACE( KMessage, (_L("TEventTc::SetEvent %S, type %d"),   
       
   939         &Name(), aEventType ) );
       
   940 
       
   941     SetEventType( aEventType );
       
   942     if( iReq )
       
   943         {
       
   944         Complete( KErrNone );
       
   945         if( EventType() == EState )
       
   946             {
       
   947             __TRACE( KMessage, (_L("TEvent::SetType Set") ) );
       
   948             SetType( ESetEvent ) ;
       
   949             }
       
   950         }
       
   951     else 
       
   952         {
       
   953         __TRACE( KMessage, (_L("TEvent::SetType Set") ) );
       
   954         SetType( ESetEvent ) ;
       
   955         }
       
   956     }
       
   957    
       
   958 /*
       
   959 -------------------------------------------------------------------------------
       
   960 
       
   961      Class: TEventTc
       
   962 
       
   963      Method: WaitEvent
       
   964 
       
   965      Description: Wait event.
       
   966      
       
   967      Parameters: None
       
   968      
       
   969      Return Values: None
       
   970 
       
   971      Errors/Exceptions: None
       
   972 
       
   973      Status: Proposal
       
   974     
       
   975 -------------------------------------------------------------------------------
       
   976 */
       
   977 void TEventTc::WaitEvent( TRequestStatus& aStatus )
       
   978     {
       
   979     __TRACE( KMessage, (_L("TEventTc::WaitEvent %S"), &Name() ) );
       
   980     SetRequestStatus( &aStatus );
       
   981     if( Type() == ESetEvent )
       
   982         {
       
   983         Complete( KErrNone );
       
   984         if( EventType() == EIndication )
       
   985             {
       
   986             __TRACE( KMessage, (_L("TEvent::SetType Req") ) );
       
   987             SetType( EReqEvent );
       
   988             }
       
   989         }
       
   990     }
       
   991     
       
   992 // ================= OTHER EXPORTED FUNCTIONS =================================
       
   993 // None
       
   994 
       
   995 // End of File