messagingfw/wappushfw/tpushscriptbased/wappushmsggen.h
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 
       
    17 #ifndef __WAPPUSHMSGGEN_H__
       
    18 #define __WAPPUSHMSGGEN_H__
       
    19 
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 class CWapPushCorruptMessageTest;
       
    24 
       
    25 /**
       
    26 * Push Message Generator Utility 
       
    27 
       
    28 Use this to create push messages. Call StartNewMsgL to start a type of message. Then call AppendFieldL to append data to
       
    29 it. Finally call CreateMsgLC to create the whole message. Then just use StartNewMsgL to start the next message
       
    30 */
       
    31 class CWapPushMsgGen : public CBase
       
    32 	{
       
    33 public:
       
    34 	enum TMsgType
       
    35 		{
       
    36 		EServiceIndication = 0,
       
    37 		EServiceLoad = 1,
       
    38 		ECorruptMsgTest, 
       
    39 		ECorruptXmlVersionTest,
       
    40 		EEmptyMsgBody
       
    41 		};
       
    42 
       
    43 	enum TMsgField
       
    44 		{
       
    45 		EHRef,						// si or sl href
       
    46 		EServiceIndicationID ,		// si_id
       
    47 		EServiceIndicationCreated,	// created
       
    48 		EServiceIndicationExpires,	// si-expires
       
    49 		EServiceIndicationText,		// indication text that occurs between >  and </indication>
       
    50 		EAction,					// si or sl action
       
    51 		EBadHRef,						// si or sl href
       
    52 		EBadServiceIndicationID ,		// si_id
       
    53 		EBadServiceIndicationCreated,	// created
       
    54 		EBadServiceIndicationExpires,	// si-expires
       
    55 		EBadAction,					// si or sl action
       
    56 		EXMLNoFieldStr,
       
    57 		EWBXMLNoFieldStr
       
    58 		};
       
    59 
       
    60 
       
    61 	static CWapPushMsgGen* NewL();
       
    62 	~CWapPushMsgGen();
       
    63 	void AppendFieldL(TMsgField aField, const TDesC8& aFieldValue);
       
    64 	HBufC8* CreateMsgLC();
       
    65 	void StartNewMsgL(TMsgType aMsgType);
       
    66 private:
       
    67 	friend class CWapPushCorruptMessageTest;
       
    68 	enum TWapPushMsgGenPanic
       
    69 		{
       
    70 		EInvalidPushMessageType,
       
    71 		EInvalidPushMessageField
       
    72 		};
       
    73 	
       
    74 	void AppendMsgDesL(const TDesC8& aDes);
       
    75 	void AppendMsgFieldDesL(const TDesC8& aDes);
       
    76 	void Panic(TWapPushMsgGenPanic aPanicCode);
       
    77 private:
       
    78 	HBufC8* iMsgBuffer;
       
    79 	HBufC8* iMsgFieldBuffer;
       
    80 	TMsgType iMsgType;
       
    81 	};
       
    82 
       
    83 
       
    84 
       
    85 
       
    86 
       
    87 #endif // __WAPPUSHMSGGEN_H__