filemanager/src/fmbkupengine/inc/CMMCScBkupTransferRequest.h
branchRCL_3
changeset 20 491b3ed49290
equal deleted inserted replaced
19:95243422089a 20:491b3ed49290
       
     1 /*
       
     2 * Copyright (c) 2005 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: Declaration for CMMCScBkupTransferRequestBase 
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __CMMCSCBKUPTRANSFERREQUEST_H__
       
    20 #define __CMMCSCBKUPTRANSFERREQUEST_H__
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>
       
    24 #include <connect/sbeclient.h>
       
    25 
       
    26 // User includes
       
    27 #include "TMMCScBkupDriveFilter.h"
       
    28 #include "TMMCScBkupOwnerDataType.h"
       
    29 #include "TMMCScBkupArchiveVector.h"
       
    30 
       
    31 // Namespaces
       
    32 using namespace conn;
       
    33 
       
    34 // Classes referenced
       
    35 class CMMCScBkupDataOwnerInfo;
       
    36 class MMMCScBkupDriver;
       
    37 class TMMCScBkupArchiveVector;
       
    38 
       
    39 
       
    40 /**
       
    41 *
       
    42 *
       
    43 * @since 3.0
       
    44 */
       
    45 NONSHARABLE_CLASS(CMMCScBkupTransferRequestBase) : public CActive
       
    46     {
       
    47     public:
       
    48 
       
    49         /**
       
    50         * C++ destructor
       
    51         */
       
    52         ~CMMCScBkupTransferRequestBase();
       
    53     
       
    54     protected:
       
    55 
       
    56         /**
       
    57         * C++ default constructor
       
    58         */
       
    59         CMMCScBkupTransferRequestBase( MMMCScBkupDriver& aDriver, TMMCScBkupOwnerDataType aElementType, TBool aUpdateOperationalSizes = ETrue, TInt aPriority = CActive::EPriorityIdle );
       
    60 
       
    61     public: // API
       
    62 
       
    63         /**
       
    64         *
       
    65         */
       
    66         virtual void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver );
       
    67 
       
    68     protected: // From CActive
       
    69         void RunL();
       
    70         void DoCancel();
       
    71         TInt RunError( TInt aError );
       
    72 
       
    73     protected: // State relation
       
    74 
       
    75         /**
       
    76         *
       
    77         */
       
    78         enum TState
       
    79             {
       
    80             EIdle = 0,
       
    81             EFinished,
       
    82             //
       
    83             ETransferData,
       
    84             EProcessData
       
    85             };
       
    86 
       
    87         /**
       
    88         *
       
    89         */
       
    90         inline TState State() const { return iState; }
       
    91 
       
    92         /**
       
    93         *
       
    94         */
       
    95         inline void SetState( TState aState ) { iState = aState; }
       
    96 
       
    97     protected: // Internal framework API
       
    98 
       
    99         /**
       
   100         *
       
   101         */
       
   102         virtual TBool ProcessChunkOfDataL() = 0;
       
   103 
       
   104         /**
       
   105         *
       
   106         */
       
   107         virtual void PrepareDataTransferL() = 0;
       
   108 
       
   109         /**
       
   110         *
       
   111         */
       
   112         virtual TDriveNumber CurrentDrive() const = 0;
       
   113         
       
   114         /**
       
   115         *
       
   116         */
       
   117         virtual void SingleDriveTransferCompleteL();
       
   118 
       
   119         /**
       
   120         *
       
   121         */
       
   122         virtual void TransferCompleteL();
       
   123 
       
   124     protected: // Internal methods
       
   125 
       
   126         /**
       
   127         *
       
   128         */
       
   129         void CompleteSelf( TInt aCompletionCode = KErrNone );
       
   130 
       
   131         /**
       
   132         *
       
   133         */
       
   134         inline MMMCScBkupDriver& Driver() { return iDriver; }
       
   135 
       
   136         /**
       
   137         *
       
   138         */
       
   139         inline CMMCScBkupDataOwnerInfo& DataOwner() { return *iDataOwner; }
       
   140 
       
   141         /**
       
   142         *
       
   143         */
       
   144         inline const CMMCScBkupDataOwnerInfo& DataOwner() const { return *iDataOwner; }
       
   145 
       
   146         /**
       
   147         *
       
   148         */
       
   149         inline TMMCScBkupArchiveVector& Info() { return iCurrentInfo; }
       
   150 
       
   151         /**
       
   152         *
       
   153         */
       
   154         inline const TMMCScBkupArchiveVector& Info() const { return iCurrentInfo; }
       
   155         
       
   156         /**
       
   157         *
       
   158         */
       
   159         inline TMMCScBkupOwnerDataType ElementType() const { return iElementType; }
       
   160 
       
   161         /**
       
   162         *
       
   163         */
       
   164         inline void DataTransferred( TInt aAmount ) { iDataTransferred += aAmount; }
       
   165 
       
   166         /**
       
   167         *
       
   168         */
       
   169         inline TInt AmountOfDataTransferred() const { return iDataTransferred; }
       
   170         
       
   171         /**
       
   172         *
       
   173         */
       
   174         inline void ResetDataTransferCounter() { iDataTransferred = 0; }
       
   175 
       
   176     private: // Internal methods
       
   177 
       
   178         /**
       
   179         *
       
   180         */
       
   181         void SetObserver( TRequestStatus& aObserver );
       
   182 
       
   183         /**
       
   184         *
       
   185         */
       
   186         void CompleteObserverRequest( TInt aCompletionCode );
       
   187 
       
   188     private: // Internal state methods
       
   189 
       
   190         /**
       
   191         *
       
   192         */
       
   193         void ProcessDataChunkL();
       
   194 
       
   195     private: // Member data
       
   196 
       
   197         // Owned externally
       
   198         //
       
   199         MMMCScBkupDriver& iDriver;
       
   200         //
       
   201         CMMCScBkupDataOwnerInfo* iDataOwner;
       
   202         //
       
   203         TRequestStatus* iObserver;
       
   204 
       
   205         // Owned by this class
       
   206         //
       
   207         TInt iDataTransferred;
       
   208         //
       
   209         TState iState;
       
   210         //
       
   211         TMMCScBkupArchiveVector iCurrentInfo;
       
   212         //
       
   213         const TMMCScBkupOwnerDataType iElementType;
       
   214         //
       
   215         const TBool iUpdateOperationalSizes;
       
   216     };
       
   217 
       
   218 
       
   219 
       
   220 
       
   221 
       
   222 
       
   223 #endif // __CMMCSCBKUPTRANSFERREQUEST_H__
       
   224 
       
   225 //End of File