supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplfallbackhandler.h
changeset 0 667063e416a2
child 12 5944cae565c9
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:   Class for handling fallback in case of multiple SLP
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_COMASUPLFALLBACKHANDLER_H
       
    21 #define C_COMASUPLFALLBACKHANDLER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "epos_csuplconnection.h"
       
    26 #include "epos_csuplsettingsinternal.h"
       
    27 #include "epos_omasuplconstants.h"
       
    28 #include "epos_comasuplconnrequestor.h"
       
    29 
       
    30 class CSuplSettingsInternal;
       
    31 class COMASuplTrace;
       
    32 
       
    33 /**
       
    34  *  Class for Handling Fallback...
       
    35  *
       
    36  *  @lib eposomasuplprotocolhandler.lib
       
    37  *  @since S60 v3.1
       
    38  */
       
    39  
       
    40 struct TSLPDetails
       
    41 {
       
    42 	TUint64 iSLPId;
       
    43 	TBuf<KHSLPAddressLength> iHSLPAddress;
       
    44 	TBuf<KHSLPAddressLength>  iIapName;
       
    45 	TBool iIsIAPDialgShown;
       
    46 	TBool iTls;
       
    47 	TBool iPskTls;
       
    48 	TBool iHomeNetworkUsage;   //True means usage is allowed in home network
       
    49 };
       
    50 
       
    51 
       
    52 
       
    53  
       
    54 class COMASuplFallBackHandler : public CBase
       
    55 {
       
    56 
       
    57 
       
    58 	public :  // Constructor 
       
    59 	
       
    60 		/**
       
    61 		* NewL Method.
       
    62 		* @since Series 60 3.1
       
    63 		* @param MEventCompletionObserver
       
    64 		* @return Instance of COMASuplFallBackHandler
       
    65 		*/ 
       
    66 		static COMASuplFallBackHandler* NewL(CSuplSettingsInternal& aSettings);
       
    67 		
       
    68 		/**
       
    69 		* Destructor.
       
    70 		*/
       
    71 		~COMASuplFallBackHandler();
       
    72 		
       
    73 	public :		
       
    74 	
       
    75 		/**
       
    76 		* CreateConnection Method. Creates the Socket required to
       
    77 		* communicate with the SLP
       
    78 		* @since Series 60 3.1
       
    79 		* @param None
       
    80 		* @return None
       
    81 		*/ 
       
    82 		TInt GetNextSLPAddressL(TInt64& aSLPId,TDes& aHslpToBeUsedAddress,TDes& aIAPName,TBool& aTls,
       
    83 		                        TBool& aPskTls,TInt aLastErrorCode,TBool& aIsIapDialogShown);
       
    84 		
       
    85 		void SetFallBackParametersL(const TDesC& aClientProvidedHSLPAddress,TBool aFallBackAllowed);
       
    86 		
       
    87 		void ReadSLPListForNIL(const TDesC& aClientProvidedHSLPAddress);
       
    88 		
       
    89 		void UpdateSLPListForHomeUsage(TBool aHomeNetwork);
       
    90 		
       
    91 		
       
    92 	private : 
       
    93 	
       
    94 		//Constuctor
       
    95 		COMASuplFallBackHandler(CSuplSettingsInternal& aSettings);
       
    96 		
       
    97 		/**
       
    98 		* By default Symbian 2nd phase constructor is private.
       
    99 		*/
       
   100 		void ConstructL();
       
   101 		
       
   102     private:
       
   103     
       
   104     void ReadSLPListL(const TDesC& aClientProvidedHSLPAddress);	
       
   105     TBool CheckErrorCodeL(TInt aLastErrorCode);	
       
   106     void GenerateHslpAddressFromIMSIL();
       
   107     void PrintSLPList();
       
   108     void GetFirstEnabledSLPL();
       
   109 		
       
   110   	protected :  // Functions from CActive
       
   111       /**
       
   112       * From CActive 
       
   113       * To handle request completion
       
   114       */
       
   115       void RunL();
       
   116       
       
   117       /**
       
   118       * From CActive 
       
   119       * To cancel the asynchronous requests
       
   120       */
       
   121    		void DoCancel();  
       
   122       /**
       
   123       * From CActive 
       
   124       * To handle errors in asynchronous requests
       
   125       */
       
   126    		TInt RunError(TInt aError);
       
   127      
       
   128 	private : //Data
       
   129 
       
   130 
       
   131   	    //SUPLSettings
       
   132   	    CSuplSettingsInternal& iSuplSettings;
       
   133 
       
   134   	    //Trace Utility
       
   135   	    COMASuplTrace* iTrace;
       
   136 
       
   137   	    TInt iCurrentServerCounter;
       
   138 
       
   139   	    TBool iIsFallBackAllowed;
       
   140 
       
   141   	    CArrayFixFlat<TSLPDetails>* iSLPList;
       
   142 
       
   143   	    TBool iTLSAuthenticationFailed;
       
   144 
       
   145   	    RBuf iGenratedHslpAddress;
       
   146         
       
   147   	    RBuf iDefaultIAPName;
       
   148 		
       
   149   	    TInt iErrorCode;
       
   150 
       
   151   	    TTime iFallBackStartTime;
       
   152 
       
   153   	    TInt iAllowedFallBackTimerValue;
       
   154       
       
   155 };
       
   156 
       
   157 #endif //C_COMASUPLFALLBACKHANDLER_H