upnpavcontroller/upnpavcontrollerclient/inc/upnpfiledownloadsessionimpl.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     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:      File tranfer session implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef C_UPNPFILEDOWNLOADSESSIONIMPL_H
       
    24 #define C_UPNPFILEDOWNLOADSESSIONIMPL_H
       
    25 
       
    26 // EXTERNAL INCLUDES
       
    27 #include <e32base.h>
       
    28 
       
    29 // INTERNAL INCLUDES
       
    30 #include "upnpfiledownloadsession.h"
       
    31 #include "upnpavdeviceobserver.h"
       
    32 #include "tupnpfiletransferevent.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class RUPnPAVControllerClient;
       
    36 class CUpnpAVDevice;
       
    37 class MUPnPFileTransferSessionObserver;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 /**
       
    41  *  AV Controller file download session clint-side implementation.
       
    42  *
       
    43  *  @lib upnpavcontrollerclient.lib
       
    44  *  @since S60 v3.2
       
    45  */
       
    46 NONSHARABLE_CLASS( CUPnPFileDownloadSessionImpl ) :
       
    47                                         public CActive, 
       
    48                                         public MUPnPFileDownloadSession,
       
    49                                         public MUPnPAVDeviceObserver
       
    50     {
       
    51 public:
       
    52 
       
    53     /**
       
    54      * 1st phase construct
       
    55      *
       
    56      * @param aServer a handle to AV Controller server
       
    57      * @param aDevice target device
       
    58      * @return new instance
       
    59      */
       
    60     static CUPnPFileDownloadSessionImpl* NewL(
       
    61         RUPnPAVControllerClient& aServer, const CUpnpAVDevice& aDevice );
       
    62 
       
    63     /**
       
    64      * Destructor
       
    65      */
       
    66     ~CUPnPFileDownloadSessionImpl();
       
    67 
       
    68 private:
       
    69 
       
    70     /**
       
    71      * Private constructor
       
    72      *
       
    73      * @param aServer a handle to AV Controller server
       
    74      */
       
    75     CUPnPFileDownloadSessionImpl( RUPnPAVControllerClient& aServer );
       
    76 
       
    77     /**
       
    78      * 2nd phase constructor
       
    79      */
       
    80     void ConstructL();
       
    81 
       
    82 private: // From CActive
       
    83 
       
    84     /**
       
    85      * See e32base.h
       
    86      */        
       
    87     void RunL();
       
    88     
       
    89     /**
       
    90      * See e32base.h
       
    91      */        
       
    92     void DoCancel();
       
    93     
       
    94     /**
       
    95      * See e32base.h
       
    96      */        
       
    97     TInt RunError( TInt aError );         
       
    98 
       
    99 public: // From MUPnPFileUploadSession
       
   100 
       
   101     /**
       
   102      * See upnpfiledownloadsession.h
       
   103      */
       
   104     void StartDownloadL( const CUpnpItem& aItem, TInt aKey );
       
   105 
       
   106     /**
       
   107      * See upnpfiledownloadsession.h
       
   108      */
       
   109     void StartDownloadL( const CUpnpElement& aResElement,
       
   110         const CUpnpItem& aItem, RFile& aFile, TInt aKey );
       
   111 
       
   112 public: // From MUPnPFileTransferSession
       
   113 
       
   114     /**
       
   115      * See upnpfiletransfersession.h
       
   116      */
       
   117     void SetObserver( MUPnPFileTransferSessionObserver& aObserver );
       
   118 
       
   119     /**
       
   120      * See upnpfiletransfersession.h
       
   121      */
       
   122     void RemoveObserver();
       
   123     
       
   124     /**
       
   125      * See upnpfiletransfersession.h
       
   126      */
       
   127     MUPnPFileTransferSessionObserver* Observer() const;   
       
   128 
       
   129     /**
       
   130      * See upnpfiletransfersession.h
       
   131      */
       
   132     void StartTrackingProgressL( TInt aKey );
       
   133     
       
   134     /**
       
   135      * See upnpfiletransfersession.h
       
   136      */
       
   137     void CancelTransfer( TInt aKey );
       
   138     
       
   139     /**
       
   140      * See upnpfiletransfersession.h
       
   141      */
       
   142     void CancelAllTransfers();
       
   143 
       
   144 public: // From MUPnPAVDeviceObserver
       
   145 
       
   146     /**
       
   147      * See upnpavdeviceobserver.h
       
   148      */
       
   149     void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
       
   150 
       
   151     /**
       
   152      * See upnpavdeviceobserver.h
       
   153      */
       
   154     void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
       
   155 
       
   156     /**
       
   157      * See upnpavdeviceobserver.h
       
   158      */
       
   159     void WLANConnectionLost();
       
   160     
       
   161 public: // New methods
       
   162 
       
   163     /**
       
   164      * Returns device
       
   165      *
       
   166      * @return device
       
   167      */        
       
   168     const CUpnpAVDevice& Device() const;
       
   169 
       
   170 private:
       
   171 
       
   172     /**
       
   173      * Reset
       
   174      */        
       
   175     void ResetL();
       
   176 
       
   177 private:
       
   178 
       
   179     /**
       
   180      * Filetransfer session observer
       
   181      *
       
   182      * Not owned
       
   183      */        
       
   184     MUPnPFileTransferSessionObserver*   iObserver;
       
   185     
       
   186     /**
       
   187      * AV Controller client handle
       
   188      */        
       
   189     RUPnPAVControllerClient&            iServer;
       
   190     
       
   191     /**
       
   192      * Target device
       
   193      *
       
   194      * Owned
       
   195      */        
       
   196     CUpnpAVDevice*                      iDevice;
       
   197     
       
   198     /**
       
   199      * Buffer to pass data to the server process
       
   200      *
       
   201      * Owned
       
   202      */        
       
   203     HBufC8*                             iBuffer;
       
   204     
       
   205     /**
       
   206      * Modifiable pointer to the data buffer
       
   207      */        
       
   208     TPtr8                               iBufferPtr;
       
   209 
       
   210     /**
       
   211      * Buffer to pass data to the server process
       
   212      *
       
   213      * Owned
       
   214      */        
       
   215     HBufC*                              iBuffer2;
       
   216     
       
   217     /**
       
   218      * Modifiable pointer to the data buffer
       
   219      */        
       
   220     TPtr                                iBufferPtr2;
       
   221     
       
   222     /**
       
   223      * Flag to store the state of WLAN
       
   224      */        
       
   225     TBool                               iAlive;
       
   226 
       
   227     /**
       
   228      * Filetransfer event. Used to receive events from the server process
       
   229      */        
       
   230     TUpnpFileTransferEvent              iEvent;           
       
   231     
       
   232     /**
       
   233      * Package buffer used in client-server comms
       
   234      */        
       
   235     TPckg<TUpnpFileTransferEvent>       iEventPkg;
       
   236     
       
   237     };
       
   238 
       
   239 #endif // C_UPNPFILEDOWNLOADSESSIONIMPL_H
       
   240 
       
   241 // End of file
       
   242