homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadproxy.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 __CMFMDOWNLOADPROXY_H
       
    21 #define __CMFMDOWNLOADPROXY_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 /* Forward declarations. */
       
    26 class MUPnPAVController;
       
    27 
       
    28 class CUpnpAVDevice;
       
    29 class MCmFmTransferObserver;
       
    30 class CCmFmDownloadMngr;
       
    31 
       
    32 // CLASS DECLARATION
       
    33  
       
    34 /**
       
    35  *  Class represents methods to communication with AV Controller API.
       
    36  *
       
    37  *  @lib cmfillmanager.lib
       
    38  *
       
    39  *  @since S60 5.1
       
    40  */
       
    41 NONSHARABLE_CLASS( CCmFmDownloadProxy ): public CBase
       
    42     {
       
    43  
       
    44 private:
       
    45     
       
    46     // Struct containing indexed download session 
       
    47     // ( own session for each server )
       
    48     struct TCmFmDownloadSessionIndexes
       
    49         {
       
    50         TInt iDeviceIndex;  // Device index
       
    51         TInt iSessionIndex; // Session index
       
    52         };
       
    53 
       
    54 public:
       
    55 
       
    56     /**
       
    57      * Two-phased constructor.
       
    58      *
       
    59      * @since S60 5.1
       
    60      */
       
    61     static CCmFmDownloadProxy* NewL( );
       
    62     
       
    63     /**
       
    64      * Two-phased constructor.
       
    65      *
       
    66      * @since S60 5.1
       
    67      */
       
    68     static CCmFmDownloadProxy* NewLC( );
       
    69 
       
    70     /**
       
    71      * Destructor.
       
    72      */
       
    73     virtual ~CCmFmDownloadProxy();
       
    74 
       
    75 public: 
       
    76             
       
    77     /**
       
    78      * Starts to fetch defined file
       
    79      *
       
    80      * @since S60 5.1
       
    81      * @param aObserver, action observer
       
    82      * @param aAVController, pointer to av controller
       
    83      * @param aDevices, list of devices        
       
    84      * @param aResElement, pointer to av controller
       
    85      * @param aItem, item to be transferred
       
    86      * @param aFile, file reference
       
    87      * @param aInternalDeviceIndex, internal device index
       
    88      * @param aInternalItemId, internal item index
       
    89      * @return None
       
    90      */ 
       
    91     void FetchFileL( MCmFmTransferObserver* aObserver, 
       
    92         MUPnPAVController* aAVController, CUpnpAVDeviceList* aDevices, 
       
    93         const CUpnpElement& aResElement, 
       
    94         const CUpnpItem& aItem, RFile& aFile, const TInt aInternalDeviceIndex,
       
    95         const TInt64 aInternalItemId );
       
    96    
       
    97     /**
       
    98      * Closes download session
       
    99      *
       
   100      * @since S60 5.1
       
   101      * @param aSessionId, session to be closed
       
   102      * @return ETrue, if sessions left
       
   103      */    
       
   104     TBool CloseDownloadSession( const TInt aSessionId );
       
   105     
       
   106     /**
       
   107      * Cancel UPnP operation download
       
   108      *
       
   109      * @since S60 5.1
       
   110      * @param None
       
   111      * @return None
       
   112      */    
       
   113     void CancelOperation();
       
   114     
       
   115 private:
       
   116 
       
   117     /**
       
   118      * Starts new download session if session to 
       
   119      * defined device doesn't already exist.
       
   120      *
       
   121      * @since S60 5.1
       
   122      * @param aObserver, action observer
       
   123      * @param aAVController, pointer to av controller
       
   124      * @param aDevices, list of devices       
       
   125      * @param aInternalDeviceIndex, internal device index
       
   126      * @return index of the used session
       
   127      */    
       
   128     TInt StartNewDownloadSessionIfNeededL( MCmFmTransferObserver* aObserver, 
       
   129         MUPnPAVController* aAVController, 
       
   130         CUpnpAVDeviceList* aDevices, 
       
   131         const TInt aInternalDeviceIndex );
       
   132 
       
   133     /**
       
   134      * Creates new download session
       
   135      *
       
   136      * @since S60 5.1
       
   137      * @param aObserver, action observer
       
   138      * @param aAVController, pointer to av controller
       
   139      * @param aDevices, list of devices       
       
   140      * @param aSessionCount, session count
       
   141      * @param aSessionIndex, ref to session index
       
   142      * @return index of the used session
       
   143      */        
       
   144     void CreateNewSessionL(  
       
   145         MCmFmTransferObserver* aObserver, MUPnPAVController* aAVController, 
       
   146         CUpnpAVDeviceList* aDevices, TInt aSessionCount, 
       
   147         TInt& aSessionIndex );                              
       
   148                            
       
   149 private:
       
   150 
       
   151     /**
       
   152      * Performs the first phase of two phase construction.
       
   153      */
       
   154     CCmFmDownloadProxy( );
       
   155 
       
   156     /**
       
   157      * Performs the second phase construction.
       
   158      */
       
   159     void ConstructL();
       
   160     
       
   161 
       
   162 private:
       
   163     
       
   164     /**
       
   165      * Download sessions
       
   166      */
       
   167     RPointerArray<CCmFmDownloadMngr> iDownloadSessions;
       
   168     
       
   169     /**
       
   170      * Indexed array for download sessions
       
   171      */
       
   172     RArray<TCmFmDownloadSessionIndexes> iSessionIndexes;
       
   173     
       
   174     /**
       
   175      * Count of download session
       
   176      */
       
   177     TInt iDownloadSessionCount;
       
   178     
       
   179     };
       
   180 
       
   181 #endif //  __CMFMDOWNLOADPROXY_H