supl/locationomasuplprotocolhandler/provisioninghandler/src/epos_comasuplsettings.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 0 667063e416a2
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
    18 
    18 
    19 
    19 
    20 
    20 
    21 #include <CWPParameter.h>
    21 #include <CWPParameter.h>
    22 #include <WPAdapterUtil.h>
    22 #include <WPAdapterUtil.h>
    23 #include <ApUtils.h>
    23 //#include <ApUtils.h>
    24 
    24 
    25 #include "epos_comasupltrace.h"
    25 #include "epos_comasupltrace.h"
    26 #include "epos_comasuplsettings.h"
    26 #include "epos_comasuplsettings.h"
    27 #include "epos_comasuplsettingsrepository.h"
    27 #include "epos_comasuplsettingsrepository.h"
    28 #include "epos_comasuplparameters.h"
    28 #include "epos_comasuplparameters.h"
    29 #include "epos_omasuplprovhandler.pan"
    29 #include "epos_omasuplprovhandler.pan"
    30 #include "epos_omasuplprovhandler.hrh"
    30 #include "epos_omasuplprovhandler.hrh"
    31 #include <epos_omasuplprovhandlerres.rsg>
    31 #include <epos_omasuplprovhandlerres.rsg>
       
    32 
       
    33 #include <cmmanagerext.h>
       
    34 #include <cmdestinationext.h>
       
    35 #include <cmconnectionmethodext.h>
       
    36 #include <cmconnectionmethoddef.h>
    32 
    37 
    33 
    38 
    34 _LIT( KTraceSuplSettings, "epos_comasuplsettings.cpp" );
    39 _LIT( KTraceSuplSettings, "epos_comasuplsettings.cpp" );
    35 
    40 
    36 
    41 
   144 //
   149 //
   145 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   146 //
   151 //
   147 TUint32 COMASuplSettings::IapIdFromWapIdL( TUint32 aWapId ) const
   152 TUint32 COMASuplSettings::IapIdFromWapIdL( TUint32 aWapId ) const
   148     {
   153     {
   149     CApUtils* apUtils = CApUtils::NewLC( *iCommsDb );
   154     /*CApUtils* apUtils = CApUtils::NewLC( *iCommsDb );
   150     TUint32 iapId = NULL;
   155     TUint32 iapId = NULL;
   151     iapId = apUtils->IapIdFromWapIdL( aWapId );
   156     iapId = apUtils->IapIdFromWapIdL( aWapId );
   152     __ASSERT_ALWAYS( iapId, Panic( SuplAdapterInvalidId ) );
   157     __ASSERT_ALWAYS( iapId, Panic( SuplAdapterInvalidId ) );
   153     CleanupStack::PopAndDestroy( apUtils );
   158     CleanupStack::PopAndDestroy( apUtils );
   154     return iapId;
   159     return iapId;
       
   160     return ;*/
       
   161     
       
   162     RCmManagerExt cmManager;
       
   163     cmManager.OpenLC(); // CS:1
       
   164     RArray<TUint32> iapIds;
       
   165     TUint32 iapId( 0 );
       
   166 
       
   167     // First get all free IAP ID's.
       
   168     cmManager.ConnectionMethodL( iapIds );
       
   169     CleanupClosePushL( iapIds ); // CS:2
       
   170 
       
   171     // Then get IAP ID's from all destinations.
       
   172     RArray<TUint32> destIds;
       
   173     cmManager.AllDestinationsL( destIds );
       
   174     CleanupClosePushL( destIds ); // CS:3
       
   175     TInt destCount = destIds.Count();
       
   176     for ( TInt destIndex = 0; destIndex < destCount; destIndex++ )
       
   177         {
       
   178         RCmDestinationExt dest = cmManager.DestinationL( 
       
   179             destIds[destIndex] );
       
   180         CleanupClosePushL( dest ); // CS:4
       
   181         TInt cmCount = dest.ConnectionMethodCount();
       
   182         for ( TInt cmIndex = 0; cmIndex < cmCount; cmIndex++ )
       
   183             {
       
   184             TUint32 apId = dest.ConnectionMethodL( 
       
   185                 cmIndex ).GetIntAttributeL( CMManager::ECmIapId );
       
   186             iapIds.AppendL( apId );
       
   187             }
       
   188         CleanupStack::PopAndDestroy( &dest ); // CS:3
       
   189         }
       
   190     // Finally, go through all connection methods and find correct IAP ID.
       
   191     const TInt cmCount = iapIds.Count();
       
   192     for ( TInt counter = 0; counter < cmCount; counter++ )
       
   193         {
       
   194         TUint32 id = cmManager.GetConnectionMethodInfoIntL( 
       
   195             iapIds[counter], CMManager::ECmWapId );
       
   196         if ( id == aWapId )
       
   197             {
       
   198             iapId = iapIds[counter];
       
   199             // No need to go through rest of IAPs.
       
   200             break;
       
   201             }
       
   202         }
       
   203     // PopAndDestroy destIds, iapIds, cmManager.
       
   204     CleanupStack::PopAndDestroy( 3, &cmManager ); // CS:0
       
   205     return iapId;
       
   206     
   155     }
   207     }
   156 
   208 
   157 
   209 
   158 // -----------------------------------------------------------------------------
   210 // -----------------------------------------------------------------------------
   159 // COMASuplSettings::COMASuplSettings
   211 // COMASuplSettings::COMASuplSettings