callcontinuity/nsmldmvccadapter/src/nsmldmvccadapter.cpp
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Implementation file for nsmldmvccadapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <escapeutils.h>
       
    21 #include <spentry.h>
       
    22 #include <spproperty.h>
       
    23 #include <nsmldmuri.h>
       
    24 #include <crcseprofileentry.h>
       
    25 #include <crcseprofileregistry.h>
       
    26 
       
    27 #include "nsmldmvccadapter.h"
       
    28 #include "vccspsettings.h"
       
    29 #include "vccmiscutils.h"
       
    30 #include "rubydebug.h"
       
    31 
       
    32 
       
    33 const TInt KNSmlDMVCC_DefaultResultSize = 255;
       
    34 
       
    35 /** VCC DDF keywords */
       
    36 _LIT8( KNSmlDMVCC_DDFVersion,               "1.0" );
       
    37 _LIT8( KNSmlDMVCC_Node,                     "VCC001" );
       
    38 _LIT( KNSmlDMVCC_ServiceName,               "VCC" );
       
    39 
       
    40 /** VCC */ 
       
    41 _LIT8( KNSmlDMVCC_Name,                     "Name" );
       
    42 _LIT8( KNSmlDMVCC_VDI,                      "VDI" );
       
    43 _LIT8( KNSmlDMVCC_VDN,                      "VDN" );
       
    44 _LIT8( KNSmlDMVCC_PreferredDomain,          "Preferred Domain" );
       
    45 _LIT8( KNSmlDMVCC_ImmediateDT,              "Immediate DT" );
       
    46 _LIT8( KNSmlDMVCC_DTCsToIM,                 "DT CS-to-IM CN direction" );
       
    47 _LIT8( KNSmlDMVCC_DTIMToCs,                 "DT IM CN-to-CS direction" );
       
    48 _LIT8( KNSmlDMVCC_DTHeldWaitingCalls,       "DT in held_waiting calls" );
       
    49 
       
    50 _LIT8( KNSmlDMVCC_WlanHOTreshold, 			"WLAN HO Treshold" );
       
    51 _LIT8( KNSmlDMVCC_WlanHOHysteresis,			"WLAN HO Hysteresis" );
       
    52 _LIT8( KNSmlDMVCC_WlanHysteresisTimerLow, 	"WLAN Hysteresis Timer Low" );
       
    53 _LIT8( KNSmlDMVCC_WlanHysteresisTimerHigh, 	"WLAN Hysteresis Timer High" );
       
    54 _LIT8( KNSmlDMVCC_CSHOTreshold, 			"CS HO Treshold" );
       
    55 _LIT8( KNSmlDMVCC_CSHOHysteresis, 			"CS HO Hysteresis" );
       
    56 _LIT8( KNSmlDMVCC_CSHysteresisTimerLow,		"CS Hysteresis Timer Low" );
       
    57 _LIT8( KNSmlDMVCC_CSHysteresisTimerHigh, 	"CS Hysteresis Timer High" );
       
    58 _LIT8( KNSmlDMVCC_VoipServiceId, 			"VoIP" );
       
    59 _LIT8( KNSmlDMVCC_DtAllowedWhenCsOriginated,"DT Allowed When CS Originated" );
       
    60 
       
    61 _LIT8( KNSmlDMVCC_NodeExp,                  "Main node for VCC settings" );
       
    62 _LIT8( KNSmlDMVCC_NameExp,                  "Name for the Communication Continuity settings" );
       
    63 _LIT8( KNSmlDMVCC_VDIExp,                   "VCC Transfer URI " );
       
    64 _LIT8( KNSmlDMVCC_VDNExp,                   "VCC Transfer Number" );
       
    65 _LIT8( KNSmlDMVCC_PreferredDomainExp,       "Preferred domain for UE originated calls/sessions" );
       
    66 _LIT8( KNSmlDMVCC_ImmediateDTExp,           "Initiate a VCC DT immediately when domain available or not" );
       
    67 _LIT8( KNSmlDMVCC_DTCsToIMExp,              "DT from CS domain to PS is restricted or not" );
       
    68 _LIT8( KNSmlDMVCC_DTIMToCsExp,              "DT from PS domain to CS is restricted or not" );
       
    69 _LIT8( KNSmlDMVCC_DTHeldWaitingCallsExp,    "DT restricted during active and a held/waiting call/session" );
       
    70 _LIT8( KNSmlDMVCC_WlanHOTresholdExp, 		"Handover signal strength treshold value for WLAN" );
       
    71 _LIT8( KNSmlDMVCC_WlanHOHysteresisExp,		"Handover hysteresis value for WLAN" );
       
    72 _LIT8( KNSmlDMVCC_WlanHysteresisTimerLowExp,"Handover hysteresis timer value for WLAN used below treshold" );
       
    73 _LIT8( KNSmlDMVCC_WlanHysteresisTimerHighExp, 	"Handover hysteresis timer value for WLAN used above treshold" );
       
    74 _LIT8( KNSmlDMVCC_CSHOTresholdExp, 			"Handover signal strength treshold value for CS" );
       
    75 _LIT8( KNSmlDMVCC_CSHOHysteresisExp, 		"Handover hysteresis value for CS" );
       
    76 _LIT8( KNSmlDMVCC_CSHysteresisTimerLowExp,	"Handover hysteresis timer value for CS used below treshold" );
       
    77 _LIT8( KNSmlDMVCC_CSHysteresisTimerHighExp, "Handover hysteresis timer value for CS used above treshold" );
       
    78 _LIT8( KNSmlDMVCC_VoipServiceIdExp, 		"VoIP Service Id to be associated with VCC" );
       
    79 _LIT8( KNSmlDMVCC_DmToConRef, 				"ToConRef" );
       
    80 _LIT8( KNSmlDMVCC_DmConRef, 				"ConRef" );
       
    81 _LIT8( KNSmlDMVCC_DmToConRefExp, 			"Refers to a collection of connectivity definitions" );
       
    82 _LIT8( KNSmlDMVCC_DmConRefExp,		 		"Indicates the linkage to connectivity parameters" );
       
    83 
       
    84 _LIT8( KNSmlDMVCC_DmVoipLinkPrefix, 			"./VoIP");
       
    85 _LIT8( KNSmlDMVCC_DmVoipId,					"VoIPId");
       
    86 _LIT8( KNSmlDMVCC_DmVoip,					"VoIP");
       
    87 _LIT( KVccServiceName,               		"VCC" );
       
    88 
       
    89 
       
    90 /** Others */
       
    91 _LIT8( KNSmlDMVCCTextPlain,                 "text/plain" );
       
    92 _LIT8( KNSmlDMVCCSeparator,                 "/" );
       
    93 _LIT( KNSmlDMVCCValueNullDesc,              "" );
       
    94 _LIT( KNSmlDMVCCValueZero,                 "0" );
       
    95 
       
    96 const TInt KNSmlDMVCCSeparatorChar            = '/';
       
    97 const TInt KNSmlDMVCCDefaultResultSize        = 64;
       
    98 const TInt KNSmlDMVCCMaxResultLength          = 256;
       
    99 const TInt  KNSmlDMVCCMaxUriLength            = 100;
       
   100 
       
   101 
       
   102 // ======== LOCAL FUNCTIONS ========
       
   103 
       
   104 // ======== MEMBER FUNCTIONS ========
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // C++ Constructor
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 CNSmlDmVCCAdapter::CNSmlDmVCCAdapter( TAny* aEcomArguments )
       
   111 : CSmlDmAdapter( aEcomArguments )
       
   112     {
       
   113     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::CNSmlDmVCCAdapter" );
       
   114     }
       
   115 
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // Second phase constructor
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 void CNSmlDmVCCAdapter::ConstructL()
       
   122     {
       
   123     RUBY_DEBUG_BLOCKL( "CNSmlDmVCCAdapter::ConstructL" );
       
   124     iVCCSettings = CVccSPSettings::NewL();
       
   125     iVCCSettings->SetServiceNameL( KNSmlDMVCC_ServiceName );
       
   126     iVCCSettings->ReadSettingsL( KVccServiceName );
       
   127     }
       
   128 
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // Two-phased constructor
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 CNSmlDmVCCAdapter* CNSmlDmVCCAdapter::NewL( MSmlDmCallback* aDmCallback )
       
   135     {
       
   136     RUBY_DEBUG_BLOCKL( "CNSmlDmVCCAdapter::NewL" );
       
   137     CNSmlDmVCCAdapter* self = CNSmlDmVCCAdapter::NewLC( aDmCallback );
       
   138     CleanupStack::Pop( self );
       
   139     return self;
       
   140     }
       
   141 
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // Two-phased constructor
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 CNSmlDmVCCAdapter* CNSmlDmVCCAdapter::NewLC( MSmlDmCallback* aDmCallback )
       
   148     {
       
   149     RUBY_DEBUG0( "CNSmlDmVCCAdapter::NewLC --Start" );
       
   150     CNSmlDmVCCAdapter* self = new( ELeave ) CNSmlDmVCCAdapter( aDmCallback );
       
   151     CleanupStack::PushL( self );
       
   152     self->ConstructL();
       
   153     RUBY_DEBUG0( "CNSmlDmVCCAdapter::NewLC --End" );
       
   154     return self;
       
   155     }
       
   156 
       
   157 
       
   158 // ---------------------------------------------------------------------------
       
   159 // Destructor
       
   160 // ---------------------------------------------------------------------------
       
   161 //
       
   162 CNSmlDmVCCAdapter::~CNSmlDmVCCAdapter()
       
   163     {
       
   164     RUBY_DEBUG0( "CNSmlDmVCCAdapter::~CNSmlDmVCCAdapter() - ENTER" );
       
   165     delete iVCCSettings;
       
   166     delete iTempBuf;
       
   167     RUBY_DEBUG0( "CNSmlDmVCCAdapter::~CNSmlDmVCCAdapter() - EXIT" );
       
   168     }
       
   169 
       
   170 // ---------------------------------------------------------------------------
       
   171 //  
       
   172 // ---------------------------------------------------------------------------
       
   173 //
       
   174 void CNSmlDmVCCAdapter::DDFVersionL( CBufBase& aVersion )
       
   175     {
       
   176     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::DDFVersionL" );
       
   177     aVersion.InsertL( 0,KNSmlDMVCC_DDFVersion );
       
   178     }
       
   179 
       
   180 // ---------------------------------------------------------------------------
       
   181 //  
       
   182 // ---------------------------------------------------------------------------
       
   183 //
       
   184 void CNSmlDmVCCAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
       
   185     {
       
   186     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::DDFStructureL" );
       
   187   
       
   188     TSmlDmAccessTypes accessTypesGet;
       
   189     accessTypesGet.SetGet();
       
   190 
       
   191     TSmlDmAccessTypes accessTypesGetReplace;
       
   192     accessTypesGetReplace.SetGet();
       
   193     accessTypesGetReplace.SetReplace();
       
   194      
       
   195     
       
   196     // Main node
       
   197     MSmlDmDDFObject& vccNode = aDDF.AddChildObjectL( KNSmlDMVCC_Node );
       
   198     vccNode.SetAccessTypesL( accessTypesGet );
       
   199     vccNode.SetOccurenceL( MSmlDmDDFObject::EOneOrMore );
       
   200     vccNode.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   201     vccNode.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   202     vccNode.SetDescriptionL( KNSmlDMVCC_NodeExp );
       
   203     
       
   204     // Name leaf -read only
       
   205     MSmlDmDDFObject& vccName = vccNode.AddChildObjectL( KNSmlDMVCC_Name );    
       
   206     vccName.SetAccessTypesL( accessTypesGet );
       
   207     vccName.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
       
   208     vccName.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   209     vccName.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   210     vccName.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   211     vccName.SetDescriptionL( KNSmlDMVCC_NameExp );
       
   212     
       
   213     // VDI leaf
       
   214     MSmlDmDDFObject& vccVDI = vccNode.AddChildObjectL( KNSmlDMVCC_VDI );    
       
   215     vccVDI.SetAccessTypesL( accessTypesGetReplace );
       
   216     vccVDI.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   217     vccVDI.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   218     vccVDI.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   219     vccVDI.SetDescriptionL( KNSmlDMVCC_VDIExp );
       
   220     
       
   221     // VDN leaf
       
   222     MSmlDmDDFObject& vccVDN = vccNode.AddChildObjectL( KNSmlDMVCC_VDN );
       
   223     vccVDN.SetAccessTypesL( accessTypesGetReplace );
       
   224     vccVDN.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   225     vccVDN.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   226     vccVDN.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   227     vccVDN.SetDescriptionL( KNSmlDMVCC_VDNExp );
       
   228     
       
   229     // Preferred domain leaf
       
   230     MSmlDmDDFObject& vccPD = 
       
   231                           vccNode.AddChildObjectL( KNSmlDMVCC_PreferredDomain );
       
   232     vccPD.SetAccessTypesL( accessTypesGetReplace );
       
   233     vccPD.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   234     vccPD.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   235     vccPD.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   236     vccPD.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   237     vccPD.SetDescriptionL( KNSmlDMVCC_PreferredDomainExp );
       
   238     
       
   239     // Immediate DT leaf
       
   240     MSmlDmDDFObject& vccIDT = vccNode.AddChildObjectL( KNSmlDMVCC_ImmediateDT );
       
   241     vccIDT.SetAccessTypesL( accessTypesGetReplace );
       
   242     vccIDT.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   243     vccIDT.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   244     vccIDT.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   245     vccIDT.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   246     vccIDT.SetDescriptionL( KNSmlDMVCC_ImmediateDTExp );
       
   247     
       
   248     // CS to PS leaf
       
   249     MSmlDmDDFObject& vccDTCS = vccNode.AddChildObjectL( KNSmlDMVCC_DTCsToIM );
       
   250     vccDTCS.SetAccessTypesL( accessTypesGetReplace );
       
   251     vccDTCS.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   252     vccDTCS.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   253     vccDTCS.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   254     vccDTCS.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   255     vccDTCS.SetDescriptionL( KNSmlDMVCC_DTCsToIMExp );
       
   256     
       
   257     // PS to CS leaf
       
   258     MSmlDmDDFObject& vccDTIM = vccNode.AddChildObjectL( KNSmlDMVCC_DTIMToCs );
       
   259     vccDTIM.SetAccessTypesL( accessTypesGetReplace );
       
   260     vccDTIM.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   261     vccDTIM.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   262     vccDTIM.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   263     vccDTIM.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   264     vccDTIM.SetDescriptionL( KNSmlDMVCC_DTIMToCsExp );
       
   265     
       
   266     // DT restricted while held or waiting calls leaf
       
   267     MSmlDmDDFObject& vccDTHeld = 
       
   268                        vccNode.AddChildObjectL( KNSmlDMVCC_DTHeldWaitingCalls );
       
   269     vccDTHeld.SetAccessTypesL( accessTypesGetReplace );
       
   270     vccDTHeld.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   271     vccDTHeld.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   272     vccDTHeld.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   273     vccDTHeld.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   274     vccDTHeld.SetDescriptionL( KNSmlDMVCC_DTHeldWaitingCallsExp );
       
   275     
       
   276     // DT Allowed when CS Originated Call
       
   277     MSmlDmDDFObject& vccDTAllowedWhenCsOrig = 
       
   278                vccNode.AddChildObjectL( KNSmlDMVCC_DtAllowedWhenCsOriginated );
       
   279     vccDTAllowedWhenCsOrig.SetAccessTypesL( accessTypesGetReplace );
       
   280     vccDTAllowedWhenCsOrig.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   281     vccDTAllowedWhenCsOrig.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   282     vccDTAllowedWhenCsOrig.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   283     vccDTAllowedWhenCsOrig.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   284     vccDTAllowedWhenCsOrig.SetDescriptionL( KNSmlDMVCC_DtAllowedWhenCsOriginated );
       
   285         
       
   286     
       
   287     // WLAN HO treshold leaf
       
   288     MSmlDmDDFObject& vccWLANHotreshold = 
       
   289                        vccNode.AddChildObjectL( KNSmlDMVCC_WlanHOTreshold );
       
   290     vccWLANHotreshold.SetAccessTypesL( accessTypesGetReplace );
       
   291     vccWLANHotreshold.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   292     vccWLANHotreshold.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   293     vccWLANHotreshold.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   294     vccWLANHotreshold.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   295     vccWLANHotreshold.SetDescriptionL( KNSmlDMVCC_WlanHOTresholdExp );
       
   296     
       
   297     // WLAN HO hysteresis leaf
       
   298     MSmlDmDDFObject& vccWLANHoHysteresis = 
       
   299                        vccNode.AddChildObjectL( KNSmlDMVCC_WlanHOHysteresis );
       
   300     vccWLANHoHysteresis.SetAccessTypesL( accessTypesGetReplace );
       
   301     vccWLANHoHysteresis.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   302     vccWLANHoHysteresis.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   303     vccWLANHoHysteresis.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   304     vccWLANHoHysteresis.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   305     vccWLANHoHysteresis.SetDescriptionL( KNSmlDMVCC_WlanHOHysteresisExp );
       
   306     
       
   307     // WLAN HO hysteresis timer low leaf
       
   308     MSmlDmDDFObject& vccWLANHoHysteresisTimerLow = 
       
   309                        vccNode.AddChildObjectL( KNSmlDMVCC_WlanHysteresisTimerLow );
       
   310     vccWLANHoHysteresisTimerLow.SetAccessTypesL( accessTypesGetReplace );
       
   311     vccWLANHoHysteresisTimerLow.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   312     vccWLANHoHysteresisTimerLow.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   313     vccWLANHoHysteresisTimerLow.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   314     vccWLANHoHysteresisTimerLow.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   315     vccWLANHoHysteresisTimerLow.SetDescriptionL( KNSmlDMVCC_WlanHysteresisTimerLowExp );
       
   316     
       
   317     // WLAN HO hysteresis timer high leaf
       
   318     MSmlDmDDFObject& vccWLANHoHysteresisTimerHigh = 
       
   319                        vccNode.AddChildObjectL( KNSmlDMVCC_WlanHysteresisTimerHigh );
       
   320     vccWLANHoHysteresisTimerHigh.SetAccessTypesL( accessTypesGetReplace );
       
   321     vccWLANHoHysteresisTimerHigh.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   322     vccWLANHoHysteresisTimerHigh.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   323     vccWLANHoHysteresisTimerHigh.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   324     vccWLANHoHysteresisTimerHigh.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   325     vccWLANHoHysteresisTimerHigh.SetDescriptionL( KNSmlDMVCC_WlanHysteresisTimerHighExp );
       
   326     
       
   327     // CS HO treshold leaf
       
   328     MSmlDmDDFObject& vccCSHotreshold = 
       
   329                        vccNode.AddChildObjectL( KNSmlDMVCC_CSHOTreshold );
       
   330     vccCSHotreshold.SetAccessTypesL( accessTypesGetReplace );
       
   331     vccCSHotreshold.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   332     vccCSHotreshold.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   333     vccCSHotreshold.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   334     vccCSHotreshold.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   335     vccCSHotreshold.SetDescriptionL( KNSmlDMVCC_CSHOTresholdExp );
       
   336     
       
   337     // CS HO hysteresis leaf
       
   338     MSmlDmDDFObject& vccCSHoHysteresis = 
       
   339                        vccNode.AddChildObjectL( KNSmlDMVCC_CSHOHysteresis );
       
   340     vccCSHoHysteresis.SetAccessTypesL( accessTypesGetReplace );
       
   341     vccCSHoHysteresis.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   342     vccCSHoHysteresis.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   343     vccCSHoHysteresis.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   344     vccCSHoHysteresis.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   345     vccCSHoHysteresis.SetDescriptionL( KNSmlDMVCC_CSHOHysteresisExp );
       
   346     
       
   347     // CS HO hysteresis timer low leaf
       
   348     MSmlDmDDFObject& vccCSHoHysteresisTimerLow = 
       
   349                        vccNode.AddChildObjectL( KNSmlDMVCC_CSHysteresisTimerLow );
       
   350     vccCSHoHysteresisTimerLow.SetAccessTypesL( accessTypesGetReplace );
       
   351     vccCSHoHysteresisTimerLow.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   352     vccCSHoHysteresisTimerLow.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   353     vccCSHoHysteresisTimerLow.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   354     vccCSHoHysteresisTimerLow.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   355     vccCSHoHysteresisTimerLow.SetDescriptionL( KNSmlDMVCC_CSHysteresisTimerLowExp );
       
   356     
       
   357     // CS HO hysteresis timer high leaf
       
   358     MSmlDmDDFObject& vccCSHoHysteresisTimerHigh = 
       
   359                        vccNode.AddChildObjectL( KNSmlDMVCC_CSHysteresisTimerHigh );
       
   360     vccCSHoHysteresisTimerHigh.SetAccessTypesL( accessTypesGetReplace );
       
   361     vccCSHoHysteresisTimerHigh.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   362     vccCSHoHysteresisTimerHigh.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   363     vccCSHoHysteresisTimerHigh.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   364     vccCSHoHysteresisTimerHigh.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
       
   365     vccCSHoHysteresisTimerHigh.SetDescriptionL( KNSmlDMVCC_CSHysteresisTimerHighExp );
       
   366     
       
   367     // ./VCC001/ToConRef/
       
   368     
       
   369     MSmlDmDDFObject& toConRefNode = vccNode.AddChildObjectL(KNSmlDMVCC_DmToConRef);
       
   370     toConRefNode.SetAccessTypesL( accessTypesGet );
       
   371     toConRefNode.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   372     toConRefNode.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   373     toConRefNode.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   374     toConRefNode.SetDescriptionL( KNSmlDMVCC_DmToConRefExp );
       
   375     
       
   376     // ./VCC001/ToConRef/VoIP
       
   377         
       
   378     MSmlDmDDFObject& voipNode = toConRefNode.AddChildObjectL( KNSmlDMVCC_VoipServiceId );
       
   379     voipNode.SetAccessTypesL( accessTypesGet );
       
   380     voipNode.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   381     voipNode.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   382     voipNode.SetDFFormatL( MSmlDmDDFObject::ENode );
       
   383     voipNode.SetDescriptionL( KNSmlDMVCC_VoipServiceIdExp );
       
   384     
       
   385     // ./VCC001/ToConRef/VoIP/ConRef
       
   386     
       
   387     MSmlDmDDFObject& conRefVoipNode = voipNode.AddChildObjectL(KNSmlDMVCC_DmConRef);
       
   388     conRefVoipNode.SetAccessTypesL( accessTypesGetReplace );
       
   389     conRefVoipNode.SetOccurenceL( MSmlDmDDFObject::EOne );
       
   390     conRefVoipNode.SetScopeL( MSmlDmDDFObject::EDynamic );
       
   391     conRefVoipNode.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   392     conRefVoipNode.SetDescriptionL( KNSmlDMVCC_DmConRefExp );
       
   393         
       
   394     // !NOTE! Ext node not inserted yet
       
   395   }
       
   396 
       
   397 // ---------------------------------------------------------------------------
       
   398 //  Note: HBufC* buf points to member iTempBuf that is deleted every time 
       
   399 //  ConvertToUnicodeL is called and in class' destructor.
       
   400 // ---------------------------------------------------------------------------
       
   401 //
       
   402 void CNSmlDmVCCAdapter::UpdateLeafObjectL( const TDesC8& aURI, 
       
   403             const TDesC8& /*aLUID*/, const TDesC8& aObject, 
       
   404             const TDesC8& /*aType*/, TInt aStatusRef )
       
   405     {
       
   406     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::UpdateLeafObjectL" );
       
   407   	RUBY_DEBUG0( "ReadSPSettings" );
       
   408   	iVCCSettings->ReadSettingsL( KVccServiceName );
       
   409     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
   410     HBufC* buf = ConvertToUnicodeL( aObject );
       
   411     
       
   412     // Find the last leaf in URI
       
   413     TPtrC8 uriSeg( LastURISeg( aURI ) );
       
   414   
       
   415     if ( KNSmlDMVCC_Name() == uriSeg )
       
   416         {
       
   417         // Don't do anything at the moment
       
   418         //iVCCSettings->SetNameL( aObject );
       
   419         }
       
   420     else if ( KNSmlDMVCC_VDI() == uriSeg )
       
   421         {
       
   422         if ( KErrNone != iVCCSettings->SetVdiL( buf->Des() ) )
       
   423             {
       
   424             retValue = CSmlDmAdapter::EInvalidObject;
       
   425             }
       
   426         }
       
   427     else if ( KNSmlDMVCC_VDN() == uriSeg )
       
   428         {
       
   429         if ( !( iVCCSettings->SetVdnL( buf->Des() ) ) )
       
   430             {
       
   431             retValue = CSmlDmAdapter::EInvalidObject;
       
   432             }
       
   433         }
       
   434     else if ( KNSmlDMVCC_PreferredDomain() == uriSeg )
       
   435         {
       
   436         TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
       
   437     
       
   438         switch ( value )
       
   439             {
       
   440             case 0:
       
   441             case 1:
       
   442             case 2:
       
   443             case 3:
       
   444                 iVCCSettings->SetPreferredDomainL( buf->Des() );
       
   445                 break;
       
   446             default:
       
   447                 retValue = CSmlDmAdapter::EInvalidObject;
       
   448                 break;
       
   449           }
       
   450         }
       
   451     else if ( KNSmlDMVCC_ImmediateDT() == uriSeg )
       
   452         {
       
   453         TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
       
   454     
       
   455         switch ( value )
       
   456             {
       
   457             case 0:
       
   458             case 1:
       
   459                 iVCCSettings->SetImmediateDtL( buf->Des() );
       
   460                 break;
       
   461             default:
       
   462                 retValue = CSmlDmAdapter::EInvalidObject;
       
   463                 break;
       
   464             }
       
   465         }
       
   466     else if ( KNSmlDMVCC_DTCsToIM() == uriSeg )
       
   467         {
       
   468         TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
       
   469         
       
   470         switch ( value )
       
   471             {
       
   472             case 0:
       
   473             case 1:
       
   474                 iVCCSettings->SetDtCsToPsAllowedL( buf->Des() );
       
   475                 break;
       
   476             default:
       
   477                 retValue = CSmlDmAdapter::EInvalidObject;
       
   478                 break;
       
   479             }
       
   480         }
       
   481     else if ( KNSmlDMVCC_DTIMToCs() == uriSeg )
       
   482         {
       
   483         TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
       
   484     
       
   485         switch ( value )
       
   486             {
       
   487             case 0:
       
   488             case 1:
       
   489                 iVCCSettings->SetDtPsToCsAllowedL( buf->Des() );
       
   490                 break;
       
   491             default:
       
   492                 retValue = CSmlDmAdapter::EInvalidObject;
       
   493                 break;
       
   494             }
       
   495         }
       
   496     else if ( KNSmlDMVCC_DtAllowedWhenCsOriginated() == uriSeg )
       
   497         {
       
   498         TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
       
   499         
       
   500         switch ( value )
       
   501             {
       
   502             case 0:
       
   503             case 1:
       
   504                 iVCCSettings->SetDtAllowedWhenCsOriginated( buf->Des() );
       
   505                 break;
       
   506             default:
       
   507                 retValue = CSmlDmAdapter::EInvalidObject;
       
   508                 break;
       
   509             }
       
   510         }
       
   511     
       
   512     else if ( KNSmlDMVCC_DTHeldWaitingCalls() == uriSeg )
       
   513         {
       
   514         TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
       
   515 
       
   516         switch ( value )
       
   517             {
       
   518             case 0:
       
   519             case 1:
       
   520                 iVCCSettings->SetDtHeldWaitingCallsAllowedL( buf->Des() );
       
   521                 break;
       
   522             default:
       
   523                 retValue = CSmlDmAdapter::EInvalidObject;
       
   524                 break;
       
   525             }
       
   526         }
       
   527            
       
   528     else if ( KNSmlDMVCC_WlanHOTreshold() == uriSeg )
       
   529         {
       
   530         iVCCSettings->SetDtWlanHoTresholdL( buf->Des() );
       
   531         }
       
   532     else if ( KNSmlDMVCC_WlanHOHysteresis() == uriSeg )
       
   533         {
       
   534         iVCCSettings->SetDtWlanHoHysteresisL( buf->Des() );
       
   535         }
       
   536     else if ( KNSmlDMVCC_WlanHysteresisTimerLow() == uriSeg )
       
   537         {
       
   538         iVCCSettings->SetDtWlanHoHysteresisTimerLowL( buf->Des() );
       
   539         }
       
   540     else if ( KNSmlDMVCC_WlanHysteresisTimerHigh() == uriSeg )
       
   541         {
       
   542         iVCCSettings->SetDtWlanHoHysteresisTimerHighL( buf->Des() );
       
   543         }
       
   544     
       
   545     else if ( KNSmlDMVCC_CSHOTreshold() == uriSeg )
       
   546         {
       
   547         iVCCSettings->SetDtCsHoTresholdL( buf->Des() );
       
   548         }
       
   549     else if ( KNSmlDMVCC_CSHOHysteresis() == uriSeg )
       
   550         {
       
   551         iVCCSettings->SetDtCsHoHysteresisL( buf->Des() );
       
   552         }
       
   553     else if ( KNSmlDMVCC_CSHysteresisTimerLow() == uriSeg )
       
   554         {
       
   555         iVCCSettings->SetDtCsHoHysteresisTimerLowL( buf->Des() );
       
   556         }
       
   557     else if ( KNSmlDMVCC_CSHysteresisTimerHigh() == uriSeg )
       
   558         {
       
   559         iVCCSettings->SetDtCsHoHysteresisTimerHighL( buf->Des() );
       
   560         }
       
   561     else if ( KNSmlDMVCC_DmConRef() == uriSeg )
       
   562         {
       
   563         retValue = UpdateVoipConRefL(aURI, aObject);
       
   564         }
       
   565         
       
   566     else
       
   567         { // No recognized leaf object found
       
   568         retValue = CSmlDmAdapter::EInvalidObject;
       
   569         }
       
   570   
       
   571     if ( CSmlDmAdapter::EOk == retValue )
       
   572         {
       
   573         RUBY_DEBUG0( "StoreSPSettings" );
       
   574         // Set operation successfull, store changes into SP Settings table
       
   575         iVCCSettings->StoreL();
       
   576         }
       
   577   
       
   578     Callback().SetStatusL( aStatusRef, retValue ); 
       
   579     }
       
   580 
       
   581 // ---------------------------------------------------------------------------
       
   582 //  
       
   583 // ---------------------------------------------------------------------------
       
   584 //
       
   585 void CNSmlDmVCCAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, 
       
   586             const TDesC8& /*aLUID*/,
       
   587                   RWriteStream*& /*aStream*/, const TDesC8& /*aType*/,
       
   588                   TInt aStatusRef )
       
   589     {
       
   590     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::UpdateLeafObjectL -stream" );
       
   591     Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
       
   592     }
       
   593 
       
   594 // ---------------------------------------------------------------------------
       
   595 //  
       
   596 // ---------------------------------------------------------------------------
       
   597 //
       
   598 void CNSmlDmVCCAdapter::DeleteObjectL( const TDesC8& aURI,
       
   599                                        const TDesC8& /*aLUID*/, 
       
   600                                        TInt aStatusRef )
       
   601     {
       
   602     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::DeleteObjectL" );
       
   603    	iVCCSettings->ReadSettingsL( KVccServiceName );
       
   604     
       
   605     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
   606     TPtrC8 uriSeg( LastURISeg( aURI ) );
       
   607   
       
   608     if ( KNSmlDMVCC_Name() == uriSeg )
       
   609         {
       
   610         // Don't do anything at the moment
       
   611         //iVCCSettings->SetNameL( KNSmlDMVCCValueNullDesc );
       
   612         }
       
   613     else if ( KNSmlDMVCC_VDI() == uriSeg )
       
   614         {
       
   615         iVCCSettings->SetVdiL( KNSmlDMVCCValueNullDesc );
       
   616         }
       
   617     else if ( KNSmlDMVCC_VDN() == uriSeg )
       
   618         {
       
   619         iVCCSettings->SetVdnL( KNSmlDMVCCValueNullDesc );
       
   620         }
       
   621     else if ( KNSmlDMVCC_PreferredDomain() == uriSeg )
       
   622         {
       
   623         iVCCSettings->SetPreferredDomainL( KNSmlDMVCCValueZero );
       
   624         }
       
   625     else if ( KNSmlDMVCC_ImmediateDT() == uriSeg )
       
   626         {
       
   627         iVCCSettings->SetImmediateDtL( KNSmlDMVCCValueZero );
       
   628         }
       
   629     else if ( KNSmlDMVCC_DTCsToIM() == uriSeg )
       
   630         {
       
   631         iVCCSettings->SetDtCsToPsAllowedL( KNSmlDMVCCValueZero );
       
   632         }
       
   633     else if ( KNSmlDMVCC_DTIMToCs() == uriSeg )
       
   634         {
       
   635         iVCCSettings->SetDtPsToCsAllowedL( KNSmlDMVCCValueZero );
       
   636         }
       
   637     else if ( KNSmlDMVCC_DTHeldWaitingCalls() == uriSeg )
       
   638         {
       
   639         iVCCSettings->SetDtHeldWaitingCallsAllowedL( KNSmlDMVCCValueZero );
       
   640         }
       
   641      else if ( KNSmlDMVCC_WlanHOTreshold() == uriSeg )
       
   642         {
       
   643         iVCCSettings->SetDtWlanHoTresholdL( KNSmlDMVCCValueZero );
       
   644         }
       
   645     else if ( KNSmlDMVCC_WlanHOHysteresis() == uriSeg )
       
   646         {
       
   647         iVCCSettings->SetDtWlanHoHysteresisL( KNSmlDMVCCValueZero );
       
   648         }
       
   649     else if ( KNSmlDMVCC_WlanHysteresisTimerLow() == uriSeg )
       
   650         {
       
   651         iVCCSettings->SetDtWlanHoHysteresisTimerLowL( KNSmlDMVCCValueZero );
       
   652         }
       
   653     else if ( KNSmlDMVCC_WlanHysteresisTimerHigh() == uriSeg )
       
   654         {
       
   655         iVCCSettings->SetDtWlanHoHysteresisTimerHighL( KNSmlDMVCCValueZero );
       
   656         }
       
   657     else if ( KNSmlDMVCC_CSHOTreshold() == uriSeg )
       
   658         {
       
   659         iVCCSettings->SetDtCsHoTresholdL( KNSmlDMVCCValueZero );
       
   660         }
       
   661     else if ( KNSmlDMVCC_CSHOHysteresis() == uriSeg )
       
   662         {
       
   663         iVCCSettings->SetDtCsHoHysteresisL( KNSmlDMVCCValueZero );
       
   664         }
       
   665     else if ( KNSmlDMVCC_CSHysteresisTimerLow() == uriSeg )
       
   666         {
       
   667         iVCCSettings->SetDtCsHoHysteresisTimerLowL( KNSmlDMVCCValueZero );
       
   668         }
       
   669     else if ( KNSmlDMVCC_CSHysteresisTimerHigh() == uriSeg )
       
   670         {
       
   671         iVCCSettings->SetDtCsHoHysteresisTimerHighL( KNSmlDMVCCValueZero );
       
   672         }
       
   673     else if ( KNSmlDMVCC_DmConRef() == uriSeg )
       
   674         {
       
   675         iVCCSettings->SetVoipServiceIdL( KNSmlDMVCCValueZero );
       
   676         }
       
   677     else if ( KNSmlDMVCC_DtAllowedWhenCsOriginated() == uriSeg )
       
   678         {
       
   679         iVCCSettings->SetDtAllowedWhenCsOriginated( KNSmlDMVCCValueZero );
       
   680         }
       
   681     else
       
   682         {
       
   683         retValue = CSmlDmAdapter::EInvalidObject;
       
   684         }
       
   685   
       
   686     if ( CSmlDmAdapter::EOk == retValue )
       
   687         {
       
   688         iVCCSettings->StoreL();
       
   689         }
       
   690   
       
   691     Callback().SetStatusL( aStatusRef, retValue ); 
       
   692     }
       
   693 
       
   694 // ---------------------------------------------------------------------------
       
   695 //  
       
   696 // ---------------------------------------------------------------------------
       
   697 //
       
   698 void CNSmlDmVCCAdapter::FetchLeafObjectL( const TDesC8& aURI, 
       
   699              const TDesC8& /*aLUID*/, const TDesC8& aType, 
       
   700              TInt aResultsRef, TInt aStatusRef )
       
   701   {
       
   702   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::FetchLeafObjectL" );
       
   703   
       
   704     CBufBase* result = CBufFlat::NewL( KNSmlDMVCCDefaultResultSize );
       
   705     CleanupStack::PushL( result );
       
   706     CSmlDmAdapter::TError status = FetchObjectL( aURI, *result );
       
   707 
       
   708     if ( status == CSmlDmAdapter::EOk )
       
   709         {
       
   710         Callback().SetResultsL( aResultsRef, *result, aType );
       
   711         }
       
   712     
       
   713     Callback().SetStatusL( aStatusRef, status );
       
   714 
       
   715     CleanupStack::PopAndDestroy( result );
       
   716   }
       
   717 
       
   718 // ---------------------------------------------------------------------------
       
   719 //  
       
   720 // ---------------------------------------------------------------------------
       
   721 //
       
   722 void CNSmlDmVCCAdapter::FetchLeafObjectSizeL( const TDesC8& /*aURI*/, 
       
   723                const TDesC8& /*aLUID*/, const TDesC8& /*aType*/, 
       
   724                TInt /*aResultsRef*/, TInt aStatusRef )
       
   725   {
       
   726   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::FetchLeafObjectSizeL" );
       
   727   
       
   728   // Not supported 
       
   729   Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   730   }
       
   731 
       
   732 // ---------------------------------------------------------------------------
       
   733 //  
       
   734 // ---------------------------------------------------------------------------
       
   735 //
       
   736 void CNSmlDmVCCAdapter::ChildURIListL( const TDesC8& aURI, 
       
   737                                        const TDesC8& /*aLUID*/,
       
   738               const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/,
       
   739               TInt aResultsRef, TInt aStatusRef )
       
   740   {
       
   741   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::ChildURIListL" );
       
   742   
       
   743     CSmlDmAdapter::TError status = CSmlDmAdapter::EError;
       
   744 
       
   745     CBufBase *currentURISegmentList = CBufFlat::NewL( KNSmlDMVCCDefaultResultSize );
       
   746     CleanupStack::PushL( currentURISegmentList );
       
   747     TBuf8<KNSmlDMVCCMaxUriLength> mappingInfo( KNullDesC8 );
       
   748     TBuf8<KNSmlDMVCCMaxUriLength> uri = aURI;
       
   749     TBuf8<KSmlMaxURISegLen> segmentName;
       
   750     
       
   751      if ( KNSmlDMVCC_Node() == LastURISeg( aURI ) )
       
   752         {
       
   753         // Name
       
   754         segmentName.Copy( KNSmlDMVCC_Name );
       
   755         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   756             segmentName );
       
   757         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   758             KNSmlDMVCCSeparator );
       
   759         // VDI
       
   760         segmentName.Copy( KNSmlDMVCC_VDI );
       
   761         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   762             segmentName );
       
   763         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   764             KNSmlDMVCCSeparator );
       
   765         // VDN
       
   766         segmentName.Copy( KNSmlDMVCC_VDN );
       
   767         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   768             segmentName );
       
   769         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   770             KNSmlDMVCCSeparator );
       
   771         // Preferred domain
       
   772         segmentName.Copy( KNSmlDMVCC_PreferredDomain );
       
   773         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   774             segmentName );
       
   775         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   776             KNSmlDMVCCSeparator );
       
   777         // Immediate dt
       
   778         segmentName.Copy( KNSmlDMVCC_ImmediateDT );
       
   779         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   780             segmentName );
       
   781         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   782             KNSmlDMVCCSeparator );
       
   783         // DT CS to PS
       
   784         segmentName.Copy( KNSmlDMVCC_DTCsToIM );
       
   785         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   786             segmentName );
       
   787         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   788             KNSmlDMVCCSeparator );
       
   789         // DT PS to CS
       
   790         segmentName.Copy( KNSmlDMVCC_DTIMToCs );
       
   791         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   792             segmentName );
       
   793         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   794             KNSmlDMVCCSeparator );
       
   795         // DT Held waiting calls
       
   796         segmentName.Copy( KNSmlDMVCC_DTHeldWaitingCalls );
       
   797         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   798             segmentName );
       
   799         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   800             KNSmlDMVCCSeparator );
       
   801             
       
   802         // Wlan Ho Treshold
       
   803         segmentName.Copy( KNSmlDMVCC_WlanHOTreshold );
       
   804         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   805             segmentName );
       
   806         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   807             KNSmlDMVCCSeparator );
       
   808         
       
   809          // Wlan Ho Hysteresis
       
   810         segmentName.Copy( KNSmlDMVCC_WlanHOHysteresis );
       
   811         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   812             segmentName );
       
   813         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   814             KNSmlDMVCCSeparator );
       
   815             
       
   816          // Wlan Ho Hysteresis Timer Low
       
   817         segmentName.Copy( KNSmlDMVCC_WlanHysteresisTimerLow );
       
   818         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   819             segmentName );
       
   820         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   821             KNSmlDMVCCSeparator );
       
   822             
       
   823          // Wlan Ho Hysteresis Timer High
       
   824         segmentName.Copy( KNSmlDMVCC_WlanHysteresisTimerHigh );
       
   825         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   826             segmentName );
       
   827         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   828             KNSmlDMVCCSeparator );
       
   829         
       
   830         // CS Ho Treshold
       
   831         segmentName.Copy( KNSmlDMVCC_CSHOTreshold );
       
   832         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   833             segmentName );
       
   834         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   835             KNSmlDMVCCSeparator );
       
   836         
       
   837          // CS Ho Hysteresis
       
   838         segmentName.Copy( KNSmlDMVCC_CSHOHysteresis );
       
   839         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   840             segmentName );
       
   841         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   842             KNSmlDMVCCSeparator );
       
   843             
       
   844          // CS Ho Hysteresis Timer Low
       
   845         segmentName.Copy( KNSmlDMVCC_CSHysteresisTimerLow );
       
   846         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   847             segmentName );
       
   848         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   849             KNSmlDMVCCSeparator );
       
   850             
       
   851          // CS Ho Hysteresis Timer High
       
   852         segmentName.Copy( KNSmlDMVCC_CSHysteresisTimerHigh );
       
   853         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   854             segmentName );
       
   855         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   856             KNSmlDMVCCSeparator );
       
   857         
       
   858         // DT Allowed When CS Originated
       
   859         segmentName.Copy( KNSmlDMVCC_DtAllowedWhenCsOriginated );
       
   860         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   861             segmentName );
       
   862         currentURISegmentList->InsertL( currentURISegmentList->Size(), 
       
   863             KNSmlDMVCCSeparator );
       
   864                 
       
   865                 
       
   866     	status = CSmlDmAdapter::EOk;
       
   867         }
       
   868     else if( KNSmlDMVCC_DmToConRef() == LastURISeg( aURI ) )    // ./VCC001/ToConRef
       
   869       		{
       
   870         	segmentName.Copy( KNSmlDMVCC_VoipServiceId );
       
   871         	currentURISegmentList->InsertL( currentURISegmentList->Size(), segmentName );
       
   872         	currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMVCCSeparator );
       
   873 			status = CSmlDmAdapter::EOk;
       
   874 	       	}
       
   875     else if( KNSmlDMVCC_VoipServiceId() == LastURISeg( aURI ) )         // ./VCC001/ToConRef/VoIP
       
   876         	{
       
   877         	segmentName.Copy( KNSmlDMVCC_DmConRef );
       
   878         	currentURISegmentList->InsertL( currentURISegmentList->Size(), segmentName );
       
   879         	currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMVCCSeparator );
       
   880     		status = CSmlDmAdapter::EOk;
       
   881         	}
       
   882          
       
   883     
       
   884     Callback().SetStatusL( aStatusRef, status );
       
   885     Callback().SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
       
   886     CleanupStack::PopAndDestroy( currentURISegmentList ); 
       
   887   }
       
   888 
       
   889 // ---------------------------------------------------------------------------
       
   890 //  
       
   891 // ---------------------------------------------------------------------------
       
   892 //
       
   893 void CNSmlDmVCCAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, 
       
   894            const TDesC8& /*aParentLUID*/, TInt aStatusRef )
       
   895   {
       
   896   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::AddNodeObjectL" );
       
   897   
       
   898   // Not supported 
       
   899   Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
       
   900   }
       
   901 
       
   902 // ---------------------------------------------------------------------------
       
   903 //  
       
   904 // ---------------------------------------------------------------------------
       
   905 //
       
   906 void CNSmlDmVCCAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, 
       
   907             const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, 
       
   908             const TDesC8& /*aType*/, TInt aStatusRef )
       
   909   {
       
   910   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::ExecuteCommandL" );
       
   911   
       
   912   // Not supported 
       
   913   Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); 
       
   914   }
       
   915 
       
   916 // ---------------------------------------------------------------------------
       
   917 //  
       
   918 // ---------------------------------------------------------------------------
       
   919 //
       
   920 void CNSmlDmVCCAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, 
       
   921             const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, 
       
   922             const TDesC8& /*aType*/, TInt aStatusRef )
       
   923   {
       
   924   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::ExecuteCommandL -stream" );
       
   925   
       
   926   // Not supported 
       
   927   Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   928   }
       
   929                       
       
   930 // ---------------------------------------------------------------------------
       
   931 //  
       
   932 // ---------------------------------------------------------------------------
       
   933 //
       
   934 void CNSmlDmVCCAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, 
       
   935            const TDesC8& /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, 
       
   936            const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/, 
       
   937            TInt aStatusRef )
       
   938   {
       
   939   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::CopyCommandL" );
       
   940   
       
   941   // Not supported 
       
   942   Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); 
       
   943   }
       
   944 
       
   945 // ---------------------------------------------------------------------------
       
   946 //  
       
   947 // ---------------------------------------------------------------------------
       
   948 //
       
   949 void CNSmlDmVCCAdapter::StartAtomicL()
       
   950   {
       
   951   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::StartAtomicL()" );
       
   952   // Not supported 
       
   953   }
       
   954 
       
   955 // ---------------------------------------------------------------------------
       
   956 //  
       
   957 // ---------------------------------------------------------------------------
       
   958 //
       
   959 void CNSmlDmVCCAdapter::CommitAtomicL()
       
   960   {
       
   961   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::CommitAtomicL()" );
       
   962   // Not supported 
       
   963   }
       
   964 
       
   965 // ---------------------------------------------------------------------------
       
   966 //  
       
   967 // ---------------------------------------------------------------------------
       
   968 //
       
   969 void CNSmlDmVCCAdapter::RollbackAtomicL()
       
   970   {
       
   971   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::RollbackAtomicL()" );
       
   972   // Not supported 
       
   973   }
       
   974 
       
   975 // ---------------------------------------------------------------------------
       
   976 //  
       
   977 // ---------------------------------------------------------------------------
       
   978 //
       
   979 TBool CNSmlDmVCCAdapter::StreamingSupport( TInt& /*aItemSize*/ )
       
   980   {
       
   981   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::StreamingSupport" );
       
   982   return EFalse;
       
   983   }
       
   984 
       
   985 // ---------------------------------------------------------------------------
       
   986 //  
       
   987 // ---------------------------------------------------------------------------
       
   988 //
       
   989 void CNSmlDmVCCAdapter::StreamCommittedL()
       
   990   {
       
   991   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::StreamCommittedL" );
       
   992   // Not supported 
       
   993   }
       
   994 
       
   995 // ---------------------------------------------------------------------------
       
   996 //  
       
   997 // ---------------------------------------------------------------------------
       
   998 //
       
   999 void CNSmlDmVCCAdapter::CompleteOutstandingCmdsL()
       
  1000   {
       
  1001   RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::CompleteOutstandingCmdsL()" );
       
  1002   
       
  1003   iVCCSettings->StoreL();
       
  1004   }
       
  1005 
       
  1006 // ---------------------------------------------------------------------------
       
  1007 // Returns only the last uri segment.
       
  1008 // ---------------------------------------------------------------------------
       
  1009 //
       
  1010 const TPtrC8 CNSmlDmVCCAdapter::LastURISeg( const TDesC8& aURI )
       
  1011     {
       
  1012     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::LastURISeg" );
       
  1013     TInt offset = aURI.LocateReverse( KNSmlDMVCCSeparatorChar  );
       
  1014     
       
  1015     RUBY_DEBUG1( " - offset == %d", offset );    
       
  1016     
       
  1017     TInt i;
       
  1018     for ( i=aURI.Length()-1; i >= 0; i-- )
       
  1019         {
       
  1020         if ( aURI[i]=='/' )
       
  1021             {
       
  1022             break;
       
  1023             }
       
  1024         }
       
  1025     if ( i==0 )
       
  1026         {
       
  1027         return aURI;
       
  1028         }
       
  1029     else
       
  1030         {
       
  1031         return aURI.Mid( i + 1 );
       
  1032         }    
       
  1033     }
       
  1034 
       
  1035 // ---------------------------------------------------------------------------
       
  1036 //  
       
  1037 // ---------------------------------------------------------------------------
       
  1038 //
       
  1039 CSmlDmAdapter::TError CNSmlDmVCCAdapter::FetchObjectL( const TDesC8& aURI, 
       
  1040                                                    CBufBase& aResult )
       
  1041   {
       
  1042     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::FetchObjectL" );
       
  1043     TInt composeResult = ETrue; 
       
  1044     iVCCSettings->ReadSettingsL( KVccServiceName );
       
  1045     
       
  1046     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; 
       
  1047     TInt err( KErrNone );
       
  1048     TPtrC8 lastUriSeg = LastURISeg( aURI );
       
  1049     CSPEntry* entry = CSPEntry::NewLC();
       
  1050     
       
  1051     iVCCSettings->FindServiceEntryL( KNSmlDMVCC_ServiceName, *entry );
       
  1052     
       
  1053     if ( entry->PropertyCount() > 0 )
       
  1054       {
       
  1055       RUBY_DEBUG0( "- Service Entry found" );
       
  1056       TServiceId serviceId = entry->GetServiceId();   
       
  1057       CSPProperty* property = CSPProperty::NewLC();
       
  1058       
       
  1059     if ( KNSmlDMVCC_Name() == lastUriSeg )
       
  1060       {
       
  1061       RUBY_DEBUG0( "- Name" );
       
  1062       err = iVCCSettings->FindPropertyL( serviceId, ESubPropertyVccName, 
       
  1063                                *property );
       
  1064       }
       
  1065     else if ( KNSmlDMVCC_VDI() == lastUriSeg )
       
  1066           {
       
  1067           RUBY_DEBUG0( "- VDI" );
       
  1068           err = iVCCSettings->FindPropertyL( serviceId, ESubPropertyVccVDI, 
       
  1069                                    *property );
       
  1070           }
       
  1071     else if ( KNSmlDMVCC_VDN() == lastUriSeg )
       
  1072       {
       
  1073       RUBY_DEBUG0( "- VDN" );
       
  1074       err = iVCCSettings->FindPropertyL( serviceId, ESubPropertyVccVDN, 
       
  1075                                *property );
       
  1076       }
       
  1077     else if ( KNSmlDMVCC_PreferredDomain() == lastUriSeg )
       
  1078       {
       
  1079       RUBY_DEBUG0( "- Preferred Domain" );
       
  1080       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1081                                ESubPropertyVccPreferredDomain, 
       
  1082                                *property );
       
  1083       }
       
  1084     else if ( KNSmlDMVCC_ImmediateDT() == lastUriSeg )
       
  1085       {
       
  1086       RUBY_DEBUG0( "- Immediate DT" );
       
  1087       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1088                                ESubPropertyVccImmediateDomainTransfer, 
       
  1089                                *property );
       
  1090       }
       
  1091     else if ( KNSmlDMVCC_DTCsToIM() == lastUriSeg )
       
  1092       {
       
  1093       RUBY_DEBUG0( "- CS to PS" );
       
  1094       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1095                                ESubPropertyVccDtCstoPsAllowed, 
       
  1096                                *property );
       
  1097       }
       
  1098     else if ( KNSmlDMVCC_DTIMToCs() == lastUriSeg )
       
  1099       {
       
  1100       RUBY_DEBUG0( "- PS to CS" );
       
  1101       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1102                                      ESubPropertyVccDtPstoCsAllowed, 
       
  1103                                      *property );
       
  1104       }
       
  1105     else if ( KNSmlDMVCC_DTHeldWaitingCalls() == lastUriSeg )
       
  1106       {
       
  1107       RUBY_DEBUG0( "- Held waiting calls" );
       
  1108       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1109                              ESubPropertyVccDtHeldWaitingCallsAllowed, 
       
  1110                              *property );
       
  1111       }
       
  1112    
       
  1113     else if ( KNSmlDMVCC_WlanHOTreshold() == lastUriSeg )
       
  1114       {
       
  1115       RUBY_DEBUG0( "- WlanHOTreshold" );
       
  1116       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1117                              ESubPropertyVccDtWLANHoTriggerLevel, 
       
  1118                              *property );
       
  1119       }
       
  1120     else if ( KNSmlDMVCC_WlanHOHysteresis() == lastUriSeg )
       
  1121       {
       
  1122       RUBY_DEBUG0( "- WlanHOHysteresis" );
       
  1123       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1124                              ESubPropertyVccDtWLANHoHysteresis, 
       
  1125                              *property );
       
  1126       }
       
  1127 
       
  1128     else if ( KNSmlDMVCC_WlanHysteresisTimerLow() == lastUriSeg )
       
  1129       {
       
  1130       RUBY_DEBUG0( "- _WlanHysteresisTimerLow" );
       
  1131       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1132                              ESubPropertyVccDtWLANHoHysteresisTimerLow, 
       
  1133                              *property );
       
  1134       }
       
  1135 
       
  1136     else if ( KNSmlDMVCC_WlanHysteresisTimerHigh() == lastUriSeg )
       
  1137       {
       
  1138       RUBY_DEBUG0( "- WlanHysteresisTimerHigh" );
       
  1139       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1140                              ESubPropertyVccDtCSHoHysteresisTimerHigh, 
       
  1141                              *property );
       
  1142       }
       
  1143    
       
  1144     else if ( KNSmlDMVCC_CSHOTreshold() == lastUriSeg )
       
  1145       {
       
  1146       RUBY_DEBUG0( "- CSHOTreshold" );
       
  1147       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1148                              ESubPropertyVccDtCSHoTriggerLevel, 
       
  1149                              *property );
       
  1150       }
       
  1151     else if ( KNSmlDMVCC_CSHOHysteresis() == lastUriSeg )
       
  1152       {
       
  1153       RUBY_DEBUG0( "- CSHOHysteresis" );
       
  1154       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1155                              ESubPropertyVccDtCSHoHysteresis, 
       
  1156                              *property );
       
  1157       }
       
  1158 
       
  1159     else if ( KNSmlDMVCC_CSHysteresisTimerLow() == lastUriSeg )
       
  1160       {
       
  1161       RUBY_DEBUG0( "- CSHysteresisTimerLow" );
       
  1162       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1163                              ESubPropertyVccDtCSHoHysteresisTimerLow, 
       
  1164                              *property );
       
  1165       }
       
  1166 
       
  1167     else if ( KNSmlDMVCC_CSHysteresisTimerHigh() == lastUriSeg )
       
  1168       {
       
  1169       RUBY_DEBUG0( "- CSHysteresisTimerHigh" );
       
  1170       err = iVCCSettings->FindPropertyL( serviceId, 
       
  1171                              ESubPropertyVccDtCSHoHysteresisTimerHigh, 
       
  1172                              *property );
       
  1173       }
       
  1174   
       
  1175     else if( KNSmlDMVCC_DmConRef() == lastUriSeg )
       
  1176       {
       
  1177       TPtrC8 conRefUri = NSmlDmURI::RemoveLastSeg(aURI);
       
  1178       TPtrC8 lastConRefSeg = NSmlDmURI::LastURISeg(conRefUri);
       
  1179       composeResult = EFalse;  
       
  1180       if(KNSmlDMVCC_VoipServiceId() == lastConRefSeg )
       
  1181             {
       
  1182             // Voip ConRef
       
  1183             retValue= FetchVoipConRefL(aURI, aResult);
       
  1184             
       
  1185             }
       
  1186       else
       
  1187             {
       
  1188              retValue = CSmlDmAdapter::ENotFound;
       
  1189             } 
       
  1190       }
       
  1191     else if ( KNSmlDMVCC_DtAllowedWhenCsOriginated() == lastUriSeg )
       
  1192         {
       
  1193         RUBY_DEBUG0( "- DT allowed when CS originated" );
       
  1194         err = iVCCSettings->FindPropertyL( serviceId, 
       
  1195                              ESubPropertyVccDtAllowedWhenCsOriginated,
       
  1196                              *property );
       
  1197         }
       
  1198     else
       
  1199       {
       
  1200       RUBY_DEBUG0( "- Invalid object" );
       
  1201       retValue = CSmlDmAdapter::EInvalidObject;
       
  1202       }
       
  1203     
       
  1204     if ( KErrNone == err && composeResult )
       
  1205       {
       
  1206       RUBY_DEBUG0( "- Result handling STARTt" );
       
  1207       // Get result from property
       
  1208       TBuf<KNSmlDMVCCMaxResultLength> buf;
       
  1209       err = property->GetValue( buf );
       
  1210       
       
  1211       // Insert result into result buffer
       
  1212       TBuf8<KNSmlDMVCCMaxResultLength> buf8;
       
  1213       buf8.Append( buf );
       
  1214       aResult.InsertL( 0, buf8 );
       
  1215       RUBY_DEBUG0( "- Result handling STOP" );
       
  1216       }
       
  1217     
       
  1218     CleanupStack::PopAndDestroy( property );
       
  1219       }
       
  1220     else
       
  1221       {
       
  1222       RUBY_DEBUG0( "- Service not found" );
       
  1223       // Service not found
       
  1224       retValue = CSmlDmAdapter::ENotFound;
       
  1225       }
       
  1226     
       
  1227   if ( KErrNone != err )
       
  1228     {
       
  1229     RUBY_DEBUG1( "- Other error occurred [%d]", err );
       
  1230     // Other error occurred
       
  1231     retValue = CSmlDmAdapter::EError;
       
  1232     }
       
  1233     
       
  1234     CleanupStack::PopAndDestroy( entry );
       
  1235     
       
  1236     return retValue;
       
  1237   }
       
  1238 
       
  1239 // ---------------------------------------------------------------------------
       
  1240 //  
       
  1241 // ---------------------------------------------------------------------------
       
  1242 //
       
  1243 HBufC* CNSmlDmVCCAdapter::ConvertToUnicodeL( const TDesC8& aSource )
       
  1244     {
       
  1245     if ( iTempBuf )
       
  1246         {
       
  1247         delete iTempBuf;
       
  1248         iTempBuf = NULL;
       
  1249         }
       
  1250 
       
  1251     HBufC* temp = EscapeUtils::ConvertToUnicodeFromUtf8L( aSource );
       
  1252     CleanupStack::PushL( temp );
       
  1253     iTempBuf = temp->AllocL();
       
  1254     CleanupStack::PopAndDestroy( temp );
       
  1255     
       
  1256     //return static_cast<const TDesC&>(*iTempPtr);
       
  1257     return iTempBuf;
       
  1258     }
       
  1259 
       
  1260 // ---------------------------------------------------------------------------
       
  1261 //  
       
  1262 // ---------------------------------------------------------------------------
       
  1263 //
       
  1264 CSmlDmAdapter::TError CNSmlDmVCCAdapter::FetchVoipConRefL( const TDesC8& /*aUri*/,
       
  1265                                                               CBufBase& aObject )
       
  1266 	{
       
  1267     RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::FetchVoipConRefL" );
       
  1268     CSmlDmAdapter::TError status( CSmlDmAdapter::EOk );
       
  1269     
       
  1270     iVCCSettings->ReadSettingsL( KVccServiceName );
       
  1271         
       
  1272     // Fetch correct id here
       
  1273     RUBY_DEBUG1( "ServiceId=%d", iVCCSettings->VoipServiceId() );
       
  1274     CRCSEProfileRegistry* cRCSEProfileRegistry = CRCSEProfileRegistry::NewLC();   // CS: 1
       
  1275     RPointerArray<CRCSEProfileEntry> foundEntries;
       
  1276     CleanupStack::PushL( TCleanupItem( ResetAndDestroyEntries, &foundEntries ) ); // CS: 2
       
  1277         
       
  1278     cRCSEProfileRegistry->FindByServiceIdL( (TUint32)iVCCSettings->VoipServiceId(),
       
  1279                                            foundEntries );
       
  1280     
       
  1281     RUBY_DEBUG1( "ProfileCount=%d", foundEntries.Count() );
       
  1282     if ( foundEntries.Count() > 0 )
       
  1283     	{
       
  1284     	RUBY_DEBUG1( "VoipId=%d", foundEntries[0]->iId );
       
  1285     	TInt voipId = foundEntries[0]->iId;
       
  1286          
       
  1287     	CBufBase* result = CBufFlat::NewL( 1 );
       
  1288     	CleanupStack::PushL( result );                      // CS: 3
       
  1289         
       
  1290     	// Request all VoIP identifiers 
       
  1291     	Callback().FetchLinkL( KNSmlDMVCC_DmVoipLinkPrefix, *result, status );
       
  1292         
       
  1293     	if( status == CSmlDmAdapter::EOk )
       
  1294         	{
       
  1295         	TInt resultSize( result->Size() );
       
  1296         	HBufC8* linkList = HBufC8::NewLC( resultSize ); // CS: 4
       
  1297         	TPtr8 linkListPtr( linkList->Des() );
       
  1298         	TInt numOfUriSegs( KErrNone );
       
  1299             
       
  1300         	if( resultSize > 0 )
       
  1301             	{
       
  1302             	linkListPtr.Copy( result->Ptr(0) );
       
  1303             	RemoveLastSeparator( linkListPtr );
       
  1304             	numOfUriSegs = NSmlDmURI::NumOfURISegs( linkListPtr );
       
  1305             	}
       
  1306             
       
  1307     		// Find correct VoIP profile
       
  1308     		while( numOfUriSegs )
       
  1309         		{
       
  1310         		TBuf8<KNSmlDMVCC_DefaultResultSize> object; 
       
  1311                 
       
  1312         		// Build URI: ./VoIP/<X>/VoIPId
       
  1313         		object.Copy( KNSmlDMVCC_DmVoipLinkPrefix );
       
  1314         		object.Append( KNSmlDMVCCSeparator );
       
  1315         		object.Append( NSmlDmURI::LastURISeg( linkListPtr ) );
       
  1316         		object.Append( KNSmlDMVCCSeparator );
       
  1317         		object.Append( KNSmlDMVCC_DmVoipId );
       
  1318                 
       
  1319         		// Fetch VoIPId from URI
       
  1320         		result->Reset();
       
  1321         		Callback().FetchLinkL( object, *result, status );
       
  1322                 
       
  1323         		if( status == CSmlDmAdapter::EOk )
       
  1324             		{
       
  1325             		// Check if VoIPId match
       
  1326             		TLex8 lex( result->Ptr( 0 ) );
       
  1327     				TInt voipIdFromVoipAdapter( KErrNotFound );
       
  1328     				lex.Val( voipIdFromVoipAdapter );
       
  1329                                       
       
  1330             		if( voipId == voipIdFromVoipAdapter )
       
  1331                 		{
       
  1332                 		aObject.InsertL( 0, NSmlDmURI::RemoveLastSeg( object ) );
       
  1333                 		break;
       
  1334                 		}
       
  1335             		}
       
  1336                 
       
  1337         		// VoIPId did not match --> continue
       
  1338         		linkListPtr.Copy( NSmlDmURI::RemoveLastSeg( linkListPtr ) );
       
  1339          
       
  1340         		--numOfUriSegs;
       
  1341         		}
       
  1342             CleanupStack::PopAndDestroy( linkList );        // CS: 3
       
  1343         	} 
       
  1344         CleanupStack::PopAndDestroy( result );              // CS: 2
       
  1345     	}
       
  1346 	else
       
  1347     	{
       
  1348     	RUBY_DEBUG0("Profiles not found");
       
  1349     	status = CSmlDmAdapter::ENotFound;
       
  1350     	}	
       
  1351     CleanupStack::PopAndDestroy();							// CS: 1
       
  1352     CleanupStack::PopAndDestroy( cRCSEProfileRegistry ); 	// CS: 0
       
  1353     return status;
       
  1354 	}
       
  1355 
       
  1356 // -----------------------------------------------------------------------------
       
  1357 // CNSmlDmVCCAdapter::UpdateVoipConRefL
       
  1358 // -----------------------------------------------------------------------------
       
  1359 //
       
  1360 CSmlDmAdapter::TError CNSmlDmVCCAdapter::UpdateVoipConRefL(const TDesC8& /*aUri*/, 
       
  1361                                                          const TDesC8& aObject)
       
  1362     {
       
  1363     RUBY_DEBUG_BLOCK("CNSmlDmVCCAdapter::UpdateVoipConRefL");
       
  1364     
       
  1365     CSmlDmAdapter::TError status( CSmlDmAdapter::EOk );
       
  1366     
       
  1367     CBufBase* result = CBufFlat::NewL(1);
       
  1368     CleanupStack::PushL(result);			// CS: 1
       
  1369 
       
  1370     // Request all voip settings identifiers 
       
  1371     Callback().FetchLinkL(KNSmlDMVCC_DmVoip, *result, status);
       
  1372     
       
  1373     if( status == CSmlDmAdapter::EOk )
       
  1374         {
       
  1375         RUBY_DEBUG0("Voip profiles found");
       
  1376         // Fetch VoIP profile id
       
  1377         TBuf8<KNSmlDMVCC_DefaultResultSize> object;
       
  1378         object.Copy( aObject );
       
  1379         object.Append( KNSmlDMVCCSeparator );
       
  1380         object.Append( KNSmlDMVCC_DmVoipId );
       
  1381         
       
  1382         result->Reset();
       
  1383         Callback().FetchLinkL( object, *result, status );
       
  1384         
       
  1385         if( status == CSmlDmAdapter::EOk )
       
  1386             {
       
  1387          	RUBY_DEBUG0("Voip Link fetched ok");
       
  1388         
       
  1389             // Convert VoipId to ServiceID
       
  1390            	CRCSEProfileRegistry* cRCSEProfileRegistry = CRCSEProfileRegistry::NewLC(); // CS: 2
       
  1391     	
       
  1392     		TInt voipProfileId;
       
  1393        		TLex8 temp( result->Ptr( 0 ) );
       
  1394         	TInt res = temp.Val(voipProfileId) ;
       
  1395     		
       
  1396     		RUBY_DEBUG1( "VoipId=%d", voipProfileId );
       
  1397     		if (res == KErrNone )
       
  1398     			{
       
  1399     			CRCSEProfileEntry* foundEntry = CRCSEProfileEntry::NewLC();		// CS: 3 
       
  1400     			TRAP( res, cRCSEProfileRegistry->FindL( voipProfileId, *foundEntry ) );
       
  1401     	   	
       
  1402     			RUBY_DEBUG1( "ServiceId=%d", foundEntry->iServiceProviderId );
       
  1403                 if (res==KErrNone)
       
  1404                 	{
       
  1405                 	// And save
       
  1406     				iVCCSettings->SetVoipServiceIdL(foundEntry->iServiceProviderId);
       
  1407     			   	}
       
  1408     			else
       
  1409     				{
       
  1410     				RUBY_DEBUG0("Service id not found");
       
  1411         			status = CSmlDmAdapter::EError;
       
  1412                     }
       
  1413             	CleanupStack::PopAndDestroy( foundEntry );						// CS: 2
       
  1414     		   	}
       
  1415             else
       
  1416                 {
       
  1417                 RUBY_DEBUG0("Voip id fetch failed");
       
  1418                 status = CSmlDmAdapter::EError;
       
  1419                 }
       
  1420     		CleanupStack::PopAndDestroy( cRCSEProfileRegistry );				// CS: 1
       
  1421             }
       
  1422         else
       
  1423             {
       
  1424         	RUBY_DEBUG0("Voip link not found");
       
  1425             status = CSmlDmAdapter::EError;
       
  1426             }
       
  1427         }
       
  1428     else
       
  1429         {
       
  1430         RUBY_DEBUG0("Voip profiles not found");
       
  1431         status = CSmlDmAdapter::ENotFound;
       
  1432         }
       
  1433     
       
  1434     CleanupStack::PopAndDestroy(result);										// CS: 0
       
  1435     return status;
       
  1436     }
       
  1437 
       
  1438     
       
  1439 // -----------------------------------------------------------------------------
       
  1440 // CNSmlDmVCCAdapter::RemoveLastSeparator
       
  1441 // -----------------------------------------------------------------------------
       
  1442 //
       
  1443 void CNSmlDmVCCAdapter::RemoveLastSeparator( TPtr8& aURI )
       
  1444     {
       
  1445         
       
  1446     if( aURI.Length() > 0 )
       
  1447     	{
       
  1448     	TChar separator( '/' );
       
  1449     	TInt lastchar( aURI.Length() - 1 );
       
  1450     	
       
  1451     	// Check if last character is separator.
       
  1452     	if( aURI[lastchar] == separator )
       
  1453     		{
       
  1454     		// Delete separator.
       
  1455     		aURI.Delete( lastchar, 1 );
       
  1456     		}
       
  1457     	}
       
  1458     }
       
  1459 	
       
  1460 // -----------------------------------------------------------------------------
       
  1461 // CNSmlDmVCCAdapter::ResetAndDestroyEntries
       
  1462 // -----------------------------------------------------------------------------
       
  1463 //
       
  1464 void CNSmlDmVCCAdapter::ResetAndDestroyEntries( TAny* anArray )
       
  1465 	{
       
  1466 
       
  1467     RPointerArray<CRCSEProfileEntry>* array = 
       
  1468         reinterpret_cast<RPointerArray<CRCSEProfileEntry>*>( anArray );
       
  1469         
       
  1470     if (array)
       
  1471         {
       
  1472         array->ResetAndDestroy();
       
  1473         array->Close();
       
  1474         }
       
  1475 	}
       
  1476 
       
  1477 //  End of File  
       
  1478