mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/DownloadGateway.h
changeset 16 43d09473c595
parent 14 80975da52420
child 22 128eb6a32b84
equal deleted inserted replaced
14:80975da52420 16:43d09473c595
     1 /*
       
     2 * Copyright (c) 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:  Header of DownloadGateway class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DOWNLOADGATEWAY_H
       
    20 #define DOWNLOADGATEWAY_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <downloadmgrclientapiext.h>
       
    24 #include <ProgDLSource.h>
       
    25 
       
    26 namespace multimedia
       
    27     {
       
    28     
       
    29     /**
       
    30      *  Observer that sends browser events to the Client
       
    31      *  @lib EnhancedMediaClient.lib
       
    32      *  @since S60 v3.2
       
    33      */    
       
    34     class MDownloadGatewayObserver
       
    35         {
       
    36         public:
       
    37             virtual void Event(MProgDLSource::TDownloadStatus aStatus) = 0;
       
    38             virtual void MoveFileComplete(TInt aError) = 0;
       
    39         };
       
    40 
       
    41     /**
       
    42     *  Implements the Gateway from which the Clients talk to the DownloadMgr.
       
    43     *  Provides functionality to the Clients to query attributes
       
    44     *  from the Browser
       
    45     *  @lib EnhancedMediaClient.lib
       
    46     *  @since S60 v3.2
       
    47     */    
       
    48     class CDownloadGateway : public MHttpDownloadMgrObserver
       
    49         {
       
    50         public:
       
    51             /**
       
    52             * Function to Create the Object.
       
    53             */
       
    54             CDownloadGateway();
       
    55             /**
       
    56             * Destructor.
       
    57             */
       
    58             ~CDownloadGateway();
       
    59 
       
    60             /**
       
    61             * Initialize the Gateway with the Client UID.
       
    62             * Here it connect to the DownloadMgr Server.
       
    63             * @since S60 v3.2
       
    64             * @param aClientUid Client which wants to connect.             
       
    65             */            
       
    66             TInt Initialize(TUid aClientUid);
       
    67             /**
       
    68             * Calls Move on the DownloadMgr for the TransactionID
       
    69             * @since S60 v3.2
       
    70             * @param aId TransactionID for which the File has to be moved.             
       
    71             * @param aDestFileName Full Pathname where the file needs to be moved.             
       
    72             */            
       
    73             TInt MoveFile( TInt aId, const TDesC& aDestFileName );
       
    74             /**
       
    75             * Called by the Client which wants to Connect to the Download
       
    76             * @since S60 v3.2
       
    77             * @param aId TransactionID for which the File has to be moved.             
       
    78             * @param aObserver Observer where the Client wants the Callbacks             
       
    79             * @param aAppUid UID for the App which Connects.             
       
    80             */            
       
    81             TInt ConnectToDownload(TInt aId, MDownloadGatewayObserver& aObserver, TUid aAppUid);
       
    82             /**
       
    83             * Disconnect from the Download
       
    84             * Here it connect to the DownloadMgr Server.
       
    85             * @since S60 v3.2
       
    86             * @param aId DownloadID from which the Client wants to Disconnect.             
       
    87             */            
       
    88             TInt DisconnectFromDownload(TInt aId);
       
    89             /**
       
    90             * Gets the Current Downloaded Size of the Download
       
    91             * @since S60 v3.2
       
    92             * @param aId TransactionID of the Download which the FileSize is queried.             
       
    93             * @param aSize Size of the Download returned             
       
    94             */            
       
    95             TInt GetCurrentSize(  TInt aId, TUint& aSize );
       
    96             /**
       
    97             * Total Size of the File which is being downloaded
       
    98             * Here it connect to the DownloadMgr Server.
       
    99             * @since S60 v3.2
       
   100             * @param aId TransactionID of the Download which the FileSize is queried.             
       
   101             * @param aSize Total Size of the File being Downloaded returned             
       
   102             */            
       
   103             TInt GetDownloadSize( TInt aId, TUint& aSize );
       
   104             /**
       
   105             * Gets the Download Status for a particular Download
       
   106             * @since S60 v3.2
       
   107             * @param aId TransactionID of the Download which the FileSize is queried.             
       
   108             * @param aStatus Download Status for the Download           
       
   109             */            
       
   110             TInt GetDownloadStatus(TInt aTxId, MProgDLSource::TDownloadStatus& aStatus);
       
   111             /**
       
   112             * Cancelling a Particular Download
       
   113             * @since S60 v3.2
       
   114             * @param aId TransactionID of the Download to be deleted             
       
   115             */            
       
   116             TInt DeleteDownload(TInt aId);
       
   117             /**
       
   118             * Resuming a Paused Download
       
   119             * @since S60 v3.2
       
   120             * @param aId TransactionID of the Download to be Resumed
       
   121             */            
       
   122             TInt ResumeDownload(TInt aId);
       
   123             /**
       
   124             * Queries the MimeType of the File from the DownloadMgr
       
   125             * @since S60 v3.2
       
   126             * @param aId TransactionID of the Download to be queried
       
   127             * @param aMimeType MimeType returned from the Browser.           
       
   128             */            
       
   129             TInt GetMimeType(TInt aId, TDes8& aMimeType);
       
   130             /**
       
   131             * Tells the Browser if the Download is being Progressively Played
       
   132             * @since S60 v3.2
       
   133             * @param aId TransactionID of the Dowload to be Resumed
       
   134             * @param aMode Whether the Mode is True or False.            
       
   135             */            
       
   136             TInt SetProgressiveMode(TInt aId, TBool aMode);
       
   137             /**
       
   138             * Before Calling Move we need to Call this to set the Local FileName
       
   139             * @since S60 v3.2
       
   140             * @param aId TransactionID of the Dowload for setting the FileName
       
   141             * @param aFileName Name to be Set
       
   142             */            
       
   143             TInt SetLocalFileName( TInt aId, TDesC& aFileName );
       
   144             /**
       
   145             * Gets the Local FileName from the DownloadMgr
       
   146             * @since S60 v3.2
       
   147             * @param aId TransactionID of the Dowload to be Resumed
       
   148             * @param aFileName Gets the FileName from the DownloadMgr
       
   149             */            
       
   150             TInt GetLocalFileName(TInt aId, TDes& aFileName );
       
   151             // From MhttpDownloadMgrObserver
       
   152             /**
       
   153             * From MhttpDownloadMgrObserver.
       
   154             * Callback from the DownloadManager notifying Client Events.
       
   155             * @since S60 v3.2
       
   156             * @param aDownload Download for which the Event is meant             
       
   157             * @param aEvent Actual Event             
       
   158             */            
       
   159             void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
       
   160             // MhttpDownloadMgrObserver Ends
       
   161 
       
   162         private:
       
   163             // The Observer where we need to forward the Browser events
       
   164             MDownloadGatewayObserver* iObserver;
       
   165             // Download Manager instance to which we connect
       
   166             RHttpDownloadMgrApiExt  iDownloadMgr;
       
   167             // Download for which we connect
       
   168             RHttpDownload* iDownload;
       
   169             // Status if we are connected
       
   170             TBool iDMgrConnected;
       
   171             // Previous DLMgr Event
       
   172             THttpDownloadEvent iPrevEvent;
       
   173             // Current Download ID
       
   174             TInt iDownloadId;
       
   175             // Current Download Status
       
   176             MProgDLSource::TDownloadStatus iDownloadStatus;
       
   177         };
       
   178     } // namespace multimedia
       
   179 
       
   180 #endif // DOWNLOADGATEWAY_H
       
   181 
       
   182 // End of file