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