|
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: ximp context observer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CVIMPSTENGINESESSIONCNTXTOBSERVER_H_ |
|
20 #define CVIMPSTENGINESESSIONCNTXTOBSERVER_H_ |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "tvimpstenums.h" |
|
27 |
|
28 #include <ximpcontextobserver.h> |
|
29 #include <searchelement.h> |
|
30 |
|
31 class MVIMPSTServiceListObserver; |
|
32 class CVIMPSTEngineRequestMapper; |
|
33 class MXIMPContext; |
|
34 class MVIMPSTEngineSearchExtentionEventObserver; |
|
35 class MPresenceGrantRequestListEvent; |
|
36 class MSearchKeysEvent; |
|
37 class MPresenceFeatures; |
|
38 class MXIMPClient; |
|
39 class MVIMPSTEngineSessionCntxtObserver; |
|
40 class MPresenceAuthorization; |
|
41 class MPresenceWatching; |
|
42 class MPresentityGroups; |
|
43 class MPresencePublishing; |
|
44 class MPresenceObjectFactory; |
|
45 |
|
46 // CLASS DESCRIPTION |
|
47 |
|
48 /** |
|
49 * ximp context observer |
|
50 * @lib vimpstengine.lib |
|
51 * @since S60 5.0 |
|
52 */ |
|
53 NONSHARABLE_CLASS( CVIMPSTEngineSessionCntxtObserver ) : public CBase, |
|
54 public MXIMPContextObserver |
|
55 |
|
56 |
|
57 { |
|
58 //for testcases. |
|
59 friend class T_VimpstEngineSessionCntxtObserver; |
|
60 friend class T_VimpstEnginePresenceSubService; |
|
61 |
|
62 public: |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 * @param aSettingsId: settings id. |
|
67 * @param aAdapterUid: Uid of the ximpfw adaptation. |
|
68 * @return CVIMPSTEngineSessionCntxtObserver new instance of this class |
|
69 */ |
|
70 static CVIMPSTEngineSessionCntxtObserver* |
|
71 CVIMPSTEngineSessionCntxtObserver::NewL(TUint32 aServiceId); |
|
72 /** |
|
73 * Two-phased constructor. |
|
74 * @param aSettingsId: settings id. |
|
75 * @param aAdapterUid: Uid of the ximpfw adaptation. |
|
76 * @return CVIMPSTEngineSessionCntxtObserver new instance of this class |
|
77 */ |
|
78 static CVIMPSTEngineSessionCntxtObserver* |
|
79 CVIMPSTEngineSessionCntxtObserver::NewLC(TUint32 aServiceId); |
|
80 |
|
81 |
|
82 /** |
|
83 * C++ default destructor. |
|
84 * ~CVIMPSTEngineSessionCntxtObserver |
|
85 */ |
|
86 ~CVIMPSTEngineSessionCntxtObserver(); |
|
87 |
|
88 /** |
|
89 * GetCompletedReqResult |
|
90 * @return TInt the result code |
|
91 */ |
|
92 TInt GetCompletedReqResult() const; |
|
93 |
|
94 /** |
|
95 * GetRequestMapper |
|
96 * @return CVIMPSTEngineRequestMapper pointer to RequestMapper |
|
97 */ |
|
98 CVIMPSTEngineRequestMapper* GetRequestMapper() const; |
|
99 |
|
100 /** |
|
101 * Presence bind |
|
102 * |
|
103 * @since S60 5.0 |
|
104 * @param aProtocolUid - uid of the ximpfw adaptation. |
|
105 * @return TInt, error if any. |
|
106 */ |
|
107 TInt ServerBindL(TUid aProtocolUid); |
|
108 |
|
109 /** |
|
110 * Presence unbind |
|
111 * |
|
112 * @since S60 5.0 |
|
113 * @param aDoUnsubscribe, do unsubscribe before unbind. |
|
114 * Unsubscribe can not be done if unbind is triggered by |
|
115 * lost network. |
|
116 * @return TInt, error if any. |
|
117 */ |
|
118 TInt ServerUnBindL( TBool aDoUnsubscribe ); |
|
119 |
|
120 /** |
|
121 * Returns pointer to XIMP presence authorization interface. |
|
122 * This method must be used to get access. |
|
123 * If feature is not supported by current |
|
124 * presence adapter, leaves with KErrNotSupported. |
|
125 * |
|
126 * @since S60 3.2 |
|
127 * @return MPresenceAuthorization reference |
|
128 */ |
|
129 MPresenceAuthorization& XimpAuthorizationL(); |
|
130 |
|
131 /** |
|
132 * Returns pointer to XIMP presence watching interface. |
|
133 * This method must be used to get access. |
|
134 * If feature is not supported by current |
|
135 * presence adapter, leaves with KErrNotSupported. |
|
136 * |
|
137 * @since S60 3.2 |
|
138 * @return MPresenceWatching reference |
|
139 */ |
|
140 MPresenceWatching& XimpPresenceWatchingL(); |
|
141 |
|
142 /** |
|
143 * Returns pointer to XIMP presence presentity groups interface. |
|
144 * This method must be used to get access. |
|
145 * If feature is not supported by current |
|
146 * presence adapter, leaves with KErrNotSupported. |
|
147 * |
|
148 * @since S60 3.2 |
|
149 * @return MPresentityGroups reference |
|
150 */ |
|
151 MPresentityGroups& XimpPresentityGroupsL(); |
|
152 |
|
153 /** |
|
154 * Returns pointer to XIMP presence publishing interface. |
|
155 * This method must be used to get access. |
|
156 * If feature is not supported by current |
|
157 * presence adapter, leaves with KErrNotSupported. |
|
158 * |
|
159 * @since S60 3.2 |
|
160 * @return MPresentityGroups reference |
|
161 */ |
|
162 MPresencePublishing& XimpPresencePublishingL(); |
|
163 |
|
164 /** |
|
165 * Gets reference to object factory interface. |
|
166 * |
|
167 * Returned object factory interface is used |
|
168 * to instantiate presence objects. |
|
169 * |
|
170 * @return Object factory interface. |
|
171 * No ownership is returned caller. |
|
172 */ |
|
173 MPresenceObjectFactory& PresenceObjectFactoryL() const ; |
|
174 |
|
175 MPresenceFeatures& PresenceFeaturesL() const; |
|
176 |
|
177 /** |
|
178 * Gets reference to Presencecontext. |
|
179 * |
|
180 * Returned Presencecontext interface is used |
|
181 * to instantiate object factory. |
|
182 * |
|
183 * @since 5.0 |
|
184 * @return Object factory interface. |
|
185 * No ownership is returned caller. |
|
186 */ |
|
187 MXIMPContext& XimpPresenceContextL(); |
|
188 |
|
189 /** |
|
190 * Register observer from getting notified of ximp events. |
|
191 * |
|
192 * @since 5.0 |
|
193 * @param aObserver observer to be called when ximp events are received. |
|
194 * Unregister is done by session context when the presence context gets |
|
195 * unbinded. The Requester must register each time when XIMP Context gets Binded. |
|
196 * Otherwise he will not get the event |
|
197 */ |
|
198 void RegisterObserver(MVIMPSTEngineSessionCntxtObserver* aObserver); |
|
199 |
|
200 /** |
|
201 * get the supproted features form the ximp adaptation |
|
202 * |
|
203 * @since 5.0 |
|
204 * @return MDesC8Array array of supported features. |
|
205 */ |
|
206 TInt GetSupportedFeatures(); |
|
207 |
|
208 |
|
209 /** |
|
210 * get the supproted features form the ximp adaptation |
|
211 * |
|
212 * @since 5.0 |
|
213 * @return MDesC8Array array of supported features. |
|
214 */ |
|
215 TVIMPSTEnums::TVIMPSTBindStatus ContextBindStatus(); |
|
216 |
|
217 private: |
|
218 |
|
219 /** |
|
220 * Unregister observer from getting notified of ximp events. |
|
221 * |
|
222 * @since 5.0 |
|
223 * @param aObserver observer to be called when ximp events are received. |
|
224 */ |
|
225 void UnRegisterObserver(MVIMPSTEngineSessionCntxtObserver* aObserver); |
|
226 |
|
227 /** |
|
228 * HandleximpContextEvent method from context obsrver |
|
229 * ximp framework |
|
230 * @param aContext |
|
231 * @param aEvent, event |
|
232 */ |
|
233 |
|
234 void HandlePresenceContextEvent( const MXIMPContext& aContext, |
|
235 const MXIMPBase& aEvent ); |
|
236 |
|
237 /** |
|
238 * Handles presence callbacks |
|
239 * |
|
240 * @since S60 3.2 |
|
241 * @param aContext, context |
|
242 * @param aEvent, event |
|
243 * @return void |
|
244 */ |
|
245 void DoHandlePresenceContextEventL( |
|
246 const MXIMPContext& aContext, |
|
247 const MXIMPBase& aEvent ); |
|
248 |
|
249 /** |
|
250 * Resolves and allocates presense uri from ximp operation. |
|
251 * |
|
252 * @since S60 5.0 |
|
253 * @param aEvent, used to get the ximpidentity. |
|
254 * @return HBufC, presence uri from operation. Ownsership passed. |
|
255 */ |
|
256 HBufC* UriFromXimpOperationLC(const MXIMPBase& aEvent ); |
|
257 private: |
|
258 |
|
259 /** |
|
260 *second phase constructor |
|
261 */ |
|
262 void ConstructL(); |
|
263 |
|
264 /** |
|
265 * CVIMPSTEngineSessionCntxtObserver |
|
266 * @param aSettingsId: settings id. |
|
267 * @param aAdapterUid: Uid of the ximpfw adaptation. |
|
268 */ |
|
269 CVIMPSTEngineSessionCntxtObserver(TUint32 aServiceId); |
|
270 |
|
271 /** |
|
272 * Identifies the Features supported by the Adaptation |
|
273 * and stores the information in iFeatureSupported |
|
274 */ |
|
275 void IdentifySupportedFeaturesL(); |
|
276 |
|
277 |
|
278 private: //Data |
|
279 // not own |
|
280 TUint32 iServiceId; |
|
281 |
|
282 //Result code from waited request |
|
283 TInt iReqResult; |
|
284 |
|
285 // Current presence bind status |
|
286 TVIMPSTEnums::TVIMPSTBindStatus iBindStatus; |
|
287 |
|
288 //OWN: request mapper to mapp each request |
|
289 CVIMPSTEngineRequestMapper* iRequestMapper; |
|
290 |
|
291 // own , client for presence framework |
|
292 MXIMPClient* iClient; |
|
293 |
|
294 // own ,presence context to prsence framework |
|
295 MXIMPContext* iPresenceCtx; |
|
296 |
|
297 // owned pointer to presence plugin |
|
298 MPresenceFeatures* iFeatures; |
|
299 |
|
300 //Stores the XIMPFw EventTypes Subscribed for |
|
301 RArray< TInt32 > iAcceptedEventTypes; |
|
302 |
|
303 // Own, array of observers. |
|
304 RPointerArray<MVIMPSTEngineSessionCntxtObserver> iObserverArray; |
|
305 |
|
306 //Stores the XIMP Features Supported |
|
307 TInt iFeatureSupported; |
|
308 |
|
309 |
|
310 }; |
|
311 |
|
312 |
|
313 |
|
314 #endif //CVIMPSTENGINESESSIONCNTXTOBSERVER_H_ |
|
315 |
|
316 |