upnpsharing/upnpcontentserver/src/upnpunsharerao.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2006-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:      CUpnpUnsharerAo class implementation
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 // INCLUDE FILES
       
    25 #include "upnpdlnaprofiler.h"
       
    26 #include "upnpcdsreselementutility.h"
       
    27 #include "upnpcommonutils.h"
       
    28 #include <upnpelement.h>
       
    29 
       
    30 #include "upnpunsharerao.h"
       
    31 
       
    32 _LIT( KComponentLogfile, "contentserver.txt");
       
    33 #include "upnplog.h"
       
    34 
       
    35 // CONSTANTS
       
    36 const TInt KDefaultBrowseReqCount( 20 );
       
    37 const TInt KDefaultBrowseStartingInd( 0 );
       
    38 
       
    39 using namespace UpnpContentServer;
       
    40 
       
    41 // ============================ MEMBER FUNCTIONS ============================
       
    42 
       
    43 // --------------------------------------------------------------------------
       
    44 // CUpnpUnsharerAo::CUpnpUnsharerAo
       
    45 // C++ default constructor can NOT contain any code, that
       
    46 // might leave.
       
    47 // --------------------------------------------------------------------------
       
    48 //
       
    49 CUpnpUnsharerAo::CUpnpUnsharerAo( MUpnpSharingCallback* aCallback,
       
    50                                   TInt aPriority )
       
    51     : CActive( aPriority ),
       
    52       iCallback( aCallback )
       
    53     {
       
    54     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
    55     iTotalItems = KErrNotFound;
       
    56     iAllTotalItems = 0;
       
    57     CActiveScheduler::Add( this );
       
    58     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
    59     }
       
    60 
       
    61 // --------------------------------------------------------------------------
       
    62 // CUpnpUnsharerAo::~CUpnpUnsharerAo()
       
    63 // C++ destructor.
       
    64 // --------------------------------------------------------------------------
       
    65 //
       
    66 CUpnpUnsharerAo::~CUpnpUnsharerAo()
       
    67     {
       
    68     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
    69     delete iFileSharing;
       
    70     iFileSharing = NULL;
       
    71     iMediaServer.Close();
       
    72 
       
    73     if ( IsActive() )
       
    74         {
       
    75         __LOG1("IsActive: true  iCurrentOperation: %d", iCurrentOperation );
       
    76         iCurrentOperation = ENotActive;
       
    77         TRequestStatus* stat = &iStatus;
       
    78         User::RequestComplete( stat, KErrNone );
       
    79         }
       
    80 
       
    81     Cancel();
       
    82 
       
    83     Cleanup();
       
    84     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
    85     }
       
    86 
       
    87 // --------------------------------------------------------------------------
       
    88 // CUpnpUnsharerAo::RunL
       
    89 // Called when asyncronous request is ready
       
    90 // --------------------------------------------------------------------------
       
    91 //
       
    92 void CUpnpUnsharerAo::RunL()
       
    93     {
       
    94     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
    95     if ( iStatus.Int() == KErrCorrupt ||
       
    96         iStatus.Int() == KErrNoMemory ||
       
    97         iStatus.Int() == KErrDiskFull )
       
    98         {
       
    99         iCurrentOperation = ENotActive;
       
   100         }
       
   101 
       
   102     if ( iStopRequested == MUpnpSharingCallback::ESharingPause )
       
   103         {
       
   104         delete iFileSharing;
       
   105         iFileSharing = NULL;
       
   106         iFileSharing = CUpnpFileSharing::NewL();
       
   107         iStopRequested = MUpnpSharingCallback::ESharingNoStop;
       
   108         }
       
   109 
       
   110     switch ( iCurrentOperation )
       
   111         {
       
   112     case EInitialize :
       
   113         {
       
   114         TInt err( InitializeL( iUpContainer ) );
       
   115         if ( !err )
       
   116             {
       
   117             QueryContainersFromMediaServerL( iUpContainer );
       
   118             }
       
   119         else
       
   120             {
       
   121             iCurrentOperation = ENotActive;
       
   122             SelfComplete( KErrNone );
       
   123             }
       
   124         }
       
   125         break;
       
   126     case EQueryContainersFromMediaServer :
       
   127         {
       
   128         QueryContainersFromMediaServerL( iCurrentContainerId );
       
   129         }
       
   130         break;
       
   131     case EQueryContainersFromMediaServerResult :
       
   132         {
       
   133         QueryContainersFromMediaServerResultL();
       
   134         }
       
   135         break;
       
   136     case EQueryItemsFromMediaServer :
       
   137         {
       
   138         QueryContainerItemsL( iCurrentContainerId );
       
   139         }
       
   140         break;
       
   141     case EUnshareItemList:
       
   142         {
       
   143         UnshareItemListL();
       
   144         }
       
   145         break;
       
   146     case EQueryItemsFromMediaServerResult :
       
   147         {
       
   148         QueryContainerItemsResultL();
       
   149         }
       
   150         break;
       
   151     case EUnshareContainer :
       
   152         {
       
   153         UnshareContainerL();
       
   154         }
       
   155         break;
       
   156     case EUnshareContainerResult :
       
   157         {
       
   158         UnshareContainerResultL();
       
   159         }
       
   160         break;
       
   161     case ENotActive :
       
   162         {
       
   163         Cleanup();
       
   164         if ( iCallback )
       
   165             {
       
   166             iCallback->CompleteSharingOperationL( iStatus.Int(), 0 );
       
   167             }
       
   168         }
       
   169         break;
       
   170     default :
       
   171         break;
       
   172         }
       
   173 
       
   174     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   175     }
       
   176 
       
   177 // --------------------------------------------------------------------------
       
   178 // CUpnpUnsharerAo::DoCancel
       
   179 // Cancels active object
       
   180 // --------------------------------------------------------------------------
       
   181 //
       
   182 void CUpnpUnsharerAo::DoCancel()
       
   183     {
       
   184     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   185     // NOTE: The cancelling of mediaserver request must be made in destructor
       
   186     // because there is no cancel in CUpnpFileSharing
       
   187     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   188     }
       
   189 
       
   190 // --------------------------------------------------------------------------
       
   191 // CUpnpUnsharerAo::RunError
       
   192 // Handle leaves
       
   193 // --------------------------------------------------------------------------
       
   194 //
       
   195 TInt CUpnpUnsharerAo::RunError( TInt aError )
       
   196     {
       
   197     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   198     TInt ret( KErrNone );
       
   199     if ( aError == KErrNoMemory ||
       
   200          aError == KErrDiskFull ||
       
   201          aError == KErrCorrupt )
       
   202         {
       
   203         iCurrentOperation = ENotActive;
       
   204         SelfComplete( aError );
       
   205         }
       
   206 
       
   207     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   208     return ret;
       
   209     }
       
   210 
       
   211 // --------------------------------------------------------------------------
       
   212 // CUpnpUnsharerAo::QueryContainersFromMediaServerL
       
   213 // (other items are commented in header)
       
   214 // --------------------------------------------------------------------------
       
   215 //
       
   216 void CUpnpUnsharerAo::QueryContainersFromMediaServerL( TInt aId )
       
   217     {
       
   218     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   219     CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC();
       
   220     browseCriteria->SetStartingIndex( iContainerBrowsePosition );
       
   221 
       
   222     if ( iContainerList )
       
   223         {
       
   224         delete iContainerList;
       
   225         iContainerList = NULL;
       
   226         }
       
   227     iContainerList = CUpnpContainerList::NewL();
       
   228 
       
   229     // Get shared containers to iContainerList
       
   230     iFileSharing->GetSharedContainerListL( aId,
       
   231                                            *browseCriteria,
       
   232                                            *iContainerList,
       
   233                                            iTotalContainers,
       
   234                                            iStatus );
       
   235     iCurrentOperation = EQueryContainersFromMediaServerResult;
       
   236     CleanupStack::PopAndDestroy( browseCriteria );
       
   237     SetActive();
       
   238 
       
   239     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   240     }
       
   241 
       
   242 // --------------------------------------------------------------------------
       
   243 // CUpnpUnsharerAo::QueryContainersFromMediaServerResultL
       
   244 // (other items are commented in header)
       
   245 // --------------------------------------------------------------------------
       
   246 //
       
   247 void CUpnpUnsharerAo::QueryContainersFromMediaServerResultL()
       
   248     {
       
   249     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   250     CUpnpContainer* nextContainer( NULL );
       
   251     TInt containerCount( iContainerList->ObjectCount() );
       
   252     if ( containerCount )
       
   253         {
       
   254         // there are subcontainers -> store them and query if they
       
   255         // have subcontainers
       
   256         iContainerLists.AppendL( iContainerList ); //Transfer ownership
       
   257         // check if we neet to get containers in segments
       
   258 
       
   259         if ( iContainerBrowsePosition + containerCount 
       
   260              >= iTotalContainers )
       
   261             {
       
   262             // all segments queried
       
   263             // next container under processing is always last in the list
       
   264             nextContainer =
       
   265                 static_cast< CUpnpContainer* >(
       
   266                     iContainerList->operator[](
       
   267                         containerCount - 1 ) );
       
   268             iCurrentContainerId = UPnPCommonUtils::DesC8ToInt(
       
   269                 nextContainer->Id());
       
   270             iContainerList = NULL;
       
   271             iContainerBrowsePosition = 0;
       
   272             }
       
   273         else
       
   274             {
       
   275             __LOG("CUpnpUnsharerAo: retrieving next segment");
       
   276             // set the starting position for retrieving next segment
       
   277             iContainerBrowsePosition += KDefaultBrowseReqCount;
       
   278             iContainerList = NULL;
       
   279             }
       
   280 
       
   281         iCurrentOperation = EQueryContainersFromMediaServer;
       
   282         }
       
   283     else
       
   284         {
       
   285         // no subcontainers -> query the items
       
   286         if ( iContainerLists.Count() )
       
   287             {
       
   288             CUpnpContainerList* contList =
       
   289                 iContainerLists[ iContainerLists.Count()-1 ];
       
   290             nextContainer =
       
   291                 static_cast< CUpnpContainer* >(
       
   292                     contList->operator[](
       
   293                         contList->ObjectCount() - 1 ) );
       
   294             iCurrentContainerId = UPnPCommonUtils::DesC8ToInt(
       
   295                 nextContainer->Id() );
       
   296             // there should be at least the initial container
       
   297             iCurrentOperation = EQueryItemsFromMediaServer;
       
   298 
       
   299             delete iContainerList;
       
   300             iContainerList = NULL;
       
   301 
       
   302             iCurrentOperation  = EQueryItemsFromMediaServer;
       
   303 
       
   304             }
       
   305         else
       
   306             {
       
   307             // error: no initial container
       
   308             iCurrentOperation  = ENotActive;
       
   309 
       
   310             }
       
   311         }
       
   312     SelfComplete( KErrNone );
       
   313     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   314     }
       
   315 
       
   316 // --------------------------------------------------------------------------
       
   317 // CUpnpUnsharerAo::QueryContainerItemsL
       
   318 // (other items are commented in header)
       
   319 // --------------------------------------------------------------------------
       
   320 //
       
   321 void CUpnpUnsharerAo::QueryContainerItemsL( TInt aId )
       
   322     {
       
   323     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   324     delete iItemList;
       
   325     iItemList = NULL;
       
   326     iItemList = CUpnpItemList::NewL();
       
   327     if ( !iFileSharing )
       
   328         {
       
   329         User::Leave( KErrGeneral );
       
   330         }
       
   331     CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC();
       
   332     if ( iTotalItems == KErrNotFound )
       
   333         {
       
   334         iFileSharing->GetSharedItemListL (
       
   335             aId, *browseCriteria,
       
   336             *iItemList, iTotalItems, iStatus );
       
   337 
       
   338         if ( iTotalItems > 0 )
       
   339             {
       
   340             iAllTotalItems += iTotalItems;
       
   341             }
       
   342         }
       
   343     else
       
   344         {
       
   345         TInt tmp( 0 );
       
   346         iFileSharing->GetSharedItemListL (
       
   347             aId, *browseCriteria,
       
   348             *iItemList, tmp, iStatus );
       
   349 
       
   350         if ( tmp > 0 )
       
   351             {
       
   352             iAllTotalItems += tmp;
       
   353             }
       
   354         }
       
   355     iCurrentOperation = EQueryItemsFromMediaServerResult;
       
   356     CleanupStack::PopAndDestroy( browseCriteria );
       
   357     SetActive();
       
   358     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   359     }
       
   360 
       
   361 // --------------------------------------------------------------------------
       
   362 // CUpnpUnsharerAo::QueryContainerItemsResultL
       
   363 // (other items are commented in header)
       
   364 // --------------------------------------------------------------------------
       
   365 //
       
   366 void CUpnpUnsharerAo::QueryContainerItemsResultL()
       
   367     {
       
   368     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   369     if ( !iItemList )
       
   370         {
       
   371         User::Leave( KErrGeneral );
       
   372         }
       
   373     TInt objCount( iItemList->ObjectCount() );
       
   374     if ( objCount && ( iExecStatus < iTotalItems ) )
       
   375         {
       
   376         // unshare the items in parts
       
   377         iCurrentOperation = EUnshareItemList;
       
   378         
       
   379         }
       
   380     else
       
   381         {
       
   382         // the container iCurrentContainerId is empty -> unshare it unless it
       
   383         // is the container received at the start
       
   384 
       
   385         if ( iContainerLists.Count() > 1 )
       
   386             {
       
   387             iCurrentOperation = EUnshareContainer;
       
   388             }
       
   389         else
       
   390             {
       
   391             // all done
       
   392             iCurrentOperation = ENotActive;
       
   393             }
       
   394         }
       
   395 
       
   396     if ( iExecStatus > 0  )
       
   397         {
       
   398         iCallback->SetProgressL( iExecStatus );
       
   399         }
       
   400 
       
   401     SelfComplete( KErrNone );
       
   402     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   403     }
       
   404 
       
   405 // --------------------------------------------------------------------------
       
   406 // CUpnpUnsharerAo::UnshareItemListL
       
   407 // (other items are commented in header)
       
   408 // --------------------------------------------------------------------------
       
   409 //
       
   410 void CUpnpUnsharerAo::UnshareItemListL()
       
   411     {
       
   412     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   413 
       
   414     iExecStatus += iItemList->ObjectCount();
       
   415     iFileSharing->UnshareItemListL( *iItemList, iUnsharePosition, iStatus );
       
   416 
       
   417     delete iItemList;
       
   418     iItemList = NULL;
       
   419     iCurrentOperation = EQueryItemsFromMediaServer;
       
   420     SetActive();
       
   421     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   422     }
       
   423 
       
   424 // --------------------------------------------------------------------------
       
   425 // CUpnpUnsharerAo::UnshareContainerL
       
   426 // (other items are commented in header)
       
   427 // --------------------------------------------------------------------------
       
   428 //
       
   429 void CUpnpUnsharerAo::UnshareContainerL()
       
   430     {
       
   431     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   432     iFileSharing->UnshareContainerL( iCurrentContainerId, iStatus );
       
   433     iCurrentOperation = EUnshareContainerResult;
       
   434     iExecStatus = 0;
       
   435     iTotalItems = KErrNotFound;
       
   436     SetActive();
       
   437     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   438     }
       
   439 
       
   440 // --------------------------------------------------------------------------
       
   441 // CUpnpUnsharerAo::UnshareContainerResultL
       
   442 // (other items are commented in header)
       
   443 // --------------------------------------------------------------------------
       
   444 //
       
   445 void CUpnpUnsharerAo::UnshareContainerResultL()
       
   446     {
       
   447     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   448 
       
   449     if ( iContainerLists.Count() )
       
   450         {
       
   451         // one container is now fully handled -> remove from list of
       
   452         // containers
       
   453         CUpnpContainerList* contList =
       
   454             iContainerLists[ iContainerLists.Count()-1 ];
       
   455         // note: iCurrentContainerId is always last in the list
       
   456         contList->RemoveAndDestroy( *UPnPCommonUtils::IntToDesC8LC(
       
   457             iCurrentContainerId ) );
       
   458         CleanupStack::PopAndDestroy(); // UPnPCommonUtils::IntToDesC8LC
       
   459         if ( contList->ObjectCount() )
       
   460             {
       
   461             // get the next container ( last of the list ) to process
       
   462             TInt nextPos = contList->ObjectCount() - 1;
       
   463             CUpnpContainer* nextContainer = static_cast< CUpnpContainer* >(
       
   464                 contList->operator[]( nextPos ));
       
   465             iCurrentContainerId = UPnPCommonUtils::DesC8ToInt(
       
   466                 nextContainer->Id());
       
   467             // Restart cycle: query if it has subcontainers
       
   468             iCurrentOperation = EQueryContainersFromMediaServer;
       
   469 
       
   470             }
       
   471         else
       
   472             {
       
   473             // one directory hierarchy is empty
       
   474             CUpnpContainerList* removeList = iContainerLists[
       
   475                 iContainerLists.Count()-1 ];
       
   476             iContainerLists.Remove( iContainerLists.Count()-1 );
       
   477             delete removeList;
       
   478             if ( iContainerLists.Count() )
       
   479                 {
       
   480                 // go back in containerlists
       
   481                 contList =
       
   482                     iContainerLists[ iContainerLists.Count()-1 ];
       
   483                 TInt backPos( contList->ObjectCount() - 1 );
       
   484                 CUpnpContainer* nextContainer =
       
   485                     static_cast< CUpnpContainer* >(
       
   486                         contList->operator[]( backPos ));
       
   487                 iCurrentContainerId = UPnPCommonUtils::DesC8ToInt(
       
   488                     nextContainer->Id() );
       
   489                 // Restart cycle: query if it has items
       
   490                 // no need to query containers
       
   491                 iCurrentOperation = EQueryItemsFromMediaServer;
       
   492 
       
   493                 }
       
   494             else
       
   495                 {
       
   496                 // all done
       
   497                 iCurrentOperation = ENotActive;
       
   498                 }
       
   499             }
       
   500         }
       
   501     else
       
   502         {
       
   503         // all done
       
   504         iCurrentOperation = ENotActive;
       
   505         }
       
   506     SelfComplete( KErrNone );
       
   507     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   508     }
       
   509 
       
   510 // --------------------------------------------------------------------------
       
   511 // CUpnpUnsharerAo::EmptyContainer
       
   512 // (other items are commented in header)
       
   513 // --------------------------------------------------------------------------
       
   514 //
       
   515 TInt CUpnpUnsharerAo::EmptyContainer( TInt& aContainerId )
       
   516     {
       
   517     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   518 
       
   519     TInt err( KErrNotFound );
       
   520 
       
   521     iUpContainer = aContainerId;
       
   522     iCurrentContainerId = aContainerId;
       
   523     iCurrentOperation = EInitialize;
       
   524     SelfComplete( KErrNone );
       
   525     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   526     return err;
       
   527     }
       
   528 
       
   529 // --------------------------------------------------------------------------
       
   530 // CUpnpUnsharerAo::RequestStop
       
   531 // ( other items are commented in header )
       
   532 // --------------------------------------------------------------------------
       
   533 //
       
   534 void CUpnpUnsharerAo::RequestStop(
       
   535     MUpnpSharingCallback::TSharingStopType aStopType )
       
   536     {
       
   537     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   538     iStopRequested = aStopType;
       
   539     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   540     }
       
   541 
       
   542 // --------------------------------------------------------------------------
       
   543 // CUpnpUnsharerAo::InitializeL
       
   544 // (other items are commented in header)
       
   545 // --------------------------------------------------------------------------
       
   546 //
       
   547 TInt CUpnpUnsharerAo::InitializeL( TInt& aContainerId )
       
   548     {
       
   549     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   550     // First initialize resources
       
   551     iFileSharing = CUpnpFileSharing::NewL();
       
   552     TInt error( iMediaServer.Connect() );
       
   553     if ( !error )
       
   554         {
       
   555         // start offline if not started
       
   556         TInt status( RUpnpMediaServerClient::EStopped );
       
   557         iMediaServer.Status( status );
       
   558         if ( status == RUpnpMediaServerClient::EStopped )
       
   559             {
       
   560             error = iMediaServer.StartOffline();
       
   561             }
       
   562         if ( !error )
       
   563             {
       
   564             CUpnpContainerList* beginList = CUpnpContainerList::NewLC();
       
   565             CUpnpContainer* beginContainer = CUpnpContainer::NewL();
       
   566             CleanupStack::PushL( beginContainer );
       
   567             beginContainer->SetIdL(
       
   568                 *UPnPCommonUtils::IntToDesC8LC( aContainerId ) );
       
   569             CleanupStack::PopAndDestroy(); // IntToDesC8LC
       
   570             beginList->AppendObjectL( *beginContainer ); //Transfer ownership
       
   571             CleanupStack::Pop( beginContainer );
       
   572             iContainerLists.AppendL( beginList ); //Transfer ownership
       
   573             CleanupStack::Pop( beginList );
       
   574             }
       
   575         }
       
   576 
       
   577     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   578     return error;
       
   579     }
       
   580 
       
   581 // --------------------------------------------------------------------------
       
   582 // CUpnpUnsharerAo::CreateBrowseCriteriaLC
       
   583 // (other items are commented in header)
       
   584 // --------------------------------------------------------------------------
       
   585 //
       
   586 CUpnpBrowseCriteria* CUpnpUnsharerAo::CreateBrowseCriteriaLC() const
       
   587     {
       
   588     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   589     CUpnpBrowseCriteria* browseCriteria = CUpnpBrowseCriteria::NewLC();
       
   590     browseCriteria->SetRequestedCount( KDefaultBrowseReqCount );
       
   591     browseCriteria->SetStartingIndex( KDefaultBrowseStartingInd );
       
   592     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   593     return browseCriteria;
       
   594     }
       
   595 
       
   596 // --------------------------------------------------------------------------
       
   597 // CUpnpUnsharerAo::SelfComplete
       
   598 // Complete own request
       
   599 // --------------------------------------------------------------------------
       
   600 //
       
   601 void CUpnpUnsharerAo::SelfComplete( TInt aError )
       
   602     {
       
   603     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   604     SetActive();
       
   605     TRequestStatus* stat = &iStatus;
       
   606     User::RequestComplete( stat, aError );
       
   607     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   608     }
       
   609 
       
   610 // --------------------------------------------------------------------------
       
   611 // CUpnpUnsharerAo::Cleanup
       
   612 // (other items are commented in header)
       
   613 // --------------------------------------------------------------------------
       
   614 //
       
   615 void CUpnpUnsharerAo::Cleanup()
       
   616     {
       
   617     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   618     iExecStatus = 0;
       
   619     iTotalItems = KErrNotFound;
       
   620     iTotalContainers = KErrNotFound;
       
   621     iContainerBrowsePosition = 0;
       
   622 
       
   623     iCurrentContainerId = KErrNotFound;
       
   624     iUpContainer = KErrNotFound;
       
   625     iStopRequested = MUpnpSharingCallback::ESharingNoStop;
       
   626 
       
   627     delete iItemList;
       
   628     iItemList = NULL;
       
   629     delete iContainerList;
       
   630     iContainerList = NULL;
       
   631 
       
   632     iContainerLists.ResetAndDestroy();
       
   633 
       
   634     iCurrentOperation = ENotActive;
       
   635 
       
   636     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   637     }
       
   638 
       
   639 // --------------------------------------------------------------------------
       
   640 // CUpnpUnsharerAo::UnSharingProgress
       
   641 // (the usage in header)
       
   642 // --------------------------------------------------------------------------
       
   643 //
       
   644 TInt CUpnpUnsharerAo::UnSharingProgress( ) 
       
   645     { 
       
   646     TInt progress( 0 );
       
   647     if ( iExecStatus >= 0 )
       
   648         {
       
   649         progress = iExecStatus;
       
   650         }
       
   651     return progress;
       
   652     }
       
   653 
       
   654 // --------------------------------------------------------------------------
       
   655 // CUpnpUnsharerAo::TotalItemsForUnShare
       
   656 // (the usage in header)
       
   657 // --------------------------------------------------------------------------
       
   658 //
       
   659 TInt CUpnpUnsharerAo::TotalItemsForUnShare( ) 
       
   660     {
       
   661     TInt items( 0 );
       
   662     if ( iTotalItems >= 0 )
       
   663         {
       
   664         items = iTotalItems;
       
   665         }
       
   666     return items;
       
   667     }
       
   668 
       
   669 // End of file