diff -r a19c8664496d -r ba42c4bd84dd satengine/SatServer/Engine/src/CSatApnHandler.cpp --- a/satengine/SatServer/Engine/src/CSatApnHandler.cpp Wed Mar 31 22:34:38 2010 +0300 +++ b/satengine/SatServer/Engine/src/CSatApnHandler.cpp Wed Apr 14 16:32:24 2010 +0300 @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include "MSatUtils.h" #include "CSatApnHandler.h" @@ -386,4 +388,74 @@ return formatApnName; } +// ----------------------------------------------------------------------------- +// CSatApnHandler::FindDefaultApL +// ----------------------------------------------------------------------------- +// +TUint32 CSatApnHandler::FindDefaultApL( + const RPacketContext::TProtocolType& aPdpType ) + { + LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL calling" ); + TUint32 defaultIap( 0 ); + TInt pdpType; + TBool isFound( EFalse ); + + // create a network destination + RCmDestination des; + RCmConnectionMethod cm; + + // Create CMManager Session + RCmManager cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + // Get the Connection Method list from the open CMManager session + RArray array = RArray( KSatCMGranularity ); + CleanupClosePushL( array ); + + // list all available destinations' id + cmManager.AllDestinationsL( array ); + for( TInt i = 0; ( i < array.Count() ) && !isFound; ++i ) + { + des = cmManager.DestinationL( array[i] ); + CleanupClosePushL( des ); + + if ( CMManager::ESnapPurposeInternet == + des.MetadataL( CMManager::ESnapMetadataPurpose ) ) + { + LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \ + the fixed destination is identified as 'Internet'" ); + for( TInt j = 0; ( j < des.ConnectionMethodCount() ) && + !isFound; ++j ) + { + cm = des.ConnectionMethodL( j ); + CleanupClosePushL( cm ); + pdpType = cm.GetIntAttributeL( + CMManager::EPacketDataPDPType ); + LOG2( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \ + current protocol type is %d", pdpType ) + if ( pdpType == aPdpType ) + { + defaultIap = cm.GetIntAttributeL( CMManager::ECmIapId ); + isFound = ETrue; + LOG2( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \ + default iap had been found %d", defaultIap ) + } + CleanupStack::PopAndDestroy( &cm ); + } + } + CleanupStack::PopAndDestroy( &des ); + } + CleanupStack::PopAndDestroy( &array ); + CleanupStack::PopAndDestroy( &cmManager ); + + if ( !isFound ) + { + LOG( SIMPLE, "SATENGINE: CSatApnHandler: default AP not found" ); + User::Leave( KErrNotFound ); + } + + LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL exit" ) + return defaultIap; + } // End of File