dvrengine/CommonRecordingEngine/src/CCRTimer.cpp
changeset 0 822a42b6c3f1
equal deleted inserted replaced
-1:000000000000 0:822a42b6c3f1
       
     1 /*
       
     2 * Copyright (c) 2007 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 the License "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:    Wrapper for CTimer*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CCRTimer.h"
       
    22 #include "MCRTimerObserver.h"
       
    23 
       
    24 // CONSTANTS
       
    25 // None
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CCRTimer::NewL()
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CCRTimer* CCRTimer::NewL( const TInt aPriority, MCRTimerObserver& aTimerObserver )
       
    34     {
       
    35     CCRTimer* self = CCRTimer::NewLC( aPriority, aTimerObserver );
       
    36     CleanupStack::Pop( self );
       
    37     return self;
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CCRTimer::NewLC()
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CCRTimer* CCRTimer::NewLC( const TInt aPriority, MCRTimerObserver& aTimerObserver )
       
    45     {
       
    46     CCRTimer* self = new (ELeave) CCRTimer( aPriority, aTimerObserver );
       
    47     CleanupStack::PushL( self );
       
    48     self->ConstructL();
       
    49     return self;
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CCRTimer::CCRTimer()
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CCRTimer::CCRTimer( const TInt aPriority, MCRTimerObserver& aTimerObserver )
       
    57   : CTimer( aPriority ), iObserver( aTimerObserver )
       
    58     {
       
    59     // None
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CCRTimer::ConstructL()
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 void CCRTimer::ConstructL()
       
    67     {
       
    68     CTimer::ConstructL();
       
    69     CActiveScheduler::Add( this );
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CCRTimer::~CCRTimer()
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 CCRTimer::~CCRTimer()
       
    77     {
       
    78     Cancel();
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CCRTimer::RunL()
       
    83 // Timer request has completed, so notify the timer's owner.
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 void CCRTimer::RunL()
       
    87     {
       
    88     if ( iStatus == KErrNone )
       
    89         {
       
    90         iObserver.TimerExpired( this );
       
    91         }
       
    92     }
       
    93 
       
    94 //  End of File