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