epoc32/include/SyncMLHistory.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /*
     2 * Copyright (c) 2009 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: History Log info
    15 *
    16 */
    17 ///////////////////////////////////////////////////////////////////////////////
    18 // SyncMLHistory.h
    19 //
    20 // v05
    21 //
    22 ///////////////////////////////////////////////////////////////////////////////
    23 #ifndef __SYNCMLHISTORY_H__
    24 #define __SYNCMLHISTORY_H__
    25 //
    26 #include <e32base.h>
    27 #include <s32strm.h>
    28 #include <hash.h>
    29 //
    30 #include <syncmldef.h>
    31 //
    32 class CSmlAlertInfo;
    33 class CSmlHistoryEntrySet;
    34 //
    35 /** Unique ID for Sync Job entry type. */
    36 const TInt KSmlHistoryEntryJobTypeValue = 0x10009FA9;
    37 const TUid KUidSmlHistoryEntryJob = { KSmlHistoryEntryJobTypeValue };
    38 //
    39 /** Unique ID for Push Msg entry type. */
    40 const TInt KSmlHistoryEntryPushMsgTypeValue = 0x10009FAA;
    41 const TUid KUidSmlHistoryEntryPushMsg = { KSmlHistoryEntryPushMsgTypeValue };
    42 //
    43 /** Panic codes for shared History Log classes. */
    44 enum TSmlPanicHistoryShared
    45 	{
    46 	ESmlPanicHistoryShared_BadTaskId,
    47 	ESmlPanicHistoryShared_BadSortOrdering
    48 	};
    49 //
    50 
    51 ///////////////////////////////////////////////////////////////////////////////
    52 // CSyncMLHistoryEntry
    53 ///////////////////////////////////////////////////////////////////////////////
    54 class CSyncMLHistoryEntry : public CBase
    55 /**
    56 	Base class for a history log entry.
    57 
    58 	Not intended for user derivation. Derived classes: 
    59 	@see CSyncMLHistoryJob 
    60 
    61 	@publishedAll
    62 	@released
    63   */
    64 	{
    65 public:
    66 	/** An ordering of History Entries. */
    67 	enum TSortOrder
    68 		{
    69 		/** Ordered by Time Stamp. */
    70 		ESortByTime,
    71 		/** Ordered by Entry Type. */
    72 		ESortByType
    73 		};
    74 public:
    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&);
    79 public:
    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;
    87 
    88 protected:
    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&);
    95 private:
    96 	friend class CEntrySet;
    97 	IMPORT_C void SetEntryId(TInt);
    98 	IMPORT_C virtual TAny* Reserved(TUid);
    99 private:
   100 	TUid iEntryType;
   101 	TInt iEntryId;
   102 	TInt iSpare;
   103 	};
   104 
   105 ///////////////////////////////////////////////////////////////////////////////
   106 ///////////////////////////////////////////////////////////////////////////////
   107 
   108 ///////////////////////////////////////////////////////////////////////////////
   109 // CSyncMLHistoryJob
   110 ///////////////////////////////////////////////////////////////////////////////
   111 class CSyncMLHistoryJob : public CSyncMLHistoryEntry
   112 /**
   113 	This class holds the result of a session with a server.
   114 	@publishedAll
   115 	@released
   116 */
   117 	{
   118 public:
   119 	class TTaskInfo
   120 	/**
   121 		This class identifies a sync task within the profile,
   122 		and the result of the attempt to synchronise it.
   123 	*/
   124 		{
   125 	public:
   126 		IMPORT_C TTaskInfo();
   127 		IMPORT_C void InternalizeL(RReadStream&);
   128 		IMPORT_C void ExternalizeL(RWriteStream&) const;
   129 	public:
   130 		/** Identifies the profile sync task */
   131 		TSmlTaskId iTaskId;
   132 		/** Indicates the synchronisation result */
   133 		TInt iError;
   134 		/** Indicates the number of items added to the db */
   135 		TInt iItemsAdded;
   136 		/** Indicates the number of items modified in the db */
   137 		TInt iItemsChanged;
   138 		/** Indicates the number of items deleted from the db */
   139 		TInt iItemsDeleted;
   140 		/** Indicates the number of items moved in the db */
   141 		TInt iItemsMoved;
   142 		/** Indicates the number of items failed to modify the db */
   143 		TInt iItemsFailed;
   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;
   156 		};
   157 public:
   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;
   164 public:
   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;
   172 public:
   173 	IMPORT_C TTaskInfo& TaskById(TSmlTaskId);
   174 	IMPORT_C void SetResult(TTime aFinishTime, TInt aResultCode);
   175 	IMPORT_C void SetLastSyncResult(TTime aSuccessSyncTime );
   176 private:
   177 	CSyncMLHistoryJob();
   178 	void ConstructL(TSmlProfileId, const RArray<TSmlTaskId>&);
   179 	virtual void InternalizeL(RReadStream&);
   180 private:
   181 	TTime iStartTime;
   182 	TTime iFinishTime;
   183 	TInt iResultCode;
   184 	TSmlProfileId iProfileId;
   185 	RArray<TTaskInfo> iTaskInfo;
   186 	TTime iLastSuccessSync;
   187 	};
   188 
   189 ///////////////////////////////////////////////////////////////////////////////
   190 inline CSyncMLHistoryJob* CSyncMLHistoryJob::DynamicCast(CSyncMLHistoryEntry* aEntry)
   191 	{
   192 	return static_cast<CSyncMLHistoryJob*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryJob, aEntry));
   193 	}
   194 
   195 inline const CSyncMLHistoryJob* CSyncMLHistoryJob::DynamicCast(const CSyncMLHistoryEntry* aEntry)
   196 	{
   197 	return static_cast<const CSyncMLHistoryJob*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryJob, aEntry));
   198 	}
   199 
   200 ///////////////////////////////////////////////////////////////////////////////
   201 ///////////////////////////////////////////////////////////////////////////////
   202 
   203 ///////////////////////////////////////////////////////////////////////////////
   204 // CSyncMLHistoryPushMsg
   205 ///////////////////////////////////////////////////////////////////////////////
   206 class CSyncMLHistoryPushMsg : public CSyncMLHistoryEntry
   207 /**
   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.
   210 	@publishedAll
   211 	@released
   212 */
   213 	{
   214 public:
   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;
   220 public:
   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;
   228 public:
   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);
   234 
   235 private:
   236 	CSyncMLHistoryPushMsg();
   237 	virtual void InternalizeL(RReadStream&);
   238 private:
   239 	TTime iTimeStamp;
   240 	TInt iResultCode;
   241 	TInt iRcvCount;
   242 	TBuf8<MD5_HASH> iDigest;
   243 	RPointerArray<CSmlAlertInfo> iAlerts;
   244 	};
   245 
   246 ///////////////////////////////////////////////////////////////////////////////
   247 inline CSyncMLHistoryPushMsg* CSyncMLHistoryPushMsg::DynamicCast(CSyncMLHistoryEntry* aEntry)
   248 	{
   249 	return static_cast<CSyncMLHistoryPushMsg*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryPushMsg, aEntry));
   250 	}
   251 
   252 inline const CSyncMLHistoryPushMsg* CSyncMLHistoryPushMsg::DynamicCast(const CSyncMLHistoryEntry* aEntry)
   253 	{
   254 	return static_cast<const CSyncMLHistoryPushMsg*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryPushMsg, aEntry));
   255 	}
   256 
   257 ///////////////////////////////////////////////////////////////////////////////
   258 ///////////////////////////////////////////////////////////////////////////////
   259 
   260 ///////////////////////////////////////////////////////////////////////////////
   261 ///////////////////////////////////////////////////////////////////////////////
   262 ///////////////////////////////////////////////////////////////////////////////
   263 #endif
   264 
   265