|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file contains the CWapPushMsgGen for creating push messages |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file WapPushMsgGen.h |
|
20 */ |
|
21 |
|
22 #ifndef __WAPPUSHMSGGEN_H__ |
|
23 #define __WAPPUSHMSGGEN_H__ |
|
24 |
|
25 |
|
26 #include <e32base.h> |
|
27 |
|
28 class CWapPushCorruptMessageTest; |
|
29 |
|
30 /** |
|
31 * Push Message Generator Utility |
|
32 |
|
33 Use this to create push messages. Call StartNewMsgL to start a type of message. Then call AppendFieldL to append data to |
|
34 it. Finally call CreateMsgLC to create the whole message. Then just use StartNewMsgL to start the next message |
|
35 */ |
|
36 class CWapPushMsgGen : public CBase |
|
37 { |
|
38 public: |
|
39 enum TMsgType |
|
40 { |
|
41 EServiceIndication = 0, |
|
42 EServiceLoad = 1, |
|
43 ECorruptMsgTest, |
|
44 ECorruptXmlVersionTest, |
|
45 EEmptyMsgBody |
|
46 }; |
|
47 |
|
48 enum TMsgField |
|
49 { |
|
50 EHRef, // si or sl href |
|
51 EServiceIndicationID , // si_id |
|
52 EServiceIndicationCreated, // created |
|
53 EServiceIndicationExpires, // si-expires |
|
54 EServiceIndicationText, // indication text that occurs between > and </indication> |
|
55 EAction, // si or sl action |
|
56 EBadHRef, // si or sl href |
|
57 EBadServiceIndicationID , // si_id |
|
58 EBadServiceIndicationCreated, // created |
|
59 EBadServiceIndicationExpires, // si-expires |
|
60 EBadAction, // si or sl action |
|
61 EXMLNoFieldStr, |
|
62 EWBXMLNoFieldStr |
|
63 }; |
|
64 |
|
65 |
|
66 static CWapPushMsgGen* NewL(); |
|
67 ~CWapPushMsgGen(); |
|
68 void AppendFieldL(TMsgField aField, const TDesC8& aFieldValue); |
|
69 HBufC8* CreateMsgLC(); |
|
70 void StartNewMsgL(TMsgType aMsgType); |
|
71 void AppendMsgDesL(const TDesC8& aDes); |
|
72 private: |
|
73 friend class CWapPushCorruptMessageTest; |
|
74 enum TWapPushMsgGenPanic |
|
75 { |
|
76 EInvalidPushMessageType, |
|
77 EInvalidPushMessageField |
|
78 }; |
|
79 |
|
80 void AppendMsgFieldDesL(const TDesC8& aDes); |
|
81 void Panic(TWapPushMsgGenPanic aPanicCode); |
|
82 private: |
|
83 HBufC8* iMsgBuffer; |
|
84 HBufC8* iMsgFieldBuffer; |
|
85 TMsgType iMsgType; |
|
86 }; |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 #endif // __WAPPUSHMSGGEN_H__ |