IMPSengine/client/src/impshandlertimer.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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: 
       
    15 * timer class for imps handler.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    <e32std.h>
       
    22 #include    <flogger.h>
       
    23 #include    "impsutils.h"
       
    24 #include    "impshandler.h"
       
    25 #include    "impshandlertimer.h"
       
    26 
       
    27 // MACROS
       
    28 #ifndef _DEBUG
       
    29 #define _NO_IMPS_LOGGING_
       
    30 #endif
       
    31 
       
    32 const TInt KWaitTime = 5;
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CImpsHandlerTimer::Start
       
    36 // -----------------------------------------------------------------------------
       
    37 CImpsHandlerTimer::CImpsHandlerTimer(
       
    38     TInt aPriority,
       
    39     CImpsHandler2& aHandler ) 
       
    40     : CActive( aPriority ),
       
    41       iHandler( aHandler )
       
    42     {
       
    43 #ifndef _NO_IMPS_LOGGING_
       
    44     CImpsClientLogger::Log(_L("CImpsHandlerTimer: Constructor"));
       
    45 #endif    
       
    46     // Add this to the scheduler
       
    47     (void) iTimer.CreateLocal();
       
    48     CActiveScheduler::Add(this);
       
    49     }
       
    50 
       
    51 CImpsHandlerTimer::~CImpsHandlerTimer()
       
    52     {
       
    53     Cancel();
       
    54     iTimer.Close();
       
    55 #ifndef _NO_IMPS_LOGGING_
       
    56     CImpsClientLogger::Log(_L("CImpsHandlerTimer: Destructor"));
       
    57 #endif        
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CImpsHandlerTimer::Start
       
    62 // -----------------------------------------------------------------------------
       
    63 void CImpsHandlerTimer::Start( )
       
    64     {
       
    65     if ( IsActive() )
       
    66     	{
       
    67     	return;
       
    68     	}
       
    69 #ifndef _NO_IMPS_LOGGING_
       
    70     CImpsClientLogger::Log(_L("CImpsHandlerTimer: Start"));
       
    71 #endif
       
    72     iTimer.After( iStatus, KWaitTime * 1000000 );
       
    73     iStatus = KRequestPending;
       
    74     SetActive();
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CImpsHandlerTimer::RunL
       
    79 // -----------------------------------------------------------------------------
       
    80 void CImpsHandlerTimer::RunL()
       
    81     {
       
    82 #ifndef _NO_IMPS_LOGGING_
       
    83     CImpsClientLogger::Log(_L("CImpsHandlerTimer: RunL, calling EventHandled"));
       
    84 #endif  
       
    85     iHandler.StartRun();  
       
    86     iHandler.EventHandled();
       
    87     }
       
    88     
       
    89 // -----------------------------------------------------------------------------
       
    90 // CImpsHandlerTimer::DoCancel
       
    91 // -----------------------------------------------------------------------------
       
    92 void CImpsHandlerTimer::DoCancel()
       
    93     {
       
    94     iTimer.Cancel();
       
    95     }
       
    96 
       
    97 //  End of File  
       
    98 
       
    99 
       
   100 
       
   101