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