|
1 /* |
|
2 * Copyright (c) 2008 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: Implementation for presence cache reader notification handling |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef PRESENCECACHECLIENTNOTIFICATION_H |
|
19 #define PRESENCECACHECLIENTNOTIFICATION_H |
|
20 |
|
21 #include "presencecacheclient.h" |
|
22 |
|
23 #include "presencecachedefs.h" |
|
24 #include "presenceapiobjbase.h" |
|
25 |
|
26 |
|
27 /** |
|
28 * Implementation for presence cache reader notification. This object is |
|
29 * instantiated by CPresenceCacheClient. This class handles client-server |
|
30 * messaging for notifications. |
|
31 * |
|
32 * @ingroup ximpprescacheapi |
|
33 * @since S60 v5.0 |
|
34 */ |
|
35 NONSHARABLE_CLASS( CPresenceCacheClientNotification ) : public CActive |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 * @param aClient presence cache client |
|
43 */ |
|
44 static CPresenceCacheClientNotification* NewL( CPresenceCacheClient& aClient ); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 virtual ~CPresenceCacheClientNotification(); |
|
50 |
|
51 /** |
|
52 * Subscribe for given presence buddy's change in presence. |
|
53 * |
|
54 * @param aIdentity buddy id, in xsp format |
|
55 * @return KErrNone if successful, KErrArgument if observer not set |
|
56 * @leave Only in system error cases e.g. if failed to allocate memory. |
|
57 */ |
|
58 TInt SubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity); |
|
59 |
|
60 /** |
|
61 * Unsubscribe for given presence buddy's change in presence. |
|
62 * |
|
63 * @param aIdentity buddy id, in xsp format |
|
64 * @leave Only in system error cases e.g. if failed to allocate memory. |
|
65 */ |
|
66 void UnsubscribePresenceBuddyChangeL(const MXIMPIdentity& aIdentity); |
|
67 |
|
68 private: |
|
69 |
|
70 /** |
|
71 * C++ constructor |
|
72 */ |
|
73 CPresenceCacheClientNotification( CPresenceCacheClient& aClient ); |
|
74 |
|
75 /** |
|
76 * Symbian second phase constructor |
|
77 */ |
|
78 void ConstructL(); |
|
79 |
|
80 void StartNotifySubscription(); |
|
81 |
|
82 /** |
|
83 * Client callback handler Accesor |
|
84 */ |
|
85 MPresCacheReadHandler* ClientNotifyHandler(); |
|
86 |
|
87 /** |
|
88 * Get presence from Cache server to a client observer |
|
89 * @param aClient client callback observer |
|
90 * @param aSize notification size |
|
91 */ |
|
92 void PreseneceFromServerToClientL( MPresCacheReadHandler& aClient, TInt aSize ); |
|
93 |
|
94 |
|
95 public: //From CActive |
|
96 |
|
97 void RunL(); |
|
98 |
|
99 void DoCancel(); |
|
100 |
|
101 TInt RunError( TInt aError ); |
|
102 |
|
103 private: // Data |
|
104 |
|
105 /** |
|
106 * presence cache client handling client-server messages |
|
107 */ |
|
108 CPresenceCacheClient& iClient; |
|
109 |
|
110 /** |
|
111 * Size of presence notification for client-sever messages |
|
112 */ |
|
113 TPckgBuf<TInt> iSizePckg; |
|
114 |
|
115 /** |
|
116 * Whether the first notification subscription is done |
|
117 */ |
|
118 TBool iNotificationSubscribed; |
|
119 |
|
120 }; |
|
121 |
|
122 #endif // PRESENCECACHECLIENTNOTIFICATION_H |
|
123 |
|
124 |
|
125 |