epoc32/include/SyncMLHistory.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/SyncMLHistory.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,265 @@
     1.4 +/*
     1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* 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
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: History Log info
    1.18 +*
    1.19 +*/
    1.20 +///////////////////////////////////////////////////////////////////////////////
    1.21 +// SyncMLHistory.h
    1.22 +//
    1.23 +// v05
    1.24 +//
    1.25 +///////////////////////////////////////////////////////////////////////////////
    1.26 +#ifndef __SYNCMLHISTORY_H__
    1.27 +#define __SYNCMLHISTORY_H__
    1.28 +//
    1.29 +#include <e32base.h>
    1.30 +#include <s32strm.h>
    1.31 +#include <hash.h>
    1.32 +//
    1.33 +#include <syncmldef.h>
    1.34 +//
    1.35 +class CSmlAlertInfo;
    1.36 +class CSmlHistoryEntrySet;
    1.37 +//
    1.38 +/** Unique ID for Sync Job entry type. */
    1.39 +const TInt KSmlHistoryEntryJobTypeValue = 0x10009FA9;
    1.40 +const TUid KUidSmlHistoryEntryJob = { KSmlHistoryEntryJobTypeValue };
    1.41 +//
    1.42 +/** Unique ID for Push Msg entry type. */
    1.43 +const TInt KSmlHistoryEntryPushMsgTypeValue = 0x10009FAA;
    1.44 +const TUid KUidSmlHistoryEntryPushMsg = { KSmlHistoryEntryPushMsgTypeValue };
    1.45 +//
    1.46 +/** Panic codes for shared History Log classes. */
    1.47 +enum TSmlPanicHistoryShared
    1.48 +	{
    1.49 +	ESmlPanicHistoryShared_BadTaskId,
    1.50 +	ESmlPanicHistoryShared_BadSortOrdering
    1.51 +	};
    1.52 +//
    1.53 +
    1.54 +///////////////////////////////////////////////////////////////////////////////
    1.55 +// CSyncMLHistoryEntry
    1.56 +///////////////////////////////////////////////////////////////////////////////
    1.57 +class CSyncMLHistoryEntry : public CBase
    1.58 +/**
    1.59 +	Base class for a history log entry.
    1.60 +
    1.61 +	Not intended for user derivation. Derived classes: 
    1.62 +	@see CSyncMLHistoryJob 
    1.63 +
    1.64 +	@publishedAll
    1.65 +	@released
    1.66 +  */
    1.67 +	{
    1.68 +public:
    1.69 +	/** An ordering of History Entries. */
    1.70 +	enum TSortOrder
    1.71 +		{
    1.72 +		/** Ordered by Time Stamp. */
    1.73 +		ESortByTime,
    1.74 +		/** Ordered by Entry Type. */
    1.75 +		ESortByType
    1.76 +		};
    1.77 +public:
    1.78 +	// Factory methods based upon entry type.
    1.79 +	IMPORT_C static CSyncMLHistoryEntry* NewL(TUid aEntryType);
    1.80 +	IMPORT_C static CSyncMLHistoryEntry* NewL(RReadStream&);
    1.81 +	IMPORT_C static CSyncMLHistoryEntry* NewL(const CSyncMLHistoryEntry&);
    1.82 +public:
    1.83 +	IMPORT_C virtual ~CSyncMLHistoryEntry();
    1.84 +	IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
    1.85 +	IMPORT_C TUid EntryType() const;
    1.86 +	IMPORT_C TInt EntryId() const;
    1.87 +	virtual TSmlProfileId Profile() const = 0;
    1.88 +	virtual TTime TimeStamp() const = 0;
    1.89 +	virtual TInt ResultCode() const = 0;
    1.90 +
    1.91 +protected:
    1.92 +	CSyncMLHistoryEntry(TUid);
    1.93 +	/** @internalTechnology */
    1.94 +	IMPORT_C static CSyncMLHistoryEntry* DoDynamicCast(TUid aEntryType, CSyncMLHistoryEntry*);
    1.95 +	/** @internalTechnology */
    1.96 +	IMPORT_C static const CSyncMLHistoryEntry* DoDynamicCast(TUid aEntryType, const CSyncMLHistoryEntry*);
    1.97 +	virtual void InternalizeL(RReadStream&);
    1.98 +private:
    1.99 +	friend class CEntrySet;
   1.100 +	IMPORT_C void SetEntryId(TInt);
   1.101 +	IMPORT_C virtual TAny* Reserved(TUid);
   1.102 +private:
   1.103 +	TUid iEntryType;
   1.104 +	TInt iEntryId;
   1.105 +	TInt iSpare;
   1.106 +	};
   1.107 +
   1.108 +///////////////////////////////////////////////////////////////////////////////
   1.109 +///////////////////////////////////////////////////////////////////////////////
   1.110 +
   1.111 +///////////////////////////////////////////////////////////////////////////////
   1.112 +// CSyncMLHistoryJob
   1.113 +///////////////////////////////////////////////////////////////////////////////
   1.114 +class CSyncMLHistoryJob : public CSyncMLHistoryEntry
   1.115 +/**
   1.116 +	This class holds the result of a session with a server.
   1.117 +	@publishedAll
   1.118 +	@released
   1.119 +*/
   1.120 +	{
   1.121 +public:
   1.122 +	class TTaskInfo
   1.123 +	/**
   1.124 +		This class identifies a sync task within the profile,
   1.125 +		and the result of the attempt to synchronise it.
   1.126 +	*/
   1.127 +		{
   1.128 +	public:
   1.129 +		IMPORT_C TTaskInfo();
   1.130 +		IMPORT_C void InternalizeL(RReadStream&);
   1.131 +		IMPORT_C void ExternalizeL(RWriteStream&) const;
   1.132 +	public:
   1.133 +		/** Identifies the profile sync task */
   1.134 +		TSmlTaskId iTaskId;
   1.135 +		/** Indicates the synchronisation result */
   1.136 +		TInt iError;
   1.137 +		/** Indicates the number of items added to the db */
   1.138 +		TInt iItemsAdded;
   1.139 +		/** Indicates the number of items modified in the db */
   1.140 +		TInt iItemsChanged;
   1.141 +		/** Indicates the number of items deleted from the db */
   1.142 +		TInt iItemsDeleted;
   1.143 +		/** Indicates the number of items moved in the db */
   1.144 +		TInt iItemsMoved;
   1.145 +		/** Indicates the number of items failed to modify the db */
   1.146 +		TInt iItemsFailed;
   1.147 +		/** Indicates the number of items added to the server's db */
   1.148 +		TInt iServerItemsAdded;
   1.149 +		/** Indicates the number of items modified in the server's db */
   1.150 +		TInt iServerItemsChanged;
   1.151 +		/** Indicates the number of items deleted from the server's db */
   1.152 +		TInt iServerItemsDeleted;
   1.153 +		/** Indicates the number of items moved in the server's db */
   1.154 +		TInt iServerItemsMoved;
   1.155 +		/** Indicates the number of items failed to modify the server's db */
   1.156 +		TInt iServerItemsFailed;
   1.157 +		/** Indicates the actual SyncType used for the synchronisation */
   1.158 +		TSmlSyncType iSyncType;
   1.159 +		};
   1.160 +public:
   1.161 +	inline static CSyncMLHistoryJob* DynamicCast(CSyncMLHistoryEntry*);
   1.162 +	inline static const CSyncMLHistoryJob* DynamicCast(const CSyncMLHistoryEntry*);
   1.163 +	IMPORT_C static CSyncMLHistoryJob* NewL();
   1.164 +	IMPORT_C static CSyncMLHistoryJob* NewL(TSmlProfileId, const RArray<TSmlTaskId>&);
   1.165 +	IMPORT_C virtual ~CSyncMLHistoryJob();
   1.166 +	IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
   1.167 +public:
   1.168 +	IMPORT_C virtual TSmlProfileId Profile() const;
   1.169 +	IMPORT_C virtual TTime TimeStamp() const;
   1.170 +	IMPORT_C TTime LastSuccessSyncTime() const; 
   1.171 +	IMPORT_C virtual TInt ResultCode() const;
   1.172 +	IMPORT_C TTime FinishTime() const;
   1.173 +	IMPORT_C TInt TaskCount() const;
   1.174 +	IMPORT_C const TTaskInfo& TaskAt(TInt) const;
   1.175 +public:
   1.176 +	IMPORT_C TTaskInfo& TaskById(TSmlTaskId);
   1.177 +	IMPORT_C void SetResult(TTime aFinishTime, TInt aResultCode);
   1.178 +	IMPORT_C void SetLastSyncResult(TTime aSuccessSyncTime );
   1.179 +private:
   1.180 +	CSyncMLHistoryJob();
   1.181 +	void ConstructL(TSmlProfileId, const RArray<TSmlTaskId>&);
   1.182 +	virtual void InternalizeL(RReadStream&);
   1.183 +private:
   1.184 +	TTime iStartTime;
   1.185 +	TTime iFinishTime;
   1.186 +	TInt iResultCode;
   1.187 +	TSmlProfileId iProfileId;
   1.188 +	RArray<TTaskInfo> iTaskInfo;
   1.189 +	TTime iLastSuccessSync;
   1.190 +	};
   1.191 +
   1.192 +///////////////////////////////////////////////////////////////////////////////
   1.193 +inline CSyncMLHistoryJob* CSyncMLHistoryJob::DynamicCast(CSyncMLHistoryEntry* aEntry)
   1.194 +	{
   1.195 +	return static_cast<CSyncMLHistoryJob*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryJob, aEntry));
   1.196 +	}
   1.197 +
   1.198 +inline const CSyncMLHistoryJob* CSyncMLHistoryJob::DynamicCast(const CSyncMLHistoryEntry* aEntry)
   1.199 +	{
   1.200 +	return static_cast<const CSyncMLHistoryJob*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryJob, aEntry));
   1.201 +	}
   1.202 +
   1.203 +///////////////////////////////////////////////////////////////////////////////
   1.204 +///////////////////////////////////////////////////////////////////////////////
   1.205 +
   1.206 +///////////////////////////////////////////////////////////////////////////////
   1.207 +// CSyncMLHistoryPushMsg
   1.208 +///////////////////////////////////////////////////////////////////////////////
   1.209 +class CSyncMLHistoryPushMsg : public CSyncMLHistoryEntry
   1.210 +/**
   1.211 +	This class holds the result of a parsing a push msg.
   1.212 +	This class contains a counter that stores how many times the same message has been received.
   1.213 +	@publishedAll
   1.214 +	@released
   1.215 +*/
   1.216 +	{
   1.217 +public:
   1.218 +	inline static CSyncMLHistoryPushMsg* DynamicCast(CSyncMLHistoryEntry*);
   1.219 +	inline static const CSyncMLHistoryPushMsg* DynamicCast(const CSyncMLHistoryEntry*);
   1.220 +	IMPORT_C static CSyncMLHistoryPushMsg* NewL();
   1.221 +	IMPORT_C virtual ~CSyncMLHistoryPushMsg();
   1.222 +	IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
   1.223 +public:
   1.224 +	IMPORT_C virtual TSmlProfileId Profile() const;
   1.225 +	IMPORT_C virtual TTime TimeStamp() const;
   1.226 +	IMPORT_C virtual TInt ResultCode() const;
   1.227 +	IMPORT_C TInt ReceivedCount() const;
   1.228 +	IMPORT_C const TDesC8& MsgDigest() const;
   1.229 +	IMPORT_C TInt AlertCount() const;
   1.230 +	IMPORT_C const CSmlAlertInfo& Alert(TInt aIndex) const;
   1.231 +public:
   1.232 +	IMPORT_C void IncReceivedCount();
   1.233 +	IMPORT_C void SetMsgDigest(const TDesC8&);
   1.234 +	IMPORT_C void AddAlertsL(RPointerArray<CSmlAlertInfo>&); // Ownership of CSmlAlertInfo objects is transferred.
   1.235 +	IMPORT_C void ResetAlerts();
   1.236 +	IMPORT_C void SetResultCode(TInt aResultCode);
   1.237 +
   1.238 +private:
   1.239 +	CSyncMLHistoryPushMsg();
   1.240 +	virtual void InternalizeL(RReadStream&);
   1.241 +private:
   1.242 +	TTime iTimeStamp;
   1.243 +	TInt iResultCode;
   1.244 +	TInt iRcvCount;
   1.245 +	TBuf8<MD5_HASH> iDigest;
   1.246 +	RPointerArray<CSmlAlertInfo> iAlerts;
   1.247 +	};
   1.248 +
   1.249 +///////////////////////////////////////////////////////////////////////////////
   1.250 +inline CSyncMLHistoryPushMsg* CSyncMLHistoryPushMsg::DynamicCast(CSyncMLHistoryEntry* aEntry)
   1.251 +	{
   1.252 +	return static_cast<CSyncMLHistoryPushMsg*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryPushMsg, aEntry));
   1.253 +	}
   1.254 +
   1.255 +inline const CSyncMLHistoryPushMsg* CSyncMLHistoryPushMsg::DynamicCast(const CSyncMLHistoryEntry* aEntry)
   1.256 +	{
   1.257 +	return static_cast<const CSyncMLHistoryPushMsg*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryPushMsg, aEntry));
   1.258 +	}
   1.259 +
   1.260 +///////////////////////////////////////////////////////////////////////////////
   1.261 +///////////////////////////////////////////////////////////////////////////////
   1.262 +
   1.263 +///////////////////////////////////////////////////////////////////////////////
   1.264 +///////////////////////////////////////////////////////////////////////////////
   1.265 +///////////////////////////////////////////////////////////////////////////////
   1.266 +#endif
   1.267 +
   1.268 +