serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/sendmessage.h
changeset 22 fc9cf246af83
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
       
     1 /*
       
     2 * Copyright (c) 2007 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 the License "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 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __SENDMESSAGE_H
       
    21 #define __SENDMESSAGE_H
       
    22 
       
    23 #include <rsendas.h>
       
    24 #include <rsendasmessage.h>
       
    25 
       
    26 class CMsvAttachment;
       
    27 class CRecipientList;
       
    28 class CMsgCallbackBase;
       
    29 
       
    30 /**
       
    31  * This class provides functionality for sending SMS/MMS messages.
       
    32 */
       
    33 class CSendMessage : public CActive
       
    34 	{
       
    35 
       
    36 	/**
       
    37 	 * TMessageState enum represents the message states for asynchronous requests.
       
    38 	*/
       
    39 	enum TMessageState
       
    40 		{
       
    41 		EInitialize = 0,
       
    42 		EValidate,
       
    43 		ESend,
       
    44 		EComplete
       
    45 		};
       
    46 		
       
    47 
       
    48 	public:
       
    49 	
       
    50 	    /**
       
    51 	     * Two-phased constructor.
       
    52 	     * @param aServerSession  Object of CMsvSession Class which
       
    53 	     *        represents a channel of communication between a client thread  
       
    54 	     *        and the Message Server thread.
       
    55 	     * @return CSendMessage object
       
    56 	    */
       
    57 		static CSendMessage* NewL( CMsvSession& aServerSession );
       
    58 
       
    59 	    /**
       
    60 	    * Destructor.
       
    61 	    */
       
    62 		virtual ~CSendMessage();
       
    63 
       
    64 		
       
    65 	private:
       
    66 
       
    67 	    /** 
       
    68 	     * Constructor.
       
    69 	     * @param aServerSession  Object of CMsvSession Class which
       
    70 	     *        represents a channel of communication between a client thread  
       
    71 	     *        and the Message Server thread .
       
    72 	    */
       
    73 		CSendMessage( CMsvSession& aServerSession );
       
    74 
       
    75 
       
    76 	public:	
       
    77 	
       
    78 	    /**
       
    79 	     * Sets message input parameters 
       
    80 	     * Ownership is transferred to this class
       
    81 	     * @param aMessageParam Message Input Parameters
       
    82 		 * @param aTemplateDetail 
       
    83 	     * @param aNotifyCallback Bydefault it is NULL to make function
       
    84 	     *        call synchronous , if provided then function call is asynchronous                  
       
    85 		 * @param aAsyncRequestObserver Asynchronous request observer
       
    86 	    */
       
    87 		void SetInputParamsL( CSendMessageParams* aMessageParam, 
       
    88 								CMessageDetailInfo* aTemplateDetail = NULL,
       
    89 								CMsgCallbackBase* aNotifyCallback = NULL,
       
    90 								MAsyncRequestObserver* aAsyncRequestObserver = NULL);
       
    91 		
       
    92 	    /**
       
    93 	     * Sends the message
       
    94 	    */
       
    95 		void SendMessageL();
       
    96 		
       
    97     private: 
       
    98     	
       
    99 		/**
       
   100 		 * Inherited from CActive class 
       
   101 		*/ 
       
   102     	virtual void DoCancel();
       
   103 
       
   104 		/**
       
   105 		 * Inherited from CActive class 
       
   106 		*/ 
       
   107         virtual void RunL();
       
   108 
       
   109 		/**
       
   110 		 * Internal function 
       
   111 		*/ 
       
   112 		void InitializeL();
       
   113 
       
   114 		/**
       
   115 		 * Internal function 
       
   116 		*/ 
       
   117 		void ValidateL();
       
   118 
       
   119 		/**
       
   120 		 * Internal function 
       
   121 		*/ 
       
   122 		void SendL();
       
   123 
       
   124 		/**
       
   125 		 * Activates the request and call SetActive() function
       
   126 		*/ 
       
   127 		void ActivateRequest(TInt aReason);
       
   128 
       
   129 		/**
       
   130 		 * Gives the result for notification request.
       
   131 		*/ 
       
   132 		void NotifyRequestResult(TInt aReason);
       
   133 	
       
   134 		/**
       
   135 		 * Sets the subject for message
       
   136 		*/ 
       
   137      	void AddSubjectL();
       
   138      	
       
   139 		/**
       
   140 		 * Sets the recipient address
       
   141 		*/ 
       
   142 		void AddRecipientL();
       
   143 		
       
   144 		/**
       
   145 		 * Sets body text to message
       
   146 		*/ 
       
   147 		void AddBodyTextL();
       
   148 		
       
   149 		/**
       
   150 		 * Adds attachments to message
       
   151 		*/ 
       
   152 		void AddAttachmentL();
       
   153        
       
   154 	private:
       
   155 
       
   156 		/**
       
   157 		 * Represents a channel of communication between a client thread 
       
   158 		 * and the Message Server thread
       
   159 		*/ 
       
   160 		CMsvSession& 			iServerSession;
       
   161 
       
   162 		/**
       
   163 		 * Asynchronous request observer, Used to get infromed of completion or request
       
   164 		*/ 
       
   165 		MAsyncRequestObserver* 	iAsyncRequestObserver;
       
   166 
       
   167 		/**
       
   168 		 * Represents a session with the SendAs Server
       
   169 		*/ 
       
   170 		RSendAs					iSendAs;
       
   171 
       
   172 		/**
       
   173 		 * RSendAsMessage class object which encapsulates creating and
       
   174 		 * sending a message.
       
   175 		*/ 
       
   176 		RSendAsMessage			iMessage;
       
   177 
       
   178 		/**
       
   179 		 * State of message
       
   180 		*/ 
       
   181 		TMessageState			iMessageState;
       
   182 
       
   183 		/**
       
   184 		 * A callback notification for asynchronous function
       
   185 		*/ 
       
   186 		CMsgCallbackBase* 		iNotifyCallback;
       
   187 		
       
   188 		/**
       
   189 		 * Message input parameters
       
   190 		*/ 
       
   191 		CSendMessageParams* 	iMessageParam;
       
   192 
       
   193 		/**
       
   194 		 * Message detail for template message id
       
   195 		*/ 
       
   196        	CMessageDetailInfo*		iTemplateDetail;
       
   197        	
       
   198        	/**
       
   199        	 * Flag which specifies to cancel the request 
       
   200        	 * but not to call the NotifyResultL
       
   201        	 * If false doesnot call the NotifyResultL
       
   202        	**/
       
   203        	TBool iCallNotifyForCancelFlag;
       
   204        	
       
   205        	/*
       
   206        	 * Flag information specifying whether the body text file 
       
   207        	 * in case of MMS is created or not, if created need to be 
       
   208        	 * cleaned up checking this flag at the end
       
   209        	*/
       
   210        	TBool iBodyTextFileFlag;
       
   211        	
       
   212        	/*
       
   213        	 * FileName of the Body Text file used in case of MMS
       
   214        	*/
       
   215        	TFileName iBodyTextFileName;
       
   216 	};
       
   217 
       
   218 
       
   219 
       
   220 
       
   221 #endif __SENDMESSAGE_H