phoneapp/phoneuicontrol/src/cphonestatemachine.cpp
branchRCL_3
changeset 6 38529f706030
parent 5 2a26698d78ba
child 23 40a3f856b14d
--- a/phoneapp/phoneuicontrol/src/cphonestatemachine.cpp	Mon Mar 15 12:40:24 2010 +0200
+++ b/phoneapp/phoneuicontrol/src/cphonestatemachine.cpp	Wed Mar 31 21:30:06 2010 +0300
@@ -29,6 +29,8 @@
 #include "cphonestateincall.h"
 #include "phonestatedefinitions.h"
 #include "phonelogger.h"
+#include "mphonesecuritymodeobserver.h"
+#include "mphonesecuritymessagehandler.h"
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -55,29 +57,14 @@
     {
 	if( iState == iIdleState )
 		{
-		delete iState;
-		iState = NULL;
+		// Avoid deleting idle state instance twice.
+		// If state is idle, iState points to idle state instance.
 		iIdleState = NULL;			
 		}
-	else
-		{
-	    if( iState )
-		    {
-		    delete iState;
-		    iState = NULL;	    	
-		    }
-		if( iIdleState )
-			{
-		    delete iIdleState;
-		    iIdleState = NULL;			
-			}			
-		}
-	if( iPhoneEngine )
-		{
-	    delete iPhoneEngine;
-	    iPhoneEngine = NULL;			
-		}
-    }
+	delete iState;
+	delete iIdleState;
+	delete iPhoneEngine;
+	}
 
 // ---------------------------------------------------------
 // CPhoneStateMachine::SetPhoneEngine
@@ -176,4 +163,66 @@
     PhoneEngineInfo()->SetCallId( aCallId );
     }
 
+
+// -----------------------------------------------------------
+// CPhoneStateMachine::SecurityMode
+// -----------------------------------------------------------
+//
+EXPORT_C MPhoneSecurityModeObserver* CPhoneStateMachine::SecurityMode()
+	{
+	return iSecurityModeObserver;
+	}
+	
+// -----------------------------------------------------------
+// CPhoneStateMachine::SetSecurityModeObserver
+// -----------------------------------------------------------
+//
+EXPORT_C void CPhoneStateMachine::SetSecurityModeObserver( MPhoneSecurityModeObserver* aObserver )
+	{
+	iSecurityModeObserver = aObserver;
+	}
+
+// -----------------------------------------------------------
+// CPhoneStateMachine::SetSecurityMessageHandler
+// -----------------------------------------------------------
+//
+EXPORT_C void CPhoneStateMachine::SetSecurityMessageHandler( MPhoneSecurityMessageHandler* aHandler )
+	{
+	iSecurityMessageHandler = aHandler;
+	}
+
+// -----------------------------------------------------------
+// CPhoneStateMachine::HandlePhoneEngineMessageL
+// -----------------------------------------------------------
+//
+EXPORT_C void CPhoneStateMachine::HandlePhoneEngineMessageL(const TInt aMessage, 
+     TInt aCallId )
+	{
+	// Forward engine messages to security mode state and current phone state
+	// instance.
+	if ( iSecurityMessageHandler )
+		{
+		iSecurityMessageHandler->HandlePhoneEngineMessageL( aMessage, aCallId );
+		}
+	
+	State()->HandlePhoneEngineMessageL( aMessage, aCallId );
+	}
+
+// -----------------------------------------------------------
+// CPhoneStateMachine::HandlePropertyChangedL
+// -----------------------------------------------------------
+//
+EXPORT_C void CPhoneStateMachine::HandlePropertyChangedL(const TUid& aCategory,
+     const TUint aKey,
+     const TInt aValue )
+	{
+	// Forward P&S key changes to security mode state and current phone state
+	// instance.
+	if ( iSecurityMessageHandler )
+		{
+		iSecurityMessageHandler->HandlePropertyChangedL( aCategory, aKey, aValue );
+		}
+	State()->HandlePropertyChangedL( aCategory, aKey, aValue );
+	}
+	
 // End of File