phoneapp/phoneuivoipextension/src/cphonevcchandler.cpp
branchRCL_3
changeset 6 38529f706030
parent 0 5f000ab63145
child 12 b68fcd923911
equal deleted inserted replaced
5:2a26698d78ba 6:38529f706030
    54 //
    54 //
    55 CPhoneVccHandler::CPhoneVccHandler( 
    55 CPhoneVccHandler::CPhoneVccHandler( 
    56     MPhoneStateMachine& aStateMachine,
    56     MPhoneStateMachine& aStateMachine,
    57     MPhoneViewCommandHandle& aViewCommandHandle ) : 
    57     MPhoneViewCommandHandle& aViewCommandHandle ) : 
    58     iStateMachine( aStateMachine ),
    58     iStateMachine( aStateMachine ),
    59     iViewCommandHandle( aViewCommandHandle ), iVccHoReady( ETrue )
    59     iViewCommandHandle( aViewCommandHandle ), iVccHoReady( ETrue ),
       
    60     iHOFailure ( EFalse )
    60     {
    61     {
    61     }
    62     }
    62 
    63 
    63 // -----------------------------------------------------------
    64 // -----------------------------------------------------------
    64 // CPhoneVccHandler::~CPhoneStateIdleVoIP()
    65 // CPhoneVccHandler::~CPhoneStateIdleVoIP()
    66 // -----------------------------------------------------------
    67 // -----------------------------------------------------------
    67 //
    68 //
    68 CPhoneVccHandler::~CPhoneVccHandler()
    69 CPhoneVccHandler::~CPhoneVccHandler()
    69     {
    70     {
    70     delete iPropListener;
    71     delete iPropListener;
       
    72     delete iPropListenerReq;
    71     TRAPD( err, CancelHandoverNoteTimerL() );
    73     TRAPD( err, CancelHandoverNoteTimerL() );
    72     if ( err != KErrNone )
    74     if ( err != KErrNone )
    73         {
    75         {
    74         __PHONELOG( EBasic, PhoneUIVoIPExtension,
    76         __PHONELOG( EBasic, PhoneUIVoIPExtension,
    75               "CPhoneVccHandler::~CPhoneVccHandler, leave" );
    77               "CPhoneVccHandler::~CPhoneVccHandler, leave" );
    83 //
    85 //
    84 void CPhoneVccHandler::ConstructL()
    86 void CPhoneVccHandler::ConstructL()
    85     {
    87     {
    86     iPropListener = CVccUiPsPropertyListener::NewL( KVccPropKeyHoStatus );
    88     iPropListener = CVccUiPsPropertyListener::NewL( KVccPropKeyHoStatus );
    87     iPropListener->AddObserverL( *this );
    89     iPropListener->AddObserverL( *this );
    88  	iPropListener->Start();
    90     iPropListener->Start();
       
    91 
       
    92     iPropListenerReq = CVccUiPsPropertyListener::NewL( KVccPropKeyHoRequest );
       
    93     iPropListenerReq->AddObserverL( *this );
       
    94     iPropListenerReq->Start();
       
    95  	
    89     }
    96     }
    90 
    97 
    91 // -----------------------------------------------------------
    98 // -----------------------------------------------------------
    92 // CPhoneVccHandler::NewL()
    99 // CPhoneVccHandler::NewL()
    93 // Constructor
   100 // Constructor
   272     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
   279     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
   273         "CPhoneVccHandler::RemoveHandoverNoteL()");
   280         "CPhoneVccHandler::RemoveHandoverNoteL()");
   274         
   281         
   275     if ( iVccHoReady && !iHandoverNoteTimer )
   282     if ( iVccHoReady && !iHandoverNoteTimer )
   276         {
   283         {
   277         iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveGlobalNote );            
   284         iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveGlobalNote );
       
   285         if ( iHOFailure )
       
   286             {
       
   287             iHOFailure = EFalse;
       
   288             CPhoneState* phoneState = 
       
   289             static_cast< CPhoneState* >( iStateMachine.State() ); 
       
   290             phoneState->SendGlobalInfoNoteL( EPhoneVoIPHandoverFail );
       
   291             
       
   292             }
   278         } 
   293         } 
   279     }
   294     }
   280     
   295     
   281 // -----------------------------------------------------------
   296 // -----------------------------------------------------------
   282 // CPhoneVccHandler::HandoverInProgressNoteL
   297 // CPhoneVccHandler::HandoverInProgressNoteL
   283 // -----------------------------------------------------------
   298 // -----------------------------------------------------------
   284 //
   299 //
   285 void CPhoneVccHandler::HandoverInProgressNoteL( TInt aCommand )
   300 void CPhoneVccHandler::HandoverInProgressNoteL( TInt aCommand )
   286     {
   301     {
   287      TPhoneCmdParamGlobalNote globalNoteParam;  
   302     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   303             "CPhoneVccHandler::HandoverInProgressNoteL()");
       
   304     
       
   305     TPhoneCmdParamGlobalNote globalNoteParam;  
   288           
   306           
   289 // Check notification tone user setting
   307     // Check notification tone user setting
   290      TInt tone = GetHoNotifToneModeL();
   308     TInt tone = GetHoNotifToneModeL();
       
   309     
       
   310     __PHONELOG1( EBasic, EPhoneControl,
       
   311                 "CPhoneVccHandler::HandoverInProgressNoteL - tone: %d", tone );
   291     
   312     
   292       if ( tone == 1 )
   313       if ( tone == 1 )
   293            {
   314            {
   294            globalNoteParam.SetTone( EAvkonSIDConfirmationTone );
   315            globalNoteParam.SetTone( EAvkonSIDConfirmationTone );
   295            }
   316            }
   322         "CPhoneVccHandler::VccPropertyChangedL() ");
   343         "CPhoneVccHandler::VccPropertyChangedL() ");
   323    
   344    
   324     __PHONELOG1( EBasic, EPhoneControl,
   345     __PHONELOG1( EBasic, EPhoneControl,
   325             "CPhoneVccHandler::VccPropertyChangedL - key: %d", aValue );
   346             "CPhoneVccHandler::VccPropertyChangedL - key: %d", aValue );
   326 
   347 
       
   348     if( aKeyId == KVccPropKeyHoRequest )
       
   349         {
       
   350         switch( aValue )
       
   351             {
       
   352             case  EVccAutomaticStartPsToCsHoRequest:
       
   353                 {
       
   354                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
       
   355                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- EVccAutomaticStartPsToCsHoRequest" );
       
   356                 // Do not show if already started since the wait note is 
       
   357                 // already visible
       
   358                 if ( iVccHoReady && !iHandoverNoteTimer )
       
   359                     {
       
   360                     iVccHoReady = EFalse;
       
   361                     HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromWlan );
       
   362                     }
       
   363                 }
       
   364                 break;
       
   365             case EVccAutomaticStartCsToPsHoRequest:
       
   366                 {
       
   367                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
       
   368                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- EVccAutomaticStartCsToPsHoRequest" );
       
   369                 // Do not show if already started since the wait note is 
       
   370                 // already visible
       
   371                 if ( iVccHoReady && !iHandoverNoteTimer )
       
   372                     {
       
   373                     iVccHoReady = EFalse;
       
   374                     HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromGsm );
       
   375                     }
       
   376                 }                
       
   377                 break;
       
   378             default:
       
   379                 // none
       
   380                 break;
       
   381             }
       
   382         }
   327     
   383     
   328     if( aKeyId == KVccPropKeyHoStatus )
   384     if( aKeyId == KVccPropKeyHoStatus )
   329   		{
   385   		{
   330   		switch( aValue )
   386   		switch( aValue )
   331   			{				
   387   			{				
   336                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- HO fail" );
   392                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- HO fail" );
   337                 // Remove handover note if handover is in progress
   393                 // Remove handover note if handover is in progress
   338                 if( !iVccHoReady )
   394                 if( !iVccHoReady )
   339                     {
   395                     {
   340                     iVccHoReady = ETrue;
   396                     iVccHoReady = ETrue;
   341                     CPhoneState* phoneState = 
   397                     iHOFailure = ETrue;
   342                                static_cast< CPhoneState* >( iStateMachine.State() ); 
   398                     if ( !iHandoverNoteTimer )
   343                     CancelHandoverNoteTimerL();
   399                         {
   344                     phoneState->SendGlobalInfoNoteL( EPhoneVoIPHandoverFail );
   400                         RemoveHandoverNoteL();
   345                     }
   401                         }
       
   402                      }
   346                  }
   403                  }
   347                 break;
   404                 break;
   348             case EVccCsToPsHoSuccessful:
   405             case EVccCsToPsHoSuccessful:
   349             case EVccPsToCsHoSuccessful:
   406             case EVccPsToCsHoSuccessful:
   350                 {
   407                 {
   356   				break;
   413   				break;
   357             case EVccCsToPsHoStarted:
   414             case EVccCsToPsHoStarted:
   358                 {
   415                 {
   359                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
   416                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
   360                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- CsToPsHoStarted" );
   417                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- CsToPsHoStarted" );
   361                 // Do not show if manually started since the wait note is 
   418                 // Do not show if already started since the wait note is 
   362                 // already visible
   419                 // already visible
   363                 if ( iVccHoReady )
   420                 if ( iVccHoReady && !iHandoverNoteTimer )
   364                     {
   421                     {
   365                     iVccHoReady = EFalse;
   422                     iVccHoReady = EFalse;
   366                     HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromGsm );
   423                     HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromGsm );
   367                     }
   424                     }
   368                 }
   425                 }
   369                 break;
   426                 break;
   370             case EVccPsToCsHoStarted: 
   427             case EVccPsToCsHoStarted: 
   371                 {
   428                 {
   372                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
   429                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
   373                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- PsToCsHoStarted" );
   430                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- PsToCsHoStarted" );
   374                 // Do not show if manually started since the wait note is 
   431                 // Do not show if already started since the wait note is 
   375                 // already visible
   432                 // already visible
   376                 if ( iVccHoReady )
   433                 if ( iVccHoReady && !iHandoverNoteTimer )
   377                     {
   434                     {
   378                     iVccHoReady = EFalse;
   435                     iVccHoReady = EFalse;
   379                     HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromWlan);
   436                     HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromWlan);
   380                     }
   437                     }
   381                 }
   438                 }
   399                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- HO IDLE" );
   456                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- HO IDLE" );
   400                 iVccHoAllowedToGsm = ETrue;
   457                 iVccHoAllowedToGsm = ETrue;
   401                 iVccHoAllowedToWlan = ETrue;
   458                 iVccHoAllowedToWlan = ETrue;
   402                 iNoHoIfMultiCall = EFalse;
   459                 iNoHoIfMultiCall = EFalse;
   403                 iVccUnavailable = EFalse;
   460                 iVccUnavailable = EFalse;
       
   461                 if( !iVccHoReady )
       
   462                     {
       
   463                     iVccHoReady = ETrue;
       
   464                     if ( !iHandoverNoteTimer )
       
   465                         {
       
   466                         RemoveHandoverNoteL();
       
   467                         }
       
   468                      }
   404                 break;
   469                 break;
   405                 }
   470                 }
   406             case EVccCsToPsNotAllowed:
   471             case EVccCsToPsNotAllowed:
   407                 {
   472                 {
   408                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
   473                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
   468 // Gets HO notification tone setting value
   533 // Gets HO notification tone setting value
   469 // ---------------------------------------------------------------------------
   534 // ---------------------------------------------------------------------------
   470 //
   535 //
   471 TInt CPhoneVccHandler::GetHoNotifToneModeL()
   536 TInt CPhoneVccHandler::GetHoNotifToneModeL()
   472     {
   537     {
       
   538     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   539             "CPhoneVccHandler::GetHoNotifToneModeL() ");
       
   540     
   473     // Find out VCC service id
   541     // Find out VCC service id
   474      CSPProperty* property = CSPProperty::NewLC();
   542      CSPProperty* property = CSPProperty::NewLC();
   475     
   543     
   476     CSPSettings* settings = CSPSettings::NewLC();
   544     CSPSettings* settings = CSPSettings::NewLC();
   477     
   545     
   481     TInt err = settings->FindPropertyL( 
   549     TInt err = settings->FindPropertyL( 
   482             vccServiceId, ESubPropertyVccDtVoipServiceId, *property ); 
   550             vccServiceId, ESubPropertyVccDtVoipServiceId, *property ); 
   483     
   551     
   484     TInt voipId;
   552     TInt voipId;
   485     TInt error = property->GetValue( voipId );
   553     TInt error = property->GetValue( voipId );
       
   554     
       
   555     __PHONELOG1( EBasic, EPhoneControl,
       
   556         "CPhoneVccHandler::GetHoNotifToneModeL - voipId: %d", voipId ); 
   486     
   557     
   487     // Find and get the HO notification tone property
   558     // Find and get the HO notification tone property
   488     TInt tone = 0;
   559     TInt tone = 0;
   489     RBuf value;
   560     RBuf value;
   490     value.CreateL( 1 );
   561     value.CreateL( 1 );