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 |
|
|
312 |
protected: // Functions from base classes
|
|
313 |
|
|
314 |
/**
|
|
315 |
* RunL
|
|
316 |
* From CActive, RunL.
|
|
317 |
* Callback function.
|
|
318 |
* Invoked to handle responses from the server.
|
|
319 |
*/
|
|
320 |
void RunL();
|
|
321 |
|
|
322 |
/**
|
|
323 |
* DoCancel
|
|
324 |
* From CActive, DoCancel.
|
|
325 |
* Cancels any outstanding operation.
|
|
326 |
*/
|
|
327 |
void DoCancel ();
|
|
328 |
|
|
329 |
private: // Constructors and destructors
|
|
330 |
|
|
331 |
/**
|
|
332 |
* CCSRequestHandler.
|
|
333 |
* Performs the first phase of two phase construction.
|
|
334 |
*/
|
|
335 |
CCSRequestHandler ();
|
|
336 |
|
|
337 |
/**
|
|
338 |
* ConstructL.
|
|
339 |
* Performs the second phase construction of a
|
|
340 |
* CCSRequestHandler object.
|
|
341 |
*/
|
|
342 |
void ConstructL ();
|
|
343 |
|
|
344 |
/**
|
|
345 |
* HandleGetConversationListResults
|
|
346 |
* This is for handling GetEntryList results asynchronusly
|
|
347 |
* from the server.
|
|
348 |
*/
|
|
349 |
void HandleGetConversationListResults();
|
|
350 |
|
|
351 |
/**
|
|
352 |
* HandleGetConversationResults
|
|
353 |
* This is for handling GetConversation results
|
|
354 |
* async callback from server.
|
|
355 |
*/
|
|
356 |
void HandleGetConversationResults();
|
|
357 |
|
|
358 |
/**
|
|
359 |
* HandleGetConversationListOverflow.
|
|
360 |
* This is for handling GetEntryList results buffer
|
|
361 |
* overflow error.
|
|
362 |
*/
|
|
363 |
void HandleGetConversationListOverflow();
|
|
364 |
|
|
365 |
/**
|
|
366 |
* HandleGetConversationOverflow.
|
|
367 |
* This is for handling GetConversation results buffer
|
|
368 |
* overflow error.
|
|
369 |
*/
|
|
370 |
void HandleGetConversationOverflow();
|
|
371 |
|
|
372 |
/**
|
|
373 |
* HandleErrorL.
|
|
374 |
* Handles error events from server.
|
|
375 |
*
|
|
376 |
* @param aErrorCode Error code .
|
|
377 |
*/
|
|
378 |
void HandleErrorL ( TInt aErrorCode );
|
|
379 |
|
|
380 |
/**
|
|
381 |
* HandleAddConversationList.
|
|
382 |
* Handles new conversation list event.
|
|
383 |
*/
|
|
384 |
void HandleAddConversationList (HBufC8* aResultsBuffer);
|
|
385 |
|
|
386 |
/**
|
|
387 |
* HandleDeleteConversationList.
|
|
388 |
* Handles delete conversation list event.
|
|
389 |
*/
|
|
390 |
void HandleDeleteConversationList (HBufC8* aResultsBuffer);
|
|
391 |
|
|
392 |
/**
|
|
393 |
* HandleModifyConversationList.
|
|
394 |
* Handles modify conversation list event.
|
|
395 |
*/
|
|
396 |
void HandleModifyConversationList (HBufC8* aResultsBuffer);
|
|
397 |
|
|
398 |
/**
|
|
399 |
* HandleAddConversation.
|
|
400 |
* Handles add conversation event.
|
|
401 |
*/
|
|
402 |
void HandleAddConversation (HBufC8* aResultsBuffer);
|
|
403 |
|
|
404 |
/**
|
|
405 |
* HandleDeleteConversationEvent.
|
|
406 |
* Handles delete conversation event.
|
|
407 |
*/
|
|
408 |
void HandleDeleteConversation (HBufC8* aResultsBuffer);
|
|
409 |
|
|
410 |
/**
|
|
411 |
* HandleModifyConversationEvent.
|
|
412 |
* Handles modify conversation event.
|
|
413 |
*/
|
|
414 |
void HandleModifyConversation (HBufC8* aResultsBuffer);
|
|
415 |
|
|
416 |
/**
|
|
417 |
* HandleCachingStarted.
|
|
418 |
* Handles caching started event.
|
|
419 |
*/
|
|
420 |
void HandleCachingStarted (HBufC8* aResultsBuffer);
|
|
421 |
|
|
422 |
/**
|
|
423 |
* HandleCachingCompleted.
|
|
424 |
* Handles caching Completed event.
|
|
425 |
*/
|
|
426 |
void HandleCachingCompleted (HBufC8* aResultsBuffer);
|
|
427 |
|
|
428 |
/**
|
|
429 |
* HandleCachingError
|
|
430 |
* Handles caching error event.
|
|
431 |
*/
|
|
432 |
void HandleCachingError (HBufC8* aResultsBuffer);
|
|
433 |
|
|
434 |
/**
|
|
435 |
* HandleRefreshConversationList
|
|
436 |
* Handles refresh list event.
|
|
437 |
*/
|
|
438 |
void HandleRefreshConversationList (HBufC8* aResultsBuffer);
|
|
439 |
|
|
440 |
/**
|
|
441 |
* HandleRefreshConversation
|
|
442 |
* Handles refresh event.
|
|
443 |
*/
|
|
444 |
void HandleRefreshConversation (HBufC8* aResultsBuffer);
|
|
445 |
|
|
446 |
private: // Data
|
|
447 |
|
|
448 |
friend class CCsNotificationHandler;
|
|
449 |
|
|
450 |
/**
|
|
451 |
* iSession
|
|
452 |
* The conversation server csession.
|
|
453 |
* Own.
|
|
454 |
*/
|
|
455 |
RCsSession iSession;
|
|
456 |
|
|
457 |
/**
|
|
458 |
* iResultsObserver
|
|
459 |
* Observer which handles conversation event from server.
|
|
460 |
* Own.
|
|
461 |
*/
|
|
462 |
MCsResultsObserver* iResultsObserver;
|
|
463 |
|
|
464 |
/**
|
|
465 |
* iConversationListChangeObserver
|
|
466 |
* Observer which handle conversation list changes.
|
|
467 |
* Own.
|
|
468 |
*/
|
|
469 |
MCsConversationListChangeObserver* iConversationListChangeObserver;
|
|
470 |
|
|
471 |
/**
|
|
472 |
* iConversationChangeObserver
|
|
473 |
* Observer which handles conversation changes.
|
|
474 |
* Own.
|
|
475 |
*/
|
|
476 |
CCsConversationChangeObserver* iConversationChangeObserver;
|
|
477 |
|
|
478 |
/**
|
|
479 |
* iCachingChangeObserver
|
|
480 |
* Observers which handle conversation change events from server.
|
|
481 |
* Own.
|
|
482 |
*/
|
|
483 |
MCsCachingStatusObserver* iCachingStatusObserver;
|
|
484 |
|
|
485 |
/**
|
|
486 |
* iBuffer
|
|
487 |
* The buffer that holds the conversation data like contact
|
|
488 |
* or conversation entry id. Required for IPC with server.
|
|
489 |
* Own.
|
|
490 |
*/
|
|
491 |
HBufC8* iBuffer;
|
|
492 |
|
|
493 |
/**
|
|
494 |
* iResultsBuffer.
|
|
495 |
* The buffer hold the response data for IPC communication.
|
|
496 |
* Use this buffer sync calls to server.
|
|
497 |
* Own.
|
|
498 |
*/
|
|
499 |
HBufC8* iResultsBuffer;
|
|
500 |
|
|
501 |
/**
|
|
502 |
* iListResultsBuffer.
|
|
503 |
* The buffer is used for async call to get conversation list
|
|
504 |
* from server.
|
|
505 |
* Own.
|
|
506 |
*/
|
|
507 |
HBufC8* iListResultsBuffer;
|
|
508 |
|
|
509 |
/**
|
|
510 |
* iConvResultsBuffer.
|
|
511 |
* The buffer is used for async call to get conversations
|
|
512 |
* from server.
|
|
513 |
* Own.
|
|
514 |
*/
|
|
515 |
HBufC8* iConvResultsBuffer;
|
|
516 |
|
|
517 |
/**
|
|
518 |
* iNotificationHandler
|
|
519 |
* Own.
|
|
520 |
*/
|
|
521 |
CCsNotificationHandler* iNotificationHandler;
|
|
522 |
|
|
523 |
};
|
|
524 |
#endif //__C_CS_REQUEST_HANDLER_H__
|
|
525 |
|
|
526 |
// End of File
|