upnpsharing/upnpcontentserver/src/upnpselectionreader.cpp
changeset 0 7f85d04be362
child 30 5ec426854821
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:      CUpnpSelectionReader class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 
       
    25 #include <upnpstring.h>
       
    26 #include <s32file.h>
       
    27 #include <centralrepository.h>
       
    28 // #include <clfcontentlistingextended.hrh>
       
    29 
       
    30 #include <MCLFItemListModel.h>
       
    31 #include <MCLFItem.h>
       
    32 #include "upnpcontentservercrkeys.h"
       
    33 #include "upnpselectionreader.h"
       
    34 #include "upnpcontentmetadatautility.h"
       
    35 #include "upnpcontentserverdefs.h"
       
    36 
       
    37 _LIT( KComponentLogfile, "contentserver.txt");
       
    38 #include "upnplog.h"
       
    39 
       
    40 //CONSTANTS
       
    41 // Format string for listbox items
       
    42 _LIT(KItemFormatString, "1\t%S");
       
    43 const TInt KDefaultStringArrGranularity( 10 );
       
    44 const TInt KDefaultSelectionGranularity( 2 );
       
    45 
       
    46 const TInt KShareNoneIndex = 0;
       
    47 const TInt KShareAllIndex = 1;
       
    48 const TInt KPredefinedSelections = 2; // Share none and share all
       
    49 
       
    50 using namespace UpnpContentServer;
       
    51 
       
    52 // ================= MEMBER FUNCTIONS =======================
       
    53 
       
    54 // --------------------------------------------------------------------------
       
    55 // CUpnpSelectionReader::NewL
       
    56 // Two-phased constructor.
       
    57 // --------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C CUpnpSelectionReader* CUpnpSelectionReader::NewL(
       
    60                         CUpnpContentMetadataUtility* aUtility )
       
    61     {
       
    62     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
    63     CUpnpSelectionReader* self =
       
    64         new(ELeave) CUpnpSelectionReader();
       
    65 
       
    66     CleanupStack::PushL(self);
       
    67     self->ConstructL( aUtility );
       
    68     CleanupStack::Pop(self);
       
    69     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
    70     return self;
       
    71     }
       
    72 
       
    73 
       
    74 // --------------------------------------------------------------------------
       
    75 // CUpnpSelectionReader::ConstructL
       
    76 // Symbian 2nd phase constructor can leave.
       
    77 // --------------------------------------------------------------------------
       
    78 //
       
    79 void CUpnpSelectionReader::ConstructL(
       
    80                         CUpnpContentMetadataUtility* aUtility  )
       
    81     {
       
    82     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
    83 
       
    84     iMetadataUtility = aUtility;
       
    85 
       
    86     iPlIdArray = new (ELeave) CDesCArrayFlat( KDefaultStringArrGranularity );
       
    87     iCollIdArray = new (ELeave) 
       
    88         CDesCArrayFlat( KDefaultStringArrGranularity );
       
    89 
       
    90     iPlaylistNames = new (ELeave) 
       
    91         CDesCArrayFlat( KDefaultStringArrGranularity );
       
    92     iCollectionNames = new (ELeave) 
       
    93         CDesCArrayFlat( KDefaultStringArrGranularity );
       
    94 
       
    95     iSelectedImages  = new (ELeave) RArray<TInt>( 
       
    96         KDefaultSelectionGranularity);
       
    97     iSelectedMusic  = new (ELeave) RArray<TInt>( 
       
    98         KDefaultSelectionGranularity);
       
    99 
       
   100     GetVisualSharingStateL( iVisualSharingSelection );
       
   101     GetMusicSharingStateL( iMusicSharingSelection );
       
   102     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   103     }
       
   104 
       
   105 
       
   106 // --------------------------------------------------------------------------
       
   107 // CUpnpSelectionReader::CUpnpSelectionReader
       
   108 // C++ default constructor can NOT contain any code, that
       
   109 // might leave.
       
   110 // --------------------------------------------------------------------------
       
   111 //
       
   112 CUpnpSelectionReader::CUpnpSelectionReader()
       
   113     {
       
   114     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   115     iImageContainers = NULL;
       
   116     iPlaylistNames = NULL;
       
   117     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   118     }
       
   119 
       
   120 // --------------------------------------------------------------------------
       
   121 // CUpnpSelectionReader::~CUpnpSelectionReader
       
   122 // C++ default destructor.
       
   123 // --------------------------------------------------------------------------
       
   124 //
       
   125 CUpnpSelectionReader::~CUpnpSelectionReader()
       
   126     {
       
   127     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   128 
       
   129     iMetadataUtility = NULL;
       
   130 
       
   131     if ( iSelectedImages )
       
   132         {
       
   133         iSelectedImages->Close();
       
   134         }
       
   135 
       
   136     delete iSelectedImages;
       
   137 
       
   138     if ( iSelectedMusic )
       
   139         {
       
   140         iSelectedMusic->Close();
       
   141         }
       
   142 
       
   143     delete iSelectedMusic;
       
   144     delete iPlIdArray;
       
   145     delete iCollIdArray;
       
   146     delete iPlaylistNames;
       
   147     delete iImageContainers;
       
   148     delete iCollectionNames;
       
   149     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   150     }
       
   151 
       
   152 // --------------------------------------------------------------------------
       
   153 // CUpnpSelectionReader::IsItemSharedL()
       
   154 // Checks if album is shared earlier
       
   155 // --------------------------------------------------------------------------
       
   156 //
       
   157 TBool CUpnpSelectionReader::IsItemShared(
       
   158             const TDesC& aItemName,
       
   159             const CDesCArray& aIDArray ) const
       
   160     {
       
   161     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   162     TInt pos;
       
   163     TBool retVal = !aIDArray.Find( aItemName, pos );
       
   164 
       
   165     __LOG1( "CUpnpSelectionReader::IsItemSharedL returns %d",
       
   166         retVal );
       
   167 
       
   168     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   169     return retVal;
       
   170     }
       
   171 
       
   172 
       
   173 // --------------------------------------------------------------------------
       
   174 // CUpnpSelectionReader::FetchCollectionsL()
       
   175 // Fetch albums from Media Gallery for the listbox
       
   176 // --------------------------------------------------------------------------
       
   177 //
       
   178 void CUpnpSelectionReader::FetchCollectionsL( CDesCArray* 
       
   179                                               aSettingsTextArray )
       
   180     {
       
   181     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   182 
       
   183     if ( !aSettingsTextArray )
       
   184         {
       
   185         User::Leave( KErrGeneral );
       
   186         }
       
   187     // This is for IsItemSharedL
       
   188     iMediaType = EImageAndVideo;
       
   189 
       
   190     if( iSelectedImages )
       
   191         {
       
   192         iSelectedImages->Reset();
       
   193         }
       
   194     if( iCollIdArray )
       
   195         {
       
   196         iCollIdArray->Reset();
       
   197         }
       
   198     if( iCollectionNames )
       
   199         {
       
   200         iCollectionNames->Reset();
       
   201         }
       
   202 
       
   203     // Read shared albums
       
   204     CDesCArray* sharedStuff = new (ELeave) CDesCArrayFlat( 
       
   205         KDefaultStringArrGranularity );
       
   206     CleanupStack::PushL( sharedStuff );
       
   207 
       
   208     ReadSharedContainerIDsL( sharedStuff,
       
   209                              EImageAndVideo );
       
   210 
       
   211     // fill iCollIdArray
       
   212     SearchCollectionsL();
       
   213 
       
   214     // cycle trough albums to collect names to the listbox
       
   215     for (TInt index = 0; index < iCollIdArray->MdcaCount(); index++)
       
   216         {
       
   217         HBufC16* albumName = HBufC16::NewL(KMaxFileName);
       
   218         CleanupStack::PushL( albumName );
       
   219 
       
   220         // create item string for listbox (icon + album name)
       
   221         TPtrC16 collectionName = iCollectionNames->MdcaPoint( index );
       
   222         albumName->Des().Format( KItemFormatString, &collectionName ); 
       
   223 
       
   224         // append album name to the listbox
       
   225         aSettingsTextArray->AppendL( albumName->Des() );
       
   226 
       
   227         // check if album is shared earlier
       
   228         if ( IsItemShared( iCollIdArray->MdcaPoint( index ), *sharedStuff ) )
       
   229             {
       
   230             //Index can't be '0' or '1' because there are predefined 
       
   231             //selections such as "share nothing" and "share all" first.
       
   232             iSelectedImages->AppendL( index + KPredefinedSelections );
       
   233             }
       
   234 
       
   235 
       
   236         CleanupStack::PopAndDestroy( albumName );
       
   237         albumName = NULL;
       
   238         }
       
   239 
       
   240     GetVisualSharingStateL( iVisualSharingSelection );
       
   241 
       
   242     if ( iVisualSharingSelection == EShareAll )
       
   243        {
       
   244         iSelectedImages->Reset();
       
   245         // if all albums were shared mark only "share all"
       
   246         iSelectedImages->AppendL( KShareAllIndex );
       
   247         }
       
   248     else if ( iVisualSharingSelection == EShareNone )
       
   249         {
       
   250         iSelectedImages->Reset();
       
   251         // if no albums were shared mark only "share nothing"
       
   252         iSelectedImages->AppendL( KShareNoneIndex );
       
   253         }
       
   254 
       
   255     iContainerCount = aSettingsTextArray->MdcaCount();
       
   256 
       
   257     CleanupStack::PopAndDestroy( sharedStuff );
       
   258     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   259     }
       
   260 
       
   261 
       
   262 // --------------------------------------------------------------------------
       
   263 // CUpnpSelectionReader::FetchPlaylistsL()
       
   264 // Fetch playlists from Media Gallery for the listbox.
       
   265 // --------------------------------------------------------------------------
       
   266 //
       
   267 void CUpnpSelectionReader::FetchPlaylistsL( CDesCArray* aSettingsTextArray )
       
   268     {
       
   269     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   270 
       
   271     if ( !aSettingsTextArray )
       
   272         {
       
   273         User::Leave( KErrGeneral );
       
   274         }
       
   275 
       
   276     // This is for IsItemSharedL
       
   277     iMediaType = EPlaylist;
       
   278 
       
   279     if ( iSelectedMusic )
       
   280         {
       
   281         iSelectedMusic->Reset();
       
   282         }
       
   283 
       
   284     if ( iPlIdArray )
       
   285         {
       
   286         iPlIdArray->Reset();
       
   287         }
       
   288 
       
   289     if( iPlaylistNames )
       
   290         {
       
   291         iPlaylistNames->Reset();
       
   292         }
       
   293 
       
   294     // container where items will be added
       
   295     CDesCArray* sharedStuff = new (ELeave) CDesCArrayFlat( 
       
   296         KDefaultStringArrGranularity );
       
   297     CleanupStack::PushL( sharedStuff );
       
   298 
       
   299     // Read previously shared playlist ids for calculating indexes
       
   300     ReadSharedContainerIDsL( sharedStuff,
       
   301                              EPlaylist );
       
   302 
       
   303     // search .m3u files put them to iPlIdArray
       
   304     SearchPlaylistFilesL();
       
   305 
       
   306     for ( TInt fileIndex = 0; 
       
   307           fileIndex < iPlIdArray->MdcaCount(); fileIndex++ )
       
   308         {
       
   309         HBufC16* listboxItem = HBufC16::NewL(KMaxFileName);
       
   310         CleanupStack::PushL(listboxItem);
       
   311 
       
   312         TPtrC itemName( iPlaylistNames->MdcaPoint( fileIndex ) );
       
   313 
       
   314         TBuf<KMaxFileName> nameBuf;
       
   315         nameBuf.Copy( itemName );
       
   316         listboxItem->Des().Format(KItemFormatString, &nameBuf );
       
   317         aSettingsTextArray->AppendL( listboxItem->Des() );
       
   318 
       
   319         if ( IsItemShared( iPlIdArray->MdcaPoint( fileIndex ),
       
   320                            *sharedStuff ) )
       
   321             {
       
   322             //Index can't be '0' or '1' because there are predefined 
       
   323             //selections such as "share nothing" and "share all" first.
       
   324             iSelectedMusic->AppendL( fileIndex + KPredefinedSelections );
       
   325             }
       
   326 
       
   327         CleanupStack::PopAndDestroy( listboxItem );
       
   328         listboxItem = NULL;
       
   329         }
       
   330 
       
   331     GetMusicSharingStateL( iMusicSharingSelection );
       
   332 
       
   333     if ( iMusicSharingSelection == EShareAll )
       
   334         {
       
   335         iSelectedMusic->Reset();
       
   336         // if all albums were shared mark only "share all"
       
   337         iSelectedMusic->AppendL( KShareAllIndex );
       
   338         }
       
   339     else if ( iMusicSharingSelection == EShareNone )
       
   340         {
       
   341         iSelectedMusic->Reset();
       
   342         // if no albums were shared mark only "share nothing"
       
   343         iSelectedMusic->AppendL( KShareNoneIndex );
       
   344         }
       
   345     iContainerCount = aSettingsTextArray->MdcaCount();
       
   346     CleanupStack::PopAndDestroy( sharedStuff );
       
   347     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   348     }
       
   349 
       
   350 
       
   351 // --------------------------------------------------------------------------
       
   352 // CUpnpSelectionReader::SearchPlaylistFilesL()
       
   353 // Search playlist files
       
   354 // --------------------------------------------------------------------------
       
   355 //
       
   356 TBool CUpnpSelectionReader::SearchPlaylistFilesL()
       
   357     {
       
   358     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   359 
       
   360     CUPnPPlaylistServices* playlists = CUPnPPlaylistServices::NewL();
       
   361     CleanupStack::PushL( playlists );
       
   362     
       
   363     playlists->ListPlaylistsL( *iPlIdArray, *iPlaylistNames );
       
   364     // for debugging
       
   365 
       
   366 #ifdef _DEBUG
       
   367     __LOG("CUpnpSelectionReader: Checking playlist validity.");
       
   368     for ( TInt i(0); i<iPlIdArray->MdcaCount(); i++ )
       
   369         {
       
   370         TBool valid(EFalse);
       
   371         TRAPD( err, valid = playlists->IsValidPlaylistL( 
       
   372                    iPlaylistNames->MdcaPoint(i) ));
       
   373         if ( !err )
       
   374             {
       
   375             TPtrC id( iPlIdArray->MdcaPoint(i) );
       
   376             __LOG3("Playlist[%d] %S IsValid: %d",
       
   377                 i, &id, valid );
       
   378             }
       
   379         }
       
   380 #endif
       
   381     CleanupStack::PopAndDestroy( playlists );
       
   382     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   383     return ETrue;
       
   384     }
       
   385 
       
   386 // --------------------------------------------------------------------------
       
   387 // CUpnpSelectionReader::SearchCollectionsL
       
   388 // fill iCollIdArray
       
   389 // --------------------------------------------------------------------------
       
   390 //
       
   391 TBool CUpnpSelectionReader::SearchCollectionsL()
       
   392     {
       
   393     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   394 
       
   395     CUPnPAlbumServices* albums = CUPnPAlbumServices::NewL();
       
   396     CleanupStack::PushL( albums );
       
   397     
       
   398     albums->ListAlbumsL( *iCollIdArray, *iCollectionNames );
       
   399 
       
   400 #ifdef _DEBUG
       
   401     __LOG("CUpnpSelectionReader: Checking album validity.");
       
   402     for ( TInt i(0); i<iCollIdArray->MdcaCount(); i++ )
       
   403         {
       
   404         TBool valid(EFalse);
       
   405         TRAPD( err, valid = albums->IsValidAlbumL( 
       
   406                    iCollectionNames->MdcaPoint(i) ));
       
   407         if ( !err )
       
   408             {
       
   409             TPtrC id( iCollIdArray->MdcaPoint(i) );
       
   410             __LOG3("Album[%d] %S IsValid: %d",
       
   411                 i, &id, valid );
       
   412             }
       
   413         }
       
   414 #endif
       
   415     CleanupStack::PopAndDestroy( albums );
       
   416 
       
   417     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   418     return ETrue;
       
   419     }
       
   420 
       
   421 // --------------------------------------------------------------------------
       
   422 // CUPnPFileSharingEngine::ReadSharedContainerIDsL
       
   423 // Reads shared container IDs from file
       
   424 // --------------------------------------------------------------------------
       
   425 //
       
   426 TInt CUpnpSelectionReader::ReadSharedContainerIDsL(
       
   427     CDesCArray* aArray,
       
   428     const TUpnpMediaType& aContainerType ) const
       
   429     {
       
   430     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   431 
       
   432     // Leave if NULL
       
   433     if ( !aArray )
       
   434         {
       
   435         User::Leave(KErrArgument);
       
   436         }
       
   437 
       
   438     RFs fs;
       
   439     RFile file;
       
   440     User::LeaveIfError( fs.Connect() );
       
   441     CleanupClosePushL(fs);
       
   442 
       
   443     TInt error = KErrNone;
       
   444 
       
   445     if ( aContainerType == EImageAndVideo )
       
   446         {
       
   447         error = file.Open(fs, KVisualFile, EFileRead );
       
   448         }
       
   449     else if ( aContainerType == EPlaylist )
       
   450         {
       
   451         error = file.Open(fs, KMusicFile, EFileRead );
       
   452         }
       
   453     else
       
   454         {
       
   455         // Not valid container type
       
   456         error = KErrNotFound;
       
   457         }
       
   458 
       
   459     if ( error == KErrNone )
       
   460         {
       
   461         CleanupClosePushL( file );
       
   462         RFileReadStream readStream( file );
       
   463         CleanupClosePushL( readStream );
       
   464 
       
   465         HBufC* collectionName = HBufC::NewL(KMaxFileName);
       
   466         CleanupStack::PushL( collectionName );
       
   467         TPtr collection = collectionName->Des();
       
   468 
       
   469         do
       
   470             {
       
   471             TRAPD(err, readStream >> collection); //leaves when eof
       
   472             if (err)
       
   473                 {
       
   474                 error = err;
       
   475                 }
       
   476             else
       
   477                 {
       
   478                 aArray->AppendL(collection);
       
   479                 }
       
   480 
       
   481             }  while(error == KErrNone); // end of file
       
   482 
       
   483         CleanupStack::PopAndDestroy( collectionName );
       
   484         CleanupStack::PopAndDestroy( &readStream ); // Close readStream
       
   485         CleanupStack::PopAndDestroy( &file ); // Close file
       
   486         }
       
   487 
       
   488      CleanupStack::PopAndDestroy( &fs );
       
   489 
       
   490     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   491     return error;
       
   492     }
       
   493 
       
   494 
       
   495 // --------------------------------------------------------------------------
       
   496 // CUPnPFileSharingEngine::GetSelectionIndexesL
       
   497 // Reads shared container IDs from file
       
   498 // --------------------------------------------------------------------------
       
   499 //
       
   500 void CUpnpSelectionReader::GetSelectionIndexesL(
       
   501     RArray<TInt>& aSelections,
       
   502     const TUpnpMediaType& aType )
       
   503     {
       
   504     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   505     RArray<TInt>* list( NULL );
       
   506     if ( aType == EImageAndVideo )
       
   507         {
       
   508         if ( !iSelectedImages )
       
   509             {
       
   510 
       
   511             iImageContainers->Reset();
       
   512             FetchCollectionsL( iImageContainers );
       
   513             iImageContainers->Reset();
       
   514             }
       
   515         else if ( !iImageContainers )
       
   516             {
       
   517             iImageContainers = new (ELeave) CDesCArrayFlat( 
       
   518                 KDefaultStringArrGranularity );
       
   519             FetchCollectionsL( iImageContainers );
       
   520             }
       
   521         else 
       
   522             {
       
   523             FetchCollectionsL( iImageContainers );
       
   524             }
       
   525             
       
   526         list = iSelectedImages;
       
   527         }
       
   528     else
       
   529         {
       
   530         if ( !iSelectedMusic )
       
   531             {
       
   532             iPlaylistNames->Reset();
       
   533             FetchPlaylistsL( iPlaylistNames );
       
   534             iPlaylistNames->Reset();
       
   535             }
       
   536         else if ( iPlaylistNames )
       
   537             {
       
   538             iPlaylistNames = new (ELeave) 
       
   539                 CDesCArrayFlat( KDefaultStringArrGranularity );
       
   540             FetchPlaylistsL( iPlaylistNames );
       
   541             }
       
   542         else 
       
   543             {
       
   544             FetchPlaylistsL( iPlaylistNames );
       
   545             }
       
   546         
       
   547         list = iSelectedMusic;
       
   548         }
       
   549 
       
   550     for ( TInt i(0); i< list->Count(); i++ )
       
   551         {
       
   552         aSelections.AppendL( list->operator[]( i ) );
       
   553         }
       
   554     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   555     }
       
   556 
       
   557 // --------------------------------------------------------------------------
       
   558 // CUpnpSelectionReader::GetVisualSharingStateL
       
   559 // (other items are commented in header )
       
   560 // --------------------------------------------------------------------------
       
   561 //
       
   562 TInt CUpnpSelectionReader::GetVisualSharingStateL( TInt& aShareAllState )
       
   563     {
       
   564     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   565     CRepository* rep = CRepository::NewL( KCrUidUpnpContentserver );
       
   566     CleanupStack::PushL( rep );
       
   567     TInt err( rep->Get( KUPnPAppShareAllVisualFiles, aShareAllState ));
       
   568     CleanupStack::PopAndDestroy( rep );
       
   569     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   570     return err;
       
   571     }
       
   572 
       
   573 // --------------------------------------------------------------------------
       
   574 // CUpnpSelectionReader::GetMusicSharingStateL
       
   575 // (other items are commented in header )
       
   576 // --------------------------------------------------------------------------
       
   577 //
       
   578 TInt CUpnpSelectionReader::GetMusicSharingStateL( TInt& aShareAllState )
       
   579     {
       
   580     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   581     CRepository* rep = CRepository::NewL( KCrUidUpnpContentserver );
       
   582     CleanupStack::PushL( rep );
       
   583     TInt err( rep->Get( KUPnPAppShareAllMusicFiles, aShareAllState ));
       
   584     CleanupStack::PopAndDestroy( rep );
       
   585     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   586     return err;
       
   587     }
       
   588 
       
   589 // --------------------------------------------------------------------------
       
   590 // CUpnpSelectionReader::GetContainerCount
       
   591 // (other items are commented in header )
       
   592 // --------------------------------------------------------------------------
       
   593 //
       
   594 TInt CUpnpSelectionReader::GetContainerCount() const
       
   595     {
       
   596     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   597     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   598     return iContainerCount;
       
   599     }
       
   600 
       
   601 // --------------------------------------------------------------------------
       
   602 // CUpnpSelectionReader::PlayListIdsL
       
   603 // (other items are commented in header )
       
   604 // --------------------------------------------------------------------------
       
   605 //
       
   606 TInt CUpnpSelectionReader::PlayListIdsL( CDesCArray& aPlaylistIds, 
       
   607                                         CDesCArray& aPlaylistNames )
       
   608     {
       
   609     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   610     TInt err( KErrNone );
       
   611     if ( iPlIdArray && iPlaylistNames )
       
   612         {
       
   613         for ( TInt i(0); i < iPlIdArray->MdcaCount(); i++ )
       
   614             {
       
   615             aPlaylistIds.AppendL( iPlIdArray->MdcaPoint( i ) );
       
   616             aPlaylistNames.AppendL( iPlaylistNames->MdcaPoint( i ) );
       
   617             }
       
   618         }
       
   619     else
       
   620         {
       
   621         err = KErrGeneral;
       
   622         }
       
   623     
       
   624     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   625     return err;
       
   626     }
       
   627 
       
   628 // --------------------------------------------------------------------------
       
   629 // CUpnpSelectionReader::CollectionIdsL
       
   630 // (other items are commented in header )
       
   631 // --------------------------------------------------------------------------
       
   632 //
       
   633 TInt CUpnpSelectionReader::CollectionIdsL( CDesCArray& aCollectionIds,
       
   634                                              CDesCArray& aCollectionNames )
       
   635     {
       
   636     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   637     TInt err( KErrNone );
       
   638     if ( iCollIdArray && iCollectionNames )
       
   639         {
       
   640         for ( TInt i(0); i < iCollIdArray->MdcaCount(); i++ )
       
   641             {
       
   642             aCollectionIds.AppendL( iCollIdArray->MdcaPoint( i ) );
       
   643             aCollectionNames.AppendL( iCollectionNames->MdcaPoint( i ) );
       
   644             }
       
   645         }
       
   646     else
       
   647         {
       
   648         err = KErrGeneral;
       
   649         }
       
   650     
       
   651     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   652     return err;
       
   653     }
       
   654 
       
   655 // --------------------------------------------------------------------------
       
   656 // CUpnpSelectionReader::SetMetadata
       
   657 // (other items are commented in header )
       
   658 // --------------------------------------------------------------------------
       
   659 //
       
   660 void CUpnpSelectionReader::SetMetadata( CUpnpContentMetadataUtility*
       
   661     aMetaData )
       
   662     {
       
   663     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   664     iMetadataUtility = aMetaData;
       
   665     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   666     }
       
   667 
       
   668 // End of file