1023 // |
1017 // |
1024 |
1018 |
1025 EXPORT_C void CSuplConnection::Connect(TRequestStatus &aStatus, |
1019 EXPORT_C void CSuplConnection::Connect(TRequestStatus &aStatus, |
1026 TBool aPrompt, TBool aWlanOnly) |
1020 TBool aPrompt, TBool aWlanOnly) |
1027 { |
1021 { |
1028 |
|
1029 // Log |
1022 // Log |
1030 iTrace->Trace(_L("CSuplConnection::Connect"), KTraceFileName, __LINE__); |
1023 iTrace->Trace(_L("CSuplConnection::Connect"), KTraceFileName, __LINE__); |
1031 iPrompt = aPrompt; |
1024 iPrompt = aPrompt; |
1032 iWlanOnly = aWlanOnly; |
1025 iWlanOnly = aWlanOnly; |
1033 |
1026 |
1034 aStatus = KRequestPending; |
1027 if (iState == EConnected) |
1035 TRequestStatus *reqStatus = &aStatus; |
1028 { |
1036 |
1029 aStatus = KRequestPending; |
1037 if (iState == EConnected) |
1030 TRequestStatus *reqStatus = &aStatus; |
1038 { |
1031 User::RequestComplete(reqStatus, KErrNone); |
1039 User::RequestComplete(reqStatus, KErrNone); |
1032 iConnectClients++; |
1040 iConnectClients++; |
1033 return; |
1041 return; |
1034 } |
1042 } |
1035 |
1043 |
1036 // Check if Connect() is started. If started, add status to Q |
1044 TInt error = iConnArray.Append(reqStatus); |
1037 //if (iConnectStarted) |
1045 if (error != KErrNone) |
1038 // { |
1046 { |
1039 aStatus = KRequestPending; |
1047 User::RequestComplete(reqStatus, error); |
1040 TRequestStatus *reqStatus = &aStatus; |
1048 return; |
1041 iConnArray.Append(reqStatus); |
1049 } |
1042 // } |
1050 |
1043 |
1051 if (!iConnectStarted) |
1044 if (!iConnectStarted) |
1052 { |
1045 { |
1053 iTrace->Trace( |
1046 iTrace->Trace(_L("CSuplConnection::Connect : Connection not started"), KTraceFileName, __LINE__); |
1054 _L("CSuplConnection::Connect : Connection not started"), |
|
1055 KTraceFileName, __LINE__); |
|
1056 // Connect only if not already connected |
1047 // Connect only if not already connected |
1057 if (iState == ENotConnected || iState == EFailure) |
1048 if(iState == ENotConnected || iState == EFailure) |
1058 { |
1049 { |
1059 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), |
1050 iTrace->Trace(_L("CSuplConnection::Connect : ENotConnected"), KTraceFileName, __LINE__); |
1060 KTraceFileName, __LINE__); |
|
1061 iConnectStarted = ETrue; |
1051 iConnectStarted = ETrue; |
1062 |
1052 |
1063 #ifndef __WINS__ |
1053 #ifndef __WINS__ |
1064 |
1054 |
1065 iTrace->Trace(_L("CSuplConnection::Connect ExtendedConnPref"), KTraceFileName, __LINE__); |
1055 iTrace->Trace(_L("CSuplConnection::Connect ExtendedConnPref"), KTraceFileName, __LINE__); |
1066 |
1056 |
1067 TExtendedConnPref OCCPrefs; |
1057 TExtendedConnPref OCCPrefs; |
1068 TConnPrefList prefList; |
1058 TConnPrefList prefList; |
1069 |
1059 |
1070 if(iWlanOnly) |
1060 if(iWlanOnly) |
1071 { |
1061 { |
1072 iTrace->Trace(_L("CSuplConnection::Connect : iWLANOnly used"), KTraceFileName, __LINE__); |
1062 iTrace->Trace(_L("CSuplConnection::Connect : iWLANOnly used"), KTraceFileName, __LINE__); |
1073 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerWLAN); |
1063 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerWLAN); |
1074 } |
1064 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
1075 else |
1065 } |
1076 { |
1066 else |
1077 iTrace->Trace(_L("CSuplConnection::Connect OCC GPRS Connection.."), KTraceFileName, __LINE__); |
1067 { |
1078 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerCellular); |
1068 iTrace->Trace(_L("CSuplConnection::Connect using OCC"), KTraceFileName, __LINE__); |
1079 } |
1069 iTrace->Trace(_L("CSuplConnection::Connect OCC GPRS Connection.."), KTraceFileName, __LINE__); |
1080 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
1070 OCCPrefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerCellular); |
1081 |
1071 OCCPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
1082 if(!iPrompt) |
1072 } |
1083 { |
1073 |
1084 iTrace->Trace(_L("CSuplConnection::Connect : silent connection"), KTraceFileName, __LINE__); |
1074 if(!iPrompt) |
1085 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
1075 { |
1086 } |
1076 iTrace->Trace(_L("CSuplConnection::Connect : silent connection"), KTraceFileName, __LINE__); |
1087 else |
1077 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
1088 { |
1078 } |
1089 iTrace->Trace(_L("CSuplConnection::Connect : Dialog prompt"), KTraceFileName, __LINE__); |
1079 else |
1090 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); |
1080 { |
1091 } |
1081 iTrace->Trace(_L("CSuplConnection::Connect : Dialog prompt"), KTraceFileName, __LINE__); |
1092 |
1082 OCCPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault); |
|
1083 } |
|
1084 |
|
1085 |
|
1086 |
1093 TRAP_IGNORE(prefList.AppendL(&OCCPrefs)); |
1087 TRAP_IGNORE(prefList.AppendL(&OCCPrefs)); |
1094 |
1088 |
|
1089 |
1095 TInt ret = iConnection.Open(iSocketServ); |
1090 TInt ret = iConnection.Open(iSocketServ); |
1096 if( ret != KErrNone ) |
|
1097 { |
|
1098 TRequestStatus* statusPtr = &iStatus; |
|
1099 User::RequestComplete( statusPtr,ret ); |
|
1100 return; |
|
1101 } |
|
1102 // Start an Outgoing Connection with overrides |
1091 // Start an Outgoing Connection with overrides |
1103 iConnection.Start(prefList,iStatus); |
1092 iConnection.Start(prefList,iStatus); |
1104 // Set state to ERetriveIAP |
1093 // Set state to ERetriveIAP |
1105 iState = ERetriveIAP; |
1094 iState = ERetriveIAP; |
1106 SetActive(); |
1095 SetActive(); |
1107 |
1096 |
|
1097 |
|
1098 |
1108 #else |
1099 #else |
1109 ConnectIAP(); |
1100 ConnectIAP(); |
1110 #endif |
1101 #endif |
1111 } |
1102 } |
1112 } |
1103 } |
1113 else |
1104 else |
1114 iTrace->Trace( |
1105 iTrace->Trace(_L("CSuplConnection::Connect : Conn in progress, request queued"), KTraceFileName, __LINE__); |
1115 _L( |
|
1116 "CSuplConnection::Connect : Conn in progress, request queued"), |
|
1117 KTraceFileName, __LINE__); |
|
1118 // Log |
1106 // Log |
1119 iTrace->Trace(_L("CSuplConnection::Connect:Exit"), KTraceFileName, |
1107 iTrace->Trace(_L("CSuplConnection::Connect:Exit"), KTraceFileName, __LINE__); |
1120 __LINE__); |
|
1121 } |
1108 } |
1122 |
1109 |
1123 // ----------------------------------------------------------------------------- |
1110 // ----------------------------------------------------------------------------- |
1124 // CSuplConnection::CompleteConnectStatus |
1111 // CSuplConnection::CompleteConnectStatus |
1125 // Completes the request to cancel connection |
1112 // Completes the request to cancel connection |