diff -r 2c7f27287390 -r 053c6c7c14f3 idlefw/tsrc/mcsplugin/ut_mcsplugin/caouserafter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlefw/tsrc/mcsplugin/ut_mcsplugin/caouserafter.h Thu Aug 19 10:13:44 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef __CAOUSERAFTER_H__ +#define __CAOUSERAFTER_H__ + +// INCLUDES +#include +#include +#include + + +/** + * Active object version of User::After() + */ +class CAOUserAfter : public CTimer + { + private: + CActiveSchedulerWait iWait; + TInt iLength; + + + public: //new functions + + /** + * Constructs the waiting timer, executes + * it and when timer expires, deletes self. + * @param aLength The lenghth of wait in micro + * seconds. + */ + static void AfterLD( TInt aLenght ) + { + CAOUserAfter* wait= new ( ELeave ) CAOUserAfter( aLenght ); + CleanupStack::PushL( wait ); + wait->ConstructL(); + CleanupStack::Pop(); + + RDebug::Print( _L("CAOUserAfter - Starting time consuming...") ); + wait->StartWaitD(); + RDebug::Print( _L("CAOUserAfter - completed.") ); + } + + private: + CAOUserAfter( TInt aLenght ) + : CTimer( CActive::EPriorityStandard ), + iLength( aLenght ) + { + } + + void ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add( this ); + } + + virtual ~CAOUserAfter() + { + } + + void StartWaitD() + { + After( iLength ); + iWait.Start(); + } + + void RunL() + { + iWait.AsyncStop(); + Cancel(); + delete this; + } + }; + +#endif // __CAOUSERAFTER_H__ + +// End of File