supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplsession2.cpp
changeset 20 82ee1f804b63
parent 18 3825cf2dc8c2
child 22 4c4ed41530db
equal deleted inserted replaced
18:3825cf2dc8c2 20:82ee1f804b63
    88 #include "epos_comasupldialogtimer.h"
    88 #include "epos_comasupldialogtimer.h"
    89 #include "epos_tomasuplposmethod.h"
    89 #include "epos_tomasuplposmethod.h"
    90 #include "epos_omasuplconfigurationkeys.h"
    90 #include "epos_omasuplconfigurationkeys.h"
    91 #include "epos_csuplsettingparams.h"
    91 #include "epos_csuplsettingparams.h"
    92 #include "epos_comasuplasnbase.h"
    92 #include "epos_comasuplasnbase.h"
       
    93 #include "epos_csuplsettingsconstants.h"
    93 
    94 
    94 
    95 
    95 _LIT(KTraceFileName,"SUPL_OMA_SESSION::EPos_COMASuplSession2.cpp");
    96 _LIT(KTraceFileName,"SUPL_OMA_SESSION::EPos_COMASuplSession2.cpp");
    96 
    97 
    97 //Multiplying factor for conversion of ellipsoid to circle
    98 //Multiplying factor for conversion of ellipsoid to circle
  1716 
  1717 
  1717     TPosition posInfo;
  1718     TPosition posInfo;
  1718     TOMASuplUtcTime UtcTime;
  1719     TOMASuplUtcTime UtcTime;
  1719     TOMASuplPositionEstimate PosEstimate;
  1720     TOMASuplPositionEstimate PosEstimate;
  1720     TDateTime TimeStamp;
  1721     TDateTime TimeStamp;
  1721     TInt ZoneCode,Zone,altitude,AltitudeUncertainty, HorizontalAccuracy;
  1722     TInt ZoneCode,Zone,altitude, HorizontalAccuracy;
       
  1723 	TInt AltitudeUncertainty = 0;
  1722     TOMASuplAltitudeInfo AltitudeInfo;
  1724     TOMASuplAltitudeInfo AltitudeInfo;
  1723     TInt latitude,longitude;
  1725     TInt latitude,longitude;
  1724     TOMASuplPositionEstimate::TOMASuplLatitudeSign LatSign;
  1726     TOMASuplPositionEstimate::TOMASuplLatitudeSign LatSign;
  1725     TOMASuplAltitudeInfo::TOMASuplAltitudeDirection altitudeDirection;
  1727     TOMASuplAltitudeInfo::TOMASuplAltitudeDirection altitudeDirection;
  1726     TOMASuplUncertainty Uncertainty;
  1728     TOMASuplUncertainty Uncertainty;
  1900 
  1902 
  1901     TPosition posInfo;
  1903     TPosition posInfo;
  1902     TOMASuplUtcTime UtcTime;
  1904     TOMASuplUtcTime UtcTime;
  1903     TOMASuplPositionEstimate PosEstimate;
  1905     TOMASuplPositionEstimate PosEstimate;
  1904     TDateTime TimeStamp;
  1906     TDateTime TimeStamp;
  1905     TInt ZoneCode,Zone,altitude,AltitudeUncertainty, HorizontalAccuracy;
  1907     TInt ZoneCode,Zone,altitude, HorizontalAccuracy;
       
  1908 	TInt AltitudeUncertainty = 0;
  1906     TOMASuplAltitudeInfo AltitudeInfo;
  1909     TOMASuplAltitudeInfo AltitudeInfo;
  1907     TInt latitude,longitude;
  1910     TInt latitude,longitude;
  1908     TOMASuplPositionEstimate::TOMASuplLatitudeSign LatSign;
  1911     TOMASuplPositionEstimate::TOMASuplLatitudeSign LatSign;
  1909     TOMASuplAltitudeInfo::TOMASuplAltitudeDirection AltitudeDirection;
  1912     TOMASuplAltitudeInfo::TOMASuplAltitudeDirection AltitudeDirection;
  1910     TOMASuplUncertainty Uncertainty;
  1913     TOMASuplUncertainty Uncertainty;
  2192         }
  2195         }
  2193     else //Other messages than SUPL_INIT.... Send End
  2196     else //Other messages than SUPL_INIT.... Send End
  2194         {
  2197         {
  2195         CreateCloneMessageL(aDecodedAsnMessage);		
  2198         CreateCloneMessageL(aDecodedAsnMessage);		
  2196         UpdateSuplSessionIDL();
  2199         UpdateSuplSessionIDL();
       
  2200 		if (iRequestType == ESUPL_NETWORK && messageType == COMASuplAsnMessageBase::ESUPL_INIT)
       
  2201 			{
       
  2202 			ServerAddressCheckForSuplInitL();
       
  2203 			}
  2197  
  2204  
  2198         iSuplSessionState = ESUPL_INITIALIZED;
  2205         iSuplSessionState = ESUPL_INITIALIZED;
  2199         iSuplMsgType = ESUPL_END;
  2206         iSuplMsgType = ESUPL_END;
  2200 
  2207 
  2201         if((aErrorCode == KErrCompletion && messageType == COMASuplAsnMessageBase::ESUPL_INIT) ||
  2208         if((aErrorCode == KErrCompletion && messageType == COMASuplAsnMessageBase::ESUPL_INIT) ||
  2220                 hslpAdress->Des().Copy(iHSLPAddress);
  2227                 hslpAdress->Des().Copy(iHSLPAddress);
  2221                 }
  2228                 }
  2222 
  2229 
  2223             else if(len ==0)
  2230             else if(len ==0)
  2224                 {
  2231                 {
  2225                 iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__);
  2232                 CServerParams* serverParams = CServerParams::NewL();
  2226                 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
  2233                 CleanupStack::PushL(serverParams);
  2227                 CleanupStack::PushL(hslpAdress);
  2234     
  2228                 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());	
  2235                 if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound )
  2229                 CleanupStack::Pop(hslpAdress);						
  2236                     {
  2230                 }
  2237 	                iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__);
       
  2238 	                hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
       
  2239 	                hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());	
       
  2240                     }
       
  2241                 else
       
  2242                     {
       
  2243                     iTrace->Trace(_L("Sending End with ver for Default HSLP"), KTraceFileName, __LINE__);
       
  2244                     TInt64 slpId;
       
  2245                     TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable;
       
  2246                     HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen);
       
  2247                     HBufC* iapName = HBufC::NewL(KMaxIAPLen);
       
  2248                     CleanupStack::PushL(serverAddr);
       
  2249                     CleanupStack::PushL(iapName);
       
  2250                     serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable);
       
  2251                     hslpAdress = HBufC8::NewL(serverAddr->Length());
       
  2252                     hslpAdress->Des().Copy(*serverAddr);
       
  2253     
       
  2254                     CleanupStack::PopAndDestroy(iapName);
       
  2255                     CleanupStack::PopAndDestroy(serverAddr);
       
  2256                     }
       
  2257                 CleanupStack::PopAndDestroy(serverParams);
       
  2258                 }
       
  2259             delete iSuplState;
       
  2260             iSuplState=NULL;
  2231             CleanupStack::PushL(hslpAdress);
  2261             CleanupStack::PushL(hslpAdress);
  2232             iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress);		
  2262             iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress);		
  2233             CleanupStack::PopAndDestroy(hslpAdress);
  2263             CleanupStack::PopAndDestroy(hslpAdress);
  2234             }
  2264             }
  2235         else
  2265         else
  3855         hslpAdress->Des().Copy(iHSLPAddress);
  3885         hslpAdress->Des().Copy(iHSLPAddress);
  3856         }
  3886         }
  3857 
  3887 
  3858     else if(len ==0)
  3888     else if(len ==0)
  3859         {
  3889         {
  3860         iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__);
  3890 		CServerParams* serverParams = CServerParams::NewL();
  3861         hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
  3891 		CleanupStack::PushL(serverParams);
  3862         CleanupStack::PushL(hslpAdress);
  3892 		
  3863         hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());
  3893 		if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound )
  3864         CleanupStack::Pop(hslpAdress);	
  3894 			{
  3865 
  3895 	        iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__);
  3866         }
  3896 	        hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
  3867     CleanupStack::PushL(hslpAdress);
  3897 	        CleanupStack::PushL(hslpAdress);
       
  3898 	        hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());
       
  3899 	        CleanupStack::Pop(hslpAdress);	
       
  3900 			}
       
  3901 		else
       
  3902 			{
       
  3903 			iTrace->Trace(_L("Default HSLP"), KTraceFileName, __LINE__);
       
  3904 			TInt64 slpId;
       
  3905 			TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable;
       
  3906 			HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen);
       
  3907 			HBufC* iapName = HBufC::NewL(KMaxIAPLen);
       
  3908 			CleanupStack::PushL(serverAddr);
       
  3909 			CleanupStack::PushL(iapName);
       
  3910 			serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable);
       
  3911 			hslpAdress = HBufC8::NewL(serverAddr->Length());
       
  3912 			hslpAdress->Des().Copy(*serverAddr);
       
  3913 		
       
  3914 			CleanupStack::PopAndDestroy(iapName);
       
  3915 			CleanupStack::PopAndDestroy(serverAddr);
       
  3916 			}
       
  3917 		CleanupStack::PopAndDestroy(serverParams);
       
  3918 
       
  3919         }
  3868 
  3920 
  3869     delete iSuplState;
  3921     delete iSuplState;
  3870     iSuplState = NULL;
  3922     iSuplState = NULL;
  3871 
  3923 
       
  3924     CleanupStack::PushL(hslpAdress);
  3872     if(setStatusCode)
  3925     if(setStatusCode)
  3873         {
  3926         {
  3874         iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress);		
  3927         iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress);		
  3875         }
  3928         }
  3876     else
  3929     else
  4388                     	hslpAdress = HBufC8::NewL(iHSLPAddress.Length());
  4441                     	hslpAdress = HBufC8::NewL(iHSLPAddress.Length());
  4389                     	hslpAdress->Des().Copy(iHSLPAddress);
  4442                     	hslpAdress->Des().Copy(iHSLPAddress);
  4390                     	}
  4443                     	}
  4391                 	else if(len ==0)
  4444                 	else if(len ==0)
  4392                     	{
  4445                     	{
  4393                     	iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__);
  4446 						CServerParams* serverParams = CServerParams::NewL();
  4394                     	hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
  4447 						CleanupStack::PushL(serverParams);
  4395                     	CleanupStack::PushL(hslpAdress);
  4448 					
  4396                     	hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());	
  4449 						if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound )
  4397                     	CleanupStack::Pop(hslpAdress);
  4450 							{
       
  4451                             iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__);
       
  4452                             hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
       
  4453                             hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());	
       
  4454 							}
       
  4455 						else
       
  4456 							{
       
  4457 							iTrace->Trace(_L("Sending End with ver for Default HSLP"), KTraceFileName, __LINE__);
       
  4458 							TInt64 slpId;
       
  4459             				TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable;
       
  4460 							HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen);
       
  4461 							HBufC* iapName = HBufC::NewL(KMaxIAPLen);
       
  4462 							CleanupStack::PushL(serverAddr);
       
  4463 							CleanupStack::PushL(iapName);
       
  4464 							serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable);
       
  4465 							hslpAdress = HBufC8::NewL(serverAddr->Length());
       
  4466 							hslpAdress->Des().Copy(*serverAddr);
       
  4467 			
       
  4468 							CleanupStack::PopAndDestroy(iapName);
       
  4469 							CleanupStack::PopAndDestroy(serverAddr);
       
  4470 							}
       
  4471 						CleanupStack::PopAndDestroy(serverParams);
  4398                     	}
  4472                     	}
  4399 
  4473 
  4400                 CleanupStack::PushL(hslpAdress);
  4474                     delete iSuplState;
  4401                 ServerAddressCheckForSuplInitL();
  4475                     iSuplState = NULL;
  4402                 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress);		
  4476                     CleanupStack::PushL(hslpAdress);
  4403                 CleanupStack::PopAndDestroy(hslpAdress);
  4477                     ServerAddressCheckForSuplInitL();
  4404 
  4478                     iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress);		
  4405                 // Set the SessionId.
  4479                     CleanupStack::PopAndDestroy(hslpAdress);
  4406                 iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SLP Session ID"), KTraceFileName, __LINE__);
  4480 
  4407                 UpdateSLPSessionIDL(SessionID);
  4481                     // Set the SessionId.
  4408 
  4482                     iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SLP Session ID"), KTraceFileName, __LINE__);
  4409                 iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SET Session ID"), KTraceFileName, __LINE__);
  4483                     UpdateSLPSessionIDL(SessionID);
  4410                 UpdateSETSessionIDL(SessionID);
  4484     
  4411                 iSuplState->SetMsgStateObserver(this);
  4485                     iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SET Session ID"), KTraceFileName, __LINE__);
  4412                 iSuplState->GenerateMessageL();
  4486                     UpdateSETSessionIDL(SessionID);
  4413                 iSuplSessionState = ESUPL_GENERATE;
  4487                     iSuplState->SetMsgStateObserver(this);
  4414                             }
  4488                     iSuplState->GenerateMessageL();
  4415                         else
  4489                     iSuplSessionState = ESUPL_GENERATE;
  4416                             {                                
  4490                     }
  4417 					        iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl);		
  4491                 else
  4418 						    UpdateSLPSessionIDL(SessionID);
  4492                     {                                
  4419 						    UpdateSETSessionIDL(SessionID);
  4493                     iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl);		
  4420 						    iSuplState->SetMsgStateObserver(this);
  4494                     UpdateSLPSessionIDL(SessionID);
  4421                             iRequestType = ESUPL_INVALID_SESSION;
  4495                     UpdateSETSessionIDL(SessionID);
  4422 						    iSuplSessionState = ESUPL_GENERATE;
  4496                     iSuplState->SetMsgStateObserver(this);
  4423 						    iSuplState->GenerateMessageL();
  4497                     iRequestType = ESUPL_INVALID_SESSION;
  4424                             }
  4498                     iSuplSessionState = ESUPL_GENERATE;
  4425 
  4499                     iSuplState->GenerateMessageL();
       
  4500                     }
  4426                 } 
  4501                 } 
  4427             else 							
  4502             else 							
  4428                 {
  4503                 {
  4429                 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl);
  4504                 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl);
  4430                 iSuplSessionState = ESUPL_ENCODE;
  4505                 iSuplSessionState = ESUPL_ENCODE;