upnp/upnpstack/upnputils/src/upnpdevicelibraryelement.cpp
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies  this distribution, and is available 
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CUpnpDeviceLibraryElement
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include "upnpdevicelibraryelement.h"
       
    22 #include "upnpssdpmessage.h"
       
    23 #include "upnpcons.h"
       
    24 #include "upnpstring.h"
       
    25 
       
    26 using namespace UpnpSSDP;
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CUpnpDeviceLibraryElement::CUpnpDeviceLibraryElement
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CUpnpDeviceLibraryElement::CUpnpDeviceLibraryElement(MUpnpTimeoutElementParent& aParent)
       
    37     : CUpnpTimeoutElement(aParent)
       
    38     {
       
    39     iLocal = EFalse;
       
    40     iFilter = ETrue;
       
    41     iAdvertised = EFalse;
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CUpnpDeviceLibraryElement::ConstructL
       
    46 // Symbian 2nd phase constructor can leave.
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 void CUpnpDeviceLibraryElement::ConstructL()
       
    50     {
       
    51     BaseConstructL();
       
    52     iUUID = HBufC8::NewL(0);
       
    53     iDescriptionURL = HBufC8::NewL(0);
       
    54     iDomain = HBufC8::NewL(0);
       
    55     iDeviceType = HBufC8::NewL(0);
       
    56 
       
    57     iServiceList = new (ELeave) CDesC8ArrayFlat(4);
       
    58 
       
    59     iAlive = ETrue;
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CUpnpDeviceLibraryElement::NewL
       
    64 // Two-phased constructor.
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C CUpnpDeviceLibraryElement* CUpnpDeviceLibraryElement::NewL( 
       
    68                                                MUpnpTimeoutElementParent& aParent )
       
    69     {
       
    70     CUpnpDeviceLibraryElement* self = new (ELeave) CUpnpDeviceLibraryElement(aParent);
       
    71     
       
    72     CleanupStack::PushL(self);
       
    73     self->ConstructL();
       
    74     CleanupStack::Pop();
       
    75     
       
    76     return self;
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CUpnpDeviceLibraryElement::~CUpnpDeviceLibraryElement
       
    81 // Destructor.
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 EXPORT_C CUpnpDeviceLibraryElement::~CUpnpDeviceLibraryElement()
       
    85     {
       
    86     Cancel(); 
       
    87 
       
    88     delete iUUID;
       
    89     iUUID = NULL;
       
    90     delete iDescriptionURL;
       
    91     iDescriptionURL = NULL;
       
    92     delete iDomain;
       
    93     iDomain = NULL;
       
    94     delete iDeviceType;
       
    95     iDeviceType = NULL;
       
    96 
       
    97     if( iServiceList )    
       
    98         {
       
    99         iServiceList->Reset();
       
   100         delete iServiceList;
       
   101         }
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CUpnpDeviceLibraryElement::IsRootDevice
       
   106 // Return iRootDevice.
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 EXPORT_C TBool CUpnpDeviceLibraryElement::IsRootDevice() const
       
   110     {
       
   111     return iRootDevice;
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CUpnpDeviceLibraryElement::UUID
       
   116 // Return iUUID.
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 EXPORT_C TDesC8& CUpnpDeviceLibraryElement::UUID() 
       
   120     {
       
   121     return *iUUID;
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CUpnpDeviceLibraryElement::DescriptionURL
       
   126 // Return iDescriptionURL.
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 EXPORT_C TDesC8& CUpnpDeviceLibraryElement::DescriptionUrl() 
       
   130     {
       
   131     return *iDescriptionURL;
       
   132     }
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // CUpnpDeviceLibraryElement::Domain
       
   136 // Return iDomain.
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 EXPORT_C TDesC8& CUpnpDeviceLibraryElement::Domain() 
       
   140     {
       
   141     return *iDomain;
       
   142     }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CUpnpDeviceLibraryElement::DeviceType
       
   146 // Return iDeviceType.
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 EXPORT_C TDesC8& CUpnpDeviceLibraryElement::DeviceType() 
       
   150     {
       
   151     return *iDeviceType;
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CUpnpDeviceLibraryElement::ServiceList
       
   156 //
       
   157 // (other items were commented in a header).
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 EXPORT_C CDesC8Array& CUpnpDeviceLibraryElement::ServiceList() 
       
   161     {
       
   162     return *iServiceList;
       
   163     }
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // CUpnpDeviceLibraryElement::AddInfoFromNotificationTypeHeaderL
       
   167 //
       
   168 // Supported NT (Notification Type) messages:
       
   169 // "uuid:"                         (length: 5 )
       
   170 // "upnp:rootdevice"               (length: 15)
       
   171 // "urn:schemas-upnp-org:device:"  (length: 28)
       
   172 // "urn:schemas-upnp-org:service:" (length: 29)
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 TBool CUpnpDeviceLibraryElement::AddInfoFromNotificationTypeHeaderL(
       
   176     CUpnpSsdpMessage* aMessage )
       
   177     {
       
   178     TPtrC8 nt = aMessage->St( );
       
   179 
       
   180     if ( nt.Length( ) == 0 )
       
   181         {
       
   182         nt.Set( aMessage->Nt( ) );
       
   183         }
       
   184 
       
   185     if ( HasPrefix( nt, KUPnPUuid ) )
       
   186         {
       
   187         // an uuid advertisement
       
   188         return ETrue;
       
   189         }
       
   190 
       
   191     if ( iDeviceType->Length( ) == 0 )
       
   192         {
       
   193         if ( nt == KUPnPRootDevice )
       
   194             {
       
   195             // a root device advertisement
       
   196             SetDeviceTypeL( nt );
       
   197             return ETrue;
       
   198             }
       
   199 
       
   200         if ( HasPrefix( nt, KUPnPDeviceSchema ) )
       
   201             {
       
   202             // a device advertisement
       
   203             SetDeviceTypeL( nt );
       
   204             return ETrue;
       
   205             }
       
   206         }
       
   207 
       
   208     if ( HasPrefix( nt, KUPnPServiceSchema ) )
       
   209         {
       
   210         // a service advertisement
       
   211         AddServiceTypeL( nt );
       
   212         return ETrue;
       
   213         }
       
   214 
       
   215     return EFalse;
       
   216     }
       
   217 
       
   218 // -----------------------------------------------------------------------------
       
   219 // CUpnpDeviceLibraryElement::AddInfoL
       
   220 //
       
   221 // (other items were commented in a header).
       
   222 // -----------------------------------------------------------------------------
       
   223 //
       
   224 EXPORT_C TBool CUpnpDeviceLibraryElement::AddInfoL( CUpnpSsdpMessage* aMessage, 
       
   225                                                 TInt& aUpdateId )
       
   226     {
       
   227     if ( !aMessage )
       
   228         {
       
   229         return EFalse;
       
   230         }
       
   231 
       
   232     if ( iDescriptionURL->Length() == 0 )
       
   233         {
       
   234         SetDescriptionUrlL( aMessage->Location() );
       
   235         }
       
   236 
       
   237     TBool updateInc = AddInfoFromNotificationTypeHeaderL( aMessage );
       
   238 
       
   239     //If iUUID message has not been defined, Set it as Message's UUID
       
   240     if ( iUUID->Length() == 0 )
       
   241         {
       
   242         SetUuidL( aMessage->Uuid() );
       
   243         }
       
   244     else
       
   245         {
       
   246         // Set update only when device didn't notify before, always 
       
   247         // when device notify - uuid will be set
       
   248         updateInc = EFalse;
       
   249         }
       
   250 
       
   251     if ( updateInc )
       
   252         {
       
   253         aUpdateId++;
       
   254         SetUpdateId(aUpdateId);
       
   255         }
       
   256 
       
   257     return updateInc;
       
   258     }
       
   259 
       
   260 // -----------------------------------------------------------------------------
       
   261 // CUpnpDeviceLibraryElement::AddInfoL
       
   262 //
       
   263 // (other items were commented in a header).
       
   264 // -----------------------------------------------------------------------------
       
   265 //
       
   266 EXPORT_C void CUpnpDeviceLibraryElement::AddInfoL(const TUpnpAddLocalDevice* anIndex,
       
   267                                                   const TDesC8& aBuffer,
       
   268                                                   const TInetAddr& aAddr)
       
   269     {
       
   270     if ( !anIndex )
       
   271         {
       
   272         return;
       
   273         }
       
   274 
       
   275     TInt index = 0;
       
   276 
       
   277     TPtrC8 uuid = aBuffer.Left(anIndex->iUuidLength);
       
   278     index += anIndex->iUuidLength;
       
   279 
       
   280     TPtrC8 deviceType = aBuffer.Mid(index, anIndex->iDeviceTypeLength);
       
   281     index += anIndex->iDeviceTypeLength;
       
   282 
       
   283     TPtrC8 descriptionUrl = aBuffer.Mid(index, anIndex->iDescriptionUrlLength);
       
   284     index += anIndex->iDescriptionUrlLength;
       
   285 
       
   286     TPtrC8 domain = aBuffer.Mid(index, anIndex->iDomainLength);
       
   287     index += anIndex->iDomainLength;
       
   288 
       
   289     TPtrC8 port = aBuffer.Mid(index, anIndex->iPortNumberLength);
       
   290     index += anIndex->iPortNumberLength;
       
   291 
       
   292     TPtrC8 root = aBuffer.Mid(index, anIndex->iRootDeviceLength);
       
   293     index += anIndex->iRootDeviceLength;
       
   294 
       
   295     if (uuid.Length()> 0)
       
   296         {
       
   297         SetUuidL(uuid);
       
   298         }
       
   299 
       
   300     if (deviceType.Length()> 0)
       
   301         {
       
   302         SetDeviceTypeL(deviceType);
       
   303         }
       
   304 
       
   305     if (root.Length()> 0)
       
   306         {
       
   307         SetRootDevice( ETrue );
       
   308         }
       
   309     else
       
   310         {
       
   311         SetRootDevice( EFalse );
       
   312         }
       
   313 
       
   314     if (descriptionUrl.Length()> 0)
       
   315         {
       
   316         if (aAddr.IsUnspecified())
       
   317             {
       
   318             SetDescriptionUrlL(descriptionUrl);
       
   319             }
       
   320         else
       
   321             {
       
   322             SetDescriptionUrlL(descriptionUrl, aAddr, port);
       
   323             }
       
   324         }
       
   325 
       
   326     if (domain.Length()> 0)
       
   327         {
       
   328         SetDomainL(domain);
       
   329         }
       
   330 
       
   331     for (TInt i=0; i < KMaxServiceCount; i++)
       
   332         {
       
   333         TPtrC8 serviceType = aBuffer.Mid(index, anIndex->iServiceLength[i]);
       
   334         index += anIndex->iServiceLength[i];
       
   335 
       
   336         AddServiceTypeL(serviceType);
       
   337         }
       
   338     }
       
   339 
       
   340 // -----------------------------------------------------------------------------
       
   341 // CUpnpDeviceLibraryElement::AddInfoL
       
   342 //
       
   343 // (other items were commented in a header).
       
   344 // -----------------------------------------------------------------------------
       
   345 //
       
   346 EXPORT_C void CUpnpDeviceLibraryElement::AddInfoL(const TUpnpAddLocalDevice* anIndex,
       
   347                                                   const TDesC8& aBuffer)
       
   348     {
       
   349     AddInfoL(anIndex, aBuffer, TInetAddr());
       
   350     }
       
   351 
       
   352 // -----------------------------------------------------------------------------
       
   353 // CUpnpDeviceLibraryElement::SetUuidL
       
   354 //
       
   355 // (other items were commented in a header).
       
   356 // -----------------------------------------------------------------------------
       
   357 //
       
   358 void CUpnpDeviceLibraryElement::SetUuidL( const TDesC8& aUUID )
       
   359     {
       
   360     if ( aUUID.Length()> KUdnMaxLength )
       
   361         {
       
   362         User::Leave( KErrOverflow );
       
   363         }
       
   364     
       
   365     delete iUUID;
       
   366     iUUID = NULL;
       
   367 
       
   368     iUUID = aUUID.AllocL( );
       
   369     }
       
   370 
       
   371 // -----------------------------------------------------------------------------
       
   372 // CUpnpDeviceLibraryElement::SetDescriptionUrlL
       
   373 //
       
   374 // (other items were commented in a header).
       
   375 // -----------------------------------------------------------------------------
       
   376 //
       
   377 void CUpnpDeviceLibraryElement::SetDescriptionUrlL(
       
   378     const TDesC8& aDescriptionURL )
       
   379     {
       
   380     if ( aDescriptionURL.Length( ) > KUrlMaxLength )
       
   381         {
       
   382         User::Leave( KErrOverflow );
       
   383         }
       
   384 
       
   385     delete iDescriptionURL;
       
   386     iDescriptionURL = NULL;
       
   387 
       
   388     iDescriptionURL = aDescriptionURL.AllocL( );
       
   389     }
       
   390 
       
   391 // -----------------------------------------------------------------------------
       
   392 // CUpnpDeviceLibraryElement::SetDescriptionUrlL
       
   393 //
       
   394 // (other items were commented in a header).
       
   395 // -----------------------------------------------------------------------------
       
   396 //
       
   397 void CUpnpDeviceLibraryElement::SetDescriptionUrlL(
       
   398     const TDesC8& aDescriptionURL, const TInetAddr& aAddr, const TDesC8& aPort )
       
   399     {
       
   400     TBuf<UpnpSSDP::KIPAddBuffLen> addrBuf;
       
   401     aAddr.Output( addrBuf );
       
   402 
       
   403     HBufC8* addrBuf8 = UpnpString::FromUnicodeL( addrBuf );
       
   404     CleanupStack::PushL( addrBuf8 );
       
   405 
       
   406     HBufC8* url = HBufC8::NewLC( (UpnpHTTP::KHTTPUrl().Length( ))
       
   407             + aDescriptionURL.Length( ) + addrBuf8->Length( )
       
   408             + aPort.Length( )+ 2 );//+2 reserved for colon and slashes in url
       
   409 
       
   410     url->Des().Append( UpnpHTTP::KHTTPUrl( ) );
       
   411     url->Des().Append( *addrBuf8 );
       
   412     if ( aPort.Length( ) > 0 )
       
   413         {
       
   414         url->Des().Append( UpnpString::KColon( ) );
       
   415         url->Des().Append( aPort );
       
   416         }
       
   417     // After Ip address there should be slash and device Url so device url
       
   418     // must start with slash
       
   419     ASSERT( aDescriptionURL.Find( UpnpString::KSlash) == 0 ); 
       
   420    	
       
   421     url->Des().Append( aDescriptionURL );
       
   422 
       
   423     SetDescriptionUrlL( *url );
       
   424 
       
   425     CleanupStack::PopAndDestroy( url );
       
   426     CleanupStack::PopAndDestroy( addrBuf8 );
       
   427     }
       
   428 
       
   429 // -----------------------------------------------------------------------------
       
   430 // CUpnpDeviceLibraryElement::SetDomainL
       
   431 //
       
   432 // (other items were commented in a header).
       
   433 // -----------------------------------------------------------------------------
       
   434 //
       
   435 void CUpnpDeviceLibraryElement::SetDomainL(const TDesC8& aDomain)
       
   436     {
       
   437     if ( aDomain.Length( ) > KDeviceTypeBufferLength )
       
   438         {
       
   439         User::Leave( KErrOverflow );
       
   440         }
       
   441     
       
   442     delete iDomain;
       
   443     iDomain = NULL;
       
   444 
       
   445     iDomain = aDomain.AllocL();
       
   446     }
       
   447 
       
   448 // -----------------------------------------------------------------------------
       
   449 // CUpnpDeviceLibraryElement::SetDeviceTypeL
       
   450 //
       
   451 // (other items were commented in a header).
       
   452 // -----------------------------------------------------------------------------
       
   453 //
       
   454 void CUpnpDeviceLibraryElement::SetDeviceTypeL(const TDesC8& aDeviceType)
       
   455     {
       
   456     if ( aDeviceType.Length( ) > KDeviceTypeBufferLength )
       
   457         {
       
   458         User::Leave( KErrOverflow );
       
   459         }
       
   460     
       
   461     delete iDeviceType;
       
   462     iDeviceType = NULL;
       
   463 
       
   464     iDeviceType = aDeviceType.AllocL();
       
   465     }
       
   466 
       
   467 // -----------------------------------------------------------------------------
       
   468 // CUpnpDeviceLibraryElement::AddServiceTypeL
       
   469 //
       
   470 // (other items were commented in a header).
       
   471 // -----------------------------------------------------------------------------
       
   472 //
       
   473 void CUpnpDeviceLibraryElement::AddServiceTypeL( const TDesC8& aServiceType )
       
   474     {
       
   475     if ( aServiceType.Length() > 0 )
       
   476         {
       
   477         if ( aServiceType.Length() > KServiceTypeBufferLength )
       
   478             {
       
   479             User::Leave( KErrOverflow );
       
   480             }
       
   481         // check if this service type is already mentioned 
       
   482         // in the service type list
       
   483         TInt foundIdx;
       
   484         
       
   485         if ( iServiceList->Find( aServiceType, foundIdx ) == 0 )
       
   486             {
       
   487             return;
       
   488             }
       
   489 
       
   490         // else, append the new service type to the list
       
   491         iServiceList->AppendL( aServiceType );
       
   492         }
       
   493     }
       
   494 
       
   495 // -----------------------------------------------------------------------------
       
   496 // CUpnpDeviceLibraryElement::AsTDeviceL
       
   497 //
       
   498 // (other items were commented in a header).
       
   499 // -----------------------------------------------------------------------------
       
   500 //
       
   501 EXPORT_C TUpnpDevice* CUpnpDeviceLibraryElement::AsTDeviceL() const
       
   502     {
       
   503     TUpnpDevice* dev = new (ELeave) TUpnpDevice;
       
   504     dev->Set(const_cast<CUpnpDeviceLibraryElement*>(this));
       
   505     return dev;
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // CUpnpDeviceLibraryElement::UpdateId
       
   510 //
       
   511 // (other items were commented in a header).
       
   512 // -----------------------------------------------------------------------------
       
   513 //
       
   514 EXPORT_C TInt CUpnpDeviceLibraryElement::UpdateId() const
       
   515     {
       
   516     return iUpdateId;
       
   517     }
       
   518 
       
   519 // -----------------------------------------------------------------------------
       
   520 // CUpnpDeviceLibraryElement::SetUpdateId
       
   521 //
       
   522 // (other items were commented in a header).
       
   523 // -----------------------------------------------------------------------------
       
   524 //
       
   525 EXPORT_C void CUpnpDeviceLibraryElement::SetUpdateId(TInt aUpdateId)    
       
   526     {
       
   527     iUpdateId = aUpdateId;
       
   528     }
       
   529 
       
   530 // -----------------------------------------------------------------------------
       
   531 // CUpnpDeviceLibraryElement::SetAlive
       
   532 //
       
   533 // (other items were commented in a header).
       
   534 // -----------------------------------------------------------------------------
       
   535 //
       
   536 EXPORT_C void CUpnpDeviceLibraryElement::SetAlive(TBool aAlive)
       
   537     {
       
   538     iAlive = aAlive;
       
   539     }
       
   540 
       
   541 // -----------------------------------------------------------------------------
       
   542 // CUpnpDeviceLibraryElement::Alive
       
   543 //
       
   544 // (other items were commented in a header).
       
   545 // -----------------------------------------------------------------------------
       
   546 //
       
   547 EXPORT_C TBool CUpnpDeviceLibraryElement::Alive() const
       
   548     {
       
   549     return iAlive;
       
   550     }
       
   551 
       
   552 // -----------------------------------------------------------------------------
       
   553 // CUpnpDeviceLibraryElement::SetLocal
       
   554 //
       
   555 // (other items were commented in a header).
       
   556 // -----------------------------------------------------------------------------
       
   557 //
       
   558 void CUpnpDeviceLibraryElement::SetLocal(TBool aLocal)
       
   559     {
       
   560     iLocal = aLocal;
       
   561     }
       
   562 
       
   563 // -----------------------------------------------------------------------------
       
   564 // CUpnpDeviceLibraryElement::Local
       
   565 //
       
   566 // (other items were commented in a header).
       
   567 // -----------------------------------------------------------------------------
       
   568 //
       
   569 EXPORT_C TBool CUpnpDeviceLibraryElement::Local() const
       
   570     {
       
   571     return iLocal;
       
   572     }
       
   573 
       
   574 // -----------------------------------------------------------------------------
       
   575 // CUpnpDeviceLibraryElement::SetFilter
       
   576 //
       
   577 // (other items were commented in a header).
       
   578 // -----------------------------------------------------------------------------
       
   579 //
       
   580 void CUpnpDeviceLibraryElement::SetFilter(TBool aFilter)
       
   581     {
       
   582     iFilter = aFilter;
       
   583     }
       
   584 
       
   585 // -----------------------------------------------------------------------------
       
   586 // CUpnpDeviceLibraryElement::Filter
       
   587 //
       
   588 // (other items were commented in a header).
       
   589 // -----------------------------------------------------------------------------
       
   590 //
       
   591 TBool CUpnpDeviceLibraryElement::Filter() const
       
   592     {
       
   593     return iFilter;
       
   594     }
       
   595 
       
   596 // -----------------------------------------------------------------------------
       
   597 // CUpnpDeviceLibraryElement::Expired
       
   598 //
       
   599 // -----------------------------------------------------------------------------
       
   600 //
       
   601 TBool CUpnpDeviceLibraryElement::Expired() const
       
   602     {
       
   603     return iExpired;
       
   604     }
       
   605     
       
   606 // -----------------------------------------------------------------------------
       
   607 // CUpnpDeviceLibraryElement::SetExpired
       
   608 //
       
   609 // -----------------------------------------------------------------------------
       
   610 //
       
   611 void CUpnpDeviceLibraryElement::SetExpired( TBool aExpired )
       
   612     {
       
   613     iExpired = aExpired;
       
   614     }
       
   615 
       
   616 // -----------------------------------------------------------------------------
       
   617 // CUpnpDeviceLibraryElement::SetRootDevice
       
   618 //
       
   619 // (other items were commented in a header).
       
   620 // -----------------------------------------------------------------------------
       
   621 //
       
   622 void CUpnpDeviceLibraryElement::SetRootDevice(TBool aRootDevice)
       
   623     {
       
   624     iRootDevice = aRootDevice;
       
   625     }
       
   626 
       
   627 // -----------------------------------------------------------------------------
       
   628 // CUpnpDeviceLibraryElement::Advertised
       
   629 //
       
   630 // (other items were commented in a header).
       
   631 // -----------------------------------------------------------------------------
       
   632 //
       
   633 TBool CUpnpDeviceLibraryElement::Advertised()
       
   634     {
       
   635     return iAdvertised;
       
   636     }
       
   637 
       
   638 // -----------------------------------------------------------------------------
       
   639 // CUpnpDeviceLibraryElement::Advertising
       
   640 //
       
   641 // (other items were commented in a header).
       
   642 // -----------------------------------------------------------------------------
       
   643 //
       
   644 void CUpnpDeviceLibraryElement::Advertising()
       
   645     {
       
   646     iAdvertised = ETrue;
       
   647     }
       
   648 
       
   649 // -----------------------------------------------------------------------------
       
   650 // CUpnpDeviceLibraryElement::AdvertisingFinished
       
   651 //
       
   652 // (other items were commented in a header).
       
   653 // -----------------------------------------------------------------------------
       
   654 //
       
   655 void CUpnpDeviceLibraryElement::AdvertisingFinished()
       
   656     {
       
   657     iAdvertised = EFalse;
       
   658     }
       
   659 
       
   660 // -----------------------------------------------------------------------------
       
   661 // CUpnpDeviceLibraryElement::HasPrefix
       
   662 //
       
   663 // (other items were commented in a header).
       
   664 // -----------------------------------------------------------------------------
       
   665 //
       
   666 TBool CUpnpDeviceLibraryElement::HasPrefix( const TDesC8& aDescriptor,
       
   667     const TDesC8& aPrefix )
       
   668     {
       
   669     return (aDescriptor.Left( aPrefix.Length( ) ) == aPrefix );
       
   670     }
       
   671 
       
   672 //  End of File