26 #include <DevManInternalCRKeys.h> |
26 #include <DevManInternalCRKeys.h> |
27 #include <centralrepository.h> |
27 #include <centralrepository.h> |
28 #include <rconnmon.h> |
28 #include <rconnmon.h> |
29 #include <es_enum.h> |
29 #include <es_enum.h> |
30 |
30 |
31 #include <cmconnectionmethodext.h> |
31 #include <cmconnectionmethod.h> |
32 #include <cmconnectionmethoddef.h> |
32 #include <cmconnectionmethoddef.h> |
33 #include <cmpluginpacketdatadef.h> |
33 #include <cmpluginpacketdatadef.h> |
34 |
34 |
35 #include <cmdestinationext.h> |
35 #include <cmdestination.h> |
36 #include <cmmanagerdef.h> |
36 #include <cmmanagerdef.h> |
37 |
37 |
38 #include "iaupdateconnectionmethod.h" |
38 #include "iaupdateconnectionmethod.h" |
39 #include "iaupdateprivatecrkeys.h" |
39 #include "iaupdateprivatecrkeys.h" |
40 #include "iaupdatefwfotamodel.h" |
40 #include "iaupdatefwfotamodel.h" |
422 User::LeaveIfError( |
422 User::LeaveIfError( |
423 cenrep->Get( KIAUpdateAccessPoint, connMethodId ) ); |
423 cenrep->Get( KIAUpdateAccessPoint, connMethodId ) ); |
424 CleanupStack::PopAndDestroy( cenrep ); |
424 CleanupStack::PopAndDestroy( cenrep ); |
425 cenrep = NULL; |
425 cenrep = NULL; |
426 |
426 |
427 RCmManagerExt cmManagerExt; |
427 RCmManager cmManager; |
428 cmManagerExt.OpenL(); |
428 cmManager.OpenL(); |
429 CleanupClosePushL( cmManagerExt ); |
429 CleanupClosePushL( cmManager ); |
430 |
430 |
431 if ( connMethodId == -1 ) |
431 if ( connMethodId == -1 ) |
432 { |
432 { |
433 //check what is the default connection by users |
433 //check what is the default connection by users |
434 |
434 |
435 TCmDefConnValue DCSetting; |
435 TCmDefConnValue DCSetting; |
436 cmManagerExt.ReadDefConnL( DCSetting ); |
436 cmManager.ReadDefConnL( DCSetting ); |
437 |
437 |
438 |
438 |
439 switch ( DCSetting.iType ) |
439 switch ( DCSetting.iType ) |
440 { |
440 { |
441 case ECmDefConnAlwaysAsk: |
441 case ECmDefConnAlwaysAsk: |
442 case ECmDefConnAskOnce: |
442 case ECmDefConnAskOnce: |
443 { |
443 { |
444 //go with the best IAP under internet snap |
444 //go with the best IAP under internet snap |
445 connectionMethodId = GetBestIAPInInternetSNAPL( cmManagerExt ); |
445 connectionMethodId = GetBestIAPInInternetSNAPL( cmManager ); |
446 break; |
446 break; |
447 } |
447 } |
448 case ECmDefConnDestination: |
448 case ECmDefConnDestination: |
449 { |
449 { |
450 //go with the best IAP under this snap |
450 //go with the best IAP under this snap |
451 connectionMethodId = GetBestIAPInThisSNAPL( cmManagerExt, DCSetting.iId ); |
451 connectionMethodId = GetBestIAPInThisSNAPL( cmManager, DCSetting.iId ); |
452 break; |
452 break; |
453 } |
453 } |
454 case ECmDefConnConnectionMethod: |
454 case ECmDefConnConnectionMethod: |
455 { |
455 { |
456 //go with the best IAP under this snap |
456 //go with the best IAP under this snap |
460 } |
460 } |
461 } |
461 } |
462 else if ( connMethodId == 0 ) |
462 else if ( connMethodId == 0 ) |
463 { |
463 { |
464 //no choice from user, we go with the best IAP under Internent SNAP |
464 //no choice from user, we go with the best IAP under Internent SNAP |
465 connectionMethodId = GetBestIAPInInternetSNAPL( cmManagerExt ); |
465 connectionMethodId = GetBestIAPInInternetSNAPL( cmManager ); |
466 } |
466 } |
467 else |
467 else |
468 { |
468 { |
469 |
469 |
470 // It was some SNAP value |
470 // It was some SNAP value |
471 connectionMethodId = GetBestIAPInThisSNAPL( cmManagerExt, connMethodId ); |
471 connectionMethodId = GetBestIAPInThisSNAPL( cmManager, connMethodId ); |
472 } |
472 } |
473 |
473 |
474 CleanupStack::PopAndDestroy( &cmManagerExt ); |
474 CleanupStack::PopAndDestroy( &cmManager ); |
475 |
475 |
476 return connectionMethodId; |
476 return connectionMethodId; |
477 |
477 |
478 } |
478 } |
479 |
479 |
480 |
480 |
481 // ----------------------------------------------------------------------------- |
481 // ----------------------------------------------------------------------------- |
482 // CIAUpdateFWSyncHandler::GetBestIAPInInternetSNAPL |
482 // CIAUpdateFWSyncHandler::GetBestIAPInInternetSNAPL |
483 // ----------------------------------------------------------------------------- |
483 // ----------------------------------------------------------------------------- |
484 // |
484 // |
485 TUint32 CIAUpdateFWSyncHandler::GetBestIAPInInternetSNAPL( RCmManagerExt& aCmManagerExt ) |
485 TUint32 CIAUpdateFWSyncHandler::GetBestIAPInInternetSNAPL( RCmManager& aCmManager ) |
486 { |
486 { |
487 //select IAP from Internet SNAP |
487 //select IAP from Internet SNAP |
488 RArray<TUint32> destIdArray; |
488 RArray<TUint32> destIdArray; |
489 aCmManagerExt.AllDestinationsL( destIdArray ); |
489 aCmManager.AllDestinationsL( destIdArray ); |
490 TUint32 InternetSNAPID = 0; |
490 TUint32 InternetSNAPID = 0; |
491 for ( TInt i = 0; i< destIdArray.Count(); i++ ) |
491 for ( TInt i = 0; i< destIdArray.Count(); i++ ) |
492 { |
492 { |
493 RCmDestinationExt dest = aCmManagerExt.DestinationL( destIdArray[i] ); |
493 RCmDestination dest = aCmManager.DestinationL( destIdArray[i] ); |
494 CleanupClosePushL( dest ); |
494 CleanupClosePushL( dest ); |
495 |
495 |
496 if ( dest.MetadataL( CMManager::ESnapMetadataInternet ) ) |
496 if ( dest.MetadataL( CMManager::ESnapMetadataInternet ) ) |
497 { |
497 { |
498 InternetSNAPID = destIdArray[i]; |
498 InternetSNAPID = destIdArray[i]; |
501 } |
501 } |
502 CleanupStack::PopAndDestroy( &dest ); |
502 CleanupStack::PopAndDestroy( &dest ); |
503 } |
503 } |
504 destIdArray.Reset(); |
504 destIdArray.Reset(); |
505 |
505 |
506 return GetBestIAPInThisSNAPL( aCmManagerExt, InternetSNAPID ); |
506 return GetBestIAPInThisSNAPL( aCmManager, InternetSNAPID ); |
507 } |
507 } |
508 |
508 |
509 |
509 |
510 |
510 |
511 // ----------------------------------------------------------------------------- |
511 // ----------------------------------------------------------------------------- |
512 // CIAUpdateFWSyncHandler::GetBestIAPInThisSNAPL |
512 // CIAUpdateFWSyncHandler::GetBestIAPInThisSNAPL |
513 // ----------------------------------------------------------------------------- |
513 // ----------------------------------------------------------------------------- |
514 // |
514 // |
515 TUint32 CIAUpdateFWSyncHandler::GetBestIAPInThisSNAPL( RCmManagerExt& aCmManagerExt, TUint32 aSNAPID ) |
515 TUint32 CIAUpdateFWSyncHandler::GetBestIAPInThisSNAPL( RCmManager& aCmManager, TUint32 aSNAPID ) |
516 { |
516 { |
517 //get all usable IAPs |
517 //get all usable IAPs |
518 TConnMonIapInfoBuf iapInfo; |
518 TConnMonIapInfoBuf iapInfo; |
519 TRequestStatus status; |
519 TRequestStatus status; |
520 |
520 |
526 User::WaitForRequest( status ); |
526 User::WaitForRequest( status ); |
527 User::LeaveIfError( status.Int() ); |
527 User::LeaveIfError( status.Int() ); |
528 |
528 |
529 CleanupStack::PopAndDestroy( &connMon ); |
529 CleanupStack::PopAndDestroy( &connMon ); |
530 |
530 |
531 RCmDestinationExt dest = aCmManagerExt.DestinationL( aSNAPID ); |
531 RCmDestination dest = aCmManager.DestinationL( aSNAPID ); |
532 CleanupClosePushL( dest ); |
532 CleanupClosePushL( dest ); |
533 |
533 |
534 // Check whether the SNAP contains any IAP. |
534 // Check whether the SNAP contains any IAP. |
535 for (TInt i = 0; i < dest.ConnectionMethodCount(); i++ ) |
535 for (TInt i = 0; i < dest.ConnectionMethodCount(); i++ ) |
536 { |
536 { |
537 RCmConnectionMethodExt cm = dest.ConnectionMethodL( i ); |
537 RCmConnectionMethod cm = dest.ConnectionMethodL( i ); |
538 CleanupClosePushL( cm ); |
538 CleanupClosePushL( cm ); |
539 |
539 |
540 TUint32 iapid= cm.GetIntAttributeL( CMManager::ECmIapId ); |
540 TUint32 iapid= cm.GetIntAttributeL( CMManager::ECmIapId ); |
541 |
541 |
542 for ( TInt i = 0; i < iapInfo().iCount; i++ ) |
542 for ( TInt i = 0; i < iapInfo().iCount; i++ ) |