2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: History Log info
17 ///////////////////////////////////////////////////////////////////////////////
22 ///////////////////////////////////////////////////////////////////////////////
23 #ifndef __SYNCMLHISTORY_H__
24 #define __SYNCMLHISTORY_H__
30 #include <SyncMLDef.h>
33 class CSmlHistoryEntrySet;
35 /** Unique ID for Sync Job entry type. */
36 const TInt KSmlHistoryEntryJobTypeValue = 0x10009FA9;
37 const TUid KUidSmlHistoryEntryJob = { KSmlHistoryEntryJobTypeValue };
39 /** Unique ID for Push Msg entry type. */
40 const TInt KSmlHistoryEntryPushMsgTypeValue = 0x10009FAA;
41 const TUid KUidSmlHistoryEntryPushMsg = { KSmlHistoryEntryPushMsgTypeValue };
43 /** Panic codes for shared History Log classes. */
44 enum TSmlPanicHistoryShared
46 ESmlPanicHistoryShared_BadTaskId,
47 ESmlPanicHistoryShared_BadSortOrdering
51 ///////////////////////////////////////////////////////////////////////////////
52 // CSyncMLHistoryEntry
53 ///////////////////////////////////////////////////////////////////////////////
54 class CSyncMLHistoryEntry : public CBase
56 Base class for a history log entry.
58 Not intended for user derivation. Derived classes:
59 @see CSyncMLHistoryJob
66 /** An ordering of History Entries. */
69 /** Ordered by Time Stamp. */
71 /** Ordered by Entry Type. */
75 // Factory methods based upon entry type.
76 IMPORT_C static CSyncMLHistoryEntry* NewL(TUid aEntryType);
77 IMPORT_C static CSyncMLHistoryEntry* NewL(RReadStream&);
78 IMPORT_C static CSyncMLHistoryEntry* NewL(const CSyncMLHistoryEntry&);
80 IMPORT_C virtual ~CSyncMLHistoryEntry();
81 IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
82 IMPORT_C TUid EntryType() const;
83 IMPORT_C TInt EntryId() const;
84 virtual TSmlProfileId Profile() const = 0;
85 virtual TTime TimeStamp() const = 0;
86 virtual TInt ResultCode() const = 0;
89 CSyncMLHistoryEntry(TUid);
90 /** @internalTechnology */
91 IMPORT_C static CSyncMLHistoryEntry* DoDynamicCast(TUid aEntryType, CSyncMLHistoryEntry*);
92 /** @internalTechnology */
93 IMPORT_C static const CSyncMLHistoryEntry* DoDynamicCast(TUid aEntryType, const CSyncMLHistoryEntry*);
94 virtual void InternalizeL(RReadStream&);
96 friend class CEntrySet;
97 IMPORT_C void SetEntryId(TInt);
98 IMPORT_C virtual TAny* Reserved(TUid);
105 ///////////////////////////////////////////////////////////////////////////////
106 ///////////////////////////////////////////////////////////////////////////////
108 ///////////////////////////////////////////////////////////////////////////////
110 ///////////////////////////////////////////////////////////////////////////////
111 class CSyncMLHistoryJob : public CSyncMLHistoryEntry
113 This class holds the result of a session with a server.
121 This class identifies a sync task within the profile,
122 and the result of the attempt to synchronise it.
126 IMPORT_C TTaskInfo();
127 IMPORT_C void InternalizeL(RReadStream&);
128 IMPORT_C void ExternalizeL(RWriteStream&) const;
130 /** Identifies the profile sync task */
132 /** Indicates the synchronisation result */
134 /** Indicates the number of items added to the db */
136 /** Indicates the number of items modified in the db */
138 /** Indicates the number of items deleted from the db */
140 /** Indicates the number of items moved in the db */
142 /** Indicates the number of items failed to modify the db */
144 /** Indicates the number of items added to the server's db */
145 TInt iServerItemsAdded;
146 /** Indicates the number of items modified in the server's db */
147 TInt iServerItemsChanged;
148 /** Indicates the number of items deleted from the server's db */
149 TInt iServerItemsDeleted;
150 /** Indicates the number of items moved in the server's db */
151 TInt iServerItemsMoved;
152 /** Indicates the number of items failed to modify the server's db */
153 TInt iServerItemsFailed;
154 /** Indicates the actual SyncType used for the synchronisation */
155 TSmlSyncType iSyncType;
158 inline static CSyncMLHistoryJob* DynamicCast(CSyncMLHistoryEntry*);
159 inline static const CSyncMLHistoryJob* DynamicCast(const CSyncMLHistoryEntry*);
160 IMPORT_C static CSyncMLHistoryJob* NewL();
161 IMPORT_C static CSyncMLHistoryJob* NewL(TSmlProfileId, const RArray<TSmlTaskId>&);
162 IMPORT_C virtual ~CSyncMLHistoryJob();
163 IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
165 IMPORT_C virtual TSmlProfileId Profile() const;
166 IMPORT_C virtual TTime TimeStamp() const;
167 IMPORT_C TTime LastSuccessSyncTime() const;
168 IMPORT_C virtual TInt ResultCode() const;
169 IMPORT_C TTime FinishTime() const;
170 IMPORT_C TInt TaskCount() const;
171 IMPORT_C const TTaskInfo& TaskAt(TInt) const;
173 IMPORT_C TTaskInfo& TaskById(TSmlTaskId);
174 IMPORT_C void SetResult(TTime aFinishTime, TInt aResultCode);
175 IMPORT_C void SetLastSyncResult(TTime aSuccessSyncTime );
178 void ConstructL(TSmlProfileId, const RArray<TSmlTaskId>&);
179 virtual void InternalizeL(RReadStream&);
184 TSmlProfileId iProfileId;
185 RArray<TTaskInfo> iTaskInfo;
186 TTime iLastSuccessSync;
189 ///////////////////////////////////////////////////////////////////////////////
190 inline CSyncMLHistoryJob* CSyncMLHistoryJob::DynamicCast(CSyncMLHistoryEntry* aEntry)
192 return static_cast<CSyncMLHistoryJob*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryJob, aEntry));
195 inline const CSyncMLHistoryJob* CSyncMLHistoryJob::DynamicCast(const CSyncMLHistoryEntry* aEntry)
197 return static_cast<const CSyncMLHistoryJob*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryJob, aEntry));
200 ///////////////////////////////////////////////////////////////////////////////
201 ///////////////////////////////////////////////////////////////////////////////
203 ///////////////////////////////////////////////////////////////////////////////
204 // CSyncMLHistoryPushMsg
205 ///////////////////////////////////////////////////////////////////////////////
206 class CSyncMLHistoryPushMsg : public CSyncMLHistoryEntry
208 This class holds the result of a parsing a push msg.
209 This class contains a counter that stores how many times the same message has been received.
215 inline static CSyncMLHistoryPushMsg* DynamicCast(CSyncMLHistoryEntry*);
216 inline static const CSyncMLHistoryPushMsg* DynamicCast(const CSyncMLHistoryEntry*);
217 IMPORT_C static CSyncMLHistoryPushMsg* NewL();
218 IMPORT_C virtual ~CSyncMLHistoryPushMsg();
219 IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
221 IMPORT_C virtual TSmlProfileId Profile() const;
222 IMPORT_C virtual TTime TimeStamp() const;
223 IMPORT_C virtual TInt ResultCode() const;
224 IMPORT_C TInt ReceivedCount() const;
225 IMPORT_C const TDesC8& MsgDigest() const;
226 IMPORT_C TInt AlertCount() const;
227 IMPORT_C const CSmlAlertInfo& Alert(TInt aIndex) const;
229 IMPORT_C void IncReceivedCount();
230 IMPORT_C void SetMsgDigest(const TDesC8&);
231 IMPORT_C void AddAlertsL(RPointerArray<CSmlAlertInfo>&); // Ownership of CSmlAlertInfo objects is transferred.
232 IMPORT_C void ResetAlerts();
233 IMPORT_C void SetResultCode(TInt aResultCode);
236 CSyncMLHistoryPushMsg();
237 virtual void InternalizeL(RReadStream&);
242 TBuf8<MD5_HASH> iDigest;
243 RPointerArray<CSmlAlertInfo> iAlerts;
246 ///////////////////////////////////////////////////////////////////////////////
247 inline CSyncMLHistoryPushMsg* CSyncMLHistoryPushMsg::DynamicCast(CSyncMLHistoryEntry* aEntry)
249 return static_cast<CSyncMLHistoryPushMsg*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryPushMsg, aEntry));
252 inline const CSyncMLHistoryPushMsg* CSyncMLHistoryPushMsg::DynamicCast(const CSyncMLHistoryEntry* aEntry)
254 return static_cast<const CSyncMLHistoryPushMsg*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryPushMsg, aEntry));
257 ///////////////////////////////////////////////////////////////////////////////
258 ///////////////////////////////////////////////////////////////////////////////
260 ///////////////////////////////////////////////////////////////////////////////
261 ///////////////////////////////////////////////////////////////////////////////
262 ///////////////////////////////////////////////////////////////////////////////