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