492 |
492 |
493 TBool iapTypeLanOrWlan = EFalse; |
493 TBool iapTypeLanOrWlan = EFalse; |
494 TConnectionId connId = iSession->ConnectionId(); |
494 TConnectionId connId = iSession->ConnectionId(); |
495 |
495 |
496 ChooseBestIAPL( iChooseIapPref, availableIAPList, iNextBestExists ); |
496 ChooseBestIAPL( iChooseIapPref, availableIAPList, iNextBestExists ); |
497 CleanupStack::PopAndDestroy( &availableIAPList ); |
|
498 TUint32 validateIapId = iChooseIapPref.IapId(); |
497 TUint32 validateIapId = iChooseIapPref.IapId(); |
499 // Check if any suitable IAP's were found, if not then complete selection with error code |
498 // Check if any suitable IAP's were found, if not then complete selection with error code |
500 if ( validateIapId == 0 ) |
499 if ( validateIapId == 0 ) |
501 { |
500 { |
502 ChooseIapComplete( KErrNotFound, NULL ); |
501 ChooseIapComplete( KErrNotFound, NULL ); |
|
502 CleanupStack::PopAndDestroy( &availableIAPList ); |
503 return; |
503 return; |
504 } |
504 } |
505 |
505 |
506 TUint32 retNetId( 0 ); |
506 TUint32 retNetId( 0 ); |
507 iCommsDatAccess->ValidateIapL( connId, |
507 iCommsDatAccess->ValidateIapL( connId, |
724 TInt aError, |
728 TInt aError, |
725 const TMpmConnPref* aPolicyPref ) |
729 const TMpmConnPref* aPolicyPref ) |
726 { |
730 { |
727 MPMLOGSTRING2( "CMPMIapSelection::ChooseIapComplete aError = %d", aError ) |
731 MPMLOGSTRING2( "CMPMIapSelection::ChooseIapComplete aError = %d", aError ) |
728 |
732 |
|
733 if ( ( aError == KErrNone ) && |
|
734 !( iChooseIapPref.NoteBehaviour() & |
|
735 TExtendedConnPref::ENoteBehaviourConnDisableNotes ) ) |
|
736 { |
|
737 TConnectionState state = |
|
738 iSession->MyServer().CheckUsageOfIap( aPolicyPref->IapId(), |
|
739 iSession->ConnectionId() ); |
|
740 TBool connectionAlreadyActive = (state == EStarted || state == EStarting || state == ERoaming); |
|
741 if ( !connectionAlreadyActive && |
|
742 ( iSession->IsMMSIap( aPolicyPref->IapId() ) == EFalse ) ) |
|
743 { |
|
744 CConnectionUiUtilities* connUiUtils( NULL ); |
|
745 TRAPD( popupError, connUiUtils = CConnectionUiUtilities::NewL() ); |
|
746 if ( popupError == KErrNone ) |
|
747 { |
|
748 connUiUtils->ConnectingViaDiscreetPopup( aPolicyPref->IapId() ); |
|
749 delete connUiUtils; |
|
750 } |
|
751 } |
|
752 } |
|
753 |
729 if( iWlanDialog ) |
754 if( iWlanDialog ) |
730 { |
755 { |
731 delete iWlanDialog; |
756 delete iWlanDialog; |
732 iWlanDialog = NULL; |
757 iWlanDialog = NULL; |
733 } |
758 } |
734 |
759 |
|
760 iSession->ChooseIapComplete( aError, aPolicyPref ); |
735 // Set choose iap state to none |
761 // Set choose iap state to none |
736 iChooseIapState = ENoConnection; |
762 iChooseIapState = ENoConnection; |
737 iNextBestExists = EFalse; |
763 iNextBestExists = EFalse; |
738 iUserSelectionSnapId = 0; |
764 iUserSelectionSnapId = 0; |
739 iUserSelectionIapId = 0; |
765 iUserSelectionIapId = 0; |
740 iImplicitState = EImplicitStart; |
766 iImplicitState = EImplicitStart; |
741 |
|
742 iSession->ChooseIapComplete( aError, aPolicyPref ); |
|
743 } |
767 } |
744 |
768 |
745 |
769 |
746 // ----------------------------------------------------------------------------- |
770 // ----------------------------------------------------------------------------- |
747 // CMPMIapSelection::UserWlanSelectionDoneL |
771 // CMPMIapSelection::UserWlanSelectionDoneL |
1003 void CMPMIapSelection::ImplicitConnectionIapSelectionL() |
1020 void CMPMIapSelection::ImplicitConnectionIapSelectionL() |
1004 { |
1021 { |
1005 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL" ) |
1022 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL" ) |
1006 iSession->AvailableUnblacklistedIapsL( iStoredAvailableIaps, iSession->ConnectionId() ); |
1023 iSession->AvailableUnblacklistedIapsL( iStoredAvailableIaps, iSession->ConnectionId() ); |
1007 |
1024 |
1008 // Create and initiate user dialog only if it hasnot |
1025 // Create and initiate user dialog |
1009 // been cancelled in last 10s(KTimeout) |
|
1010 // |
1026 // |
1011 if ( !iSession->MyServer().IsConnSelectionDlgTimerOn() ) |
1027 iDialog = CMPMDialog::NewL( *this, |
1012 { |
|
1013 iDialog = CMPMDialog::NewL( *this, |
|
1014 iStoredAvailableIaps, |
1028 iStoredAvailableIaps, |
1015 iChooseIapPref.BearerSet(), |
1029 iChooseIapPref.BearerSet(), |
1016 *iSession->MyServer().ConnectDialogQueue(), |
1030 *iSession->MyServer().ConnectDialogQueue(), |
1017 iSession->MyServer() ); |
1031 iSession->MyServer() ); |
1018 } |
|
1019 else |
|
1020 { |
|
1021 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL, iConnSelectionDlgTimer running" ) |
|
1022 ChooseIapComplete( KErrCancel, NULL ); |
|
1023 } |
|
1024 } |
1032 } |
1025 |
1033 |
1026 // ----------------------------------------------------------------------------- |
1034 // ----------------------------------------------------------------------------- |
1027 // CMPMIapSelection::ImplicitConnectionL |
1035 // CMPMIapSelection::ImplicitConnectionL |
1028 // ----------------------------------------------------------------------------- |
1036 // ----------------------------------------------------------------------------- |
1029 // |
1037 // |
1030 void CMPMIapSelection::ImplicitConnectionL() |
1038 void CMPMIapSelection::ImplicitConnectionL() |
1031 { |
1039 { |
1032 if( iImplicitState == EImplicitStart ) |
1040 if( iImplicitState == EImplicitStart ) |
1033 { |
1041 { |
1034 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionL EImplicitStart" ) |
1042 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitStart" ) |
1035 iImplicitState = EImplicitWlanScan; |
1043 iImplicitState = EImplicitWlanScan; |
1036 ImplicitConnectionCheckWlanScanNeededL(); |
1044 ImplicitConnectionCheckWlanScanNeededL(); |
1037 } |
1045 } |
1038 else if( iImplicitState == EImplicitWlanScan ) |
1046 else if( iImplicitState == EImplicitWlanScan ) |
1039 { |
1047 { |
1040 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionL EImplicitWlanScan" ) |
1048 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitWlanScan" ) |
1041 iImplicitState = EImplicitUserSelection; |
1049 iImplicitState = EImplicitUserSelection; |
1042 ImplicitConnectionIapSelectionL(); |
1050 ImplicitConnectionIapSelectionL(); |
1043 } |
1051 } |
1044 else if( iImplicitState == EImplicitUserSelection ) |
1052 else if( iImplicitState == EImplicitUserSelection ) |
1045 { |
1053 { |
1046 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionL EImplicitUserSelection" ) |
1054 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitUserSelection" ) |
1047 iImplicitState = EImplicitWlanQuery; |
1055 iImplicitState = EImplicitWlanQuery; |
1048 ImplicitConnectionWlanNoteL(); |
1056 ImplicitConnectionWlanNoteL(); |
1049 } |
1057 } |
1050 else //EImplicitWlanQuery |
1058 else //EImplicitWlanQuery |
1051 { |
1059 { |
1052 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionL EImplicitWlanQuery" ) |
1060 MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitWlanQuery" ) |
1053 CompleteImplicitConnectionL(); |
1061 CompleteImplicitConnectionL(); |
1054 } |
1062 } |
1055 } |
1063 } |
1056 |
1064 |
1057 // ----------------------------------------------------------------------------- |
1065 // ----------------------------------------------------------------------------- |
1126 for ( TInt k = destCount; k >= 0; k-- ) |
1134 for ( TInt k = destCount; k >= 0; k-- ) |
1127 { |
1135 { |
1128 ret = aAvailableIAPs.Find( destNetIaps[k].iIapId ); |
1136 ret = aAvailableIAPs.Find( destNetIaps[k].iIapId ); |
1129 if ( ret == KErrNotFound ) |
1137 if ( ret == KErrNotFound ) |
1130 { |
1138 { |
1131 TBool isTunDriver = iCommsDatAccess->IsTunDriverIap( |
1139 MPMLOGSTRING2( "CMPMIapSelection::ChooseBestIAPL: \ |
1132 destNetIaps[k].iIapId ); |
1140 Remove unavailable IAP = %i", destNetIaps[k].iIapId ) |
1133 if ( !isTunDriver ) |
1141 destNetIaps.Remove( k ); |
1134 { |
|
1135 MPMLOGSTRING2( "CMPMIapSelection::ChooseBestIAPL: \ |
|
1136 Remove unavailable IAP = %i", destNetIaps[k].iIapId ) |
|
1137 destNetIaps.Remove( k ); |
|
1138 } |
|
1139 } |
1142 } |
1140 } |
1143 } |
1141 |
1144 |
1142 // Remove any unavailable IAP from embeddedIaps |
1145 // Remove any unavailable IAP from embeddedIaps |
1143 // |
1146 // |
1149 for ( TInt m = embedCount; m >= 0; m-- ) |
1152 for ( TInt m = embedCount; m >= 0; m-- ) |
1150 { |
1153 { |
1151 ret = aAvailableIAPs.Find( embeddedIaps[m].iIapId ); |
1154 ret = aAvailableIAPs.Find( embeddedIaps[m].iIapId ); |
1152 if ( ret == KErrNotFound ) |
1155 if ( ret == KErrNotFound ) |
1153 { |
1156 { |
1154 TBool isTunDriver = iCommsDatAccess->IsTunDriverIap( embeddedIaps[m].iIapId ); |
1157 // Remove IapId because it's not available |
1155 if ( !isTunDriver ) |
1158 // |
1156 { |
1159 MPMLOGSTRING2( "CMPMIapSelection::ChooseBestIAPL: \ |
1157 // Remove IapId because it's not available |
|
1158 MPMLOGSTRING2( "CMPMIapSelection::ChooseBestIAPL: \ |
|
1159 Remove unavailable IAP = %i", embeddedIaps[m].iIapId ) |
1160 Remove unavailable IAP = %i", embeddedIaps[m].iIapId ) |
1160 embeddedIaps.Remove( m ); |
1161 embeddedIaps.Remove( m ); |
1161 } |
|
1162 } |
1162 } |
1163 } |
1163 } |
1164 } |
1164 } |
1165 |
1165 |
1166 // Determine the actual priorities for virtual IAPs and embedded Snaps |
1166 // Determine the actual priorities for virtual IAPs and embedded Snaps |