supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplfallbackhandler.cpp
branchRCL_3
changeset 23 5944cae565c9
parent 0 667063e416a2
child 24 9c303455e256
equal deleted inserted replaced
19:d6e4203b7ebe 23:5944cae565c9
    40 // COMASuplFallBackHandler::COMASuplFallBackHandler
    40 // COMASuplFallBackHandler::COMASuplFallBackHandler
    41 // C++ constructor can NOT contain any code, that might leave.
    41 // C++ constructor can NOT contain any code, that might leave.
    42 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    43 //
    43 //
    44 COMASuplFallBackHandler::COMASuplFallBackHandler(CSuplSettingsInternal& aSettings):
    44 COMASuplFallBackHandler::COMASuplFallBackHandler(CSuplSettingsInternal& aSettings):
    45 												iSuplSettings(aSettings)
    45 												iSuplSettings(aSettings),
       
    46 												iAttemptedBackupServer(EFalse)
    46     {
    47     {
    47 
    48 
    48     }
    49     }
    49 
    50 
    50 // -----------------------------------------------------------------------------
    51 // -----------------------------------------------------------------------------
   111 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
   112 //    TODO: Merge if conditions...
   113 //    TODO: Merge if conditions...
   113 TInt COMASuplFallBackHandler::GetNextSLPAddressL(TInt64& aSLPId, TDes& aHslpToBeUsedAddress,TDes& aIAPName,TBool& aTls,
   114 TInt COMASuplFallBackHandler::GetNextSLPAddressL(TInt64& aSLPId, TDes& aHslpToBeUsedAddress,TDes& aIAPName,TBool& aTls,
   114                                                  TBool& aPskTls,TInt aLastErrorCode,TBool& aIsIapDialogShown)
   115                                                  TBool& aPskTls,TInt aLastErrorCode,TBool& aIsIapDialogShown)
   115     {
   116     {
       
   117 	iTrace->Trace(_L("COMASuplFallBackHandler::GetNextSLPAddressL"),KTraceFileName, __LINE__);
       
   118 	
   116     _LIT(KFormatTxt,"%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); 
   119     _LIT(KFormatTxt,"%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); 
   117     
   120     
   118     TBuf<256> LogBuffer;
   121     TBuf<256> LogBuffer;
   119     
   122     
   120      if( aLastErrorCode != KErrNone)// If its KErrNone then its means server name is asked first time and no need for Tls failure check
   123      if( aLastErrorCode != KErrNone)// If its KErrNone then its means server name is asked first time and no need for Tls failure check
   158         
   161         
   159      	else
   162      	else
   160 	     	{
   163 	     	{
   161 	     	return KErrNotFound;
   164 	     	return KErrNotFound;
   162 	     	}  
   165 	     	}  
   163 	 	} 
   166 	 	}
       
   167 
       
   168 	//Check to see if the server list is empty.  If it is create the HSLP Address from the IMSI and use that
       
   169 	// as the server address.  This does not add the server to the list and this functionality should only
       
   170 	// be tried once
       
   171 	if(iSLPList->Count() <= 0 && (!iAttemptedBackupServer))
       
   172 		{
       
   173 		iTrace->Trace(_L("Going to create and use alternative HSLP Address from IMSI"),KTraceFileName, __LINE__);
       
   174 
       
   175 		iAttemptedBackupServer = ETrue;
       
   176 
       
   177 		//Generate the HSLP Address
       
   178 		GenerateHslpAddressFromIMSIL();
       
   179 
       
   180 		//Copy the generated address into the supplied function arguments
       
   181 		aHslpToBeUsedAddress.Copy(iGenratedHslpAddress);
       
   182 		aIAPName.Zero();   
       
   183 		aIAPName.Copy(iDefaultIAPName);
       
   184 		aTls = ETrue;
       
   185 		aPskTls = EFalse;
       
   186 		aIsIapDialogShown = ETrue;
       
   187 
       
   188 		iTrace->Trace(_L("Server being used:"),KTraceFileName, __LINE__);
       
   189 		LogBuffer.Copy(aHslpToBeUsedAddress);
       
   190 		iTrace->Trace(LogBuffer,KTraceFileName, __LINE__);
       
   191 
       
   192 		iTrace->Trace(_L("iap being used:"),KTraceFileName, __LINE__);
       
   193 		LogBuffer.Copy(aIAPName);
       
   194 		iTrace->Trace(LogBuffer,KTraceFileName, __LINE__);
       
   195 
       
   196 		return KErrNone;
       
   197 		}
   164     
   198     
   165     if( iSLPList->Count() <= 0 || iCurrentServerCounter >= iSLPList->Count() ) 
   199     if( iSLPList->Count() <= 0 || iCurrentServerCounter >= iSLPList->Count() ) 
   166         {
   200         {
   167         LogBuffer.Copy(_L("No more servers available..."));
   201         LogBuffer.Copy(_L("No more servers available..."));
   168         iTrace->Trace(LogBuffer,KTraceFileName, __LINE__); 				
   202         iTrace->Trace(LogBuffer,KTraceFileName, __LINE__);