summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/corewlan
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-03-24 03:45:52 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-03-24 03:45:52 (GMT)
commit06188c60bfd530a5f1d6ef954a45d31bccb2e987 (patch)
treeb4b4ee53d52ab0d82dfebc759801384f22863832 /src/plugins/bearer/corewlan
parent63d9c7d545489ba34c8c34d91ff06a682127acb2 (diff)
downloadQt-06188c60bfd530a5f1d6ef954a45d31bccb2e987.zip
Qt-06188c60bfd530a5f1d6ef954a45d31bccb2e987.tar.gz
Qt-06188c60bfd530a5f1d6ef954a45d31bccb2e987.tar.bz2
Bearer management changes from Qt Mobility (6fb31d1e).
6fb31d1e287d7def45c115eb56bcb9b0c5cb3c40.
Diffstat (limited to 'src/plugins/bearer/corewlan')
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h3
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm21
2 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 76574a8..ece2c60 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -95,11 +95,10 @@ private:
SCDynamicStoreRef storeSession;
CFRunLoopSourceRef runloopSource;
-
bool hasWifi;
protected:
- QMap<QString, QMap<QString,QString> > userProfiles;
+ QMap<QString, QMap<QString,QString> > userProfiles;
void startNetworkChangeLoop();
void getUserConfigurations();
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 5a13de9..e3778f1 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -50,11 +50,13 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
+
#include <QDir>
#include <CoreWLAN/CoreWLAN.h>
#include <CoreWLAN/CWInterface.h>
#include <CoreWLAN/CWNetwork.h>
#include <CoreWLAN/CWNetwork.h>
+#include <CoreWLAN/CW8021XProfile.h>
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSKeyValueObserving.h>
@@ -194,14 +196,14 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSString *wantedSsid = 0;
bool okToProceed = true;
+
if(getNetworkNameFromSsid(id) != id) {
NSArray *array = [CW8021XProfile allUser8021XProfiles];
for (NSUInteger i=0; i<[array count]; ++i) {
const QString idCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] userDefinedName])));
const QString idCheck2 = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid])));
- if(id == idCheck
- || id == idCheck2) {
+ if (id == idCheck || id == idCheck2) {
QString thisName = getSsidFromNetworkName(id);
if(thisName.isEmpty()) {
wantedSsid = qt_mac_QStringToNSString(id);
@@ -263,6 +265,8 @@ void QCoreWlanEngine::connectToId(const QString &id)
emit connectionError(id, InterfaceLookupError);
locker.relock();
}
+
+ locker.unlock();
emit connectionError(id, OperationNotSupported);
}
@@ -415,7 +419,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
if (!err) {
for(uint row=0; row < [apArray count]; row++ ) {
-
apNetwork = [apArray objectAtIndex:row];
const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
@@ -501,6 +504,7 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
while (i.hasNext()) {
i.next();
QString networkName = i.key();
+
if(!addedConfigs.contains(networkName)) {
QString interfaceName;
QMapIterator<QString, QString> ij(i.value());
@@ -688,7 +692,6 @@ QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
while (i.hasNext()) {
i.next();
-
QMap<QString,QString> map = i.value();
QMapIterator<QString, QString> ij(i.value());
while (ij.hasNext()) {
@@ -697,7 +700,7 @@ QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
if(name == i.key() || name == idCheck) {
return ij.key();
}
- }
+ }
}
return QString();
}
@@ -731,10 +734,10 @@ void QCoreWlanEngine::getUserConfigurations()
for(uint row=0; row < [wifiInterfaces count]; row++ ) {
CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
-
+ NSString *nsInterfaceName = [wifiInterface name];
// add user configured system networks
SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
- NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", [wifiInterface name]]);
+ NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]);
CFRelease(dynRef);
NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
@@ -744,7 +747,7 @@ void QCoreWlanEngine::getUserConfigurations()
QString thisSsid = qt_mac_NSStringToQString(ssidkey);
if(!userProfiles.contains(thisSsid)) {
QMap <QString,QString> map;
- map.insert(thisSsid, qt_mac_NSStringToQString([wifiInterface name]));
+ map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
userProfiles.insert(thisSsid, map);
}
}
@@ -778,7 +781,7 @@ void QCoreWlanEngine::getUserConfigurations()
if(!userProfiles.contains(networkName)
&& !ssid.isEmpty()) {
QMap<QString,QString> map;
- map.insert(ssid, qt_mac_NSStringToQString([wifiInterface name]));
+ map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
userProfiles.insert(networkName, map);
}
}