homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadmngr.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 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:  Manages upnp download
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CMFMDOWNLOADMNGR_H
       
    21 #define __CMFMDOWNLOADMNGR_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 #include "upnpfiletransfersessionobserver.h"
       
    26 
       
    27 /* Forward declarations. */
       
    28 class MUPnPAVController;
       
    29 class CUpnpAVDevice;
       
    30 class MCmFmTransferObserver;
       
    31 
       
    32 // CLASS DECLARATION
       
    33  /**
       
    34   *  Class represents methods to communication with AV Controller API.
       
    35   *
       
    36   *  @lib cmfillmanager.lib
       
    37   *
       
    38   *  @since S60 5.1
       
    39   */
       
    40 NONSHARABLE_CLASS( CCmFmDownloadMngr ): public CBase,
       
    41                           public MUPnPFileTransferSessionObserver
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Two-phased constructor.
       
    48      *
       
    49      * @since S60 5.1
       
    50      * @param aAVController, av controller
       
    51      * @param aObserver, action observer
       
    52      * @param aDevice, device
       
    53      * @param aDownloadId, id for the download manager
       
    54      * @return  pointer to CCmFmDownloadMngr class
       
    55      */
       
    56     static CCmFmDownloadMngr* NewL( MUPnPAVController* aAVController, 
       
    57         MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice,
       
    58         const TInt aDownloadId  );
       
    59     
       
    60     /**
       
    61      * Two-phased constructor.
       
    62      *
       
    63      * @since S60 5.1
       
    64      * @param aAVController, av controller
       
    65      * @param aObserver, action observer
       
    66      * @param aDevice, device      
       
    67      * @param aDownloadId, id for the download manager
       
    68      * @return  pointer to CCmFmDownloadMngr class
       
    69      */
       
    70     static CCmFmDownloadMngr* NewLC( MUPnPAVController* aAVController, 
       
    71         MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice,
       
    72         const TInt aDownloadId  );
       
    73 
       
    74     /**
       
    75      * Destructor.
       
    76      */
       
    77     virtual ~CCmFmDownloadMngr();
       
    78 
       
    79 public: 
       
    80         
       
    81     /**
       
    82     * Starts to fetch defined file
       
    83     *
       
    84     * @since S60 5.1
       
    85     * @param aResElement, pointer to av controller
       
    86     * @param aItem, item to be transferred
       
    87     * @param aFile, file to be downloaded
       
    88     * @param aInternalItemId, internal item index
       
    89     * @return None
       
    90     */ 
       
    91     void FetchFileL( const CUpnpElement& aResElement, 
       
    92         const CUpnpItem& aItem, RFile& aFile, const TInt64 aInternalItemId );
       
    93     
       
    94     /**
       
    95     * Cancel UPnP operation
       
    96     *
       
    97     * @since S60 5.1
       
    98     * @param None
       
    99     * @return None
       
   100     */    
       
   101     void CancelOperation();
       
   102 
       
   103 protected: 
       
   104     
       
   105 // From base class MUPnPFileTransferSessionObserver
       
   106 
       
   107     /**
       
   108      * From MUPnPFileTransferSessionObserver
       
   109      * @see base class definition
       
   110      */
       
   111     void TransferStarted( TInt aKey, TInt aStatus );
       
   112  
       
   113     /**
       
   114      * From MUPnPFileTransferSessionObserver
       
   115      * @see base class definition
       
   116      */
       
   117      void TransferCompleted( TInt aKey, TInt aStatus,
       
   118                              const TDesC& aFilePath );
       
   119     
       
   120     /**
       
   121      * From MUPnPFileTransferSessionObserver
       
   122      * @see base class definition
       
   123      */
       
   124     void TransferProgress( TInt aKey, TInt aBytes, TInt aTotalBytes );
       
   125 
       
   126     /**
       
   127      * From MUPnPFileTransferSessionObserver
       
   128      * @see base class definition
       
   129      */        
       
   130     void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );
       
   131                            
       
   132 private:
       
   133 
       
   134     /**
       
   135      * Performs the first phase of two phase construction.
       
   136      *
       
   137      * @since S60 5.1
       
   138      * @param aAVController, av controller
       
   139      * @param aObserver, transfer observer
       
   140      * @param aDownloadId, download manager id
       
   141      */
       
   142     CCmFmDownloadMngr( MUPnPAVController* aAVController, 
       
   143         MCmFmTransferObserver* aObserver, const TInt aDownloadId );
       
   144 
       
   145     /**
       
   146      * Performs the second phase construction.
       
   147      * @since S60 5.1
       
   148      * @param aDevice, UPnP server
       
   149      */
       
   150     void ConstructL( const CUpnpAVDevice& aDevice );
       
   151     
       
   152 
       
   153 private:
       
   154     
       
   155     /**
       
   156      * AV Controller
       
   157      */
       
   158     MUPnPAVController* iAVController;                   // Not owned
       
   159     
       
   160     /**
       
   161      * File transfer Observer
       
   162      */
       
   163     MCmFmTransferObserver* iObserver;                   // Not owned
       
   164     
       
   165     /**
       
   166      * Download manager id. Proxy identifies managers with this id
       
   167      */
       
   168     TInt iDownloadId;
       
   169     
       
   170     /**
       
   171      * Download session
       
   172      */
       
   173     MUPnPFileDownloadSession* iDownloadSession;         // Not owned
       
   174 
       
   175     /**
       
   176      * Size of transferred file
       
   177      */
       
   178     TInt64 iFileSize;
       
   179     
       
   180     };
       
   181 
       
   182 #endif //  __CMFMDOWNLOADMNGR_H