PECengine/PresenceManager2/SrcSearch/CPEngSearchSessionHandler.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     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: this class handles the search session
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPENGSEARCHSESSIONHANDLER_H
       
    19 #define CPENGSEARCHSESSIONHANDLER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <E32Base.h>
       
    23 #include <ImpsClient.h>
       
    24 #include <ImpsAccessCli.h>
       
    25 
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CPEngNWSessionSlot2;
       
    30 class CIMPSSAPSettings;
       
    31 class CPEngNWSessionSlotID2;
       
    32 class CPEngNWSessionSlot2;
       
    33 
       
    34 
       
    35 
       
    36 /**
       
    37  *
       
    38  *
       
    39  * @lib
       
    40  * @since 3.0
       
    41  */
       
    42 NONSHARABLE_CLASS( CPEngSearchSessionHandler ) : public CBase,
       
    43         public MImpsAccessHandler2,
       
    44         public MImpsErrorHandler2
       
    45     {
       
    46 
       
    47 private: //enumerations
       
    48 
       
    49     /**
       
    50      *
       
    51      */
       
    52     enum TPEngAccessOperation
       
    53         {
       
    54         EPEngAccOp_Idle = 0, //Idle state, no operation running
       
    55         EPEngAccOp_LogIn = 1,
       
    56         EPEngAccOp_LogOut = 2,
       
    57         };
       
    58 
       
    59 
       
    60 public:  // Constructors and destructor
       
    61 
       
    62     /**
       
    63      * Two-phased constructor.
       
    64      */
       
    65     static CPEngSearchSessionHandler* NewL( TInt aPriority,
       
    66                                             const CPEngNWSessionSlotID2& aNWSessionSlotID );
       
    67 
       
    68     /**
       
    69      * Destructor.
       
    70      */
       
    71     virtual ~CPEngSearchSessionHandler();
       
    72 
       
    73 
       
    74 private:
       
    75 
       
    76     /**
       
    77      * C++ default constructor.
       
    78      */
       
    79     CPEngSearchSessionHandler();
       
    80 
       
    81     /**
       
    82      * Symbian OS constructor.
       
    83      */
       
    84     void ConstructL( TInt aPriority,
       
    85                      const CPEngNWSessionSlotID2& aNWSessionSlotID );
       
    86 
       
    87 
       
    88 
       
    89 
       
    90 public: //New services
       
    91 
       
    92     /**
       
    93      *
       
    94      *
       
    95      *
       
    96      */
       
    97     void OpenCspSessionL( TRequestStatus& aStatus );
       
    98 
       
    99 
       
   100     /**
       
   101      *
       
   102      *
       
   103      *
       
   104      */
       
   105     void CloseCspSessionL( TRequestStatus& aStatus );
       
   106 
       
   107 
       
   108     /**
       
   109      *
       
   110      *
       
   111      *
       
   112      */
       
   113     RImpsEng& ImpsEngine();
       
   114 
       
   115 
       
   116 
       
   117     /**
       
   118      *
       
   119      *
       
   120      *
       
   121      */
       
   122     TBool IsRequestPending( TInt aId );
       
   123 
       
   124 
       
   125 
       
   126 private: //From MImpsAccessHandler2
       
   127 
       
   128 
       
   129     /**
       
   130      * Observer method for Login and Open event.
       
   131      * Login may be initiated by other application.
       
   132      * @param aId operation id received in LoginL. If this is 0, then the
       
   133      *        login was initiated by other application or SAP.
       
   134      * @param aCspId CSP session identifier
       
   135      */
       
   136     void HandleLoginL( TInt aId,
       
   137                        TImpsCspIdentifier& aCspId );
       
   138 
       
   139     /**
       
   140      * Observer method for Logout event.
       
   141      * @param aId operation id received in LogoutL. If this is 0, then the
       
   142      *        logout was initiated by other application or caused by a serious
       
   143      *        network error. SAP initiated logouts are identified with -1.
       
   144      * @param aCspId CSP session identifier
       
   145      */
       
   146     void HandleLogoutL( TInt aId,
       
   147                         TImpsCspIdentifier& aCspId );
       
   148 
       
   149     /**
       
   150      * Observer method for CancelLogin event.
       
   151      * @param aCancelledOpId operation id of the canceled login.
       
   152      * @param aCspId CSP session identifier
       
   153      */
       
   154     void HandleLoginCancelL( TInt aCancelledOpId,
       
   155                              TImpsCspIdentifier& aCspId );
       
   156 
       
   157 
       
   158     /**
       
   159      * Observer for NumberOfSessions and NumberOfSubSessions response
       
   160      * @param aId operation id
       
   161      * @param aNbr number of sessions
       
   162      * @param aCspId CSP session identifier
       
   163      */
       
   164     void HandleNbrSessionsL( TInt aId,
       
   165                              TInt aNbr,
       
   166                              TImpsCspIdentifier& aCspId );
       
   167 
       
   168 
       
   169 private: // From MImpsErrorHandler2
       
   170 
       
   171     /**
       
   172      * Observer method for error messages.
       
   173      * This provides data for partial error responses too.
       
   174      * Each service API MUST register this observer by RegisterErrorObserverL
       
   175      * immediately after Register method.
       
   176      * @param aStatus error code.
       
   177      * @param aOpId operation id to map responses to the requests.
       
   178      * @param aDescripton error description
       
   179      * @param aDetailedRes detailed error description
       
   180      * @param aCspId CSP session identifier
       
   181      */
       
   182     void HandleErrorL( TInt aStatus,
       
   183                        TInt aOpId,
       
   184                        const TDesC* aDescription,
       
   185                        const CImpsDetailed* aDetailedRes,
       
   186                        TImpsCspIdentifier& aCspId );
       
   187 
       
   188 
       
   189 
       
   190 private: //Data
       
   191 
       
   192 
       
   193     CIMPSSAPSettings*       iImpsSap;
       
   194     RImpsEng                iImpsEng;
       
   195     RImpsAccessClient2      iImpsAccClient;
       
   196 
       
   197     TInt iOpId;
       
   198     TPEngAccessOperation    iOperation;
       
   199     TRequestStatus*         iRequest;
       
   200 
       
   201     };
       
   202 
       
   203 #endif  // CPENGSEARCHSESSIONHANDLER_H
       
   204 
       
   205 
       
   206