wvuing/IMPSConnectionUI/ClientPluginSrc/CCnUiClientPluginBase.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:  Shared basic implementation for client plug-ins.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CCNUICLIENTPLUGINBASE_H
       
    19 #define __CCNUICLIENTPLUGINBASE_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <E32Base.h>
       
    23 #include <badesca.h>
       
    24 #include <MPEngAttributeTransactionObserver2.h>
       
    25 #include <MPEngContactListTransactionObserver2.h>
       
    26 #include <MPEngAttributeListTransactionObserver2.h>
       
    27 #include <PEngWVServices2.h>
       
    28 
       
    29 #include "MCnUiClientPlugin.h"
       
    30 
       
    31 const TInt KCollationLevel = 0;
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 
       
    35 class CPEngAttributeStore2;
       
    36 class CPEngAttributeTransaction2;
       
    37 class CPEngAttributeListStore2;
       
    38 class CPEngAttributeListTransaction2;
       
    39 class CPEngContactListStore2;
       
    40 class CPEngContactListTransaction2;
       
    41 class CPEngNWSessionSlotID2;
       
    42 
       
    43 
       
    44 
       
    45 // CLASS DECLARATION
       
    46 /**
       
    47  * Shared basic implementation for client plug-ins.
       
    48  *
       
    49  * @since 2.1
       
    50  */
       
    51 NONSHARABLE_CLASS( CCnUiClientPluginBase ) : public CBase,
       
    52         public MCnUiClientPlugin,
       
    53         public MPEngContactListTransactionObserver2,
       
    54         public MPEngAttributeListTransactionObserver2,
       
    55         public MPEngAttributeTransactionObserver2
       
    56 
       
    57 
       
    58 
       
    59     {
       
    60 protected: //Enumerations
       
    61 
       
    62     /**
       
    63      * Sub processing steps ID's.
       
    64      * @since 2.1
       
    65      */
       
    66     enum TStepId
       
    67         {
       
    68         ECntListPublish = 1,
       
    69         EAttribListPublish = 2,
       
    70         EAttributePublish = 3,
       
    71         EBaseCntListSynch = 4
       
    72         };
       
    73 
       
    74 
       
    75     /**
       
    76      * Sub processing types.
       
    77      * @since 2.1
       
    78      */
       
    79     enum TStepProcessType
       
    80         {
       
    81         EExplicitPostLoginSync = 1,
       
    82         EPreLogoutPublish = 2
       
    83         };
       
    84 
       
    85 
       
    86 protected: //constructors and destructor
       
    87 
       
    88     /**
       
    89      * C++ constructor.
       
    90      */
       
    91     CCnUiClientPluginBase( TIMPSConnectionClient aClientID );
       
    92 
       
    93 
       
    94     /**
       
    95      * Destructor.
       
    96      */
       
    97     ~CCnUiClientPluginBase();
       
    98 
       
    99 
       
   100     /**
       
   101      * Symbian OS constructor.
       
   102      */
       
   103     void ConstructL( CPEngNWSessionSlotID2& aNWSessionSlotID );
       
   104 
       
   105 
       
   106 public: //From MCnUiClientPlugin
       
   107 
       
   108 
       
   109     /**
       
   110      * From MCnUiClientPlugin
       
   111      * @see MCnUiClientPlugin
       
   112      * @since 2.1
       
   113      */
       
   114     TIMPSConnectionClient ClientID();
       
   115 
       
   116 
       
   117     /**
       
   118      * From MCnUiClientPlugin
       
   119      * @see MCnUiClientPlugin
       
   120      * @since 2.1
       
   121      */
       
   122     void ReleaseDynamicResources();
       
   123 
       
   124 
       
   125     //New connection open related methods
       
   126     /**
       
   127      * From MCnUiClientPlugin
       
   128      * @see MCnUiClientPlugin
       
   129      * @since 2.1
       
   130      */
       
   131     void ConnectionOpenInitL( TBool aSapConnectionOpen,
       
   132                               const CIMPSSAPSettings& aSap );
       
   133 
       
   134 
       
   135     /**
       
   136      * From MCnUiClientPlugin
       
   137      * @see MCnUiClientPlugin
       
   138      * @since 2.1
       
   139      */
       
   140     TBool VerifySapCapabilitiesL();
       
   141 
       
   142 
       
   143     /**
       
   144     * From MCnUiClientPlugin
       
   145     * @see MCnUiClientPlugin
       
   146     * @since 2.1
       
   147     */
       
   148     void DoPostLoginProsessingL( TRequestStatus& aStatus );
       
   149 
       
   150 
       
   151     /**
       
   152     * From MCnUiClientPlugin
       
   153     * @see MCnUiClientPlugin
       
   154     * @since 2.1
       
   155     */
       
   156     void CancelPostLoginProsessing();
       
   157 
       
   158 
       
   159     //New connection close related methods
       
   160     /**
       
   161     * From MCnUiClientPlugin
       
   162     * @see MCnUiClientPlugin
       
   163     * @since 2.1
       
   164     */
       
   165     void ConnectionCloseInitL( const CIMPSSAPSettings& aSap );
       
   166 
       
   167 
       
   168     /**
       
   169     * From MCnUiClientPlugin
       
   170     * @see MCnUiClientPlugin
       
   171     * @since 2.1
       
   172     */
       
   173     void DoPreLogoutProsessingL( TRequestStatus& aStatus );
       
   174 
       
   175 
       
   176     /**
       
   177     * From MCnUiClientPlugin
       
   178     * @see MCnUiClientPlugin
       
   179     * @since 2.1
       
   180     */
       
   181     void CancelPreLogoutProsessing();
       
   182 
       
   183     /**
       
   184      * From MCnUiClientPlugin
       
   185      * @see MCnUiClientPlugin
       
   186      * @since 2.1
       
   187      */
       
   188     void LoginCancelledL();
       
   189 
       
   190 
       
   191 private: // From MPEngContactListTransactionObserver2
       
   192 
       
   193 
       
   194     /**
       
   195      * From MPEngContactListTransactionObserver2
       
   196      * @see MPEngContactListTransactionObserver2
       
   197      */
       
   198     void HandleContactListTransactionError(
       
   199         TInt aError,
       
   200         CPEngContactListTransaction2& aAttributeTransaction,
       
   201         TInt aTransactionOperation );
       
   202 
       
   203     /**
       
   204      * From MPEngContactListTransactionObserver2
       
   205      * @see MPEngContactListTransactionObserver2
       
   206      */
       
   207     void HandleContactListTransactionCompleteL(
       
   208         MPEngTransactionStatus2& aStatus,
       
   209         CPEngContactListTransaction2& aContactListTransaction,
       
   210         TInt aTransactionOperation );
       
   211 
       
   212 
       
   213 private: // From MPEngAttributeListTransactionObserver2
       
   214 
       
   215     /**
       
   216      * From MPEngAttributeListTransactionObserver2
       
   217      * @see MPEngAttributeListTransactionObserver2
       
   218      */
       
   219     void HandleAttributeListTransactionError(
       
   220         TInt aError,
       
   221         CPEngAttributeListTransaction2& aAttributeTransaction,
       
   222         TInt aTransactionOperation );
       
   223 
       
   224     /**
       
   225      * From MPEngAttributeListTransactionObserver2
       
   226      * @see MPEngAttributeListTransactionObserver2
       
   227      */
       
   228     void HandleAttributeListTransactionCompleteL(
       
   229         MPEngTransactionStatus2& aStatus,
       
   230         CPEngAttributeListTransaction2& aAttributeListTransaction,
       
   231         TInt aTransactionOperation );
       
   232 
       
   233 
       
   234 
       
   235 
       
   236 private: //From MPEngAttributeTransactionObserver2
       
   237 
       
   238     /**
       
   239      * From MPEngAttributeTransactionObserver2
       
   240      * @see MPEngAttributeTransactionObserver2
       
   241      * @since 2.1
       
   242      */
       
   243     void HandleAttributeTransactionError(
       
   244         TInt aError,
       
   245         CPEngAttributeTransaction2& aAttributeTransaction,
       
   246         TInt aTransactionOperation );
       
   247 
       
   248     /**
       
   249      * From MPEngAttributeTransactionObserver2
       
   250      * @see MPEngAttributeTransactionObserver2
       
   251      * @since 2.1
       
   252      */
       
   253     void HandleAttributeTransactionCompleteL(
       
   254         MPEngTransactionStatus2& aStatus,
       
   255         CPEngAttributeTransaction2& aAttributeTransaction,
       
   256         TInt aTransactionOperation );
       
   257 
       
   258 
       
   259 
       
   260 protected: // New template methods & helpers to derived classes
       
   261 
       
   262     /**
       
   263      * Template method for concrete client plug-ins
       
   264      * to do their client specific capability checks.
       
   265      *
       
   266      * @since 2.1
       
   267      * @param aCurrenServices The Current NW Server capabilities
       
   268      * expressed as IMPS Engine TImpsServices.
       
   269      * @return ETrue if network server capabilities are OK for
       
   270      * client. Else EFalse.
       
   271      */
       
   272     virtual TBool DoVerifySapCapabilities( TPEngWVCspServicesTree2 aCurrenServices ) = 0;
       
   273 
       
   274     /**
       
   275      * Template method for concrete client
       
   276      * plug-ins to enumerate contact list used by those.
       
   277      *
       
   278      * @since 2.1
       
   279      * @return An array containing known contact list names.
       
   280      */
       
   281     virtual CDesCArray* DoClientKnownCntListsLC() = 0;
       
   282 
       
   283 
       
   284     /**
       
   285      * Template method for concrete client
       
   286      * plug-ins to start their explicit post login
       
   287      * synchronization processing.
       
   288      *
       
   289      * Client plug-in can use PENG publishers holded by this base
       
   290      * to do the sub steps. If client starts processing,
       
   291      * it has to signal to base with SetStepProcessingActive()
       
   292      *
       
   293      * @since 2.1
       
   294      */
       
   295     virtual void DoStartExplicitPostLoginSyncL() = 0;
       
   296 
       
   297 
       
   298     /**
       
   299      * Template method for concrete client
       
   300      * plug-ins to get notifications from post login
       
   301      * processing step completions and handle those
       
   302      * as needed.
       
   303      *
       
   304      * @since 2.1
       
   305      * @param aStepId The step ID which completed.
       
   306      * @param aStepStatus The completion status.
       
   307      */
       
   308     virtual void DoHandleExplicitPostLoginSyncStepCompleteL( TStepId aStepId,
       
   309                                                              TInt& aStepStatus ) = 0;
       
   310 
       
   311     /**
       
   312      * Template method for concrete client
       
   313      * plug-ins to start their explicit pre logout
       
   314      * publishing.
       
   315      *
       
   316      * Client plug-in can use PENG publishers holded by this base
       
   317      * to do the sub steps. If client starts processing,
       
   318      * it has to signal to base with SetStepProcessingActive()
       
   319      *
       
   320      * @since 2.1
       
   321      */
       
   322     virtual void DoStartPreLogoutPublishL() = 0;
       
   323 
       
   324 
       
   325     /**
       
   326      * Template method for concrete client
       
   327      * plug-ins to get notifications from pre logout
       
   328      * processing step completions and handle those
       
   329      * as needed.
       
   330      *
       
   331      * @since 2.1
       
   332      * @param aStepId The step ID which completed.
       
   333      * @param aStepStatus The completion status.
       
   334      */
       
   335     virtual void DoHandlePreLogoutPublishStepCompleteL( TStepId aStepId,
       
   336                                                         TInt& aStepStatus ) = 0;
       
   337 
       
   338     /**
       
   339      * Signals to base that there were started a
       
   340      * sub processing step.
       
   341      *
       
   342      * @since 2.1
       
   343      */
       
   344     void SetStepProcessingActive();
       
   345 
       
   346 
       
   347 
       
   348 private: //Private helpers
       
   349 
       
   350 
       
   351     /**
       
   352      * Helper to handle sub step completions.
       
   353      *
       
   354      * @since 2.1
       
   355      * @param aStepId The step ID which completed.
       
   356      * @param aStepStatus The completion status.
       
   357      */
       
   358     void HandleStepComplete( TStepId aStepId, TInt aStepStatus );
       
   359 
       
   360 
       
   361     /**
       
   362      * Helper to cancel all PENG publishers and
       
   363      * complete the original request.
       
   364      * This method is protected against partial
       
   365      * construction, so it can be used from destructor.
       
   366      *
       
   367      * @since 2.1
       
   368      */
       
   369     void CancelAllProcessingAndCompleteIfNeeded();
       
   370 
       
   371 
       
   372     /**
       
   373      * Helper to cancel all PENG publishers.
       
   374      * This method is protected against partial
       
   375      * construction, so it can be used from destructor.
       
   376      *
       
   377      * @since 2.1
       
   378      */
       
   379     void CancelAllPEngPublishers();
       
   380 
       
   381 
       
   382 protected : // Protected data available to real clients
       
   383 
       
   384     ///<PENG contact list handlers, owned.
       
   385     CPEngContactListStore2*               iPEngCntListStore;
       
   386     CPEngContactListTransaction2*          iPEngCntListPublisher;
       
   387 
       
   388     ///<PENG attribute list handlers, owned.
       
   389     CPEngAttributeListStore2*             iPEngAttributeListStore;
       
   390     CPEngAttributeListTransaction2*        iPEngAttributeListPublisher;
       
   391 
       
   392     ///<PENG attribute handlers, owned.
       
   393     CPEngAttributeStore2*                 iPEngAttributeStore;
       
   394     CPEngAttributeTransaction2*            iPEngAttributePublisher;
       
   395 
       
   396     // the state of this state machine
       
   397     TStepId                              iStepId;
       
   398 
       
   399     // owns: network session slot ID
       
   400     CPEngNWSessionSlotID2*               iNWSessionSlotID;
       
   401 
       
   402 private: // Private data
       
   403 
       
   404     ///<Client ID, owned
       
   405     const TIMPSConnectionClient          iClientID;
       
   406 
       
   407     ///<Is explicit sync needed flag, owned
       
   408     TBool                                iExplicitSyncNeeded;
       
   409 
       
   410     ///<Is step processing active, owned
       
   411     TBool                                iStepProcessingActive;
       
   412 
       
   413     ///<Step processing type, owned
       
   414     TStepProcessType                     iStepProcessType;
       
   415 
       
   416     ///<External request status complete after step precessing, owned
       
   417     TRequestStatus*                      iRequest;
       
   418 
       
   419 
       
   420     };
       
   421 
       
   422 #endif      //__CCNUICLIENTPLUGINBASE_H
       
   423 //  End of File
       
   424 
       
   425