author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 18 Jan 2010 21:02:57 +0200 | |
changeset 27 | 02682e02e51f |
parent 11 | 5c0037c72160 |
child 39 | 1aa6688bfd6b |
permissions | -rw-r--r-- |
5 | 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 |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
81 |
* @param aTemplateDetail |
5 | 82 |
* @param aNotifyCallback Bydefault it is NULL to make function |
83 |
* call synchronous , if provided then function call is asynchronous |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
84 |
* @param aAsyncRequestObserver Asynchronous request observer |
5 | 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 |
||
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
96 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
97 |
* Sends a sms message |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
98 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
99 |
void SendSMSMessageL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
100 |
|
5 | 101 |
private: |
102 |
||
103 |
/** |
|
104 |
* Inherited from CActive class |
|
105 |
*/ |
|
106 |
virtual void DoCancel(); |
|
107 |
||
108 |
/** |
|
109 |
* Inherited from CActive class |
|
110 |
*/ |
|
111 |
virtual void RunL(); |
|
112 |
||
113 |
/** |
|
114 |
* Internal function |
|
115 |
*/ |
|
116 |
void InitializeL(); |
|
117 |
||
118 |
/** |
|
119 |
* Internal function |
|
120 |
*/ |
|
121 |
void ValidateL(); |
|
122 |
||
123 |
/** |
|
124 |
* Internal function |
|
125 |
*/ |
|
126 |
void SendL(); |
|
127 |
||
128 |
/** |
|
129 |
* Activates the request and call SetActive() function |
|
130 |
*/ |
|
131 |
void ActivateRequest(TInt aReason); |
|
132 |
||
133 |
/** |
|
134 |
* Gives the result for notification request. |
|
135 |
*/ |
|
136 |
void NotifyRequestResult(TInt aReason); |
|
137 |
||
138 |
/** |
|
139 |
* Sets the subject for message |
|
140 |
*/ |
|
141 |
void AddSubjectL(); |
|
142 |
||
143 |
/** |
|
144 |
* Sets the recipient address |
|
145 |
*/ |
|
146 |
void AddRecipientL(); |
|
147 |
||
148 |
/** |
|
149 |
* Sets body text to message |
|
150 |
*/ |
|
151 |
void AddBodyTextL(); |
|
152 |
||
153 |
/** |
|
154 |
* Adds attachments to message |
|
155 |
*/ |
|
156 |
void AddAttachmentL(); |
|
157 |
||
158 |
private: |
|
159 |
||
160 |
/** |
|
161 |
* Represents a channel of communication between a client thread |
|
162 |
* and the Message Server thread |
|
163 |
*/ |
|
164 |
CMsvSession& iServerSession; |
|
165 |
||
166 |
/** |
|
167 |
* Asynchronous request observer, Used to get infromed of completion or request |
|
168 |
*/ |
|
169 |
MAsyncRequestObserver* iAsyncRequestObserver; |
|
170 |
||
171 |
/** |
|
172 |
* Represents a session with the SendAs Server |
|
173 |
*/ |
|
174 |
RSendAs iSendAs; |
|
175 |
||
176 |
/** |
|
177 |
* RSendAsMessage class object which encapsulates creating and |
|
178 |
* sending a message. |
|
179 |
*/ |
|
180 |
RSendAsMessage iMessage; |
|
181 |
||
182 |
/** |
|
183 |
* State of message |
|
184 |
*/ |
|
185 |
TMessageState iMessageState; |
|
186 |
||
187 |
/** |
|
188 |
* A callback notification for asynchronous function |
|
189 |
*/ |
|
190 |
CMsgCallbackBase* iNotifyCallback; |
|
191 |
||
192 |
/** |
|
193 |
* Message input parameters |
|
194 |
*/ |
|
195 |
CSendMessageParams* iMessageParam; |
|
196 |
||
197 |
/** |
|
198 |
* Message detail for template message id |
|
199 |
*/ |
|
200 |
CMessageDetailInfo* iTemplateDetail; |
|
201 |
||
202 |
/** |
|
203 |
* Flag which specifies to cancel the request |
|
204 |
* but not to call the NotifyResultL |
|
205 |
* If false doesnot call the NotifyResultL |
|
206 |
**/ |
|
207 |
TBool iCallNotifyForCancelFlag; |
|
208 |
||
209 |
/* |
|
210 |
* Flag information specifying whether the body text file |
|
211 |
* in case of MMS is created or not, if created need to be |
|
212 |
* cleaned up checking this flag at the end |
|
213 |
*/ |
|
214 |
TBool iBodyTextFileFlag; |
|
215 |
||
216 |
/* |
|
217 |
* FileName of the Body Text file used in case of MMS |
|
218 |
*/ |
|
219 |
TFileName iBodyTextFileName; |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
220 |
|
5 | 221 |
}; |
222 |
||
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
223 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
224 |
* Utility class for waiting for asychronous requests |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
225 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
226 |
class CAsyncWaiter : public CActive |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
227 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
228 |
public: |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
229 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
230 |
* Two-phased constructor. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
231 |
* @param aPriority set aPriority to EPriorityStandard |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
232 |
* @return CAsyncWaiter object |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
233 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
234 |
static CAsyncWaiter* NewL( TInt aPriority = EPriorityStandard ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
235 |
static CAsyncWaiter* NewLC( TInt aPriority = EPriorityStandard ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
236 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
237 |
* Destructor. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
238 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
239 |
~CAsyncWaiter(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
240 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
241 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
242 |
* Starts the active scheduler. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
243 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
244 |
void StartAndWait(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
245 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
246 |
* Starts the active scheduler. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
247 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
248 |
TInt Result() const; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
249 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
250 |
private: |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
251 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
252 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
253 |
* Constructor. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
254 |
* @param aPriority |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
255 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
256 |
CAsyncWaiter( TInt aPriority ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
257 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
258 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
259 |
* Inherited from CActive class |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
260 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
261 |
void RunL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
262 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
263 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
264 |
* Inherited from CActive class |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
265 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
266 |
void DoCancel(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
267 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
268 |
private: |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
269 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
270 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
271 |
* wait scheduler |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
272 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
273 |
CActiveSchedulerWait iWait; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
274 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
275 |
/** |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
276 |
* error |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
277 |
*/ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
278 |
TInt iError; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
279 |
}; |
5 | 280 |
|
281 |
||
282 |
#endif __SENDMESSAGE_H |