testexecfw/useremul/src/DelayTimer.cpp
changeset 0 3e07fef1e154
equal deleted inserted replaced
-1:000000000000 0:3e07fef1e154
       
     1 /*------------------------------------------------------------------
       
     2  -
       
     3  * Software Name : UserEmulator
       
     4  * Version       : v4.2.1309
       
     5  * 
       
     6  * Copyright (c) 2009 France Telecom. All rights reserved.
       
     7  * This software is distributed under the License 
       
     8  * "Eclipse Public License - v 1.0" the text of which is available
       
     9  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10  *
       
    11  * Initial Contributors:
       
    12  * France Telecom 
       
    13  *
       
    14  * Contributors:
       
    15  *------------------------------------------------------------------
       
    16  -
       
    17  * File Name: DelayTimer.cpp
       
    18  * 
       
    19  * Created: 13/08/2009
       
    20  * Author(s): Marcell Kiss, Reshma Sandeep Das
       
    21  *   
       
    22  * Description:
       
    23  * Active object implementation for asynchronous key events handling
       
    24  *------------------------------------------------------------------
       
    25  -
       
    26  *
       
    27  */
       
    28 
       
    29 //System Includes
       
    30 #include <aknnavi.h> 
       
    31 #include <aknnavide.h> 
       
    32 #include <eikspane.h> 
       
    33 #include <aknutils.h>
       
    34 
       
    35 //User Includes
       
    36 #include "DelayTimer.h"
       
    37 
       
    38 // ============================ MEMBER FUNCTIONS ===============================
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CDelayTimer::CDelayTimer()
       
    42 // C++ Default constructor.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 CDelayTimer::CDelayTimer(MActionObserver& aObserver) 
       
    46     : CTimer( CActive::EPriorityStandard),
       
    47       iActionObserver(aObserver)
       
    48 {	 
       
    49 }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CDelayTimer::~CDelayTimer()
       
    53 // Destructor
       
    54 // -----------------------------------------------------------------------------
       
    55 //    
       
    56 CDelayTimer::~CDelayTimer()
       
    57 {
       
    58 	Cancel();   
       
    59 }
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CDelayTimer::ConstructL()
       
    63 // 2nd phase constructor.
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 void CDelayTimer::ConstructL( )
       
    67 {
       
    68     CActiveScheduler::Add( this );
       
    69     CTimer::ConstructL(); 
       
    70 }
       
    71   
       
    72 // -----------------------------------------------------------------------------
       
    73 // CDelayTimer::NewL()
       
    74 // Two-phased constructor.
       
    75 // -----------------------------------------------------------------------------
       
    76 //  
       
    77 CDelayTimer* CDelayTimer::NewL( MActionObserver& aObserver )
       
    78 {
       
    79     CDelayTimer* self = new ( ELeave ) CDelayTimer(aObserver);
       
    80     CleanupStack::PushL( self );
       
    81     self->ConstructL();
       
    82     CleanupStack::Pop( self );
       
    83     return self;    
       
    84 }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CDelayTimer::RunL()
       
    88 // After completed timer period, execution comes to RunL.
       
    89 // -----------------------------------------------------------------------------
       
    90 //  
       
    91 void CDelayTimer::RunL()
       
    92 {  
       
    93     // Handle request completion
       
    94     iActionObserver.PerformActionL();
       
    95 }
       
    96 
       
    97 void CDelayTimer::Wait(TInt aInterval)
       
    98 {
       
    99 	if( !IsActive() )
       
   100 	{
       
   101 		//Wait for specified time interval
       
   102 		CTimer::After(aInterval);
       
   103 		User::ResetInactivityTime();
       
   104 	}
       
   105 }