localconnectivityservice/lcstylustap/src/forcedismounttimer.cpp
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     1 /*
       
     2 * Copyright (c) 2006 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:  LC stylustap force unmount timeouttimer
       
    15 */
       
    16 
       
    17 #include "debug.h"
       
    18 #include "forcedismounttimer.h"
       
    19 
       
    20 
       
    21 const TInt KForceDismountTimeOut   = 6000000; // 6 seconds
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 // ---------------------------------------------------------------------------
       
    25 // NewL
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CForceDismountTimer* CForceDismountTimer::NewL( MTimerNotifier* aTimeOutNotify)
       
    29     {
       
    30     TRACE_FUNC    
       
    31     CForceDismountTimer* self = CForceDismountTimer::NewLC( aTimeOutNotify );
       
    32     CleanupStack::Pop(self);
       
    33     return self;
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // NewLC
       
    38 // ---------------------------------------------------------------------------
       
    39 //    
       
    40 CForceDismountTimer* CForceDismountTimer::NewLC( MTimerNotifier* aTimeOutNotify )
       
    41     {
       
    42     TRACE_FUNC    
       
    43     CForceDismountTimer* self = new (ELeave) CForceDismountTimer( aTimeOutNotify );
       
    44     CleanupStack::PushL(self);
       
    45     self->ConstructL();
       
    46     return self;
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CTimeOutTimer()
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CForceDismountTimer::CForceDismountTimer( MTimerNotifier* aTimeOutNotify):
       
    54     CTimer(EPriorityStandard), 
       
    55     iNotify(aTimeOutNotify)    
       
    56     {
       
    57     TRACE_FUNC    
       
    58     }    
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // Destructor
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CForceDismountTimer::~CForceDismountTimer()
       
    65     {
       
    66     TRACE_FUNC    
       
    67     Cancel();
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // ConstructL()
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 void CForceDismountTimer::ConstructL()
       
    75     {
       
    76     TRACE_FUNC    
       
    77     if ( !iNotify )    
       
    78         {
       
    79         User::Leave(KErrArgument);    
       
    80         }
       
    81     CTimer::ConstructL();
       
    82     CActiveScheduler::Add(this);
       
    83     After( KForceDismountTimeOut );
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // From class CActive
       
    88 // RunL()
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CForceDismountTimer::RunL()
       
    92     {
       
    93     TRACE_FUNC    
       
    94     // Timer request has completed, so notify the timer's owner
       
    95     iNotify->TimerExpired();
       
    96     }