PECengine/ListLibrary2/ContactListSrc/CPEngContactListTransBase.h
branchRCL_3
changeset 17 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
16:6ca72c0fe49a 17:a941bc465d9f
       
     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 for contact list create and synchronize handlers
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CPENGCONTACTLISTTRANSBASE_H__
       
    19 #define __CPENGCONTACTLISTTRANSBASE_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include "MPEngOutgoingTransactionHandler.h"
       
    23 #include "PEngWVCspVersion.h"
       
    24 #include <e32base.h>
       
    25 #include <badesca.h>
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class   CPEngTransactionStatus;
       
    30 class   MPEngXMLParser;
       
    31 class   CPEngContactListModBase;
       
    32 class   CPEngSessionSlotId;
       
    33 class   MPEngXMLSerializer;
       
    34 class   MPEngContactListTransactionManager;
       
    35 
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  * Base class for contact list create and synchronize handlers
       
    41  *
       
    42  * @lib PEngListLib2
       
    43  * @since 3.0
       
    44  */
       
    45 NONSHARABLE_CLASS( CPEngContactListTransBase ):
       
    46         public CBase,
       
    47         public MPEngOutgoingTransactionHandler
       
    48     {
       
    49 protected:  // Enumerations
       
    50 
       
    51     /**
       
    52      * Contact list synhronization state.
       
    53      */
       
    54     enum TPengCntListSyncState
       
    55         {
       
    56         EPEngCntListCreate,
       
    57         EPEngCntListFetch,
       
    58         EPEngSubscribeCntList,
       
    59         EPEngTransactionCompleted
       
    60         };
       
    61 
       
    62 
       
    63 public:
       
    64 
       
    65     /**
       
    66      * Destructor.
       
    67      */
       
    68     virtual ~CPEngContactListTransBase();
       
    69 
       
    70 
       
    71 protected: // Constructors
       
    72 
       
    73     /**
       
    74      *  C++ constructor.
       
    75      */
       
    76     CPEngContactListTransBase( CPEngContactListModBase& aContactList,
       
    77                                CPEngSessionSlotId& aSessionSlotId,
       
    78                                MPEngContactListTransactionManager& aManager,
       
    79                                TPEngWVCspVersion& aCSPVersion,
       
    80                                TInt aOperationId );
       
    81 
       
    82 
       
    83     /**
       
    84      * Symbian constructor
       
    85      */
       
    86     void ConstructL();
       
    87 
       
    88 
       
    89 public: // From MPEngOutgoingTransactionHandler
       
    90 
       
    91     /**
       
    92      * Synchronous method, get Outgoing transaction request
       
    93      * @see <MPEngOutgoingTransactionHandler.h>
       
    94      */
       
    95     void RequestL( TDes8& aSendBuffer );
       
    96 
       
    97 
       
    98     /**
       
    99      * Signals to the transaction handler that this it is last
       
   100      * @see <MPEngOutgoingTransactionHandler.h>
       
   101      */
       
   102     void LastRunningTransactionHandler();
       
   103 
       
   104 
       
   105     /**
       
   106      * Process the response to the request.
       
   107      * @see <MPEngOutgoingTransactionHandler.h>
       
   108      */
       
   109     void ProcessResponseL( const TDesC8& aResponse,
       
   110                            TRequestStatus& aStatus );
       
   111 
       
   112     /**
       
   113      * Cancels asynchronous processing of the request
       
   114      * @see <MPEngOutgoingTransactionHandler.h>
       
   115      */
       
   116     void CancelProcessing();
       
   117 
       
   118 
       
   119     /**
       
   120      * Support for simultaneous transaction handling
       
   121      * @see <MPEngOutgoingTransactionHandler.h>
       
   122      */
       
   123     void NewTransactionHandlersL(
       
   124         RPointerArray<MPEngOutgoingTransactionHandler>& aHandlers );
       
   125 
       
   126     /**
       
   127      * Function to signal completing of the transaction
       
   128      * @see <MPEngOutgoingTransactionHandler.h>
       
   129      */
       
   130     TBool TransactionCompleted( );
       
   131 
       
   132 
       
   133     /**
       
   134      * Gets transaction status result class
       
   135      * @see <MPEngOutgoingTransactionHandler.h>
       
   136      */
       
   137     CPEngTransactionStatus* TransactionResult( );
       
   138 
       
   139 
       
   140     /**
       
   141      * Releases the handler
       
   142      * @see <MPEngOutgoingTransactionHandler.h>
       
   143      */
       
   144     void ReleaseHandler();
       
   145 
       
   146 
       
   147 protected: // New functions
       
   148 
       
   149 
       
   150     /**
       
   151      * Template function to create XML message to create contact list
       
   152      *
       
   153      * @since 3.0
       
   154      * @param aXmlSerializer XML serializer
       
   155      */
       
   156     virtual void DoGetXMLCreateCntListL(
       
   157         MPEngXMLSerializer& aXmlSerializer ) = 0;
       
   158 
       
   159     /**
       
   160      * Template function to create XML message to fetch contact list
       
   161      *
       
   162      * @since 3.0
       
   163      * @param aXmlSerializer XML serializer
       
   164      */
       
   165     virtual void DoGetXMLFetchCntListL(
       
   166         MPEngXMLSerializer& aXmlSerializer ) = 0;
       
   167 
       
   168 
       
   169     /**
       
   170      * Template function to parse XML message from creating contact list
       
   171      *
       
   172      * @since 3.0
       
   173      * @param aResponse XML request response buffer
       
   174      * @param aXMLparser XML parser
       
   175      */
       
   176     virtual void DoParseCreateCntListResponseL(
       
   177         const TDesC8& aResponse,
       
   178         MPEngXMLParser& aXMLparser ) = 0;
       
   179 
       
   180 
       
   181     /**
       
   182      * Template function to parse XML message from fetching contact list
       
   183      *
       
   184      * @since 3.0
       
   185      * @param aResponse XML request response buffer
       
   186      * @param aXMLparser XML parser
       
   187      */
       
   188     virtual void DoParseFetchCntListResponseL(
       
   189         const TDesC8& aResponse,
       
   190         MPEngXMLParser& aXMLparser ) = 0;
       
   191 
       
   192     /**
       
   193      * Complete contact list transaction,
       
   194      * update contact list properties
       
   195      *
       
   196      * @since 3.0
       
   197      */
       
   198     void CompleteCntListTransactionL();
       
   199 
       
   200 
       
   201 
       
   202 private: // New functions
       
   203 
       
   204     /**
       
   205      * Create XML message to subscribe contact
       
   206      *
       
   207      * @since 3.0
       
   208      * @param aXmlSerializer XML serializer
       
   209      */
       
   210     void GetXMLSubscribeListL( MPEngXMLSerializer& aXmlSerializer );
       
   211 
       
   212 
       
   213     /**
       
   214      * Parse Subscribe contact list response
       
   215      *
       
   216      * @since 3.0
       
   217      * @param aResponse XML request response buffer
       
   218      * @param aXMLparser XML parser
       
   219      */
       
   220     void ParseSubscribeListResponseL( const TDesC8& aResponse,
       
   221                                       MPEngXMLParser& aXMLparser );
       
   222 
       
   223 
       
   224 protected:  // Data
       
   225 
       
   226 
       
   227     /// OWN: Contact list model
       
   228     CPEngContactListModBase&            iContactList;
       
   229 
       
   230     /// REF: Session slot
       
   231     CPEngSessionSlotId&                 iSessionSlotId;
       
   232 
       
   233     /// REF: Contact List Transaction manager
       
   234     MPEngContactListTransactionManager& iManager;
       
   235 
       
   236     /// OWN: Transaction status class
       
   237     CPEngTransactionStatus*             iTransactionStatus;
       
   238 
       
   239     /// OWN: State of the presence contact list synchronization
       
   240     TPengCntListSyncState               iContactListSyncState;
       
   241 
       
   242     /// REF: CPS Version
       
   243     TPEngWVCspVersion&                  iCSPVersion;
       
   244 
       
   245     /// OWN: Operation Id
       
   246     TInt                                iOperationId;
       
   247     };
       
   248 
       
   249 #endif      //  __CPENGCONTACTLISTTRANSBASE_H__
       
   250 
       
   251 //  End of File
       
   252