1 /* |
1 /* |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008 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". |
17 |
17 |
18 |
18 |
19 |
19 |
20 |
20 |
21 // INCLUDES |
21 // INCLUDES |
|
22 #include <aknnotewrappers.h> |
|
23 #include <AknWaitDialog.h> |
22 #include <StringLoader.h> |
24 #include <StringLoader.h> |
23 #include <e32property.h> |
25 #include <e32property.h> |
24 #include <data_caging_path_literals.hrh> // for resource and bitmap directories |
26 #include <data_caging_path_literals.hrh> // for resource and bitmap directories |
25 #include <SyncMLErr.h> // sync error codes |
27 #include <SyncMLErr.h> // sync error codes |
|
28 #include <iaupdate.rsg> |
|
29 #include <AknsUtils.h> |
26 #include <DevManInternalCRKeys.h> |
30 #include <DevManInternalCRKeys.h> |
27 #include <centralrepository.h> |
31 #include <centralrepository.h> |
28 #include <rconnmon.h> |
32 #include <rconnmon.h> |
29 #include <es_enum.h> |
33 #include <es_enum.h> |
30 |
34 |
31 #include <cmconnectionmethod.h> |
35 #include <cmconnectionmethodext.h> |
32 #include <cmconnectionmethoddef.h> |
36 #include <cmconnectionmethoddef.h> |
33 #include <cmpluginpacketdatadef.h> |
37 #include <cmpluginpacketdatadef.h> |
34 |
38 #include <cmconnectionmethoddef.h> |
35 #include <cmdestination.h> |
39 #include <cmconnectionmethodext.h> |
|
40 #include <cmdestinationext.h> |
36 #include <cmmanagerdef.h> |
41 #include <cmmanagerdef.h> |
37 |
|
38 #include <uikon.hrh> |
|
39 |
42 |
40 #include "iaupdateconnectionmethod.h" |
43 #include "iaupdateconnectionmethod.h" |
41 #include "iaupdateprivatecrkeys.h" |
44 #include "iaupdateprivatecrkeys.h" |
42 #include "iaupdatefwfotamodel.h" |
45 #include "iaupdatefwfotamodel.h" |
43 #include "iaupdatefwsyncappengine.h" |
46 #include "iaupdatefwsyncappengine.h" |
329 KNSmlDMNoUserInitiatedJob ); |
332 KNSmlDMNoUserInitiatedJob ); |
330 |
333 |
331 iSyncRunning = EFalse; |
334 iSyncRunning = EFalse; |
332 iSyncError = aError; |
335 iSyncError = aError; |
333 |
336 |
334 /*if ( iWaitDialog ) |
337 if ( iWaitDialog ) |
335 { |
338 { |
336 |
339 |
337 iWaitDialog->ProcessFinishedL(); |
340 iWaitDialog->ProcessFinishedL(); |
338 iWaitDialog = NULL; |
341 iWaitDialog = NULL; |
339 }*/ |
342 } |
340 |
343 |
341 iUseFotaProgressNote = EFalse; |
344 iUseFotaProgressNote = EFalse; |
342 iSyncJob.Close(); |
345 iSyncJob.Close(); |
343 FLOG("[IAUPDATE] CIAUpdateFWSyncHandler::SynchronizeCompletedL 13"); |
346 FLOG("[IAUPDATE] CIAUpdateFWSyncHandler::SynchronizeCompletedL 13"); |
344 // handle error in HandleActiveCallL (when active caller completes) |
347 // handle error in HandleActiveCallL (when active caller completes) |
424 User::LeaveIfError( |
427 User::LeaveIfError( |
425 cenrep->Get( KIAUpdateAccessPoint, connMethodId ) ); |
428 cenrep->Get( KIAUpdateAccessPoint, connMethodId ) ); |
426 CleanupStack::PopAndDestroy( cenrep ); |
429 CleanupStack::PopAndDestroy( cenrep ); |
427 cenrep = NULL; |
430 cenrep = NULL; |
428 |
431 |
429 RCmManager cmManager; |
432 RCmManagerExt cmManagerExt; |
430 cmManager.OpenL(); |
433 cmManagerExt.OpenL(); |
431 CleanupClosePushL( cmManager ); |
434 CleanupClosePushL( cmManagerExt ); |
432 |
435 |
433 if ( connMethodId == -1 ) |
436 if ( connMethodId == -1 ) |
434 { |
437 { |
435 //check what is the default connection by users |
438 //check what is the default connection by users |
436 |
439 |
437 TCmDefConnValue DCSetting; |
440 TCmDefConnValue DCSetting; |
438 cmManager.ReadDefConnL( DCSetting ); |
441 cmManagerExt.ReadDefConnL( DCSetting ); |
439 |
442 |
440 |
443 |
441 switch ( DCSetting.iType ) |
444 switch ( DCSetting.iType ) |
442 { |
445 { |
443 case ECmDefConnAlwaysAsk: |
446 case ECmDefConnAlwaysAsk: |
444 case ECmDefConnAskOnce: |
447 case ECmDefConnAskOnce: |
445 { |
448 { |
446 //go with the best IAP under internet snap |
449 //go with the best IAP under internet snap |
447 connectionMethodId = GetBestIAPInInternetSNAPL( cmManager ); |
450 connectionMethodId = GetBestIAPInInternetSNAPL( cmManagerExt ); |
448 break; |
451 break; |
449 } |
452 } |
450 case ECmDefConnDestination: |
453 case ECmDefConnDestination: |
451 { |
454 { |
452 //go with the best IAP under this snap |
455 //go with the best IAP under this snap |
453 connectionMethodId = GetBestIAPInThisSNAPL( cmManager, DCSetting.iId ); |
456 connectionMethodId = GetBestIAPInThisSNAPL( cmManagerExt, DCSetting.iId ); |
454 break; |
457 break; |
455 } |
458 } |
456 case ECmDefConnConnectionMethod: |
459 case ECmDefConnConnectionMethod: |
457 { |
460 { |
458 //go with the best IAP under this snap |
461 //go with the best IAP under this snap |
462 } |
465 } |
463 } |
466 } |
464 else if ( connMethodId == 0 ) |
467 else if ( connMethodId == 0 ) |
465 { |
468 { |
466 //no choice from user, we go with the best IAP under Internent SNAP |
469 //no choice from user, we go with the best IAP under Internent SNAP |
467 connectionMethodId = GetBestIAPInInternetSNAPL( cmManager ); |
470 connectionMethodId = GetBestIAPInInternetSNAPL( cmManagerExt ); |
468 } |
471 } |
469 else |
472 else |
470 { |
473 { |
471 |
474 |
472 // It was some SNAP value |
475 // It was some SNAP value |
473 connectionMethodId = GetBestIAPInThisSNAPL( cmManager, connMethodId ); |
476 connectionMethodId = GetBestIAPInThisSNAPL( cmManagerExt, connMethodId ); |
474 } |
477 } |
475 |
478 |
476 CleanupStack::PopAndDestroy( &cmManager ); |
479 CleanupStack::PopAndDestroy( &cmManagerExt ); |
477 |
480 |
478 return connectionMethodId; |
481 return connectionMethodId; |
479 |
482 |
480 } |
483 } |
481 |
484 |
482 |
485 |
483 // ----------------------------------------------------------------------------- |
486 // ----------------------------------------------------------------------------- |
484 // CIAUpdateFWSyncHandler::GetBestIAPInInternetSNAPL |
487 // CIAUpdateFWSyncHandler::GetBestIAPInInternetSNAPL |
485 // ----------------------------------------------------------------------------- |
488 // ----------------------------------------------------------------------------- |
486 // |
489 // |
487 TUint32 CIAUpdateFWSyncHandler::GetBestIAPInInternetSNAPL( RCmManager& aCmManager ) |
490 TUint32 CIAUpdateFWSyncHandler::GetBestIAPInInternetSNAPL( RCmManagerExt& aCmManagerExt ) |
488 { |
491 { |
489 //select IAP from Internet SNAP |
492 //select IAP from Internet SNAP |
490 RArray<TUint32> destIdArray; |
493 RArray<TUint32> destIdArray; |
491 aCmManager.AllDestinationsL( destIdArray ); |
494 aCmManagerExt.AllDestinationsL( destIdArray ); |
492 TUint32 InternetSNAPID = 0; |
495 TUint32 InternetSNAPID = 0; |
493 for ( TInt i = 0; i< destIdArray.Count(); i++ ) |
496 for ( TInt i = 0; i< destIdArray.Count(); i++ ) |
494 { |
497 { |
495 RCmDestination dest = aCmManager.DestinationL( destIdArray[i] ); |
498 RCmDestinationExt dest = aCmManagerExt.DestinationL( destIdArray[i] ); |
496 CleanupClosePushL( dest ); |
499 CleanupClosePushL( dest ); |
497 |
500 |
498 if ( dest.MetadataL( CMManager::ESnapMetadataInternet ) ) |
501 if ( dest.MetadataL( CMManager::ESnapMetadataInternet ) ) |
499 { |
502 { |
500 InternetSNAPID = destIdArray[i]; |
503 InternetSNAPID = destIdArray[i]; |
503 } |
506 } |
504 CleanupStack::PopAndDestroy( &dest ); |
507 CleanupStack::PopAndDestroy( &dest ); |
505 } |
508 } |
506 destIdArray.Reset(); |
509 destIdArray.Reset(); |
507 |
510 |
508 return GetBestIAPInThisSNAPL( aCmManager, InternetSNAPID ); |
511 return GetBestIAPInThisSNAPL( aCmManagerExt, InternetSNAPID ); |
509 } |
512 } |
510 |
513 |
511 |
514 |
512 |
515 |
513 // ----------------------------------------------------------------------------- |
516 // ----------------------------------------------------------------------------- |
514 // CIAUpdateFWSyncHandler::GetBestIAPInThisSNAPL |
517 // CIAUpdateFWSyncHandler::GetBestIAPInThisSNAPL |
515 // ----------------------------------------------------------------------------- |
518 // ----------------------------------------------------------------------------- |
516 // |
519 // |
517 TUint32 CIAUpdateFWSyncHandler::GetBestIAPInThisSNAPL( RCmManager& aCmManager, TUint32 aSNAPID ) |
520 TUint32 CIAUpdateFWSyncHandler::GetBestIAPInThisSNAPL( RCmManagerExt& aCmManagerExt, TUint32 aSNAPID ) |
518 { |
521 { |
519 //get all usable IAPs |
522 //get all usable IAPs |
520 TConnMonIapInfoBuf iapInfo; |
523 TConnMonIapInfoBuf iapInfo; |
521 TRequestStatus status; |
524 TRequestStatus status; |
522 |
525 |
528 User::WaitForRequest( status ); |
531 User::WaitForRequest( status ); |
529 User::LeaveIfError( status.Int() ); |
532 User::LeaveIfError( status.Int() ); |
530 |
533 |
531 CleanupStack::PopAndDestroy( &connMon ); |
534 CleanupStack::PopAndDestroy( &connMon ); |
532 |
535 |
533 RCmDestination dest = aCmManager.DestinationL( aSNAPID ); |
536 RCmDestinationExt dest = aCmManagerExt.DestinationL( aSNAPID ); |
534 CleanupClosePushL( dest ); |
537 CleanupClosePushL( dest ); |
535 |
538 |
536 // Check whether the SNAP contains any IAP. |
539 // Check whether the SNAP contains any IAP. |
537 for (TInt i = 0; i < dest.ConnectionMethodCount(); i++ ) |
540 for (TInt i = 0; i < dest.ConnectionMethodCount(); i++ ) |
538 { |
541 { |
539 RCmConnectionMethod cm = dest.ConnectionMethodL( i ); |
542 RCmConnectionMethodExt cm = dest.ConnectionMethodL( i ); |
540 CleanupClosePushL( cm ); |
543 CleanupClosePushL( cm ); |
541 |
544 |
542 TUint32 iapid= cm.GetIntAttributeL( CMManager::ECmIapId ); |
545 TUint32 iapid= cm.GetIntAttributeL( CMManager::ECmIapId ); |
543 |
546 |
544 for ( TInt i = 0; i < iapInfo().iCount; i++ ) |
547 for ( TInt i = 0; i < iapInfo().iCount; i++ ) |
711 // CIAUpdateFWSyncHandler::ShowProgressDialogL |
714 // CIAUpdateFWSyncHandler::ShowProgressDialogL |
712 // ----------------------------------------------------------------------------- |
715 // ----------------------------------------------------------------------------- |
713 // |
716 // |
714 void CIAUpdateFWSyncHandler::ShowProgressDialogL( ) |
717 void CIAUpdateFWSyncHandler::ShowProgressDialogL( ) |
715 { |
718 { |
716 //iWaitDialog = new ( ELeave ) CAknWaitDialog( |
719 iWaitDialog = new ( ELeave ) CAknWaitDialog( |
717 // ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ) ); |
720 ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ) ); |
718 //iWaitDialog->ExecuteLD( R_FOTA_CHECK_WAIT_NOTE ); |
721 iWaitDialog->ExecuteLD( R_FOTA_CHECK_WAIT_NOTE ); |
719 //iWaitDialog->SetCallback( this ); |
722 iWaitDialog->SetCallback( this ); |
720 } |
723 } |
721 |
724 |
722 // ----------------------------------------------------------------------------- |
725 // ----------------------------------------------------------------------------- |
723 // CIAUpdateFWSyncHandler::HideProgressDialogL |
726 // CIAUpdateFWSyncHandler::HideProgressDialogL |
724 // ----------------------------------------------------------------------------- |
727 // ----------------------------------------------------------------------------- |
725 // |
728 // |
726 void CIAUpdateFWSyncHandler::HideProgressDialogL() |
729 void CIAUpdateFWSyncHandler::HideProgressDialogL() |
727 { |
730 { |
728 /*if ( iWaitDialog ) |
731 if ( iWaitDialog ) |
729 { |
732 { |
730 iWaitDialog->ProcessFinishedL(); |
733 iWaitDialog->ProcessFinishedL(); |
731 iWaitDialog = NULL; |
734 iWaitDialog = NULL; |
732 }*/ |
735 } |
733 } |
736 } |
734 |
737 |
735 // ----------------------------------------------------------------------------- |
738 // ----------------------------------------------------------------------------- |
736 // CIAUpdateFWSyncHandler::Session |
739 // CIAUpdateFWSyncHandler::Session |
737 // ----------------------------------------------------------------------------- |
740 // ----------------------------------------------------------------------------- |