|
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: CS Server Client Session class |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __C_CS_SESSION_H |
|
19 #define __C_CS_SESSION_H |
|
20 |
|
21 // USER INCLUDE FILES |
|
22 #include "mcsconversationdeleteobserver.h" |
|
23 #include "mcsconversationmarkreadobserver.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CCsServer; |
|
27 class CCsPluginInterface; |
|
28 class CCsClientConversation; |
|
29 class CCsConversationEvent; |
|
30 class CCsConversationDeleteHandler; |
|
31 class CCsConversationMarkReadHandler; |
|
32 |
|
33 // CLASS DECLARATIONS |
|
34 |
|
35 /** |
|
36 * Represents a session (version 2) for a client thread on |
|
37 * the server side |
|
38 */ |
|
39 class CCsSession : public CSession2, |
|
40 public MCsConversationDeleteObserver, |
|
41 public MCsConversationMarkReadObserver |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 * Two phase construction |
|
47 * |
|
48 * @param aServer, instance of CsServer |
|
49 */ |
|
50 static CCsSession* NewL(CCsServer* aServer); |
|
51 |
|
52 /** |
|
53 * ServiceL |
|
54 * Handles the servicing of client requests |
|
55 * Implements CSession2 ServiceL |
|
56 * |
|
57 * @param aMessage RMessage reference |
|
58 */ |
|
59 void ServiceL(const RMessage2& aMessage); |
|
60 |
|
61 /** |
|
62 * ServiceError |
|
63 * Handles the leaves generated by ServiceL function |
|
64 * Implements CSession2 ServiceError |
|
65 * |
|
66 * @param aMessage RMessage instance |
|
67 * @parea, aError the error occured during the service |
|
68 */ |
|
69 void ServiceError( |
|
70 const RMessage2& aMessage, |
|
71 TInt aError); |
|
72 |
|
73 /** |
|
74 * HandleNewConversationListEventL |
|
75 * Handles the new conversation list event received from cache |
|
76 * asynchronously |
|
77 * |
|
78 * @param aClientConversation the client conversation to be processed |
|
79 */ |
|
80 void HandleNewConversationListEventL( |
|
81 CCsClientConversation* aClientConversation); |
|
82 |
|
83 /** |
|
84 * HandleDeleteConversationListEventL |
|
85 * Handles the delete conversation list event received from cache |
|
86 * asynchronously |
|
87 * |
|
88 * @param aClientConversation the client conversation to be processed |
|
89 */ |
|
90 void HandleDeleteConversationListEventL( |
|
91 CCsClientConversation* aClientConversation); |
|
92 |
|
93 /** |
|
94 * HandleModifyConversationListEventL |
|
95 * Handles the modify conversation modify event received from cache |
|
96 * asynchronously |
|
97 * |
|
98 * @param aClientConversation the client conversation to be processed |
|
99 */ |
|
100 void HandleModifyConversationListEventL( |
|
101 CCsClientConversation* aClientConversation); |
|
102 |
|
103 /** |
|
104 * HandleNewConversationEventL |
|
105 * Handles the new conversation event received from cache |
|
106 * asynchronously |
|
107 * |
|
108 * @param aClientConversation the client conversation to be processed |
|
109 */ |
|
110 void HandleNewConversationEventL( |
|
111 CCsClientConversation* aClientConversation); |
|
112 |
|
113 /** |
|
114 * HandleDeleteConversationEventL |
|
115 * Handles the delete conversation event received from cache |
|
116 * asynchronously |
|
117 * |
|
118 * @param aClientConversation the client conversation to be processed |
|
119 */ |
|
120 void HandleDeleteConversationEventL( |
|
121 CCsClientConversation* aClientConversation); |
|
122 |
|
123 /** |
|
124 * HandleModifyConversationEventL |
|
125 * Handles the modify conversation event received from cache |
|
126 * asynchronously |
|
127 * |
|
128 * @param aClientConversation the client conversation to be processed |
|
129 */ |
|
130 void HandleModifyConversationEventL( |
|
131 CCsClientConversation* aClientConversation); |
|
132 |
|
133 /** |
|
134 * HandleChangeEventL |
|
135 * Handle on-the-fly data changes event |
|
136 * |
|
137 * @param aConversation , conversation change |
|
138 * @param aEvent, event for the change |
|
139 */ |
|
140 void HandleChangeEventL(CCsClientConversation* aConversation, |
|
141 TUint32 aEvent ); |
|
142 |
|
143 /** |
|
144 * HandleRefreshConversationListL. |
|
145 * Notify client to refresh conversation list. |
|
146 */ |
|
147 void HandleRefreshConversationListL(); |
|
148 |
|
149 /** |
|
150 * HandleRefreshConversationList. |
|
151 * Notify client to refresh conversations. |
|
152 */ |
|
153 void HandleRefreshConversationL(); |
|
154 |
|
155 public: |
|
156 // From MCsConversationDeleteObserver |
|
157 void DeleteComplete(CCsConversationDeleteHandler* aHandler); |
|
158 void DeleteInProgress(CCsConversationDeleteHandler* aHandler); |
|
159 |
|
160 public: |
|
161 // From MCsConversationMarkReadObserver |
|
162 void MarkReadComplete(CCsConversationMarkReadHandler* aHandler); |
|
163 |
|
164 private: |
|
165 |
|
166 /** |
|
167 * Second phase constructor |
|
168 */ |
|
169 void ConstructL(); |
|
170 |
|
171 /** |
|
172 * Constructor |
|
173 */ |
|
174 CCsSession(CCsServer* aServer); |
|
175 |
|
176 /** |
|
177 * Destructor |
|
178 */ |
|
179 ~CCsSession(); |
|
180 |
|
181 /** |
|
182 * DoServiceL |
|
183 * Serve the client requests |
|
184 * |
|
185 * @param aMessage, RMessage instace |
|
186 */ |
|
187 void DoServiceL(const RMessage2& aMessage); |
|
188 |
|
189 /** |
|
190 * GetConversationsL |
|
191 * Service method to get the |
|
192 * conversation entry list for one conversation entry ID |
|
193 * |
|
194 * @param aMessage RMessage instace |
|
195 */ |
|
196 void GetConversationsL(const RMessage2& aMessage); |
|
197 |
|
198 /** |
|
199 * GetConversationListL |
|
200 * Service method to get the |
|
201 * list of recent(latest) conversation entry and |
|
202 * list of dispalyname for all stored conversation entry ID |
|
203 * |
|
204 * @param aMessage RMessage instace |
|
205 */ |
|
206 void GetConversationListL(const RMessage2& aMessage); |
|
207 |
|
208 /** |
|
209 * GetConversationUnreadListL |
|
210 * Service method to get the |
|
211 * list of recent(latest) unread conversation entry and |
|
212 * list of dispalyname for all stored conversation entry ID |
|
213 * |
|
214 * @param aMessage RMessage instace |
|
215 */ |
|
216 void GetConversationUnreadListL(const RMessage2& aMessage); |
|
217 |
|
218 /** |
|
219 * DeleteConversationL |
|
220 * Service method to delete a conversation |
|
221 * |
|
222 * @param aMessage RMessage instace |
|
223 */ |
|
224 void DeleteConversationL(const RMessage2& aMessage); |
|
225 |
|
226 /** |
|
227 * ShutdownServerL |
|
228 * Service method to shutdown the server |
|
229 * |
|
230 * @param aMessage RMessage instace |
|
231 */ |
|
232 void ShutdownServerL(const RMessage2& aMessage); |
|
233 |
|
234 /** |
|
235 * RequestChangeEventL |
|
236 * Service method to request add as observer |
|
237 * for on cache change events |
|
238 * |
|
239 * @param aMessage RMessage instace |
|
240 */ |
|
241 void RequestChangeEventL(const RMessage2& aMessage); |
|
242 |
|
243 /** |
|
244 * RemoveChangeEventL |
|
245 * Service method to remove as observer |
|
246 * for on cache change events |
|
247 * |
|
248 * @param aMessage RMessage instace |
|
249 */ |
|
250 void RemoveChangeEventL(const RMessage2& aMessage); |
|
251 |
|
252 /** |
|
253 * GetCachingStatusL |
|
254 * Service method to request conversation server |
|
255 * to get caching status |
|
256 * |
|
257 * @param aMessage RMessage instace |
|
258 */ |
|
259 void GetCachingStatusL(const RMessage2& aMessage); |
|
260 |
|
261 /** |
|
262 * GetTotalUnreadCountL |
|
263 * Gets total unread conversation entries. |
|
264 * |
|
265 * @param aMessage RMessage instace |
|
266 */ |
|
267 void GetTotalUnreadCountL(const RMessage2& aMessage); |
|
268 |
|
269 /** |
|
270 * SetConversationListChangeObserverL |
|
271 * Service method to request conversation server |
|
272 * to set conversation list change observer flag |
|
273 * |
|
274 * @param aMessage RMessage instace |
|
275 */ |
|
276 void SetConversationListChangeObserverL(const RMessage2& aMessage); |
|
277 |
|
278 /** |
|
279 * ResetConversationListChangeObserverL |
|
280 * Service method to request conversation server |
|
281 * to reset conversation list change observer flag |
|
282 * |
|
283 * @param aMessage RMessage instace |
|
284 */ |
|
285 void ResetConversationListChangeObserverL(const RMessage2& aMessage); |
|
286 |
|
287 /** |
|
288 * SetConversationChangeObserverL |
|
289 * Service method to request conversation server |
|
290 * to set conversation change observer flag for given |
|
291 * client conversation |
|
292 * |
|
293 * @param aMessage RMessage instace |
|
294 */ |
|
295 void SetConversationChangeObserverL(const RMessage2& aMessage); |
|
296 |
|
297 /** |
|
298 * ResetConversationChangeObserverL |
|
299 * Service method to request conversation server |
|
300 * to reset conversation change observer flag for given |
|
301 * client conversation |
|
302 * |
|
303 * @param aMessage RMessage instace |
|
304 */ |
|
305 void ResetConversationChangeObserverL(const RMessage2& aMessage); |
|
306 |
|
307 /** |
|
308 * SetCachingStatusObserverL |
|
309 * Service method to request conversation server |
|
310 * to set caching status observer flag |
|
311 * |
|
312 * @param aMessage RMessage instace |
|
313 */ |
|
314 void SetCachingStatusObserverL(const RMessage2& aMessage); |
|
315 |
|
316 /** |
|
317 * ResetCachingStatusObserverL |
|
318 * Service method to request conversation server |
|
319 * to reset caching status observer flag |
|
320 * |
|
321 * @param aMessage RMessage instance |
|
322 */ |
|
323 void ResetCachingStatusObserverL(const RMessage2& aMessage); |
|
324 |
|
325 /** |
|
326 * NotifyClient |
|
327 * Notify client for cache change event |
|
328 * |
|
329 * @param aConversationEvent instance of the event to be notified |
|
330 */ |
|
331 void NotifyClient(CCsConversationEvent* aConversationEvent); |
|
332 |
|
333 /** |
|
334 * GetConversationIdL |
|
335 * Get the conversation id. |
|
336 * |
|
337 * @param aMessage RMessage instance |
|
338 */ |
|
339 void GetConversationIdL(const RMessage2& aMessage); |
|
340 |
|
341 /** |
|
342 * GetConversationIdfromAddressL |
|
343 * Get the conversation id from address |
|
344 * |
|
345 * @param aMessage RMessage instance |
|
346 */ |
|
347 void GetConversationIdfromAddressL(const RMessage2& aMessage); |
|
348 /** |
|
349 * MarkConversationReadL |
|
350 * Service method to mark a conversation as read. |
|
351 * |
|
352 * @param aMessage RMessage instance |
|
353 */ |
|
354 void MarkConversationReadL(const RMessage2& aMessage); |
|
355 |
|
356 private: |
|
357 |
|
358 /** |
|
359 * iServer |
|
360 * Reference to server (not owned) |
|
361 */ |
|
362 CCsServer* iServer; |
|
363 |
|
364 /** |
|
365 * Buf for doing IPC |
|
366 * Own |
|
367 */ |
|
368 HBufC8* des; |
|
369 |
|
370 /** |
|
371 * iEventList |
|
372 * Temp list of cache change event |
|
373 * Own |
|
374 */ |
|
375 RPointerArray<CCsConversationEvent>* iEventList; |
|
376 |
|
377 /** |
|
378 * iMonitoredConversation |
|
379 * Conversation monitored for changes. |
|
380 */ |
|
381 CCsClientConversation* iMonitoredConversation; |
|
382 |
|
383 /** |
|
384 * iAsyncReqRMessage |
|
385 * Store RMeessage received from clinet |
|
386 * for cache change event notification |
|
387 * (NotOwned) |
|
388 */ |
|
389 RMessagePtr2 iAsyncReqRMessage; |
|
390 |
|
391 /** |
|
392 * iBufferOverflow |
|
393 * boolean to make if overflow has occured |
|
394 */ |
|
395 TBool iBufferOverflow; |
|
396 |
|
397 /** |
|
398 * iGetConversationBufferOverflow |
|
399 * boolean to make if overflow has occured in API GetConversation |
|
400 */ |
|
401 TBool iGetConversationBufferOverflow; |
|
402 |
|
403 /** |
|
404 * iNotifyHandling |
|
405 * iAsyncReqRMessage is valid or not for |
|
406 * notification handling |
|
407 * Owned |
|
408 */ |
|
409 TBool iNotifyHandling; |
|
410 |
|
411 /** |
|
412 * iConversationListChangeObserver |
|
413 * It will true if observer |
|
414 * registered for conversation List change event |
|
415 * Owned |
|
416 */ |
|
417 TBool iConversationListChangeObserver; |
|
418 |
|
419 /** |
|
420 * iConversationChangeObserver |
|
421 * It will true if observer |
|
422 * registered for conversation change observer |
|
423 * Owned |
|
424 */ |
|
425 TBool iConversationChangeObserver; |
|
426 |
|
427 /** |
|
428 * iCachingChangeObserver |
|
429 * It will true if observer |
|
430 * registered for caching status change observer |
|
431 * Owned |
|
432 */ |
|
433 TBool iCachingChangeObserver; |
|
434 |
|
435 /** |
|
436 * iReqCnt |
|
437 * Maintains the count of requests which are being served |
|
438 */ |
|
439 TInt iReqCnt; |
|
440 }; |
|
441 |
|
442 #endif // __C_CS_SESSION_H |
|
443 |