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