upnpmediaserver/contentdirectoryservice/inc/upnptransfercontroller.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /** @file
       
     2 * Copyright (c) 2005-2006 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CUPNPTRANSFERCONTROLLER_H
       
    21 #define C_CUPNPTRANSFERCONTROLLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 #include "upnpnotifytimer.h"
       
    26 #include "upnperrors.h"
       
    27 #include "upnpfiletransfer.h"
       
    28 #include "upnpfiletransfertimerobserver.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CUpnpContentDirectory;
       
    32 class CUpnpFileTransferEvent;
       
    33 class CUpnpHttpMessage;
       
    34 
       
    35 /**
       
    36 *  This is a class controlling upload and downloads
       
    37 *
       
    38 *  @lib ContentDirectory
       
    39 *  @since Series 60 2.6
       
    40 */
       
    41 class CUpnpTransferController: public CBase, public MUpnpFileTransferTimerObserver
       
    42 {
       
    43 public: // Constructors and destructors
       
    44 
       
    45     /**
       
    46     * Two-phased constructor 
       
    47     * @since Series60 2.6
       
    48     * @param aService Parent service 
       
    49     */
       
    50     static CUpnpTransferController* NewL( CUpnpContentDirectory* aCd );
       
    51 
       
    52 
       
    53     /**
       
    54     * Destructor.
       
    55     */
       
    56     virtual ~CUpnpTransferController();
       
    57 
       
    58      /**
       
    59     * This functions is a entry point for http messages.
       
    60     * received from Symbian HTTP Stack
       
    61     * @since Series 60 3.2
       
    62     * @param aSessionId identifier of the HTTP request.
       
    63     * @param aHttpStatusCode HTTP error code.
       
    64     */
       
    65     void HttpResponseReceivedL( TInt aSessionId,
       
    66                                 TInt aStatusCode);   
       
    67                                 
       
    68     /** 
       
    69     * Function for stopping ongoing file transfer (import / export)
       
    70     * @since Series 60 2.6
       
    71     * @param aAction received action
       
    72     * @retrun upnperrorcode descriping situation
       
    73     **/
       
    74     TUpnpErrorCode StopTransferResourceL( TInt aId ); 
       
    75     
       
    76     
       
    77     /**
       
    78     * This function return a file transfer from CDs list.
       
    79     * @since Series 60 2.6
       
    80     * @param aTransferId transferid to be checked
       
    81     * @return TUpnpFileTransfer.
       
    82     */
       
    83     TInt Transfer( TInt aTransferId );
       
    84     
       
    85     /**
       
    86     * This functions returns export/import file transfers which are in progress state       
       
    87     * @param aResult number of file transfers in progress state 
       
    88     */
       
    89     TBool IsMaxImportExportTransfers();
       
    90         
       
    91     /**
       
    92     * This function removes a file transfer event from list and return it.
       
    93     * @since Series 60 2.6
       
    94     * @param aTransferId transferid to be checked
       
    95     * @return TUpnpFileTransfer.
       
    96     */
       
    97     CUpnpFileTransferEvent* RemoveTransferLC( TInt aTransferId );
       
    98     
       
    99     CUpnpFileTransferEvent* TransferL( TInt aTransferId );
       
   100 
       
   101     /**
       
   102     * Callback for filetransfer timer events
       
   103     * @since Series 60 2.6
       
   104     * @return Error code
       
   105     */
       
   106     void TransferEvent( CUpnpFileTransferTimerObserver* aTimer );
       
   107     
       
   108      /**
       
   109     * Append transfer to transfer list for eventing purpose        
       
   110     * @param aHttpMsg 
       
   111     */
       
   112     void AddIncomingTransferInternalL(CUpnpHttpMessage* aHttpMsg);
       
   113     
       
   114     void TransferFailL(CUpnpHttpMessage* aHttpMsg);
       
   115 
       
   116      /**
       
   117     * Sends transfer failed event to Media Server       
       
   118     * @param aHttpMsg 
       
   119     */
       
   120     void NotifyTransferFailL(CUpnpHttpMessage* aHttpMsg);
       
   121                                 
       
   122 private:
       
   123     /**
       
   124     * C++ default constructor.
       
   125     */
       
   126     CUpnpTransferController( CUpnpContentDirectory* aCd );
       
   127     
       
   128     /**
       
   129     * Second phase of the constructor.
       
   130     * Initialises a DOM tree.
       
   131     * By default Symbian 2nd phase constructor is private.
       
   132     * @param service Parent service
       
   133     */
       
   134     void ConstructL();
       
   135     
       
   136 
       
   137 
       
   138 public: 
       
   139 
       
   140     //array for filetransfers  
       
   141     RPointerArray<CUpnpFileTransfer> iFileTransfers;
       
   142     
       
   143     
       
   144     RPointerArray<CUpnpFileTransferTimerObserver> iStatusTimers;
       
   145 
       
   146     
       
   147 private: 
       
   148     CUpnpContentDirectory* iContentDirectory;
       
   149            
       
   150     };
       
   151 
       
   152 #endif      // C_CUPNPTRANSFERCONTROLLER_H 
       
   153         
       
   154 // End of File