presadap12/impsplugin/inc/cimpspluginaccesshandler.h
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Access handler of the network session
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __IMPSPLUGINACCESSHANDLER_H__
       
    19 #define __IMPSPLUGINACCESSHANDLER_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include    <E32Base.h>
       
    23 #include    <ImpsAccessCli.h>
       
    24 #include    "PEngPresenceEngineConsts2.h"
       
    25 #include    "PEngWVServices2.h"
       
    26 #include    "MImpsPluginAccessHandler.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MPEngSessionStatusObserver;
       
    30 
       
    31 
       
    32 /**
       
    33  * CImpsPluginAccessHandler
       
    34  *
       
    35  * @since 3.0
       
    36  */
       
    37 NONSHARABLE_CLASS( CImpsPluginAccessHandler ) :
       
    38         public CBase,
       
    39         public MImpsPluginAccessHandler,
       
    40         public MImpsAccessHandler2,
       
    41         public MImpsErrorHandler2,
       
    42         public MImpsStatusHandler2
       
    43     {
       
    44 public: /* Construction */
       
    45 
       
    46 
       
    47     /**
       
    48      * Instantiates CImpsPluginAccessHandler object.
       
    49      *
       
    50      * @return New CImpsPluginAccessHandler instance.
       
    51      */
       
    52     static CImpsPluginAccessHandler* NewL( RImpsEng& aSessClient );
       
    53 
       
    54 
       
    55     /**
       
    56      * Destructor.
       
    57      */
       
    58     ~CImpsPluginAccessHandler();
       
    59 
       
    60     //-----------------------------------------------------------------------
       
    61 public: // from MImpsPluginAccessHandler
       
    62 
       
    63 
       
    64     /**
       
    65      *  Log in to the presence server
       
    66      *  @see <MImpsPluginAccessHandler>
       
    67      */
       
    68     void LogInL( TRequestStatus& aStatus,
       
    69                  TDesC &aPassword,
       
    70                  TDesC &aClientId,
       
    71                  TDesC &aServiceAddress,
       
    72                  TInt32 aIapId );
       
    73 
       
    74     /**
       
    75      *  Log out from the presence server
       
    76      *  @see <MImpsPluginAccessHandler>
       
    77      */
       
    78     void LogOutL( TRequestStatus& aStatus );
       
    79 
       
    80 
       
    81     /**
       
    82      *  Cancels active asynchronous operation
       
    83      *  @see <MImpsPluginAccessHandler>
       
    84      */
       
    85     void Cancel( TInt aReason );
       
    86 
       
    87     /**
       
    88      *  Register session status observer
       
    89      *  @see <MImpsPluginAccessHandler>
       
    90      */
       
    91     void RegisterSessionObserverL(
       
    92         MPEngSessionStatusObserver& aObserver );
       
    93 
       
    94     /**
       
    95      *  UnRegister session status observer
       
    96      *  @see <MImpsPluginAccessHandler>
       
    97      */
       
    98     void UnregisterSessionObserver(
       
    99         MPEngSessionStatusObserver& aObserver );
       
   100 
       
   101     /**
       
   102      *  Get session service capabilities
       
   103      *  @see <MImpsPluginAccessHandler>
       
   104      */
       
   105     TPEngWVCspServicesTree2& ServiceCapabilities();
       
   106 
       
   107 
       
   108 public: // MImpsAccessHandler2
       
   109 
       
   110     /**
       
   111      * Observer method for Login and Open event.
       
   112      * @see <impspurecli.h>
       
   113      */
       
   114     void HandleLoginL( TInt aId,
       
   115                        TImpsCspIdentifier& aCspId );
       
   116 
       
   117     /**
       
   118      * Observer method for Logout event.
       
   119      * @see <impspurecli.h>
       
   120      */
       
   121     void HandleLogoutL( TInt aId,
       
   122                         TImpsCspIdentifier& aCspId );
       
   123 
       
   124     /**
       
   125      * Observer method for CancelLogin event.
       
   126      * @see <impspurecli.h>
       
   127      */
       
   128     void HandleLoginCancelL( TInt aCancelledOpId,
       
   129                              TImpsCspIdentifier& aCspId );
       
   130 
       
   131     /**
       
   132      * Observer for NumberOfSessions and NumberOfSubSessions response
       
   133      * @see <impspurecli.h>
       
   134      */
       
   135     void HandleNbrSessionsL( TInt aId,
       
   136                              TInt aNbr,
       
   137                              TImpsCspIdentifier& aCspId );
       
   138 
       
   139 public: // MImpsErrorHandler
       
   140 
       
   141     /**
       
   142      * Observer method for error messages.
       
   143      * @see <impspurecli.h>
       
   144      */
       
   145     void HandleErrorL( TInt aStatus,
       
   146                        TInt aOpId,
       
   147                        const TDesC* aDescription,
       
   148                        const CImpsDetailed* aDetailedRes,
       
   149                        TImpsCspIdentifier& aCspId );
       
   150 
       
   151 public: // MImpsStatusHandler
       
   152     /**
       
   153      * Observer method for changes in service status.
       
   154      * @see <MImpsStatusHandler.h>
       
   155      */
       
   156     void HandleStatusChangeL( TImpsServiceStatus aStatus,
       
   157                               TImpsCspIdentifier& aCspId );
       
   158 
       
   159 private: // new private functions
       
   160 
       
   161     /**
       
   162      *  Copy service tree
       
   163      *
       
   164      *  @since 3.0
       
   165      *  @param WV Engine service tree
       
   166      */
       
   167     void CopyServiceTree( TImpsServices& aFrom );
       
   168 
       
   169     /**
       
   170      *  Notify if new state
       
   171      *
       
   172      *  @since 3.0
       
   173      *  @param aNewState
       
   174      *  @param aEvent
       
   175      */
       
   176     void NotifyIfNewStateL( TPEngNWSessionSlotState aNewState,
       
   177                             TPEngNWSessionSlotEvent aEvent );
       
   178 
       
   179 
       
   180     /**
       
   181      *  Handle completion of the log in request
       
   182      *
       
   183      *  @since 3.0
       
   184      */
       
   185     void HandleLogInCompletionL();
       
   186 
       
   187 
       
   188 
       
   189 protected: // construction
       
   190 
       
   191     /**
       
   192      * C++ constructor. protected
       
   193      */
       
   194     CImpsPluginAccessHandler();
       
   195 
       
   196     /**
       
   197      * Symbian Second phase constructor
       
   198      */
       
   199     void ConstructL( RImpsEng& aSessClient );
       
   200 
       
   201 private: //Data
       
   202     enum TPEngOperation
       
   203         {
       
   204         EIdle           = 0,
       
   205         EDoingLogIn     = 1,
       
   206         EDoingLogOut    = 2,
       
   207         ECanceling      = 3
       
   208         };
       
   209 
       
   210     /// OWN: State of the session
       
   211     TPEngNWSessionSlotState     iSessStatus;
       
   212 
       
   213     /// OWN: Service tree of the session
       
   214     TPEngWVCspServicesTree2     iServices;
       
   215 
       
   216     /// OWN: TBool service tree fetched
       
   217     TBool                       iServiceFetched;
       
   218 
       
   219     /// REF: Session state observer
       
   220     RPointerArray<MPEngSessionStatusObserver> iObservers;
       
   221 
       
   222     /// OWN: Access client of WV Engine
       
   223     RImpsAccessClient2          iAccessClient;
       
   224 
       
   225     /// OWN: Operation Id from the WV Server
       
   226     TInt                        iOpId;
       
   227 
       
   228     /// REF: Request Status of the active request
       
   229     TRequestStatus*             iStatus;
       
   230 
       
   231     /// OWN: Active operation
       
   232     TPEngOperation              iOperation;
       
   233 
       
   234     };
       
   235 
       
   236 #endif  //__IMPSPLUGINACCESSHANDLER_H__
       
   237 
       
   238 // End of File