phoneapp/phoneuicontrol/src/cphonestatemachine.cpp
branchRCL_3
changeset 6 38529f706030
parent 5 2a26698d78ba
child 23 40a3f856b14d
equal deleted inserted replaced
5:2a26698d78ba 6:38529f706030
    27 #include "cphonestateincoming.h"
    27 #include "cphonestateincoming.h"
    28 #include "cphonestatecallsetup.h"
    28 #include "cphonestatecallsetup.h"
    29 #include "cphonestateincall.h"
    29 #include "cphonestateincall.h"
    30 #include "phonestatedefinitions.h"
    30 #include "phonestatedefinitions.h"
    31 #include "phonelogger.h"
    31 #include "phonelogger.h"
       
    32 #include "mphonesecuritymodeobserver.h"
       
    33 #include "mphonesecuritymessagehandler.h"
    32 
    34 
    33 // ================= MEMBER FUNCTIONS =======================
    35 // ================= MEMBER FUNCTIONS =======================
    34 
    36 
    35 // C++ default constructor can NOT contain any code, that
    37 // C++ default constructor can NOT contain any code, that
    36 // might leave.
    38 // might leave.
    53 //
    55 //
    54 EXPORT_C CPhoneStateMachine::~CPhoneStateMachine()
    56 EXPORT_C CPhoneStateMachine::~CPhoneStateMachine()
    55     {
    57     {
    56 	if( iState == iIdleState )
    58 	if( iState == iIdleState )
    57 		{
    59 		{
    58 		delete iState;
    60 		// Avoid deleting idle state instance twice.
    59 		iState = NULL;
    61 		// If state is idle, iState points to idle state instance.
    60 		iIdleState = NULL;			
    62 		iIdleState = NULL;			
    61 		}
    63 		}
    62 	else
    64 	delete iState;
    63 		{
    65 	delete iIdleState;
    64 	    if( iState )
    66 	delete iPhoneEngine;
    65 		    {
    67 	}
    66 		    delete iState;
       
    67 		    iState = NULL;	    	
       
    68 		    }
       
    69 		if( iIdleState )
       
    70 			{
       
    71 		    delete iIdleState;
       
    72 		    iIdleState = NULL;			
       
    73 			}			
       
    74 		}
       
    75 	if( iPhoneEngine )
       
    76 		{
       
    77 	    delete iPhoneEngine;
       
    78 	    iPhoneEngine = NULL;			
       
    79 		}
       
    80     }
       
    81 
    68 
    82 // ---------------------------------------------------------
    69 // ---------------------------------------------------------
    83 // CPhoneStateMachine::SetPhoneEngine
    70 // CPhoneStateMachine::SetPhoneEngine
    84 // ---------------------------------------------------------
    71 // ---------------------------------------------------------
    85 //
    72 //
   174         "CALL ID: CPhoneStateMachine::SetCallId (%d)",
   161         "CALL ID: CPhoneStateMachine::SetCallId (%d)",
   175         aCallId);     
   162         aCallId);     
   176     PhoneEngineInfo()->SetCallId( aCallId );
   163     PhoneEngineInfo()->SetCallId( aCallId );
   177     }
   164     }
   178 
   165 
       
   166 
       
   167 // -----------------------------------------------------------
       
   168 // CPhoneStateMachine::SecurityMode
       
   169 // -----------------------------------------------------------
       
   170 //
       
   171 EXPORT_C MPhoneSecurityModeObserver* CPhoneStateMachine::SecurityMode()
       
   172 	{
       
   173 	return iSecurityModeObserver;
       
   174 	}
       
   175 	
       
   176 // -----------------------------------------------------------
       
   177 // CPhoneStateMachine::SetSecurityModeObserver
       
   178 // -----------------------------------------------------------
       
   179 //
       
   180 EXPORT_C void CPhoneStateMachine::SetSecurityModeObserver( MPhoneSecurityModeObserver* aObserver )
       
   181 	{
       
   182 	iSecurityModeObserver = aObserver;
       
   183 	}
       
   184 
       
   185 // -----------------------------------------------------------
       
   186 // CPhoneStateMachine::SetSecurityMessageHandler
       
   187 // -----------------------------------------------------------
       
   188 //
       
   189 EXPORT_C void CPhoneStateMachine::SetSecurityMessageHandler( MPhoneSecurityMessageHandler* aHandler )
       
   190 	{
       
   191 	iSecurityMessageHandler = aHandler;
       
   192 	}
       
   193 
       
   194 // -----------------------------------------------------------
       
   195 // CPhoneStateMachine::HandlePhoneEngineMessageL
       
   196 // -----------------------------------------------------------
       
   197 //
       
   198 EXPORT_C void CPhoneStateMachine::HandlePhoneEngineMessageL(const TInt aMessage, 
       
   199      TInt aCallId )
       
   200 	{
       
   201 	// Forward engine messages to security mode state and current phone state
       
   202 	// instance.
       
   203 	if ( iSecurityMessageHandler )
       
   204 		{
       
   205 		iSecurityMessageHandler->HandlePhoneEngineMessageL( aMessage, aCallId );
       
   206 		}
       
   207 	
       
   208 	State()->HandlePhoneEngineMessageL( aMessage, aCallId );
       
   209 	}
       
   210 
       
   211 // -----------------------------------------------------------
       
   212 // CPhoneStateMachine::HandlePropertyChangedL
       
   213 // -----------------------------------------------------------
       
   214 //
       
   215 EXPORT_C void CPhoneStateMachine::HandlePropertyChangedL(const TUid& aCategory,
       
   216      const TUint aKey,
       
   217      const TInt aValue )
       
   218 	{
       
   219 	// Forward P&S key changes to security mode state and current phone state
       
   220 	// instance.
       
   221 	if ( iSecurityMessageHandler )
       
   222 		{
       
   223 		iSecurityMessageHandler->HandlePropertyChangedL( aCategory, aKey, aValue );
       
   224 		}
       
   225 	State()->HandlePropertyChangedL( aCategory, aKey, aValue );
       
   226 	}
       
   227 	
   179 // End of File
   228 // End of File