ncdengine/provider/client/inc/ncddownloadoperationproxy.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCDDOWNLOADOPERATIONPROXY_H	
       
    20 #define C_NCDDOWNLOADOPERATIONPROXY_H
       
    21 
       
    22 #include "ncdoperationimpl.h"
       
    23 #include "ncdbaseoperationproxy.h"
       
    24 #include "ncddownloadoperation.h"
       
    25 #include "ncdoperationdatatypes.h"
       
    26 
       
    27 class MNcdDownloadOperationObserver;
       
    28 class CNcdNodeProxy;
       
    29 
       
    30 class CNcdDownloadOperationProxy : 
       
    31     public CNcdOperation< MNcdDownloadOperation >
       
    32     {
       
    33 public:
       
    34 
       
    35     /**
       
    36      * Constructor
       
    37      *
       
    38      * @param aSession is the session that is used between
       
    39      *                 the proxy and the server.
       
    40      * @param aDownloadType Download type
       
    41      * @param aHandle is the handle that identifies the serverside
       
    42      *                object that this proxy uses.
       
    43      * @param aRemoveHandler An observer that is called during destruction.
       
    44      * @param aNode The node this operation was started from.
       
    45      */    
       
    46     static CNcdDownloadOperationProxy* NewL( MCatalogsClientServer& aSession,
       
    47                         TNcdDownloadDataType aDownloadType,
       
    48                         TInt aHandle,
       
    49                         MNcdOperationProxyRemoveHandler* aRemoveHandler,
       
    50                         CNcdNodeProxy* aNode, 
       
    51                         MNcdDownloadOperationObserver* aObserver,
       
    52                         CNcdNodeManagerProxy* aNodeManager,
       
    53                         TInt aDownloadIndex = 0,
       
    54                         TBool aIsRunning = EFalse );
       
    55     /**
       
    56      * Constructor
       
    57      *
       
    58      * @param aSession is the session that is used between
       
    59      *                 the proxy and the server.
       
    60      * @param aDownloadType Download type
       
    61      * @param aHandle is the handle that identifies the serverside
       
    62      *                object that this proxy uses.
       
    63      * @param aRemoveHandler An observer that is called during destruction.
       
    64      * @param aNode The node this operation was started from.
       
    65      */
       
    66     static CNcdDownloadOperationProxy* NewLC(  MCatalogsClientServer& aSession,
       
    67                         TNcdDownloadDataType aDownloadType,
       
    68                         TInt aHandle,
       
    69                         MNcdOperationProxyRemoveHandler* aRemoveHandler,
       
    70                         CNcdNodeProxy* aNode,
       
    71                         MNcdDownloadOperationObserver* aObserver,
       
    72                         CNcdNodeManagerProxy* aNodeManager,
       
    73                         TInt aDownloadIndex = 0,
       
    74                         TBool aIsRunning = EFalse );
       
    75 
       
    76 
       
    77         
       
    78 public: // From MNcdDownloadOperation
       
    79     
       
    80     /**
       
    81      * @see MNcdDownloadOperation::FileCount()
       
    82      */
       
    83     TInt FileCount();
       
    84     
       
    85     /**
       
    86      * @see MNcdDownloadOperation::CurrentFile()
       
    87      */
       
    88     TInt CurrentFile();    
       
    89 
       
    90     /**
       
    91      * @see MNcdDownloadOperation::PauseL()
       
    92      */
       
    93     void PauseL();
       
    94 
       
    95 
       
    96     /**
       
    97      * @see MNcdDownloadOperation::ResumeL()
       
    98      */
       
    99     void ResumeL();
       
   100 
       
   101 
       
   102     /**
       
   103      * @see MNcdDownloadOperation::IsPaused()
       
   104      */
       
   105     TBool IsPaused();
       
   106 
       
   107 
       
   108     /**
       
   109      * @see MNcdDownloadOperation::IsPausableL()
       
   110      */
       
   111     TBool IsPausableL();
       
   112   
       
   113   
       
   114     /**
       
   115      * @see MNcdDownloadOperation::AddObserverL()
       
   116      */
       
   117     void AddObserverL( MNcdDownloadOperationObserver& aObserver );
       
   118 
       
   119     /**
       
   120      * @see MNcdDownloadOperation::RemoveObserver()
       
   121      */
       
   122     TBool RemoveObserver( MNcdDownloadOperationObserver& aObserver );
       
   123 
       
   124 
       
   125     /**
       
   126      * @see MNcdDownloadOperation::DownloadDataType()
       
   127      */
       
   128     TNcdDownloadDataType DownloadDataType() const;
       
   129 
       
   130 
       
   131 public: // From MNcdOperation
       
   132 
       
   133     /**
       
   134      * @see MNcdOperation::OperationType()
       
   135      */
       
   136     TNcdInterfaceId OperationType() const;
       
   137 
       
   138     
       
   139 protected: // Constructor and destructor
       
   140 
       
   141     /**
       
   142      * Constructor
       
   143      *
       
   144      */
       
   145     CNcdDownloadOperationProxy( TNcdDownloadDataType aDownloadType,
       
   146         TInt aDownloadIndex );
       
   147     
       
   148     virtual ~CNcdDownloadOperationProxy();
       
   149 
       
   150 
       
   151     /**
       
   152      * ConstructL
       
   153      *
       
   154      * @param aSession is the session that is used between
       
   155      *                 the proxy and the server.
       
   156      * @param aHandle is the handle that identifies the serverside
       
   157      *                object that this proxy uses.
       
   158      * @param aRemoveHandler An observer that is called during destruction.
       
   159      * @param aNode The node this operation was started from.
       
   160      */
       
   161     void ConstructL( MCatalogsClientServer& aSession,
       
   162                     TInt aHandle,
       
   163                     MNcdOperationProxyRemoveHandler* aRemoveHandler,
       
   164                     CNcdNodeProxy* aNode,
       
   165                     MNcdDownloadOperationObserver* aObserver,
       
   166                     CNcdNodeManagerProxy* aNodeManager,
       
   167                     TBool aIsRunning );
       
   168     
       
   169     
       
   170 protected: // From CNcdBaseOperationProxy
       
   171 
       
   172     /**
       
   173      * @see CNcdBaseOperationProxy::ProgressCallback()
       
   174      */
       
   175     void ProgressCallback();
       
   176     
       
   177     
       
   178     /**
       
   179      * @see CNcdBaseOperationProxy::QueryReceivedCallback()
       
   180      */
       
   181     void QueryReceivedCallback( CNcdQuery* aQuery );
       
   182     
       
   183     
       
   184     /**
       
   185      * @see CNcdBaseOperationProxy::CompleteCallback()
       
   186      */
       
   187     void CompleteCallback( TInt aError );
       
   188     
       
   189 
       
   190     /**
       
   191      * @see CNcdBaseOperationProxy::CreateInitializationBufferL()
       
   192      */    
       
   193     HBufC8* CreateInitializationBufferL();
       
   194     
       
   195     
       
   196     /**
       
   197      * @see CNcdBaseOperationProxy::InitializationCallback()    
       
   198      */
       
   199     void InitializationCallback( RReadStream& aReadStream, 
       
   200         TInt aDataLength );    
       
   201 
       
   202 protected: // CActive
       
   203 
       
   204     /**
       
   205      * @see CActive::DoCancel
       
   206      */    
       
   207     void DoCancel();
       
   208     
       
   209     
       
   210 private: // data
       
   211 
       
   212     /**
       
   213      * Operation observer, for callbacks.
       
   214      * Observer not own.
       
   215      */    
       
   216     RPointerArray<MNcdDownloadOperationObserver> iObservers;
       
   217     
       
   218     TNcdDownloadDataType iDownloadType;
       
   219     
       
   220     // Total number of files      
       
   221     TInt iFileCount;
       
   222     
       
   223     // Number of the currently downloaded file
       
   224     TInt iCurrentFile;
       
   225 
       
   226     
       
   227     // Pause-state of the download
       
   228     TBool iIsPaused;
       
   229     
       
   230     };
       
   231 
       
   232 #endif // C_NCDDOWNLOADOPERATIONPROXY_H