upnpsharing/upnpsharingalgorithm/inc/upnpsharingao.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
       
     1 /**
       
     2  * Copyright (c) 2009 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 : CUpnpSharingAO class definiton
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef UPNP_SHARING_AO_H
       
    19 #define UPNP_SHARING_AO_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 // FORWARD DECLARATIONS
       
    25 class CUpnpItem;
       
    26 class CUpnpFileSharing;
       
    27 
       
    28 /**
       
    29  *  UpnpSharingAO class definition
       
    30  *
       
    31  *  @lib upnpsharingalgorithm.lib
       
    32  *  @since S60 5.2
       
    33  */
       
    34 class CUpnpSharingAO  : public CActive
       
    35     {
       
    36 
       
    37     public:
       
    38         // Constructors and destructor.
       
    39 
       
    40         /**
       
    41          * Two-phased constructor.
       
    42          * @since S60 5.2
       
    43          */
       
    44         static CUpnpSharingAO* NewL();
       
    45 
       
    46         /**
       
    47          * Two-phased constructor.
       
    48          * @since S60 5.2
       
    49          */
       
    50         static CUpnpSharingAO* NewLC();
       
    51 
       
    52         /**
       
    53          * Destructor.
       
    54          * @since S60 5.2
       
    55          */
       
    56         virtual ~CUpnpSharingAO();
       
    57 
       
    58     public:
       
    59 
       
    60         /**
       
    61          * Shares file
       
    62          *
       
    63          * @since S60 5.2
       
    64          * @param aParentContainerId, parent container id where
       
    65          * item is shared
       
    66          * @param aItem, UpnpItem to be shared
       
    67          */
       
    68         void ShareFileL( const TDesC8& aParentContainerId,
       
    69                          CUpnpItem* aItem );
       
    70 
       
    71         /**
       
    72          * Shares reference item based on original items id.
       
    73          * Item data is filled on sharing.
       
    74          *
       
    75          * @since S60 5.2
       
    76          * @param aParentContainerId, parent container id where
       
    77          * item is shared
       
    78          * @param aOriginalItemId, original item id from
       
    79          *                         which reference is created
       
    80          * @param aItem, reference UpnpItem to be shared
       
    81          */
       
    82         void ShareReferenceL( const TInt aParentContainerId,
       
    83                               const TInt aOriginalItemId,
       
    84                               CUpnpItem* aItem );
       
    85 
       
    86         /**
       
    87          * Shares container
       
    88          *
       
    89          * @since S60 5.2
       
    90          * @param aContainer, Container object which is going to be shared
       
    91          */
       
    92         void ShareContainerL( CUpnpContainer* aContainer );
       
    93 
       
    94         /**
       
    95          * Unshares file
       
    96          *
       
    97          * @since S60 5.2
       
    98          * @param aItemId, itemid of UPnPItem to be shared
       
    99          */
       
   100         void UnshareFileL( const TInt aItemId );
       
   101 
       
   102         /**
       
   103          * Unshares container
       
   104          *
       
   105          * @since S60 5.2
       
   106          * @param aContainerId, id for container which is going to be unshared
       
   107          */
       
   108         void UnshareContainerL( const TInt aContainerId );
       
   109 
       
   110     protected:
       
   111 
       
   112         // From base class CActive
       
   113 
       
   114         /**
       
   115          * From CActive
       
   116          * See base class definition
       
   117          */
       
   118         void RunL();
       
   119 
       
   120         /**
       
   121          * From CActive
       
   122          * See base class definition
       
   123          */
       
   124         void DoCancel();
       
   125 
       
   126     private:
       
   127 
       
   128         /**
       
   129          * Second-phase constructor.
       
   130          *
       
   131          * @since S60 5.2
       
   132          */
       
   133         void ConstructL();
       
   134 
       
   135         /**
       
   136          * C++ default constructor.
       
   137          * @since S60 5.2
       
   138          */
       
   139         CUpnpSharingAO::CUpnpSharingAO() :
       
   140                             CActive( CActive::EPriorityStandard ) {}
       
   141 
       
   142         /**
       
   143          * Waits that request completes
       
   144          * This does not block other AO's
       
   145          *
       
   146          * @since S60 5.2
       
   147          */
       
   148         void WaitRequestToComplete();
       
   149 
       
   150         /**
       
   151          * Stops waiting request complete
       
   152          *
       
   153          * @since S60 5.2
       
   154          */
       
   155         void StopWaitingRequestComplete();
       
   156 
       
   157         /**
       
   158          * Sets the object active and waits for the request to complete
       
   159          *
       
   160          * @since S60 5.2
       
   161          */
       
   162         void CompleteRequestL();
       
   163 
       
   164     private:
       
   165 
       
   166         /**
       
   167          * MediaServer file sharing instance. Owned
       
   168          */
       
   169         CUpnpFileSharing*               iFileSharing;
       
   170 
       
   171         /**
       
   172          * Waits request to complete. Owned
       
   173          */
       
   174         CActiveSchedulerWait*           iWaitRequest;
       
   175 
       
   176         /**
       
   177          * Active scheduler pointer. Owned.
       
   178          */
       
   179         CActiveScheduler*               iScheduler;
       
   180     };
       
   181 
       
   182 #endif // UPNP_SHARING_AO_H
       
   183 // End of File