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: service manager callback implementation class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CICPSERVICEMANAGER_H |
|
20 #define C_CICPSERVICEMANAGER_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <cchservice.h> |
|
27 #include <ximpbase.h> |
|
28 #include <ximpcontext.h> |
|
29 #include <ximpcontextobserver.h> |
|
30 #include <ximpcontextstate.h> |
|
31 #include <spdefinitions.h> |
|
32 |
|
33 #include "timconnproviderenums.h" |
|
34 |
|
35 #define MAX_LENGTH 512 |
|
36 |
|
37 class MXIMPContext; //for MXIMPContext |
|
38 class MXIMPClient; |
|
39 class CICPServiceRequest; |
|
40 class CXmppSettingsApi; //protocol specific settings store |
|
41 class CIMCacheFactory; // imcache factory |
|
42 class MIMCacheUpdater; // cache updater |
|
43 class CSPSettings; //SP Settings |
|
44 |
|
45 /** |
|
46 * CIcpServiceManager class |
|
47 * @lib imconnectionprovider.dll |
|
48 */ |
|
49 class CIcpServiceManager : public CBase, |
|
50 public MXIMPContextObserver |
|
51 { |
|
52 //for test case purpose |
|
53 friend class Cimconnectionprovider_test; |
|
54 |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Two-phased constructor |
|
59 */ |
|
60 static CIcpServiceManager* NewL( MCchServiceObserver& aServiceObserver ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CIcpServiceManager(); |
|
66 |
|
67 public: // New functions |
|
68 |
|
69 /** |
|
70 * Client enables service. CCHService implementation |
|
71 * should use MCCHServiceObserver for service state notifications. |
|
72 * @see MCCHServiceObserver |
|
73 * @param aServiceId |
|
74 */ |
|
75 void EnableServiceL( TUint aServiceId, |
|
76 TCCHSubserviceType aSubServiceType ); |
|
77 |
|
78 /** |
|
79 * Client enables service. CCHService implementation |
|
80 * should use MCCHServiceObserver for service state notifications. |
|
81 * @see MCCHServiceObserver |
|
82 * @param aServiceId |
|
83 * @param aIapId |
|
84 */ |
|
85 void EnableServiceL( TUint aServiceId, |
|
86 TCCHSubserviceType aSubServiceType, |
|
87 TUint aIapId ); |
|
88 |
|
89 /** |
|
90 * Client disables service. |
|
91 * @param aServiceId |
|
92 */ |
|
93 void DisableServiceL( TUint aServiceId, |
|
94 TCCHSubserviceType aSubServiceType ); |
|
95 |
|
96 /** |
|
97 * Client checks is the service available by the IAP id array. |
|
98 * CCHService implementation should return ETrue if service is |
|
99 * registrable by the (some) IAP, array contains. |
|
100 * @param aServiceId |
|
101 * @param aIapIdArray Id array of the currently available iaps. |
|
102 * @return ETrue if service is available. |
|
103 */ |
|
104 TBool IsAvailableL( TUint aServiceId, |
|
105 TCCHSubserviceType aSubServiceType, |
|
106 const RArray<TUint32>& aIapIdArray ) const; |
|
107 |
|
108 /** |
|
109 * Get service state information. |
|
110 * @param aServiceId |
|
111 * @param aState Current service state. |
|
112 * @return General symbian error code. |
|
113 */ |
|
114 TInt GetServiceState( TUint aServiceId, |
|
115 TCCHSubserviceType aSubServiceType, |
|
116 TCCHSubserviceState& aState ) const; |
|
117 |
|
118 /** |
|
119 * Get service network information. |
|
120 * @param aServiceId |
|
121 * @param aSnapId Used Snap id (should be set as null if |
|
122 * not in use) |
|
123 * @pamar aIapId Used IAP id (should be set as null if |
|
124 * not in use) |
|
125 * @return General symbian error code. |
|
126 */ |
|
127 TInt GetServiceNetworkInfoL( TUint aServiceId, |
|
128 TCCHSubserviceType aSubServiceType, |
|
129 TUint32& aSnapId, |
|
130 TUint32& aIapId, |
|
131 TBool& aSnapLocked, |
|
132 TBool& aPasswordSet) const; |
|
133 |
|
134 /** |
|
135 * Set Snap id for service. |
|
136 * @param aServiceId |
|
137 * @param aSnapId |
|
138 * @return General symbian error code. |
|
139 */ |
|
140 TInt SetSnapId( TUint aServiceId, |
|
141 TCCHSubserviceType aSubServiceType, |
|
142 TUint aSnapId ); |
|
143 |
|
144 /** |
|
145 * Set IAP id for service. |
|
146 * @param aServiceId |
|
147 * @param aSnapId |
|
148 * @return General symbian error code. |
|
149 */ |
|
150 TInt SetIapId( TUint aServiceId, |
|
151 TCCHSubserviceType aSubServiceType, |
|
152 TUint aIapId ); |
|
153 |
|
154 /** |
|
155 * Get service specifics information about service and protocol |
|
156 * @param aServiceId |
|
157 * @param aSubservice |
|
158 * @param aBuffer |
|
159 */ |
|
160 void GetServiceInfoL( TUint aServiceId, |
|
161 TCCHSubserviceType aSubServiceType, |
|
162 RBuf& aBuffer ) const; |
|
163 |
|
164 /** |
|
165 * Sets service reserved or unreserved |
|
166 * @param aReserved Reserved |
|
167 * @param aServiceId |
|
168 * @param aSubServiceType Sub service type |
|
169 * @return Symbian error codes |
|
170 */ |
|
171 TInt SetServiceReserved( TBool aReserved, |
|
172 TUint aServiceId, |
|
173 TCCHSubserviceType aSubServiceType ); |
|
174 |
|
175 |
|
176 /** |
|
177 * Returns the connection parameters |
|
178 * @since S60 3.2.3 |
|
179 * @param aServiceId Selected service id |
|
180 * @param aServiceId Selected service type |
|
181 * @param aParameter Connection parameter of the service |
|
182 * @param aValue Value of the parameter |
|
183 * @return Symbian error code |
|
184 */ |
|
185 TInt GetConnectionParameter( TUint aServiceId, |
|
186 TCCHSubserviceType aSubServiceType, |
|
187 TCchConnectionParameter aParameter, |
|
188 TInt& aValue ) const; |
|
189 |
|
190 /** |
|
191 * Returns the connection parameters |
|
192 * @since S60 3.2.3 |
|
193 * @param aServiceId Selected service id |
|
194 * @param aServiceId Selected service type |
|
195 * @param aParameter Connection parameter of the service |
|
196 * @param aValue Value of the parameter |
|
197 * @return Symbian error code |
|
198 */ |
|
199 void GetConnectionParameterL(TUint aServiceId, |
|
200 TCCHSubserviceType aSubServiceType, |
|
201 TCchConnectionParameter aParameter, |
|
202 RBuf& aValue ) const; |
|
203 |
|
204 /** |
|
205 * Sets the connection parameters |
|
206 * @since S60 3.2.3 |
|
207 * @param aServiceId Selected service id |
|
208 * @param aServiceId Selected service type |
|
209 * @param aParameter Connection parameter of the service |
|
210 * @param aValue Value of the parameter |
|
211 * @return Symbian error code |
|
212 */ |
|
213 TInt SetConnectionParameter( TUint aServiceId, |
|
214 TCCHSubserviceType aSubServiceType, |
|
215 TCchConnectionParameter aParameter, |
|
216 TInt aValue ); |
|
217 |
|
218 /** |
|
219 * Sets the connection parameters |
|
220 * @since S60 3.2.3 |
|
221 * @param aServiceId Selected service id |
|
222 * @param aServiceId Selected service type |
|
223 * @param aParameter Connection parameter of the service |
|
224 * @param aValue Value of the parameter |
|
225 * @return Symbian error code |
|
226 */ |
|
227 void SetConnectionParameterL( TUint aServiceId, |
|
228 TCCHSubserviceType aSubServiceType, |
|
229 TCchConnectionParameter aParameter, |
|
230 const TDesC& aValue ); |
|
231 |
|
232 /** |
|
233 * Returns service reserved info |
|
234 * @param aServiceId |
|
235 * @param aSubServiceType Sub service type |
|
236 * @return ETrue if reserved |
|
237 */ |
|
238 TBool IsReserved( TUint aServiceId, |
|
239 TCCHSubserviceType aSubServiceType ) const; |
|
240 |
|
241 /** |
|
242 * Profile event call back. |
|
243 * @since S60 3.2 |
|
244 * @param aProfileId SIP profile id. |
|
245 * @param aEvent a new profile event. |
|
246 */ |
|
247 void ProfileEventOccurred( const TUint32 aProfileId, |
|
248 TCCHSubserviceState aEvent, TInt aError ); |
|
249 |
|
250 /** |
|
251 * Service event call back. |
|
252 * @since S60 3.2 |
|
253 * @param aServiceId Service id. |
|
254 * @param aEvent a new profile event. |
|
255 */ |
|
256 void ServiceEventOccurred( const TUint32 aServiceId, |
|
257 const TCCHSubserviceType aSubService, |
|
258 TCCHSubserviceState aEvent, TInt aError ); |
|
259 |
|
260 |
|
261 /** |
|
262 * Handles presence context event |
|
263 * @param aContext |
|
264 * @param aEvent Event |
|
265 */ |
|
266 void HandlePresenceContextEvent( const MXIMPContext& aContext, |
|
267 const MXIMPBase& aEvent ); |
|
268 |
|
269 |
|
270 |
|
271 /** |
|
272 * Handles bind to the presence context |
|
273 * @param aServiceSettingId |
|
274 */ |
|
275 void BindL(TInt aServiceSettingId); |
|
276 |
|
277 /** |
|
278 * Handles unbind to the presence context |
|
279 */ |
|
280 void UnBindL(); |
|
281 |
|
282 private: |
|
283 |
|
284 TInt ConvertXIMPErrToCChErr(const TInt aXimpErr); |
|
285 |
|
286 /** |
|
287 * Default constructor |
|
288 * @param aStateObserver State Observer |
|
289 */ |
|
290 CIcpServiceManager( MCchServiceObserver& aServiceObserver ); |
|
291 |
|
292 /** |
|
293 * 2nd phase constructor |
|
294 */ |
|
295 void ConstructL(); |
|
296 |
|
297 |
|
298 /** |
|
299 * FindRequestId |
|
300 * find the request id |
|
301 * @param aRequestId to find |
|
302 */ |
|
303 CICPServiceRequest* FindRequestId(TXIMPRequestId& aRequestId ) ; |
|
304 |
|
305 |
|
306 /** |
|
307 * RemoveRequestId |
|
308 * remove from the array |
|
309 * @param aRequestId ,to remove |
|
310 */ |
|
311 CICPServiceRequest* RemoveRequestId(TXIMPRequestId& aRequestId) ; |
|
312 |
|
313 |
|
314 /** Create a Request |
|
315 * @Returns the Ptr to the new request created |
|
316 * @param - aRequestId |
|
317 * @param - aType |
|
318 */ |
|
319 CICPServiceRequest* CreateRequestL(TXIMPRequestId& aRequestId, |
|
320 TIMConnProviderEnums::TRequestTypes aType ); |
|
321 |
|
322 |
|
323 |
|
324 /** |
|
325 * SetIMDisabledL |
|
326 * @param aServiceId: ServiceId |
|
327 */ |
|
328 void SetIMDisabledL(TUint32 aServiceId); |
|
329 |
|
330 |
|
331 TBool ValidateServiceL( TUint32 aServiceId ) const; |
|
332 TInt GetSPSettingsIntPropertyL( TUint32 aServiceId, |
|
333 TServicePropertyName aPropertyName ) const; |
|
334 |
|
335 |
|
336 TBool ValidateSubService( TCCHSubserviceType aSubServiceType ) const; |
|
337 |
|
338 |
|
339 |
|
340 /** |
|
341 * Gets the name of the service |
|
342 * |
|
343 * @since S60 5.0 |
|
344 * @param aServiceId, service id |
|
345 * @param aServiceName, service name is copied to this parameter |
|
346 * caller should allocate memory for this parameter |
|
347 * @return None |
|
348 */ |
|
349 void GetServiceNameL( |
|
350 TUint32 aServiceId, TDes& aServiceName ); |
|
351 |
|
352 private: |
|
353 |
|
354 /** |
|
355 * Observer for state changes |
|
356 */ |
|
357 MCchServiceObserver& iServiceObserver; |
|
358 |
|
359 /** |
|
360 * Event |
|
361 */ |
|
362 TCCHSubserviceState iOngoingState; |
|
363 |
|
364 /** |
|
365 * Ongoing service id and subservice type |
|
366 */ |
|
367 |
|
368 TUint iIapId; |
|
369 |
|
370 TUint iSnapId; |
|
371 |
|
372 TInt iServiceId; |
|
373 |
|
374 TInt iLastReportedError; |
|
375 /** |
|
376 * Ximp specific data handling |
|
377 */ |
|
378 //owns |
|
379 MXIMPClient* iPresClient; |
|
380 |
|
381 //owns |
|
382 MXIMPContext* iPresenceCtx; |
|
383 |
|
384 // Own |
|
385 RPointerArray<CICPServiceRequest> iReqIDArray; |
|
386 |
|
387 // Owned , settings api to set and reset owndata. |
|
388 CXmppSettingsApi* iXmppParameters; |
|
389 |
|
390 //Stores the XIMPFw EventTypes Subscribed for |
|
391 RArray< TInt32 > iAcceptedEventTypes; |
|
392 |
|
393 //stores the userid |
|
394 HBufC* iOwnUserId; |
|
395 |
|
396 // owned, imcache factory ,call release on it. |
|
397 CIMCacheFactory* iIMCacheFactory; |
|
398 |
|
399 // owned,by factory, cache updater |
|
400 MIMCacheUpdater* iIMCacheUpdater ; |
|
401 |
|
402 HBufC* iServiceName; |
|
403 |
|
404 CSPSettings *iCSPSetting; |
|
405 |
|
406 #ifdef _DEBUG |
|
407 #endif |
|
408 |
|
409 }; |
|
410 |
|
411 #endif // C_CICPSERVICEMANAGER_H |
|
412 |
|
413 // End of file |
|
414 |
|