bearermanagement/mpm/src/mpmexpirytimer.cpp
branchRCL_3
changeset 55 fc7b30ed2058
equal deleted inserted replaced
54:984e13af52c4 55:fc7b30ed2058
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Implementation of class CMPMExpiryTimer, a common timer class for MPM.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "mpmexpirytimer.h"
       
    19 #include "mpmexpirytimercallback.h"
       
    20 
       
    21 // ---------------------------------------------------------------------------
       
    22 // Constructs and returns the class object.
       
    23 // ---------------------------------------------------------------------------
       
    24 //
       
    25 CMPMExpiryTimer* CMPMExpiryTimer::NewL( MMPMExpiryTimerCallback& aCallback, TInt aTimeout )
       
    26     {
       
    27     CMPMExpiryTimer* self = new( ELeave ) CMPMExpiryTimer( aCallback, aTimeout );
       
    28     CleanupStack::PushL( self );
       
    29     self->ConstructL();
       
    30     CleanupStack::Pop( self );
       
    31     return self;
       
    32     }
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // Default C++ constructor.
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 
       
    39 CMPMExpiryTimer::CMPMExpiryTimer( MMPMExpiryTimerCallback& aCallback, TInt aTimeout ):
       
    40         CTimer( CActive::EPriorityStandard ),
       
    41         iCallback( aCallback ),
       
    42         iTimeout( aTimeout )
       
    43     {
       
    44     CActiveScheduler::Add( this );
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Symbian 2nd phase constructor.
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 
       
    52 void CMPMExpiryTimer::ConstructL()
       
    53     {
       
    54     CTimer::ConstructL();        
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // RunL, from CTimer, starts up the timer.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 
       
    62 void CMPMExpiryTimer::Start()
       
    63     {
       
    64     After( iTimeout );
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // RunL, from CTimer, called when the timer expires.
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 
       
    72 void CMPMExpiryTimer::RunL()
       
    73     {
       
    74     iCallback.HandleTimedOut();
       
    75     }