supl/locationomasuplprotocolhandler/protocolhandlerver2/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_comasuplinitver2.h"
       
    30 #include "epos_momasupltimeoutnotifier.h"
       
    31 #include "epos_comasuplstate.h"
       
    32 
       
    33 // Forward Declarartion
       
    34 class COMASuplNotification;
       
    35 class COMASuplTimeoutTimer;
       
    36 class MOMASuplPrivacyObserver;
       
    37 /**
       
    38  *  COMASuplInitState handles all SUPL_INIT related processing.  
       
    39  *  @lib eposomasuplprotocolhandler.lib
       
    40  *  @since S60 v3.1u
       
    41  */
       
    42 
       
    43 class COMASuplInitState : public COMASuplState,
       
    44 						  public MPosVerificationObserver
       
    45 {
       
    46 
       
    47 	public :  // Constructor 
       
    48 
       
    49 		/**
       
    50 		* NewL Method.
       
    51 		* @since S60  v3.1u
       
    52 		* @param aMsgTimeout,timeout value for SUPL_INIT
       
    53 		* @return Instance of COMASuplInitState
       
    54 		*/ 
       
    55 		static COMASuplInitState* NewL(TInt aMsgTimeout,const TDesC8& aHSLPAddress,
       
    56 										MOMASuplPrivacyObserver &aPrivacyObserver,TInt aSupportedMode, CPosNetworkPrivacy*	iNetworkPrivacy);
       
    57 
       
    58 		/**
       
    59 		* Destructor.
       
    60 		*/
       
    61 		~COMASuplInitState();
       
    62 
       
    63 	public:		//MPosVerificationObserver
       
    64 
       
    65 		/**
       
    66 		* Called when a call to CPosNetworkPrivacy::VerifyLocationRequestL()
       
    67 		* completes, in which this observer object was passed as a parameter.
       
    68 		*
       
    69 		* @param aRequestId The request id which was returned by
       
    70 		* 					CPosNetworkPrivacy::VerifyLocationRequestL().
       
    71 		* @param aCompletionCode @p KErrNone if the location request is
       
    72 		* 		 accepted, @p KErrAccessDenied if the location request is rejected
       
    73 		* 		 or any of the system wide error codes.
       
    74 		*/
       
    75 		void HandleVerifyComplete(TInt /*aRequestId*/, TInt aCompletionCode);
       
    76 
       
    77 	public:		//COMASuplState
       
    78 		/**
       
    79 		* Timeout Notifier Method.
       
    80 		* @since S60  v3.1u
       
    81 		* @param None
       
    82 		* @return None
       
    83 		*/
       
    84 		void TimerExpiredL();
       
    85 
       
    86 		/**
       
    87 		* ProcessMessage Method,Process SUPL_INIT message...
       
    88 		* @since S60  v3.1u
       
    89 		* @param None
       
    90 		* @return system wide error
       
    91 		*/ 
       
    92 		virtual TInt ProcessMessageL(COMASuplAsnMessageBase* aDecodedMessage); 
       
    93 		/**
       
    94 		* GetPosMethod Method,returns the positioning method...
       
    95 		* @
       
    96 		* @param None
       
    97 		* @return TOMASuplPosMethod
       
    98 		*/
       
    99 		TOMASuplPosMethod GetPosMethod();
       
   100 
       
   101 		/**
       
   102 		* IsTriggerSession Method,returns whether trigger session or not 
       
   103 		* @
       
   104 		* @param None
       
   105 		* @return TOMASuplPosMethod
       
   106 		*/
       
   107 	    TBool IsTriggerSession();	
       
   108 
       
   109 		/**
       
   110 		* GetTriggerType Method,returns whether trigger session or not 
       
   111 		* @
       
   112 		* @param None
       
   113 		* @return TOMASuplPosMethod
       
   114 		*/
       
   115 	    COMASuplTriggeredStart::TOMASuplTrigType GetTriggerType();	
       
   116 	    
       
   117 	    void GetRequestorIDAndName(TInt& aRequestorId, TDes& aRequestorName);
       
   118 	    
       
   119 	    void GetPrivacyStatus(TBool& aPrivacyOverride);
       
   120 	    
       
   121 	    void GetSuplPrivacyRequestInfo(CPosSUPLPrivacyRequestInfo*& asuplReqInfo);
       
   122 	    
       
   123 	    void SetSessionId(TInt aSessionId);
       
   124 	    
       
   125 	private:
       
   126 		/**
       
   127 		* HandlePrivacy - Handles the privacy information
       
   128 		* @since S60  v3.1u
       
   129 		* @param None
       
   130 		* @return error code
       
   131 		*/
       
   132 		TInt HandlePrivacyL();
       
   133 		/**
       
   134 		* MakeGSMNotificationL - Handles the privacy notification
       
   135 		* @since S60  v3.1u
       
   136 		* @param None
       
   137 		* @return error code
       
   138 		*/ 
       
   139 		TInt MakeGSMNotificationL();
       
   140 
       
   141 		/**
       
   142 		* MakeGSMVerificationL - Handles the privacy verification
       
   143 		* @since S60  v3.1u
       
   144 		* @param None
       
   145 		* @return error code
       
   146 		*/ 
       
   147 		TInt MakeGSMVerificationL(CPosNetworkPrivacy::TRequestDecision aTimeOutStrategy);
       
   148 
       
   149 		/**
       
   150 		* Requestor - Retrievs requestor Information
       
   151 		* @since S60  v3.1u
       
   152 		* @param requestor
       
   153 		* @return error code
       
   154 		*/ 					 
       
   155 		TInt RequestorL(HBufC*& aRequestor);
       
   156 
       
   157 		/**
       
   158 		* Client - Retrievs client Information
       
   159 		* @since S60  v3.1u
       
   160 		* @param clientname
       
   161 		* @return error code
       
   162 		*/ 	
       
   163 		TInt ClientL(HBufC*& aClient);	
       
   164 
       
   165 	private:
       
   166 
       
   167 		/**
       
   168 		* CheckForVersion - Checks for SUPL version
       
   169 		* @since S60  v3.1u
       
   170 		* @param None
       
   171 		* @return error code
       
   172 		*/ 	
       
   173 		TInt CheckForVersion();
       
   174 		
       
   175 		/**
       
   176 		* CheckForModeSupport - Checks Modes
       
   177 		* @since S60  v3.1u
       
   178 		* @param None
       
   179 		* @return error code
       
   180 		*/ 	
       
   181 		TInt CheckForModeSupport();
       
   182 		
       
   183 		/**
       
   184 		* CheckForModeSupport - Checks for the existance of SET Session ID
       
   185 		* @since S60  v3.1u
       
   186 		* @param None
       
   187 		* @return error code
       
   188 		*/ 	
       
   189 		
       
   190 		TInt CheckForSetSessionID();
       
   191 		
       
   192 		/**
       
   193 		* CheckForSLPSessionID - Checks for the existance of SET Session ID
       
   194 		* @since S60  v3.1u
       
   195 		* @param None
       
   196 		* @return error code
       
   197 		*/ 	
       
   198 		TInt CheckForSLPSessionID();
       
   199 
       
   200 		/**
       
   201 		* ConverttoUniCode - Converts to Unicode
       
   202 		* @since S60  v3.1u
       
   203 		* @param clientname - Unicode String
       
   204 		* @param aRequestor -  UTF8,UCS2, UTF& String
       
   205 		* @return error code
       
   206 		*/ 	
       
   207 		TInt ConverttoUniCodeL(HBufC*& aUniCode,HBufC8& aRequstor);							  
       
   208 		
       
   209 		/**
       
   210 		* CheckForPositioningMethod - Checks whether positionmethod is NoPosition
       
   211 		* @since S60  v3.1u
       
   212 		* @param None
       
   213 		* @return None
       
   214 		*/
       
   215 		void CheckForPositioningMethod();
       
   216 		
       
   217 		/**
       
   218 		* CheckForExtensionParameters - Extracts SUPL 2.0 extension params 
       
   219 		* @since S60  v3.1u
       
   220 		* @param None
       
   221 		* @return None
       
   222 		*/
       
   223 		void CheckForExtensionParameters();
       
   224 		
       
   225 		/**
       
   226 		* GsmDefaultDecode - Unpacks the data of  7-bit format to 8-bit
       
   227 		* @since S60  v3.1u
       
   228 		* @param aIn, input  string, represented in 7-bit
       
   229 		* @param aOut,output string, represented in 8-bit
       
   230 		* @return None
       
   231 		*/
       
   232 		void GsmDefaultDecode( const TDesC8& aIn, TDes8& aOut );
       
   233 		
       
   234 		/**
       
   235 		* FormUCS2String - Forms the UCS2 string from the string which contains the characters 
       
   236 		* @since S60  v3.1
       
   237 		* @param aIn, input  string, represented in 8-bit
       
   238 		* @param aOut,output string, represented in UCS2
       
   239 		* @return None
       
   240 		*/
       
   241 		void FormUCS2String( const TDesC8& aIn, TDes& aOut );
       
   242 		
       
   243 	private : 
       
   244 
       
   245 		/**
       
   246 		* Constuctor Method.
       
   247 		* @since S60  v3.1u
       
   248 		* @param aMsgTimeout,Timeout for message
       
   249 		* @return None
       
   250 		*/ 
       
   251 		COMASuplInitState(TInt aMsgTimeout,const TDesC8& aHSLPAddress,
       
   252 						MOMASuplPrivacyObserver &aPrivacyObserver,TInt aSupportedMode, CPosNetworkPrivacy*	iNetworkPrivacy);
       
   253 
       
   254 		/**
       
   255 		* ConstructL Method, 2nd phase construction
       
   256 		* @since S60  v3.1u
       
   257 		* @param None
       
   258 		* @return None
       
   259 		*/
       
   260 		void ConstructL();
       
   261 		
       
   262 		void ReadRequestIDFeatureFlagL();
       
   263 		
       
   264 
       
   265 	private: //Data
       
   266 
       
   267 		COMASuplInitVer2* iSuplInit;
       
   268 
       
   269 		CPosNetworkPrivacy*	iNetworkPrivacy;
       
   270 
       
   271 		// RequestId. Used by POS Message Plugin API.
       
   272 		TInt	iGSMRequestId;
       
   273 
       
   274 		//Type of requestinfo
       
   275 		CPosSUPLPrivacyRequestInfo::TIdType iIdType;
       
   276 
       
   277 		//Notification
       
   278 		COMASuplNotification* iNotification;
       
   279 
       
   280         //Notification mode
       
   281         COMASuplVer2SuplInitExtn::TOMASuplNotificationMode iNotificationMode;
       
   282 
       
   283         //Trigger type
       
   284         COMASuplTriggeredStart::TOMASuplTrigType iTriggerType;
       
   285 
       
   286         //Historic reportings supported
       
   287         TOMASuplHistoricReporting iHistRepSupported;
       
   288 		
       
   289 		//Completion Code
       
   290 		TInt iCompletionCode;
       
   291 		
       
   292 		const TDesC8& iHSLPAddress;
       
   293 		
       
   294 		// Privacy Observer 
       
   295 		MOMASuplPrivacyObserver &iPrivacyObserver;
       
   296 		
       
   297 		TBool iNoPosition;
       
   298 		//Supported Mode of SET
       
   299 		TInt iSupportedMode;
       
   300 		TOMASuplPosMethod iPosMethod;
       
   301         TBool iTriggerSessionFlag;
       
   302         
       
   303         
       
   304         
       
   305         RBuf iRequestorName;     //Vijay
       
   306         
       
   307         TBool iPrivacyOverride;  //Vijay
       
   308         
       
   309         CPosSUPLPrivacyRequestInfo* iSuplReqInfo; //Vijay
       
   310         
       
   311         TBool iIsNotificationOnly;//APE Centric
       
   312         
       
   313         TBool iRequestIDFeatureFlag;//APE Centric
       
   314         
       
   315         TInt iSETSessionUniqueId;
       
   316 };
       
   317 
       
   318 #endif //C_COMASUPLINITSTATE_H