supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplstartstate.h
changeset 0 667063e416a2
child 19 02ba3f1733c6
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_START message...
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_COMASUPLSTARTSTATE_H
       
    21 #define C_COMASUPLSTARTSTATE_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <lbs/epos_comasuplpossessionbase.h>
       
    25 #include "lbs/epos_tomasuplallowedcapabilities.h"
       
    26 #include "epos_comasuplstate.h"
       
    27 #include "epos_comasupletel.h"
       
    28 
       
    29 class COMASuplLocationId;
       
    30 class COMASuplETel;
       
    31 class COMASuplSETCapabilities;
       
    32 class RMobilePhone;
       
    33 class COMASuplPOSRequestor;
       
    34 class TSuplTerminalQop;
       
    35 class TOMASuplECellInfo;
       
    36 class COMASuplAsnHandlerBase;
       
    37 class TOMASuplAllowedCapabilities;
       
    38 /**
       
    39 *  COMASuplStartState handles all SUPL_START related processing.   
       
    40 *  @lib eposomasuplprotocolhandler.lib
       
    41 *  @since S60 v3.1
       
    42 */
       
    43  
       
    44 class COMASuplStartState : public COMASuplState,
       
    45 						   public MOMASuplETelObserver,
       
    46 						   public MOMASuplMsgStateObserver
       
    47 {
       
    48 	
       
    49 	public :  // Constructor 
       
    50 	
       
    51 			/**
       
    52 			* NewL Method.
       
    53 			* @since S60 v3.1u
       
    54 			* @param aCapabilities,Allowed Capabilities
       
    55 			* @param aMobilePhone,
       
    56 			* @param aMsgTimeout,Timeout for message
       
    57 			* @param aAllowedCapabilities,Allowed capabilities
       
    58 			* @return Instance of COMASuplStartState
       
    59 			*/ 
       
    60 			static COMASuplStartState* NewL(RMobilePhone& aMobilePhone,TInt aMsgTimeout,
       
    61 											COMASuplPOSRequestor* aPosRequestor,COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase,
       
    62 											TInt aAllowedCapabilities);
       
    63 			/**
       
    64 			* Destructor.
       
    65 			*/
       
    66 			~COMASuplStartState();
       
    67 	
       
    68 	public:		//COMASuplState
       
    69 			/**
       
    70 			* GenerateMessageL Method,Generates SUPL_START message.
       
    71 			* @since S60 v3.1u
       
    72 			* @param None
       
    73 			* @return None
       
    74 			*/ 
       
    75 			virtual TInt GenerateMessageL();
       
    76 			
       
    77 			/**
       
    78 			* CancelOperation  Method,Cancels Operation...which are going on...
       
    79 			* @since S60 v3.1u
       
    80 			* @param None
       
    81 			* @return None
       
    82 			*/ 
       
    83 			virtual void CancelOperation();
       
    84 			
       
    85 			/**
       
    86 			* EncodeMessageL Method,Encodes SUPL_START message.
       
    87 			* @since S60 v3.1u
       
    88 			* @param aSuplVersion, version of SUPL
       
    89 			* @param aSessionId, sessionid of session.
       
    90 			* @param aError, error code if any error occures while conversion.
       
    91 			* @return encoded data, HBufC8*
       
    92 			*/ 
       
    93 			virtual HBufC8* EncodeMessageL(TOMASuplVersion &aSuplVersion,
       
    94 						   COMASuplSessionID* aSessionId,TInt &aError);
       
    95 			
       
    96 			/**
       
    97 			* Capabilities Method, returns the Capabilities pointer
       
    98 			* @since S60 v3.1u
       
    99 			* @param None
       
   100 			* @return SET capabilities retrieved during the creation of SUPL START
       
   101 			*/
       
   102 			COMASuplSETCapabilities* Capabilities();
       
   103 			
       
   104 			/**
       
   105 			* SetQop Method, Sets QoP to Encode with SUPL_END
       
   106 			* @since S60 v3.1
       
   107 			* @param aQop , QoP parameter which got form client.
       
   108 			* @return None
       
   109 			*/
       
   110 			void SetQop(TSuplTerminalQop& aQop);
       
   111 	
       
   112 	public: //MOMASuplETelObserver
       
   113 	
       
   114 			/**
       
   115 			* RequestCompleted Method, Location Id request completed succesfully
       
   116 			* @since S60 v3.1u
       
   117 			* @param aLocationId, all location related information
       
   118 			* @param aErrorCode, Failure reason code        
       
   119 			* @return None
       
   120 			*/
       
   121 			virtual void LocationIDRequestCompletedL(COMASuplLocationId* aLocationId,TInt aErrorCode);
       
   122 
       
   123 			/**
       
   124 			* RequestCompleted Method, E-Cell Id request completed succesfully
       
   125 			* @since S60 v3.2
       
   126 			* @param aECId TOMASuplECellInfo, all E-Cell id related information
       
   127 			* @param aErrorCode, Failure reason code        
       
   128 			* @return None
       
   129 			*/
       
   130 			virtual void LocationECellIdRequestCompletedL(TOMASuplECellInfo& aECId,TInt aErrorCode);
       
   131 			
       
   132 			/**
       
   133 			 * RequestCompleted Method, Location Id request for comparision completed succesfully
       
   134 			 * @since S60 v3.1u
       
   135 			 * @param aLocationId, all location related information
       
   136 			 * @param aErrorCode, Failure reason code        
       
   137 			 * @return None
       
   138 			 */
       
   139 			virtual void ComparisionLocationIDRequestCompletedL(COMASuplLocationId* aLocationId,TInt aErrorCode);
       
   140 			
       
   141 			/**
       
   142 	  	 	* OperationCompleteL,Notifies about complaetion of operation with or without error.
       
   143 			*@since Series 60 3.1u
       
   144 			*@param aError,error code occured while completion of operation.
       
   145 			*/
       
   146 			virtual void OperationCompleteL(TInt aError);
       
   147 			
       
   148 public:			
       
   149 			/**
       
   150 			* GetCurrentCellID Method, to get current cell id
       
   151 			* @since Series 60 3.1
       
   152 			* @param  TCellIdInfo
       
   153 			* @return None
       
   154 			*/ 
       
   155 			void GetCurrentCellID(TCellIdInfo& aCurrentCellId,TInt& aType);		
       
   156 			
       
   157 	private:
       
   158 			/**
       
   159 			* FillAllowedCapabilities Method.
       
   160 			* @since S60 v3.1u
       
   161 			* @param aAllowedCapabilities,Allowed capabilities of SET 
       
   162 			* @return None
       
   163 			*/
       
   164 			void FillAllowedCapabilities(TInt aAllowedCapabilities);
       
   165 			
       
   166 			/**
       
   167 			* InitilizeAllowedCapabilities Method.
       
   168 			* @since S60 v3.1u
       
   169 			* @param None
       
   170 			* @return None
       
   171 			*/
       
   172 			void InitilizeAllowedCapabilities();
       
   173 
       
   174 			/**
       
   175 			* ComputeCapabilities Method,Computes capabilities.. does SETCaps = SETCaps & AllowedCaps
       
   176 			* @since S60 v3.1u
       
   177 			* @param None
       
   178 			* @return None
       
   179 			*/
       
   180 			void ComputeCapabilities();
       
   181 			
       
   182 			/**
       
   183 			* ValidateSetCapabilities Method to validate the capabilities of
       
   184 			* the SET against the Capabilities retrieved during the construction
       
   185 			* of SUPL START
       
   186 			* @since S60  v3.1u
       
   187 			* @param None
       
   188 			* @return None
       
   189 			*/
       
   190 			TInt ValidateSetCapabilities();
       
   191 			
       
   192 			/**
       
   193 			* SetPrefferedBack Method to Set Preffered method to the one which POS had given
       
   194 			* @since S60  v3.1u
       
   195 			* @param None
       
   196 			* @return None
       
   197 			*/
       
   198 			void SetPrefferedBack();
       
   199 
       
   200 	protected : 
       
   201 	
       
   202 			/**
       
   203 			* Constuctor Method.
       
   204 			* @since S60 v3.1u
       
   205 			* @param aMobilePhone,
       
   206 			* @param aMsgTimeout,Timeout for message
       
   207 			* @return None
       
   208 			*/ 
       
   209 			COMASuplStartState(RMobilePhone& aMobilePhone,
       
   210 			   TInt aMsgTimeout,COMASuplPOSRequestor* aPosRequestor,COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase);
       
   211 			/**
       
   212 			* ConstructL Method, 2nd phase construction
       
   213 			* @since S60 v3.1u
       
   214 			* @param aAllowedCapabilities,Allowed capabilities
       
   215 			* @return None
       
   216 			*/
       
   217 			void ConstructL(TInt aAllowedCapabilities);
       
   218 
       
   219 			/**
       
   220 			* GetPosParamsL Method, Get the SET Capabilities from POS
       
   221 			* Message plugin
       
   222 			* @since S60 v3.1u
       
   223 			* @param None
       
   224 			* @return SET capabilities retrieved during the 
       
   225 			* creation of SUPL START
       
   226 			*/
       
   227 			void virtual GetPosParamsL();
       
   228 	
       
   229 			/**
       
   230 			* GetPositionComplete Method, 
       
   231 			* @since S60 v3.1u
       
   232 			* @param None
       
   233 			* @return None
       
   234 			*/
       
   235 			void GetPositionComplete(TInt);
       
   236 			
       
   237 			/**
       
   238 			* GetAssistceDataFromPluginL Method, 
       
   239 			* @since S60 v3.2
       
   240 			* @param aErrorCode , error code if any error occured during previous operation
       
   241 			* @return None
       
   242 			*/
       
   243 			void GetAssistceDataFromPluginL(TInt aErrorCode);
       
   244 			
       
   245 	protected: //Data
       
   246 	
       
   247 			//LocationID Requestor
       
   248 			COMASuplETel* iLocationIDRequestor;
       
   249 			
       
   250 			//Location ID
       
   251 			COMASuplLocationId* iLocationId;
       
   252 			
       
   253 			//SET capabilities
       
   254 			COMASuplSETCapabilities* iSETCapabilities;
       
   255 			
       
   256 			//Allowed capabilities
       
   257 			COMASuplSETCapabilities* iAllowedCapabilities;
       
   258 			COMASuplPosSessionBase::TOMASuplPositioningMethod iPositioningMethodforPOS;
       
   259 			
       
   260 			TOMASuplAllowedCapabilities iAllowedCapabilitiesforPOS;
       
   261 
       
   262 			//Connected RMobilePhone session
       
   263 			RMobilePhone& iMobilePhone;
       
   264 
       
   265 			//POS Requestor
       
   266 			COMASuplPOSRequestor* iPosRequestor;
       
   267 			
       
   268 			//Enhanaced Cell Id
       
   269 			TBool  iECId; 
       
   270 			
       
   271 			//Generation Status
       
   272 			TBool iGenerationStatus;
       
   273 			
       
   274 			//Received QoP from Client Lib
       
   275 			TSuplTerminalQop iClientQop;
       
   276 			
       
   277 			//is Qop Present
       
   278 			TBool iIsQoPPresent;
       
   279 			
       
   280 			//	SET Preffered method provided by POS
       
   281 			COMASuplSETCapabilities::TOMASuplPrefMethod    iPOSMsgSETprefMethod;
       
   282 
       
   283 			//To hold E-cell id data
       
   284 			TOMASuplECellInfo iMmCellInfo;
       
   285 			
       
   286 			COMASuplAsnHandlerBase* iOMASuplAsnHandlerBase;
       
   287 
       
   288 };
       
   289 
       
   290 #endif //C_COMASUPLSTARTSTATE_H