testexecfw/useremul/src/CameraAppTimer.cpp
changeset 0 3e07fef1e154
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/useremul/src/CameraAppTimer.cpp	Mon Mar 08 15:03:44 2010 +0800
@@ -0,0 +1,89 @@
+/*------------------------------------------------------------------
+ -
+ * Software Name : UserEmulator
+ * Version       : v4.2.1309
+ * 
+ * Copyright (c) 2009 France Telecom. All rights reserved.
+ * This software is distributed under the License 
+ * "Eclipse Public License - v 1.0" the text of which is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * France Telecom 
+ *
+ * Contributors:
+ *------------------------------------------------------------------
+ -
+ * File Name: CameraAppTimer.cpp
+ * 
+ * Created: 13/08/2009
+ * Author(s): Marcell Kiss
+ *   
+ * Description:
+ * Camera app's timer CActive class
+ *------------------------------------------------------------------
+ -
+ *
+ */
+ 
+// User Includes
+#include "CameraAppTimer.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CCameraAppTimer::CCameraAppTimer(MCameraAppObserver& aNotify)
+:CActive(EPriorityNormal),iNotify(aNotify)
+{
+}
+ 
+CCameraAppTimer::~CCameraAppTimer()
+{	
+	Cancel();
+	iTimer.Close();
+}
+ 
+CCameraAppTimer* CCameraAppTimer::NewL(MCameraAppObserver& aNotify)
+{
+	CCameraAppTimer* me = new (ELeave) CCameraAppTimer(aNotify);
+    CleanupStack::PushL(me);
+	me->ConstructL();
+	CleanupStack::Pop(me);
+    return me;
+}
+// ----------------------------------------------------------
+// Second phase constructor
+// ----------------------------------------------------------
+// 
+void CCameraAppTimer::ConstructL(void)
+{
+	CActiveScheduler::Add(this);
+	iTimer.CreateLocal();
+}
+
+// ----------------------------------------------------------
+// Set timer
+// ----------------------------------------------------------
+//
+void CCameraAppTimer::After(TTimeIntervalMicroSeconds32 aInterval)
+{
+	Cancel();
+	iTimer.After(iStatus,aInterval);
+	SetActive();
+}
+// ----------------------------------------------------------
+// Cancel timer
+// ----------------------------------------------------------
+//
+void CCameraAppTimer::DoCancel()
+{
+	iTimer.Cancel();
+}
+ 
+// ----------------------------------------------------------
+// Notifies AppUi that timer expired
+// ----------------------------------------------------------
+//
+void CCameraAppTimer::RunL()
+{
+	iNotify.CheckCameraAppL();
+}