locationsystemui/locationsysui/locsuplsettingsui/inc/locsuplsettingsadapter.h
changeset 56 4e949f03ecc5
equal deleted inserted replaced
-1:000000000000 56:4e949f03ecc5
       
     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     public:
       
    49         /**
       
    50  		 * Static Two phase contructor that instantiates the CLocSUPLSettingsAdapter
       
    51 		 * 
       
    52 		 * @param aObserver				    Observer to the SUPL settings adapter
       
    53 		 * @return CLocSUPLSettingsAdapter*	Reference to the object created
       
    54 		 */
       
    55         static CLocSUPLSettingsAdapter* NewL(
       
    56                             MLocSUPLSettingsAdapterObserver&    aObserver );
       
    57 
       
    58         /**
       
    59          * Destructor
       
    60          */
       
    61         virtual ~CLocSUPLSettingsAdapter();
       
    62 
       
    63     private:
       
    64         /**
       
    65          * Private Constructor
       
    66          */
       
    67         CLocSUPLSettingsAdapter( MLocSUPLSettingsAdapterObserver&    aObserver );
       
    68 
       
    69         /**
       
    70          * Second phase of the two phase constructor
       
    71          */
       
    72         void ConstructL();
       
    73 				
       
    74     public:
       
    75         /**
       
    76          * Initializes the SUPL Settings API. This is an asynchronus call, the call
       
    77          * back for which is given through the observer
       
    78          */
       
    79         void Initialize();
       
    80         
       
    81         /**
       
    82          * Cancels the Initialization
       
    83          */
       
    84         void CancelInitialize();
       
    85         
       
    86         
       
    87 
       
    88         /***************************************************************************
       
    89 	     * 
       
    90 	     * @since S60 9.1TB 
       
    91 	     * 
       
    92          ***************************************************************************/
       
    93 
       
    94         /**
       
    95 	     * Adds the new server into settings. 
       
    96 	     * After adding server entry, the server identity generated will be retuned with aSlpId..  
       
    97 	     * 
       
    98 	     * @since S60 9.1TB 
       
    99 	     *
       
   100 	     * @param [IN] aServerAddress Server address in string format 
       
   101 	     * @param [IN] aIapName The Internet Access Point Name refers to the access point which is 
       
   102 	     * used to access the HSLP over the internet.  This can have maximum size of 100 characters.
       
   103 	     * @param [IN] aUsageInHomeNw Inidcates whether server can be used in the home network or not 
       
   104      	 */
       
   105 		void AddNewServerL( 
       
   106                 const TDesC& aServerAddress,
       
   107                 const TDesC& aIapName,
       
   108                 const TBool aUsageInHomeNw
       
   109         );
       
   110 
       
   111 	    /**
       
   112 	     * Deletes server entry from SUPL settings storage.  
       
   113 	     *
       
   114 	     * @since S60 9.1TB 
       
   115 	     *
       
   116 	     * @param [IN] aSlpId Server identity for which the entery needs to be deleted from the SUPL settings storage 
       
   117 	     *
       
   118 	     */
       
   119 	    void RemoveServerL(
       
   120 	    		const TInt64 aSlpId
       
   121 	    );
       
   122 
       
   123 	    /**
       
   124 	     * This synchronous method is used to retrieve properties of all servers from SUPL settings storage.  
       
   125 	     * This method retrieves all properties for each server.
       
   126 	     *
       
   127 	     * @since S60 9.1TB 
       
   128 	     *
       
   129 	     * @param [OUT] aParamValues Array of retrieved server entries 
       
   130 	     * @ref CServerParams class
       
   131 	     *
       
   132 	     */
       
   133 	    void GetAllSlpL(
       
   134 	            RPointerArray<CServerParams>& aParamValues
       
   135 	    ) const;
       
   136 
       
   137 	    /**
       
   138 	     * This method is used to retrieve all properties of server from SUPL settings storage
       
   139 	     * based on SLP identification.  
       
   140 	     *
       
   141 	     * @since S60 9.1TB 
       
   142 	     *
       
   143 	     * @param [IN] aSlpId SLP ID for which the parameters needs to be changed 
       
   144 	     * @param [OUT] aParamValues Parameter for which the value needs to be changed  
       
   145 	     * @ref CServerParams class
       
   146 	     */
       
   147 	    void GetSlpInfoFromIdL(
       
   148 	            const TInt64 aSlpId, 
       
   149 	            CServerParams *aParamValues
       
   150 	    ) const;
       
   151 
       
   152 	    /**
       
   153 	     * Sets the priority of the server to the specified priority.  
       
   154 	     *
       
   155 	     * @since S60 9.1TB 
       
   156 	     *
       
   157 	     * @param [IN] aSlpId Server identity for which the priority needs to be changed 
       
   158          * @param [IN] aPriority Number of positions to move 
       
   159          * @param [IN] aDirection Whether to increase or decrease priority. 
       
   160 	     *
       
   161 	     */
       
   162 	    void ChangePriorityL(
       
   163 	            TInt64 aSlpId, 
       
   164 		        TInt aPriority,
       
   165 		        TBool aDirection
       
   166 	    );
       
   167 
       
   168 	    /**
       
   169 	     * Sets the server address parameter in server settings 
       
   170 	     *
       
   171 	     * @since S60 9.1TB 
       
   172 	     *
       
   173 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be changed 
       
   174 	     * @param [IN] aServerAddres SUPL Server address 
       
   175 	     *
       
   176 	     */
       
   177 	    void SetServerAddressL( 
       
   178 	            const TInt64 aSlpId, 
       
   179 	            const TDesC& aServerAddress
       
   180 	    );
       
   181 
       
   182 	    /**
       
   183 	     * Obtains the server address parameter from server settings.  Client
       
   184 	     * has to allocate memory for server address parameter.
       
   185 	     *
       
   186 	     * @since S60 9.1TB 
       
   187 	     *
       
   188 	     * @param [IN] aSlpId SLP ID of server for which the server address needs to be retrieved 
       
   189 	     * @param [OUT] aServerAddres SUPL Server address 
       
   190 	     * 
       
   191 	     */
       
   192 	    void GetServerAddressL( 
       
   193 	            TInt64 aSlpId, 
       
   194 	            TDes& aServerAddress
       
   195 	    ) const;
       
   196 
       
   197 	    /**
       
   198 	     * Sets the IAP Name in server parameters. IAP name refers to 
       
   199 	     * the access point which is used to access the HSLP over the internet. 
       
   200 	     *
       
   201 	     * @since S60 9.1TB 
       
   202 	     *
       
   203 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be changed 
       
   204 	     * @param [IN] aIapName The Internet Access Point Name refers to the access point which is 
       
   205 	     * used to access the HSLP over the internet.  This can have maximum size of 100 characters. 
       
   206 	     * 
       
   207 	     */
       
   208 	    void SetIapNameL( 
       
   209 	            const TInt64 aSlpId, 
       
   210 	            const TDesC& aIapName
       
   211 	    );
       
   212 
       
   213 	    /**
       
   214 	     * Obtains the IAP Name in server parameters. IAP name refers to 
       
   215 	     * the access point which is used to access the HSLP over the internet. It is client's
       
   216 	     * responsibility to allocate memory for IAP name before invoking this method.
       
   217 	     *
       
   218 	     * @since S60 9.1TB 
       
   219 	     *
       
   220 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved 
       
   221 	     * @param [OUT] aIapName The Internet Access Point Name refers to the access point which is 
       
   222 	     * used to access the HSLP over the internet.  This can have maximum size of 100 characters. 
       
   223 	     * 
       
   224 	     */
       
   225 	    void GetIapNameL( 
       
   226 	            const TInt64 aSlpId, 
       
   227 	            TDes& aIapName
       
   228 	    ) const;
       
   229 
       
   230 
       
   231 	    /**
       
   232 	     * Sets the parameter which indicates whether server
       
   233 	     * can be used for SUPL session or not. 
       
   234 	     *
       
   235 	     * @since S60 9.1TB 
       
   236 	     *
       
   237 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be changed 
       
   238 	     * @param [IN] aEnable Flag to indicate whether server can be enabled or not 
       
   239 	     * 
       
   240 	     */
       
   241 	    void SetServerEnabledFlagL(
       
   242 	            const TInt64 aSlpId, 
       
   243 	            const TBool aEnable 
       
   244 	    );
       
   245 
       
   246 	    /**
       
   247 	     * Obtains the parameter which indicates whether server
       
   248 	     * can be used for SUPL session or not. 
       
   249 	     *
       
   250 	     * @since S60 9.1TB 
       
   251 	     *
       
   252 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved 
       
   253 	     * @param [OUT] aEnable Flag to indicate whether server can be enabled or not 
       
   254 	     * 
       
   255 	     */
       
   256 	    void GetServerEnabledFlagL(
       
   257 	            const TInt64 aSlpId, 
       
   258 	            TBool& aEnable 
       
   259 	    ) const;
       
   260 
       
   261 	    /**
       
   262 	     * Sets the parameter which indicates whether server
       
   263 	     * can be used out side home network or not. 
       
   264 	     *
       
   265 	     * @since S60 9.1TB 
       
   266 	     *
       
   267 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be changed 
       
   268 	     * @param [IN] aHomeNwFlag Flag to indicate whether server can be used outside home network or not 
       
   269 	     * 
       
   270 	     */
       
   271 	    void SetUsageInHomwNwFlagL(
       
   272 	            const TInt64 aSlpId, 
       
   273 	            const TBool aHomeNwFlag 
       
   274 	    );
       
   275 
       
   276 	    /**
       
   277 	     * Obtains the parameter which indicates whether server
       
   278 	     * can be used out side home network or not. 
       
   279 	     *
       
   280 	     * @since S60 9.1TB 
       
   281 	     *
       
   282 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved 
       
   283 	     * @param [OUT] aHomeNwFlag Flag to indicate whether server can be used outside home network or not 
       
   284 	     * 
       
   285 	     */
       
   286 	    void GetUsageInHomwNwFlagL(
       
   287 	            const TInt64 aSlpId, 
       
   288 	            TBool& aHomeNwFlag 
       
   289 	    ) const;
       
   290 
       
   291 	    /**
       
   292 	     * This method is used to change parameter which indicates whether server
       
   293 	     * details are editable or not. 
       
   294 	     *
       
   295 	     * @since S60 9.1TB 
       
   296 	     *
       
   297 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved 
       
   298 	     * @param [IN] aEditFlag Flag to indicate whether server details are editable or not 
       
   299 	     */ 
       
   300 	    void SetEditableFlagL( 
       
   301 	            const TInt64 aSlpId, 
       
   302 	            const TBool aEditFlag 
       
   303 	    ) const;
       
   304 
       
   305 	    /**
       
   306 	     * This method is used to retrieve parameter which indicates whether server
       
   307 	     * details are editable or not. 
       
   308 	     *
       
   309 	     * @since S60 9.1TB 
       
   310 	     *
       
   311 	     * @param [IN] aSlpId SLP ID for which the parameter needs to be retrieved 
       
   312 	     * @param [OUT] aEditFlag Flag to indicate whether server details are editable or not 
       
   313 	     */ 
       
   314 	    void GetEditableFlagL( 
       
   315 	            const TInt64 aSlpId, 
       
   316 	            TBool& aEditFlag 
       
   317 	    ) const;
       
   318 
       
   319 	    /**
       
   320 	     * Obtains the number of server entries present in SUPL settings. 
       
   321 	     *
       
   322 	     * @since S60 9.1TB 
       
   323 	     *
       
   324 	     * @param [OUT] aCount Number of SLP entries 
       
   325 	     *
       
   326 	     */
       
   327 	    void SlpCountL(
       
   328 	            TInt& aCount 
       
   329 	    );
       
   330 	    
       
   331 	     /**
       
   332 	     * Obtains the count of active SUPL sessions 
       
   333 	     *
       
   334 	     * @since S60 9.1TB 
       
   335 	     *
       
   336 	     * @param [OUT] aActiveSessionsCount Count of active SUPL sessions 
       
   337 	     *
       
   338 	     */
       
   339 	    void GetActiveSessionsCountL( TInt& aActiveSessionsCount );
       
   340 	    
       
   341 	     /**
       
   342 	     * This method is used to retrieve properties of all triggers from SUPL settings storage.  
       
   343 	     * This method retrieves all properties for each trigger.
       
   344 	     *
       
   345 	     * @since S60 9.1TB 
       
   346 	     *
       
   347 	     * @param [OUT] aParamValues Array of retrieved trigger entries 
       
   348 	     * @ref CTriggerParams class
       
   349 	     *
       
   350 	     */
       
   351 	    void GetTriggerParamsL( RPointerArray<CTriggerParams>& aParamValues ) const;
       
   352 	    
       
   353 	     /**
       
   354 	     * This method is used to retrieve properties of all triggers from SUPL settings storage.  
       
   355 	     * This method retrieves all properties for required trigger.
       
   356 	     *
       
   357 	     * @since S60 9.2TB 
       
   358 	     *
       
   359 	     * @param [IN] aSessionId Sessiond Id 
       
   360 	     * @param [OUT] aTrigger Array of retrieved trigger entries 
       
   361 	     * @ref CTriggerParams class
       
   362 	     *
       
   363 	     */
       
   364 	    void GetTriggerParamsL( TInt64 aSessionId, CTriggerParams*& aTrigger ) const;
       
   365 	    
       
   366 	     /**
       
   367 	     * Changes the notification status for a trigger session based on session id
       
   368 	     *
       
   369 	     * @since S60 9.1TB 
       
   370 	     *
       
   371 	     * @param [IN] aSessionId Id of session for which the notification status has to be changed
       
   372 	     *
       
   373 	     */
       
   374 	    void ChangeNotificationStatusL( TInt64 aSessionId, TBool aTriggerNotificationStatus ) const;
       
   375 	    
       
   376 	     /**
       
   377 	     * Deletes a trigger session based on session id
       
   378 	     *
       
   379 	     * @since S60 9.1TB 
       
   380 	     *
       
   381 	     * @param [IN] aSessionId Id of session that needs to be deleted 
       
   382 	     *
       
   383 	     */
       
   384 	    void RemoveTriggerSessionL( TInt64 aSessionId ) const;
       
   385 	   
       
   386 	   /**
       
   387 	     * Set the Observer for the specific Session
       
   388 	     * 
       
   389 	     */  
       
   390 	    void SetSessionObserver( MLocSUPLSettingsSessionObserver* aObserver );
       
   391 	   
       
   392 	   /**
       
   393 	     * Remove the Session observer
       
   394 	     * 
       
   395 	     */  
       
   396 	    void RemoveSessionObserver( );
       
   397 	    
       
   398 	    /**
       
   399          * Generates IMSI address
       
   400          */
       
   401         void GenerateHslpAddressFromImsi(TDes& aIMSIAddress );
       
   402 
       
   403 
       
   404               	
       
   405 	public:
       
   406 	
       
   407 	    /** 
       
   408 	     * Inherited from MSuplSettingsObserver
       
   409 	     */	
       
   410         void HandleSuplSettingsChangeL(
       
   411                 TSuplSettingsEventType aEvent,
       
   412                 TInt aSlpId                        
       
   413         );
       
   414         
       
   415         
       
   416 	    /** 
       
   417 	     * Inherited from MSuplSessionObserver
       
   418 	     */	
       
   419 		void HandleSuplSessionChangeL( 
       
   420                 TSuplSessionEventType aEvent,
       
   421                 TInt64 aSessionId                         
       
   422         		);		
       
   423 	protected:
       
   424 	    /** 
       
   425 	     * Inherited from CActive
       
   426 	     */
       
   427 		void RunL();
       
   428 		
       
   429 		/**
       
   430 		 * Inherited from CActive
       
   431 		 */
       
   432 		void DoCancel();
       
   433 		
       
   434     private:
       
   435         /**
       
   436          * Observer for the SUPL Settings UI Adapter
       
   437          * Reference
       
   438          */
       
   439         MLocSUPLSettingsAdapterObserver&    iObserver;
       
   440         
       
   441         /**
       
   442          * SUPL Settings UI
       
   443          * Owns
       
   444          */
       
   445         CSuplSettings*                      iSUPLSettings;
       
   446         
       
   447         
       
   448         /**
       
   449          * Observer for the specific SUPL session.
       
   450          * Does not own.
       
   451          */
       
   452 		MLocSUPLSettingsSessionObserver* iSessionObserver;
       
   453         
       
   454     };
       
   455 
       
   456 #endif      // CLOCSUPLSETTINGSADAPTER_H_
       
   457 
       
   458 // End of File