supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplsession2.cpp
branchRCL_3
changeset 16 6fcbaa43369c
parent 4 42de37ce7ce4
child 24 9c303455e256
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplsession2.cpp	Mon Mar 15 12:42:19 2010 +0200
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplsession2.cpp	Wed Mar 31 22:18:21 2010 +0300
@@ -90,6 +90,7 @@
 #include "epos_omasuplconfigurationkeys.h"
 #include "epos_csuplsettingparams.h"
 #include "epos_comasuplasnbase.h"
+#include "epos_csuplsettingsconstants.h"
 
 
 _LIT(KTraceFileName,"SUPL_OMA_SESSION::EPos_COMASuplSession2.cpp");
@@ -1718,7 +1719,8 @@
     TOMASuplUtcTime UtcTime;
     TOMASuplPositionEstimate PosEstimate;
     TDateTime TimeStamp;
-    TInt ZoneCode,Zone,altitude,AltitudeUncertainty, HorizontalAccuracy;
+    TInt ZoneCode,Zone,altitude, HorizontalAccuracy;
+	TInt AltitudeUncertainty = 0;
     TOMASuplAltitudeInfo AltitudeInfo;
     TInt latitude,longitude;
     TOMASuplPositionEstimate::TOMASuplLatitudeSign LatSign;
@@ -1902,7 +1904,8 @@
     TOMASuplUtcTime UtcTime;
     TOMASuplPositionEstimate PosEstimate;
     TDateTime TimeStamp;
-    TInt ZoneCode,Zone,altitude,AltitudeUncertainty, HorizontalAccuracy;
+    TInt ZoneCode,Zone,altitude, HorizontalAccuracy;
+	TInt AltitudeUncertainty = 0;
     TOMASuplAltitudeInfo AltitudeInfo;
     TInt latitude,longitude;
     TOMASuplPositionEstimate::TOMASuplLatitudeSign LatSign;
@@ -2222,12 +2225,35 @@
 
             else if(len ==0)
                 {
-                iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__);
-                hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
-                CleanupStack::PushL(hslpAdress);
-                hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());	
-                CleanupStack::Pop(hslpAdress);						
+                CServerParams* serverParams = CServerParams::NewL();
+                CleanupStack::PushL(serverParams);
+    
+                if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound )
+                    {
+                    iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__);
+                    hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
+                    hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());	
+                    }
+                else
+                    {
+                    iTrace->Trace(_L("Sending End with ver for Default HSLP"), KTraceFileName, __LINE__);
+                    TInt64 slpId;
+                    TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable;
+                    HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen);
+                    HBufC* iapName = HBufC::NewL(KMaxIAPLen);
+                    CleanupStack::PushL(serverAddr);
+                    CleanupStack::PushL(iapName);
+                    serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable);
+                    hslpAdress = HBufC8::NewL(serverAddr->Length());
+                    hslpAdress->Des().Copy(*serverAddr);
+    
+                    CleanupStack::PopAndDestroy(iapName);
+                    CleanupStack::PopAndDestroy(serverAddr);
+                    }
+                CleanupStack::PopAndDestroy(serverParams);
                 }
+            delete iSuplState;
+            iSuplState=NULL;
             CleanupStack::PushL(hslpAdress);
             iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress);		
             CleanupStack::PopAndDestroy(hslpAdress);
@@ -3857,11 +3883,34 @@
 
     else if(len ==0)
         {
-        iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__);
-        hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
-        CleanupStack::PushL(hslpAdress);
-        hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());
-        CleanupStack::Pop(hslpAdress);	
+		CServerParams* serverParams = CServerParams::NewL();
+		CleanupStack::PushL(serverParams);
+		
+		if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound )
+			{
+	        iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__);
+	        hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
+	        CleanupStack::PushL(hslpAdress);
+	        hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());
+	        CleanupStack::Pop(hslpAdress);	
+			}
+		else
+			{
+			iTrace->Trace(_L("Default HSLP"), KTraceFileName, __LINE__);
+			TInt64 slpId;
+			TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable;
+			HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen);
+			HBufC* iapName = HBufC::NewL(KMaxIAPLen);
+			CleanupStack::PushL(serverAddr);
+			CleanupStack::PushL(iapName);
+			serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable);
+			hslpAdress = HBufC8::NewL(serverAddr->Length());
+			hslpAdress->Des().Copy(*serverAddr);
+		
+			CleanupStack::PopAndDestroy(iapName);
+			CleanupStack::PopAndDestroy(serverAddr);
+			}
+		CleanupStack::PopAndDestroy(serverParams);
 
         }
     CleanupStack::PushL(hslpAdress);
@@ -4390,13 +4439,36 @@
                     	}
                 	else if(len ==0)
                     	{
-                    	iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__);
-                    	hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
-                    	CleanupStack::PushL(hslpAdress);
-                    	hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());	
-                    	CleanupStack::Pop(hslpAdress);
+						CServerParams* serverParams = CServerParams::NewL();
+						CleanupStack::PushL(serverParams);
+					
+						if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound )
+							{
+	                    	iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__);
+	                    	hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length());
+	                    	hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi());	
+							}
+							else
+							{
+							iTrace->Trace(_L("Sending End with ver for Default HSLP"), KTraceFileName, __LINE__);
+							TInt64 slpId;
+            				TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable;
+							HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen);
+							HBufC* iapName = HBufC::NewL(KMaxIAPLen);
+							CleanupStack::PushL(serverAddr);
+							CleanupStack::PushL(iapName);
+							serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable);
+							hslpAdress = HBufC8::NewL(serverAddr->Length());
+							hslpAdress->Des().Copy(*serverAddr);
+			
+							CleanupStack::PopAndDestroy(iapName);
+							CleanupStack::PopAndDestroy(serverAddr);
+							}
+						CleanupStack::PopAndDestroy(serverParams);
                     	}
 
+			    delete iSuplState;
+			    iSuplState = NULL;
                 CleanupStack::PushL(hslpAdress);
                 ServerAddressCheckForSuplInitL();
                 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress);