summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-03-04 05:22:31 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-03-04 05:22:31 (GMT)
commit1e7b2415bf1bc853655e0a85a8cb21ecd24b149e (patch)
tree242ddf36c289b84d7d09054bf05230772f9f05af /src/plugins/bearer
parent2c6de1ce1489668253b7d3a5df3f2194fbd1bee7 (diff)
downloadQt-1e7b2415bf1bc853655e0a85a8cb21ecd24b149e.zip
Qt-1e7b2415bf1bc853655e0a85a8cb21ecd24b149e.tar.gz
Qt-1e7b2415bf1bc853655e0a85a8cb21ecd24b149e.tar.bz2
Updating polling mechanism for bearer management engines.
Improves the polling mechanism by sharing a single timer for all poll based engines. Updates are only performed for a poll based engine iff a QNetworkConfigurationManager object has been constructed or a QNetworkConfiguration is held externally from the engine.
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h3
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm10
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp14
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h3
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp13
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h4
6 files changed, 26 insertions, 21 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index cfd89e4..3289ffb 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -80,13 +80,14 @@ public:
bool getAllScInterfaces();
+ bool requiresPolling() const;
+
private Q_SLOTS:
void doRequestUpdate();
private:
bool isWifiReady(const QString &dev);
QMap<QString, QString> configurationInterface;
- QTimer pollTimer;
QStringList scanForSsids(const QString &interfaceName);
bool isKnownSsid(const QString &interfaceName, const QString &ssid);
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 598d2f0..5870b01 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -243,8 +243,7 @@ void QCoreWlanEngine::requestUpdate()
{
QMutexLocker locker(&mutex);
- pollTimer.stop();
- QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
+ doRequestUpdate();
}
void QCoreWlanEngine::doRequestUpdate()
@@ -343,8 +342,6 @@ void QCoreWlanEngine::doRequestUpdate()
emit configurationRemoved(ptr);
}
- pollTimer.start();
-
emit updateCompleted();
}
@@ -610,4 +607,9 @@ QNetworkConfigurationPrivatePointer QCoreWlanEngine::defaultConfiguration()
return QNetworkConfigurationPrivatePointer();
}
+bool QCoreWlanEngine::requiresPolling() const
+{
+ return true;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index e6c871d..a9e78b2 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -142,9 +142,6 @@ static QString qGetInterfaceType(const QString &interface)
QGenericEngine::QGenericEngine(QObject *parent)
: QBearerEngineImpl(parent)
{
- connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate()));
- pollTimer.setInterval(10000);
- doRequestUpdate();
}
QGenericEngine::~QGenericEngine()
@@ -179,8 +176,7 @@ void QGenericEngine::requestUpdate()
{
QMutexLocker locker(&mutex);
- pollTimer.stop();
- QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
+ doRequestUpdate();
}
void QGenericEngine::doRequestUpdate()
@@ -282,8 +278,6 @@ void QGenericEngine::doRequestUpdate()
emit configurationRemoved(ptr);
}
- pollTimer.start();
-
emit updateCompleted();
}
@@ -328,5 +322,11 @@ QNetworkConfigurationPrivatePointer QGenericEngine::defaultConfiguration()
return QNetworkConfigurationPrivatePointer();
}
+
+bool QGenericEngine::requiresPolling() const
+{
+ return true;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
index cd9a976..a1b9167 100644
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ b/src/plugins/bearer/generic/qgenericengine.h
@@ -78,12 +78,13 @@ public:
QNetworkConfigurationPrivatePointer defaultConfiguration();
+ bool requiresPolling() const;
+
private Q_SLOTS:
void doRequestUpdate();
private:
QMap<QString, QString> configurationInterface;
- QTimer pollTimer;
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index c8015d8..ec2da00 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -95,10 +95,6 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent)
if (result != ERROR_SUCCESS)
qWarning("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
- // On Windows XP SP2 and SP3 only connection and disconnection notifications are available.
- // We need to poll for changes in available wireless networks.
- connect(&pollTimer, SIGNAL(timeout()), this, SLOT(scanComplete()));
- pollTimer.setInterval(10000);
scanComplete();
}
@@ -222,8 +218,6 @@ void QNativeWifiEngine::scanComplete()
emit configurationRemoved(ptr);
}
- pollTimer.start();
-
emit updateCompleted();
}
@@ -492,4 +486,11 @@ QNetworkConfigurationPrivatePointer QNativeWifiEngine::defaultConfiguration()
return QNetworkConfigurationPrivatePointer();
}
+bool QNativeWifiEngine::requiresPolling() const
+{
+ // On Windows XP SP2 and SP3 only connection and disconnection notifications are available.
+ // We need to poll for changes in available wireless networks.
+ return true;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index a9a9375..56489b6 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -90,12 +90,12 @@ public:
inline bool available() const { return handle != 0; }
+ bool requiresPolling() const;
+
public Q_SLOTS:
void scanComplete();
private:
- QTimer pollTimer;
-
Qt::HANDLE handle;
};