richcallsettingsengine/rcse2/src/crcseprofileregistry.cpp
changeset 0 a4daefaec16c
child 12 876a3df1f464
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  Stores and loads CRCSEProfileEntry to/from data storage.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <sipmanagedprofileregistry.h>
       
    22 #include <sipprofile.h>
       
    23 
       
    24 #include <spsettings.h>
       
    25 #include <spentry.h>
       
    26 #include <spproperty.h>
       
    27 #include <spdefinitions.h>
       
    28 #include <featmgr.h>
       
    29 
       
    30 #include <cenrepdatabaseutil.h>
       
    31 #include <cenrepdatabaseproperty.h>
       
    32 
       
    33 #include "crcseprofileregistry.h"
       
    34 #include "crcseprofileentry.h"
       
    35 #include "crcseaudiocodecregistry.h"
       
    36 #include "rcsepanic.h"
       
    37 #include "rcseconstants.h"
       
    38 #include "rcsedefaults.h"
       
    39 #include "rcseprivatecrkeys.h"
       
    40 #include "rcselogger.h"
       
    41 
       
    42 
       
    43 const TInt KArrayInitSize = 2;
       
    44 
       
    45 // ============================ MEMBER FUNCTIONS ===============================
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CRCSEProfileRegistry::CRCSEProfileRegistry
       
    49 // C++ default constructor can NOT contain any code, that
       
    50 // might leave.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CRCSEProfileRegistry::CRCSEProfileRegistry()
       
    54     : CRCSERegistryBase( EVoIPProfile ),
       
    55       iSIPRegistry( NULL )
       
    56     {
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CRCSEProfileRegistry::ConstructL
       
    61 // Symbian 2nd phase constructor can leave.
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 void CRCSEProfileRegistry::ConstructL()
       
    65     {
       
    66     // Check VoIP support from feature manager
       
    67     FeatureManager::InitializeLibL();
       
    68     TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
       
    69     FeatureManager::UnInitializeLib();
       
    70     if ( !support )
       
    71         {
       
    72         User::Leave( KErrNotSupported );
       
    73         }
       
    74 
       
    75     BaseConstructL();
       
    76     iSIPRegistry = CSIPManagedProfileRegistry::NewL( *this );
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CRCSEProfileRegistry::NewL
       
    81 // Two-phased constructor.
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 EXPORT_C CRCSEProfileRegistry* CRCSEProfileRegistry::NewL()
       
    85     {
       
    86     CRCSEProfileRegistry* self = CRCSEProfileRegistry::NewLC();
       
    87     CleanupStack::Pop( self );
       
    88     return self;
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CRCSEProfileRegistry::NewLC
       
    93 // Two-phased constructor.
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 EXPORT_C CRCSEProfileRegistry* CRCSEProfileRegistry::NewLC()
       
    97     {
       
    98     CRCSEProfileRegistry* self = new( ELeave ) CRCSEProfileRegistry;
       
    99     CleanupStack::PushL( self );
       
   100     self->ConstructL();
       
   101     return self;
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // Destructor
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 EXPORT_C CRCSEProfileRegistry::~CRCSEProfileRegistry()
       
   109     {
       
   110     RCSELOGSTRING( "CRCSEProfileRegistry::~CRCSEProfileRegistry() - IN" );
       
   111 
       
   112     delete iSIPRegistry;
       
   113     iSIPProfiles.ResetAndDestroy();
       
   114 
       
   115     RCSELOGSTRING( "CRCSEProfileRegistry::~CRCSEProfileRegistry() - OUT" );
       
   116     }
       
   117     
       
   118 // -----------------------------------------------------------------------------
       
   119 // CRCSEProfileRegistry::FindL
       
   120 // Start search of profile entry by provider name.
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 EXPORT_C void CRCSEProfileRegistry::FindL( 
       
   124     const TDesC& aProviderName,
       
   125     CRCSEProfileEntry& aFoundEntry )
       
   126     {
       
   127     RCSELOGSTRING2( "CRCSEProfileRegistry::FindL(%S) - IN", &aProviderName );
       
   128 
       
   129     BeginL();
       
   130 
       
   131     RArray<TUint32> entryIds;
       
   132     CleanupClosePushL( entryIds );
       
   133 
       
   134     // Search IDs of entries that have this service ID
       
   135     FindIdsByValueL( KColProviderName,
       
   136                      aProviderName, 
       
   137                      entryIds );
       
   138 
       
   139     // Search whole entry if ID was found
       
   140     if ( 0 < entryIds.Count() )
       
   141         {
       
   142         FindEntryL( entryIds[ 0 ], aFoundEntry );
       
   143         }
       
   144     else
       
   145         {
       
   146         User::Leave( KErrNotFound );
       
   147         }
       
   148 
       
   149     // Check that SIP Ids are valid
       
   150     UpdateSIPProfileLinksL( aFoundEntry );
       
   151     
       
   152     CleanupStack::PopAndDestroy( &entryIds );
       
   153 
       
   154     EndL();
       
   155 
       
   156     RCSELOGSTRING2( "CRCSEProfileRegistry::FindL(%S) - OUT", &aProviderName );
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CRCSEProfileRegistry::FindL
       
   161 // Start search of profile entry by ID.
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 EXPORT_C void CRCSEProfileRegistry::FindL( 
       
   165     TUint32 aProfileId, 
       
   166     CRCSEProfileEntry& aFoundEntry )
       
   167     {
       
   168     RCSELOGSTRING2( "CRCSEProfileRegistry::FindL(id=%d) - IN", aProfileId );
       
   169 
       
   170     BeginL();
       
   171 
       
   172     FindEntryL( aProfileId, aFoundEntry );
       
   173 
       
   174     // Check that SIP Ids are valid
       
   175     UpdateSIPProfileLinksL( aFoundEntry );
       
   176 
       
   177     EndL();
       
   178 
       
   179     RCSELOGSTRING2( "CRCSEProfileRegistry::FindL(id=%d) - OUT", aProfileId );
       
   180     }
       
   181     
       
   182 // -----------------------------------------------------------------------------
       
   183 // CRCSEProfileRegistry::AddL
       
   184 // Start addition of profile entry.
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 EXPORT_C TUint32 CRCSEProfileRegistry::AddL( 
       
   188     const CRCSEProfileEntry& aNewEntry )
       
   189     {
       
   190     RCSELOGSTRING( "CRCSEProfileRegistry::AddL() - IN" );
       
   191 
       
   192     BeginL();
       
   193 
       
   194     TUint32 id( KNoEntryId );
       
   195 
       
   196     // Add entry to storage
       
   197     AddOrUpdateEntryL( id, aNewEntry );
       
   198 
       
   199     __ASSERT_ALWAYS( KNoEntryId < id, User::Leave( KErrCorrupt ) );
       
   200 
       
   201     // Create service settings or use existing
       
   202     CRCSEProfileEntry& modifyEntry 
       
   203         = const_cast<CRCSEProfileEntry&>( aNewEntry );
       
   204 
       
   205     // New service settings entry...
       
   206     if( ( CRCSEProfileEntry::EOONotSet == modifyEntry.iNewServiceTableEntry ||
       
   207           CRCSEProfileEntry::EOn == modifyEntry.iNewServiceTableEntry ) )
       
   208         {
       
   209         CreateDefaultServiceSettingsL( modifyEntry );
       
   210         if ( modifyEntry.iServiceProviderId != KRCSEDefServiceProviderId )
       
   211             {
       
   212             UpdateServiceIdL( id, modifyEntry.iServiceProviderId );
       
   213             }
       
   214         }
       
   215 
       
   216     // Use existing service settings entry if
       
   217     // - given service id is valid
       
   218     // - service id is not used by another profile
       
   219     // - provider name is valid
       
   220     else if( CRCSEProfileEntry::EOff == modifyEntry.iNewServiceTableEntry &&
       
   221              KSPNoId < modifyEntry.iServiceProviderId )
       
   222         {
       
   223         // Check that provide name is valid
       
   224         TBool providerExist( 
       
   225             NameExistsInServiceTableL( modifyEntry.iProviderName ) );
       
   226 
       
   227         if( !providerExist )
       
   228             {
       
   229             User::Leave( KErrNotFound );
       
   230             }
       
   231 
       
   232         // Check that service id is not used by another profile
       
   233         LeaveIfServiceIdInUseL( modifyEntry );
       
   234         }
       
   235 
       
   236     // Fail all other cases
       
   237     else
       
   238         {
       
   239         User::Leave( KErrArgument );
       
   240         }
       
   241 
       
   242     EndL();
       
   243 
       
   244     RCSELOGSTRING( "CRCSEProfileRegistry::AddL() - OUT" );
       
   245 
       
   246     return id;
       
   247     }
       
   248 
       
   249 // -----------------------------------------------------------------------------
       
   250 // CRCSEProfileRegistry::DeleteL
       
   251 // Deletes a profile entry which profile id is aProfileId.
       
   252 // -----------------------------------------------------------------------------
       
   253 //
       
   254 EXPORT_C void CRCSEProfileRegistry::DeleteL( 
       
   255     TUint32 aProfileId )
       
   256     {
       
   257     RCSELOGSTRING( "CRCSEProfileRegistry::DeleteL() - IN" );
       
   258 
       
   259     // Delete referenced settings first
       
   260     DeleteReferenceSettingsL( aProfileId );
       
   261 
       
   262     // Start transaction here since referenced settings are
       
   263     // deleted in own separate transaction
       
   264     BeginL();
       
   265 
       
   266     // Delete actual profile
       
   267     iCenRepDb->DeleteEntryL( aProfileId );
       
   268 
       
   269     EndL();
       
   270 
       
   271     RCSELOGSTRING( "CRCSEProfileRegistry::DeleteL() - OUT" );
       
   272     }
       
   273 
       
   274 // -----------------------------------------------------------------------------
       
   275 // CRCSEProfileRegistry::UpdateL
       
   276 // Updates profile entry, which profile identifier is aId.
       
   277 // -----------------------------------------------------------------------------
       
   278 //
       
   279 EXPORT_C void CRCSEProfileRegistry::UpdateL(
       
   280     TUint32 aId, const CRCSEProfileEntry& aUpdateData )
       
   281     {
       
   282     RCSELOGSTRING2( "CRCSEProfileRegistry::UpdateL(%d) - IN", aId );
       
   283 
       
   284     __ASSERT_ALWAYS( KNoEntryId < aId, User::Leave( KErrArgument ) );
       
   285 
       
   286     BeginL();
       
   287 
       
   288     AddOrUpdateEntryL( aId, aUpdateData );
       
   289 
       
   290     // Update also service settings if needed
       
   291     if ( aUpdateData.iIds.Count() && 
       
   292         aUpdateData.iIds[0].iProfileType == CRCSEProfileEntry::EProtocolSIP )
       
   293         {
       
   294         if ( aUpdateData.iServiceProviderId == KRCSEDefServiceProviderId )
       
   295             {
       
   296             CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
       
   297             CopyEntryValues( aUpdateData, *entry );
       
   298             CreateDefaultServiceSettingsL( *entry );
       
   299             UpdateServiceSettingsL( *entry );
       
   300             AddOrUpdateEntryL( aId, *entry );
       
   301             CleanupStack::PopAndDestroy( entry );
       
   302             }
       
   303         else
       
   304             {
       
   305             UpdateServiceSettingsL( aUpdateData );
       
   306             }
       
   307         }
       
   308 
       
   309     EndL();
       
   310 
       
   311     RCSELOGSTRING2( "CRCSEProfileRegistry::UpdateL(%d) - OUT", aId );
       
   312     }
       
   313 
       
   314 // -----------------------------------------------------------------------------
       
   315 // CRCSEProfileRegistry::GetDefaultProfile
       
   316 // Resets a default profile values.
       
   317 // -----------------------------------------------------------------------------
       
   318 //
       
   319 EXPORT_C void CRCSEProfileRegistry::GetDefaultProfile( 
       
   320     CRCSEProfileEntry& aDefaultProfile ) const
       
   321     {
       
   322     aDefaultProfile.ResetDefaultValues();
       
   323     }
       
   324 
       
   325 // -----------------------------------------------------------------------------
       
   326 // CRCSEProfileRegistry::GetAllIdsL
       
   327 // Gets all profile identifiers.
       
   328 // -----------------------------------------------------------------------------
       
   329 //
       
   330 EXPORT_C void CRCSEProfileRegistry::GetAllIdsL( RArray<TUint32>& aAllIds )
       
   331     {
       
   332     RCSELOGSTRING( "CRCSEProfileRegistry::GetAllIdsL() - IN" );
       
   333 
       
   334     BeginL();
       
   335 
       
   336     FindAllIdsL( aAllIds );
       
   337     
       
   338     EndL();
       
   339 
       
   340     RCSELOGSTRING( "CRCSEProfileRegistry::GetAllIdsL() - OUT" );
       
   341     }
       
   342 
       
   343 
       
   344 // -----------------------------------------------------------------------------
       
   345 // CRCSEProfileRegistry::FindByServiceIdL
       
   346 // Gets all profiles matching to service ID.
       
   347 // -----------------------------------------------------------------------------
       
   348 //
       
   349 EXPORT_C void CRCSEProfileRegistry::FindByServiceIdL( TUint32 aServiceId, 
       
   350     RPointerArray<CRCSEProfileEntry>& aFoundEntries )
       
   351     {
       
   352     RCSELOGSTRING( "CRCSEProfileRegistry::FindByServiceIdL() - IN" );
       
   353 
       
   354     BeginL();
       
   355 
       
   356     TBuf<KDesLength128> des;
       
   357 
       
   358     RArray<TUint32> entryIds;
       
   359     CleanupClosePushL( entryIds );
       
   360 
       
   361     // Search IDs of entries that have this service ID
       
   362     FindIdsByValueL( KColServiceProviderId,
       
   363                      ToDes( aServiceId, des ), 
       
   364                      entryIds );
       
   365 
       
   366     const TInt count( entryIds.Count() );
       
   367     RCSELOGSTRING2( " - Entries found: %d", count );
       
   368 
       
   369     // Search entries using found IDs
       
   370     for ( TInt i( 0 ); i < count; i++ )
       
   371         {
       
   372         CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
       
   373         TRAPD( e, FindEntryL( entryIds[ i ], *entry ) );
       
   374 
       
   375         if ( KErrNone == e )
       
   376             {
       
   377             aFoundEntries.AppendL( entry );
       
   378             CleanupStack::Pop( entry );
       
   379             }
       
   380         else
       
   381             {
       
   382             CleanupStack::PopAndDestroy( entry );
       
   383             }
       
   384         }
       
   385 
       
   386     CleanupStack::PopAndDestroy( &entryIds );
       
   387 
       
   388     // Update SIP profile links
       
   389     const TInt entryCount( aFoundEntries.Count() );
       
   390     for ( TInt k( 0 ); k < entryCount; ++k )
       
   391         {
       
   392         UpdateSIPProfileLinksL( *aFoundEntries[k] );
       
   393         }
       
   394 
       
   395     EndL();
       
   396 
       
   397     RCSELOGSTRING( "CRCSEProfileRegistry::FindByServiceIdL() - OUT" );
       
   398     }
       
   399 
       
   400 
       
   401 // -----------------------------------------------------------------------------
       
   402 // CRCSEProfileRegistry::FindBySIPSprofileIdL
       
   403 // Gets all profiles based on SIP profile ID.
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 EXPORT_C void CRCSEProfileRegistry::FindBySIPProfileIdL( TUint32 aSipProfileId, 
       
   407     RPointerArray<CRCSEProfileEntry>& aFoundEntries )
       
   408     {
       
   409     RCSELOGSTRING( "CRCSEProfileRegistry::FindBySIPProfileIdL() - IN" );
       
   410 
       
   411     BeginL();
       
   412 
       
   413     // Find all profile IDs
       
   414     RArray<TUint32> voipIds;
       
   415     CleanupClosePushL( voipIds );
       
   416     FindAllIdsL( voipIds );
       
   417 
       
   418     // Check protocol ids (iIds) from each found profile ID.
       
   419     // Leave only those profile IDs where match found.
       
   420     CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
       
   421     TInt count( voipIds.Count() );
       
   422 
       
   423     RArray<TSettingIds> prIds;
       
   424     CleanupClosePushL( prIds );
       
   425 
       
   426     for ( TInt i( 0 ); i < count; i++ )
       
   427         {
       
   428         iCenRepDb->FindPropertyL( voipIds[ i ], KColProtocolIds, *property );
       
   429         
       
   430         const TDesC& value = property->GetDesValue();
       
   431 
       
   432         ExtractProtocoIdsL( value, prIds );
       
   433 
       
   434         TBool found( EFalse );
       
   435         TInt prIdCount( prIds.Count() );
       
   436         for ( TInt j( 0 ); j < prIdCount && !found; j++ )
       
   437             {
       
   438             if ( prIds[ j ].iProfileType == CRCSEProfileEntry::EProtocolSIP && 
       
   439                  prIds[ j ].iProfileId == aSipProfileId )
       
   440                 {
       
   441                 found = ETrue;
       
   442                 }
       
   443             }
       
   444 
       
   445         // Search profile if match found
       
   446         if ( found )
       
   447             {
       
   448             CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
       
   449             TRAPD( e, FindEntryL( voipIds[ i ], *entry ) );
       
   450 
       
   451             if ( KErrNone == e )
       
   452                 {
       
   453                 aFoundEntries.AppendL( entry );
       
   454                 CleanupStack::Pop( entry );
       
   455                 }
       
   456             else
       
   457                 {
       
   458                 CleanupStack::PopAndDestroy( entry );
       
   459                 }
       
   460             }
       
   461         }
       
   462 
       
   463 
       
   464     CleanupStack::PopAndDestroy( &prIds );
       
   465     CleanupStack::PopAndDestroy( property );
       
   466 
       
   467 
       
   468     // Update SIP profile links
       
   469     TInt entryCount( aFoundEntries.Count() );
       
   470     for ( TInt k( 0 ); k < entryCount; ++k )
       
   471         {
       
   472         UpdateSIPProfileLinksL( *aFoundEntries[k] );
       
   473         }
       
   474 
       
   475     CleanupStack::PopAndDestroy( &voipIds );
       
   476     EndL();
       
   477 
       
   478     RCSELOGSTRING( "CRCSEProfileRegistry::FindBySIPProfileIdL() - OUT" );
       
   479     }
       
   480 
       
   481 // ---------------------------------------------------------------------------
       
   482 // CRCSEProfileRegistry::AddL
       
   483 // Add bunch of entries to store
       
   484 // ---------------------------------------------------------------------------
       
   485 //
       
   486 void CRCSEProfileRegistry::AddL( 
       
   487     RPointerArray<CRCSEProfileEntry>& aEntries )
       
   488     {
       
   489     RCSELOGSTRING2( 
       
   490         "CRCSEProfileRegistry::AddL( %d entries) - IN", aEntries.Count() );
       
   491 
       
   492     BeginL();
       
   493 
       
   494     TInt count( aEntries.Count() );
       
   495 
       
   496     for ( TInt i( 0 ); i < count; ++i )
       
   497         {
       
   498         // Create service settings if service ID is not available for entry
       
   499         if (  KRCSEDefServiceProviderId == aEntries[ i ]->iServiceProviderId )
       
   500             {
       
   501             CreateDefaultServiceSettingsL( *aEntries[ i ] );
       
   502             }
       
   503 
       
   504         TUint32 id( KNoEntryId );
       
   505         AddOrUpdateEntryL( id, *aEntries[ i ] );
       
   506         aEntries[ i ]->iId = id;
       
   507         }
       
   508         
       
   509 
       
   510     EndL();
       
   511 
       
   512     RCSELOGSTRING( "CRCSEProfileRegistry::AddL(entries) - OUT" );
       
   513     }
       
   514 
       
   515 // -----------------------------------------------------------------------------
       
   516 // CRCSEProfileRegistry::FindEntryL
       
   517 // Do actual search of profile entry
       
   518 // -----------------------------------------------------------------------------
       
   519 //
       
   520 void CRCSEProfileRegistry::FindEntryL( 
       
   521     TUint32 aProfileId, 
       
   522     CRCSEProfileEntry& aFoundEntry )
       
   523     {
       
   524     RCSELOGSTRING2( "CRCSEProfileRegistry::FindEntryL(id=%d) - IN", aProfileId );
       
   525 
       
   526     RIpAppPropArray properties;
       
   527 	TCleanupItem cleanup( CRCSERegistryBase::CleanupDbPropArray, &properties );
       
   528 	CleanupStack::PushL( cleanup );
       
   529 
       
   530     User::LeaveIfError( iCenRepDb->FindEntryL( aProfileId, properties ) );
       
   531     ConvertPropertiesToEntryL( aFoundEntry, properties );
       
   532     aFoundEntry.iId = aProfileId;
       
   533     
       
   534     CleanupStack::PopAndDestroy( &properties );
       
   535 
       
   536     RCSELOGSTRING2( "CRCSEProfileRegistry::FindEntryL(id=%d) - OUT", aProfileId );
       
   537     }
       
   538 
       
   539 // -----------------------------------------------------------------------------
       
   540 // CRCSEProfileRegistry::AddOrUpdateEntryL
       
   541 // Adds new entry or updates values of existing enry
       
   542 // -----------------------------------------------------------------------------
       
   543 //
       
   544 void CRCSEProfileRegistry::AddOrUpdateEntryL( 
       
   545     TUint32& aId, 
       
   546     const CRCSEProfileEntry& aEntry )
       
   547     {
       
   548     RCSELOGSTRING( "CRCSEProfileRegistry::AddOrUpdateEntryL() - IN" );
       
   549 
       
   550     TInt id( aId );
       
   551 
       
   552     RIpAppPropArray properties;
       
   553 	TCleanupItem cleanup( CRCSERegistryBase::CleanupDbPropArray, &properties );
       
   554 	CleanupStack::PushL( cleanup );
       
   555 
       
   556     ConvertEntryToPropertiesL( aEntry, properties );
       
   557 
       
   558     if ( KNoEntryId == id ) // Add new one
       
   559         {
       
   560         RCSELOGSTRING( "-- Add --" );
       
   561         iCenRepDb->AddEntryL( id, properties );
       
   562         }
       
   563     else                    // Update existing entry
       
   564         {
       
   565         RCSELOGSTRING( "-- Update --" );
       
   566         User::LeaveIfError( iCenRepDb->UpdateEntryL( id, properties ) );
       
   567         }
       
   568 
       
   569     aId = id;
       
   570 
       
   571     CleanupStack::PopAndDestroy( &properties );
       
   572 
       
   573     RCSELOGSTRING( "CRCSEProfileRegistry::AddOrUpdateEntryL() - OUT" );
       
   574     }
       
   575 
       
   576 // -----------------------------------------------------------------------------
       
   577 // 
       
   578 // -----------------------------------------------------------------------------
       
   579 //
       
   580 void CRCSEProfileRegistry::ConvertPropertiesToEntryL( 
       
   581     CRCSEProfileEntry& aEntry,
       
   582     RIpAppPropArray& aProperties )
       
   583     {
       
   584     RCSELOGSTRING( "CRCSEProfileRegistry::ConvertPropertiesToEntryL() - IN" );
       
   585 
       
   586     aEntry.ResetDefaultValues();
       
   587 
       
   588     TBuf<KDesLength256> value;
       
   589 
       
   590     GetPropertyValueL( KColProviderName, aEntry.iProviderName, aProperties );
       
   591 
       
   592     GetPropertyValueL( KColSettingsName, aEntry.iSettingsName, aProperties );
       
   593 
       
   594     GetPropertyValueL( KColPreferredCodecs, value, aProperties );
       
   595 
       
   596     TLex lex2( value );
       
   597     while( !lex2.Eos() )
       
   598         {
       
   599         // Extract the number as unsigned int 32, which can be 
       
   600         // converted to value wanted (template)
       
   601         TUint32 num;
       
   602         lex2.Val( num, EDecimal );
       
   603         aEntry.iPreferredCodecs.AppendL( static_cast<TUint32>( num ) );
       
   604         // Skip characters to space char.
       
   605         lex2.SkipCharacters();
       
   606         if ( !lex2.Eos() ) // Check that End of string is not next char.
       
   607             {
       
   608             // Go over the space character.
       
   609             lex2.Inc( 1 );
       
   610             }
       
   611         }
       
   612 
       
   613     GetPropertyValueL( KColStartMediaPort, value, aProperties );
       
   614     aEntry.iStartMediaPort = ToTInt32L( value );
       
   615 
       
   616     GetPropertyValueL( KColEndMediaPort, value, aProperties );
       
   617     aEntry.iEndMediaPort = ToTInt32L( value );
       
   618 
       
   619     GetPropertyValueL( KColSiqnalingQOS, value, aProperties );
       
   620     aEntry.iSiqnalingQOS = ToTInt32L( value );
       
   621 
       
   622     GetPropertyValueL( KColMediaQOS, value, aProperties );
       
   623     aEntry.iMediaQOS = ToTInt32L( value );
       
   624 
       
   625     GetPropertyValueL( KColInbandDtmf, value, aProperties );
       
   626     aEntry.iInbandDTMF = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   627 
       
   628     GetPropertyValueL( KColOutbandDtmf, value, aProperties );
       
   629     aEntry.iOutbandDTMF = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   630 
       
   631     GetPropertyValueL( KColHoldRingBack, value, aProperties );
       
   632     aEntry.iHoldRingBack = ToTInt32L( value );
       
   633 
       
   634     GetPropertyValueL( KColAutoComplete, value, aProperties );
       
   635     aEntry.iAutoComplete = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   636 
       
   637     GetPropertyValueL( KColCFNoAnswer, value, aProperties );
       
   638     aEntry.iCFNoAnswer = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   639 
       
   640     GetPropertyValueL( KColCFBusy, value, aProperties );
       
   641     aEntry.iCFBusy = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   642 
       
   643     GetPropertyValueL( KColCFUnconditional, value, aProperties );
       
   644     aEntry.iCFUnconditional = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   645 
       
   646     GetPropertyValueL( KColRedundancy, value, aProperties );
       
   647     aEntry.iRedundancy = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   648 
       
   649     GetPropertyValueL( KColProtocolIds, value, aProperties );
       
   650     ExtractProtocoIdsL( value, aEntry.iIds );
       
   651 
       
   652     GetPropertyValueL( KColSecureCallPreference, value, aProperties );
       
   653     aEntry.iSecureCallPreference = ToTUint32L( value );
       
   654 
       
   655     GetPropertyValueL( KColVoIPProfileLock, value, aProperties );
       
   656     aEntry.iVoIPProfileLock = ToTUint32L( value );
       
   657 
       
   658     GetPropertyValueL( KColAdhocAllowed, value, aProperties );
       
   659     aEntry.iAdhocAllowed = ToTUint32L( value );
       
   660 
       
   661     GetPropertyValueL( KColSIPServerType, value, aProperties );
       
   662     aEntry.iSIPServerType.Copy( value );
       
   663 
       
   664     GetPropertyValueL( KColSBCType, value, aProperties );
       
   665     aEntry.iSBCType.Copy( value );;
       
   666 
       
   667     GetPropertyValueL( KColSTUNServerType, value, aProperties );
       
   668     aEntry.iSTUNServerType.Copy( value );
       
   669 
       
   670     GetPropertyValueL( KColWLANAPType, value, aProperties );
       
   671     aEntry.iWLANAPType.Copy( value );
       
   672 
       
   673     GetPropertyValueL( KColPSTNGatewayType, value, aProperties );
       
   674     aEntry.iPSTNGatewayType.Copy( value );
       
   675 
       
   676     GetPropertyValueL( KColSecurityGatewayType, value, aProperties );
       
   677     aEntry.iSecurityGatewayType.Copy( value );
       
   678 
       
   679     GetPropertyValueL( KColRTCP, value, aProperties );
       
   680     aEntry.iRTCP = ToTUint32L( value );
       
   681 
       
   682     GetPropertyValueL( KColSIPVoIPUAHTerminalType, value, aProperties );
       
   683     aEntry.iSIPVoIPUAHTerminalType = ToTUint32L( value );
       
   684 
       
   685     GetPropertyValueL( KColSIPVoIPUAHeaderWLANMAC, value, aProperties );
       
   686     aEntry.iSIPVoIPUAHeaderWLANMAC = ToTUint32L( value );
       
   687 
       
   688     GetPropertyValueL( KColSIPVoIPUAHeaderString, value, aProperties );
       
   689     aEntry.iSIPVoIPUAHeaderString.Copy( value );
       
   690 
       
   691     GetPropertyValueL( KColProfileLockedToIAP, value, aProperties );
       
   692     aEntry.iProfileLockedToIAP = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   693 
       
   694     GetPropertyValueL( KColVoIPPluginUID, value, aProperties );
       
   695     aEntry.iVoIPPluginUID = ToTInt32L( value );
       
   696 
       
   697     GetPropertyValueL( KColAllowVoIPoverWCDMA, value, aProperties );
       
   698     aEntry.iAllowVoIPoverWCDMA = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   699 
       
   700     GetPropertyValueL( KColAllowVoIPoverBT, value, aProperties );
       
   701     aEntry.iAllowVoIPoverBT = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   702 
       
   703     GetPropertyValueL( KColMeanCountOfVoIPDigits, value, aProperties );
       
   704     aEntry.iMeanCountOfVoIPDigits = ToTInt32L( value );
       
   705 
       
   706     GetPropertyValueL( KColIgnoreAddrDomainPart, value, aProperties );
       
   707     aEntry.iIgnoreAddrDomainPart = ToTInt32L( value );
       
   708 
       
   709     GetPropertyValueL( KColHandoverDialect, value, aProperties );
       
   710     aEntry.iHandoverDialect = ToTInt32L( value );
       
   711 
       
   712     GetPropertyValueL( KColPSTelephonyHOPreference, value, aProperties );
       
   713     aEntry.iPSTelephonyHOPreference = ToTInt32L( value );
       
   714 
       
   715     GetPropertyValueL( KColHOThresholdValueLL, value, aProperties );
       
   716     aEntry.iHOThresholdValueLL = ToTInt32L( value );
       
   717 
       
   718     GetPropertyValueL( KColHOThresholdValueHL, value, aProperties );
       
   719     aEntry.iHOThresholdValueHL = ToTInt32L( value );
       
   720 
       
   721     GetPropertyValueL( KColNumberOfMeasurementsAbove, value, aProperties );
       
   722     aEntry.iNumberOfMeasurementsAbove = ToTInt32L( value );
       
   723 
       
   724     GetPropertyValueL( KColNumberOfMeasurementsBelow, value, aProperties );
       
   725     aEntry.iNumberOfMeasurementsBelow = ToTInt32L( value );
       
   726 
       
   727     GetPropertyValueL( KColSmartScannInterParaHigh, value, aProperties );
       
   728     aEntry.iSmartScannInterParaHigh = ToTInt32L( value );
       
   729 
       
   730     GetPropertyValueL( KColSmartScannInterParaMedium, value, aProperties );
       
   731     aEntry.iSmartScannInterParaMedium = ToTInt32L( value );
       
   732 
       
   733     GetPropertyValueL( KColSmartScannInterParaLow, value, aProperties );
       
   734     aEntry.iSmartScannInterParaLow = ToTInt32L( value );
       
   735 
       
   736     GetPropertyValueL( KColSmartScannInterParaStatic, value, aProperties );
       
   737     aEntry.iSmartScannInterParaStatic = ToTInt32L( value );
       
   738 
       
   739     GetPropertyValueL( KColSmartScannDurationHighMode, value, aProperties );
       
   740     aEntry.iSmartScannDurationHighMode = ToTInt32L( value );
       
   741 
       
   742     GetPropertyValueL( KColSmartScannDurationMediumMode, value, aProperties );
       
   743     aEntry.iSmartScannDurationMediumMode = ToTInt32L( value );
       
   744 
       
   745     GetPropertyValueL( KColSmartScannDurationLowMode, value, aProperties );
       
   746     aEntry.iSmartScannDurationLowMode = ToTInt32L( value );
       
   747 
       
   748     GetPropertyValueL( KColHandoffNumber, value, aProperties );
       
   749     aEntry.iHandoffNumber = ToTInt32L( value );
       
   750 
       
   751     GetPropertyValueL( KColHandbackNumber, value, aProperties );
       
   752     aEntry.iHandbackNumber = ToTInt32L( value );
       
   753 
       
   754     GetPropertyValueL( KColHysterisisTimer, value, aProperties );
       
   755     aEntry.iHysterisisTimer = ToTInt32L( value );
       
   756 
       
   757     GetPropertyValueL( KColHandOffProcessTimer, value, aProperties );
       
   758     aEntry.iHandOffProcessTimer = ToTInt32L( value );
       
   759 
       
   760     GetPropertyValueL( KColDisconnectProcessTimer, value, aProperties );
       
   761     aEntry.iDisconnectProcessTimer = ToTInt32L( value );
       
   762 
       
   763     GetPropertyValueL( KColHandoffPrefix, value, aProperties );
       
   764     aEntry.iHandoffPrefix.Copy( value );
       
   765 
       
   766     GetPropertyValueL( KColHandbackPrefix, value, aProperties );
       
   767     aEntry.iHandbackPrefix.Copy( value );
       
   768 
       
   769     GetPropertyValueL( KColHandoverTones, value, aProperties );
       
   770     aEntry.iHandoverTones = ToTInt32L( value );
       
   771 
       
   772     GetPropertyValueL( KColSupportSMSoverWLAN, value, aProperties );
       
   773     aEntry.iSupportSMSoverWLAN = ToTInt32L( value );
       
   774 
       
   775     GetPropertyValueL( KColServiceProviderId, value, aProperties );
       
   776     aEntry.iServiceProviderId = ToTUint32L( value );
       
   777 
       
   778     GetPropertyValueL( KColUserPhoneUriParam, value, aProperties );
       
   779     aEntry.iUserPhoneUriParameter = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   780 
       
   781     GetPropertyValueL( KColSIPConnTestAddress, value, aProperties );
       
   782     aEntry.iSIPConnTestAddress.Copy( value );
       
   783 
       
   784     GetPropertyValueL( KColNATSettingsStorageId, value, aProperties );
       
   785     aEntry.iNATSettingsStorageId = ToTUint32L( value );
       
   786 
       
   787     GetPropertyValueL( KColSIPMinSE, value, aProperties );
       
   788     aEntry.iSIPMinSE = ToTInt32L( value );
       
   789 
       
   790     GetPropertyValueL( KColSIPSessionExpires, value, aProperties );
       
   791     aEntry.iSIPSessionExpires = ToTInt32L( value );
       
   792 
       
   793     GetPropertyValueL( KColNATProtocol, value, aProperties );
       
   794     aEntry.iNATProtocol = ToTInt32L( value );
       
   795 
       
   796     GetPropertyValueL( KColNewServiceTable, value, aProperties );
       
   797     aEntry.iNewServiceTableEntry = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
       
   798 
       
   799     GetPropertyValueL( KColSNAPId, value, aProperties );
       
   800     aEntry.iSNAPId = ToTUint32L( value );
       
   801     
       
   802     GetPropertyValueL( KColCreationUrl, value, aProperties );
       
   803     aEntry.iAccountCreationUrl.Copy( value );
       
   804 
       
   805     RCSELOGSTRING( "CRCSEProfileRegistry::ConvertPropertiesToEntryL() - OUT" );
       
   806     }
       
   807 
       
   808 
       
   809 // -----------------------------------------------------------------------------
       
   810 // 
       
   811 // -----------------------------------------------------------------------------
       
   812 //
       
   813 void CRCSEProfileRegistry::ConvertEntryToPropertiesL( 
       
   814     const CRCSEProfileEntry& aEntry,
       
   815     RIpAppPropArray& aProperties )
       
   816     {
       
   817     RCSELOGSTRING( "CRCSEProfileRegistry::ConvertEntryToPropertiesL() - IN" );
       
   818 
       
   819     // Descriptor for value conversion
       
   820     TBuf<KDesLength128> des;
       
   821 
       
   822     CreatePropertyL( KColProviderName,
       
   823                      aEntry.iProviderName,
       
   824                      aProperties );
       
   825 
       
   826     CreatePropertyL( KColSettingsName, 
       
   827                      aEntry.iSettingsName,
       
   828                      aProperties );
       
   829 
       
   830     TInt count = aEntry.iPreferredCodecs.Count();
       
   831     des.Zero();
       
   832     for ( TInt j( 0 ); j < count; j++ )
       
   833         {
       
   834         des.AppendNum( static_cast<TUint32>( aEntry.iPreferredCodecs[j] ) );
       
   835         if ( j < count - 1 )
       
   836             {
       
   837             des.Append( KSpace );
       
   838             }
       
   839         }
       
   840 
       
   841     CreatePropertyL( KColPreferredCodecs, 
       
   842                      des,
       
   843                      aProperties );
       
   844 
       
   845     CreatePropertyL( KColStartMediaPort, 
       
   846                      ToDes( aEntry.iStartMediaPort, des ),
       
   847                      aProperties );
       
   848 
       
   849     CreatePropertyL( KColEndMediaPort, 
       
   850                      ToDes( aEntry.iEndMediaPort, des ),
       
   851                      aProperties );
       
   852 
       
   853     CreatePropertyL( KColSiqnalingQOS, 
       
   854                      ToDes( aEntry.iSiqnalingQOS, des ),
       
   855                      aProperties );
       
   856 
       
   857     CreatePropertyL(  KColMediaQOS, 
       
   858                      ToDes( aEntry.iMediaQOS, des ),
       
   859                      aProperties );
       
   860 
       
   861     TInt32 inbandDTMF( aEntry.iInbandDTMF ); // TOnOff
       
   862     CreatePropertyL( KColInbandDtmf, 
       
   863                      ToDes( inbandDTMF, des ),
       
   864                      aProperties );
       
   865 
       
   866     TInt32 outbandDTMF( aEntry.iOutbandDTMF ); // TOnOff
       
   867     CreatePropertyL( KColOutbandDtmf, 
       
   868                      ToDes( outbandDTMF, des ),
       
   869                      aProperties );
       
   870 
       
   871     TInt32 holdRingBack( aEntry.iHoldRingBack ); // TOnOff
       
   872     CreatePropertyL( KColHoldRingBack, 
       
   873                      ToDes( holdRingBack, des ),
       
   874                      aProperties );
       
   875 
       
   876     TInt32 autoComplete = aEntry.iAutoComplete; // TOnOff
       
   877     CreatePropertyL( KColAutoComplete, 
       
   878                      ToDes( autoComplete, des ),
       
   879                      aProperties );
       
   880 
       
   881     TInt32 cfNoAnswer( aEntry.iCFNoAnswer ); // TOnOff
       
   882     CreatePropertyL( KColCFNoAnswer, 
       
   883                      ToDes( cfNoAnswer,  des ),
       
   884                      aProperties );
       
   885 
       
   886     TInt32 cfBusy( aEntry.iCFBusy ); // TOnOff
       
   887     CreatePropertyL( KColCFBusy, 
       
   888                      ToDes( cfBusy, des ),
       
   889                      aProperties );
       
   890 
       
   891     TInt32 cfUnconditional( aEntry.iCFUnconditional ); // TOnOff
       
   892     CreatePropertyL( KColCFUnconditional, 
       
   893                      ToDes( cfUnconditional, des ),
       
   894                      aProperties );
       
   895 
       
   896     TInt32 redundancy( aEntry.iRedundancy ); // TOnOff
       
   897     CreatePropertyL( KColRedundancy, 
       
   898                      ToDes( redundancy, des ),
       
   899                      aProperties );
       
   900 
       
   901     des.Zero();
       
   902     TBuf<KDesLength15> intDes; // for SIP profile ID
       
   903     count = aEntry.iIds.Count();
       
   904 
       
   905     if ( count )
       
   906         {
       
   907         for( TInt i = 0; i < count; i++ )
       
   908             {
       
   909             intDes.Zero();
       
   910 
       
   911             TInt profileType = aEntry.iIds[i].iProfileType;
       
   912             intDes.Num( profileType );
       
   913             des.Append( intDes );
       
   914             des.Append( KSpace );
       
   915 
       
   916             TInt profileId = aEntry.iIds[i].iProfileId;
       
   917             intDes.Num( profileId );
       
   918             des.Append( intDes );
       
   919             des.Append( KSpace );
       
   920 
       
   921             TInt profileSpecificId = aEntry.iIds[i].iProfileSpecificSettingId;
       
   922             intDes.Num( profileSpecificId );
       
   923             des.Append( intDes );
       
   924             des.Append( KSpace );
       
   925             }
       
   926         }
       
   927 
       
   928     CreatePropertyL( KColProtocolIds, 
       
   929                      des,
       
   930                      aProperties );
       
   931 
       
   932     CreatePropertyL( KColSecureCallPreference, 
       
   933                      ToDes( aEntry.iSecureCallPreference, des ),
       
   934                      aProperties );
       
   935 
       
   936     CreatePropertyL( KColVoIPProfileLock, 
       
   937                      ToDes( aEntry.iVoIPProfileLock, des ),
       
   938                      aProperties );
       
   939 
       
   940     CreatePropertyL( KColAdhocAllowed, 
       
   941                      ToDes( aEntry.iAdhocAllowed, des ),
       
   942                      aProperties );
       
   943 
       
   944     CreatePropertyL( KColSIPServerType, 
       
   945                      aEntry.iSIPServerType,
       
   946                      aProperties );
       
   947 
       
   948     CreatePropertyL( KColSBCType, 
       
   949                      aEntry.iSBCType,
       
   950                      aProperties );
       
   951 
       
   952     CreatePropertyL( KColSTUNServerType, 
       
   953                      aEntry.iSTUNServerType,
       
   954                      aProperties );
       
   955 
       
   956     CreatePropertyL( KColWLANAPType, 
       
   957                      aEntry.iWLANAPType,
       
   958                      aProperties );
       
   959 
       
   960     CreatePropertyL( KColPSTNGatewayType, 
       
   961                      aEntry.iPSTNGatewayType,
       
   962                      aProperties );
       
   963 
       
   964     CreatePropertyL( KColSecurityGatewayType, 
       
   965                      aEntry.iSecurityGatewayType,
       
   966                      aProperties );
       
   967   
       
   968     CreatePropertyL( KColRTCP, 
       
   969                      ToDes( aEntry.iRTCP, des ),
       
   970                      aProperties );
       
   971 
       
   972     CreatePropertyL( KColSIPVoIPUAHTerminalType, 
       
   973                      ToDes( aEntry.iSIPVoIPUAHTerminalType, des ),
       
   974                      aProperties );
       
   975 
       
   976     CreatePropertyL( KColSIPVoIPUAHeaderWLANMAC, 
       
   977                      ToDes( aEntry.iSIPVoIPUAHeaderWLANMAC, des ),
       
   978                      aProperties );
       
   979 
       
   980     CreatePropertyL( KColSIPVoIPUAHeaderString, 
       
   981                      aEntry.iSIPVoIPUAHeaderString,
       
   982                      aProperties );
       
   983 
       
   984     TInt32 profileLockedToIAP( aEntry.iProfileLockedToIAP ); // TOnOff
       
   985     CreatePropertyL( KColProfileLockedToIAP, 
       
   986                      ToDes( profileLockedToIAP, des ),
       
   987                      aProperties );
       
   988 
       
   989     CreatePropertyL( KColVoIPPluginUID, 
       
   990                      ToDes( aEntry.iVoIPPluginUID, des ),
       
   991                      aProperties );
       
   992 
       
   993     TInt32 allowVoIPoverWCDMA( aEntry.iAllowVoIPoverWCDMA ); // TOnOff
       
   994     CreatePropertyL( KColAllowVoIPoverWCDMA, 
       
   995                      ToDes( allowVoIPoverWCDMA, des ),
       
   996                      aProperties );
       
   997 
       
   998     TInt32 allowVoIPoverBT( aEntry.iAllowVoIPoverBT ); // TOnOff
       
   999     CreatePropertyL( KColAllowVoIPoverBT, 
       
  1000                      ToDes( allowVoIPoverBT, des ),
       
  1001                      aProperties );
       
  1002 
       
  1003     CreatePropertyL( KColMeanCountOfVoIPDigits,
       
  1004                      ToDes( aEntry.iMeanCountOfVoIPDigits, des ),
       
  1005                      aProperties );
       
  1006 
       
  1007     CreatePropertyL( KColIgnoreAddrDomainPart, 
       
  1008                      ToDes( aEntry.iIgnoreAddrDomainPart, des ),
       
  1009                      aProperties );
       
  1010 
       
  1011     CreatePropertyL( KColHandoverDialect, 
       
  1012                      ToDes( aEntry.iHandoverDialect, des ),
       
  1013                      aProperties );
       
  1014 
       
  1015     CreatePropertyL( KColPSTelephonyHOPreference, 
       
  1016                      ToDes( aEntry.iPSTelephonyHOPreference, des ),
       
  1017                      aProperties );
       
  1018 
       
  1019     CreatePropertyL( KColHOThresholdValueLL, 
       
  1020                      ToDes( aEntry.iHOThresholdValueLL, des ),
       
  1021                      aProperties );
       
  1022 
       
  1023     CreatePropertyL( KColHOThresholdValueHL, 
       
  1024                      ToDes( aEntry.iHOThresholdValueHL, des ),
       
  1025                      aProperties );
       
  1026 
       
  1027     CreatePropertyL( KColNumberOfMeasurementsAbove, 
       
  1028                      ToDes( aEntry.iNumberOfMeasurementsAbove, des ),
       
  1029                      aProperties );
       
  1030 
       
  1031     CreatePropertyL( KColNumberOfMeasurementsBelow, 
       
  1032                      ToDes( aEntry.iNumberOfMeasurementsBelow, des ),
       
  1033                      aProperties );
       
  1034 
       
  1035     CreatePropertyL( KColSmartScannInterParaHigh, 
       
  1036                      ToDes( aEntry.iSmartScannInterParaHigh, des ),
       
  1037                      aProperties );
       
  1038 
       
  1039     CreatePropertyL( KColSmartScannInterParaMedium, 
       
  1040                      ToDes(  aEntry.iSmartScannInterParaMedium, des ),
       
  1041                      aProperties );
       
  1042 
       
  1043     CreatePropertyL( KColSmartScannInterParaLow, 
       
  1044                      ToDes( aEntry.iSmartScannInterParaLow, des ),
       
  1045                      aProperties );
       
  1046 
       
  1047     CreatePropertyL( KColSmartScannInterParaStatic, 
       
  1048                      ToDes( aEntry.iSmartScannInterParaStatic, des ),
       
  1049                      aProperties );
       
  1050 
       
  1051     CreatePropertyL( KColSmartScannDurationHighMode, 
       
  1052                      ToDes( aEntry.iSmartScannDurationHighMode, des ),
       
  1053                      aProperties );
       
  1054 
       
  1055     CreatePropertyL( KColSmartScannDurationMediumMode, 
       
  1056                      ToDes( aEntry.iSmartScannDurationMediumMode, des ),
       
  1057                      aProperties );
       
  1058 
       
  1059     CreatePropertyL( KColSmartScannDurationLowMode, 
       
  1060                      ToDes( aEntry.iSmartScannDurationLowMode, des ),
       
  1061                      aProperties );
       
  1062 
       
  1063     CreatePropertyL( KColHandoffNumber, 
       
  1064                      ToDes( aEntry.iHandoffNumber, des ),
       
  1065                      aProperties );
       
  1066 
       
  1067     CreatePropertyL( KColHandbackNumber, 
       
  1068                      ToDes( aEntry.iHandbackNumber, des ),
       
  1069                      aProperties );
       
  1070 
       
  1071     CreatePropertyL( KColHysterisisTimer, 
       
  1072                      ToDes( aEntry.iHysterisisTimer, des ),
       
  1073                      aProperties );
       
  1074 
       
  1075     CreatePropertyL( KColHandOffProcessTimer, 
       
  1076                      ToDes( aEntry.iHandOffProcessTimer, des ),
       
  1077                      aProperties );
       
  1078 
       
  1079     CreatePropertyL( KColDisconnectProcessTimer, 
       
  1080                      ToDes( aEntry.iDisconnectProcessTimer, des ),
       
  1081                      aProperties );
       
  1082 
       
  1083     CreatePropertyL( KColHandoffPrefix, 
       
  1084                      aEntry.iHandoffPrefix,
       
  1085                      aProperties );
       
  1086 
       
  1087     CreatePropertyL( KColHandbackPrefix, 
       
  1088                      aEntry.iHandbackPrefix,
       
  1089                      aProperties );
       
  1090 
       
  1091     CreatePropertyL( KColHandoverTones, 
       
  1092                      ToDes( aEntry.iHandoverTones, des ),
       
  1093                      aProperties );
       
  1094 
       
  1095     CreatePropertyL( KColSupportSMSoverWLAN, 
       
  1096                      ToDes( aEntry.iSupportSMSoverWLAN, des ),
       
  1097                      aProperties );
       
  1098 
       
  1099     CreatePropertyL( KColServiceProviderId, 
       
  1100                      ToDes( aEntry.iServiceProviderId, des ),
       
  1101                      aProperties );
       
  1102 
       
  1103     TInt32 userPhoneUriParameter( aEntry.iUserPhoneUriParameter ); // TOnOff
       
  1104     CreatePropertyL( KColUserPhoneUriParam, 
       
  1105                      ToDes( userPhoneUriParameter, des ),
       
  1106                      aProperties );
       
  1107 
       
  1108     CreatePropertyL( KColSIPConnTestAddress, 
       
  1109                      aEntry.iSIPConnTestAddress,
       
  1110                      aProperties );
       
  1111 
       
  1112     CreatePropertyL( KColNATSettingsStorageId, 
       
  1113                      ToDes( aEntry.iNATSettingsStorageId, des ),
       
  1114                      aProperties );
       
  1115 
       
  1116     CreatePropertyL( KColSIPMinSE, 
       
  1117                      ToDes( aEntry.iSIPMinSE, des ),
       
  1118                      aProperties );
       
  1119 
       
  1120     CreatePropertyL( KColSIPSessionExpires, 
       
  1121                      ToDes( aEntry.iSIPSessionExpires, des ),
       
  1122                      aProperties );
       
  1123 
       
  1124     CreatePropertyL( KColNATProtocol, 
       
  1125                      ToDes( aEntry.iNATProtocol, des ),
       
  1126                      aProperties );
       
  1127 
       
  1128     TInt32 newServiceTable( aEntry.iNewServiceTableEntry ); // TOnOff
       
  1129     CreatePropertyL( KColNewServiceTable, 
       
  1130                      ToDes( newServiceTable, des ),
       
  1131                      aProperties );
       
  1132 
       
  1133     CreatePropertyL( KColSNAPId, 
       
  1134                      ToDes( aEntry.iSNAPId, des ),
       
  1135                      aProperties );
       
  1136 
       
  1137     CreatePropertyL( KColCreationUrl, 
       
  1138                      aEntry.iAccountCreationUrl,
       
  1139                      aProperties );
       
  1140     
       
  1141     RCSELOGSTRING( "CRCSEProfileRegistry::ConvertEntryToPropertiesL() - OUT" );
       
  1142     }
       
  1143 
       
  1144 // -----------------------------------------------------------------------------
       
  1145 // CRCSEProfileRegistry::
       
  1146 // -----------------------------------------------------------------------------
       
  1147 //
       
  1148 void CRCSEProfileRegistry::ExtractProtocoIdsL( 
       
  1149     const TDesC& aDes, RArray<TSettingIds>& aArray )
       
  1150     {
       
  1151     TLex lex( aDes );
       
  1152     
       
  1153     TSettingIds value;
       
  1154     
       
  1155     // Reset original array
       
  1156     aArray.Reset();
       
  1157     
       
  1158     while( !lex.Eos() )
       
  1159         {
       
  1160         lex.Val( value.iProfileType );
       
  1161         // Skip characters to space char.
       
  1162         lex.SkipCharacters();
       
  1163         lex.Inc( 1 );
       
  1164         lex.Val( value.iProfileId );
       
  1165         lex.SkipCharacters();
       
  1166         lex.Inc( 1 );
       
  1167         lex.Val( value.iProfileSpecificSettingId );
       
  1168         
       
  1169         aArray.AppendL( value );
       
  1170         if ( !lex.Eos() ) // Check that End of string is not next char.
       
  1171             {
       
  1172             // Go over the space character.
       
  1173             lex.Inc( 1 );
       
  1174             }
       
  1175         } 
       
  1176     }
       
  1177 
       
  1178 // -----------------------------------------------------------------------------
       
  1179 // CRCSEProfileRegistry::UpdateSIPProfileLinksL
       
  1180 // Validates profile's SIP profile IDs and updates if necessary
       
  1181 // -----------------------------------------------------------------------------
       
  1182 //
       
  1183 void CRCSEProfileRegistry::UpdateSIPProfileLinksL( CRCSEProfileEntry& aEntry )
       
  1184     {
       
  1185     RCSELOGSTRING( "CRCSEProfileRegistry::UpdateSIPProfileLinksL - IN" );
       
  1186     const TInt count( aEntry.iIds.Count() );
       
  1187     TSettingIds value;
       
  1188     RCSELOGSTRING2( "Protocol link count=%d", count );
       
  1189 
       
  1190     if ( 0 < count )
       
  1191         {
       
  1192         iSIPProfiles.ResetAndDestroy();
       
  1193 
       
  1194         TInt err(0);
       
  1195         // Check the existence of linked SIP profiles
       
  1196         for ( TInt i( count-1 ); 0 <= i ; i-- )
       
  1197             {
       
  1198             value = aEntry.iIds[i];
       
  1199 
       
  1200             if ( CRCSEProfileEntry::EProtocolSIP == value.iProfileType )
       
  1201                 {
       
  1202                 CSIPProfile* profile = NULL;
       
  1203                 TRAP( err, profile = iSIPRegistry->ProfileL( value.iProfileId ) );
       
  1204                 if ( KErrNotFound == err )
       
  1205                     {
       
  1206                     aEntry.iIds.Remove( i );
       
  1207                     delete profile;
       
  1208                     profile = NULL;
       
  1209                     RCSELOGSTRING2( "SIP link removed, id=%d", value.iProfileId );
       
  1210                     }
       
  1211                 else if ( KErrNone == err )
       
  1212                     {
       
  1213                     err = iSIPProfiles.Append( profile );
       
  1214                     }
       
  1215                 else
       
  1216                     {
       
  1217                     delete profile;
       
  1218                     profile = NULL;
       
  1219                     }
       
  1220                 }
       
  1221             }
       
  1222 
       
  1223         // Check that all profiles have same AOR.
       
  1224         // If some AOR differs leave only the first link
       
  1225         TInt profCount( iSIPProfiles.Count() );
       
  1226         RCSELOGSTRING2( "SIP link count=%d", profCount );
       
  1227         TBool ok( ETrue );
       
  1228         if ( 1 < profCount )
       
  1229             {
       
  1230             const TDesC8* aor1;
       
  1231             HBufC8* empty = KNullDesC8().AllocLC();
       
  1232             err = iSIPProfiles[0]->GetParameter( KSIPUserAor, aor1 );
       
  1233 
       
  1234             if ( KErrNotFound == err )
       
  1235                 {
       
  1236                 aor1 = empty;
       
  1237                 }
       
  1238 
       
  1239             for ( TInt j( 1 ); j < profCount; j++ )
       
  1240                 {
       
  1241                 const TDesC8* aor2;
       
  1242                 err = iSIPProfiles[j]->GetParameter( KSIPUserAor, aor2 );
       
  1243 
       
  1244                 if ( KErrNotFound == err )
       
  1245                     {
       
  1246                     if ( aor1->Compare( KNullDesC8() ) != 0 )
       
  1247                         {
       
  1248                         ok = EFalse;
       
  1249                         }
       
  1250                     }
       
  1251                 else
       
  1252                     { 
       
  1253                     if ( aor1->Compare( *aor2 ) != 0 )
       
  1254                         {
       
  1255                         ok = EFalse;
       
  1256                         }
       
  1257                     }
       
  1258                 }
       
  1259             CleanupStack::PopAndDestroy( empty );
       
  1260 
       
  1261             if ( !ok )
       
  1262                 {
       
  1263                 RCSELOGSTRING( "AOR changed" );
       
  1264                 TInt newCount = aEntry.iIds.Count();
       
  1265                 TBool first( ETrue );
       
  1266                 for ( TInt k( 0 ); k < newCount; k++ )
       
  1267                     {
       
  1268                     value = aEntry.iIds[k];
       
  1269                     if ( CRCSEProfileEntry::EProtocolSIP == value.iProfileType )
       
  1270                         {
       
  1271                         if ( first )
       
  1272                             {
       
  1273                             first = EFalse;
       
  1274                             RCSELOGSTRING2( "Leave SIP link, index=%d", k );
       
  1275                             }
       
  1276                         else
       
  1277                             {
       
  1278                             aEntry.iIds.Remove( k );
       
  1279                             newCount--;
       
  1280                             k--;
       
  1281                             RCSELOGSTRING2( "Remove SIP link, index=%d", k );
       
  1282                             }
       
  1283                         }
       
  1284                     }
       
  1285                 }
       
  1286             }
       
  1287 
       
  1288         iSIPProfiles.ResetAndDestroy();
       
  1289 
       
  1290         // Update entry if count of ids have changed
       
  1291         if ( count != aEntry.iIds.Count() )
       
  1292             {
       
  1293             RCSELOGSTRING3( "Link ID count: initial=%d, final=%d",
       
  1294                              count, aEntry.iIds.Count() );
       
  1295 
       
  1296             AddOrUpdateEntryL( aEntry.iId, aEntry );
       
  1297 
       
  1298             RCSELOGSTRING( "Entry updated" );
       
  1299             }
       
  1300         }
       
  1301 
       
  1302     RCSELOGSTRING( "CRCSEProfileRegistry::UpdateSIPProfileLinksL - OUT" );
       
  1303     }
       
  1304 
       
  1305 // -----------------------------------------------------------------------------
       
  1306 // Local helper method for searching default values of properties from service
       
  1307 // table and adding them to given service entry.
       
  1308 // -----------------------------------------------------------------------------
       
  1309 //
       
  1310 void FindAndAddDefaultPropertyL( 
       
  1311     CSPSettings& aTable, 
       
  1312     CSPEntry& aEntry, 
       
  1313     CSPProperty& aProperty, 
       
  1314     TServicePropertyName aName  )
       
  1315     {
       
  1316     TInt err = aTable.FindPropertyL( KDefaultVoIPService, aName, aProperty );
       
  1317 
       
  1318     if ( KErrNone == err )
       
  1319         {
       
  1320         aEntry.AddPropertyL( aProperty );
       
  1321         }
       
  1322     }
       
  1323 
       
  1324 // -----------------------------------------------------------------------------
       
  1325 // CRCSEProfileRegistry::CreateDefaultServiceSettingsL
       
  1326 // Creates a voip-sip service entry with default content and return
       
  1327 // service ID for new profile
       
  1328 // -----------------------------------------------------------------------------
       
  1329 //
       
  1330 void CRCSEProfileRegistry::CreateDefaultServiceSettingsL( 
       
  1331     CRCSEProfileEntry& aNewEntry )
       
  1332     {
       
  1333     RCSELOGSTRING( 
       
  1334         "CRCSEProfileRegistry::CreateDefaultServiceSettingsL - IN" );
       
  1335 
       
  1336     // Do not create service if there is no SIP linkage.
       
  1337     if ( !aNewEntry.iIds.Count() )
       
  1338         {
       
  1339         return;
       
  1340         }
       
  1341     else if ( aNewEntry.iIds[0].iProfileType != 
       
  1342         CRCSEProfileEntry::EProtocolSIP )
       
  1343         {
       
  1344         return;
       
  1345         }
       
  1346 
       
  1347     // Service table API
       
  1348     CSPSettings* table = CSPSettings::NewLC();
       
  1349 
       
  1350     // New service entry for this provider name
       
  1351     CSPEntry* entry = CSPEntry::NewLC();
       
  1352     entry->SetServiceName( aNewEntry.iProviderName );
       
  1353 
       
  1354     CSPProperty* property = CSPProperty::NewLC();
       
  1355 
       
  1356     // Service Setup plug-in UID ( if VoIP plugin UID set )
       
  1357     if ( KRCSEDefaultVoIPPluginUID != aNewEntry.iVoIPPluginUID )
       
  1358         {
       
  1359         property->SetName( EPropertyServiceSetupPluginId );
       
  1360         property->SetValue( aNewEntry.iVoIPPluginUID );
       
  1361         entry->AddPropertyL( *property );
       
  1362         }
       
  1363 
       
  1364     // This property is needed by clients to check if VoIP service is used
       
  1365     property->SetName( ESubPropertyVoIPSettingsId );
       
  1366     property->SetValue( KVoIPSettingsID );
       
  1367     entry->AddPropertyL( *property );
       
  1368     
       
  1369     // Service Attribute Mask
       
  1370     FindAndAddDefaultPropertyL( 
       
  1371         *table, *entry, *property, EPropertyServiceAttributeMask );
       
  1372 
       
  1373     // Phone Application CLI plug-in UID
       
  1374     FindAndAddDefaultPropertyL( 
       
  1375         *table, *entry, *property, EPropertyCLIPluginId );
       
  1376 
       
  1377     // Phone Application Call Logging plug-in UID.
       
  1378     FindAndAddDefaultPropertyL( 
       
  1379         *table, *entry, *property, EPropertyCallLoggingPluginId );
       
  1380 
       
  1381     // Phone Application Call State Indicator plug-in UID.
       
  1382     FindAndAddDefaultPropertyL( 
       
  1383         *table, *entry, *property, EPropertyCallStateIndicatorPluginId );
       
  1384 
       
  1385     // Phone Application Call Menu Handler plug-in UID.
       
  1386     FindAndAddDefaultPropertyL( 
       
  1387         *table, *entry, *property, EPropertyCallMenuHandlerPluginId );
       
  1388 
       
  1389     // Converged Call Engine Call Provider plug-in UID.
       
  1390     FindAndAddDefaultPropertyL( 
       
  1391         *table, *entry, *property, EPropertyCallProviderPluginId );
       
  1392 
       
  1393     // Virtual Phonebook Contact Store ID.
       
  1394     FindAndAddDefaultPropertyL( 
       
  1395         *table, *entry, *property, EPropertyContactStoreId );
       
  1396 
       
  1397     // Contact View plug-in UID
       
  1398     FindAndAddDefaultPropertyL( 
       
  1399         *table, *entry, *property, EPropertyContactViewPluginId );
       
  1400 
       
  1401     // Converged Connection Handler (CCH) VoIP Subservice plug-in UID
       
  1402     FindAndAddDefaultPropertyL( 
       
  1403         *table, *entry, *property, EPropertyVoIPSubServicePluginId );
       
  1404 
       
  1405     // Converged Connection Handler (CCH) VMBX Subservice plug-in UID
       
  1406     FindAndAddDefaultPropertyL( 
       
  1407         *table, *entry, *property, EPropertyVMBXSubServicePluginId );
       
  1408 
       
  1409     // Brand ID for VoIP
       
  1410     FindAndAddDefaultPropertyL( 
       
  1411         *table, *entry, *property, EPropertyBrandId );
       
  1412 
       
  1413     // Presence Service Connectivity plugin UID
       
  1414     FindAndAddDefaultPropertyL( 
       
  1415         *table, *entry, *property, EPropertyPCSPluginId );
       
  1416 
       
  1417     // Maximum Lenght of Log Contact Link
       
  1418     FindAndAddDefaultPropertyL( 
       
  1419         *table, *entry, *property, EPropertyLogCntLinkMaxLength );
       
  1420 
       
  1421     // Field Type of Presence Presentity ID
       
  1422     FindAndAddDefaultPropertyL( 
       
  1423         *table, *entry, *property, ESubPropertyPresencePresentityIDFieldType );
       
  1424 
       
  1425     // Add entry to store and set service ID
       
  1426     User::LeaveIfError( table->AddEntryL( *entry ) );
       
  1427     aNewEntry.iServiceProviderId 
       
  1428         = static_cast<TUint32>( entry->GetServiceId() );
       
  1429 
       
  1430     CleanupStack::PopAndDestroy( property );
       
  1431     CleanupStack::PopAndDestroy( entry );
       
  1432     CleanupStack::PopAndDestroy( table );
       
  1433 
       
  1434     RCSELOGSTRING( 
       
  1435         "CRCSEProfileRegistry::CreateDefaultServiceSettingsL - OUT" );
       
  1436     }
       
  1437 
       
  1438 // ---------------------------------------------------------------------------
       
  1439 // CRCSEProfileRegistry::DeleteReferenceSettingsL
       
  1440 // ---------------------------------------------------------------------------
       
  1441 //
       
  1442 void CRCSEProfileRegistry::DeleteReferenceSettingsL( TUint32 aProfileId )
       
  1443     {
       
  1444     RCSELOGSTRING( "CRCSEProfileRegistry::DeleteReferenceSettingsL - IN" );
       
  1445 
       
  1446     CRCSEProfileEntry* profileInfo = CRCSEProfileEntry::NewLC();
       
  1447 
       
  1448     TRAPD( e, FindL( aProfileId, *profileInfo ) );
       
  1449 
       
  1450     __ASSERT_ALWAYS( KErrNone == e || KErrNotFound == e, User::Leave( e ) );
       
  1451 
       
  1452     // Delete related audio codecs
       
  1453     CRCSEAudioCodecRegistry* codecReg = CRCSEAudioCodecRegistry::NewLC();
       
  1454     codecReg->DeleteL( profileInfo->iPreferredCodecs );
       
  1455     CleanupStack::PopAndDestroy( codecReg );
       
  1456 
       
  1457     // Delete related service settings
       
  1458     if( CRCSEProfileEntry::EOONotSet == profileInfo->iNewServiceTableEntry ||
       
  1459         CRCSEProfileEntry::EOn == profileInfo->iNewServiceTableEntry )
       
  1460         {
       
  1461         RCSELOGSTRING( "Delete related service settings" );
       
  1462         CSPSettings* serviceSettings = CSPSettings::NewLC();
       
  1463         serviceSettings->DeleteEntryL( profileInfo->iServiceProviderId );
       
  1464         CleanupStack::PopAndDestroy( serviceSettings );
       
  1465         }
       
  1466 
       
  1467     CleanupStack::PopAndDestroy( profileInfo );
       
  1468 
       
  1469     RCSELOGSTRING( "CRCSEProfileRegistry::DeleteReferenceSettingsL - OUT" );
       
  1470     }
       
  1471 // -----------------------------------------------------------------------------
       
  1472 // CRCSEProfileRegistry::NameExistsInServiceTableL
       
  1473 // -----------------------------------------------------------------------------
       
  1474 //
       
  1475 TBool CRCSEProfileRegistry::NameExistsInServiceTableL(
       
  1476     const TDesC& aProviderName ) const
       
  1477     {
       
  1478     RCSELOGSTRING( "CRCSEProfileRegistry::NameExistsInServiceTableL- IN" );
       
  1479     TBool result( EFalse );
       
  1480     
       
  1481     RIdArray serviceIds;
       
  1482     CleanupClosePushL( serviceIds );
       
  1483     CDesCArray* serviceNames = 
       
  1484         new ( ELeave ) CDesCArrayFlat( KArrayInitSize );
       
  1485     CleanupStack::PushL( serviceNames );
       
  1486     CSPSettings* serviceSettings = CSPSettings::NewLC();
       
  1487     TInt err(KErrNone);
       
  1488     err = serviceSettings->FindServiceIdsL( serviceIds );
       
  1489     if ( KErrNotFound == err )
       
  1490         {
       
  1491         CleanupStack::PopAndDestroy( serviceSettings );
       
  1492         CleanupStack::PopAndDestroy( serviceNames );
       
  1493         CleanupStack::PopAndDestroy( &serviceIds );
       
  1494         return EFalse; 
       
  1495         }
       
  1496     User::LeaveIfError( err );
       
  1497     User::LeaveIfError( 
       
  1498         serviceSettings->FindServiceNamesL( serviceIds, *serviceNames ) );
       
  1499     CleanupStack::PopAndDestroy( serviceSettings );
       
  1500     TBool serviceFound( EFalse );
       
  1501     for ( TInt i( 0 ) ; i < serviceNames->MdcaCount() && !serviceFound ; i++ )
       
  1502         {
       
  1503         if ( !aProviderName.Compare( serviceNames->MdcaPoint( i) ) )
       
  1504             {
       
  1505             result = ETrue;
       
  1506             serviceFound = ETrue;
       
  1507             }
       
  1508         }
       
  1509     CleanupStack::PopAndDestroy( serviceNames );	
       
  1510     CleanupStack::PopAndDestroy( &serviceIds );
       
  1511     
       
  1512     RCSELOGSTRING( "CRCSEProfileRegistry::NameExistsInServiceTableL- OUT" );
       
  1513     return result;
       
  1514     }
       
  1515     
       
  1516 // -----------------------------------------------------------------------------
       
  1517 // CRCSEProfileRegistry::LeaveIfServiceIdInUseL
       
  1518 // -----------------------------------------------------------------------------
       
  1519 //
       
  1520 void CRCSEProfileRegistry::LeaveIfServiceIdInUseL(
       
  1521     const CRCSEProfileEntry& aEntry ) 
       
  1522     {    
       
  1523     RCSELOGSTRING( "CRCSEProfileRegistry::LeaveIfServiceIdInUseL - IN" );
       
  1524 
       
  1525     // Find all profile IDs
       
  1526     RArray<TUint32> voipIds;
       
  1527     CleanupClosePushL( voipIds );
       
  1528     FindAllIdsL( voipIds );
       
  1529 
       
  1530 
       
  1531     // Check service id from each profile
       
  1532     CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
       
  1533     TBuf<KDesLength256> value;
       
  1534     TInt count( voipIds.Count() );
       
  1535 
       
  1536     for ( TInt i( 0 ); i < count; i++ )
       
  1537         {
       
  1538         iCenRepDb->FindPropertyL( voipIds[ i ], KColProtocolIds, *property );
       
  1539 
       
  1540         __ASSERT_ALWAYS( 
       
  1541             aEntry.iServiceProviderId != ToTUint32L( property->GetDesValue() ),
       
  1542                 User::Leave( KErrAlreadyExists ) );
       
  1543         }
       
  1544 
       
  1545     CleanupStack::PopAndDestroy( property );
       
  1546     CleanupStack::PopAndDestroy( &voipIds );
       
  1547 
       
  1548     RCSELOGSTRING( "CRCSEProfileRegistry::LeaveIfServiceIdInUseL - OUT" );
       
  1549     }
       
  1550 
       
  1551 // -----------------------------------------------------------------------------
       
  1552 // CRCSEProfileRegistry::UpdateServiceSettingsL
       
  1553 // -----------------------------------------------------------------------------
       
  1554 //
       
  1555 void CRCSEProfileRegistry::UpdateServiceSettingsL(
       
  1556     const CRCSEProfileEntry& aEntry ) 
       
  1557     {    
       
  1558     RCSELOGSTRING( "CRCSEProfileRegistry::UpdateServiceSettingsL - IN" );
       
  1559 
       
  1560     // Do not update service if there is no SIP linkage.
       
  1561     if ( !aEntry.iIds.Count() )
       
  1562         {
       
  1563         return;
       
  1564         }
       
  1565     else if ( aEntry.iIds[0].iProfileType != 
       
  1566         CRCSEProfileEntry::EProtocolSIP )
       
  1567         {
       
  1568         return;
       
  1569         }
       
  1570 
       
  1571     CSPSettings* serviceSettings = CSPSettings::NewLC();
       
  1572     CSPEntry* serviceEntry = CSPEntry::NewLC();
       
  1573 
       
  1574     User::LeaveIfError( 
       
  1575         serviceSettings->FindEntryL( 
       
  1576             aEntry.iServiceProviderId, *serviceEntry ) );
       
  1577 
       
  1578     // Update service settings if service name has been changed
       
  1579     if ( aEntry.iProviderName != serviceEntry->GetServiceName() )
       
  1580         {
       
  1581         serviceEntry->SetServiceName( aEntry.iProviderName );
       
  1582         User::LeaveIfError( serviceSettings->UpdateEntryL( *serviceEntry ) );
       
  1583         }
       
  1584 
       
  1585     CleanupStack::PopAndDestroy( serviceEntry );
       
  1586     CleanupStack::PopAndDestroy( serviceSettings );
       
  1587 
       
  1588     RCSELOGSTRING( "CRCSEProfileRegistry::UpdateServiceSettingsL - OUT" );
       
  1589     }
       
  1590 
       
  1591 // -----------------------------------------------------------------------------
       
  1592 // CRCSEProfileRegistry::UpdateServiceIdL
       
  1593 // -----------------------------------------------------------------------------
       
  1594 //
       
  1595 void CRCSEProfileRegistry::UpdateServiceIdL( TUint32 aId, TUint32 aServiceId )
       
  1596     {    
       
  1597     RCSELOGSTRING( "CRCSEProfileRegistry::UpdateServiceIdL - IN" );
       
  1598 
       
  1599     TBuf<KDesLength128> des;
       
  1600 
       
  1601     RIpAppPropArray properties;
       
  1602 
       
  1603     CreatePropertyL( KColServiceProviderId,
       
  1604                      ToDes( aServiceId, des ),
       
  1605                      properties );
       
  1606 
       
  1607     iCenRepDb->AddOrUpdatePropertiesL( aId, properties );
       
  1608 
       
  1609     properties.ResetAndDestroy();
       
  1610 
       
  1611     RCSELOGSTRING( "CRCSEProfileRegistry::UpdateServiceIdL - OUT" );
       
  1612     }
       
  1613 
       
  1614 // ---------------------------------------------------------------------------
       
  1615 // From MSIPProfileRegistryObserver
       
  1616 // CRCSEProfileRegistry::ProfileRegistryEventOccurred
       
  1617 // SIP profile event
       
  1618 // ---------------------------------------------------------------------------
       
  1619 //
       
  1620 void CRCSEProfileRegistry::ProfileRegistryEventOccurred( 
       
  1621     TUint32 /*aSIPProfileId*/,
       
  1622     TEvent /*aEvent*/ )
       
  1623     {
       
  1624     RCSELOGSTRING( "CRCSEProfileRegistry::ProfileRegistryEventOccurred" );
       
  1625     // Have to be implemented because MSIPProfileRegistryObserver
       
  1626     // is passed to CSIPManagedProfileRegistry.
       
  1627     }
       
  1628 
       
  1629 // ---------------------------------------------------------------------------
       
  1630 // From MSIPProfileRegistryObserver
       
  1631 // CRCSEProfileRegistry::ProfileRegistryErrorOccured
       
  1632 // An asynchronous error has occurred related to SIP profile
       
  1633 // ---------------------------------------------------------------------------
       
  1634 //
       
  1635 void CRCSEProfileRegistry::ProfileRegistryErrorOccurred( 
       
  1636     TUint32  /*aProfileId*/,
       
  1637     TInt /*aError*/ )
       
  1638     {
       
  1639     RCSELOGSTRING( "CRCSEProfileRegistry::ProfileRegistryErrorOccurred" );
       
  1640     // Have to be implemented because MSIPProfileRegistryObserver
       
  1641     // is passed to CSIPManagedProfileRegistry.
       
  1642     }
       
  1643 
       
  1644 // -----------------------------------------------------------------------------
       
  1645 // CRCSEProfileRegistry::ResetAndDestroyEntries
       
  1646 // -----------------------------------------------------------------------------
       
  1647 //
       
  1648 void CRCSEProfileRegistry::ResetAndDestroyEntries( TAny* anArray )
       
  1649 	{
       
  1650 	RCSELOGSTRING( "CRCSEProfileRegistry::ResetAndDestroyEntries - IN" );
       
  1651 	
       
  1652     RPointerArray<CRCSEProfileEntry>* array = 
       
  1653         reinterpret_cast<RPointerArray<CRCSEProfileEntry>*>( anArray );
       
  1654     if (array)
       
  1655         {
       
  1656         array->ResetAndDestroy();
       
  1657         array->Close();
       
  1658         }
       
  1659     RCSELOGSTRING( "CRCSEProfileRegistry::ResetAndDestroyEntries - OUT" );
       
  1660 	}
       
  1661 
       
  1662 // -----------------------------------------------------------------------------
       
  1663 // CRCSEProfileRegistry::CopyEntryValues
       
  1664 // -----------------------------------------------------------------------------
       
  1665 //
       
  1666 void CRCSEProfileRegistry::CopyEntryValues( 
       
  1667     const CRCSEProfileEntry& aSourceEntry, 
       
  1668     CRCSEProfileEntry& aDestinationEntry )
       
  1669     {
       
  1670     aDestinationEntry.ResetDefaultValues();
       
  1671     aDestinationEntry.iIds.Reset();
       
  1672     for ( TInt i = 0; i < aSourceEntry.iIds.Count(); i++ )
       
  1673         {
       
  1674         aDestinationEntry.iIds.Append( aSourceEntry.iIds[i] );
       
  1675         }
       
  1676     aDestinationEntry.iId = aSourceEntry.iId;
       
  1677     aDestinationEntry.iProviderName = aSourceEntry.iProviderName;
       
  1678     aDestinationEntry.iSettingsName = aSourceEntry.iSettingsName;
       
  1679     aDestinationEntry.iPreferredCodecs.Reset();
       
  1680     for ( TInt i = 0; i < aSourceEntry.iPreferredCodecs.Count(); i++ )
       
  1681         {
       
  1682         aDestinationEntry.iPreferredCodecs.Append( 
       
  1683             aSourceEntry.iPreferredCodecs[i] );
       
  1684         }
       
  1685     aDestinationEntry.iStartMediaPort = aSourceEntry.iStartMediaPort;
       
  1686     aDestinationEntry.iEndMediaPort = aSourceEntry.iEndMediaPort;
       
  1687     aDestinationEntry.iMediaQOS = aSourceEntry.iMediaQOS;
       
  1688     aDestinationEntry.iInbandDTMF = aSourceEntry.iInbandDTMF;
       
  1689     aDestinationEntry.iOutbandDTMF = aSourceEntry.iOutbandDTMF;
       
  1690     aDestinationEntry.iSecureCallPreference = 
       
  1691         aSourceEntry.iSecureCallPreference;
       
  1692     aDestinationEntry.iRTCP = aSourceEntry.iRTCP;
       
  1693     aDestinationEntry.iSIPVoIPUAHTerminalType = 
       
  1694         aSourceEntry.iSIPVoIPUAHTerminalType;
       
  1695     aDestinationEntry.iSIPVoIPUAHeaderWLANMAC = 
       
  1696         aSourceEntry.iSIPVoIPUAHeaderWLANMAC;
       
  1697     aDestinationEntry.iSIPVoIPUAHeaderString = 
       
  1698         aSourceEntry.iSIPVoIPUAHeaderString;
       
  1699     aDestinationEntry.iProfileLockedToIAP = aSourceEntry.iProfileLockedToIAP;
       
  1700     aDestinationEntry.iVoIPPluginUID = aSourceEntry.iVoIPPluginUID;
       
  1701     aDestinationEntry.iAllowVoIPoverWCDMA = aSourceEntry.iAllowVoIPoverWCDMA;
       
  1702     aDestinationEntry.iMeanCountOfVoIPDigits = 
       
  1703         aSourceEntry.iMeanCountOfVoIPDigits;
       
  1704     aDestinationEntry.iIgnoreAddrDomainPart = 
       
  1705         aSourceEntry.iIgnoreAddrDomainPart;
       
  1706     aDestinationEntry.iServiceProviderId = aSourceEntry.iServiceProviderId;
       
  1707     aDestinationEntry.iUserPhoneUriParameter = 
       
  1708         aSourceEntry.iUserPhoneUriParameter;
       
  1709     aDestinationEntry.iSIPConnTestAddress = aSourceEntry.iSIPConnTestAddress;
       
  1710     aDestinationEntry.iNATSettingsStorageId = 
       
  1711         aSourceEntry.iNATSettingsStorageId;
       
  1712     aDestinationEntry.iSIPMinSE = aSourceEntry.iSIPMinSE;
       
  1713     aDestinationEntry.iSIPSessionExpires = aSourceEntry.iSIPSessionExpires;
       
  1714     aDestinationEntry.iNATProtocol = aSourceEntry.iNATProtocol;
       
  1715     aDestinationEntry.iNewServiceTableEntry = 
       
  1716         aSourceEntry.iNewServiceTableEntry;
       
  1717     aDestinationEntry.iSNAPId = aSourceEntry.iSNAPId;
       
  1718     aDestinationEntry.iAccountCreationUrl = aSourceEntry.iAccountCreationUrl;
       
  1719     }
       
  1720 
       
  1721 //  End of File  
       
  1722 
       
  1723