commsconfig/cscengine/src/cscengservicehandler.cpp
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  For CSC needed Service Provider Settings handling
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <spentry.h>
       
    20 #include <spproperty.h>
       
    21 #include <spsettings.h>
       
    22 #include <spnotifychange.h>
       
    23 #include <spsettingsvoiputils.h>
       
    24 #include <centralrepository.h>
       
    25 #include <settingsinternalcrkeys.h>
       
    26 
       
    27 #include "cscenglogger.h"
       
    28 #include "cscengservicehandler.h"
       
    29 #include "mcscengserviceobserver.h"
       
    30 
       
    31 const TInt KDummyServiceCount = 1;// only remove cs service, VoIP service is not returned
       
    32 const TInt KArrayInitSize = 2;
       
    33 
       
    34 // SCP-plugin uid for Sip VoIP
       
    35 const TInt32 KSipVoIPSubServicePlugId = 0x1027545A;
       
    36 // Preferred Telephony value is PS call
       
    37 const TInt KRCSEInternetCallPreferred = 1;
       
    38 // Preferred Telephony value is CS call
       
    39 const TInt KRCSECSCallPreferred = 0;
       
    40 
       
    41 // ======== MEMBER FUNCTIONS ========
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 CCSCEngServiceHandler::CCSCEngServiceHandler()
       
    48     {    
       
    49     }
       
    50 
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CCSCEngServiceHandler::ConstructL( MCSCEngServiceObserver* aObserver )
       
    56     {
       
    57     CSCENGDEBUG( "CCSCEngServiceHandler::ConstructL - begin" ); 
       
    58     
       
    59     iObserver = aObserver;
       
    60     iServiceSettings = CSPSettings::NewL();
       
    61     iNotifier = CSPNotifyChange::NewL( *this );
       
    62     iSettingsVoIPUtils = CSPSettingsVoIPUtils::NewL();
       
    63            
       
    64     RArray<TUint> serviceIds;
       
    65     iNotifier->NotifyChangeL( serviceIds );
       
    66     
       
    67     CSCENGDEBUG( "CCSCEngServiceHandler::ConstructL - end" ); 
       
    68     }   
       
    69     
       
    70     
       
    71 // ---------------------------------------------------------------------------
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C CCSCEngServiceHandler* CCSCEngServiceHandler::NewL( 
       
    75     MCSCEngServiceObserver* aObserver )
       
    76     {    
       
    77     CCSCEngServiceHandler* self = new (ELeave) CCSCEngServiceHandler;
       
    78     CleanupStack::PushL( self );
       
    79     self->ConstructL( aObserver );
       
    80     CleanupStack::Pop( self );
       
    81     return self;
       
    82     }
       
    83 
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CCSCEngServiceHandler::~CCSCEngServiceHandler()
       
    89     {
       
    90     CSCENGDEBUG( 
       
    91         "CCSCEngServiceHandler::~CCSCEngCenrepHandler - begin" ); 
       
    92     
       
    93     iServiceName.Close();
       
    94     delete iSettingsVoIPUtils;
       
    95     delete iServiceSettings;
       
    96     delete iNotifier;
       
    97     
       
    98     CSCENGDEBUG( 
       
    99         "CCSCEngServiceHandler::~CCSCEngCenrepHandler - end" ); 
       
   100     }
       
   101     
       
   102 
       
   103 // ---------------------------------------------------------------------------
       
   104 // For getting all service ids
       
   105 // ---------------------------------------------------------------------------
       
   106 //
       
   107 EXPORT_C void CCSCEngServiceHandler::GetAllServiceIdsL( 
       
   108     RArray<TUint>& aServiceIds )
       
   109     {
       
   110     CSCENGDEBUG( "CCSCEngServiceHandler::GetAllServiceIds - begin" ); 
       
   111     
       
   112     iServiceSettings->FindServiceIdsL( aServiceIds );
       
   113     
       
   114     // Remove 'dummy service's' from service ids list.
       
   115     if ( KDummyServiceCount <= aServiceIds.Count() )
       
   116         {
       
   117         for ( TUint i = 0; i < KDummyServiceCount; i++ )
       
   118             {
       
   119             aServiceIds.Remove( 0 );
       
   120             }
       
   121         }
       
   122         
       
   123     CSCENGDEBUG( "CCSCEngServiceHandler::GetAllServiceIds - end" ); 
       
   124     }
       
   125 
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // For getting service provider settings count
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 EXPORT_C TInt CCSCEngServiceHandler::ServiceIdCountL()
       
   132     {
       
   133     CSCENGDEBUG2( 
       
   134         "CCSCEngServiceHandler::ServiceIdCount COUNT=%d", 
       
   135             iServiceSettings->SettingsCountL() );
       
   136     
       
   137     return iServiceSettings->SettingsCountL();
       
   138     }
       
   139 
       
   140 
       
   141 // ---------------------------------------------------------------------------
       
   142 // For deleting service
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C void CCSCEngServiceHandler::DeleteServiceL( TUint aServiceId )
       
   146     {
       
   147     CSCENGDEBUG( "CCSCEngServiceHandler::DeleteServiceL - begin" );
       
   148     
       
   149     User::LeaveIfError( iServiceSettings->DeleteEntryL( aServiceId ) );
       
   150     
       
   151     CSCENGDEBUG( "CCSCEngServiceHandler::DeleteServiceL - end" );
       
   152     }
       
   153 
       
   154 
       
   155 // ---------------------------------------------------------------------------
       
   156 // For getting service name
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 EXPORT_C const TDesC16& CCSCEngServiceHandler::ServiceNameL( 
       
   160     TUint aServiceId )
       
   161     {
       
   162     CSCENGDEBUG( "CCSCEngServiceHandler::ServiceNameL - begin" );
       
   163     
       
   164     iServiceName.Zero();
       
   165     RArray<TUint> serviceIds;
       
   166     CleanupClosePushL( serviceIds );
       
   167     
       
   168     GetAllServiceIdsL( serviceIds );
       
   169     
       
   170     CDesCArray* serviceNames = 
       
   171         new ( ELeave ) CDesCArrayFlat( KArrayInitSize );
       
   172     CleanupStack::PushL( serviceNames );
       
   173     
       
   174     iServiceSettings->FindServiceNamesL( serviceIds, *serviceNames );
       
   175     
       
   176     TBool serviceFound( EFalse );
       
   177     for ( TInt i( 0 ) ; i < serviceIds.Count() && !serviceFound ; i++ )
       
   178         {
       
   179         if ( aServiceId == serviceIds[ i ] )
       
   180             {
       
   181             serviceFound = ETrue;
       
   182             iServiceName.Close();
       
   183             iServiceName.CreateL( serviceNames->MdcaPoint( i ) );
       
   184             }
       
   185         }
       
   186     
       
   187     if ( !serviceFound )
       
   188         {
       
   189         User::Leave( KErrNotFound ); // leave if service not found
       
   190         }
       
   191     
       
   192     CleanupStack::PopAndDestroy( serviceNames );	
       
   193     CleanupStack::PopAndDestroy( &serviceIds );
       
   194     
       
   195     CSCENGDEBUG( "CCSCEngServiceHandler::ServiceNameL - end" );
       
   196             
       
   197     return iServiceName;
       
   198     }
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // For getting brand id
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 EXPORT_C void CCSCEngServiceHandler::BrandIdL( 
       
   205     TUint aServiceId, TDes16& aBrandId )
       
   206     {
       
   207     CSCENGDEBUG( "CCSCEngServiceHandler::BrandIdL - begin" ); 
       
   208     
       
   209     CSPProperty* property = CSPProperty::NewLC();
       
   210     
       
   211     User::LeaveIfError( iServiceSettings->FindPropertyL( 
       
   212         aServiceId, EPropertyBrandId, *property ) );
       
   213        
       
   214     User::LeaveIfError( property->GetValue( aBrandId ) );
       
   215     
       
   216     CleanupStack::PopAndDestroy( property );
       
   217     
       
   218     CSCENGDEBUG2( "CCSCEngServiceHandler::BrandIdL BRANDID=%S", &aBrandId );
       
   219     
       
   220     CSCENGDEBUG( "CCSCEngServiceHandler::BrandIdL - end" ); 
       
   221     }      
       
   222 
       
   223 // ---------------------------------------------------------------------------
       
   224 // For getting snap id
       
   225 // ---------------------------------------------------------------------------
       
   226 //
       
   227 EXPORT_C TInt CCSCEngServiceHandler::SnapIdL( TUint aServiceId )
       
   228     {
       
   229     CSCENGDEBUG( "CCSCEngServiceHandler::SnapIdL - begin" ); 
       
   230     
       
   231     CSPProperty* property = CSPProperty::NewLC();
       
   232     TInt snapId( 0 );
       
   233     
       
   234     User::LeaveIfError( iServiceSettings->FindPropertyL( 
       
   235         aServiceId, ESubPropertyVoIPPreferredSNAPId, *property ) );
       
   236        
       
   237     User::LeaveIfError( property->GetValue( snapId ) );
       
   238     
       
   239     CleanupStack::PopAndDestroy( property );
       
   240     
       
   241     CSCENGDEBUG( "CCSCEngServiceHandler::SnapIdL - end" ); 
       
   242     
       
   243     return snapId;
       
   244     }  
       
   245 
       
   246 // ---------------------------------------------------------------------------
       
   247 // For getting service setup plug-in id
       
   248 // ---------------------------------------------------------------------------
       
   249 //
       
   250 EXPORT_C TInt32 CCSCEngServiceHandler::ServiceSetupPluginIdL( 
       
   251     TUint aServiceId )
       
   252     {
       
   253     CSCENGDEBUG( "CCSCEngServiceHandler::ServiceSetupPluginId - begin" ); 
       
   254     
       
   255     CSPProperty* property = CSPProperty::NewLC();
       
   256      
       
   257     User::LeaveIfError( iServiceSettings->FindPropertyL( 
       
   258         aServiceId, EPropertyServiceSetupPluginId, *property ) );
       
   259     
       
   260     TInt serviceSetupPluginId( 0 );   
       
   261     User::LeaveIfError( property->GetValue( serviceSetupPluginId ) ); 
       
   262           
       
   263     CleanupStack::PopAndDestroy( property );
       
   264     
       
   265     CSCENGDEBUG( "CCSCEngServiceHandler::ServiceSetupPluginId - end" ); 
       
   266     
       
   267     return serviceSetupPluginId;
       
   268     }      
       
   269 
       
   270 
       
   271 // ---------------------------------------------------------------------------
       
   272 // For getting service´s phonebook tab view id
       
   273 // ---------------------------------------------------------------------------
       
   274 //
       
   275 EXPORT_C TInt CCSCEngServiceHandler::ServiceTabViewIdL( TUint aServiceId )
       
   276     {
       
   277     CSPProperty* property = CSPProperty::NewLC();
       
   278      
       
   279     User::LeaveIfError( iServiceSettings->FindPropertyL( 
       
   280         aServiceId, EPropertyContactViewId, *property ) );
       
   281     
       
   282     TInt tabViewId( 0);                   
       
   283     User::LeaveIfError( property->GetValue( tabViewId ) );     
       
   284     
       
   285     CleanupStack::PopAndDestroy( property );
       
   286 
       
   287     CSCENGDEBUG2( "CCSCEngServiceHandler::ServiceTabViewIdL: %d", tabViewId );
       
   288     
       
   289     return tabViewId;
       
   290     }      
       
   291 
       
   292 // ---------------------------------------------------------------------------
       
   293 // For getting service´s IM settings id.
       
   294 // ---------------------------------------------------------------------------
       
   295 //
       
   296 EXPORT_C TInt CCSCEngServiceHandler::ImSettingsIdL( TUint aServiceId )
       
   297     {
       
   298     CSCENGDEBUG( "CCSCEngServiceHandler::ImSettingsIdL - begin" ); 
       
   299     
       
   300     CSPProperty* property = CSPProperty::NewLC();
       
   301      
       
   302     User::LeaveIfError( iServiceSettings->FindPropertyL( 
       
   303         aServiceId, ESubPropertyIMSettingsId, *property ) );
       
   304     
       
   305     TInt settingsId( 0 );                   
       
   306     User::LeaveIfError( property->GetValue( settingsId ) );    
       
   307     
       
   308     CleanupStack::PopAndDestroy( property );
       
   309 
       
   310     CSCENGDEBUG( "CCSCEngServiceHandler::ImSettingsIdL - end" );
       
   311     
       
   312     return settingsId;
       
   313     }  
       
   314 
       
   315 // ---------------------------------------------------------------------------
       
   316 // For setting service´s IM settings id.
       
   317 // ---------------------------------------------------------------------------
       
   318 //
       
   319 EXPORT_C void CCSCEngServiceHandler::SetImSettingsIdL(
       
   320     TUint aServiceId, TInt aSettingsId )
       
   321     {
       
   322     CSCENGDEBUG( "CCSCEngServiceHandler::SetImSettingsIdL - begin" ); 
       
   323     
       
   324     CSPProperty* property = CSPProperty::NewLC();
       
   325     
       
   326     User::LeaveIfError( 
       
   327         property->SetName( ESubPropertyIMSettingsId ) );
       
   328     User::LeaveIfError( property->SetValue( aSettingsId ) );
       
   329     
       
   330     iServiceSettings->AddOrUpdatePropertyL( aServiceId, *property );
       
   331     
       
   332     CleanupStack::PopAndDestroy( property );
       
   333     
       
   334     CSCENGDEBUG( "CCSCEngServiceHandler::SetImSettingsIdL - end" );
       
   335     } 
       
   336 
       
   337 // ---------------------------------------------------------------------------
       
   338 // For getting service´s presence request preference setting
       
   339 // ---------------------------------------------------------------------------
       
   340 //
       
   341 EXPORT_C TOnOff CCSCEngServiceHandler::PresenceReqPrefL( TUint aServiceId )
       
   342     {
       
   343     CSCENGDEBUG( "CCSCEngServiceHandler::PresenceReqPrefL" ); 
       
   344     
       
   345     CSPProperty* property = CSPProperty::NewLC();
       
   346     
       
   347     User::LeaveIfError( iServiceSettings->FindPropertyL( 
       
   348         aServiceId, ESubPropertyPresenceRequestPreference , *property ) );
       
   349     
       
   350     TOnOff onOff = EOn;    
       
   351     User::LeaveIfError( property->GetValue( onOff ) );
       
   352     
       
   353     CleanupStack::PopAndDestroy( property );
       
   354     
       
   355     return onOff;
       
   356     } 
       
   357 
       
   358 
       
   359 // ---------------------------------------------------------------------------
       
   360 // For setting service´s presence request preference setting
       
   361 // ---------------------------------------------------------------------------
       
   362 //
       
   363 EXPORT_C void CCSCEngServiceHandler::SetPresenceReqPrefL( 
       
   364     TUint aServiceId, TOnOff aOnOff )
       
   365     {
       
   366     CSCENGDEBUG2( 
       
   367         "CCSCEngServiceHandler::SetPresenceReqPrefL: aOnOff=%d", aOnOff ); 
       
   368     
       
   369     CSPProperty* property = CSPProperty::NewLC();
       
   370     User::LeaveIfError( 
       
   371         property->SetName( ESubPropertyPresenceRequestPreference ) );
       
   372     User::LeaveIfError( property->SetValue( aOnOff ) );
       
   373     
       
   374     iServiceSettings->AddOrUpdatePropertyL( aServiceId, *property );
       
   375     CleanupStack::PopAndDestroy( property );
       
   376     } 
       
   377 
       
   378 
       
   379 // ---------------------------------------------------------------------------
       
   380 // For getting service´s handover notification tone preference setting
       
   381 // ---------------------------------------------------------------------------
       
   382 //
       
   383 EXPORT_C TOnOff CCSCEngServiceHandler::HandoverNotifTonePrefL( 
       
   384     TUint aServiceId )
       
   385     {
       
   386     CSCENGDEBUG( "CCSCEngServiceHandler::HandoverNotifTonePrefL" ); 
       
   387 
       
   388     CSPProperty* property = CSPProperty::NewLC();
       
   389          
       
   390     User::LeaveIfError( iServiceSettings->FindPropertyL( 
       
   391         aServiceId, ESubPropertyVccHoNotificationToneMode , *property ) );
       
   392          
       
   393     RBuf value( 0 );  
       
   394     CleanupClosePushL( value );
       
   395     value.CreateL( 1 );
       
   396     User::LeaveIfError( property->GetValue( value ) );
       
   397          
       
   398     // convert rbuf to int
       
   399     TInt intValue;
       
   400     TLex temp( value );
       
   401     User::LeaveIfError( temp.Val( intValue ) );
       
   402       
       
   403     CleanupStack::PopAndDestroy( &value );
       
   404     CleanupStack::PopAndDestroy( property );
       
   405          
       
   406     TOnOff onOff = EOONotSet;
       
   407       
       
   408     switch ( intValue )
       
   409         {
       
   410         case 0:
       
   411             {
       
   412             onOff = EOff;
       
   413             }
       
   414             break;
       
   415         case 1:
       
   416             {
       
   417             onOff = EOn;
       
   418             }
       
   419             break;
       
   420         default:
       
   421             {
       
   422             onOff = EOONotSet;
       
   423             }
       
   424             break;
       
   425         }
       
   426 
       
   427     CSCENGDEBUG2( "CCSCEngServiceHandler::HandoverNotifTonePrefL: %d", onOff ); 
       
   428       
       
   429     return onOff;
       
   430     }
       
   431         
       
   432 
       
   433 // ---------------------------------------------------------------------------
       
   434 // For setting service´s handover notification tone preference setting
       
   435 // ---------------------------------------------------------------------------
       
   436 //
       
   437 EXPORT_C void CCSCEngServiceHandler::SetHandoverNotifTonePrefL( 
       
   438     TUint aServiceId, TOnOff aOnOff )
       
   439     {
       
   440     CSPProperty* property = CSPProperty::NewLC();
       
   441     User::LeaveIfError( 
       
   442         property->SetName( ESubPropertyVccHoNotificationToneMode ) );
       
   443     
       
   444     RBuf value;
       
   445     CleanupClosePushL( value );
       
   446     value.CreateL( 1 );
       
   447     value.AppendNum( aOnOff );
       
   448     User::LeaveIfError( property->SetValue( value ) );
       
   449        
       
   450     iServiceSettings->AddOrUpdatePropertyL( aServiceId, *property );
       
   451     
       
   452     CleanupStack::PopAndDestroy( &value );
       
   453     CleanupStack::PopAndDestroy( property );
       
   454     }
       
   455         
       
   456 
       
   457 // ---------------------------------------------------------------------------
       
   458 // For finding out if service supports VCC
       
   459 // ---------------------------------------------------------------------------
       
   460 //
       
   461 EXPORT_C TBool CCSCEngServiceHandler::IsVccSupportedL( TUint aServiceId )
       
   462     {
       
   463     TBool supported( EFalse );
       
   464     
       
   465     TInt vccServiceId( KErrNone );
       
   466     TInt error( KErrNone );
       
   467         
       
   468     //  Array of service provider IDs
       
   469     // is defined as: typedef RArray<TServiceId> RIdArray
       
   470     // in spdefinitions.h
       
   471     RIdArray serviceIdArray;     
       
   472     CleanupClosePushL( serviceIdArray );
       
   473 
       
   474     // This should leave if error occurs
       
   475     error = iServiceSettings->FindServiceIdsL( serviceIdArray );    
       
   476     User::LeaveIfError( error );
       
   477             
       
   478     TInt serviceId( KErrNone );
       
   479     TBool foundEntry( EFalse );
       
   480         
       
   481     for ( TInt i( 0 ); i < serviceIdArray.Count() && !foundEntry; i++ )
       
   482         {
       
   483         CSPProperty* property = CSPProperty::NewLC(); 
       
   484         error = iServiceSettings->FindPropertyL(
       
   485             serviceIdArray[i], ESubPropertyVccVDI, *property ); 
       
   486            
       
   487         if( error == KErrNone )
       
   488             {            
       
   489             vccServiceId =  serviceIdArray[i];
       
   490             foundEntry = ETrue;
       
   491             }
       
   492         CleanupStack::PopAndDestroy( property );
       
   493         }
       
   494     
       
   495     CleanupStack::PopAndDestroy( &serviceIdArray );
       
   496     
       
   497     if ( vccServiceId )
       
   498         {
       
   499         CSPProperty* property2 = CSPProperty::NewLC(); 
       
   500         
       
   501         iServiceSettings->FindPropertyL( 
       
   502             vccServiceId,
       
   503             ESubPropertyVccDtVoipServiceId,
       
   504             *property2 );
       
   505 
       
   506         TInt error = property2->GetValue( serviceId );
       
   507         User::LeaveIfError( error );
       
   508         CleanupStack::PopAndDestroy( property2 );
       
   509         }    
       
   510     
       
   511     if ( serviceId == aServiceId )
       
   512         {
       
   513         supported = ETrue;
       
   514         }
       
   515     
       
   516     CSCENGDEBUG2( "CCSCEngServiceHandler::IsVccSupportedL: %d", supported );
       
   517     
       
   518     return supported;
       
   519     }
       
   520 
       
   521 
       
   522 // ---------------------------------------------------------------------------
       
   523 // For finding out if service supports SIP/VoIP
       
   524 // ---------------------------------------------------------------------------
       
   525 //
       
   526 EXPORT_C TBool CCSCEngServiceHandler::IsSipVoIPL( TUint aServiceId )
       
   527     {
       
   528     TBool sipVoIP( EFalse );
       
   529     TInt uid( 0 );
       
   530     
       
   531     CSPProperty* property = CSPProperty::NewLC();
       
   532     
       
   533     User::LeaveIfError( iServiceSettings->FindPropertyL( 
       
   534         aServiceId, EPropertyVoIPSubServicePluginId , *property ) );
       
   535     
       
   536     User::LeaveIfError( property->GetValue( uid ) );
       
   537     
       
   538     if ( KSipVoIPSubServicePlugId == uid )
       
   539         {
       
   540         sipVoIP = ETrue;
       
   541         }
       
   542     
       
   543     CSCENGDEBUG2( "CCSCEngServiceHandler::IsSipVoIP: %d", sipVoIP );
       
   544     
       
   545     CleanupStack::PopAndDestroy( property );
       
   546     
       
   547     return sipVoIP;
       
   548     } 
       
   549 
       
   550 // ---------------------------------------------------------------------------
       
   551 // For finding out if service is the preferred service
       
   552 // ---------------------------------------------------------------------------
       
   553 //
       
   554 EXPORT_C TBool CCSCEngServiceHandler::IsPreferredService( TUint aServiceId )
       
   555     const
       
   556     {
       
   557     TUint service( 0 );
       
   558     TInt ret = iSettingsVoIPUtils->GetPreferredService( service );
       
   559     
       
   560     return ( KErrNone == ret && service == aServiceId );
       
   561     } 
       
   562 
       
   563 // ---------------------------------------------------------------------------
       
   564 // For finding out if voip is preferred telephony value
       
   565 // ---------------------------------------------------------------------------
       
   566 //
       
   567 EXPORT_C TBool CCSCEngServiceHandler::IsPreferredTelephonyVoip() const
       
   568     {
       
   569     return iSettingsVoIPUtils->IsPreferredTelephonyVoIP();
       
   570     } 
       
   571 
       
   572 // ---------------------------------------------------------------------------
       
   573 // Sets the preferred telephony value
       
   574 // ---------------------------------------------------------------------------
       
   575 //
       
   576 EXPORT_C TInt CCSCEngServiceHandler::SetVoipAsPrefTelephony( 
       
   577     TBool aValue,
       
   578     TUint aServiceId ) const
       
   579     {
       
   580     TRAPD( err, SetVoipAsPrefTelephonyL( aValue, aServiceId ) );
       
   581     return err;
       
   582     }
       
   583     
       
   584 // ---------------------------------------------------------------------------
       
   585 // Sets the preferred telephony value
       
   586 // ---------------------------------------------------------------------------
       
   587 //
       
   588 void CCSCEngServiceHandler::SetVoipAsPrefTelephonyL( 
       
   589     TBool aValue, 
       
   590     TUint aServiceId ) const
       
   591     {  
       
   592     TInt value( aValue ? KRCSEInternetCallPreferred : KRCSECSCallPreferred );
       
   593     TInt serviceId( aServiceId );
       
   594           
       
   595     CRepository* repository = CRepository::NewLC( KCRUidRichCallSettings );
       
   596     
       
   597     User::LeaveIfError( repository->Set( KRCSEPreferredTelephony, value ) );
       
   598     User::LeaveIfError( repository->Set( KRCSPSPreferredService, serviceId ) );
       
   599     CleanupStack::PopAndDestroy( repository );
       
   600     }
       
   601 
       
   602 // ---------------------------------------------------------------------------
       
   603 // From class MSPNotifyChangeObserver
       
   604 // Notifies change in service table
       
   605 // ---------------------------------------------------------------------------
       
   606 //
       
   607 void CCSCEngServiceHandler::HandleNotifyChange( TUint /*aServiceId*/ )
       
   608     {
       
   609     CSCENGDEBUG( "CCSCEngServiceHandler::HandleNotifyChange - begin" );
       
   610    
       
   611     iObserver->NotifyServiceChange();
       
   612      
       
   613     CSCENGDEBUG( "CCSCEngServiceHandler::HandleNotifyChange - end" );  
       
   614     }
       
   615