author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 14:12:40 +0300 | |
changeset 44 | 36f374c67aa8 |
parent 31 | ebfee66fde93 |
child 47 | 5b14749788d7 |
child 52 | 12db4185673b |
permissions | -rw-r--r-- |
31 | 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 "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: This is the client side server interface. This class makes |
|
15 |
* request to the server and is an interface b/w UI Engine and server. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef __C_CS_REQUEST_HANDLER_H__ |
|
20 |
#define __C_CS_REQUEST_HANDLER_H__ |
|
21 |
||
22 |
// INCLUDE FILES |
|
23 |
||
24 |
// SYSTEM INCLUDES |
|
25 |
#include <mcsplugineventobserver.h> |
|
26 |
||
27 |
// USER INCLUDES |
|
28 |
#include <rcssession.h> |
|
29 |
||
30 |
// FORWARD DECLARATIONS |
|
31 |
class CCsConversationEntry; |
|
32 |
class CCsClientConversation; |
|
33 |
class MCsConversationListChangeObserver; |
|
34 |
class MCsConversationChangeObserver; |
|
35 |
class CCsConversationChangeObserver; |
|
36 |
class MCsResultsObserver; |
|
37 |
class MCsCachingStatusObserver; |
|
38 |
class CCsConversationCache; |
|
39 |
class CCsNotificationHandler; |
|
40 |
||
41 |
// CLASS DECLARATION |
|
42 |
/** |
|
43 |
* CCSRequestHandler |
|
44 |
* This class handles all request and response to server and |
|
45 |
* act as a interface b/w UI engine and Conversation server |
|
46 |
* |
|
47 |
* @remarks Lib: CsServerClientAPI.lib |
|
48 |
* @since S60 v5.0 |
|
49 |
*/ |
|
50 |
class CCSRequestHandler : public CActive |
|
51 |
{ |
|
52 |
||
53 |
public: // Constructors and destructors |
|
54 |
||
55 |
/** |
|
56 |
* NewL. |
|
57 |
* Two-phased constructor. |
|
58 |
* Creates a CCSRequestHandler object using two phase construction, |
|
59 |
* and return a pointer to the created object |
|
60 |
* |
|
61 |
* @return A pointer to the created instance of CCSRequestHandler. |
|
62 |
*/ |
|
63 |
IMPORT_C static CCSRequestHandler* NewL (); |
|
64 |
||
65 |
/** |
|
66 |
* NewLC. |
|
67 |
* Two-phased constructor. |
|
68 |
* Creates a CCSRequestHandler object using two phase construction, |
|
69 |
* and return a pointer to the created object. |
|
70 |
* |
|
71 |
* @return A pointer to the created instance of CCSRequestHandler. |
|
72 |
*/ |
|
73 |
IMPORT_C static CCSRequestHandler* NewLC (); |
|
74 |
||
75 |
/** |
|
76 |
* ~CCSRequestHandler. |
|
77 |
* Destructor. |
|
78 |
* Destroys the object and release all memory objects. |
|
79 |
*/ |
|
80 |
virtual ~CCSRequestHandler (); |
|
81 |
||
82 |
public: // New functions |
|
83 |
||
84 |
/** |
|
85 |
* Version. |
|
86 |
* Returns the conversation server version. |
|
87 |
* Synchronous. |
|
88 |
* |
|
89 |
* @return The current version of conversation server. |
|
90 |
*/ |
|
91 |
IMPORT_C TVersion Version () const; |
|
92 |
||
93 |
/** |
|
94 |
* RequestResultsEventL. |
|
95 |
* Adds observer to handle async results from server |
|
96 |
* Synchronous. |
|
97 |
* |
|
98 |
* @param aObserver The object to be used to handle updates |
|
99 |
* from the server. |
|
100 |
*/ |
|
101 |
IMPORT_C void RequestResultsEventL ( MCsResultsObserver* aObserver ); |
|
102 |
||
103 |
/** |
|
104 |
* RemoveResultsEventL. |
|
105 |
* Removes observer that handle async results from server |
|
106 |
* |
|
107 |
* @param aObserver The object used to handle updates from the server. |
|
108 |
*/ |
|
109 |
IMPORT_C void RemoveResultsEventL ( MCsResultsObserver* aObserver ); |
|
110 |
||
111 |
/** |
|
112 |
* RequestConversationListChangeEventL |
|
113 |
* Adds observer to handle real time conversation list |
|
114 |
* change events from server |
|
115 |
* Synchronous. |
|
116 |
* |
|
117 |
* @param aObserver The object The object to be notified for updates |
|
118 |
* from the server. |
|
119 |
*/ |
|
120 |
IMPORT_C void RequestConversationListChangeEventL ( |
|
121 |
MCsConversationListChangeObserver* aObserver ); |
|
122 |
||
123 |
/** |
|
124 |
* RemoveConversationListChangeEventL |
|
125 |
* Removes observer that handles real time conversation list |
|
126 |
* change events from server |
|
127 |
* Synchronous. |
|
128 |
* |
|
129 |
* @param aObserver The object used to handle updates from the server. |
|
130 |
*/ |
|
131 |
IMPORT_C void RemoveConversationListChangeEventL ( |
|
132 |
MCsConversationListChangeObserver* aObserver ); |
|
133 |
||
134 |
/** |
|
135 |
* RequestConversationChangeEventL |
|
136 |
* Adds observer to handle real time updates for conversation |
|
137 |
* change events from server. As of now its for Meco second view |
|
138 |
* Synchronous. |
|
139 |
* |
|
140 |
* @param aObserver The object to be notified for updates |
|
141 |
* from the server. |
|
142 |
* @param aClientConversation Client conversation object |
|
143 |
*/ |
|
144 |
IMPORT_C void RequestConversationChangeEventL ( |
|
145 |
MCsConversationChangeObserver* aObserver , |
|
146 |
CCsClientConversation* aClientConversation); |
|
147 |
||
148 |
/** |
|
149 |
* RemoveConversationChangeEventL |
|
150 |
* Removes observer that handle async conversation |
|
151 |
* change events from server |
|
152 |
* Synchronous. |
|
153 |
* |
|
154 |
* @param aObserver The object used to handle updates from the server. |
|
155 |
* @param aClientConversation Client conversation object |
|
156 |
*/ |
|
157 |
IMPORT_C void RemoveConversationChangeEventL ( |
|
158 |
MCsConversationChangeObserver* aObserver , |
|
159 |
CCsClientConversation* aClientConversation); |
|
160 |
||
161 |
/** |
|
162 |
* RequestCachingStatusEventL |
|
163 |
* Adds observer to handle async caching status events from server |
|
164 |
* Synchronous. |
|
165 |
* |
|
166 |
* @param aObserver The object to be used to handle updates |
|
167 |
* from the server. |
|
168 |
*/ |
|
169 |
IMPORT_C void RequestCachingStatusEventL ( |
|
170 |
MCsCachingStatusObserver* aObserver ); |
|
171 |
||
172 |
/** |
|
173 |
* RemoveCachingStatusEventL |
|
174 |
* Removes observer that handle async caching status events from server |
|
175 |
* Synchronous. |
|
176 |
* |
|
177 |
* @param aObserver The object used to handle updates from the server. |
|
178 |
*/ |
|
179 |
IMPORT_C void RemoveCachingStatusEventL ( |
|
180 |
MCsCachingStatusObserver* aObserver); |
|
181 |
||
182 |
/** |
|
183 |
* ShutdownServerL. |
|
184 |
* Shuts down the conversation server. |
|
185 |
* Synchronous. |
|
186 |
* |
|
187 |
* CAUTION: Shutdown of conversation server |
|
188 |
* shouldn't be done for each session. |
|
189 |
* It should be done only when the conversation server |
|
190 |
* needs to be completely shutdown. |
|
191 |
*/ |
|
192 |
IMPORT_C void ShutdownServerL(); |
|
193 |
||
194 |
/** |
|
195 |
* Get Recent Conversation Entry list with display name |
|
196 |
* for all stored conversation entry IDs. |
|
197 |
* This is a Async API. |
|
198 |
*/ |
|
199 |
IMPORT_C void GetConversationListL(); |
|
200 |
||
201 |
/** |
|
202 |
* Get Recent unread Conversation Entry list with display name |
|
203 |
* for all stored conversation entry IDs. |
|
204 |
* Synchronous. |
|
205 |
* |
|
206 |
* @param aClientConversationList Pointer to list of CCsClientConversation |
|
207 |
* having only unread conversation entries. |
|
208 |
* @attention Caller is owner of aClientConversationList. ResetAndDestroy(), |
|
209 |
* Close() & delete needs to be called to avoid memory leaks. |
|
210 |
*/ |
|
211 |
IMPORT_C void GetConversationUnreadListL(RPointerArray< |
|
212 |
CCsClientConversation>* aClientConversationList); |
|
213 |
||
214 |
/** |
|
215 |
* Get Conversation Entry list for given Conversation Entry ID. |
|
216 |
* This is a Async API. |
|
217 |
* |
|
218 |
* @param aClientConversation - class encapsulating Conversation Entry ID |
|
219 |
*/ |
|
220 |
IMPORT_C void GetConversationsL( |
|
221 |
CCsClientConversation* aClientConversation ); |
|
222 |
||
223 |
/** |
|
224 |
* Delete a conversation. |
|
225 |
* Synchronous. |
|
226 |
* |
|
227 |
* @param aConversationId The conversation id. |
|
228 |
*/ |
|
229 |
IMPORT_C void DeleteConversationL(TInt aConversationId); |
|
230 |
||
231 |
/** |
|
232 |
* GetCachingStatusL |
|
233 |
* Get caching status |
|
234 |
* Synchronous. |
|
235 |
* |
|
236 |
* @return Caching Status |
|
237 |
* KCacheStatusUnknwon / KCacheStatusStarted / |
|
238 |
* KCacheStatusCompleted / KCacheStatusError |
|
239 |
*/ |
|
240 |
IMPORT_C TUint8 GetCachingStatusL(); |
|
241 |
||
242 |
/** |
|
243 |
* GetTotalUnreadCountL |
|
244 |
* Get total unread conversation entries. |
|
245 |
* Synchronous. |
|
246 |
* |
|
247 |
* @return Total unread conversation entries. |
|
248 |
*/ |
|
249 |
IMPORT_C TUint32 GetTotalUnreadCountL(); |
|
250 |
||
251 |
/** |
|
252 |
* Get the conversation identifier for a contact. |
|
253 |
* @param Contact Id. |
|
254 |
* @return Conversation Id. |
|
255 |
*/ |
|
256 |
IMPORT_C TInt GetConversationIdL ( TInt aContactId ); |
|
257 |
||
258 |
/** |
|
259 |
* Get the conversation identifier for a contact. |
|
260 |
* @param Contact address. |
|
261 |
* @return Conversation Id. |
|
262 |
*/ |
|
263 |
IMPORT_C TInt GetConversationIdFromAddressL ( TDesC& aContactAddress ); |
|
264 |
||
265 |
/** |
|
266 |
* MarkConversationReadL |
|
267 |
* Mark conversation as read. |
|
268 |
* This is Sync API. |
|
269 |
* Read status is set in the background. |
|
270 |
* |
|
271 |
* @param aConversationId Conversation Id. |
|
272 |
*/ |
|
273 |
IMPORT_C void MarkConversationReadL ( TInt aConversationId ); |
|
274 |
||
275 |
/** |
|
276 |
* GetMessagingHistoryL. |
|
277 |
* Get the messaging history for a contact. |
|
278 |
* This is Async API. |
|
279 |
* Data is returned via MCsResultsObserver. |
|
280 |
* |
|
281 |
* @param aContactId Contact Id. |
|
282 |
*/ |
|
283 |
IMPORT_C void GetMessagingHistoryL ( TInt aContactId ); |
|
284 |
||
285 |
/** |
|
286 |
* ClearMessagingHistoryL |
|
287 |
* Clear the messaging history for a contact. |
|
288 |
* This is Sync API. |
|
289 |
* Delete is done in the background. |
|
290 |
* |
|
291 |
* @param aContactId Contact Id. |
|
292 |
*/ |
|
293 |
IMPORT_C void ClearMessagingHistoryL ( TInt aContactId ); |
|
294 |
||
295 |
/** |
|
296 |
* MarkMessagingHistoryReadL |
|
297 |
* Set the messaging history as read. |
|
298 |
* This is Sync API. |
|
299 |
* Read status is set in the background. |
|
300 |
* |
|
301 |
* @param aContactId Contact Id. |
|
302 |
*/ |
|
303 |
IMPORT_C void MarkMessagingHistoryReadL ( TInt aContactId ); |
|
304 |
||
305 |
/** |
|
306 |
* Get the conversation for a message. |
|
307 |
* @param Message Id. |
|
308 |
* @return CCsClientConversation |
|
309 |
*/ |
|
310 |
IMPORT_C CCsClientConversation* GetConversationFromMessageIdL ( TInt aMessageId ); |
|
311 |
||
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
312 |
IMPORT_C CCsClientConversation* GetConversationFromConversationIdL( TInt aConversationId ); |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
313 |
|
31 | 314 |
protected: // Functions from base classes |
315 |
||
316 |
/** |
|
317 |
* RunL |
|
318 |
* From CActive, RunL. |
|
319 |
* Callback function. |
|
320 |
* Invoked to handle responses from the server. |
|
321 |
*/ |
|
322 |
void RunL(); |
|
323 |
||
324 |
/** |
|
325 |
* DoCancel |
|
326 |
* From CActive, DoCancel. |
|
327 |
* Cancels any outstanding operation. |
|
328 |
*/ |
|
329 |
void DoCancel (); |
|
330 |
||
331 |
private: // Constructors and destructors |
|
332 |
||
333 |
/** |
|
334 |
* CCSRequestHandler. |
|
335 |
* Performs the first phase of two phase construction. |
|
336 |
*/ |
|
337 |
CCSRequestHandler (); |
|
338 |
||
339 |
/** |
|
340 |
* ConstructL. |
|
341 |
* Performs the second phase construction of a |
|
342 |
* CCSRequestHandler object. |
|
343 |
*/ |
|
344 |
void ConstructL (); |
|
345 |
||
346 |
/** |
|
347 |
* HandleGetConversationListResults |
|
348 |
* This is for handling GetEntryList results asynchronusly |
|
349 |
* from the server. |
|
350 |
*/ |
|
351 |
void HandleGetConversationListResults(); |
|
352 |
||
353 |
/** |
|
354 |
* HandleGetConversationResults |
|
355 |
* This is for handling GetConversation results |
|
356 |
* async callback from server. |
|
357 |
*/ |
|
358 |
void HandleGetConversationResults(); |
|
359 |
||
360 |
/** |
|
361 |
* HandleGetConversationListOverflow. |
|
362 |
* This is for handling GetEntryList results buffer |
|
363 |
* overflow error. |
|
364 |
*/ |
|
365 |
void HandleGetConversationListOverflow(); |
|
366 |
||
367 |
/** |
|
368 |
* HandleGetConversationOverflow. |
|
369 |
* This is for handling GetConversation results buffer |
|
370 |
* overflow error. |
|
371 |
*/ |
|
372 |
void HandleGetConversationOverflow(); |
|
373 |
||
374 |
/** |
|
375 |
* HandleErrorL. |
|
376 |
* Handles error events from server. |
|
377 |
* |
|
378 |
* @param aErrorCode Error code . |
|
379 |
*/ |
|
380 |
void HandleErrorL ( TInt aErrorCode ); |
|
381 |
||
382 |
/** |
|
383 |
* HandleAddConversationList. |
|
384 |
* Handles new conversation list event. |
|
385 |
*/ |
|
386 |
void HandleAddConversationList (HBufC8* aResultsBuffer); |
|
387 |
||
388 |
/** |
|
389 |
* HandleDeleteConversationList. |
|
390 |
* Handles delete conversation list event. |
|
391 |
*/ |
|
392 |
void HandleDeleteConversationList (HBufC8* aResultsBuffer); |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
393 |
|
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
394 |
/** |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
395 |
* HandlePartialDeleteConversationList |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
396 |
* Handles partial delete of conversation event. |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
397 |
*/ |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
398 |
void HandlePartialDeleteConversationList(HBufC8* aResultsBuffer); |
31 | 399 |
|
400 |
/** |
|
401 |
* HandleModifyConversationList. |
|
402 |
* Handles modify conversation list event. |
|
403 |
*/ |
|
404 |
void HandleModifyConversationList (HBufC8* aResultsBuffer); |
|
405 |
||
406 |
/** |
|
407 |
* HandleAddConversation. |
|
408 |
* Handles add conversation event. |
|
409 |
*/ |
|
410 |
void HandleAddConversation (HBufC8* aResultsBuffer); |
|
411 |
||
412 |
/** |
|
413 |
* HandleDeleteConversationEvent. |
|
414 |
* Handles delete conversation event. |
|
415 |
*/ |
|
416 |
void HandleDeleteConversation (HBufC8* aResultsBuffer); |
|
417 |
||
418 |
/** |
|
419 |
* HandleModifyConversationEvent. |
|
420 |
* Handles modify conversation event. |
|
421 |
*/ |
|
422 |
void HandleModifyConversation (HBufC8* aResultsBuffer); |
|
423 |
||
424 |
/** |
|
425 |
* HandleCachingStarted. |
|
426 |
* Handles caching started event. |
|
427 |
*/ |
|
428 |
void HandleCachingStarted (HBufC8* aResultsBuffer); |
|
429 |
||
430 |
/** |
|
431 |
* HandleCachingCompleted. |
|
432 |
* Handles caching Completed event. |
|
433 |
*/ |
|
434 |
void HandleCachingCompleted (HBufC8* aResultsBuffer); |
|
435 |
||
436 |
/** |
|
437 |
* HandleCachingError |
|
438 |
* Handles caching error event. |
|
439 |
*/ |
|
440 |
void HandleCachingError (HBufC8* aResultsBuffer); |
|
441 |
||
442 |
/** |
|
443 |
* HandleRefreshConversationList |
|
444 |
* Handles refresh list event. |
|
445 |
*/ |
|
446 |
void HandleRefreshConversationList (HBufC8* aResultsBuffer); |
|
447 |
||
448 |
/** |
|
449 |
* HandleRefreshConversation |
|
450 |
* Handles refresh event. |
|
451 |
*/ |
|
452 |
void HandleRefreshConversation (HBufC8* aResultsBuffer); |
|
453 |
||
454 |
private: // Data |
|
455 |
||
456 |
friend class CCsNotificationHandler; |
|
457 |
||
458 |
/** |
|
459 |
* iSession |
|
460 |
* The conversation server csession. |
|
461 |
* Own. |
|
462 |
*/ |
|
463 |
RCsSession iSession; |
|
464 |
||
465 |
/** |
|
466 |
* iResultsObserver |
|
467 |
* Observer which handles conversation event from server. |
|
468 |
* Own. |
|
469 |
*/ |
|
470 |
MCsResultsObserver* iResultsObserver; |
|
471 |
||
472 |
/** |
|
473 |
* iConversationListChangeObserver |
|
474 |
* Observer which handle conversation list changes. |
|
475 |
* Own. |
|
476 |
*/ |
|
477 |
MCsConversationListChangeObserver* iConversationListChangeObserver; |
|
478 |
||
479 |
/** |
|
480 |
* iConversationChangeObserver |
|
481 |
* Observer which handles conversation changes. |
|
482 |
* Own. |
|
483 |
*/ |
|
484 |
CCsConversationChangeObserver* iConversationChangeObserver; |
|
485 |
||
486 |
/** |
|
487 |
* iCachingChangeObserver |
|
488 |
* Observers which handle conversation change events from server. |
|
489 |
* Own. |
|
490 |
*/ |
|
491 |
MCsCachingStatusObserver* iCachingStatusObserver; |
|
492 |
||
493 |
/** |
|
494 |
* iBuffer |
|
495 |
* The buffer that holds the conversation data like contact |
|
496 |
* or conversation entry id. Required for IPC with server. |
|
497 |
* Own. |
|
498 |
*/ |
|
499 |
HBufC8* iBuffer; |
|
500 |
||
501 |
/** |
|
502 |
* iResultsBuffer. |
|
503 |
* The buffer hold the response data for IPC communication. |
|
504 |
* Use this buffer sync calls to server. |
|
505 |
* Own. |
|
506 |
*/ |
|
507 |
HBufC8* iResultsBuffer; |
|
508 |
||
509 |
/** |
|
510 |
* iListResultsBuffer. |
|
511 |
* The buffer is used for async call to get conversation list |
|
512 |
* from server. |
|
513 |
* Own. |
|
514 |
*/ |
|
515 |
HBufC8* iListResultsBuffer; |
|
516 |
||
517 |
/** |
|
518 |
* iConvResultsBuffer. |
|
519 |
* The buffer is used for async call to get conversations |
|
520 |
* from server. |
|
521 |
* Own. |
|
522 |
*/ |
|
523 |
HBufC8* iConvResultsBuffer; |
|
524 |
||
525 |
/** |
|
526 |
* iNotificationHandler |
|
527 |
* Own. |
|
528 |
*/ |
|
529 |
CCsNotificationHandler* iNotificationHandler; |
|
530 |
||
531 |
}; |
|
532 |
#endif //__C_CS_REQUEST_HANDLER_H__ |
|
533 |
||
534 |
// End of File |