|
1 /* |
|
2 * Copyright (c) 2002-2005 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: |
|
15 * WV engine group feature interface. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef RImpsGroupCli_H |
|
21 #define RImpsGroupCli_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 #include <bamdesca.h> |
|
27 #include "impsconst.h" |
|
28 #include "impsgroupprops.h" |
|
29 #include "impsclient.h" |
|
30 |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CImpsGroupHandler2; |
|
34 class MImpsGroupHandler2; |
|
35 class CImpsGroupCommand2; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * RImpsGroupClient2 API |
|
41 * |
|
42 * Applications use the subsystem via RImpsGroupClient2 class. First, they |
|
43 * need to connect to the server by calling RegisterL() member function. |
|
44 * |
|
45 * When everything is done, call Unregister() to end |
|
46 * the session. |
|
47 * |
|
48 * A user of this API must be aware that raising/releasing |
|
49 * the PDP context may affect the response times of called functions. |
|
50 * |
|
51 * Observer methods: |
|
52 * ----------------------- |
|
53 * Client can be notified when a certain type of message is received |
|
54 * from the remote server. |
|
55 * Client has to be connected in the server in order to get notify events. |
|
56 * If the client is disconnected by server by calling Unregister(), all notify |
|
57 * requests and possible incoming events are canceled. |
|
58 * |
|
59 * Notify events are session-specific, |
|
60 * ie. if you have several RImpsGroupClients |
|
61 * connected to the server, each has its own notify requests. |
|
62 * |
|
63 * In order to use notify services, you need to implement MImpsGroupHandler2 |
|
64 * and give a pointer to your class in RegisterL. |
|
65 * Observer method doesn't need to do anything else than your |
|
66 * application needs it to do. |
|
67 * |
|
68 * |
|
69 */ |
|
70 |
|
71 |
|
72 |
|
73 class RImpsGroupClient2 : public RImpsClient2 |
|
74 { |
|
75 |
|
76 public: // Constructors and destructor |
|
77 |
|
78 /** |
|
79 * C++ default constructor. |
|
80 */ |
|
81 IMPORT_C RImpsGroupClient2(); |
|
82 |
|
83 public: // New functions |
|
84 |
|
85 // INITILIZATION AND CONNECT |
|
86 |
|
87 /** |
|
88 * Registers the listener object for Group events and connects to |
|
89 * the Symbian Server. |
|
90 * Leaves with KImpsErrorAlreadyInUse if the client |
|
91 * has already registered. |
|
92 * @param aEngine WV Engine server instance |
|
93 * @param aObserver The observer instance. |
|
94 * @param aClientId Client-Id for requests if non zero length. |
|
95 * @param aReceiveNew determines if new pushed messages are received. |
|
96 * If EFalse then new messages are filtered out and |
|
97 * responses to own requests are deliverd only. |
|
98 * @param aPriority Observer priority. Refers to CActive priority. |
|
99 */ |
|
100 IMPORT_C void RegisterL( RImpsEng& aEngine, |
|
101 MImpsGroupHandler2* aObserver, |
|
102 const TDesC& aClientId, |
|
103 TBool aReceiveNew = ETrue, |
|
104 TInt aPriority = CActive::EPriorityStandard ); |
|
105 |
|
106 |
|
107 /** |
|
108 * Unregisters the listener object and disconnects from |
|
109 * the Symbian OS server. |
|
110 */ |
|
111 IMPORT_C void Unregister(); |
|
112 |
|
113 |
|
114 // WV PROTOCOL REQUESTS |
|
115 |
|
116 /** |
|
117 * Create a group. |
|
118 * MImpsGroupHandler2::HandleCompleteL handles the server response. |
|
119 * Leaves if out of memory before sending a message |
|
120 * to the Symbian OS server. |
|
121 * @param aGroupId group id |
|
122 * @param aProperties initial group properties |
|
123 * @param aScreenName, ScreenName of the user |
|
124 * @param aJoingGroup indicates that the newly created group is |
|
125 * joined (or not) at creation time. |
|
126 * WV CSP static conformance has the statement CREAG-5. |
|
127 * CREAG-5: |
|
128 * If the JoinGroup transaction was not agreed during |
|
129 * service negotiation from either server or client side, |
|
130 * the Join-Group flag in the CreateGroupRequest |
|
131 * primitive indicates ‘F’ (false). |
|
132 * @param aSubscribeNotification indicates if we subscribe notification. |
|
133 * @return operation-id (positive) |
|
134 */ |
|
135 IMPORT_C TInt CreateGroupL( const TDesC& aGroupId, |
|
136 const CImpsCommonGroupProps* aProperties, |
|
137 const TDesC& aScreenName, |
|
138 TBool aJoinGroup, |
|
139 TBool aSubscribeNotification = EFalse ); |
|
140 |
|
141 /** |
|
142 * Delete a group. |
|
143 * MImpsGroupHandler2::HandleCompleteL handles the server response. |
|
144 * Leaves if out of memory before sending a |
|
145 * message to the Symbian OS server. |
|
146 * @param aGroupId group id |
|
147 * @return operation-id (positive) |
|
148 */ |
|
149 IMPORT_C TInt DeleteGroupL( const TDesC& aGroupId ); |
|
150 |
|
151 /** |
|
152 * Join a group. |
|
153 * MImpsGroupHandler2::HandleJoinL handles the server response. |
|
154 * Leaves if out of memory before sending a message |
|
155 * to the Symbian OS server. |
|
156 * @param aGroupId group id |
|
157 * @param aScreenName screen name for the user, |
|
158 * optional (may be zero length) |
|
159 * @param aUsers ETrue if a user wants to get list of joined |
|
160 * users in a reponse, |
|
161 * @param aSubscribeNotification indicates if we subscribe notification. |
|
162 * @return operation-id (positive) |
|
163 */ |
|
164 IMPORT_C TInt JoinGroupL( const TDesC& aGroupId, |
|
165 const TDesC& aScreenName, |
|
166 TBool aUsers, |
|
167 TBool aSubscribeNotification = EFalse ); |
|
168 |
|
169 /** |
|
170 * Leave a group. |
|
171 * MImpsGroupHandler2::HandleLeaveL handles the server response. |
|
172 * Leaves if out of memory before sending a message |
|
173 * to the Symbian OS server. |
|
174 * @param aGroupId group id |
|
175 * @return operation-id (positive) |
|
176 */ |
|
177 IMPORT_C TInt LeaveGroupL( const TDesC& aGroupId ); |
|
178 |
|
179 /** |
|
180 * Get group members. |
|
181 * MImpsGroupHandler2::HandleGroupMembersL handles the server response. |
|
182 * Leaves if out of memory before sending a message |
|
183 * to the Symbian OS server. |
|
184 * @param aGroupId group id |
|
185 * @return operation-id (positive) |
|
186 */ |
|
187 IMPORT_C TInt GroupMembersL( const TDesC& aGroupId ); |
|
188 |
|
189 /** |
|
190 * Add group members. |
|
191 * The new users' type is ordinary initially. |
|
192 * MImpsGroupHandler2::HandleCompleteL handles the server response. |
|
193 * Leaves if out of memory before sending a |
|
194 * message to the Symbian OS server. Leaves with |
|
195 * KErrArgument if both aUserList and aScreenNameList are empty |
|
196 * @param aGroupId target group id |
|
197 * @param aUserList list of users to be added (user-ids) |
|
198 * @param aScreenNameList Screennames of the users |
|
199 * @return operation-id (positive) |
|
200 */ |
|
201 IMPORT_C TInt AddMembersL( const TDesC& aGroupId, |
|
202 const MDesCArray& aUserList, |
|
203 const MDesCArray& aScreenNameList ); |
|
204 |
|
205 /** |
|
206 * Remove group members. |
|
207 * MImpsGroupHandler2::HandleCompleteL handles the server response. |
|
208 * Leaves if out of memory before sending a |
|
209 * message to the Symbian OS server. |
|
210 * Leaves with KErrArgument if aUserList is empty |
|
211 * @param aGroupId target group id |
|
212 * @param aUserList list of users to be removed |
|
213 * @return operation-id (positive) |
|
214 */ |
|
215 IMPORT_C TInt RemoveMembersL( const TDesC& aGroupId, |
|
216 const MDesCArray& aUserList ); |
|
217 |
|
218 /** |
|
219 * Modify members' access rights. |
|
220 * MImpsGroupHandler2::HandleCompleteL handles the server response. |
|
221 * Leaves if out of memory before sending a |
|
222 * message to the Symbian OS server. |
|
223 * @param aGroupId target group id |
|
224 * @param aAdminList list of new administrators user-ids |
|
225 * @param aModerList list of new moderators user-ids |
|
226 * @param aOrdinaryList list of new ordinary users user-ids |
|
227 * @return operation-id (positive) |
|
228 */ |
|
229 IMPORT_C TInt ModifyMembersAccessL( const TDesC& aGroupId, |
|
230 const MDesCArray* aAdminList, |
|
231 const MDesCArray* aModerList, |
|
232 const MDesCArray* aOrdinaryList ); |
|
233 |
|
234 /** |
|
235 * Get group properties. |
|
236 * MImpsGroupHandler2::HandleGroupPropertiesL |
|
237 * handles the server response. |
|
238 * Leaves if out of memory before sending a |
|
239 * message to the Symbian OS server. |
|
240 * @param aGroupId target group id |
|
241 * @return operation-id (positive) |
|
242 */ |
|
243 IMPORT_C TInt GroupPropertiesL( const TDesC& aGroupId ); |
|
244 |
|
245 /** |
|
246 * Set group properties. |
|
247 * MImpsGroupHandler2::HandleCompleteL handles the server response. |
|
248 * Leaves if out of memory before sending a message |
|
249 * to the Symbian OS server. |
|
250 * @param aGroupId target group id |
|
251 * @param aGroupProps common properties |
|
252 * @param aOwnProps user's own properties |
|
253 * @return operation-id (positive) |
|
254 */ |
|
255 IMPORT_C TInt SetGroupPropertiesL( const TDesC& aGroupId, |
|
256 const CImpsCommonGroupProps* aGroupProps, |
|
257 const CImpsPrivateGroupProps* aOwnProps ); |
|
258 |
|
259 /** |
|
260 * Update or get list of rejected users. |
|
261 * MImpsGroupHandler2::HandleRejectListL handles the server response. |
|
262 * If you want to get the current reject list only, then |
|
263 * give aGroupId parameter only. |
|
264 * Leaves if out of memory before sending a message |
|
265 * to the Symbian OS server. |
|
266 * @param aGroupId target group id |
|
267 * @param aRejectedList users to be added to the reject list (user-ids) |
|
268 * May be NULL. |
|
269 * @param aEnabledList users to be removed from |
|
270 * the reject list (user-ids). May be NULL. |
|
271 * @return operation-id (positive) |
|
272 */ |
|
273 IMPORT_C TInt SetRejectListL( const TDesC& aGroupId, |
|
274 const MDesCArray* aRejectedList, |
|
275 const MDesCArray* aEnabledList ); |
|
276 |
|
277 /** |
|
278 * Subscribe group change notice. |
|
279 * MImpsGroupHandler2::HandleCompleteL handles the server response. |
|
280 * After successfull subscription HandleGroupPropertiesL, |
|
281 * HandleNewUsersL and HandleLeftUsersL methods are called |
|
282 * whenever remote service sends notifications. |
|
283 * Leaves if out of memory before sending a message |
|
284 * to the Symbian OS server. |
|
285 * @param aGroupId group id |
|
286 * @return operation-id (positive) |
|
287 */ |
|
288 IMPORT_C TInt SubscribeL( const TDesC& aGroupId ); |
|
289 |
|
290 /** |
|
291 * Unsubscribe group change notice. |
|
292 * MImpsGroupHandler2::HandleCompleteL handles the server response. |
|
293 * Leaves if out of memory before sending a message |
|
294 * to the Symbian OS server. |
|
295 * @param aGroupId group id |
|
296 * @return operation-id (positive) |
|
297 */ |
|
298 IMPORT_C TInt UnsubscribeL( const TDesC& aGroupId ); |
|
299 |
|
300 /** |
|
301 * Check the group change subscription status. |
|
302 * MImpsGroupHandler2::HandleSubscriptionL handles the server response. |
|
303 * Leaves if out of memory before sending a message |
|
304 * to the Symbian OS server. |
|
305 * @param aGroupId group id |
|
306 * @return operation-id (positive) |
|
307 */ |
|
308 IMPORT_C TInt CheckSubscriptionL( const TDesC& aGroupId ); |
|
309 |
|
310 /** |
|
311 * Pointer to the observer handler |
|
312 * @return handler |
|
313 */ |
|
314 MImpsGroupHandler2* Handler(); |
|
315 |
|
316 private: // New functions |
|
317 |
|
318 /** |
|
319 * Registers the listener object for Fund events and connects to |
|
320 * the Symbian OS Server. |
|
321 * @param aEngine WV Engine server instance |
|
322 * @param aHandler the observer |
|
323 * @return general error code |
|
324 */ |
|
325 TInt DoRegister( RImpsEng& aEngine, |
|
326 CImpsHandler2* aHandler ); |
|
327 |
|
328 private: // data |
|
329 |
|
330 MImpsGroupHandler2* iHandlerCallBack; |
|
331 CImpsGroupCommand2* iCommand; |
|
332 |
|
333 |
|
334 private: // friend classes |
|
335 |
|
336 friend class CImpsGroupCommand2; |
|
337 |
|
338 }; |
|
339 |
|
340 // CLASS DECLARATION |
|
341 |
|
342 /** |
|
343 * MImpsGroupHandler2 |
|
344 * |
|
345 * Abstract interface for handling the notify events from the server. |
|
346 * User derives his class from this and implements the observer methods below. |
|
347 */ |
|
348 |
|
349 class MImpsGroupHandler2 |
|
350 { |
|
351 |
|
352 public: |
|
353 |
|
354 /** |
|
355 * Handles a response of CreateGroupL, DeleteGroupL, AddMembersL, |
|
356 * RemoveMembersL, ModifyMembersAccessL, SubscribeL, UnsubscribeL. |
|
357 * @param aOpId operation id to map responses to the requests. |
|
358 * @param aCspId CSP session identifier |
|
359 */ |
|
360 virtual void HandleCompleteL( TInt aOpId, |
|
361 TImpsCspIdentifier& aCspId ) = 0; |
|
362 |
|
363 /** |
|
364 * Handles JoinGroupL response. |
|
365 * Leaves with KErrEof if no more data. |
|
366 * @param aOpId operation id to map responses to the requests. |
|
367 * @param aUserList list of joined users if requested. |
|
368 * @param aScreenNames list of screen names if requested |
|
369 * @param aWelcomeText welcome text from remote service. |
|
370 * @param aCspId CSP session identifier |
|
371 */ |
|
372 virtual void HandleJoinL( TInt aOpId, |
|
373 const MDesCArray& aUserList, |
|
374 const MDesCArray& aScreenNames, |
|
375 const TDesC& aWelcomeText, |
|
376 TImpsCspIdentifier& aCspId ) = 0; |
|
377 |
|
378 /** |
|
379 * Handles GroupMembersL response. |
|
380 * Leaves with KErrEof if no more data. |
|
381 * @param aOpId operation id to map responses to the requests. |
|
382 * @param aUserList list of users of ordinary users |
|
383 * @param aScreenNames list of screen names of ordinary users |
|
384 * @param aModers list of moderators (user-ids) |
|
385 * @param aAdmins list of administrators |
|
386 * @param aCspId CSP session identifier |
|
387 */ |
|
388 virtual void HandleGroupMembersL( TInt aOpId, |
|
389 const MDesCArray& aUserList, |
|
390 const MDesCArray& aScreenNames, |
|
391 const MDesCArray& aModers, |
|
392 const MDesCArray& aAdmins, |
|
393 TImpsCspIdentifier& aCspId ) = 0; |
|
394 |
|
395 /** |
|
396 * Handles GroupPropertiesL response and subscribed notification. |
|
397 * @param aOpId operation id to map responses to the requests. |
|
398 * This is 0 if event is initiated by remote service based on the |
|
399 * group change notification subscription. |
|
400 * @param aGroupId group id, presnet only if aOpId is 0. |
|
401 * @param aGroupProps common properties |
|
402 * @param aOwnProps user's own properties |
|
403 * @param aCspId CSP session identifier |
|
404 */ |
|
405 virtual void HandleGroupPropertiesL( TInt aOpId, |
|
406 const TDesC& aGroupId, |
|
407 const CImpsCommonGroupProps& aGroupProps, |
|
408 const CImpsPrivateGroupProps& aOwnProps, |
|
409 TImpsCspIdentifier& aCspId ) = 0; |
|
410 |
|
411 /** |
|
412 * Handles SetRejectListL response. |
|
413 * Leaves with KErrEof if no more data. |
|
414 * @param aOpId operation id to map responses to the requests. |
|
415 * @param aUserList list of rejected users in reject list |
|
416 * @param aCspId CSP session identifier |
|
417 */ |
|
418 virtual void HandleRejectListL( TInt aOpId, |
|
419 const MDesCArray& aUserList, |
|
420 TImpsCspIdentifier& aCspId ) = 0; |
|
421 |
|
422 /** |
|
423 * Handles CheckSubscriptionL response. |
|
424 * @param aOpId operation id to map responses to the requests. |
|
425 * @param aIsSubscribed ETrue if group is subscribed. |
|
426 * @param aCspId CSP session identifier |
|
427 */ |
|
428 virtual void HandleSubscriptionL( TInt aOpId, |
|
429 TBool aIsSubscribed, |
|
430 TImpsCspIdentifier& aCspId ) = 0; |
|
431 |
|
432 /** |
|
433 * Handles group change notification about new users. |
|
434 * Error indicates internal error. |
|
435 * @param aGroupId group id |
|
436 * @param aUserList list of joined users |
|
437 * @param aScreenNames list of screen names |
|
438 * @param aCspId CSP session identifier |
|
439 */ |
|
440 virtual void HandleNewUsersL( |
|
441 const TDesC& aGroupId, |
|
442 const MDesCArray& aUserList, |
|
443 const MDesCArray& aScreenNames, |
|
444 TImpsCspIdentifier& aCspId ) = 0; |
|
445 |
|
446 /** |
|
447 * Handles group change notification about users left. |
|
448 * Error indicates internal error. |
|
449 * @param aGroupId group id |
|
450 * @param aUserList list of users left |
|
451 * @param aScreenNames list of screen names |
|
452 * @param aCspId CSP session identifier |
|
453 */ |
|
454 virtual void HandleLeftUsersL( |
|
455 const TDesC& aGroupId, |
|
456 const MDesCArray& aUserList, |
|
457 const MDesCArray& aScreenNames, |
|
458 TImpsCspIdentifier& aCspId ) = 0; |
|
459 |
|
460 /** |
|
461 * Handles both LeaveGroupL response and a service |
|
462 * initiated group leave situation. |
|
463 * Leaves with KErrEof if no more data. |
|
464 * @param aOpId operation id to map responses to the requests. |
|
465 * This is 0 if operation is initiated by a remote service. |
|
466 * @param aGroupId group id |
|
467 * @param aDescription textual description of the leave |
|
468 * @param aCspId CSP session identifier |
|
469 */ |
|
470 virtual void HandleLeaveL( |
|
471 TInt aOpId, |
|
472 const TDesC& aGroupId, |
|
473 const TDesC& aDescription, |
|
474 TImpsCspIdentifier& aCspId ) = 0; |
|
475 |
|
476 }; |
|
477 |
|
478 #endif |
|
479 |
|
480 // End of File |
|
481 |
|
482 |