multimediacommsengine/mmcesrv/mmceserver/src/mcecsserverclosetimer.cpp
changeset 0 1bce908db942
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcecsserverclosetimer.cpp	Tue Feb 02 01:04:58 2010 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2005 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:  
+*
+*/
+
+
+
+
+#include "mcecsserverclosetimer.h"
+#include "mcesip.h"
+
+// -----------------------------------------------------------------------------
+// CMceCsServerCloseTimer::NewL
+// -----------------------------------------------------------------------------
+//
+CMceCsServerCloseTimer* CMceCsServerCloseTimer::NewL()
+    {
+    CMceCsServerCloseTimer* self = CMceCsServerCloseTimer::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMceCsServerCloseTimer::NewLC
+// -----------------------------------------------------------------------------
+//
+CMceCsServerCloseTimer* CMceCsServerCloseTimer::NewLC()
+    {
+    CMceCsServerCloseTimer* self = new (ELeave) CMceCsServerCloseTimer;
+    CleanupStack::PushL( self );
+    self->ConstructL ();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMceCsServerCloseTimer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMceCsServerCloseTimer::ConstructL()
+    {
+	User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+// -----------------------------------------------------------------------------
+// CMceCsServerCloseTimer::CMceCsServerCloseTimer
+// -----------------------------------------------------------------------------
+//
+CMceCsServerCloseTimer::CMceCsServerCloseTimer()
+ : CActive( EPriorityStandard )
+    {
+	CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CMceCsServerCloseTimer::~CMceCsServerCloseTimer
+// -----------------------------------------------------------------------------
+//
+CMceCsServerCloseTimer::~CMceCsServerCloseTimer()
+    {
+	CActive::Cancel();
+	iTimer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CMceCsServerCloseTimer::StopActiveSchedulerAfter
+// -----------------------------------------------------------------------------
+//
+void CMceCsServerCloseTimer::StopActiveSchedulerAfter( TUint aMilliSeconds )
+    {
+    if ( !IsActive() )
+        {
+	    TTimeIntervalMicroSeconds32 
+	        timeInterval( KConversionMilliToMicro * aMilliSeconds );
+        iTimer.After(iStatus, timeInterval);
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMceCsServerCloseTimer::RunL
+// -----------------------------------------------------------------------------
+//
+void CMceCsServerCloseTimer::RunL()
+    {
+	CActiveScheduler::Stop();
+    }
+
+// -----------------------------------------------------------------------------
+// CMceCsServerCloseTimer::DoCancel
+// -----------------------------------------------------------------------------
+//	
+void CMceCsServerCloseTimer::DoCancel()
+    {
+	iTimer.Cancel();
+    }