supl/locationomasuplprotocolhandler/syncmlprovhandler/src/epos_comasupldmrepository.cpp
changeset 0 667063e416a2
child 22 4c4ed41530db
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2  * Copyright (c) 2005 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:   SUPL settings respository class
       
    15  *
       
    16  */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <utf.h>
       
    22 
       
    23 #include "epos_comasupltrace.h"
       
    24 #include "epos_comasupldmrepository.h"
       
    25 
       
    26 #include "epos_csuplsettingparams.h"
       
    27 #include "epos_tomasuplsettingsmap.h"
       
    28 
       
    29 _LIT( KTraceSuplDmRepository, "epos_comasupldmrepository.cpp" );
       
    30 
       
    31 const TInt KMaxBufferLength = 255 ;
       
    32 
       
    33 //integer values used to set or reset a boolen flag ti indicate which parameters were set NULL
       
    34 const TInt KNameBitMask = 1;
       
    35 const TInt KPrefConRefBitMask = 2;
       
    36 const TInt KProvIdBitMask = 4;
       
    37 const TInt KSlpBitMask = 8;
       
    38 const TInt KToConRefBitMask = 32;
       
    39 const TInt KConRefBitMask = 64;
       
    40 const TInt KAddrTypeBitMask = 128;
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // COMASuplSettingsRepository::NewL
       
    44 // Factory method that creates an instance of COMASuplSettings
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 COMASuplDMRepository* COMASuplDMRepository::NewL()
       
    48     {
       
    49     COMASuplDMRepository* self = new ( ELeave ) COMASuplDMRepository();
       
    50     CleanupStack::PushL( self );
       
    51     self->ConstructL();
       
    52     CleanupStack::Pop();
       
    53     return self;
       
    54     }
       
    55 
       
    56 
       
    57 // -----------------------------------------------------------------------------    
       
    58 // Destructor
       
    59 //
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 COMASuplDMRepository::~COMASuplDMRepository()
       
    63     {
       
    64     if(iSettings)
       
    65         {
       
    66         delete iSettings;
       
    67         iSettings = NULL;
       
    68         }
       
    69     if(iTrace)
       
    70         {
       
    71         delete iTrace;
       
    72         iSettings = NULL;
       
    73         }
       
    74     if(iServerAddress)
       
    75         {
       
    76         delete iServerAddress;
       
    77         iServerAddress = NULL;
       
    78         }
       
    79     if(iIapName)
       
    80         {
       
    81         delete iIapName;
       
    82         iIapName = NULL;
       
    83         }
       
    84     if(iServerId)
       
    85         {
       
    86         delete iServerId;
       
    87         iServerId = NULL;
       
    88         }
       
    89 
       
    90     if(iIap1)
       
    91         {
       
    92         delete iIap1;
       
    93         iIap1 = NULL;
       
    94         }
       
    95 
       
    96     if(iIap2)
       
    97         {
       
    98         delete iIap2;
       
    99         iIap2 = NULL;
       
   100         }
       
   101 
       
   102     if(iSlp)
       
   103         {
       
   104         delete iSlp;
       
   105         iSlp = NULL;
       
   106         }
       
   107 
       
   108     if(iServerAddType)
       
   109         {
       
   110         delete iServerAddType;
       
   111         iServerAddType = NULL;
       
   112         }
       
   113     }
       
   114 
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // Retrieves IAP name
       
   118 //
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 void COMASuplDMRepository::GetIAPNameLC( TDesC8*& aIAP )
       
   122     {
       
   123 
       
   124     iTrace->Trace( _L("COMASuplDMRepository::GetIAPNameLC - Start"), 
       
   125             KTraceSuplDmRepository, __LINE__ );
       
   126 
       
   127 
       
   128     CServerParams* paramValues = CServerParams::NewL();
       
   129     CleanupStack::PushL(paramValues);
       
   130     TInt64 slpId;
       
   131     HBufC* serverAddress = HBufC::NewLC(KMaxBufferLength);
       
   132     HBufC* iapName = HBufC::NewLC(KMaxBufferLength);
       
   133     TBool serverEnabled;
       
   134     TBool simChangeRemove;
       
   135     TBool usageInHomeNw;
       
   136     TBool editable;
       
   137 
       
   138     TInt err = iSettings->GetDefaultServer( paramValues );
       
   139 
       
   140 
       
   141     if ( KErrNone != err)
       
   142         { 
       
   143         TBuf<64> errcode;
       
   144         errcode.Append(_L("GetDefaultServer failed with error code :"));
       
   145         errcode.AppendNum(err);
       
   146         iTrace->Trace(errcode,KTraceSuplDmRepository, __LINE__ );
       
   147         User::Leave( err );
       
   148         }    
       
   149     paramValues->Get(slpId,serverAddress->Des(),iapName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
       
   150 
       
   151     HBufC8* IAPName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *iapName );
       
   152 
       
   153 
       
   154     aIAP = IAPName;    
       
   155     iTrace->Trace( _L("COMASuplDMRepository::GetIAPNameLC - End"), 
       
   156             KTraceSuplDmRepository, __LINE__ );
       
   157     CleanupStack::PopAndDestroy(3);
       
   158 
       
   159     CleanupStack::PushL( IAPName );
       
   160     }
       
   161 
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // Retrieves HSLP address
       
   165 //
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 void COMASuplDMRepository::GetHSLPAddressLC( TDesC8*& aHSLP )
       
   169     {
       
   170 
       
   171     iTrace->Trace( _L("COMASuplDMRepository::GetHSLPAddressLC - Start"), 
       
   172             KTraceSuplDmRepository, __LINE__ );
       
   173 
       
   174 
       
   175     CServerParams* paramValues = CServerParams::NewL();
       
   176     CleanupStack::PushL(paramValues);
       
   177     TInt64 slpId;
       
   178     HBufC* serverAddress = HBufC::NewLC(KMaxBufferLength);
       
   179     HBufC* iapName = HBufC::NewLC(KMaxBufferLength);
       
   180     TBool serverEnabled;
       
   181     TBool simChangeRemove;
       
   182     TBool usageInHomeNw;
       
   183     TBool editable;
       
   184 
       
   185     TInt err = iSettings->GetDefaultServer( paramValues );
       
   186 
       
   187     if ( KErrNone != err && KErrNotFound != err )
       
   188         {
       
   189         TBuf<64> errcode;
       
   190         errcode.Append(_L("GetDefaultServer failed with error code :"));
       
   191         errcode.AppendNum(err);
       
   192         iTrace->Trace(errcode,KTraceSuplDmRepository, __LINE__ );
       
   193         User::Leave( err );
       
   194         }
       
   195 
       
   196     paramValues->Get(slpId,serverAddress->Des(),iapName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
       
   197 
       
   198     HBufC8* HSLPAddr = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *serverAddress );
       
   199 
       
   200 
       
   201     aHSLP = HSLPAddr;
       
   202     iTrace->Trace( _L("COMASuplDMRepository::GetHSLPAddressLC - End"), 
       
   203             KTraceSuplDmRepository, __LINE__ );    
       
   204     CleanupStack::PopAndDestroy(3);
       
   205 
       
   206 
       
   207 
       
   208     CleanupStack::PushL( HSLPAddr );
       
   209     }
       
   210 
       
   211 
       
   212 // -----------------------------------------------------------------------------
       
   213 // Starts an atomic transaction
       
   214 //
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 void COMASuplDMRepository::StartTransactionL()
       
   218     {
       
   219 #if 0
       
   220     User::LeaveIfError( iSettings->LockSettingsL() );    
       
   221 #endif
       
   222     }
       
   223 
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // Commits changes in an atomic transaction
       
   227 //
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void COMASuplDMRepository::CommitTransactionL()
       
   231     {
       
   232 #if 0
       
   233     User::LeaveIfError( iSettings->UnlockSettings() );    
       
   234 #endif
       
   235     }
       
   236 
       
   237 
       
   238 // -----------------------------------------------------------------------------
       
   239 // Reverts changes made in an atomic transaction
       
   240 //
       
   241 // -----------------------------------------------------------------------------
       
   242 //
       
   243 void COMASuplDMRepository::RollbackTransactionL()
       
   244     {
       
   245 #if 0
       
   246     User::LeaveIfError( iSettings->UnlockSettings( EFalse ) );
       
   247 #endif
       
   248     }
       
   249 
       
   250 
       
   251 // -----------------------------------------------------------------------------
       
   252 // Saves SUPL Settings information
       
   253 //
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 void COMASuplDMRepository::SaveL( const TDesC& aValue,TOMASuplSettingsMap::TSuplSettingType aType,TBool aIsAtomic )
       
   257     {
       
   258     if( !aIsAtomic )
       
   259         {
       
   260         StartTransactionL();    
       
   261         }
       
   262     TRAPD( err, SaveSettingsL( aValue,aType) );
       
   263     if( KErrNone != err )
       
   264         {
       
   265         if ( !aIsAtomic )
       
   266             {
       
   267             RollbackTransactionL();    
       
   268             }
       
   269         User::Leave( err );
       
   270         }
       
   271     if ( !aIsAtomic )
       
   272         {
       
   273         CommitTransactionL();
       
   274         }
       
   275     }
       
   276 
       
   277 
       
   278 // -----------------------------------------------------------------------------
       
   279 // C++ default constructor can NOT contain any code, that
       
   280 // might leave.
       
   281 // -----------------------------------------------------------------------------
       
   282 //
       
   283 COMASuplDMRepository::COMASuplDMRepository()
       
   284     {
       
   285     }
       
   286 
       
   287 
       
   288 // -----------------------------------------------------------------------------    
       
   289 // Symbian 2nd phase constructor
       
   290 //
       
   291 // -----------------------------------------------------------------------------
       
   292 //
       
   293 void COMASuplDMRepository::ConstructL()
       
   294     {
       
   295     iSettings = CSuplSettingsInternal::NewL();
       
   296     iTrace = COMASuplTrace::NewL();
       
   297     iState = ENotInitialized;
       
   298     iSlpId = -1;
       
   299     iServerAddress = HBufC::NewL(KMaxBufferLength);
       
   300     iIapName = HBufC::NewL(KMaxBufferLength);
       
   301     iServerId = HBufC::NewL(KMaxBufferLength);
       
   302     iIap1 = HBufC::NewL(KMaxBufferLength);
       
   303     iIap2 = HBufC::NewL(KMaxBufferLength);
       
   304     iSlp = HBufC::NewL(KMaxBufferLength);
       
   305     iServerAddType = HBufC::NewL(KMaxBufferLength);
       
   306     iNullMask = 0;
       
   307     }
       
   308 
       
   309 
       
   310 // -----------------------------------------------------------------------------
       
   311 // Saves SUPL Settings information
       
   312 //
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 void COMASuplDMRepository::SaveSettingsL( const TDesC& aValue,TOMASuplSettingsMap::TSuplSettingType aType)
       
   316     {
       
   317 
       
   318     iTrace->Trace( _L( "COMASuplSettingsRepository::SaveL() Start" ), 
       
   319             KTraceSuplDmRepository, __LINE__ );
       
   320 
       
   321     if( iState != EInitialized )
       
   322         {
       
   323         iSettings->Initialize( iStatus );
       
   324         User::WaitForRequest( iStatus );
       
   325 
       
   326         if ( KErrNone != iStatus.Int() )
       
   327             {
       
   328             iTrace->Trace( _L( "Error Initializing SUPL Settings" ), 
       
   329                     KTraceSuplDmRepository, __LINE__ );
       
   330 
       
   331             User::Leave( KErrNotReady );
       
   332             }
       
   333         iState = EInitialized;
       
   334         }
       
   335 
       
   336     switch(aType)
       
   337         {
       
   338         case TOMASuplSettingsMap::EName :
       
   339             {
       
   340             if ( aValue.Length() )
       
   341                 {
       
   342                 iTrace->Trace( _L( "Received Server Address of no zero length" ), 
       
   343                         KTraceSuplDmRepository, __LINE__ );
       
   344                 *iServerAddress = aValue;
       
   345                 CServerParams* paramValues = CServerParams::NewL();
       
   346                 CleanupStack::PushL(paramValues);
       
   347                 TInt err =  paramValues->Set(*iServerAddress,*iIapName);
       
   348                 err = iSettings->AddNewServer(paramValues,iSlpId);
       
   349                 if(err == KErrAlreadyExists)
       
   350                     {
       
   351                     TInt getErr = iSettings->GetSlpInfoAddress(*iServerAddress,paramValues);
       
   352                     if(getErr == KErrNone)
       
   353                         {
       
   354                         HBufC* servername = HBufC::NewLC(KMaxBufferLength);
       
   355                         HBufC* iapName = HBufC::NewL(KMaxBufferLength);
       
   356                         TBool serverEnabled;
       
   357                         TBool simChangeRemove;
       
   358                         TBool usageInHomeNw;
       
   359                         TBool editable;
       
   360 
       
   361                         paramValues->Get(iSlpId,servername->Des(),iapName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
       
   362                         delete iapName;
       
   363                         CleanupStack::PopAndDestroy();//servername
       
   364                         }
       
   365                     }
       
   366 
       
   367                 if ((err == KErrNone || err == KErrAlreadyExists) && iSlpId!= -1)
       
   368                     iSettings->SetTopPriority(iSlpId);
       
   369 
       
   370 
       
   371                 if (err!=KErrNone && err != KErrAlreadyExists)
       
   372                     {
       
   373                     TBuf<64> errcode;
       
   374                     errcode.Append(_L( "Error updating SUPL settings" ));
       
   375                     errcode.AppendNum(err);
       
   376                     iTrace->Trace( errcode,KTraceSuplDmRepository, __LINE__ );
       
   377                     User::Leave( err );
       
   378                     }
       
   379                 CleanupStack::PopAndDestroy(1); //params
       
   380                 }
       
   381             else
       
   382                 {
       
   383                 iTrace->Trace( _L( "Server Name is NULL" ), 
       
   384                         KTraceSuplDmRepository, __LINE__ );
       
   385                 iNullMask |= KNameBitMask;
       
   386                 }
       
   387             }
       
   388             break;
       
   389         case TOMASuplSettingsMap::EPrefConRef :
       
   390             {
       
   391             if( aValue.Length() )
       
   392                 {
       
   393                 iTrace->Trace( _L( "Received EPrefConRef of non zero length" ), 
       
   394                         KTraceSuplDmRepository, __LINE__ );
       
   395                 }
       
   396             else
       
   397                 {
       
   398                 iTrace->Trace( _L( "EPrefConRef Name is NULL" ), 
       
   399                         KTraceSuplDmRepository, __LINE__ );
       
   400                 iNullMask |= KPrefConRefBitMask;
       
   401                 }
       
   402             *iIapName = aValue; 
       
   403             }
       
   404             break;
       
   405         case TOMASuplSettingsMap::EProviderId :
       
   406             {
       
   407             if( aValue.Length() )
       
   408                 {
       
   409                 iTrace->Trace( _L( "Received ProviderId of non zero length" ), 
       
   410                         KTraceSuplDmRepository, __LINE__ );
       
   411                
       
   412                 }
       
   413             else
       
   414                 {
       
   415                 iTrace->Trace( _L( "Provider Id is NULL" ), 
       
   416                         KTraceSuplDmRepository, __LINE__ );
       
   417                 iNullMask |= KProvIdBitMask;
       
   418                 }
       
   419             *iServerId = aValue; 
       
   420             }
       
   421             break;
       
   422         case TOMASuplSettingsMap::ESlp: 
       
   423             {
       
   424             if( aValue.Length() )
       
   425                 {
       
   426                 iTrace->Trace( _L( "Received name of non zero length" ), 
       
   427                         KTraceSuplDmRepository, __LINE__ );
       
   428                 }
       
   429             else
       
   430                 {
       
   431                 iTrace->Trace( _L( "name is NULL" ), 
       
   432                         KTraceSuplDmRepository, __LINE__ );
       
   433                 iNullMask |= KSlpBitMask;
       
   434                 }
       
   435             *iSlp = aValue; 
       
   436             }
       
   437             break;
       
   438         case TOMASuplSettingsMap::EToConRef :
       
   439             {
       
   440             if( aValue.Length() )
       
   441                 {
       
   442                 iTrace->Trace( _L( "Received IAP1 of non zero length" ), 
       
   443                         KTraceSuplDmRepository, __LINE__ );
       
   444                 }
       
   445             else
       
   446                 {
       
   447                 iTrace->Trace( _L( "IAP1 is NULL" ), 
       
   448                         KTraceSuplDmRepository, __LINE__ );
       
   449                 iNullMask |= KToConRefBitMask;
       
   450                 }
       
   451             *iIap1 = aValue; 
       
   452             }
       
   453             break;
       
   454         case TOMASuplSettingsMap::EConRef :
       
   455             {
       
   456             if( aValue.Length() )
       
   457                 {
       
   458                 iTrace->Trace( _L( "Received name of non zero length" ), 
       
   459                         KTraceSuplDmRepository, __LINE__ );
       
   460                 }
       
   461             else
       
   462                 {
       
   463                 iTrace->Trace( _L( "IAP2 is NULL" ), 
       
   464                         KTraceSuplDmRepository, __LINE__ );
       
   465                 iNullMask |= KConRefBitMask;
       
   466                 }
       
   467             *iIap2 = aValue; 
       
   468             }
       
   469             break;
       
   470         case TOMASuplSettingsMap::EAddrType :
       
   471             {
       
   472             if( aValue.Length() )
       
   473                 {
       
   474                 iTrace->Trace( _L( "Received Address type of non zero length" ), 
       
   475                         KTraceSuplDmRepository, __LINE__ );
       
   476                 }
       
   477             else
       
   478                 {
       
   479                 iTrace->Trace( _L( "Address type is NULL" ), 
       
   480                         KTraceSuplDmRepository, __LINE__ );
       
   481                 iNullMask |= KAddrTypeBitMask;
       
   482                 }
       
   483             *iServerAddType = aValue; 
       
   484             }
       
   485             break;
       
   486         }
       
   487 
       
   488 
       
   489 
       
   490 
       
   491     if(iSlpId != -1) // a server name was received and added now add buffered values,if any to database
       
   492         {
       
   493         if(iIapName->Length() != 0 || iNullMask & KPrefConRefBitMask)// if IAP Name was recieved add it to the settings DB
       
   494             {
       
   495             iSettings->SetIapName(iSlpId,*iIapName);
       
   496             iSettings->SetTopPriority(iSlpId);
       
   497             }
       
   498 
       
   499 
       
   500         if(iServerId->Length() != 0 && iIap1->Length() != 0 && iIap2->Length() != 0 && 
       
   501                 iSlp->Length() != 0 && iServerAddType->Length() != 0) // if all extended parameters exist add to settings DB directly
       
   502             {
       
   503             CServerExtensionParams* params = CServerExtensionParams::NewL();
       
   504             TInt err=params->Set( iServerId->Des(),iIap1->Des(),iIap2->Des(),iSlp->Des(),iServerAddType->Des());  
       
   505 
       
   506             iSettings->SetServerExtensionParams(iSlpId,params);
       
   507             iSettings->SetTopPriority(iSlpId);
       
   508             delete params;
       
   509 
       
   510             User::LeaveIfError(err);
       
   511 
       
   512             }
       
   513         // if 1 or more extended parameters exist but not all of them add to settings DB after retrieving existing params
       
   514         else if(iServerId->Length() != 0 || iIap1->Length() != 0 || iIap2->Length() != 0 || 
       
   515                 iSlp->Length() != 0 || iServerAddType->Length() != 0 || iNullMask) 
       
   516             {
       
   517             CServerExtensionParams* params = CServerExtensionParams::NewLC();
       
   518 
       
   519             iSettings->GetServerExtensionParams(iSlpId,params); //get the already set parameters
       
   520 
       
   521             HBufC* serverid=HBufC::NewLC(KMaxBufferLength);
       
   522             HBufC* iap1=HBufC::NewLC(KMaxBufferLength);
       
   523             HBufC* iap2=HBufC::NewLC(KMaxBufferLength);
       
   524             HBufC* serveradd=HBufC::NewLC(KMaxBufferLength);
       
   525             HBufC* serveraddtype=HBufC::NewLC(KMaxBufferLength);
       
   526             params->Get(serverid->Des(),iap1->Des(),iap2->Des(),serveradd->Des(),serveraddtype->Des());
       
   527 
       
   528             if(iServerId->Length() == 0 && !(iNullMask & KProvIdBitMask))
       
   529                 {
       
   530                 *iServerId = *serverid;                          
       
   531                 }
       
   532             if(iIap1->Length() == 0 && !(iNullMask & KToConRefBitMask))
       
   533                 {
       
   534                 *iIap1 = *iap1;
       
   535                 }
       
   536             if(iIap2->Length() == 0 && !(iNullMask & KConRefBitMask))
       
   537                 {
       
   538                 *iIap2 = *iap2;
       
   539                 }
       
   540             if(iSlp->Length() == 0 && !(iNullMask & KSlpBitMask))
       
   541                 {
       
   542                 *iSlp = *serveradd;
       
   543                 }
       
   544             if(iServerAddType->Length() == 0 && !(iNullMask & KAddrTypeBitMask))
       
   545                 {
       
   546                 *iServerAddType = *serveraddtype;
       
   547                 }
       
   548             CleanupStack::PopAndDestroy(5);//serverid,iap1,iap2,serveradd,serveraddtype
       
   549 
       
   550             TInt err=params->Set( iServerId->Des(),iIap1->Des(),iIap2->Des(),iSlp->Des(),iServerAddType->Des());  
       
   551 
       
   552             iSettings->SetServerExtensionParams(iSlpId,params);
       
   553             iSettings->SetTopPriority(iSlpId);
       
   554             CleanupStack::PopAndDestroy(1);//params
       
   555             User::LeaveIfError(err);
       
   556 
       
   557             }
       
   558 
       
   559         }
       
   560 
       
   561 
       
   562 
       
   563     }
       
   564 
       
   565 // -----------------------------------------------------------------------------
       
   566 // COMASuplDMRepository::GetExtnParamsLC(TDesC8*& aValue,TSuplDMExtnParamType aType)
       
   567 // Retrieves SUPL Settings Extended Params information
       
   568 //
       
   569 // -----------------------------------------------------------------------------
       
   570 //
       
   571 void COMASuplDMRepository::GetExtnParamsLC(TDesC8*& aValue,TOMASuplSettingsMap::TSuplSettingType aType)
       
   572     {
       
   573     TInt64 defaultSlpId = -1;
       
   574     TInt err = iSettings->GetDefaultSlpId(defaultSlpId);
       
   575     User::LeaveIfError(err);
       
   576     CServerExtensionParams* servExtnParams = CServerExtensionParams::NewLC();
       
   577     err = iSettings->GetServerExtensionParams(defaultSlpId,servExtnParams);
       
   578     User::LeaveIfError(err);
       
   579 
       
   580     HBufC* serverid=HBufC::NewLC(KMaxBufferLength);
       
   581     HBufC* iap1=HBufC::NewLC(KMaxBufferLength);
       
   582     HBufC* iap2=HBufC::NewLC(KMaxBufferLength);
       
   583     HBufC* serveradd=HBufC::NewLC(KMaxBufferLength);
       
   584     HBufC* serveraddtype=HBufC::NewLC(KMaxBufferLength);
       
   585     servExtnParams->Get(serverid->Des(),iap1->Des(),iap2->Des(),serveradd->Des(),serveraddtype->Des());
       
   586     switch(aType)
       
   587         {
       
   588         case TOMASuplSettingsMap::EProviderId:
       
   589             {
       
   590             HBufC8* provId = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *serverid );
       
   591             aValue = provId;
       
   592 
       
   593             CleanupStack::PopAndDestroy(6);//serverid,iap1,iap2,serveradd,serveraddtype,servExtnParams
       
   594             CleanupStack::PushL(provId);
       
   595             }
       
   596             break;
       
   597         case TOMASuplSettingsMap::ESlp:
       
   598             {
       
   599             HBufC8* slpAdd = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *serveradd );
       
   600             aValue = slpAdd;
       
   601 
       
   602             CleanupStack::PopAndDestroy(6);//serverid,iap1,iap2,serveradd,serveraddtype,servExtnParams
       
   603             CleanupStack::PushL(slpAdd);
       
   604             }
       
   605             break;
       
   606         case TOMASuplSettingsMap::EToConRef:
       
   607             {
       
   608             HBufC8* toConRef = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *iap1 );
       
   609             aValue = toConRef;
       
   610 
       
   611             CleanupStack::PopAndDestroy(6);//serverid,iap1,iap2,serveradd,serveraddtype,servExtnParams
       
   612             CleanupStack::PushL(toConRef);
       
   613             }
       
   614             break;
       
   615         case TOMASuplSettingsMap::EConRef:
       
   616             {
       
   617             HBufC8* conRef = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *iap2 );
       
   618             aValue = conRef;
       
   619 
       
   620             CleanupStack::PopAndDestroy(6);//serverid,iap1,iap2,serveradd,serveraddtype,servExtnParams
       
   621             CleanupStack::PushL(conRef);
       
   622             }
       
   623             break;
       
   624         case TOMASuplSettingsMap::EAddrType:
       
   625             {
       
   626             HBufC8* addrType = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *serveraddtype );
       
   627             aValue = addrType;
       
   628 
       
   629             CleanupStack::PopAndDestroy(6);//serverid,iap1,iap2,serveradd,serveraddtype,servExtnParams
       
   630             CleanupStack::PushL(addrType);
       
   631             }
       
   632             break;
       
   633 
       
   634         }
       
   635     }
       
   636