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