bluetoothengine/bthid/common/src/timeouttimer.cpp
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2008 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:  This is the implementation of application class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "timeouttimer.h"
       
    20 #include "timeoutnotifier.h"
       
    21 
       
    22 CTimeOutTimer* CTimeOutTimer::NewL(const TInt aPriority,
       
    23         MTimeOutNotifier& aTimeOutNotify)
       
    24     {
       
    25     CTimeOutTimer* self = CTimeOutTimer::NewLC(aPriority, aTimeOutNotify);
       
    26     CleanupStack::Pop(self);
       
    27     return self;
       
    28     }
       
    29 
       
    30 CTimeOutTimer* CTimeOutTimer::NewLC(const TInt aPriority,
       
    31         MTimeOutNotifier& aTimeOutNotify)
       
    32     {
       
    33     CTimeOutTimer* self = new (ELeave) CTimeOutTimer(aPriority,
       
    34             aTimeOutNotify);
       
    35     CleanupStack::PushL(self);
       
    36     self->ConstructL();
       
    37     return self;
       
    38     }
       
    39 
       
    40 CTimeOutTimer::CTimeOutTimer(const TInt aPriority,
       
    41         MTimeOutNotifier& aTimeOutNotify) :
       
    42     CTimer(aPriority), iNotify(aTimeOutNotify)
       
    43     {
       
    44     }
       
    45 
       
    46 CTimeOutTimer::~CTimeOutTimer()
       
    47     {
       
    48     }
       
    49 
       
    50 void CTimeOutTimer::ConstructL()
       
    51     {
       
    52     CTimer::ConstructL();
       
    53     CActiveScheduler::Add(this);
       
    54     }
       
    55 
       
    56 void CTimeOutTimer::RunL()
       
    57     {
       
    58     // Timer request has completed, so notify the timer's owner
       
    59     if (iStatus == KErrNone)
       
    60         {
       
    61         iNotify.TimerExpired();
       
    62         }
       
    63     else
       
    64         {
       
    65         User::Panic(KTimeOutTimerPanic, ETimerFailed);
       
    66         }
       
    67     }