diff -r 000000000000 -r 8466d47a6819 ipsservices/ipssosaoplugin/src/IpsSosAOPluginTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ipsservices/ipssosaoplugin/src/IpsSosAOPluginTimer.cpp Thu Dec 17 08:39:21 2009 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2008 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: +* Timer for AO Plugin +* +*/ + + +#include "emailtrace.h" +#include "IpsSosAOPluginTimer.h" + +// //internal dependency removed +/*#ifdef _DEBUG +#include "../../internal/IpsSosAOPluginTester/inc/IpsSosAOPluginTester.hrh" +#endif // _DEBUG*/ +// + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +CIpsSosAOPluginTimer* CIpsSosAOPluginTimer::NewL( + TInt aPriority, + MIpsSosAOPluginTimerCallBack& aCallBack ) + { + FUNC_LOG; + CIpsSosAOPluginTimer* self = new( + ELeave ) CIpsSosAOPluginTimer( aPriority, aCallBack ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +CIpsSosAOPluginTimer::CIpsSosAOPluginTimer( + TInt aPriority, + MIpsSosAOPluginTimerCallBack& aCallBack ) + : CActive (aPriority), iCallBack( aCallBack ) + { + FUNC_LOG; + } + + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +CIpsSosAOPluginTimer::~CIpsSosAOPluginTimer() + { + FUNC_LOG; + Cancel(); + iTimer.Close(); + } + + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +void CIpsSosAOPluginTimer::ConstructL() + { + FUNC_LOG; + User::LeaveIfError( iTimer.CreateLocal() ); + CActiveScheduler::Add(this); + } + + + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +void CIpsSosAOPluginTimer::After(const TTimeIntervalSeconds& aSeconds) + { + FUNC_LOG; + Cancel(); + TTime time; + time.HomeTime(); + time = time + aSeconds; + iTimer.At( iStatus, time ); + SetActive(); + +// removing flags +/*#ifdef IPSAOPLUGINTESTER_MBOXLOGICTEST + iTestActivationTime = time; +#endif // IPSAOPLUGINTESTER_MBOXLOGICTEST*/ +// + } + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +void CIpsSosAOPluginTimer::DoCancel() + { + FUNC_LOG; + iTimer.Cancel(); + } + + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +void CIpsSosAOPluginTimer::RunL() + { + FUNC_LOG; + iCallBack.TimerFiredL(); + } + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +// +TInt CIpsSosAOPluginTimer::RunError( TInt /* aError */ ) + { + FUNC_LOG; + // Just ignore any error and continue without + // any handling to allow smooth execution. + return KErrNone; + } + +// removing flags +/*#ifdef IPSAOPLUGINTESTER_MBOXLOGICTEST +// ---------------------------------------------------------------------------- +// TEST USAGE +// ---------------------------------------------------------------------------- +// +TInt CIpsSosAOPluginTimer::GetSecondsToTrick() + { + if ( !IsActive() ) + { + return KErrNotFound; + } + + TTime now; + now.HomeTime(); + TTimeIntervalSeconds secs; + iTestActivationTime.SecondsFrom( now, secs ); + return secs.Int(); + } +#endif // IPSAOPLUGINTESTER_MBOXLOGICTEST*/ +// + +//EOF +