diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-24 08:08:40 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-24 08:08:40 (GMT) |
commit | e5453023ec31cada0730e5b53fd11ac1d849af73 (patch) | |
tree | 7e257da76cdc190eddddd01f57f05b67f852bd3b /src/plugins/bearer/symbian/symbianengine.cpp | |
parent | 2fccc31367b207cff68de063d9f3d55a993cde42 (diff) | |
parent | 87340d6327188d79f81592031c1d648fa52932be (diff) | |
download | Qt-e5453023ec31cada0730e5b53fd11ac1d849af73.zip Qt-e5453023ec31cada0730e5b53fd11ac1d849af73.tar.gz Qt-e5453023ec31cada0730e5b53fd11ac1d849af73.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (119 commits)
Bearer management documentation.
Bearer management changes from Qt Mobility (6fb31d1e).
Remove extraneous semi-colon.
Use the default codec with QString::vsprintf()
Fix build with QT_NO_DOCKWIDGET
Fix the test of QDirIterator with NoDot and NoDotDot
Split QDir::NoDotAndDotDot into QDir::NoDot and QDir::NoDotDot
QFSFileEngine: don't look through NTFS junctions
After showing modal windows, WM_LBUTTONUP for double click is ignored.
Possible fix for missing QML properties in the qt.qhp file.
Use standard theme icons in Linguist where possible
Use more standard icons from the theme in Assistant
Use more standard icons for standard actions in Designer
Drag & drop operations wont end while using Remote Desktop sessions
_close(fd) closes the associated handle and not the other way around
Fixed locale mapping on Symbian.
Revert change 7bf4512659 on Cocoa.
Extended the high_attributes array, since we have more than 127 widget attributes now.
Added instructions for MinGW users wanting to build the MySQL driver.
Designer: Fix broken resource view.
...
Diffstat (limited to 'src/plugins/bearer/symbian/symbianengine.cpp')
-rw-r--r-- | src/plugins/bearer/symbian/symbianengine.cpp | 82 |
1 files changed, 66 insertions, 16 deletions
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 980892a..440f463 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -45,6 +45,16 @@ #include <commdb.h> #include <cdbcols.h> #include <d32dbms.h> +#include <QEventLoop> +#include <QTimer> +#include <QTime> // For randgen seeding +#include <QtCore> // For randgen seeding + +// #define QT_BEARERMGMT_CONFIGMGR_DEBUG + +#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG +#include <QDebug> +#endif #ifdef SNAP_FUNCTIONALITY_AVAILABLE #include <cmdestination.h> @@ -100,10 +110,15 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const } SymbianEngine::SymbianEngine(QObject *parent) -: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true) +: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true), + iIgnoringUpdates(false), iTimeToWait(0), iIgnoreEventLoop(0) { CActiveScheduler::Add(this); + // Seed the randomgenerator + qsrand(QTime(0,0,0).secsTo(QTime::currentTime()) + QCoreApplication::applicationPid()); + iIgnoreEventLoop = new QEventLoop(this); + TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); if (error != KErrNone) { iInitOk = false; @@ -138,9 +153,7 @@ SymbianEngine::SymbianEngine(QObject *parent) updateConfigurations(); updateStatesToSnaps(); - updateAvailableAccessPoints(); // On first time updates synchronously (without WLAN scans) - // Start monitoring IAP and/or SNAP changes in Symbian CommsDB startCommsDatabaseNotifications(); iFirstUpdate = false; @@ -184,7 +197,8 @@ QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const capFlags = QNetworkConfigurationManager::CanStartAndStopInterfaces | QNetworkConfigurationManager::DirectConnectionRouting | QNetworkConfigurationManager::SystemSessionSupport | - QNetworkConfigurationManager::DataStatistics; + QNetworkConfigurationManager::DataStatistics | + QNetworkConfigurationManager::NetworkSessionRequired; #ifdef SNAP_FUNCTIONALITY_AVAILABLE capFlags |= QNetworkConfigurationManager::ApplicationLevelRoaming | @@ -230,7 +244,7 @@ void SymbianEngine::updateConfigurationsL() QList<QString> knownConfigs = accessPointConfigurations.keys(); QList<QString> knownSnapConfigs = snapConfigurations.keys(); - + #ifdef SNAP_FUNCTIONALITY_AVAILABLE // S60 version is >= Series60 3rd Edition Feature Pack 2 TInt error = KErrNone; @@ -737,8 +751,7 @@ void SymbianEngine::updateStatesToSnaps() QMutexLocker locker(&mutex); // Go through SNAPs and set correct state to SNAPs - QList<QString> snapConfigIdents = snapConfigurations.keys(); - foreach (QString iface, snapConfigIdents) { + foreach (const QString &iface, snapConfigurations.keys()) { bool discovered = false; bool active = false; QNetworkConfigurationPrivatePointer ptr = snapConfigurations.value(iface); @@ -873,6 +886,13 @@ void SymbianEngine::RunL() { QMutexLocker locker(&mutex); + if (iIgnoringUpdates) { +#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG + qDebug("CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently)."); +#endif + return; + } + if (iStatus != KErrCancel) { RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); switch (event) { @@ -880,16 +900,32 @@ void SymbianEngine::RunL() case RDbNotifier::ECommit: /** A transaction has been committed. */ case RDbNotifier::ERollback: /** A transaction has been rolled back */ case RDbNotifier::ERecover: /** The database has been recovered */ - // Note that if further database events occur while a client is handling - // a request completion, the notifier records the most significant database - // event and this is signalled as soon as the client issues the next - // RequestNotification() request. - // => Stop recording notifications - stopCommsDatabaseNotifications(); - TRAPD(error, updateConfigurationsL()); - if (error == KErrNone) { - updateStatesToSnaps(); +#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG + qDebug("CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int()); +#endif + iIgnoringUpdates = true; + // Other events than ECommit get lower priority. In practice with those events, + // we delay_before_updating methods, whereas + // with ECommit we _update_before_delaying the reaction to next event. + // Few important notes: 1) listening to only ECommit does not seem to be adequate, + // but updates will be missed. Hence other events are reacted upon too. + // 2) RDbNotifier records the most significant event, and that will be returned once + // we issue new RequestNotification, and hence updates will not be missed even + // when we are 'not reacting to them' for few seconds. + if (event == RDbNotifier::ECommit) { + TRAPD(error, updateConfigurationsL()); + if (error == KErrNone) { + updateStatesToSnaps(); + } + waitRandomTime(); + } else { + waitRandomTime(); + TRAPD(error, updateConfigurationsL()); + if (error == KErrNone) { + updateStatesToSnaps(); + } } + iIgnoringUpdates = false; // Wait time done, allow updating again iWaitingCommsDatabaseNotifications = true; break; default: @@ -1014,6 +1050,20 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) } } +// Waits for 1..4 seconds. +void SymbianEngine::waitRandomTime() +{ + iTimeToWait = (qAbs(qrand()) % 5) * 1000; + if (iTimeToWait < 1000) { + iTimeToWait = 1000; + } +#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG + qDebug("QNetworkConfigurationManager waiting random time: %d ms", iTimeToWait); +#endif + QTimer::singleShot(iTimeToWait, iIgnoreEventLoop, SLOT(quit())); + iIgnoreEventLoop->exec(); +} + QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId) { QMutexLocker locker(&mutex); |