satengine/SatServer/Engine/src/CSatApnHandler.cpp
branchRCL_3
changeset 19 7d48bed6ce0c
parent 18 594d59766373
child 20 987c9837762f
--- a/satengine/SatServer/Engine/src/CSatApnHandler.cpp	Thu Aug 19 10:28:14 2010 +0300
+++ b/satengine/SatServer/Engine/src/CSatApnHandler.cpp	Tue Aug 31 15:45:17 2010 +0300
@@ -276,7 +276,7 @@
     cm.SetIntAttributeL( CMManager::ECmWapIPWSPOption, 
                          CMManager::ECmWapWspOptionConnectionOriented );
     cm.SetBoolAttributeL( CMManager::EPacketDataDisablePlainTextAuth, EFalse );
-    cm.SetIntAttributeL( CMManager::ECmIFPromptForAuth, EFalse );
+    cm.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, EFalse );
 
     if ( aUserLogin != KNullDesC )
         {
@@ -397,33 +397,59 @@
     {
     LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL calling" );
     TUint32 defaultIap( 0 );
-    TInt pdpType( 0 );
+    TInt pdpType;
+    TBool isFound( EFalse );
 
-    // create CMManager Session
+    // create a network destination
+    RCmDestination des;
+    RCmConnectionMethod cm;
+
+    // Create CMManager Session
     RCmManager cmManager;
     cmManager.OpenL();
     CleanupClosePushL( cmManager );
 
-    // create a network connection method
-    RCmConnectionMethod cm;
-    CleanupClosePushL( cm );
-    // get a default connection method
-    GetDefConnMethodL( cmManager, cm );
+    // Get the Connection Method list from the open CMManager session
+    RArray<TUint32> array( 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 );
 
-    // get pdp type
-    pdpType = cm.GetIntAttributeL( CMManager::EPacketDataPDPType );
-    if ( pdpType == aPdpType )
-        {
-        // get a default iap id
-        defaultIap = cm.GetIntAttributeL( CMManager::ECmIapId );
-        LOG2( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \
-                  default iap had been found defaultIap = %d", defaultIap )
+        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( &cm );
+    CleanupStack::PopAndDestroy( &array );
     CleanupStack::PopAndDestroy( &cmManager );
 
-    if ( !defaultIap )
+    if ( !isFound )
         {
         LOG( SIMPLE, "SATENGINE: CSatApnHandler: default AP not found" );
         User::Leave( KErrNotFound );
@@ -432,48 +458,4 @@
     LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL exit" )
     return defaultIap;
     }
-
-// --------------------------------------------------------------------------
-// CSatApnHandler::GetDefConnMethodL
-// --------------------------------------------------------------------------
-void CSatApnHandler::GetDefConnMethodL( RCmManager& aCmManager, 
-        RCmConnectionMethod& aDefCm )
-    {
-    LOG( SIMPLE, "SATENGINE: CSatApnHandler::GetDefConnMethodL calling" )
-
-    // Go through the default connection methods to find
-    // the one valid method
-    TCmDefConnValue defConn;
-    aCmManager.ReadDefConnL( defConn );
-
-    LOG3( SIMPLE, "SATENGINE: CSatApnHandler::\
-    GetDefConnMethodL DefConn type=%d, id=%d", 
-    defConn.iType, defConn.iId )
-
-    // Default setting is a connection method
-    if ( ECmDefConnConnectionMethod == defConn.iType )
-        {
-        LOG( SIMPLE, "SATENGINE: CSatApnHandler::\
-        GetDefConnMethodL ECmDefConnConnectionMethod" )
-        // get a default connection method 
-        aDefCm = aCmManager.ConnectionMethodL( defConn.iId );
-        }
-    // Default setting is a destination method
-    else if ( ECmDefConnDestination == defConn.iType )
-        {
-        RCmDestination defDes;
-        CleanupClosePushL( defDes );
-
-        LOG( SIMPLE, "SATENGINE: CSatApnHandler::\
-        GetDefConnMethodL ECmDefConnDestination" )
-        // get a default destination
-        defDes = aCmManager.DestinationL( defConn.iId );
-        // get the first default connection method from destination
-        aDefCm = defDes.ConnectionMethodL( 0 );
-
-        CleanupStack::PopAndDestroy( &defDes );
-        }
-
-    LOG( SIMPLE, "SATENGINE: CSatApnHandler::GetDefConnMethodL exit" )
-    }
 //  End of File