locationsystemui/locationsysui/locsuplsettingsui/inc/locsuplsettingsuiengine.h
branchRCL_3
changeset 45 6b6920c56e2f
child 49 10852b179f64
equal deleted inserted replaced
44:2b4ea9893b66 45:6b6920c56e2f
       
     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:  SUPL Settings UI Engine. The engine is resposible for handling
       
    15 *                all the UI components required for SUPL Settings UI. In addition
       
    16 *                to this it also is responsible for interacting with the SUPL
       
    17 *                Settings API
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef C_LOCSUPLSETTINGSUIENGINE_H_
       
    23 #define C_LOCSUPLSETTINGSUIENGINE_H_
       
    24 
       
    25 // System Includes
       
    26 #include <e32base.h>
       
    27 #include <agentdialog.h>    // for RGenConAgentDialogServer
       
    28 
       
    29 // User Includes
       
    30 #include "locsuplsettingsadapterobserver.h"
       
    31 
       
    32 // Forward Declaration
       
    33 class CLocSUPLSettingsAdapter;
       
    34 class MLocSUPLSettingsUiEngObserver;
       
    35 class CTextResolver;
       
    36 class CAknGlobalConfirmationQuery;
       
    37 class CServerParams;
       
    38 class CTriggerParams;
       
    39 class CLocSUPLServerEditor;
       
    40 class MSuplServerEditorObserver;
       
    41 class MLocSUPLSettingsSessionObserver;
       
    42 
       
    43 // Class Declaration
       
    44 /**
       
    45  * Engine for SUPL Settings UI
       
    46  *
       
    47  * Engine class for SUPL Settings UI. It is responsible for interacting with the 
       
    48  * SUPL Settings API. Further, it handles all commands for SUPL settings UI. The
       
    49  * Engine launches all the dialogs associated with configuring the SUPL Settings.
       
    50  * It further observers the SUPL Settings UI for any changes to the Settings
       
    51  * values.
       
    52  */
       
    53 class CLocSUPLSettingsUiEngine : public CActive, 
       
    54                                  public MLocSUPLSettingsAdapterObserver
       
    55     {
       
    56     public:
       
    57         /**
       
    58          * Two-phased constructor
       
    59          *
       
    60          * @param  aObserver                 Referenece to the Engine observer
       
    61          * @return CLocSUPLSettingsUiEngine* Reference to the object created
       
    62          */
       
    63         static CLocSUPLSettingsUiEngine* NewL( 
       
    64                             MLocSUPLSettingsUiEngObserver&      aObserver );
       
    65                             
       
    66         /**
       
    67          * Two-phased constructor. Leaves the object on the Cleanup stack
       
    68          *
       
    69          * @param  aObserver                 Reference to the Engine observer
       
    70          * @return CLocSUPLSettingsUiEngine* Reference to the object created
       
    71          */
       
    72         static CLocSUPLSettingsUiEngine* NewLC( 
       
    73                             MLocSUPLSettingsUiEngObserver&      aObserver );
       
    74          
       
    75         /**
       
    76          * Initializes the Settings Engine. This is an asynchronous call the 
       
    77          * completion of which is communicated through the observer
       
    78          * 
       
    79          */
       
    80         void Initalize();
       
    81                          
       
    82         /**
       
    83          * Destructor.
       
    84          */
       
    85         virtual ~CLocSUPLSettingsUiEngine();
       
    86        
       
    87         /** 
       
    88          * Launches the confirmation query to select IAP
       
    89 		 *
       
    90 		 */
       
    91 		void SelectConnectionL();
       
    92         
       
    93 		/**
       
    94 		 * Launches the Access Point Configurator dialog
       
    95 		 *
       
    96 		 */
       
    97 		void LaunchApConfiguratorL( TInt64 aSlpId, 
       
    98 				MSuplServerEditorObserver* aEditorObserver );
       
    99 		
       
   100         /** 
       
   101          * Opens the exisitng server with its attributes
       
   102 		 *
       
   103 		 */
       
   104 		void EditServerL( TBool iIsEditable, TInt64 aSlpId );
       
   105 
       
   106         /** 
       
   107          * returns exisitng server entries count
       
   108 		 *
       
   109 		 */
       
   110 		TInt SlpCount();
       
   111 
       
   112 		/**
       
   113 		 * Launches the SUPL Usage configurator
       
   114 		 */
       
   115 		void LaunchSuplUsageConfiguratorL();
       
   116 		
       
   117         /**
       
   118 		 * Closes the running Settings UI prematurely.
       
   119 		 */
       
   120 		void Close();
       
   121 		
       
   122         /**
       
   123          * Obtains the SUPL Settings usage.
       
   124          *
       
   125          * @return TPtr16     SUPL settings usage.
       
   126          */  
       
   127         TPtr16 GetSuplUsageL();
       
   128         
       
   129         /**
       
   130          * Obtains the SUPL usage
       
   131          *
       
   132          * @return The SUPL Usage value
       
   133          */
       
   134         TInt   GetSuplUsage();			
       
   135 		 
       
   136         /**
       
   137 		 * Creates a new server entry in Supl Settings.
       
   138 		 */
       
   139 		void AddNewServerL( 
       
   140 		        const TDesC& aServerAddress,
       
   141 		        const TDesC& aIapName,
       
   142 		        const TBool aUsageInHomeNw
       
   143 		);
       
   144 
       
   145 	    /**
       
   146 	     * Deletes server entry from SUPL settings storage.  
       
   147 	     */
       
   148 	    void RemoveServerL(
       
   149 	    		const TInt64 aSlpId
       
   150 	    );
       
   151 
       
   152 	    /**
       
   153 	     * Sets the priority of the server to the specified priority.  
       
   154 	     */
       
   155 		void ChangePriorityL(
       
   156 		        TInt64 aSlpId, 
       
   157 		        TInt aPriority,
       
   158 		        TBool aDirection
       
   159 		);
       
   160 
       
   161 	    /**
       
   162 	     * Gets properties of all servers from SUPL settings storage.  
       
   163 	     * This method retrieves all properties for each server.
       
   164 	     */
       
   165 		void GetAllSlpL(
       
   166 		        RPointerArray<CServerParams>& aParamValues
       
   167 		) const;
       
   168 	
       
   169 	    /**
       
   170 	     * Gets all properties of server from SUPL settings storage
       
   171 	     * based on SLP identification.  
       
   172 	     */
       
   173 		void GetSlpInfoFromIdL(
       
   174 	            const TInt64 aSlpId, 
       
   175 	            CServerParams *aParamValues
       
   176 		) const;
       
   177 
       
   178 	    /**
       
   179 	     * Sets the server address parameter in server settings 
       
   180 	     */
       
   181 	    void SetServerAddressL( 
       
   182 	            const TInt64 aSlpId, 
       
   183 	            const TDesC& aServerAddress
       
   184 	    );
       
   185 	    
       
   186 	    /**
       
   187 	     * Obtains the server address parameter from server settings.  Client
       
   188 	     * has to allocate memory for server address parameter.
       
   189 	     */
       
   190 	    void GetServerAddressL( 
       
   191 	            TInt64 aSlpId, 
       
   192 	            TDes& aServerAddress
       
   193 	    ) const;
       
   194 
       
   195 	    /**
       
   196 	     * Sets the IAP Name in server parameters. IAP name refers to 
       
   197 	     * the access point which is used to access the HSLP over the internet. 
       
   198 	     */
       
   199 	    void SetIapNameL( 
       
   200 	            const TInt64 aSlpId, 
       
   201 	            const TDesC& aIapName
       
   202 	    );
       
   203 
       
   204 	    /**
       
   205 	     * Sets the parameter which indicates whether server
       
   206 	     * can be used for SUPL session or not. 
       
   207 	     */
       
   208 	    void SetServerEnabledFlagL(
       
   209 	            const TInt64 aSlpId, 
       
   210 	            const TBool aEnable 
       
   211 	    ) const;
       
   212 
       
   213 	    /**
       
   214 	     * Obtains the parameter which indicates whether server
       
   215 	     * can be used for SUPL session or not. 
       
   216 	     */
       
   217 	    void GetServerEnabledFlagL(
       
   218 	            const TInt64 aSlpId, 
       
   219 	            TBool& aEnable 
       
   220 	    ) const;
       
   221 
       
   222 	    /**
       
   223 	     * Sets the parameter which indicates whether server
       
   224 	     * can be used out side home network or not. 
       
   225 	     */
       
   226 	    void SetUsageInHomwNwFlagL(
       
   227 	            const TInt64 aSlpId, 
       
   228 	            const TBool aHomeNwFlag 
       
   229 	    );
       
   230 
       
   231 		
       
   232 	    /**
       
   233 	     * Sets the parameter which indicates whether server
       
   234 	     * details are editable or not. 
       
   235 	     */ 
       
   236 		void SetEditableFlagL( 
       
   237 	            const TInt64 aSlpId, 
       
   238 	            const TBool aEditFlag 
       
   239 	    ) const;
       
   240 
       
   241 	    /**
       
   242 	     * Gets the parameter which indicates whether server
       
   243 	     * details are editable or not. 
       
   244 	     */ 
       
   245 	    void GetEditableFlagL( 
       
   246 	            const TInt64 aSlpId, 
       
   247 	            TBool& aEditFlag 
       
   248 	    ) const;
       
   249 	    
       
   250 	    /**
       
   251 	     * Obtains the count of active Supl sessions
       
   252 	     * 
       
   253 	     */  
       
   254 	    void GetActiveSessionsCountL( TInt& aAccessPointCount );
       
   255 	    
       
   256 	    /**
       
   257 	     * Gets properties of all triggers from SUPL settings storage.  
       
   258 	     * This method retrieves all properties for each trigger.
       
   259 	     */
       
   260 		void GetTriggerParamsL(
       
   261 		        RPointerArray<CTriggerParams>& aParamValues
       
   262 		) const;
       
   263 	    
       
   264 	    /**
       
   265 	     * Gets properties of all triggers from SUPL settings storage.  
       
   266 	     * This method retrieves all properties for each trigger based on session id.
       
   267 	     */
       
   268 		void GetTriggerParamsL(  TInt64 aSessionId, 
       
   269 		        CTriggerParams*& aTrigger
       
   270 		) const;
       
   271 	   
       
   272 	   /**
       
   273 	     * Open the Active Session for the specified session id.
       
   274 	     * 
       
   275 	     */  
       
   276 	    void OpenSessionL( TInt64 aSessionId );
       
   277 		
       
   278 	   /**
       
   279 	     * Deletes a trigger session based on session id
       
   280 	     * 
       
   281 	     */  
       
   282 	    void RemoveTriggerSessionL( TInt64 aSessionId ) const;
       
   283 	   
       
   284 	   /**
       
   285 	     * Deletes a trigger sessions based on session ids
       
   286 	     * 
       
   287 	     */  
       
   288 	    void RemoveTriggerSessionsL( RArray< TInt64 >& aSessionIdList ) const;
       
   289 	   
       
   290 	   /**
       
   291 	     * Deletes all the trigger sessions
       
   292 	     * 
       
   293 	     */  
       
   294 	    void RemoveAllTriggerSessionsL( ) const;
       
   295 	   
       
   296 	   /**
       
   297 	     * Changes the notification status of an active session based on session id
       
   298 	     * 
       
   299 	     */  
       
   300 	    void ChangeNotificationStatusL( TInt64 aSessionId, TBool aTriggerNotificationStatus ) const;
       
   301 	   
       
   302 	   /**
       
   303 	     * Set the Observer for the specific Session
       
   304 	     * 
       
   305 	     */  
       
   306 	    void SetSessionObserver( MLocSUPLSettingsSessionObserver* aObserver ) const;
       
   307 	   
       
   308 	   /**
       
   309 	     * Remove the Session observer
       
   310 	     * 
       
   311 	     */  
       
   312 	    void RemoveSessionObserver( ) const;
       
   313 	    
       
   314         /**
       
   315          * Sets value of highlighted AP
       
   316          */
       
   317         void SetTempAPValue( TUint32 aAccessPoint);
       
   318         
       
   319 	public:     		
       
   320 		/**
       
   321 		 * Inherited from MLocSUPLSettingsAdapterObserver
       
   322 		 */
       
   323 		void HandleSuplSettingsChangeL( TLocSUPLSettingsEvent aEvent );
       
   324 				 
       
   325     protected:
       
   326         /**
       
   327          * Inherited from CActive
       
   328          */
       
   329         void RunL();
       
   330         
       
   331         /**
       
   332          * Inherited from CActive
       
   333          */
       
   334         void DoCancel();
       
   335              
       
   336     private:
       
   337         /**
       
   338          * C++ constructor.
       
   339          */
       
   340         CLocSUPLSettingsUiEngine( MLocSUPLSettingsUiEngObserver&  aObserver );
       
   341         
       
   342         /**
       
   343          * Second Phase constructor
       
   344          */
       
   345         void ConstructL();
       
   346          
       
   347         /**
       
   348          * Obtains the index UID corresponding to the Access point name
       
   349          *
       
   350          * @param   aIAPName     Access point name
       
   351          * @return  TUint       UID corresponding to the AP Name. Zero if 
       
   352          *                      the name does not exist
       
   353          */
       
   354         TUint ConvertIAPNameToIdL( const TDesC&      aIAPName );
       
   355        
       
   356         /**
       
   357          * Displays an Error note
       
   358          *
       
   359          * @param aError Error ID
       
   360          */
       
   361         void DisplayErrorL( TInt aError );
       
   362         
       
   363         /**
       
   364          * Displays an Info note
       
   365          *
       
   366          * @param None
       
   367          */
       
   368         TInt ShowNoteL();                               
       
   369         
       
   370         /**
       
   371          * Returns value of last highlighted AP
       
   372          */
       
   373         TUint32 GetTempAPValue();
       
   374         
       
   375     private:
       
   376         /**
       
   377          * Reference to the Engine Observer
       
   378          */
       
   379         MLocSUPLSettingsUiEngObserver&	iObserver;
       
   380         
       
   381         /**
       
   382          * SUPL Settings API Adapter
       
   383          * Owns
       
   384          */
       
   385         CLocSUPLSettingsAdapter*       	iSUPLSettingsAdapter;
       
   386         
       
   387         /**
       
   388          * Flag to denote whether any dialog is currently active
       
   389          * Used in the Cancel method. If there are any requests 
       
   390          * outstanding then they have to be cancelled
       
   391          */
       
   392         TBool                   		iDialogActive;
       
   393                         
       
   394         /**
       
   395          * Temporary Buffer for returning values to the Accessor 
       
   396          * functions. The accessor expects a 16 bit variant of the descriptor
       
   397          * Owns
       
   398          */
       
   399         HBufC16*                		iConversionBuffer;
       
   400         
       
   401         /**
       
   402          * Pointer to the Conversion Buffer
       
   403          */
       
   404         TPtr16                  		iConversionBufferPtr;
       
   405         
       
   406         /**
       
   407          * Temporary Buffer to hand over to the UI components and
       
   408          * access data from the Settinga API
       
   409          * Owns
       
   410          */
       
   411         HBufC*                  		iSettingsBuffer;
       
   412         
       
   413         /**
       
   414          * Pointer to the Settings Buffer
       
   415          */
       
   416         TPtr                    		iSettingsBufferPtr;
       
   417         
       
   418         /**
       
   419          * Standard Text resolver for converting Error codes to 
       
   420          * standard texts
       
   421          */
       
   422         CTextResolver*          		iTextResolver;
       
   423 
       
   424         
       
   425         /**
       
   426          * Selected IAP ID
       
   427          */
       
   428         TUint32                     	iSelectedIap;
       
   429         
       
   430         /**
       
   431          * Launch Paramters
       
   432          */
       
   433         TInt                        	iLaunchParams;
       
   434         
       
   435         /**
       
   436          * Akn Global confirmation query
       
   437          * Owns
       
   438          */
       
   439         CAknGlobalConfirmationQuery*    iConfirmQuery;
       
   440 
       
   441         /**
       
   442          * Flag to denote whether access point selection requested or not
       
   443          */
       
   444         TBool                   		iRequestIapSelect;
       
   445 
       
   446         /**
       
   447          * SUPL Servers SLP ID to get and set the server attributes.
       
   448          * Owns.
       
   449          */
       
   450         TInt64							iCurrentSlpId;
       
   451                         
       
   452         /**
       
   453          * Supl Server Editor 
       
   454          * Owns
       
   455          */
       
   456         CLocSUPLServerEditor*			iEditorDlg;
       
   457 
       
   458         /**
       
   459          * Editor Observer
       
   460          * Owns
       
   461          */
       
   462         MSuplServerEditorObserver*		iEditorObserver;
       
   463         
       
   464         /*
       
   465          * Current highlighted AP
       
   466          * Set to -1 if no changes made in edit dialog box, Set to Uid of access 
       
   467          * point if changes made 
       
   468          */
       
   469         TUint32 iTempAP;
       
   470         
       
   471     };
       
   472     
       
   473 #endif // C_LOCSUPLSETTINGSUIENGINE_H_
       
   474