phoneapp/phoneuivoipextension/src/cphonevcchandler.cpp
branchRCL_3
changeset 62 5266b1f337bd
parent 61 41a7f70b3818
--- a/phoneapp/phoneuivoipextension/src/cphonevcchandler.cpp	Tue Aug 31 15:14:29 2010 +0300
+++ b/phoneapp/phoneuivoipextension/src/cphonevcchandler.cpp	Wed Sep 01 12:30:10 2010 +0100
@@ -16,7 +16,9 @@
 */
 
 // INCLUDES
-#include "phoneresourceids.h"
+#include <phoneui.rsg>
+#include <avkon.rsg>
+#include <phoneuivoip.rsg>
 #include <StringLoader.h>
 #include <avkon.rsg>
 #include <mpeengineinfo.h>
@@ -54,7 +56,8 @@
     MPhoneStateMachine& aStateMachine,
     MPhoneViewCommandHandle& aViewCommandHandle ) : 
     iStateMachine( aStateMachine ),
-    iViewCommandHandle( aViewCommandHandle ), iVccHoReady( ETrue )
+    iViewCommandHandle( aViewCommandHandle ), iVccHoReady( ETrue ),
+    iHOFailure ( EFalse )
     {
     }
 
@@ -66,6 +69,7 @@
 CPhoneVccHandler::~CPhoneVccHandler()
     {
     delete iPropListener;
+    delete iPropListenerReq;
     TRAPD( err, CancelHandoverNoteTimerL() );
     if ( err != KErrNone )
         {
@@ -84,6 +88,11 @@
     iPropListener = CVccUiPsPropertyListener::NewL( KVccPropKeyHoStatus );
     iPropListener->AddObserverL( *this );
     iPropListener->Start();
+
+    iPropListenerReq = CVccUiPsPropertyListener::NewL( KVccPropKeyHoRequest );
+    iPropListenerReq->AddObserverL( *this );
+    iPropListenerReq->Start();
+ 	
     }
 
 // -----------------------------------------------------------
@@ -272,7 +281,15 @@
         
     if ( iVccHoReady && !iHandoverNoteTimer )
         {
-        iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveGlobalNote );            
+        iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveGlobalNote );
+        if ( iHOFailure )
+            {
+            iHOFailure = EFalse;
+            CPhoneState* phoneState = 
+            static_cast< CPhoneState* >( iStateMachine.State() ); 
+            phoneState->SendGlobalInfoNoteL( EPhoneVoIPHandoverFail );
+            
+            }
         } 
     }
     
@@ -282,21 +299,27 @@
 //
 void CPhoneVccHandler::HandoverInProgressNoteL( TInt aCommand )
     {
-     TPhoneCmdParamGlobalNote globalNoteParam;  
+    __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
+            "CPhoneVccHandler::HandoverInProgressNoteL()");
+    
+    TPhoneCmdParamGlobalNote globalNoteParam;  
           
-// Check notification tone user setting
-     TInt tone = GetHoNotifToneModeL();
+    // Check notification tone user setting
+    TInt tone = GetHoNotifToneModeL();
+    
+    __PHONELOG1( EBasic, EPhoneControl,
+                "CPhoneVccHandler::HandoverInProgressNoteL - tone: %d", tone );
     
-//      if ( tone == 1 )
-//           {
-//           globalNoteParam.SetTone( EAvkonSIDConfirmationTone );
-//           }
-//       else
-//           {
-//           globalNoteParam.SetTone( EAvkonSIDNoSound );
-//           }
+      if ( tone == 1 )
+           {
+           globalNoteParam.SetTone( EAvkonSIDDefaultSound );
+           }
+       else
+           {
+           globalNoteParam.SetTone( EAvkonSIDNoSound );
+           }
 
-     globalNoteParam.SetType( EPhoneNotificationDialog );
+     globalNoteParam.SetType( EAknGlobalWaitNote );
      globalNoteParam.SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY );
      globalNoteParam.SetTextResourceId( 
                  CPhoneMainResourceResolver::Instance()->
@@ -314,7 +337,7 @@
 // -----------------------------------------------------------------------------
 //
 void CPhoneVccHandler::VccPropertyChangedL( const TUint aKeyId,
-                                    const TInt aValue ) 
+                                    const TInt aValue )	
     {            
     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
         "CPhoneVccHandler::VccPropertyChangedL() ");
@@ -322,25 +345,61 @@
     __PHONELOG1( EBasic, EPhoneControl,
             "CPhoneVccHandler::VccPropertyChangedL - key: %d", aValue );
 
-    
-    if( aKeyId == KVccPropKeyHoStatus )
+    if( aKeyId == KVccPropKeyHoRequest )
         {
         switch( aValue )
-            {               
-            case EVccCsToPsHoFailure:
-            case EVccPsToCsHoFailure:
+            {
+            case  EVccAutomaticStartPsToCsHoRequest:
+                {
+                __PHONELOG( EBasic, PhoneUIVoIPExtension,
+                    "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- EVccAutomaticStartPsToCsHoRequest" );
+                // Do not show if already started since the wait note is 
+                // already visible
+                if ( iVccHoReady && !iHandoverNoteTimer )
+                    {
+                    iVccHoReady = EFalse;
+                    HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromWlan );
+                    }
+                }
+                break;
+            case EVccAutomaticStartCsToPsHoRequest:
                 {
                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
+                    "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- EVccAutomaticStartCsToPsHoRequest" );
+                // Do not show if already started since the wait note is 
+                // already visible
+                if ( iVccHoReady && !iHandoverNoteTimer )
+                    {
+                    iVccHoReady = EFalse;
+                    HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromGsm );
+                    }
+                }                
+                break;
+            default:
+                // none
+                break;
+            }
+        }
+    
+    if( aKeyId == KVccPropKeyHoStatus )
+  		{
+  		switch( aValue )
+  			{				
+  			case EVccCsToPsHoFailure:
+  			case EVccPsToCsHoFailure:
+  			    {
+  			    __PHONELOG( EBasic, PhoneUIVoIPExtension,
                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- HO fail" );
                 // Remove handover note if handover is in progress
                 if( !iVccHoReady )
                     {
                     iVccHoReady = ETrue;
-                    CPhoneState* phoneState = 
-                               static_cast< CPhoneState* >( iStateMachine.State() ); 
-                    CancelHandoverNoteTimerL();
-                    phoneState->SendGlobalInfoNoteL( EPhoneVoIPHandoverFail );
-                    }
+                    iHOFailure = ETrue;
+                    if ( !iHandoverNoteTimer )
+                        {
+                        RemoveHandoverNoteL();
+                        }
+                     }
                  }
                 break;
             case EVccCsToPsHoSuccessful:
@@ -350,15 +409,15 @@
                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- HO Success" );   
                 iVccHoReady = ETrue;
                 RemoveHandoverNoteL();
-                }
-                break;
+  			    }
+  				break;
             case EVccCsToPsHoStarted:
                 {
                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- CsToPsHoStarted" );
-                // Do not show if manually started since the wait note is 
+                // Do not show if already started since the wait note is 
                 // already visible
-                if ( iVccHoReady )
+                if ( iVccHoReady && !iHandoverNoteTimer )
                     {
                     iVccHoReady = EFalse;
                     HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromGsm );
@@ -369,9 +428,9 @@
                 {
                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
                     "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- PsToCsHoStarted" );
-                // Do not show if manually started since the wait note is 
+                // Do not show if already started since the wait note is 
                 // already visible
-                if ( iVccHoReady )
+                if ( iVccHoReady && !iHandoverNoteTimer )
                     {
                     iVccHoReady = EFalse;
                     HandoverInProgressNoteL( EPhoneVoIPWaitHandoverFromWlan);
@@ -399,6 +458,14 @@
                 iVccHoAllowedToWlan = ETrue;
                 iNoHoIfMultiCall = EFalse;
                 iVccUnavailable = EFalse;
+                if( !iVccHoReady )
+                    {
+                    iVccHoReady = ETrue;
+                    if ( !iHandoverNoteTimer )
+                        {
+                        RemoveHandoverNoteL();
+                        }
+                     }
                 break;
                 }
             case EVccCsToPsNotAllowed:
@@ -454,13 +521,13 @@
                 break;
                 }
                     
-            default:
+  			default:
 
                 __PHONELOG( EBasic, PhoneUIVoIPExtension,
                         "CPhoneVccHandler::VccPropertyChangedL VccPropertyChangedL -- default" );
-                break;
-            }       
-        }
+        		break;
+  			}		
+  		}
     }
 // ---------------------------------------------------------------------------
 // Gets HO notification tone setting value
@@ -468,6 +535,9 @@
 //
 TInt CPhoneVccHandler::GetHoNotifToneModeL()
     {
+    __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
+            "CPhoneVccHandler::GetHoNotifToneModeL() ");
+    
     // Find out VCC service id
      CSPProperty* property = CSPProperty::NewLC();
     
@@ -482,6 +552,9 @@
     TInt voipId;
     TInt error = property->GetValue( voipId );
     
+    __PHONELOG1( EBasic, EPhoneControl,
+        "CPhoneVccHandler::GetHoNotifToneModeL - voipId: %d", voipId ); 
+    
     // Find and get the HO notification tone property
     TInt tone = 0;
     RBuf value;