PECengine/PresenceManager2/SrcSearch/CPEngSearchHandler.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 handls the search operation
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPENGSEARCHHANDLER_H
       
    19 #define CPENGSEARCHHANDLER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <E32Base.h>
       
    23 #include <ImpsClient.h>
       
    24 #include <ImpsFundCli.h>
       
    25 #include <ImpsFundamental.h>
       
    26 
       
    27 
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CPEngSearchCriteria2;
       
    31 class CPEngSearchResultEntry;
       
    32 class RImpsEng;
       
    33 
       
    34 
       
    35 /**
       
    36  *
       
    37  *
       
    38  * @lib
       
    39  * @since 3.0
       
    40  */
       
    41 NONSHARABLE_CLASS( CPEngSearchHandler ) : public CBase,
       
    42         public MImpsSearchHandler2,
       
    43         public MImpsErrorHandler2
       
    44 
       
    45 
       
    46     {
       
    47 public:  // Constructors and destructor
       
    48 
       
    49     /**
       
    50      * Two-phased constructor.
       
    51      */
       
    52     static CPEngSearchHandler* NewL( TInt aPriority,
       
    53     RImpsEng& aImpsEngine,
       
    54     CPEngSearchResultEntry& aResultContainer,
       
    55     const RPointerArray< CPEngSearchCriteria2 >& aCriterias,
       
    56     TInt aSearchLimit );
       
    57 
       
    58     /**
       
    59      * Destructor.
       
    60      */
       
    61     virtual ~CPEngSearchHandler();
       
    62 
       
    63 
       
    64 private:
       
    65 
       
    66     /**
       
    67      * C++ default constructor.
       
    68      */
       
    69     CPEngSearchHandler( CPEngSearchResultEntry& aResultContainer,
       
    70                         TInt aSearchLimit );
       
    71 
       
    72     /**
       
    73      * Symbian OS constructor.
       
    74      */
       
    75     void ConstructL( TInt aPriority,
       
    76                      RImpsEng& aImpsEngine,
       
    77                      const RPointerArray< CPEngSearchCriteria2 >& aCriterias );
       
    78 
       
    79 
       
    80 
       
    81 
       
    82 public: //New functions
       
    83 
       
    84 
       
    85     void SearchL( TRequestStatus& aStatus );
       
    86 
       
    87     void ContinueSearchL( TInt aContinueIndex,
       
    88                           TRequestStatus& aStatus );
       
    89 
       
    90     void StopSearchL( TRequestStatus& aStatus );
       
    91 
       
    92     TBool IsRequestPending( TInt aId );
       
    93 
       
    94 
       
    95 
       
    96 private: //From MImpsSearchHandler2
       
    97 
       
    98     /**
       
    99      * Observer method for search response
       
   100      *
       
   101      * @param aOpId operation id returned by SearchFirstL or SearchNextL.
       
   102      * @param aSearchID search operation id,
       
   103      *        used when search is continued or stopped.
       
   104      * @param aIndex indicates the particular index from which the
       
   105      *        next search can start. It is 0 in error case.
       
   106      * @param aResultsFound indicates the number of the current findings.
       
   107      * @param aCompleted TRUE if server has completed the search,
       
   108      *        FALSE if there are more results available.
       
   109      * @param aType which kind of items there are in aResults parameter
       
   110      * @param aResults list of results,
       
   111      *        NULL if none or aStatus has an error code.
       
   112      * @param aCspId CSP session identifier
       
   113      */
       
   114     void HandleSearchL( TInt aOpId,
       
   115                         TInt aSearchId,
       
   116                         TInt aIndex,
       
   117                         TInt aResultsFound,
       
   118                         TBool aCompleted,
       
   119                         TImpsSearchResultType aType,
       
   120                         MDesCArray* aResults ,
       
   121                         TImpsCspIdentifier& aCspId );
       
   122 
       
   123 
       
   124     /**
       
   125      * Observer for stopped search
       
   126      * This is called when WV server has stopped the search after StopSearchL.
       
   127      * Notice that a previous search is invalidated
       
   128      * when a new search is started,
       
   129      * but this method is not called in that situation.
       
   130      * @param aOpId operation id returned by StopSearchL.
       
   131      * @param aSearchID search operation id,
       
   132      *        used when search was stopped.
       
   133      * @param aCspId CSP session identifier
       
   134      */
       
   135     void HandleSearchStoppedL( TInt aOpId,
       
   136                                TInt aSearchId,
       
   137                                TImpsCspIdentifier& aCspId );
       
   138 
       
   139 
       
   140 
       
   141 private: //From MImpsErrorHandler2
       
   142     /**
       
   143      * Observer method for error messages.
       
   144      * This provides data for partial error responses too.
       
   145      * Each service API MUST register this observer by RegisterErrorObserverL
       
   146      * immediately after Register method.
       
   147      * @param aStatus error code.
       
   148      * @param aOpId operation id to map responses to the requests.
       
   149      * @param aDescripton error description
       
   150      * @param aDetailedRes detailed error description
       
   151      * @param aCspId CSP session identifier
       
   152      */
       
   153     void HandleErrorL( TInt aStatus,
       
   154                        TInt aOpId,
       
   155                        const TDesC* aDescription,
       
   156                        const CImpsDetailed* aDetailedRes,
       
   157                        TImpsCspIdentifier& aCspId );
       
   158 
       
   159 
       
   160 private: //Data
       
   161 
       
   162     //REF:
       
   163     CPEngSearchResultEntry& iResultContainer;
       
   164 
       
   165     //OWN:
       
   166     const TInt  iSearchLimit;
       
   167 
       
   168     //OWN:
       
   169     CSearchPairs*   iSearchPairs;
       
   170 
       
   171     //OWN:
       
   172     RImpsFundClient2    iFundClient;
       
   173 
       
   174 
       
   175     TInt    iOpId;
       
   176     TInt    iSearchId;
       
   177     TRequestStatus*     iRequest;
       
   178     };
       
   179 
       
   180 #endif  //CPENGSEARCHHANDLER_H
       
   181 
       
   182 
       
   183