messagingappbase/mce/logenginc/MceLogEngine.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 *     This class communicates with the log db. This also handles all the
       
    16 *     filtering options and registers Mce to LogEng to get notidied about
       
    17 *     changes in log DB.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef __Mce_Engine_CMceLogEngine_H__
       
    24 #define __Mce_Engine_CMceLogEngine_H__
       
    25 
       
    26 // INCLUDES
       
    27 #include <logcli.h>         // for TLogConfig
       
    28 #include <cntdef.h>
       
    29 #include <logwrap.h>        // for LogEvent, TLogRecentList, TLogId
       
    30 
       
    31 
       
    32 #include "MceLogEngine.hrh"
       
    33 #include "MceLogNotify.h"  // Log DB observer class.
       
    34 #include "MceLogPbkMatcherObserver.h"
       
    35 #include <LogsApiConsts.h>
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CMceLogEngineReader;
       
    39 class CMceLogPbkMatcher;
       
    40 class MMceLogEngObserver;
       
    41 class CMceLogEngineReader;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46  * This class communicates with the log db.  This also handles all the
       
    47  * filtering options and registers Mce to LogEng to get notified about
       
    48  * changes in log DB.
       
    49  */
       
    50 class CMceLogEngine : public CBase,
       
    51                       public MMceLogPbkMatcherObserver
       
    52     {
       
    53     public: // Construction/destruction
       
    54         /**
       
    55          * Standard creation function. Creates and returns a new object of this
       
    56          * class.
       
    57          *
       
    58          * @return pointer to CMceLogEngine instance.
       
    59          */
       
    60         IMPORT_C static CMceLogEngine* NewL();
       
    61 
       
    62 
       
    63         /**
       
    64          *  Destructor.
       
    65          */
       
    66         ~CMceLogEngine();
       
    67 
       
    68         /**
       
    69          * Starts reading events from log DB.
       
    70          *
       
    71          */
       
    72         void UpdateEventsL();
       
    73 
       
    74         /**
       
    75          * Returns const pointer to an event from iEventArray
       
    76          *
       
    77          * @param aIndex        Index of the event to return.
       
    78          * @return CLogEvent*   Pointer to returned event.
       
    79          */
       
    80         IMPORT_C const CLogEvent* Event(TInt aIndex);
       
    81 
       
    82         /**
       
    83          * Confirmation that reading entries from log engine is completed.
       
    84          *
       
    85          * @param aStatus       ETrue if reading succeeded, otherwise EFalse
       
    86          */
       
    87         void ReadEventsCompletedL( TBool aStatus = ETrue );
       
    88 
       
    89         /**
       
    90          * Informs model when log db state has changed.
       
    91          */
       
    92         void NotifyDbChangedL();
       
    93 
       
    94         /**
       
    95          * Add event to the list of events (iEventArray).
       
    96          *
       
    97          * @param aEvent The event to be added into iEventArray.
       
    98          */
       
    99         void AddEventToListL( CLogEvent* aEvent );
       
   100 
       
   101         /**
       
   102          * Resets event array
       
   103          */
       
   104         void ResetArray();
       
   105 
       
   106         /**
       
   107          * Set model observer for MLogsModelObserver class.
       
   108          *
       
   109          * @param aContainerObserver Pointer to container.
       
   110          */
       
   111         IMPORT_C void SetContainerObserver( MMceLogEngObserver* aContainerObserver );
       
   112 
       
   113         /**
       
   114          * Remove model observer to "Delivery Report" view container class.
       
   115          */
       
   116         IMPORT_C void RemoveContainerObserver();
       
   117 
       
   118         /**
       
   119          * Purge data to iLogSmsPduData class.
       
   120          *
       
   121          * @param aEvent The event which data field has to be purged.
       
   122          * @param aData pointer to array to put results in
       
   123          * @return total count of SMS messages in case of pending
       
   124          */
       
   125         IMPORT_C TInt PurgeData( const CLogEvent* aEvent, CArrayFixFlat<TInt>* aData );
       
   126 
       
   127         /**
       
   128          * Count of events
       
   129          *
       
   130          * @return count of log events
       
   131          */
       
   132         IMPORT_C TInt Count() const;
       
   133 
       
   134         /**
       
   135          * Gets standard strings from logwrap.dll
       
   136          *
       
   137          * @param aFailed reference to buffer
       
   138          * @param aPending reference to buffer
       
   139          */
       
   140         IMPORT_C void GetStandardStrings( TDes& aFailed, TDes& aPending );
       
   141 
       
   142         /**
       
   143          * Used to find out if phone number is available for a call
       
   144          *
       
   145          * @param aIndex index of currently selected item
       
   146          * @return ETrue if number is available -> call is possible
       
   147          */
       
   148         IMPORT_C TBool IsNumberAvailable( TInt aIndex );
       
   149 
       
   150         /**
       
   151          * Called by UI when foreground is gained
       
   152          */
       
   153         IMPORT_C void ForegroundGainedL();
       
   154 
       
   155         /**
       
   156          * Called by UI when foreground is lost
       
   157          */
       
   158         IMPORT_C void ForegroundLost();
       
   159 
       
   160         /**
       
   161          * Clear dr list.
       
   162          */
       
   163         IMPORT_C void ClearDrListL();
       
   164 
       
   165     public:
       
   166 
       
   167         void PbkMatchingDoneL(); // from MMceLogPbkMatcherObserver
       
   168 
       
   169     private:
       
   170         /*
       
   171          * Constructor.
       
   172          */
       
   173         CMceLogEngine();
       
   174 
       
   175         /**
       
   176          * Constructor, second phase.
       
   177          */
       
   178         void ConstructL();
       
   179 
       
   180     private:    // data
       
   181         /// Own: engine reader
       
   182         CMceLogEngineReader* iEngineReader;
       
   183 
       
   184         /// Own: array of events
       
   185         CArrayPtrFlat<CLogEvent>* iEventArray;
       
   186 
       
   187         /// Own: LogEng client object.
       
   188         CLogClient* iLogClient;
       
   189 
       
   190         /// Own: File System session
       
   191         RFs iFsSession;
       
   192 
       
   193         /// Own: Log db observer class.
       
   194         CMceLogNotify* iLogNotify;
       
   195 
       
   196         /// Ref: Engine observer.
       
   197         MMceLogEngObserver* iContainerObserver;
       
   198 
       
   199         /// Own: Foreground / Background indicator
       
   200         TBool iForeground;
       
   201 
       
   202         /// Own: DB changed / Not changed indicator
       
   203         TBool iDbDirty;
       
   204 
       
   205         /// Own: event matcher with phonebook
       
   206         CMceLogPbkMatcher* iPbkMatcher;
       
   207 
       
   208     };
       
   209 
       
   210 
       
   211 #endif // __Mce_Engine_CMceLogEngine_H__
       
   212 
       
   213 
       
   214 // End of file