htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/timeouttimer.cpp
changeset 0 d6fe6244b863
child 3 2703485a934c
equal deleted inserted replaced
-1:000000000000 0:d6fe6244b863
       
     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:  Timer.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "TimeOutTimer.h"
       
    21 #include "TimeOutNotifier.h"
       
    22 #include "HtiBtEngineLogging.h"
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 CTimeOutTimer* CTimeOutTimer::NewL( const TInt aPriority,
       
    26                                     MTimeOutNotifier& aTimeOutNotify )
       
    27     {
       
    28     CTimeOutTimer* self = new ( ELeave ) CTimeOutTimer( aPriority,
       
    29                                                         aTimeOutNotify );
       
    30     CleanupStack::PushL( self );
       
    31     self->ConstructL();
       
    32     CleanupStack::Pop( self );
       
    33     return self;
       
    34     }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 CTimeOutTimer::CTimeOutTimer( const TInt aPriority,
       
    38                               MTimeOutNotifier& aObserver )
       
    39 : CTimer( aPriority ), iObserver( aObserver )
       
    40     {
       
    41     // No implementation required
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 void CTimeOutTimer::ConstructL()
       
    46     {
       
    47     CTimer::ConstructL();
       
    48     CActiveScheduler::Add( this );
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 CTimeOutTimer::~CTimeOutTimer()
       
    53     {
       
    54     // No implementation required
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 void CTimeOutTimer::RunL()
       
    59     {
       
    60     // Timer request has completed, so notify the timer's owner
       
    61     if ( iStatus == KErrNone )
       
    62         {
       
    63         iObserver.TimerExpired();
       
    64         }
       
    65     else
       
    66         {
       
    67         LOGFMT_E("CTimeOutTimer: bad completion code: %d", iStatus.Int())
       
    68         }
       
    69     }
       
    70 
       
    71 // End of File