Msrp/MsrpHeader/inc/CMsrpMessage.h
branchMSRP_FrameWork
changeset 25 505ad3f0ce5c
child 58 cdb720e67852
equal deleted inserted replaced
22:f1578314b8da 25:505ad3f0ce5c
       
     1 /*
       
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html."
       
     8 * Initial Contributors:
       
     9 * Nokia Corporation - initial contribution.
       
    10 * Contributors:
       
    11 *
       
    12 * Description:
       
    13 * MSRP Implementation
       
    14 *
       
    15 */
       
    16 
       
    17 #ifndef CMSRPMESSAGE_H
       
    18 #define CMSRPMESSAGE_H
       
    19 
       
    20 //  INCLUDES
       
    21 #include <e32base.h>
       
    22 #include <s32strm.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 #include "CMSRPMessageBase.h"
       
    26 
       
    27 /**
       
    28 *  @publishedAll
       
    29 *
       
    30 *  Class provides functions for creation and manipulation of MSRP headers
       
    31 */
       
    32 class CMSRPMessage : public CMSRPMessageBase
       
    33     {
       
    34     public:  // Constructors and destructor
       
    35 
       
    36         /**
       
    37         * Constructor.
       
    38         */
       
    39 	    IMPORT_C CMSRPMessage();
       
    40 
       
    41         /**
       
    42         * Destructor.
       
    43         */
       
    44 		IMPORT_C ~CMSRPMessage();
       
    45 
       
    46     public: // New functions
       
    47 
       
    48 		/**
       
    49 		* Sets the content of the message to be sent
       
    50 		* Message maximum length is 2048 bytes, longer message will
       
    51 		* have to be sent in chunks by the client
       
    52 		* @param aContent message to be sent
       
    53 		*/
       
    54 		IMPORT_C void SetContent( HBufC8* aContent );
       
    55 		
       
    56 		/**
       
    57 		* Gets the content buffer, if set
       
    58 		* @return pointer to content buffer, ownership is not transferred
       
    59 		*/
       
    60 		IMPORT_C const TDesC8& Content( );
       
    61 		
       
    62 		/**
       
    63 		* Check if the contents of the message have been set
       
    64 		* @return true if set
       
    65 		*/
       
    66 		IMPORT_C TBool IsContent( ) const;
       
    67 
       
    68 		/**
       
    69 		* Check if the given externalised buffer contains MSRP Message
       
    70  		* @param aBuffer a Buffer containing the value of the
       
    71 		*        externalized object
       
    72 		* @return true if Buffer contains MSRP message
       
    73 		*/
       
    74 		IMPORT_C static TBool IsMessage( const TDesC8& aBuffer );
       
    75         
       
    76 		  /**
       
    77 		  * Checks if File
       
    78 		  */
       
    79 		        
       
    80 		IMPORT_C TBool IsFile( );
       
    81 		        
       
    82 		 /**
       
    83 		  * Sets the FileName for a FileSession
       
    84 		  */
       
    85 		IMPORT_C void SetFileName( const TFileName& aFileName );
       
    86 		        
       
    87 		 /**
       
    88 		 * Gets the FileName for a FileSession
       
    89 		 */
       
    90 		IMPORT_C TFileName& GetFileName( );
       
    91 		        
       
    92 		/* Set File Size */
       
    93 		IMPORT_C void SetFileSize( const TInt aFileSize );
       
    94 		
       
    95 		/* Get File Size */
       
    96 		IMPORT_C TInt GetFileSize();
       
    97 		
       
    98 		/* Set Granularity for file transfer */
       
    99 		        
       
   100 		IMPORT_C void SetNotifyProgress(TBool aNotify);
       
   101 		        
       
   102 		/* Get Granularity for file transfer */
       
   103         IMPORT_C TBool GetNotifyProgress();        
       
   104 		        		
       
   105 		/**
       
   106 		* Internalizes the class from given stream
       
   107  		* @param aReadStream a stream containing the value of the
       
   108 		*        externalized object
       
   109 		* @return Internalized CMSRPMessage object, ownership is transferred
       
   110 		*/
       
   111 		IMPORT_C static CMSRPMessage* InternalizeL( RReadStream& aReadStream );
       
   112 
       
   113 	public: // from base classes
       
   114 
       
   115 		// from CMSRPMessageBase
       
   116 		IMPORT_C void ExternalizeL( RWriteStream& aWriteStream );
       
   117 		
       
   118     private:
       
   119 
       
   120         /**
       
   121         * Internalizes this message
       
   122  		* @param aReadStream a stream containing the value of the
       
   123 		*        externalized object (header name not included).
       
   124         */
       
   125 	    void DoInternalizeL( RReadStream& aReadStream  );
       
   126         
       
   127     private: // Data
       
   128 
       
   129 		// content buffer
       
   130 		HBufC8* iContentBuffer;
       
   131 
       
   132 	   // filename
       
   133 	   TFileName iFileName;
       
   134 	   
       
   135 	   //filesize
       
   136 	   TInt iFileSize;
       
   137 	   
       
   138 	   //Granularity of the file
       
   139 	   TBool iNotifyProgress;
       
   140 	};
       
   141 
       
   142 #endif // CMSRPMESSAGE_H
       
   143 
       
   144 // End of File