callcontinuity/vcc/src/cvccdirector.cpp
branchRCL_3
changeset 6 fc8c25e5a2e8
parent 0 a4daefaec16c
child 10 ed1e38b404e5
equal deleted inserted replaced
2:7b872347d83b 6:fc8c25e5a2e8
    60 //
    60 //
    61 void CVccDirector::ConstructL()
    61 void CVccDirector::ConstructL()
    62     {
    62     {
    63     RUBY_DEBUG_BLOCKL( "CVccDirector::ConstructL" );
    63     RUBY_DEBUG_BLOCKL( "CVccDirector::ConstructL" );
    64 
    64 
    65     iSvpLoaded = EFalse;
       
    66     FillCallProviderArrayL();
    65     FillCallProviderArrayL();
    67     
    66     
    68     // Create the HO-trigger and connect to the wlan network
    67     // Create the HO-trigger and connect to the wlan network
    69     iHoTrigger = CVccHoTrigger::NewL();
    68     iHoTrigger = CVccHoTrigger::NewL();
    70     
    69     
   141 	{
   140 	{
   142     //no supplementary services
   141     //no supplementary services
   143     //creating cs and sipvoipproviders
   142     //creating cs and sipvoipproviders
   144     
   143     
   145     //List implementations
   144     //List implementations
   146     //Only load cs plugin in the boot. SVP will be loaded when needed.
   145 
   147     RImplInfoPtrArray implementations;
   146     RImplInfoPtrArray implementations;
   148     TCleanupItem arrayCleanup( PointerArrayCleanup, &implementations );
   147     TCleanupItem arrayCleanup( PointerArrayCleanup, &implementations );
   149     CleanupStack::PushL( arrayCleanup );
   148     CleanupStack::PushL( arrayCleanup );
   150 
   149 
   151     CConvergedCallProvider::ListImplementationsL( implementations );
   150     CConvergedCallProvider::ListImplementationsL( implementations );
   152  
   151  
   153     for( TInt i = 0; i<implementations.Count(); i++ )
   152     for( TInt i = 0; i<implementations.Count(); i++ )
   154         {
   153         {
   155         RUBY_DEBUG1( "- for loop counter value: %d", i );
   154         RUBY_DEBUG1( "- for loop counter value: %d", i );
   156         CImplementationInformation *info = implementations[i];
   155         CImplementationInformation *info = implementations[i];
   157         if ( info->ImplementationUid().iUid == KCSCallProviderPlugId )
   156         if ( IsVccOwnedPlugin ( info->ImplementationUid().iUid ) )
   158             {
   157             {
   159             CConvergedCallProvider* provider =
   158             CConvergedCallProvider* provider =
   160                 CConvergedCallProvider::NewL( info->ImplementationUid() );
   159                 CConvergedCallProvider::NewL( info->ImplementationUid() );
   161             CleanupStack::PushL( provider );
   160             CleanupStack::PushL( provider );
   162            
   161            
   165             CleanupStack::Pop( provider ); //aProvider
   164             CleanupStack::Pop( provider ); //aProvider
   166             }
   165             }
   167         }
   166         }
   168     
   167     
   169     CleanupStack::PopAndDestroy();//implementations
   168     CleanupStack::PopAndDestroy();//implementations
   170   
       
   171     TRAP_IGNORE( CheckVoipEnabledL(  VccSettingsReader::VoIPServiceIdL() ) );
       
   172 	}
   169 	}
   173 
   170 
   174 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   175 // CVccDirector::IsVccOwnedPlugin
   172 // CVccDirector::IsVccOwnedPlugin
   176 // Checks is the given call provider plugin used by VCC 
   173 // Checks is the given call provider plugin used by VCC 
   672 // Callback function for service settings table observer.
   669 // Callback function for service settings table observer.
   673 // Service provider settings table was changed.  
   670 // Service provider settings table was changed.  
   674 // Only VCC service changes are notified
   671 // Only VCC service changes are notified
   675 // -----------------------------------------------------------------------------
   672 // -----------------------------------------------------------------------------
   676 //
   673 //
   677 void CVccDirector::HandleNotifyChange( TServiceId aServiceId )
   674 void CVccDirector::HandleNotifyChange( TServiceId /*aServiceId*/ )
   678     {
   675     {
   679     RUBY_DEBUG_BLOCK( "CVccDirector::HandleNotifyChange" );
   676     RUBY_DEBUG_BLOCK( "CVccDirector::HandleNotifyChange" );
   680     CheckVoipEnabledL( aServiceId );
       
   681     
   677     
   682     if( !IsPluginInitialized())
   678     if( !IsPluginInitialized())
   683     	RetryInitialization();
   679     	RetryInitialization();
   684     }
   680     }
   685 
   681 
   977     {
   973     {
   978     RUBY_DEBUG_BLOCK( "CVccDirector::CreateConferenceL" );
   974     RUBY_DEBUG_BLOCK( "CVccDirector::CreateConferenceL" );
   979     iConference = CVccConferenceCall::NewL( aConferenceCall, iPerfArray );
   975     iConference = CVccConferenceCall::NewL( aConferenceCall, iPerfArray );
   980     aConferenceCall.AddObserverL( *iConference );
   976     aConferenceCall.AddObserverL( *iConference );
   981     }
   977     }
   982 
       
   983 // -----------------------------------------------------------------------------
       
   984 // CVccDirector::CheckVoipEnabledL
       
   985 // -----------------------------------------------------------------------------
       
   986 //
       
   987 void CVccDirector::CheckVoipEnabledL( TServiceId aServiceId )
       
   988     {
       
   989     RUBY_DEBUG_BLOCK( "CVccDirector::CheckVoipEnabledL" );
       
   990     
       
   991     TInt vccService = VccSettingsReader::VccServiceIdL();
       
   992     TInt voipService = 0;
       
   993     if( vccService )
       
   994         {
       
   995         voipService = VccSettingsReader::VoIPServiceIdL();
       
   996         }
       
   997     if( voipService == aServiceId )
       
   998         {
       
   999         RUBY_DEBUG0( "CVccDirector::HandleNotifyChange -- VoIP Service" );
       
  1000         CSPProperty* property = CSPProperty::NewLC();
       
  1001         CSPSettings* settings = CSPSettings::NewLC();
       
  1002         settings->FindPropertyL( aServiceId,
       
  1003                     ESubPropertyVoIPEnabled, *property );
       
  1004             
       
  1005         TOnOff enabled( EOONotSet );
       
  1006         property->GetValue( enabled );
       
  1007             
       
  1008         CleanupStack::PopAndDestroy( settings );
       
  1009         CleanupStack::PopAndDestroy( property );
       
  1010         //if voip is enabled load also SVP and put it into providers array
       
  1011         if( enabled && !iSvpLoaded )
       
  1012             {
       
  1013             RUBY_DEBUG0( "CVccDirector::HandleNotifyChange -- VoIP enabled, load SVP" );
       
  1014             RImplInfoPtrArray implementations;
       
  1015             TCleanupItem arrayCleanup( PointerArrayCleanup, &implementations );
       
  1016             CleanupStack::PushL( arrayCleanup );
       
  1017 
       
  1018             CConvergedCallProvider::ListImplementationsL( implementations );
       
  1019                  
       
  1020             for( TInt i = 0; i < implementations.Count(); i++ )
       
  1021                 {
       
  1022                 RUBY_DEBUG1( "- for loop counter value: %d", i );
       
  1023                 CImplementationInformation *info = implementations[i];
       
  1024                 if( info->ImplementationUid().iUid == KSipVoipCallProviderPlugId )
       
  1025                     {
       
  1026                     CConvergedCallProvider* provider =
       
  1027                          CConvergedCallProvider::NewL( info->ImplementationUid() );
       
  1028                     CleanupStack::PushL( provider );
       
  1029                            
       
  1030                     User::LeaveIfError( iProviders.Append( provider ) );
       
  1031                             
       
  1032                     CleanupStack::Pop( provider );  //provider
       
  1033                         
       
  1034                     if( iDtmfProvider )
       
  1035                         {
       
  1036                         provider->DTMFProviderL( *iDtmfProvider );
       
  1037                         }
       
  1038                     }
       
  1039                 }
       
  1040                 iSvpLoaded = ETrue;
       
  1041                 CleanupStack::PopAndDestroy();  //implementations
       
  1042             }
       
  1043             //if voip is disabled, destroy SVP and remove it from providers array.
       
  1044         else if( !enabled )
       
  1045             {
       
  1046             RUBY_DEBUG0( "CVccDirector::HandleNotifyChange -- VoIP disabled, destroy SVP" );
       
  1047                             
       
  1048             for( TInt i = 0; i < iProviders.Count(); i++ )
       
  1049                 {
       
  1050                 if( iProviders[ i ]->Uid().iUid == KSipVoipCallProviderPlugId )
       
  1051                     {
       
  1052                     delete iProviders[ i ];
       
  1053                     iProviders.Remove( i );
       
  1054                     iProviders.Compress();
       
  1055                     for( TInt a = 0; a < iInitialisedPlugins.Count(); a++ )
       
  1056                         {
       
  1057                         if( iInitialisedPlugins[ a ] == KSipVoipCallProviderPlugId )
       
  1058                             {
       
  1059                             iInitialisedPlugins.Remove( a );
       
  1060                             iInitialisedPlugins.Compress();
       
  1061                             }
       
  1062                         }
       
  1063                     iSvpLoaded = EFalse;
       
  1064                     }
       
  1065                 }
       
  1066             }
       
  1067         }
       
  1068     }