phoneapp/phoneuivoipextension/src/cphonestatemachinevoip.cpp
branchRCL_3
changeset 62 5266b1f337bd
parent 61 41a7f70b3818
child 81 c26cc2a7c548
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
   100         if ( deleteOldState )
   100         if ( deleteOldState )
   101             {
   101             {
   102             // Possible that derived class has been deleted iState,
   102             // Possible that derived class has been deleted iState,
   103             // so this delete statement may be useless.
   103             // so this delete statement may be useless.
   104             delete iState;
   104             delete iState;
   105             iState = NULL;                      
   105             iState = NULL;	            		
   106             }
   106             }
   107 
   107 
   108         // State transition need to be made - construct new state and
   108         // State transition need to be made - construct new state and
   109         // destruct old
   109         // destruct old
   110         switch( iNewStateId )
   110         switch( iNewStateId )
   111             {
   111             {
   112             case EPhoneStateCallSetup:
   112             case EPhoneStateCallSetup:
   113                 TRAP( err, iState = CPhoneStateCallSetupVoIP::NewL( 
   113                 TRAP( err, iState = CPhoneStateCallSetupVoIP::NewL( 
   114                     *this, *iViewCommandHandle, *iVoipCustomization ) );
   114                 	*this, *iViewCommandHandle, *iVoipCustomization ) );
   115                 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   115                 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   116                 madeStateTransition = ETrue;
   116                 madeStateTransition = ETrue;
   117                 break;
   117                 break;
   118 
   118 
   119             case EPhoneStateIdle:
   119             case EPhoneStateIdle:
   120                 if( iIdleState == NULL )
   120                 if( iIdleState == NULL )
   121                     {
   121                     {
   122                     TRAP( err, iIdleState = CPhoneStateIdleVoIP::NewL( 
   122                     TRAP( err, iIdleState = CPhoneStateIdleVoIP::NewL( 
   123                         *this, *iViewCommandHandle, *iVoipCustomization ) );
   123                     	*this, *iViewCommandHandle, *iVoipCustomization ) );
   124                     __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   124                     __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   125                     }
   125                     }
   126                 iState = iIdleState;
   126                 iState = iIdleState;
   127                 madeStateTransition = ETrue;
   127                 madeStateTransition = ETrue;
   128                 break;                     
   128                 break;                     
   129 
   129 
   130             case EPhoneStateIncoming:
   130             case EPhoneStateIncoming:
   131                 TRAP( err, iState = CPhoneStateIncomingVoIP::NewL( 
   131                 TRAP( err, iState = CPhoneStateIncomingVoIP::NewL( 
   132                     *this, *iViewCommandHandle, *iVoipCustomization ) );
   132                 	*this, *iViewCommandHandle, *iVoipCustomization ) );
   133                 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   133                 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   134                 madeStateTransition = ETrue;
   134                 madeStateTransition = ETrue;
   135                 break;                     
   135                 break;                     
   136 
   136 
   137             case EPhoneStateSingle:
   137             case EPhoneStateSingle:
   138                 TRAP( err, iState = CPhoneStateSingleVoIP::NewL( 
   138                 TRAP( err, iState = CPhoneStateSingleVoIP::NewL( 
   139                     *this, *iViewCommandHandle, *iVoipCustomization ));
   139                 	*this, *iViewCommandHandle, *iVoipCustomization ));
   140                 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   140                 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   141                 madeStateTransition = ETrue;
   141                 madeStateTransition = ETrue;
   142                 break;
   142                 break;
   143 
   143 
   144             case EPhoneStateAlerting:
   144             case EPhoneStateAlerting:
   145                 TRAP( err, iState = CPhoneStateAlertingVoIP::NewL(
   145                 TRAP( err, iState = CPhoneStateAlertingVoIP::NewL(
   146                     *this, *iViewCommandHandle, *iVoipCustomization ));
   146                 	*this, *iViewCommandHandle, *iVoipCustomization ));
   147                 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   147                 __ASSERT_ALWAYS( KErrNone == err, User::Invariant() );
   148                 madeStateTransition = ETrue;
   148                 madeStateTransition = ETrue;
   149                 break;
   149                 break;
   150 
   150 
   151             default:
   151             default:
   155         }
   155         }
   156 
   156 
   157     if ( madeStateTransition )
   157     if ( madeStateTransition )
   158         {
   158         {
   159         iOldStateId = iNewStateId;
   159         iOldStateId = iNewStateId;
       
   160         
       
   161         // Needs to be set or any attempts to access eikon env handle
       
   162         // will fail
       
   163         iState->SetEikonEnv( EikonEnv() );
   160         }
   164         }
   161 
   165 
   162     return iState;
   166     return iState;
   163     }
   167     }
   164 
   168