summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-03-11 09:15:55 (GMT)
committeraxis <qt-info@nokia.com>2010-03-11 09:42:47 (GMT)
commita375537d32bc33ba1154ec132f99f5a779bce067 (patch)
tree3c23e3b2c44fb52d7d62036fe7dd793e589841e8 /src/plugins/bearer
parent02f6da62a42bd1059eb0da091d1f46efbb919750 (diff)
parent1e9552f826c05bf9884fb2893dedca265ead363b (diff)
downloadQt-a375537d32bc33ba1154ec132f99f5a779bce067.zip
Qt-a375537d32bc33ba1154ec132f99f5a779bce067.tar.gz
Qt-a375537d32bc33ba1154ec132f99f5a779bce067.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts: mkspecs/common/symbian/symbian.conf qmake/generators/makefile.h qmake/project.cpp src/3rdparty/webkit/WebCore/WebCore.pro src/src.pro
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r--src/plugins/bearer/bearer.pro2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h11
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm370
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp15
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h3
-rw-r--r--src/plugins/bearer/icd/monitor.cpp56
-rw-r--r--src/plugins/bearer/icd/monitor.h22
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp47
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp51
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.h7
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp98
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h4
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp3
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp301
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.h112
-rw-r--r--src/plugins/bearer/networkmanager/qnmdbushelper.cpp11
-rw-r--r--src/plugins/bearer/networkmanager/qnmdbushelper.h2
-rw-r--r--src/plugins/bearer/nla/qnlaengine.cpp56
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp59
-rw-r--r--src/plugins/bearer/qnetworksession_impl.h9
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp17
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp38
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h1
23 files changed, 727 insertions, 568 deletions
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index 7ba62b3..a67c8f6 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -6,7 +6,7 @@ TEMPLATE = subdirs
#win32:SUBDIRS += nla
win32:SUBDIRS += generic
win32:!wince*:SUBDIRS += nativewifi
-macx:SUBDIRS += corewlan
+macx:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
macx:SUBDIRS += generic
symbian:SUBDIRS += symbian
maemo6:contains(QT_CONFIG, dbus):SUBDIRS += icd
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 044b433..cbaa9d6 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -46,6 +46,7 @@
#include <QMap>
#include <QTimer>
+#include <SystemConfiguration/SystemConfiguration.h>
QT_BEGIN_NAMESPACE
@@ -77,7 +78,9 @@ public:
QNetworkConfigurationPrivatePointer defaultConfiguration();
- bool getAllScInterfaces();
+ bool getWifiInterfaces();
+
+ bool requiresPolling() const;
private Q_SLOTS:
void doRequestUpdate();
@@ -85,12 +88,16 @@ private Q_SLOTS:
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);
QList<QNetworkConfigurationPrivate *> foundConfigurations;
+ SCDynamicStoreRef storeSession;
+ CFRunLoopSourceRef runloopSource;
+
+ void startNetworkChangeLoop();
+
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index a5384d1..cb278d9 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -61,62 +61,118 @@
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSKeyValueObserving.h>
#include <Foundation/NSAutoreleasePool.h>
+#include <Foundation/NSLock.h>
#include <SystemConfiguration/SCNetworkConfiguration.h>
+#include <private/qt_cocoa_helpers_mac_p.h>
+#include "private/qcore_mac_p.h"
+
QMap <QString, QString> networkInterfaces;
-QT_BEGIN_NAMESPACE
+#ifdef MAC_SDK_10_6
+@interface QNSListener : NSObject
+{
+ NSNotificationCenter *center;
+ CWInterface *currentInterface;
+ QCoreWlanEngine *engine;
+ NSAutoreleasePool *autoreleasepool;
+ NSLock *locker;
+}
+- (void)notificationHandler:(NSNotification *)notification;
+- (void)remove;
+- (void)setEngine:(QCoreWlanEngine *)coreEngine;
+- (void)dealloc;
-inline QString cfstringRefToQstring(CFStringRef cfStringRef) {
-// return QString([cfStringRef UTF8String]);
- QString retVal;
- CFIndex maxLength = 2 * CFStringGetLength(cfStringRef) + 1/*zero term*/; // max UTF8
- char *cstring = new char[maxLength];
- if (CFStringGetCString(CFStringRef(cfStringRef), cstring, maxLength, kCFStringEncodingUTF8)) {
- retVal = QString::fromUtf8(cstring);
- }
- delete[] cstring;
- return retVal;
+@property (assign) QCoreWlanEngine* engine;
+
+@end
+
+@implementation QNSListener
+- (id) init
+{
+ [locker lock];
+ autoreleasepool = [[NSAutoreleasePool alloc] init];
+ center = [NSNotificationCenter defaultCenter];
+ currentInterface = [CWInterface interface];
+// [center addObserver:self selector:@selector(notificationHandler:) name:kCWLinkDidChangeNotification object:nil];
+ [center addObserver:self selector:@selector(notificationHandler:) name:kCWPowerDidChangeNotification object:nil];
+ [locker unlock];
+ return self;
}
-inline CFStringRef qstringToCFStringRef(const QString &string)
+-(void)dealloc
{
- return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(string.unicode()),
- string.length());
+ [autoreleasepool release];
+ [super dealloc];
}
-inline NSString *qstringToNSString(const QString &qstr)
-{ return [reinterpret_cast<const NSString *>(qstringToCFStringRef(qstr)) autorelease]; }
+-(void)setEngine:(QCoreWlanEngine *)coreEngine
+{
+ [locker lock];
+ if(!engine)
+ engine = coreEngine;
+ [locker unlock];
+}
-inline QString nsstringToQString(const NSString *nsstr)
-{ return cfstringRefToQstring(reinterpret_cast<const CFStringRef>(nsstr)); }
+-(void)remove
+{
+ [locker lock];
+ [center removeObserver:self];
+ [locker unlock];
+}
-inline QStringList nsarrayToQStringList(void *nsarray)
+- (void)notificationHandler:(NSNotification *)notification
{
- QStringList result;
- NSArray *array = static_cast<NSArray *>(nsarray);
- for (NSUInteger i=0; i<[array count]; ++i)
- result << nsstringToQString([array objectAtIndex:i]);
- return result;
+ engine->requestUpdate();
}
+@end
+
+QNSListener *listener = 0;
+
+#endif
+
+QT_BEGIN_NAMESPACE
+
static QString qGetInterfaceType(const QString &interfaceString)
{
return networkInterfaces.value(interfaceString, QLatin1String("Unknown"));
}
+void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys, void *info)
+{
+ for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) {
+
+ QString changed = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(changedKeys, i));
+ if( changed.contains("/Network/Global/IPv4")) {
+ QCoreWlanEngine* wlanEngine = static_cast<QCoreWlanEngine*>(info);
+ wlanEngine->requestUpdate();
+ }
+ }
+ return;
+}
+
QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
: QBearerEngineImpl(parent)
{
- connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate()));
- pollTimer.setInterval(10000);
- doRequestUpdate();
+ startNetworkChangeLoop();
+
+#if defined(MAC_SDK_10_6)
+ if(!listener) {
+ listener = [[QNSListener alloc] init];
+ listener.engine = this;
+ }
+#endif
}
QCoreWlanEngine::~QCoreWlanEngine()
{
while (!foundConfigurations.isEmpty())
delete foundConfigurations.takeFirst();
+#if defined(MAC_SDK_10_6)
+ [listener remove];
+ [listener release];
+#endif
}
QString QCoreWlanEngine::getInterfaceFromId(const QString &id)
@@ -142,7 +198,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
if(networkInterfaces.value(interfaceString) == "WLAN") {
#if defined(MAC_SDK_10_6)
- CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)];
+ CWInterface *wifiInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)];
CWConfiguration *userConfig = [ wifiInterface configuration];
NSSet *remNets = [userConfig rememberedNetworks]; //CWWirelessProfile
@@ -150,17 +206,16 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSEnumerator *enumerator = [remNets objectEnumerator];
CWWirelessProfile *wProfile;
NSUInteger index=0;
- CWNetwork *apNetwork;
NSDictionary *parametersDict;
NSArray* apArray;
- CW8021XProfile *user8021XProfile;
- NSError *err;
- NSMutableDictionary *params;
+ CW8021XProfile *user8021XProfile;
+ NSError *err;
+ NSMutableDictionary *params;
while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile
- if(id == nsstringToQString([wProfile ssid])) {
+ if(id == QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([wProfile ssid])))) {
user8021XProfile = nil;
user8021XProfile = [ wProfile user8021XProfile];
@@ -179,16 +234,14 @@ void QCoreWlanEngine::connectToId(const QString &id)
if(!err) {
for(uint row=0; row < [apArray count]; row++ ) {
- apNetwork = [apArray objectAtIndex:row];
+ CWNetwork *apNetwork = [apArray objectAtIndex:row];
if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) {
bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err];
if(!result) {
- qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]);
emit connectionError(id, ConnectError);
} else {
- [apNetwork release];
[autoreleasepool release];
return;
}
@@ -198,7 +251,6 @@ void QCoreWlanEngine::connectToId(const QString &id)
}
index++;
}
- [apNetwork release];
emit connectionError(id, InterfaceLookupError);
#endif
@@ -217,7 +269,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
if(networkInterfaces.value(getInterfaceFromId(id)) == "WLAN") { //wifi only for now
#if defined(MAC_SDK_10_6)
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
- CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)];
+ CWInterface *wifiInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)];
[wifiInterface disassociate];
if([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) {
emit connectionError(id, DisconnectionError);
@@ -235,15 +287,14 @@ void QCoreWlanEngine::requestUpdate()
{
QMutexLocker locker(&mutex);
- pollTimer.stop();
- QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
+ doRequestUpdate();
}
void QCoreWlanEngine::doRequestUpdate()
{
QMutexLocker locker(&mutex);
- getAllScInterfaces();
+ getWifiInterfaces();
QStringList previous = accessPointConfigurations.keys();
@@ -284,7 +335,7 @@ void QCoreWlanEngine::doRequestUpdate()
if (!interface.addressEntries().isEmpty())
state = QNetworkConfiguration::Active;
- if (accessPointConfigurations.contains(id)) {
+ if (accessPointConfigurations.contains(id)) { //handle only scanned AP's
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
bool changed = false;
@@ -311,20 +362,6 @@ void QCoreWlanEngine::doRequestUpdate()
if (changed)
emit configurationChanged(ptr);
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
-
- ptr->name = name;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearer = qGetInterfaceType(interface.name());
-
- accessPointConfigurations.insert(id, ptr);
- configurationInterface.insert(id, interface.name());
-
- emit configurationAdded(ptr);
}
}
@@ -335,8 +372,6 @@ void QCoreWlanEngine::doRequestUpdate()
emit configurationRemoved(ptr);
}
- pollTimer.start();
-
emit updateCompleted();
}
@@ -347,87 +382,82 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
QStringList found;
#if defined(MAC_SDK_10_6)
- NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ QMacCocoaAutoReleasePool pool;
- CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)];
- NSError *err = nil;
- NSDictionary *parametersDict = nil;
- NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
+ CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
+ if([currentInterface power]) {
+ NSError *err = nil;
+ NSDictionary *parametersDict = nil;
+ NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
- CWNetwork *apNetwork;
- if (!err) {
- for(uint row=0; row < [apArray count]; row++ ) {
- NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
+ CWNetwork *apNetwork;
+ if (!err) {
+ for(uint row=0; row < [apArray count]; row++ ) {
- apNetwork = [apArray objectAtIndex:row];
+ apNetwork = [apArray objectAtIndex:row];
- const QString networkSsid = nsstringToQString([apNetwork ssid]);
+ const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- found.append(id);
+ const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
+ found.append(id);
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
+ QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
- if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if (networkSsid == nsstringToQString([currentInterface ssid]))
- state = QNetworkConfiguration::Active;
- } else {
- if (isKnownSsid(interfaceName, networkSsid))
- state = QNetworkConfiguration::Discovered;
- else
- state = QNetworkConfiguration::Defined;
- }
+ if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if (networkSsid == qt_mac_NSStringToQString([currentInterface ssid]))
+ state = QNetworkConfiguration::Active;
+ } else {
+ if (isKnownSsid(interfaceName, networkSsid))
+ state = QNetworkConfiguration::Discovered;
+ else
+ state = QNetworkConfiguration::Defined;
+ }
- if (accessPointConfigurations.contains(id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
+ if (accessPointConfigurations.contains(id)) {
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- bool changed = false;
+ bool changed = false;
- if (!ptr->isValid) {
- ptr->isValid = true;
- changed = true;
- }
+ if (!ptr->isValid) {
+ ptr->isValid = true;
+ changed = true;
+ }
- if (ptr->name != networkSsid) {
- ptr->name = networkSsid;
- changed = true;
- }
+ if (ptr->name != networkSsid) {
+ ptr->name = networkSsid;
+ changed = true;
+ }
- if (ptr->id != id) {
- ptr->id = id;
- changed = true;
- }
+ if (ptr->id != id) {
+ ptr->id = id;
+ changed = true;
+ }
- if (ptr->state != state) {
- ptr->state = state;
- changed = true;
- }
+ if (ptr->state != state) {
+ ptr->state = state;
+ changed = true;
+ }
- if (changed)
- emit configurationChanged(ptr);
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
+ if (changed)
+ emit configurationChanged(ptr);
+ } else {
+ QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
- ptr->name = networkSsid;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearer = QLatin1String("WLAN");
+ ptr->name = networkSsid;
+ ptr->isValid = true;
+ ptr->id = id;
+ ptr->state = state;
+ ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ ptr->bearer = QLatin1String("WLAN");
- accessPointConfigurations.insert(id, ptr);
- configurationInterface.insert(id, interfaceName);
+ accessPointConfigurations.insert(id, ptr);
+ configurationInterface.insert(id, interfaceName);
- emit configurationAdded(ptr);
+ emit configurationAdded(ptr);
+ }
}
- [looppool release];
}
- } else {
- qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription])
- <<nsstringToQString([err domain]);
}
-
- [autoreleasepool drain];
#else
Q_UNUSED(interfaceName);
#endif
@@ -439,7 +469,7 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
QMutexLocker locker(&mutex);
#if defined(MAC_SDK_10_6)
- CWInterface *defaultInterface = [CWInterface interfaceWithName: qstringToNSString(wifiDeviceName)];
+ CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(wifiDeviceName)];
if([defaultInterface power])
return true;
#else
@@ -453,11 +483,11 @@ bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &s
QMutexLocker locker(&mutex);
#if defined(MAC_SDK_10_6)
- CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceName)];
+ CWInterface *wifiInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceName)];
CWConfiguration *userConfig = [wifiInterface configuration];
NSSet *remNets = [userConfig rememberedNetworks];
for (CWWirelessProfile *wProfile in remNets) {
- if(ssid == nsstringToQString([wProfile ssid]))
+ if(ssid == qt_mac_NSStringToQString([wProfile ssid]))
return true;
}
#else
@@ -467,45 +497,18 @@ bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &s
return false;
}
-bool QCoreWlanEngine::getAllScInterfaces()
+bool QCoreWlanEngine::getWifiInterfaces()
{
QMutexLocker locker(&mutex);
networkInterfaces.clear();
- NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ QMacCocoaAutoReleasePool pool;
- CFArrayRef interfaces = SCNetworkInterfaceCopyAll();
- if (interfaces != NULL) {
- CFIndex interfaceCount;
- CFIndex interfaceIndex;
- interfaceCount = CFArrayGetCount(interfaces);
- for (interfaceIndex = 0; interfaceIndex < interfaceCount; interfaceIndex++) {
- NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
-
- CFStringRef bsdName;
- CFTypeRef thisInterface = CFArrayGetValueAtIndex(interfaces, interfaceIndex);
- bsdName = SCNetworkInterfaceGetBSDName((SCNetworkInterfaceRef)thisInterface);
- QString interfaceName = cfstringRefToQstring(bsdName);
- QString typeStr;
- CFStringRef type = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)thisInterface);
- if ( CFEqual(type, kSCNetworkInterfaceTypeIEEE80211)) {
- typeStr = "WLAN";
-// } else if (CFEqual(type, kSCNetworkInterfaceTypeBluetooth)) {
-// typeStr = "Bluetooth";
- } else if(CFEqual(type, kSCNetworkInterfaceTypeEthernet)) {
- typeStr = "Ethernet";
- } else if(CFEqual(type, kSCNetworkInterfaceTypeFireWire)) {
- typeStr = "Ethernet"; //ok a bit fudged
- }
- if(!networkInterfaces.contains(interfaceName) && !typeStr.isEmpty()) {
- networkInterfaces.insert(interfaceName,typeStr);
- }
- [looppool release];
- }
+ NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
+ for(uint row=0; row < [wifiInterfaces count]; row++ ) {
+ networkInterfaces.insert( qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]),"WLAN");
}
- CFRelease(interfaces);
- [autoreleasepool drain];
return true;
}
@@ -540,6 +543,60 @@ QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const
return QNetworkConfigurationManager::ForcedRoaming;
}
+void QCoreWlanEngine::startNetworkChangeLoop()
+{
+ storeSession = NULL;
+
+ SCDynamicStoreContext dynStoreContext = { 0, this/*(void *)storeSession*/, NULL, NULL, NULL };
+ storeSession = SCDynamicStoreCreate(NULL,
+ CFSTR("networkChangeCallback"),
+ networkChangeCallback,
+ &dynStoreContext);
+ if (!storeSession ) {
+ qWarning() << "could not open dynamic store: error:" << SCErrorString(SCError());
+ return;
+ }
+
+ CFMutableArrayRef notificationKeys;
+ notificationKeys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+ CFMutableArrayRef patternsArray;
+ patternsArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+ CFStringRef storeKey;
+ storeKey = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+ kSCDynamicStoreDomainState,
+ kSCEntNetIPv4);
+ CFArrayAppendValue(notificationKeys, storeKey);
+ CFRelease(storeKey);
+
+ storeKey = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+ kSCDynamicStoreDomainState,
+ kSCCompAnyRegex,
+ kSCEntNetIPv4);
+ CFArrayAppendValue(patternsArray, storeKey);
+ CFRelease(storeKey);
+
+ if (!SCDynamicStoreSetNotificationKeys(storeSession , notificationKeys, patternsArray)) {
+ qWarning() << "register notification error:"<< SCErrorString(SCError());
+ CFRelease(storeSession );
+ CFRelease(notificationKeys);
+ CFRelease(patternsArray);
+ return;
+ }
+ CFRelease(notificationKeys);
+ CFRelease(patternsArray);
+
+ runloopSource = SCDynamicStoreCreateRunLoopSource(NULL, storeSession , 0);
+ if (!runloopSource) {
+ qWarning() << "runloop source error:"<< SCErrorString(SCError());
+ CFRelease(storeSession );
+ return;
+ }
+
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), runloopSource, kCFRunLoopDefaultMode);
+ return;
+}
+
QNetworkSessionPrivate *QCoreWlanEngine::createSessionBackend()
{
return new QNetworkSessionPrivateImpl;
@@ -550,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 dc89342..a9e78b2 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -63,6 +63,7 @@
#include <unistd.h>
#endif
+QT_BEGIN_NAMESPACE
static QString qGetInterfaceType(const QString &interface)
{
@@ -141,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()
@@ -178,8 +176,7 @@ void QGenericEngine::requestUpdate()
{
QMutexLocker locker(&mutex);
- pollTimer.stop();
- QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
+ doRequestUpdate();
}
void QGenericEngine::doRequestUpdate()
@@ -281,8 +278,6 @@ void QGenericEngine::doRequestUpdate()
emit configurationRemoved(ptr);
}
- pollTimer.start();
-
emit updateCompleted();
}
@@ -327,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/icd/monitor.cpp b/src/plugins/bearer/icd/monitor.cpp
index 0ff45d2..5b0af7e 100644
--- a/src/plugins/bearer/icd/monitor.cpp
+++ b/src/plugins/bearer/icd/monitor.cpp
@@ -47,32 +47,12 @@
#include <maemo_icd.h>
#include <iapconf.h>
-#define IAP "/system/osso/connectivity/IAP"
-
-static int iap_prefix_len;
-
-/* Notify func that is called when IAP is added or deleted */
-void notify_iap(GConfClient *, guint, GConfEntry *entry, gpointer user_data)
-{
- const char *key = gconf_entry_get_key(entry);
- if (key && g_str_has_prefix(key, IAP)) {
- IapMonitor *ptr = (IapMonitor *)user_data;
- if (gconf_entry_get_value(entry)) {
- ptr->iapAdded(key, entry);
- } else {
- ptr->iapDeleted(key, entry);
- }
- }
-}
-
void IapMonitor::setup(QIcdEngine *d_ptr)
{
if (first_call) {
- d = d_ptr;
- iap_prefix_len = strlen(IAP);
- iap = new Maemo::IAPMonitor(notify_iap, (gpointer)this);
- first_call = false;
+ d = d_ptr;
+ first_call = false;
}
}
@@ -80,37 +60,25 @@ void IapMonitor::setup(QIcdEngine *d_ptr)
void IapMonitor::cleanup()
{
if (!first_call) {
- delete iap;
- timers.removeAll();
- first_call = true;
+ timers.removeAll();
+ first_call = true;
}
}
-void IapMonitor::iapAdded(const char *key, GConfEntry * /*entry*/)
+void IapMonitor::iapAdded(const QString &iap_id)
{
- //qDebug("Notify called for added element: %s=%s",
- // gconf_entry_get_key(entry), gconf_value_to_string(gconf_entry_get_value(entry)));
-
- /* We cannot know when the IAP is fully added to gconf, so a timer is
+ /* We cannot know when the IAP is fully added to db, so a timer is
* installed instead. When the timer expires we hope that IAP is added ok.
*/
- QString iap_id = QString(key + iap_prefix_len + 1).section('/',0,0);
- timers.add(iap_id, d);
+ QString id = iap_id;
+ timers.add(id, d);
}
-void IapMonitor::iapDeleted(const char *key, GConfEntry * /*entry*/)
+void IapMonitor::iapRemoved(const QString &iap_id)
{
- //qDebug("Notify called for deleted element: %s", gconf_entry_get_key(entry));
-
- /* We are only interested in IAP deletions so we skip the config entries
- */
- if (strstr(key + iap_prefix_len + 1, "/")) {
- //qDebug("Deleting IAP config %s", key+iap_prefix_len);
- return;
- }
-
- QString iap_id = key + iap_prefix_len + 1;
- d->deleteConfiguration(iap_id);
+ QString id = iap_id;
+ d->deleteConfiguration(id);
}
+
diff --git a/src/plugins/bearer/icd/monitor.h b/src/plugins/bearer/icd/monitor.h
index 82b0f36..10ffb30 100644
--- a/src/plugins/bearer/icd/monitor.h
+++ b/src/plugins/bearer/icd/monitor.h
@@ -53,7 +53,7 @@
class QIcdEngine;
/* The IapAddTimer is a helper class that makes sure we update
- * the configuration only after all gconf additions to certain
+ * the configuration only after all db additions to certain
* iap are finished (after a certain timeout)
*/
class _IapAddTimer : public QObject
@@ -64,10 +64,10 @@ public:
_IapAddTimer() {}
~_IapAddTimer()
{
- if (timer.isActive()) {
- QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
- timer.stop();
- }
+ if (timer.isActive()) {
+ QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
+ timer.stop();
+ }
}
void add(QString& iap_id, QIcdEngine *d);
@@ -92,23 +92,21 @@ public:
void removeAll();
};
-class IapMonitor
+class IapMonitor : public Maemo::IAPMonitor
{
public:
IapMonitor() : first_call(true) { }
- friend void notify_iap(GConfClient *, guint,
- GConfEntry *entry, gpointer user_data);
void setup(QIcdEngine *d);
void cleanup();
+protected:
+ void iapAdded(const QString &iapId);
+ void iapRemoved(const QString &iapId);
+
private:
bool first_call;
- void iapAdded(const char *key, GConfEntry *entry);
- void iapDeleted(const char *key, GConfEntry *entry);
-
- Maemo::IAPMonitor *iap;
QIcdEngine *d;
IapAddTimer timers;
};
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index f10042a..5e506ef 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -189,14 +189,9 @@ void QIcdEngine::doRequestUpdate()
QList<QString> all_iaps;
Maemo::IAPConf::getAll(all_iaps);
- foreach (QString escaped_iap_id, all_iaps) {
+ foreach (QString iap_id, all_iaps) {
QByteArray ssid;
- /* The key that is returned by getAll() needs to be unescaped */
- gchar *unescaped_id = gconf_unescape_key(escaped_iap_id.toUtf8().data(), -1);
- QString iap_id = QString((char *)unescaped_id);
- g_free(unescaped_id);
-
previous.removeAll(iap_id);
Maemo::IAPConf saved_ap(iap_id);
@@ -211,14 +206,11 @@ void QIcdEngine::doRequestUpdate()
QString iap_type = saved_ap.value("type").toString();
if (iap_type.startsWith("WLAN")) {
ssid = saved_ap.value("wlan_ssid").toByteArray();
- if (ssid.isEmpty()) {
- qWarning() << "Cannot get ssid for" << iap_id;
+ if (ssid.isEmpty())
continue;
- }
QString security_method = saved_ap.value("wlan_security").toString();
} else if (iap_type.isEmpty()) {
- qWarning() << "IAP" << iap_id << "network type is not set! Skipping it";
continue;
} else {
#ifdef BEARER_MANAGEMENT_DEBUG
@@ -231,11 +223,12 @@ void QIcdEngine::doRequestUpdate()
IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate;
cpPriv->name = saved_ap.value("name").toString();
- if (cpPriv->name.isEmpty())
- if (!ssid.isEmpty() && ssid.size() > 0)
- cpPriv->name = ssid.data();
- else
- cpPriv->name = iap_id;
+ if (cpPriv->name.isEmpty()) {
+ if (!ssid.isEmpty() && ssid.size() > 0)
+ cpPriv->name = ssid.data();
+ else
+ cpPriv->name = iap_id;
+ }
cpPriv->isValid = true;
cpPriv->id = iap_id;
cpPriv->network_id = ssid;
@@ -274,7 +267,9 @@ void QIcdEngine::doRequestUpdate()
scanned,
error);
if (!error.isEmpty()) {
- qWarning() << "Network scanning failed" << error;
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug() << "Network scanning failed" << error;
+#endif
} else {
#ifdef BEARER_MANAGEMENT_DEBUG
if (!scanned.isEmpty())
@@ -379,23 +374,17 @@ void QIcdEngine::deleteConfiguration(const QString &iap_id)
{
QMutexLocker locker(&mutex);
- /* Called when IAPs are deleted in gconf, in this case we do not scan
- * or read all the IAPs from gconf because it might take too much power
- * (multiple applications would need to scan and read all IAPs from gconf)
+ /* Called when IAPs are deleted in db, in this case we do not scan
+ * or read all the IAPs from db because it might take too much power
+ * (multiple applications would need to scan and read all IAPs from db)
*/
- if (accessPointConfigurations.contains(iap_id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(iap_id);
-
- if (ptr) {
- ptr->isValid = false;
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(iap_id);
+ if (ptr) {
#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP" << iap_id << "was removed from storage.";
+ qDebug() << "IAP" << iap_id << "was removed from storage.";
#endif
- emit configurationRemoved(ptr);
- } else {
- qWarning("Configuration not found for IAP %s", iap_id.toAscii().data());
- }
+ emit configurationRemoved(ptr);
} else {
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("IAP: %s, already missing from the known list", iap_id.toAscii().data());
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index a9e93e0..bb81408 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -49,6 +49,7 @@
#include <maemo_icd.h>
#include <iapconf.h>
+#include <proxyconf.h>
#include <sys/types.h>
#include <ifaddrs.h>
@@ -139,7 +140,9 @@ static DBusHandlerResult signal_handler(DBusConnection *,
DBUS_TYPE_STRING, &network_type,
DBUS_TYPE_STRING, &state,
DBUS_TYPE_INVALID) == FALSE) {
- qWarning() << QString("Failed to parse icd status signal: %1").arg(error.message);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug() << QString("Failed to parse icd status signal: %1").arg(error.message);
+#endif
} else {
QString _iap_id(iap_id);
QString _network_type(network_type);
@@ -165,7 +168,6 @@ void IcdListener::setup(QNetworkSessionPrivateImpl *d)
dbus_connection = get_dbus_conn(&error);
if (dbus_error_is_set(&error)) {
- qWarning() << "Cannot get dbus connection.";
dbus_error_free(&error);
return;
}
@@ -175,7 +177,6 @@ void IcdListener::setup(QNetworkSessionPrivateImpl *d)
dbus_bus_add_match(dbus_connection, ICD_DBUS_MATCH, &error);
if (dbus_error_is_set(&error)) {
- qWarning() << "Cannot add match" << ICD_DBUS_MATCH;
dbus_error_free(&error);
return;
}
@@ -184,7 +185,6 @@ void IcdListener::setup(QNetworkSessionPrivateImpl *d)
ICD_DBUS_PATH,
&icd_vtable,
(void*)this) == FALSE) {
- qWarning() << "Cannot register dbus signal handler, interface"<< ICD_DBUS_INTERFACE << "path" << ICD_DBUS_PATH;
dbus_error_free(&error);
return;
}
@@ -299,6 +299,8 @@ void IcdListener::cleanupSession(QNetworkSessionPrivateImpl *ptr)
void QNetworkSessionPrivateImpl::cleanupSession(void)
{
icdListener()->cleanupSession(this);
+
+ QObject::disconnect(q, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateProxies(QNetworkSession::State)));
}
@@ -337,8 +339,6 @@ void QNetworkSessionPrivateImpl::updateIdentifier(QString &newId)
} else {
toIcdConfig(privateConfiguration(publicConfig))->network_attrs |= ICD_NW_ATTR_IAPNAME;
if (privateConfiguration(publicConfig)->id != newId) {
- qWarning() << "Your config id changed from" << privateConfiguration(publicConfig)->id
- << "to" << newId;
privateConfiguration(publicConfig)->id = newId;
}
}
@@ -451,6 +451,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)),
this, SLOT(configurationChanged(QNetworkConfiguration)));
+ QObject::connect(q, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateProxies(QNetworkSession::State)));
+
state = QNetworkSession::Invalid;
lastError = QNetworkSession::UnknownSessionError;
@@ -867,7 +869,6 @@ void QNetworkSessionPrivateImpl::do_open()
qDebug() << "connect to"<< iap << "failed, result is empty";
#endif
updateState(QNetworkSession::Disconnected);
- emit quitPendingWaitsForOpened();
emit QNetworkSessionPrivate::error(QNetworkSession::InvalidConfigurationError);
if (publicConfig.type() == QNetworkConfiguration::UserChoice)
cleanupAnyConfiguration();
@@ -882,7 +883,6 @@ void QNetworkSessionPrivateImpl::do_open()
if ((publicConfig.type() != QNetworkConfiguration::UserChoice) &&
(connected_iap != config.identifier())) {
updateState(QNetworkSession::Disconnected);
- emit quitPendingWaitsForOpened();
emit QNetworkSessionPrivate::error(QNetworkSession::InvalidConfigurationError);
return;
}
@@ -946,7 +946,6 @@ void QNetworkSessionPrivateImpl::do_open()
updateState(QNetworkSession::Disconnected);
if (publicConfig.type() == QNetworkConfiguration::UserChoice)
cleanupAnyConfiguration();
- emit quitPendingWaitsForOpened();
emit QNetworkSessionPrivate::error(QNetworkSession::UnknownSessionError);
}
}
@@ -1013,25 +1012,21 @@ void QNetworkSessionPrivateImpl::stop()
void QNetworkSessionPrivateImpl::migrate()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
}
void QNetworkSessionPrivateImpl::accept()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
}
void QNetworkSessionPrivateImpl::ignore()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
}
void QNetworkSessionPrivateImpl::reject()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
}
@@ -1080,14 +1075,14 @@ QString QNetworkSessionPrivateImpl::errorString() const
QString errorStr;
switch(q->error()) {
case QNetworkSession::RoamingError:
- errorStr = QObject::tr("Roaming error");
+ errorStr = QNetworkSessionPrivateImpl::tr("Roaming error");
break;
case QNetworkSession::SessionAbortedError:
- errorStr = QObject::tr("Session aborted by user or system");
+ errorStr = QNetworkSessionPrivateImpl::tr("Session aborted by user or system");
break;
default:
case QNetworkSession::UnknownSessionError:
- errorStr = QObject::tr("Unidentified Error");
+ errorStr = QNetworkSessionPrivateImpl::tr("Unidentified Error");
break;
}
return errorStr;
@@ -1099,6 +1094,30 @@ QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const
return QNetworkSession::UnknownSessionError;
}
+void QNetworkSessionPrivateImpl::updateProxies(QNetworkSession::State newState)
+{
+ if ((newState == QNetworkSession::Connected) &&
+ (newState != currentState))
+ updateProxyInformation();
+ else if ((newState == QNetworkSession::Disconnected) &&
+ (currentState == QNetworkSession::Closing))
+ clearProxyInformation();
+
+ currentState = newState;
+}
+
+
+void QNetworkSessionPrivateImpl::updateProxyInformation()
+{
+ Maemo::ProxyConf::update();
+}
+
+
+void QNetworkSessionPrivateImpl::clearProxyInformation()
+{
+ Maemo::ProxyConf::clear();
+}
+
#include "qnetworksession_impl.moc"
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h
index b7461dc..587e6dc 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.h
+++ b/src/plugins/bearer/icd/qnetworksession_impl.h
@@ -75,7 +75,7 @@ class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate
public:
QNetworkSessionPrivateImpl(QIcdEngine *engine)
- : engine(engine), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT)
+ : engine(engine), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT), currentState(QNetworkSession::Invalid)
{
}
@@ -118,6 +118,7 @@ private Q_SLOTS:
void do_open();
void networkConfigurationsChanged();
void configurationChanged(const QNetworkConfiguration &config);
+ void updateProxies(QNetworkSession::State newState);
private:
QNetworkConfigurationManager manager;
@@ -139,6 +140,10 @@ private:
void updateIdentifier(QString &newId);
quint64 getStatistics(bool sent) const;
void cleanupSession(void);
+
+ void updateProxyInformation();
+ void clearProxyInformation();
+ QNetworkSession::State currentState;
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index c8015d8..b6522ad 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -83,8 +83,10 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent)
DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle);
if (result != ERROR_SUCCESS) {
+#ifdef BEARER_MANAGEMENT_DEBUG
if (result != ERROR_SERVICE_NOT_ACTIVE)
- qWarning("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result);
+ qDebug("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result);
+#endif
return;
}
@@ -92,13 +94,11 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent)
result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true,
WLAN_NOTIFICATION_CALLBACK(qNotificationCallback),
this, 0, 0);
+#ifdef BEARER_MANAGEMENT_DEBUG
if (result != ERROR_SUCCESS)
- qWarning("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
+ qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
+#endif
- // 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();
}
@@ -111,16 +111,22 @@ void QNativeWifiEngine::scanComplete()
{
QMutexLocker locker(&mutex);
- QStringList previous = accessPointConfigurations.keys();
-
// enumerate interfaces
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#endif
+
+ locker.unlock();
+ emit updateCompleted();
+
return;
}
+ QStringList previous = accessPointConfigurations.keys();
+
for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) {
const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i];
@@ -128,8 +134,10 @@ void QNativeWifiEngine::scanComplete()
result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid,
3, 0, &networkList);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n",
- __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n",
+ __FUNCTION__, result);
+#endif
continue;
}
@@ -222,8 +230,6 @@ void QNativeWifiEngine::scanComplete()
emit configurationRemoved(ptr);
}
- pollTimer.start();
-
emit updateCompleted();
}
@@ -235,7 +241,9 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id)
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#endif
return QString();
}
@@ -248,8 +256,10 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id)
wlan_intf_opcode_current_connection, 0, &dataSize,
reinterpret_cast<PVOID *>(&connectionAttributes), 0);
if (result != ERROR_SUCCESS) {
+#ifdef BEARER_MANAGEMENT_DEBUG
if (result != ERROR_INVALID_STATE)
- qWarning("%s: WlanQueryInterface failed with error %ld\n", __FUNCTION__, result);
+ qDebug("%s: WlanQueryInterface failed with error %ld\n", __FUNCTION__, result);
+#endif
continue;
}
@@ -286,7 +296,9 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id)
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#endif
return false;
}
@@ -297,8 +309,10 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id)
result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid,
3, 0, &networkList);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n",
- __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n",
+ __FUNCTION__, result);
+#endif
continue;
}
@@ -341,7 +355,9 @@ void QNativeWifiEngine::connectToId(const QString &id)
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#endif
emit connectionError(id, InterfaceLookupError);
return;
}
@@ -355,8 +371,10 @@ void QNativeWifiEngine::connectToId(const QString &id)
result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid,
3, 0, &networkList);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n",
- __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n",
+ __FUNCTION__, result);
+#endif
continue;
}
@@ -384,7 +402,9 @@ void QNativeWifiEngine::connectToId(const QString &id)
DWORD result = local_WlanConnect(handle, &interface.InterfaceGuid, &parameters, 0);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result);
+#endif
emit connectionError(id, ConnectError);
break;
}
@@ -423,7 +443,9 @@ void QNativeWifiEngine::disconnectFromId(const QString &id)
DWORD result = local_WlanDisconnect(handle, &guid, 0);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result);
+#endif
emit connectionError(id, DisconnectionError);
return;
}
@@ -437,17 +459,34 @@ void QNativeWifiEngine::requestUpdate()
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
if (result != ERROR_SUCCESS) {
- qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
+#endif
+
+ locker.unlock();
+ emit updateCompleted();
+
return;
}
+ bool requested = false;
for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) {
result = local_WlanScan(handle, &interfaceList->InterfaceInfo[i].InterfaceGuid, 0, 0, 0);
- if (result != ERROR_SUCCESS)
- qWarning("%s: WlanScan failed with error %ld\n", __FUNCTION__, result);
+ if (result != ERROR_SUCCESS) {
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("%s: WlanScan failed with error %ld\n", __FUNCTION__, result);
+#endif
+ } else {
+ requested = true;
+ }
}
local_WlanFreeMemory(interfaceList);
+
+ if (!requested) {
+ locker.unlock();
+ emit updateCompleted();
+ }
}
QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id)
@@ -492,4 +531,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;
};
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 5c6efe3..0fa8f3c 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -49,7 +49,6 @@
#include <QtCore/qdebug.h>
-#include <NetworkManager/NetworkManager.h>
#include <QtDBus>
#include <QDBusConnection>
#include <QDBusError>
@@ -147,7 +146,7 @@ QString QNetworkManagerEngine::getInterfaceFromId(const QString &id)
continue;
QNetworkManagerInterfaceDevice device(devices.at(0).path());
- return device.interface().name();
+ return device.networkInterface().name();
}
}
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 5dc0ea4..d23bb0d 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -41,26 +41,22 @@
#include <QObject>
#include <QList>
-#include <QtDBus>
-#include <QDBusConnection>
-#include <QDBusError>
-#include <QDBusInterface>
-#include <QDBusMessage>
-#include <QDBusReply>
-#include <QDBusPendingCallWatcher>
-#include <QDBusObjectPath>
-#include <QDBusPendingCall>
-
-#include <NetworkManager/NetworkManager.h>
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusPendingCall>
-#include "qnmdbushelper.h"
#include "qnetworkmanagerservice.h"
+#include "qnmdbushelper.h"
-//Q_DECLARE_METATYPE(QList<uint>)
QT_BEGIN_NAMESPACE
static QDBusConnection dbusConnection = QDBusConnection::systemBus();
-//static QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbusConnection);
class QNetworkManagerInterfacePrivate
{
@@ -70,19 +66,19 @@ public:
};
QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
- : QObject(parent), nmDBusHelper(0)
+ : QObject(parent)
{
d = new QNetworkManagerInterfacePrivate();
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
}
d->valid = true;
- nmDBusHelper = new QNmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)),
@@ -92,8 +88,6 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
QNetworkManagerInterface::~QNetworkManagerInterface()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -108,24 +102,24 @@ bool QNetworkManagerInterface::setConnections()
if(!isValid() )
return false;
bool allOk = false;
- if (!dbusConnection.connect(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- "PropertiesChanged",
+ if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>)))) {
allOk = true;
}
- if (!dbusConnection.connect(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- "DeviceAdded",
+ if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("DeviceAdded"),
this,SIGNAL(deviceAdded(QDBusObjectPath)))) {
allOk = true;
}
- if (!dbusConnection.connect(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- "DeviceRemoved",
+ if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("DeviceRemoved"),
this,SIGNAL(deviceRemoved(QDBusObjectPath)))) {
allOk = true;
}
@@ -140,7 +134,7 @@ QDBusInterface *QNetworkManagerInterface::connectionInterface() const
QList <QDBusObjectPath> QNetworkManagerInterface::getDevices() const
{
- QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call("GetDevices");
+ QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetDevices"));
return reply.value();
}
@@ -149,7 +143,7 @@ void QNetworkManagerInterface::activateConnection( const QString &serviceName,
QDBusObjectPath devicePath,
QDBusObjectPath specificObject)
{
- QDBusPendingCall pendingCall = d->connectionInterface->asyncCall("ActivateConnection",
+ QDBusPendingCall pendingCall = d->connectionInterface->asyncCall(QLatin1String("ActivateConnection"),
QVariant(serviceName),
QVariant::fromValue(connectionPath),
QVariant::fromValue(devicePath),
@@ -162,7 +156,7 @@ void QNetworkManagerInterface::activateConnection( const QString &serviceName,
void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) const
{
- d->connectionInterface->call("DeactivateConnection", QVariant::fromValue(connectionPath));
+ d->connectionInterface->call(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
}
bool QNetworkManagerInterface::wirelessEnabled() const
@@ -186,7 +180,6 @@ quint32 QNetworkManagerInterface::state()
return d->connectionInterface->property("State").toUInt();
}
-/////////////
class QNetworkManagerInterfaceAccessPointPrivate
{
public:
@@ -200,13 +193,12 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q
{
d = new QNetworkManagerInterfaceAccessPointPrivate();
d->path = dbusPathName;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_ACCESS_POINT,
+ QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
- qWarning() << "Could not find InterfaceAccessPoint";
return;
}
d->valid = true;
@@ -215,8 +207,6 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q
QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -232,17 +222,15 @@ bool QNetworkManagerInterfaceAccessPoint::setConnections()
return false;
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
- if(dbusConnection.connect(NM_DBUS_SERVICE,
+ if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_ACCESS_POINT,
- "PropertiesChanged",
+ QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>))) ) {
allOk = true;
@@ -300,7 +288,6 @@ quint32 QNetworkManagerInterfaceAccessPoint::strength() const
return d->connectionInterface->property("Strength").toUInt();
}
-/////////////
class QNetworkManagerInterfaceDevicePrivate
{
public:
@@ -314,13 +301,12 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
{
d = new QNetworkManagerInterfaceDevicePrivate();
d->path = deviceObjectPath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE,
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE),
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
- qWarning() << "Could not find NetworkManagerInterfaceDevice";
return;
}
d->valid = true;
@@ -328,8 +314,6 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -345,16 +329,14 @@ bool QNetworkManagerInterfaceDevice::setConnections()
return false;
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)),
this, SIGNAL(stateChanged(const QString&, quint32)));
- if(dbusConnection.connect(NM_DBUS_SERVICE,
+ if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE,
- "StateChanged",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE),
+ QLatin1String("StateChanged"),
nmDBusHelper,SLOT(deviceStateChanged(quint32)))) {
allOk = true;
}
@@ -371,7 +353,7 @@ QString QNetworkManagerInterfaceDevice::udi() const
return d->connectionInterface->property("Udi").toString();
}
-QNetworkInterface QNetworkManagerInterfaceDevice::interface() const
+QNetworkInterface QNetworkManagerInterfaceDevice::networkInterface() const
{
return QNetworkInterface::interfaceFromName(d->connectionInterface->property("Interface").toString());
}
@@ -397,7 +379,6 @@ QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const
return prop.value<QDBusObjectPath>();
}
-/////////////
class QNetworkManagerInterfaceDeviceWiredPrivate
{
public:
@@ -411,13 +392,12 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
{
d = new QNetworkManagerInterfaceDeviceWiredPrivate();
d->path = ifaceDevicePath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRED,
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
- qWarning() << "Could not find InterfaceDeviceWired";
return;
}
d->valid = true;
@@ -425,8 +405,6 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -444,16 +422,14 @@ bool QNetworkManagerInterfaceDeviceWired::setConnections()
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
- if(dbusConnection.connect(NM_DBUS_SERVICE,
+ if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRED,
- "PropertiesChanged",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>))) ) {
allOk = true;
}
@@ -480,7 +456,6 @@ bool QNetworkManagerInterfaceDeviceWired::carrier() const
return d->connectionInterface->property("Carrier").toBool();
}
-/////////////
class QNetworkManagerInterfaceDeviceWirelessPrivate
{
public:
@@ -494,13 +469,12 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
{
d = new QNetworkManagerInterfaceDeviceWirelessPrivate();
d->path = ifaceDevicePath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
- qWarning() << "Could not find InterfaceDeviceWireless";
return;
}
d->valid = true;
@@ -508,8 +482,6 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -525,10 +497,8 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
return false;
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
@@ -538,28 +508,28 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
connect(nmDBusHelper, SIGNAL(pathForAccessPointRemoved(const QString &,QDBusObjectPath)),
this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)));
- if(!dbusConnection.connect(NM_DBUS_SERVICE,
+ if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
- "AccessPointAdded",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+ QLatin1String("AccessPointAdded"),
nmDBusHelper, SLOT(slotAccessPointAdded( QDBusObjectPath )))) {
allOk = true;
}
- if(!dbusConnection.connect(NM_DBUS_SERVICE,
+ if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
- "AccessPointRemoved",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+ QLatin1String("AccessPointRemoved"),
nmDBusHelper, SLOT(slotAccessPointRemoved( QDBusObjectPath )))) {
allOk = true;
}
- if(!dbusConnection.connect(NM_DBUS_SERVICE,
+ if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
- "PropertiesChanged",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>)))) {
allOk = true;
}
@@ -574,7 +544,7 @@ QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() co
QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
{
- QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call("GetAccessPoints");
+ QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetAccessPoints"));
return reply.value();
}
@@ -603,7 +573,6 @@ quint32 QNetworkManagerInterfaceDeviceWireless::wirelessCapabilities() const
return d->connectionInterface->property("WirelelessCapabilities").toUInt();
}
-/////////////
class QNetworkManagerSettingsPrivate
{
public:
@@ -618,12 +587,11 @@ QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService,
d = new QNetworkManagerSettingsPrivate();
d->path = settingsService;
d->connectionInterface = new QDBusInterface(settingsService,
- NM_DBUS_PATH_SETTINGS,
- NM_DBUS_IFACE_SETTINGS,
+ QLatin1String(NM_DBUS_PATH_SETTINGS),
+ QLatin1String(NM_DBUS_IFACE_SETTINGS),
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
- //qWarning() << "Could not find NetworkManagerSettings";
return;
}
d->valid = true;
@@ -644,8 +612,8 @@ bool QNetworkManagerSettings::setConnections()
{
bool allOk = false;
- if (!dbusConnection.connect(d->path, NM_DBUS_PATH_SETTINGS,
- NM_DBUS_IFACE_SETTINGS, "NewConnection",
+ if (!dbusConnection.connect(d->path, QLatin1String(NM_DBUS_PATH_SETTINGS),
+ QLatin1String(NM_DBUS_IFACE_SETTINGS), QLatin1String("NewConnection"),
this, SIGNAL(newConnection(QDBusObjectPath)))) {
allOk = true;
}
@@ -655,7 +623,7 @@ bool QNetworkManagerSettings::setConnections()
QList <QDBusObjectPath> QNetworkManagerSettings::listConnections()
{
- QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call("ListConnections");
+ QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("ListConnections"));
return reply.value();
}
@@ -665,7 +633,6 @@ QDBusInterface *QNetworkManagerSettings::connectionInterface() const
}
-/////////////
class QNetworkManagerSettingsConnectionPrivate
{
public:
@@ -685,22 +652,19 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri
d->service = settingsService;
d->connectionInterface = new QDBusInterface(settingsService,
d->path,
- NM_DBUS_IFACE_SETTINGS_CONNECTION,
+ QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
- //qWarning() << "Could not find NetworkManagerSettingsConnection";
d->valid = false;
return;
}
d->valid = true;
- QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings");
+ QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call(QLatin1String("GetSettings"));
d->settingsMap = rep.value();
}
QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -717,32 +681,26 @@ bool QNetworkManagerSettingsConnection::setConnections()
bool allOk = false;
if(!dbusConnection.connect(d->service, d->path,
- NM_DBUS_IFACE_SETTINGS_CONNECTION, "Updated",
+ QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Updated"),
this, SIGNAL(updated(QNmSettingsMap)))) {
allOk = true;
} else {
QDBusError error = dbusConnection.lastError();
}
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(const QString &)),
this,SIGNAL(removed( const QString &)));
if (!dbusConnection.connect(d->service, d->path,
- NM_DBUS_IFACE_SETTINGS_CONNECTION, "Removed",
+ QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Removed"),
nmDBusHelper, SIGNAL(slotSettingsRemoved()))) {
allOk = true;
}
return allOk;
}
-//QNetworkManagerSettingsConnection::update(QNmSettingsMap map)
-//{
-// d->connectionInterface->call("Update", QVariant::fromValue(map));
-//}
QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const
{
@@ -751,23 +709,23 @@ QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const
QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
{
- QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings");
+ QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call(QLatin1String("GetSettings"));
d->settingsMap = rep.value();
return d->settingsMap;
}
NMDeviceType QNetworkManagerSettingsConnection::getType()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("type");
- while (ii != innerMap.end() && ii.key() == "type") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("type"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("type")) {
QString devType = ii.value().toString();
- if (devType == "802-3-ethernet") {
+ if (devType == QLatin1String("802-3-ethernet")) {
return DEVICE_TYPE_802_3_ETHERNET;
}
- if (devType == "802-11-wireless") {
+ if (devType == QLatin1String("802-11-wireless")) {
return DEVICE_TYPE_802_11_WIRELESS;
}
ii++;
@@ -779,11 +737,11 @@ NMDeviceType QNetworkManagerSettingsConnection::getType()
bool QNetworkManagerSettingsConnection::isAutoConnect()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("autoconnect");
- while (ii != innerMap.end() && ii.key() == "autoconnect") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("autoconnect"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("autoconnect")) {
return ii.value().toBool();
ii++;
}
@@ -794,11 +752,11 @@ bool QNetworkManagerSettingsConnection::isAutoConnect()
quint64 QNetworkManagerSettingsConnection::getTimestamp()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("timestamp");
- while (ii != innerMap.end() && ii.key() == "timestamp") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("timestamp"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("timestamp")) {
return ii.value().toUInt();
ii++;
}
@@ -809,11 +767,11 @@ quint64 QNetworkManagerSettingsConnection::getTimestamp()
QString QNetworkManagerSettingsConnection::getId()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("id");
- while (ii != innerMap.end() && ii.key() == "id") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("id"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("id")) {
return ii.value().toString();
ii++;
}
@@ -824,11 +782,11 @@ QString QNetworkManagerSettingsConnection::getId()
QString QNetworkManagerSettingsConnection::getUuid()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("uuid");
- while (ii != innerMap.end() && ii.key() == "uuid") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("uuid"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("uuid")) {
return ii.value().toString();
ii++;
}
@@ -840,11 +798,11 @@ QString QNetworkManagerSettingsConnection::getUuid()
QString QNetworkManagerSettingsConnection::getSsid()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless");
- while (i != d->settingsMap.end() && i.key() == "802-11-wireless") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("ssid");
- while (ii != innerMap.end() && ii.key() == "ssid") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("ssid"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("ssid")) {
return ii.value().toString();
ii++;
}
@@ -856,11 +814,11 @@ QString QNetworkManagerSettingsConnection::getSsid()
QString QNetworkManagerSettingsConnection::getMacAddress()
{
if(getType() == DEVICE_TYPE_802_3_ETHERNET) {
- QNmSettingsMap::const_iterator i = d->settingsMap.find("802-3-ethernet");
- while (i != d->settingsMap.end() && i.key() == "802-3-ethernet") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-3-ethernet"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("802-3-ethernet")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("mac-address");
- while (ii != innerMap.end() && ii.key() == "mac-address") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) {
return ii.value().toString();
ii++;
}
@@ -869,11 +827,11 @@ QString QNetworkManagerSettingsConnection::getMacAddress()
}
else if(getType() == DEVICE_TYPE_802_11_WIRELESS) {
- QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless");
- while (i != d->settingsMap.end() && i.key() == "802-11-wireless") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("mac-address");
- while (ii != innerMap.end() && ii.key() == "mac-address") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) {
return ii.value().toString();
ii++;
}
@@ -886,11 +844,11 @@ QString QNetworkManagerSettingsConnection::getMacAddress()
QStringList QNetworkManagerSettingsConnection::getSeenBssids()
{
if(getType() == DEVICE_TYPE_802_11_WIRELESS) {
- QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless");
- while (i != d->settingsMap.end() && i.key() == "802-11-wireless") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("seen-bssids");
- while (ii != innerMap.end() && ii.key() == "seen-bssids") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("seen-bssids"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("seen-bssids")) {
return ii.value().toStringList();
ii++;
}
@@ -900,7 +858,6 @@ QStringList QNetworkManagerSettingsConnection::getSeenBssids()
return QStringList();
}
-/////////////
class QNetworkManagerConnectionActivePrivate
{
public:
@@ -914,13 +871,12 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString
{
d = new QNetworkManagerConnectionActivePrivate();
d->path = activeConnectionObjectPath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
+ QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
- //qWarning() << "Could not find NetworkManagerSettingsConnection";
return;
}
d->valid = true;
@@ -928,8 +884,6 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString
QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -945,16 +899,14 @@ bool QNetworkManagerConnectionActive::setConnections()
return false;
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
- if(dbusConnection.connect(NM_DBUS_SERVICE,
+ if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
- "PropertiesChanged",
+ QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>))) ) {
allOk = true;
}
@@ -1000,8 +952,6 @@ bool QNetworkManagerConnectionActive::defaultRoute() const
return d->connectionInterface->property("Default").toBool();
}
-
-////
class QNetworkManagerIp4ConfigPrivate
{
public:
@@ -1015,13 +965,12 @@ QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectP
{
d = new QNetworkManagerIp4ConfigPrivate();
d->path = deviceObjectPath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_IP4_CONFIG,
+ QLatin1String(NM_DBUS_INTERFACE_IP4_CONFIG),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
- //qWarning() << "Could not find NetworkManagerIp4Config";
return;
}
d->valid = true;
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
index 81903ec..048f628 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
@@ -53,26 +53,87 @@
// We mean it.
//
-#include <NetworkManager/NetworkManager.h>
-#include <QtDBus>
-#include <QDBusConnection>
-#include <QDBusError>
-#include <QDBusInterface>
-#include <QDBusMessage>
-#include <QDBusReply>
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
#include <QNetworkInterface>
-#include <QDBusPendingCallWatcher>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusContext>
+#include <QMap>
#include "qnmdbushelper.h"
+#ifndef NETWORK_MANAGER_H
+typedef enum NMDeviceType
+{
+ DEVICE_TYPE_UNKNOWN = 0,
+ DEVICE_TYPE_802_3_ETHERNET,
+ DEVICE_TYPE_802_11_WIRELESS,
+ DEVICE_TYPE_GSM,
+ DEVICE_TYPE_CDMA
+} NMDeviceType;
+
+typedef enum
+{
+ NM_DEVICE_STATE_UNKNOWN = 0,
+ NM_DEVICE_STATE_UNMANAGED,
+ NM_DEVICE_STATE_UNAVAILABLE,
+ NM_DEVICE_STATE_DISCONNECTED,
+ NM_DEVICE_STATE_PREPARE,
+ NM_DEVICE_STATE_CONFIG,
+ NM_DEVICE_STATE_NEED_AUTH,
+ NM_DEVICE_STATE_IP_CONFIG,
+ NM_DEVICE_STATE_ACTIVATED,
+ NM_DEVICE_STATE_FAILED
+} NMDeviceState;
+
+typedef enum
+{
+ NM_ACTIVE_CONNECTION_STATE_UNKNOWN = 0,
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATING,
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+} NMActiveConnectionState;
+
+#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager"
+
+#define NM_DBUS_PATH "/org/freedesktop/NetworkManager"
+#define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager"
+#define NM_DBUS_INTERFACE_DEVICE NM_DBUS_INTERFACE ".Device"
+#define NM_DBUS_INTERFACE_DEVICE_WIRED NM_DBUS_INTERFACE_DEVICE ".Wired"
+#define NM_DBUS_INTERFACE_DEVICE_WIRELESS NM_DBUS_INTERFACE_DEVICE ".Wireless"
+#define NM_DBUS_PATH_ACCESS_POINT NM_DBUS_PATH "/AccessPoint"
+#define NM_DBUS_INTERFACE_ACCESS_POINT NM_DBUS_INTERFACE ".AccessPoint"
+
+#define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManagerSettings"
+
+#define NM_DBUS_IFACE_SETTINGS_CONNECTION "org.freedesktop.NetworkManagerSettings.Connection"
+#define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManagerSettings"
+#define NM_DBUS_INTERFACE_ACTIVE_CONNECTION NM_DBUS_INTERFACE ".Connection.Active"
+#define NM_DBUS_INTERFACE_IP4_CONFIG NM_DBUS_INTERFACE ".IP4Config"
+
+#define NM_DBUS_SERVICE_USER_SETTINGS "org.freedesktop.NetworkManagerUserSettings"
+#define NM_DBUS_SERVICE_SYSTEM_SETTINGS "org.freedesktop.NetworkManagerSystemSettings"
+
+#define NM_802_11_AP_FLAGS_NONE 0x00000000
+#define NM_802_11_AP_FLAGS_PRIVACY 0x00000001
+#endif
+
QT_BEGIN_NAMESPACE
typedef QMap< QString, QMap<QString,QVariant> > QNmSettingsMap;
typedef QList<quint32> ServerThing;
-Q_DECLARE_METATYPE(QNmSettingsMap)
-Q_DECLARE_METATYPE(ServerThing)
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QNmSettingsMap))
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ServerThing))
+
+QT_BEGIN_NAMESPACE
class QNetworkManagerInterfacePrivate;
class QNetworkManagerInterface : public QObject
@@ -107,12 +168,10 @@ Q_SIGNALS:
private Q_SLOTS:
private:
-// Q_DISABLE_COPY(QNetworkManagerInterface); ??
QNetworkManagerInterfacePrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; //end QNetworkManagerInterface
+};
-////////
class QNetworkManagerInterfaceAccessPointPrivate;
class QNetworkManagerInterfaceAccessPoint : public QObject
{
@@ -120,7 +179,6 @@ class QNetworkManagerInterfaceAccessPoint : public QObject
public:
- // NM_DEVICE_STATE
enum DeviceState {
Unknown = 0,
Unmanaged,
@@ -181,9 +239,8 @@ private:
QNetworkManagerInterfaceAccessPointPrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; //end QNetworkManagerInterfaceAccessPoint
+};
-////////
class QNetworkManagerInterfaceDevicePrivate;
class QNetworkManagerInterfaceDevice : public QObject
{
@@ -195,7 +252,7 @@ public:
~QNetworkManagerInterfaceDevice();
QString udi() const;
- QNetworkInterface interface() const;
+ QNetworkInterface networkInterface() const;
QDBusInterface *connectionInterface() const;
quint32 ip4Address() const;
quint32 state() const;
@@ -211,9 +268,8 @@ Q_SIGNALS:
private:
QNetworkManagerInterfaceDevicePrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; //end QNetworkManagerInterfaceDevice
+};
-////////
class QNetworkManagerInterfaceDeviceWiredPrivate;
class QNetworkManagerInterfaceDeviceWired : public QObject
{
@@ -236,9 +292,8 @@ Q_SIGNALS:
private:
QNetworkManagerInterfaceDeviceWiredPrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; // end QNetworkManagerInterfaceDeviceWired
+};
-////
class QNetworkManagerInterfaceDeviceWirelessPrivate;
class QNetworkManagerInterfaceDeviceWireless : public QObject
{
@@ -278,9 +333,8 @@ Q_SIGNALS:
private:
QNetworkManagerInterfaceDeviceWirelessPrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; // end QNetworkManagerInterfaceDeviceWireless
+};
-////
class QNetworkManagerSettingsPrivate;
class QNetworkManagerSettings : public QObject
{
@@ -300,9 +354,8 @@ Q_SIGNALS:
void newConnection(QDBusObjectPath);
private:
QNetworkManagerSettingsPrivate *d;
-}; //end QNetworkManagerSettings
+};
-////
class QNetworkManagerSettingsConnectionPrivate;
class QNetworkManagerSettingsConnection : public QObject
{
@@ -315,7 +368,6 @@ public:
QDBusInterface *connectionInterface() const;
QNmSettingsMap getSettings();
- // void update(QNmSettingsMap map);
bool setConnections();
NMDeviceType getType();
bool isAutoConnect();
@@ -335,9 +387,8 @@ Q_SIGNALS:
private:
QNmDBusHelper *nmDBusHelper;
QNetworkManagerSettingsConnectionPrivate *d;
-}; //end QNetworkManagerSettingsConnection
+};
-////
class QNetworkManagerConnectionActivePrivate;
class QNetworkManagerConnectionActive : public QObject
{
@@ -371,9 +422,8 @@ Q_SIGNALS:
private:
QNetworkManagerConnectionActivePrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; //QNetworkManagerConnectionActive
+};
-////
class QNetworkManagerIp4ConfigPrivate;
class QNetworkManagerIp4Config : public QObject
{
@@ -383,14 +433,12 @@ public:
QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0);
~QNetworkManagerIp4Config();
- // QList<quint32> nameservers();
QStringList domains() const;
bool isValid();
private:
QNetworkManagerIp4ConfigPrivate *d;
};
-////
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
index d5e20f3..e195eeb 100644
--- a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
+++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
@@ -43,7 +43,7 @@
#include "qnmdbushelper.h"
-#include <NetworkManager/NetworkManager.h>
+#include "qnetworkmanagerservice.h"
#include <QDBusError>
#include <QDBusInterface>
@@ -54,6 +54,15 @@
QT_BEGIN_NAMESPACE
+QNmDBusHelper::QNmDBusHelper(QObject * parent)
+ : QObject(parent)
+{
+}
+
+QNmDBusHelper::~QNmDBusHelper()
+{
+}
+
void QNmDBusHelper::deviceStateChanged(quint32 state)
{
QDBusMessage msg = this->message();
diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.h b/src/plugins/bearer/networkmanager/qnmdbushelper.h
index 862290c..933d55a 100644
--- a/src/plugins/bearer/networkmanager/qnmdbushelper.h
+++ b/src/plugins/bearer/networkmanager/qnmdbushelper.h
@@ -52,6 +52,8 @@ class QNmDBusHelper: public QObject, protected QDBusContext
{
Q_OBJECT
public:
+ QNmDBusHelper(QObject *parent = 0);
+ ~QNmDBusHelper();
public slots:
void deviceStateChanged(quint32);
diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp
index ff334e5..334eb14 100644
--- a/src/plugins/bearer/nla/qnlaengine.cpp
+++ b/src/plugins/bearer/nla/qnlaengine.cpp
@@ -228,8 +228,11 @@ QNlaThread::~QNlaThread()
if (handle) {
/* cancel completion event */
- if (WSALookupServiceEnd(handle) == SOCKET_ERROR)
- qWarning("WSALookupServiceEnd error %d", WSAGetLastError());
+ if (WSALookupServiceEnd(handle) == SOCKET_ERROR) {
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("WSALookupServiceEnd error %d", WSAGetLastError());
+#endif
+ }
}
mutex.unlock();
@@ -252,8 +255,11 @@ void QNlaThread::forceUpdate()
if (handle) {
/* cancel completion event */
- if (WSALookupServiceEnd(handle) == SOCKET_ERROR)
- qWarning("WSALookupServiceEnd error %d", WSAGetLastError());
+ if (WSALookupServiceEnd(handle) == SOCKET_ERROR) {
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("WSALookupServiceEnd error %d", WSAGetLastError());
+#endif
+ }
handle = 0;
}
mutex.unlock();
@@ -262,10 +268,8 @@ void QNlaThread::forceUpdate()
void QNlaThread::run()
{
WSAEVENT changeEvent = WSACreateEvent();
- if (changeEvent == WSA_INVALID_EVENT) {
- qWarning("WSACreateEvent error %d", WSAGetLastError());
+ if (changeEvent == WSA_INVALID_EVENT)
return;
- }
while (true) {
fetchConfigurations();
@@ -284,10 +288,8 @@ void QNlaThread::run()
int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL, &handle);
mutex.unlock();
- if (result == SOCKET_ERROR) {
- qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError());
+ if (result == SOCKET_ERROR)
break;
- }
WSACOMPLETION completion;
WSAOVERLAPPED overlapped;
@@ -303,11 +305,8 @@ void QNlaThread::run()
result = WSANSPIoctl(handle, SIO_NSP_NOTIFY_CHANGE, 0, 0, 0, 0,
&bytesReturned, &completion);
if (result == SOCKET_ERROR) {
- int error = WSAGetLastError();
- if (error != WSA_IO_PENDING) {
- qWarning("WSANSPIoctl error %d", error);
+ if (WSAGetLastError() != WSA_IO_PENDING)
break;
- }
}
#ifndef Q_OS_WINCE
@@ -325,7 +324,6 @@ void QNlaThread::run()
if (handle) {
result = WSALookupServiceEnd(handle);
if (result == SOCKET_ERROR) {
- qWarning("WSALookupServiceEnd error %d", WSAGetLastError());
mutex.unlock();
break;
}
@@ -360,7 +358,7 @@ DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv
switch (blob->header.type) {
case NLA_RAW_DATA:
#ifdef BEARER_MANAGEMENT_DEBUG
- qWarning("%s: unhandled header type NLA_RAW_DATA", __FUNCTION__);
+ qDebug("%s: unhandled header type NLA_RAW_DATA", __FUNCTION__);
#endif
break;
case NLA_INTERFACE:
@@ -372,7 +370,7 @@ DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv
break;
case NLA_802_1X_LOCATION:
#ifdef BEARER_MANAGEMENT_DEBUG
- qWarning("%s: unhandled header type NLA_802_1X_LOCATION", __FUNCTION__);
+ qDebug("%s: unhandled header type NLA_802_1X_LOCATION", __FUNCTION__);
#endif
break;
case NLA_CONNECTIVITY:
@@ -380,18 +378,15 @@ DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv
cpPriv->internet = true;
else
cpPriv->internet = false;
-#ifdef BEARER_MANAGEMENT_DEBUG
- qWarning("%s: unhandled header type NLA_CONNECTIVITY", __FUNCTION__);
-#endif
break;
case NLA_ICS:
#ifdef BEARER_MANAGEMENT_DEBUG
- qWarning("%s: unhandled header type NLA_ICS", __FUNCTION__);
+ qDebug("%s: unhandled header type NLA_ICS", __FUNCTION__);
#endif
break;
default:
#ifdef BEARER_MANAGEMENT_DEBUG
- qWarning("%s: unhandled header type %d", __FUNCTION__, blob->header.type);
+ qDebug("%s: unhandled header type %d", __FUNCTION__, blob->header.type);
#endif
;
}
@@ -462,7 +457,6 @@ void QNlaThread::fetchConfigurations()
int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL | LUP_DEEP, &hLookup);
if (result == SOCKET_ERROR) {
- qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError());
mutex.lock();
fetchedConfigurations.clear();
mutex.unlock();
@@ -474,18 +468,8 @@ void QNlaThread::fetchConfigurations()
result = WSALookupServiceNext(hLookup, LUP_RETURN_ALL,
&bufferLength, reinterpret_cast<WSAQUERYSET *>(buffer));
- if (result == SOCKET_ERROR) {
- int error = WSAGetLastError();
-
- if (error == WSA_E_NO_MORE)
- break;
-
- if (error == WSAEFAULT)
- break;
-
- qWarning("WSALookupServiceNext error %d", WSAGetLastError());
+ if (result == SOCKET_ERROR)
break;
- }
QNetworkConfigurationPrivate *cpPriv =
parseQuerySet(reinterpret_cast<WSAQUERYSET *>(buffer));
@@ -496,7 +480,9 @@ void QNlaThread::fetchConfigurations()
if (hLookup) {
result = WSALookupServiceEnd(hLookup);
if (result == SOCKET_ERROR) {
- qWarning("WSALookupServiceEnd error %d", WSAGetLastError());
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug("WSALookupServiceEnd error %d", WSAGetLastError());
+#endif
}
}
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index f41fdba..db1759c 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -100,9 +100,6 @@ void QNetworkSessionManagerPrivate::forceSessionClose(const QNetworkConfiguratio
void QNetworkSessionPrivateImpl::syncStateWithInterface()
{
- connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged()));
- connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)),
- this, SLOT(configurationChanged(QNetworkConfiguration)));
connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)),
this, SLOT(forcedSessionClose(QNetworkConfiguration)));
@@ -119,6 +116,10 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
activeConfig = publicConfig;
engine = getEngineFromId(activeConfig.identifier());
if (engine) {
+ qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer");
+ connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
+ this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)),
+ Qt::QueuedConnection);
connect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)),
this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)),
Qt::QueuedConnection);
@@ -147,6 +148,8 @@ void QNetworkSessionPrivateImpl::open()
if ((activeConfig.state() & QNetworkConfiguration::Discovered) !=
QNetworkConfiguration::Discovered) {
lastError =QNetworkSession::InvalidConfigurationError;
+ state = QNetworkSession::Invalid;
+ emit stateChanged(state);
emit QNetworkSessionPrivate::error(lastError);
return;
}
@@ -201,22 +204,18 @@ void QNetworkSessionPrivateImpl::stop()
void QNetworkSessionPrivateImpl::migrate()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
}
void QNetworkSessionPrivateImpl::accept()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
}
void QNetworkSessionPrivateImpl::ignore()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
}
void QNetworkSessionPrivateImpl::reject()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
}
QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const
@@ -231,13 +230,37 @@ QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const
return QNetworkInterface::interfaceFromName(interface);
}
-QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& /*key*/) const
+QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString &key) const
{
+ if (key == QLatin1String("AutoCloseSessionTimeout")) {
+ if (engine && engine->requiresPolling() &&
+ !(engine->capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces)) {
+ if (sessionTimeout >= 0)
+ return sessionTimeout * 10000;
+ else
+ return -1;
+ }
+ }
+
return QVariant();
}
-void QNetworkSessionPrivateImpl::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/)
+void QNetworkSessionPrivateImpl::setSessionProperty(const QString &key, const QVariant &value)
{
+ if (key == QLatin1String("AutoCloseSessionTimeout")) {
+ if (engine && engine->requiresPolling() &&
+ !(engine->capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces)) {
+ int timeout = value.toInt();
+ if (timeout >= 0) {
+ connect(engine, SIGNAL(updateCompleted()),
+ this, SLOT(decrementTimeout()), Qt::UniqueConnection);
+ sessionTimeout = timeout / 10000; // convert to poll intervals
+ } else {
+ disconnect(engine, SIGNAL(updateCompleted()), this, SLOT(decrementTimeout()));
+ sessionTimeout = -1;
+ }
+ }
+ }
}
QString QNetworkSessionPrivateImpl::errorString() const
@@ -362,12 +385,14 @@ void QNetworkSessionPrivateImpl::networkConfigurationsChanged()
startTime = engine->startTime(activeConfig.identifier());
}
-void QNetworkSessionPrivateImpl::configurationChanged(const QNetworkConfiguration &config)
+void QNetworkSessionPrivateImpl::configurationChanged(QNetworkConfigurationPrivatePointer config)
{
- if (serviceConfig.isValid() && (config == serviceConfig || config == activeConfig))
+ if (serviceConfig.isValid() &&
+ (config->id == serviceConfig.identifier() || config->id == activeConfig.identifier())) {
updateStateFromServiceNetwork();
- else if (config == activeConfig)
+ } else if (config->id == activeConfig.identifier()) {
updateStateFromActiveConfig();
+ }
}
void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration &config)
@@ -400,9 +425,17 @@ void QNetworkSessionPrivateImpl::connectionError(const QString &id,
lastError = QNetworkSession::UnknownSessionError;
}
- emit quitPendingWaitsForOpened();
emit QNetworkSessionPrivate::error(lastError);
}
}
+void QNetworkSessionPrivateImpl::decrementTimeout()
+{
+ if (--sessionTimeout <= 0) {
+ disconnect(engine, SIGNAL(updateCompleted()), this, SLOT(decrementTimeout()));
+ sessionTimeout = -1;
+ close();
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h
index 7349e77..c644174 100644
--- a/src/plugins/bearer/qnetworksession_impl.h
+++ b/src/plugins/bearer/qnetworksession_impl.h
@@ -69,7 +69,7 @@ class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate
Q_OBJECT
public:
QNetworkSessionPrivateImpl()
- : startTime(0)
+ : startTime(0), sessionTimeout(-1)
{
}
@@ -108,13 +108,12 @@ private:
private Q_SLOTS:
void networkConfigurationsChanged();
- void configurationChanged(const QNetworkConfiguration &config);
+ void configurationChanged(QNetworkConfigurationPrivatePointer config);
void forcedSessionClose(const QNetworkConfiguration &config);
void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error);
+ void decrementTimeout();
private:
- QNetworkConfigurationManager manager;
-
bool opened;
QBearerEngineImpl *engine;
@@ -122,6 +121,8 @@ private:
QNetworkSession::SessionError lastError;
quint64 startTime;
+
+ int sessionTimeout;
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 9af1fe9..bec562d 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -141,7 +141,10 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
if (state != QNetworkSession::Connected) {
// There were no open connections to used IAP or SNAP
- if ((privateConfiguration(publicConfig)->state & QNetworkConfiguration::Discovered) ==
+ if (iError == QNetworkSession::InvalidConfigurationError) {
+ newState(QNetworkSession::Invalid);
+ }
+ else if ((privateConfiguration(publicConfig)->state & QNetworkConfiguration::Discovered) ==
QNetworkConfiguration::Discovered) {
newState(QNetworkSession::Disconnected);
} else {
@@ -231,13 +234,23 @@ QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const
void QNetworkSessionPrivateImpl::open()
{
- if (isOpen || !privateConfiguration(publicConfig) || (state == QNetworkSession::Connecting)) {
+ if (isOpen || (state == QNetworkSession::Connecting)) {
return;
}
// Cancel notifications from RConnectionMonitor
// => 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) {
+ newState(QNetworkSession::Invalid);
+ iError = QNetworkSession::InvalidConfigurationError;
+ emit QNetworkSessionPrivate::error(iError);
+ syncStateWithInterface();
+ return;
+ }
TInt error = iSocketServ.Connect();
if (error != KErrNone) {
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index b3c9cb3..88a563c 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -98,7 +98,7 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const
}
SymbianEngine::SymbianEngine(QObject *parent)
-: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true)
+: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true)
{
CActiveScheduler::Add(this);
@@ -136,9 +136,12 @@ 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;
}
SymbianEngine::~SymbianEngine()
@@ -153,7 +156,14 @@ SymbianEngine::~SymbianEngine()
#endif
delete ipAccessPointsAvailabilityScanner;
+
+ // CCommsDatabase destructor uses cleanup stack. Since QNetworkConfigurationManager
+ // is a global static, but the time we are here, E32Main() has been exited already and
+ // the thread's default cleanup stack has been deleted. Without this line, a
+ // 'E32USER-CBase 69' -panic will occur.
+ CTrapCleanup* cleanup = CTrapCleanup::New();
delete ipCommsDB;
+ delete cleanup;
}
bool SymbianEngine::hasIdentifier(const QString &id)
@@ -692,9 +702,10 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
updateStatesToSnaps();
- startCommsDatabaseNotifications();
-
- emit updateCompleted();
+ if (!iFirstUpdate) {
+ startCommsDatabaseNotifications();
+ emit updateCompleted();
+ }
}
void SymbianEngine::updateStatesToSnaps()
@@ -987,11 +998,22 @@ void AccessPointsAvailabilityScanner::DoCancel()
void AccessPointsAvailabilityScanner::StartScanning()
{
- iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus);
- if (!IsActive()) {
- SetActive();
+ if (iOwner.iFirstUpdate) {
+ // On first update (the mgr is being instantiated) update only those bearers who
+ // don't need time-consuming scans (WLAN).
+ // Note: EBearerIdWCDMA covers also GPRS bearer
+ iConnectionMonitor.GetPckgAttribute(EBearerIdWCDMA, 0, KIapAvailability, iIapBuf, iStatus);
+ User::WaitForRequest(iStatus);
+ if (iStatus.Int() == KErrNone) {
+ iOwner.accessPointScanningReady(true,iIapBuf());
+ }
+ } else {
+ iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus);
+ if (!IsActive()) {
+ SetActive();
+ }
}
-}
+}
void AccessPointsAvailabilityScanner::RunL()
{
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index 5448813..ee6d070 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -162,6 +162,7 @@ private: // MConnectionMonitorObserver
void EventL(const CConnMonEventBase& aEvent);
private: // Data
+ bool iFirstUpdate;
CCommsDatabase* ipCommsDB;
RConnectionMonitor iConnectionMonitor;