14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 #include <e32std.h> |
17 #include <e32std.h> |
18 #include <escapeutils.h> |
18 #include <escapeutils.h> |
|
19 #include <cmmanager.h> |
|
20 #include <cmdestination.h> |
|
21 #include <cmconnectionmethoddef.h> |
|
22 #include <cmpluginwlandef.h> |
19 |
23 |
20 #include "scpservicemanager.h" |
24 #include "scpservicemanager.h" |
21 #include "scpsettinghandler.h" |
25 #include "scpsettinghandler.h" |
22 #include "scpservicestorage.h" |
26 #include "scpservicestorage.h" |
23 #include "scputility.h" |
27 #include "scputility.h" |
179 TCCHSubserviceType aSubServiceType ) |
183 TCCHSubserviceType aSubServiceType ) |
180 { |
184 { |
181 SCPLOGSTRING2( "CScpServiceManager::EnableServiceL service:%i", aServiceId ); |
185 SCPLOGSTRING2( "CScpServiceManager::EnableServiceL service:%i", aServiceId ); |
182 SCPLOGSTRING2( "CScpServiceManager::EnableServiceL type:%i", aSubServiceType ); |
186 SCPLOGSTRING2( "CScpServiceManager::EnableServiceL type:%i", aSubServiceType ); |
183 __ASSERT_DEBUG( aServiceId > 0, User::Panic( KNullDesC, KErrNotFound ) ); |
187 __ASSERT_DEBUG( aServiceId > 0, User::Panic( KNullDesC, KErrNotFound ) ); |
184 |
188 |
|
189 CheckRestrictedConnectionsL( aServiceId ); |
|
190 |
185 CScpService* service = GetServiceL( aServiceId, aSubServiceType ); |
191 CScpService* service = GetServiceL( aServiceId, aSubServiceType ); |
186 |
192 |
187 if( !service ) |
193 if( !service ) |
188 { |
194 { |
189 service = CreateServiceL( aServiceId, aSubServiceType ); |
195 service = CreateServiceL( aServiceId, aSubServiceType ); |
803 } |
809 } |
804 |
810 |
805 |
811 |
806 if( aParameter==ECchUsername ) |
812 if( aParameter==ECchUsername ) |
807 { |
813 { |
808 HBufC* buffer = NULL; |
|
809 TBuf16<KTempBufMaxLength> tempBuf; |
814 TBuf16<KTempBufMaxLength> tempBuf; |
810 TBuf8<KUsernameMaxLength> username; |
815 TBuf8<KUsernameMaxLength> username; |
811 |
816 |
812 if( sipConnection->GetUsername( username ) == KErrNone ) |
817 if( sipConnection->GetUsername( username ) == KErrNone ) |
813 { |
818 { |
814 tempBuf.Copy( username ); |
819 // Decode encoded username (spaces to %20). |
|
820 HBufC8* decodedUsername = EscapeUtils::EscapeDecodeL( username ); |
|
821 CleanupStack::PushL( decodedUsername ); |
815 |
822 |
816 // Decode encoded username (spaces to %20). |
823 HBufC* userName16 = |
817 buffer = EscapeUtils::EscapeDecodeL( tempBuf ); |
824 EscapeUtils::ConvertToUnicodeFromUtf8L( decodedUsername->Des() ); |
818 |
825 |
819 if ( buffer ) |
826 CleanupStack::PopAndDestroy( decodedUsername ); |
820 { |
827 |
821 aValue.Copy( buffer->Des() ); |
828 if ( userName16 ) |
822 delete buffer; |
829 { |
823 buffer = NULL; |
830 aValue.Copy( userName16->Des() ); |
|
831 delete userName16; |
|
832 userName16 = NULL; |
824 } |
833 } |
825 else |
834 else |
826 { |
835 { |
827 aValue.Copy( KNullDesC ); |
836 aValue.Copy( KNullDesC ); |
828 } |
837 } |
1005 delete service; |
1014 delete service; |
1006 service = NULL; |
1015 service = NULL; |
1007 } |
1016 } |
1008 } |
1017 } |
1009 |
1018 |
|
1019 // ----------------------------------------------------------------------------- |
|
1020 // CScpServiceManager::CheckRestrictedConnectionsL |
|
1021 // ----------------------------------------------------------------------------- |
|
1022 // |
|
1023 void CScpServiceManager::CheckRestrictedConnectionsL( TUint aServiceId ) |
|
1024 { |
|
1025 if ( !iSettingHandler->IsVoIPOverWcdmaAllowedL( aServiceId ) ) |
|
1026 { |
|
1027 SCPLOGSTRING( "CScpServiceManager::CheckRestrictedConnectionsL WCDMA not allowed" ); |
|
1028 |
|
1029 TBool sipConnectionCreated( EFalse ); |
|
1030 CScpSipConnection* sipConnection = GetSipConnectionL( |
|
1031 aServiceId, |
|
1032 ECCHVoIPSub, |
|
1033 sipConnectionCreated ); |
|
1034 |
|
1035 if( sipConnectionCreated ) |
|
1036 { |
|
1037 CleanupStack::PushL( sipConnection ); |
|
1038 } |
|
1039 |
|
1040 TUint32 snapId( KErrNone ); |
|
1041 sipConnection->GetSnap( snapId ); |
|
1042 |
|
1043 RArray<TInt> iaps; |
|
1044 CleanupClosePushL( iaps ); |
|
1045 // get first iap and iap's bearer, there must be atleast |
|
1046 // one iap if not cch does not work as it should |
|
1047 RCmManager cmm; |
|
1048 cmm.OpenL(); |
|
1049 CleanupClosePushL( cmm ); |
|
1050 RCmDestination destination( cmm.DestinationL( snapId ) ); |
|
1051 CleanupClosePushL( destination ); |
|
1052 |
|
1053 for ( TInt i = 0; i < destination.ConnectionMethodCount(); i++ ) |
|
1054 { |
|
1055 RCmConnectionMethod cm = destination.ConnectionMethodL( i ); |
|
1056 CleanupClosePushL( cm ); |
|
1057 |
|
1058 if( KUidWlanBearerType == |
|
1059 cm.GetIntAttributeL( CMManager::ECmBearerType ) ) |
|
1060 { |
|
1061 SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL WLAN IAP found" ); |
|
1062 iaps.Append( cm.GetIntAttributeL( CMManager::ECmIapId ) ); |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 SCPLOGSTRING2( "CScpServiceManager::CheckAvailableConnectionsL iaps count = %d", iaps.Count() ); |
|
1067 SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL 3G IAP found break the loop" ); |
|
1068 i = destination.ConnectionMethodCount(); |
|
1069 } |
|
1070 |
|
1071 CleanupStack::PopAndDestroy( &cm ); |
|
1072 } |
|
1073 |
|
1074 TBool available( EFalse ); |
|
1075 for ( TInt j( 0 ); j < iaps.Count(); j++ ) |
|
1076 { |
|
1077 if ( sipConnection->IsIapConnectionAvailable( iaps[ j ] ) ) |
|
1078 { |
|
1079 SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL WLAN IAP available" ); |
|
1080 available = ETrue; |
|
1081 break; |
|
1082 } |
|
1083 } |
|
1084 |
|
1085 CleanupStack::PopAndDestroy( &destination ); |
|
1086 CleanupStack::PopAndDestroy( &cmm ); |
|
1087 CleanupStack::PopAndDestroy( &iaps ); |
|
1088 |
|
1089 if( sipConnectionCreated ) |
|
1090 { |
|
1091 CleanupStack::PopAndDestroy( sipConnection ); |
|
1092 } |
|
1093 |
|
1094 if ( !available ) |
|
1095 { |
|
1096 User::Leave( KCCHErrorAccessPointNotDefined ); |
|
1097 } |
|
1098 } |
|
1099 } |
|
1100 |
1010 // End of file |
1101 // End of file |