omadm/omadmextensions/adapters/streamingadapter/src/nsmlstreamingadapter.cpp
branchRCL_3
changeset 58 5b858729772b
equal deleted inserted replaced
57:6757f1e2efd2 58:5b858729772b
       
     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 <ApUtils.h>
       
    30 #include <e32base.h>
       
    31 #include <e32std.h>
       
    32 #include <e32const.h>
       
    33 #include <mpsettingsmodel.h>
       
    34 #include <e32msgqueue.h>
       
    35 
       
    36 
       
    37 #include "nsmldebug.h"
       
    38 #include "nsmlconstants.h"
       
    39 #include "nsmldmconst.h"
       
    40 #include "nsmlstreamingadapter.h"
       
    41 #include "nsmldmiapmatcher.h"
       
    42 #include "streamingadapterCRKeys.h"
       
    43 
       
    44 #ifndef __WINS__
       
    45 // This lowers the unnecessary compiler warning (armv5) to remark.
       
    46 // "Warning:  #174-D: expression has no effect..." is caused by 
       
    47 // DBG_ARGS8 macro in no-debug builds.
       
    48 #pragma diag_remark 174
       
    49 #endif
       
    50 
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewL( )
       
    54 // -----------------------------------------------------------------------------
       
    55 CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewL(MSmlDmCallback* aDmCallback )
       
    56     {
       
    57     _DBG_FILE("CNSmlDmStreamingAdapter::NewL(): begin");
       
    58     CNSmlDmStreamingAdapter* self = NewLC( aDmCallback );
       
    59     CleanupStack::Pop();
       
    60     _DBG_FILE("CNSmlDmStreamingAdapter::NewL(): end");
       
    61     return self;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewLC( )
       
    66 // -----------------------------------------------------------------------------
       
    67 CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewLC(MSmlDmCallback* aDmCallback )
       
    68     {
       
    69     _DBG_FILE("CNSmlDmStreamingAdapter::NewLC(): begin");
       
    70     CNSmlDmStreamingAdapter* self = new (ELeave) CNSmlDmStreamingAdapter(aDmCallback);
       
    71     CleanupStack::PushL(self);
       
    72     self->ConstructL();
       
    73     self->iDmCallback = aDmCallback;
       
    74     _DBG_FILE("CNSmlDmStreamingAdapter::NewLC(): end");
       
    75     return self;
       
    76     }
       
    77 
       
    78 
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter()
       
    82 // -----------------------------------------------------------------------------
       
    83 CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter()
       
    84     {
       
    85     _DBG_FILE("CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter(): begin");
       
    86     if(iModel)
       
    87         delete iModel;
       
    88     _DBG_FILE("CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter(): end");
       
    89     }
       
    90     
       
    91 // -----------------------------------------------------------------------------
       
    92 // CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter()
       
    93 // -----------------------------------------------------------------------------
       
    94 
       
    95 CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments)
       
    96     {
       
    97     _DBG_FILE("CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(aEcomArguments): begin");
       
    98     _DBG_FILE("CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(aEcomArguments): end"); 
       
    99     }
       
   100 
       
   101 
       
   102 void CNSmlDmStreamingAdapter::ConstructL()
       
   103     {
       
   104     _DBG_FILE("CNSmlDmStreamingAdapter::ConstructL: begin");
       
   105         if ( !iModel )
       
   106                 {
       
   107                 RImplInfoPtrArray impl; 
       
   108                 CleanupStack::PushL( TCleanupItem( Cleanup, &impl ) );
       
   109                 CMPSettingsModel::ListImplementationsL( impl );
       
   110                 if( impl.Count() > 0 )
       
   111                     {
       
   112                     _DBG_FILE("CStreamingAdapter::ConstructL: Creating CMPSettingsModel");
       
   113                     // using the first available implementation
       
   114                     iModel= CMPSettingsModel::NewL( impl[0]->ImplementationUid() );
       
   115                     _DBG_FILE("CStreamingAdapter::ConstructL: Creating CMPSettingsModel Done" );
       
   116                     }
       
   117                 CleanupStack::PopAndDestroy(); // implArray
       
   118                 // Load default values
       
   119                 //iModel->LoadSettingsL(EConfigDefault);
       
   120                 if(iModel)
       
   121                 	iModel->LoadSettingsL(EConfigUser);
       
   122                 }
       
   123         _DBG_FILE("CNSmlDmStreamingAdapter::ConstructL: end");
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CNSmlDmStreamingAdapter::SetLeafPropertiesL()
       
   128 // -----------------------------------------------------------------------------
       
   129 void CNSmlDmStreamingAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject, 
       
   130                                                 const TSmlDmAccessTypes& aAccessTypes, 
       
   131                                                 const TDesC8& aDescription ) const
       
   132     {
       
   133     aObject.SetAccessTypesL( aAccessTypes );
       
   134     aObject.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   135     aObject.SetDFFormatL( MSmlDmDDFObject::EChr );
       
   136     aObject.AddDFTypeMimeTypeL( KNSmlDMStreamingAdapterTextPlain );
       
   137     aObject.SetDescriptionL( aDescription );
       
   138     }
       
   139 
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 //  CNSmlDmStreamingAdapter::DDFVersionL()
       
   143 // -----------------------------------------------------------------------------
       
   144 void CNSmlDmStreamingAdapter::DDFVersionL(CBufBase& aDDFVersion)
       
   145     {
       
   146     _DBG_FILE("CNSmlDmStreamingAdapter::DDFVersionL(TDes& aDDFVersion): begin");
       
   147     aDDFVersion.InsertL(0,KNSmlDMStreamingAdapterDDFVersion);
       
   148     _DBG_FILE("CNSmlDmStreamingAdapter::DDFVersionL(TDes& aDDFVersion): end");
       
   149     }
       
   150 
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 //  CNSmlDmStreamingAdapter::DDFStructureL()
       
   154 //
       
   155 // -----------------------------------------------------------------------------
       
   156 void CNSmlDmStreamingAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
       
   157     {
       
   158     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): begin");
       
   159     
       
   160     TSmlDmAccessTypes accessTypes;
       
   161     accessTypes.SetGet();
       
   162     
       
   163     TSmlDmAccessTypes accessNoDeleteTypes;
       
   164     accessNoDeleteTypes.SetGet();
       
   165     accessNoDeleteTypes.SetReplace();
       
   166     
       
   167     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNodeName");
       
   168     MSmlDmDDFObject& dmStreamingAdap = aDDF.AddChildObjectL( KNSmlDMStreamingAdapterNodeName );
       
   169     dmStreamingAdap.SetAccessTypesL( accessTypes ); 
       
   170     dmStreamingAdap.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   171     dmStreamingAdap.SetDescriptionL( KNSmlDMStreamingAdapterDescription );
       
   172   
       
   173   
       
   174   	_DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterName");
       
   175     MSmlDmDDFObject& confName = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterName);
       
   176     FillNodeInfoL(  confName, 
       
   177                     accessNoDeleteTypes,
       
   178                     MSmlDmDDFObject::EOne,
       
   179                     MSmlDmDDFObject::EPermanent,
       
   180                     MSmlDmDDFObject::EChr,
       
   181                     KNSmlDMStreamingAdapterNameDescription );
       
   182     
       
   183     
       
   184     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterToProxy");
       
   185     MSmlDmDDFObject& toProxyID = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterToProxy);
       
   186     FillNodeInfoL(  toProxyID, 
       
   187                     accessNoDeleteTypes,
       
   188                     MSmlDmDDFObject::EOne,
       
   189                     MSmlDmDDFObject::EPermanent,
       
   190                     MSmlDmDDFObject::EChr,
       
   191                     KNSmlDMStreamingAdapterToProxyDescription );
       
   192     
       
   193      
       
   194     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterToNapID");
       
   195     MSmlDmDDFObject& toNapID = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterToNapID);
       
   196     FillNodeInfoL(  toNapID, 
       
   197                     accessNoDeleteTypes,
       
   198                     MSmlDmDDFObject::EOne,
       
   199                     MSmlDmDDFObject::EPermanent,
       
   200                     MSmlDmDDFObject::EChr,
       
   201                     KNSmlDMStreamingAdapterToNapIDDescription );
       
   202     
       
   203     
       
   204     
       
   205     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfo");
       
   206     MSmlDmDDFObject& netInfo = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterNetInfo);
       
   207     FillNodeInfoL(  netInfo, 
       
   208                     accessTypes,
       
   209                     MSmlDmDDFObject::EOne,
       
   210                     MSmlDmDDFObject::EPermanent,
       
   211                     MSmlDmDDFObject::ENode,
       
   212                     KNSmlDMStreamingAdapterNetInfo );
       
   213     
       
   214     
       
   215     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoGPRS");
       
   216     MSmlDmDDFObject& netInfoGPRS = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoGPRS);
       
   217     FillNodeInfoL(  netInfoGPRS, 
       
   218                     accessNoDeleteTypes,
       
   219                     MSmlDmDDFObject::EOne,
       
   220                     MSmlDmDDFObject::EPermanent,
       
   221                     MSmlDmDDFObject::EChr,
       
   222                     KNSmlDMStreamingAdapterNetInfo );
       
   223                     
       
   224     
       
   225     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoEGPRS");
       
   226     MSmlDmDDFObject& netInfoEGPRS = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoEGPRS);
       
   227     FillNodeInfoL(  netInfoEGPRS, 
       
   228                     accessNoDeleteTypes,
       
   229                     MSmlDmDDFObject::EOne,
       
   230                     MSmlDmDDFObject::EPermanent,
       
   231                     MSmlDmDDFObject::EChr,
       
   232                     KNSmlDMStreamingAdapterNetInfo );
       
   233                     
       
   234     
       
   235     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoWCDMA");
       
   236     MSmlDmDDFObject& netInfoWCDMA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoWCDMA);
       
   237     FillNodeInfoL(  netInfoWCDMA, 
       
   238                     accessNoDeleteTypes,
       
   239                     MSmlDmDDFObject::EOne,
       
   240                     MSmlDmDDFObject::EPermanent,
       
   241                     MSmlDmDDFObject::EChr,
       
   242                     KNSmlDMStreamingAdapterNetInfo );
       
   243                     
       
   244                     
       
   245     
       
   246     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoCDMA2000");
       
   247     MSmlDmDDFObject& netInfoCDMA2000 = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoCDMA2000);
       
   248     FillNodeInfoL(  netInfoCDMA2000, 
       
   249                     accessNoDeleteTypes,
       
   250                     MSmlDmDDFObject::EOne,
       
   251                     MSmlDmDDFObject::EPermanent,
       
   252                     MSmlDmDDFObject::EChr,
       
   253                     KNSmlDMStreamingAdapterNetInfo );
       
   254                     
       
   255     
       
   256     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoWLAN");
       
   257     MSmlDmDDFObject& netInfoWLAN = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoWLAN);
       
   258     FillNodeInfoL(  netInfoWLAN, 
       
   259                     accessNoDeleteTypes,
       
   260                     MSmlDmDDFObject::EOne,
       
   261                     MSmlDmDDFObject::EPermanent,
       
   262                     MSmlDmDDFObject::EChr,
       
   263                     KNSmlDMStreamingAdapterNetInfo );
       
   264                     
       
   265     
       
   266     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoCDMA");
       
   267     MSmlDmDDFObject& netInfoCDMA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoCDMA);
       
   268     FillNodeInfoL(  netInfoCDMA, 
       
   269                     accessNoDeleteTypes,
       
   270                     MSmlDmDDFObject::EOne,
       
   271                     MSmlDmDDFObject::EPermanent,
       
   272                     MSmlDmDDFObject::EChr,
       
   273                     KNSmlDMStreamingAdapterNetInfo );
       
   274     
       
   275     
       
   276     
       
   277     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoHSDPA");
       
   278     MSmlDmDDFObject& netInfoHSDPA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoHSDPA);
       
   279     FillNodeInfoL(  netInfoHSDPA, 
       
   280                     accessNoDeleteTypes,
       
   281                     MSmlDmDDFObject::EOne,
       
   282                     MSmlDmDDFObject::EPermanent,
       
   283                     MSmlDmDDFObject::EChr,
       
   284                     KNSmlDMStreamingAdapterNetInfo );
       
   285     
       
   286     
       
   287     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterMinUdpPort");
       
   288     MSmlDmDDFObject& minUdpPort = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterMinUdpPort);
       
   289     FillNodeInfoL(  minUdpPort, 
       
   290                     accessNoDeleteTypes,
       
   291                     MSmlDmDDFObject::EOne,
       
   292                     MSmlDmDDFObject::EPermanent,
       
   293                     MSmlDmDDFObject::EInt,
       
   294                     KNSmlDMStreamingAdapterMinUdpPortDescription );
       
   295     
       
   296     
       
   297     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterMaxUdpPort");
       
   298     MSmlDmDDFObject& maxUdpPort = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterMaxUdpPort);
       
   299     FillNodeInfoL(  maxUdpPort, 
       
   300                     accessNoDeleteTypes,
       
   301                     MSmlDmDDFObject::EOne,
       
   302                     MSmlDmDDFObject::EPermanent,
       
   303                     MSmlDmDDFObject::EInt,
       
   304                     KNSmlDMStreamingAdapterMaxUdpPortDescription );
       
   305     
       
   306     _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): end");
       
   307     }
       
   308     
       
   309 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)
       
   310 	{
       
   311 	TInt aSusBw;
       
   312   TInt aMaxBw;
       
   313   TLex8 aConv;      
       
   314   TInt err;
       
   315   //aConv = aObject;
       
   316   TInt ret = aObject.Locate(KCommaSep()[0]);
       
   317   TInt ret1 = aObject.LocateReverse(KCommaSep()[0]);
       
   318   
       
   319   TInt len = aObject.Length() - (ret1 + 1);
       
   320   TPtrC8 segment1 = aObject.Right( len );
       
   321   aConv = segment1;
       
   322  
       
   323   TPtrC8 firstSeg = aObject.Left( ret );
       
   324   if(firstSeg.Compare(aDes))
       
   325       {
       
   326             DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d:  Error in SetMaxBandwidth"), aBearer);
       
   327       iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   328       return;
       
   329       }
       
   330   
       
   331   
       
   332   err = aConv.Val(aMaxBw);
       
   333   if(err != KErrNone)
       
   334       {
       
   335             DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in Conversion"), aBearer);
       
   336       iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   337       return;
       
   338       }
       
   339 
       
   340   if(aMaxBw > 0)
       
   341   	{
       
   342   	err = iModel->SetMaxBandwidth(aMaxBw,aBearer);
       
   343   	}
       
   344   else
       
   345   	{
       
   346   	_DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxBandwidth");
       
   347     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   348     return;
       
   349     }
       
   350     
       
   351   if(err != KErrNone)
       
   352       {
       
   353       DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in SetMaxBandwidth"), aBearer);
       
   354       iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   355       return;
       
   356       //return retValue;
       
   357       }
       
   358   
       
   359 
       
   360   TBuf8<KMaxLengthTempInfo> aSusBf;
       
   361   for(TInt i = (ret+1); i < (ret1); i++)
       
   362       {
       
   363       aSusBf.Append(aObject[i]);
       
   364       }
       
   365   aConv = aSusBf;
       
   366   err = aConv.Val(aSusBw);
       
   367   if(err != KErrNone)
       
   368       {
       
   369             DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in Conversion"), aBearer);
       
   370       iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   371       return;
       
   372       }
       
   373   
       
   374   if(aSusBw > 0)
       
   375   	{
       
   376   	err = iModel->SetSustainBandwidth(aSusBw,aBearer);
       
   377   	}
       
   378   else
       
   379   	{
       
   380   	_DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetSustainBandwidth");
       
   381     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   382     return;
       
   383     }
       
   384   
       
   385     if(err != KErrNone)
       
   386 		    {
       
   387 		    DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in SetSustainBandwidth"), aBearer);
       
   388 		    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   389 		    return;
       
   390 		    }
       
   391     if(aMaxBw > aMxMaxBw || aMaxBw < aMnMaxBw)
       
   392   	    {
       
   393         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error Invalid aMaxBw"), aBearer);
       
   394         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   395         return;
       
   396         }
       
   397     if(aSusBw > aMxSusBw || aSusBw < aMnSusBw)
       
   398         {
       
   399         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error Invalid aSusBw"), aBearer);
       
   400         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   401         return;
       
   402         }
       
   403 
       
   404   iModel->StoreSettingsL();
       
   405   
       
   406   iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   407 	}
       
   408 
       
   409 // -----------------------------------------------------------------------------
       
   410 //  CNSmlDmStreamingAdapter::UpdateLeafObjectL()
       
   411 // -----------------------------------------------------------------------------
       
   412 void CNSmlDmStreamingAdapter::UpdateLeafObjectL( const TDesC8& aURI, 
       
   413                                                const TDesC8& aLUID, 
       
   414                                                const TDesC8& aObject, 
       
   415                                                const TDesC8& aType, 
       
   416                                                const TInt aStatusRef )
       
   417     {
       
   418     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin");
       
   419     
       
   420 		//CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
   421     TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
       
   422     if ( ret == KErrNotFound ) 
       
   423         {
       
   424         //retValue = CSmlDmAdapter::EError;
       
   425         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   426         }
       
   427     else
       
   428         {
       
   429         //iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
       
   430         TInt len = aURI.Length() - (ret + 1);
       
   431         TPtrC8 segment = aURI.Right( len );
       
   432         
       
   433         if(segment == KNSmlDMStreamingAdapterName)
       
   434             {
       
   435             	// Set for Streaming Configuration Name
       
   436             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterName");
       
   437             TBuf<KMaxLengthStreamingName> aBuf;
       
   438             TInt aErr;
       
   439             CRepository* centrep( NULL);
       
   440             aBuf.Zero();
       
   441             if(aObject.Length() <= KMaxLengthStreamingName)
       
   442                {
       
   443             aBuf.Copy(aObject);
       
   444                }
       
   445             else
       
   446                 {
       
   447                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in KMaxLengthStreamingName");
       
   448                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject);
       
   449                 return;
       
   450                 }
       
   451    					
       
   452             centrep = CRepository::NewLC( KCRUidStreamingAdapter );
       
   453             if ( centrep )
       
   454                 {
       
   455                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Inside Cenrep Get");
       
   456                 aErr = centrep->Set( KStreamingConfigurationName, aBuf );
       
   457                 if(aErr != KErrNone)
       
   458                     {
       
   459                     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in CenRep Get");
       
   460                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   461                     CleanupStack::PopAndDestroy(centrep);	
       
   462                     return;
       
   463                     }
       
   464                 CleanupStack::PopAndDestroy(centrep);
       
   465                 iModel->StoreSettingsL();
       
   466                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
       
   467                 }
       
   468             else
       
   469                 {
       
   470                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in Creating the cenrep");
       
   471                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   472                 }
       
   473             }
       
   474         else if(segment == KNSmlDMStreamingAdapterToProxy)
       
   475             {
       
   476             	// Set for Streaming settings proxy address
       
   477             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterToProxy");
       
   478             TBuf<KMaxLengthToProxy> aBuf;
       
   479             if(aObject.Length() <= KMaxLengthToProxy)
       
   480                {
       
   481             aBuf.Copy(aObject);
       
   482                }
       
   483            else
       
   484                {
       
   485                _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in KMaxLengthToProxy");
       
   486                iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject);
       
   487                return;
       
   488                }
       
   489             ret = iModel->SetProxyHostNameL(aBuf);
       
   490             if(ret != KErrNone)
       
   491                 {
       
   492                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetProxyHostNameL %d"), ret);
       
   493                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   494                 return;
       
   495                 }
       
   496             iModel->StoreSettingsL();    
       
   497             iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );    
       
   498             }
       
   499         else if(segment == KNSmlDMStreamingAdapterToNapID)
       
   500             {
       
   501            	SetDefaultApL(aObject,aStatusRef);
       
   502            	/*
       
   503             TInt aNap;
       
   504             TUint32 aNapId;
       
   505             TLex8 aConv;
       
   506             aConv = aObject;
       
   507             CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
       
   508             CleanupStack::PushL(iapmatch);
       
   509             
       
   510             aNap = iapmatch->IAPIdFromURIL(aObject);
       
   511             
       
   512             if(aNap == KErrNotFound)
       
   513                 {
       
   514                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in IAPIdFromURIL %d"), aNap);
       
   515                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
       
   516                 return;
       
   517                 }
       
   518                 
       
   519             aNapId = aNap;
       
   520             CleanupStack::PopAndDestroy(); // iapMatch
       
   521             
       
   522             TInt ret;// = aConv.Val(aNapId,EDecimal);
       
   523             ret = iModel->SetDefaultAp(aNapId);
       
   524             if(ret == KErrNone)
       
   525                 {
       
   526                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): SetDefaultAp success %d"), ret);
       
   527                 iModel->StoreSettingsL();
       
   528                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );    
       
   529                 }
       
   530             else
       
   531                 {
       
   532                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetDefaultAp %d"), ret);
       
   533                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
       
   534                 }*/
       
   535             }
       
   536         else if(segment == KNSmlDMStreamingAdapterNetInfoGPRS)
       
   537             {
       
   538                 // Set for the netwrok information when Databearer is GPRS
       
   539             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoGPRS");
       
   540             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoGPRS,EBearerGPRS,aStatusRef,KMnMaxBwGPRS,KMxMaxBwGPRS,KMnSusBwGPRS,KMxSusBwGPRS);
       
   541             }
       
   542         else if(segment == KNSmlDMStreamingAdapterNetInfoEGPRS)
       
   543             {
       
   544                 // Set for the netwrok information when Databearer is EGPRS
       
   545             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoEGPRS");
       
   546             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoEGPRS,EBearerEGPRS,aStatusRef,KMnMaxBwEGPRS,KMxMaxBwEGPRS,KMnSusBwEGPRS,KMxSusBwEGPRS);
       
   547             }
       
   548         else if(segment == KNSmlDMStreamingAdapterNetInfoWCDMA)
       
   549             {
       
   550                 // Set for the netwrok information when Databearer is  WCDMA
       
   551             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWCDMA");
       
   552             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoWCDMA,EBearerWCDMA,aStatusRef,KMnMaxBwWCDMA,KMxMaxBwWCDMA,KMnSusBwWCDMA,KMxSusBwWCDMA);
       
   553             }
       
   554         else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA2000)
       
   555             {
       
   556                 // Set for the netwrok information when Databearer is CDMA2000
       
   557             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA2000");
       
   558             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoCDMA2000,EBearerCDMA2000,aStatusRef,KMnMaxBwCDMA2000,KMxMaxBwCDMA2000,KMnSusBwCDMA2000,KMxSusBwCDMA2000);
       
   559             }
       
   560         else if(segment == KNSmlDMStreamingAdapterNetInfoWLAN)
       
   561             {
       
   562                 // Set for the netwrok information when Databearer is WLAN
       
   563             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWLAN");
       
   564             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoWLAN,EBearerWLAN,aStatusRef,KMnMaxBwWLAN,KMxMaxBwWLAN,KMnSusBwWLAN,KMxSusBwWLAN);
       
   565             }
       
   566         else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA)
       
   567             {
       
   568                 // Set for the netwrok information when Databearer is CDMA
       
   569             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA");
       
   570             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoCDMA,EBearerCDMA,aStatusRef,KMnMaxBwCDMA,KMxMaxBwCDMA,KMnSusBwCDMA,KMxSusBwCDMA);
       
   571             }
       
   572         else if(segment == KNSmlDMStreamingAdapterNetInfoHSDPA)
       
   573             {
       
   574                 // Set for the netwrok information when Databearer is HSDPA
       
   575             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoHSDPA");
       
   576             SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoHSDPA,EBearerHSDPA,aStatusRef,KMnMaxBwHSDPA,KMxMaxBwHSDPA,KMnSusBwHSDPA,KMxSusBwHSDPA);
       
   577             }                
       
   578         else if(segment == KNSmlDMStreamingAdapterMinUdpPort)
       
   579             {
       
   580             	// Set for the min udp port for streaming settings
       
   581             	SetMinUDPPortL(aObject,aStatusRef);
       
   582             	/*
       
   583             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterMinUdpPort");
       
   584             TInt aMinPort;
       
   585             TInt aMaxPort;
       
   586             TLex8 aConv;
       
   587             TInt ret = KErrNone;
       
   588             aConv = aObject;
       
   589             ret = iModel->GetMaxUDPPort(aMaxPort);
       
   590             if(ret != KErrNone)
       
   591                 {
       
   592                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMaxUDPPort: %d"), ret);
       
   593                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   594                 return;
       
   595                 }
       
   596             ret = aConv.Val(aMinPort);
       
   597             if(ret != KErrNone)
       
   598             	{
       
   599       	      _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion");
       
   600               iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   601               return;
       
   602             	}
       
   603             
       
   604             
       
   605             if(aMinPort < (aMaxPort - KPortDiff) && aMinPort >= KMinPort && aMinPort < KMaxPort)
       
   606                 {
       
   607                 ret = iModel->SetMinUDPPort(aMinPort);
       
   608                 if(ret != KErrNone)
       
   609                     {
       
   610                     DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMinUDPPort: %d"), ret);
       
   611                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   612                     return;
       
   613                     }
       
   614                 iModel->StoreSettingsL();
       
   615                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   616                 }
       
   617             else
       
   618                 {
       
   619                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value");
       
   620                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   621                 }
       
   622                 */
       
   623             }
       
   624         else if(segment == KNSmlDMStreamingAdapterMaxUdpPort)
       
   625             {
       
   626             	SetMaxUDPPortL(aObject,aStatusRef);
       
   627             	// Set for the max udp port for streaming settings
       
   628             	/*
       
   629             _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin");
       
   630             TInt aMaxPort;
       
   631             TInt aMinPort;
       
   632             TLex8 aConv;
       
   633             TInt ret = KErrNone;
       
   634             aConv = aObject;
       
   635             ret = iModel->GetMinUDPPort(aMinPort);
       
   636             if(ret != KErrNone)
       
   637                 {
       
   638                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMinUDPPort: %d"), ret);
       
   639                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   640                 return;
       
   641                 }
       
   642             ret = aConv.Val(aMaxPort);
       
   643             if(ret != KErrNone)
       
   644             	{
       
   645       	      _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion");
       
   646               iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   647               return;
       
   648             	}
       
   649             
       
   650             if(aMaxPort > (aMinPort + KPortDiff) && aMaxPort >= KMinPort && aMaxPort <= KMaxPort )
       
   651                 {
       
   652                 ret = iModel->SetMaxUDPPort(aMaxPort);
       
   653                 if(ret != KErrNone)
       
   654                     {
       
   655                     DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxUDPPort: %d"), ret);
       
   656                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   657                     return;
       
   658                     }
       
   659                 iModel->StoreSettingsL();
       
   660                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   661                 }
       
   662             else
       
   663                 {
       
   664                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value");
       
   665                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   666                 } */    
       
   667             }
       
   668         }
       
   669     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): end");
       
   670     }
       
   671     
       
   672     void CNSmlDmStreamingAdapter::SetDefaultApL(const TDesC8& aObject,const TInt aStatusRef)
       
   673     {
       
   674     TInt aNap;
       
   675     TUint32 aNapId;
       
   676     TLex8 aConv;
       
   677     aConv = aObject;
       
   678     CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() );
       
   679     CleanupStack::PushL(iapmatch);
       
   680     
       
   681     aNap = iapmatch->IAPIdFromURIL(aObject);
       
   682     
       
   683     if(aNap == KErrNotFound)
       
   684         {
       
   685         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in IAPIdFromURIL %d"), aNap);
       
   686         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
       
   687         return;
       
   688         }
       
   689         
       
   690     aNapId = aNap;
       
   691     CleanupStack::PopAndDestroy(); // iapMatch
       
   692     
       
   693     TInt ret;// = aConv.Val(aNapId,EDecimal);
       
   694     ret = iModel->SetDefaultAp(aNapId);
       
   695     if(ret == KErrNone)
       
   696         {
       
   697         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): SetDefaultAp success %d"), ret);
       
   698         iModel->StoreSettingsL();
       
   699         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk );    
       
   700         }
       
   701     else
       
   702         {
       
   703         DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetDefaultAp %d"), ret);
       
   704         iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
       
   705         }
       
   706     }
       
   707     
       
   708     void CNSmlDmStreamingAdapter::SetMinUDPPortL(const TDesC8& aObject,const TInt aStatusRef)
       
   709     {
       
   710     			_DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterMinUdpPort");
       
   711             TInt aMinPort;
       
   712             TInt aMaxPort;
       
   713             TLex8 aConv;
       
   714             TInt ret = KErrNone;
       
   715             aConv = aObject;
       
   716             ret = iModel->GetMaxUDPPort(aMaxPort);
       
   717             if(ret != KErrNone)
       
   718                 {
       
   719                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMaxUDPPort: %d"), ret);
       
   720                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   721                 return;
       
   722                 }
       
   723             ret = aConv.Val(aMinPort);
       
   724             if(ret != KErrNone)
       
   725             	{
       
   726       	      _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion");
       
   727               iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   728               return;
       
   729             	}
       
   730             
       
   731             
       
   732             if(aMinPort < (aMaxPort - KPortDiff) && aMinPort >= KMinPort && aMinPort < KMaxPort)
       
   733                 {
       
   734                 ret = iModel->SetMinUDPPort(aMinPort);
       
   735                 if(ret != KErrNone)
       
   736                     {
       
   737                     DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMinUDPPort: %d"), ret);
       
   738                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   739                     return;
       
   740                     }
       
   741                 iModel->StoreSettingsL();
       
   742                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   743                 }
       
   744             else
       
   745                 {
       
   746                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value");
       
   747                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   748                 }
       
   749     }
       
   750     
       
   751     void CNSmlDmStreamingAdapter::SetMaxUDPPortL(const TDesC8& aObject,const TInt aStatusRef)
       
   752     {
       
   753     			_DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin");
       
   754             TInt aMaxPort;
       
   755             TInt aMinPort;
       
   756             TLex8 aConv;
       
   757             TInt ret = KErrNone;
       
   758             aConv = aObject;
       
   759             ret = iModel->GetMinUDPPort(aMinPort);
       
   760             if(ret != KErrNone)
       
   761                 {
       
   762                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMinUDPPort: %d"), ret);
       
   763                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   764                 return;
       
   765                 }
       
   766             ret = aConv.Val(aMaxPort);
       
   767             if(ret != KErrNone)
       
   768             	{
       
   769       	      _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion");
       
   770               iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   771               return;
       
   772             	}
       
   773             
       
   774             if(aMaxPort > (aMinPort + KPortDiff) && aMaxPort >= KMinPort && aMaxPort <= KMaxPort )
       
   775                 {
       
   776                 ret = iModel->SetMaxUDPPort(aMaxPort);
       
   777                 if(ret != KErrNone)
       
   778                     {
       
   779                     DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxUDPPort: %d"), ret);
       
   780                     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError);
       
   781                     return;
       
   782                     }
       
   783                 iModel->StoreSettingsL();
       
   784                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk);
       
   785                 }
       
   786             else
       
   787                 {
       
   788                 _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value");
       
   789                 iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject);
       
   790                 }
       
   791       }
       
   792 
       
   793 
       
   794 // -----------------------------------------------------------------------------
       
   795 // CNSmlDmStreamingAdapter::DeleteObjectL()
       
   796 // -----------------------------------------------------------------------------
       
   797 void CNSmlDmStreamingAdapter::DeleteObjectL( const TDesC8& /*aURI*/, 
       
   798                                            const TDesC8& /*aLUID*/, 
       
   799                                            const TInt aStatusRef )
       
   800     {
       
   801     _DBG_FILE("CNSmlDmStreamingAdapter::DeleteLeafObjectL( ): begin");
       
   802     _DBG_FILE("CNSmlDmStreamingAdapter::DeleteLeafObjectL( ): end");
       
   803     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed );
       
   804     }
       
   805 
       
   806 
       
   807 // -----------------------------------------------------------------------------
       
   808 //  CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   809 // const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef )
       
   810 // -----------------------------------------------------------------------------
       
   811 void CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, 
       
   812                                               const TDesC8& /*aLUID*/, 
       
   813                                               const TDesC8& aType, 
       
   814                                               const TInt aResultsRef, 
       
   815                                               const TInt aStatusRef )
       
   816     {
       
   817     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): begin");
       
   818     
       
   819     CBufBase *object = CBufFlat::NewL( 1 );
       
   820     CleanupStack::PushL( object );
       
   821     
       
   822     CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
       
   823     
       
   824     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   825     iDmCallback->SetResultsL( aResultsRef, *object, aType );
       
   826     CleanupStack::PopAndDestroy(); //object
       
   827     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): end");
       
   828     }
       
   829 
       
   830 
       
   831 // -----------------------------------------------------------------------------
       
   832 //  CNSmlDmStreamingAdapter::ChildURIListL( const TDesC& aURI, 
       
   833 // const TDesC& aParentLUID, const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   834 // const TInt aResultsRef, const TInt aStatusRef )
       
   835 // -----------------------------------------------------------------------------
       
   836 void CNSmlDmStreamingAdapter::ChildURIListL( const TDesC8& aURI, 
       
   837                                            const TDesC8& /*aParentLUID*/, 
       
   838                                            const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/, 
       
   839                                            const TInt aResultsRef, 
       
   840                                            const TInt aStatusRef )
       
   841     {
       
   842     _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin");
       
   843     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
   844     CBufBase* currentURISegmentList = CBufFlat::NewL( 1 );
       
   845     CleanupStack::PushL( currentURISegmentList );
       
   846     TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
       
   847     if ( ret == KErrNotFound ) 
       
   848         {
       
   849         ret = -1;
       
   850         }
       
   851     TInt len = aURI.Length() - ( ret + 1 );
       
   852     TPtrC8 segment = aURI.Right( len );
       
   853 
       
   854     if ( segment == KNSmlDMStreamingAdapterNodeName )
       
   855         {
       
   856         _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin");
       
   857       	currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMStreamingAdapterVal() );
       
   858         }
       
   859     else if ( segment == KNSmlDMStreamingAdapterNetInfo )
       
   860         {
       
   861         _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin");
       
   862       	currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMStreamingAdapterNetInfoVal() );
       
   863         }
       
   864     
       
   865     else
       
   866         {
       
   867         retValue = CSmlDmAdapter::EError;
       
   868         }
       
   869     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   870     iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
       
   871     CleanupStack::PopAndDestroy(); //currentURISegmentList
       
   872     _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): end");
       
   873     }
       
   874 
       
   875 
       
   876 // -----------------------------------------------------------------------------
       
   877 // CNSmlDmStreamingAdapter::AddNodeObjectL( const TDesC8& aURI, 
       
   878 // const TDesC8& aParentLUID, const TInt aStatusRef )
       
   879 // -----------------------------------------------------------------------------
       
   880 void CNSmlDmStreamingAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, 
       
   881                                             const TDesC8& /*aParentLUID*/, 
       
   882                                             const TInt aStatusRef )
       
   883     {
       
   884     _DBG_FILE("CNSmlDmStreamingAdapter::AddNodeObjectL(): begin");
       
   885     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed );
       
   886     _DBG_FILE("CNSmlDmStreamingAdapter::AddNodeObjectL(): end");
       
   887     }
       
   888 
       
   889 // -----------------------------------------------------------------------------
       
   890 //  CNSmlDmStreamingAdapter::UpdateLeafObjectL()
       
   891 // -----------------------------------------------------------------------------
       
   892 void CNSmlDmStreamingAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, 
       
   893                                                const TDesC8& /*aLUID*/, 
       
   894                                                RWriteStream*& /*aStream*/, 
       
   895                                                const TDesC8& /*aType*/, 
       
   896                                                const TInt aStatusRef )
       
   897     {
       
   898     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): stream: begin");
       
   899     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   900     _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): stream: end");
       
   901     }
       
   902 
       
   903 
       
   904 // -----------------------------------------------------------------------------
       
   905 //  CNSmlDmStreamingAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   906 //  const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef )
       
   907 // -----------------------------------------------------------------------------
       
   908 void CNSmlDmStreamingAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   909                                                   const TDesC8& /*aLUID*/, 
       
   910                                                   const TDesC8& aType, 
       
   911                                                   const TInt aResultsRef, 
       
   912                                                   const TInt aStatusRef )
       
   913     {
       
   914 
       
   915     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectSizeL(): begin");
       
   916     
       
   917     CBufBase *object = CBufFlat::NewL( 1 );
       
   918     CleanupStack::PushL( object );
       
   919     CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
       
   920         
       
   921     TInt objSizeInBytes = object->Size();
       
   922     TBuf8<2> stringObjSizeInBytes;
       
   923     stringObjSizeInBytes.Num( objSizeInBytes );
       
   924     object->Reset();
       
   925     object->InsertL( 0, stringObjSizeInBytes );
       
   926     
       
   927     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   928     iDmCallback->SetResultsL( aResultsRef, *object, aType );
       
   929     CleanupStack::PopAndDestroy(); //object
       
   930     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectSizeL(): end");
       
   931     }
       
   932     
       
   933 
       
   934 // -----------------------------------------------------------------------------
       
   935 //  CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, 
       
   936 //  const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef )
       
   937 // -----------------------------------------------------------------------------
       
   938 void CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, const TDesC8& aType, const TInt aStatusRef )
       
   939     {
       
   940     _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): begin");
       
   941     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   942     _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): end");
       
   943     }
       
   944 
       
   945 // -----------------------------------------------------------------------------
       
   946 //  CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, 
       
   947 //  const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType, 
       
   948 //  TInt aStatusRef )
       
   949 // -----------------------------------------------------------------------------
       
   950 void CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, 
       
   951                                              const TDesC8& /*aParentLUID*/, 
       
   952                                              RWriteStream*& /*aStream*/, 
       
   953                                              const TDesC8& /*aType*/, 
       
   954                                              const TInt aStatusRef )
       
   955     {
       
   956     _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): stream: begin");
       
   957     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   958     _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): stream: end");
       
   959     }
       
   960 
       
   961 // -----------------------------------------------------------------------------
       
   962 //  CNSmlDmStreamingAdapter::CopyCommandL( const TDesC8& aTargetURI, const TDesC8& 
       
   963 //  aSourceURI, const TDesC8& aSourceLUID, const TDesC8& /*aType*/, TInt aStatusRef )
       
   964 // -----------------------------------------------------------------------------
       
   965 void CNSmlDmStreamingAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& 
       
   966                                           /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, 
       
   967                                           const TDesC8& /*aSourceLUID*/, 
       
   968                                           const TDesC8& /*aType*/, TInt aStatusRef )
       
   969     {
       
   970     _DBG_FILE("CNSmlDmStreamingAdapter::CopyCommandL(): begin");
       
   971     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   972     _DBG_FILE("CNSmlDmStreamingAdapter::CopyCommandL(): end");
       
   973     }
       
   974 
       
   975 // --------------------------------------
       
   976 //  CNSmlDmStreamingAdapter::StartAtomicL()
       
   977 // --------------------------------------
       
   978 void CNSmlDmStreamingAdapter::StartAtomicL()
       
   979     {
       
   980     _DBG_FILE("CNSmlDmStreamingAdapter::StartAtomicL(): begin");
       
   981     _DBG_FILE("CNSmlDmStreamingAdapter::StartAtomicL(): end");
       
   982     }
       
   983     
       
   984 // ---------------------------------------
       
   985 //  CNSmlDmStreamingAdapter::CommitAtomicL()
       
   986 // ---------------------------------------
       
   987 void CNSmlDmStreamingAdapter::CommitAtomicL()
       
   988     {
       
   989     _DBG_FILE("CNSmlDmStreamingAdapter::CommitAtomicL(): begin");
       
   990     _DBG_FILE("CNSmlDmStreamingAdapter::CommitAtomicL(): end");
       
   991     }
       
   992 
       
   993 // -----------------------------------------
       
   994 //  CNSmlDmStreamingAdapter::RollbackAtomicL()
       
   995 // -----------------------------------------
       
   996 void CNSmlDmStreamingAdapter::RollbackAtomicL()
       
   997     {
       
   998     _DBG_FILE("CNSmlDmStreamingAdapter::RollbackAtomicL(): begin");
       
   999     _DBG_FILE("CNSmlDmStreamingAdapter::RollbackAtomicL(): end");
       
  1000     }
       
  1001 
       
  1002 // -----------------------------------------------------------
       
  1003 //  CNSmlDmStreamingAdapter::StreamingSupport( TInt& aItemSize )
       
  1004 // -----------------------------------------------------------  
       
  1005 TBool CNSmlDmStreamingAdapter::StreamingSupport( TInt& /*aItemSize*/ )
       
  1006     {
       
  1007     _DBG_FILE("CNSmlDmStreamingAdapter::StreamingSupport(): begin");
       
  1008     _DBG_FILE("CNSmlDmStreamingAdapter::StreamingSupport(): end");
       
  1009     return EFalse;
       
  1010     }
       
  1011 
       
  1012 // ------------------------------------------
       
  1013 //  CNSmlDmStreamingAdapter::StreamCommittedL()
       
  1014 // ------------------------------------------
       
  1015 void CNSmlDmStreamingAdapter::StreamCommittedL()
       
  1016     {
       
  1017     _DBG_FILE("CNSmlDmStreamingAdapter::StreamCommittedL(): begin");
       
  1018     _DBG_FILE("CNSmlDmStreamingAdapter::StreamCommittedL(): end");
       
  1019     }
       
  1020 
       
  1021 // --------------------------------------------------
       
  1022 //  CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL()
       
  1023 // --------------------------------------------------   
       
  1024 void CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL()
       
  1025     {
       
  1026     _DBG_FILE("CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL(): begin");
       
  1027     _DBG_FILE("CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL(): end");    
       
  1028     }
       
  1029 
       
  1030 
       
  1031 CSmlDmAdapter::TError CNSmlDmStreamingAdapter::GetNetInfoL(CBufBase& aObject,TDataBearer aBearer,const TDesC8 &aDes)
       
  1032     {
       
  1033       TBuf8<KMaxLengthNetInfo> aNetInfoBuf;   
       
  1034       CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  1035       TInt err;
       
  1036       aNetInfoBuf.Append(aDes);
       
  1037       aNetInfoBuf.Append(KCommaSep);
       
  1038               
       
  1039       TInt aSusBw = 0;
       
  1040       err = iModel->GetSustainBandwidth(aSusBw,aBearer);
       
  1041       if(err != KErrNone)
       
  1042           {
       
  1043           DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::GetNetInfoL() - %d: Error in GetSustainBandwidth: %d"),aBearer,err);
       
  1044           retValue = CSmlDmAdapter::EError;
       
  1045           return retValue;
       
  1046           }
       
  1047       TBuf8<KMaxLengthTempInfo> aSusBwBuf;
       
  1048       aSusBwBuf.Num(aSusBw);
       
  1049       aNetInfoBuf.Append(aSusBwBuf);
       
  1050       aNetInfoBuf.Append(KCommaSep);
       
  1051       //aObject.InsertL(0,aSusBwBuf);
       
  1052       
       
  1053       
       
  1054       TInt aMaxBw;
       
  1055       err = iModel->GetMaxBandwidth(aMaxBw,aBearer);
       
  1056       if(err != KErrNone)
       
  1057           {
       
  1058           DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::GetNetInfoL() - %d: Error in GetMaxBandwidth: %d"),aBearer,err);
       
  1059           retValue = CSmlDmAdapter::EError;
       
  1060           return retValue;
       
  1061           }
       
  1062       TBuf8<KMaxLengthTempInfo> aMaxBwBuf;
       
  1063       aMaxBwBuf.Num(aMaxBw);
       
  1064       aNetInfoBuf.Append(aMaxBwBuf);
       
  1065       
       
  1066       aObject.InsertL(0,aNetInfoBuf);
       
  1067       retValue= CSmlDmAdapter::EOk;
       
  1068       return retValue;
       
  1069     }
       
  1070 // -----------------------------------------------------------------------------
       
  1071 // CNSmlDmDevDetailAdapter::FetchLeafObjectL()
       
  1072 // -----------------------------------------------------------------------------
       
  1073 CSmlDmAdapter::TError CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, 
       
  1074                                                                CBufBase& aObject )
       
  1075     {
       
  1076     _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): begin");
       
  1077     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
  1078     TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]);
       
  1079     TInt err = KErrNone;
       
  1080     if ( ret == KErrNotFound ) 
       
  1081         {
       
  1082         retValue = CSmlDmAdapter::EError;
       
  1083         }
       
  1084     else
       
  1085         {
       
  1086         TInt len = aURI.Length() - (ret + 1);
       
  1087         TPtrC8 segment = aURI.Right( len );
       
  1088         
       
  1089         if(segment == KNSmlDMStreamingAdapterName)
       
  1090             {
       
  1091             	// Get for Streaming Configuration Setting name(It is not displayed for the user).
       
  1092             _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterName");
       
  1093             TBuf8<KMaxLengthStreamingName> aName;
       
  1094             CRepository* centrep( NULL);
       
  1095             aName.Zero();
       
  1096             centrep = CRepository::NewLC( KCRUidStreamingAdapter );
       
  1097 
       
  1098             if ( centrep )
       
  1099                 {
       
  1100                 _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in CenRep");
       
  1101                 TFullName temp;
       
  1102                 
       
  1103                 if (centrep->Get( KStreamingConfigurationName, temp )==KErrNone && temp.Length() )
       
  1104                     {
       
  1105                     _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Cenrep Get");
       
  1106                     temp.Trim();
       
  1107                     aName.Copy(temp);
       
  1108                     }
       
  1109                 else
       
  1110                 		{
       
  1111                 		_DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in Cenrep Get");
       
  1112                 		retValue = CSmlDmAdapter::EError;
       
  1113                 		CleanupStack::PopAndDestroy(centrep);	
       
  1114                 		return retValue;
       
  1115                 		}
       
  1116                 CleanupStack::PopAndDestroy(centrep);
       
  1117                 }
       
  1118             aObject.InsertL(0,aName);
       
  1119             retValue= CSmlDmAdapter::EOk;    
       
  1120             }
       
  1121         else if(segment == KNSmlDMStreamingAdapterToProxy)
       
  1122             {
       
  1123             	// Get for Proxy Address of the streaming settings.
       
  1124             _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterToProxy");
       
  1125             TBuf<KMaxLengthToProxy> uri;
       
  1126             err = iModel->GetProxyHostName(uri);
       
  1127             if(err != KErrNone)
       
  1128                 {
       
  1129                 DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in GetProxyHostName: %d"), err);
       
  1130                 retValue = CSmlDmAdapter::EError;
       
  1131                 return retValue;
       
  1132                 }
       
  1133             TPtr8 ptr = uri.Collapse(); 
       
  1134             aObject.InsertL(0,ptr); 
       
  1135             retValue= CSmlDmAdapter::EOk;
       
  1136             }
       
  1137         else if(segment == KNSmlDMStreamingAdapterToNapID)
       
  1138             {
       
  1139             	// Get for Access Point that is set in the streaming settings
       
  1140             	retValue = GetDefaultApL(aObject);
       
  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