1 /* |
1 /* |
2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
20 #include <cmmanagerext.h> |
20 #include <cmmanagerext.h> |
21 #include <cmconnectionmethod.h> |
21 #include <cmconnectionmethod.h> |
22 #include <cmconnectionmethodext.h> |
22 #include <cmconnectionmethodext.h> |
23 #include <cmconnectionmethoddef.h> |
23 #include <cmconnectionmethoddef.h> |
24 #include <cmpluginpacketdatadef.h> |
24 #include <cmpluginpacketdatadef.h> |
|
25 #include <cmdestination.h> |
|
26 #include <cmmanagerdef.h> |
25 |
27 |
26 #include "MSatUtils.h" |
28 #include "MSatUtils.h" |
27 #include "CSatApnHandler.h" |
29 #include "CSatApnHandler.h" |
28 #include "SatLog.h" |
30 #include "SatLog.h" |
29 |
31 |
384 } |
386 } |
385 |
387 |
386 return formatApnName; |
388 return formatApnName; |
387 } |
389 } |
388 |
390 |
|
391 // ----------------------------------------------------------------------------- |
|
392 // CSatApnHandler::FindDefaultApL |
|
393 // ----------------------------------------------------------------------------- |
|
394 // |
|
395 TUint32 CSatApnHandler::FindDefaultApL( |
|
396 const RPacketContext::TProtocolType& aPdpType ) |
|
397 { |
|
398 LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL calling" ); |
|
399 TUint32 defaultIap( 0 ); |
|
400 TInt pdpType; |
|
401 TBool isFound( EFalse ); |
|
402 |
|
403 // create a network destination |
|
404 RCmDestination des; |
|
405 RCmConnectionMethod cm; |
|
406 |
|
407 // Create CMManager Session |
|
408 RCmManager cmManager; |
|
409 cmManager.OpenL(); |
|
410 CleanupClosePushL( cmManager ); |
|
411 |
|
412 // Get the Connection Method list from the open CMManager session |
|
413 RArray<TUint32> array( KSatCMGranularity ); |
|
414 CleanupClosePushL( array ); |
|
415 |
|
416 // list all available destinations' id |
|
417 cmManager.AllDestinationsL( array ); |
|
418 for( TInt i = 0; ( i < array.Count() ) && !isFound; ++i ) |
|
419 { |
|
420 des = cmManager.DestinationL( array[i] ); |
|
421 CleanupClosePushL( des ); |
|
422 |
|
423 if ( CMManager::ESnapPurposeInternet == |
|
424 des.MetadataL( CMManager::ESnapMetadataPurpose ) ) |
|
425 { |
|
426 LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \ |
|
427 the fixed destination is identified as 'Internet'" ); |
|
428 for( TInt j = 0; ( j < des.ConnectionMethodCount() ) && |
|
429 !isFound; ++j ) |
|
430 { |
|
431 cm = des.ConnectionMethodL( j ); |
|
432 CleanupClosePushL( cm ); |
|
433 pdpType = cm.GetIntAttributeL( |
|
434 CMManager::EPacketDataPDPType ); |
|
435 LOG2( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \ |
|
436 current protocol type is %d", pdpType ) |
|
437 if ( pdpType == aPdpType ) |
|
438 { |
|
439 defaultIap = cm.GetIntAttributeL( CMManager::ECmIapId ); |
|
440 isFound = ETrue; |
|
441 LOG2( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \ |
|
442 default iap had been found %d", defaultIap ) |
|
443 } |
|
444 CleanupStack::PopAndDestroy( &cm ); |
|
445 } |
|
446 } |
|
447 CleanupStack::PopAndDestroy( &des ); |
|
448 } |
|
449 CleanupStack::PopAndDestroy( &array ); |
|
450 CleanupStack::PopAndDestroy( &cmManager ); |
|
451 |
|
452 if ( !isFound ) |
|
453 { |
|
454 LOG( SIMPLE, "SATENGINE: CSatApnHandler: default AP not found" ); |
|
455 User::Leave( KErrNotFound ); |
|
456 } |
|
457 |
|
458 LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL exit" ) |
|
459 return defaultIap; |
|
460 } |
389 // End of File |
461 // End of File |