supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplendstate.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_END message...
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_COMASUPLENDSTATE_H
       
    21 #define C_COMASUPLENDSTATE_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "epos_comasuplend.h"
       
    26 #include "epos_comasuplstate.h"
       
    27 
       
    28 class COMASuplPosition;
       
    29 class COMASuplAsnHandlerBase;
       
    30 
       
    31 /**
       
    32  *	COMASuplEndState handles all SUPL_END related processing.
       
    33  *  @lib eposomasuplprotocolhandler.lib
       
    34  *  @since S60 v3.1u
       
    35  */
       
    36 
       
    37 
       
    38 class COMASuplEndState : public COMASuplState
       
    39 {
       
    40 	public :  // Constructor 
       
    41 	
       
    42 		/**
       
    43 		* NewL Method.
       
    44 		* @since S60 3.1u
       
    45 		* @param COMASuplEnd::TOMASuplStatusCode,Status code,if any error 
       
    46 		* @return Instance of COMASuplEndState
       
    47 		*/ 
       
    48 		static COMASuplEndState* NewL(COMASuplEnd::TOMASuplStatusCode,COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase,
       
    49 									  HBufC8* aEncodedSuplInit = NULL,
       
    50 									  HBufC8* aHSLPAddress = NULL);
       
    51 		
       
    52 		/**
       
    53 		* NewL Method.
       
    54 		* @since S60 3.1u
       
    55 		* @param None
       
    56 		* @return Instance of COMASuplEndState
       
    57 		*/ 
       
    58 		static COMASuplEndState* NewL(COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase,HBufC8* aEncodedSuplInit = NULL, HBufC8* aHSLPAddress = NULL);
       
    59 		
       
    60 		/**
       
    61 		* Destructor.
       
    62 		*/
       
    63 		~COMASuplEndState();
       
    64 		
       
    65     public:		//COMASuplState
       
    66     
       
    67    	/**
       
    68 		* GenerateMessageL Method,Generates SUPL_END message...
       
    69 		* @since S60 3.1u
       
    70 		* @param None
       
    71 		* @return system wide error
       
    72 		*/ 
       
    73 		virtual TInt GenerateMessageL();
       
    74 
       
    75    	/**
       
    76 		* EncodeMessageL Method,Encodes SUPL_END message...
       
    77 		* @since S60 3.1u
       
    78 		* @param aSuplVersion, version of SUPL
       
    79 		* @param aSessionId, sessionid of session.
       
    80 		* @param aError, error code if any error occures while conversion.
       
    81 		* @return encoded data, HBufC8*
       
    82 		*/ 
       
    83 		virtual HBufC8* EncodeMessageL(TOMASuplVersion &aSuplVersion,COMASuplSessionID* aSessionId,
       
    84 									   TInt &aError);
       
    85 		
       
    86     /**
       
    87 		* CancelOperation  Method,Cancels Operation...which are going on...
       
    88 		* @since S60 3.1u
       
    89 		* @param None
       
    90 		* @return None
       
    91 		*/ 
       
    92 		virtual void CancelOperation();
       
    93 
       
    94     /**
       
    95 		* ProcessMessage Method,Process SUPL_END message...
       
    96 		* @since S60 3.1u
       
    97 		* @param aDecodedMessage, COMASuplAsnMessageBase ...decoded message
       
    98 		* @return system wide error
       
    99 		*/ 
       
   100 		virtual TInt ProcessMessageL(COMASuplAsnMessageBase* aDecodedMessage); 
       
   101 		
       
   102 		/**
       
   103 		* GetPosition Method,Return the Position pointer
       
   104 		* @since S60 3.1u
       
   105 		* @param None
       
   106 		* @return COMASuplPosition*
       
   107 		*/ 
       
   108 		COMASuplPosition* GetPosition() const; 
       
   109 		
       
   110 		/**
       
   111 		* StartTimer Method, Starts timer...timeout value is depend on message type.
       
   112 		* @since S60 3.1u
       
   113 		* @param None
       
   114 		* @return None
       
   115 		*/ 
       
   116 		void StartTimer();
       
   117 		
       
   118  	   /**
       
   119 		* ComputeSuplEndVer Method,Computes the Verof SUPL INIT
       
   120 		* in case of Network Initiated Location requests.
       
   121 		* @since S60 v3.1u
       
   122 		* @param None
       
   123 		* @return None
       
   124 		*/
       
   125 		
       
   126 		TBool ComputeSuplEndVerL();
       
   127 
       
   128  	   /**
       
   129 		* GetStatusCode Method, returns the current value stored in the status code
       
   130 		* @since S60 v3.2
       
   131 		* @param None
       
   132 		* @return statusCode
       
   133 		*/
       
   134         COMASuplEnd::TOMASuplStatusCode GetStatusCode();
       
   135 
       
   136 	private:
       
   137 	
       
   138  	   /**
       
   139 		* LogReceivedPosition Method,Logs position information
       
   140 		* @since S60 v3.1
       
   141 		* @param None
       
   142 		* @return None
       
   143 		*/
       
   144 		void LogReceivedPosition() const; 	
       
   145 		void PrintHex(const TDesC8& aBuffer,TInt aLine);
       
   146 		
       
   147 	protected : 
       
   148 	
       
   149 		//Constuctor
       
   150 		COMASuplEndState(COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase);
       
   151 		
       
   152 		/**
       
   153 		* Constuctor
       
   154 		* @since S60 3.1u
       
   155 		* @param COMASuplEnd::TOMASuplStatusCode,Status code,if any error 
       
   156 		* @return None
       
   157 		*/ 
       
   158 		COMASuplEndState(COMASuplEnd::TOMASuplStatusCode aStatusCode,COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase);
       
   159 		
       
   160     /**
       
   161     * ConstructL Method, 2nd phase construction
       
   162     * @since S60 3.1u
       
   163     * @param None
       
   164     * @return None
       
   165     */
       
   166 		void ConstructL(HBufC8* aEncodedSuplInit = NULL, HBufC8 *aHSLPAddress = NULL);
       
   167 
       
   168 	private: //Data
       
   169 	
       
   170 		COMASuplPosition* iOMASuplPosition;
       
   171 			
       
   172 	    COMASuplEnd::TOMASuplStatusCode iStatusCode;
       
   173 	    
       
   174 	    TBool iSetStatusCode;
       
   175 	    
       
   176 		HBufC8 *iEncodedSuplInit;
       
   177 
       
   178 		HBufC8 *iHSLPAddress;
       
   179 		
       
   180 		TBool iVerPresent;
       
   181 		
       
   182 		TBuf8<64> iRes;
       
   183 		
       
   184 		COMASuplAsnHandlerBase* iOMASuplAsnHandlerBase;
       
   185 };
       
   186 
       
   187 #endif //C_COMASuplEndState_H