Revision: 201017 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:36:36 +0300
branchRCL_3
changeset 23 5944cae565c9
parent 19 d6e4203b7ebe
child 24 9c303455e256
Revision: 201017 Kit: 201019
locsrv_plat/supl_settings_api/tsrc/group/bld.inf
supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplconnrequestor.h
supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplfallbackhandler.h
supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplconnrequestor.cpp
supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplfallbackhandler.cpp
supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplinitstate.cpp
supl/locationomasuplprotocolhandler/protocolhandlerver2/inc/epos_comasuplconnrequestor.h
supl/locationomasuplprotocolhandler/protocolhandlerver2/inc/epos_comasuplfallbackhandler.h
supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplconnrequestor.cpp
supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplfallbackhandler.cpp
supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplinitstate.cpp
supl/locationomasuplprotocolhandler/waplistener/src/epos_comasuplwaplistener.cpp
--- a/locsrv_plat/supl_settings_api/tsrc/group/bld.inf	Tue Apr 27 17:05:00 2010 +0300
+++ b/locsrv_plat/supl_settings_api/tsrc/group/bld.inf	Tue May 11 16:36:36 2010 +0300
@@ -39,10 +39,10 @@
 PRJ_TESTMMPFILES
 // NOTE: If using ARS requirements .mmp file operation should be done under this.
 // 'abld test build'
-//settingsapi_test.mmp
+settingsapi_test.mmp
 
 PRJ_MMPFILES
-settingsapi_test.mmp
+// settingsapi_test.mmp
 // Specify the .mmp files required for building the important component
 // releasables.
 //
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplconnrequestor.h	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplconnrequestor.h	Tue May 11 16:36:36 2010 +0300
@@ -50,7 +50,8 @@
 		  EConnecting,
 		  EConnectionDone,
 	      ESending,
-	      EInitilizeSetting
+	      EInitilizeSetting,
+		  EInitialState
 		};
 
 	public :  // Constructor 
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplfallbackhandler.h	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver1/inc/epos_comasuplfallbackhandler.h	Tue May 11 16:36:36 2010 +0300
@@ -151,6 +151,8 @@
   	    TTime iFallBackStartTime;
 
   	    TInt iAllowedFallBackTimerValue;
+		
+		TBool iAttemptedBackupServer;
       
 };
 
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplconnrequestor.cpp	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplconnrequestor.cpp	Tue May 11 16:36:36 2010 +0300
@@ -124,53 +124,61 @@
 //    
 void COMASuplConnRequestor::CreateConnectionL()
     {
-    TBuf<100> iapName;
+	if(!iIsSettingInitilized)
+        {
+		iState = EInitialState;
+        InitilizeSetting();
+        }
+    else
+        {
+		TBuf<100> iapName;
 		TBuf<128> buffer;
-    iState = EConnecting;  
+		iState = EConnecting;  
 		TBool isIapDialogShown = EFalse;
 		TInt errorCode = iFallBackHandler->GetNextSLPAddressL(iCurrentSLPId,iHostAddress,iapName,iTls,iPskTls,iLastConnectionError,isIapDialogShown);
 		
 		if(errorCode == KErrNone)
 			{
-				TBool ret = ConvertIAPNameToIdL(iapName,iIAPId);
-				if(!ret)
-					{
-						buffer.Copy(_L("No access point configured for "));
-						buffer.Append(iHostAddress);
-						iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
-						if( isIapDialogShown )
-						    {
-						    TInt err = iProtocolManager.LaunchSettingsUI(this,iHostAddress);
-						    if(err != KErrNone)
-                                {
-                                buffer.Copy(_L("Error in launching UI : "));
-                                buffer.AppendNum(err);
-                                iTrace->Trace(buffer,KTraceFileName, __LINE__);                 
-                                iHostAddress.Zero();
-                                iObserver.OperationCompleteL(err);
-                                }
-						        else
-						        iIapDialogShown = ETrue;
-						    }
-						
-						
-					}
-        else
-            {
-            iIsTimeoutDialogTimerStarted = EFalse;
-            iDialogTimer->Cancel();
-            buffer.Copy(_L("Connecting to "));
-            buffer.Append(iHostAddress);
-            iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
-            iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId);
-            OpenConnection();
-            }	
-        }
-    else
-        {
-        iHostAddress.Zero();
-        iObserver.OperationCompleteL(errorCode);
-        }
+			TBool ret = ConvertIAPNameToIdL(iapName,iIAPId);
+			if(!ret)
+				{
+					buffer.Copy(_L("No access point configured for "));
+					buffer.Append(iHostAddress);
+					iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
+					if( isIapDialogShown )
+						{
+						TInt err = iProtocolManager.LaunchSettingsUI(this,iHostAddress);
+						if(err != KErrNone)
+							{
+							buffer.Copy(_L("Error in launching UI : "));
+							buffer.AppendNum(err);
+							iTrace->Trace(buffer,KTraceFileName, __LINE__);                 
+							iHostAddress.Zero();
+							iObserver.OperationCompleteL(err);
+							}
+							else
+							iIapDialogShown = ETrue;
+						}
+					
+					
+				}
+			else
+	            {
+	            iIsTimeoutDialogTimerStarted = EFalse;
+	            iDialogTimer->Cancel();
+	            buffer.Copy(_L("Connecting to "));
+	            buffer.Append(iHostAddress);
+	            iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
+	            iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId);
+	            OpenConnection();
+	            }	
+			}
+	    else
+	        {
+	        iHostAddress.Zero();
+	        iObserver.OperationCompleteL(errorCode);
+	        }
+		}
     }
 
 // -----------------------------------------------------------------------------
@@ -231,6 +239,7 @@
         }
     else
         {
+		iState = EInitilizeSetting;
         InitilizeSetting();
         }
     }
@@ -278,6 +287,15 @@
 
     switch(iState)
         {
+		
+		case EInitialState:
+            {
+            iIsSettingInitilized = ETrue;
+            iTrace->Trace(_L("Setting API Initilizing Completed..."), KTraceFileName, __LINE__);
+            CreateConnectionL();
+            
+            break;
+            }
 
         case  EConnecting:
             {
@@ -380,7 +398,6 @@
 void COMASuplConnRequestor::InitilizeSetting()
     {
     iTrace->Trace(_L("Intilizing Setting API..."), KTraceFileName, __LINE__); 				
-    iState = EInitilizeSetting;
     iSuplSettings->Initialize(iStatus);
     SetActive();
     }
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplfallbackhandler.cpp	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplfallbackhandler.cpp	Tue May 11 16:36:36 2010 +0300
@@ -42,7 +42,8 @@
 // -----------------------------------------------------------------------------
 //
 COMASuplFallBackHandler::COMASuplFallBackHandler(CSuplSettingsInternal& aSettings):
-												iSuplSettings(aSettings)
+												iSuplSettings(aSettings),
+												iAttemptedBackupServer(EFalse)
     {
 
     }
@@ -113,6 +114,8 @@
 TInt COMASuplFallBackHandler::GetNextSLPAddressL(TInt64& aSLPId, TDes& aHslpToBeUsedAddress,TDes& aIAPName,TBool& aTls,
                                                  TBool& aPskTls,TInt aLastErrorCode,TBool& aIsIapDialogShown)
     {
+	iTrace->Trace(_L("COMASuplFallBackHandler::GetNextSLPAddressL"),KTraceFileName, __LINE__);
+	
     _LIT(KFormatTxt,"%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); 
     
     TBuf<256> LogBuffer;
@@ -160,7 +163,38 @@
 	     	{
 	     	return KErrNotFound;
 	     	}  
-	 	} 
+	 	}
+
+	//Check to see if the server list is empty.  If it is create the HSLP Address from the IMSI and use that
+	// as the server address.  This does not add the server to the list and this functionality should only
+	// be tried once
+	if(iSLPList->Count() <= 0 && (!iAttemptedBackupServer))
+		{
+		iTrace->Trace(_L("Going to create and use alternative HSLP Address from IMSI"),KTraceFileName, __LINE__);
+
+		iAttemptedBackupServer = ETrue;
+
+		//Generate the HSLP Address
+		GenerateHslpAddressFromIMSIL();
+
+		//Copy the generated address into the supplied function arguments
+		aHslpToBeUsedAddress.Copy(iGenratedHslpAddress);
+		aIAPName.Zero();   
+		aIAPName.Copy(iDefaultIAPName);
+		aTls = ETrue;
+		aPskTls = EFalse;
+		aIsIapDialogShown = ETrue;
+
+		iTrace->Trace(_L("Server being used:"),KTraceFileName, __LINE__);
+		LogBuffer.Copy(aHslpToBeUsedAddress);
+		iTrace->Trace(LogBuffer,KTraceFileName, __LINE__);
+
+		iTrace->Trace(_L("iap being used:"),KTraceFileName, __LINE__);
+		LogBuffer.Copy(aIAPName);
+		iTrace->Trace(LogBuffer,KTraceFileName, __LINE__);
+
+		return KErrNone;
+		}
     
     if( iSLPList->Count() <= 0 || iCurrentServerCounter >= iSLPList->Count() ) 
         {
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplinitstate.cpp	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplinitstate.cpp	Tue May 11 16:36:36 2010 +0300
@@ -988,17 +988,6 @@
 				{
 						iTrace->Trace(_L("Real: Supl 1.0..APE Flag is OFF..."), KTraceFileName, __LINE__); 
 				}
-				  
-  iRequestIDFeatureFlag = ETrue;
-	
-	if (iRequestIDFeatureFlag)
-        {
-						iTrace->Trace(_L("Supl 1.0..APE Centric Arch Feature Flag is ON..."), KTraceFileName, __LINE__); 
-        }   
-	else
-				{
-						iTrace->Trace(_L("Supl 1.0..APE Centric Arch Feature Flag is OFF..."), KTraceFileName, __LINE__); 
-				}
 	
 }
 //  End of File
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver2/inc/epos_comasuplconnrequestor.h	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver2/inc/epos_comasuplconnrequestor.h	Tue May 11 16:36:36 2010 +0300
@@ -50,7 +50,8 @@
 		  EConnecting,
 		  EConnectionDone,
 	      ESending,
-	      EInitilizeSetting
+	      EInitilizeSetting,
+		  EInitialState
 		};
 
 	public :  // Constructor 
@@ -299,6 +300,8 @@
             TBool iIapDlgTimerExpired;
             
             TBool iIsTimeoutDialogTimerStarted;
+			
+			TBool iTriggerSession;
 
 };
 
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver2/inc/epos_comasuplfallbackhandler.h	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver2/inc/epos_comasuplfallbackhandler.h	Tue May 11 16:36:36 2010 +0300
@@ -153,6 +153,8 @@
       TTime iFallBackStartTime;
       
       TInt iAllowedFallBackTimerValue;
+	  
+	  TBool iAttemptedBackupServer;
       
 };
 
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplconnrequestor.cpp	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplconnrequestor.cpp	Tue May 11 16:36:36 2010 +0300
@@ -50,7 +50,8 @@
     				 						 iObserver( aObserver),    				 						  
     				 						 iIapDialogShown(EFalse),
     				 						 iIapDlgTimerExpired(EFalse),    				 			            
-    				 			             iIsTimeoutDialogTimerStarted(EFalse)
+    				 			             iIsTimeoutDialogTimerStarted(EFalse),
+											 iTriggerSession(EFalse)
     {
 			
     }
@@ -124,6 +125,14 @@
 //    
 void COMASuplConnRequestor::CreateConnectionL(TBool aTriggerSession)
 	{
+	if(!iIsSettingInitilized)
+        {
+		iTriggerSession = aTriggerSession;
+		iState = EInitialState;
+        InitilizeSetting();
+        }
+    else
+        {
 		TBuf<100> iapName;
 		TBuf<128> buffer;
 		iState = EConnecting;  
@@ -179,6 +188,7 @@
 				iHostAddress.Zero();
 				iObserver.OperationCompleteL(errorCode);
 			}
+		}
 	}
 
 // -----------------------------------------------------------------------------
@@ -237,9 +247,10 @@
 				SetActive();
 			}
 		}
-		else
+	else
 		{
-			InitilizeSetting();
+		iState = EInitilizeSetting;
+		InitilizeSetting();
 		}
 	}
     
@@ -284,6 +295,15 @@
     	
     	switch(iState)
     		{
+			
+			case EInitialState:
+	            {
+	            iIsSettingInitilized = ETrue;
+	            iTrace->Trace(_L("Setting API Initilizing Completed..."), KTraceFileName, __LINE__);
+	            CreateConnectionL(iTriggerSession);
+	            
+	            break;
+	            }
     		
 			case  EConnecting:
 				{
@@ -386,7 +406,6 @@
 void COMASuplConnRequestor::InitilizeSetting()
 	{
 			iTrace->Trace(_L("Intilizing Setting API..."), KTraceFileName, __LINE__); 				
-			iState = EInitilizeSetting;
 			iSuplSettings->Initialize(iStatus);
 			SetActive();
 	}
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplfallbackhandler.cpp	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplfallbackhandler.cpp	Tue May 11 16:36:36 2010 +0300
@@ -42,7 +42,8 @@
 // -----------------------------------------------------------------------------
 //
 COMASuplFallBackHandler::COMASuplFallBackHandler(CSuplSettingsInternal& aSettings):
-												iSuplSettings(aSettings)
+												iSuplSettings(aSettings),
+												iAttemptedBackupServer(EFalse)
     {
 
     }
@@ -112,6 +113,8 @@
 TInt COMASuplFallBackHandler::GetNextSLPAddressL(TInt64& aSLPId, TDes& aHslpToBeUsedAddress,TDes& aIAPName,TBool& aTls,
                                                  TBool& aPskTls,TInt aLastErrorCode,TBool& aIsIapDialogShown)
     {
+	iTrace->Trace(_L("COMASuplFallBackHandler::GetNextSLPAddressL"),KTraceFileName, __LINE__);
+	
         _LIT(KFormatTxt,"%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); 
         
         TBuf<256> LogBuffer;
@@ -159,7 +162,38 @@
 	     	{
 	     	return KErrNotFound;
 	     	}  
-	 	} 
+	 	}
+		
+		//Check to see if the server list is empty.  If it is create the HSLP Address from the IMSI and use that
+		// as the server address.  This does not add the server to the list and this functionality should only
+		// be tried once
+		if(iSLPList->Count() <= 0 && (!iAttemptedBackupServer))
+			{
+			iTrace->Trace(_L("Going to create and use alternative HSLP Address from IMSI"),KTraceFileName, __LINE__);
+
+			iAttemptedBackupServer = ETrue;
+
+			//Generate the HSLP Address
+			GenerateHslpAddressFromIMSIL();
+
+			//Copy the generated address into the supplied function arguments
+			aHslpToBeUsedAddress.Copy(iGenratedHslpAddress);
+			aIAPName.Zero();   
+			aIAPName.Copy(iDefaultIAPName);
+			aTls = ETrue;
+			aPskTls = EFalse;
+			aIsIapDialogShown = ETrue;
+
+			iTrace->Trace(_L("Server being used:"),KTraceFileName, __LINE__);
+			LogBuffer.Copy(aHslpToBeUsedAddress);
+			iTrace->Trace(LogBuffer,KTraceFileName, __LINE__);
+
+			iTrace->Trace(_L("iap being used:"),KTraceFileName, __LINE__);
+			LogBuffer.Copy(aIAPName);
+			iTrace->Trace(LogBuffer,KTraceFileName, __LINE__);
+
+			return KErrNone;
+			}
 	 	
         if( iSLPList->Count() <= 0 || iCurrentServerCounter >= iSLPList->Count() ) 
             {
--- a/supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplinitstate.cpp	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplinitstate.cpp	Tue May 11 16:36:36 2010 +0300
@@ -1112,7 +1112,6 @@
  	
 	iRequestIDFeatureFlag = FeatureManager::FeatureSupported(KSUPLAPECentricArchSupport);
     FeatureManager::UnInitializeLib();
-    iRequestIDFeatureFlag = EFalse;
 	
 	if (iRequestIDFeatureFlag)
         {
--- a/supl/locationomasuplprotocolhandler/waplistener/src/epos_comasuplwaplistener.cpp	Tue Apr 27 17:05:00 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/waplistener/src/epos_comasuplwaplistener.cpp	Tue May 11 16:36:36 2010 +0300
@@ -307,8 +307,12 @@
 	TPtrC8 field;
 	TBool isHeaderPresent = aPushMsg->GetBinaryHeaderField(EHttpContentType, field);
 
-    iTrace->Trace( _L( "Received Binary Content Type is:" ), KTraceFileName, __LINE__ );
+#ifdef _DEBUG
+	//Log the received message
+	iTrace->Trace( _L( "Received Binary Content Type is:" ), KTraceFileName, __LINE__ );
     PrintHex(field, __LINE__);
+#endif
+
 	if( isHeaderPresent )
 	{
 		    iTrace->Trace( _L( "Binary Content type present..." ), KTraceFileName, __LINE__ );
@@ -328,7 +332,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// COMASuplWapListener::CheckBinaryContentType
+// COMASuplWapListener::PrintHex
 // 
 // -----------------------------------------------------------------------------
 //
@@ -338,8 +342,24 @@
 			TBuf<2> buff;
 			_LIT16(KFormat1,"%02x");
 			TInt len = aBuffer.Length();
+			
+			//The buffer is usually larger than what can be logged in a single line in the log file.  As such this should only attempt
+			// to log 27 hex blocks to each log line.
+			const TInt KNumberOfBlocks = 27;
+			TInt blockNumber = KNumberOfBlocks;
+			
 			for(TInt i = 0 ; i <len; i++)
 				{
+					//Check to see if the buffer should be logged and then emptied
+                    if(i == blockNumber)
+                        {
+                        //Trace the buffer as it currently is
+                        iTrace->Trace(buffer, KTraceFileName, aLine);
+                        //Reset the buffer for the next log line
+                        buffer.Zero();
+                        blockNumber += KNumberOfBlocks;
+                        }
+					
 					buff.Zero();
 					buff.Format(KFormat1,aBuffer[i]);
 					buffer.Append(buff);