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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
24 #ifndef __PUSHENTRY_H__
25 #define __PUSHENTRY_H__
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};
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;
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
60 const TInt KWPushNoMsgIndexEntry = (KWPushBaseError-1);
61 /** Longest String Allowed. */
62 const TInt KLongestStringAllowed=KMaxTInt32;
66 WAP Push Server MTM state information.
68 This enum is used by TPushMTMProgress and CWapPushServerMtm.
74 enum TPushServerMTMState
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,
85 EWapPushServerMtmComplete
90 Encapsulates progress information returned for asynchronous operations with
91 the WAP Push Server MTM.
93 This allows error status and ID of current entry to be returned to caller.
97 @see CMsvOperation::ProgressL()
99 class TPushMTMProgress
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. */
106 /** The number of entries which have been processed. */
108 /** ID of the (first) message being processed. */
110 /** Server state information. */
111 TPushServerMTMState iPushState;// Operation that is currently in progress
115 Packages a TPushMTMProgress object into a descriptor.
120 typedef TPckgBuf<TPushMTMProgress> TPushMTMProgressBuf;
123 /** Panic name and codes */
124 _LIT(KPushPanicMoniker, "PUSHENTRY");
132 /** Null Ids for entries not valid (Service, &Msg). */
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
144 Abstract base class for classes that handle storage of WAP Push Messages in
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.
153 The mappings of data to TMsvEntry fields standard to all classes are:
155 Push Message Type UID: TMsvEntry::iBioType
157 Status: sets bits 0-3 of TMsvEntry::iMtmData1
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.
169 class CPushMsgEntryBase: public CBase
173 WAP Push Message status values.
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
190 IMPORT_C CPushMsgEntryBase();
192 IMPORT_C virtual ~CPushMsgEntryBase();
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);
198 // Creates its own CMsvStore from the CMsvSession & calls RestoreL()
199 IMPORT_C virtual void RetrieveL(CMsvSession& aSession, TMsvId aMsgId);
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);
209 Gets the push message content type.
214 virtual const TDesC& ContentType() const =0;
217 Gets the push message type.
219 Each derived class represents a different push message type, and implements
220 this to return the appropriate value.
225 virtual TInt32 PushMsgType() const =0;
226 inline const TMsvEntry& Entry() const;
227 inline TInt Status() const;
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;
237 IMPORT_C virtual void ConstructL(const TPtrC8& aAppURI);
238 IMPORT_C virtual void ConstructL(const TInt& aAppID);
239 IMPORT_C virtual void ConstructL();
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);
247 Sets the push message type.
249 Each derived class represents a different push message type, and implements
250 this to set the appropriate value.
252 virtual void SetPushMsgType()=0;// Only the object can set it's push type - class dependent
253 void DoSaveL(CMsvEntry& aMsvEntry);
257 /** Message server entry. */
260 /** Copy of the message server entry Details field. */
262 /** Copy of the message server entry Description field. */
263 HBufC* iMsgDescription;
265 /** WAP Push message raw header buffer. */
267 /** From field buffer. */
269 /** Set to true if the object has an associated entry in the message server index. */
270 TBool iHasServerEntry;
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.*/
281 #include <pushentry.inl>