natfw/tsrc/natfwtestconsoles/natfwtestconsole/src/timeouttimer.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "TimeOutTimer.h"
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 
       
    26 // Constructor
       
    27 CTimeOutTimer::CTimeOutTimer( const TInt aPriority,
       
    28                               MTimeoutNotifier& aNotify)
       
    29 : CTimer( aPriority ), iNotify( aNotify )
       
    30     {
       
    31     
       
    32     }
       
    33 
       
    34 // Destructor
       
    35 CTimeOutTimer::~CTimeOutTimer()
       
    36     {
       
    37     }
       
    38 
       
    39 // ----------------------------------------------------
       
    40 // CTimeOutTimer::ConstructL()
       
    41 // Second-phase constructor
       
    42 // ----------------------------------------------------
       
    43 //
       
    44 void CTimeOutTimer::ConstructL()
       
    45     {
       
    46     CTimer::ConstructL();
       
    47     CActiveScheduler::Add( this );
       
    48     }
       
    49 
       
    50 // ----------------------------------------------------
       
    51 // CTimeOutTimer::NewL()
       
    52 // Two-phased construction.
       
    53 // ----------------------------------------------------
       
    54 //
       
    55 CTimeOutTimer* CTimeOutTimer::NewL( const TInt aPriority,
       
    56                                     MTimeoutNotifier& aNotify )
       
    57     {
       
    58     CTimeOutTimer* self = CTimeOutTimer::NewLC( aPriority, aNotify );
       
    59     CleanupStack::Pop( self );
       
    60     return self;
       
    61     }
       
    62 
       
    63 // ----------------------------------------------------
       
    64 // CTimeOutTimer::NewLC()
       
    65 // Two-phased construction.
       
    66 // ----------------------------------------------------
       
    67 //    
       
    68 CTimeOutTimer* CTimeOutTimer::NewLC( const TInt aPriority,
       
    69                                      MTimeoutNotifier& aNotify )
       
    70     {
       
    71     CTimeOutTimer* self = new (ELeave) CTimeOutTimer( aPriority, aNotify );
       
    72     CleanupStack::PushL( self );
       
    73     self->ConstructL();
       
    74     return self;
       
    75     }
       
    76     
       
    77 // ----------------------------------------------------
       
    78 // CTimeOutTimer::RunL()
       
    79 // Handles an active object’s request completion event.
       
    80 // ----------------------------------------------------
       
    81 //    
       
    82 void CTimeOutTimer::RunL()
       
    83     {
       
    84     if( iStatus == KErrNone )
       
    85         {
       
    86         iNotify.TimerExpired();
       
    87         }
       
    88     else
       
    89         {
       
    90         User::Leave(iStatus.Int());
       
    91         }
       
    92     }
       
    93 
       
    94 TInt CTimeOutTimer::RunError( TInt /*aError*/ )
       
    95     {
       
    96     return KErrNone;
       
    97     }
       
    98     
       
    99 // End of file