|
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 __MESSAGINGSERVICE_H |
|
20 #define __MESSAGINGSERVICE_H |
|
21 |
|
22 #include "messageheader.h" |
|
23 |
|
24 class CMessageObserver; |
|
25 |
|
26 |
|
27 /** |
|
28 * Messaging Service class |
|
29 */ |
|
30 class CMessagingService : public CBase, public MAsyncRequestObserver |
|
31 { |
|
32 public: |
|
33 |
|
34 /** |
|
35 * Two Phase Constructor |
|
36 */ |
|
37 IMPORT_C static CMessagingService* NewL(); |
|
38 |
|
39 /** |
|
40 * Destructor |
|
41 */ |
|
42 virtual ~CMessagingService(); |
|
43 |
|
44 private: |
|
45 |
|
46 /** |
|
47 * Constructor |
|
48 */ |
|
49 CMessagingService(); |
|
50 |
|
51 /** |
|
52 * Constructor |
|
53 */ |
|
54 void ConstructL(); |
|
55 |
|
56 /** |
|
57 * Adds asynchronous request object |
|
58 * @param aTransactionId Transcation Id os Async object |
|
59 * @param aAsyncObj Async object |
|
60 */ |
|
61 void AddAsyncObjL( const TInt32 aTransactionId, CActive* aAsyncObj ); |
|
62 |
|
63 /** |
|
64 * Deletes all the Asynchronous request objects |
|
65 */ |
|
66 void DeleteAsyncObjects(); |
|
67 |
|
68 public: |
|
69 |
|
70 /** |
|
71 * Sends Message |
|
72 * @param aMessageParam Structure containing details about the message |
|
73 * which is being send |
|
74 * @param aCallback CallBack object for asynchronous operation |
|
75 */ |
|
76 IMPORT_C void SendMessageL( CSendMessageParams* aMessageParam, |
|
77 CMsgCallbackBase* aCallback = NULL ); |
|
78 |
|
79 /** |
|
80 * Deletes Message |
|
81 * @param aMessageId Message Id of message which is to be deleted |
|
82 * @param aCallback CallBack object for asynchronous operation |
|
83 */ |
|
84 IMPORT_C void DeleteMessageL( const TMsvId aMessageId, |
|
85 CMsgCallbackBase* aCallback = NULL ); |
|
86 |
|
87 /** |
|
88 * Changes Status |
|
89 * @param aMessageId Message Id of message which is to be deleted |
|
90 * @param aStatusFlag Status flag |
|
91 * @param aFlagValue Flag value |
|
92 * @param aCallback CallBack object for asynchronous operation |
|
93 */ |
|
94 IMPORT_C void ChangeStatusL( const TMsvId aMessageId, |
|
95 const TMessageStatusFlag aStatusFlag, |
|
96 const TBool aFlagValue, |
|
97 CMsgCallbackBase* aCallback = NULL ); |
|
98 |
|
99 /** |
|
100 * Gives notification |
|
101 * @param aNotification Notification type |
|
102 * @param aCallback CallBack object for asynchronous operation |
|
103 */ |
|
104 IMPORT_C TInt RequestNotification( const TNotificationType aNotification, |
|
105 CMsgCallbackBase* aCallback ); |
|
106 |
|
107 /** |
|
108 * Cancels notification |
|
109 * @param aNotification Notification type |
|
110 * @param aCallback CallBack object for asynchronous operation |
|
111 */ |
|
112 IMPORT_C TInt CancelNotification( const TNotificationType aNotification, |
|
113 CMsgCallbackBase* aCallback = NULL ); |
|
114 |
|
115 |
|
116 /** |
|
117 * Gives list of message ids |
|
118 * @param aFilterParams Filter parameters |
|
119 * @param aFolderId Folder to be used (Inbox/outbox/send/...) |
|
120 * @param aCallback CallBack object for asynchronous operation |
|
121 * @param aEntrySelection output pararmeter for the result id array |
|
122 */ |
|
123 IMPORT_C void GetIdListL( CFilterParamInfo* aFilterParams, |
|
124 TMsvId aFolderId, |
|
125 CMsgCallbackBase* /*aCallback*/, |
|
126 CMsvEntrySelection*& aEntrySelection ); |
|
127 |
|
128 /** |
|
129 * Gives next header based on inputs |
|
130 * @param aFilterParams Filter parameters |
|
131 * @param aEntrySelection array of message ids on which filteration to be done |
|
132 * @param aIndex starting position on aEntrySelection to be start search |
|
133 * @param aCallback CallBack object for asynchronous operation |
|
134 * @param aHeader output pararmeter for the result header |
|
135 */ |
|
136 IMPORT_C void GetNextHeaderL( CFilterParamInfo* aFilterParams, |
|
137 CMsvEntrySelection* aEntrySelection, |
|
138 TInt& aIndex, |
|
139 CMsgCallbackBase* /*aCallback*/, |
|
140 CMessageHeader*& aHeader ); |
|
141 /** |
|
142 * Gives message details |
|
143 * @param aMessageId Message id |
|
144 * @param aCallback CallBack object for asynchronous operation |
|
145 * @param aResult Output parameter containing requested message details |
|
146 */ |
|
147 IMPORT_C void GetMessageDetailL( const TMsvId aMessageId, |
|
148 CMsgCallbackBase* aCallback, |
|
149 CMessageDetailInfo*& aResult ); |
|
150 |
|
151 /** |
|
152 * Cancels asynchronous request |
|
153 * @param aTransactionId asynchronous transaction id |
|
154 * @param aResult error code |
|
155 */ |
|
156 IMPORT_C TInt Cancel( const TInt32 aTransactionId ); |
|
157 |
|
158 |
|
159 //MAsyncRequestObserver drived |
|
160 public: |
|
161 |
|
162 /** |
|
163 * Notifies Messaging service about the completeion of the request |
|
164 * @param aTransactionId TransactionId of Asynchronous request object |
|
165 * @return void |
|
166 */ |
|
167 void RequestComplete( const TInt32 aTransactionId ); |
|
168 |
|
169 private: |
|
170 |
|
171 /** |
|
172 * Represents a channel of communication between a client thread |
|
173 * and the Message Server thread. |
|
174 */ |
|
175 CMsvSession* iMsgServerSession; |
|
176 |
|
177 /** |
|
178 * Provides the interface for notification of events from a Message Server session. |
|
179 */ |
|
180 CMessageObserver* iSessionObserver; |
|
181 |
|
182 /** |
|
183 * Contains handles of all asynchronous requests |
|
184 */ |
|
185 RArray<TAsyncRequestInfo> iAsyncObjArray; |
|
186 }; |
|
187 |
|
188 |
|
189 #endif __MESSAGINGSERVICE_H |