summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-24 08:08:40 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-24 08:08:40 (GMT)
commite5453023ec31cada0730e5b53fd11ac1d849af73 (patch)
tree7e257da76cdc190eddddd01f57f05b67f852bd3b /src/plugins
parent2fccc31367b207cff68de063d9f3d55a993cde42 (diff)
parent87340d6327188d79f81592031c1d648fa52932be (diff)
downloadQt-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')
-rw-r--r--src/plugins/bearer/bearer.pro10
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h3
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm29
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp2
-rw-r--r--src/plugins/bearer/icd/icd.pro4
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp5
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.h16
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp67
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h7
-rw-r--r--src/plugins/bearer/symbian/symbian.pro18
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp82
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h6
-rw-r--r--src/plugins/phonon/mmf/mmf.pro36
14 files changed, 196 insertions, 91 deletions
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index 00be80e..f95e8af 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -1,14 +1,18 @@
TEMPLATE = subdirs
-!maemo6:contains(QT_CONFIG, dbus) {
- SUBDIRS += networkmanager generic
+contains(QT_CONFIG, dbus) {
+ contains(QT_CONFIG, icd) {
+ SUBDIRS += icd
+ } else {
+ SUBDIRS += networkmanager generic
+ }
}
+
#win32:SUBDIRS += nla
win32:SUBDIRS += generic
win32:!wince*:SUBDIRS += nativewifi
macx:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
macx:SUBDIRS += generic
symbian:SUBDIRS += symbian
-maemo6:contains(QT_CONFIG, dbus):SUBDIRS += icd
isEmpty(SUBDIRS):SUBDIRS += generic
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 76574a8..ece2c60 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -95,11 +95,10 @@ private:
SCDynamicStoreRef storeSession;
CFRunLoopSourceRef runloopSource;
-
bool hasWifi;
protected:
- QMap<QString, QMap<QString,QString> > userProfiles;
+ QMap<QString, QMap<QString,QString> > userProfiles;
void startNetworkChangeLoop();
void getUserConfigurations();
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 60c6fbd..e3778f1 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -50,11 +50,13 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
+
#include <QDir>
#include <CoreWLAN/CoreWLAN.h>
#include <CoreWLAN/CWInterface.h>
#include <CoreWLAN/CWNetwork.h>
#include <CoreWLAN/CWNetwork.h>
+#include <CoreWLAN/CW8021XProfile.h>
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSKeyValueObserving.h>
@@ -84,6 +86,8 @@ QMap <QString, QString> networkInterfaces;
@end
@implementation QNSListener
+@synthesize engine;
+
- (id) init
{
[locker lock];
@@ -126,12 +130,6 @@ QNSListener *listener = 0;
QT_BEGIN_NAMESPACE
-
-static QString qGetInterfaceType(const QString &interfaceString)
-{
- return networkInterfaces.value(interfaceString, QLatin1String("WLAN"));
-}
-
void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys, void *info)
{
for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) {
@@ -198,14 +196,14 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSString *wantedSsid = 0;
bool okToProceed = true;
+
if(getNetworkNameFromSsid(id) != id) {
NSArray *array = [CW8021XProfile allUser8021XProfiles];
for (NSUInteger i=0; i<[array count]; ++i) {
const QString idCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] userDefinedName])));
const QString idCheck2 = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid])));
- if(id == idCheck
- || id == idCheck2) {
+ if (id == idCheck || id == idCheck2) {
QString thisName = getSsidFromNetworkName(id);
if(thisName.isEmpty()) {
wantedSsid = qt_mac_QStringToNSString(id);
@@ -267,6 +265,8 @@ void QCoreWlanEngine::connectToId(const QString &id)
emit connectionError(id, InterfaceLookupError);
locker.relock();
}
+
+ locker.unlock();
emit connectionError(id, OperationNotSupported);
}
@@ -419,7 +419,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
if (!err) {
for(uint row=0; row < [apArray count]; row++ ) {
-
apNetwork = [apArray objectAtIndex:row];
const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
@@ -505,6 +504,7 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
while (i.hasNext()) {
i.next();
QString networkName = i.key();
+
if(!addedConfigs.contains(networkName)) {
QString interfaceName;
QMapIterator<QString, QString> ij(i.value());
@@ -692,7 +692,6 @@ QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
while (i.hasNext()) {
i.next();
-
QMap<QString,QString> map = i.value();
QMapIterator<QString, QString> ij(i.value());
while (ij.hasNext()) {
@@ -701,7 +700,7 @@ QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
if(name == i.key() || name == idCheck) {
return ij.key();
}
- }
+ }
}
return QString();
}
@@ -735,10 +734,10 @@ void QCoreWlanEngine::getUserConfigurations()
for(uint row=0; row < [wifiInterfaces count]; row++ ) {
CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
-
+ NSString *nsInterfaceName = [wifiInterface name];
// add user configured system networks
SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
- CFDictionaryRef airportPlist = (const __CFDictionary*)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", [wifiInterface name]]);
+ NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]);
CFRelease(dynRef);
NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
@@ -748,7 +747,7 @@ void QCoreWlanEngine::getUserConfigurations()
QString thisSsid = qt_mac_NSStringToQString(ssidkey);
if(!userProfiles.contains(thisSsid)) {
QMap <QString,QString> map;
- map.insert(thisSsid, qt_mac_NSStringToQString([wifiInterface name]));
+ map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
userProfiles.insert(thisSsid, map);
}
}
@@ -782,7 +781,7 @@ void QCoreWlanEngine::getUserConfigurations()
if(!userProfiles.contains(networkName)
&& !ssid.isEmpty()) {
QMap<QString,QString> map;
- map.insert(ssid, qt_mac_NSStringToQString([wifiInterface name]));
+ map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
userProfiles.insert(networkName, map);
}
}
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index dfc74f2..c1de4e0 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -203,7 +203,7 @@ void QGenericEngine::doRequestUpdate()
if (interface.flags() & QNetworkInterface::IsLoopBack)
continue;
- // ignore WLAN interface handled in seperate engine
+ // ignore WLAN interface handled in separate engine
if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN"))
continue;
diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro
index 5eaf5af..f411de2 100644
--- a/src/plugins/bearer/icd/icd.pro
+++ b/src/plugins/bearer/icd/icd.pro
@@ -3,8 +3,8 @@ include(../../qpluginbase.pri)
QT += network dbus
-CONFIG += link_pkgconfig
-PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet
+QMAKE_CXXFLAGS += $$QT_CFLAGS_ICD
+LIBS += $$QT_LIBS_ICD
HEADERS += qicdengine.h \
monitor.h \
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index 5e9dc0a..7a4cb9d 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -335,7 +335,7 @@ void QIcdEngine::doRequestUpdate()
locker.relock();
}
- if (!ap.scan.network_type.startsWith("WLAN"))
+ if (!ap.scan.network_type.startsWith(QLatin1String("WLAN")))
continue; // not a wlan AP
}
} else {
@@ -417,7 +417,8 @@ QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const
{
return QNetworkConfigurationManager::CanStartAndStopInterfaces |
QNetworkConfigurationManager::DataStatistics |
- QNetworkConfigurationManager::ForcedRoaming;
+ QNetworkConfigurationManager::ForcedRoaming |
+ QNetworkConfigurationManager::NetworkSessionRequired;
}
QNetworkSessionPrivate *QIcdEngine::createSessionBackend()
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index a2ae65c..06e0529 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -391,7 +391,7 @@ quint64 QNetworkSessionPrivateImpl::getStatistics(bool sent) const
return 0;
}
- foreach (Maemo::IcdStatisticsResult res, stats_results) {
+ foreach (const Maemo::IcdStatisticsResult &res, stats_results) {
if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) {
/* network_id is the IAP UUID */
if (QString(res.params.network_id.data()) == activeConfig.identifier()) {
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
index 048f628..ecca537 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
@@ -215,7 +215,7 @@ public:
Q_DECLARE_FLAGS(ApSecurityFlags, ApSecurityFlag);
- QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0);
+ explicit QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0);
~QNetworkManagerInterfaceAccessPoint();
QDBusInterface *connectionInterface() const;
@@ -248,7 +248,7 @@ class QNetworkManagerInterfaceDevice : public QObject
public:
- QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0);
+ explicit QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0);
~QNetworkManagerInterfaceDevice();
QString udi() const;
@@ -277,7 +277,8 @@ class QNetworkManagerInterfaceDeviceWired : public QObject
public:
- QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent = 0);
+ explicit QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath,
+ QObject *parent = 0);
~QNetworkManagerInterfaceDeviceWired();
QDBusInterface *connectionInterface() const;
@@ -311,7 +312,8 @@ public:
Rsn = 0x20
};
- QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent = 0);
+ explicit QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath,
+ QObject *parent = 0);
~QNetworkManagerInterfaceDeviceWireless();
QDBusObjectPath path() const;
@@ -342,7 +344,7 @@ class QNetworkManagerSettings : public QObject
public:
- QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0);
+ explicit QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0);
~QNetworkManagerSettings();
QDBusInterface *connectionInterface() const;
@@ -402,7 +404,7 @@ public:
Activated = 2
};
- QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0);
+ explicit QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0);
~ QNetworkManagerConnectionActive();
QDBusInterface *connectionInterface() const;
@@ -430,7 +432,7 @@ class QNetworkManagerIp4Config : public QObject
Q_OBJECT
public:
- QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0);
+ explicit QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0);
~QNetworkManagerIp4Config();
QStringList domains() const;
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 0737942..8910efe 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -241,15 +241,24 @@ void QNetworkSessionPrivateImpl::open()
// => RConnection::ProgressNotification will be used for IAP/SNAP monitoring
iConnectionMonitor.CancelNotifications();
- // Configuration must be at least in Discovered - state for connecting purposes.
- if ((publicConfig.state() & QNetworkConfiguration::Discovered) !=
- QNetworkConfiguration::Discovered) {
+ // Configuration may have been invalidated after session creation by platform
+ // (e.g. configuration has been deleted).
+ if (!publicConfig.isValid()) {
newState(QNetworkSession::Invalid);
iError = QNetworkSession::InvalidConfigurationError;
emit QNetworkSessionPrivate::error(iError);
syncStateWithInterface();
return;
}
+ // If opening a (un)defined configuration, session emits error and enters
+ // NotAvailable -state.
+ if (publicConfig.state() == QNetworkConfiguration::Undefined ||
+ publicConfig.state() == QNetworkConfiguration::Defined) {
+ newState(QNetworkSession::NotAvailable);
+ iError = QNetworkSession::InvalidConfigurationError;
+ emit QNetworkSessionPrivate::error(iError);
+ return;
+ }
TInt error = iSocketServ.Connect();
if (error != KErrNone) {
@@ -450,15 +459,49 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
void QNetworkSessionPrivateImpl::stop()
{
- if (!isOpen) {
- return;
+ if (!isOpen &&
+ publicConfig.isValid() &&
+ publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
+ // If the publicConfig is type of IAP, enumerate through connections at
+ // connection monitor. If publicConfig is active in that list, stop it.
+ // Otherwise there is nothing to stop. Note: because this QNetworkSession is not open,
+ // activeConfig is not usable.
+ TUint count;
+ TRequestStatus status;
+ iConnectionMonitor.GetConnectionCount(count, status);
+ User::WaitForRequest(status);
+ if (status.Int() != KErrNone) {
+ return;
+ }
+ TUint numSubConnections; // Not used but needed by GetConnectionInfo i/f
+ TUint connectionId;
+ for (TInt i = 1; i <= count; ++i) {
+ // Get (connection monitor's assigned) connection ID
+ TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections);
+ if (ret == KErrNone) {
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
+ // See if connection Id matches with our Id. If so, stop() it.
+ if (symbianConfig->connectionId == connectionId) {
+ ret = iConnectionMonitor.SetBoolAttribute(connectionId,
+ 0, // subConnectionId don't care
+ KConnectionStop,
+ ETrue);
+ }
+ }
+ }
+ } else if (isOpen) {
+ // Since we are open, use RConnection to stop the interface
+ isOpen = false;
+ newState(QNetworkSession::Closing);
+ iConnection.Stop(RConnection::EStopAuthoritative);
+ isOpen = true;
+ close(false);
+ emit closed();
}
- isOpen = false;
- newState(QNetworkSession::Closing);
- iConnection.Stop(RConnection::EStopAuthoritative);
- isOpen = true;
- close(false);
- emit closed();
}
void QNetworkSessionPrivateImpl::migrate()
@@ -794,7 +837,7 @@ void QNetworkSessionPrivateImpl::RunL()
TInt statusCode = iStatus.Int();
switch (statusCode) {
- case KErrNone: // Connection created succesfully
+ case KErrNone: // Connection created successfully
{
TInt error = KErrNone;
QNetworkConfiguration newActiveConfig = activeConfiguration();
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index 98d4222..35e2c58 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -72,12 +72,11 @@ QT_BEGIN_NAMESPACE
class ConnectionProgressNotifier;
class SymbianEngine;
+class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive,
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
-class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, public MMobilityProtocolResp,
- public MConnectionMonitorObserver
-#else
-class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, public MConnectionMonitorObserver
+ public MMobilityProtocolResp,
#endif
+ public MConnectionMonitorObserver
{
Q_OBJECT
public:
diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro
index 9613def..f915570 100644
--- a/src/plugins/bearer/symbian/symbian.pro
+++ b/src/plugins/bearer/symbian/symbian.pro
@@ -10,14 +10,16 @@ SOURCES += symbianengine.cpp \
qnetworksession_impl.cpp \
main.cpp
-exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \
-exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) {
- message("Building with SNAP support")
- DEFINES += SNAP_FUNCTIONALITY_AVAILABLE
- LIBS += -lcmmanager
-} else {
- message("Building without SNAP support")
- LIBS += -lapengine
+symbian {
+ exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \
+ exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) {
+ message("Building with SNAP support")
+ DEFINES += SNAP_FUNCTIONALITY_AVAILABLE
+ LIBS += -lcmmanager
+ } else {
+ message("Building without SNAP support")
+ LIBS += -lapengine
+ }
}
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
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);
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index e6af908..2e7ae60 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -53,6 +53,7 @@
#endif
class CCommsDatabase;
+class QEventLoop;
QT_BEGIN_NAMESPACE
class QTimer;
@@ -148,6 +149,7 @@ private:
void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo);
void startCommsDatabaseNotifications();
void stopCommsDatabaseNotifications();
+ void waitRandomTime();
QNetworkConfigurationPrivatePointer defaultConfigurationL();
TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const;
@@ -170,8 +172,10 @@ private: // Data
TBool iOnline;
TBool iInitOk;
TBool iUpdateGoingOn;
+ TBool iIgnoringUpdates;
+ TUint iTimeToWait;
+ QEventLoop* iIgnoreEventLoop;
-
AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner;
friend class QNetworkSessionPrivate;
diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro
index da41f18..85415b2 100644
--- a/src/plugins/phonon/mmf/mmf.pro
+++ b/src/plugins/phonon/mmf/mmf.pro
@@ -77,23 +77,25 @@ SOURCES += \
# Test for whether the build environment supports video rendering to graphics
# surfaces.
-exists($${EPOCROOT}epoc32/include/platform/videoplayer2.h) {
- HEADERS += \
- $$PHONON_MMF_DIR/videooutput_surface.h \
- $$PHONON_MMF_DIR/videoplayer_surface.h
- SOURCES += \
- $$PHONON_MMF_DIR/videooutput_surface.cpp \
- $$PHONON_MMF_DIR/videoplayer_surface.cpp
- DEFINES += PHONON_MMF_VIDEO_SURFACES
-} else {
- HEADERS += \
- $$PHONON_MMF_DIR/ancestormovemonitor.h \
- $$PHONON_MMF_DIR/videooutput_dsa.h \
- $$PHONON_MMF_DIR/videoplayer_dsa.h
- SOURCES += \
- $$PHONON_MMF_DIR/ancestormovemonitor.cpp \
- $$PHONON_MMF_DIR/videooutput_dsa.cpp \
- $$PHONON_MMF_DIR/videoplayer_dsa.cpp \
+symbian {
+ exists($${EPOCROOT}epoc32/include/platform/videoplayer2.h) {
+ HEADERS += \
+ $$PHONON_MMF_DIR/videooutput_surface.h \
+ $$PHONON_MMF_DIR/videoplayer_surface.h
+ SOURCES += \
+ $$PHONON_MMF_DIR/videooutput_surface.cpp \
+ $$PHONON_MMF_DIR/videoplayer_surface.cpp
+ DEFINES += PHONON_MMF_VIDEO_SURFACES
+ } else {
+ HEADERS += \
+ $$PHONON_MMF_DIR/ancestormovemonitor.h \
+ $$PHONON_MMF_DIR/videooutput_dsa.h \
+ $$PHONON_MMF_DIR/videoplayer_dsa.h
+ SOURCES += \
+ $$PHONON_MMF_DIR/ancestormovemonitor.cpp \
+ $$PHONON_MMF_DIR/videooutput_dsa.cpp \
+ $$PHONON_MMF_DIR/videoplayer_dsa.cpp \
+ }
}
LIBS += -lcone