voipplugins/voipadapters/dmvoipadapter/src/nsmldmvoipadapter.cpp
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2002-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:  Device Management VoIP adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <f32file.h>
       
    21 #include <sysutil.h>
       
    22 #include <settingsinternalcrkeys.h>
       
    23 #include <centralrepository.h>
       
    24 #include <wlaninternalpskeys.h> // For GetWlanacAddress and GetWlanTypeL.
       
    25 #include <badesca.h> // For CDesC8ArrayFlat used in CompleteOutstandingCmdsL.
       
    26 #include <coemain.h> // For GetPhoneModelL.
       
    27 #include <crcseprofileregistry.h>
       
    28 #include <crcseprofileentry.h>
       
    29 #include <crcseaudiocodecregistry.h>
       
    30 #include <crcseaudiocodecentry.h>
       
    31 #include <utf.h>
       
    32 #include <sipmanagedprofile.h> // For SIP User Agent Header.
       
    33 #include <sipprofileregistryobserver.h> // For SIP User Agent Header.
       
    34 #include <sipmanagedprofileregistry.h> // For SIP User Agent Header.
       
    35 #include <spdefinitions.h> // For Service Provider Settings.
       
    36 #include <spsettings.h>    // For Service Provider Settings.
       
    37 #include <spentry.h>       // For Service Provider Settings.
       
    38 #include <spproperty.h>    // For Service Provider Settings.
       
    39 #include <featmgr.h>
       
    40 #include <nsmldmiapmatcher.h> // For fetching IAP.
       
    41 #include <nsmldmuri.h> // for parsing uris
       
    42 #include <pathinfo.h> // For getting phone rom root path.
       
    43 #include <cvimpstsettingsstore.h> // For IM tone path
       
    44 #include <pressettingsset.h> // for checking if presence settings is valid
       
    45 #include <pressettingsapi.h> // for checking if presence settings is valid
       
    46 
       
    47 #include "nsmldmvoipadapter.h"
       
    48 #include "cdmvoipspsettings.h"
       
    49 #include "CSIPProfileRegistryObserver.h" // For SIP User Agent Header.
       
    50 #include "cipappphoneutils.h"            // For GetPhoneModelL, GetTerminalTypeL
       
    51 #include "cipapputilsaddressresolver.h"  // For GetWlanMacAddress
       
    52 #include "smldmvoipdebug.h"
       
    53 
       
    54 // CONSTANTS
       
    55 
       
    56 const TInt   KNSmlVoIPMaxUriLength     = 256;
       
    57 const TInt   KDefaultResultSize        = 64;
       
    58 const TInt   KNSmlVoIPMaxResultLength  = 256;
       
    59 const TInt   KNSmlDMFatMinimumFileSize = 512;
       
    60 const TUint  KTempStringlength = 200;
       
    61 _LIT8( KSpaceMark,         " " );
       
    62 _LIT8( KUserAgent,         "User-Agent" );
       
    63 _LIT8( KColonMark,         ":" );
       
    64 
       
    65 _LIT8( KNSmlDMVoIPDDFVersion,                "1.0" ); 
       
    66 _LIT8( KNSmlDMVoIPNodeName,                  "VoIP" );
       
    67 _LIT8( KNSmlDMVoIPPrefix,                    "VoIPId" );
       
    68 _LIT8( KNSmlDMVoIPDynamicNode,               "" );
       
    69 _LIT8( KNSmlDMVoIPSetID,                     "VoIPId" ); 
       
    70 _LIT8( KNSmlDMVoIPProvID,                    "ProviderName" ); 
       
    71 _LIT8( KNSmlDMVoIPName,                      "SettingsName" );
       
    72 _LIT8( KNSmlDMVoIPPreferredCodecsNode,       "PreferredCodecs" );
       
    73 
       
    74 // VoIP/x/CodecSettings
       
    75 _LIT8( KNSmlDMVoIPCodecSettingsNode,         "CodecSettings" );
       
    76 _LIT8( KNSmlDMVoIPCodecSettingsId,           "CodecSettingsId" );
       
    77 _LIT8( KNSmlDMVoIPCodecId,                   "VoIPCodecId" );
       
    78 _LIT8( KNSmlDMVoIPPreferredCodecId,          "PreferredCodecId" );
       
    79 _LIT8( KNSmlDMVoIPMediaTypeName,             "MediaTypeName" );
       
    80 _LIT8( KNSmlDMVoIPMediaSubTypeName,          "MediaSubTypeName" );
       
    81 _LIT8( KNSmlDMVoIPJitterBufferSize,          "JitterBufferSize" );
       
    82 _LIT8( KNSmlDMVoIPOctetAlign,                "OctetAlign" );
       
    83 _LIT8( KNSmlDMVoIPModeSetNode,               "ModeSet" );
       
    84 _LIT8( KNSmlDMVoIPMode,                      "Mode" );
       
    85 _LIT8( KNSmlDMVoIPModeId,                    "ModeId" );
       
    86 _LIT8( KNSmlDMVoIPModeChangePeriod,          "ModeChangePeriod" );
       
    87 _LIT8( KNSmlDMVoIPModeChangeNeighbor,        "ModeChangeNeighbor" );
       
    88 _LIT8( KNSmlDMVoIPPtime,                     "Ptime" );
       
    89 _LIT8( KNSmlDMVoIPMaxPtime,                  "MaxPtime" );
       
    90 _LIT8( KNSmlDMVoIPVAD,                       "VAD" ); 
       
    91 _LIT8( KNSmlDMVoIPAnnexB,                    "AnnexB" );
       
    92 _LIT8( KNSmlDMVoIPMaxRed,                    "MaxRed" );
       
    93 
       
    94 // VoIP/x/SettingIds node
       
    95 _LIT8( KNSmlDMVoIPSettingIdsNode,            "SettingIds" );
       
    96 _LIT8( KNSmlDMVoIPSettingId,                 "SettingId" );
       
    97 _LIT8( KNSmlDMVoIPProfileType,               "ProfileType" ); 
       
    98 _LIT8( KNSmlDMVoIPProfileId,                 "ProfileId" );
       
    99 _LIT8( KNSmlDMVoIPProfileSpecificId,         "ProfileSpecificId" );
       
   100 _LIT8( KNSmlDMVoIPProfileTypeSIP,            "SIP" );
       
   101 _LIT8( KNSmlDMVoIPProfileTypeSCCP,           "SCCP" );
       
   102 
       
   103 // VoIP/x/
       
   104 _LIT8( KNSmlDMVoIPSMPort,                    "StartMediaPort" );
       
   105 _LIT8( KNSmlDMVoIPEMPort,                    "EndMediaPort" );
       
   106 _LIT8( KNSmlDMVoIPMediaQos,                  "MediaQos" );
       
   107 _LIT8( KNSmlDMVoIPDTMFIB,                    "InbandDTMF" );
       
   108 _LIT8( KNSmlDMVoIPDTMFOB,                    "OutbandDTMF" );
       
   109 _LIT8( KNSmlDMVoIPSecureCallPref,            "SecureCallPref" );
       
   110 _LIT8( KNSmlDMVoIPRTCP,                      "RTCP" );
       
   111 _LIT8( KNSmlDMVoIPUAHTerminalType,           "UAHTerminalType" );
       
   112 _LIT8( KNSmlDMVoIPUAHWLANMAC,                "UAHWLANMAC" );
       
   113 _LIT8( KNSmlDMVoIPUAHString,                 "UAHString" );
       
   114 _LIT8( KNSmlDMVoIPProfileLockedToIAP,        "ProfileLockedToIAP" );
       
   115 _LIT8( KNSmlDMVoIPPluginUID,                 "VoIPPluginUID" );
       
   116 _LIT8( KNSmlDMVoIPAllowVoIPOverWCDMA,        "AllowVoIPOverWCDMA" );
       
   117 _LIT8( KNSmlDMVoIPVoIPDigits,                "VoIPDigits" );
       
   118 _LIT8( KNSmlDMVoIPURIDomainIgnoreRule,       "URIDomainIgnoreRule" );
       
   119 _LIT8( KNSmlDMVoIPAutoAcceptBuddyRequest,    "AutoAcceptBuddyRequest" );
       
   120 _LIT8( KNSmlDMVoIPUsedVoIPRelease,           "UsedVoIPRelease" );
       
   121 _LIT8( KNSmlDMVoIPAddUserPhone,              "AddUserPhone" );
       
   122 _LIT8( KNSmlDMVoIPProviderBookmarkUri,       "ProviderBookmarkURI" );
       
   123 _LIT8( KNSmlDMVoIPSIPConnTestUri,            "SIPConnectivityTestURI" );
       
   124 _LIT8( KNSmlDMVoIPNatFwProfileId,            "NATFWProfileId" );
       
   125 _LIT8( KNSmlDMVoIPMinSessionInterval,        "MinSessionInterval" );
       
   126 _LIT8( KNSmlDMVoIPSessionExpires,            "SessionExpires" );
       
   127 _LIT8( KNSmlDMVoIPBrandingDataUri,           "BradingDataURI" );
       
   128 _LIT8( KNSmlDMVoIPPresenceSettingsId,        "PresenceSettingsId" );
       
   129 _LIT8( KNSmlDMVoIPUsedNatProtocol,           "UsedNATProtocol" );
       
   130 _LIT8( KNSmlDMVoIPAutoEnable,                "AutoEnable" );
       
   131 _LIT8( KNSmlDMVoIPSnapProfileId,             "SNAPProfileId" );
       
   132 _LIT8( KNSmlDMVoIPEnableIm,                  "EnableIM" );
       
   133 
       
   134 // VoIP/x/VoiceMailBox
       
   135 _LIT8( KNSmlDMVoIPVmbxNode,                  "VoiceMailBox" );
       
   136 _LIT8( KNSmlDMVoIPMwiUri,                    "MWI-URI" );
       
   137 _LIT8( KNSmlDMVoIPListeningUri,              "ListeningURI" );
       
   138 _LIT8( KNSmlDMVoIPUsedIAPId,                 "UsedIAPId" );
       
   139 _LIT8( KNSmlDMVoIPReSubscribeInterval,       "ReSubscribeInterval" );
       
   140 _LIT8( KNSmlDMVoIPUsedSIPProfileId,          "UsedSIPProfileId" );
       
   141 
       
   142 // Explanations of parameters
       
   143 _LIT8( KNSmlDMVoIPNodeNameExp,               "The interior object holds all VoIP objects" );
       
   144 _LIT8( KNSmlDMVoIPDynamicNodeExp,            "Placeholder for settings ID's" );
       
   145 _LIT8( KNSmlDMVoIPSetIDExp,                  "Settings ID number" );
       
   146 _LIT8( KNSmlDMVoIPProvIDExp,                 "Provider ID" ); 
       
   147 _LIT8( KNSmlDMVoIPNameExp,                   "Name of the settings" );
       
   148 
       
   149 // CodecSettings
       
   150 _LIT8( KNSmlDMVoIPCodecOrderExp,             "Codec order" );
       
   151 _LIT8( KNSmlDMVoIPCodecSettingsNodeExp,      "CodecSettings" );
       
   152 _LIT8( KNSmlDMVoIPCodecSettingsIdExp,        "CodecSettingsID" );
       
   153 _LIT8( KNSmlDMVoIPMediaTypeNameExp,          "MediaTypeName" );
       
   154 _LIT8( KNSmlDMVoIPMediaSubTypeNameExp,       "MediaSubTypeName" );
       
   155 _LIT8( KNSmlDMVoIPJitterBufferSizeExp,       "JitterBufferSize" );
       
   156 _LIT8( KNSmlDMVoIPOctetAlignExp,             "OctetAlign" );
       
   157 _LIT8( KNSmlDMVoIPModeSetNodeExp,            "ModeSet" );
       
   158 _LIT8( KNSmlDMVoIPModeSetIdExp,              "Mode Id" );
       
   159 _LIT8( KNSmlDMVoIPModeChangePeriodExp,       "ModeChangePeriod" );
       
   160 _LIT8( KNSmlDMVoIPModeChangeNeighborExp,     "ModeChangeNeighbor" );
       
   161 _LIT8( KNSmlDMVoIPPtimeExp,                  "Ptime" );
       
   162 _LIT8( KNSmlDMVoIPMaxPtimeExp,               "MaxPtime" );
       
   163 _LIT8( KNSmlDMVoIPVADExp,                    "Voice activation detection" );
       
   164 _LIT8( KNSmlDMVoIPAnnexBExp,                 "AnnexB" );
       
   165 _LIT8( KNSmlDMVoIPMaxRedExp,                 "Max-red" );
       
   166 
       
   167 // VoIP/x/
       
   168 _LIT8( KNSmlDMVoIPSMPortExp,                 "Start media port" );
       
   169 _LIT8( KNSmlDMVoIPEMPortExp,                 "End media port" );
       
   170 _LIT8( KNSmlDMVoIPMediaQosExp,               "Media QOS" );
       
   171 _LIT8( KNSmlDMVoIPDTMFIBExp,                 "DTMF in-band" );
       
   172 _LIT8( KNSmlDMVoIPDTMFOBExp,                 "DTMF out-band" );
       
   173 _LIT8( KNSmlDMVoIPSecureCallPrefExp,         "Secure call preference");
       
   174 _LIT8( KNSmlDMVoIPRTCPExp,                   "Real-Time Control Protocol reporting" );
       
   175 _LIT8( KNSmlDMVoIPUAHTerminalTypeExp,        "SIP VoIP User Agent header: terminal type display" );
       
   176 _LIT8( KNSmlDMVoIPUAHWLANMACExp,             "SIP VoIP User Agent header: WLAN MAC address display " );
       
   177 _LIT8( KNSmlDMVoIPUAHStringExp,              "SIP VoIP User Agent header: free string" );
       
   178 _LIT8( KNSmlDMVoIPProfileLockedToIAPExp,     "Profile locked to IAP" );
       
   179 _LIT8( KNSmlDMVoIPPluginUIDExp,              "VoIP plugin UID" );
       
   180 _LIT8( KNSmlDMVoIPAllowVoIPOverWCDMAExp,     "Allow VoIP over WCDMA" );
       
   181 _LIT8( KNSmlDMVoIPVoIPDigitsExp,             "Number of meaningful VoIP digits" );
       
   182 _LIT8( KNSmlDMVoIPURIDomainIgnoreRuleExp,    "Domain part of URI ignore rule" );
       
   183 _LIT8( KNSmlDMVoIPAutoAcceptBuddyRequestExp, "Auto-accept buddy request" );
       
   184 _LIT8( KNSmlDMVoIPUsedVoIPReleaseExp,        "Used VoIP release" );
       
   185 _LIT8( KNSmlDMVoIPAddUserPhoneExp,           "Add user=phone to all numbers" );
       
   186 _LIT8( KNSmlDMVoIPProviderBookmarkUriExp,    "Provider bookmark URI" );
       
   187 _LIT8( KNSmlDMVoIPSIPConnTestUriExp,         "SIP connectivity test URI" );
       
   188 _LIT8( KNSmlDMVoIPNatFwProfileIdExp,         "NATFW profile ID" );
       
   189 _LIT8( KNSmlDMVoIPMinSessionIntervalExp,     "Minimum value for session interval" );
       
   190 _LIT8( KNSmlDMVoIPSessionExpiresExp,         "Session interval for SIP session" );
       
   191 _LIT8( KNSmlDMVoIPBrandingDataUriExp,        "Brading data URI" );
       
   192 _LIT8( KNSmlDMVoIPPresenceSettingsIdExp,     "Presence settings ID" );
       
   193 _LIT8( KNSmlDMVoIPUsedNatProtocolExp,        "Used NAT Protocol" );
       
   194 _LIT8( KNSmlDMVoIPAutoEnableExp,             "Auto enable the service" );
       
   195 _LIT8( KNSmlDMVoIPSnapProfileIdExp,          "SNAP profile ID" );
       
   196 _LIT8( KNSmlDMVoIPEnableImExp,               "Enable IM" );
       
   197 
       
   198 // VoIP/x/VoiceMailBox
       
   199 _LIT8( KNSmlDMVoIPVmbxNodeExp,               "VoiceMailBox node" );
       
   200 _LIT8( KNSmlDMVoIPMwiUriExp,                 "MWI-URI" );
       
   201 _LIT8( KNSmlDMVoIPListeningUriExp,           "Listening-URI" );
       
   202 _LIT8( KNSmlDMVoIPUsedIAPIdExp,              "Used IAP ID" );
       
   203 _LIT8( KNSmlDMVoIPReSubscribeIntervalExp,    "Re-rubscribe interval" );
       
   204 _LIT8( KNSmlDMVoIPUsedSIPProfileIdExp,       "Used SIP profile ID" );
       
   205 
       
   206 // VoIP/x/SettingIds node
       
   207 _LIT8( KNSmlDMVoIPProfileTypeExp,            "ProfileType" ); 
       
   208 _LIT8( KNSmlDMVoIPProfileIdExp,              "ProfileId" );
       
   209 _LIT8( KNSmlDMVoIPProfileSpecificExp,        "ProfileSpecificId" );
       
   210 
       
   211 // Other
       
   212 _LIT8( KNSmlDMVoIPValueTrue,                 "True" );
       
   213 _LIT8( KNSmlDMVoIPValueFalse,                "False" );
       
   214 _LIT8( KNSmlDMVoIPValueNotSet,               "NotSet" );
       
   215 _LIT8( KNSmlDefDMSIP,                        "SIP" );
       
   216 _LIT8( KNSmlDefDMSCCP,                       "SCCP/SCCPAcc" );
       
   217 _LIT8( KNSmlDMVoIPTextPlain,                 "text/plain" );
       
   218 _LIT8( KNSmlDMVoIPSeparator,                 "/" );
       
   219 _LIT8( KNSmlVoIPUriDotSlash,                 "./");
       
   220 _LIT( KOpenParenthesis,                      "(" );
       
   221 _LIT( KClosedParenthesis,                    ")" );
       
   222 _LIT8( KDefaultSettingsName,                 "DMAdapterIns" );
       
   223 _LIT8( KNSmlDMSIPSipID,                      "SIPId" );
       
   224 _LIT8( KNSmlDMSCCPSccpID,                    "SCCPId" );
       
   225 _LIT8( KNSmlDMNATFWDomain,                   "NATFW/DomainSpecific" );
       
   226 _LIT8( KNSmlDMPresence,                      "OMA_PRESENCE" );
       
   227 _LIT8( KNSmlDMSnapUriPrefix,                 "BearerManagementSNAP" );
       
   228 const TInt KSixSegs   = 6;
       
   229 const TInt KFiveSegs  = 5;
       
   230 const TInt KFourSegs  = 4;
       
   231 const TInt KThreeSegs = 3;
       
   232 const TInt KTwoSegs   = 2;
       
   233 
       
   234 const TUint8 KDMVoIPSeparator = '/';
       
   235 
       
   236 // VoiceMailBox related constants.
       
   237 const TInt KDefaultReSubscribe = 600;
       
   238 // IM related constants.
       
   239 const TUint32 KIMSubServicePluginId = 0x1027545A; // KSIPConnectivityPluginImplUid
       
   240 const TUint32 KIMLaunchUid          = 0x200255D0;
       
   241 const TInt    KIMSettingsId         = 1;
       
   242 // Default IM message tone
       
   243 _LIT( KDefaultTone,       "Message 2.aac" );
       
   244 
       
   245 // Bearer related constants
       
   246 const TUint32 KBearerNotSpecified = 0;
       
   247 const TUint32 KBearerWlanOnly = 1;
       
   248 const TUint32 KBearerCellularOnly = 2;
       
   249 
       
   250 // ---------------------------------------------------------------------------
       
   251 // CNSmlDmVoIPAdapter::ConstructL
       
   252 // Symbian 2nd phase constructor can leave.
       
   253 // ---------------------------------------------------------------------------
       
   254 //
       
   255 void CNSmlDmVoIPAdapter::ConstructL()
       
   256     {
       
   257     DBG_PRINT( "CNSmlDmVoIPAdapter::ConstructL(): begin" );
       
   258     // Check VoIP support from feature manager
       
   259     FeatureManager::InitializeLibL();
       
   260     TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
       
   261     FeatureManager::UnInitializeLib();
       
   262 
       
   263     if ( !support )
       
   264         {
       
   265         DBG_PRINT( "CNSmlDmVoIPAdapter::ConstructL(): no support" );        
       
   266         User::Leave( KErrNotSupported );
       
   267         }
       
   268     DBG_PRINT( "CNSmlDmVoIPAdapter::ConstructL(): end" );
       
   269     }
       
   270 
       
   271 // ---------------------------------------------------------------------------
       
   272 // CNSmlDmVoIPAdapter* CNSmlDmVoIPAdapter::NewL
       
   273 // Two-phased constructor.
       
   274 // ---------------------------------------------------------------------------
       
   275 //
       
   276 CNSmlDmVoIPAdapter* CNSmlDmVoIPAdapter::NewL(
       
   277     MSmlDmCallback* aDmCallback )
       
   278     {
       
   279     DBG_PRINT("CNSmlDmVoIPAdapter::NewL(): begin");
       
   280     CNSmlDmVoIPAdapter* self = new (ELeave) CNSmlDmVoIPAdapter( aDmCallback );
       
   281     self->ConstructL();
       
   282     self->iDmCallback = aDmCallback;
       
   283     DBG_PRINT("CNSmlDmVoIPAdapter::NewL(): end");
       
   284     return self;
       
   285     }
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // CNSmlDmVoIPAdapter::~CNSmlDmVoIPAdapter
       
   289 // ---------------------------------------------------------------------------
       
   290 //
       
   291 CNSmlDmVoIPAdapter::~CNSmlDmVoIPAdapter()
       
   292     {
       
   293     DBG_PRINT("CNSmlDmVoIPAdapter::~CNSmlDmVoIPAdapter(): begin");
       
   294 
       
   295     iCodecEntries.ResetAndDestroy();
       
   296     iCodecEntries.Close();
       
   297 
       
   298     iProfileEntries.ResetAndDestroy();
       
   299     iProfileEntries.Close();
       
   300 
       
   301     if ( iCRCSEAudioCodec )
       
   302         {
       
   303         delete iCRCSEAudioCodec;
       
   304         }
       
   305 
       
   306     if ( iCRCSEProfile )
       
   307         {
       
   308         delete iCRCSEProfile; 
       
   309         }
       
   310     delete iTempProfileIdObject;
       
   311     iProfileModifs.Close();
       
   312     iCodecModifs.Close();
       
   313 
       
   314     iSPSettings.ResetAndDestroy();
       
   315     iSPSettings.Close();
       
   316 
       
   317     DBG_PRINT("CNSmlDmVoIPAdapter::~CNSmlDmVoIPAdapter(): end");
       
   318     }
       
   319 
       
   320 // ---------------------------------------------------------------------------
       
   321 // CNSmlDmVoIPAdapter::LoadProfilesL
       
   322 // ---------------------------------------------------------------------------
       
   323 //
       
   324 void CNSmlDmVoIPAdapter::LoadProfilesL()
       
   325     {
       
   326     DBG_PRINT("CNSmlDmVoIPAdapter::LoadProfilesL(): begin");
       
   327 
       
   328     if ( !iCRCSEProfile )
       
   329         {
       
   330         iCRCSEProfile = CRCSEProfileRegistry::NewL();
       
   331         }
       
   332 
       
   333     if ( !iCRCSEAudioCodec )
       
   334         {
       
   335         iCRCSEAudioCodec = CRCSEAudioCodecRegistry::NewL();
       
   336         }
       
   337 
       
   338     // Load profiles to pointerarray
       
   339     RArray<TUint32> allIds;
       
   340     iCRCSEProfile->GetAllIdsL( allIds ); 
       
   341     TInt idCount = allIds.Count();
       
   342     for ( TInt counter = 0; counter < idCount; counter++ )
       
   343         {
       
   344         CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC();
       
   345         iCRCSEProfile->FindL( allIds[counter], *profile );
       
   346         // Ownership change to iProfileEntries:
       
   347         iProfileEntries.AppendL( profile );
       
   348         CleanupStack::Pop( profile );
       
   349         }
       
   350 
       
   351     allIds.Reset();
       
   352 
       
   353     // Load audio codecs information to pointerarray
       
   354     iCRCSEAudioCodec->GetAllCodecIdsL( allIds );
       
   355     idCount = allIds.Count();
       
   356     for ( TInt counter = 0; counter < idCount; counter++ )
       
   357         {
       
   358         CRCSEAudioCodecEntry* codec = CRCSEAudioCodecEntry::NewLC();
       
   359         iCRCSEAudioCodec->FindL( allIds[counter], *codec );
       
   360         // Ownership change to iCodecEntries:
       
   361         iCodecEntries.AppendL( codec );
       
   362         CleanupStack::Pop( codec );
       
   363         }
       
   364     allIds.Close();
       
   365     DBG_PRINT("CNSmlDmVoIPAdapter::LoadProfilesL(): end");
       
   366     }
       
   367 
       
   368 // ---------------------------------------------------------------------------
       
   369 // CNSmlDmVoIPAdapter::CNSmlDmVoIPAdapter
       
   370 // C++ default constructor can NOT contain any code, that
       
   371 // might leave.
       
   372 // ---------------------------------------------------------------------------
       
   373 //
       
   374 CNSmlDmVoIPAdapter::CNSmlDmVoIPAdapter( TAny* aEcomArguments ):
       
   375     CSmlDmAdapter( aEcomArguments )
       
   376     {
       
   377     DBG_PRINT("CNSmlDmVoIPAdapter::CNSmlDmVoIPAdapter(aEcomArguments): begin");
       
   378     DBG_PRINT("CNSmlDmVoIPAdapter::CNSmlDmVoIPAdapter(aEcomArguments): end");   
       
   379     }
       
   380 
       
   381 // ---------------------------------------------------------------------------
       
   382 // CNSmlDmVoIPAdapter::DDFVersionL
       
   383 // Inserts DDF version of the adapter to aDDFVersion
       
   384 // ---------------------------------------------------------------------------
       
   385 //
       
   386 void CNSmlDmVoIPAdapter::DDFVersionL( CBufBase& aDDFVersion )
       
   387     {
       
   388     DBG_PRINT("CNSmlDmVoIPAdapter::DDFVersionL(TDes& aDDFVersion): begin");
       
   389     aDDFVersion.InsertL( 0, KNSmlDMVoIPDDFVersion );
       
   390     DBG_PRINT("CNSmlDmVoIPAdapter::DDFVersionL(TDes& aDDFVersion): end");
       
   391     }
       
   392 
       
   393 // ---------------------------------------------------------------------------
       
   394 // CNSmlDmVoIPAdapter::DDFStructureL
       
   395 // Builds the DDF structure of adapter
       
   396 // ---------------------------------------------------------------------------
       
   397 //
       
   398 void CNSmlDmVoIPAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
       
   399     {
       
   400     DBG_PRINT("CNSmlDmVoIPAdapter::DDFStructureL(): begin");
       
   401 
       
   402     TSmlDmAccessTypes accessTypesGet;
       
   403     accessTypesGet.SetGet();
       
   404 
       
   405     TSmlDmAccessTypes accessTypesGetAdd;
       
   406     accessTypesGetAdd.SetGet();
       
   407     accessTypesGetAdd.SetAdd();
       
   408 
       
   409     TSmlDmAccessTypes accessTypesGetReplaceAdd;
       
   410     accessTypesGetReplaceAdd.SetGet();
       
   411     accessTypesGetReplaceAdd.SetReplace();
       
   412     accessTypesGetReplaceAdd.SetAdd();
       
   413 
       
   414     TSmlDmAccessTypes accessTypesAll;
       
   415     accessTypesAll.SetGet();
       
   416     accessTypesAll.SetDelete();
       
   417     accessTypesAll.SetAdd();
       
   418     accessTypesAll.SetReplace();
       
   419 
       
   420     // VoIP
       
   421     MSmlDmDDFObject& voip = aDDF.AddChildObjectL( KNSmlDMVoIPNodeName );
       
   422     voip.SetAccessTypesL( accessTypesGetAdd );
       
   423     voip.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   424     voip.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   425     voip.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   426     voip.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   427     voip.SetDescriptionL( KNSmlDMVoIPNodeNameExp );
       
   428 
       
   429     // dynamic settings ID node
       
   430     MSmlDmDDFObject& idNode = voip.AddChildObjectGroupL();
       
   431     idNode.SetAccessTypesL( accessTypesAll );
       
   432     idNode.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
       
   433     idNode.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   434     idNode.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   435     idNode.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   436     idNode.SetDescriptionL( KNSmlDMVoIPDynamicNode );
       
   437 
       
   438     // VoIPId
       
   439     MSmlDmDDFObject& setID = idNode.AddChildObjectL( 
       
   440         KNSmlDMVoIPSetID );
       
   441     setID.SetAccessTypesL( accessTypesGet );
       
   442     setID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   443     setID.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   444     setID.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   445     setID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   446     setID.SetDescriptionL( KNSmlDMVoIPSetIDExp );
       
   447 
       
   448     // ProviderName
       
   449     MSmlDmDDFObject& provID = idNode.AddChildObjectL( 
       
   450         KNSmlDMVoIPProvID );
       
   451     provID.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   452     provID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   453     provID.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   454     provID.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   455     provID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   456     provID.SetDescriptionL( KNSmlDMVoIPProvIDExp );
       
   457 
       
   458     // SettingsName
       
   459     MSmlDmDDFObject& name = idNode.AddChildObjectL( 
       
   460         KNSmlDMVoIPName );
       
   461     name.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   462     name.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   463     name.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   464     name.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   465     name.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   466     name.SetDescriptionL( KNSmlDMVoIPNameExp );
       
   467 
       
   468     // PreferredCodecs node
       
   469     MSmlDmDDFObject& codecOrder = idNode.AddChildObjectL( 
       
   470         KNSmlDMVoIPPreferredCodecsNode );
       
   471     codecOrder.SetAccessTypesL( accessTypesGet );
       
   472     codecOrder.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   473     codecOrder.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   474     codecOrder.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   475     codecOrder.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   476     codecOrder.SetDescriptionL( KNSmlDMVoIPCodecOrderExp );
       
   477 
       
   478     // PreferredCodecs dynamic
       
   479     MSmlDmDDFObject& codecDyn = codecOrder.AddChildObjectGroupL();
       
   480     codecDyn.SetAccessTypesL( accessTypesGet );
       
   481     codecDyn.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
       
   482     codecDyn.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   483     codecDyn.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   484     codecDyn.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   485     codecDyn.SetDescriptionL( KNSmlDMVoIPCodecOrderExp );
       
   486 
       
   487     // PreferredCodecs/PreferredCodecId
       
   488     MSmlDmDDFObject& preferredCodecID = codecDyn.AddChildObjectL( 
       
   489         KNSmlDMVoIPPreferredCodecId );
       
   490     preferredCodecID.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   491     preferredCodecID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   492     preferredCodecID.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   493     preferredCodecID.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   494     preferredCodecID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   495     preferredCodecID.SetDescriptionL( KNSmlDMVoIPCodecSettingsIdExp );
       
   496 
       
   497     // CodecSettings node
       
   498     MSmlDmDDFObject& codecNode = idNode.AddChildObjectL( 
       
   499         KNSmlDMVoIPCodecSettingsNode );
       
   500     codecNode.SetAccessTypesL( accessTypesGetAdd );
       
   501     codecNode.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   502     codecNode.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   503     codecNode.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   504     codecNode.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   505     codecNode.SetDescriptionL( KNSmlDMVoIPCodecSettingsNodeExp );
       
   506 
       
   507     // CodecSettings dynamic
       
   508     MSmlDmDDFObject& codecSetDyn = codecNode.AddChildObjectGroupL();
       
   509     codecSetDyn.SetAccessTypesL( accessTypesAll );
       
   510     codecSetDyn.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
       
   511     codecSetDyn.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   512     codecSetDyn.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   513     codecSetDyn.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   514     codecSetDyn.SetDescriptionL( KNSmlDMVoIPDynamicNodeExp );
       
   515 
       
   516     // CodecSettings/VoIPCodecId
       
   517     MSmlDmDDFObject& codecsetID = codecSetDyn.AddChildObjectL( 
       
   518         KNSmlDMVoIPCodecId );
       
   519     codecsetID.SetAccessTypesL( accessTypesGet );
       
   520     codecsetID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   521     codecsetID.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   522     codecsetID.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   523     codecsetID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   524     codecsetID.SetDescriptionL( KNSmlDMVoIPCodecSettingsIdExp );
       
   525 
       
   526     // CodecSettings/MediaTypeName
       
   527     MSmlDmDDFObject& mediaTypeName = codecSetDyn.AddChildObjectL( 
       
   528         KNSmlDMVoIPMediaTypeName );
       
   529     mediaTypeName.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   530     mediaTypeName.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   531     mediaTypeName.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   532     mediaTypeName.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   533     mediaTypeName.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   534     mediaTypeName.SetDescriptionL( KNSmlDMVoIPMediaTypeNameExp );
       
   535 
       
   536     // CodecSettings/MediaSubTypeName
       
   537     MSmlDmDDFObject& mediaSubTypeName = codecSetDyn.AddChildObjectL( 
       
   538         KNSmlDMVoIPMediaSubTypeName );
       
   539     mediaSubTypeName.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   540     mediaSubTypeName.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   541     mediaSubTypeName.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   542     mediaSubTypeName.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   543     mediaSubTypeName.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   544     mediaSubTypeName.SetDescriptionL( KNSmlDMVoIPMediaSubTypeNameExp );
       
   545 
       
   546      // CodecSettings/JitterBufferSize
       
   547     MSmlDmDDFObject& jitterBufferSize = codecSetDyn.AddChildObjectL( 
       
   548         KNSmlDMVoIPJitterBufferSize );
       
   549     jitterBufferSize.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   550     jitterBufferSize.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   551     jitterBufferSize.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   552     jitterBufferSize.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   553     jitterBufferSize.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   554     jitterBufferSize.SetDescriptionL( KNSmlDMVoIPJitterBufferSizeExp );
       
   555 
       
   556      // CodecSettings/OctetAlign
       
   557     MSmlDmDDFObject& octetAlign = codecSetDyn.AddChildObjectL( 
       
   558         KNSmlDMVoIPOctetAlign );
       
   559     octetAlign.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   560     octetAlign.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   561     octetAlign.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   562     octetAlign.SetDFFormatL( MSmlDmDDFObject::EBool );
       
   563     octetAlign.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   564     octetAlign.SetDescriptionL( KNSmlDMVoIPOctetAlignExp );
       
   565 
       
   566     // CodecSettings/ModeSet node
       
   567     MSmlDmDDFObject& modeSetNode = codecSetDyn.AddChildObjectL( 
       
   568         KNSmlDMVoIPModeSetNode );
       
   569     modeSetNode.SetAccessTypesL( accessTypesGetAdd );
       
   570     modeSetNode.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   571     modeSetNode.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   572     modeSetNode.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   573     modeSetNode.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   574     modeSetNode.SetDescriptionL( KNSmlDMVoIPModeSetNodeExp );
       
   575 
       
   576     // ModeSet dynamic
       
   577     MSmlDmDDFObject& modeSetDyn = modeSetNode.AddChildObjectGroupL();
       
   578     modeSetDyn.SetAccessTypesL( accessTypesAll );
       
   579     modeSetDyn.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
       
   580     modeSetDyn.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   581     modeSetDyn.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   582     modeSetDyn.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   583     modeSetDyn.SetDescriptionL( KNSmlDMVoIPModeSetIdExp );
       
   584 
       
   585      // ModeSet/x/Mode
       
   586     MSmlDmDDFObject& modeSetId = modeSetDyn.AddChildObjectL( 
       
   587         KNSmlDMVoIPMode );
       
   588     modeSetId.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   589     modeSetId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   590     modeSetId.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   591     modeSetId.SetDFFormatL( MSmlDmDDFObject::EInt );  // int
       
   592     modeSetId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   593     modeSetId.SetDescriptionL( KNSmlDMVoIPModeChangePeriodExp );
       
   594 
       
   595      // CodecSettings/ModeChangePeriod
       
   596     MSmlDmDDFObject& modeChangePer = codecSetDyn.AddChildObjectL( 
       
   597         KNSmlDMVoIPModeChangePeriod );
       
   598     modeChangePer.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   599     modeChangePer.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   600     modeChangePer.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   601     modeChangePer.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   602     modeChangePer.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   603     modeChangePer.SetDescriptionL( KNSmlDMVoIPModeChangePeriodExp );
       
   604 
       
   605      // CodecSettings/ModeChangeNeighbor
       
   606     MSmlDmDDFObject& modeChange = codecSetDyn.AddChildObjectL( 
       
   607         KNSmlDMVoIPModeChangeNeighbor );
       
   608     modeChange.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   609     modeChange.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   610     modeChange.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   611     modeChange.SetDFFormatL( MSmlDmDDFObject::EBool );
       
   612     modeChange.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   613     modeChange.SetDescriptionL( KNSmlDMVoIPModeChangeNeighborExp );
       
   614 
       
   615      // CodecSettings/Ptime
       
   616     MSmlDmDDFObject& ptime = codecSetDyn.AddChildObjectL( 
       
   617         KNSmlDMVoIPPtime );
       
   618     ptime.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   619     ptime.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   620     ptime.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   621     ptime.SetDFFormatL( MSmlDmDDFObject::EInt );  // int
       
   622     ptime.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   623     ptime.SetDescriptionL( KNSmlDMVoIPPtimeExp );
       
   624 
       
   625      // CodecSettings/MaxPtime
       
   626     MSmlDmDDFObject& maxptime = codecSetDyn.AddChildObjectL( 
       
   627         KNSmlDMVoIPMaxPtime );
       
   628     maxptime.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   629     maxptime.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   630     maxptime.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   631     maxptime.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   632     maxptime.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   633     maxptime.SetDescriptionL( KNSmlDMVoIPMaxPtimeExp );
       
   634 
       
   635      // CodecSettings/VAD
       
   636     MSmlDmDDFObject& vad = codecSetDyn.AddChildObjectL( 
       
   637         KNSmlDMVoIPVAD );
       
   638     vad.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   639     vad.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   640     vad.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   641     vad.SetDFFormatL( MSmlDmDDFObject::EBool ); // bool
       
   642     vad.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   643     vad.SetDescriptionL( KNSmlDMVoIPVADExp );
       
   644 
       
   645     // CodecSettings/AnnexB
       
   646     MSmlDmDDFObject& annexB = codecSetDyn.AddChildObjectL( 
       
   647         KNSmlDMVoIPAnnexB );
       
   648     annexB.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   649     annexB.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   650     annexB.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   651     annexB.SetDFFormatL( MSmlDmDDFObject::EBool );  // bool
       
   652     annexB.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   653     annexB.SetDescriptionL( KNSmlDMVoIPAnnexBExp ); 
       
   654 
       
   655     // CodecSettings/MaxRed
       
   656     MSmlDmDDFObject& maxRed = codecSetDyn.AddChildObjectL(
       
   657         KNSmlDMVoIPMaxRed );
       
   658     maxRed.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   659     maxRed.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   660     maxRed.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   661     maxRed.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   662     maxRed.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   663     maxRed.SetDescriptionL( KNSmlDMVoIPMaxRedExp );
       
   664 
       
   665     // SettingsIds node
       
   666     MSmlDmDDFObject& settingIds = idNode.AddChildObjectL( 
       
   667         KNSmlDMVoIPSettingIdsNode );
       
   668     settingIds.SetAccessTypesL( accessTypesGetAdd );
       
   669     settingIds.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   670     settingIds.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   671     settingIds.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   672     settingIds.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   673     settingIds.SetDescriptionL( KNSmlDMVoIPDynamicNode );
       
   674 
       
   675     // settingsIds dynamic
       
   676     MSmlDmDDFObject& settingIdsDynID = settingIds.AddChildObjectGroupL();
       
   677     settingIdsDynID.SetAccessTypesL( accessTypesAll );
       
   678     settingIdsDynID.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
       
   679     settingIdsDynID.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   680     settingIdsDynID.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   681     settingIdsDynID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   682     settingIdsDynID.SetDescriptionL( KNSmlDMVoIPDynamicNodeExp );
       
   683 
       
   684     // SettingIds/ProfileType
       
   685     MSmlDmDDFObject& profileType = settingIdsDynID.AddChildObjectL( 
       
   686         KNSmlDMVoIPProfileType );
       
   687     profileType.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   688     profileType.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   689     profileType.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   690     profileType.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   691     profileType.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   692     profileType.SetDescriptionL( KNSmlDMVoIPProfileTypeExp ); 
       
   693 
       
   694     // SettingIds/ProfileId
       
   695     MSmlDmDDFObject& profileId = settingIdsDynID.AddChildObjectL( 
       
   696         KNSmlDMVoIPProfileId );
       
   697     profileId.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   698     profileId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   699     profileId.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   700     profileId.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   701     profileId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   702     profileId.SetDescriptionL( KNSmlDMVoIPProfileIdExp );
       
   703 
       
   704     // SettingIds/ProfileSpecificId
       
   705     MSmlDmDDFObject& profileSpecific = settingIdsDynID.AddChildObjectL( 
       
   706         KNSmlDMVoIPProfileSpecificId );
       
   707     profileSpecific.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   708     profileSpecific.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   709     profileSpecific.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   710     profileSpecific.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   711     profileSpecific.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   712     profileSpecific.SetDescriptionL( KNSmlDMVoIPProfileSpecificExp );
       
   713 
       
   714     // VoIP/<x>/VoiceMailBox
       
   715     MSmlDmDDFObject& vmbx = idNode.AddChildObjectL( 
       
   716         KNSmlDMVoIPVmbxNode );
       
   717     vmbx.SetAccessTypesL( accessTypesGetAdd );
       
   718     vmbx.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   719     vmbx.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   720     vmbx.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   721     vmbx.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   722     vmbx.SetDescriptionL( KNSmlDMVoIPVmbxNodeExp );
       
   723 
       
   724     // VoIP/<x>/VoiceMailBox/MWI-URI
       
   725     MSmlDmDDFObject& mwiUri = vmbx.AddChildObjectL( 
       
   726         KNSmlDMVoIPMwiUri );
       
   727     mwiUri.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   728     mwiUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   729     mwiUri.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   730     mwiUri.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   731     mwiUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   732     mwiUri.SetDescriptionL( KNSmlDMVoIPMwiUriExp );
       
   733 
       
   734     // VoIP/<x>/VoiceMailBox/ListeningURI
       
   735     MSmlDmDDFObject& listenUri = vmbx.AddChildObjectL( 
       
   736         KNSmlDMVoIPListeningUri );
       
   737     listenUri.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   738     listenUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   739     listenUri.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   740     listenUri.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   741     listenUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   742     listenUri.SetDescriptionL( KNSmlDMVoIPListeningUriExp );
       
   743 
       
   744     // VoIP/<x>/VoiceMailBox/UsedIAPId
       
   745     MSmlDmDDFObject& usedIapId = vmbx.AddChildObjectL( 
       
   746         KNSmlDMVoIPUsedIAPId );
       
   747     usedIapId.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   748     usedIapId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   749     usedIapId.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   750     usedIapId.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   751     usedIapId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   752     usedIapId.SetDescriptionL( KNSmlDMVoIPUsedIAPIdExp );
       
   753 
       
   754     // VoIP/<x>/VoiceMailBox/ReSubscribeInterval
       
   755     MSmlDmDDFObject& reSubscribe = vmbx.AddChildObjectL( 
       
   756         KNSmlDMVoIPReSubscribeInterval );
       
   757     reSubscribe.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   758     reSubscribe.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   759     reSubscribe.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   760     reSubscribe.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   761     reSubscribe.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   762     reSubscribe.SetDescriptionL( KNSmlDMVoIPReSubscribeIntervalExp );
       
   763 
       
   764     // VoIP/<x>/VoiceMailBox/UsedSIPProfileId
       
   765     MSmlDmDDFObject& sipId = vmbx.AddChildObjectL( 
       
   766         KNSmlDMVoIPUsedSIPProfileId );
       
   767     sipId.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   768     sipId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   769     sipId.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   770     sipId.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   771     sipId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   772     sipId.SetDescriptionL( KNSmlDMVoIPUsedSIPProfileIdExp );
       
   773 
       
   774     // StartMediaPort
       
   775     MSmlDmDDFObject& smport = idNode.AddChildObjectL( 
       
   776         KNSmlDMVoIPSMPort );
       
   777     smport.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   778     smport.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   779     smport.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   780     smport.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   781     smport.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   782     smport.SetDescriptionL( KNSmlDMVoIPSMPortExp );
       
   783 
       
   784     // EndMediaPort
       
   785     MSmlDmDDFObject& emport = idNode.AddChildObjectL( 
       
   786         KNSmlDMVoIPEMPort );
       
   787     emport.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   788     emport.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   789     emport.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   790     emport.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   791     emport.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   792     emport.SetDescriptionL( KNSmlDMVoIPEMPortExp );
       
   793 
       
   794     // MediaQos
       
   795     MSmlDmDDFObject& mediaQos = idNode.AddChildObjectL( 
       
   796         KNSmlDMVoIPMediaQos );
       
   797     mediaQos.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   798     mediaQos.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   799     mediaQos.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   800     mediaQos.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   801     mediaQos.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   802     mediaQos.SetDescriptionL( KNSmlDMVoIPMediaQosExp );
       
   803 
       
   804     // DTMFIB
       
   805     MSmlDmDDFObject& dtmfbib = idNode.AddChildObjectL( 
       
   806         KNSmlDMVoIPDTMFIB );
       
   807     dtmfbib.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   808     dtmfbib.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   809     dtmfbib.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   810     dtmfbib.SetDFFormatL( MSmlDmDDFObject::EBool );
       
   811     dtmfbib.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   812     dtmfbib.SetDescriptionL( KNSmlDMVoIPDTMFIBExp );
       
   813 
       
   814     // DTMFOB
       
   815     MSmlDmDDFObject& dtmfob = idNode.AddChildObjectL( 
       
   816         KNSmlDMVoIPDTMFOB );
       
   817     dtmfob.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   818     dtmfob.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   819     dtmfob.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   820     dtmfob.SetDFFormatL( MSmlDmDDFObject::EBool );
       
   821     dtmfob.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   822     dtmfob.SetDescriptionL( KNSmlDMVoIPDTMFOBExp );
       
   823 
       
   824     // SecureCallPref
       
   825     MSmlDmDDFObject& secureCallPref = idNode.AddChildObjectL(
       
   826         KNSmlDMVoIPSecureCallPref );
       
   827     secureCallPref.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   828     secureCallPref.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   829     secureCallPref.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   830     secureCallPref.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   831     secureCallPref.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   832     secureCallPref.SetDescriptionL( KNSmlDMVoIPSecureCallPrefExp );
       
   833 
       
   834     // RTCP
       
   835     MSmlDmDDFObject& rtcp = idNode.AddChildObjectL(
       
   836         KNSmlDMVoIPRTCP );
       
   837     rtcp.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   838     rtcp.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   839     rtcp.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   840     rtcp.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   841     rtcp.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   842     rtcp.SetDescriptionL( KNSmlDMVoIPRTCPExp );
       
   843 
       
   844     // UAHTerminalType
       
   845     MSmlDmDDFObject& uahTerminalType = idNode.AddChildObjectL(
       
   846         KNSmlDMVoIPUAHTerminalType );
       
   847     uahTerminalType.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   848     uahTerminalType.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   849     uahTerminalType.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   850     uahTerminalType.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   851     uahTerminalType.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   852     uahTerminalType.SetDescriptionL( KNSmlDMVoIPUAHTerminalTypeExp );
       
   853 
       
   854     // UAHWLANMAC
       
   855     MSmlDmDDFObject& uahWLANMAC = idNode.AddChildObjectL(
       
   856         KNSmlDMVoIPUAHWLANMAC );
       
   857     uahWLANMAC.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   858     uahWLANMAC.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   859     uahWLANMAC.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   860     uahWLANMAC.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   861     uahWLANMAC.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   862     uahWLANMAC.SetDescriptionL( KNSmlDMVoIPUAHWLANMACExp );
       
   863 
       
   864     // UAHString
       
   865     MSmlDmDDFObject& uahString = idNode.AddChildObjectL(
       
   866         KNSmlDMVoIPUAHString );
       
   867     uahString.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   868     uahString.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   869     uahString.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   870     uahString.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   871     uahString.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   872     uahString.SetDescriptionL( KNSmlDMVoIPUAHStringExp );
       
   873 
       
   874     // ProfileLockedToIAP
       
   875     MSmlDmDDFObject& profileLockedToIAP = idNode.AddChildObjectL(
       
   876         KNSmlDMVoIPProfileLockedToIAP );
       
   877     profileLockedToIAP.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   878     profileLockedToIAP.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   879     profileLockedToIAP.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   880     profileLockedToIAP.SetDFFormatL( MSmlDmDDFObject::EBool );
       
   881     profileLockedToIAP.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   882     profileLockedToIAP.SetDescriptionL( KNSmlDMVoIPProfileLockedToIAPExp );
       
   883 
       
   884     // VoIPPluginUID
       
   885     MSmlDmDDFObject& voipPluginUID = idNode.AddChildObjectL(
       
   886         KNSmlDMVoIPPluginUID );
       
   887     voipPluginUID.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   888     voipPluginUID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   889     voipPluginUID.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   890     voipPluginUID.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   891     voipPluginUID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   892     voipPluginUID.SetDescriptionL( KNSmlDMVoIPPluginUIDExp );
       
   893 
       
   894     // AllowVoIPOverWCDMA
       
   895     MSmlDmDDFObject& voipOverWCDMA = idNode.AddChildObjectL(
       
   896         KNSmlDMVoIPAllowVoIPOverWCDMA );
       
   897     voipOverWCDMA.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   898     voipOverWCDMA.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   899     voipOverWCDMA.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   900     voipOverWCDMA.SetDFFormatL( MSmlDmDDFObject::EBool );
       
   901     voipOverWCDMA.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   902     voipOverWCDMA.SetDescriptionL( KNSmlDMVoIPAllowVoIPOverWCDMAExp );
       
   903 
       
   904     // VoIPDigits
       
   905     MSmlDmDDFObject& voipDigits = idNode.AddChildObjectL(
       
   906         KNSmlDMVoIPVoIPDigits );
       
   907     voipDigits.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   908     voipDigits.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   909     voipDigits.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   910     voipDigits.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   911     voipDigits.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   912     voipDigits.SetDescriptionL( KNSmlDMVoIPVoIPDigitsExp );
       
   913 
       
   914     // URIDomainIgnoreRule
       
   915     MSmlDmDDFObject& uriDomainIgn = idNode.AddChildObjectL(
       
   916         KNSmlDMVoIPURIDomainIgnoreRule );
       
   917     uriDomainIgn.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   918     uriDomainIgn.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   919     uriDomainIgn.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   920     uriDomainIgn.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   921     uriDomainIgn.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   922     uriDomainIgn.SetDescriptionL( KNSmlDMVoIPURIDomainIgnoreRuleExp );
       
   923 
       
   924     // AutoAcceptBuddyRequest
       
   925     MSmlDmDDFObject& aaBuddyReq = idNode.AddChildObjectL(
       
   926         KNSmlDMVoIPAutoAcceptBuddyRequest );
       
   927     aaBuddyReq.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   928     aaBuddyReq.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   929     aaBuddyReq.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   930     aaBuddyReq.SetDFFormatL( MSmlDmDDFObject::EBool );
       
   931     aaBuddyReq.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   932     aaBuddyReq.SetDescriptionL( KNSmlDMVoIPAutoAcceptBuddyRequestExp );
       
   933 
       
   934     // UsedVoIPRelease
       
   935     MSmlDmDDFObject& voipRel = idNode.AddChildObjectL(
       
   936         KNSmlDMVoIPUsedVoIPRelease );
       
   937     voipRel.SetAccessTypesL( accessTypesGet );
       
   938     voipRel.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   939     voipRel.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   940     voipRel.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   941     voipRel.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   942     voipRel.SetDescriptionL( KNSmlDMVoIPUsedVoIPReleaseExp );
       
   943 
       
   944     // AddUserPhone
       
   945     MSmlDmDDFObject& addUserPhone = idNode.AddChildObjectL(
       
   946         KNSmlDMVoIPAddUserPhone );
       
   947     addUserPhone.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   948     addUserPhone.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   949     addUserPhone.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   950     addUserPhone.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   951     addUserPhone.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   952     addUserPhone.SetDescriptionL( KNSmlDMVoIPAddUserPhoneExp );
       
   953 
       
   954     // ProviderBookmarkURI
       
   955     MSmlDmDDFObject& providerBkmarkUri = idNode.AddChildObjectL(
       
   956         KNSmlDMVoIPProviderBookmarkUri );
       
   957     providerBkmarkUri.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   958     providerBkmarkUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   959     providerBkmarkUri.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   960     providerBkmarkUri.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   961     providerBkmarkUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   962     providerBkmarkUri.SetDescriptionL( KNSmlDMVoIPProviderBookmarkUriExp );
       
   963 
       
   964     // SIPConnectivityTestURI
       
   965     MSmlDmDDFObject& sipConnTestUri = idNode.AddChildObjectL( 
       
   966         KNSmlDMVoIPSIPConnTestUri );
       
   967     sipConnTestUri.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   968     sipConnTestUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   969     sipConnTestUri.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   970     sipConnTestUri.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   971     sipConnTestUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   972     sipConnTestUri.SetDescriptionL( KNSmlDMVoIPSIPConnTestUriExp );
       
   973 
       
   974     // NATFWProfileId
       
   975     MSmlDmDDFObject& natfwId = idNode.AddChildObjectL(
       
   976         KNSmlDMVoIPNatFwProfileId );
       
   977     natfwId.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   978     natfwId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   979     natfwId.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   980     natfwId.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   981     natfwId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   982     natfwId.SetDescriptionL( KNSmlDMVoIPNatFwProfileIdExp );
       
   983 
       
   984     // MinSessionInterval
       
   985     MSmlDmDDFObject& minSe = idNode.AddChildObjectL(
       
   986         KNSmlDMVoIPMinSessionInterval );
       
   987     minSe.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   988     minSe.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   989     minSe.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   990     minSe.SetDFFormatL( MSmlDmDDFObject::EInt );
       
   991     minSe.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
   992     minSe.SetDescriptionL( KNSmlDMVoIPMinSessionIntervalExp );
       
   993 
       
   994     // SessionExpires
       
   995     MSmlDmDDFObject& sessionExpires = idNode.AddChildObjectL(
       
   996         KNSmlDMVoIPSessionExpires );
       
   997     sessionExpires.SetAccessTypesL( accessTypesGetReplaceAdd );
       
   998     sessionExpires.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
   999     sessionExpires.SetScopeL( MSmlDmDDFObject::EDynamic );
       
  1000     sessionExpires.SetDFFormatL( MSmlDmDDFObject::EInt );
       
  1001     sessionExpires.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
  1002     sessionExpires.SetDescriptionL( KNSmlDMVoIPSessionExpiresExp );
       
  1003 
       
  1004     // BradingDataURI
       
  1005     MSmlDmDDFObject& brandingUri = idNode.AddChildObjectL(
       
  1006         KNSmlDMVoIPBrandingDataUri );
       
  1007     brandingUri.SetAccessTypesL( accessTypesGetReplaceAdd );
       
  1008     brandingUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
  1009     brandingUri.SetScopeL( MSmlDmDDFObject::EDynamic );
       
  1010     brandingUri.SetDFFormatL( MSmlDmDDFObject::EInt );
       
  1011     brandingUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
  1012     brandingUri.SetDescriptionL( KNSmlDMVoIPBrandingDataUriExp );
       
  1013 
       
  1014     // PresenceSettingsID
       
  1015     MSmlDmDDFObject& presenceId = idNode.AddChildObjectL(
       
  1016         KNSmlDMVoIPPresenceSettingsId );
       
  1017     presenceId.SetAccessTypesL( accessTypesGetReplaceAdd );
       
  1018     presenceId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
  1019     presenceId.SetScopeL( MSmlDmDDFObject::EDynamic );
       
  1020     presenceId.SetDFFormatL( MSmlDmDDFObject::EChr );
       
  1021     presenceId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
  1022     presenceId.SetDescriptionL( KNSmlDMVoIPPresenceSettingsIdExp );
       
  1023 
       
  1024     // UsedNatProtocol
       
  1025     MSmlDmDDFObject& natProtocol = idNode.AddChildObjectL(
       
  1026         KNSmlDMVoIPUsedNatProtocol );
       
  1027     natProtocol.SetAccessTypesL( accessTypesGetReplaceAdd );
       
  1028     natProtocol.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
  1029     natProtocol.SetScopeL( MSmlDmDDFObject::EDynamic );
       
  1030     natProtocol.SetDFFormatL( MSmlDmDDFObject::EInt );
       
  1031     natProtocol.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
  1032     natProtocol.SetDescriptionL( KNSmlDMVoIPUsedNatProtocolExp );
       
  1033 
       
  1034     // AutoEnableService
       
  1035     MSmlDmDDFObject& autoEnable = idNode.AddChildObjectL(
       
  1036         KNSmlDMVoIPAutoEnable );
       
  1037     autoEnable.SetAccessTypesL( accessTypesGetReplaceAdd );
       
  1038     autoEnable.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
  1039     autoEnable.SetScopeL( MSmlDmDDFObject::EDynamic );
       
  1040     autoEnable.SetDFFormatL( MSmlDmDDFObject::EBool );
       
  1041     autoEnable.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
  1042     autoEnable.SetDescriptionL( KNSmlDMVoIPAutoEnableExp );
       
  1043     
       
  1044     // SNAPProfileId
       
  1045     MSmlDmDDFObject& snapId = idNode.AddChildObjectL(
       
  1046         KNSmlDMVoIPSnapProfileId );
       
  1047     snapId.SetAccessTypesL( accessTypesGetReplaceAdd );
       
  1048     snapId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
  1049     snapId.SetScopeL( MSmlDmDDFObject::EDynamic );
       
  1050     snapId.SetDFFormatL( MSmlDmDDFObject::EChr );
       
  1051     snapId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
  1052     snapId.SetDescriptionL( KNSmlDMVoIPSnapProfileIdExp );
       
  1053 
       
  1054     // EnableIM
       
  1055     MSmlDmDDFObject& enableIm = idNode.AddChildObjectL(
       
  1056         KNSmlDMVoIPEnableIm );
       
  1057     enableIm.SetAccessTypesL( accessTypesGetReplaceAdd );
       
  1058     enableIm.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
       
  1059     enableIm.SetScopeL( MSmlDmDDFObject::EDynamic );
       
  1060     enableIm.SetDFFormatL( MSmlDmDDFObject::EBool );
       
  1061     enableIm.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
       
  1062     enableIm.SetDescriptionL( KNSmlDMVoIPEnableImExp );
       
  1063     
       
  1064     DBG_PRINT("CNSmlDmVoIPAdapter::DDFStructureL(): end");
       
  1065     }
       
  1066 
       
  1067 // ---------------------------------------------------------------------------
       
  1068 // CNSmlDmVoIPAdapter::UpdateLeafObjectL
       
  1069 // Updates value of leaf object
       
  1070 // ---------------------------------------------------------------------------
       
  1071 //
       
  1072 void CNSmlDmVoIPAdapter::UpdateLeafObjectL( 
       
  1073     const TDesC8& aURI, 
       
  1074     const TDesC8& aLUID, 
       
  1075     const TDesC8& aObject, 
       
  1076     const TDesC8& /*aType*/, 
       
  1077     const TInt aStatusRef )
       
  1078     {
       
  1079     DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): begin");
       
  1080 
       
  1081     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  1082 
       
  1083     // Load VoIP profile information if not loaded yet
       
  1084     if ( !iProfileEntries.Count() )
       
  1085         {
       
  1086         LoadProfilesL();
       
  1087         }
       
  1088 
       
  1089     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  1090     TPtrC8 uriSeg = LastURISeg( aURI );
       
  1091     TPtrC8 uriTmp = RemoveLastURISeg( aURI );
       
  1092     TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
       
  1093 
       
  1094     // Check that luid mapping exist 
       
  1095     if ( !aLUID.Length() )
       
  1096         {
       
  1097         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
  1098         DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): no LUID end");
       
  1099         return;
       
  1100         }
       
  1101 
       
  1102      // Find profile and get settings
       
  1103     iProfileID = FindProfileLocation( aLUID );
       
  1104 
       
  1105     // If profile is not found return error.
       
  1106     if ( KErrNotFound == iProfileID )
       
  1107         {
       
  1108         retValue = CSmlDmAdapter::ENotFound;
       
  1109         iDmCallback->SetStatusL( aStatusRef, retValue );
       
  1110         DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): not found end");
       
  1111         return;
       
  1112         }
       
  1113 
       
  1114     CDMVoIPSPSettings* spSettings = CDMVoIPSPSettings::NewLC(); // CS:1
       
  1115     spSettings->iRcseProfileId = iProfileEntries[iProfileID]->iId;
       
  1116     TInt spSettingsId( KErrNotFound );
       
  1117     // Check if service provider settings for this VoIP profile are already
       
  1118     // updated to be stored.
       
  1119     for ( TInt counter = 0; counter < iSPSettings.Count(); counter++ )
       
  1120         {
       
  1121         if ( iProfileEntries[iProfileID]->iId == 
       
  1122             iSPSettings[counter]->iRcseProfileId )
       
  1123             {
       
  1124             spSettingsId = counter;
       
  1125             }
       
  1126         }
       
  1127     TBool addSpSettings( EFalse );
       
  1128 
       
  1129     // Check that profile is not already to be saved.
       
  1130     if ( KErrNotFound == iProfileModifs.Find( iProfileID ) )
       
  1131         {
       
  1132         iProfileModifs.Insert( iProfileID, iProfileModifs.Count() );
       
  1133         }
       
  1134 
       
  1135     // VoIP/x/ProviderName
       
  1136     if ( KNSmlDMVoIPProvID() == uriSeg )
       
  1137         {
       
  1138         CRCSEProfileEntry* tmpEntryForProvider = CRCSEProfileEntry::NewLC();
       
  1139         tmpEntryForProvider->iProviderName.Copy( aObject );
       
  1140         CheckDuplicateProviderL( *tmpEntryForProvider );
       
  1141         iProfileEntries[iProfileID]->iProviderName.Copy( 
       
  1142             tmpEntryForProvider->iProviderName );
       
  1143         CleanupStack::PopAndDestroy( tmpEntryForProvider );
       
  1144         }
       
  1145     // VoIP/x/SettingsName
       
  1146     else if ( KNSmlDMVoIPName() == uriSeg )
       
  1147         {
       
  1148         CRCSEProfileEntry* tmpEntryForName = CRCSEProfileEntry::NewLC();
       
  1149         tmpEntryForName->iSettingsName.Copy( aObject );
       
  1150         CheckDuplicateNameL( *tmpEntryForName );
       
  1151         iProfileEntries[iProfileID]->iSettingsName.Copy( 
       
  1152             tmpEntryForName->iSettingsName );
       
  1153         CleanupStack::PopAndDestroy( tmpEntryForName ); 
       
  1154         }
       
  1155     // VoIP/x/SMPort
       
  1156     else if ( KNSmlDMVoIPSMPort() == uriSeg )
       
  1157         {
       
  1158         iProfileEntries[iProfileID]->iStartMediaPort = 
       
  1159             DesToInt( aObject );
       
  1160         }
       
  1161     // VoIP/x/EMPort
       
  1162     else if ( KNSmlDMVoIPEMPort() == uriSeg )
       
  1163         {
       
  1164         iProfileEntries[iProfileID]->iEndMediaPort = DesToInt( aObject );
       
  1165         }
       
  1166     // VoIP/x/MediaQos
       
  1167     else if ( KNSmlDMVoIPMediaQos() == uriSeg )
       
  1168         {
       
  1169         iProfileEntries[iProfileID]->iMediaQOS = DesToInt( aObject );
       
  1170         }
       
  1171     // VoIP/x/DTMFIB
       
  1172     else if ( KNSmlDMVoIPDTMFIB() == uriSeg )
       
  1173         {
       
  1174         if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1175             {
       
  1176             iProfileEntries[iProfileID]->iInbandDTMF = CRCSEProfileEntry::EOn;
       
  1177             }
       
  1178         else if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1179             {
       
  1180             iProfileEntries[iProfileID]->iInbandDTMF = 
       
  1181                 CRCSEProfileEntry::EOff;
       
  1182             }
       
  1183         else
       
  1184             {
       
  1185             retValue = CSmlDmAdapter::EInvalidObject;   
       
  1186             }
       
  1187         }
       
  1188     // VoIP/x/DTMFOB
       
  1189     else if ( KNSmlDMVoIPDTMFOB() == uriSeg )
       
  1190         {
       
  1191         if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1192             {
       
  1193             iProfileEntries[iProfileID]->iOutbandDTMF = 
       
  1194                 CRCSEProfileEntry::EOn;
       
  1195             }
       
  1196         else if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1197             {
       
  1198             iProfileEntries[iProfileID]->iOutbandDTMF = 
       
  1199                 CRCSEProfileEntry::EOff;
       
  1200             }
       
  1201         else
       
  1202             {
       
  1203             retValue = CSmlDmAdapter::EInvalidObject;   
       
  1204             }
       
  1205         }
       
  1206     // VoIP/x/SecureCallPref
       
  1207     else if ( KNSmlDMVoIPSecureCallPref() == uriSeg )
       
  1208         {
       
  1209         iProfileEntries[iProfileID]->
       
  1210             iSecureCallPreference = DesToInt( aObject );
       
  1211         }
       
  1212     // VoIP/x/RTCP
       
  1213     else if ( KNSmlDMVoIPRTCP() == uriSeg )
       
  1214         {
       
  1215         iProfileEntries[iProfileID]->iRTCP = DesToInt( aObject );
       
  1216         }
       
  1217     // VoIP/x/UAHTerminalType
       
  1218     else if ( KNSmlDMVoIPUAHTerminalType() == uriSeg )
       
  1219         {
       
  1220         iProfileEntries[iProfileID]->
       
  1221             iSIPVoIPUAHTerminalType = DesToInt( aObject );
       
  1222         }
       
  1223     // VoIP/x/UAHWLANMAC
       
  1224     else if ( KNSmlDMVoIPUAHWLANMAC() == uriSeg )
       
  1225         {
       
  1226         iProfileEntries[iProfileID]->
       
  1227             iSIPVoIPUAHeaderWLANMAC = DesToInt( aObject );
       
  1228         }
       
  1229     // VoIP/x/UAHString
       
  1230     else if ( KNSmlDMVoIPUAHString() == uriSeg )
       
  1231         {
       
  1232         iProfileEntries[iProfileID]->
       
  1233             iSIPVoIPUAHeaderString.Copy( aObject );
       
  1234         }
       
  1235     // VoIP/x/ProfileLockedToIAP
       
  1236     else if ( KNSmlDMVoIPProfileLockedToIAP() == uriSeg )
       
  1237         {
       
  1238         if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1239             {
       
  1240             iProfileEntries[iProfileID]->
       
  1241                 iProfileLockedToIAP = CRCSEProfileEntry::EOn;
       
  1242             }
       
  1243         else if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1244             {
       
  1245             iProfileEntries[iProfileID]->
       
  1246                 iProfileLockedToIAP = CRCSEProfileEntry::EOff;
       
  1247             }
       
  1248         else
       
  1249             {
       
  1250             retValue = CSmlDmAdapter::EInvalidObject;   
       
  1251             }
       
  1252         }
       
  1253     // VoIP/x/VoIPPluginUID
       
  1254     else if ( KNSmlDMVoIPPluginUID() == uriSeg )
       
  1255         {
       
  1256         iProfileEntries[iProfileID]->iVoIPPluginUID = 
       
  1257             DesToTUint( aObject );
       
  1258         }
       
  1259     // VoIP/x/AllowVoIPOverWCDMA
       
  1260     else if ( KNSmlDMVoIPAllowVoIPOverWCDMA() == uriSeg )
       
  1261         {
       
  1262         if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1263             {
       
  1264             iProfileEntries[iProfileID]->
       
  1265                 iAllowVoIPoverWCDMA = CRCSEProfileEntry::EOn;
       
  1266             }
       
  1267         else if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1268             {
       
  1269             iProfileEntries[iProfileID]->
       
  1270                 iAllowVoIPoverWCDMA = CRCSEProfileEntry::EOff;
       
  1271             }
       
  1272         else
       
  1273             {
       
  1274             retValue = CSmlDmAdapter::EInvalidObject;   
       
  1275             }
       
  1276         iAllowVoIPOverWCDMAModified = ETrue; 
       
  1277         }
       
  1278     // VoIP/x/VoIPDigits
       
  1279     else if ( KNSmlDMVoIPVoIPDigits() == uriSeg )
       
  1280         {
       
  1281         iProfileEntries[iProfileID]->iMeanCountOfVoIPDigits = 
       
  1282             DesToInt( aObject );
       
  1283         }
       
  1284     // VoIP/x/URIDomainIgnoreRule
       
  1285     else if ( KNSmlDMVoIPURIDomainIgnoreRule() == uriSeg )
       
  1286         {
       
  1287         iProfileEntries[iProfileID]->iIgnoreAddrDomainPart = 
       
  1288             DesToInt( aObject );
       
  1289         }
       
  1290     // VoIP/x/AddUserPhone
       
  1291     else if ( KNSmlDMVoIPAddUserPhone() == uriSeg )
       
  1292         {
       
  1293         if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1294             {
       
  1295             iProfileEntries[iProfileID]->iUserPhoneUriParameter =
       
  1296             CRCSEProfileEntry::EOff;
       
  1297             }
       
  1298         else if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1299             {
       
  1300             iProfileEntries[iProfileID]->iUserPhoneUriParameter =
       
  1301             CRCSEProfileEntry::EOn;
       
  1302             }
       
  1303         else
       
  1304             {
       
  1305             retValue = CSmlDmAdapter::EInvalidObject;
       
  1306             }
       
  1307         }
       
  1308     // VoIP/x/ProviderBookmarkURI
       
  1309     else if ( KNSmlDMVoIPProviderBookmarkUri() == uriSeg )
       
  1310         {
       
  1311         if ( KErrNotFound == spSettingsId )
       
  1312             {
       
  1313             delete spSettings->iServiceProviderBookmark;
       
  1314             spSettings->iServiceProviderBookmark = NULL;
       
  1315             spSettings->iServiceProviderBookmark = HBufC::NewL( 
       
  1316                 aObject.Length() );
       
  1317             spSettings->iServiceProviderBookmark->Des().Copy( aObject );
       
  1318             addSpSettings = ETrue;
       
  1319             }
       
  1320         else
       
  1321             {
       
  1322             delete iSPSettings[spSettingsId]->iServiceProviderBookmark;
       
  1323             iSPSettings[spSettingsId]->iServiceProviderBookmark = NULL;
       
  1324             iSPSettings[spSettingsId]->iServiceProviderBookmark = HBufC::NewL(
       
  1325                 aObject.Length() );
       
  1326             iSPSettings[spSettingsId]->iServiceProviderBookmark->Des().Copy( 
       
  1327                 aObject );
       
  1328             }
       
  1329         }
       
  1330     // VoIP/x/SIPConnectivityTestURI
       
  1331     else if ( KNSmlDMVoIPSIPConnTestUri() == uriSeg )
       
  1332         {
       
  1333         iProfileEntries[iProfileID]->iSIPConnTestAddress.Copy( 
       
  1334             aObject );
       
  1335         }
       
  1336     // VoIP/x/NATFWProfileId
       
  1337     else if ( KNSmlDMVoIPNatFwProfileId() == uriSeg )
       
  1338         {
       
  1339         TUint32 natId = NatFwIdL( aObject );
       
  1340         if ( KErrNone == natId )
       
  1341             {
       
  1342             retValue = CSmlDmAdapter::EInvalidObject;
       
  1343             }
       
  1344         else
       
  1345             {
       
  1346             iProfileEntries[iProfileID]->iNATSettingsStorageId = natId;
       
  1347             }
       
  1348         }
       
  1349     // VoIP/x/MinSessionInterval
       
  1350     else if ( KNSmlDMVoIPMinSessionInterval() == uriSeg )
       
  1351         {
       
  1352         iProfileEntries[iProfileID]->iSIPMinSE = DesToInt( aObject );
       
  1353         }
       
  1354     // VoIP/x/SessionExpires
       
  1355     else if ( KNSmlDMVoIPSessionExpires() == uriSeg )
       
  1356         {
       
  1357         iProfileEntries[iProfileID]->iSIPSessionExpires = 
       
  1358             DesToInt( aObject );
       
  1359         }
       
  1360     // VoIP/x/BradingDataURI
       
  1361     else if ( KNSmlDMVoIPBrandingDataUri() == uriSeg )
       
  1362         {
       
  1363         if ( KErrNotFound == spSettingsId )
       
  1364             {
       
  1365             delete spSettings->iBrandingDataUri;
       
  1366             spSettings->iBrandingDataUri = NULL;
       
  1367             spSettings->iBrandingDataUri = HBufC::NewL( aObject.Length() );
       
  1368             spSettings->iBrandingDataUri->Des().Copy( aObject );
       
  1369             addSpSettings = ETrue;
       
  1370             }
       
  1371         else
       
  1372             {
       
  1373             delete iSPSettings[spSettingsId]->iBrandingDataUri;
       
  1374             iSPSettings[spSettingsId]->iBrandingDataUri = NULL;
       
  1375             iSPSettings[spSettingsId]->iBrandingDataUri = 
       
  1376                 HBufC::NewL( aObject.Length() );
       
  1377             iSPSettings[spSettingsId]->iBrandingDataUri->Des().Copy( 
       
  1378                 aObject );
       
  1379             }
       
  1380         }
       
  1381     // VoIP/x/PresenceSettingsID
       
  1382     else if ( KNSmlDMVoIPPresenceSettingsId() == uriSeg )
       
  1383         {
       
  1384         if ( KErrNotFound == spSettingsId )
       
  1385             {
       
  1386             spSettings->iPresenceId = PresenceIdL( aObject );
       
  1387             addSpSettings = ETrue;
       
  1388             }
       
  1389         else
       
  1390             {
       
  1391             iSPSettings[spSettingsId]->iPresenceId = PresenceIdL( aObject );
       
  1392             }
       
  1393         }
       
  1394     // VoIP/x/UsedNATProtocol
       
  1395     else if ( KNSmlDMVoIPUsedNatProtocol() == uriSeg )
       
  1396         {
       
  1397         iProfileEntries[iProfileID]->iNATProtocol = DesToInt( aObject );
       
  1398         }
       
  1399     // VoIP/x/AutoEnable
       
  1400     else if ( KNSmlDMVoIPAutoEnable() == uriSeg )
       
  1401         {
       
  1402         if ( KErrNotFound == spSettingsId )
       
  1403             {
       
  1404             spSettings->iAutoEnableService = DesToInt( aObject );
       
  1405             addSpSettings = ETrue;
       
  1406             }
       
  1407         else
       
  1408             {
       
  1409             iSPSettings[spSettingsId]->iAutoEnableService =  
       
  1410                 DesToInt( aObject );
       
  1411             }
       
  1412         }
       
  1413     // VoIP/x/SNAPProfileId
       
  1414     else if ( KNSmlDMVoIPSnapProfileId() == uriSeg )
       
  1415         {
       
  1416         if ( KErrNotFound == spSettingsId )
       
  1417             {
       
  1418             spSettings->iSnapId = SnapIdL( aObject );
       
  1419             addSpSettings = ETrue;
       
  1420             }
       
  1421         else
       
  1422             {
       
  1423             iSPSettings[spSettingsId]->iSnapId = SnapIdL( aObject );
       
  1424             }
       
  1425         }
       
  1426     // VoIP/x/EnableIM
       
  1427     else if ( KNSmlDMVoIPEnableIm() == uriSeg )
       
  1428         {
       
  1429         if ( KErrNotFound == spSettingsId )
       
  1430             {
       
  1431             if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1432                 {
       
  1433                 spSettings->iImEnabled = EFalse;
       
  1434                 addSpSettings = ETrue;
       
  1435                 }
       
  1436             else if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1437                 {
       
  1438                 spSettings->iImEnabled = ETrue;
       
  1439                 addSpSettings = ETrue;
       
  1440                 }
       
  1441             else
       
  1442                 {
       
  1443                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1444                 }
       
  1445             }
       
  1446         else
       
  1447             {
       
  1448             if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1449                 {
       
  1450                 iSPSettings[spSettingsId]->iImEnabled = EFalse;
       
  1451                 }
       
  1452             else if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1453                 {
       
  1454                 iSPSettings[spSettingsId]->iImEnabled = ETrue;
       
  1455                 }
       
  1456             else
       
  1457                 {
       
  1458                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1459                 }
       
  1460             }
       
  1461         }
       
  1462 
       
  1463     // ==============================
       
  1464     // SettingIds node (update)
       
  1465     // ==============================
       
  1466     //
       
  1467 
       
  1468     // VoIP/x/SettingIds
       
  1469     if ( KNSmlDMVoIPSettingId() == LastURISeg( aLUID ).Left( 
       
  1470         KNSmlDMVoIPSettingId().Length() ) 
       
  1471         && KFiveSegs == NumOfURISegs( aURI ) )
       
  1472         {
       
  1473         retValue = UpdateSettingIdsSpecificObjectL( aLUID, uriSeg, aObject );
       
  1474         }
       
  1475 
       
  1476     // ==============================
       
  1477     // PreferredCodecs node (update)
       
  1478     // ==============================
       
  1479     //
       
  1480 
       
  1481     // VoIP/x/PreferredCodecs node
       
  1482     if ( KNSmlDMVoIPPreferredCodecId() == uriSeg
       
  1483         && KFiveSegs == NumOfURISegs( aURI ) ) 
       
  1484         {
       
  1485         // Check that codec ID is found from codec entries before setting it.
       
  1486         // Preferred codec ID setting is only for knowing and changing an
       
  1487         // already existing codec priority.
       
  1488         if ( FindCodecLocation( DesToInt( aObject ) ) != KErrNotFound &&
       
  1489             DesToInt( aLUID.Right( 10 ) ) <= iProfileEntries[iProfileID]->
       
  1490             iPreferredCodecs.Count() )
       
  1491             {
       
  1492             iProfileEntries[iProfileID]->iPreferredCodecs[ 
       
  1493                 DesToInt( aLUID.Right( 10 ))] = DesToInt( aObject );
       
  1494             }
       
  1495         else
       
  1496             {
       
  1497             // Codec is not found from codecsettings or
       
  1498             // invalid LUID is passed to the adapter.
       
  1499             retValue = CSmlDmAdapter::EInvalidObject;
       
  1500             }
       
  1501 
       
  1502         }
       
  1503 
       
  1504     // ==============================
       
  1505     // CodecSettings node (update)
       
  1506     // ==============================
       
  1507     //
       
  1508     if ( KNSmlDMVoIPCodecSettingsId() == LastURISeg( aLUID ).
       
  1509         Left( KNSmlDMVoIPCodecSettingsId().Length() )
       
  1510         && KFiveSegs == NumOfURISegs( aURI ) )
       
  1511         {
       
  1512         retValue = UpdateCodecSpecificObject( aLUID, uriSeg, aObject );
       
  1513         }
       
  1514 
       
  1515     // ==============================
       
  1516     // VoiceMailBox node (update)
       
  1517     // ==============================
       
  1518     //
       
  1519     if ( KNSmlDMVoIPVmbxNode() == secondLastUriSeg && 
       
  1520         KFourSegs == NumOfURISegs( aURI ) )
       
  1521         {
       
  1522         if ( KNSmlDMVoIPMwiUri() == uriSeg )
       
  1523             {
       
  1524             if ( KErrNotFound == spSettingsId )
       
  1525                 {
       
  1526                 delete spSettings->iVmbxMwiUri;
       
  1527                 spSettings->iVmbxMwiUri = NULL;
       
  1528                 spSettings->iVmbxMwiUri = HBufC::NewL( aObject.Length() );
       
  1529                 spSettings->iVmbxMwiUri->Des().Copy( aObject );
       
  1530                 addSpSettings = ETrue;
       
  1531                 }
       
  1532             else
       
  1533                 {
       
  1534                 delete iSPSettings[spSettingsId]->iVmbxMwiUri;
       
  1535                 iSPSettings[spSettingsId]->iVmbxMwiUri = NULL;
       
  1536                 iSPSettings[spSettingsId]->iVmbxMwiUri = HBufC::NewL( 
       
  1537                     aObject.Length() );
       
  1538                 iSPSettings[spSettingsId]->iVmbxMwiUri->Des().Copy( aObject );
       
  1539                 }
       
  1540             }
       
  1541         else if ( KNSmlDMVoIPListeningUri() == uriSeg )
       
  1542             {
       
  1543             if ( KErrNotFound == spSettingsId )
       
  1544                 {
       
  1545                 delete spSettings->iVmbxListenUri;
       
  1546                 spSettings->iVmbxListenUri = NULL;
       
  1547                 spSettings->iVmbxListenUri = HBufC::NewL( aObject.Length() );
       
  1548                 spSettings->iVmbxListenUri->Des().Copy( aObject );
       
  1549                 addSpSettings = ETrue;
       
  1550                 }
       
  1551             else
       
  1552                 {
       
  1553                 delete iSPSettings[spSettingsId]->iVmbxListenUri;
       
  1554                 iSPSettings[spSettingsId]->iVmbxListenUri = NULL;
       
  1555                 iSPSettings[spSettingsId]->iVmbxListenUri = HBufC::NewL( 
       
  1556                     aObject.Length() );
       
  1557                 iSPSettings[spSettingsId]->iVmbxListenUri->Des().Copy( 
       
  1558                     aObject );
       
  1559                 }
       
  1560             }
       
  1561         else if ( KNSmlDMVoIPUsedIAPId() == uriSeg )
       
  1562             {
       
  1563             TInt iapId = ConRefL( aObject );
       
  1564             if ( KErrNotFound == iapId )
       
  1565                 {
       
  1566                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1567                 }
       
  1568             else
       
  1569                 {
       
  1570                 if ( KErrNotFound == spSettingsId )
       
  1571                     {
       
  1572                     spSettings->iVmbxIapId = iapId;
       
  1573                     addSpSettings = ETrue;
       
  1574                     }
       
  1575                 else
       
  1576                     {
       
  1577                     iSPSettings[spSettingsId]->iVmbxIapId = iapId;
       
  1578                     }
       
  1579                 }
       
  1580             }
       
  1581         else if ( KNSmlDMVoIPReSubscribeInterval() == uriSeg )
       
  1582             {
       
  1583             if ( KErrNotFound == spSettingsId )
       
  1584                 {
       
  1585                 spSettings->iReSubscribeInterval = DesToInt( aObject );
       
  1586                 addSpSettings = ETrue;
       
  1587                 }
       
  1588             else
       
  1589                 {
       
  1590                 iSPSettings[spSettingsId]->iReSubscribeInterval = 
       
  1591                     DesToInt( aObject );
       
  1592                 }
       
  1593             }
       
  1594         else if ( KNSmlDMVoIPUsedSIPProfileId() == uriSeg )
       
  1595             {
       
  1596             TUint32 profileId = SetSipRefL( aObject ); 
       
  1597             if ( profileId > 0 )
       
  1598                 {
       
  1599                 if ( KErrNotFound == spSettingsId )
       
  1600                     {
       
  1601                     spSettings->iVmbxSipId = profileId;
       
  1602                     addSpSettings = ETrue;
       
  1603                     }
       
  1604                 else
       
  1605                     {
       
  1606                     iSPSettings[spSettingsId]->iVmbxSipId = profileId;
       
  1607                     }
       
  1608                 }
       
  1609             else
       
  1610                 {
       
  1611                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1612                 }
       
  1613             }
       
  1614         else if ( KNSmlDMVoIPAutoAcceptBuddyRequest() == uriSeg )
       
  1615             {
       
  1616             if ( KErrNotFound == spSettingsId )
       
  1617                 {
       
  1618                 spSettings->iAutoAcceptBuddy = DesToInt( aObject );
       
  1619                 addSpSettings = ETrue;
       
  1620                 }
       
  1621             else
       
  1622                 {
       
  1623                 iSPSettings[spSettingsId]->iAutoAcceptBuddy = 
       
  1624                     DesToInt( aObject );
       
  1625                 }
       
  1626             }
       
  1627         else
       
  1628             {
       
  1629             retValue = CSmlDmAdapter::EInvalidObject;
       
  1630             }
       
  1631         }
       
  1632 
       
  1633     if ( addSpSettings )
       
  1634         {
       
  1635         // Append Service Provider Settings to array for saving them later.
       
  1636         // iSPSettings array will own the object now. 
       
  1637         iSPSettings.AppendL( spSettings );
       
  1638         CleanupStack::Pop( spSettings ); // CS:0
       
  1639         }
       
  1640     else
       
  1641         {
       
  1642         // Local Service Provider Settings not needed.
       
  1643         CleanupStack::PopAndDestroy( spSettings ); // CS:0
       
  1644         }
       
  1645 
       
  1646     iDmCallback->SetStatusL( aStatusRef, retValue );
       
  1647 
       
  1648     DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): end");
       
  1649     }
       
  1650     
       
  1651 // ---------------------------------------------------------------------------
       
  1652 // CNSmlDmVoIPAdapter::UpdateCodecSpecificObject
       
  1653 // Updates Codec specific object.
       
  1654 // ---------------------------------------------------------------------------
       
  1655 //
       
  1656 CSmlDmAdapter::TError CNSmlDmVoIPAdapter::UpdateCodecSpecificObject(
       
  1657     const TDesC8& aLUID, const TDesC8& aUriSeg, const TDesC8& aObject )
       
  1658     {
       
  1659     DBG_PRINT("CNSmlDmVoIPAdapter::UpdateCodecSpecificObject(): begin");
       
  1660 
       
  1661     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  1662 
       
  1663     // Get codec ID used by these settings.
       
  1664     TUint32 codecId = DesToInt( aLUID.Right( 10 ) );
       
  1665     TInt codecPos = FindCodecLocation( codecId );
       
  1666     if ( KErrNotFound != codecPos )
       
  1667         {
       
  1668         // Add profile to be saved if not done already.
       
  1669         if ( KErrNotFound == iCodecModifs.Find( codecPos ) )
       
  1670             {
       
  1671             iCodecModifs.Insert( codecPos, iCodecModifs.Count() );
       
  1672             }
       
  1673         //CodecId
       
  1674         if ( KNSmlDMVoIPCodecId() == aUriSeg ) 
       
  1675             {
       
  1676             iCodecEntries[codecPos]->iCodecId = DesToInt( aObject );
       
  1677             }
       
  1678         //MediaTypeName
       
  1679         if ( KNSmlDMVoIPMediaTypeName() == aUriSeg ) 
       
  1680             {
       
  1681             iCodecEntries[codecPos]->iMediaTypeName.Copy( aObject );
       
  1682             }
       
  1683         //MediaSubTypeName
       
  1684         if ( KNSmlDMVoIPMediaSubTypeName() == aUriSeg ) 
       
  1685             {
       
  1686             iCodecEntries[codecPos]->
       
  1687                 iMediaSubTypeName.Copy( aObject );
       
  1688             }
       
  1689         //JitterBufferSize
       
  1690         if ( KNSmlDMVoIPJitterBufferSize() == aUriSeg ) 
       
  1691             {
       
  1692             iCodecEntries[codecPos]->iJitterBufferSize = 
       
  1693                 DesToInt( aObject );
       
  1694             }
       
  1695         //OctetAlign
       
  1696         if ( KNSmlDMVoIPOctetAlign() == aUriSeg ) 
       
  1697             {
       
  1698             if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1699                 {
       
  1700                 iCodecEntries[codecPos]->iOctetAlign = 
       
  1701                     CRCSEAudioCodecEntry::EOn;
       
  1702                 }
       
  1703             else if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1704                 {
       
  1705                 iCodecEntries[codecPos]->iOctetAlign = 
       
  1706                     CRCSEAudioCodecEntry::EOff;
       
  1707                 }
       
  1708             else
       
  1709                 {
       
  1710                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1711                 }
       
  1712             }
       
  1713         //ModeChangePeriod
       
  1714         if ( KNSmlDMVoIPModeChangePeriod() == aUriSeg ) 
       
  1715             {
       
  1716             iCodecEntries[codecPos]->iModeChangePeriod = 
       
  1717                 DesToInt( aObject );
       
  1718             }
       
  1719         //ModeChangeNeighbor                
       
  1720         if ( KNSmlDMVoIPModeChangeNeighbor() == aUriSeg ) 
       
  1721             {
       
  1722             if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1723                 {
       
  1724                 iCodecEntries[codecPos]->iModeChangeNeighbor = 
       
  1725                     CRCSEAudioCodecEntry::EOn;
       
  1726                 }
       
  1727             else if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1728                 {
       
  1729                 iCodecEntries[codecPos]->iModeChangeNeighbor = 
       
  1730                     CRCSEAudioCodecEntry::EOff;
       
  1731                 }
       
  1732             else
       
  1733                 {
       
  1734                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1735                 }
       
  1736             }
       
  1737         //Ptime
       
  1738         if ( KNSmlDMVoIPPtime() == aUriSeg ) 
       
  1739             {
       
  1740             iCodecEntries[codecPos]->iPtime = DesToInt( aObject );
       
  1741             }
       
  1742         //Maxptime
       
  1743         if ( KNSmlDMVoIPMaxPtime() == aUriSeg ) 
       
  1744             {
       
  1745             iCodecEntries[codecPos]->iMaxptime = DesToInt( aObject );
       
  1746             }
       
  1747         //VAD                
       
  1748         if ( KNSmlDMVoIPVAD() == aUriSeg ) 
       
  1749             {
       
  1750             if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1751                 {
       
  1752                 iCodecEntries[codecPos]->iVAD = 
       
  1753                     CRCSEAudioCodecEntry::EOn;
       
  1754                 }
       
  1755             else if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1756                 {
       
  1757                 iCodecEntries[codecPos]->iVAD = 
       
  1758                     CRCSEAudioCodecEntry::EOff;
       
  1759                 }
       
  1760             else
       
  1761                 {
       
  1762                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1763                 }
       
  1764             }
       
  1765         //AnnexB                
       
  1766         if ( KNSmlDMVoIPAnnexB() == aUriSeg ) 
       
  1767             {
       
  1768             if ( KNSmlDMVoIPValueTrue() == aObject )
       
  1769                 {
       
  1770                 iCodecEntries[codecPos]->iAnnexb =
       
  1771                     CRCSEAudioCodecEntry::EOn;
       
  1772                 }
       
  1773             else if ( KNSmlDMVoIPValueFalse() == aObject )
       
  1774                 {
       
  1775                 iCodecEntries[codecPos]->iAnnexb =
       
  1776                     CRCSEAudioCodecEntry::EOff;
       
  1777                 }
       
  1778             else
       
  1779                 {
       
  1780                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1781                 }
       
  1782             }
       
  1783         // MaxRed
       
  1784         if ( KNSmlDMVoIPMaxRed() == aUriSeg )
       
  1785             {
       
  1786             iCodecEntries[codecPos]->iMaxRed = DesToInt( aObject );
       
  1787             }
       
  1788 
       
  1789         // ==============================
       
  1790         // ModeSet node ( update )
       
  1791         // ==============================
       
  1792         //
       
  1793         if ( KNSmlDMVoIPMode() == aUriSeg )  
       
  1794             {
       
  1795             // Add profile to be saved if not done already.
       
  1796             if ( KErrNotFound == iCodecModifs.Find( codecPos ) )
       
  1797                 {
       
  1798                 iCodecModifs.Insert( codecPos, iCodecModifs.Count() );
       
  1799                 }
       
  1800             iCodecEntries[codecPos]->iModeSet[ 
       
  1801                 DesToInt( aLUID.Right( 10 ))] = DesToInt( aObject );
       
  1802             }
       
  1803         }
       
  1804     else
       
  1805         {
       
  1806         // codecsetting not found even in luid exists
       
  1807         retValue = CSmlDmAdapter::EError;
       
  1808         }
       
  1809     DBG_PRINT("CNSmlDmVoIPAdapter::UpdateCodecSpecificObject(): end");
       
  1810 
       
  1811     return retValue;
       
  1812     }
       
  1813 
       
  1814 // ---------------------------------------------------------------------------
       
  1815 // CNSmlDmVoIPAdapter::UpdateSettingIdsSpecificObjectL
       
  1816 // Updates SettingIds specific object.
       
  1817 // ---------------------------------------------------------------------------
       
  1818 //
       
  1819 CSmlDmAdapter::TError CNSmlDmVoIPAdapter::UpdateSettingIdsSpecificObjectL(
       
  1820     const TDesC8& aLUID, const TDesC8& aUriSeg, const TDesC8& aObject )
       
  1821     {
       
  1822     DBG_PRINT("CNSmlDmVoIPAdapter::UpdateSettingIdsSpecificObjectL(): start");
       
  1823 
       
  1824     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  1825 
       
  1826     // Get SIP Specific ID used by these settings.
       
  1827 
       
  1828     // Add profile to be saved if not done already.
       
  1829     if ( KErrNotFound == iProfileModifs.Find( iProfileID ) )
       
  1830         {
       
  1831         iProfileModifs.Insert( iProfileID, iProfileModifs.Count() );
       
  1832         }
       
  1833     //ProfileType
       
  1834     if ( KNSmlDMVoIPProfileType() == aUriSeg )
       
  1835         {
       
  1836         if ( KNSmlDMVoIPProfileTypeSIP() == aObject )
       
  1837             {
       
  1838             iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  1839                 LastURISeg( aLUID ).Right( 10 ))].iProfileType = 0;
       
  1840             // If the profile id is not saved and the string to fetch it is only temporaly stored,
       
  1841             // the profile id will be fetched from previously-stored member value and set as well 
       
  1842             // when saveing the profiletype.
       
  1843             if( iTempProfileIdObject )
       
  1844                 {
       
  1845                 TUint32 profileId = SetSipRefL( *iTempProfileIdObject ); 
       
  1846                 if ( profileId > 0 )
       
  1847                     {
       
  1848                     // Set profileId to settingsids.
       
  1849                     iProfileEntries[iProfileID]->
       
  1850                         iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
       
  1851                         iProfileId = profileId;
       
  1852                     retValue = CSmlDmAdapter::EOk;
       
  1853                     }
       
  1854                 else
       
  1855                     {
       
  1856                     retValue = CSmlDmAdapter::EInvalidObject;
       
  1857                     }       
       
  1858                 } 
       
  1859             iIsProfileTypeSet = ETrue;
       
  1860             delete iTempProfileIdObject;
       
  1861             iTempProfileIdObject = NULL;
       
  1862             }
       
  1863         else if ( KNSmlDMVoIPProfileTypeSCCP() == aObject )
       
  1864             {
       
  1865             iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  1866                 LastURISeg( aLUID ).Right( 10 ))].iProfileType = 1;
       
  1867             // If the profile id is not saved and the string to fetch it is only temporaly stored,
       
  1868             // the profile id will be fetched from previously-stored member value and set as well 
       
  1869             // when saveing the profiletype.
       
  1870             if( iTempProfileIdObject )
       
  1871                 {
       
  1872                 TUint32 profileId = SetSccpRefL( *iTempProfileIdObject ); 
       
  1873                 // profileId can be zero
       
  1874                 if ( profileId > 0 || 0 == profileId )
       
  1875                     {
       
  1876                     // set profileId to settingsids
       
  1877                     iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  1878                         LastURISeg( aLUID ).Right( 10 ))].
       
  1879                         iProfileId = profileId;
       
  1880                     retValue = CSmlDmAdapter::EOk;
       
  1881                     }
       
  1882                 else
       
  1883                     {
       
  1884                     retValue = CSmlDmAdapter::EInvalidObject;
       
  1885                     }
       
  1886                 }
       
  1887             iIsProfileTypeSet = ETrue;
       
  1888             delete iTempProfileIdObject;
       
  1889             iTempProfileIdObject = NULL;       
       
  1890             }
       
  1891         else
       
  1892             {
       
  1893             retValue = CSmlDmAdapter::EInvalidObject;   
       
  1894             }
       
  1895         }
       
  1896     // ProfileId
       
  1897     if ( KNSmlDMVoIPProfileId() == aUriSeg )
       
  1898         {
       
  1899         // Handle SIP type.
       
  1900         if ( 0 == iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  1901             LastURISeg( aLUID ).Right( 10 ))].iProfileType )
       
  1902             {
       
  1903             TUint32 profileId = SetSipRefL( aObject ); 
       
  1904             if ( profileId > 0 )
       
  1905                 {
       
  1906                 // Set profileId to settingsids.
       
  1907                 iProfileEntries[iProfileID]->
       
  1908                     iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
       
  1909                     iProfileId = profileId;
       
  1910                 retValue = CSmlDmAdapter::EOk;
       
  1911                 }
       
  1912             else
       
  1913                 {
       
  1914                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1915                 }
       
  1916             }  
       
  1917         // Handle SCCP type
       
  1918         else if ( 1 == iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  1919             LastURISeg( aLUID ).Right( 10 ))].iProfileType )
       
  1920             {
       
  1921             TUint32 profileId = SetSccpRefL( aObject ); 
       
  1922 
       
  1923             // profileId can be zero
       
  1924             if ( profileId > 0 || 0 == profileId )
       
  1925                 {
       
  1926                 // set profileId to settingsids
       
  1927                 iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  1928                     LastURISeg( aLUID ).Right( 10 ))].
       
  1929                     iProfileId = profileId;
       
  1930                 retValue = CSmlDmAdapter::EOk;
       
  1931                 }
       
  1932             else
       
  1933                 {
       
  1934                 retValue = CSmlDmAdapter::EInvalidObject;
       
  1935                 }
       
  1936             }
       
  1937         // If the ProfileType has not been set yet,
       
  1938         // the string used to fetch ProfileId temporarily is stored to a member value. 
       
  1939         else if ( !iIsProfileTypeSet )
       
  1940             {
       
  1941             if( iTempProfileIdObject )
       
  1942             	{
       
  1943             	delete iTempProfileIdObject;
       
  1944             	iTempProfileIdObject = NULL;
       
  1945             	}
       
  1946                 iTempProfileIdObject = aObject.AllocL();
       
  1947             }
       
  1948         else
       
  1949             {
       
  1950             // no SCCP or SIP type found
       
  1951             retValue = CSmlDmAdapter::EError;
       
  1952             }
       
  1953         }
       
  1954     // ProfileSpecificId
       
  1955     if ( KNSmlDMVoIPProfileSpecificId() == aUriSeg )
       
  1956         {
       
  1957         // SIPSpecific settings have been removed so set
       
  1958         // SIPSpecific ID as not found.
       
  1959         iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  1960             LastURISeg( aLUID ).Right( 10 ))].
       
  1961             iProfileSpecificSettingId = KErrNotFound;
       
  1962 
       
  1963         // Set status to OK so we won't break backwards compatibility.
       
  1964         // Some DM servers may react to receiving other status than OK
       
  1965         // when sending settings they think are supported.
       
  1966         retValue = CSmlDmAdapter::EOk;
       
  1967         }
       
  1968 
       
  1969     DBG_PRINT("CNSmlDmVoIPAdapter::UpdateSettingIdsSpecificObjectL(): end");
       
  1970 
       
  1971     return retValue;
       
  1972     }
       
  1973 // ---------------------------------------------------------------------------
       
  1974 // CNSmlDmVoIPAdapter::DeleteObjectL
       
  1975 // This deletes VoIP profiles
       
  1976 // ---------------------------------------------------------------------------
       
  1977 //
       
  1978 void CNSmlDmVoIPAdapter::DeleteObjectL( 
       
  1979     const TDesC8& aURI, 
       
  1980     const TDesC8& aLUID, 
       
  1981     const TInt aStatusRef )
       
  1982     {
       
  1983     DBG_PRINT("CNSmlDmVoIPAdapter::DeleteObjectL( ): begin");
       
  1984 
       
  1985     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  1986 
       
  1987     // Load VoIP profile information if not loaded yet
       
  1988     if ( !iProfileEntries.Count() )
       
  1989         {
       
  1990         LoadProfilesL();
       
  1991         }
       
  1992 
       
  1993     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EError;
       
  1994 
       
  1995     // Get URI parameters.
       
  1996     TBuf8<KNSmlVoIPMaxUriLength> uri = aURI;
       
  1997     TPtrC8 uriSeg = LastURISeg( aURI );
       
  1998     TPtrC8 uriTmp = RemoveLastURISeg( aURI );
       
  1999     TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
       
  2000 
       
  2001     // Copy LUID as last segment if exists.
       
  2002     if ( 0 < aLUID.Length() )
       
  2003         {
       
  2004         uri.Copy ( aLUID );
       
  2005         }
       
  2006     iProfileID = FindProfileLocation( uri );
       
  2007     if ( KErrNotFound == iProfileID )
       
  2008         {
       
  2009         iProfileID = FindProfileLocation( aURI );
       
  2010         if ( KErrNotFound == iProfileID )
       
  2011             {
       
  2012             retValue = CSmlDmAdapter::ENotFound;
       
  2013             iDmCallback->SetStatusL( aStatusRef, retValue );
       
  2014             DBG_PRINT("CNSmlDmVoIPAdapter::DeleteObjectL( ): ENotFound end");
       
  2015             return;
       
  2016             }
       
  2017         } 
       
  2018 
       
  2019     // ==============================
       
  2020     // VoIP/x (delete)
       
  2021     // ==============================
       
  2022     //
       
  2023     if ( secondLastUriSeg == KNSmlDMVoIPNodeName
       
  2024         && aLUID.Find( KNSmlDMVoIPPrefix ) != KErrNotFound )
       
  2025         {
       
  2026         // Delete profile from RCSE.
       
  2027         iCRCSEProfile->DeleteL( iProfileEntries[iProfileID]->iId );
       
  2028 
       
  2029         // Delete profile also from memory and compress array.
       
  2030         delete iProfileEntries[iProfileID];
       
  2031         iProfileEntries[iProfileID] = NULL;
       
  2032         iProfileEntries.Remove( iProfileID );
       
  2033         iProfileEntries.Compress();
       
  2034         iDmCallback->SetMappingL( aURI, KNullDesC8 ); 
       
  2035         retValue = CSmlDmAdapter::EOk;
       
  2036 
       
  2037         // Fall back to CS preferred when no more VoIP profiles
       
  2038         TInt profileCount = iProfileEntries.Count();
       
  2039         if ( KErrNone == profileCount )
       
  2040             {
       
  2041             SetTelephonyPreferenceL( ECSPreferred );
       
  2042             }
       
  2043         }
       
  2044 
       
  2045     // ==============================
       
  2046     // CodecSettings node ( delete ) 
       
  2047     // ==============================
       
  2048     //
       
  2049     else if ( KNSmlDMVoIPCodecSettingsNode() == secondLastUriSeg  
       
  2050         && KFourSegs == NumOfURISegs( aURI ) 
       
  2051         && aLUID.Find( KNSmlDMVoIPCodecSettingsId ) != KErrNotFound )
       
  2052         {
       
  2053         // Get codec ID used by this setting.
       
  2054         TUint32 codecId = DesToInt( aLUID.Right(10) );
       
  2055         TInt codecPos = FindCodecLocation( codecId );    
       
  2056         if ( KErrNotFound != codecPos )
       
  2057             {
       
  2058             // Delete codec settings from RCSE.
       
  2059             iCRCSEAudioCodec->DeleteL( codecId );
       
  2060             TInt preferredPos = iProfileEntries[iProfileID]->
       
  2061                 iPreferredCodecs.Find( codecId );
       
  2062 
       
  2063             // Remove codec settings ID from profiles iPreferredCodecs.
       
  2064             iProfileEntries[iProfileID]->iPreferredCodecs.Remove(
       
  2065                 preferredPos );
       
  2066             iProfileEntries[iProfileID]->iPreferredCodecs.Compress();
       
  2067 
       
  2068             // Remove codec settings from iCodecEntries and update
       
  2069             // Profile back to RCSE. 
       
  2070             delete iCodecEntries[codecPos];
       
  2071             iCodecEntries[codecPos] = NULL;
       
  2072             iCodecEntries.Remove( codecPos );
       
  2073             iCodecEntries.Compress();
       
  2074             iCRCSEProfile->UpdateL( iProfileEntries[iProfileID]->
       
  2075                 iId, *iProfileEntries[iProfileID] );
       
  2076             retValue = CSmlDmAdapter::EOk;
       
  2077             }
       
  2078         else
       
  2079             {
       
  2080             retValue = CSmlDmAdapter::EError;    
       
  2081             }
       
  2082         }
       
  2083 
       
  2084     // ==============================
       
  2085     // VoIP/x/SettingIds ( delete ) 
       
  2086     // ==============================,
       
  2087     //
       
  2088     else if ( KNSmlDMVoIPSettingIdsNode() == secondLastUriSeg  
       
  2089         && KFourSegs == NumOfURISegs( aURI ) 
       
  2090         && aLUID.Find( KNSmlDMVoIPSettingId ) != KErrNotFound )
       
  2091         {
       
  2092         iProfileEntries[iProfileID]->iIds.Remove( 
       
  2093             DesToInt( aLUID.Right( 10 ) ) );
       
  2094         iProfileEntries[iProfileID]->iIds.Compress();
       
  2095         iCRCSEProfile->UpdateL( iProfileEntries[iProfileID]->
       
  2096             iId, *iProfileEntries[iProfileID] );
       
  2097         retValue = CSmlDmAdapter::EOk;
       
  2098         }
       
  2099 
       
  2100     // ==============================
       
  2101     // VoIP/x/CodecSettings/x/ModeSet Node ( delete ) 
       
  2102     // ==============================
       
  2103     //
       
  2104     else if ( KNSmlDMVoIPModeSetNode() == secondLastUriSeg 
       
  2105         && KSixSegs == NumOfURISegs( aURI )  
       
  2106         && aLUID.Find( KNSmlDMVoIPModeId ) != KErrNotFound )
       
  2107         {
       
  2108         // get codecid used by this setting
       
  2109         TUint32 codecId = DesToInt( RemoveLastURISeg( aLUID ).Right( 10 ) );
       
  2110         TInt codecPos = FindCodecLocation( codecId );
       
  2111         if ( KErrNotFound != codecPos )
       
  2112             {
       
  2113             // remove modeset from iCodecEntries    
       
  2114             iCodecEntries[codecPos]->
       
  2115                 iModeSet.Remove( DesToInt( aLUID.Right( 10 ) ) );
       
  2116             iCodecEntries[codecPos]->
       
  2117                 iModeSet.Compress();
       
  2118 
       
  2119             // update changes also to rcse    
       
  2120             iCRCSEAudioCodec->UpdateL( codecId, *iCodecEntries[codecPos] );
       
  2121             iDmCallback->SetMappingL( aURI, KNullDesC8 );     
       
  2122             retValue = CSmlDmAdapter::EOk;
       
  2123             }
       
  2124         else
       
  2125             {
       
  2126             retValue = CSmlDmAdapter::EError;   
       
  2127             }
       
  2128         }
       
  2129     else
       
  2130         {
       
  2131         retValue = CSmlDmAdapter::EInvalidObject;
       
  2132         }
       
  2133     iDmCallback->SetStatusL( aStatusRef, retValue ); 
       
  2134     DBG_PRINT("CNSmlDmVoIPAdapter::DeleteObjectL( ): end");
       
  2135     }
       
  2136 
       
  2137 // ---------------------------------------------------------------------------
       
  2138 // CNSmlDmVoIPAdapter::FetchLeafObjectL
       
  2139 // Fetches the values of leaf objects.
       
  2140 // ---------------------------------------------------------------------------
       
  2141 //
       
  2142 void CNSmlDmVoIPAdapter::FetchLeafObjectL( 
       
  2143     const TDesC8& aURI, 
       
  2144     const TDesC8& aLUID, 
       
  2145     const TDesC8& aType, 
       
  2146     const TInt aResultsRef, 
       
  2147     const TInt aStatusRef )
       
  2148     {
       
  2149     DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectL(): begin");
       
  2150 
       
  2151     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  2152 
       
  2153     // Load VoIP profile information if not loaded yet
       
  2154     if ( !iProfileEntries.Count() )
       
  2155         {
       
  2156         LoadProfilesL();
       
  2157         }  
       
  2158 
       
  2159     CBufBase *result = CBufFlat::NewL( KDefaultResultSize );
       
  2160     CleanupStack::PushL( result );
       
  2161     CSmlDmAdapter::TError status = FetchObjectL( aURI, aLUID, *result );
       
  2162 
       
  2163     if ( CSmlDmAdapter::EOk == status )
       
  2164         {
       
  2165         iDmCallback->SetResultsL( aResultsRef, *result, aType );
       
  2166         }
       
  2167     iDmCallback->SetStatusL( aStatusRef, status );
       
  2168 
       
  2169     CleanupStack::PopAndDestroy( result ); //result
       
  2170     result = NULL;
       
  2171     DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectL(): end");
       
  2172     }
       
  2173 
       
  2174 // ---------------------------------------------------------------------------
       
  2175 // CNSmlDmVoIPAdapter::FetchObjectL()
       
  2176 // Fetches the values of leaf objects.
       
  2177 // ---------------------------------------------------------------------------
       
  2178 //
       
  2179 CSmlDmAdapter::TError CNSmlDmVoIPAdapter::FetchObjectL( 
       
  2180     const TDesC8& aURI, const TDesC8& aLUID,
       
  2181     CBufBase& result )
       
  2182     {
       
  2183     DBG_PRINT("CNSmlDmVoIPAdapter::FetchObjectL(): start");
       
  2184     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  2185     typedef CRCSEProfileEntry Entry;
       
  2186 
       
  2187     // Check that LUID mapping exists.
       
  2188     if ( !aLUID.Length() > 0 )
       
  2189         {
       
  2190         DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectL(internal)()():ENotFound end");
       
  2191         return CSmlDmAdapter::ENotFound;
       
  2192         }
       
  2193 
       
  2194     TBuf8<KNSmlVoIPMaxResultLength> segmentResult;
       
  2195     TPtrC8 uriSeg = LastURISeg( aURI );
       
  2196 
       
  2197     TPtrC8 uriTmp = RemoveLastURISeg( aURI );
       
  2198     TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
       
  2199 
       
  2200     // Find profile and get its settings.
       
  2201     iProfileID = FindProfileLocation( aLUID );
       
  2202 
       
  2203     // If profile is not found return error.
       
  2204     if ( KErrNotFound == iProfileID )
       
  2205         {
       
  2206         DBG_PRINT( "CNSmlDmVoIPAdapter::FetchObjectL(): ENotFound end" );
       
  2207         return CSmlDmAdapter::ENotFound;
       
  2208         }
       
  2209 
       
  2210     // Set SPS ready for getting values.
       
  2211     CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1
       
  2212     TUint32 serviceId = iProfileEntries[iProfileID]->iServiceProviderId;
       
  2213 
       
  2214     //VoIP/x/VoIPId
       
  2215     if ( KNSmlDMVoIPSetID() == uriSeg )
       
  2216         {
       
  2217         segmentResult.AppendNumFixedWidthUC( 
       
  2218             iProfileEntries[iProfileID]->iId, EDecimal, 10 );
       
  2219         }
       
  2220     //VoIP/x/ProviderName
       
  2221     else if ( KNSmlDMVoIPProvID() == uriSeg )
       
  2222         {
       
  2223         segmentResult.Copy( iProfileEntries[iProfileID]->
       
  2224             iProviderName );
       
  2225         }
       
  2226     //VoIP/x/SettingsName
       
  2227     else if ( KNSmlDMVoIPName() == uriSeg )
       
  2228         {
       
  2229         segmentResult.Copy( iProfileEntries[iProfileID]->
       
  2230             iSettingsName );
       
  2231         }
       
  2232     //VoIP/x/SMPort
       
  2233     else if ( KNSmlDMVoIPSMPort() == uriSeg )
       
  2234         {
       
  2235         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2236             iStartMediaPort );
       
  2237         }
       
  2238     //VoIP/x/EMPort
       
  2239     else if ( KNSmlDMVoIPEMPort() == uriSeg )
       
  2240         {
       
  2241         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2242             iEndMediaPort );
       
  2243         }
       
  2244     //VoIP/x/MediaQos
       
  2245     else if ( KNSmlDMVoIPMediaQos() == uriSeg )
       
  2246         {
       
  2247         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2248             iMediaQOS );
       
  2249         }
       
  2250     //VoIP/x/DTMFIB
       
  2251     else if ( KNSmlDMVoIPDTMFIB() == uriSeg )
       
  2252         {
       
  2253         if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
       
  2254             iInbandDTMF )
       
  2255             {
       
  2256             segmentResult.Copy( KNSmlDMVoIPValueNotSet );
       
  2257             }
       
  2258         if ( Entry::EOn == iProfileEntries[iProfileID]->iInbandDTMF )
       
  2259             {
       
  2260             segmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2261             }
       
  2262         if ( Entry::EOff == iProfileEntries[iProfileID]->iInbandDTMF )
       
  2263             {
       
  2264             segmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2265             }
       
  2266         }
       
  2267     //VoIP/x/DTMFOB
       
  2268     else if ( KNSmlDMVoIPDTMFOB() == uriSeg )
       
  2269         {
       
  2270         if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
       
  2271             iOutbandDTMF )
       
  2272             {
       
  2273             segmentResult.Copy( KNSmlDMVoIPValueNotSet );
       
  2274             }
       
  2275         if ( Entry::EOff == iProfileEntries[iProfileID]->iOutbandDTMF )
       
  2276             {
       
  2277             segmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2278             }
       
  2279         if ( Entry::EOn == iProfileEntries[iProfileID]->iOutbandDTMF )
       
  2280             {
       
  2281             segmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2282             }
       
  2283         }
       
  2284     // VoIP/x/SecureCallPref
       
  2285     else if ( KNSmlDMVoIPSecureCallPref() == uriSeg )
       
  2286         {
       
  2287         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2288             iSecureCallPreference );
       
  2289         }
       
  2290     // VoIP/x/RTCP
       
  2291     else if ( KNSmlDMVoIPRTCP() == uriSeg )
       
  2292         {
       
  2293         segmentResult.Num( iProfileEntries[iProfileID]->iRTCP );
       
  2294         }
       
  2295    // VoIP/x/UAHTerminalType
       
  2296     else if ( KNSmlDMVoIPUAHTerminalType() == uriSeg )
       
  2297         {
       
  2298         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2299             iSIPVoIPUAHTerminalType );
       
  2300         }
       
  2301     // VoIP/x/UAHWLANMAC
       
  2302     else if ( KNSmlDMVoIPUAHWLANMAC() == uriSeg )
       
  2303         {
       
  2304         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2305             iSIPVoIPUAHeaderWLANMAC );
       
  2306         }
       
  2307     // VoIP/x/UAHString
       
  2308     else if ( KNSmlDMVoIPUAHString() == uriSeg )
       
  2309         {
       
  2310         segmentResult.Copy( iProfileEntries[iProfileID]->
       
  2311             iSIPVoIPUAHeaderString );
       
  2312         }
       
  2313     // VoIP/x/ProfileLockedToIAP
       
  2314     else if ( KNSmlDMVoIPProfileLockedToIAP() == uriSeg )
       
  2315         {
       
  2316         if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
       
  2317             iProfileLockedToIAP )
       
  2318             {
       
  2319             segmentResult.Copy( KNSmlDMVoIPValueNotSet );
       
  2320             }
       
  2321         if ( Entry::EOn == iProfileEntries[iProfileID]->
       
  2322             iProfileLockedToIAP )
       
  2323             {
       
  2324             segmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2325             }
       
  2326         if ( Entry::EOff == iProfileEntries[iProfileID]->
       
  2327             iProfileLockedToIAP )
       
  2328             {
       
  2329             segmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2330             }
       
  2331         }
       
  2332     // VoIP/x/VoIPPluginUID
       
  2333     else if ( KNSmlDMVoIPPluginUID() == uriSeg )
       
  2334         {
       
  2335         segmentResult.Num( iProfileEntries[iProfileID]->iVoIPPluginUID );
       
  2336         }
       
  2337     // VoIP/x/AllowVoIPOverWCDMA
       
  2338     else if ( KNSmlDMVoIPAllowVoIPOverWCDMA() == uriSeg )
       
  2339         {
       
  2340         TInt sipProfileId(0);
       
  2341         TUint32 bearerFilttering(0);
       
  2342         
       
  2343         for ( TInt index = 0; index < iProfileEntries[iProfileID]->
       
  2344                 iIds.Count(); index++ )
       
  2345             {
       
  2346             if ( iProfileEntries[iProfileID]->iIds[index].iProfileType == 0 )
       
  2347                 {
       
  2348                 sipProfileId = iProfileEntries[iProfileID]->
       
  2349                     iIds[index].iProfileId;
       
  2350                 break;
       
  2351                 }
       
  2352             }
       
  2353         
       
  2354         CSIPProfile* sipProf = NULL;
       
  2355         CSIPProfileRegistryObserver* sipRegObs =
       
  2356             CSIPProfileRegistryObserver::NewLC(); // CS:1
       
  2357         CSIPManagedProfileRegistry* sipProfReg = 
       
  2358             CSIPManagedProfileRegistry::NewLC( *sipRegObs ); // CS:2
       
  2359         TRAPD( err, ( sipProf = sipProfReg->ProfileL( sipProfileId ) ) );
       
  2360         
       
  2361         if ( KErrNone == err )
       
  2362             {
       
  2363             User::LeaveIfError( sipProf->GetParameter( 
       
  2364                 KBearerType, bearerFilttering ) );
       
  2365             }
       
  2366         
       
  2367         CleanupStack::PopAndDestroy( sipProfReg ); // CS:1
       
  2368         CleanupStack::PopAndDestroy( sipRegObs ); // CS:0
       
  2369         
       
  2370         if ( bearerFilttering == KBearerWlanOnly )
       
  2371             {
       
  2372             segmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2373             }
       
  2374         
       
  2375         else if ( bearerFilttering == KBearerNotSpecified )
       
  2376             {
       
  2377             segmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2378             }
       
  2379         }
       
  2380     // VoIP/x/VoIPDigits
       
  2381     else if ( KNSmlDMVoIPVoIPDigits() == uriSeg )
       
  2382         {
       
  2383         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2384             iMeanCountOfVoIPDigits );
       
  2385         }
       
  2386     // VoIP/x/URIDomainIgnoreRule
       
  2387     else if ( KNSmlDMVoIPURIDomainIgnoreRule() == uriSeg )
       
  2388         {
       
  2389         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2390             iIgnoreAddrDomainPart );
       
  2391         }
       
  2392     // VoIP/x/AutoAcceptBuddyRequest
       
  2393     else if ( KNSmlDMVoIPAutoAcceptBuddyRequest() == uriSeg )
       
  2394         {
       
  2395         CSPProperty* autoAcceptBuddy = CSPProperty::NewLC();
       
  2396         TInt err = spSettings->FindPropertyL( serviceId, 
       
  2397             ESubPropertyPresenceRequestPreference, *autoAcceptBuddy );
       
  2398         if ( KErrNone != err )
       
  2399             {
       
  2400             retValue = CSmlDmAdapter::EError;
       
  2401             }
       
  2402         else
       
  2403             {
       
  2404             TInt autoAccept;
       
  2405             err = autoAcceptBuddy->GetValue( autoAccept );
       
  2406             if ( KErrNone == err )
       
  2407                 {
       
  2408                 segmentResult.Num( autoAccept );
       
  2409                 }
       
  2410             else
       
  2411                 {
       
  2412                 retValue = CSmlDmAdapter::EError;
       
  2413                 }
       
  2414             }
       
  2415         CleanupStack::PopAndDestroy( autoAcceptBuddy );
       
  2416         }
       
  2417     // VoIP/x/UsedVoIPRelease
       
  2418     else if ( KNSmlDMVoIPUsedVoIPRelease() == uriSeg )
       
  2419         {
       
  2420         TBuf16<KMaxUriLength> voipRelease( KNullDesC16 );
       
  2421         voipRelease.Copy( spSettings->GetSIPVoIPSWVersion() );
       
  2422         if ( !voipRelease.Length() )
       
  2423             {
       
  2424             retValue = CSmlDmAdapter::EError;
       
  2425             }
       
  2426         else
       
  2427             {
       
  2428             segmentResult.Copy( voipRelease );
       
  2429             }
       
  2430         }
       
  2431     // VoIP/x/AddUserPhone
       
  2432     else if ( KNSmlDMVoIPAddUserPhone() == uriSeg )
       
  2433         {
       
  2434         if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
       
  2435             iUserPhoneUriParameter )
       
  2436             {
       
  2437             segmentResult.Copy( KNSmlDMVoIPValueNotSet );
       
  2438             }
       
  2439         else if ( Entry::EOn == iProfileEntries[iProfileID]->
       
  2440             iUserPhoneUriParameter )
       
  2441             {
       
  2442             segmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2443             }
       
  2444         else if ( Entry::EOff == iProfileEntries[iProfileID]->
       
  2445             iUserPhoneUriParameter )
       
  2446             {
       
  2447             segmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2448             }
       
  2449         }
       
  2450     // VoIP/x/ProviderBookmarkURI
       
  2451     else if ( KNSmlDMVoIPProviderBookmarkUri() == uriSeg )
       
  2452         {
       
  2453         CSPProperty* providerBkmark = CSPProperty::NewLC();
       
  2454         TInt err = spSettings->FindPropertyL( serviceId, 
       
  2455             EPropertyServiceBookmarkUri, *providerBkmark );
       
  2456         if ( KErrNone != err )
       
  2457             {
       
  2458             retValue = CSmlDmAdapter::EError;
       
  2459             }
       
  2460         else
       
  2461             {
       
  2462             TBuf16<KNSmlVoIPMaxUriLength> bkmark;
       
  2463             err = providerBkmark->GetValue( bkmark );
       
  2464             if ( KErrNone == err )
       
  2465                 {
       
  2466                 segmentResult.Copy( bkmark );
       
  2467                 }
       
  2468             else
       
  2469                 {
       
  2470                 retValue = CSmlDmAdapter::EError;
       
  2471                 }
       
  2472             }
       
  2473         CleanupStack::PopAndDestroy( providerBkmark );
       
  2474         }
       
  2475     // VoIP/x/SIPConnectivityTestURI
       
  2476     else if ( KNSmlDMVoIPSIPConnTestUri() == uriSeg )
       
  2477         {
       
  2478         segmentResult.Copy( iProfileEntries[iProfileID]->
       
  2479             iSIPConnTestAddress );
       
  2480         }
       
  2481     // VoIP/x/NATFWProfileId
       
  2482     else if ( KNSmlDMVoIPNatFwProfileId() == uriSeg )
       
  2483         {
       
  2484         TBuf16<KMaxUriLength> natfwProfile;
       
  2485         retValue = GetNatFwUriL( natfwProfile, 
       
  2486             iProfileEntries[iProfileID]->iNATSettingsStorageId );
       
  2487         if ( CSmlDmAdapter::EOk == retValue )
       
  2488             {
       
  2489             segmentResult.Copy( natfwProfile );
       
  2490             }
       
  2491         }
       
  2492     // VoIP/x/MinSessionInterval
       
  2493     else if ( KNSmlDMVoIPMinSessionInterval() == uriSeg )
       
  2494         {
       
  2495         segmentResult.Num( iProfileEntries[iProfileID]->iSIPMinSE );
       
  2496         }
       
  2497     // VoIP/x/SessionExpires
       
  2498     else if ( KNSmlDMVoIPSessionExpires() == uriSeg )
       
  2499         {
       
  2500         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2501             iSIPSessionExpires );
       
  2502         }
       
  2503     // VoIP/x/BradingDataURI
       
  2504     else if ( KNSmlDMVoIPBrandingDataUri() == uriSeg )
       
  2505         {
       
  2506         CSPProperty* brandingUri = CSPProperty::NewLC();
       
  2507         TInt err = spSettings->FindPropertyL( serviceId, 
       
  2508             ESubPropertyVoIPBrandDataUri, *brandingUri );
       
  2509         if ( KErrNone != err )
       
  2510             {
       
  2511             retValue = CSmlDmAdapter::EError;
       
  2512             }
       
  2513         else
       
  2514             {
       
  2515             TBuf16<KNSmlVoIPMaxUriLength> brandUri;
       
  2516             err = brandingUri->GetValue( brandUri );
       
  2517             if ( KErrNone == err )
       
  2518                 {
       
  2519                 segmentResult.Copy( brandUri );
       
  2520                 }
       
  2521             else
       
  2522                 {
       
  2523                 retValue = CSmlDmAdapter::EError;
       
  2524                 }
       
  2525             }
       
  2526         CleanupStack::PopAndDestroy( brandingUri );
       
  2527         }
       
  2528     // VoIP/x/PresenceSettingsId
       
  2529     else if ( KNSmlDMVoIPPresenceSettingsId() == uriSeg )
       
  2530         {
       
  2531         CSPProperty* presenceId = CSPProperty::NewLC();
       
  2532         TInt err = spSettings->FindPropertyL( serviceId, 
       
  2533             ESubPropertyPresenceSettingsId, *presenceId );
       
  2534         if ( KErrNone != err )
       
  2535             {
       
  2536             retValue = CSmlDmAdapter::EError;
       
  2537             }
       
  2538         else
       
  2539             {
       
  2540             TInt presId;
       
  2541             err = presenceId->GetValue( presId );
       
  2542             if ( KErrNone == err )
       
  2543                 {
       
  2544                 TBuf16<KMaxUriLength> presenceUri;
       
  2545                 retValue = GetPresenceUriL( presenceUri, (TUint32)presId );
       
  2546                 if ( EOk == retValue )
       
  2547                     {
       
  2548                     segmentResult.Copy( presenceUri );
       
  2549                     }
       
  2550                 }
       
  2551             else
       
  2552                 {
       
  2553                 retValue = CSmlDmAdapter::EError;
       
  2554                 }
       
  2555             }
       
  2556         CleanupStack::PopAndDestroy( presenceId );
       
  2557         }
       
  2558     // VoIP/x/UsedNATProtocol
       
  2559     else if ( KNSmlDMVoIPUsedNatProtocol() == uriSeg )
       
  2560         {
       
  2561         segmentResult.Num( iProfileEntries[iProfileID]->iNATProtocol );
       
  2562         }
       
  2563     // VoIP/x/AutoEnable
       
  2564     else if ( KNSmlDMVoIPAutoEnable() == uriSeg )
       
  2565         {
       
  2566         CSPProperty* autoEnableService = CSPProperty::NewLC();
       
  2567         TInt err = spSettings->FindPropertyL( serviceId, 
       
  2568             ESubPropertyVoIPEnabled, *autoEnableService );
       
  2569         if ( KErrNone != err )
       
  2570             {
       
  2571             retValue = CSmlDmAdapter::EError;
       
  2572             }
       
  2573         else
       
  2574             {
       
  2575             TInt autoEnable;
       
  2576             err = autoEnableService->GetValue( autoEnable );
       
  2577             if ( KErrNone == err )
       
  2578                 {
       
  2579                 segmentResult.Num( autoEnable );
       
  2580                 }
       
  2581             else
       
  2582                 {
       
  2583                 retValue = CSmlDmAdapter::EError;
       
  2584                 }
       
  2585             }
       
  2586         CleanupStack::PopAndDestroy( autoEnableService );
       
  2587         }
       
  2588     // VoIP/x/SnapProfileId
       
  2589     else if ( KNSmlDMVoIPSnapProfileId() == uriSeg )
       
  2590         {
       
  2591         CSPProperty* snapProfileId = CSPProperty::NewLC();
       
  2592         TInt err = spSettings->FindPropertyL( serviceId, 
       
  2593             ESubPropertyVoIPPreferredSNAPId, *snapProfileId );
       
  2594         if ( KErrNone != err )
       
  2595             {
       
  2596             retValue = CSmlDmAdapter::EError;
       
  2597             }
       
  2598         else
       
  2599             {
       
  2600             TInt snapId;
       
  2601             err = snapProfileId->GetValue( snapId );
       
  2602             if ( KErrNone == err )
       
  2603                 {
       
  2604                 TBuf8<KMaxUriLength> snapUri;
       
  2605                 retValue = GetSnapUriL( snapUri, (TUint32)snapId );
       
  2606                 if ( EOk == retValue )
       
  2607                     {
       
  2608                     segmentResult.Copy( snapUri );
       
  2609                     }
       
  2610                 }
       
  2611             else
       
  2612                 {
       
  2613                 retValue = CSmlDmAdapter::EError;
       
  2614                 }
       
  2615             }
       
  2616         CleanupStack::PopAndDestroy( snapProfileId );
       
  2617         }
       
  2618     // VoIP/x/EnableIM
       
  2619     else if ( KNSmlDMVoIPEnableIm() == uriSeg )
       
  2620         {
       
  2621         CSPProperty* enableIm = CSPProperty::NewLC();
       
  2622         TInt err = spSettings->FindPropertyL( serviceId, 
       
  2623             ESubPropertyIMEnabled, *enableIm );
       
  2624         if ( KErrNotFound == err )
       
  2625             {
       
  2626             segmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2627             }
       
  2628         else if ( KErrNone != err )
       
  2629             {
       
  2630             retValue = CSmlDmAdapter::EError;
       
  2631             }
       
  2632         else
       
  2633             {
       
  2634             TInt enableValue;
       
  2635             err = enableIm->GetValue( enableValue );
       
  2636             if ( KErrNone == err && 0 < enableValue )
       
  2637                 {
       
  2638                 segmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2639                 }
       
  2640             else if ( KErrNone == err && !enableValue )
       
  2641                 {
       
  2642                 segmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2643                 }
       
  2644             else
       
  2645                 {
       
  2646                 retValue = CSmlDmAdapter::EError;
       
  2647                 }
       
  2648             }
       
  2649         CleanupStack::PopAndDestroy( enableIm );
       
  2650         }
       
  2651 
       
  2652     // ==============================
       
  2653     // CodecSettings node ( fetch )
       
  2654     // ==============================
       
  2655     //
       
  2656     // VoIP/x/PreferredCodecs node
       
  2657     if ( KNSmlDMVoIPPreferredCodecId() == uriSeg.Left(
       
  2658         KNSmlDMVoIPPreferredCodecId().Length() ) ) 
       
  2659         {
       
  2660         TInt preferredPos = DesToInt( LastURISeg( aLUID ).Right( 10 ) );
       
  2661         segmentResult.Num( iProfileEntries[iProfileID]->
       
  2662             iPreferredCodecs[preferredPos]);
       
  2663         }
       
  2664 
       
  2665     // VoIP/x/CodecSettings node    
       
  2666     if ( KNSmlDMVoIPCodecSettingsId() == LastURISeg( aLUID ).
       
  2667         Left( KNSmlDMVoIPCodecSettingsId().Length() )
       
  2668         && KFiveSegs == NumOfURISegs( aURI ) )
       
  2669         {
       
  2670         retValue = FetchCodecObject( aLUID, uriSeg, segmentResult );
       
  2671         }
       
  2672 
       
  2673     // ==============================
       
  2674     // SettingIds node ( fetch )
       
  2675     // ==============================
       
  2676     //
       
  2677     if ( KNSmlDMVoIPSettingId() == LastURISeg( aLUID ).
       
  2678         Left( KNSmlDMVoIPSettingId().Length() ) 
       
  2679         && KFiveSegs == NumOfURISegs( aURI ) )
       
  2680         {
       
  2681 
       
  2682         //ProfileType
       
  2683         if ( KNSmlDMVoIPProfileType() == uriSeg )
       
  2684             {
       
  2685             if ( 0 == iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  2686                 LastURISeg( aLUID ).Right( 10 ))].iProfileType )
       
  2687                 {
       
  2688                 segmentResult.Copy( KNSmlDMVoIPProfileTypeSIP );
       
  2689                 }
       
  2690             if ( 1 == iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  2691                 LastURISeg( aLUID ).Right( 10 ))].iProfileType )
       
  2692                 {
       
  2693                 segmentResult.Copy( KNSmlDMVoIPProfileTypeSCCP );
       
  2694                 }
       
  2695             }
       
  2696 
       
  2697         // ProfileId
       
  2698         if ( KNSmlDMVoIPProfileId() == uriSeg )
       
  2699             {
       
  2700             if ( 0 == iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  2701                 LastURISeg( aLUID ).Right( 10 ))].iProfileType )
       
  2702                 {
       
  2703                 retValue = GetSipIdL( result, iProfileEntries[iProfileID]->
       
  2704                     iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
       
  2705                     iProfileId );
       
  2706                 }
       
  2707             if ( 1 == iProfileEntries[iProfileID]->iIds[DesToInt( 
       
  2708                 LastURISeg( aLUID ).Right( 10 ))].iProfileType )
       
  2709                 {
       
  2710                 // Get SCCP ID from sccp adapter if exists
       
  2711                 retValue = GetSccpIdL( result, iProfileEntries[iProfileID]->
       
  2712                     iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
       
  2713                     iProfileId );
       
  2714                 }
       
  2715             }
       
  2716 
       
  2717         // ProfileSpecificId
       
  2718         if ( KNSmlDMVoIPProfileSpecificId() == uriSeg )
       
  2719             {
       
  2720             segmentResult.Num( iProfileEntries[iProfileID]->iIds[
       
  2721                 DesToInt( LastURISeg( aLUID ).Right( 10 ) ) ].
       
  2722                 iProfileSpecificSettingId );
       
  2723             }
       
  2724         }
       
  2725 
       
  2726     // ==============================
       
  2727     // VoiceMailBox node (fetch)
       
  2728     // ==============================
       
  2729     //
       
  2730     if ( KNSmlDMVoIPVmbxNode() == secondLastUriSeg &&
       
  2731         KFourSegs == NumOfURISegs( aURI ) )
       
  2732         {
       
  2733         // VoIP/x/VoiceMailBox/MWI-URI
       
  2734         if ( KNSmlDMVoIPMwiUri() == uriSeg )
       
  2735             {
       
  2736             CSPProperty* mwiUri = CSPProperty::NewLC();
       
  2737             TInt err = spSettings->FindPropertyL( serviceId, 
       
  2738                 ESubPropertyVMBXMWIAddress, *mwiUri );
       
  2739             if ( KErrNone != err )
       
  2740                 {
       
  2741                 retValue = CSmlDmAdapter::EError;
       
  2742                 }
       
  2743             else
       
  2744                 {
       
  2745                 TBuf16<KNSmlVoIPMaxUriLength> mwiAddr;
       
  2746                 err = mwiUri->GetValue( mwiAddr );
       
  2747                 if ( KErrNone == err )
       
  2748                     {
       
  2749                     segmentResult.Copy( mwiAddr );
       
  2750                     }
       
  2751                 else
       
  2752                     {
       
  2753                     retValue = CSmlDmAdapter::EError;
       
  2754                     }
       
  2755                 }
       
  2756             CleanupStack::PopAndDestroy( mwiUri );
       
  2757             }
       
  2758 
       
  2759         // VoIP/x/VoiceMailBox/ListeningURI
       
  2760         if ( KNSmlDMVoIPListeningUri() == uriSeg )
       
  2761             {
       
  2762             CSPProperty* listeningUri = CSPProperty::NewLC();
       
  2763             TInt err = spSettings->FindPropertyL( serviceId, 
       
  2764                 ESubPropertyVMBXListenAddress, *listeningUri );
       
  2765             if ( KErrNone != err )
       
  2766                 {
       
  2767                 retValue = CSmlDmAdapter::EError;
       
  2768                 }
       
  2769             else
       
  2770                 {
       
  2771                 TBuf16<KNSmlVoIPMaxUriLength> listenUri;
       
  2772                 err = listeningUri->GetValue( listenUri );
       
  2773                 if ( KErrNone == err )
       
  2774                     {
       
  2775                     segmentResult.Copy( listenUri );
       
  2776                     }
       
  2777                 else
       
  2778                     {
       
  2779                     retValue = CSmlDmAdapter::EError;
       
  2780                     }
       
  2781                 }
       
  2782             CleanupStack::PopAndDestroy( listeningUri );
       
  2783             }
       
  2784 
       
  2785         // VoIP/x/VoiceMailBox/UsedIAPId
       
  2786         if ( KNSmlDMVoIPUsedIAPId() == uriSeg )
       
  2787             {
       
  2788             CSPProperty* iapId = CSPProperty::NewLC();
       
  2789             TInt err = spSettings->FindPropertyL( serviceId, 
       
  2790                 ESubPropertyVMBXPreferredIAPId, *iapId );
       
  2791             if ( KErrNone != err )
       
  2792                 {
       
  2793                 retValue = CSmlDmAdapter::EError;
       
  2794                 }
       
  2795             else
       
  2796                 {
       
  2797                 TInt iap;
       
  2798                 err = iapId->GetValue( iap );
       
  2799                 if ( KErrNone == err )
       
  2800                     {
       
  2801                     retValue = GetConRefL( result, iap );
       
  2802                     if ( CSmlDmAdapter::EOk != retValue )
       
  2803                         {
       
  2804                         result.Reset();
       
  2805                         }
       
  2806                     }
       
  2807                 else
       
  2808                     {
       
  2809                     retValue = CSmlDmAdapter::EError;
       
  2810                     }
       
  2811                 
       
  2812                 }
       
  2813             CleanupStack::PopAndDestroy( iapId );
       
  2814             }
       
  2815 
       
  2816         // VoIP/x/VoiceMailBox/ReSubscribeInterval
       
  2817         if ( KNSmlDMVoIPReSubscribeInterval() == uriSeg )
       
  2818             {
       
  2819             CSPProperty* reSubscrInterval = CSPProperty::NewLC();
       
  2820             TInt err = spSettings->FindPropertyL( serviceId, 
       
  2821                 ESubPropertyVMBXMWISubscribeInterval, *reSubscrInterval );
       
  2822             if ( KErrNone != err )
       
  2823                 {
       
  2824                 retValue = CSmlDmAdapter::EError;
       
  2825                 }
       
  2826             else
       
  2827                 {
       
  2828                 TInt reSubscribe;
       
  2829                 err = reSubscrInterval->GetValue( reSubscribe );
       
  2830                 if ( KErrNone == err )
       
  2831                     {
       
  2832                     segmentResult.Num( reSubscribe );
       
  2833                     }
       
  2834                 else
       
  2835                     {
       
  2836                     retValue = CSmlDmAdapter::EError;
       
  2837                     }
       
  2838                 }
       
  2839             CleanupStack::PopAndDestroy( reSubscrInterval );
       
  2840             }
       
  2841 
       
  2842         // VoIP/x/VoiceMailBox/UsedSIPProfileId
       
  2843         if ( KNSmlDMVoIPUsedSIPProfileId() == uriSeg )
       
  2844             {
       
  2845             CSPProperty* sipProfileId = CSPProperty::NewLC();
       
  2846             TInt err = spSettings->FindPropertyL( serviceId, 
       
  2847                 ESubPropertyVMBXSettingsId, *sipProfileId );
       
  2848             if ( KErrNone != err )
       
  2849                 {
       
  2850                 retValue = CSmlDmAdapter::EError;
       
  2851                 }
       
  2852             else
       
  2853                 {
       
  2854                 TInt sipId;
       
  2855                 err = sipProfileId->GetValue( sipId );
       
  2856                 if ( KErrNone == err )
       
  2857                     {
       
  2858                     retValue = GetSipIdL( result, sipId );
       
  2859                     if ( CSmlDmAdapter::EOk != retValue )
       
  2860                         {
       
  2861                         result.Reset();
       
  2862                         }
       
  2863                     }
       
  2864                 else
       
  2865                     {
       
  2866                     retValue = CSmlDmAdapter::EError;
       
  2867                     }
       
  2868                 }
       
  2869             CleanupStack::PopAndDestroy( sipProfileId );
       
  2870             }
       
  2871         }
       
  2872 
       
  2873     result.InsertL( result.Size(), segmentResult );       
       
  2874     CleanupStack::PopAndDestroy( spSettings );
       
  2875 
       
  2876     DBG_PRINT("CNSmlDmVoIPAdapter::FetchObjectL(): end");
       
  2877     return retValue;
       
  2878     }
       
  2879 
       
  2880 // ---------------------------------------------------------------------------
       
  2881 // CNSmlDmVoIPAdapter::FetchCodecObject
       
  2882 // Fetches the values of Codec specific leaf objects.
       
  2883 // ---------------------------------------------------------------------------
       
  2884 //
       
  2885 CSmlDmAdapter::TError CNSmlDmVoIPAdapter::FetchCodecObject( 
       
  2886     const TDesC8& aLUID, const TDesC8& aUriSeg, TDes8& aSegmentResult )
       
  2887     {
       
  2888     DBG_PRINT("CNSmlDmVoIPAdapter::FetchCodecObject(): begin");
       
  2889     
       
  2890     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  2891 
       
  2892     TUint32 codecId = DesToInt( aLUID.Right( 10 ) );
       
  2893     TInt codecPos = FindCodecLocation( codecId );
       
  2894     if ( KErrNotFound != codecPos )
       
  2895         {
       
  2896         //CodecId
       
  2897         if ( KNSmlDMVoIPCodecId() == aUriSeg ) 
       
  2898             {
       
  2899             aSegmentResult.Num ( iCodecEntries[codecPos]->iCodecId );
       
  2900             }
       
  2901         //MediaTypeName
       
  2902         if ( KNSmlDMVoIPMediaTypeName() == aUriSeg ) 
       
  2903             {
       
  2904             aSegmentResult.Copy ( iCodecEntries[codecPos]->
       
  2905                 iMediaTypeName );
       
  2906             }
       
  2907         //MediaSubTypeName
       
  2908         if ( KNSmlDMVoIPMediaSubTypeName() == aUriSeg ) 
       
  2909             {
       
  2910             aSegmentResult.Copy ( iCodecEntries[codecPos]->
       
  2911                 iMediaSubTypeName );
       
  2912             }
       
  2913         //JitterBufferSize
       
  2914         if ( KNSmlDMVoIPJitterBufferSize() == aUriSeg ) 
       
  2915             {
       
  2916             if ( KNotSet < iCodecEntries[codecPos]->iJitterBufferSize )
       
  2917                 {
       
  2918                 aSegmentResult.Num ( iCodecEntries[codecPos]->
       
  2919                     iJitterBufferSize );
       
  2920                 }
       
  2921             }
       
  2922         //OctetAlign            
       
  2923         if ( KNSmlDMVoIPOctetAlign() == aUriSeg ) 
       
  2924             {
       
  2925             if ( CRCSEAudioCodecEntry::EOn == 
       
  2926                 iCodecEntries[codecPos]->iOctetAlign )
       
  2927                 {
       
  2928                 aSegmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2929                 }
       
  2930             if ( CRCSEAudioCodecEntry::EOff == 
       
  2931                 iCodecEntries[codecPos]->iOctetAlign )
       
  2932                 {
       
  2933                 aSegmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2934                 }
       
  2935             }
       
  2936         //ModeChangePeriod
       
  2937         if ( KNSmlDMVoIPModeChangePeriod() == aUriSeg ) 
       
  2938             {
       
  2939             if ( KNotSet < iCodecEntries[codecPos]->
       
  2940                 iModeChangePeriod )
       
  2941                 {
       
  2942                 aSegmentResult.Num( iCodecEntries[codecPos]->
       
  2943                     iModeChangePeriod );
       
  2944                 }
       
  2945             }
       
  2946         //ModeChangeNeighbor          
       
  2947         if ( KNSmlDMVoIPModeChangeNeighbor() == aUriSeg ) 
       
  2948             {
       
  2949             if ( CRCSEAudioCodecEntry::EOn == 
       
  2950                 iCodecEntries[codecPos]->iModeChangeNeighbor )
       
  2951                 {
       
  2952                 aSegmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2953                 }
       
  2954             if ( CRCSEAudioCodecEntry::EOff == 
       
  2955                 iCodecEntries[codecPos]->iModeChangeNeighbor )
       
  2956                 {
       
  2957                 aSegmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2958                 }
       
  2959             }
       
  2960         //Ptime
       
  2961         if ( KNSmlDMVoIPPtime() == aUriSeg )  
       
  2962             {
       
  2963             if ( KNotSet < iCodecEntries[codecPos]->iPtime )
       
  2964                 {
       
  2965                 aSegmentResult.Num( iCodecEntries[codecPos]->iPtime );
       
  2966                 }
       
  2967             }
       
  2968         //Maxptime
       
  2969         if ( KNSmlDMVoIPMaxPtime() == aUriSeg ) 
       
  2970             {
       
  2971             if ( KNotSet < iCodecEntries[codecPos]->iMaxptime )
       
  2972                 {
       
  2973                 aSegmentResult.Num( 
       
  2974                     iCodecEntries[codecPos]->iMaxptime );
       
  2975                 }
       
  2976             }
       
  2977         //VAD                
       
  2978         if ( KNSmlDMVoIPVAD() == aUriSeg ) 
       
  2979             {
       
  2980             if ( CRCSEAudioCodecEntry::EOn ==
       
  2981                 iCodecEntries[codecPos]->iVAD )
       
  2982                 {
       
  2983                 aSegmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2984                 }
       
  2985             if ( CRCSEAudioCodecEntry::EOff == 
       
  2986                 iCodecEntries[codecPos]->iVAD )
       
  2987                 {
       
  2988                 aSegmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  2989                 }
       
  2990             }
       
  2991         //AnnexB                
       
  2992         if ( KNSmlDMVoIPAnnexB() == aUriSeg ) 
       
  2993             {
       
  2994             if ( CRCSEAudioCodecEntry::EOn == 
       
  2995                 iCodecEntries[codecPos]->iAnnexb )
       
  2996                 {
       
  2997                 aSegmentResult.Copy( KNSmlDMVoIPValueTrue );
       
  2998                 }
       
  2999             if ( CRCSEAudioCodecEntry::EOff == 
       
  3000                 iCodecEntries[codecPos]->iAnnexb )
       
  3001                 {
       
  3002                 aSegmentResult.Copy( KNSmlDMVoIPValueFalse );
       
  3003                 }
       
  3004             }
       
  3005         // MaxRed
       
  3006         if ( KNSmlDMVoIPMaxRed() == aUriSeg )
       
  3007             {
       
  3008             if ( CRCSEAudioCodecEntry::EOONotSet < 
       
  3009                 iCodecEntries[codecPos]->iMaxRed )                
       
  3010                 {
       
  3011                 aSegmentResult.Num( iCodecEntries[codecPos]->iMaxRed );
       
  3012                 }
       
  3013             }
       
  3014 
       
  3015         // ==============================
       
  3016         // ModeSet node ( fetch )
       
  3017         // ==============================
       
  3018         //
       
  3019         if ( KNSmlDMVoIPMode() == aUriSeg )  
       
  3020             {
       
  3021             aSegmentResult.Num ( iCodecEntries[codecPos]->
       
  3022                 iModeSet[DesToInt( aLUID.Right( 10 ))] );
       
  3023             }
       
  3024         }
       
  3025     else
       
  3026         {
       
  3027         // Codec not found even if LUID exists.
       
  3028         retValue = CSmlDmAdapter::EError;    
       
  3029         }   
       
  3030 
       
  3031     DBG_PRINT("CNSmlDmVoIPAdapter::FetchCodecObject(): begin");
       
  3032 
       
  3033     return retValue;
       
  3034     }
       
  3035 
       
  3036 // ---------------------------------------------------------------------------
       
  3037 // CNSmlDmVoIPAdapter::ChildURIListL
       
  3038 // Inserts the list of children objects of the node to dm-module
       
  3039 // ---------------------------------------------------------------------------
       
  3040 //
       
  3041 void  CNSmlDmVoIPAdapter::ChildURIListL( 
       
  3042     const TDesC8& aURI,
       
  3043     const TDesC8& aLUID, 
       
  3044     const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
  3045     const TInt aResultsRef, 
       
  3046     const TInt aStatusRef )
       
  3047     {
       
  3048     DBG_PRINT( "CNSmlDmVoIPAdapter::ChildURIListL(): start" );
       
  3049 
       
  3050     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  3051 
       
  3052     // Load VoIP profile information if not loaded yet
       
  3053     if ( !iProfileEntries.Count() )
       
  3054         {
       
  3055         LoadProfilesL();
       
  3056         }
       
  3057 
       
  3058     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  3059 
       
  3060     CBufBase *currentURISegmentList = CBufFlat::NewL( 1 );
       
  3061     CleanupStack::PushL( currentURISegmentList );
       
  3062 
       
  3063     // get URI parameters
       
  3064     TBuf8<KNSmlVoIPMaxUriLength> uri( KNullDesC8 );
       
  3065     TBuf8<KNSmlVoIPMaxUriLength> mappingInfo( KNullDesC8 );
       
  3066     TPtrC8 uriTmp = RemoveLastURISeg( aURI );
       
  3067     TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
       
  3068     TBuf8<KSmlMaxURISegLen> segmentName;
       
  3069     TInt howManyObjects = iProfileEntries.Count();
       
  3070 
       
  3071     iProfileID = FindProfileLocation( aLUID );
       
  3072 
       
  3073     // VoIP
       
  3074     if ( KNSmlDMVoIPNodeName() == LastURISeg( aURI ) )   
       
  3075         {
       
  3076         for ( TInt counter = 0; counter < howManyObjects ; counter++ )
       
  3077             {
       
  3078             TBool notInList = ETrue;
       
  3079             TInt currentline = 0;
       
  3080             TUint ddId ( iProfileEntries[counter]->iId );
       
  3081             while ( notInList && currentline < aPreviousURISegmentList.Count() )
       
  3082                 {
       
  3083                 TInt profileLocation = FindProfileLocation(
       
  3084                     aPreviousURISegmentList.At( currentline ).iURISegLUID );
       
  3085                 if ( profileLocation != KErrNotFound )
       
  3086                     {
       
  3087                     TUint32 profileID( 
       
  3088                         iProfileEntries[profileLocation]->iId );   
       
  3089                     if ( profileID == ddId ) 
       
  3090                         {
       
  3091                         notInList = EFalse;
       
  3092                         break;
       
  3093                         }
       
  3094                     }
       
  3095                 currentline++;
       
  3096                 }
       
  3097             if ( notInList )
       
  3098                 {
       
  3099                 // VoIP/x
       
  3100                 segmentName.Copy( KNSmlDMVoIPPrefix );
       
  3101 
       
  3102                 // Add profileID number to identify profile
       
  3103                 segmentName.AppendNumFixedWidthUC( 
       
  3104                     iProfileEntries[counter]->iId, EDecimal, 10 );
       
  3105                 currentURISegmentList->InsertL( currentURISegmentList->
       
  3106                     Size(), segmentName );
       
  3107                 currentURISegmentList->InsertL( currentURISegmentList->
       
  3108                     Size(), KNSmlDMVoIPSeparator );
       
  3109 
       
  3110                 // set luid mapping to dm-module
       
  3111                 mappingInfo.Copy ( KNSmlDMVoIPPrefix );
       
  3112                 TUint val ( iProfileEntries[counter]->iId );
       
  3113                 mappingInfo.AppendNumFixedWidthUC( val, EDecimal, 10 );
       
  3114                 uri.Copy( KNSmlDMVoIPNodeName );
       
  3115                 uri.Append ( KNSmlDMVoIPSeparator );
       
  3116                 uri.Append ( KNSmlDMVoIPPrefix );
       
  3117                 uri.AppendNumFixedWidthUC( val, EDecimal, 10 );
       
  3118                 iDmCallback->SetMappingL( uri, mappingInfo ); 
       
  3119                 }
       
  3120             else
       
  3121                 { // Add those in PreviousList which are on database
       
  3122                 currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3123                     aPreviousURISegmentList.At(currentline).iURISeg );
       
  3124                 currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3125                      KNSmlDMVoIPSeparator );
       
  3126                 }
       
  3127             }
       
  3128         retValue = CSmlDmAdapter::EOk;
       
  3129         iDmCallback->SetStatusL( aStatusRef, retValue );
       
  3130         iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList,
       
  3131             KNullDesC8 );
       
  3132         CleanupStack::PopAndDestroy( currentURISegmentList ); 
       
  3133         currentURISegmentList = NULL;
       
  3134         return;
       
  3135         }
       
  3136 
       
  3137     if ( KErrNotFound == iProfileID )
       
  3138         {
       
  3139         retValue = CSmlDmAdapter::ENotFound;
       
  3140         iDmCallback->SetStatusL( aStatusRef, retValue );
       
  3141         CleanupStack::PopAndDestroy( currentURISegmentList ); 
       
  3142         currentURISegmentList = NULL;
       
  3143         return;
       
  3144         }
       
  3145 
       
  3146     // VoIP/x/PreferredCodecs
       
  3147     if ( KNSmlDMVoIPPreferredCodecsNode() == LastURISeg( aURI ) )   
       
  3148         {
       
  3149         TInt preferredCount = iProfileEntries[iProfileID]->
       
  3150             iPreferredCodecs.Count();
       
  3151         for ( TInt counter = 0; counter < preferredCount ; counter++ )
       
  3152             { 
       
  3153             TBool inList = EFalse;
       
  3154             
       
  3155             // We need to rebuild LUID mapping if someone other has added or
       
  3156             // deleted codecs, because there is no usable link to each codec.
       
  3157             if ( aPreviousURISegmentList.Count() == preferredCount )
       
  3158                 {
       
  3159                 inList = ETrue;    
       
  3160                 }
       
  3161             if ( !inList )
       
  3162                 {
       
  3163                 segmentName.Copy( KNSmlDMVoIPPreferredCodecId );
       
  3164                 segmentName.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  3165                 currentURISegmentList->InsertL( currentURISegmentList->
       
  3166                     Size(), segmentName );
       
  3167                 currentURISegmentList->InsertL( currentURISegmentList->
       
  3168                     Size(), KNSmlDMVoIPSeparator );
       
  3169 
       
  3170                 // Set LUID mapping to dm-module.
       
  3171                 mappingInfo.Copy ( aLUID ); 
       
  3172                 mappingInfo.Append ( KNSmlDMVoIPSeparator );
       
  3173                 mappingInfo.Append ( KNSmlDMVoIPPreferredCodecId );
       
  3174                 mappingInfo.AppendNumFixedWidthUC( counter, EDecimal, 10 );
       
  3175                 uri.Copy( aURI );
       
  3176                 uri.Append ( KNSmlDMVoIPSeparator );
       
  3177                 uri.Append ( KNSmlDMVoIPPreferredCodecId );
       
  3178                 uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  3179                 iDmCallback->SetMappingL( uri, mappingInfo ); 
       
  3180                 }
       
  3181             else
       
  3182                 { // Add those in PreviousList which are on database
       
  3183                 currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3184                     aPreviousURISegmentList.At( counter ).iURISeg );
       
  3185                 currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3186                      KNSmlDMVoIPSeparator );
       
  3187                 }
       
  3188             }
       
  3189         }
       
  3190 
       
  3191     // VoIP/x/PreferredCodecs/x/
       
  3192     else if ( KNSmlDMVoIPPreferredCodecsNode() == secondLastUriSeg
       
  3193         && KFourSegs == NumOfURISegs( aURI ) )
       
  3194         {
       
  3195         segmentName.Copy( KNSmlDMVoIPPreferredCodecId );
       
  3196         currentURISegmentList->InsertL( currentURISegmentList->
       
  3197                 Size(), segmentName );
       
  3198         currentURISegmentList->InsertL( currentURISegmentList->
       
  3199                 Size(), KNSmlDMVoIPSeparator );        
       
  3200         }
       
  3201 
       
  3202     // VoIP/x/
       
  3203     else if ( KNSmlDMVoIPCodecSettingsNode() == LastURISeg( aURI ) )   
       
  3204         {
       
  3205         for ( TInt counter = 0; 
       
  3206             counter < iProfileEntries[iProfileID]->iPreferredCodecs.Count(); 
       
  3207             counter++ ) 
       
  3208             { 
       
  3209             TBool notInList = ETrue;
       
  3210             TInt currentline = 0;
       
  3211             TUint32 ddId = iProfileEntries[iProfileID]->
       
  3212                 iPreferredCodecs[counter];
       
  3213             while ( notInList && currentline < 
       
  3214                 aPreviousURISegmentList.Count() )
       
  3215                 {
       
  3216                 if ( DesToInt( aPreviousURISegmentList.At( currentline ).
       
  3217                     iURISegLUID.Right( 10 ) ) == ddId ) 
       
  3218                     {
       
  3219                     notInList = EFalse;
       
  3220                     break;
       
  3221                     }
       
  3222                 currentline++;
       
  3223                 }
       
  3224             if ( notInList )
       
  3225                 {
       
  3226                 segmentName.Copy( KNSmlDMVoIPCodecSettingsId );
       
  3227                 segmentName.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  3228                 currentURISegmentList->InsertL( currentURISegmentList->
       
  3229                     Size(), segmentName );
       
  3230                 currentURISegmentList->InsertL( currentURISegmentList->
       
  3231                     Size(), KNSmlDMVoIPSeparator );
       
  3232 
       
  3233                 // Set LUID mapping to dm-module.
       
  3234                 mappingInfo.Copy ( aLUID ); 
       
  3235                 mappingInfo.Append ( KNSmlDMVoIPSeparator );
       
  3236                 mappingInfo.Append ( KNSmlDMVoIPCodecSettingsId );
       
  3237                 mappingInfo.AppendNumFixedWidthUC( ddId, EDecimal, 10 );
       
  3238                 uri.Copy( aURI );
       
  3239                 uri.Append ( KNSmlDMVoIPSeparator );
       
  3240                 uri.Append ( KNSmlDMVoIPCodecSettingsId );
       
  3241                 uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  3242                 iDmCallback->SetMappingL( uri, mappingInfo ); 
       
  3243                 }
       
  3244             else
       
  3245                 { // Add those from PreviousList which are on database
       
  3246                 currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3247                     aPreviousURISegmentList.At(currentline).iURISeg );
       
  3248                 currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3249                      KNSmlDMVoIPSeparator );
       
  3250                 }
       
  3251             }
       
  3252         }
       
  3253 
       
  3254     // ==============================
       
  3255     // CodecSettings node
       
  3256     // ==============================
       
  3257     //
       
  3258     else if ( KNSmlDMVoIPCodecSettingsNode() == secondLastUriSeg 
       
  3259         && KFourSegs == NumOfURISegs( aURI ) )
       
  3260         {
       
  3261         CodecChildListL( currentURISegmentList );
       
  3262         }
       
  3263 
       
  3264     // ==============================
       
  3265     // ModeSet node
       
  3266     // ==============================
       
  3267     //
       
  3268     else if ( KNSmlDMVoIPModeSetNode() == LastURISeg( aURI ) )   
       
  3269         {
       
  3270         TUint32 codecId;
       
  3271         codecId = DesToInt( aLUID.Right( 10 ) );
       
  3272         TInt codecPos = FindCodecLocation( codecId );    
       
  3273         if ( KErrNotFound != codecPos )
       
  3274             {
       
  3275             TInt modesetCount = iCodecEntries[codecPos]->iModeSet.Count();
       
  3276             for ( TInt counter = 0; counter < modesetCount; counter++ )
       
  3277                 { 
       
  3278                 TBool inList = EFalse;
       
  3279 
       
  3280                 // We need to rebuild LUID mapping if someone other has added
       
  3281                 // or deleted, because there is no usable link to each ModeSet.
       
  3282                 if ( aPreviousURISegmentList.Count() == modesetCount )
       
  3283                     {
       
  3284                     inList = ETrue;    
       
  3285                     }
       
  3286                 if ( !inList )
       
  3287                     {
       
  3288                     segmentName.Copy( KNSmlDMVoIPModeId );
       
  3289                     segmentName.AppendNumFixedWidthUC( counter + 1, EDecimal,
       
  3290                         3 );
       
  3291                     currentURISegmentList->InsertL( currentURISegmentList->
       
  3292                         Size(), segmentName );
       
  3293                     currentURISegmentList->InsertL( currentURISegmentList->
       
  3294                         Size(), KNSmlDMVoIPSeparator );
       
  3295 
       
  3296                     // Set LUID mapping to DM module.
       
  3297                     mappingInfo.Copy ( aLUID );
       
  3298                     mappingInfo.Append ( KNSmlDMVoIPSeparator );
       
  3299                     mappingInfo.Append ( KNSmlDMVoIPModeId );
       
  3300                     mappingInfo.AppendNumFixedWidthUC( counter, EDecimal, 10 );
       
  3301                     uri.Copy( aURI );
       
  3302                     uri.Append ( KNSmlDMVoIPSeparator );
       
  3303                     uri.Append ( KNSmlDMVoIPModeId );
       
  3304                     uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  3305                     iDmCallback->SetMappingL( uri, mappingInfo ); 
       
  3306                     }
       
  3307                 else
       
  3308                     { // Add those in PreviousList which are on database.
       
  3309                     currentURISegmentList->InsertL( currentURISegmentList->
       
  3310                         Size(), aPreviousURISegmentList.At( counter ).iURISeg );
       
  3311                     currentURISegmentList->InsertL( currentURISegmentList->
       
  3312                         Size(), KNSmlDMVoIPSeparator );
       
  3313                     }
       
  3314                 }
       
  3315             }
       
  3316         else
       
  3317             {
       
  3318             retValue = CSmlDmAdapter::EError;    
       
  3319             }    
       
  3320         
       
  3321         }       
       
  3322 
       
  3323     else if ( KNSmlDMVoIPModeSetNode() == secondLastUriSeg 
       
  3324         && KSixSegs == NumOfURISegs( aURI ) )
       
  3325         {
       
  3326         segmentName.Copy( KNSmlDMVoIPMode );
       
  3327         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3328             segmentName );
       
  3329         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3330             KNSmlDMVoIPSeparator );
       
  3331         }       
       
  3332 
       
  3333     // ==============================
       
  3334     // SettingIds node
       
  3335     // ==============================
       
  3336     //
       
  3337     // VoIP/x/SettingIds
       
  3338     else if ( KNSmlDMVoIPSettingIdsNode() == LastURISeg( aURI ) )    
       
  3339         {
       
  3340         for ( TInt counter = 0; counter < 
       
  3341             iProfileEntries[iProfileID]->iIds.Count(); counter++ )
       
  3342             { 
       
  3343             TBool inList = EFalse;
       
  3344 
       
  3345             // We need to rebuild luid mapping if someone other has made
       
  3346             // some changes because there is no usable link to settingids.
       
  3347             if ( aPreviousURISegmentList.Count() == 
       
  3348                 iProfileEntries[iProfileID]->iIds.Count() )
       
  3349                 {
       
  3350                 inList = ETrue;    
       
  3351                 }
       
  3352             if ( !inList )
       
  3353                 {
       
  3354                 segmentName.Copy( KNSmlDMVoIPSettingId );
       
  3355                 segmentName.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  3356                 currentURISegmentList->InsertL( currentURISegmentList->
       
  3357                     Size(), segmentName );
       
  3358                 currentURISegmentList->InsertL( currentURISegmentList->
       
  3359                     Size(), KNSmlDMVoIPSeparator );
       
  3360 
       
  3361                 // set luid mapping to dm-module
       
  3362                 mappingInfo.Copy ( aLUID );     
       
  3363                 mappingInfo.Append ( KNSmlDMVoIPSeparator );
       
  3364                 mappingInfo.Append ( KNSmlDMVoIPSettingId );
       
  3365                 mappingInfo.AppendNumFixedWidthUC( counter, EDecimal, 10 );
       
  3366                 uri.Copy( aURI );
       
  3367                 uri.Append ( KNSmlDMVoIPSeparator );
       
  3368                 uri.Append ( KNSmlDMVoIPSettingId );
       
  3369                 uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  3370                 iDmCallback->SetMappingL( uri, mappingInfo ); 
       
  3371                 }
       
  3372             else
       
  3373                 { // Add those in PreviousList which are on database
       
  3374                 currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3375                     aPreviousURISegmentList.At( counter ).iURISeg );
       
  3376                 currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3377                      KNSmlDMVoIPSeparator );
       
  3378                 }
       
  3379             }
       
  3380         }  
       
  3381 
       
  3382     // ==============================
       
  3383     // SettingId leaf
       
  3384     // ==============================
       
  3385     //
       
  3386     else if ( KNSmlDMVoIPSettingIdsNode() == secondLastUriSeg
       
  3387         && KFourSegs == NumOfURISegs( aURI ) )
       
  3388         {
       
  3389         // ProfileType
       
  3390         segmentName.Copy( KNSmlDMVoIPProfileType );
       
  3391         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3392             segmentName );
       
  3393         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3394             KNSmlDMVoIPSeparator );
       
  3395 
       
  3396         // ProfileId
       
  3397         segmentName.Copy( KNSmlDMVoIPProfileId );
       
  3398         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3399             segmentName );
       
  3400         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3401             KNSmlDMVoIPSeparator );
       
  3402 
       
  3403         // ProfileSpecific
       
  3404         segmentName.Copy( KNSmlDMVoIPProfileSpecificId );
       
  3405         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3406             segmentName );
       
  3407         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3408             KNSmlDMVoIPSeparator );
       
  3409         }  
       
  3410 
       
  3411     // ==============================
       
  3412     // VoIP/x/VoiceMailBox node
       
  3413     // ==============================
       
  3414     //
       
  3415     else if ( KNSmlDMVoIPVmbxNode() == LastURISeg( aURI ) && 
       
  3416         KThreeSegs == NumOfURISegs( aURI ) )
       
  3417         {
       
  3418         // VoIP/x/VoiceMailBox/MWI-URI
       
  3419         segmentName.Copy( KNSmlDMVoIPMwiUri );
       
  3420         currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3421             segmentName );
       
  3422         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3423             KNSmlDMVoIPSeparator );
       
  3424         // VoIP/x/VoiceMailBox/ListeningURI
       
  3425         segmentName.Copy( KNSmlDMVoIPListeningUri );
       
  3426         currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3427             segmentName );
       
  3428         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3429             KNSmlDMVoIPSeparator );
       
  3430         // VoIP/x/VoiceMailBox/UsedIAPId
       
  3431         segmentName.Copy( KNSmlDMVoIPUsedIAPId );
       
  3432         currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3433             segmentName );
       
  3434         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3435             KNSmlDMVoIPSeparator );
       
  3436         // VoIP/x/VoiceMailBox/ReSubscribeInterval
       
  3437         segmentName.Copy( KNSmlDMVoIPReSubscribeInterval );
       
  3438         currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3439             segmentName );
       
  3440         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3441             KNSmlDMVoIPSeparator );
       
  3442         // VoIP/x/VoiceMailBox/UsedSIPProfileId
       
  3443         segmentName.Copy( KNSmlDMVoIPUsedSIPProfileId );
       
  3444         currentURISegmentList->InsertL( currentURISegmentList->Size(),
       
  3445             segmentName );
       
  3446         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
  3447             KNSmlDMVoIPSeparator );
       
  3448         }
       
  3449 
       
  3450     // ==============================
       
  3451     // VoIP/x/ node
       
  3452     // ==============================
       
  3453     //
       
  3454     else if ( KNSmlDMVoIPNodeName() == secondLastUriSeg 
       
  3455         && KTwoSegs == NumOfURISegs( aURI ) )
       
  3456         {
       
  3457         VoipChildListL( currentURISegmentList );
       
  3458         }
       
  3459     else 
       
  3460         {
       
  3461         // if none of asked nodes found return error.
       
  3462         retValue = CSmlDmAdapter::ENotFound;
       
  3463         }
       
  3464     iDmCallback->SetStatusL( aStatusRef, retValue );
       
  3465     if ( CSmlDmAdapter::EOk == retValue )
       
  3466         {
       
  3467         iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, 
       
  3468             KNullDesC8 );
       
  3469         }
       
  3470     CleanupStack::PopAndDestroy( currentURISegmentList ); 
       
  3471     currentURISegmentList = NULL;
       
  3472     DBG_PRINT("CNSmlDmVoIPAdapter::ChildURIListL(): end");
       
  3473     }
       
  3474 
       
  3475 // ---------------------------------------------------------------------------
       
  3476 // CNSmlDmVoIPAdapter::CodecChildListL
       
  3477 // Inserts Codec specific leaf objects.
       
  3478 // ---------------------------------------------------------------------------
       
  3479 //
       
  3480 void CNSmlDmVoIPAdapter::CodecChildListL(
       
  3481     CBufBase* const aCurrentURISegmentList )
       
  3482     {
       
  3483     DBG_PRINT("CNSmlDmVoIPAdapter::CodecChildListL(): start");
       
  3484 
       
  3485     TBuf8<KSmlMaxURISegLen> segmentName;
       
  3486 
       
  3487     // VoIP/x/CodecSettings/CodecSettingsIdXXX/VoIPCodecId
       
  3488     segmentName.Copy( KNSmlDMVoIPCodecId );
       
  3489     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3490         segmentName );
       
  3491     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3492         KNSmlDMVoIPSeparator );
       
  3493 
       
  3494     // VoIP/x/CodecSettings/CodecSettingsIdXXX/MediaTypeName
       
  3495     segmentName.Copy( KNSmlDMVoIPMediaTypeName );
       
  3496     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3497         segmentName );
       
  3498     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3499         KNSmlDMVoIPSeparator );
       
  3500 
       
  3501     // VoIP/x/CodecSettings/CodecSettingsIdXXX/MediaSubTypeName
       
  3502     segmentName.Copy( KNSmlDMVoIPMediaSubTypeName );
       
  3503     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3504         segmentName );
       
  3505     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3506         KNSmlDMVoIPSeparator );
       
  3507 
       
  3508     // VoIP/x/CodecSettings/CodecSettingsIdXXX/JitterBufferSize
       
  3509     segmentName.Copy( KNSmlDMVoIPJitterBufferSize );
       
  3510     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3511         segmentName );
       
  3512     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3513         KNSmlDMVoIPSeparator );
       
  3514 
       
  3515     // VoIP/x/CodecSettings/CodecSettingsIdXXX/OctetAlign
       
  3516     segmentName.Copy( KNSmlDMVoIPOctetAlign );
       
  3517     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3518         segmentName );
       
  3519     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3520         KNSmlDMVoIPSeparator );
       
  3521 
       
  3522     // VoIP/x/CodecSettings/CodecSettingsIdXXX/ModeSet
       
  3523     segmentName.Copy( KNSmlDMVoIPModeSetNode );
       
  3524     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3525         segmentName );
       
  3526     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3527         KNSmlDMVoIPSeparator );
       
  3528 
       
  3529     // VoIP/x/CodecSettings/CodecSettingsIdXXX/ModeChangePeriod
       
  3530     segmentName.Copy( KNSmlDMVoIPModeChangePeriod );
       
  3531     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3532         segmentName );
       
  3533     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3534         KNSmlDMVoIPSeparator );
       
  3535 
       
  3536     // VoIP/x/CodecSettings/CodecSettingsIdXXX/ModeChangeNeighbor
       
  3537     segmentName.Copy( KNSmlDMVoIPModeChangeNeighbor );
       
  3538     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3539         segmentName );
       
  3540     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3541         KNSmlDMVoIPSeparator );
       
  3542 
       
  3543     // VoIP/x/CodecSettings/CodecSettingsIdXXX/Ptime
       
  3544     segmentName.Copy( KNSmlDMVoIPPtime );
       
  3545     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3546         segmentName );
       
  3547     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3548         KNSmlDMVoIPSeparator );
       
  3549 
       
  3550     // VoIP/x/CodecSettings/CodecSettingsIdXXX/MaxPtime
       
  3551     segmentName.Copy( KNSmlDMVoIPMaxPtime );
       
  3552     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3553         segmentName );
       
  3554     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3555         KNSmlDMVoIPSeparator );
       
  3556 
       
  3557     // VoIP/x/CodecSettings/CodecSettingsIdXXX/VAD
       
  3558     segmentName.Copy( KNSmlDMVoIPVAD );
       
  3559     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3560         segmentName );
       
  3561     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3562         KNSmlDMVoIPSeparator );
       
  3563 
       
  3564     // VoIP/x/CodecSettings/CodecSettingsIdXXX/AnnexB
       
  3565     segmentName.Copy( KNSmlDMVoIPAnnexB );
       
  3566     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3567         segmentName );
       
  3568     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3569         KNSmlDMVoIPSeparator );
       
  3570 
       
  3571     // VoIP/x/CodecSettings/CodecSettingsIdXXX/MaxRed
       
  3572     segmentName.Copy( KNSmlDMVoIPMaxRed );
       
  3573     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3574         segmentName );
       
  3575     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3576         KNSmlDMVoIPSeparator );
       
  3577 
       
  3578     DBG_PRINT("CNSmlDmVoIPAdapter::CodecChildListL(): end");
       
  3579     }
       
  3580 
       
  3581 // ---------------------------------------------------------------------------
       
  3582 // CNSmlDmVoIPAdapter::VoipChildListL
       
  3583 // Inserts VoIP leaf objects.
       
  3584 // ---------------------------------------------------------------------------
       
  3585 //
       
  3586 void CNSmlDmVoIPAdapter::VoipChildListL(
       
  3587     CBufBase* const aCurrentURISegmentList )
       
  3588     {
       
  3589     DBG_PRINT("CNSmlDmVoIPAdapter::VoipChildListL(): start");
       
  3590 
       
  3591     TBuf8<KSmlMaxURISegLen> segmentName;
       
  3592 
       
  3593     // VoIP/x/VoIPID
       
  3594     segmentName.Copy( KNSmlDMVoIPSetID );
       
  3595     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3596         segmentName );
       
  3597     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3598         KNSmlDMVoIPSeparator );
       
  3599 
       
  3600     // VoIP/x/ProviderName
       
  3601     segmentName.Copy( KNSmlDMVoIPProvID );
       
  3602     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3603         segmentName );
       
  3604     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3605         KNSmlDMVoIPSeparator );
       
  3606 
       
  3607     // VoIP/x/SettingsName
       
  3608     segmentName.Copy( KNSmlDMVoIPName );
       
  3609     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3610         segmentName );
       
  3611     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3612         KNSmlDMVoIPSeparator );
       
  3613 
       
  3614     // VoIP/x/PreferredCodecs
       
  3615     segmentName.Copy( KNSmlDMVoIPPreferredCodecsNode );
       
  3616     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3617         segmentName ); 
       
  3618     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3619         KNSmlDMVoIPSeparator ); 
       
  3620 
       
  3621     // VoIP/x/CodecSettings
       
  3622     segmentName.Copy( KNSmlDMVoIPCodecSettingsNode );
       
  3623     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3624         segmentName ); 
       
  3625     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3626         KNSmlDMVoIPSeparator ); 
       
  3627 
       
  3628     // VoIP/x/SettingIds
       
  3629     segmentName.Copy( KNSmlDMVoIPSettingIdsNode );
       
  3630     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3631         segmentName ); 
       
  3632     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3633         KNSmlDMVoIPSeparator );
       
  3634 
       
  3635     // VoIP/x/StartMediaPort
       
  3636     segmentName.Copy( KNSmlDMVoIPSMPort );
       
  3637     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3638         segmentName ); 
       
  3639     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3640         KNSmlDMVoIPSeparator );
       
  3641 
       
  3642     // VoIP/x/EndMediaPort
       
  3643     segmentName.Copy( KNSmlDMVoIPEMPort );
       
  3644     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3645         segmentName ); 
       
  3646     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3647         KNSmlDMVoIPSeparator );
       
  3648 
       
  3649     // VoIP/x/VoiceMailBox
       
  3650     segmentName.Copy( KNSmlDMVoIPVmbxNode );
       
  3651     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3652         segmentName ); 
       
  3653     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3654         KNSmlDMVoIPSeparator );
       
  3655 
       
  3656     // VoIP/x/MegiaQos
       
  3657     segmentName.Copy( KNSmlDMVoIPMediaQos );
       
  3658     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3659         segmentName ); 
       
  3660     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3661         KNSmlDMVoIPSeparator );
       
  3662 
       
  3663     // VoIP/x/InbandDTMF
       
  3664     segmentName.Copy( KNSmlDMVoIPDTMFIB );
       
  3665     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3666         segmentName ); 
       
  3667     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3668         KNSmlDMVoIPSeparator );
       
  3669 
       
  3670     // VoIP/x/OutbandDTMF
       
  3671     segmentName.Copy( KNSmlDMVoIPDTMFOB );
       
  3672     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3673         segmentName ); 
       
  3674     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3675         KNSmlDMVoIPSeparator );
       
  3676 
       
  3677     // VoIP/x/SecureCallPref
       
  3678     segmentName.Copy( KNSmlDMVoIPSecureCallPref );
       
  3679     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3680         segmentName );
       
  3681     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3682         KNSmlDMVoIPSeparator );
       
  3683 
       
  3684     // VoIP/x/RTCP
       
  3685     segmentName.Copy( KNSmlDMVoIPRTCP );
       
  3686     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3687         segmentName );
       
  3688     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3689         KNSmlDMVoIPSeparator );
       
  3690 
       
  3691     // VoIP/x/UAHTerminalType
       
  3692     segmentName.Copy( KNSmlDMVoIPUAHTerminalType );
       
  3693     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3694         segmentName );
       
  3695     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3696         KNSmlDMVoIPSeparator );
       
  3697 
       
  3698     // VoIP/x/UAHWLANMAC
       
  3699     segmentName.Copy( KNSmlDMVoIPUAHWLANMAC );
       
  3700     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3701         segmentName );
       
  3702     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3703         KNSmlDMVoIPSeparator );
       
  3704 
       
  3705     // VoIP/x/UAHString
       
  3706     segmentName.Copy( KNSmlDMVoIPUAHString );
       
  3707     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3708         segmentName );
       
  3709     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3710         KNSmlDMVoIPSeparator );
       
  3711 
       
  3712     // VoIP/x/ProfileLockedToIAP
       
  3713     segmentName.Copy( KNSmlDMVoIPProfileLockedToIAP );
       
  3714     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3715         segmentName );
       
  3716     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3717         KNSmlDMVoIPSeparator );
       
  3718 
       
  3719     // VoIP/x/VoIPPluginUID
       
  3720     segmentName.Copy( KNSmlDMVoIPPluginUID );
       
  3721     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3722         segmentName );
       
  3723     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3724         KNSmlDMVoIPSeparator );
       
  3725 
       
  3726     // VoIP/x/AllowVoIPoverWCDMA
       
  3727     segmentName.Copy( KNSmlDMVoIPAllowVoIPOverWCDMA );
       
  3728     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3729         segmentName );
       
  3730     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
       
  3731         KNSmlDMVoIPSeparator );
       
  3732 
       
  3733     // VoIP/x/VoIPDigits
       
  3734     segmentName.Copy( KNSmlDMVoIPVoIPDigits );
       
  3735     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3736         segmentName );
       
  3737     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3738         KNSmlDMVoIPSeparator );
       
  3739 
       
  3740     // VoIP/x/URIDomainIgnoreRule
       
  3741     segmentName.Copy( KNSmlDMVoIPURIDomainIgnoreRule );
       
  3742     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3743         segmentName );
       
  3744     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3745         KNSmlDMVoIPSeparator );
       
  3746 
       
  3747     // VoIP/x/AutoAcceptBuddyRequest
       
  3748     segmentName.Copy( KNSmlDMVoIPAutoAcceptBuddyRequest );
       
  3749     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3750         segmentName );
       
  3751     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3752         KNSmlDMVoIPSeparator );
       
  3753 
       
  3754     // VoIP/x/UsedVoIPRelease
       
  3755     segmentName.Copy( KNSmlDMVoIPUsedVoIPRelease );
       
  3756     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3757         segmentName );
       
  3758     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3759         KNSmlDMVoIPSeparator );
       
  3760 
       
  3761     // VoIP/x/AddUserPhone
       
  3762     segmentName.Copy( KNSmlDMVoIPAddUserPhone );
       
  3763     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3764         segmentName );
       
  3765     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3766         KNSmlDMVoIPSeparator );
       
  3767 
       
  3768     // VoIP/x/ProviderBookmarkURI
       
  3769     segmentName.Copy( KNSmlDMVoIPProviderBookmarkUri );
       
  3770     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3771         segmentName );
       
  3772     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3773         KNSmlDMVoIPSeparator );
       
  3774 
       
  3775     // VoIP/x/SIPConnectivityTestURI
       
  3776     segmentName.Copy( KNSmlDMVoIPSIPConnTestUri );
       
  3777     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3778         segmentName );
       
  3779     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3780         KNSmlDMVoIPSeparator );
       
  3781 
       
  3782     // VoIP/x/NATFWProfileId
       
  3783     segmentName.Copy( KNSmlDMVoIPNatFwProfileId );
       
  3784     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3785         segmentName );
       
  3786     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3787         KNSmlDMVoIPSeparator );
       
  3788 
       
  3789     // VoIP/x/MinSessionInterval
       
  3790     segmentName.Copy( KNSmlDMVoIPMinSessionInterval );
       
  3791     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3792         segmentName );
       
  3793     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3794         KNSmlDMVoIPSeparator );
       
  3795 
       
  3796     // VoIP/x/SessionExpires
       
  3797     segmentName.Copy( KNSmlDMVoIPSessionExpires );
       
  3798     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3799         segmentName );
       
  3800     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3801         KNSmlDMVoIPSeparator );
       
  3802 
       
  3803     // VoIP/x/BradingDataURI
       
  3804     segmentName.Copy( KNSmlDMVoIPBrandingDataUri );
       
  3805     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3806         segmentName );
       
  3807     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3808         KNSmlDMVoIPSeparator );
       
  3809 
       
  3810     // VoIP/x/PresenceSettingsId
       
  3811     segmentName.Copy( KNSmlDMVoIPPresenceSettingsId );
       
  3812     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3813         segmentName );
       
  3814     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3815         KNSmlDMVoIPSeparator );
       
  3816 
       
  3817     // VoIP/x/UsedNATProtocol
       
  3818     segmentName.Copy( KNSmlDMVoIPUsedNatProtocol );
       
  3819     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3820         segmentName );
       
  3821     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3822         KNSmlDMVoIPSeparator );
       
  3823 
       
  3824     // VoIP/x/AutoEnable
       
  3825     segmentName.Copy( KNSmlDMVoIPAutoEnable );
       
  3826     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3827         segmentName );
       
  3828     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3829         KNSmlDMVoIPSeparator );
       
  3830 
       
  3831     // VoIP/x/SnapProfileId
       
  3832     segmentName.Copy( KNSmlDMVoIPSnapProfileId );
       
  3833     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3834         segmentName );
       
  3835     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3836         KNSmlDMVoIPSeparator );
       
  3837 
       
  3838     // VoIP/x/EnableIM
       
  3839     segmentName.Copy( KNSmlDMVoIPEnableIm );
       
  3840     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3841         segmentName );
       
  3842     aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
       
  3843         KNSmlDMVoIPSeparator );
       
  3844 
       
  3845     DBG_PRINT("CNSmlDmVoIPAdapter::VoipChildListL(): end");
       
  3846     }
       
  3847 
       
  3848 // ---------------------------------------------------------------------------
       
  3849 // CNSmlDmVoIPAdapter::AddNodeObjectL
       
  3850 // Adds a new node.
       
  3851 // ---------------------------------------------------------------------------
       
  3852 //
       
  3853 void CNSmlDmVoIPAdapter::AddNodeObjectL( 
       
  3854     const TDesC8& aURI, 
       
  3855     const TDesC8& aParentLUID, 
       
  3856     const TInt aStatusRef )
       
  3857     {
       
  3858     DBG_PRINT("CNSmlDmVoIPAdapter::AddNodeObjectL(): begin");
       
  3859 
       
  3860     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  3861 
       
  3862     CSmlDmAdapter::TError retValue = EOk;
       
  3863 
       
  3864     // Load VoIP profile information if not loaded yet
       
  3865     if ( !iProfileEntries.Count() )
       
  3866         {
       
  3867         LoadProfilesL();
       
  3868         }
       
  3869     // Find profile from array, profile deleted from elsewhere if not found
       
  3870     if ( aParentLUID.Length() > 0 )
       
  3871         {
       
  3872         TInt profileID = FindProfileLocation ( aParentLUID );
       
  3873         if ( KErrNotFound == profileID )
       
  3874             {
       
  3875             retValue = CSmlDmAdapter::ENotFound;
       
  3876             }
       
  3877         else
       
  3878             {
       
  3879             retValue = CSmlDmAdapter::EAlreadyExists;
       
  3880             }
       
  3881         }
       
  3882 
       
  3883     // Get last URI segment. 
       
  3884     TBuf8<KNSmlVoIPMaxUriLength> uri = aURI;
       
  3885     TBuf8<KNSmlVoIPMaxUriLength> mappingInfo ( KNullDesC8 );
       
  3886     TPtrC8 uriSeg = LastURISeg( aURI );
       
  3887     TPtrC8 uriTmp = RemoveLastURISeg( aURI );
       
  3888     TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
       
  3889 
       
  3890      // Find profile
       
  3891     iProfileID = FindProfileLocation( aParentLUID );
       
  3892 
       
  3893     // ==============================
       
  3894     // VoIP node ( add )
       
  3895     // ==============================
       
  3896     //
       
  3897     // VoIP/x/VoIP
       
  3898     if ( KNSmlDMVoIPNodeName() == secondLastUriSeg 
       
  3899         && ( EOk == retValue || ENotFound == retValue ) )
       
  3900         {
       
  3901         // Check OOD before saving new profile.
       
  3902         RFs fs;
       
  3903         User::LeaveIfError( fs.Connect() );
       
  3904         CleanupClosePushL( fs ); // CS:1
       
  3905 
       
  3906         // VoIP settings are stored in three files.
       
  3907         if ( SysUtil::FFSSpaceBelowCriticalLevelL( 
       
  3908             &fs, KNSmlDMFatMinimumFileSize * 3 ) )
       
  3909             {
       
  3910             // Prevent writing in OOD.
       
  3911             CleanupStack::PopAndDestroy( &fs ); // CS:0
       
  3912             iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EDiskFull );
       
  3913             DBG_PRINT("CNSmlDmVoIPAdapter::AddNodeObjectL(): DISK FULL end");
       
  3914             return;
       
  3915             }
       
  3916         CleanupStack::PopAndDestroy( &fs ); // CS:0
       
  3917         CRCSEProfileEntry* newProfileEntry = CRCSEProfileEntry::NewLC();
       
  3918         iCRCSEProfile->GetDefaultProfile( *newProfileEntry );
       
  3919         if ( uriSeg.Length() < KMaxSettingsNameLength )
       
  3920             {
       
  3921             newProfileEntry->iSettingsName.Copy( uriSeg );
       
  3922             }
       
  3923         newProfileEntry->iProviderName.Copy( KDefaultSettingsName );
       
  3924         CheckDuplicateNameL( *newProfileEntry );
       
  3925         CheckDuplicateProviderL( *newProfileEntry );
       
  3926 
       
  3927         CRCSEAudioCodecEntry* newAudioCodecEntry1 = 
       
  3928             CRCSEAudioCodecEntry::NewLC();
       
  3929         newAudioCodecEntry1->SetDefaultCodecValueSet( KAudioCodecAMRWB() );
       
  3930         newAudioCodecEntry1->iMediaSubTypeName = KAudioCodecAMRWB;
       
  3931         TUint32 codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry1 );
       
  3932         newProfileEntry->iPreferredCodecs.Append( codecId );
       
  3933         newAudioCodecEntry1->iCodecId = codecId;
       
  3934         iCodecEntries.AppendL( newAudioCodecEntry1 );
       
  3935         CleanupStack::Pop( newAudioCodecEntry1 );
       
  3936 
       
  3937         CRCSEAudioCodecEntry* newAudioCodecEntry2 = 
       
  3938             CRCSEAudioCodecEntry::NewLC();
       
  3939         newAudioCodecEntry2->SetDefaultCodecValueSet( KAudioCodecAMR() );
       
  3940         newAudioCodecEntry2->iMediaSubTypeName = KAudioCodecAMR;        
       
  3941         codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry2 );
       
  3942         newProfileEntry->iPreferredCodecs.Append( codecId );
       
  3943         newAudioCodecEntry2->iCodecId = codecId; 
       
  3944         iCodecEntries.AppendL( newAudioCodecEntry2 );
       
  3945         CleanupStack::Pop( newAudioCodecEntry2 );
       
  3946 
       
  3947         CRCSEAudioCodecEntry* newAudioCodecEntry3 = 
       
  3948             CRCSEAudioCodecEntry::NewLC();
       
  3949         newAudioCodecEntry3->SetDefaultCodecValueSet( KAudioCodecPCMU() );
       
  3950         newAudioCodecEntry3->iMediaSubTypeName = KAudioCodecPCMU;
       
  3951         codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry3 );
       
  3952         newProfileEntry->iPreferredCodecs.Append( codecId );
       
  3953         newAudioCodecEntry3->iCodecId = codecId;
       
  3954         iCodecEntries.AppendL( newAudioCodecEntry3 );
       
  3955         CleanupStack::Pop( newAudioCodecEntry3 );
       
  3956 
       
  3957         CRCSEAudioCodecEntry* newAudioCodecEntry4 = 
       
  3958             CRCSEAudioCodecEntry::NewLC();
       
  3959         newAudioCodecEntry4->SetDefaultCodecValueSet( KAudioCodecPCMA() );
       
  3960         newAudioCodecEntry4->iMediaSubTypeName = KAudioCodecPCMA;
       
  3961         codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry4 );
       
  3962         newProfileEntry->iPreferredCodecs.Append( codecId );
       
  3963         newAudioCodecEntry4->iCodecId = codecId; 
       
  3964         iCodecEntries.AppendL( newAudioCodecEntry4 );
       
  3965         CleanupStack::Pop( newAudioCodecEntry4 );
       
  3966 
       
  3967         CRCSEAudioCodecEntry* newAudioCodecEntry5 = 
       
  3968             CRCSEAudioCodecEntry::NewLC();
       
  3969         newAudioCodecEntry5->SetDefaultCodecValueSet( KAudioCodeciLBC() );
       
  3970         newAudioCodecEntry5->iMediaSubTypeName = KAudioCodeciLBC;
       
  3971         codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry5 );
       
  3972         newProfileEntry->iPreferredCodecs.Append( codecId );
       
  3973         newAudioCodecEntry5->iCodecId = codecId; 
       
  3974         iCodecEntries.AppendL( newAudioCodecEntry5 );
       
  3975         CleanupStack::Pop( newAudioCodecEntry5 );
       
  3976 
       
  3977         CRCSEAudioCodecEntry* newAudioCodecEntry6 = 
       
  3978             CRCSEAudioCodecEntry::NewLC();
       
  3979         newAudioCodecEntry6->SetDefaultCodecValueSet( KAudioCodecG729() );
       
  3980         newAudioCodecEntry6->iMediaSubTypeName = KAudioCodecG729;
       
  3981         codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry6 );
       
  3982         newProfileEntry->iPreferredCodecs.Append( codecId );
       
  3983         newAudioCodecEntry6->iCodecId = codecId;
       
  3984         iCodecEntries.AppendL( newAudioCodecEntry6 );
       
  3985         CleanupStack::Pop( newAudioCodecEntry6 );
       
  3986 
       
  3987         CRCSEAudioCodecEntry* newAudioCodecEntry7 = 
       
  3988             CRCSEAudioCodecEntry::NewLC();
       
  3989         newAudioCodecEntry7->SetDefaultCodecValueSet( KAudioCodecCN() );
       
  3990         newAudioCodecEntry7->iMediaSubTypeName = KAudioCodecCN;
       
  3991         codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry7 );
       
  3992         newProfileEntry->iPreferredCodecs.Append( codecId );
       
  3993         newAudioCodecEntry7->iCodecId = codecId;
       
  3994         iCodecEntries.AppendL( newAudioCodecEntry7 );
       
  3995         CleanupStack::Pop( newAudioCodecEntry7 );
       
  3996 
       
  3997         // Add SettingIds entry.
       
  3998         TSettingIds idEntry;
       
  3999         idEntry.iProfileType = -1;
       
  4000         // SIPSpecific not supported => ID not found.
       
  4001         idEntry.iProfileSpecificSettingId = KErrNotFound;
       
  4002         idEntry.iProfileId = -1;
       
  4003         newProfileEntry->iIds.Append( idEntry ); 
       
  4004 
       
  4005         // Add new VoIP profile.
       
  4006         TUint32 profileID = iCRCSEProfile->AddL( *newProfileEntry );
       
  4007         newProfileEntry->iId = profileID;
       
  4008         iProfileEntries.AppendL( newProfileEntry );
       
  4009 
       
  4010         // Add LUID mapping to first SettingIds of profile.
       
  4011         uri.Copy( aURI );
       
  4012         uri.Append( KNSmlDMVoIPSeparator );
       
  4013         uri.Append( KNSmlDMVoIPSettingIdsNode );
       
  4014         uri.Append( KNSmlDMVoIPSeparator );
       
  4015         uri.Append( KNSmlDMVoIPSettingId );
       
  4016         uri.AppendNumFixedWidthUC( 1, EDecimal, 3 );
       
  4017         mappingInfo.Copy( KNSmlDMVoIPPrefix );
       
  4018         mappingInfo.AppendNumFixedWidthUC( profileID, EDecimal, 10 );
       
  4019         mappingInfo.Append( KNSmlDMVoIPSeparator );
       
  4020         mappingInfo.Append( KNSmlDMVoIPSettingId );
       
  4021         mappingInfo.AppendNumFixedWidthUC( 0, EDecimal, 10 );
       
  4022         iDmCallback->SetMappingL( uri, mappingInfo ); 
       
  4023 
       
  4024         // Add LUID mapping for CodecSettings and preferredCodecs.
       
  4025         for ( TInt counter = 0; counter < newProfileEntry->
       
  4026             iPreferredCodecs.Count(); counter++ )
       
  4027             {
       
  4028             uri.Copy( aURI );
       
  4029             uri.Append( KNSmlDMVoIPSeparator );
       
  4030             uri.Append( KNSmlDMVoIPCodecSettingsNode );
       
  4031             uri.Append( KNSmlDMVoIPSeparator );
       
  4032             uri.Append( KNSmlDMVoIPCodecSettingsId );
       
  4033             uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  4034             mappingInfo.Copy( KNSmlDMVoIPPrefix );
       
  4035             mappingInfo.AppendNumFixedWidthUC( profileID, EDecimal, 10 );
       
  4036             mappingInfo.Append( KNSmlDMVoIPSeparator );
       
  4037             mappingInfo.Append( KNSmlDMVoIPCodecSettingsId );
       
  4038             mappingInfo.AppendNumFixedWidthUC( newProfileEntry->
       
  4039                 iPreferredCodecs[counter], EDecimal, 10 );
       
  4040             iDmCallback->SetMappingL( uri, mappingInfo ); 
       
  4041 
       
  4042             uri.Copy( aURI );
       
  4043             uri.Append( KNSmlDMVoIPSeparator );
       
  4044             uri.Append( KNSmlDMVoIPPreferredCodecsNode );
       
  4045             uri.Append( KNSmlDMVoIPSeparator );
       
  4046             uri.Append( KNSmlDMVoIPPreferredCodecId );
       
  4047             uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
       
  4048             mappingInfo.Copy( KNSmlDMVoIPPrefix );
       
  4049             mappingInfo.AppendNumFixedWidthUC( profileID, EDecimal, 10 );
       
  4050             mappingInfo.Append( KNSmlDMVoIPSeparator );
       
  4051             mappingInfo.Append( KNSmlDMVoIPPreferredCodecId );
       
  4052             mappingInfo.AppendNumFixedWidthUC( counter, EDecimal, 10 );
       
  4053             iDmCallback->SetMappingL( uri, mappingInfo ); 
       
  4054             }
       
  4055 
       
  4056         // Set LUID mapping to DM module.
       
  4057         mappingInfo.Copy ( KNSmlDMVoIPPrefix );
       
  4058         mappingInfo.AppendNumFixedWidthUC( profileID, EDecimal, 10 );
       
  4059         iDmCallback->SetMappingL( aURI, mappingInfo ); 
       
  4060 
       
  4061         CleanupStack::Pop( newProfileEntry );
       
  4062 
       
  4063         retValue = CSmlDmAdapter::EOk;
       
  4064         }
       
  4065 
       
  4066     if ( KErrNotFound != iProfileID )
       
  4067         {
       
  4068         // ==============================
       
  4069         // CodecSettings node (add)
       
  4070         // ==============================
       
  4071         //
       
  4072         if ( KNSmlDMVoIPCodecSettingsNode() == secondLastUriSeg &&
       
  4073             KErrNotFound == aParentLUID.Find( KNSmlDMVoIPCodecSettingsId ) )
       
  4074             {
       
  4075             CRCSEAudioCodecEntry *newAudioCodecEntry = 
       
  4076                 CRCSEAudioCodecEntry::NewLC();
       
  4077             iCRCSEAudioCodec->GetDefaultCodec( *newAudioCodecEntry );
       
  4078             TUint32 codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry );
       
  4079             newAudioCodecEntry->iCodecId = codecId;
       
  4080             iCodecEntries.AppendL( newAudioCodecEntry );
       
  4081 
       
  4082             // Add new codec ID to iPreferredCodecs of current VoIP profile.
       
  4083             iProfileEntries[iProfileID]->
       
  4084                 iPreferredCodecs.Append( codecId );
       
  4085 
       
  4086             // Update VoIP profile back to permanent store.    
       
  4087             iCRCSEProfile->UpdateL( iProfileEntries[iProfileID]->
       
  4088                 iId, *iProfileEntries[iProfileID] );
       
  4089             CleanupStack::Pop( newAudioCodecEntry );
       
  4090 
       
  4091             // Add LUID mapping to new codecsettings entry.
       
  4092             mappingInfo.Copy( KNSmlDMVoIPPrefix );
       
  4093             TUint val( iProfileEntries[iProfileID]->iId );
       
  4094             mappingInfo.AppendNumFixedWidthUC( val, EDecimal, 10 );
       
  4095             mappingInfo.Append( KNSmlDMVoIPSeparator );
       
  4096             mappingInfo.Append( KNSmlDMVoIPCodecSettingsId );
       
  4097             mappingInfo.AppendNumFixedWidthUC( codecId, EDecimal, 10 );
       
  4098             iDmCallback->SetMappingL( aURI, mappingInfo );
       
  4099 
       
  4100             // Add LUID mapping to new preferredcodecs entry.
       
  4101             uri.Copy( RemoveLastURISeg( RemoveLastURISeg( aURI ) ) );
       
  4102             uri.Append( KNSmlDMVoIPSeparator );
       
  4103             uri.Append( KNSmlDMVoIPPreferredCodecsNode );
       
  4104             uri.Append( KNSmlDMVoIPSeparator );
       
  4105             uri.Append( KNSmlDMVoIPPreferredCodecId );
       
  4106             uri.AppendNumFixedWidthUC( 
       
  4107                 iProfileEntries[iProfileID]->iPreferredCodecs.Count(),
       
  4108                 EDecimal, 3 );
       
  4109             mappingInfo.Copy( KNSmlDMVoIPPrefix );
       
  4110             mappingInfo.AppendNumFixedWidthUC( iProfileID, EDecimal, 10 );
       
  4111             mappingInfo.Append( KNSmlDMVoIPSeparator );
       
  4112             mappingInfo.Append( KNSmlDMVoIPPreferredCodecId );
       
  4113             mappingInfo.AppendNumFixedWidthUC( 
       
  4114                 iProfileEntries[iProfileID]->iPreferredCodecs.Count() - 1,
       
  4115                 EDecimal, 10 );
       
  4116             iDmCallback->SetMappingL( uri, mappingInfo );    
       
  4117             retValue = CSmlDmAdapter::EOk;
       
  4118             }
       
  4119 
       
  4120         // ==============================
       
  4121         // ModeSet node (add)
       
  4122         // ==============================
       
  4123         //
       
  4124         if ( KNSmlDMVoIPModeSetNode() == secondLastUriSeg
       
  4125             && KErrNotFound == aParentLUID.Find( KNSmlDMVoIPModeId ) )
       
  4126             {
       
  4127             // Get codec ID used by these settings.
       
  4128             TUint32 codecId = DesToInt( aParentLUID.Right( 10 ) );
       
  4129             TInt codecPos = FindCodecLocation( codecId );
       
  4130             if ( KErrNotFound != codecPos )
       
  4131                 {
       
  4132                 iCodecEntries[codecPos]->iModeSet.Append( 1 );
       
  4133                 iCRCSEAudioCodec->UpdateL( codecId,
       
  4134                     *iCodecEntries[codecPos] );
       
  4135 
       
  4136                 // All LUID mapping to new mode-set item.
       
  4137                 mappingInfo.Copy( aParentLUID );
       
  4138                 mappingInfo.Append( KNSmlDMVoIPSeparator );
       
  4139                 mappingInfo.Append( KNSmlDMVoIPModeId );
       
  4140                 mappingInfo.AppendNumFixedWidthUC( 
       
  4141                     iCodecEntries[codecPos]->iModeSet.Count() - 1,
       
  4142                     EDecimal, 10 );
       
  4143                 iDmCallback->SetMappingL( aURI, mappingInfo ); 
       
  4144                 retValue = CSmlDmAdapter::EOk;    
       
  4145                 }
       
  4146             else
       
  4147                 {
       
  4148                 retValue = CSmlDmAdapter::EError;    
       
  4149                 }
       
  4150             }
       
  4151 
       
  4152         // ==============================
       
  4153         // SettingIds node (add)  
       
  4154         // ==============================
       
  4155         //
       
  4156         if ( KNSmlDMVoIPSettingIdsNode() == secondLastUriSeg &&
       
  4157             KErrNotFound == aParentLUID.Find( KNSmlDMVoIPSettingId ) )
       
  4158             {
       
  4159             TSettingIds idEntry;
       
  4160             idEntry.iProfileType = 0;
       
  4161             idEntry.iProfileSpecificSettingId = -1;
       
  4162             idEntry.iProfileId = 0;
       
  4163             iProfileEntries[iProfileID]->iIds.Append( idEntry ); 
       
  4164             iCRCSEProfile->UpdateL( iProfileEntries[iProfileID]->iId, 
       
  4165                 *iProfileEntries[iProfileID] );
       
  4166             mappingInfo.Copy( KNSmlDMVoIPPrefix );
       
  4167             TUint val( iProfileEntries[iProfileID]->iId );
       
  4168             mappingInfo.AppendNumFixedWidthUC( val, EDecimal, 10 );
       
  4169             mappingInfo.Append( KNSmlDMVoIPSeparator );
       
  4170             mappingInfo.Append( KNSmlDMVoIPSettingId );
       
  4171             mappingInfo.AppendNumFixedWidthUC( 
       
  4172                 iProfileEntries[iProfileID]->iIds.Count() - 1, EDecimal, 10 );
       
  4173             iDmCallback->SetMappingL( aURI, mappingInfo );       
       
  4174             retValue = CSmlDmAdapter::EOk;
       
  4175             }
       
  4176         }
       
  4177 
       
  4178     // Return status ok for existing leaf nodes that do not need
       
  4179     // to be added separately.    
       
  4180     if ( aParentLUID.Length() > 0 && 
       
  4181         retValue != CSmlDmAdapter::ENotFound &&
       
  4182         ( KNSmlDMVoIPCodecSettingsNode() == uriSeg
       
  4183         || KNSmlDMVoIPModeSetNode() == uriSeg
       
  4184         || KNSmlDMVoIPSettingIdsNode() == uriSeg
       
  4185         || KNSmlDMVoIPSettingIdsNode() == uriSeg
       
  4186         || KNSmlDMVoIPVmbxNode() == uriSeg
       
  4187         ) )
       
  4188         {
       
  4189         retValue = CSmlDmAdapter::EOk;   
       
  4190         }
       
  4191     iDmCallback->SetStatusL( aStatusRef, retValue );
       
  4192 
       
  4193     DBG_PRINT("CNSmlDmVoIPAdapter::AddNodeObjectL(): end");
       
  4194     }
       
  4195 
       
  4196 // ---------------------------------------------------------------------------
       
  4197 // CNSmlDmVoIPAdapter::UpdateLeafObjectL 
       
  4198 // For streaming large object data.
       
  4199 // ---------------------------------------------------------------------------
       
  4200 //
       
  4201 void CNSmlDmVoIPAdapter::UpdateLeafObjectL( 
       
  4202     const TDesC8& /*aURI*/, 
       
  4203     const TDesC8& /*aLUID*/, 
       
  4204     RWriteStream*& /*aStream*/, 
       
  4205     const TDesC8& /*aType*/, 
       
  4206     const TInt aStatusRef )
       
  4207     {
       
  4208     DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): stream: begin");
       
  4209     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  4210     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
  4211     DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): stream: end");
       
  4212     }
       
  4213 
       
  4214 // ---------------------------------------------------------------------------
       
  4215 // CNSmlDmVoIPAdapter::FetchLeafObjectSizeL
       
  4216 // Fetches leaf object size of aURI.
       
  4217 // ---------------------------------------------------------------------------
       
  4218 //
       
  4219 void CNSmlDmVoIPAdapter::FetchLeafObjectSizeL( 
       
  4220     const TDesC8& aURI, 
       
  4221     const TDesC8& aLUID, 
       
  4222     const TDesC8& aType, 
       
  4223     const TInt aResultsRef, 
       
  4224     const TInt aStatusRef )
       
  4225     {
       
  4226     DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectSizeL(): begin");
       
  4227 
       
  4228     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  4229 
       
  4230     CBufBase *object = CBufFlat::NewL( 1 );
       
  4231     CleanupStack::PushL( object );
       
  4232     CSmlDmAdapter::TError retValue = FetchObjectL( aURI, aLUID, *object );
       
  4233 
       
  4234     TInt objSizeInBytes = object->Size();
       
  4235     TBuf8<16> stringObjSizeInBytes;
       
  4236     stringObjSizeInBytes.Num( objSizeInBytes );
       
  4237     object->Reset();
       
  4238     object->InsertL( 0, stringObjSizeInBytes );
       
  4239 
       
  4240     iDmCallback->SetStatusL( aStatusRef, retValue );
       
  4241     iDmCallback->SetResultsL( aResultsRef, *object, aType );
       
  4242     CleanupStack::PopAndDestroy( object ); 
       
  4243     object = NULL;
       
  4244     DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectSizeL(): end");
       
  4245     }
       
  4246 
       
  4247 // ---------------------------------------------------------------------------
       
  4248 // CNSmlDmVoIPAdapter::ExecuteCommandL  
       
  4249 // ---------------------------------------------------------------------------
       
  4250 //
       
  4251 void CNSmlDmVoIPAdapter::ExecuteCommandL( 
       
  4252     const TDesC8& /*aURI*/, 
       
  4253     const TDesC8& /*aLUID*/, 
       
  4254     const TDesC8& /*aArgument*/, 
       
  4255     const TDesC8& /*aType*/, 
       
  4256     const TInt aStatusRef )
       
  4257     {
       
  4258     DBG_PRINT("CNSmlDmVoIPAdapter::ExecuteCommandL(): begin");
       
  4259     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  4260     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
  4261     DBG_PRINT("CNSmlDmVoIPAdapter::ExecuteCommandL(): end");
       
  4262     }
       
  4263 
       
  4264 // ---------------------------------------------------------------------------
       
  4265 // CNSmlDmVoIPAdapter::ExecuteCommandL  
       
  4266 // ---------------------------------------------------------------------------
       
  4267 //
       
  4268 void CNSmlDmVoIPAdapter::ExecuteCommandL( 
       
  4269     const TDesC8& /*aURI*/, 
       
  4270     const TDesC8& /*aParentLUID*/, 
       
  4271     RWriteStream*& /*aStream*/, 
       
  4272     const TDesC8& /*aType*/, 
       
  4273     const TInt aStatusRef )
       
  4274     {
       
  4275     DBG_PRINT("CNSmlDmVoIPAdapter::ExecuteCommandL(): stream: begin");
       
  4276     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  4277     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
  4278     DBG_PRINT("CNSmlDmVoIPAdapter::ExecuteCommandL(): stream: end");
       
  4279     }
       
  4280 
       
  4281 // ---------------------------------------------------------------------------
       
  4282 // CNSmlDmVoIPAdapter::CopyCommandL  
       
  4283 // ---------------------------------------------------------------------------
       
  4284 //
       
  4285 void CNSmlDmVoIPAdapter::CopyCommandL( 
       
  4286     const TDesC8& /*aTargetURI*/, 
       
  4287     const TDesC8& /*aTargetLUID*/, 
       
  4288     const TDesC8& /*aSourceURI*/, 
       
  4289     const TDesC8& /*aSourceLUID*/, 
       
  4290     const TDesC8& /*aType*/, 
       
  4291     TInt aStatusRef )
       
  4292     {
       
  4293     DBG_PRINT("CNSmlDmVoIPAdapter::CopyCommandL(): begin");
       
  4294     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  4295     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
  4296     DBG_PRINT("CNSmlDmVoIPAdapter::CopyCommandL(): end");
       
  4297     }
       
  4298 
       
  4299 // ---------------------------------------------------------------------------
       
  4300 // CNSmlDmVoIPAdapter::StartAtomicL
       
  4301 // For signaling adapter of beginning of the atomic section
       
  4302 // ---------------------------------------------------------------------------
       
  4303 //
       
  4304 void CNSmlDmVoIPAdapter::StartAtomicL()
       
  4305     {
       
  4306     DBG_PRINT("CNSmlDmVoIPAdapter::StartAtomicL(): begin");
       
  4307     DBG_PRINT("CNSmlDmVoIPAdapter::StartAtomicL(): end");
       
  4308     }
       
  4309 
       
  4310 // ---------------------------------------------------------------------------
       
  4311 // CNSmlDmVoIPAdapter::CommitAtomicL
       
  4312 // The CommitAtomicL call is issued only if all the commands in the Atomic were successful 
       
  4313 // ---------------------------------------------------------------------------
       
  4314 //
       
  4315 void CNSmlDmVoIPAdapter::CommitAtomicL()
       
  4316     {
       
  4317     DBG_PRINT("CNSmlDmVoIPAdapter::CommitAtomicL(): begin");
       
  4318     DBG_PRINT("CNSmlDmVoIPAdapter::CommitAtomicL(): end");
       
  4319     }
       
  4320 
       
  4321 // ---------------------------------------------------------------------------
       
  4322 // CNSmlDmVoIPAdapter::RollbackAtomicL
       
  4323 // For signaling adapter to roll back all atomic commands
       
  4324 // ---------------------------------------------------------------------------
       
  4325 //
       
  4326 void CNSmlDmVoIPAdapter::RollbackAtomicL()
       
  4327     {
       
  4328     DBG_PRINT("CNSmlDmVoIPAdapter::RollbackAtomicL(): begin");
       
  4329     DBG_PRINT("CNSmlDmVoIPAdapter::RollbackAtomicL(): end");
       
  4330     }
       
  4331 
       
  4332 // ---------------------------------------------------------------------------
       
  4333 // CNSmlDmVoIPAdapter::StreamingSupport
       
  4334 // For telling framework whether streaming large object data is supported
       
  4335 // ---------------------------------------------------------------------------
       
  4336 //
       
  4337 TBool CNSmlDmVoIPAdapter::StreamingSupport( TInt& /*aItemSize*/ )
       
  4338     {
       
  4339     DBG_PRINT("CNSmlDmVoIPAdapter::StreamingSupport(): begin");
       
  4340     DBG_PRINT("CNSmlDmVoIPAdapter::StreamingSupport(): end");
       
  4341     return EFalse;
       
  4342     }
       
  4343 
       
  4344 // ---------------------------------------------------------------------------
       
  4345 // CNSmlDmVoIPAdapter::StreamCommittedL()
       
  4346 // For telling adapter when streaming large object is finished.
       
  4347 // ---------------------------------------------------------------------------
       
  4348 //
       
  4349 void CNSmlDmVoIPAdapter::StreamCommittedL()
       
  4350     {
       
  4351     DBG_PRINT("CNSmlDmVoIPAdapter::StreamCommittedL(): begin");
       
  4352     DBG_PRINT("CNSmlDmVoIPAdapter::StreamCommittedL(): end");
       
  4353     }
       
  4354 
       
  4355 // ---------------------------------------------------------------------------
       
  4356 // CNSmlDmVoIPAdapter::CompleteOutstandingCmdsL()
       
  4357 // When all buffered dm commands are sent to adapter, set SIP User Agent 
       
  4358 // Header into SIPManagedProfile, and save all changes.
       
  4359 // ---------------------------------------------------------------------------
       
  4360 //
       
  4361 void CNSmlDmVoIPAdapter::CompleteOutstandingCmdsL()
       
  4362     {
       
  4363     DBG_PRINT("CNSmlDmVoIPAdapter::CompleteOutstandingCmdsL(): begin");
       
  4364 
       
  4365     // Save only profiles that have changed. If there are such profiles,
       
  4366     // save changed profiles back to permanent store
       
  4367     if ( iProfileEntries.Count() )
       
  4368         {
       
  4369         for ( TInt counter = 0; counter < iProfileModifs.Count(); counter++ )
       
  4370             {
       
  4371             for ( TInt index = 0; index < iProfileEntries[counter]->
       
  4372                 iIds.Count(); index++ )
       
  4373                 {
       
  4374                 if ( ( 0 == iProfileEntries[counter]->
       
  4375                     iIds[index].iProfileType ) 
       
  4376                     && iProfileEntries[counter]->
       
  4377                         iIds[index].iProfileId > 0
       
  4378                     && ( iProfileEntries[counter]->
       
  4379                         iSIPVoIPUAHTerminalType ||
       
  4380                         iProfileEntries[counter]->
       
  4381                         iSIPVoIPUAHeaderWLANMAC ||
       
  4382                         iProfileEntries[counter]->
       
  4383                         iSIPVoIPUAHeaderString.Length() > 0 ||
       
  4384                         iAllowVoIPOverWCDMAModified ) )
       
  4385                     {
       
  4386                     // Create objects that allow the creation of
       
  4387                     // CSIPManagedProfile object.
       
  4388                     CSIPProfile* sipProf = NULL;
       
  4389                     CSIPProfileRegistryObserver* sipRegObs =
       
  4390                         CSIPProfileRegistryObserver::NewLC(); // CS:1
       
  4391                     CSIPManagedProfileRegistry* sipProfReg = 
       
  4392                         CSIPManagedProfileRegistry::NewLC( 
       
  4393                             *sipRegObs ); // CS:2
       
  4394                     TRAPD( err, ( sipProf = sipProfReg->ProfileL( 
       
  4395                         iProfileEntries[counter]->
       
  4396                         iIds[index].iProfileId ) ) );
       
  4397                     if ( KErrNone == err )
       
  4398                         {
       
  4399                         CSIPManagedProfile* sipManProf = 
       
  4400                             static_cast<CSIPManagedProfile*>( sipProf );
       
  4401                         CleanupStack::PushL( sipManProf ); // CS:3
       
  4402                         // Compile the User Agent Header into a TBuf string.
       
  4403                         TBuf8<KTempStringlength> userAgentHeader;
       
  4404                         TBuf<KMaxTerminalTypeLength> tempTerminalType;
       
  4405                         TBuf<KWlanMacAddressLength> tempWlanMac;
       
  4406                         TBuf<KMaxSettingsLength32> tempFreeString;
       
  4407                         tempFreeString = iProfileEntries[counter]->
       
  4408                             iSIPVoIPUAHeaderString;
       
  4409 
       
  4410                         userAgentHeader.Append( KUserAgent );
       
  4411                         userAgentHeader.Append( KColonMark );
       
  4412                         userAgentHeader.Append( KSpaceMark );
       
  4413 
       
  4414                         if ( iProfileEntries[counter]->
       
  4415                             iSIPVoIPUAHTerminalType )
       
  4416                             {
       
  4417                             GetTerminalTypeL( tempTerminalType );
       
  4418                             userAgentHeader.Append( tempTerminalType );
       
  4419                             userAgentHeader.Append( KSpaceMark );
       
  4420                             }
       
  4421                         if ( iProfileEntries[counter]->
       
  4422                             iSIPVoIPUAHeaderWLANMAC )
       
  4423                             {
       
  4424                             GetWlanMacAddressL( tempWlanMac );
       
  4425                             userAgentHeader.Append( tempWlanMac );
       
  4426                             userAgentHeader.Append( KSpaceMark );
       
  4427                             }
       
  4428                         if ( tempFreeString.Length() > 0 )
       
  4429                             {
       
  4430                             userAgentHeader.Append( tempFreeString );
       
  4431                             }
       
  4432 
       
  4433                         // Create an array for setting the user agent header.
       
  4434                         // Granularity is 1 since only one item is appended
       
  4435                         // into the array.
       
  4436                         CDesC8ArrayFlat* uahArray = new ( ELeave ) 
       
  4437                             CDesC8ArrayFlat( 1 );
       
  4438         	            CleanupStack::PushL( uahArray ); // CS:4
       
  4439         	            uahArray->AppendL( userAgentHeader );
       
  4440                         if ( userAgentHeader.Length() > 0 )
       
  4441                             {
       
  4442                             User::LeaveIfError( 
       
  4443                                 sipManProf->SetParameter( 
       
  4444                                 KSIPHeaders, *uahArray ) );
       
  4445                             }
       
  4446                         
       
  4447                         if ( iAllowVoIPOverWCDMAModified )
       
  4448                             {
       
  4449                             if ( iProfileEntries[iProfileID]->
       
  4450                                     iAllowVoIPoverWCDMA == 
       
  4451                                      CRCSEProfileEntry::EOn )
       
  4452                                 {
       
  4453                                 User::LeaveIfError( 
       
  4454                                     sipManProf->SetParameter( 
       
  4455                                     KBearerType, KBearerNotSpecified ) );
       
  4456                                 }
       
  4457                             else if ( iProfileEntries[iProfileID]->
       
  4458                                          iAllowVoIPoverWCDMA ==
       
  4459                                          CRCSEProfileEntry::EOff )
       
  4460                                 {
       
  4461                                 User::LeaveIfError( 
       
  4462                                     sipManProf->SetParameter( 
       
  4463                                     KBearerType, KBearerWlanOnly ) );
       
  4464                                 }
       
  4465                             iAllowVoIPOverWCDMAModified = EFalse;
       
  4466                             }
       
  4467 
       
  4468                         sipProfReg->SaveL( *sipManProf );
       
  4469                         uahArray->Reset();
       
  4470                         // uahArray, sipManProf 
       
  4471                         CleanupStack::PopAndDestroy( uahArray );  // CS:3
       
  4472                         CleanupStack::PopAndDestroy( sipManProf );  // CS:2
       
  4473                         }// if
       
  4474                     // sipProfReg, sipRegObs
       
  4475                     CleanupStack::PopAndDestroy( sipProfReg ); // CS:1
       
  4476                     CleanupStack::PopAndDestroy( sipRegObs ); // CS:0
       
  4477                     sipProf = NULL;
       
  4478                     }// if
       
  4479                 }// for
       
  4480             iCRCSEProfile->UpdateL( 
       
  4481                 iProfileEntries[iProfileModifs[counter]]->iId,
       
  4482                 *iProfileEntries[iProfileModifs[counter]] );
       
  4483             }
       
  4484         iProfileModifs.Reset();
       
  4485         }
       
  4486 
       
  4487     if ( iCodecEntries.Count() )
       
  4488         {
       
  4489         for ( TInt counter = 0; counter < iCodecModifs.Count(); counter++ )
       
  4490             {
       
  4491             iCRCSEAudioCodec->UpdateL( iCodecEntries[iCodecModifs[counter]]->
       
  4492                 iCodecId, *iCodecEntries[iCodecModifs[counter]] );
       
  4493             }
       
  4494         iCodecModifs.Reset();
       
  4495         }  
       
  4496 
       
  4497     // Since CRCSEProfileRegistry::UpdateL takes CRCSEProfileEntry as const,
       
  4498     // the service ID'S in iProfileEntries array items have not changed.
       
  4499     // Hence load all profiles again from CRCSEProfileRegistry.
       
  4500     iCodecEntries.ResetAndDestroy();
       
  4501     iProfileEntries.ResetAndDestroy();
       
  4502     LoadProfilesL();
       
  4503 
       
  4504 
       
  4505     const TInt spSettingsCount = iSPSettings.Count();
       
  4506     if ( spSettingsCount )
       
  4507         {
       
  4508         // Set SPS ready for setting values.
       
  4509         CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1
       
  4510 
       
  4511         for ( TInt counter = 0; counter < spSettingsCount; counter++ )
       
  4512             {
       
  4513             TUint32 serviceId = 
       
  4514                 iProfileEntries[iProfileID]->iServiceProviderId;
       
  4515 
       
  4516             TInt err( KErrNone );
       
  4517             CSPEntry* spEntry = CSPEntry::NewLC(); // CS:2
       
  4518             err = spSettings->FindEntryL( serviceId, *spEntry );
       
  4519             User::LeaveIfError( err );
       
  4520 
       
  4521             CSPProperty* property = CSPProperty::NewLC(); // CS:3
       
  4522 
       
  4523             // VMBX MWI-URI.
       
  4524             if ( iSPSettings[counter]->iVmbxMwiUri->Des().Length() )
       
  4525                 {
       
  4526                 err = property->SetName( ESubPropertyVMBXMWIAddress );
       
  4527                 property->SetValue( 
       
  4528                     iSPSettings[counter]->iVmbxMwiUri->Des() );
       
  4529                 if ( KErrNone == err )
       
  4530                     {
       
  4531                     err = spEntry->AddPropertyL( *property );
       
  4532                     if ( KErrAlreadyExists == err )
       
  4533                         {
       
  4534                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4535                             ESubPropertyVMBXMWIAddress, 
       
  4536                             iSPSettings[counter]->iVmbxMwiUri->Des() ) );
       
  4537                         }
       
  4538                     else
       
  4539                         {
       
  4540                         User::LeaveIfError( err );
       
  4541                         }
       
  4542                     }
       
  4543 
       
  4544                 // Let's check if listening URI has been or is about
       
  4545                 // to be set. If not, set same as in MWI address.
       
  4546                 CSPProperty* listeningUri = CSPProperty::NewLC();
       
  4547                 err = spSettings->FindPropertyL( serviceId, 
       
  4548                     ESubPropertyVMBXListenAddress, *listeningUri );
       
  4549                 if ( KErrNone != err && 
       
  4550                     !iSPSettings[counter]->iVmbxListenUri->Des().Length() )
       
  4551                     {
       
  4552                     delete iSPSettings[counter]->iVmbxListenUri;
       
  4553                     iSPSettings[counter]->iVmbxListenUri = NULL;
       
  4554                     iSPSettings[counter]->iVmbxListenUri = 
       
  4555                         iSPSettings[counter]->iVmbxMwiUri->Des().AllocL();
       
  4556                     }
       
  4557                 CleanupStack::PopAndDestroy( listeningUri );
       
  4558 
       
  4559                 // Let's check if re-subscribe interval has been or is
       
  4560                 // about to be set. If not, set default value.
       
  4561                 CSPProperty* reSubscrInterval = CSPProperty::NewLC();
       
  4562                 err = spSettings->FindPropertyL( serviceId, 
       
  4563                     ESubPropertyVMBXMWISubscribeInterval, *reSubscrInterval );
       
  4564                 if ( KErrNone != err && 
       
  4565                     iSPSettings[counter]->iReSubscribeInterval == KErrNotFound )
       
  4566                     {
       
  4567                     iSPSettings[counter]->iReSubscribeInterval = 
       
  4568                         KDefaultReSubscribe;
       
  4569                     }
       
  4570                 CleanupStack::PopAndDestroy( reSubscrInterval );
       
  4571                 }
       
  4572 
       
  4573             // VMBX ListeningURI.
       
  4574             if ( iSPSettings[counter]->iVmbxListenUri->Des().Length() )
       
  4575                 {
       
  4576                 err = property->SetName( ESubPropertyVMBXListenAddress );
       
  4577                 property->SetValue( 
       
  4578                     iSPSettings[counter]->iVmbxListenUri->Des() );
       
  4579                 if ( KErrNone == err )
       
  4580                     {
       
  4581                     err = spEntry->AddPropertyL( *property );
       
  4582                     if ( KErrAlreadyExists == err )
       
  4583                         {
       
  4584                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4585                             ESubPropertyVMBXListenAddress, 
       
  4586                             iSPSettings[counter]->iVmbxListenUri->Des() ) );
       
  4587                         }
       
  4588                     else
       
  4589                         {
       
  4590                         User::LeaveIfError( err );
       
  4591                         }
       
  4592                     }
       
  4593                 }
       
  4594 
       
  4595             // VMBX IAP ID.
       
  4596             if ( KErrNone != iSPSettings[counter]->iVmbxIapId )
       
  4597                 {
       
  4598                 err = property->SetName( ESubPropertyVMBXPreferredIAPId );
       
  4599                 property->SetValue( iSPSettings[counter]->iVmbxIapId );
       
  4600                 if ( KErrNone == err )
       
  4601                     {
       
  4602                     err = spEntry->AddPropertyL( *property );
       
  4603                     if ( KErrAlreadyExists == err )
       
  4604                         {
       
  4605                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4606                             ESubPropertyVMBXPreferredIAPId, 
       
  4607                             iSPSettings[counter]->iVmbxIapId ) );
       
  4608                         }
       
  4609                     else
       
  4610                         {
       
  4611                         User::LeaveIfError( err );
       
  4612                         }
       
  4613                     }
       
  4614                 }
       
  4615 
       
  4616             // VMBX re-SUBSCRIBE interval.
       
  4617             if ( KErrNotFound != iSPSettings[counter]->iReSubscribeInterval )
       
  4618                 {
       
  4619                 err = property->SetName( 
       
  4620                     ESubPropertyVMBXMWISubscribeInterval );
       
  4621                 property->SetValue( 
       
  4622                     iSPSettings[counter]->iReSubscribeInterval );
       
  4623                 if ( KErrNone == err )
       
  4624                     {
       
  4625                     err = spEntry->AddPropertyL( *property );
       
  4626                     if ( KErrAlreadyExists == err )
       
  4627                         {
       
  4628                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4629                             ESubPropertyVMBXMWISubscribeInterval, 
       
  4630                             iSPSettings[counter]->iReSubscribeInterval ) );
       
  4631                         }
       
  4632                     else
       
  4633                         {
       
  4634                         User::LeaveIfError( err );
       
  4635                         }
       
  4636                     }
       
  4637                 }
       
  4638 
       
  4639             // VMBX SIP ID.
       
  4640             if ( KErrNone != iSPSettings[counter]->iVmbxSipId )
       
  4641                 {
       
  4642                 err = property->SetName( ESubPropertyVMBXSettingsId );
       
  4643                 property->SetValue( iSPSettings[counter]->iVmbxSipId );
       
  4644                 if ( KErrNone == err )
       
  4645                     {
       
  4646                     err = spEntry->AddPropertyL( *property );
       
  4647                     if ( KErrAlreadyExists == err )
       
  4648                         {
       
  4649                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4650                             ESubPropertyVMBXSettingsId, 
       
  4651                             iSPSettings[counter]->iVmbxSipId ) );
       
  4652                         }
       
  4653                     else
       
  4654                         {
       
  4655                         User::LeaveIfError( err );
       
  4656                         }
       
  4657                     }
       
  4658                 }
       
  4659 
       
  4660             // Service provider bookmark URI.
       
  4661             if ( iSPSettings[counter]->iServiceProviderBookmark->
       
  4662                 Des().Length() )
       
  4663                 {
       
  4664                 err = property->SetName( EPropertyServiceBookmarkUri );
       
  4665                 property->SetValue( 
       
  4666                     iSPSettings[counter]->iServiceProviderBookmark->Des() );
       
  4667                 if ( KErrNone == err )
       
  4668                     {
       
  4669                     err = spEntry->AddPropertyL( *property );
       
  4670                     if ( KErrAlreadyExists == err )
       
  4671                         {
       
  4672                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4673                             EPropertyServiceBookmarkUri, 
       
  4674                             iSPSettings[counter]->
       
  4675                             iServiceProviderBookmark->Des() ) );
       
  4676                         }
       
  4677                     else
       
  4678                         {
       
  4679                         User::LeaveIfError( err );
       
  4680                         }
       
  4681                     }
       
  4682                 }
       
  4683 
       
  4684             // Branding data URI.
       
  4685             if ( iSPSettings[counter]->iBrandingDataUri->Des().Length() )
       
  4686                 {
       
  4687                 err = property->SetName( ESubPropertyVoIPBrandDataUri );
       
  4688                 property->SetValue( 
       
  4689                     iSPSettings[counter]->iBrandingDataUri->Des() );
       
  4690                 if ( KErrNone == err )
       
  4691                     {
       
  4692                     err = spEntry->AddPropertyL( *property );
       
  4693                     if ( KErrAlreadyExists == err )
       
  4694                         {
       
  4695                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4696                             ESubPropertyVoIPBrandDataUri, 
       
  4697                             iSPSettings[counter]->iBrandingDataUri->Des() ) );
       
  4698                         }
       
  4699                     else
       
  4700                         {
       
  4701                         User::LeaveIfError( err );
       
  4702                         }
       
  4703                     }
       
  4704                 }
       
  4705 
       
  4706             // Presence settings ID.
       
  4707             if ( KErrNone != iSPSettings[counter]->iPresenceId )
       
  4708                 {
       
  4709                 err = property->SetName( ESubPropertyPresenceSettingsId );
       
  4710                 property->SetValue( 
       
  4711                     iSPSettings[counter]->iPresenceId );
       
  4712                 if ( KErrNone == err )
       
  4713                     {
       
  4714                     err = spEntry->AddPropertyL( *property );
       
  4715                     if ( KErrAlreadyExists == err )
       
  4716                         {
       
  4717                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4718                             ESubPropertyPresenceSettingsId, 
       
  4719                             iSPSettings[counter]->iPresenceId ) );
       
  4720                         }
       
  4721                     else
       
  4722                         {
       
  4723                         User::LeaveIfError( err );
       
  4724                         }
       
  4725                     }
       
  4726                 }
       
  4727 
       
  4728             // Presence auto accept buddy request.
       
  4729             if ( KErrNotFound != iSPSettings[counter]->iAutoAcceptBuddy )
       
  4730                 {
       
  4731                 TOnOff value( static_cast<TOnOff>( 
       
  4732                     iSPSettings[counter]->iAutoAcceptBuddy ) );
       
  4733                 err = property->SetName( 
       
  4734                     ESubPropertyPresenceRequestPreference );
       
  4735                 property->SetValue( value );
       
  4736                 if ( KErrNone == err )
       
  4737                     {
       
  4738                     err = spEntry->AddPropertyL( *property );
       
  4739                     if ( KErrAlreadyExists == err )
       
  4740                         {
       
  4741                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4742                             ESubPropertyPresenceRequestPreference, value ) );
       
  4743                         }
       
  4744                     else
       
  4745                         {
       
  4746                         User::LeaveIfError( err );
       
  4747                         }
       
  4748                     }
       
  4749                 }
       
  4750 
       
  4751             // Auto enable service.
       
  4752             if ( KErrNotFound != iSPSettings[counter]->iAutoEnableService )
       
  4753                 {
       
  4754                 TOnOff value( static_cast<TOnOff>( 
       
  4755                     iSPSettings[counter]->iAutoEnableService ) );
       
  4756                 err = property->SetName( ESubPropertyVoIPEnabled );
       
  4757                 err = property->SetValue( value );
       
  4758                 if ( KErrNone == err )
       
  4759                     {
       
  4760                     err = spEntry->AddPropertyL( *property );
       
  4761                     if ( KErrAlreadyExists == err )
       
  4762                         {
       
  4763                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4764                             ESubPropertyVoIPEnabled, value ) ) ;
       
  4765                         }
       
  4766                     else
       
  4767                         {
       
  4768                         User::LeaveIfError( err );
       
  4769                         }
       
  4770                     }
       
  4771                 // enable presence
       
  4772                 if ( KErrNone != iSPSettings[counter]->iPresenceId )
       
  4773                     {
       
  4774                     err = property->SetName( ESubPropertyPresenceEnabled );
       
  4775                     property->SetValue( value );
       
  4776                     if ( KErrNone == err )
       
  4777                         {
       
  4778                         err = spEntry->AddPropertyL( *property );
       
  4779                         if ( KErrAlreadyExists == err )
       
  4780                             {
       
  4781                             User::LeaveIfError( spEntry->UpdateProperty( 
       
  4782                                 ESubPropertyPresenceEnabled, value ) );
       
  4783                             }
       
  4784                         else
       
  4785                             {
       
  4786                             User::LeaveIfError( err );
       
  4787                             }
       
  4788                         }
       
  4789                     }
       
  4790                 // enable voicemailbox
       
  4791                 if ( KErrNone != iSPSettings[counter]->iVmbxIapId )
       
  4792                     {
       
  4793                     err = property->SetName( ESubPropertyVMBXEnabled );
       
  4794                     property->SetValue( value );
       
  4795                     if ( KErrNone == err )
       
  4796                         {
       
  4797                         err = spEntry->AddPropertyL( *property );
       
  4798                         if ( KErrAlreadyExists == err )
       
  4799                             {
       
  4800                             User::LeaveIfError( spEntry->UpdateProperty( 
       
  4801                                 ESubPropertyVMBXEnabled, value ) );
       
  4802                             }
       
  4803                         else
       
  4804                             {
       
  4805                             User::LeaveIfError( err );
       
  4806                             }
       
  4807                         }
       
  4808                     }
       
  4809                 }
       
  4810 
       
  4811             // SNAP Profile ID.
       
  4812             if ( KErrNone != iSPSettings[counter]->iSnapId )
       
  4813                 {
       
  4814                 err = property->SetName( ESubPropertyVoIPPreferredSNAPId );
       
  4815                 property->SetValue( iSPSettings[counter]->iSnapId );
       
  4816                 if ( KErrNone == err )
       
  4817                     {
       
  4818                     err = spEntry->AddPropertyL( *property );
       
  4819                     if ( KErrAlreadyExists == err )
       
  4820                         {
       
  4821                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4822                             ESubPropertyVoIPPreferredSNAPId, 
       
  4823                             iSPSettings[counter]->iSnapId ) );
       
  4824                         }
       
  4825                     else
       
  4826                         {
       
  4827                         User::LeaveIfError( err );
       
  4828                         }
       
  4829                     }
       
  4830                 }
       
  4831 
       
  4832             // Enable IM
       
  4833             if ( KErrNotFound != iSPSettings[counter]->iImEnabled )
       
  4834                 {
       
  4835                 // IM is enabled => add or set IM properties.
       
  4836                 if ( iSPSettings[counter]->iImEnabled )
       
  4837                     {
       
  4838                     // IM enabled.
       
  4839                     property->SetName( ESubPropertyIMEnabled );
       
  4840                     property->SetValue( EOn );
       
  4841                     err = spEntry->AddPropertyL( *property );
       
  4842                     if ( KErrAlreadyExists == err )
       
  4843                         {
       
  4844                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4845                             ESubPropertyIMEnabled, EOn ) );
       
  4846                         }
       
  4847 
       
  4848                     // IM launch UID.
       
  4849                     property->SetName( ESubPropertyIMLaunchUid );
       
  4850                     property->SetValue( KIMLaunchUid );
       
  4851                     err = spEntry->AddPropertyL( *property );
       
  4852                     if ( KErrAlreadyExists == err )
       
  4853                         {
       
  4854                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4855                             ESubPropertyIMLaunchUid, KIMLaunchUid ) );
       
  4856                         }
       
  4857 
       
  4858                     // IM settings ID.
       
  4859                     property->SetName( ESubPropertyIMSettingsId );
       
  4860                     // The value only needs to be different from 0,
       
  4861                     // no-one actually uses it.
       
  4862                     property->SetValue( KIMSettingsId );
       
  4863                     err = spEntry->AddPropertyL( *property );
       
  4864                     if ( KErrAlreadyExists == err )
       
  4865                         {
       
  4866                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4867                             ESubPropertyIMSettingsId, KIMSettingsId ) );
       
  4868                         }
       
  4869 
       
  4870                     // IM sub-service plugin UID.
       
  4871                     property->SetName( EPropertyIMSubServicePluginId );
       
  4872                     property->SetValue( KIMSubServicePluginId );
       
  4873                     err = spEntry->AddPropertyL( *property );
       
  4874                     if ( KErrAlreadyExists == err )
       
  4875                         {
       
  4876                         User::LeaveIfError( spEntry->UpdateProperty( 
       
  4877                             EPropertyIMSubServicePluginId, 
       
  4878                             KIMSubServicePluginId ) );
       
  4879                         }
       
  4880 
       
  4881                     // IM preferred SNAP ID.
       
  4882                     const CSPProperty* snap;
       
  4883                     spEntry->GetProperty( snap, 
       
  4884                         ESubPropertyVoIPPreferredSNAPId );
       
  4885                     TInt snapId( KErrNone );
       
  4886                     err = snap->GetValue( snapId );
       
  4887                     if ( KErrNone == err )
       
  4888                         {
       
  4889                         property->SetName( ESubPropertyIMPreferredSNAPId );
       
  4890                         err = property->SetValue( snapId );
       
  4891                         if ( KErrNone == err )
       
  4892                             {
       
  4893                             err = spEntry->AddPropertyL( *property );
       
  4894                            if ( KErrAlreadyExists == err )
       
  4895                                 {
       
  4896                                 User::LeaveIfError( spEntry->UpdateProperty( 
       
  4897                                     ESubPropertyIMPreferredSNAPId, 
       
  4898                                     snapId ) );
       
  4899                                 }
       
  4900                             }
       
  4901                         }
       
  4902 
       
  4903                     // IM default tone.
       
  4904                     TFileName toneFile;
       
  4905                     toneFile.Copy( PathInfo::RomRootPath() );
       
  4906                     toneFile.Append( PathInfo::DigitalSoundsPath() );
       
  4907                     toneFile.Append( KDefaultTone );
       
  4908                     MVIMPSTSettingsStore* vimpStSettings =
       
  4909                         CVIMPSTSettingsStore::NewLC(); // CS:4
       
  4910                     User::LeaveIfError( vimpStSettings->SetL( serviceId,
       
  4911                         EServiceToneFileName, toneFile ) );
       
  4912                     // Pop vimpStSettings (can't use M object as argument).
       
  4913                     CleanupStack::PopAndDestroy(); // CS:3
       
  4914                     }
       
  4915                 // IM enabled is set to false => delete IM properties.
       
  4916                 else
       
  4917                     {
       
  4918                     spEntry->DeleteProperty( ESubPropertyIMEnabled );
       
  4919                     spEntry->DeleteProperty( ESubPropertyIMLaunchUid );
       
  4920                     spEntry->DeleteProperty( ESubPropertyIMSettingsId );
       
  4921                     spEntry->DeleteProperty( EPropertyIMSubServicePluginId );
       
  4922                     spEntry->DeleteProperty( ESubPropertyIMPreferredSNAPId );
       
  4923                     }
       
  4924                 }
       
  4925 
       
  4926             err = spSettings->UpdateEntryL( *spEntry );
       
  4927             // property, spEntry
       
  4928 			CleanupStack::PopAndDestroy( property ); // CS:2
       
  4929             CleanupStack::PopAndDestroy( spEntry ); // CS:1
       
  4930             } // for
       
  4931         CleanupStack::PopAndDestroy( spSettings ); // CS:0
       
  4932         iSPSettings.ResetAndDestroy();
       
  4933         }
       
  4934 
       
  4935     DBG_PRINT("CNSmlDmVoIPAdapter::CompleteOutstandingCmdsL(): end");   
       
  4936     }
       
  4937 
       
  4938 // ---------------------------------------------------------------------------
       
  4939 // CNSmlDmVoIPAdapter::FindProfileLocation
       
  4940 // Finds profileID from aURI and returns profile location in array.
       
  4941 // ---------------------------------------------------------------------------
       
  4942 //
       
  4943 TInt CNSmlDmVoIPAdapter::FindProfileLocation( const TDesC8& aURI ) const
       
  4944     {
       
  4945     TInt id( 0 );
       
  4946     id = aURI.Find( KNSmlDMVoIPPrefix );
       
  4947     if ( id != KErrNotFound )
       
  4948         {
       
  4949         id = DesToInt( aURI.Mid( id + KNSmlDMVoIPPrefix().Length(), 10 ) ); 
       
  4950         for ( TInt counter = 0; counter < iProfileEntries.Count(); counter++ )
       
  4951             {
       
  4952             if ( iProfileEntries[counter]->iId == id )
       
  4953                 {
       
  4954                 return counter;
       
  4955                 }
       
  4956             }
       
  4957         }
       
  4958     return KErrNotFound;
       
  4959     }
       
  4960 
       
  4961 // ---------------------------------------------------------------------------
       
  4962 // CNSmlDmVoIPAdapter::DesToInt
       
  4963 // Converts a 8 bit descriptor to int.
       
  4964 // ---------------------------------------------------------------------------
       
  4965 //
       
  4966 TInt CNSmlDmVoIPAdapter::DesToInt( const TDesC8& aDes ) const
       
  4967     {
       
  4968     TLex8 lex( aDes );
       
  4969     TInt value = 0;
       
  4970     lex.Val( value );
       
  4971     return value;
       
  4972     }
       
  4973 
       
  4974 // ---------------------------------------------------------------------------
       
  4975 // CNSmlDmVoIPAdapter::DesToTUint
       
  4976 // Converts a 8bit descriptor to TUint.
       
  4977 // ---------------------------------------------------------------------------
       
  4978 //
       
  4979 TUint CNSmlDmVoIPAdapter::DesToTUint( const TDesC8& aDes ) const
       
  4980     {
       
  4981     TLex8 lex( aDes );
       
  4982     TUint value = 0;
       
  4983     lex.Val( value );
       
  4984     return value;
       
  4985     }
       
  4986 
       
  4987 // ---------------------------------------------------------------------------
       
  4988 // TPtrC8 CNSmlDmVoIPAdapter::RemoveLastURISeg
       
  4989 // returns parent uri, i.e. removes last uri segment
       
  4990 // ---------------------------------------------------------------------------
       
  4991 //
       
  4992 const TPtrC8 CNSmlDmVoIPAdapter::RemoveLastURISeg( const TDesC8& aURI ) const
       
  4993     {
       
  4994     TInt i ( 0 );
       
  4995     if ( KErrNotFound != aURI.Find( KNSmlDMVoIPSeparator ) )
       
  4996         {
       
  4997         for ( i = aURI.Length() - 1; i >= 0; i-- )
       
  4998             {
       
  4999             if ( KDMVoIPSeparator == aURI[i]  )
       
  5000                 {
       
  5001                 break;
       
  5002                 }
       
  5003             }
       
  5004         }
       
  5005     return aURI.Left( i );
       
  5006     }
       
  5007 
       
  5008 // ---------------------------------------------------------------------------
       
  5009 // TInt CNSmlDmVoIPAdapter::NumOfURISegs
       
  5010 // For getting the number of uri segs
       
  5011 // ---------------------------------------------------------------------------
       
  5012 //
       
  5013 TInt CNSmlDmVoIPAdapter::NumOfURISegs( const TDesC8& aURI ) const
       
  5014     {
       
  5015     TInt numOfURISegs = 1;
       
  5016     for ( TInt i = 0; i < aURI.Length(); i++ )
       
  5017         {
       
  5018         if ( KDMVoIPSeparator == aURI[i]  )
       
  5019             {
       
  5020             numOfURISegs++;
       
  5021             }
       
  5022         }
       
  5023     return numOfURISegs;
       
  5024     }
       
  5025 
       
  5026 // ---------------------------------------------------------------------------
       
  5027 // TPtrC8 CNSmlDmVoIPAdapter::LastURISeg
       
  5028 // Returns only the last uri segment
       
  5029 // ---------------------------------------------------------------------------
       
  5030 //
       
  5031 const TPtrC8 CNSmlDmVoIPAdapter::LastURISeg( const TDesC8& aURI ) const
       
  5032     {
       
  5033     TInt i( 0 );
       
  5034     if ( KErrNotFound != aURI.Find( KNSmlDMVoIPSeparator ) )
       
  5035         {
       
  5036         for ( i = aURI.Length() - 1; i >= 0; i-- )
       
  5037             {
       
  5038             if ( KDMVoIPSeparator == aURI[i] )
       
  5039                 {
       
  5040                 break;
       
  5041                 }
       
  5042             }
       
  5043         }
       
  5044     if ( 0 == i )
       
  5045         {
       
  5046         return aURI;
       
  5047         }
       
  5048     else
       
  5049         {
       
  5050         return aURI.Mid( i + 1 );
       
  5051         }
       
  5052     }
       
  5053 
       
  5054 // ---------------------------------------------------------------------------
       
  5055 // TPtrC8 CNSmlDmVoIPAdapter::RemoveDotSlash
       
  5056 // return uri without dot and slash in start
       
  5057 // ---------------------------------------------------------------------------
       
  5058 //
       
  5059 const TPtrC8 CNSmlDmVoIPAdapter::RemoveDotSlash( const TDesC8& aURI ) const
       
  5060     {
       
  5061     if ( 0 == aURI.Find( KNSmlVoIPUriDotSlash ) )
       
  5062         {
       
  5063         return aURI.Right( aURI.Length() - KNSmlVoIPUriDotSlash().Length() );
       
  5064         }
       
  5065     else
       
  5066         {
       
  5067         return aURI;
       
  5068         }
       
  5069     }
       
  5070 
       
  5071 // ---------------------------------------------------------------------------
       
  5072 // CNSmlDmVoIPAdapter::SetSipRefL
       
  5073 // Set sip reference value.
       
  5074 // ---------------------------------------------------------------------------
       
  5075 //
       
  5076 TUint32 CNSmlDmVoIPAdapter::SetSipRefL( const TDesC8& aObject ) const
       
  5077     {
       
  5078     DBG_PRINT("CNSmlDmVoIPAdapter::SetSipRef() : begin");
       
  5079     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5080 
       
  5081     CBufBase* fetchResult = CBufFlat::NewL( 1 );
       
  5082     CleanupStack::PushL( fetchResult );
       
  5083 
       
  5084     // Make all SIP profiles known
       
  5085     CSmlDmAdapter::TError errorStatus;
       
  5086     iDmCallback->FetchLinkL( KNSmlDefDMSIP, *fetchResult, errorStatus );
       
  5087 
       
  5088     // Fetch SIP profile ID.
       
  5089     TBuf8<KNSmlVoIPMaxResultLength> object; 
       
  5090     object.Copy( aObject );
       
  5091     object.Append( KNSmlDMVoIPSeparator );
       
  5092     object.Append( KNSmlDMSIPSipID );
       
  5093     iDmCallback->FetchLinkL( object, *fetchResult, errorStatus );
       
  5094     TUint32 profileId = DesToInt( fetchResult->Ptr( 0 ) );    
       
  5095     CleanupStack::PopAndDestroy( fetchResult );
       
  5096     fetchResult = NULL;
       
  5097     DBG_PRINT("CNSmlDmVoIPAdapter::SetSipRef() : end");
       
  5098     return profileId;
       
  5099     }
       
  5100 
       
  5101 // ---------------------------------------------------------------------------
       
  5102 // CNSmlDmVoIPAdapter::GetSipIdL
       
  5103 // Get URI for given sip profile ID.
       
  5104 // ---------------------------------------------------------------------------
       
  5105 //
       
  5106 MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetSipIdL( CBufBase& aObject,
       
  5107     TUint32 aID ) const
       
  5108     {
       
  5109     DBG_PRINT("CNSmlDmVoIPAdapter::GetSipIdL() : begin");
       
  5110 
       
  5111     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5112 
       
  5113     CBufBase* result = CBufFlat::NewL( 1 );
       
  5114     CleanupStack::PushL( result ); 
       
  5115     CSmlDmAdapter::TError errorStatus;
       
  5116     TBuf8<KNSmlVoIPMaxResultLength> object;
       
  5117     iDmCallback->FetchLinkL( KNSmlDefDMSIP, *result, errorStatus );
       
  5118     result->Compress();
       
  5119     HBufC8* childList = HBufC8::NewLC( result->Size() );
       
  5120     TInt uriSegCount( 0 );
       
  5121     if ( result->Size() > 0 )
       
  5122         {
       
  5123         childList->Des().Copy( result->Ptr(0) );
       
  5124 
       
  5125         // Delete last / mark
       
  5126         childList->Des().Delete( childList->Length() - 1, 1 );    
       
  5127         uriSegCount = NumOfURISegs( childList->Des() );
       
  5128         }
       
  5129 
       
  5130     for ( TInt counter = 0; counter < uriSegCount; counter++ )
       
  5131         {
       
  5132         result->Reset();
       
  5133         object.Copy( KNSmlDefDMSIP );
       
  5134         object.Append( KNSmlDMVoIPSeparator );
       
  5135         object.Append( LastURISeg( childList->Des() ) );
       
  5136 
       
  5137         // Make SIP profile settings known
       
  5138         iDmCallback->FetchLinkL( object, *result, errorStatus );
       
  5139         result->Compress();
       
  5140         result->Reset();
       
  5141 
       
  5142         // Get SIP id
       
  5143         object.Append( KNSmlDMVoIPSeparator );
       
  5144         object.Append( KNSmlDMSIPSipID );
       
  5145         iDmCallback->FetchLinkL( object, *result, errorStatus );
       
  5146         if ( aID == DesToInt( result->Ptr( 0 ) ) )
       
  5147             {
       
  5148             aObject.InsertL( aObject.Size(), RemoveLastURISeg( object ) );
       
  5149             break; 
       
  5150             }
       
  5151         childList->Des().Copy( RemoveLastURISeg ( childList->Des() ) );    
       
  5152         }
       
  5153     // childList, result 
       
  5154     CleanupStack::PopAndDestroy( childList ); // CS:1
       
  5155     CleanupStack::PopAndDestroy( result ); // CS:0
       
  5156     result = NULL;
       
  5157     childList = NULL;
       
  5158     DBG_PRINT("CNSmlDmVoIPAdapter::GetSipIdL() : end");
       
  5159     return errorStatus;
       
  5160     }
       
  5161 
       
  5162 // ---------------------------------------------------------------------------
       
  5163 // CNSmlDmVoIPAdapter::SetSccpRefL
       
  5164 // Set SCCP reference value. 
       
  5165 // ---------------------------------------------------------------------------
       
  5166 //
       
  5167 TUint CNSmlDmVoIPAdapter::SetSccpRefL( const TDesC8& aObject ) const
       
  5168     {
       
  5169     DBG_PRINT("CNSmlDmVoIPAdapter::SetSccpRef() : begin");
       
  5170 
       
  5171     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5172 
       
  5173     CBufBase* fetchResult = CBufFlat::NewL( 1 );
       
  5174     CleanupStack::PushL( fetchResult );
       
  5175 
       
  5176     // Make all SCCP profiles known
       
  5177     CSmlDmAdapter::TError errorStatus;
       
  5178     iDmCallback->FetchLinkL( KNSmlDefDMSCCP, *fetchResult, errorStatus );
       
  5179 
       
  5180     // Find profile asked
       
  5181     iDmCallback->FetchLinkL( aObject, *fetchResult, errorStatus );
       
  5182 
       
  5183     // Fetch SCCP profile ID.
       
  5184     TBuf8<KNSmlVoIPMaxResultLength> object; 
       
  5185     object.Copy( aObject );
       
  5186     object.Append( KNSmlDMVoIPSeparator );
       
  5187     object.Append( KNSmlDMSCCPSccpID ); 
       
  5188     iDmCallback->FetchLinkL( object, *fetchResult, errorStatus );
       
  5189     TUint32 profileId = DesToInt( fetchResult->Ptr( 0 ) );    
       
  5190     CleanupStack::PopAndDestroy( fetchResult );
       
  5191     fetchResult = NULL;
       
  5192     DBG_PRINT("CNSmlDmVoIPAdapter::SetSccpRef() : end");
       
  5193     return profileId;
       
  5194     }
       
  5195 
       
  5196 // ---------------------------------------------------------------------------
       
  5197 // CNSmlDmVoIPAdapter::GetSccpIdL
       
  5198 // Get URI for given sccp profile ID.
       
  5199 // ---------------------------------------------------------------------------
       
  5200 //
       
  5201 MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetSccpIdL( CBufBase& aObject,
       
  5202     TUint32 aID ) const
       
  5203     {
       
  5204     DBG_PRINT("CNSmlDmVoIPAdapter::GetSccpIdL() : begin");
       
  5205 
       
  5206     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5207 
       
  5208     CBufBase* result = CBufFlat::NewL( 1 );
       
  5209     CleanupStack::PushL( result ); 
       
  5210     CSmlDmAdapter::TError errorStatus;
       
  5211     TBuf8<KNSmlVoIPMaxResultLength> object;
       
  5212     iDmCallback->FetchLinkL( KNSmlDefDMSCCP, *result, errorStatus );
       
  5213     result->Compress();
       
  5214     HBufC8* childList = HBufC8::NewLC( result->Size() );
       
  5215     TInt uriSegCount ( 0 );
       
  5216     if ( result->Size() > 0 )
       
  5217         {
       
  5218         childList->Des().Copy( result->Ptr(0) );
       
  5219 
       
  5220         // Delete last / mark
       
  5221         childList->Des().Delete( childList->Length() - 1, 1 );    
       
  5222         uriSegCount = NumOfURISegs( childList->Des() );
       
  5223         }
       
  5224 
       
  5225     for ( TInt counter = 0; counter < uriSegCount; counter++ )
       
  5226         {
       
  5227         result->Reset();
       
  5228 
       
  5229         // Make SCCP profile settings known
       
  5230         object.Copy( KNSmlDefDMSCCP );
       
  5231         object.Append( KNSmlDMVoIPSeparator );
       
  5232         object.Append( LastURISeg( childList->Des() ) );
       
  5233         iDmCallback->FetchLinkL( object, *result, errorStatus );
       
  5234         result->Compress();
       
  5235         result->Reset();
       
  5236 
       
  5237         // Get SCCPId
       
  5238         object.Append( KNSmlDMVoIPSeparator );
       
  5239         object.Append( KNSmlDMSCCPSccpID );
       
  5240         iDmCallback->FetchLinkL( object, *result, errorStatus );
       
  5241         if ( aID == DesToInt ( result->Ptr( 0 ) ) )
       
  5242             {
       
  5243             aObject.InsertL( aObject.Size(), RemoveLastURISeg( object ) );
       
  5244             break; 
       
  5245             }
       
  5246         childList->Des().Copy( RemoveLastURISeg ( childList->Des() ) );    
       
  5247         }
       
  5248     // childList, result 
       
  5249     CleanupStack::PopAndDestroy( childList ); // CS:1
       
  5250     CleanupStack::PopAndDestroy( result ); // CS:0
       
  5251     result = NULL;
       
  5252     childList = NULL;
       
  5253     DBG_PRINT("CNSmlDmVoIPAdapter::GetSccpIdL() : end");
       
  5254     return errorStatus;
       
  5255     }
       
  5256 
       
  5257 // ---------------------------------------------------------------------------
       
  5258 // CNSmlDmVoIPAdapter::CheckDuplicateNameL
       
  5259 // Checks if duplicate named sip profiles. Renames if same.
       
  5260 // ---------------------------------------------------------------------------
       
  5261 //
       
  5262 TBool CNSmlDmVoIPAdapter::CheckDuplicateNameL( CRCSEProfileEntry& aEntry )
       
  5263     {
       
  5264     TBool isValid( EFalse );
       
  5265     HBufC* newName = HBufC::NewLC( KMaxSettingsNameLength * 2 );
       
  5266     newName->Des().Copy( aEntry.iSettingsName );
       
  5267 
       
  5268     TInt count( iProfileEntries.Count() );
       
  5269 
       
  5270     for ( TInt n = 0; n < count; n++ )
       
  5271         {
       
  5272         const TDesC& existingName = iProfileEntries[n]->iSettingsName;
       
  5273         if ( 0 == existingName.Compare( aEntry.iSettingsName )
       
  5274             && iProfileID != n ) // Skip the current profile.
       
  5275             {
       
  5276             TBool isUnique( EFalse );
       
  5277 
       
  5278             for ( TInt i = 1; !isUnique; i++ )
       
  5279                 {
       
  5280                 TBool found( EFalse );
       
  5281 
       
  5282                 newName->Des().Copy( aEntry.iSettingsName );
       
  5283                 newName->Des().Append( KOpenParenthesis() );
       
  5284                 newName->Des().AppendNum( i );
       
  5285                 newName->Des().Append( KClosedParenthesis() );
       
  5286                 for ( TInt m = 0; m < count; m++ )
       
  5287                     {
       
  5288                     if ( 0 == iProfileEntries[m]->iSettingsName.Compare( 
       
  5289                         newName->Des() ) )
       
  5290                         {
       
  5291                         found = ETrue;
       
  5292                         }
       
  5293                     } // for
       
  5294                 if ( !found )
       
  5295                     {
       
  5296                     isUnique = ETrue;
       
  5297                     }
       
  5298                 } // for
       
  5299             } // if
       
  5300         } // for
       
  5301 
       
  5302     // Change setting only if length is smaller than max length.
       
  5303     if ( newName->Length() < KMaxSettingsNameLength )
       
  5304         {
       
  5305         aEntry.iSettingsName.Copy( newName->Des() );
       
  5306         isValid = ETrue;
       
  5307         }
       
  5308     CleanupStack::PopAndDestroy( newName );  
       
  5309     return isValid;  
       
  5310     }
       
  5311 
       
  5312 // ---------------------------------------------------------------------------
       
  5313 // CNSmlDmVoIPAdapter::CheckDuplicateProviderL
       
  5314 // Checks if duplicate provider name. Renames if same.
       
  5315 // ---------------------------------------------------------------------------
       
  5316 //
       
  5317 TBool CNSmlDmVoIPAdapter::CheckDuplicateProviderL( CRCSEProfileEntry& aEntry )
       
  5318     {
       
  5319     TBool isValid( EFalse );
       
  5320     HBufC* newName = HBufC::NewLC( KMaxProviderNameLength * 2 );
       
  5321     newName->Des().Copy( aEntry.iProviderName );
       
  5322 
       
  5323     TInt count( iProfileEntries.Count() );
       
  5324 
       
  5325     for ( TInt n = 0; n < count; n++ )
       
  5326         {
       
  5327         const TDesC& existingName = iProfileEntries[n]->iProviderName;
       
  5328         if ( 0 == existingName.Compare( aEntry.iProviderName )
       
  5329             && iProfileID != n ) // Skip the current profile.
       
  5330             {
       
  5331             TBool isUnique( EFalse );
       
  5332 
       
  5333             for ( TInt i = 1; !isUnique; i++ )
       
  5334                 {
       
  5335                 TBool found( EFalse );
       
  5336 
       
  5337                 newName->Des().Copy( aEntry.iProviderName );
       
  5338                 newName->Des().Append( KOpenParenthesis() );
       
  5339                 newName->Des().AppendNum( i );
       
  5340                 newName->Des().Append( KClosedParenthesis() );
       
  5341                 for ( TInt m = 0; m < count; m++ )
       
  5342                     {
       
  5343                     if ( 0 == iProfileEntries[m]->iProviderName.Compare( 
       
  5344                         newName->Des() ) )
       
  5345                         {
       
  5346                         found = ETrue;
       
  5347                         }
       
  5348                     }
       
  5349                 if ( !found )
       
  5350                     {
       
  5351                     isUnique = ETrue;
       
  5352                     }
       
  5353                 }
       
  5354             }
       
  5355         }
       
  5356 
       
  5357     // Change setting only if length is smaller than max length.
       
  5358     if ( newName->Length() < KMaxProviderNameLength )
       
  5359         {
       
  5360         aEntry.iProviderName.Copy( newName->Des() );
       
  5361         isValid = ETrue;
       
  5362         }
       
  5363 
       
  5364     CleanupStack::PopAndDestroy( newName ); 
       
  5365     return isValid;  
       
  5366     }
       
  5367 
       
  5368 // ---------------------------------------------------------------------------
       
  5369 // TInt CNSmlDmVoIPAdapter::FindCodecLocation
       
  5370 // For getting codec position.
       
  5371 // ---------------------------------------------------------------------------
       
  5372 //
       
  5373 TInt CNSmlDmVoIPAdapter::FindCodecLocation( TUint32 aID ) const
       
  5374     {
       
  5375     for ( TInt i = 0; i < iCodecEntries.Count(); i++ )
       
  5376         {
       
  5377         if ( iCodecEntries[i]->iCodecId == aID )
       
  5378             {
       
  5379             return i;   
       
  5380             }
       
  5381         }
       
  5382     return KErrNotFound;
       
  5383     }
       
  5384 
       
  5385 // ---------------------------------------------------------------------------
       
  5386 // void CNSmlDmVoIPAdapter::SetTelephonyPreferenceL
       
  5387 // For setting telephony preference.
       
  5388 // ---------------------------------------------------------------------------
       
  5389 //
       
  5390 void CNSmlDmVoIPAdapter::SetTelephonyPreferenceL ( const TTelephonyPreference& 
       
  5391     aTelephonyPreference )
       
  5392     {
       
  5393     // Central Repository for richcall settings
       
  5394     CRepository* rep = CRepository::NewLC( KCRUidRichCallSettings );
       
  5395     if ( EPSPreferred == aTelephonyPreference )
       
  5396         {
       
  5397         rep->Set( KRCSEPreferredTelephony, EPSPreferred );
       
  5398         }
       
  5399     else if ( ECSPreferred == aTelephonyPreference )
       
  5400         {
       
  5401         rep->Set( KRCSEPreferredTelephony, ECSPreferred );
       
  5402         }
       
  5403     CleanupStack::PopAndDestroy( rep );
       
  5404     }
       
  5405 
       
  5406 // ---------------------------------------------------------------------------
       
  5407 // CNSmlDmVoIPAdapter::GetTerminalTypeL
       
  5408 // Collect terminal type used in SIP User Agent Header.
       
  5409 // ---------------------------------------------------------------------------
       
  5410 //
       
  5411 void CNSmlDmVoIPAdapter::GetTerminalTypeL(
       
  5412     TBuf<KMaxTerminalTypeLength>& aTerminalType ) const
       
  5413     {
       
  5414     aTerminalType.Zero(); // Reset before use
       
  5415 
       
  5416     CIpAppPhoneUtils* phoneUtils = CIpAppPhoneUtils::NewLC();
       
  5417     phoneUtils->GetTerminalTypeL( aTerminalType ); // Gets phone model + type
       
  5418     CleanupStack::PopAndDestroy( phoneUtils );
       
  5419     }
       
  5420 
       
  5421 // ---------------------------------------------------------------------------
       
  5422 // CNSmlDmVoIPAdapter::GetWlanMacAddressL
       
  5423 // Gets WLAN MAC address used in SIP User Agent Header (same as *#62209526#).
       
  5424 // ---------------------------------------------------------------------------
       
  5425 //
       
  5426 void CNSmlDmVoIPAdapter::GetWlanMacAddressL( TBuf<KWlanMacAddressLength>& 
       
  5427     aMac ) const
       
  5428     {
       
  5429     aMac.Zero(); // Reset before use
       
  5430 
       
  5431     CIPAppUtilsAddressResolver* resolver = CIPAppUtilsAddressResolver::NewLC();
       
  5432 
       
  5433     TBuf8<KWlanMacAddressLength> wlanmac;
       
  5434     _LIT8( KFormat, "-");
       
  5435     resolver->GetWlanMACAddress( wlanmac, KFormat );
       
  5436     //wlanmac buffer contains now the wlan mac address like 00-15-a0-99-10-ec
       
  5437     CleanupStack::PopAndDestroy( resolver );
       
  5438     aMac.Copy( wlanmac );
       
  5439 
       
  5440     }
       
  5441 
       
  5442 // ---------------------------------------------------------------------------
       
  5443 // CNSmlDmVoIPAdapter::GetNatFwUriL
       
  5444 // Get NAT/FW profile URI.
       
  5445 // ---------------------------------------------------------------------------
       
  5446 //
       
  5447 MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetNatFwUriL( 
       
  5448     TBuf16<KMaxUriLength>& aObject, TInt aProfileId ) const
       
  5449     {
       
  5450     DBG_PRINT("CNSmlDmVoIPAdapter::GetNatFwUriL : begin");
       
  5451 
       
  5452     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5453 
       
  5454     CBufBase* result = CBufFlat::NewL( 1 ); // CS:1
       
  5455     CleanupStack::PushL( result );
       
  5456     CSmlDmAdapter::TError errorStatus;
       
  5457 
       
  5458     // Get URIs to all DomainSpecific NAT/FW settings.
       
  5459     iDmCallback->FetchLinkL( KNSmlDMNATFWDomain(), *result, errorStatus );
       
  5460 
       
  5461     if ( CSmlDmAdapter::EOk != errorStatus )
       
  5462         {
       
  5463         CleanupStack::PopAndDestroy( result );
       
  5464         return errorStatus;
       
  5465         }
       
  5466 
       
  5467     result->Compress();
       
  5468     HBufC8* childList = HBufC8::NewLC( result->Size() ); // CS:2
       
  5469     TInt uriSegCount( 0 );
       
  5470 
       
  5471     if ( result->Size() )
       
  5472         {
       
  5473         childList->Des().Copy( result->Ptr(0) );
       
  5474         uriSegCount = NumOfURISegs( childList->Des() );
       
  5475         }
       
  5476 
       
  5477     for ( TInt index = 0; index < uriSegCount; index++ )
       
  5478         {
       
  5479         HBufC8* uri = HBufC8::NewLC( ( KMaxUriLength * KTwoSegs ) );// CS:3
       
  5480         uri->Des().Copy( KNSmlDMNATFWDomain );
       
  5481         uri->Des().Append( KNSmlDMVoIPSeparator() );
       
  5482         uri->Des().Append( LastURISeg( childList->Des() ) );
       
  5483         HBufC8* luid = HBufC8::NewLC( KMaxUriLength ); // CS:4
       
  5484         luid->Des().Copy( iDmCallback->GetLuidAllocL( uri->Des() )->Des() );
       
  5485         if ( luid->Des().Length() && 
       
  5486             aProfileId == DesToTUint( LastURISeg( luid->Des() ) ) )
       
  5487             {
       
  5488             aObject.Copy( uri->Des() );
       
  5489             // luid, uri
       
  5490             CleanupStack::PopAndDestroy( luid ); // CS:3
       
  5491             CleanupStack::PopAndDestroy( uri ); // CS:2
       
  5492             break;
       
  5493             }
       
  5494         // luid, uri
       
  5495         CleanupStack::PopAndDestroy( luid ); // CS:3
       
  5496         CleanupStack::PopAndDestroy( uri ); // CS:2
       
  5497         childList->Des().Copy( RemoveLastURISeg( childList->Des() ) );
       
  5498         }
       
  5499 
       
  5500     // childList, result
       
  5501     CleanupStack::PopAndDestroy( childList ); // CS:1
       
  5502     CleanupStack::PopAndDestroy( result ); // CS:0
       
  5503     DBG_PRINT("CNSmlDmVoIPAdapter::GetNatFwUriL : end");
       
  5504     return errorStatus;
       
  5505     }
       
  5506 
       
  5507 // ---------------------------------------------------------------------------
       
  5508 // CNSmlDmVoIPAdapter::NatFwIdL
       
  5509 // Get NAT/FW profile ID.
       
  5510 // ---------------------------------------------------------------------------
       
  5511 //
       
  5512 TUint32 CNSmlDmVoIPAdapter::NatFwIdL( const TDesC8& aObject ) const
       
  5513     {
       
  5514     DBG_PRINT("CNSmlDmVoIPAdapter::NatFwIdL : begin");
       
  5515 
       
  5516     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5517 
       
  5518     TUint32 profileId( KErrNone );
       
  5519     HBufC8* luid = HBufC8::NewLC( KMaxUriLength ); // CS:1
       
  5520     luid->Des().Copy( iDmCallback->GetLuidAllocL( aObject )->Des() );
       
  5521     if ( luid->Des().Length() )
       
  5522         {
       
  5523         profileId = DesToTUint( LastURISeg( luid->Des() ) );
       
  5524         }
       
  5525     CleanupStack::PopAndDestroy( luid ); // CS:0
       
  5526     DBG_PRINT("CNSmlDmVoIPAdapter::NatFwIdL : end");
       
  5527     return profileId;
       
  5528     }
       
  5529 
       
  5530 // ---------------------------------------------------------------------------
       
  5531 // CNSmlDmVoIPAdapter::GetConRefL
       
  5532 // Get DM URI for IAP.
       
  5533 // ---------------------------------------------------------------------------
       
  5534 //
       
  5535 MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetConRefL( CBufBase& aObject, 
       
  5536     TInt aIapId ) const
       
  5537     {
       
  5538     DBG_PRINT("CNSmlDmVoIPAdapter::GetConRefL() : begin");
       
  5539 
       
  5540     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5541 
       
  5542     TBool found = EFalse;
       
  5543     CNSmlDMIAPMatcher* iapMatch = CNSmlDMIAPMatcher::NewL( iDmCallback );
       
  5544     CleanupStack::PushL( iapMatch ); // CS:1
       
  5545     HBufC8* uri8 = iapMatch->URIFromIAPIdL( aIapId );
       
  5546     CleanupStack::PushL( uri8 ); // CS:2
       
  5547     if ( uri8 )
       
  5548         {
       
  5549         aObject.InsertL( aObject.Size(), uri8->Des() );
       
  5550         found = ETrue;
       
  5551         }
       
  5552     // uri8, iapMatch
       
  5553     CleanupStack::PopAndDestroy( uri8 ); // CS:1
       
  5554     CleanupStack::PopAndDestroy( iapMatch ); // CS:0
       
  5555     DBG_PRINT("CNSmlDmVoIPAdapter::GetConRefL() : end");
       
  5556     if ( !found )
       
  5557         {
       
  5558         return CSmlDmAdapter::ENotFound;
       
  5559         }
       
  5560     return CSmlDmAdapter::EOk;
       
  5561     }
       
  5562 
       
  5563 // ---------------------------------------------------------------------------
       
  5564 // CNSmlDmVoIPAdapter::ConRefL
       
  5565 // Get IAP ID (connection reference value) from given URI.
       
  5566 // ---------------------------------------------------------------------------
       
  5567 //
       
  5568 TInt CNSmlDmVoIPAdapter::ConRefL( const TDesC8& aObject ) const
       
  5569     {
       
  5570     DBG_PRINT("CNSmlDmVoIPAdapter::ConRefL() : begin");
       
  5571 
       
  5572     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5573 
       
  5574     CNSmlDMIAPMatcher* iapMatch = CNSmlDMIAPMatcher::NewL( iDmCallback );
       
  5575     CleanupStack::PushL( iapMatch );
       
  5576     TInt iapId = iapMatch->IAPIdFromURIL( aObject );
       
  5577     CleanupStack::PopAndDestroy( iapMatch ); 
       
  5578     DBG_PRINT("CNSmlDmVoIPAdapter::ConRefL() : end");
       
  5579     return iapId;
       
  5580     }
       
  5581 
       
  5582 // ---------------------------------------------------------------------------
       
  5583 // CNSmlDmVoIPAdapter::GetPresenceUriL
       
  5584 // Get Presence profile DM URI.
       
  5585 // ---------------------------------------------------------------------------
       
  5586 //
       
  5587 MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetPresenceUriL( 
       
  5588     TBuf16<KMaxUriLength>& aObject, TUint32 aProfileId ) const
       
  5589     {
       
  5590     DBG_PRINT("CNSmlDmVoIPAdapter::GetPresenceUriL : begin");
       
  5591 
       
  5592     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5593 
       
  5594     CBufBase* result = CBufFlat::NewL( 1 );
       
  5595     CleanupStack::PushL( result ); // CS:1
       
  5596     CSmlDmAdapter::TError errorStatus;
       
  5597 
       
  5598     // Get URIs to all Presence settings.
       
  5599     iDmCallback->FetchLinkL( KNSmlDMPresence(), *result, errorStatus );
       
  5600 
       
  5601     if ( CSmlDmAdapter::EOk != errorStatus )
       
  5602         {
       
  5603         CleanupStack::PopAndDestroy( result );
       
  5604         return errorStatus;
       
  5605         }
       
  5606 
       
  5607     result->Compress();
       
  5608     HBufC8* childList = HBufC8::NewLC( result->Size() ); // CS:2
       
  5609     TInt uriSegCount( 0 );
       
  5610 
       
  5611     if ( result->Size() )
       
  5612         {
       
  5613         childList->Des().Copy( result->Ptr( 0 ) );
       
  5614         uriSegCount = NumOfURISegs( childList->Des() );
       
  5615         }
       
  5616 
       
  5617     // Get LUIDs for URIs.
       
  5618     for ( TInt index = 0; index < uriSegCount; index++ )
       
  5619         {
       
  5620         HBufC8* uri = HBufC8::NewLC( KMaxUriLength ); // CS:3
       
  5621         HBufC8* luid = HBufC8::NewLC( KMaxUriLength ); // CS:4
       
  5622 
       
  5623         uri->Des().Copy( KNSmlDMPresence() );
       
  5624         uri->Des().Append( KNSmlDMVoIPSeparator() );
       
  5625         uri->Des().Append( LastURISeg( childList->Des() ) );
       
  5626         luid->Des().Copy( iDmCallback->GetLuidAllocL( uri->Des() )->Des() );
       
  5627         if ( luid->Des().Length() && 
       
  5628             aProfileId == DesToTUint( LastURISeg( luid->Des() ) ) )
       
  5629             {
       
  5630             aObject.Copy( uri->Des() );
       
  5631             // luid, uri
       
  5632             CleanupStack::PopAndDestroy( luid );  // CS:3
       
  5633             CleanupStack::PopAndDestroy( uri );  // CS:2
       
  5634             break;
       
  5635             }
       
  5636         childList->Des().Copy( RemoveLastURISeg( childList->Des() ) );
       
  5637         // luid, uri
       
  5638         CleanupStack::PopAndDestroy( luid );  // CS:3
       
  5639         CleanupStack::PopAndDestroy( uri );  // CS:2
       
  5640         }
       
  5641     // childList, result
       
  5642     CleanupStack::PopAndDestroy( childList );     // CS:1
       
  5643     CleanupStack::PopAndDestroy( result );     // CS:0
       
  5644     DBG_PRINT("CNSmlDmVoIPAdapter::GetPresenceUriL : end");
       
  5645     return errorStatus;
       
  5646     }
       
  5647 
       
  5648 // ---------------------------------------------------------------------------
       
  5649 // CNSmlDmVoIPAdapter::PresenceIdL
       
  5650 // Get Presence profile ID.
       
  5651 // ---------------------------------------------------------------------------
       
  5652 //
       
  5653 TUint32 CNSmlDmVoIPAdapter::PresenceIdL( const TDesC8& aObject ) const
       
  5654     {
       
  5655 #ifdef _DEBUG
       
  5656     TBuf<KMaxDebugPrintLength> object;
       
  5657     object.Copy( aObject );
       
  5658     DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL : begin uri: %S", &object );
       
  5659 #endif
       
  5660 
       
  5661     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5662     TPtrC8 uri = RemoveDotSlash( aObject );
       
  5663 
       
  5664     HBufC8* luid = iDmCallback->GetLuidAllocL( uri );
       
  5665     CleanupStack::PushL( luid ); //CS:1
       
  5666     
       
  5667     // check whether above found id is valid or not
       
  5668     TUint32 profileId;
       
  5669     if ( luid->Length() == KErrNone )
       
  5670         {
       
  5671         //try to find it another way
       
  5672         if( NSmlDmURI::NumOfURISegs( uri ) > 1 )
       
  5673             {
       
  5674             TPtrC8 idSegment = NSmlDmURI::URISeg( uri, 2 );
       
  5675             TBuf<KMaxDebugPrintLength> tempSegment;
       
  5676             tempSegment.Copy( idSegment );
       
  5677             DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL - idSegment:%S", &tempSegment );
       
  5678             profileId = DesToTUint(idSegment);
       
  5679             if(!IsPresIDValidL(profileId))
       
  5680                 {
       
  5681                 CleanupStack::PopAndDestroy( luid ); // CS:0
       
  5682                 DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : ID not valid - return KErrNone");
       
  5683                 return KErrNone;
       
  5684                 }
       
  5685             CleanupStack::PopAndDestroy( luid ); // CS:0
       
  5686             DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL - settingsId found local way:%d", profileId);
       
  5687             return profileId;
       
  5688             }
       
  5689         CleanupStack::PopAndDestroy( luid ); // CS:0
       
  5690         DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : ID not valid, too short uri");
       
  5691         return KErrNone;
       
  5692         }    
       
  5693     profileId = DesToTUint( *luid );
       
  5694     CleanupStack::PopAndDestroy( luid ); // CS:0
       
  5695     DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL : return profleId: %d", profileId );
       
  5696     return profileId;
       
  5697     }
       
  5698 
       
  5699 // -----------------------------------------------------------------------------
       
  5700 // CPresenceDMAdapter::IsPresIDValidL
       
  5701 // -----------------------------------------------------------------------------
       
  5702 //
       
  5703 TBool CNSmlDmVoIPAdapter::IsPresIDValidL( TUint32 aSetId ) const
       
  5704      {
       
  5705     TPresSettingsSet tempSet;
       
  5706     if ((PresSettingsApi::SettingsSetL( (TInt)aSetId,tempSet)) == KErrNone)
       
  5707         return ETrue;
       
  5708     DBG_PRINT2(" CNSmlDmVoIPAdapter::IsPresIDValidL - Invalid settings : %d", aSetId );
       
  5709     return EFalse;   
       
  5710     }
       
  5711 
       
  5712 // ---------------------------------------------------------------------------
       
  5713 // CNSmlDmVoIPAdapter::SnapIdL
       
  5714 // Gets SNAP ID based on URI.
       
  5715 // ---------------------------------------------------------------------------
       
  5716 //
       
  5717 TInt CNSmlDmVoIPAdapter::SnapIdL( const TDesC8& aUri )
       
  5718     {
       
  5719     DBG_PRINT( "CNSmlDmVoIPAdapter::SnapIdL - begin" );
       
  5720     TInt snapId( KErrNotFound );
       
  5721 
       
  5722     HBufC8* luid = HBufC8::NewLC( KNSmlVoIPMaxUriLength ); // CS:1
       
  5723     luid->Des().Copy( iDmCallback->GetLuidAllocL( aUri )->Des() );
       
  5724 
       
  5725     if ( luid->Des().Length() )
       
  5726         {
       
  5727         snapId = DesToInt( LastURISeg( luid->Des() ) );
       
  5728         }
       
  5729     CleanupStack::PopAndDestroy( luid ); // CS:0
       
  5730     DBG_PRINT( "CNSmlDmVoIPAdapter::SnapIdL - end" );
       
  5731     return snapId;
       
  5732     }
       
  5733 
       
  5734 // ---------------------------------------------------------------------------
       
  5735 // CNSmlDmVoIPAdapter::GetSnapUriL
       
  5736 // Set SNAP URI based on SNAP ID.
       
  5737 // ---------------------------------------------------------------------------
       
  5738 //
       
  5739 MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetSnapUriL( TDes8& aObject, 
       
  5740     TInt aSnapId )
       
  5741     {
       
  5742     __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
       
  5743 
       
  5744     DBG_PRINT( "CNSmlDmSIPAdapter::GetSnapUriL - begin" );
       
  5745 
       
  5746     CBufBase* result = CBufFlat::NewL( 1 );
       
  5747     CleanupStack::PushL( result ); // CS:1
       
  5748     CSmlDmAdapter::TError status;
       
  5749 
       
  5750     // Get URIs to all SNAP settings.
       
  5751     iDmCallback->FetchLinkL( KNSmlDMSnapUriPrefix(), *result, status );
       
  5752 
       
  5753     if ( CSmlDmAdapter::EOk != status )
       
  5754         {
       
  5755         CleanupStack::PopAndDestroy( result );
       
  5756         DBG_PRINT( "CNSmlDmVoIPAdapter::GetSnapUriL - Fetch SNAP error end" );
       
  5757         return status;
       
  5758         }
       
  5759 
       
  5760     result->Compress();
       
  5761     HBufC8* childList = HBufC8::NewLC( result->Size() ); // CS:2
       
  5762     TInt uriSegCount( 0 );
       
  5763 
       
  5764     if ( result->Size() )
       
  5765         {
       
  5766         childList->Des().Copy( result->Ptr( 0 ) );
       
  5767         uriSegCount = NumOfURISegs( childList->Des() );
       
  5768         }
       
  5769 
       
  5770     // Get LUIDs for URIs.
       
  5771     for ( TInt index = 0; index < uriSegCount; index++ )
       
  5772         {
       
  5773         HBufC8* uri = HBufC8::NewLC( KNSmlVoIPMaxUriLength ); // CS:3
       
  5774         HBufC8* luid = HBufC8::NewLC( KNSmlVoIPMaxUriLength ); // CS:4
       
  5775 
       
  5776         uri->Des().Copy( KNSmlDMSnapUriPrefix() );
       
  5777         uri->Des().Append( KNSmlDMVoIPSeparator() );
       
  5778         uri->Des().Append( LastURISeg( childList->Des() ) );
       
  5779         luid->Des().Copy( iDmCallback->GetLuidAllocL( uri->Des() )->Des() );
       
  5780         if ( luid->Des().Length() && 
       
  5781             aSnapId == DesToInt( LastURISeg( luid->Des() ) ) )
       
  5782             {
       
  5783             aObject.Copy( uri->Des() );
       
  5784             // luid, uri
       
  5785             CleanupStack::PopAndDestroy( luid );  // CS:3
       
  5786             CleanupStack::PopAndDestroy( uri );  // CS:2
       
  5787             break;
       
  5788             }
       
  5789         childList->Des().Copy( RemoveLastURISeg( childList->Des() ) );
       
  5790         // luid, uri
       
  5791         CleanupStack::PopAndDestroy( luid );  // CS:3
       
  5792         CleanupStack::PopAndDestroy( uri );  // CS:2
       
  5793         }
       
  5794     // childList, result
       
  5795     CleanupStack::PopAndDestroy( childList );  // CS:1
       
  5796     CleanupStack::PopAndDestroy( result );  // CS:0
       
  5797     DBG_PRINT( "CNSmlDmVoIPAdapter::GetSnapUriL - end" );
       
  5798     return status;
       
  5799     }
       
  5800 
       
  5801 // End of file.