|
1 /* |
|
2 * Copyright (c) 2006 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: Contains CNcdProvider class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_PROVIDER_H |
|
20 #define NCD_PROVIDER_H |
|
21 |
|
22 |
|
23 #include "catalogscommunicable.h" |
|
24 #include "catalogshttpconnectionmanager.h" |
|
25 |
|
26 |
|
27 class CNcdNodeManager; |
|
28 class CNcdFavoriteManager; |
|
29 class CNcdPurchaseHistoryDb; |
|
30 class CNcdOperationManager; |
|
31 class CNcdSubscriptionManager; |
|
32 class CNcdStorageManager; |
|
33 class CNcdProtocol; |
|
34 class CCatalogsTransport; |
|
35 class MNcdConfigurationManager; |
|
36 class MCatalogsHttpSession; |
|
37 class MCatalogsSmsSession; |
|
38 class MCatalogsContext; |
|
39 class MCatalogsAccessPointManager; |
|
40 class CNcdProviderUtils; |
|
41 class MCatalogsHttpSession; |
|
42 class RFs; |
|
43 class CNcdReportManager; |
|
44 class TCatalogsConnectionMethod; |
|
45 class CNcdHttpUtils; |
|
46 class CNcdServerReportManager; |
|
47 class MNcdProviderCloseObserver; |
|
48 class CNcdGeneralManager; |
|
49 |
|
50 struct TNcdProviderContext |
|
51 { |
|
52 MCatalogsHttpSession* iHttpSession; |
|
53 MCatalogsSmsSession* iSmsSession; |
|
54 CNcdReportManager* iReportManager; |
|
55 |
|
56 TNcdProviderContext() : |
|
57 iHttpSession( NULL ), |
|
58 iSmsSession( NULL ), |
|
59 iReportManager( NULL ) |
|
60 { |
|
61 } |
|
62 }; |
|
63 |
|
64 /** |
|
65 * CNcdProvider provides functions to ... |
|
66 * @lib ?library |
|
67 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
68 */ |
|
69 class CNcdProvider : public CCatalogsCommunicable, |
|
70 public MCatalogsHttpConnectionConfirmationObserver, |
|
71 public MCatalogsHttpConnectionErrorObserver |
|
72 { |
|
73 |
|
74 public: |
|
75 |
|
76 /** |
|
77 * TNcdProviderFunctionNumber should be used when proxies are requesting |
|
78 * services by calling ReceiveMessageL function of this class. |
|
79 */ |
|
80 enum TNcdProviderFunctionNumber |
|
81 { |
|
82 /** |
|
83 * |
|
84 */ |
|
85 ENcdProviderNodeManagerHandle, |
|
86 |
|
87 /** |
|
88 * |
|
89 */ |
|
90 ENcdProviderPurchaseHistoryHandle, |
|
91 |
|
92 /** |
|
93 * |
|
94 */ |
|
95 ENcdProviderOperationManagerHandle, |
|
96 |
|
97 /** |
|
98 * |
|
99 */ |
|
100 ENcdProviderSubscriptionManagerHandle, |
|
101 |
|
102 /** |
|
103 * |
|
104 */ |
|
105 ENcdProviderFavoriteManagerHandle, |
|
106 |
|
107 /** |
|
108 * |
|
109 */ |
|
110 ENcdProviderServerReportManagerHandle, |
|
111 |
|
112 /** |
|
113 * |
|
114 */ |
|
115 ENcdProviderRelease, |
|
116 |
|
117 /** |
|
118 * |
|
119 */ |
|
120 ENcdProviderAddConfiguration, |
|
121 |
|
122 /** |
|
123 * |
|
124 */ |
|
125 ENcdProviderRemoveConfiguration, |
|
126 |
|
127 |
|
128 /** |
|
129 * |
|
130 */ |
|
131 ENcdProviderRetrieveConfigurations, |
|
132 |
|
133 |
|
134 /** |
|
135 * |
|
136 */ |
|
137 ENcdProviderSetDefaultAccessPoint, |
|
138 |
|
139 |
|
140 /** |
|
141 * |
|
142 */ |
|
143 ENcdProviderClientId, |
|
144 |
|
145 /** |
|
146 * |
|
147 */ |
|
148 ENcdProviderClearCache, |
|
149 |
|
150 |
|
151 /** |
|
152 */ |
|
153 ENcdGetProviderInfo, |
|
154 |
|
155 /** |
|
156 * |
|
157 */ |
|
158 ENcdProviderIsSimChanged, |
|
159 |
|
160 /** |
|
161 * |
|
162 */ |
|
163 ENcdProviderIsFixedAp, |
|
164 |
|
165 /** |
|
166 * |
|
167 */ |
|
168 ENcdProviderSyncSeenInfo |
|
169 |
|
170 }; |
|
171 |
|
172 |
|
173 enum TNcdProviderInfo |
|
174 { |
|
175 ENcdProviderInfoType, |
|
176 ENcdProviderInfoVersion, |
|
177 ENcdProviderInfoUid, |
|
178 ENcdProviderInfoProvisioning |
|
179 }; |
|
180 |
|
181 |
|
182 |
|
183 /** |
|
184 * NewLC |
|
185 * |
|
186 * @param aProviderIndex Local index of the provider. |
|
187 * @return CNcdProvider* Pointer to the created object |
|
188 * of this class. |
|
189 */ |
|
190 static CNcdProvider* NewLC( |
|
191 const TUid& aFamilyId, |
|
192 MNcdProviderCloseObserver& aCloseObserver, |
|
193 const TDesC& aEngineRoot, |
|
194 CCatalogsTransport& aTransport, |
|
195 CNcdStorageManager& aStorageManager ); |
|
196 |
|
197 |
|
198 /** |
|
199 * Destructor |
|
200 */ |
|
201 virtual ~CNcdProvider(); |
|
202 |
|
203 public: |
|
204 |
|
205 void PrepareSessionL( MCatalogsSession& aSession, TUint32 aOptions ); |
|
206 |
|
207 /** |
|
208 * Informs objects of session removal. They should not use |
|
209 * given session in anyway anymore |
|
210 * |
|
211 * @since S60 ?S60_version |
|
212 * @param aSession Session that is not in use anymore. |
|
213 */ |
|
214 void HandleSessionRemoval( MCatalogsSession& aSession ); |
|
215 |
|
216 void GetProviderContextL( MCatalogsContext& aContext, TNcdProviderContext& aProviderContext ); |
|
217 |
|
218 CNcdNodeManager& NodeManager(); |
|
219 |
|
220 MCatalogsAccessPointManager& AccessPointManager(); |
|
221 |
|
222 const TUid& FamilyId() const; |
|
223 |
|
224 const TDesC& FamilyName() const; |
|
225 |
|
226 TInt DatabaseClearingStatus() const; |
|
227 |
|
228 public: // CCatalogsCommunicable |
|
229 |
|
230 /** |
|
231 * TNcdNodeFunctionNumber describes the functionality that |
|
232 * may be required using this function. |
|
233 * |
|
234 * @see CCatalogsCommuniCable::ReceiveMessage |
|
235 */ |
|
236 virtual void ReceiveMessage( MCatalogsBaseMessage* aMessage, |
|
237 TInt aFunctionNumber ); |
|
238 |
|
239 void ReceiveMessageL( |
|
240 MCatalogsBaseMessage& aMessage, |
|
241 TInt aFunctionNumber ); |
|
242 |
|
243 /** |
|
244 * @see CCatalogsCommunicable::CounterPartLost |
|
245 */ |
|
246 virtual void CounterPartLost( const MCatalogsSession& aSession ); |
|
247 |
|
248 public: // MCatalogsHttpConnectionConfirmationObserver |
|
249 |
|
250 virtual TCatalogsHttpConnectionConfirmationState |
|
251 HandleConnectionConfirmationRequestL( |
|
252 MCatalogsHttpSession& aSession, |
|
253 const TCatalogsConnectionMethod& aMethod ); |
|
254 |
|
255 |
|
256 public: // MCatalogsHttpConnectionErrorObserver |
|
257 |
|
258 |
|
259 virtual void HandleConnectionErrorL( |
|
260 MCatalogsHttpSession& aSession, |
|
261 const TCatalogsConnectionMethod& aMethod, |
|
262 TInt aError ); |
|
263 |
|
264 |
|
265 protected: |
|
266 |
|
267 /** |
|
268 * Constructor |
|
269 */ |
|
270 CNcdProvider( |
|
271 const TUid& aFamilyId, |
|
272 MNcdProviderCloseObserver& aCloseObserver, |
|
273 const TDesC& aEngineRoot, |
|
274 CCatalogsTransport& aTransport, |
|
275 CNcdStorageManager& aStorageManager ); |
|
276 |
|
277 /** |
|
278 * Creates the nodemanager and the data storer. |
|
279 */ |
|
280 void ConstructL(); |
|
281 |
|
282 |
|
283 // Here are all the functions that are used when ReceiveMessageL is called |
|
284 // and the functionality is delegated according to the given function |
|
285 // number. |
|
286 |
|
287 // Gives the operationmanager handle to the proxy |
|
288 void NodeManagerHandleRequestL( |
|
289 MCatalogsBaseMessage& aMessage ) const; |
|
290 |
|
291 // Gives the Purchase History handle to the proxy. |
|
292 void PurchaseHistoryHandleRequestL( MCatalogsBaseMessage& aMessage ) const; |
|
293 |
|
294 // Gives the operationmanager handle to the proxy |
|
295 void OperationManagerHandleRequestL( |
|
296 MCatalogsBaseMessage& aMessage ) const; |
|
297 |
|
298 // Gives the subscriptionmanager handle to the proxy |
|
299 void SubscriptionManagerHandleRequestL( |
|
300 MCatalogsBaseMessage& aMessage ) const; |
|
301 |
|
302 // Gives the favoritemanager handle to the proxy |
|
303 void FavoriteManagerHandleRequestL( |
|
304 MCatalogsBaseMessage& aMessage ) const; |
|
305 |
|
306 void ServerReportManagerHandleRequestL( |
|
307 MCatalogsBaseMessage& aMessage ) const; |
|
308 |
|
309 // Removes one reference of this object from the session. |
|
310 // ( There may be multiple references, but we take care of our own. ) |
|
311 void ReleaseRequestL( MCatalogsBaseMessage& aMessage ) const; |
|
312 |
|
313 |
|
314 void AddConfigurationRequestL( MCatalogsBaseMessage& aMessage ); |
|
315 |
|
316 void RemoveConfigurationRequestL( MCatalogsBaseMessage& aMessage ); |
|
317 |
|
318 void RetrieveConfigurationsRequestL( |
|
319 MCatalogsBaseMessage& aMessage ); |
|
320 |
|
321 void SetDefaultAccessPointRequestL( |
|
322 MCatalogsBaseMessage& aMessage ); |
|
323 |
|
324 void CreateClientIdRequestL( |
|
325 MCatalogsBaseMessage& aMessage ); |
|
326 |
|
327 // Clears client cache |
|
328 void ClearCacheRequestL( |
|
329 MCatalogsBaseMessage& aMessage ); |
|
330 |
|
331 void GetInfoRequestL( |
|
332 MCatalogsBaseMessage& aMessage ); |
|
333 |
|
334 void IsSimChangedRequestL( MCatalogsBaseMessage& aMessage ); |
|
335 |
|
336 void IsFixedApRequestL( MCatalogsBaseMessage& aMessage ); |
|
337 |
|
338 void SyncSeenInfoRequestL( MCatalogsBaseMessage& aMessage ); |
|
339 |
|
340 void AllowCacheCleaningL( |
|
341 const MCatalogsContext& aContext, |
|
342 TBool aAllow ); |
|
343 |
|
344 TBool StartupBeginL( const TDesC& aEnginePath ); |
|
345 |
|
346 void CheckDatabaseVersionsL( const TDesC& aEnginePath ); |
|
347 |
|
348 |
|
349 void StartupEndL(); |
|
350 |
|
351 void ClearProviderFilesL( const TDesC& aEnginePath ); |
|
352 |
|
353 void ClearDatabasesL( const TDesC& aEnginePath ); |
|
354 void ClearPurchaseHistoryL(); |
|
355 void ClearTempFilesL(); |
|
356 |
|
357 void HandleShutdownFileL(); |
|
358 |
|
359 // Manages the storages if SIM card is changed. |
|
360 // aClearStorages determines whether storages are cleared or not |
|
361 void ManageStoragesL( |
|
362 const MCatalogsContext& aContext, |
|
363 TBool aClearStorages ); |
|
364 |
|
365 // Hashes IMSI with SHA-1 |
|
366 HBufC8* HashImsiLC(); |
|
367 |
|
368 HBufC8* ConvertDataToTextL( const TDesC8& aData ) const; |
|
369 |
|
370 void PurchaseHistoryPathLC( RBuf& aPath ) const; |
|
371 |
|
372 void FamilyPathLC( RBuf& aPath ) const; |
|
373 |
|
374 void HandleProviderOptionsL( |
|
375 const MCatalogsContext& aContext, |
|
376 TUint32 aOptions, |
|
377 MCatalogsHttpSession& aHttpSession ); |
|
378 |
|
379 private: |
|
380 |
|
381 // Prevent these two if they are not implemented |
|
382 CNcdProvider( const CNcdProvider& aObject ); |
|
383 CNcdProvider& operator =( const CNcdProvider& aObject ); |
|
384 |
|
385 |
|
386 private: // data |
|
387 |
|
388 // ID of the family this provider instance belongs to |
|
389 TUid iFamilyId; |
|
390 |
|
391 TUidName iFamilyName; |
|
392 |
|
393 MNcdProviderCloseObserver& iCloseObserver; |
|
394 |
|
395 const TDesC& iEngineRoot; |
|
396 |
|
397 // Local provider index number of this provider. Used to index context provider fields, |
|
398 // for example. |
|
399 TInt iProviderIndex; |
|
400 |
|
401 // Node manager is used to manage the creation of nodes |
|
402 CNcdNodeManager* iNodeManager; |
|
403 |
|
404 // Purchase history |
|
405 CNcdPurchaseHistoryDb* iPurchaseHistory; |
|
406 |
|
407 // Operation manager is used to manage the creation of operations |
|
408 CNcdOperationManager* iOperationManager; |
|
409 |
|
410 |
|
411 // Subscription manager manages subscription info |
|
412 CNcdSubscriptionManager* iSubscriptionManager; |
|
413 |
|
414 |
|
415 // Storage manager is used to manage all storages in the provider |
|
416 CNcdStorageManager& iStorageManager; |
|
417 |
|
418 // Protocol handler manages protocol sessions and provides access |
|
419 // to response parser and request processing |
|
420 CNcdProtocol* iProtocolHandler; |
|
421 |
|
422 // Transport |
|
423 CCatalogsTransport& iTransport; |
|
424 |
|
425 MNcdConfigurationManager* iConfigurationManager; |
|
426 |
|
427 // Access point manager is used to manage creation of access points |
|
428 MCatalogsAccessPointManager* iAccessPointManager; |
|
429 |
|
430 // Favorite manager is used to manage favorite node list. |
|
431 CNcdFavoriteManager* iFavoriteManager; |
|
432 |
|
433 // Server report manager is used to manage server report sending. |
|
434 CNcdServerReportManager* iServerReportManager; |
|
435 |
|
436 // ETrue if the SIM has been changed since previous startup |
|
437 TBool iSimChanged; |
|
438 |
|
439 // ETrue while provider is starting up |
|
440 TBool iProviderStartingUp; |
|
441 |
|
442 CNcdHttpUtils* iHttpUtils; |
|
443 |
|
444 // ETrue if the engine was not shutdown properly last time |
|
445 TBool iShutdownFailed; |
|
446 |
|
447 CNcdGeneralManager* iGeneralManager; |
|
448 |
|
449 TInt iDatabaseClearingStatus; |
|
450 }; |
|
451 |
|
452 |
|
453 #endif // NCD_PROVIDER_H |