PECengine/PresenceManager2/SrcCommon/CPEngAsyncOperation.h
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Asynchronous operation base class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPENGASYNCOPERATION_H
       
    19 #define CPENGASYNCOPERATION_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include "RPEngManagerClient.h"
       
    23 #include "RPEngTransferClient.h"
       
    24 #include "PEngPresenceManagerDefs.h"
       
    25 
       
    26 #include <E32Base.h>
       
    27 
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MPEngAdvTransactionStatus2;
       
    32 class MPEngAsyncOperationOwner;
       
    33 class CPEngTransactionStatus;
       
    34 class CPEngNWSessionSlotStorageProxy;
       
    35 
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  * Asynchronous operation base class.
       
    41  *
       
    42  * Provides:
       
    43  * - adding to scheduler
       
    44  * - protection against nested canceling
       
    45  * - operation owning services
       
    46  *
       
    47  *  @lib
       
    48  *  @since 3.0
       
    49  */
       
    50 NONSHARABLE_CLASS( CPEngAsyncOperation ): public CActive
       
    51     {
       
    52 public:  // destructor
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     virtual ~CPEngAsyncOperation();
       
    58 
       
    59 protected: //Constructor
       
    60 
       
    61     /**
       
    62      * Constructor.
       
    63      */
       
    64     CPEngAsyncOperation( TInt aPriority,
       
    65                          RPEngManagerClient& aServer );
       
    66 
       
    67 
       
    68     /**
       
    69      * Symbian OS base class constructor.
       
    70      */
       
    71     void BaseConstructL( CPEngNWSessionSlotStorageProxy& aUsedSlot );
       
    72 
       
    73 
       
    74 public:  // New external services
       
    75 
       
    76 
       
    77     /**
       
    78      * Sets the operation owner.
       
    79      * Owner can be set just once.
       
    80      */
       
    81     void SetOwner( MPEngAsyncOperationOwner& aOperationOwner );
       
    82 
       
    83     /**
       
    84      * Cancels the operation and deletes it
       
    85      */
       
    86     void CancelOpD();
       
    87 
       
    88 
       
    89 
       
    90 protected:  // Services for derived implementations
       
    91 
       
    92     /**
       
    93      *
       
    94      */
       
    95     void InitTransaction( HBufC16* aTransactionData,
       
    96                           TInt aTransactionOperation );
       
    97 
       
    98     /**
       
    99      *
       
   100      */
       
   101     void IssueTransaction();
       
   102 
       
   103     /**
       
   104      * Completes the operation with given error.
       
   105      */
       
   106     void CompleteWithError( TInt aErr );
       
   107 
       
   108 
       
   109 
       
   110 protected:  // Template methods for derived implementations
       
   111 
       
   112     /**
       
   113      * Notifies derived implementation from
       
   114      * operation step complete or failure with error.
       
   115      */
       
   116     virtual void DoHandleOpSuccessL( MPEngAdvTransactionStatus2& aStatus,
       
   117                                      TInt aTransactionOperation ) = 0;
       
   118 
       
   119     virtual void DoHandleOpFailure( MPEngAdvTransactionStatus2& aStatus,
       
   120                                     TInt aTransactionOperation ) = 0;
       
   121 
       
   122     virtual TPEngAsyncOpResult DoNotifyObserver( MPEngAdvTransactionStatus2& aStatus,
       
   123                                                  TInt aTransactionOperation ) = 0;
       
   124 
       
   125 
       
   126 
       
   127 
       
   128 private: //From CActive
       
   129 
       
   130     void DoCancel();
       
   131     void RunL();
       
   132     TInt RunError( TInt aError );
       
   133 
       
   134 
       
   135 
       
   136 protected:  // Data
       
   137 
       
   138     //REF: Operation owner
       
   139     MPEngAsyncOperationOwner*   iOperationOwner;
       
   140 
       
   141     //OWN: Is cancel call running?
       
   142     TBool   iCancelling;
       
   143 
       
   144 
       
   145 
       
   146     //OWN: Transaction operation identifier
       
   147     TInt    iTransactionOperation;
       
   148 
       
   149     //OWN: Transaction data
       
   150     HBufC16*     iTransactionData;
       
   151 
       
   152 
       
   153 
       
   154     //OWN: Transaction status container for result
       
   155     CPEngTransactionStatus*     iTransactionStatus;
       
   156 
       
   157     //REF:
       
   158     RPEngManagerClient&     iTransactionServer;
       
   159 
       
   160     //OWN:
       
   161     RPEngTransferClient     iTransactionClient;
       
   162 
       
   163     };
       
   164 
       
   165 #endif  //CPENGASYNCOPERATION_H
       
   166