imageeditor/src/JpTimer.cpp
changeset 1 edfc90759b9f
equal deleted inserted replaced
0:57d4cdd99204 1:edfc90759b9f
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "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 * Ixonos Plc
       
    14 *
       
    15 * Description: 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "JPTimer.h"
       
    21 #include "MTimerCallBack.h"
       
    22 
       
    23 
       
    24 
       
    25 CJPTimer* CJPTimer::NewL( MTimerCallBack* aCallBack )
       
    26 	{
       
    27 	CJPTimer* self = new( ELeave )CJPTimer( aCallBack );
       
    28 	CleanupStack::PushL( self );
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop( self );
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 
       
    35 
       
    36 CJPTimer::CJPTimer( MTimerCallBack* aCallBack )
       
    37 	: CTimer( EPriorityStandard )
       
    38 	, iCallBack( aCallBack )
       
    39 	{
       
    40 	}
       
    41 
       
    42 
       
    43 
       
    44 void CJPTimer::ConstructL()
       
    45 	{
       
    46 	CTimer::ConstructL();
       
    47 	CActiveScheduler::Add( this );
       
    48 	}
       
    49 
       
    50 
       
    51 
       
    52 CJPTimer::~CJPTimer()
       
    53 	{
       
    54 	Cancel();
       
    55 	}
       
    56 
       
    57 
       
    58 
       
    59 void CJPTimer::RunL()
       
    60 	{
       
    61 	iCalling = false;
       
    62 	iCallBack->TimerCallBack();
       
    63 	}
       
    64 
       
    65 
       
    66 
       
    67 void CJPTimer::Call( TInt aWait )
       
    68 	{
       
    69 	if( iCalling ) return;
       
    70 	iCalling = true;
       
    71 	After( aWait );
       
    72 	}