epoc32/include/pushentry.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // 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
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 /**
    19  @file
    20  @publishedPartner
    21  @released
    22 */
    23 
    24 #ifndef __PUSHENTRY_H__
    25 #define __PUSHENTRY_H__
    26 
    27 #include <e32std.h>
    28 #include <msvapi.h>
    29 #include <msvstd.h>
    30 
    31 
    32 /** UID for the WAP Push MTM. */
    33 const TUid KUidMtmWapPush = {0x10009158};
    34 /** UID for WAP Push SI messages. */
    35 const TUid KUidWapPushMsgSI = {0x10009159};
    36 /** UID for WAP Push SL messages. */
    37 const TUid KUidWapPushMsgSL = {0x1000915A};
    38 /** UID for WAP Push multipart messages. */
    39 const TUid KUidWapPushMsgMultiPart = {0x1000915B};
    40 /** UID for WAP Push unknown-type messages. */
    41 const TUid KUidWapPushMsgUnknown = {0x1000915C};
    42 
    43 
    44 // Defines for Masking values used to extract status information from iMtmData1
    45 /** TMsvEntry::iMtmData1 mask to get Status value. */
    46 const TInt32 KPushMaskOnlyStatus			= 0x0000000F;
    47 /** TMsvEntry::iMtmData1 mask to all bits except those for the Status value. */
    48 const TInt32 KPushMaskEverythingButStatus	= 0xFFFFFFF0;
    49 /** TMsvEntry::iMtmData1 mask to get Action value. */
    50 const TInt32 KPushMaskOnlyAction			= 0x000000F0;
    51 /** TMsvEntry::iMtmData1 mask to all bits except those for the Action value. */
    52 const TInt32 KPushMaskEverythingButAction	= 0xFFFFFF0F;
    53 
    54 
    55 // Defines for Leave Codes
    56 /** Base value for WAP Push-specific errors. */
    57 const TInt KWPushBaseError		 =	-1100;
    58 /** CPushMsgEntryBase::UpdateL() called without a message server entry being loaded 
    59 error. */
    60 const TInt KWPushNoMsgIndexEntry =   (KWPushBaseError-1);
    61 /** Longest String Allowed. */
    62 const TInt KLongestStringAllowed=KMaxTInt32;
    63 
    64 
    65 /**
    66 WAP Push Server MTM state information.
    67 
    68 This enum is used by TPushMTMProgress and CWapPushServerMtm.
    69 
    70 @publishedPartner
    71 @released
    72 @see TPushMTMProgress 
    73 */
    74 enum TPushServerMTMState
    75 	{
    76 	/** Server is waiting for a command. */
    77 	EWapPushServerMtmWaiting,
    78 	/** Server is executing a Change command. */
    79 	EWapPushServerMtmChange,
    80 	/** Server is executing a Create command. */
    81 	EWapPushServerMtmCreate,
    82 	/** Server is executing a Delete command. */
    83 	EWapPushServerMtmDelete,
    84 	/** Unused. */
    85 	EWapPushServerMtmComplete
    86 	};
    87 
    88 
    89 /** 
    90 Encapsulates progress information returned for asynchronous operations with 
    91 the WAP Push Server MTM. 
    92 
    93 This allows error status and ID of current entry to be returned to caller.
    94 
    95 @publishedPartner
    96 @released
    97 @see CMsvOperation::ProgressL() 
    98 */
    99 class TPushMTMProgress
   100 	{
   101 public:
   102 	/** Error code. */
   103 	TInt				iError; // client side needs to be informed of an error
   104 	/** The number of entries on which the operation was or will be attempted. */
   105 	TInt				iTotalMsgs;
   106 	/** The number of entries which have been processed. */
   107 	TInt				iMsgsProcessed;
   108 	/** ID of the (first) message being processed. */
   109 	TMsvId				iMsgId;
   110 	/** Server state information. */
   111 	TPushServerMTMState iPushState;// Operation that is currently in progress
   112 	};
   113 
   114 /** 
   115 Packages a TPushMTMProgress object into a descriptor. 
   116 
   117 @publishedPartner
   118 @released
   119 */
   120 typedef TPckgBuf<TPushMTMProgress> TPushMTMProgressBuf;
   121 
   122 
   123 /** Panic name and codes */
   124 _LIT(KPushPanicMoniker, "PUSHENTRY");
   125 
   126 /**
   127 @internalComponent
   128 @released
   129 */
   130 enum TPushEntryPanic	
   131 	{
   132 	/** Null Ids for entries not valid (Service, &Msg). */
   133 	EPushEntryNullMsgId,
   134 	/** Only save messages under the Service Entry. */
   135 	EPushEntryServiceIdMismatch,
   136 	/** Not a WAP Push  MTM. */
   137 	EPushEntryWrongMTMtype,
   138 	/** iBioType value in TMsvEntry don't match Uid for Push Entry class. */
   139 	EPushEntryWrongMsgtype
   140 	};
   141 
   142 
   143 /** 
   144 Abstract base class for classes that handle storage of WAP Push Messages in 
   145 the message server.
   146 
   147 The class acts as a wrapper for TMsvEntry, and provides accessors and storage 
   148 functionality. Key pieces of data are mapped onto certain TMsvEntry fields: 
   149 this speeds up access by applications to this data. This base class has the 
   150 generic mappings and storage behaviour. More specialised mappings and storage 
   151 are defined in each derived class.
   152 
   153 The mappings of data to TMsvEntry fields standard to all classes are:
   154 
   155 Push Message Type UID: TMsvEntry::iBioType
   156 
   157 Status: sets bits 0-3 of TMsvEntry::iMtmData1
   158 
   159 Some derived classes need to store more data than there are available fields 
   160 in TMsvEntry, and the Unknown type potentially requires large data capacity. 
   161 This additional data is saved in the message store associated with the message 
   162 entry. Derived classes provide this functionality by overriding ExternalizeL() 
   163 and InternalizeL() implementations. The base class itself uses the message store
   164 to store the WAP Push message's raw header and From information.
   165 
   166 @publishedPartner
   167 @released
   168 */
   169 class CPushMsgEntryBase: public CBase
   170 	{
   171 public:
   172 	/** 
   173 	WAP Push Message status values. 
   174 	
   175 	@internalTechnology
   176 	@released
   177 	*/
   178 	enum TPushMsgStatus	
   179 		{
   180 		/** Message is valid. */
   181 		EPushMsgStatusValid = 0,
   182 		/** Message is expired. */
   183 		EPushMsgStatusExpired,
   184 		/** Message is deleted. */
   185 		EPushMsgStatusDeleted,
   186 		/** Message is corrupt. */
   187 		EPushMsgStatusCorrupt
   188 		};
   189 
   190 	IMPORT_C CPushMsgEntryBase();
   191 
   192 	IMPORT_C virtual ~CPushMsgEntryBase();
   193 
   194 	// Creates its own CMsvStore from the CMsvSession & calls StoreL()
   195 	IMPORT_C virtual TMsvId SaveL(CMsvSession& aSession, TMsvId aParent);
   196 	IMPORT_C virtual void UpdateL(CMsvSession& aSession);
   197 
   198 	// Creates its own CMsvStore from the CMsvSession & calls RestoreL()
   199 	IMPORT_C virtual void RetrieveL(CMsvSession& aSession, TMsvId aMsgId);
   200 	
   201 	IMPORT_C void SetEntry(const TMsvEntry& aEntry);
   202 	IMPORT_C void SetStatus(TInt aStatusFlags);
   203 	IMPORT_C const TDesC8&  Header() const;
   204 	IMPORT_C void SetHeaderL(const TDesC8& aHeader);
   205 	IMPORT_C const TDesC8& From() const; 
   206 	IMPORT_C void SetFromL(const TDesC8& aFrom);
   207 
   208 	/**
   209 	Gets the push message content type.
   210 	
   211 	@return
   212 	Content type 
   213 	*/
   214 	virtual const TDesC& ContentType() const =0;
   215 	
   216 	/** 
   217 	Gets the push message type.
   218 	
   219 	Each derived class represents a different push message type, and implements 
   220 	this to return the appropriate value.
   221 	
   222 	@return 
   223 	Push message type
   224 	*/
   225 	virtual TInt32 PushMsgType() const =0;
   226 	inline const TMsvEntry& Entry() const;
   227 	inline TInt Status() const;
   228 
   229 	IMPORT_C const TDesC& MsgDescription() const;
   230 	IMPORT_C void SetMsgDescriptionL(const TDesC& aDescription);
   231 	IMPORT_C const TDesC& MsgDetails() const;
   232 	IMPORT_C void SetMsgDetailsL(const TDesC& aDetails);
   233 	IMPORT_C const TTime& ReceivedDate() const;
   234 	IMPORT_C TInt AppID(TPtrC8& aAppURI, TInt& aAppID, TBool& aIsAnInt) const;
   235 
   236 protected:
   237 	IMPORT_C virtual void ConstructL(const TPtrC8& aAppURI);
   238 	IMPORT_C virtual void ConstructL(const TInt& aAppID);
   239 	IMPORT_C virtual void ConstructL();
   240 
   241 	// No  matching StoreL due to different needs for saving & updating msg's
   242 	IMPORT_C void RestoreL(CMsvStore& aStore );
   243 	IMPORT_C virtual void ExternalizeL(RMsvWriteStream& aStream);
   244 	IMPORT_C virtual void InternalizeL(RMsvReadStream& aStream);
   245 	
   246 	/** 	
   247 	Sets the push message type.
   248 	
   249 	Each derived class represents a different push message type, and implements 
   250 	this to set the appropriate value. 
   251 	*/
   252 	virtual void SetPushMsgType()=0;// Only the object can set it's push type - class dependent 
   253 	void DoSaveL(CMsvEntry& aMsvEntry);
   254 
   255 protected:
   256 
   257 	/** Message server entry. */
   258 	TMsvEntry iEntry;
   259 
   260 	/** Copy of the message server entry Details field. */
   261 	HBufC* iMsgDetails;    
   262 	/** Copy of the message server entry Description field. */
   263 	HBufC* iMsgDescription;
   264 							    
   265 	/** WAP Push message raw header buffer. */
   266 	HBufC8* iHeader;
   267 	/** From field buffer. */
   268 	HBufC8* iFrom;
   269 	/** Set to true if the object has an associated entry in the message server index. */
   270 	TBool iHasServerEntry;
   271 
   272 	/** Message AppID as a string. Only one of iAppIDString and iAppIdInt will be set.*/
   273 	HBufC8* iAppIDString;
   274 	/** Message AppID as a number. Only one of iAppIDString and iAppIdInt will be set.*/
   275 	TInt iAppIdInt;
   276 	};
   277 
   278 
   279 
   280 
   281 #include <pushentry.inl>
   282 
   283 #endif