|
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: Handles binding and unbinding to service, fetches presense of identities. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CLOGSEXTSERVICEHANDLER_H |
|
20 #define C_CLOGSEXTSERVICEHANDLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "mlogsextensioncchhandlerobserver.h" |
|
24 |
|
25 |
|
26 #include <presencecachereadhandler2.h> |
|
27 #include <mpresencebuddyinfo2.h> |
|
28 |
|
29 class CLogsExtPresentityData; |
|
30 class CLogsExtensionCchHandler; |
|
31 class MLogsExtServiceHandlerObserver; |
|
32 class TXIMPRequestId; |
|
33 |
|
34 |
|
35 class MPresenceCacheReader2; |
|
36 class MPresenceBuddyInfo2; |
|
37 |
|
38 /** |
|
39 * Service and presence handler. |
|
40 * |
|
41 * @since S60 v3.2 |
|
42 */ |
|
43 NONSHARABLE_CLASS(CLogsExtServiceHandler) : |
|
44 public CBase, |
|
45 public MPresenceCacheReadHandler2 |
|
46 { |
|
47 |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Creates a new CLogsExtServiceHandler. |
|
52 * |
|
53 * @since S60 v3.2 |
|
54 * @param aServiceId a service id |
|
55 * @param aObserver service handler observer |
|
56 * @return a new CLogsExtServiceHandler instance |
|
57 */ |
|
58 static CLogsExtServiceHandler* NewL( |
|
59 const TUint32 aServiceId, |
|
60 MLogsExtServiceHandlerObserver& aObserver ); |
|
61 |
|
62 /** |
|
63 * Creates a new CLogsExtServiceHandler. |
|
64 * |
|
65 * @since S60 v3.2 |
|
66 * @param aServiceId a service id |
|
67 * @param aObserver service handler observer |
|
68 * @return a new CLogsExtServiceHandler instance |
|
69 */ |
|
70 static CLogsExtServiceHandler* NewLC( |
|
71 const TUint32 aServiceId, |
|
72 MLogsExtServiceHandlerObserver& aObserver ); |
|
73 |
|
74 /** |
|
75 * Destructor. |
|
76 */ |
|
77 ~CLogsExtServiceHandler(); |
|
78 |
|
79 /** |
|
80 * Returns the service id. |
|
81 * |
|
82 * @since S60 v3.2 |
|
83 * @return the service id |
|
84 */ |
|
85 TUint32 ServiceId(); |
|
86 |
|
87 /** |
|
88 * Adds the specified presentity to this service handler |
|
89 * and starts to handle subscription/event handling etc. |
|
90 * for this presentity. |
|
91 * |
|
92 * @since S60 v3.2 |
|
93 * @param aPresentityId a presentity |
|
94 */ |
|
95 void AddPresentityL( const TDesC& aPresentityId ); |
|
96 |
|
97 public: // From MPresCacheReadHandler2 |
|
98 |
|
99 void HandlePresenceReadL(TInt aErrorCode, |
|
100 RPointerArray<MPresenceBuddyInfo2>& aPresenceBuddyInfoList); |
|
101 |
|
102 void HandlePresenceNotificationL(TInt aErrorCode, |
|
103 MPresenceBuddyInfo2* aPresenceBuddyInfo); |
|
104 |
|
105 |
|
106 private: |
|
107 |
|
108 /** |
|
109 * Symbian second-phase constructor. |
|
110 */ |
|
111 void ConstructL(); |
|
112 |
|
113 /** |
|
114 * Constructor. |
|
115 */ |
|
116 CLogsExtServiceHandler( const TUint32 aServiceId, |
|
117 MLogsExtServiceHandlerObserver& aObserver ); |
|
118 |
|
119 /** |
|
120 * Submits a request to get the content of a certain group. |
|
121 * |
|
122 * @since S60 v3.2 |
|
123 * @param aGroupName the name of group to retrieve content from. |
|
124 */ |
|
125 void GetGroupContentL( const TDesC& aGroupName ); |
|
126 |
|
127 /** |
|
128 * Create presentity data object for a presentity. |
|
129 * |
|
130 * @since S60 v3.2 |
|
131 * @param aPresentityId a presentity to create data object for. |
|
132 */ |
|
133 void DoPresentityDataCreationL(const TDesC& aPresentityId ); |
|
134 |
|
135 /** |
|
136 * Tests whether presentity data object exists or not. |
|
137 * |
|
138 * @since S60 v3.2 |
|
139 * @param aPresentityId a presentity |
|
140 * @return True, if exists; False otherwise |
|
141 */ |
|
142 TBool PresentityDataExists( const TDesC16& aPresentityId ); |
|
143 |
|
144 /** |
|
145 * Gets presentity data object of a certain presentity. |
|
146 * |
|
147 * @since S60 v3.2 |
|
148 * @param aPresentityId a presentity |
|
149 * @param aPresentityData presentity data object pointer. |
|
150 * @return KErrNone in case data has been retrieved successfully, |
|
151 * system-wide errorcode otherwise |
|
152 */ |
|
153 TInt GetPresentityData( |
|
154 const TDesC16& aPresentityId, |
|
155 CLogsExtPresentityData*& aPresentityData ); |
|
156 |
|
157 /** |
|
158 * Subscribe presentity of the specified PresentityData object. |
|
159 * Subscribing presence is an asynchronous operation and it |
|
160 * might evolve network operations. |
|
161 * |
|
162 * @since S60 v3.2 |
|
163 * @param aPresentityData a presentity data object |
|
164 */ |
|
165 void DoPresentitySubscriptionL( CLogsExtPresentityData& aPresentityData ); |
|
166 |
|
167 /** |
|
168 * UnSubscribe all contact for presence changes. The Presence Change |
|
169 * notification for these contacts will no longer be delivered. |
|
170 * |
|
171 * |
|
172 */ |
|
173 void UnSubscribePresenceInfosL(); |
|
174 |
|
175 /** |
|
176 * Determines whether the service handler has to make subscriptions |
|
177 * and also initiates those. It also informs the service handler |
|
178 * oberver in case the status of a presentity should not be displayed |
|
179 * (e.g. because the presentity is not found from the subscribed buddy |
|
180 * list anymore) |
|
181 * |
|
182 * @since S60 v3.2 |
|
183 */ |
|
184 void CheckServiceHandler(); |
|
185 |
|
186 /** |
|
187 * Accomplishes the same as CheckServiceHandler(). |
|
188 * |
|
189 * @since S60 v3.2 |
|
190 */ |
|
191 void DoCheckServiceHandlerL(); |
|
192 |
|
193 |
|
194 private: // data |
|
195 |
|
196 /** |
|
197 * Service id |
|
198 */ |
|
199 TUint32 iServiceId; |
|
200 |
|
201 /** |
|
202 * The array that contains the presence fetchers. |
|
203 * Own. |
|
204 */ |
|
205 RPointerArray<CLogsExtPresentityData> iPresentityDataArray; |
|
206 |
|
207 /** |
|
208 * The observer of this service handler. |
|
209 * Not own. |
|
210 */ |
|
211 MLogsExtServiceHandlerObserver* iObserver; |
|
212 |
|
213 |
|
214 /** |
|
215 * Presence cache reader |
|
216 * |
|
217 */ |
|
218 MPresenceCacheReader2* iCacheReader; |
|
219 |
|
220 }; |
|
221 |
|
222 #endif // C_CLOGSEXTSERVICEHANDLER_H |