supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplposstate.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_POS message...
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef EPOS_COMASUPLPOSSTATE_H
       
    21 #define EPOS_COMASUPLPOSSTATE_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include <lbs/epos_comasuplpospayload.h>
       
    26 #include "epos_comasuplstate.h"
       
    27 
       
    28 class COMASuplPosSessionBase;
       
    29 class COMASuplPOSRequestor;
       
    30 class COMASuplPosPayload;
       
    31 class COMASuplVelocity;
       
    32 class COMASuplPos;
       
    33 class COMASuplSETCapabilities;
       
    34 class COMASuplAsnHandlerBase;
       
    35 
       
    36 /**
       
    37  *  COMASuplPosState handles all SUPL_POS related processing.
       
    38  *  @lib eposomasuplprotocolhandler.lib
       
    39  *  @since S60 v3.1
       
    40  */
       
    41 
       
    42 class COMASuplPosState : public COMASuplState,public MOMASuplMsgStateObserver
       
    43 {
       
    44 	public :  // Constructor 
       
    45 	
       
    46 		/**
       
    47 		* NewL Method.
       
    48 		* @since S60 v3.1
       
    49 		* @param None
       
    50 		* @return None
       
    51 		* @return Instance of COMASuplPosState
       
    52 		*/ 
       
    53 		static COMASuplPosState* NewL(COMASuplPosSessionBase* aPOSSession,TInt aMsgTimeout,COMASuplSETCapabilities* aSETCapabilities,
       
    54 																	COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase);
       
    55 		
       
    56 		/**
       
    57 		* Destructor.
       
    58 		*/
       
    59 		~COMASuplPosState();
       
    60 		
       
    61     public:		//COMASuplState
       
    62     
       
    63 	  /**
       
    64 		* GenerateMessageL Method,Generates SUPL_END message...
       
    65 		* @since S60 v3.1
       
    66 		* @param None
       
    67 		* @return system wide error
       
    68 		*/ 
       
    69 		virtual TInt GenerateMessageL();
       
    70 
       
    71     /**
       
    72 		* EncodeMessageL Method,Encodes SUPL_END message...
       
    73 		* @since S60 v3.1
       
    74 		* @param aSuplVersion, version of SUPL
       
    75 		* @param aSessionId, sessionid of session.
       
    76 		* @param aError, error code if any error occures while conversion.
       
    77 		* @return encoded data, HBufC8*
       
    78 		*/ 
       
    79 		virtual HBufC8* EncodeMessageL(TOMASuplVersion &aSuplVersion,
       
    80 						COMASuplSessionID* aSessionId,TInt &aError);
       
    81 
       
    82     /**
       
    83 		* CancelOperation Method,Cancels operations if it is ongoing
       
    84 		* @since S60 v3.1
       
    85 		* @param None
       
    86 		* @return None
       
    87 		*/ 
       
    88 		virtual void CancelOperation();
       
    89 		
       
    90     /**
       
    91 		* ProcessMessage Method,Process SUPL_END message...
       
    92 		* @since S60 v3.1u
       
    93 		* @param None
       
    94 		* @return system wide error
       
    95 		*/ 
       
    96 		virtual TInt ProcessMessageL(COMASuplAsnMessageBase* aDecodedMessage); 
       
    97 		
       
    98 		/**
       
    99 		* StartTimer Method, Starts timer...
       
   100 		* @since Series 60 3.1
       
   101 		* @param None
       
   102 		* @return None
       
   103 		*/ 
       
   104 		virtual void StartTimer();
       
   105 		
       
   106 		/**
       
   107 		* OperationCompleteL Method,
       
   108 		* @since Series 60 3.1
       
   109 		* @param None
       
   110 		* @return None
       
   111 		*/ 
       
   112 		void OperationCompleteL(TInt aError);
       
   113 		void GetPositionComplete(TInt aError);
       
   114 		
       
   115    public:
       
   116        	/**
       
   117 		* IsLastMessage Method,returns true if POS plugin has anything to sent to SLP
       
   118 		* @since Series 60 3.1
       
   119 		* @param None
       
   120 		* @return TBool
       
   121 		*/ 
       
   122 		TBool IsLastMessage();
       
   123 		
       
   124        	/**
       
   125 		* IsGenerationInProgress Method,returns true if generation is in progress or not
       
   126 		* @since Series 60 3.1
       
   127 		* @param None
       
   128 		* @return TBool
       
   129 		*/ 
       
   130 		TBool IsGenerationInProgress();
       
   131 		
       
   132        	/**
       
   133 		* IsSegmentationDone Method,checks for segmentation is done 
       
   134 		* @since Series 60 3.1
       
   135 		* @param None
       
   136 		* @return TBool
       
   137 		*/ 
       
   138 		TBool IsSegmentationDone() const;
       
   139 		
       
   140 	   	/**
       
   141 		* SetRemainingPosPayloadFromSuplPosInit Method,Sets remaining pospayload from SUPL_POS_INIT
       
   142 		* @since Series 60 3.1
       
   143 		* @param aRemainingPospayload, will give remaining pos payload
       
   144 		* @return None
       
   145 		*/ 
       
   146 		void SetRemainingPosPayloadFromSuplPosInitL(COMASuplPosPayload* aRemainingPospayload);	
       
   147 		
       
   148 	private :
       
   149 	
       
   150 	   	/**
       
   151 		* IterateSuplInfoListL Method,returns None
       
   152 		* @since Series 60 3.1
       
   153 		* @param 
       
   154 		* @return 
       
   155 		*/ 
       
   156 		void IterateSuplInfoListL(COMASuplPos* aOMASuplPos,TInt &aError);	
       
   157 		
       
   158 	   	/**
       
   159 		* PseudoSegmentationL Method,does segmentation of pospayload
       
   160 		* @since Series 60 3.1
       
   161 		* @param None
       
   162 		* @return None
       
   163 		*/ 
       
   164 		void PseudoSegmentationL();
       
   165 		
       
   166 	   	/**
       
   167 		* LogPosPayLoadData Method,returns None
       
   168 		* @since Series 60 3.1
       
   169 		* @param None
       
   170 		* @return None
       
   171 		*/ 
       
   172 		void LogPosPayLoadData();
       
   173 		
       
   174 	   	/**
       
   175 		* LogVelocity Method,returns None
       
   176 		* @since Series 60 3.1
       
   177 		* @param None
       
   178 		* @return None
       
   179 		*/ 
       
   180 		void LogVelocity();		
       
   181 		
       
   182 		TBool CheckPOSPayloadType(const COMASuplPosPayload *aPosPayload);
       
   183 		void LogPacket(const TDesC8& aPacket);
       
   184 	protected : 
       
   185 	
       
   186 		//Constuctor
       
   187 		COMASuplPosState(COMASuplPosSessionBase* aPOSSession,TInt aMsgTimeout,COMASuplSETCapabilities* aSETCapabilities,
       
   188 										 COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase);
       
   189 		
       
   190 	  /**
       
   191 	  * ConstructL Method, 2nd phase construction
       
   192 	  * @since S60 v3.1u
       
   193 	  * @param None
       
   194 	  * @return None
       
   195 	  */
       
   196 		void ConstructL();
       
   197 
       
   198 	private: //Data
       
   199 		
       
   200 	//POS Session 
       
   201 	COMASuplPosSessionBase* iPOSSession;
       
   202 
       
   203 	//POS Requestor
       
   204 	COMASuplPOSRequestor* iPOSRequestor;
       
   205 
       
   206 	COMASuplPosPayload* iOMASuplPosPayLoad;
       
   207 
       
   208 	COMASuplVelocity* iOMASuplVelocity;
       
   209 	
       
   210 	//SET capabilities
       
   211 	COMASuplSETCapabilities* iSETCapabilities;
       
   212 
       
   213 	//Error code from POS plugin		
       
   214 	TInt iRequestError;
       
   215 	
       
   216 	TBool iGenerationStatus;
       
   217 	
       
   218 	//Will hold if segmented used for last time...
       
   219 	TBool iIsLastPosPayloadSegmented;
       
   220 	
       
   221 	//Will hold remaining pospayload data...
       
   222 	HBufC8* iRemainingPospayload;
       
   223 	
       
   224 	//Will hold pospayload type...
       
   225 	COMASuplPosPayload::TOMASuplPosPayloadType iPosPayLoadType;
       
   226 	
       
   227 	TBool iIsAnyPosPayloadFromPosInit;
       
   228 	
       
   229 	COMASuplAsnHandlerBase* iOMASuplAsnHandlerBase;
       
   230 		
       
   231 };
       
   232 
       
   233 #endif //C_COMASUPLPOSSTATE_H