upnpmediaserver/contentdirectoryservice/inc/upnptransferbase.h
author Sampo Huttunen <sampo.huttunen@nokia.com>
Wed, 24 Nov 2010 09:39:46 +0200
branchIOP_Improvements
changeset 45 a6c41ca11adf
parent 0 7f85d04be362
permissions -rw-r--r--
Updated the SIS package, there was some BC issue with the earlier version. Also updated the platform UID to S^3 version.

/** @file
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies  this distribution, and is available 
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  class for sending/receiving HTTP request/response 
*                using Symbian HTTP client 
*
*/


#ifndef C_CUPNPTRANSFERBASE_H
#define C_CUPNPTRANSFERBASE_H

// INCLUDES
#include <e32base.h>
#include "httptransferobserver.h"
#include "upnptransferobserver.h"

// FORWARD DECLARATIONS
class CUpnpContentDirectory;
class CHttpTransferBase;
class MUpnpTransferObserver;

const TInt KDefaultAccessPoint = 11;
const TInt KDefaultBuffer = 64000;
const TInt KNumOfConcurrentTransactions = 2;

class CUpnpTransferBase: public CBase , public MHttpTransferObserver
{
public:  // Constructors and destructor
    
    /**
    * Destructor.
    */
    virtual ~CUpnpTransferBase();

// from base class  MHttpTransferObserver

   virtual void ReadyForTransferL( TAny* aKey);
     
   /**
    * Gets transfer progress callback
    *
    * @since S60 v3.2
    * @param aKey the file identifier
    * @param aBytes transferred
    * @param aTotalBytes all bytes to be transferred
    */
   virtual void TransferProgress( TAny* aKey, 
                                  TInt aBytes, 
                                  TInt aTotalBytes );
                                   
   virtual void TransferCompleted( TAny* aKey, TInt aStatus );     




public: // New functions

     /**
     * Creates new CHttpFile object and adds it to the iFileQueue
     *
     * @since S60 v3.2
     * @param aUri Uri of the downloaded object
     * @param aTargetPath Local path of the object
     * @param aKey Identifier of the object
     */
    void CreateAndQueueHttpFileL( const TDesC8& aUri, 
                                  const TDesC& aTargetPath, 
                                  TInt aKey );
    
    /**
    * Sets a header
    *
    * @since S60 v3.2
    * @param aKey the file identifier
    * @param aFieldName The field name, e.g. 'Content-Type'
    * @param aFieldValue The field value. e.g. 'text/plain'
    */
    void SetHeaderL( TInt aKey,
                     const TDesC8& aFieldName, 
                     const TDesC8& aFieldValue );
    
    /**
    * Turns on/off transfer progress callbacks
    *
    * @since S60 v3.2
    * @param aKey the file identifier
    * @param aSwitchOn tuning on/off    
    */
    void TrackProgess(TInt aKey, TBool aSwitchOn);   
          

    /**
    * cancels transfer
    *
    * @since S60 v3.2
    * @param aKey the file identifier   
    */         
    virtual void CancelTransfer( TInt aKey);     
  
 protected: 
    /**
    * C++ default constructor.
    */
    CUpnpTransferBase( MUpnpTransferObserver* aCd );
    
    // new functions
    TInt MapStatus( TInt aErrorCode );
    
 protected:    // Data
    MUpnpTransferObserver* iObserver;
    CHttpTransferBase* iHttpTransferBase;
    
    
};

#endif // C_CUPNPTRANFERBASE_H