locationsystemui/locationsysui/locsuplsettingsui/src/locsuplsettingsadapter.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Adapter to the SUPL Settings API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // System Includes
       
    20 #include <epos_csuplsettings.h>
       
    21 #include <locsuplsettingsui.rsg>
       
    22 #include <StringLoader.h>
       
    23 
       
    24 // User Includes
       
    25 #include "locsuplsettingsadapter.h"
       
    26 #include "locsuplsettingsadapterobserver.h"
       
    27 #include "locsuplsettingssessionobserver.h"
       
    28 #include "locsupldebug.h"
       
    29 
       
    30 
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // Private Constructor
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CLocSUPLSettingsAdapter::CLocSUPLSettingsAdapter( 
       
    37                             MLocSUPLSettingsAdapterObserver&    aObserver )
       
    38 		:CActive( EPriorityStandard ),
       
    39 		iObserver( aObserver )
       
    40     {
       
    41     }
       
    42  
       
    43 // ---------------------------------------------------------------------------
       
    44 // Destructor
       
    45 // ---------------------------------------------------------------------------
       
    46 //    
       
    47 CLocSUPLSettingsAdapter::~CLocSUPLSettingsAdapter()
       
    48     {
       
    49 	DEBUG( + CLocSUPLSettingsAdapter::~CLocSUPLSettingsAdapter );	
       
    50     Cancel();
       
    51     
       
    52     if( iSUPLSettings )
       
    53         {
       
    54         iSUPLSettings->RemoveObserver();
       
    55         iSUPLSettings->RemoveSessionObserver();
       
    56         }
       
    57         
       
    58     delete iSUPLSettings;
       
    59     iSUPLSettings = NULL;
       
    60     
       
    61     delete iAutomatic;
       
    62     iAutomatic = NULL;
       
    63     
       
    64     delete iAutomaticatHome;
       
    65     iAutomaticatHome = NULL;
       
    66     
       
    67     delete iAsk;
       
    68     iAsk = NULL;
       
    69     
       
    70     delete iDisable;
       
    71     iDisable = NULL;
       
    72 	DEBUG( - CLocSUPLSettingsAdapter::~CLocSUPLSettingsAdapter );	
       
    73     } 
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CLocSUPLSettingsAdapter* CLocSUPLSettingsAdapter::NewL
       
    77 // Static Two phase contructor that instantiates the CLocSUPLSettingsAdapter
       
    78 // 
       
    79 // @param aObserver				    Observer to the SUPL settings adapter
       
    80 // @return CLocSUPLSettingsAdapter*	Reference to the object created
       
    81 // ---------------------------------------------------------------------------
       
    82 //    
       
    83 CLocSUPLSettingsAdapter* CLocSUPLSettingsAdapter::NewL(
       
    84                             MLocSUPLSettingsAdapterObserver&    aObserver )
       
    85     {
       
    86 	DEBUG( + CLocSUPLSettingsAdapter::NewL );	
       
    87     CLocSUPLSettingsAdapter* self = 
       
    88                 new ( ELeave ) CLocSUPLSettingsAdapter( aObserver );
       
    89     CleanupStack::PushL( self );
       
    90     self->ConstructL();
       
    91     CleanupStack::Pop( self );
       
    92 	DEBUG( - CLocSUPLSettingsAdapter::NewL );	
       
    93     return self;
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // void CLocSUPLSettingsAdapter::ConstructL
       
    98 // Second phase of the two phase constructor
       
    99 // ---------------------------------------------------------------------------
       
   100 // 
       
   101 void CLocSUPLSettingsAdapter::ConstructL()
       
   102     {
       
   103 	DEBUG( + CLocSUPLSettingsAdapter::ConstructL );	
       
   104     // Create the SUPL Settings
       
   105     iSUPLSettings = CSuplSettings::NewL();
       
   106     
       
   107     // Set the Observer for SUPL Settings
       
   108     iSUPLSettings->SetObserverL( *this );
       
   109     
       
   110     // Set the Observer for SUPL Sessions
       
   111     iSUPLSettings->SetSessionObserverL( *this );
       
   112     
       
   113     // Load the SUPL settings usage strings
       
   114     iAutomatic 			= StringLoader::LoadL( R_LOC_SUPL_AUTOMATIC );
       
   115     iAutomaticatHome 	= StringLoader::LoadL( R_LOC_SUPL_HOME_AUTOMATIC );
       
   116     iAsk 				= StringLoader::LoadL( R_LOC_SUPL_ASK );
       
   117     iDisable 			= StringLoader::LoadL( R_LOC_SUPL_DISABLED );
       
   118     
       
   119     CActiveScheduler::Add( this );
       
   120 	DEBUG( - CLocSUPLSettingsAdapter::ConstructL );	
       
   121     }           
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // void CLocSUPLSettingsAdapter::Initialize
       
   125 // Initializes the SUPL Settings API. This is an asynchronus call, the call
       
   126 // back for which is given through the observer
       
   127 // ---------------------------------------------------------------------------
       
   128 //
       
   129 void CLocSUPLSettingsAdapter::Initialize()
       
   130     {
       
   131 	DEBUG( + CLocSUPLSettingsAdapter::Initialize );	
       
   132     if( !IsActive())
       
   133         {
       
   134         iSUPLSettings->Initialize( iStatus );
       
   135         SetActive();
       
   136         }
       
   137 	DEBUG( - CLocSUPLSettingsAdapter::Initialize );	
       
   138     }
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // void CLocSUPLSettingsAdapter::CancelInitialize
       
   142 // Cancels the Initialization
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 void CLocSUPLSettingsAdapter::CancelInitialize()
       
   146     {
       
   147     Cancel();
       
   148     }
       
   149     
       
   150 // ---------------------------------------------------------------------------
       
   151 // void CLocSUPLSettingsAdapter::SetSuplUsageL
       
   152 // ---------------------------------------------------------------------------
       
   153 //       
       
   154 void CLocSUPLSettingsAdapter::SetSuplUsageL( 
       
   155             const CLocSUPLSettingsAdapter::TLocSuplUsage    aIndex )
       
   156     {
       
   157 	DEBUG( + CLocSUPLSettingsAdapter::SetSuplUsageL );	
       
   158     CSuplSettings::TSuplSettingsUsage value = CSuplSettings::ESuplUsageAlwaysAsk;
       
   159     switch ( aIndex )
       
   160         {
       
   161         case ELocSuplAutomatic:
       
   162             {
       
   163             value = CSuplSettings::ESuplUsageAutomatic;
       
   164             break;
       
   165             }
       
   166         case ELocSuplAutomaticatHome:
       
   167             {
       
   168             value = CSuplSettings::ESuplUsageHomeAutomatic;
       
   169             break;
       
   170             }
       
   171         case ELocSuplAlwaysAsk:
       
   172             {
       
   173             value = CSuplSettings::ESuplUsageAlwaysAsk;
       
   174             break;
       
   175             }
       
   176         case ELocSuplDisable:
       
   177             {
       
   178             value = CSuplSettings::ESuplUsageDisabled;
       
   179             break;
       
   180             }
       
   181         default:
       
   182             {
       
   183             User::Leave( KErrNotFound );
       
   184             break;    
       
   185             }
       
   186         }
       
   187 
       
   188     // Write back to the SUPL settings API
       
   189     TInt ret = iSUPLSettings->SetSuplUsage( value );            
       
   190             
       
   191     // If the Set failed, then Leave with the corresponding Error code
       
   192     if( ret )
       
   193         {
       
   194         User::Leave ( ret );
       
   195         }
       
   196 	DEBUG( - CLocSUPLSettingsAdapter::SetSuplUsageL );	
       
   197     }
       
   198 
       
   199 // ---------------------------------------------------------------------------
       
   200 // void CLocSUPLSettingsAdapter::GetSuplUsageL
       
   201 // ---------------------------------------------------------------------------
       
   202 //  
       
   203 void CLocSUPLSettingsAdapter::GetSuplUsageL( TDes&    aSuplUsage )
       
   204     {
       
   205 	DEBUG( + CLocSUPLSettingsAdapter::GetSuplUsageL );	
       
   206     CSuplSettings::TSuplSettingsUsage value = CSuplSettings::ESuplUsageAlwaysAsk;
       
   207     User::LeaveIfError( iSUPLSettings->GetSuplUsage( value ));
       
   208 
       
   209     switch ( value )
       
   210         {
       
   211         case CSuplSettings::ESuplUsageAutomatic:
       
   212             {
       
   213             if ( aSuplUsage.MaxLength() < iAutomatic->Des().Length())
       
   214                 {
       
   215                 User::Leave( KErrNoMemory );
       
   216                 }
       
   217             aSuplUsage.Copy( *iAutomatic );
       
   218             break;
       
   219             }
       
   220         case CSuplSettings::ESuplUsageHomeAutomatic:
       
   221             {
       
   222             if ( aSuplUsage.MaxLength() < iAutomaticatHome->Des().Length())
       
   223                 {
       
   224                 User::Leave( KErrNoMemory );
       
   225                 }
       
   226             aSuplUsage.Copy( *iAutomaticatHome );          
       
   227             break;
       
   228             }
       
   229         case CSuplSettings::ESuplUsageAlwaysAsk:
       
   230             {
       
   231             if ( aSuplUsage.MaxLength() < iAsk->Des().Length())
       
   232                 {
       
   233                 User::Leave( KErrNoMemory );
       
   234                 }            
       
   235             aSuplUsage.Copy( *iAsk );
       
   236             break;
       
   237             }
       
   238         case CSuplSettings::ESuplUsageDisabled:
       
   239             {
       
   240             if ( aSuplUsage.MaxLength() < iDisable->Des().Length())
       
   241                 {
       
   242                 User::Leave( KErrNoMemory );
       
   243                 }
       
   244             aSuplUsage.Copy( *iDisable );
       
   245             break;
       
   246             }
       
   247         default:
       
   248             {
       
   249             User::Leave( KErrNotSupported );
       
   250             break;
       
   251             }
       
   252         }
       
   253 	DEBUG( - CLocSUPLSettingsAdapter::GetSuplUsageL );	
       
   254     }
       
   255 
       
   256 // ---------------------------------------------------------------------------
       
   257 // TLocSuplUsage CLocSUPLSettingsAdapter::GetSuplUsage
       
   258 // ---------------------------------------------------------------------------
       
   259 // 
       
   260 TInt CLocSUPLSettingsAdapter::GetSuplUsage()
       
   261     {
       
   262 	DEBUG( + CLocSUPLSettingsAdapter::GetSuplUsage TInt );	
       
   263     CSuplSettings::TSuplSettingsUsage value = CSuplSettings::ESuplUsageAlwaysAsk;
       
   264     TInt error = iSUPLSettings->GetSuplUsage( value );
       
   265     if ( error )
       
   266         {
       
   267         // If there is an error then return the default value
       
   268         return CSuplSettings::ESuplUsageAlwaysAsk;
       
   269         }
       
   270 	DEBUG( - CLocSUPLSettingsAdapter::GetSuplUsage TInt );	
       
   271     return value;
       
   272     }
       
   273 
       
   274 // ---------------------------------------------------------------------------
       
   275 // TLocSuplUsage CLocSUPLSettingsAdapter::GetSuplUsageIndex
       
   276 // ---------------------------------------------------------------------------
       
   277 // 
       
   278 CLocSUPLSettingsAdapter::TLocSuplUsage CLocSUPLSettingsAdapter::GetSuplUsageIndex()
       
   279     {    
       
   280 	DEBUG( + CLocSUPLSettingsAdapter::GetSuplUsageIndex );	
       
   281     TLocSuplUsage index = ELocSuplAutomatic;
       
   282     CSuplSettings::TSuplSettingsUsage value = CSuplSettings::ESuplUsageAlwaysAsk;
       
   283     if ( iSUPLSettings->GetSuplUsage( value ))
       
   284         {
       
   285         // If there is an error then return the default value.
       
   286         return index;
       
   287         }
       
   288         
       
   289     switch ( value )
       
   290         {
       
   291         case CSuplSettings::ESuplUsageAutomatic:
       
   292             {
       
   293             index = ELocSuplAutomatic;
       
   294             break;
       
   295             }
       
   296         case CSuplSettings::ESuplUsageHomeAutomatic:
       
   297             {
       
   298             index = ELocSuplAutomaticatHome;         
       
   299             break;
       
   300             }
       
   301         case CSuplSettings::ESuplUsageAlwaysAsk:
       
   302             {
       
   303             index = ELocSuplAlwaysAsk;
       
   304             break;
       
   305             }
       
   306         case CSuplSettings::ESuplUsageDisabled:
       
   307             {
       
   308             index = ELocSuplDisable;
       
   309             break;
       
   310             }
       
   311         default:
       
   312             {
       
   313             break;
       
   314             }
       
   315         }
       
   316     return index;   
       
   317     }
       
   318     
       
   319 // ---------------------------------------------------------------------------
       
   320 // const TDesC& CLocSUPLSettingsAdapter::Automatic
       
   321 // ---------------------------------------------------------------------------
       
   322 // 
       
   323 const TDesC& CLocSUPLSettingsAdapter::Automatic()
       
   324     {
       
   325     return *iAutomatic;
       
   326     }
       
   327 
       
   328 // ---------------------------------------------------------------------------
       
   329 // const TDesC& CLocSUPLSettingsAdapter::AutomaticAtHome
       
   330 // ---------------------------------------------------------------------------
       
   331 //
       
   332 const TDesC& CLocSUPLSettingsAdapter::AutomaticAtHome()
       
   333     {
       
   334     return *iAutomaticatHome;  
       
   335     }
       
   336 
       
   337 // ---------------------------------------------------------------------------
       
   338 // const TDesC& CLocSUPLSettingsAdapter::AlwaysAsk
       
   339 // ---------------------------------------------------------------------------
       
   340 //
       
   341 const TDesC& CLocSUPLSettingsAdapter::AlwaysAsk()
       
   342     {
       
   343     return *iAsk;   
       
   344     }
       
   345 
       
   346 // ---------------------------------------------------------------------------
       
   347 // const TDesC& CLocSUPLSettingsAdapter::Disable
       
   348 // ---------------------------------------------------------------------------
       
   349 //
       
   350 const TDesC& CLocSUPLSettingsAdapter::Disable()
       
   351     {
       
   352     return *iDisable; 
       
   353     }
       
   354                    
       
   355 // ---------------------------------------------------------------------------
       
   356 // void CLocSUPLSettingsAdapter::HandleSuplSettingsChangeL
       
   357 // Handle the Settings UI changes
       
   358 // ---------------------------------------------------------------------------
       
   359 //     
       
   360 void CLocSUPLSettingsAdapter::HandleSuplSettingsChangeL( 
       
   361                 TSuplSettingsEventType /*aEvent*/,
       
   362                 TInt /*aSlpId*/                         
       
   363         		)
       
   364     {
       
   365 	DEBUG( + CLocSUPLSettingsAdapter::HandleSuplSettingsChangeL );	
       
   366     iObserver.HandleSuplSettingsChangeL( 
       
   367                     MLocSUPLSettingsAdapterObserver::ESUPLSettingsChanged );
       
   368 	DEBUG( - CLocSUPLSettingsAdapter::HandleSuplSettingsChangeL );	
       
   369     }
       
   370 
       
   371 // ---------------------------------------------------------------------------
       
   372 // void CLocSUPLSettingsAdapter::HandleSuplSessionChangeL
       
   373 // Handle the Supl Session changes
       
   374 // ---------------------------------------------------------------------------
       
   375 //     
       
   376 void CLocSUPLSettingsAdapter::HandleSuplSessionChangeL( 
       
   377                 TSuplSessionEventType aEvent,
       
   378                 TInt64 aSessionId                        
       
   379         		)
       
   380     {
       
   381 	DEBUG( + CLocSUPLSettingsAdapter::HandleSuplSessionChangeL );	
       
   382 	if( iSessionObserver && iSessionObserver->SessionId() == aSessionId )
       
   383 		{
       
   384 		MLocSUPLSettingsSessionObserver::TUpdateType updateType = 
       
   385                             MLocSUPLSettingsSessionObserver::ESessionModified;
       
   386 							
       
   387 		if( MSuplSessionObserver::ESuplSessionDBDeleteEvent == aEvent )
       
   388 		    updateType = MLocSUPLSettingsSessionObserver::ESessionDeleted;
       
   389 
       
   390 		iSessionObserver->UpdateSessionL( updateType );
       
   391 		}
       
   392 		
       
   393     iObserver.HandleSuplSettingsChangeL( 
       
   394                     MLocSUPLSettingsAdapterObserver::ESUPLSettingsChanged );
       
   395 	DEBUG( - CLocSUPLSettingsAdapter::HandleSuplSessionChangeL );	
       
   396     }
       
   397 
       
   398 // ---------------------------------------------------------------------------
       
   399 // void CLocSUPLSettingsAdapter::RunL
       
   400 // Inherited from CActive
       
   401 // ---------------------------------------------------------------------------
       
   402 // 
       
   403 void CLocSUPLSettingsAdapter::RunL()
       
   404     {
       
   405 	DEBUG( + CLocSUPLSettingsAdapter::RunL );	
       
   406     // If the SUPL settings API has been successfull initalized then a success
       
   407     // call back needs to be issued. In all other cases, other than a KErrCancel
       
   408     // it is assumed that the initailization has failed.
       
   409     if( iStatus.Int() == KErrNone )
       
   410         {        
       
   411         iObserver.HandleSuplSettingsChangeL( 
       
   412                     MLocSUPLSettingsAdapterObserver::ESUPLSettingsIntialized );
       
   413         }
       
   414     else if( iStatus.Int() != KErrCancel )
       
   415         {
       
   416         iObserver.HandleSuplSettingsChangeL( 
       
   417                     MLocSUPLSettingsAdapterObserver::ESUPLSettingsInitalizeError );    
       
   418         }
       
   419 	DEBUG( - CLocSUPLSettingsAdapter::RunL );	
       
   420     }
       
   421 
       
   422 // ---------------------------------------------------------------------------
       
   423 // void CLocSUPLSettingsAdapter::DoCancel
       
   424 // Inherited from CActive
       
   425 // ---------------------------------------------------------------------------
       
   426 //     
       
   427 void CLocSUPLSettingsAdapter::DoCancel()
       
   428     {
       
   429     iSUPLSettings->CancelInitialize();
       
   430     }
       
   431 
       
   432 
       
   433 //***************************************************************************
       
   434 //  
       
   435 //  @since S60 9.1TB 
       
   436 // 
       
   437 // ***************************************************************************
       
   438 
       
   439 // ---------------------------------------------------------------------------
       
   440 // void CLocSUPLSettingsAdapter::AddNewServerL
       
   441 // ---------------------------------------------------------------------------
       
   442 // 
       
   443 void CLocSUPLSettingsAdapter::AddNewServerL( 
       
   444         const TDesC& aServerAddress,
       
   445         const TDesC& aIapName,
       
   446         const TBool aUsageInHomeNw
       
   447 		)
       
   448 	{
       
   449 	DEBUG( + CLocSUPLSettingsAdapter::AddNewServerL );	
       
   450 	CServerParams* serverParam = CServerParams::NewL();
       
   451 	CleanupStack::PushL( serverParam );
       
   452 	User::LeaveIfError(serverParam->Set( 
       
   453 						aServerAddress, 
       
   454 						aIapName, 
       
   455 						ETrue, 
       
   456 						EFalse, // default value
       
   457 						aUsageInHomeNw, 
       
   458 						ETrue ));
       
   459 	
       
   460 	TInt64 slpId;	
       
   461 	User::LeaveIfError( iSUPLSettings->AddNewServer( serverParam, slpId ) );							
       
   462 	CleanupStack::PopAndDestroy();
       
   463 	DEBUG( - CLocSUPLSettingsAdapter::AddNewServerL );	
       
   464 	}
       
   465 	
       
   466 // ---------------------------------------------------------------------------
       
   467 // void CLocSUPLSettingsAdapter::RemoveServerL
       
   468 // ---------------------------------------------------------------------------
       
   469 // 
       
   470 void CLocSUPLSettingsAdapter::RemoveServerL(
       
   471 		const TInt64 aSlpId
       
   472 		)
       
   473 	{
       
   474 	DEBUG( + CLocSUPLSettingsAdapter::RemoveServerL );	
       
   475 	User::LeaveIfError( iSUPLSettings->RemoveServer( aSlpId ) );
       
   476 	DEBUG( - CLocSUPLSettingsAdapter::RemoveServerL );	
       
   477 	}
       
   478 
       
   479 // ---------------------------------------------------------------------------
       
   480 // void CLocSUPLSettingsAdapter::GetAllSlpL
       
   481 // ---------------------------------------------------------------------------
       
   482 // 
       
   483 void CLocSUPLSettingsAdapter::GetAllSlpL(
       
   484         RPointerArray<CServerParams>& aParamValues
       
   485 		) const
       
   486 	{
       
   487 	DEBUG( + CLocSUPLSettingsAdapter::GetAllSlpL );	
       
   488 	User::LeaveIfError( iSUPLSettings->GetAllSlp( aParamValues ) );
       
   489 	DEBUG( - CLocSUPLSettingsAdapter::GetAllSlpL );	
       
   490 	}
       
   491 
       
   492 // ---------------------------------------------------------------------------
       
   493 // void CLocSUPLSettingsAdapter::GetSlpInfoFromIdL
       
   494 // ---------------------------------------------------------------------------
       
   495 // 
       
   496 void CLocSUPLSettingsAdapter::GetSlpInfoFromIdL(
       
   497 	            const TInt64 aSlpId, 
       
   498 	            CServerParams *aParamValues
       
   499 	    ) const
       
   500 	{
       
   501 	DEBUG( + CLocSUPLSettingsAdapter::GetSlpInfoFromIdL );	
       
   502 	User::LeaveIfError( iSUPLSettings->GetSlpInfoFromId( aSlpId, aParamValues ) );	
       
   503 	DEBUG( - CLocSUPLSettingsAdapter::GetSlpInfoFromIdL );	
       
   504 	}
       
   505 
       
   506 // ---------------------------------------------------------------------------
       
   507 // void CLocSUPLSettingsAdapter::ChangePriorityL
       
   508 // ---------------------------------------------------------------------------
       
   509 // 
       
   510 void CLocSUPLSettingsAdapter::ChangePriorityL(
       
   511         TInt64 aSlpId, 
       
   512         TInt aPriority,
       
   513         TBool aDirection
       
   514 		)
       
   515 	{
       
   516 	DEBUG( + CLocSUPLSettingsAdapter::ChangePriorityL );	
       
   517 	User::LeaveIfError( 
       
   518 		iSUPLSettings->ChangePriority( aSlpId, aPriority, aDirection ) );		
       
   519 	DEBUG( - CLocSUPLSettingsAdapter::ChangePriorityL );	
       
   520 	}
       
   521 
       
   522 // ---------------------------------------------------------------------------
       
   523 // void CLocSUPLSettingsAdapter::SetServerAddressL
       
   524 // ---------------------------------------------------------------------------
       
   525 // 
       
   526 void CLocSUPLSettingsAdapter::SetServerAddressL( 
       
   527         const TInt64 aSlpId, 
       
   528         const TDesC& aServerAddress
       
   529 		)
       
   530 	{
       
   531 	DEBUG( + CLocSUPLSettingsAdapter::SetServerAddressL );	
       
   532 	User::LeaveIfError( iSUPLSettings->SetServerAddress( aSlpId, aServerAddress ) );	
       
   533 	DEBUG( - CLocSUPLSettingsAdapter::SetServerAddressL );	
       
   534 	}
       
   535 
       
   536 // ---------------------------------------------------------------------------
       
   537 // void CLocSUPLSettingsAdapter::GetServerAddressL
       
   538 // ---------------------------------------------------------------------------
       
   539 // 
       
   540 void CLocSUPLSettingsAdapter::GetServerAddressL( 
       
   541         TInt64 aSlpId, 
       
   542         TDes& aServerAddress
       
   543 		) const
       
   544 	{
       
   545 	DEBUG( + CLocSUPLSettingsAdapter::GetServerAddressL );	
       
   546 	User::LeaveIfError( iSUPLSettings->GetServerAddress( aSlpId, aServerAddress ) );	
       
   547 	DEBUG( - CLocSUPLSettingsAdapter::GetServerAddressL );	
       
   548 	}
       
   549 
       
   550 // ---------------------------------------------------------------------------
       
   551 // void CLocSUPLSettingsAdapter::SetIapNameL
       
   552 // ---------------------------------------------------------------------------
       
   553 // 
       
   554 void CLocSUPLSettingsAdapter::SetIapNameL( 
       
   555         const TInt64 aSlpId, 
       
   556         const TDesC& aIapName
       
   557 		)
       
   558 	{
       
   559 	DEBUG( + CLocSUPLSettingsAdapter::SetIapNameL );	
       
   560 	User::LeaveIfError( iSUPLSettings->SetIapName( aSlpId, aIapName ) );	
       
   561 	DEBUG( - CLocSUPLSettingsAdapter::SetIapNameL );	
       
   562 	}
       
   563 
       
   564 // ---------------------------------------------------------------------------
       
   565 // void CLocSUPLSettingsAdapter::GetIapNameL
       
   566 // ---------------------------------------------------------------------------
       
   567 // 
       
   568 void CLocSUPLSettingsAdapter::GetIapNameL( 
       
   569         const TInt64 aSlpId, 
       
   570         TDes& aIapName
       
   571 		) const
       
   572 	{
       
   573 	DEBUG( + CLocSUPLSettingsAdapter::GetIapNameL );	
       
   574 	User::LeaveIfError( iSUPLSettings->GetIapName( aSlpId, aIapName ) );	
       
   575 	DEBUG( - CLocSUPLSettingsAdapter::GetIapNameL );	
       
   576 	}
       
   577 
       
   578 // ---------------------------------------------------------------------------
       
   579 // void CLocSUPLSettingsAdapter::SetServerEnabledFlagL
       
   580 // ---------------------------------------------------------------------------
       
   581 // 
       
   582 void CLocSUPLSettingsAdapter::SetServerEnabledFlagL(
       
   583         const TInt64 aSlpId, 
       
   584         const TBool aEnable 
       
   585 		)
       
   586 	{
       
   587 	DEBUG( + CLocSUPLSettingsAdapter::SetServerEnabledFlagL );	
       
   588 	User::LeaveIfError( iSUPLSettings->SetServerEnabledFlag( aSlpId, aEnable ) );	
       
   589 	DEBUG( - CLocSUPLSettingsAdapter::SetServerEnabledFlagL );	
       
   590 	}
       
   591 
       
   592 // ---------------------------------------------------------------------------
       
   593 // void CLocSUPLSettingsAdapter::GetServerEnabledFlagL
       
   594 // ---------------------------------------------------------------------------
       
   595 // 
       
   596 void CLocSUPLSettingsAdapter::GetServerEnabledFlagL(
       
   597         const TInt64 aSlpId, 
       
   598         TBool& aEnable 
       
   599 		) const
       
   600 	{
       
   601 	DEBUG( + CLocSUPLSettingsAdapter::GetServerEnabledFlagL );	
       
   602 	User::LeaveIfError( iSUPLSettings->GetServerEnabledFlag( aSlpId, aEnable ) );	
       
   603 	DEBUG( - CLocSUPLSettingsAdapter::GetServerEnabledFlagL );	
       
   604 	}
       
   605 
       
   606 // ---------------------------------------------------------------------------
       
   607 // void CLocSUPLSettingsAdapter::SetUsageInHomwNwFlagL
       
   608 // ---------------------------------------------------------------------------
       
   609 // 
       
   610 void CLocSUPLSettingsAdapter::SetUsageInHomwNwFlagL(
       
   611         const TInt64 aSlpId, 
       
   612         const TBool aHomeNwFlag 
       
   613 		)
       
   614 	{
       
   615 	DEBUG( + CLocSUPLSettingsAdapter::SetUsageInHomwNwFlagL );	
       
   616 	User::LeaveIfError( iSUPLSettings->SetUsageInHomwNwFlag( aSlpId, aHomeNwFlag ) );	
       
   617 	DEBUG( - CLocSUPLSettingsAdapter::SetUsageInHomwNwFlagL );	
       
   618 	}
       
   619 
       
   620 // ---------------------------------------------------------------------------
       
   621 // void CLocSUPLSettingsAdapter::GetUsageInHomwNwFlagL
       
   622 // ---------------------------------------------------------------------------
       
   623 // 
       
   624 void CLocSUPLSettingsAdapter::GetUsageInHomwNwFlagL(
       
   625         const TInt64 aSlpId, 
       
   626         TBool& aHomeNwFlag 
       
   627 		) const
       
   628 	{
       
   629 	DEBUG( + CLocSUPLSettingsAdapter::SetUsageInHomwNwFlagL );	
       
   630 	User::LeaveIfError( iSUPLSettings->GetUsageInHomwNwFlag( aSlpId, aHomeNwFlag ) );	
       
   631 	DEBUG( - CLocSUPLSettingsAdapter::GetServerEnabledFlagL );	
       
   632 	}
       
   633 
       
   634 // ---------------------------------------------------------------------------
       
   635 // void CLocSUPLSettingsAdapter::SetEditableFlagL
       
   636 // ---------------------------------------------------------------------------
       
   637 // 
       
   638 void CLocSUPLSettingsAdapter::SetEditableFlagL( 
       
   639 	            const TInt64 aSlpId, 
       
   640 	            const TBool aEditFlag 
       
   641 	    ) const
       
   642 	{
       
   643 	DEBUG( + CLocSUPLSettingsAdapter::SetEditableFlagL );	
       
   644 	User::LeaveIfError( iSUPLSettings->SetEditableFlag( aSlpId, aEditFlag ) );
       
   645 	DEBUG( - CLocSUPLSettingsAdapter::SetEditableFlagL );	
       
   646 	}
       
   647 
       
   648 // ---------------------------------------------------------------------------
       
   649 // void CLocSUPLSettingsAdapter::GetEditableFlagL
       
   650 // ---------------------------------------------------------------------------
       
   651 // 
       
   652 void CLocSUPLSettingsAdapter::GetEditableFlagL(
       
   653 	            const TInt64 aSlpId, 
       
   654 	            TBool& aEditFlag 
       
   655 	    ) const
       
   656 	{
       
   657 	DEBUG( + CLocSUPLSettingsAdapter::GetEditableFlagL );	
       
   658 	User::LeaveIfError( iSUPLSettings->GetEditableFlag( aSlpId, aEditFlag ) );	
       
   659 	DEBUG( - CLocSUPLSettingsAdapter::GetEditableFlagL );	
       
   660 	}
       
   661 
       
   662 // ---------------------------------------------------------------------------
       
   663 // void CLocSUPLSettingsAdapter::SlpCountL
       
   664 // ---------------------------------------------------------------------------
       
   665 // 
       
   666 void CLocSUPLSettingsAdapter::SlpCountL(
       
   667         TInt& aCount 
       
   668 		)
       
   669 	{
       
   670 	DEBUG( + CLocSUPLSettingsAdapter::SlpCountL );	
       
   671 	User::LeaveIfError( iSUPLSettings->SlpCount( aCount ) );	
       
   672 	DEBUG( - CLocSUPLSettingsAdapter::SlpCountL );	
       
   673 	}
       
   674 
       
   675 // ---------------------------------------------------------------------------
       
   676 // void CLocSUPLSettingsAdapter::GetActiveSessionsCountL
       
   677 // ---------------------------------------------------------------------------
       
   678 //
       
   679 void CLocSUPLSettingsAdapter::GetActiveSessionsCountL( TInt& aActiveSessionsCount )
       
   680     {
       
   681     DEBUG( + CLocSUPLSettingsAdapter::GetActiveSessionsCountL );
       
   682     RPointerArray< CTriggerParams > aParamValues;
       
   683     TInt ret = iSUPLSettings->GetTriggerParams( aParamValues );
       
   684     if( ret == KErrNotFound )
       
   685         {
       
   686         aParamValues.ResetAndDestroy();
       
   687         aParamValues.Close(); 
       
   688         aActiveSessionsCount = 0;
       
   689         }
       
   690     else if ( ret == KErrNone )
       
   691         {
       
   692         TInt activeSessionsCount = aParamValues.Count(); 
       
   693         aParamValues.ResetAndDestroy();
       
   694         aParamValues.Close();   
       
   695         aActiveSessionsCount = activeSessionsCount;
       
   696         }
       
   697     else
       
   698         {
       
   699         aParamValues.ResetAndDestroy();
       
   700         aParamValues.Close();
       
   701         //Leave with error
       
   702         User::Leave( ret );
       
   703         }
       
   704         DEBUG( - CLocSUPLSettingsAdapter::GetActiveSessionsCountL );   
       
   705     }
       
   706  
       
   707 // ---------------------------------------------------------------------------
       
   708 // void CLocSUPLSettingsAdapter::GetTriggerParamsL
       
   709 // ---------------------------------------------------------------------------
       
   710 //
       
   711 void CLocSUPLSettingsAdapter::GetTriggerParamsL( RPointerArray<CTriggerParams>& aParamValues ) const
       
   712     {
       
   713     DEBUG( + CLocSUPLSettingsAdapter::GetTriggerParamsL );
       
   714     TInt ret = iSUPLSettings->GetTriggerParams( aParamValues );
       
   715     if(( ret != KErrNotFound ) && ( ret != KErrNone ))
       
   716         {
       
   717          User::Leave( ret );   
       
   718         }
       
   719     DEBUG( - CLocSUPLSettingsAdapter::GetTriggerParamsL );  
       
   720     }
       
   721  
       
   722 // ---------------------------------------------------------------------------
       
   723 // void CLocSUPLSettingsAdapter::GetTriggerParamsL
       
   724 // ---------------------------------------------------------------------------
       
   725 //
       
   726 void CLocSUPLSettingsAdapter::GetTriggerParamsL( TInt64 aSessionId, CTriggerParams*& aTrigger ) const
       
   727     {
       
   728     DEBUG( + CLocSUPLSettingsAdapter::GetTriggerParamsL );
       
   729     TInt ret = iSUPLSettings->GetTriggerParams( aSessionId, aTrigger );
       
   730     if( !ret )
       
   731         {
       
   732          User::Leave( ret );   
       
   733         }
       
   734     DEBUG( - CLocSUPLSettingsAdapter::GetTriggerParamsL );  
       
   735     }
       
   736  
       
   737 // ---------------------------------------------------------------------------
       
   738 // void CLocSUPLSettingsAdapter::ChangeNotificationStatusL
       
   739 // ---------------------------------------------------------------------------
       
   740 //
       
   741 void CLocSUPLSettingsAdapter::ChangeNotificationStatusL( TInt64 aSessionId, TBool aTriggerNotificationStatus ) const
       
   742     {
       
   743     DEBUG( + CLocSUPLSettingsAdapter::ChangeNotificationStatusL );
       
   744     TInt ret = iSUPLSettings->SetNotificationStatus( aSessionId, aTriggerNotificationStatus );
       
   745     if(( ret != KErrNotFound ) && ( ret != KErrNone ))
       
   746         {
       
   747          User::Leave( ret );   
       
   748         }
       
   749     DEBUG( - CLocSUPLSettingsAdapter::ChangeNotificationStatusL );  
       
   750     }
       
   751     
       
   752 // ---------------------------------------------------------------------------
       
   753 // void CLocSUPLSettingsAdapter::RemoveTriggerSessionL
       
   754 // ---------------------------------------------------------------------------
       
   755 //
       
   756 void CLocSUPLSettingsAdapter::RemoveTriggerSessionL( TInt64 aSessionId ) const
       
   757     {
       
   758     DEBUG( + CLocSUPLSettingsAdapter::RemoveTriggerSessionL );
       
   759     iSUPLSettings->CancelTriggerSession( aSessionId );
       
   760     DEBUG( - CLocSUPLSettingsAdapter::RemoveTriggerSessionL );  
       
   761     }
       
   762 	
       
   763 // ---------------------------------------------------------------------------
       
   764 // void CLocSUPLSettingsAdapter::SetSessionObserver
       
   765 // ---------------------------------------------------------------------------
       
   766 // 
       
   767 void CLocSUPLSettingsAdapter::SetSessionObserver( MLocSUPLSettingsSessionObserver* aObserver )
       
   768 	{
       
   769 	iSessionObserver = aObserver;
       
   770 	}
       
   771 	
       
   772 // ---------------------------------------------------------------------------
       
   773 // void CLocSUPLSettingsAdapter::RemoveSessionObserver
       
   774 // ---------------------------------------------------------------------------
       
   775 // 
       
   776 void CLocSUPLSettingsAdapter::RemoveSessionObserver( )
       
   777 	{
       
   778 	iSessionObserver = NULL;
       
   779 	}
       
   780     
       
   781 // End of file