PECengine/ListLibrary2/ContactListSrc/CPEngContactListMngTransBase.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     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:  Base class of the contact list management handlers
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CPENGCONTACTLISTMNGTRANSBASE_H__
       
    19 #define __CPENGCONTACTLISTMNGTRANSBASE_H__
       
    20 
       
    21 
       
    22 //  INCLUDES
       
    23 #include "MPEngOutgoingTransactionHandler.h"
       
    24 #include "CPEngContactListModBase.h"
       
    25 #include "PEngWVCspVersion.h"
       
    26 #include <e32base.h>
       
    27 #include <badesca.h>
       
    28 
       
    29 
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class   CPEngTransactionStatus;
       
    33 class   CPEngContactListModBase;
       
    34 class   MPEngXMLSerializer;
       
    35 class   CPEngSessionSlotId;
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /**
       
    40  * Base class of the contact list management handlers.
       
    41  *
       
    42  * @lib PEngListLib2
       
    43  * @since 3.0
       
    44  */
       
    45 NONSHARABLE_CLASS( CPEngContactListMngTransBase ):
       
    46         public CBase,
       
    47         public MPEngOutgoingTransactionHandler
       
    48     {
       
    49 protected:  // enumerations
       
    50 
       
    51     // Transaction handler states
       
    52     enum TPEngCntListMngTransState
       
    53         {
       
    54         EPEngListContentUpdate = 1,
       
    55         EPEngSubscriptionUpdate,
       
    56         EPEngRollBack,
       
    57         EPEngActivateAttributes,
       
    58         EPEngDeActivateAttributes,
       
    59         EPEngTransactionCompleted,
       
    60         };
       
    61 
       
    62 public:
       
    63 
       
    64     /**
       
    65      * Destructor.
       
    66      */
       
    67     virtual ~CPEngContactListMngTransBase();
       
    68 
       
    69 
       
    70 
       
    71 protected: // Constructors
       
    72 
       
    73     /**
       
    74      * C++ constructor.
       
    75      */
       
    76     CPEngContactListMngTransBase( CPEngContactListModBase& aContactList,
       
    77                                   CPEngSessionSlotId& aSessionSlot,
       
    78                                   TPEngWVCspVersion& aCSPVersion,
       
    79                                   TInt aOperationId );
       
    80 
       
    81     /**
       
    82      * Symbian OS constructor
       
    83      */
       
    84     void ConstructL();
       
    85 
       
    86 
       
    87 
       
    88 public: // From MPEngOutgoingTransactionHandler
       
    89 
       
    90     /**
       
    91      * Synchronous method, get Outgoing transaction request
       
    92      * @see <MPEngOutgoingTransactionHandler.h>
       
    93      */
       
    94     void RequestL( TDes8& aSendBuffer );
       
    95 
       
    96 
       
    97     /**
       
    98      * Signals to the transaction handler thst it is last
       
    99      * @see <MPEngOutgoingTransactionHandler.h>
       
   100      */
       
   101     void LastRunningTransactionHandler();
       
   102 
       
   103 
       
   104     /**
       
   105      * Process the response to the request.
       
   106      * @see <MPEngOutgoingTransactionHandler.h>
       
   107      */
       
   108     void ProcessResponseL( const TDesC8& aResponse,
       
   109                            TRequestStatus& aStatus );
       
   110 
       
   111     /**
       
   112      * Cancels asynchronous processing of the request
       
   113      * @see <MPEngOutgoingTransactionHandler.h>
       
   114      */
       
   115     void CancelProcessing( );
       
   116 
       
   117 
       
   118     /**
       
   119      * Support for simultaneous transaction handling
       
   120      * @see <MPEngOutgoingTransactionHandler.h>
       
   121      */
       
   122     void NewTransactionHandlersL(
       
   123         RPointerArray<MPEngOutgoingTransactionHandler>& aHandlers );
       
   124 
       
   125     /**
       
   126      * Function to signal completing of the transaction
       
   127      * @see <MPEngOutgoingTransactionHandler.h>
       
   128      */
       
   129     TBool TransactionCompleted( );
       
   130 
       
   131 
       
   132     /**
       
   133      * Gets transaction status result class
       
   134      * @see <MPEngOutgoingTransactionHandler.h>
       
   135      * @since 3.0
       
   136      */
       
   137     CPEngTransactionStatus* TransactionResult( );
       
   138 
       
   139 
       
   140     /**
       
   141      * Releases the handler
       
   142      * @see <MPEngOutgoingTransactionHandler.h>
       
   143      */
       
   144     void ReleaseHandler( );
       
   145 
       
   146 
       
   147 
       
   148 public: // Template functions for derived classes
       
   149 
       
   150     /**
       
   151      * Template function to append nick list XML message.
       
   152      *
       
   153      * @since 3.0
       
   154      * @param aXmlSerializer XML message serializer
       
   155      */
       
   156     virtual void DoAppendListNickUpdateL(
       
   157         MPEngXMLSerializer& aXmlSerializer ) = 0;
       
   158 
       
   159     /**
       
   160      * Template function to append subscription update XML message.
       
   161      *
       
   162      * @since 3.0
       
   163      * @param aXmlSerializer XML message serializer
       
   164      */
       
   165     virtual void DoGetXMLSubscriptionUpdateL(
       
   166         MPEngXMLSerializer& aXmlSerializer ) = 0;
       
   167 
       
   168     /**
       
   169      * Template function to parse subscription update response.
       
   170      *
       
   171      * @since 3.0
       
   172      * @param aResponse request response
       
   173      */
       
   174     virtual void DoParseSubscriptionUpdateResponseL(
       
   175         const TDesC8& aResponse ) = 0;
       
   176 
       
   177     /**
       
   178      * Template function to update transaction state
       
   179      *
       
   180      * Function should update state of the transaction so that
       
   181      * it continues for another step of the request
       
   182      *
       
   183      * @since 3.0
       
   184      */
       
   185     virtual void DoUpdateTransactionState() = 0;
       
   186 
       
   187 
       
   188     /**
       
   189      * Template function to fill nick list of the update type.
       
   190      *
       
   191      * Derived function should fills in the given array with
       
   192      * contacts which should be updated by the handler.
       
   193      *
       
   194      * @since 3.0
       
   195      * @param nick list to be filled
       
   196      */
       
   197     virtual void DoFillNickListLC(
       
   198         RPointerArray<CPEngContactListModItemContainer>& aNickList ) = 0;
       
   199 
       
   200 
       
   201     /**
       
   202      * Template function to complete contact list update.
       
   203      *
       
   204      * Derived class should do what ever cleaning required
       
   205      * to complet request.
       
   206      *
       
   207      * @since 3.0
       
   208      */
       
   209     virtual void DoCompleteContactListUpdateL() = 0;
       
   210 
       
   211 
       
   212 
       
   213 private: ///New functions
       
   214 
       
   215     /**
       
   216      * Create XML message to update contact list content
       
   217      * @since 3.0
       
   218      * @param aXmlSerializer XML message serializer
       
   219      */
       
   220     void GetXMLContactListUpdateL( MPEngXMLSerializer& aXmlSerializer );
       
   221 
       
   222 
       
   223     /**
       
   224      * Create XML message to roll back not existing WV IDs
       
   225      * @since 3.0
       
   226      * @param aSendBuffer XML message serializer
       
   227      */
       
   228     void GetXMLRollBackUpdateL( MPEngXMLSerializer& aXmlSerializer );
       
   229 
       
   230     /**
       
   231      * Parse XML list update response
       
   232      * @since 3.0
       
   233      * @param aResponse Response buffer
       
   234      */
       
   235     void ParseListUpdateResponseL( const TDesC8& aResponse );
       
   236 
       
   237 
       
   238 
       
   239 protected:  // Data
       
   240 
       
   241     /// OWN:Contact list model
       
   242     CPEngContactListModBase&            iContactList;
       
   243 
       
   244     /// REF: Session slot
       
   245     CPEngSessionSlotId&                 iSessionSlotId;
       
   246 
       
   247     // OWN: Transaction status
       
   248     CPEngTransactionStatus*             iTransactionStatus;
       
   249 
       
   250     // OWN: State of the presence contact list update
       
   251     TPEngCntListMngTransState           iUpdateState;
       
   252 
       
   253     // OWN: Arry for rollback
       
   254     CDesCArrayFlat*                     iRollBackIDsArray;
       
   255 
       
   256     /// OWN: CSP version
       
   257     TPEngWVCspVersion&                  iCSPVersion;
       
   258 
       
   259     /// OWN: Operation Id
       
   260     TInt                                iOperationId;
       
   261 
       
   262     /// OWN: Count of new added contact Ids on the server
       
   263     TInt 							    iNewIdsCount;
       
   264     };
       
   265 
       
   266 #endif      //  __CPENGCONTACTLISTMNGTRANSBASE_H__
       
   267 
       
   268 //  End of File
       
   269 
       
   270