diff -r 0aa8cc770c8a -r 4a793f564d72 connectivitymodules/SeCon/servers/syncserver/src/cscontimeout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivitymodules/SeCon/servers/syncserver/src/cscontimeout.cpp Wed Sep 01 12:20:56 2010 +0100 @@ -0,0 +1,85 @@ +/* +* 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: CCSconTimeOut implementation +* +*/ + +#include "cscontimeout.h" + +CCSconTimeOut::CCSconTimeOut( MTimeOutObserver& aTimeOutObserver ) : + CActive(EPriorityStandard), // Standard priority + iTimeOutObserver(aTimeOutObserver) + { + } + + +CCSconTimeOut* CCSconTimeOut::NewL( MTimeOutObserver& aTimeOutObserver ) + { + CCSconTimeOut* self = new (ELeave) CCSconTimeOut( aTimeOutObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +void CCSconTimeOut::ConstructL() + { + User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer + CActiveScheduler::Add(this); // Add to scheduler + } + +CCSconTimeOut::~CCSconTimeOut() + { + Cancel(); // Cancel any request, if outstanding + iTimer.Close(); // Destroy the RTimer object + // Delete instance variables if any + } + +void CCSconTimeOut::DoCancel() + { + iTimer.Cancel(); + } + +void CCSconTimeOut::Start(TTimeIntervalMicroSeconds32 aDelay) + { + Cancel(); // Cancel any request, just to be sure + iState = EUninitialized; + iTimer.After(iStatus, aDelay); // Set for later + SetActive(); // Tell scheduler a request is active + } + +void CCSconTimeOut::RunL() + { + /*if (iState == EUninitialized) + { + // Do something the first time RunL() is called + iState = EInitialized; + } + else if (iState != EError) + { + // Do something + } + iTimer.After(iStatus, 1000000); // Set for 1 sec later + SetActive(); // Tell scheduler a request is active*/ + if ( iState == KErrNone ) + { + iTimeOutObserver.TimeOut(); + } + + } + +TInt CCSconTimeOut::RunError(TInt aError) + { + return aError; + }