supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplinitstate.h
changeset 0 667063e416a2
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 SUPL_INIT message...
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_COMASUPLINITSTATE_H
       
    21 #define C_COMASUPLINITSTATE_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include <lbs/epos_cposnetworkprivacy.h>
       
    26 #include <lbs/epos_cpossuplprivacyrequestinfo.h>
       
    27 #include <lbs/epos_mposverificationobserver.h>
       
    28 
       
    29 #include "epos_momasupltimeoutnotifier.h"
       
    30 #include "epos_comasuplstate.h"
       
    31 
       
    32 // Forward Declarartion
       
    33 class COMASuplNotification;
       
    34 class COMASuplTimeoutTimer;
       
    35 class MOMASuplPrivacyObserver;
       
    36 /**
       
    37  *  COMASuplInitState handles all SUPL_INIT related processing.  
       
    38  *  @lib eposomasuplprotocolhandler.lib
       
    39  *  @since S60 v3.1u
       
    40  */
       
    41 
       
    42 class COMASuplInitState : public COMASuplState,
       
    43 						  public MPosVerificationObserver
       
    44 {
       
    45 
       
    46 	public :  // Constructor 
       
    47 
       
    48 		/**
       
    49 		* NewL Method.
       
    50 		* @since S60  v3.1u
       
    51 		* @param aMsgTimeout,timeout value for SUPL_INIT
       
    52 		* @return Instance of COMASuplInitState
       
    53 		*/ 
       
    54 		static COMASuplInitState* NewL(TInt aMsgTimeout,const TDesC8& aHSLPAddress,
       
    55 										MOMASuplPrivacyObserver &aPrivacyObserver,TInt aSupportedMode, CPosNetworkPrivacy*	iNetworkPrivacy);
       
    56 
       
    57 		/**
       
    58 		* Destructor.
       
    59 		*/
       
    60 		~COMASuplInitState();
       
    61 
       
    62 	public:		//MPosVerificationObserver
       
    63 
       
    64 		/**
       
    65 		* Called when a call to CPosNetworkPrivacy::VerifyLocationRequestL()
       
    66 		* completes, in which this observer object was passed as a parameter.
       
    67 		*
       
    68 		* @param aRequestId The request id which was returned by
       
    69 		* 					CPosNetworkPrivacy::VerifyLocationRequestL().
       
    70 		* @param aCompletionCode @p KErrNone if the location request is
       
    71 		* 		 accepted, @p KErrAccessDenied if the location request is rejected
       
    72 		* 		 or any of the system wide error codes.
       
    73 		*/
       
    74 		void HandleVerifyComplete(TInt /*aRequestId*/, TInt aCompletionCode);
       
    75 
       
    76 	public:		//COMASuplState
       
    77 		/**
       
    78 		* Timeout Notifier Method.
       
    79 		* @since S60  v3.1u
       
    80 		* @param None
       
    81 		* @return None
       
    82 		*/
       
    83 		void TimerExpiredL();
       
    84 
       
    85 		/**
       
    86 		* ProcessMessage Method,Process SUPL_INIT message...
       
    87 		* @since S60  v3.1u
       
    88 		* @param None
       
    89 		* @return system wide error
       
    90 		*/ 
       
    91 		virtual TInt ProcessMessageL(COMASuplAsnMessageBase* aDecodedMessage); 
       
    92 		/**
       
    93 		* GetPosMethod Method,returns the positioning method...
       
    94 		* @
       
    95 		* @param None
       
    96 		* @return TOMASuplPosMethod
       
    97 		*/
       
    98 		TOMASuplPosMethod GetPosMethod();
       
    99 
       
   100 	    void GetRequestorID(TInt& aRequestorId);
       
   101 	private:
       
   102 		/**
       
   103 		* HandlePrivacy - Handles the privacy information
       
   104 		* @since S60  v3.1u
       
   105 		* @param None
       
   106 		* @return error code
       
   107 		*/
       
   108 		TInt HandlePrivacyL();
       
   109 		/**
       
   110 		* MakeGSMNotificationL - Handles the privacy notification
       
   111 		* @since S60  v3.1u
       
   112 		* @param None
       
   113 		* @return error code
       
   114 		*/ 
       
   115 		TInt MakeGSMNotificationL();
       
   116 
       
   117 		/**
       
   118 		* MakeGSMVerificationL - Handles the privacy verification
       
   119 		* @since S60  v3.1u
       
   120 		* @param None
       
   121 		* @return error code
       
   122 		*/ 
       
   123 		TInt MakeGSMVerificationL(CPosNetworkPrivacy::TRequestDecision aTimeOutStrategy);
       
   124 
       
   125 		/**
       
   126 		* Requestor - Retrievs requestor Information
       
   127 		* @since S60  v3.1u
       
   128 		* @param requestor
       
   129 		* @return error code
       
   130 		*/ 					 
       
   131 		TInt RequestorL(HBufC*& aRequestor);
       
   132 
       
   133 		/**
       
   134 		* Client - Retrievs client Information
       
   135 		* @since S60  v3.1u
       
   136 		* @param clientname
       
   137 		* @return error code
       
   138 		*/ 	
       
   139 		TInt ClientL(HBufC*& aClient);	
       
   140 
       
   141 	private:
       
   142 
       
   143 		/**
       
   144 		* CheckForVersion - Checks for SUPL version
       
   145 		* @since S60  v3.1u
       
   146 		* @param None
       
   147 		* @return error code
       
   148 		*/ 	
       
   149 		TInt CheckForVersion();
       
   150 		
       
   151 		/**
       
   152 		* CheckForModeSupport - Checks Modes
       
   153 		* @since S60  v3.1u
       
   154 		* @param None
       
   155 		* @return error code
       
   156 		*/ 	
       
   157 		TInt CheckForModeSupport();
       
   158 		
       
   159 		/**
       
   160 		* CheckForModeSupport - Checks for the existance of SET Session ID
       
   161 		* @since S60  v3.1u
       
   162 		* @param None
       
   163 		* @return error code
       
   164 		*/ 	
       
   165 		
       
   166 		TInt CheckForSetSessionID();
       
   167 		
       
   168 		/**
       
   169 		* CheckForSLPSessionID - Checks for the existance of SET Session ID
       
   170 		* @since S60  v3.1u
       
   171 		* @param None
       
   172 		* @return error code
       
   173 		*/ 	
       
   174 		TInt CheckForSLPSessionID();
       
   175 
       
   176 		/**
       
   177 		* ConverttoUniCode - Converts to Unicode
       
   178 		* @since S60  v3.1u
       
   179 		* @param clientname - Unicode String
       
   180 		* @param aRequestor -  UTF8,UCS2, UTF& String
       
   181 		* @return error code
       
   182 		*/ 	
       
   183 		TInt ConverttoUniCodeL(HBufC*& aUniCode,HBufC8& aRequstor);							  
       
   184 		
       
   185 		/**
       
   186 		* CheckForPositioningMethod - Checks whether positionmethod is NoPosition
       
   187 		* @since S60  v3.1u
       
   188 		* @param None
       
   189 		* @return None
       
   190 		*/
       
   191 		void CheckForPositioningMethod();
       
   192 		
       
   193 		/**
       
   194 		* GsmDefaultDecode - Unpacks the data of  7-bit format to 8-bit
       
   195 		* @since S60  v3.1u
       
   196 		* @param aIn, input  string, represented in 7-bit
       
   197 		* @param aOut,output string, represented in 8-bit
       
   198 		* @return None
       
   199 		*/
       
   200 		void GsmDefaultDecode( const TDesC8& aIn, TDes8& aOut );
       
   201 		
       
   202 		/**
       
   203 		* FormUCS2String - Forms the UCS2 string from the string which contains the characters 
       
   204 		* @since S60  v3.1
       
   205 		* @param aIn, input  string, represented in 8-bit
       
   206 		* @param aOut,output string, represented in UCS2
       
   207 		* @return None
       
   208 		*/
       
   209 		void FormUCS2String( const TDesC8& aIn, TDes& aOut );
       
   210 		
       
   211 	private : 
       
   212 
       
   213 		/**
       
   214 		* Constuctor Method.
       
   215 		* @since S60  v3.1u
       
   216 		* @param aMsgTimeout,Timeout for message
       
   217 		* @return None
       
   218 		*/ 
       
   219 		COMASuplInitState(TInt aMsgTimeout,const TDesC8& aHSLPAddress,
       
   220 						MOMASuplPrivacyObserver &aPrivacyObserver,TInt aSupportedMode, CPosNetworkPrivacy*	iNetworkPrivacy);
       
   221 
       
   222 		/**
       
   223 		* ConstructL Method, 2nd phase construction
       
   224 		* @since S60  v3.1u
       
   225 		* @param None
       
   226 		* @return None
       
   227 		*/
       
   228 		void ConstructL();
       
   229 		
       
   230 		void ReadRequestIDFeatureFlagL();
       
   231 
       
   232 	private: //Data
       
   233 
       
   234 		COMASuplInit* iSuplInit;
       
   235 
       
   236 		CPosNetworkPrivacy*	iNetworkPrivacy;
       
   237 
       
   238 		// RequestId
       
   239 		TInt	iGSMRequestId;
       
   240 
       
   241 		//Type of requestinfo
       
   242 		CPosSUPLPrivacyRequestInfo::TIdType iIdType;
       
   243 
       
   244 		//Notification
       
   245 		COMASuplNotification* iNotification;
       
   246 		
       
   247 		//Completion Code
       
   248 		TInt iCompletionCode;
       
   249 		
       
   250 		const TDesC8& iHSLPAddress;
       
   251 		
       
   252 		// Privacy Observer 
       
   253 		MOMASuplPrivacyObserver &iPrivacyObserver;
       
   254 		
       
   255 		TBool iNoPosition;
       
   256 		//Supported Mode of SET
       
   257 		TInt iSupportedMode;
       
   258 		
       
   259 		TOMASuplPosMethod iPosMethod;
       
   260         TBool iIsNotificationOnly;//APE Centric
       
   261         TBool iRequestIDFeatureFlag;//APE Centric
       
   262 };
       
   263 
       
   264 #endif //C_COMASUPLINITSTATE_H