messagingappbase/mce/logenginc/MceLogPbkMatcher.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  
       
    15 *     Defines the CMceLogPbkMatcher class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __Logs_Engine_CMceLogPbkMatcher_H__
       
    22 #define __Logs_Engine_CMceLogPbkMatcher_H__
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <logviewchangeobserver.h>
       
    27 
       
    28 // DATA TYPES
       
    29 
       
    30 enum TMceLogPbkMatcherState
       
    31     {
       
    32     ECreated = 0,           // when created, no operation in progress
       
    33     EOpeningDefaultMatchStores, // opening match stores from the phonebook
       
    34     EFilteringEvent,        // filter setting
       
    35     EReadingEvent ,         // log reading is in progress
       
    36     EUpdatingEvent          // log updating is in progress
       
    37     };
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CLogViewEvent;
       
    41 class CLogClient;
       
    42 class CLogEvent;
       
    43 class CLogFilter;
       
    44 class CLogFilterList;
       
    45 class MMceLogPbkMatcherObserver;
       
    46 class CPhoneNumberMatcher;
       
    47 
       
    48 // CLASS DECLARATION
       
    49 
       
    50 class CMceLogPbkMatcher : public CActive, public MLogViewChangeObserver
       
    51 
       
    52     {
       
    53     public:     // Constructors.
       
    54         /**
       
    55          * Standard creation function. Creates and returns a new object of this
       
    56          * class.
       
    57          *
       
    58          * @param aFsSession    reference to file server session
       
    59          * @param aObserver     pointer to observer
       
    60          *
       
    61          * @return Pointer to the new instance of this class.
       
    62          */
       
    63         static CMceLogPbkMatcher* NewL( 
       
    64             RFs& aFsSession,
       
    65                                 MMceLogPbkMatcherObserver* aObserver = NULL );
       
    66 
       
    67 
       
    68         /**
       
    69          * Destructor.
       
    70          */
       
    71         ~CMceLogPbkMatcher();
       
    72 
       
    73         /**
       
    74          * Start the process of matching and updating log entries
       
    75          */
       
    76         void StartL();
       
    77 
       
    78 
       
    79     private:    // Constructions.
       
    80     
       
    81         /**
       
    82          * Sets filters to logs engine
       
    83          */
       
    84         void SetFiltersToLogsL();
       
    85 
       
    86         /**
       
    87          * Configure filters to read certain log events
       
    88          */
       
    89         void SetFiltersL();
       
    90 
       
    91         /**
       
    92          * Configure to read log events of particular type
       
    93          *
       
    94          * @param aFilterType   filter type
       
    95          * @return Pointer to created filter
       
    96          */
       
    97         CLogFilter* SetOneFilterLC( TUid aFilterType );
       
    98 
       
    99         /**
       
   100          * Gets name from the phonebook
       
   101          *
       
   102          * @return ETrue if found one match, otherwise EFalse
       
   103          */
       
   104         TBool GetRemotePartyL();
       
   105 
       
   106         /**
       
   107          * Add correctly matching contacts to array
       
   108          *
       
   109          * @param aIdArray, parameters array
       
   110          * @param aNoDuplicateArray, result array
       
   111          * @param aNumber, matching number
       
   112          */
       
   113         void FillNoDuplicateArrayL( CContactIdArray& aIdArray,
       
   114                     CArrayFixFlat<TContactItemId>& aNoDuplicateArray,
       
   115                     const TDesC& aNumber );
       
   116 
       
   117     protected: // Constructions, for test access used in derived test class
       
   118 
       
   119         /**
       
   120          * Constructor, second phase.
       
   121          */
       
   122         void ConstructL();
       
   123 
       
   124         /**
       
   125          * Constructor
       
   126          *
       
   127          * @param aFsSession    reference to file server session
       
   128          * @param aObserver     pointer to observer
       
   129          */
       
   130         CMceLogPbkMatcher( 
       
   131             RFs& aFsSession, 
       
   132                     MMceLogPbkMatcherObserver* aObserver = NULL );
       
   133 
       
   134 
       
   135     private:     // Operations from CActive
       
   136 
       
   137         /**
       
   138          * Cancels active request.
       
   139          */
       
   140         void DoCancel();
       
   141 
       
   142     protected:     // Operations from CActive, derived test class
       
   143 
       
   144         /**
       
   145          * This is called when a request to a log engine is completed.
       
   146          */
       
   147         void RunL();
       
   148 
       
   149         /**
       
   150          * RunL leave handler.
       
   151          *
       
   152          * @param aError, leave code
       
   153          * @return error code or KErrNone
       
   154          */
       
   155         TInt RunError( TInt aError );
       
   156 
       
   157     public: // from MLogViewChangeObserver
       
   158         void HandleLogViewChangeEventAddedL(TLogId aId,   TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount);
       
   159         void HandleLogViewChangeEventChangedL(TLogId aId,   TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount);
       
   160         void HandleLogViewChangeEventDeletedL(TLogId aId,   TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount);
       
   161 
       
   162 
       
   163 
       
   164     private: // data
       
   165 
       
   166         /// Ref: Reference to file server session
       
   167         RFs& iFsSession;
       
   168 
       
   169         /// Ref: pointer to observer
       
   170         MMceLogPbkMatcherObserver* iObserver;
       
   171 
       
   172         /// Own: Log engine
       
   173         CLogClient* iLogClient;
       
   174 
       
   175         /// Own: Event
       
   176         CLogEvent* iEvent;
       
   177 
       
   178         /// Own: Filterlist
       
   179         CLogFilterList* iFilterList;
       
   180 
       
   181         /// Own: View to filtered events.
       
   182         CLogViewEvent* iLogViewEvent;
       
   183 
       
   184         /// Own: Reader's state
       
   185         TMceLogPbkMatcherState iReaderState;
       
   186 
       
   187         /// Own: matcher utility class
       
   188         CPhoneNumberMatcher* iPbkS60Matcher;
       
   189     };
       
   190 
       
   191 #endif // __Logs_Engine_CMceLogPbkMatcher_H__
       
   192 
       
   193 // End of File