omadmadapters/streamingadapter/src/nsmlstreamingadapter.cpp
changeset 46 b9b00b134b0d
child 62 03849bd79877
equal deleted inserted replaced
45:0f9fc722d255 46:b9b00b134b0d
       
     1 /*
       
     2 *  Name        : nsmldmstreamingadapter.cpp
       
     3 *  Part of     : nsmldmstreamingadapter
       
     4 *  Interface   : ecom / SmlDmAdapter
       
     5 *
       
     6 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     7 * All rights reserved.
       
     8 * This component and the accompanying materials are made available
       
     9 * under the terms of "Eclipse Public License v1.0"
       
    10 * which accompanies this distribution, and is available
       
    11 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    12 *
       
    13 * Initial Contributors:
       
    14 * Nokia Corporation - initial contribution.
       
    15 *
       
    16 * Contributors:
       
    17 *
       
    18 * Description:  Implementation of dm adapters
       
    19 * 	This is part of omadmextensions.
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 //INCLUDE FILES
       
    25 #include <implementationproxy.h> // For TImplementationProxy definition
       
    26 #include <centralrepository.h>
       
    27 #include <commdb.h>
       
    28 #include <cdbcols.h>             // CommsDB columname defs
       
    29 #include <e32base.h>
       
    30 #include <e32std.h>
       
    31 #include <e32const.h>
       
    32 #include <mpsettingsmodel.h>
       
    33 #include <e32msgqueue.h>
       
    34 
       
    35 
       
    36 #include "nsmldebug.h"
       
    37 #include "nsmlconstants.h"
       
    38 #include "nsmldmconst.h"
       
    39 #include "nsmlstreamingadapter.h"
       
    40 #include "nsmldmiapmatcher.h"
       
    41 #include "streamingadapterCRKeys.h"
       
    42 
       
    43 #ifndef __WINS__
       
    44 // This lowers the unnecessary compiler warning (armv5) to remark.
       
    45 // "Warning:  #174-D: expression has no effect..." is caused by 
       
    46 // DBG_ARGS8 macro in no-debug builds.
       
    47 #pragma diag_remark 174
       
    48 #endif
       
    49 
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewL( )
       
    53 // -----------------------------------------------------------------------------
       
    54 CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewL(MSmlDmCallback* aDmCallback )
       
    55     {
       
    56     _DBG_FILE("CNSmlDmStreamingAdapter::NewL(): begin");
       
    57     CNSmlDmStreamingAdapter* self = NewLC( aDmCallback );
       
    58     CleanupStack::Pop();
       
    59     _DBG_FILE("CNSmlDmStreamingAdapter::NewL(): end");
       
    60     return self;
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewLC( )
       
    65 // -----------------------------------------------------------------------------
       
    66 CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewLC(MSmlDmCallback* aDmCallback )
       
    67     {
       
    68     _DBG_FILE("CNSmlDmStreamingAdapter::NewLC(): begin");
       
    69     CNSmlDmStreamingAdapter* self = new (ELeave) CNSmlDmStreamingAdapter(aDmCallback);
       
    70     CleanupStack::PushL(self);
       
    71     self->ConstructL();
       
    72     self->iDmCallback = aDmCallback;
       
    73     _DBG_FILE("CNSmlDmStreamingAdapter::NewLC(): end");
       
    74     return self;
       
    75     }
       
    76 
       
    77 
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter()
       
    81 // -----------------------------------------------------------------------------
       
    82 CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter()
       
    83     {
       
    84     _DBG_FILE("CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter(): begin");
       
    85     if(iModel)
       
    86         delete iModel;
       
    87     _DBG_FILE("CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter(): end");
       
    88     }
       
    89     
       
    90 // -----------------------------------------------------------------------------
       
    91 // CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter()
       
    92 // -----------------------------------------------------------------------------
       
    93 
       
    94 CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments)
       
    95     {
       
    96     _DBG_FILE("CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(aEcomArguments): begin");
       
    97     _DBG_FILE("CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(aEcomArguments): end"); 
       
    98     }
       
    99 
       
   100 
       
   101 void CNSmlDmStreamingAdapter::ConstructL()
       
   102     {
       
   103     _DBG_FILE("CNSmlDmStreamingAdapter::ConstructL: begin");
       
   104         if ( !iModel )
       
   105                 {
       
   106                 RImplInfoPtrArray impl; 
       
   107                 CleanupStack::PushL( TCleanupItem( Cleanup, &impl ) );
       
   108                 CMPSettingsModel::ListImplementationsL( impl );
       
   109                 if( impl.Count() > 0 )
       
   110                     {
       
   111                     _DBG_FILE("CStreamingAdapter::ConstructL: Creating CMPSettingsModel");
       
   112                     // using the first available implementation
       
   113                     iModel= CMPSettingsModel::NewL( impl[0]->ImplementationUid() );
       
   114                     _DBG_FILE("CStreamingAdapter::ConstructL: Creating CMPSettingsModel Done" );
       
   115                     }
       
   116                 CleanupStack::PopAndDestroy(); // implArray
       
   117                 // Load default values
       
   118                 //iModel->LoadSettingsL(EConfigDefault);
       
   119                 if(iModel)
       
   120                 	iModel->LoadSettingsL(EConfigUser);
       
   121                 }
       
   122         _DBG_FILE("CNSmlDmStreamingAdapter::ConstructL: end");
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CNSmlDmStreamingAdapter::SetLeafPropertiesL()
       
   127 // -----------------------------------------------------------------------------
       
   128 void CNSmlDmStreamingAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject, 
       
   129                                                 const TSmlDmAccessTypes& aAccessTypes, 
       
   130                                                 const TDesC8& aDescription ) const
       
   131     {
       
   132     aObject.SetAccessTypesL( aAccessTypes );
       
   133     aObject.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   134     aObject.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   135     aObject.AddDFTypeMimeTypeL( KNSmlDMStreamingAdapterTextPlain );
       
   136     aObject.SetDescriptionL( aDescription );
       
   137     }
       
   138 
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 //  CNSmlDmStreamingAdapter::DDFVersionL()
       
   142 // -----------------------------------------------------------------------------
       
   143 void CNSmlDmStreamingAdapter::DDFVersionL(CBufBase& aDDFVersion)
       
   144     {
       
   145     _DBG_FILE("CNSmlDmStreamingAdapter::DDFVersionL(TDes& aDDFVersion): begin");
       
   146     aDDFVersion.InsertL(0,KNSmlDMStreamingAdapterDDFVersion);
       
   147     _DBG_FILE("CNSmlDmStreamingAdapter::DDFVersionL(TDes& aDDFVersion): end");
       
   148     }
       
   149 
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 //  CNSmlDmStreamingAdapter::DDFStructureL()
       
   153 //
       
   154 // -----------------------------------------------------------------------------
       
   155 void CNSmlDmStreamingAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
       
   156     {
       
   157     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): begin");
       
   158     
       
   159     TSmlDmAccessTypes accessTypes;
       
   160     accessTypes.SetGet();
       
   161     
       
   162     TSmlDmAccessTypes accessNoDeleteTypes;
       
   163     accessNoDeleteTypes.SetGet();
       
   164     accessNoDeleteTypes.SetReplace();
       
   165     
       
   166     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNodeName");
       
   167     MSmlDmDDFObject& dmStreamingAdap = aDDF.AddChildObjectL( KNSmlDMStreamingAdapterNodeName );
       
   168     dmStreamingAdap.SetAccessTypesL( accessTypes ); 
       
   169     dmStreamingAdap.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   170     dmStreamingAdap.SetDescriptionL( KNSmlDMStreamingAdapterDescription );
       
   171   
       
   172   
       
   173   	_DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterName");
       
   174     MSmlDmDDFObject& confName = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterName);
       
   175     FillNodeInfoL(  confName, 
       
   176                     accessNoDeleteTypes,
       
   177                     MSmlDmDDFObject::EOne,
       
   178                     MSmlDmDDFObject::EPermanent,
       
   179                     MSmlDmDDFObject::EChr,
       
   180                     KNSmlDMStreamingAdapterNameDescription );
       
   181     
       
   182     
       
   183     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterToProxy");
       
   184     MSmlDmDDFObject& toProxyID = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterToProxy);
       
   185     FillNodeInfoL(  toProxyID, 
       
   186                     accessNoDeleteTypes,
       
   187                     MSmlDmDDFObject::EOne,
       
   188                     MSmlDmDDFObject::EPermanent,
       
   189                     MSmlDmDDFObject::EChr,
       
   190                     KNSmlDMStreamingAdapterToProxyDescription );
       
   191     
       
   192      
       
   193     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterToNapID");
       
   194     MSmlDmDDFObject& toNapID = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterToNapID);
       
   195     FillNodeInfoL(  toNapID, 
       
   196                     accessNoDeleteTypes,
       
   197                     MSmlDmDDFObject::EOne,
       
   198                     MSmlDmDDFObject::EPermanent,
       
   199                     MSmlDmDDFObject::EChr,
       
   200                     KNSmlDMStreamingAdapterToNapIDDescription );
       
   201     
       
   202     
       
   203     
       
   204     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfo");
       
   205     MSmlDmDDFObject& netInfo = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterNetInfo);
       
   206     FillNodeInfoL(  netInfo, 
       
   207                     accessTypes,
       
   208                     MSmlDmDDFObject::EOne,
       
   209                     MSmlDmDDFObject::EPermanent,
       
   210                     MSmlDmDDFObject::ENode,
       
   211                     KNSmlDMStreamingAdapterNetInfo );
       
   212     
       
   213     
       
   214     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoGPRS");
       
   215     MSmlDmDDFObject& netInfoGPRS = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoGPRS);
       
   216     FillNodeInfoL(  netInfoGPRS, 
       
   217                     accessNoDeleteTypes,
       
   218                     MSmlDmDDFObject::EOne,
       
   219                     MSmlDmDDFObject::EPermanent,
       
   220                     MSmlDmDDFObject::EChr,
       
   221                     KNSmlDMStreamingAdapterNetInfo );
       
   222                     
       
   223     
       
   224     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoEGPRS");
       
   225     MSmlDmDDFObject& netInfoEGPRS = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoEGPRS);
       
   226     FillNodeInfoL(  netInfoEGPRS, 
       
   227                     accessNoDeleteTypes,
       
   228                     MSmlDmDDFObject::EOne,
       
   229                     MSmlDmDDFObject::EPermanent,
       
   230                     MSmlDmDDFObject::EChr,
       
   231                     KNSmlDMStreamingAdapterNetInfo );
       
   232                     
       
   233     
       
   234     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoWCDMA");
       
   235     MSmlDmDDFObject& netInfoWCDMA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoWCDMA);
       
   236     FillNodeInfoL(  netInfoWCDMA, 
       
   237                     accessNoDeleteTypes,
       
   238                     MSmlDmDDFObject::EOne,
       
   239                     MSmlDmDDFObject::EPermanent,
       
   240                     MSmlDmDDFObject::EChr,
       
   241                     KNSmlDMStreamingAdapterNetInfo );
       
   242                     
       
   243                     
       
   244     
       
   245     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoCDMA2000");
       
   246     MSmlDmDDFObject& netInfoCDMA2000 = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoCDMA2000);
       
   247     FillNodeInfoL(  netInfoCDMA2000, 
       
   248                     accessNoDeleteTypes,
       
   249                     MSmlDmDDFObject::EOne,
       
   250                     MSmlDmDDFObject::EPermanent,
       
   251                     MSmlDmDDFObject::EChr,
       
   252                     KNSmlDMStreamingAdapterNetInfo );
       
   253                     
       
   254     
       
   255     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoWLAN");
       
   256     MSmlDmDDFObject& netInfoWLAN = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoWLAN);
       
   257     FillNodeInfoL(  netInfoWLAN, 
       
   258                     accessNoDeleteTypes,
       
   259                     MSmlDmDDFObject::EOne,
       
   260                     MSmlDmDDFObject::EPermanent,
       
   261                     MSmlDmDDFObject::EChr,
       
   262                     KNSmlDMStreamingAdapterNetInfo );
       
   263                     
       
   264     
       
   265     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoCDMA");
       
   266     MSmlDmDDFObject& netInfoCDMA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoCDMA);
       
   267     FillNodeInfoL(  netInfoCDMA, 
       
   268                     accessNoDeleteTypes,
       
   269                     MSmlDmDDFObject::EOne,
       
   270                     MSmlDmDDFObject::EPermanent,
       
   271                     MSmlDmDDFObject::EChr,
       
   272                     KNSmlDMStreamingAdapterNetInfo );
       
   273     
       
   274     
       
   275     
       
   276     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoHSDPA");
       
   277     MSmlDmDDFObject& netInfoHSDPA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoHSDPA);
       
   278     FillNodeInfoL(  netInfoHSDPA, 
       
   279                     accessNoDeleteTypes,
       
   280                     MSmlDmDDFObject::EOne,
       
   281                     MSmlDmDDFObject::EPermanent,
       
   282                     MSmlDmDDFObject::EChr,
       
   283                     KNSmlDMStreamingAdapterNetInfo );
       
   284     
       
   285     
       
   286     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterMinUdpPort");
       
   287     MSmlDmDDFObject& minUdpPort = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterMinUdpPort);
       
   288     FillNodeInfoL(  minUdpPort, 
       
   289                     accessNoDeleteTypes,
       
   290                     MSmlDmDDFObject::EOne,
       
   291                     MSmlDmDDFObject::EPermanent,
       
   292                     MSmlDmDDFObject::EInt,
       
   293                     KNSmlDMStreamingAdapterMinUdpPortDescription );
       
   294     
       
   295     
       
   296     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterMaxUdpPort");
       
   297     MSmlDmDDFObject& maxUdpPort = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterMaxUdpPort);
       
   298     FillNodeInfoL(  maxUdpPort, 
       
   299                     accessNoDeleteTypes,
       
   300                     MSmlDmDDFObject::EOne,
       
   301                     MSmlDmDDFObject::EPermanent,
       
   302                     MSmlDmDDFObject::EInt,
       
   303                     KNSmlDMStreamingAdapterMaxUdpPortDescription );
       
   304     
       
   305     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): end");
       
   306     }
       
   307     
       
   308 void CNSmlDmStreamingAdapter::SetNetInfoL(const TDesC8& aObject,const TDesC8 &aDes,TDataBearer aBearer,const TInt aStatusRef,const TInt aMnMaxBw, const TInt aMxMaxBw,const TInt aMnSusBw,const TInt aMxSusBw)
       
   309 	{
       
   310 	TInt aSusBw;
       
   311   TInt aMaxBw;
       
   312   TLex8 aConv;      
       
   313   TInt err;
       
   314   //aConv = aObject;
       
   315   TInt ret = aObject.Locate(KCommaSep()[0]);
       
   316   TInt ret1 = aObject.LocateReverse(KCommaSep()[0]);
       
   317   
       
   318   TInt len = aObject.Length() - (ret1 + 1);
       
   319   TPtrC8 segment1 = aObject.Right( len );
       
   320   aConv = segment1;
       
   321  
       
   322   TPtrC8 firstSeg = aObject.Left( ret );
       
   323   if(firstSeg.Compare(aDes))
       
   324       {
       
   325             DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d:  Error in SetMaxBandwidth"), aBearer);
       
   326       iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   327       return;
       
   328       }
       
   329   
       
   330   
       
   331   err = aConv.Val(aMaxBw);
       
   332   if(err != KErrNone)
       
   333       {
       
   334             DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in Conversion"), aBearer);
       
   335       iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   336       return;
       
   337       }
       
   338 
       
   339   if(aMaxBw > 0)
       
   340   	{
       
   341   	err = iModel->SetMaxBandwidth(aMaxBw,aBearer);
       
   342   	}
       
   343   else
       
   344   	{
       
   345   	_DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxBandwidth");
       
   346     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   347     return;
       
   348     }
       
   349     
       
   350   if(err != KErrNone)
       
   351       {
       
   352       DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in SetMaxBandwidth"), aBearer);
       
   353       iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   354       return;
       
   355       //return retValue;
       
   356       }
       
   357   
       
   358 
       
   359   TBuf8<KMaxLengthTempInfo> aSusBf;
       
   360   for(TInt i = (ret+1); i < (ret1); i++)
       
   361       {
       
   362       aSusBf.Append(aObject[i]);
       
   363       }
       
   364   aConv = aSusBf;
       
   365   err = aConv.Val(aSusBw);
       
   366   if(err != KErrNone)
       
   367       {
       
   368             DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in Conversion"), aBearer);
       
   369       iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   370       return;
       
   371       }
       
   372   
       
   373   if(aSusBw > 0)
       
   374   	{
       
   375   	err = iModel->SetSustainBandwidth(aSusBw,aBearer);
       
   376   	}
       
   377   else
       
   378   	{
       
   379   	_DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetSustainBandwidth");
       
   380     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   381     return;
       
   382     }
       
   383   
       
   384     if(err != KErrNone)
       
   385 		    {
       
   386 		    DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in SetSustainBandwidth"), aBearer);
       
   387 		    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   388 		    return;
       
   389 		    }
       
   390     if(aMaxBw > aMxMaxBw || aMaxBw < aMnMaxBw)
       
   391   	    {
       
   392         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error Invalid aMaxBw"), aBearer);
       
   393         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   394         return;
       
   395         }
       
   396     if(aSusBw > aMxSusBw || aSusBw < aMnSusBw)
       
   397         {
       
   398         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error Invalid aSusBw"), aBearer);
       
   399         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   400         return;
       
   401         }
       
   402 
       
   403   iModel->StoreSettingsL();
       
   404   
       
   405   iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   406 	}
       
   407 
       
   408 // -----------------------------------------------------------------------------
       
   409 //  CNSmlDmStreamingAdapter::UpdateLeafObjectL()
       
   410 // -----------------------------------------------------------------------------
       
   411 void CNSmlDmStreamingAdapter::UpdateLeafObjectL( const TDesC8& aURI, 
       
   412                                                const TDesC8& aLUID, 
       
   413                                                const TDesC8& aObject, 
       
   414                                                const TDesC8& aType, 
       
   415                                                const TInt aStatusRef )
       
   416     {
       
   417     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin");
       
   418     
       
   419 		//CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
   420     TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
       
   421     if ( ret == KErrNotFound ) 
       
   422         {
       
   423         //retValue = CSmlDmAdapter::EError;
       
   424         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   425         }
       
   426     else
       
   427         {
       
   428         //iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
       
   429         TInt len = aURI.Length() - (ret + 1);
       
   430         TPtrC8 segment = aURI.Right( len );
       
   431         
       
   432         if(segment == KNSmlDMStreamingAdapterName)
       
   433             {
       
   434             	// Set for Streaming Configuration Name
       
   435             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterName");
       
   436             TBuf<KMaxLengthStreamingName> aBuf;
       
   437             TInt aErr;
       
   438             CRepository* centrep( NULL);
       
   439             aBuf.Zero();
       
   440             if(aObject.Length() <= KMaxLengthStreamingName)
       
   441                {
       
   442             aBuf.Copy(aObject);
       
   443                }
       
   444             else
       
   445                 {
       
   446                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in KMaxLengthStreamingName");
       
   447                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject);
       
   448                 return;
       
   449                 }
       
   450    					
       
   451             centrep = CRepository::NewLC( KCRUidStreamingAdapter );
       
   452             if ( centrep )
       
   453                 {
       
   454                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Inside Cenrep Get");
       
   455                 aErr = centrep->Set( KStreamingConfigurationName, aBuf );
       
   456                 if(aErr != KErrNone)
       
   457                     {
       
   458                     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in CenRep Get");
       
   459                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   460                     CleanupStack::PopAndDestroy(centrep);	
       
   461                     return;
       
   462                     }
       
   463                 CleanupStack::PopAndDestroy(centrep);
       
   464                 iModel->StoreSettingsL();
       
   465                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
       
   466                 }
       
   467             else
       
   468                 {
       
   469                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in Creating the cenrep");
       
   470                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   471                 }
       
   472             }
       
   473         else if(segment == KNSmlDMStreamingAdapterToProxy)
       
   474             {
       
   475             	// Set for Streaming settings proxy address
       
   476             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterToProxy");
       
   477             TBuf<KMaxLengthToProxy> aBuf;
       
   478             if(aObject.Length() <= KMaxLengthToProxy)
       
   479                {
       
   480             aBuf.Copy(aObject);
       
   481                }
       
   482            else
       
   483                {
       
   484                _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in KMaxLengthToProxy");
       
   485                iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject);
       
   486                return;
       
   487                }
       
   488             ret = iModel->SetProxyHostNameL(aBuf);
       
   489             if(ret != KErrNone)
       
   490                 {
       
   491                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetProxyHostNameL %d"), ret);
       
   492                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   493                 return;
       
   494                 }
       
   495             iModel->StoreSettingsL();    
       
   496             iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );    
       
   497             }
       
   498         else if(segment == KNSmlDMStreamingAdapterToNapID)
       
   499             {
       
   500            	SetDefaultApL(aObject,aStatusRef);
       
   501            	/*
       
   502             TInt aNap;
       
   503             TUint32 aNapId;
       
   504             TLex8 aConv;
       
   505             aConv = aObject;
       
   506             CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
       
   507             CleanupStack::PushL(iapmatch);
       
   508             
       
   509             aNap = iapmatch->IAPIdFromURIL(aObject);
       
   510             
       
   511             if(aNap == KErrNotFound)
       
   512                 {
       
   513                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in IAPIdFromURIL %d"), aNap);
       
   514                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
       
   515                 return;
       
   516                 }
       
   517                 
       
   518             aNapId = aNap;
       
   519             CleanupStack::PopAndDestroy(); // iapMatch
       
   520             
       
   521             TInt ret;// = aConv.Val(aNapId,EDecimal);
       
   522             ret = iModel->SetDefaultAp(aNapId);
       
   523             if(ret == KErrNone)
       
   524                 {
       
   525                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): SetDefaultAp success %d"), ret);
       
   526                 iModel->StoreSettingsL();
       
   527                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );    
       
   528                 }
       
   529             else
       
   530                 {
       
   531                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetDefaultAp %d"), ret);
       
   532                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
       
   533                 }*/
       
   534             }
       
   535         else if(segment == KNSmlDMStreamingAdapterNetInfoGPRS)
       
   536             {
       
   537                 // Set for the netwrok information when Databearer is GPRS
       
   538             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoGPRS");
       
   539             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoGPRS,EBearerGPRS,aStatusRef,KMnMaxBwGPRS,KMxMaxBwGPRS,KMnSusBwGPRS,KMxSusBwGPRS);
       
   540             }
       
   541         else if(segment == KNSmlDMStreamingAdapterNetInfoEGPRS)
       
   542             {
       
   543                 // Set for the netwrok information when Databearer is EGPRS
       
   544             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoEGPRS");
       
   545             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoEGPRS,EBearerEGPRS,aStatusRef,KMnMaxBwEGPRS,KMxMaxBwEGPRS,KMnSusBwEGPRS,KMxSusBwEGPRS);
       
   546             }
       
   547         else if(segment == KNSmlDMStreamingAdapterNetInfoWCDMA)
       
   548             {
       
   549                 // Set for the netwrok information when Databearer is  WCDMA
       
   550             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWCDMA");
       
   551             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoWCDMA,EBearerWCDMA,aStatusRef,KMnMaxBwWCDMA,KMxMaxBwWCDMA,KMnSusBwWCDMA,KMxSusBwWCDMA);
       
   552             }
       
   553         else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA2000)
       
   554             {
       
   555                 // Set for the netwrok information when Databearer is CDMA2000
       
   556             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA2000");
       
   557             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoCDMA2000,EBearerCDMA2000,aStatusRef,KMnMaxBwCDMA2000,KMxMaxBwCDMA2000,KMnSusBwCDMA2000,KMxSusBwCDMA2000);
       
   558             }
       
   559         else if(segment == KNSmlDMStreamingAdapterNetInfoWLAN)
       
   560             {
       
   561                 // Set for the netwrok information when Databearer is WLAN
       
   562             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWLAN");
       
   563             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoWLAN,EBearerWLAN,aStatusRef,KMnMaxBwWLAN,KMxMaxBwWLAN,KMnSusBwWLAN,KMxSusBwWLAN);
       
   564             }
       
   565         else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA)
       
   566             {
       
   567                 // Set for the netwrok information when Databearer is CDMA
       
   568             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA");
       
   569             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoCDMA,EBearerCDMA,aStatusRef,KMnMaxBwCDMA,KMxMaxBwCDMA,KMnSusBwCDMA,KMxSusBwCDMA);
       
   570             }
       
   571         else if(segment == KNSmlDMStreamingAdapterNetInfoHSDPA)
       
   572             {
       
   573                 // Set for the netwrok information when Databearer is HSDPA
       
   574             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoHSDPA");
       
   575             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoHSDPA,EBearerHSDPA,aStatusRef,KMnMaxBwHSDPA,KMxMaxBwHSDPA,KMnSusBwHSDPA,KMxSusBwHSDPA);
       
   576             }                
       
   577         else if(segment == KNSmlDMStreamingAdapterMinUdpPort)
       
   578             {
       
   579             	// Set for the min udp port for streaming settings
       
   580             	SetMinUDPPortL(aObject,aStatusRef);
       
   581             	/*
       
   582             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterMinUdpPort");
       
   583             TInt aMinPort;
       
   584             TInt aMaxPort;
       
   585             TLex8 aConv;
       
   586             TInt ret = KErrNone;
       
   587             aConv = aObject;
       
   588             ret = iModel->GetMaxUDPPort(aMaxPort);
       
   589             if(ret != KErrNone)
       
   590                 {
       
   591                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMaxUDPPort: %d"), ret);
       
   592                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   593                 return;
       
   594                 }
       
   595             ret = aConv.Val(aMinPort);
       
   596             if(ret != KErrNone)
       
   597             	{
       
   598       	      _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion");
       
   599               iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   600               return;
       
   601             	}
       
   602             
       
   603             
       
   604             if(aMinPort < (aMaxPort - KPortDiff) && aMinPort >= KMinPort && aMinPort < KMaxPort)
       
   605                 {
       
   606                 ret = iModel->SetMinUDPPort(aMinPort);
       
   607                 if(ret != KErrNone)
       
   608                     {
       
   609                     DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMinUDPPort: %d"), ret);
       
   610                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   611                     return;
       
   612                     }
       
   613                 iModel->StoreSettingsL();
       
   614                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   615                 }
       
   616             else
       
   617                 {
       
   618                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value");
       
   619                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   620                 }
       
   621                 */
       
   622             }
       
   623         else if(segment == KNSmlDMStreamingAdapterMaxUdpPort)
       
   624             {
       
   625             	SetMaxUDPPortL(aObject,aStatusRef);
       
   626             	// Set for the max udp port for streaming settings
       
   627             	/*
       
   628             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin");
       
   629             TInt aMaxPort;
       
   630             TInt aMinPort;
       
   631             TLex8 aConv;
       
   632             TInt ret = KErrNone;
       
   633             aConv = aObject;
       
   634             ret = iModel->GetMinUDPPort(aMinPort);
       
   635             if(ret != KErrNone)
       
   636                 {
       
   637                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMinUDPPort: %d"), ret);
       
   638                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   639                 return;
       
   640                 }
       
   641             ret = aConv.Val(aMaxPort);
       
   642             if(ret != KErrNone)
       
   643             	{
       
   644       	      _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion");
       
   645               iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   646               return;
       
   647             	}
       
   648             
       
   649             if(aMaxPort > (aMinPort + KPortDiff) && aMaxPort >= KMinPort && aMaxPort <= KMaxPort )
       
   650                 {
       
   651                 ret = iModel->SetMaxUDPPort(aMaxPort);
       
   652                 if(ret != KErrNone)
       
   653                     {
       
   654                     DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxUDPPort: %d"), ret);
       
   655                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   656                     return;
       
   657                     }
       
   658                 iModel->StoreSettingsL();
       
   659                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   660                 }
       
   661             else
       
   662                 {
       
   663                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value");
       
   664                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   665                 } */    
       
   666             }
       
   667         }
       
   668     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): end");
       
   669     }
       
   670     
       
   671     void CNSmlDmStreamingAdapter::SetDefaultApL(const TDesC8& aObject,const TInt aStatusRef)
       
   672     {
       
   673     TInt aNap;
       
   674     TUint32 aNapId;
       
   675     TLex8 aConv;
       
   676     aConv = aObject;
       
   677     CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
       
   678     CleanupStack::PushL(iapmatch);
       
   679     
       
   680     aNap = iapmatch->IAPIdFromURIL(aObject);
       
   681     
       
   682     if(aNap == KErrNotFound)
       
   683         {
       
   684         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in IAPIdFromURIL %d"), aNap);
       
   685         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
       
   686         return;
       
   687         }
       
   688         
       
   689     aNapId = aNap;
       
   690     CleanupStack::PopAndDestroy(); // iapMatch
       
   691     
       
   692     TInt ret;// = aConv.Val(aNapId,EDecimal);
       
   693     ret = iModel->SetDefaultAp(aNapId);
       
   694     if(ret == KErrNone)
       
   695         {
       
   696         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): SetDefaultAp success %d"), ret);
       
   697         iModel->StoreSettingsL();
       
   698         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );    
       
   699         }
       
   700     else
       
   701         {
       
   702         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetDefaultAp %d"), ret);
       
   703         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
       
   704         }
       
   705     }
       
   706     
       
   707     void CNSmlDmStreamingAdapter::SetMinUDPPortL(const TDesC8& aObject,const TInt aStatusRef)
       
   708     {
       
   709     			_DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterMinUdpPort");
       
   710             TInt aMinPort;
       
   711             TInt aMaxPort;
       
   712             TLex8 aConv;
       
   713             TInt ret = KErrNone;
       
   714             aConv = aObject;
       
   715             ret = iModel->GetMaxUDPPort(aMaxPort);
       
   716             if(ret != KErrNone)
       
   717                 {
       
   718                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMaxUDPPort: %d"), ret);
       
   719                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   720                 return;
       
   721                 }
       
   722             ret = aConv.Val(aMinPort);
       
   723             if(ret != KErrNone)
       
   724             	{
       
   725       	      _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion");
       
   726               iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   727               return;
       
   728             	}
       
   729             
       
   730             
       
   731             if(aMinPort < (aMaxPort - KPortDiff) && aMinPort >= KMinPort && aMinPort < KMaxPort)
       
   732                 {
       
   733                 ret = iModel->SetMinUDPPort(aMinPort);
       
   734                 if(ret != KErrNone)
       
   735                     {
       
   736                     DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMinUDPPort: %d"), ret);
       
   737                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   738                     return;
       
   739                     }
       
   740                 iModel->StoreSettingsL();
       
   741                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   742                 }
       
   743             else
       
   744                 {
       
   745                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value");
       
   746                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   747                 }
       
   748     }
       
   749     
       
   750     void CNSmlDmStreamingAdapter::SetMaxUDPPortL(const TDesC8& aObject,const TInt aStatusRef)
       
   751     {
       
   752     			_DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin");
       
   753             TInt aMaxPort;
       
   754             TInt aMinPort;
       
   755             TLex8 aConv;
       
   756             TInt ret = KErrNone;
       
   757             aConv = aObject;
       
   758             ret = iModel->GetMinUDPPort(aMinPort);
       
   759             if(ret != KErrNone)
       
   760                 {
       
   761                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMinUDPPort: %d"), ret);
       
   762                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   763                 return;
       
   764                 }
       
   765             ret = aConv.Val(aMaxPort);
       
   766             if(ret != KErrNone)
       
   767             	{
       
   768       	      _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion");
       
   769               iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   770               return;
       
   771             	}
       
   772             
       
   773             if(aMaxPort > (aMinPort + KPortDiff) && aMaxPort >= KMinPort && aMaxPort <= KMaxPort )
       
   774                 {
       
   775                 ret = iModel->SetMaxUDPPort(aMaxPort);
       
   776                 if(ret != KErrNone)
       
   777                     {
       
   778                     DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxUDPPort: %d"), ret);
       
   779                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   780                     return;
       
   781                     }
       
   782                 iModel->StoreSettingsL();
       
   783                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   784                 }
       
   785             else
       
   786                 {
       
   787                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value");
       
   788                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   789                 }
       
   790       }
       
   791 
       
   792 
       
   793 // -----------------------------------------------------------------------------
       
   794 // CNSmlDmStreamingAdapter::DeleteObjectL()
       
   795 // -----------------------------------------------------------------------------
       
   796 void CNSmlDmStreamingAdapter::DeleteObjectL( const TDesC8& /*aURI*/, 
       
   797                                            const TDesC8& /*aLUID*/, 
       
   798                                            const TInt aStatusRef )
       
   799     {
       
   800     _DBG_FILE("CNSmlDmStreamingAdapter::DeleteLeafObjectL( ): begin");
       
   801     _DBG_FILE("CNSmlDmStreamingAdapter::DeleteLeafObjectL( ): end");
       
   802     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed );
       
   803     }
       
   804 
       
   805 
       
   806 // -----------------------------------------------------------------------------
       
   807 //  CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   808 // const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef )
       
   809 // -----------------------------------------------------------------------------
       
   810 void CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, 
       
   811                                               const TDesC8& /*aLUID*/, 
       
   812                                               const TDesC8& aType, 
       
   813                                               const TInt aResultsRef, 
       
   814                                               const TInt aStatusRef )
       
   815     {
       
   816     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): begin");
       
   817     
       
   818     CBufBase *object = CBufFlat::NewL( 1 );
       
   819     CleanupStack::PushL( object );
       
   820     
       
   821     CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
       
   822     
       
   823     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   824     iDmCallback->SetResultsL( aResultsRef, *object, aType );
       
   825     CleanupStack::PopAndDestroy(); //object
       
   826     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): end");
       
   827     }
       
   828 
       
   829 
       
   830 // -----------------------------------------------------------------------------
       
   831 //  CNSmlDmStreamingAdapter::ChildURIListL( const TDesC& aURI, 
       
   832 // const TDesC& aParentLUID, const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   833 // const TInt aResultsRef, const TInt aStatusRef )
       
   834 // -----------------------------------------------------------------------------
       
   835 void CNSmlDmStreamingAdapter::ChildURIListL( const TDesC8& aURI, 
       
   836                                            const TDesC8& /*aParentLUID*/, 
       
   837                                            const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/, 
       
   838                                            const TInt aResultsRef, 
       
   839                                            const TInt aStatusRef )
       
   840     {
       
   841     _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin");
       
   842     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
   843     CBufBase* currentURISegmentList = CBufFlat::NewL( 1 );
       
   844     CleanupStack::PushL( currentURISegmentList );
       
   845     TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
       
   846     if ( ret == KErrNotFound ) 
       
   847         {
       
   848         ret = -1;
       
   849         }
       
   850     TInt len = aURI.Length() - ( ret + 1 );
       
   851     TPtrC8 segment = aURI.Right( len );
       
   852 
       
   853     if ( segment == KNSmlDMStreamingAdapterNodeName )
       
   854         {
       
   855         _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin");
       
   856       	currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMStreamingAdapterVal() );
       
   857         }
       
   858     else if ( segment == KNSmlDMStreamingAdapterNetInfo )
       
   859         {
       
   860         _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin");
       
   861       	currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMStreamingAdapterNetInfoVal() );
       
   862         }
       
   863     
       
   864     else
       
   865         {
       
   866         retValue = CSmlDmAdapter::EError;
       
   867         }
       
   868     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   869     iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
       
   870     CleanupStack::PopAndDestroy(); //currentURISegmentList
       
   871     _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): end");
       
   872     }
       
   873 
       
   874 
       
   875 // -----------------------------------------------------------------------------
       
   876 // CNSmlDmStreamingAdapter::AddNodeObjectL( const TDesC8& aURI, 
       
   877 // const TDesC8& aParentLUID, const TInt aStatusRef )
       
   878 // -----------------------------------------------------------------------------
       
   879 void CNSmlDmStreamingAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, 
       
   880                                             const TDesC8& /*aParentLUID*/, 
       
   881                                             const TInt aStatusRef )
       
   882     {
       
   883     _DBG_FILE("CNSmlDmStreamingAdapter::AddNodeObjectL(): begin");
       
   884     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed );
       
   885     _DBG_FILE("CNSmlDmStreamingAdapter::AddNodeObjectL(): end");
       
   886     }
       
   887 
       
   888 // -----------------------------------------------------------------------------
       
   889 //  CNSmlDmStreamingAdapter::UpdateLeafObjectL()
       
   890 // -----------------------------------------------------------------------------
       
   891 void CNSmlDmStreamingAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, 
       
   892                                                const TDesC8& /*aLUID*/, 
       
   893                                                RWriteStream*& /*aStream*/, 
       
   894                                                const TDesC8& /*aType*/, 
       
   895                                                const TInt aStatusRef )
       
   896     {
       
   897     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): stream: begin");
       
   898     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   899     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): stream: end");
       
   900     }
       
   901 
       
   902 
       
   903 // -----------------------------------------------------------------------------
       
   904 //  CNSmlDmStreamingAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   905 //  const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef )
       
   906 // -----------------------------------------------------------------------------
       
   907 void CNSmlDmStreamingAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   908                                                   const TDesC8& /*aLUID*/, 
       
   909                                                   const TDesC8& aType, 
       
   910                                                   const TInt aResultsRef, 
       
   911                                                   const TInt aStatusRef )
       
   912     {
       
   913 
       
   914     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectSizeL(): begin");
       
   915     
       
   916     CBufBase *object = CBufFlat::NewL( 1 );
       
   917     CleanupStack::PushL( object );
       
   918     CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
       
   919         
       
   920     TInt objSizeInBytes = object->Size();
       
   921     TBuf8<2> stringObjSizeInBytes;
       
   922     stringObjSizeInBytes.Num( objSizeInBytes );
       
   923     object->Reset();
       
   924     object->InsertL( 0, stringObjSizeInBytes );
       
   925     
       
   926     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   927     iDmCallback->SetResultsL( aResultsRef, *object, aType );
       
   928     CleanupStack::PopAndDestroy(); //object
       
   929     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectSizeL(): end");
       
   930     }
       
   931     
       
   932 
       
   933 // -----------------------------------------------------------------------------
       
   934 //  CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, 
       
   935 //  const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef )
       
   936 // -----------------------------------------------------------------------------
       
   937 void CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, const TDesC8& aType, const TInt aStatusRef )
       
   938     {
       
   939     _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): begin");
       
   940     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   941     _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): end");
       
   942     }
       
   943 
       
   944 // -----------------------------------------------------------------------------
       
   945 //  CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, 
       
   946 //  const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType, 
       
   947 //  TInt aStatusRef )
       
   948 // -----------------------------------------------------------------------------
       
   949 void CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, 
       
   950                                              const TDesC8& /*aParentLUID*/, 
       
   951                                              RWriteStream*& /*aStream*/, 
       
   952                                              const TDesC8& /*aType*/, 
       
   953                                              const TInt aStatusRef )
       
   954     {
       
   955     _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): stream: begin");
       
   956     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   957     _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): stream: end");
       
   958     }
       
   959 
       
   960 // -----------------------------------------------------------------------------
       
   961 //  CNSmlDmStreamingAdapter::CopyCommandL( const TDesC8& aTargetURI, const TDesC8& 
       
   962 //  aSourceURI, const TDesC8& aSourceLUID, const TDesC8& /*aType*/, TInt aStatusRef )
       
   963 // -----------------------------------------------------------------------------
       
   964 void CNSmlDmStreamingAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& 
       
   965                                           /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, 
       
   966                                           const TDesC8& /*aSourceLUID*/, 
       
   967                                           const TDesC8& /*aType*/, TInt aStatusRef )
       
   968     {
       
   969     _DBG_FILE("CNSmlDmStreamingAdapter::CopyCommandL(): begin");
       
   970     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   971     _DBG_FILE("CNSmlDmStreamingAdapter::CopyCommandL(): end");
       
   972     }
       
   973 
       
   974 // --------------------------------------
       
   975 //  CNSmlDmStreamingAdapter::StartAtomicL()
       
   976 // --------------------------------------
       
   977 void CNSmlDmStreamingAdapter::StartAtomicL()
       
   978     {
       
   979     _DBG_FILE("CNSmlDmStreamingAdapter::StartAtomicL(): begin");
       
   980     _DBG_FILE("CNSmlDmStreamingAdapter::StartAtomicL(): end");
       
   981     }
       
   982     
       
   983 // ---------------------------------------
       
   984 //  CNSmlDmStreamingAdapter::CommitAtomicL()
       
   985 // ---------------------------------------
       
   986 void CNSmlDmStreamingAdapter::CommitAtomicL()
       
   987     {
       
   988     _DBG_FILE("CNSmlDmStreamingAdapter::CommitAtomicL(): begin");
       
   989     _DBG_FILE("CNSmlDmStreamingAdapter::CommitAtomicL(): end");
       
   990     }
       
   991 
       
   992 // -----------------------------------------
       
   993 //  CNSmlDmStreamingAdapter::RollbackAtomicL()
       
   994 // -----------------------------------------
       
   995 void CNSmlDmStreamingAdapter::RollbackAtomicL()
       
   996     {
       
   997     _DBG_FILE("CNSmlDmStreamingAdapter::RollbackAtomicL(): begin");
       
   998     _DBG_FILE("CNSmlDmStreamingAdapter::RollbackAtomicL(): end");
       
   999     }
       
  1000 
       
  1001 // -----------------------------------------------------------
       
  1002 //  CNSmlDmStreamingAdapter::StreamingSupport( TInt& aItemSize )
       
  1003 // -----------------------------------------------------------  
       
  1004 TBool CNSmlDmStreamingAdapter::StreamingSupport( TInt& /*aItemSize*/ )
       
  1005     {
       
  1006     _DBG_FILE("CNSmlDmStreamingAdapter::StreamingSupport(): begin");
       
  1007     _DBG_FILE("CNSmlDmStreamingAdapter::StreamingSupport(): end");
       
  1008     return EFalse;
       
  1009     }
       
  1010 
       
  1011 // ------------------------------------------
       
  1012 //  CNSmlDmStreamingAdapter::StreamCommittedL()
       
  1013 // ------------------------------------------
       
  1014 void CNSmlDmStreamingAdapter::StreamCommittedL()
       
  1015     {
       
  1016     _DBG_FILE("CNSmlDmStreamingAdapter::StreamCommittedL(): begin");
       
  1017     _DBG_FILE("CNSmlDmStreamingAdapter::StreamCommittedL(): end");
       
  1018     }
       
  1019 
       
  1020 // --------------------------------------------------
       
  1021 //  CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL()
       
  1022 // --------------------------------------------------   
       
  1023 void CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL()
       
  1024     {
       
  1025     _DBG_FILE("CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL(): begin");
       
  1026     _DBG_FILE("CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL(): end");    
       
  1027     }
       
  1028 
       
  1029 
       
  1030 CSmlDmAdapter::TError CNSmlDmStreamingAdapter::GetNetInfoL(CBufBase& aObject,TDataBearer aBearer,const TDesC8 &aDes)
       
  1031     {
       
  1032       TBuf8<KMaxLengthNetInfo> aNetInfoBuf;   
       
  1033       CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  1034       TInt err;
       
  1035       aNetInfoBuf.Append(aDes);
       
  1036       aNetInfoBuf.Append(KCommaSep);
       
  1037               
       
  1038       TInt aSusBw = 0;
       
  1039       err = iModel->GetSustainBandwidth(aSusBw,aBearer);
       
  1040       if(err != KErrNone)
       
  1041           {
       
  1042           DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::GetNetInfoL() - %d: Error in GetSustainBandwidth: %d"),aBearer,err);
       
  1043           retValue = CSmlDmAdapter::EError;
       
  1044           return retValue;
       
  1045           }
       
  1046       TBuf8<KMaxLengthTempInfo> aSusBwBuf;
       
  1047       aSusBwBuf.Num(aSusBw);
       
  1048       aNetInfoBuf.Append(aSusBwBuf);
       
  1049       aNetInfoBuf.Append(KCommaSep);
       
  1050       //aObject.InsertL(0,aSusBwBuf);
       
  1051       
       
  1052       
       
  1053       TInt aMaxBw;
       
  1054       err = iModel->GetMaxBandwidth(aMaxBw,aBearer);
       
  1055       if(err != KErrNone)
       
  1056           {
       
  1057           DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::GetNetInfoL() - %d: Error in GetMaxBandwidth: %d"),aBearer,err);
       
  1058           retValue = CSmlDmAdapter::EError;
       
  1059           return retValue;
       
  1060           }
       
  1061       TBuf8<KMaxLengthTempInfo> aMaxBwBuf;
       
  1062       aMaxBwBuf.Num(aMaxBw);
       
  1063       aNetInfoBuf.Append(aMaxBwBuf);
       
  1064       
       
  1065       aObject.InsertL(0,aNetInfoBuf);
       
  1066       retValue= CSmlDmAdapter::EOk;
       
  1067       return retValue;
       
  1068     }
       
  1069 // -----------------------------------------------------------------------------
       
  1070 // CNSmlDmDevDetailAdapter::FetchLeafObjectL()
       
  1071 // -----------------------------------------------------------------------------
       
  1072 CSmlDmAdapter::TError CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, 
       
  1073                                                                CBufBase& aObject )
       
  1074     {
       
  1075     _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): begin");
       
  1076     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  1077     TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
       
  1078     TInt err = KErrNone;
       
  1079     if ( ret == KErrNotFound ) 
       
  1080         {
       
  1081         retValue = CSmlDmAdapter::EError;
       
  1082         }
       
  1083     else
       
  1084         {
       
  1085         TInt len = aURI.Length() - (ret + 1);
       
  1086         TPtrC8 segment = aURI.Right( len );
       
  1087         
       
  1088         if(segment == KNSmlDMStreamingAdapterName)
       
  1089             {
       
  1090             	// Get for Streaming Configuration Setting name(It is not displayed for the user).
       
  1091             _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterName");
       
  1092             TBuf8<KMaxLengthStreamingName> aName;
       
  1093             CRepository* centrep( NULL);
       
  1094             aName.Zero();
       
  1095             centrep = CRepository::NewLC( KCRUidStreamingAdapter );
       
  1096 
       
  1097             if ( centrep )
       
  1098                 {
       
  1099                 _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in CenRep");
       
  1100                 TFullName temp;
       
  1101                 
       
  1102                 if (centrep->Get( KStreamingConfigurationName, temp )==KErrNone && temp.Length() )
       
  1103                     {
       
  1104                     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Cenrep Get");
       
  1105                     temp.Trim();
       
  1106                     aName.Copy(temp);
       
  1107                     }
       
  1108                 else
       
  1109                 		{
       
  1110                 		_DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in Cenrep Get");
       
  1111                 		retValue = CSmlDmAdapter::EError;
       
  1112                 		CleanupStack::PopAndDestroy(centrep);	
       
  1113                 		return retValue;
       
  1114                 		}
       
  1115                 CleanupStack::PopAndDestroy(centrep);
       
  1116                 }
       
  1117             aObject.InsertL(0,aName);
       
  1118             retValue= CSmlDmAdapter::EOk;    
       
  1119             }
       
  1120         else if(segment == KNSmlDMStreamingAdapterToProxy)
       
  1121             {
       
  1122             	// Get for Proxy Address of the streaming settings.
       
  1123             _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterToProxy");
       
  1124             TBuf<KMaxLengthToProxy> uri;
       
  1125             err = iModel->GetProxyHostName(uri);
       
  1126             if(err != KErrNone)
       
  1127                 {
       
  1128                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in GetProxyHostName: %d"), err);
       
  1129                 retValue = CSmlDmAdapter::EError;
       
  1130                 return retValue;
       
  1131                 }
       
  1132             TPtr8 ptr = uri.Collapse(); 
       
  1133             aObject.InsertL(0,ptr); 
       
  1134             retValue= CSmlDmAdapter::EOk;
       
  1135             }
       
  1136         else if(segment == KNSmlDMStreamingAdapterToNapID)
       
  1137             {
       
  1138             	// Get for Access Point that is set in the streaming settings
       
  1139             	retValue = GetDefaultApL(aObject);
       
  1140             	retValue = CSmlDmAdapter::EOk;  // even if no AP set return with null value
       
  1141             	return retValue;
       
  1142             	/*
       
  1143             _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterToNapID");
       
  1144             TUint32 aNapId;
       
  1145             err = iModel->GetDefaultAp(aNapId);
       
  1146             if(err != KErrNone)
       
  1147                 {
       
  1148                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in GetDefaultAp: %d"), err);
       
  1149                 retValue = CSmlDmAdapter::EError;
       
  1150                 return retValue;
       
  1151                 }
       
  1152             CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
       
  1153             CleanupStack::PushL(iapmatch);
       
  1154 
       
  1155             HBufC8* uri8 = iapmatch->URIFromIAPIdL( aNapId );
       
  1156             
       
  1157             if( uri8 )
       
  1158                 {
       
  1159                 CleanupStack::PushL(uri8);
       
  1160                 aObject.InsertL(0,uri8->Des());
       
  1161                 retValue= CSmlDmAdapter::EOk;
       
  1162                 CleanupStack::PopAndDestroy(); // uri8
       
  1163                 }
       
  1164             else
       
  1165                 {
       
  1166                 _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in URIFromIAPIdL:ENotFound");
       
  1167                 retValue= CSmlDmAdapter::ENotFound;
       
  1168                 }    
       
  1169             CleanupStack::PopAndDestroy(); // iapMatch */
       
  1170             
       
  1171             }
       
  1172         else if(segment == KNSmlDMStreamingAdapterNetInfoHSDPA)
       
  1173             {
       
  1174             	// Get for network information when data bearer is HSDPA
       
  1175             _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoHSDPA");
       
  1176             retValue = GetNetInfoL(aObject,EBearerHSDPA,KNSmlDMStreamingAdapterNetInfoHSDPA);
       
  1177              return retValue;
       
  1178             
       
  1179            
       
  1180             }
       
  1181         else if(segment == KNSmlDMStreamingAdapterNetInfoGPRS)
       
  1182             {
       
  1183             	// Get for network information when data bearer is GPRS
       
  1184             _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoGPRS");
       
  1185             retValue = GetNetInfoL(aObject,EBearerGPRS,KNSmlDMStreamingAdapterNetInfoGPRS);
       
  1186             return retValue;
       
  1187             }
       
  1188         else if(segment == KNSmlDMStreamingAdapterNetInfoEGPRS)
       
  1189             {
       
  1190             	// Get for network information when data bearer is EGPRS
       
  1191             _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoEGPRS");
       
  1192             retValue = GetNetInfoL(aObject,EBearerEGPRS,KNSmlDMStreamingAdapterNetInfoEGPRS);
       
  1193             return retValue;
       
  1194             }
       
  1195         else if(segment == KNSmlDMStreamingAdapterNetInfoWCDMA)
       
  1196             {
       
  1197             	// Get for network information when data bearer is WCDMA
       
  1198             _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWCDMA");
       
  1199             retValue = GetNetInfoL(aObject,EBearerWCDMA,KNSmlDMStreamingAdapterNetInfoWCDMA);
       
  1200             return retValue;
       
  1201             }
       
  1202         else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA)
       
  1203             {
       
  1204             	// Get for network information when data bearer is CDMA
       
  1205             _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA");
       
  1206             retValue = GetNetInfoL(aObject,EBearerCDMA,KNSmlDMStreamingAdapterNetInfoCDMA);
       
  1207             return retValue;
       
  1208             }
       
  1209         else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA2000)
       
  1210             {
       
  1211             	// Get for network information when data bearer is CDMA2000
       
  1212             _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA2000");
       
  1213             retValue = GetNetInfoL(aObject,EBearerCDMA2000,KNSmlDMStreamingAdapterNetInfoCDMA2000);
       
  1214             return retValue;
       
  1215             }
       
  1216         else if(segment == KNSmlDMStreamingAdapterNetInfoWLAN)
       
  1217             {
       
  1218             	// Get for network information when data bearer is WLAN
       
  1219             _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWLAN");
       
  1220             retValue = GetNetInfoL(aObject,EBearerWLAN,KNSmlDMStreamingAdapterNetInfoWLAN);
       
  1221             return retValue;
       
  1222             }
       
  1223         else if(segment == KNSmlDMStreamingAdapterMinUdpPort)
       
  1224             {
       
  1225             	// Get for Min UDP port of streaming settings
       
  1226             _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterMinUdpPort");
       
  1227             TInt aMinPort;
       
  1228             err = iModel->GetMinUDPPort(aMinPort);
       
  1229             if(err != KErrNone)
       
  1230                 {
       
  1231                 DBG_ARGS8(_S8("CNSmlDmInfoAdapter::FetchLeafObjectL(): Error in GetMinUDPPort: %d"), err);
       
  1232                 retValue = CSmlDmAdapter::EError;
       
  1233                 return retValue;
       
  1234                 }
       
  1235             TBuf8<10> aMinPortBuf;
       
  1236             aMinPortBuf.Num(aMinPort);
       
  1237             aObject.InsertL(0,aMinPortBuf);
       
  1238             retValue= CSmlDmAdapter::EOk;
       
  1239             }
       
  1240         else if(segment == KNSmlDMStreamingAdapterMaxUdpPort)
       
  1241             {
       
  1242             	// Get for Max UDP port of streaming settings
       
  1243             _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterMaxUdpPort");
       
  1244             TInt aMaxPort;
       
  1245             err = iModel->GetMaxUDPPort(aMaxPort);
       
  1246             if(err != KErrNone)
       
  1247                 {
       
  1248                 DBG_ARGS8(_S8("CNSmlDmInfoAdapter::FetchLeafObjectL(): Error in GetMaxUDPPort: %d"), err);
       
  1249                 retValue= CSmlDmAdapter::EError;
       
  1250                 return retValue;
       
  1251                 }
       
  1252             TBuf8<10> aMaxPortBuf;
       
  1253             aMaxPortBuf.Num(aMaxPort);
       
  1254             aObject.InsertL(0,aMaxPortBuf);
       
  1255             retValue= CSmlDmAdapter::EOk;    
       
  1256             }
       
  1257         }
       
  1258     _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): end");
       
  1259     return retValue;
       
  1260     }
       
  1261     
       
  1262     
       
  1263     CSmlDmAdapter::TError CNSmlDmStreamingAdapter::GetDefaultApL(CBufBase& aObject)
       
  1264     {
       
  1265     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  1266     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterToNapID");
       
  1267       TUint32 aNapId;
       
  1268       TInt err;
       
  1269       err = iModel->GetDefaultAp(aNapId);
       
  1270       if(err != KErrNone)
       
  1271           {
       
  1272           DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in GetDefaultAp: %d"), err);
       
  1273           retValue = CSmlDmAdapter::EError;
       
  1274           return retValue;
       
  1275           }
       
  1276       CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
       
  1277       CleanupStack::PushL(iapmatch);
       
  1278 
       
  1279       HBufC8* uri8 = iapmatch->URIFromIAPIdL( aNapId );
       
  1280       
       
  1281       if( uri8 )
       
  1282           {
       
  1283           CleanupStack::PushL(uri8);
       
  1284           aObject.InsertL(0,uri8->Des());
       
  1285           retValue= CSmlDmAdapter::EOk;
       
  1286           CleanupStack::PopAndDestroy(); // uri8
       
  1287           }
       
  1288       else
       
  1289           {
       
  1290           _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in URIFromIAPIdL:ENotFound");
       
  1291           retValue= CSmlDmAdapter::ENotFound;
       
  1292           }    
       
  1293       CleanupStack::PopAndDestroy(); // iapMatch
       
  1294       return retValue;
       
  1295       }
       
  1296 
       
  1297 
       
  1298 // ---------------------------------------------------------------------------
       
  1299 // CNSmlDmFotaAdapter::FillNodeInfoL()
       
  1300 // Fills the DDF node info.
       
  1301 // ---------------------------------------------------------------------------
       
  1302 //
       
  1303 void CNSmlDmStreamingAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, 
       
  1304                                         const TSmlDmAccessTypes& aAccTypes, 
       
  1305                                         MSmlDmDDFObject::TOccurence aOccurrence, 
       
  1306                                         MSmlDmDDFObject::TScope aScope, 
       
  1307                                         MSmlDmDDFObject::TDFFormat aFormat, 
       
  1308                                         const TDesC8& aDescription ) const
       
  1309     {
       
  1310     _DBG_FILE("CNSmlDmInfoAdapter::FillNodeInfoL(): end");
       
  1311     aNode.SetAccessTypesL( aAccTypes );
       
  1312     aNode.SetOccurenceL( aOccurrence );
       
  1313     aNode.SetScopeL( aScope );
       
  1314     aNode.SetDFFormatL( aFormat );
       
  1315     
       
  1316     if( aFormat != MSmlDmDDFObject::ENode )
       
  1317         {
       
  1318         aNode.AddDFTypeMimeTypeL( KNSmlDMStreamingAdapterTextPlain );
       
  1319         }
       
  1320     
       
  1321     aNode.SetDescriptionL( aDescription );
       
  1322    	_DBG_FILE("CNSmlDmInfoAdapter::FillNodeInfoL(): end");
       
  1323     }
       
  1324 
       
  1325 /*
       
  1326 
       
  1327 TInt CNSmlDmStreamingAdapter::ThreadFunction(TAny* aStarted)
       
  1328     {
       
  1329     _DBG_FILE("CNSmlDmInfoAdapter::ThreadFunction(): Start");
       
  1330     CTrapCleanup* cleanup = CTrapCleanup::New();
       
  1331     _DBG_FILE("CNSmlDmInfoAdapter::CTrapCleanup New");
       
  1332     RMsgQueueBase& aMsgQ= *(RMsgQueueBase*) aStarted;
       
  1333     CNetworkInfo * aNetInfo;
       
  1334     TRAPD(err,aNetInfo = CNetworkInfo::NewL());
       
  1335     _DBG_FILE("CNSmlDmInfoAdapter::CNetworkInfo New");
       
  1336     TRAP(err,aNetInfo->GetNetworkInfoL(aMsgQ));
       
  1337     _DBG_FILE("CNSmlDmInfoAdapter::ThreadFunction(): End");
       
  1338     delete aNetInfo;
       
  1339     delete cleanup;
       
  1340     }
       
  1341 */
       
  1342 
       
  1343 // -----------------------------------------------------------------------------
       
  1344 // CStreamingAdapter::Cleanup
       
  1345 // -----------------------------------------------------------------------------
       
  1346 //
       
  1347 void CNSmlDmStreamingAdapter::Cleanup( TAny* aAny )
       
  1348     {
       
  1349     RImplInfoPtrArray* implArray = 
       
  1350         reinterpret_cast< RImplInfoPtrArray*> ( aAny );
       
  1351     implArray->ResetAndDestroy();
       
  1352     implArray->Close();
       
  1353     }
       
  1354 
       
  1355 
       
  1356 // -----------------------------------------------------------------------------
       
  1357 //
       
  1358 // -----------------------------------------------------------------------------
       
  1359 #ifndef IMPLEMENTATION_PROXY_ENTRY
       
  1360 #define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr)  {{aUid},(aFuncPtr)}
       
  1361 #endif
       
  1362 
       
  1363 const TImplementationProxy ImplementationTable[] = 
       
  1364     {
       
  1365         IMPLEMENTATION_PROXY_ENTRY(KNSmlDMStreamingAdapterImplUid, CNSmlDmStreamingAdapter::NewL)
       
  1366     };
       
  1367 
       
  1368 // -----------------------------------------------------------------------------
       
  1369 //
       
  1370 // -----------------------------------------------------------------------------
       
  1371 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
  1372     {
       
  1373     _DBG_FILE("ImplementationGroupProxy() for CNSmlDmStreamingAdapter: begin");
       
  1374     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
  1375     _DBG_FILE("ImplementationGroupProxy() for CNSmlDmStreamingAdapter: end");
       
  1376     return ImplementationTable;
       
  1377     }
       
  1378 
       
  1379 // End of file
       
  1380