|
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: Adapter to the SUPL Settings API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CLOCSUPLSETTINGSADAPTER_H_ |
|
20 #define CLOCSUPLSETTINGSADAPTER_H_ |
|
21 |
|
22 // System Includes |
|
23 #include <e32base.h> |
|
24 #include <epos_csuplsettingparams.h> // class CServerParams |
|
25 #include <epos_csuplsettings.h> // class CSuplSettings |
|
26 #include <epos_msuplsettingsobserver.h> |
|
27 |
|
28 // User Includes |
|
29 #include "epos_msuplsettingsobserver.h" |
|
30 #include "epos_msuplsessionobserver.h" |
|
31 |
|
32 // Forward Declarations |
|
33 class MLocSUPLSettingsAdapterObserver; |
|
34 class MLocSUPLSettingsSessionObserver; |
|
35 |
|
36 // Class Declaration |
|
37 |
|
38 /** |
|
39 * Adapter class for the SUPL settings API. Handles all the interfacing |
|
40 * functionality to the SUPL Settings API. It also observes for the Settings |
|
41 * changes communicated through the MSuplSettingsObserver |
|
42 */ |
|
43 class CLocSUPLSettingsAdapter : public CActive, |
|
44 public MSuplSettingsObserver, |
|
45 public MSuplSessionObserver |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * SUPL Usage enumerations which display the order of display |
|
50 * in the User interface |
|
51 */ |
|
52 enum TLocSuplUsage |
|
53 { |
|
54 ELocSuplAutomatic = 0, |
|
55 ELocSuplAutomaticatHome, |
|
56 ELocSuplAlwaysAsk, |
|
57 ELocSuplDisable |
|
58 }; |
|
59 public: |
|
60 /** |
|
61 * Static Two phase contructor that instantiates the CLocSUPLSettingsAdapter |
|
62 * |
|
63 * @param aObserver Observer to the SUPL settings adapter |
|
64 * @return CLocSUPLSettingsAdapter* Reference to the object created |
|
65 */ |
|
66 static CLocSUPLSettingsAdapter* NewL( |
|
67 MLocSUPLSettingsAdapterObserver& aObserver ); |
|
68 |
|
69 /** |
|
70 * Destructor |
|
71 */ |
|
72 virtual ~CLocSUPLSettingsAdapter(); |
|
73 |
|
74 private: |
|
75 /** |
|
76 * Private Constructor |
|
77 */ |
|
78 CLocSUPLSettingsAdapter( MLocSUPLSettingsAdapterObserver& aObserver ); |
|
79 |
|
80 /** |
|
81 * Second phase of the two phase constructor |
|
82 */ |
|
83 void ConstructL(); |
|
84 |
|
85 public: |
|
86 /** |
|
87 * Initializes the SUPL Settings API. This is an asynchronus call, the call |
|
88 * back for which is given through the observer |
|
89 */ |
|
90 void Initialize(); |
|
91 |
|
92 /** |
|
93 * Cancels the Initialization |
|
94 */ |
|
95 void CancelInitialize(); |
|
96 |
|
97 /** |
|
98 * Sets the SUPL Settings usage. |
|
99 * |
|
100 * @param aIndex Index of the SUPL settings usage item. |
|
101 */ |
|
102 void SetSuplUsageL( const TLocSuplUsage aIndex ); |
|
103 |
|
104 /** |
|
105 * Obtains the SUPL Settings usage. |
|
106 * |
|
107 * @param aSuplUsage SUPL settings usage string. |
|
108 */ |
|
109 void GetSuplUsageL( TDes& aSuplUsage ); |
|
110 |
|
111 /** |
|
112 * Obtains the SUPL usage |
|
113 * |
|
114 * @return The SUPL usage |
|
115 */ |
|
116 TInt GetSuplUsage(); |
|
117 |
|
118 /** |
|
119 * Obtains the Supl Settings usage index |
|
120 * |
|
121 * @return TLocSuplUsage SUPL settings usage index |
|
122 */ |
|
123 TLocSuplUsage GetSuplUsageIndex(); |
|
124 |
|
125 |
|
126 /*************************************************************************** |
|
127 * |
|
128 * @since S60 9.1TB |
|
129 * |
|
130 ***************************************************************************/ |
|
131 |
|
132 /** |
|
133 * Adds the new server into settings. |
|
134 * After adding server entry, the server identity generated will be retuned with aSlpId.. |
|
135 * |
|
136 * @since S60 9.1TB |
|
137 * |
|
138 * @param [IN] aServerAddress Server address in string format |
|
139 * @param [IN] aIapName The Internet Access Point Name refers to the access point which is |
|
140 * used to access the HSLP over the internet. This can have maximum size of 100 characters. |
|
141 * @param [IN] aUsageInHomeNw Inidcates whether server can be used in the home network or not |
|
142 */ |
|
143 void AddNewServerL( |
|
144 const TDesC& aServerAddress, |
|
145 const TDesC& aIapName, |
|
146 const TBool aUsageInHomeNw |
|
147 ); |
|
148 |
|
149 /** |
|
150 * Deletes server entry from SUPL settings storage. |
|
151 * |
|
152 * @since S60 9.1TB |
|
153 * |
|
154 * @param [IN] aSlpId Server identity for which the entery needs to be deleted from the SUPL settings storage |
|
155 * |
|
156 */ |
|
157 void RemoveServerL( |
|
158 const TInt64 aSlpId |
|
159 ); |
|
160 |
|
161 /** |
|
162 * This synchronous method is used to retrieve properties of all servers from SUPL settings storage. |
|
163 * This method retrieves all properties for each server. |
|
164 * |
|
165 * @since S60 9.1TB |
|
166 * |
|
167 * @param [OUT] aParamValues Array of retrieved server entries |
|
168 * @ref CServerParams class |
|
169 * |
|
170 */ |
|
171 void GetAllSlpL( |
|
172 RPointerArray<CServerParams>& aParamValues |
|
173 ) const; |
|
174 |
|
175 /** |
|
176 * This method is used to retrieve all properties of server from SUPL settings storage |
|
177 * based on SLP identification. |
|
178 * |
|
179 * @since S60 9.1TB |
|
180 * |
|
181 * @param [IN] aSlpId SLP ID for which the parameters needs to be changed |
|
182 * @param [OUT] aParamValues Parameter for which the value needs to be changed |
|
183 * @ref CServerParams class |
|
184 */ |
|
185 void GetSlpInfoFromIdL( |
|
186 const TInt64 aSlpId, |
|
187 CServerParams *aParamValues |
|
188 ) const; |
|
189 |
|
190 /** |
|
191 * Sets the priority of the server to the specified priority. |
|
192 * |
|
193 * @since S60 9.1TB |
|
194 * |
|
195 * @param [IN] aSlpId Server identity for which the priority needs to be changed |
|
196 * @param [IN] aPriority Number of positions to move |
|
197 * @param [IN] aDirection Whether to increase or decrease priority. |
|
198 * |
|
199 */ |
|
200 void ChangePriorityL( |
|
201 TInt64 aSlpId, |
|
202 TInt aPriority, |
|
203 TBool aDirection |
|
204 ); |
|
205 |
|
206 /** |
|
207 * Sets the server address parameter in server settings |
|
208 * |
|
209 * @since S60 9.1TB |
|
210 * |
|
211 * @param [IN] aSlpId SLP ID for which the parameter needs to be changed |
|
212 * @param [IN] aServerAddres SUPL Server address |
|
213 * |
|
214 */ |
|
215 void SetServerAddressL( |
|
216 const TInt64 aSlpId, |
|
217 const TDesC& aServerAddress |
|
218 ); |
|
219 |
|
220 /** |
|
221 * Obtains the server address parameter from server settings. Client |
|
222 * has to allocate memory for server address parameter. |
|
223 * |
|
224 * @since S60 9.1TB |
|
225 * |
|
226 * @param [IN] aSlpId SLP ID of server for which the server address needs to be retrieved |
|
227 * @param [OUT] aServerAddres SUPL Server address |
|
228 * |
|
229 */ |
|
230 void GetServerAddressL( |
|
231 TInt64 aSlpId, |
|
232 TDes& aServerAddress |
|
233 ) const; |
|
234 |
|
235 /** |
|
236 * Sets the IAP Name in server parameters. IAP name refers to |
|
237 * the access point which is used to access the HSLP over the internet. |
|
238 * |
|
239 * @since S60 9.1TB |
|
240 * |
|
241 * @param [IN] aSlpId SLP ID for which the parameter needs to be changed |
|
242 * @param [IN] aIapName The Internet Access Point Name refers to the access point which is |
|
243 * used to access the HSLP over the internet. This can have maximum size of 100 characters. |
|
244 * |
|
245 */ |
|
246 void SetIapNameL( |
|
247 const TInt64 aSlpId, |
|
248 const TDesC& aIapName |
|
249 ); |
|
250 |
|
251 /** |
|
252 * Obtains the IAP Name in server parameters. IAP name refers to |
|
253 * the access point which is used to access the HSLP over the internet. It is client's |
|
254 * responsibility to allocate memory for IAP name before invoking this method. |
|
255 * |
|
256 * @since S60 9.1TB |
|
257 * |
|
258 * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved |
|
259 * @param [OUT] aIapName The Internet Access Point Name refers to the access point which is |
|
260 * used to access the HSLP over the internet. This can have maximum size of 100 characters. |
|
261 * |
|
262 */ |
|
263 void GetIapNameL( |
|
264 const TInt64 aSlpId, |
|
265 TDes& aIapName |
|
266 ) const; |
|
267 |
|
268 |
|
269 /** |
|
270 * Sets the parameter which indicates whether server |
|
271 * can be used for SUPL session or not. |
|
272 * |
|
273 * @since S60 9.1TB |
|
274 * |
|
275 * @param [IN] aSlpId SLP ID for which the parameter needs to be changed |
|
276 * @param [IN] aEnable Flag to indicate whether server can be enabled or not |
|
277 * |
|
278 */ |
|
279 void SetServerEnabledFlagL( |
|
280 const TInt64 aSlpId, |
|
281 const TBool aEnable |
|
282 ); |
|
283 |
|
284 /** |
|
285 * Obtains the parameter which indicates whether server |
|
286 * can be used for SUPL session or not. |
|
287 * |
|
288 * @since S60 9.1TB |
|
289 * |
|
290 * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved |
|
291 * @param [OUT] aEnable Flag to indicate whether server can be enabled or not |
|
292 * |
|
293 */ |
|
294 void GetServerEnabledFlagL( |
|
295 const TInt64 aSlpId, |
|
296 TBool& aEnable |
|
297 ) const; |
|
298 |
|
299 /** |
|
300 * Sets the parameter which indicates whether server |
|
301 * can be used out side home network or not. |
|
302 * |
|
303 * @since S60 9.1TB |
|
304 * |
|
305 * @param [IN] aSlpId SLP ID for which the parameter needs to be changed |
|
306 * @param [IN] aHomeNwFlag Flag to indicate whether server can be used outside home network or not |
|
307 * |
|
308 */ |
|
309 void SetUsageInHomwNwFlagL( |
|
310 const TInt64 aSlpId, |
|
311 const TBool aHomeNwFlag |
|
312 ); |
|
313 |
|
314 /** |
|
315 * Obtains the parameter which indicates whether server |
|
316 * can be used out side home network or not. |
|
317 * |
|
318 * @since S60 9.1TB |
|
319 * |
|
320 * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved |
|
321 * @param [OUT] aHomeNwFlag Flag to indicate whether server can be used outside home network or not |
|
322 * |
|
323 */ |
|
324 void GetUsageInHomwNwFlagL( |
|
325 const TInt64 aSlpId, |
|
326 TBool& aHomeNwFlag |
|
327 ) const; |
|
328 |
|
329 /** |
|
330 * This method is used to change parameter which indicates whether server |
|
331 * details are editable or not. |
|
332 * |
|
333 * @since S60 9.1TB |
|
334 * |
|
335 * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved |
|
336 * @param [IN] aEditFlag Flag to indicate whether server details are editable or not |
|
337 */ |
|
338 void SetEditableFlagL( |
|
339 const TInt64 aSlpId, |
|
340 const TBool aEditFlag |
|
341 ) const; |
|
342 |
|
343 /** |
|
344 * This method is used to retrieve parameter which indicates whether server |
|
345 * details are editable or not. |
|
346 * |
|
347 * @since S60 9.1TB |
|
348 * |
|
349 * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved |
|
350 * @param [OUT] aEditFlag Flag to indicate whether server details are editable or not |
|
351 */ |
|
352 void GetEditableFlagL( |
|
353 const TInt64 aSlpId, |
|
354 TBool& aEditFlag |
|
355 ) const; |
|
356 |
|
357 /** |
|
358 * Obtains the number of server entries present in SUPL settings. |
|
359 * |
|
360 * @since S60 9.1TB |
|
361 * |
|
362 * @param [OUT] aCount Number of SLP entries |
|
363 * |
|
364 */ |
|
365 void SlpCountL( |
|
366 TInt& aCount |
|
367 ); |
|
368 |
|
369 /** |
|
370 * Obtains the count of active SUPL sessions |
|
371 * |
|
372 * @since S60 9.1TB |
|
373 * |
|
374 * @param [OUT] aActiveSessionsCount Count of active SUPL sessions |
|
375 * |
|
376 */ |
|
377 void GetActiveSessionsCountL( TInt& aActiveSessionsCount ); |
|
378 |
|
379 /** |
|
380 * This method is used to retrieve properties of all triggers from SUPL settings storage. |
|
381 * This method retrieves all properties for each trigger. |
|
382 * |
|
383 * @since S60 9.1TB |
|
384 * |
|
385 * @param [OUT] aParamValues Array of retrieved trigger entries |
|
386 * @ref CTriggerParams class |
|
387 * |
|
388 */ |
|
389 void GetTriggerParamsL( RPointerArray<CTriggerParams>& aParamValues ) const; |
|
390 |
|
391 /** |
|
392 * This method is used to retrieve properties of all triggers from SUPL settings storage. |
|
393 * This method retrieves all properties for required trigger. |
|
394 * |
|
395 * @since S60 9.2TB |
|
396 * |
|
397 * @param [IN] aSessionId Sessiond Id |
|
398 * @param [OUT] aTrigger Array of retrieved trigger entries |
|
399 * @ref CTriggerParams class |
|
400 * |
|
401 */ |
|
402 void GetTriggerParamsL( TInt64 aSessionId, CTriggerParams*& aTrigger ) const; |
|
403 |
|
404 /** |
|
405 * Changes the notification status for a trigger session based on session id |
|
406 * |
|
407 * @since S60 9.1TB |
|
408 * |
|
409 * @param [IN] aSessionId Id of session for which the notification status has to be changed |
|
410 * |
|
411 */ |
|
412 void ChangeNotificationStatusL( TInt64 aSessionId, TBool aTriggerNotificationStatus ) const; |
|
413 |
|
414 /** |
|
415 * Deletes a trigger session based on session id |
|
416 * |
|
417 * @since S60 9.1TB |
|
418 * |
|
419 * @param [IN] aSessionId Id of session that needs to be deleted |
|
420 * |
|
421 */ |
|
422 void RemoveTriggerSessionL( TInt64 aSessionId ) const; |
|
423 |
|
424 /** |
|
425 * Set the Observer for the specific Session |
|
426 * |
|
427 */ |
|
428 void SetSessionObserver( MLocSUPLSettingsSessionObserver* aObserver ); |
|
429 |
|
430 /** |
|
431 * Remove the Session observer |
|
432 * |
|
433 */ |
|
434 void RemoveSessionObserver( ); |
|
435 |
|
436 |
|
437 public: // Accessor functions for SUPL settings usage strings |
|
438 const TDesC& Automatic(); |
|
439 |
|
440 const TDesC& AutomaticAtHome(); |
|
441 |
|
442 const TDesC& AlwaysAsk(); |
|
443 |
|
444 const TDesC& Disable(); |
|
445 |
|
446 public: |
|
447 |
|
448 /** |
|
449 * Inherited from MSuplSettingsObserver |
|
450 */ |
|
451 void HandleSuplSettingsChangeL( |
|
452 TSuplSettingsEventType aEvent, |
|
453 TInt aSlpId |
|
454 ); |
|
455 |
|
456 |
|
457 /** |
|
458 * Inherited from MSuplSessionObserver |
|
459 */ |
|
460 void HandleSuplSessionChangeL( |
|
461 TSuplSessionEventType aEvent, |
|
462 TInt64 aSessionId |
|
463 ); |
|
464 protected: |
|
465 /** |
|
466 * Inherited from CActive |
|
467 */ |
|
468 void RunL(); |
|
469 |
|
470 /** |
|
471 * Inherited from CActive |
|
472 */ |
|
473 void DoCancel(); |
|
474 |
|
475 private: |
|
476 /** |
|
477 * Observer for the SUPL Settings UI Adapter |
|
478 * Reference |
|
479 */ |
|
480 MLocSUPLSettingsAdapterObserver& iObserver; |
|
481 |
|
482 /** |
|
483 * SUPL Settings UI |
|
484 * Owns |
|
485 */ |
|
486 CSuplSettings* iSUPLSettings; |
|
487 |
|
488 /** |
|
489 * SUPL settings usage is automatic |
|
490 * Owns |
|
491 */ |
|
492 HBufC* iAutomatic; |
|
493 |
|
494 /** |
|
495 * SUPL settings usage is automatic in home network |
|
496 * Owns |
|
497 */ |
|
498 HBufC* iAutomaticatHome; |
|
499 |
|
500 /** |
|
501 * SUPL settings usage needs a user confirmation |
|
502 * Owns |
|
503 */ |
|
504 HBufC* iAsk; |
|
505 |
|
506 /** |
|
507 * SUPL is disabled. |
|
508 * Owns. |
|
509 */ |
|
510 HBufC* iDisable; |
|
511 |
|
512 /** |
|
513 * Observer for the specific SUPL session. |
|
514 * Does not own. |
|
515 */ |
|
516 MLocSUPLSettingsSessionObserver* iSessionObserver; |
|
517 |
|
518 }; |
|
519 |
|
520 #endif // CLOCSUPLSETTINGSADAPTER_H_ |
|
521 |
|
522 // End of File |