supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplinitstate.h
changeset 0 667063e416a2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplinitstate.h	Tue Feb 02 01:06:48 2010 +0200
@@ -0,0 +1,264 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   class for handling SUPL_INIT message...
+*
+*/
+
+
+
+#ifndef C_COMASUPLINITSTATE_H
+#define C_COMASUPLINITSTATE_H
+
+#include <e32base.h>
+
+#include <lbs/epos_cposnetworkprivacy.h>
+#include <lbs/epos_cpossuplprivacyrequestinfo.h>
+#include <lbs/epos_mposverificationobserver.h>
+
+#include "epos_momasupltimeoutnotifier.h"
+#include "epos_comasuplstate.h"
+
+// Forward Declarartion
+class COMASuplNotification;
+class COMASuplTimeoutTimer;
+class MOMASuplPrivacyObserver;
+/**
+ *  COMASuplInitState handles all SUPL_INIT related processing.  
+ *  @lib eposomasuplprotocolhandler.lib
+ *  @since S60 v3.1u
+ */
+
+class COMASuplInitState : public COMASuplState,
+						  public MPosVerificationObserver
+{
+
+	public :  // Constructor 
+
+		/**
+		* NewL Method.
+		* @since S60  v3.1u
+		* @param aMsgTimeout,timeout value for SUPL_INIT
+		* @return Instance of COMASuplInitState
+		*/ 
+		static COMASuplInitState* NewL(TInt aMsgTimeout,const TDesC8& aHSLPAddress,
+										MOMASuplPrivacyObserver &aPrivacyObserver,TInt aSupportedMode, CPosNetworkPrivacy*	iNetworkPrivacy);
+
+		/**
+		* Destructor.
+		*/
+		~COMASuplInitState();
+
+	public:		//MPosVerificationObserver
+
+		/**
+		* Called when a call to CPosNetworkPrivacy::VerifyLocationRequestL()
+		* completes, in which this observer object was passed as a parameter.
+		*
+		* @param aRequestId The request id which was returned by
+		* 					CPosNetworkPrivacy::VerifyLocationRequestL().
+		* @param aCompletionCode @p KErrNone if the location request is
+		* 		 accepted, @p KErrAccessDenied if the location request is rejected
+		* 		 or any of the system wide error codes.
+		*/
+		void HandleVerifyComplete(TInt /*aRequestId*/, TInt aCompletionCode);
+
+	public:		//COMASuplState
+		/**
+		* Timeout Notifier Method.
+		* @since S60  v3.1u
+		* @param None
+		* @return None
+		*/
+		void TimerExpiredL();
+
+		/**
+		* ProcessMessage Method,Process SUPL_INIT message...
+		* @since S60  v3.1u
+		* @param None
+		* @return system wide error
+		*/ 
+		virtual TInt ProcessMessageL(COMASuplAsnMessageBase* aDecodedMessage); 
+		/**
+		* GetPosMethod Method,returns the positioning method...
+		* @
+		* @param None
+		* @return TOMASuplPosMethod
+		*/
+		TOMASuplPosMethod GetPosMethod();
+
+	    void GetRequestorID(TInt& aRequestorId);
+	private:
+		/**
+		* HandlePrivacy - Handles the privacy information
+		* @since S60  v3.1u
+		* @param None
+		* @return error code
+		*/
+		TInt HandlePrivacyL();
+		/**
+		* MakeGSMNotificationL - Handles the privacy notification
+		* @since S60  v3.1u
+		* @param None
+		* @return error code
+		*/ 
+		TInt MakeGSMNotificationL();
+
+		/**
+		* MakeGSMVerificationL - Handles the privacy verification
+		* @since S60  v3.1u
+		* @param None
+		* @return error code
+		*/ 
+		TInt MakeGSMVerificationL(CPosNetworkPrivacy::TRequestDecision aTimeOutStrategy);
+
+		/**
+		* Requestor - Retrievs requestor Information
+		* @since S60  v3.1u
+		* @param requestor
+		* @return error code
+		*/ 					 
+		TInt RequestorL(HBufC*& aRequestor);
+
+		/**
+		* Client - Retrievs client Information
+		* @since S60  v3.1u
+		* @param clientname
+		* @return error code
+		*/ 	
+		TInt ClientL(HBufC*& aClient);	
+
+	private:
+
+		/**
+		* CheckForVersion - Checks for SUPL version
+		* @since S60  v3.1u
+		* @param None
+		* @return error code
+		*/ 	
+		TInt CheckForVersion();
+		
+		/**
+		* CheckForModeSupport - Checks Modes
+		* @since S60  v3.1u
+		* @param None
+		* @return error code
+		*/ 	
+		TInt CheckForModeSupport();
+		
+		/**
+		* CheckForModeSupport - Checks for the existance of SET Session ID
+		* @since S60  v3.1u
+		* @param None
+		* @return error code
+		*/ 	
+		
+		TInt CheckForSetSessionID();
+		
+		/**
+		* CheckForSLPSessionID - Checks for the existance of SET Session ID
+		* @since S60  v3.1u
+		* @param None
+		* @return error code
+		*/ 	
+		TInt CheckForSLPSessionID();
+
+		/**
+		* ConverttoUniCode - Converts to Unicode
+		* @since S60  v3.1u
+		* @param clientname - Unicode String
+		* @param aRequestor -  UTF8,UCS2, UTF& String
+		* @return error code
+		*/ 	
+		TInt ConverttoUniCodeL(HBufC*& aUniCode,HBufC8& aRequstor);							  
+		
+		/**
+		* CheckForPositioningMethod - Checks whether positionmethod is NoPosition
+		* @since S60  v3.1u
+		* @param None
+		* @return None
+		*/
+		void CheckForPositioningMethod();
+		
+		/**
+		* GsmDefaultDecode - Unpacks the data of  7-bit format to 8-bit
+		* @since S60  v3.1u
+		* @param aIn, input  string, represented in 7-bit
+		* @param aOut,output string, represented in 8-bit
+		* @return None
+		*/
+		void GsmDefaultDecode( const TDesC8& aIn, TDes8& aOut );
+		
+		/**
+		* FormUCS2String - Forms the UCS2 string from the string which contains the characters 
+		* @since S60  v3.1
+		* @param aIn, input  string, represented in 8-bit
+		* @param aOut,output string, represented in UCS2
+		* @return None
+		*/
+		void FormUCS2String( const TDesC8& aIn, TDes& aOut );
+		
+	private : 
+
+		/**
+		* Constuctor Method.
+		* @since S60  v3.1u
+		* @param aMsgTimeout,Timeout for message
+		* @return None
+		*/ 
+		COMASuplInitState(TInt aMsgTimeout,const TDesC8& aHSLPAddress,
+						MOMASuplPrivacyObserver &aPrivacyObserver,TInt aSupportedMode, CPosNetworkPrivacy*	iNetworkPrivacy);
+
+		/**
+		* ConstructL Method, 2nd phase construction
+		* @since S60  v3.1u
+		* @param None
+		* @return None
+		*/
+		void ConstructL();
+		
+		void ReadRequestIDFeatureFlagL();
+
+	private: //Data
+
+		COMASuplInit* iSuplInit;
+
+		CPosNetworkPrivacy*	iNetworkPrivacy;
+
+		// RequestId
+		TInt	iGSMRequestId;
+
+		//Type of requestinfo
+		CPosSUPLPrivacyRequestInfo::TIdType iIdType;
+
+		//Notification
+		COMASuplNotification* iNotification;
+		
+		//Completion Code
+		TInt iCompletionCode;
+		
+		const TDesC8& iHSLPAddress;
+		
+		// Privacy Observer 
+		MOMASuplPrivacyObserver &iPrivacyObserver;
+		
+		TBool iNoPosition;
+		//Supported Mode of SET
+		TInt iSupportedMode;
+		
+		TOMASuplPosMethod iPosMethod;
+        TBool iIsNotificationOnly;//APE Centric
+        TBool iRequestIDFeatureFlag;//APE Centric
+};
+
+#endif //C_COMASUPLINITSTATE_H