mmsengine/mmsserver/inc/mmslog.h
changeset 0 72b543305e3a
child 26 ebe688cedc25
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 *     State machine for handling MMS log entries
       
    16 *     (sent messages and delivery reports)
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef MMSLOG_H
       
    23 #define MMSLOG_H
       
    24 
       
    25 //  INCLUDES
       
    26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    27 #include <logwraplimits.h>
       
    28 #endif
       
    29 #include <msvstd.h>
       
    30 #include <mentact.h>
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 enum TMmsLoggingState
       
    37     {
       
    38     EMmsLogIdle,
       
    39     EMmsLogFiltering,
       
    40     EMmsLogMatchingEntry,
       
    41     EMmsLogUpdatingEntry,
       
    42     EMmsLogCreatingEntry,
       
    43     EMmsLogAddingEventType,
       
    44     EMmsLogFinal
       
    45     };
       
    46 
       
    47 // FUNCTION PROTOTYPES
       
    48 
       
    49 // FORWARD DECLARATIONS
       
    50 class CLogClient;
       
    51 class CLogEvent;
       
    52 class CLogViewEvent;
       
    53 class CLogFilter;
       
    54 class CLogFilterList;
       
    55 
       
    56 // CLASS DECLARATION
       
    57 
       
    58 /**
       
    59 *  State machine that handles log database for MMS.
       
    60 */
       
    61 class CMmsLog :public CMsgActive
       
    62     {
       
    63     public:  // Constructors and destructor
       
    64         
       
    65         /**
       
    66         * Two-phased constructor.
       
    67         * @param aLogClient instance of log client. Caller creates for reusability
       
    68         * @param aLogViewEvent common settings for the event. Only remote party will vary
       
    69         */
       
    70         static CMmsLog* NewL( CLogClient& aLogClient, CLogViewEvent& aLogViewEvent, RFs& aFs );
       
    71         
       
    72         /**
       
    73         * Destructor.
       
    74         */
       
    75         virtual ~CMmsLog();
       
    76 
       
    77     public: // New functions
       
    78 
       
    79         /**
       
    80         * Start the state machine
       
    81         * @param aLogEvent common settings for an event. <br>
       
    82         *     aLog Event will contain the filter keys to be used.<br>
       
    83         *     (event type and message id (delivery report) or
       
    84         *     message entry id (sent messages)
       
    85         * @param aRemoteParties list of remote parties (pure addresses)
       
    86         * @param aStatus status of the calling active object
       
    87         */
       
    88         void StartL( CLogEvent& aLogEvent, CDesCArray& aRemoteParties, TRequestStatus& aStatus );
       
    89         
       
    90         TLogLink GetLink();
       
    91         
       
    92     public: // Functions from base classes
       
    93 
       
    94     protected:  // New functions
       
    95         
       
    96     protected:  // Functions from base classes
       
    97         
       
    98     private:
       
    99 
       
   100         /**
       
   101         * C++ default constructor.
       
   102         */
       
   103         CMmsLog( CLogClient& aLogClient, CLogViewEvent& aLogViewEvent );
       
   104 
       
   105         /**
       
   106         * By default Symbian OS constructor is private.
       
   107         */
       
   108         void ConstructL( RFs& aFs );
       
   109 
       
   110         // By default, prohibit copy constructor
       
   111         CMmsLog( const CMmsLog& );
       
   112         // Prohibit assignment operator
       
   113         CMmsLog& operator= ( const CMmsLog& );
       
   114 
       
   115         /**
       
   116         * Active object completion
       
   117         */
       
   118         void RunL();
       
   119 
       
   120         /**
       
   121         * Active object completion
       
   122         */
       
   123         void DoRunL();
       
   124 
       
   125         /**
       
   126         * Sweep the floor after everything has crashed
       
   127         */
       
   128         void DoComplete( TInt& aStatus );
       
   129 
       
   130         /**
       
   131         * Select next state for state machine
       
   132         */
       
   133         void SelectNextState();
       
   134 
       
   135         /**
       
   136         * Switch states
       
   137         */
       
   138         void ChangeStateL();
       
   139 
       
   140         /**
       
   141         * Find matching entries
       
   142         */
       
   143         void FilterL();
       
   144 
       
   145         /**
       
   146         * Check if found entry matches
       
   147         */
       
   148         void MatchEntryL();
       
   149         
       
   150         /**
       
   151         * Matching entry in log - update it
       
   152         */
       
   153         void UpdateEntryL();
       
   154 
       
   155         /**
       
   156         * Create a new entry into log
       
   157         */
       
   158         void CreateEntryL();
       
   159 
       
   160         /**
       
   161         * Add MMS Event Type
       
   162         */
       
   163         void AddEventTypeL();
       
   164 
       
   165 
       
   166     public:     // Data
       
   167     
       
   168     protected:  // Data
       
   169 
       
   170     private:    // Data
       
   171         RFs             iFs; // file system
       
   172         // State machine state
       
   173         TInt            iState;
       
   174         TInt            iError;
       
   175         // The log classes are instantiated by the caller
       
   176         // because the classes may be reused to add several
       
   177         // entries to logs.
       
   178         CLogClient&     iLogClient;     // caller opens this
       
   179         CLogViewEvent&  iLogViewEvent;  // caller provides this
       
   180         CLogEvent*      iLogEvent;      // caller provides this
       
   181         CLogFilterList* iFilterList;    // this is ours
       
   182         CDesCArray*     iRemoteParties; // caller provides this
       
   183         CLogEvent*      iLogUpdatedEvent; // We need this to update entries
       
   184         CLogEventType*  iLogEventType;  // to add mms event type      
       
   185 
       
   186         // sent entries are filtered by entry id
       
   187         TMsvId          iEntryId;
       
   188         // delivery reports are filtered by message id
       
   189         TPtrC8          iMessageId;
       
   190         TInt            iCurrentRemoteParty;
       
   191         TBool           iEvents; // filter results
       
   192         TBool           iEventMatched; // matching event found from the log
       
   193         TBool           iEventTypeAdded; // try adding only once
       
   194         
       
   195         TLogLink iLastMatchedLink;  
       
   196 
       
   197         TBuf<KLogMaxRemotePartyLength> iAlias; // alias for phone number
       
   198 
       
   199     public:     // Friend classes
       
   200     protected:  // Friend classes
       
   201     private:    // Friend classes
       
   202 
       
   203     };
       
   204 
       
   205 #endif      // MMSLOG_H   
       
   206             
       
   207 // End of File