localconnectivityservice/generichid/tsrc/GenericHidTest/src/timer.cpp
branchRCL_3
changeset 19 0aa8cc770c8a
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
       
     1 /*
       
     2 * Copyright (c) 2007-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:  HID Heaset plugin timeouttimer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "timer.h"
       
    20 
       
    21 // ======== MEMBER FUNCTIONS ========
       
    22 // ---------------------------------------------------------------------------
       
    23 // NewL
       
    24 // ---------------------------------------------------------------------------
       
    25 //
       
    26 CWaitTimer* CWaitTimer::NewL( TTimeIntervalMicroSeconds32 aTimeOutTime )
       
    27     {
       
    28     CWaitTimer* self = CWaitTimer::NewLC( aTimeOutTime );
       
    29     CleanupStack::Pop(self);
       
    30     return self;
       
    31     }
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // NewLC
       
    35 // ---------------------------------------------------------------------------
       
    36 //    
       
    37 CWaitTimer* CWaitTimer::NewLC( TTimeIntervalMicroSeconds32 aTimeOutTime )
       
    38     {
       
    39     CWaitTimer* self = new (ELeave) CWaitTimer();
       
    40     CleanupStack::PushL(self);
       
    41     self->ConstructL( aTimeOutTime );
       
    42     return self;
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CTimeOutTimer()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CWaitTimer::CWaitTimer():
       
    50     CTimer( EPriorityStandard )    
       
    51     {
       
    52     }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // Destructor
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 CWaitTimer::~CWaitTimer()
       
    59     {
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // ConstructL()
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 void CWaitTimer::ConstructL( TTimeIntervalMicroSeconds32 aTimeOutTime  )
       
    67     {
       
    68     CTimer::ConstructL();
       
    69     CActiveScheduler::Add(this);
       
    70     After( aTimeOutTime );
       
    71     iSyncWaiter.Start();
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // From class CActive
       
    76 // RunL()
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CWaitTimer::RunL()
       
    80     {
       
    81     // Timer request has completed, so notify the timer's owner
       
    82     iSyncWaiter.AsyncStop();
       
    83     }