epoc32/include/SyncMLHistory.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: History Log info
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
///////////////////////////////////////////////////////////////////////////////
williamr@2
    18
// SyncMLHistory.h
williamr@2
    19
//
williamr@2
    20
// v05
williamr@2
    21
//
williamr@2
    22
///////////////////////////////////////////////////////////////////////////////
williamr@2
    23
#ifndef __SYNCMLHISTORY_H__
williamr@2
    24
#define __SYNCMLHISTORY_H__
williamr@2
    25
//
williamr@2
    26
#include <e32base.h>
williamr@2
    27
#include <s32strm.h>
williamr@2
    28
#include <hash.h>
williamr@2
    29
//
williamr@4
    30
#include <SyncMLDef.h>
williamr@2
    31
//
williamr@2
    32
class CSmlAlertInfo;
williamr@2
    33
class CSmlHistoryEntrySet;
williamr@2
    34
//
williamr@2
    35
/** Unique ID for Sync Job entry type. */
williamr@2
    36
const TInt KSmlHistoryEntryJobTypeValue = 0x10009FA9;
williamr@2
    37
const TUid KUidSmlHistoryEntryJob = { KSmlHistoryEntryJobTypeValue };
williamr@2
    38
//
williamr@2
    39
/** Unique ID for Push Msg entry type. */
williamr@2
    40
const TInt KSmlHistoryEntryPushMsgTypeValue = 0x10009FAA;
williamr@2
    41
const TUid KUidSmlHistoryEntryPushMsg = { KSmlHistoryEntryPushMsgTypeValue };
williamr@2
    42
//
williamr@2
    43
/** Panic codes for shared History Log classes. */
williamr@2
    44
enum TSmlPanicHistoryShared
williamr@2
    45
	{
williamr@2
    46
	ESmlPanicHistoryShared_BadTaskId,
williamr@2
    47
	ESmlPanicHistoryShared_BadSortOrdering
williamr@2
    48
	};
williamr@2
    49
//
williamr@2
    50
williamr@2
    51
///////////////////////////////////////////////////////////////////////////////
williamr@2
    52
// CSyncMLHistoryEntry
williamr@2
    53
///////////////////////////////////////////////////////////////////////////////
williamr@2
    54
class CSyncMLHistoryEntry : public CBase
williamr@2
    55
/**
williamr@2
    56
	Base class for a history log entry.
williamr@2
    57
williamr@2
    58
	Not intended for user derivation. Derived classes: 
williamr@2
    59
	@see CSyncMLHistoryJob 
williamr@2
    60
williamr@2
    61
	@publishedAll
williamr@2
    62
	@released
williamr@2
    63
  */
williamr@2
    64
	{
williamr@2
    65
public:
williamr@2
    66
	/** An ordering of History Entries. */
williamr@2
    67
	enum TSortOrder
williamr@2
    68
		{
williamr@2
    69
		/** Ordered by Time Stamp. */
williamr@2
    70
		ESortByTime,
williamr@2
    71
		/** Ordered by Entry Type. */
williamr@2
    72
		ESortByType
williamr@2
    73
		};
williamr@2
    74
public:
williamr@2
    75
	// Factory methods based upon entry type.
williamr@2
    76
	IMPORT_C static CSyncMLHistoryEntry* NewL(TUid aEntryType);
williamr@2
    77
	IMPORT_C static CSyncMLHistoryEntry* NewL(RReadStream&);
williamr@2
    78
	IMPORT_C static CSyncMLHistoryEntry* NewL(const CSyncMLHistoryEntry&);
williamr@2
    79
public:
williamr@2
    80
	IMPORT_C virtual ~CSyncMLHistoryEntry();
williamr@2
    81
	IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
williamr@2
    82
	IMPORT_C TUid EntryType() const;
williamr@2
    83
	IMPORT_C TInt EntryId() const;
williamr@2
    84
	virtual TSmlProfileId Profile() const = 0;
williamr@2
    85
	virtual TTime TimeStamp() const = 0;
williamr@2
    86
	virtual TInt ResultCode() const = 0;
williamr@2
    87
williamr@2
    88
protected:
williamr@2
    89
	CSyncMLHistoryEntry(TUid);
williamr@2
    90
	/** @internalTechnology */
williamr@2
    91
	IMPORT_C static CSyncMLHistoryEntry* DoDynamicCast(TUid aEntryType, CSyncMLHistoryEntry*);
williamr@2
    92
	/** @internalTechnology */
williamr@2
    93
	IMPORT_C static const CSyncMLHistoryEntry* DoDynamicCast(TUid aEntryType, const CSyncMLHistoryEntry*);
williamr@2
    94
	virtual void InternalizeL(RReadStream&);
williamr@2
    95
private:
williamr@2
    96
	friend class CEntrySet;
williamr@2
    97
	IMPORT_C void SetEntryId(TInt);
williamr@2
    98
	IMPORT_C virtual TAny* Reserved(TUid);
williamr@2
    99
private:
williamr@2
   100
	TUid iEntryType;
williamr@2
   101
	TInt iEntryId;
williamr@2
   102
	TInt iSpare;
williamr@2
   103
	};
williamr@2
   104
williamr@2
   105
///////////////////////////////////////////////////////////////////////////////
williamr@2
   106
///////////////////////////////////////////////////////////////////////////////
williamr@2
   107
williamr@2
   108
///////////////////////////////////////////////////////////////////////////////
williamr@2
   109
// CSyncMLHistoryJob
williamr@2
   110
///////////////////////////////////////////////////////////////////////////////
williamr@2
   111
class CSyncMLHistoryJob : public CSyncMLHistoryEntry
williamr@2
   112
/**
williamr@2
   113
	This class holds the result of a session with a server.
williamr@2
   114
	@publishedAll
williamr@2
   115
	@released
williamr@2
   116
*/
williamr@2
   117
	{
williamr@2
   118
public:
williamr@2
   119
	class TTaskInfo
williamr@2
   120
	/**
williamr@2
   121
		This class identifies a sync task within the profile,
williamr@2
   122
		and the result of the attempt to synchronise it.
williamr@2
   123
	*/
williamr@2
   124
		{
williamr@2
   125
	public:
williamr@2
   126
		IMPORT_C TTaskInfo();
williamr@2
   127
		IMPORT_C void InternalizeL(RReadStream&);
williamr@2
   128
		IMPORT_C void ExternalizeL(RWriteStream&) const;
williamr@2
   129
	public:
williamr@2
   130
		/** Identifies the profile sync task */
williamr@2
   131
		TSmlTaskId iTaskId;
williamr@2
   132
		/** Indicates the synchronisation result */
williamr@2
   133
		TInt iError;
williamr@2
   134
		/** Indicates the number of items added to the db */
williamr@2
   135
		TInt iItemsAdded;
williamr@2
   136
		/** Indicates the number of items modified in the db */
williamr@2
   137
		TInt iItemsChanged;
williamr@2
   138
		/** Indicates the number of items deleted from the db */
williamr@2
   139
		TInt iItemsDeleted;
williamr@2
   140
		/** Indicates the number of items moved in the db */
williamr@2
   141
		TInt iItemsMoved;
williamr@2
   142
		/** Indicates the number of items failed to modify the db */
williamr@2
   143
		TInt iItemsFailed;
williamr@2
   144
		/** Indicates the number of items added to the server's db */
williamr@2
   145
		TInt iServerItemsAdded;
williamr@2
   146
		/** Indicates the number of items modified in the server's db */
williamr@2
   147
		TInt iServerItemsChanged;
williamr@2
   148
		/** Indicates the number of items deleted from the server's db */
williamr@2
   149
		TInt iServerItemsDeleted;
williamr@2
   150
		/** Indicates the number of items moved in the server's db */
williamr@2
   151
		TInt iServerItemsMoved;
williamr@2
   152
		/** Indicates the number of items failed to modify the server's db */
williamr@2
   153
		TInt iServerItemsFailed;
williamr@2
   154
		/** Indicates the actual SyncType used for the synchronisation */
williamr@2
   155
		TSmlSyncType iSyncType;
williamr@2
   156
		};
williamr@2
   157
public:
williamr@2
   158
	inline static CSyncMLHistoryJob* DynamicCast(CSyncMLHistoryEntry*);
williamr@2
   159
	inline static const CSyncMLHistoryJob* DynamicCast(const CSyncMLHistoryEntry*);
williamr@2
   160
	IMPORT_C static CSyncMLHistoryJob* NewL();
williamr@2
   161
	IMPORT_C static CSyncMLHistoryJob* NewL(TSmlProfileId, const RArray<TSmlTaskId>&);
williamr@2
   162
	IMPORT_C virtual ~CSyncMLHistoryJob();
williamr@2
   163
	IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
williamr@2
   164
public:
williamr@2
   165
	IMPORT_C virtual TSmlProfileId Profile() const;
williamr@2
   166
	IMPORT_C virtual TTime TimeStamp() const;
williamr@2
   167
	IMPORT_C TTime LastSuccessSyncTime() const; 
williamr@2
   168
	IMPORT_C virtual TInt ResultCode() const;
williamr@2
   169
	IMPORT_C TTime FinishTime() const;
williamr@2
   170
	IMPORT_C TInt TaskCount() const;
williamr@2
   171
	IMPORT_C const TTaskInfo& TaskAt(TInt) const;
williamr@2
   172
public:
williamr@2
   173
	IMPORT_C TTaskInfo& TaskById(TSmlTaskId);
williamr@2
   174
	IMPORT_C void SetResult(TTime aFinishTime, TInt aResultCode);
williamr@2
   175
	IMPORT_C void SetLastSyncResult(TTime aSuccessSyncTime );
williamr@2
   176
private:
williamr@2
   177
	CSyncMLHistoryJob();
williamr@2
   178
	void ConstructL(TSmlProfileId, const RArray<TSmlTaskId>&);
williamr@2
   179
	virtual void InternalizeL(RReadStream&);
williamr@2
   180
private:
williamr@2
   181
	TTime iStartTime;
williamr@2
   182
	TTime iFinishTime;
williamr@2
   183
	TInt iResultCode;
williamr@2
   184
	TSmlProfileId iProfileId;
williamr@2
   185
	RArray<TTaskInfo> iTaskInfo;
williamr@2
   186
	TTime iLastSuccessSync;
williamr@2
   187
	};
williamr@2
   188
williamr@2
   189
///////////////////////////////////////////////////////////////////////////////
williamr@2
   190
inline CSyncMLHistoryJob* CSyncMLHistoryJob::DynamicCast(CSyncMLHistoryEntry* aEntry)
williamr@2
   191
	{
williamr@2
   192
	return static_cast<CSyncMLHistoryJob*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryJob, aEntry));
williamr@2
   193
	}
williamr@2
   194
williamr@2
   195
inline const CSyncMLHistoryJob* CSyncMLHistoryJob::DynamicCast(const CSyncMLHistoryEntry* aEntry)
williamr@2
   196
	{
williamr@2
   197
	return static_cast<const CSyncMLHistoryJob*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryJob, aEntry));
williamr@2
   198
	}
williamr@2
   199
williamr@2
   200
///////////////////////////////////////////////////////////////////////////////
williamr@2
   201
///////////////////////////////////////////////////////////////////////////////
williamr@2
   202
williamr@2
   203
///////////////////////////////////////////////////////////////////////////////
williamr@2
   204
// CSyncMLHistoryPushMsg
williamr@2
   205
///////////////////////////////////////////////////////////////////////////////
williamr@2
   206
class CSyncMLHistoryPushMsg : public CSyncMLHistoryEntry
williamr@2
   207
/**
williamr@2
   208
	This class holds the result of a parsing a push msg.
williamr@2
   209
	This class contains a counter that stores how many times the same message has been received.
williamr@2
   210
	@publishedAll
williamr@2
   211
	@released
williamr@2
   212
*/
williamr@2
   213
	{
williamr@2
   214
public:
williamr@2
   215
	inline static CSyncMLHistoryPushMsg* DynamicCast(CSyncMLHistoryEntry*);
williamr@2
   216
	inline static const CSyncMLHistoryPushMsg* DynamicCast(const CSyncMLHistoryEntry*);
williamr@2
   217
	IMPORT_C static CSyncMLHistoryPushMsg* NewL();
williamr@2
   218
	IMPORT_C virtual ~CSyncMLHistoryPushMsg();
williamr@2
   219
	IMPORT_C virtual void ExternalizeL(RWriteStream&) const;
williamr@2
   220
public:
williamr@2
   221
	IMPORT_C virtual TSmlProfileId Profile() const;
williamr@2
   222
	IMPORT_C virtual TTime TimeStamp() const;
williamr@2
   223
	IMPORT_C virtual TInt ResultCode() const;
williamr@2
   224
	IMPORT_C TInt ReceivedCount() const;
williamr@2
   225
	IMPORT_C const TDesC8& MsgDigest() const;
williamr@2
   226
	IMPORT_C TInt AlertCount() const;
williamr@2
   227
	IMPORT_C const CSmlAlertInfo& Alert(TInt aIndex) const;
williamr@2
   228
public:
williamr@2
   229
	IMPORT_C void IncReceivedCount();
williamr@2
   230
	IMPORT_C void SetMsgDigest(const TDesC8&);
williamr@2
   231
	IMPORT_C void AddAlertsL(RPointerArray<CSmlAlertInfo>&); // Ownership of CSmlAlertInfo objects is transferred.
williamr@2
   232
	IMPORT_C void ResetAlerts();
williamr@2
   233
	IMPORT_C void SetResultCode(TInt aResultCode);
williamr@2
   234
williamr@2
   235
private:
williamr@2
   236
	CSyncMLHistoryPushMsg();
williamr@2
   237
	virtual void InternalizeL(RReadStream&);
williamr@2
   238
private:
williamr@2
   239
	TTime iTimeStamp;
williamr@2
   240
	TInt iResultCode;
williamr@2
   241
	TInt iRcvCount;
williamr@2
   242
	TBuf8<MD5_HASH> iDigest;
williamr@2
   243
	RPointerArray<CSmlAlertInfo> iAlerts;
williamr@2
   244
	};
williamr@2
   245
williamr@2
   246
///////////////////////////////////////////////////////////////////////////////
williamr@2
   247
inline CSyncMLHistoryPushMsg* CSyncMLHistoryPushMsg::DynamicCast(CSyncMLHistoryEntry* aEntry)
williamr@2
   248
	{
williamr@2
   249
	return static_cast<CSyncMLHistoryPushMsg*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryPushMsg, aEntry));
williamr@2
   250
	}
williamr@2
   251
williamr@2
   252
inline const CSyncMLHistoryPushMsg* CSyncMLHistoryPushMsg::DynamicCast(const CSyncMLHistoryEntry* aEntry)
williamr@2
   253
	{
williamr@2
   254
	return static_cast<const CSyncMLHistoryPushMsg*>(CSyncMLHistoryEntry::DoDynamicCast(KUidSmlHistoryEntryPushMsg, aEntry));
williamr@2
   255
	}
williamr@2
   256
williamr@2
   257
///////////////////////////////////////////////////////////////////////////////
williamr@2
   258
///////////////////////////////////////////////////////////////////////////////
williamr@2
   259
williamr@2
   260
///////////////////////////////////////////////////////////////////////////////
williamr@2
   261
///////////////////////////////////////////////////////////////////////////////
williamr@2
   262
///////////////////////////////////////////////////////////////////////////////
williamr@2
   263
#endif
williamr@2
   264
williamr@2
   265