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