|
1 /* |
|
2 * Copyright (c) 2006-2009 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: IETF SIMPLE Protocol implementation for XIMP Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef PRESENCEPLUGINCONNECTION_H |
|
20 #define PRESENCEPLUGINCONNECTION_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <ximpprotocolconnection.h> |
|
24 #include <protocolpresencefeatures.h> |
|
25 //Connection obs |
|
26 #include "mpresencepluginconnectionobs.h" |
|
27 #include "simpleimfeatures.h" |
|
28 #include "presencelogger.h" |
|
29 |
|
30 //FORWARD |
|
31 class MXIMPServiceInfo; |
|
32 class MXIMPObjectFactory; |
|
33 class MXIMPProtocolConnectionHost; |
|
34 class MProtocolPresenceWatching; |
|
35 class MProtocolPresencePublishing; |
|
36 class MProtocolPresentityGroups; |
|
37 class MProtocolPresenceAuthorization; |
|
38 class MProtocolPresenceFeatures; |
|
39 class MProtocolPresenceDataHost; |
|
40 class CPresencePluginSession; |
|
41 class CPresencePluginWinfo; |
|
42 class CPresencePluginWatcher; |
|
43 class CPresencePluginAuthorization; |
|
44 class CPresencePluginPublisher; |
|
45 class CPresencePluginXdmUtils; |
|
46 class CPresencePluginGroups; |
|
47 class CPresencePluginVirtualGroup; |
|
48 class CPresencePluginData; |
|
49 class CPresenceConnectionInfo; |
|
50 class MProtocolImFeatures; |
|
51 |
|
52 |
|
53 /** |
|
54 * CPrecensePluginSession |
|
55 * |
|
56 * presence Engine Connection |
|
57 * |
|
58 * @lib presenceplugin.dll |
|
59 * @since S60 v3.2 |
|
60 */ |
|
61 NONSHARABLE_CLASS(CPresencePluginConnection) : public CActive, |
|
62 public MXIMPProtocolConnection, |
|
63 public MProtocolPresenceFeatures, |
|
64 public MPresencePluginConnectionObs |
|
65 { |
|
66 public: |
|
67 |
|
68 enum TConnectionStatus |
|
69 { |
|
70 /** undefined */ |
|
71 ENotActive = 0, |
|
72 /** Connection initializing */ |
|
73 EActive, |
|
74 /** Connection close */ |
|
75 ETerminated |
|
76 }; |
|
77 |
|
78 /** |
|
79 * Two-phased constructor. |
|
80 * |
|
81 * @param aServiceInfo, XIMP service info |
|
82 * @param aClientCtxInfo, XIMP contex client info |
|
83 */ |
|
84 static CPresencePluginConnection* NewL( |
|
85 const MXIMPServiceInfo& aServiceInfo, |
|
86 const MXIMPContextClientInfo& aClientCtxInfo ); |
|
87 |
|
88 /** |
|
89 * Two-phased constructor loaded. |
|
90 * |
|
91 * @param aServiceInfo, XIMP service info |
|
92 * @param aClientCtxInfo, XIMP contex client info |
|
93 */ |
|
94 static CPresencePluginConnection* NewL( |
|
95 const MXIMPServiceInfo& aServiceInfo, |
|
96 const MXIMPContextClientInfo& aClientCtxInfo, |
|
97 const TDesC8& aETag ); |
|
98 |
|
99 /** |
|
100 * Standard C++ destructor |
|
101 */ |
|
102 ~CPresencePluginConnection(); |
|
103 |
|
104 /** |
|
105 * Grand list subscribe state |
|
106 * |
|
107 * @since S60 3.2 |
|
108 * @param none |
|
109 * @return TBool grand list subscribe state |
|
110 */ |
|
111 TBool GrandListState( ); |
|
112 |
|
113 /** |
|
114 * Set connection info array |
|
115 * |
|
116 * @since S60 3.2 |
|
117 * @param connection info |
|
118 * @return none |
|
119 */ |
|
120 void SetConnectionArray( CPresenceConnectionInfo* aArray ); |
|
121 |
|
122 /** |
|
123 * Get connection info array |
|
124 * |
|
125 * @since S60 3.2 |
|
126 * @param none |
|
127 * @return return info |
|
128 */ |
|
129 CPresenceConnectionInfo* GetConnectionArray( ); |
|
130 |
|
131 |
|
132 /** |
|
133 * Gets protocol interface. In error cases returns NULL |
|
134 * |
|
135 * @since S60 5.0 |
|
136 * @param none |
|
137 * @return protocol interface |
|
138 */ |
|
139 TAny* GetProtocolInterface( TInt aInterfaceId ); |
|
140 |
|
141 private: |
|
142 |
|
143 /** |
|
144 * Standard C++ constructor |
|
145 */ |
|
146 CPresencePluginConnection( ); |
|
147 |
|
148 /** |
|
149 * Performs the 2nd phase of construction. |
|
150 * |
|
151 * @param aService, XIMP service info |
|
152 * @param aClientCtxInfo, XIMP contex client info |
|
153 */ |
|
154 void ConstructL( |
|
155 const MXIMPServiceInfo& aService, |
|
156 const MXIMPContextClientInfo& aClientCtxInfo ); |
|
157 |
|
158 /** |
|
159 * Performs the 2nd phase of construction. Overload |
|
160 * |
|
161 * @param aService, XIMP service info |
|
162 * @param aClientCtxInfo, XIMP contex client info |
|
163 */ |
|
164 void ConstructL( |
|
165 const MXIMPServiceInfo& aService, |
|
166 const MXIMPContextClientInfo& aClientCtxInfo, |
|
167 const TDesC8& aETag ); |
|
168 |
|
169 private: //Own private functions |
|
170 |
|
171 /** |
|
172 * DeRegister |
|
173 * |
|
174 * @since S60 3.2 |
|
175 * @param none |
|
176 * @return none |
|
177 */ |
|
178 void DeRegister( ); |
|
179 |
|
180 /** |
|
181 * CreateImFeaturesPlugin |
|
182 * |
|
183 * @since S60 5.0 |
|
184 * @param none |
|
185 * @return none |
|
186 */ |
|
187 void CreateImFeaturesPluginL(); |
|
188 |
|
189 /** |
|
190 * DeleteImFeaturesPlugin |
|
191 * |
|
192 * @since S60 5.0 |
|
193 * @param none |
|
194 * @return none |
|
195 */ |
|
196 void DeleteImFeaturesPlugin(); |
|
197 |
|
198 protected: // from base class CActive |
|
199 |
|
200 /** |
|
201 * Defined in a base class |
|
202 */ |
|
203 void RunL(); |
|
204 |
|
205 /** |
|
206 * Defined in a base class |
|
207 */ |
|
208 TInt RunError( TInt aError ); |
|
209 |
|
210 /** |
|
211 * Defined in a base class |
|
212 */ |
|
213 void DoCancel(); |
|
214 |
|
215 public: // from base class MPrFwBase |
|
216 |
|
217 TInt32 GetPresenceSetId() const; |
|
218 |
|
219 /** |
|
220 * Defined in a base class |
|
221 */ |
|
222 TAny* GetInterface( |
|
223 TInt32 aInterfaceId, |
|
224 TIfGetOps aOps ); |
|
225 |
|
226 /** |
|
227 * Defined in a base class |
|
228 */ |
|
229 const TAny* GetInterface( |
|
230 TInt32 aInterfaceId, |
|
231 TIfGetOps aOps ) const; |
|
232 |
|
233 /** |
|
234 * Defined in a base class |
|
235 */ |
|
236 TInt32 GetInterfaceId() const; |
|
237 |
|
238 public:// from base class MPresencePluginConnectionObs |
|
239 |
|
240 /** |
|
241 * Return subscribed buddy virtual group |
|
242 * |
|
243 * @since S60 3.2 |
|
244 * @param none |
|
245 * @return CPresencePluginVirtualGroup, virtual group |
|
246 */ |
|
247 CPresencePluginVirtualGroup* SubscribedContacts(); |
|
248 |
|
249 /** |
|
250 * Get Stop Publish state |
|
251 * |
|
252 * @since S60 3.2 |
|
253 * @param none |
|
254 * @return TBOOL, Stop Publish state |
|
255 */ |
|
256 TBool GetStopPublishState(); |
|
257 |
|
258 /** |
|
259 * Is stop publish called |
|
260 * |
|
261 * @since S60 3.2 |
|
262 * @param none |
|
263 * @return TBOOL, Stop Publish |
|
264 */ |
|
265 TBool IsStopPublishCalled(); |
|
266 |
|
267 /** |
|
268 * Set Stop Publish state |
|
269 * |
|
270 * @since S60 3.2 |
|
271 * @param aState, stop publish state TRUE/FALSE |
|
272 * @return none |
|
273 */ |
|
274 void SetStopPublishState( TBool aState ); |
|
275 |
|
276 /** |
|
277 * Get Tuple id |
|
278 * |
|
279 * @since S60 3.2 |
|
280 * @param none |
|
281 * @return TInt, tupleid |
|
282 */ |
|
283 TInt GetTupleId() const; |
|
284 |
|
285 /** |
|
286 * Set Tuple id |
|
287 * |
|
288 * @since S60 3.2 |
|
289 * @param aTupleId, generated tupleid |
|
290 * @return none |
|
291 */ |
|
292 void SetTupleId( const TInt aTupleId ); |
|
293 |
|
294 /** |
|
295 * Get ETag |
|
296 * |
|
297 * @since S60 3.2 |
|
298 * @param none |
|
299 * @return TDesC8, Etag value |
|
300 */ |
|
301 const TDesC8& GetETag() const; |
|
302 |
|
303 /** |
|
304 * Set ETag |
|
305 * |
|
306 * @since S60 3.2 |
|
307 * @param aEtag, Etag value |
|
308 * @return none |
|
309 */ |
|
310 void SetETag( const TDesC8& aETag ); |
|
311 |
|
312 /** |
|
313 * Defined in a base class |
|
314 */ |
|
315 void CompleteReq( TReqType aType, TInt aStatus ); |
|
316 |
|
317 /** |
|
318 * Defined in a base class |
|
319 */ |
|
320 void CompleteReq( TXIMPRequestId aReqId, TInt aStatus ); |
|
321 |
|
322 /** |
|
323 * Defined in a base class |
|
324 */ |
|
325 MXIMPObjectFactory& ObjectFactory(); |
|
326 |
|
327 /** |
|
328 * Defined in a base class |
|
329 */ |
|
330 MPresenceObjectFactory& PresenceObjectFactoryOwn(); |
|
331 |
|
332 /** |
|
333 * Defined in a base class |
|
334 */ |
|
335 CPresencePluginWinfo* WinfoHandlerL(); |
|
336 |
|
337 /** |
|
338 * Defined in a base class |
|
339 */ |
|
340 CPresencePluginWatcher* WatcherHandlerL(); |
|
341 |
|
342 /** |
|
343 * Defined in a base class |
|
344 */ |
|
345 void WinfoTerminatedL( TInt aReason ); |
|
346 |
|
347 /** |
|
348 * Defined in a base class |
|
349 */ |
|
350 void WinfoNotification( MSimpleWinfo& aWinfo ); |
|
351 |
|
352 /** |
|
353 * Defined in a base class |
|
354 */ |
|
355 TPtrC8 CurrentSipPresentity8(); |
|
356 |
|
357 /** |
|
358 * Defined in a base class |
|
359 */ |
|
360 CPresencePluginXdmUtils* XdmUtilsL(); |
|
361 |
|
362 /** |
|
363 * Defined in a base class |
|
364 */ |
|
365 TBool GetSessionStatus( ); |
|
366 |
|
367 /** |
|
368 * Termiante connection |
|
369 */ |
|
370 void TerminateConnectionL( ); |
|
371 |
|
372 /** |
|
373 * Returns groups api implementation. Leaves if |
|
374 * pointer not available. |
|
375 */ |
|
376 CPresencePluginGroups& GroupsL(); |
|
377 |
|
378 /** |
|
379 * Returns service id |
|
380 */ |
|
381 TInt& ServiceId(); |
|
382 |
|
383 public: // from MXIMPProtocolConnection |
|
384 |
|
385 /** |
|
386 * Defined in a base class |
|
387 */ |
|
388 MProtocolPresenceDataHost& ProtocolPresenceHost(); |
|
389 |
|
390 /** |
|
391 * Defined in a base class |
|
392 */ |
|
393 MProtocolPresenceFeatures& ProtocolPresenceFeatures(); |
|
394 |
|
395 /** |
|
396 * PrimeHost |
|
397 * |
|
398 * @since S60 3.2 |
|
399 * @param [in] aHost |
|
400 * Reference to host interface, what this MXIMPProtocolConnection |
|
401 * instance must use to communicate back to Presence Framework |
|
402 * direction. |
|
403 */ |
|
404 void PrimeHost( MXIMPProtocolConnectionHost& aHost ); |
|
405 |
|
406 /** |
|
407 * OpenSessionL |
|
408 * |
|
409 * @since S60 3.2 |
|
410 * @param [in] aReqId |
|
411 * Request ID identifying the request. Presence protocol |
|
412 * connection implementation must cache here given ID and |
|
413 * use it when completing the request later through the |
|
414 * MXIMPProtocolConnectionHost::HandleRequestCompleted(). |
|
415 */ |
|
416 void OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo, |
|
417 TXIMPRequestId aReqId ); |
|
418 |
|
419 /** |
|
420 * OpenSessionL |
|
421 * |
|
422 * @since S60 3.2 |
|
423 * @param [in] aReqId |
|
424 * Request ID identifying the request. Presence protocol |
|
425 * connection implementation must cache here given ID and |
|
426 * use it when completing the request later through the |
|
427 * MXIMPProtocolConnectionHost::HandleRequestCompleted(). |
|
428 */ |
|
429 void OpenSessionL( const TInt& aSettingsId, |
|
430 TXIMPRequestId aReqId ); |
|
431 |
|
432 /** |
|
433 * CloseSession |
|
434 * |
|
435 * @since S60 3.2 |
|
436 * @param [in] aReqId |
|
437 * Request ID identifying the request. Presence protocol |
|
438 * connection implementation must cache here given ID and |
|
439 * use it when completing the request later through the |
|
440 * MXIMPProtocolConnectionHost::HandleRequestCompleted(). |
|
441 */ |
|
442 void CloseSession( const MXIMPContextClientInfo& aContextClient, |
|
443 TXIMPRequestId aReqId ); |
|
444 |
|
445 /** |
|
446 * GetSupportedFeaturesL |
|
447 * |
|
448 * @since S60 3.2 |
|
449 * @param [out] aFeatures |
|
450 * Return parameter where to append supported |
|
451 * presence protocol connection features. |
|
452 * Feature IDs are defined in NXIMPFeature namespace. |
|
453 */ |
|
454 void GetSupportedFeaturesL( CDesC8Array& aFeatures ) const; |
|
455 |
|
456 /** |
|
457 * PresenceWatching |
|
458 * |
|
459 * @since S60 3.2 |
|
460 * @return Requested interface. |
|
461 * interface ownership is not returned caller. |
|
462 */ |
|
463 MProtocolPresenceWatching& PresenceWatching(); |
|
464 |
|
465 /** |
|
466 * PresencePublishing |
|
467 * |
|
468 * @since S60 3.2 |
|
469 * @return Requested interface. |
|
470 * interface ownership is not returned caller. |
|
471 */ |
|
472 MProtocolPresencePublishing& PresencePublishing(); |
|
473 |
|
474 /** |
|
475 * PresentityGroups |
|
476 * |
|
477 * @since S60 3.2 |
|
478 * @return Requested interface. |
|
479 * interface ownership is not returned caller. |
|
480 */ |
|
481 MProtocolPresentityGroups& PresentityGroups(); |
|
482 |
|
483 /** |
|
484 * PresenceAuthorization |
|
485 * |
|
486 * @since S60 3.2 |
|
487 * @return Requested interface. |
|
488 * interface ownership is not returned caller. |
|
489 */ |
|
490 MProtocolPresenceAuthorization& PresenceAuthorization(); |
|
491 |
|
492 /** |
|
493 * PresenceAuthorization |
|
494 * |
|
495 * @since S60 3.2 |
|
496 * @return Requested interface as own type |
|
497 * interface ownership is not returned caller. |
|
498 */ |
|
499 CPresencePluginAuthorization& InternalPresenceAuthorization(); |
|
500 |
|
501 /** |
|
502 * Defined in a base class |
|
503 */ |
|
504 MXIMPProtocolConnectionHost* Host(); |
|
505 |
|
506 /** |
|
507 * Defined in a base class |
|
508 */ |
|
509 TPtrC16 CurrentDomain(); |
|
510 |
|
511 /** |
|
512 * Defined in a base class |
|
513 */ |
|
514 MXIMPServiceInfo& ServiceInfo(); |
|
515 |
|
516 private: //data |
|
517 |
|
518 /** |
|
519 * Presence Engine session |
|
520 * Own. |
|
521 */ |
|
522 CPresencePluginSession* iSession; |
|
523 |
|
524 /** |
|
525 * CPresencePluginWinfo |
|
526 * Own. |
|
527 */ |
|
528 CPresencePluginWinfo* iPluginWinfo; |
|
529 |
|
530 /** |
|
531 * CPresencePluginWatcher |
|
532 * Own. |
|
533 */ |
|
534 CPresencePluginWatcher* iWatcher; |
|
535 |
|
536 /** |
|
537 * current request id |
|
538 * Own |
|
539 */ |
|
540 TXIMPRequestId iXIMPId; |
|
541 |
|
542 /** |
|
543 * Host for connection. |
|
544 * Not own. |
|
545 */ |
|
546 MXIMPProtocolConnectionHost* iConnectionHost; |
|
547 |
|
548 /** |
|
549 * MXIMPProtocolPresenceauthorization implementation. |
|
550 * Own. |
|
551 */ |
|
552 CPresencePluginAuthorization* iAuth; |
|
553 |
|
554 /** |
|
555 * CSimplePluginPublisher |
|
556 * Own. |
|
557 */ |
|
558 CPresencePluginPublisher* iPublisher; |
|
559 |
|
560 /** |
|
561 * CSimplePluginGroups |
|
562 * Own. |
|
563 */ |
|
564 CPresencePluginGroups* iGroups; |
|
565 |
|
566 /** |
|
567 * CPresencePluginImFeatures |
|
568 * Own. |
|
569 */ |
|
570 CSimpleImFeatures* iImFeatures; |
|
571 |
|
572 /** |
|
573 * Current user SIP identity |
|
574 * Own. |
|
575 */ |
|
576 HBufC16* iSipPresentity; |
|
577 |
|
578 /** |
|
579 * XDM utils |
|
580 * Own. |
|
581 */ |
|
582 CPresencePluginXdmUtils* iXdmUtils; |
|
583 |
|
584 /** |
|
585 * TupleId |
|
586 * Own. |
|
587 */ |
|
588 TInt iOwnTupleId; |
|
589 |
|
590 /** |
|
591 * Document Etag |
|
592 * Own. |
|
593 */ |
|
594 HBufC8* iETag; |
|
595 |
|
596 /** |
|
597 * Virtual groups |
|
598 * Own |
|
599 */ |
|
600 CPresencePluginVirtualGroup* iSubscribedBuddys; |
|
601 |
|
602 /** |
|
603 * Plugin Data |
|
604 * Own. |
|
605 */ |
|
606 CPresencePluginData* iPresenceData; |
|
607 |
|
608 /** |
|
609 * Stop publish state |
|
610 * Own |
|
611 */ |
|
612 TBool iStopPublishState; |
|
613 |
|
614 /** |
|
615 * Grant list subscribe state |
|
616 * Own |
|
617 */ |
|
618 TBool iGrantListSubs; |
|
619 |
|
620 /** |
|
621 * Is stop publish called |
|
622 * Own |
|
623 */ |
|
624 TBool iStopPublishCall; |
|
625 |
|
626 /** |
|
627 * Terminated state called |
|
628 * Own. |
|
629 */ |
|
630 TBool iTerminatedCall; |
|
631 |
|
632 /** |
|
633 * Connection Array instance |
|
634 * Own. |
|
635 */ |
|
636 CPresenceConnectionInfo* iConnectionArray; |
|
637 |
|
638 SIMPLE_UNIT_TEST( T_CPresencePluginConnection ) |
|
639 SIMPLE_UNIT_TEST( T_SIMPLEDataModelAdapter ) |
|
640 }; |
|
641 |
|
642 #endif // PRESENCEPLUGINCONNECTION_H |