summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-07-26 02:48:44 (GMT)
committerToby Tomkins <toby.tomkins@nokia.com>2010-07-29 03:37:54 (GMT)
commitc0c08e4efa42981e0e23b94ad032cdf86cc280cd (patch)
tree3ff81734e25cd1bec3ae4446c5746c30c9743930 /src
parent57453beaaa22cf184c721e7813f933b0eb41faa8 (diff)
downloadQt-c0c08e4efa42981e0e23b94ad032cdf86cc280cd.zip
Qt-c0c08e4efa42981e0e23b94ad032cdf86cc280cd.tar.gz
Qt-c0c08e4efa42981e0e23b94ad032cdf86cc280cd.tar.bz2
Cherry pick fix for MOBILITY-1194 from Qt Mobility.
2f582953ecfc53f217317f58e4fc75b5b51a1126 (cherry picked from commit 34691d27d03abc0c8f940b4a0a3cda4cd308642e)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp74
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp66
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h1
3 files changed, 93 insertions, 48 deletions
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index d6b4975..f7a52c2 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -146,12 +146,14 @@ void QNetworkSessionPrivateImpl::configurationRemoved(QNetworkConfigurationPriva
}
}
+// Function sets the state of the session to match the state
+// of the underlying interface (the configuration this session is based on)
void QNetworkSessionPrivateImpl::syncStateWithInterface()
{
if (!publicConfig.isValid())
return;
- if (iFirstSync && publicConfig.isValid()) {
+ if (iFirstSync) {
QObject::connect(engine, SIGNAL(configurationStateChanged(TUint32, TUint32, QNetworkSession::State)),
this, SLOT(configurationStateChanged(TUint32, TUint32, QNetworkSession::State)));
// Listen to configuration removals, so that in case the configuration
@@ -162,46 +164,25 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
// Start listening IAP state changes from QNetworkConfigurationManagerPrivate
iHandleStateNotificationsFromManager = true;
- // Check open connections to see if there is already
- // an open connection to selected IAP or SNAP
- TUint count;
- TRequestStatus status;
- iConnectionMonitor.GetConnectionCount(count, status);
- User::WaitForRequest(status);
- if (status.Int() != KErrNone) {
- return;
- }
-
- TUint numSubConnections;
- TUint connectionId;
- for (TUint i = 1; i <= count; i++) {
- TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections);
- if (ret == KErrNone) {
- TUint apId;
- iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status);
- User::WaitForRequest(status);
- if (status.Int() == KErrNone) {
- TInt connectionStatus;
- iConnectionMonitor.GetIntAttribute(connectionId, 0, KConnectionStatus, connectionStatus, status);
- User::WaitForRequest(status);
- if (connectionStatus == KLinkLayerOpen) {
- if (state != QNetworkSession::Closing) {
- if (newState(QNetworkSession::Connected, apId)) {
- return;
- }
- }
- }
- }
- }
- }
-
- if (state != QNetworkSession::Connected) {
- if ((publicConfig.state() & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
- newState(QNetworkSession::Disconnected);
- } else {
- newState(QNetworkSession::NotAvailable);
- }
+ // Check what is the state of the configuration this session is based on
+ // and set the session in appropriate state.
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "syncStateWithInterface() state of publicConfig is: " << publicConfig.state();
+#endif
+ switch (publicConfig.state()) {
+ case QNetworkConfiguration::Active:
+ newState(QNetworkSession::Connected);
+ break;
+ case QNetworkConfiguration::Discovered:
+ newState(QNetworkSession::Disconnected);
+ break;
+ case QNetworkConfiguration::Defined:
+ newState(QNetworkSession::NotAvailable);
+ break;
+ case QNetworkConfiguration::Undefined:
+ default:
+ newState(QNetworkSession::Invalid);
}
}
@@ -253,7 +234,8 @@ QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const
<< "currentInterface() requested, state: " << state
<< "publicConfig validity: " << publicConfig.isValid();
if (activeInterface.isValid())
- qDebug() << "interface is: " << activeInterface.humanReadableName();
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "interface is: " << activeInterface.humanReadableName();
#endif
if (!publicConfig.isValid() || state != QNetworkSession::Connected) {
@@ -906,6 +888,14 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
if (iapId == 0) {
_LIT(KSetting, "IAP\\Id");
iConnection.GetIntSetting(KSetting, iapId);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ // Check if this is an Easy WLAN configuration. On Symbian^3 RConnection may report
+ // the used configuration as 'EasyWLAN' IAP ID if someone has just opened the configuration
+ // from WLAN Scan dialog, _and_ that connection is still up. We need to find the
+ // real matching configuration. Function alters the Easy WLAN ID to real IAP ID (only if
+ // easy WLAN):
+ engine->easyWlanTrueIapId(iapId);
+#endif
}
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index ca444c1..8486fa9 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -270,7 +270,7 @@ void SymbianEngine::updateConfigurationsL()
QList<QString> knownConfigs = accessPointConfigurations.keys();
QList<QString> knownSnapConfigs = snapConfigurations.keys();
-#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
// S60 version is >= Series60 3rd Edition Feature Pack 2
TInt error = KErrNone;
@@ -311,7 +311,17 @@ void SymbianEngine::updateConfigurationsL()
iCmManager.AllDestinationsL(destinations);
for(int i = 0; i < destinations.Count(); i++) {
RCmDestination destination;
- destination = iCmManager.DestinationL(destinations[i]);
+
+ // Some destinatsions require ReadDeviceData -capability (MMS/WAP)
+ // The below function will leave in these cases. Don't. Proceed to
+ // next destination (if any).
+ TRAPD(error, destination = iCmManager.DestinationL(destinations[i]));
+ if (error == KErrPermissionDenied) {
+ continue;
+ } else {
+ User::LeaveIfError(error);
+ }
+
CleanupClosePushL(destination);
QString ident = QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX +
QString::number(qHash(destination.Id()));
@@ -319,12 +329,12 @@ void SymbianEngine::updateConfigurationsL()
knownSnapConfigs.removeOne(ident);
} else {
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
-
+
HBufC *pName = destination.NameLC();
QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
-
+
cpPriv->isValid = true;
cpPriv->id = ident;
cpPriv->numericId = destination.Id();
@@ -393,7 +403,6 @@ void SymbianEngine::updateConfigurationsL()
CleanupStack::PopAndDestroy(&destination);
}
CleanupStack::PopAndDestroy(&destinations);
-
#else
// S60 version is < Series60 3rd Edition Feature Pack 2
CCommsDbTableView* pDbTView = ipCommsDB->OpenTableLC(TPtrC(IAP));
@@ -423,8 +432,9 @@ void SymbianEngine::updateConfigurationsL()
}
CleanupStack::PopAndDestroy(pDbTView);
#endif
+
QT_TRYCATCH_LEAVING(updateActiveAccessPoints());
-
+
foreach (const QString &oldIface, knownConfigs) {
//remove non existing IAP
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldIface);
@@ -687,6 +697,11 @@ void SymbianEngine::updateActiveAccessPoints()
if (!ptr) {
// If IAP was not found, check if the update was about EasyWLAN
ptr = configurationFromEasyWlan(apId, connectionId);
+ // Change the ident correspondingly
+ if (ptr) {
+ ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(toSymbianConfig(ptr)->numericIdentifier()));
+ }
}
#endif
if (ptr) {
@@ -1224,6 +1239,45 @@ QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUi
}
return QNetworkConfigurationPrivatePointer();
}
+
+bool SymbianEngine::easyWlanTrueIapId(TUint32& trueIapId)
+{
+ // Check if this is easy wlan id in the first place
+ if (trueIapId != iCmManager.EasyWlanIdL())
+ return false;
+
+ // Loop through all connections that connection monitor is aware
+ // and check for IAPs based on easy WLAN
+ TRequestStatus status;
+ TUint connectionCount;
+ iConnectionMonitor.GetConnectionCount(connectionCount, status);
+ User::WaitForRequest(status);
+ TUint connectionId;
+ TUint subConnectionCount;
+ TUint apId;
+ if (status.Int() == KErrNone) {
+ for (TUint i = 1; i <= connectionCount; i++) {
+ iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount);
+ iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount,
+ KIAPId, apId, status);
+ User::WaitForRequest(status);
+ if (apId == trueIapId) {
+ QNetworkConfigurationPrivatePointer ptr =
+ configurationFromEasyWlan(apId, connectionId);
+ if (ptr) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNCM easyWlanTrueIapId(), found true IAP ID: "
+ << toSymbianConfig(ptr)->numericIdentifier();
+#endif
+ trueIapId = toSymbianConfig(ptr)->numericIdentifier();
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
#endif
// Sessions may use this function to report configuration state changes,
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index cfddc29..ecd858d 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -208,6 +208,7 @@ private:
QNetworkSession::State newState);
#ifdef OCC_FUNCTIONALITY_AVAILABLE
QNetworkConfigurationPrivatePointer configurationFromEasyWlan(TUint32 apId, TUint connectionId);
+ bool easyWlanTrueIapId(TUint32& trueIapId);
#endif
private: // Data