981 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), |
988 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), |
982 KTraceFileName, __LINE__); |
989 KTraceFileName, __LINE__); |
983 iConnectStarted = ETrue; |
990 iConnectStarted = ETrue; |
984 |
991 |
985 #ifndef __WINS__ |
992 #ifndef __WINS__ |
986 TCommDbConnPref prefs; |
993 TExtendedConnPref OCCPrefs; |
987 prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); |
994 TConnPrefList prefList; |
988 prefs.SetDirection(ECommDbConnectionDirectionOutgoing); |
995 |
989 prefs.SetIapId(iIAPId); |
996 OCCPrefs.SetForcedRoaming(EFalse); //do not switch networks during an ongoing connection |
|
997 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); |
|
998 |
|
999 if(iIAPId != -1) //if a IAP was configured |
|
1000 |
|
1001 { |
|
1002 iTrace->Trace(_L("CSuplConnection::Connect : IAP configured"), KTraceFileName, __LINE__); |
|
1003 OCCPrefs.SetIapId(iIAPId); |
|
1004 // since IAP Id is set SNAP purpose should not be set - set to unknown |
|
1005 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown); |
|
1006 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerUnknown); |
|
1007 } |
|
1008 else |
|
1009 { |
|
1010 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
|
1011 //WLAN and Cellular Networks allowed for connection |
|
1012 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerWLAN | TExtendedConnPref::EExtendedConnBearerCellular); |
|
1013 |
|
1014 //if SNAP purpose is set IAP Id should be zero - zero by default not explicitly set |
|
1015 iTrace->Trace(_L("CSuplConnection::Connect : IAP not configured"), KTraceFileName, __LINE__); |
|
1016 } |
|
1017 |
|
1018 TRAP_IGNORE(prefList.AppendL(&OCCPrefs)); |
990 |
1019 |
991 TInt ret = iConnection.Open(iSocketServ); |
1020 TInt ret = iConnection.Open(iSocketServ); |
|
1021 if(ret != KErrNone) |
|
1022 iTrace->Trace(_L("RConnection Open returned error"), KTraceFileName, __LINE__); |
|
1023 |
|
1024 iTrace->Trace(_L("RConnection Start Called, State is ERetriveIAP"), KTraceFileName, __LINE__); |
992 // Start an Outgoing Connection with overrides |
1025 // Start an Outgoing Connection with overrides |
993 iConnection.Start(prefs,iStatus); |
1026 iConnection.Start(prefList,iStatus); |
994 // Set state to ERetriveIAP |
1027 // Set state to ERetriveIAP |
995 iState = ERetriveIAP; |
1028 iState = ERetriveIAP; |
996 SetActive(); |
1029 SetActive(); |
997 #else |
1030 #else |
998 ConnectIAP(); |
1031 ConnectIAP(); |
1017 // |
1050 // |
1018 |
1051 |
1019 EXPORT_C void CSuplConnection::Connect(TRequestStatus &aStatus, |
1052 EXPORT_C void CSuplConnection::Connect(TRequestStatus &aStatus, |
1020 TBool aPrompt, TBool aWlanOnly) |
1053 TBool aPrompt, TBool aWlanOnly) |
1021 { |
1054 { |
|
1055 |
1022 // Log |
1056 // Log |
1023 iTrace->Trace(_L("CSuplConnection::Connect"), KTraceFileName, __LINE__); |
1057 iTrace->Trace(_L("CSuplConnection::Connect"), KTraceFileName, __LINE__); |
1024 iPrompt = aPrompt; |
1058 iPrompt = aPrompt; |
1025 iWlanOnly = aWlanOnly; |
1059 iWlanOnly = aWlanOnly; |
1026 |
1060 |
1027 if (iState == EConnected) |
1061 aStatus = KRequestPending; |
1028 { |
1062 TRequestStatus *reqStatus = &aStatus; |
1029 aStatus = KRequestPending; |
1063 |
1030 TRequestStatus *reqStatus = &aStatus; |
1064 if (iState == EConnected) |
1031 User::RequestComplete(reqStatus, KErrNone); |
1065 { |
1032 iConnectClients++; |
1066 User::RequestComplete(reqStatus, KErrNone); |
1033 return; |
1067 iConnectClients++; |
1034 } |
1068 return; |
1035 |
1069 } |
1036 // Check if Connect() is started. If started, add status to Q |
1070 |
1037 //if (iConnectStarted) |
1071 TInt error = iConnArray.Append(reqStatus); |
1038 // { |
1072 if (error != KErrNone) |
1039 aStatus = KRequestPending; |
1073 { |
1040 TRequestStatus *reqStatus = &aStatus; |
1074 User::RequestComplete(reqStatus, error); |
1041 iConnArray.Append(reqStatus); |
1075 return; |
1042 // } |
1076 } |
1043 |
1077 |
1044 if (!iConnectStarted) |
1078 if (!iConnectStarted) |
1045 { |
1079 { |
1046 iTrace->Trace(_L("CSuplConnection::Connect : Connection not started"), KTraceFileName, __LINE__); |
1080 iTrace->Trace( |
|
1081 _L("CSuplConnection::Connect : Connection not started"), |
|
1082 KTraceFileName, __LINE__); |
1047 // Connect only if not already connected |
1083 // Connect only if not already connected |
1048 if(iState == ENotConnected || iState == EFailure) |
1084 if (iState == ENotConnected || iState == EFailure) |
1049 { |
1085 { |
1050 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), KTraceFileName, __LINE__); |
1086 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), |
|
1087 KTraceFileName, __LINE__); |
1051 iConnectStarted = ETrue; |
1088 iConnectStarted = ETrue; |
1052 |
1089 |
1053 #ifndef __WINS__ |
1090 #ifndef __WINS__ |
1054 |
1091 |
1055 iTrace->Trace(_L("CSuplConnection::Connect ExtendedConnPref"), KTraceFileName, __LINE__); |
1092 iTrace->Trace(_L("CSuplConnection::Connect ExtendedConnPref"), KTraceFileName, __LINE__); |
1056 |
1093 |
1057 TExtendedConnPref OCCPrefs; |
1094 TExtendedConnPref OCCPrefs; |
1058 TConnPrefList prefList; |
1095 TConnPrefList prefList; |
1059 |
1096 |
1060 if(iWlanOnly) |
1097 if(iWlanOnly) |
1061 { |
1098 { |
1062 iTrace->Trace(_L("CSuplConnection::Connect : iWLANOnly used"), KTraceFileName, __LINE__); |
1099 iTrace->Trace(_L("CSuplConnection::Connect : iWLANOnly used"), KTraceFileName, __LINE__); |
1063 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerWLAN); |
1100 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerWLAN); |
1064 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
1101 } |
1065 } |
1102 else |
1066 else |
1103 { |
1067 { |
1104 iTrace->Trace(_L("CSuplConnection::Connect OCC GPRS Connection.."), KTraceFileName, __LINE__); |
1068 iTrace->Trace(_L("CSuplConnection::Connect using OCC"), KTraceFileName, __LINE__); |
1105 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerCellular); |
1069 iTrace->Trace(_L("CSuplConnection::Connect OCC GPRS Connection.."), KTraceFileName, __LINE__); |
1106 } |
1070 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerCellular); |
1107 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
1071 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
1108 |
1072 } |
1109 if(!iPrompt) |
1073 |
1110 { |
1074 if(!iPrompt) |
1111 iTrace->Trace(_L("CSuplConnection::Connect : silent connection"), KTraceFileName, __LINE__); |
1075 { |
1112 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
1076 iTrace->Trace(_L("CSuplConnection::Connect : silent connection"), KTraceFileName, __LINE__); |
1113 } |
1077 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
1114 else |
1078 } |
1115 { |
1079 else |
1116 iTrace->Trace(_L("CSuplConnection::Connect : Dialog prompt"), KTraceFileName, __LINE__); |
1080 { |
1117 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); |
1081 iTrace->Trace(_L("CSuplConnection::Connect : Dialog prompt"), KTraceFileName, __LINE__); |
1118 } |
1082 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); |
1119 |
1083 } |
|
1084 |
|
1085 |
|
1086 |
|
1087 TRAP_IGNORE(prefList.AppendL(&OCCPrefs)); |
1120 TRAP_IGNORE(prefList.AppendL(&OCCPrefs)); |
1088 |
1121 |
1089 |
|
1090 TInt ret = iConnection.Open(iSocketServ); |
1122 TInt ret = iConnection.Open(iSocketServ); |
|
1123 if( ret != KErrNone ) |
|
1124 { |
|
1125 TRequestStatus* statusPtr = &aStatus; |
|
1126 User::RequestComplete( statusPtr,ret ); |
|
1127 return; |
|
1128 } |
1091 // Start an Outgoing Connection with overrides |
1129 // Start an Outgoing Connection with overrides |
1092 iConnection.Start(prefList,iStatus); |
1130 iConnection.Start(prefList,iStatus); |
1093 // Set state to ERetriveIAP |
1131 // Set state to ERetriveIAP |
1094 iState = ERetriveIAP; |
1132 iState = ERetriveIAP; |
1095 SetActive(); |
1133 SetActive(); |
1096 |
1134 |
1097 |
|
1098 |
|
1099 #else |
1135 #else |
1100 ConnectIAP(); |
1136 ConnectIAP(); |
1101 #endif |
1137 #endif |
1102 } |
1138 } |
1103 } |
1139 } |
1104 else |
1140 else |
1105 iTrace->Trace(_L("CSuplConnection::Connect : Conn in progress, request queued"), KTraceFileName, __LINE__); |
1141 iTrace->Trace( |
|
1142 _L( |
|
1143 "CSuplConnection::Connect : Conn in progress, request queued"), |
|
1144 KTraceFileName, __LINE__); |
1106 // Log |
1145 // Log |
1107 iTrace->Trace(_L("CSuplConnection::Connect:Exit"), KTraceFileName, __LINE__); |
1146 iTrace->Trace(_L("CSuplConnection::Connect:Exit"), KTraceFileName, |
|
1147 __LINE__); |
1108 } |
1148 } |
1109 |
1149 |
1110 // ----------------------------------------------------------------------------- |
1150 // ----------------------------------------------------------------------------- |
1111 // CSuplConnection::CompleteConnectStatus |
1151 // CSuplConnection::CompleteConnectStatus |
1112 // Completes the request to cancel connection |
1152 // Completes the request to cancel connection |