locationsystemui/locationsysui/locsuplsettingsui/src/locsuplserverlbmodel.cpp
branchRCL_3
changeset 49 10852b179f64
parent 0 667063e416a2
equal deleted inserted replaced
47:fce0ae2e4223 49:10852b179f64
    21 #include <locsuplsettingsui.rsg>
    21 #include <locsuplsettingsui.rsg>
    22 #include <StringLoader.h>
    22 #include <StringLoader.h>
    23 #include <epos_csuplsettings.h>
    23 #include <epos_csuplsettings.h>
    24 #include <epos_csuplsettingparams.h>
    24 #include <epos_csuplsettingparams.h>
    25 #include <epos_csuplsettingsconstants.h>
    25 #include <epos_csuplsettingsconstants.h>
       
    26 #include <bldvariant.hrh>
       
    27 #include <featmgr.h>
    26 
    28 
    27 // User Include
    29 // User Include
    28 #include "locsuplserverlbmodel.h"
    30 #include "locsuplserverlbmodel.h"
    29 #include "locsuplsettingsuiengine.h"
    31 #include "locsuplsettingsuiengine.h"
    30 #include "locsupldebug.h"
    32 #include "locsupldebug.h"
    31 		  					   	  
    33 		  					   	  
    32 // Constants
    34 // Constants
    33 
    35 
    34 const TInt KMaxConversionBufferLength 	= 0x200;
    36 const TInt KMaxConversionBufferLength 	= 0x200;
    35 const TInt KServerEntryGranularity		= 10;
    37 const TInt KServerEntryGranularity		= 10;
       
    38 const TInt KMaxServerAddressLength = 255;
    36 
    39 
    37 
    40 
    38 // ========================= MEMBER FUNCTIONS ================================
    41 // ========================= MEMBER FUNCTIONS ================================
    39 
    42 
    40 // ---------------------------------------------------------------------------
    43 // ---------------------------------------------------------------------------
   202 //
   205 //
   203 // ---------------------------------------------------------------------------
   206 // ---------------------------------------------------------------------------
   204 //	    
   207 //	    
   205 void CLocSUPLServerLBModel::UpdateSlpIdsL()
   208 void CLocSUPLServerLBModel::UpdateSlpIdsL()
   206 	{
   209 	{
   207 	DEBUG( + CLocSUPLServerLBModel::CollectSlpIdsL );
   210 	DEBUG( + CLocSUPLServerLBModel::UpdateSlpIdsL );
   208 
   211 
   209 	iSlpIdList.Reset();
   212 	iSlpIdList.Reset();
   210 	iSlpAddressList.ResetAndDestroy();
   213 	iSlpAddressList.ResetAndDestroy();
   211 	iEnableFlagList.Reset();
   214 	iEnableFlagList.Reset();
   212 
   215 
       
   216 	TBool displayImsiAddress = FeatureManager::FeatureSupported(KFeatureIdFfSuplImsiGeneratedAddressDisplay);
       
   217 
       
   218 
   213 	if( iEngine.SlpCount() > 0 )
   219 	if( iEngine.SlpCount() > 0 )
   214 		{
   220 		{
   215 		RPointerArray< CServerParams > 	serverList;
   221 		RPointerArray< CServerParams > 	serverList;
   216 		
   222 		
   217 		// Get all server entries
   223 		// Get all server entries
   218 		iEngine.GetAllSlpL( serverList );		
   224 		iEngine.GetAllSlpL( serverList );		
   219 		
   225 		
   220 		for( TInt i = 0; i < serverList.Count() ; i++ )
   226 		TBuf<KMaxServerAddressLength> imsiAddress;
       
   227 		iEngine.GenerateHslpAddressFromImsi(imsiAddress);		
       
   228 		
       
   229 		TInt serverCount = 	serverList.Count();
       
   230 		
       
   231 		for( TInt i = 0; i < serverCount ; i++ )
   221 			{
   232 			{
   222 		    TInt64 slpId;
   233 		    TInt64 slpId;
   223 		    HBufC* hslpAddr = HBufC::NewL( KMaxHSLPAddrLen );    
   234 		    HBufC* hslpAddr = HBufC::NewLC( KMaxHSLPAddrLen );    
   224 		    HBufC* iapName 	= HBufC::NewL( KMaxIAPLen );
   235 		    HBufC* iapName 	= HBufC::NewLC( KMaxIAPLen );
   225 		    TBool enabledFlag, simChangeFlag, usageInHomeNwFlag, editFlag;    
   236 		    TBool enabledFlag, simChangeFlag, usageInHomeNwFlag, editFlag;    
   226 		    		    
   237 		    		    
   227 		    TInt errParams = serverList[i]->Get(
   238 		    TInt errParams = serverList[i]->Get(
   228 		    							slpId, 
   239 		    							slpId, 
   229 		    							hslpAddr->Des(), 
   240 		    							hslpAddr->Des(), 
   231 		    							enabledFlag, 
   242 		    							enabledFlag, 
   232 		    							simChangeFlag, 
   243 		    							simChangeFlag, 
   233 		    							usageInHomeNwFlag, 
   244 		    							usageInHomeNwFlag, 
   234 		    							editFlag
   245 		    							editFlag
   235 		    						);
   246 		    						);
       
   247 		    						
       
   248 		    						
       
   249 		   			
   236 		    if ( errParams != KErrNone )
   250 		    if ( errParams != KErrNone )
   237 		        {
   251 		        {
   238 		        // Error has occured 
   252 		         	User::Leave(errParams);
   239 		        }  
   253 		        }
   240 			
   254 		        	       
       
   255 			if ( displayImsiAddress || imsiAddress.Compare(hslpAddr->Des()) ) // Flag is true->Show IMSI server too, not otherwise!
       
   256 			{
   241 			iSlpIdList.Append( slpId );
   257 			iSlpIdList.Append( slpId );
   242 			iSlpAddressList.Append( hslpAddr->AllocL() );
   258 			iSlpAddressList.Append( hslpAddr->AllocL() );
   243 			iEnableFlagList.Append( enabledFlag );
   259 			iEnableFlagList.Append( enabledFlag );
       
   260 			}
   244 			
   261 			
   245 			delete hslpAddr;
   262 			CleanupStack::PopAndDestroy(2);
   246 			delete iapName;
       
   247 			}
   263 			}
   248 		serverList.ResetAndDestroy();
   264 		serverList.ResetAndDestroy();
   249 		serverList.Close();		
   265 		serverList.Close();		
   250 		}	
   266 		}	
   251 	DEBUG( - CLocSUPLServerLBModel::CollectSlpIdsL );
   267 	DEBUG( - CLocSUPLServerLBModel::UpdateSlpIdsL );
   252 	}        
   268 	}        
   253     
   269     
   254 // ---------------------------------------------------------------------------
   270 // ---------------------------------------------------------------------------
   255 // CLocSUPLServerLBModel::SlpIds()
   271 // CLocSUPLServerLBModel::SlpIds()
   256 // returns server id array
   272 // returns server id array