pushmtm/MtmUtilInc/PushMtmOperation.h
branchRCL_3
changeset 65 8e6fa1719340
parent 0 84ad3b177aa3
equal deleted inserted replaced
64:6385c4c93049 65:8e6fa1719340
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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 of CPushMtmOperation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef PUSHMTMOPERATION_H
       
    21 #define PUSHMTMOPERATION_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 
       
    25 #include "PushMtmProgress.h"
       
    26 #include <e32base.h>
       
    27 #include <msvapi.h>
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 * Base class for mtm operations controlling asynchronous functions on the 
       
    33 * client side.
       
    34 */
       
    35 class CPushMtmOperation : public CMsvOperation, 
       
    36                           public MMsvEntryObserver
       
    37     {
       
    38     public: // Constructors and destructor
       
    39 
       
    40         /**
       
    41         * Destructor.
       
    42         */
       
    43         IMPORT_C virtual ~CPushMtmOperation();
       
    44 
       
    45     public: // New functions
       
    46 
       
    47         /**
       
    48         * Start or restart the operation.
       
    49         * Current implementation calls Cancel and invokes RunL.
       
    50         * Derived classes may override this.
       
    51         */
       
    52         IMPORT_C virtual void StartL();
       
    53 
       
    54     public: // Functions from base classes
       
    55 
       
    56         /**
       
    57         * Get progress information.
       
    58         * @return A package buffer (of type TPushMtmProgressBuf), containing 
       
    59         *         progress information.
       
    60         */
       
    61         IMPORT_C const TDesC8& ProgressL();
       
    62 
       
    63     protected: // Constructors
       
    64 
       
    65         /**
       
    66         * Constructor. Calls CActiveScheduler::Add( this )!
       
    67         * @param aSession Message Server Session to be used by this operation.
       
    68         * @param aId Id of entry to operate on.
       
    69         * @param aObserverRequestStatus Observer's status.
       
    70         */
       
    71         IMPORT_C CPushMtmOperation( CMsvSession& aSession, 
       
    72                                     TMsvId aId, 
       
    73                                     TRequestStatus& aObserverRequestStatus );
       
    74 
       
    75     protected: // New functions
       
    76 
       
    77         /**
       
    78         * Invoke RunL. Complete request with KErrNone.
       
    79         * @return None.
       
    80         */
       
    81         IMPORT_C void InvokeRun();
       
    82 
       
    83         /**
       
    84         * Signal the observer that the asynchronous request is complete.
       
    85         * @param aCompletionCode The value for which the observer's request 
       
    86         *        status is set.
       
    87         */
       
    88         IMPORT_C void SignalObserver( TInt aCompletionCode );
       
    89 
       
    90         /**
       
    91         * Request entry event observation.
       
    92         * @return None.
       
    93         */
       
    94         IMPORT_C void ObserveEntryEventL();
       
    95 
       
    96         /**
       
    97         * Cancel the request for entry event observation.
       
    98         * @return None.
       
    99         */
       
   100         IMPORT_C void CancelObserveEntryEvent();
       
   101 
       
   102     protected: // Functions from base classes
       
   103 
       
   104         /**
       
   105         * Current implementation calls SignalObserver( KErrNone ).
       
   106         * Derived classes should override this and also should 
       
   107         * call SignalObserver.
       
   108         */
       
   109         IMPORT_C void RunL();
       
   110 
       
   111         /**
       
   112         * Cancel protocol implementation.
       
   113         */
       
   114         IMPORT_C void DoCancel();
       
   115 
       
   116         /**
       
   117         * Leave handler protocol implementation: it is called when 
       
   118         * RunL leaves. The observer is signaled if a leave occures. 
       
   119         * The leave code is not forwarded to the scheduler.
       
   120         */
       
   121         IMPORT_C TInt RunError( TInt aError );
       
   122 
       
   123         /**
       
   124         * Call-back for entry event handling. Derived classes may override it.
       
   125         */
       
   126         IMPORT_C void HandleEntryEventL( TMsvEntryEvent aEvent, 
       
   127                       TAny* aArg1, TAny* aArg2, TAny* aArg3 );
       
   128 
       
   129     protected: // Data
       
   130 
       
   131         TMsvId iEntryId; ///< Id of entry to operate on.
       
   132         CMsvEntry* iCEntry; ///< Context. Owned.
       
   133         TPushMtmProgress iProgress; ///< Progress information.
       
   134         /// 8 bit descriptor package pointing to the progress information.
       
   135         TPushMtmProgressPckg iProgressPckg;
       
   136     };
       
   137 
       
   138 #endif // PUSHMTMOPERATION_H
       
   139 
       
   140 // End of file.