Ticket #40852: patch-src_plugins_bearer_corewlan_qcorewlanengine.mm.diff
File patch-src_plugins_bearer_corewlan_qcorewlanengine.mm.diff, 5.5 KB (added by BSeppke (Benjamin Seppke), 11 years ago) |
---|
-
src/plugins/bearer/corewlan/qcorewlanengine.mm
old new 52 52 #include <QtCore/qdebug.h> 53 53 54 54 #include <QDir> 55 56 #ifdef MAC_SDK_10_7 57 #include <CoreWLAN/CoreWLANConstants.h> 58 #include <CoreWLAN/CoreWLANTypes.h> 59 #endif 55 60 #include <CoreWLAN/CoreWLAN.h> 56 61 #include <CoreWLAN/CWInterface.h> 57 62 #include <CoreWLAN/CWNetwork.h> … … 101 106 NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; 102 107 notificationCenter = [NSNotificationCenter defaultCenter]; 103 108 currentInterface = [CWInterface interfaceWithName:nil]; 104 [notificationCenter addObserver:self selector:@selector(notificationHandler:) name: kCWPowerDidChangeNotification object:nil];109 [notificationCenter addObserver:self selector:@selector(notificationHandler:) name:CWPowerDidChangeNotification object:nil]; 105 110 [locker unlock]; 106 111 [autoreleasepool release]; 107 112 return self; … … 175 180 176 181 if([currentInterface power]) { 177 182 NSError *err = nil; 178 NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys: 179 [NSNumber numberWithBool:YES], kCWScanKeyMerge, 180 [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType, 181 [NSNumber numberWithInteger:100], kCWScanKeyRestTime, nil]; 182 183 NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err]; 184 CWNetwork *apNetwork; 185 183 184 NSSet* apArray = [currentInterface scanForNetworksWithSSID:nil error:&err]; 185 186 186 if (!err) { 187 187 188 for(uint row=0; row < [apArray count]; row++ ) { 189 apNetwork = [apArray objectAtIndex:row]; 188 for(CWNetwork *apNetwork in apArray) { 190 189 191 190 const QString networkSsid = qt_NSStringToQString([apNetwork ssid]); 192 191 const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); … … 194 193 195 194 QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; 196 195 bool known = isKnownSsid(networkSsid); 197 if( [currentInterface .interfaceState intValue] == kCWInterfaceStateRunning){196 if( [currentInterface serviceActive] ) { 198 197 if( networkSsid == qt_NSStringToQString( [currentInterface ssid])) { 199 198 state = QNetworkConfiguration::Active; 200 199 } … … 207 206 } 208 207 } 209 208 QNetworkConfiguration::Purpose purpose = QNetworkConfiguration::UnknownPurpose; 210 if([[apNetwork s ecurityMode] intValue] == kCWSecurityModeOpen) {209 if([[apNetwork supportsSecurity] intValue] == kCWSecurityNone) { 211 210 purpose = QNetworkConfiguration::PublicPurpose; 212 211 } else { 213 212 purpose = QNetworkConfiguration::PrivatePurpose; … … 237 236 interfaceName = ij.value(); 238 237 } 239 238 240 if( [currentInterface .interfaceState intValue] == kCWInterfaceStateRunning) {239 if( [currentInterface serviceActive] ) { 241 240 if( networkSsid == qt_NSStringToQString([currentInterface ssid])) { 242 241 state = QNetworkConfiguration::Active; 243 242 } … … 508 507 else 509 508 wantedSsid = thisName; 510 509 511 [params setValue: [array objectAtIndex:i] forKey:kCWAssocKey8021XProfile];510 //[params setValue: [array objectAtIndex:i] forKey:kCWAssocKey8021XProfile]; 512 511 using8021X = true; 513 512 break; 514 513 } … … 528 527 } 529 528 } 530 529 } 531 NSDictionary *scanParameters = [NSDictionary dictionaryWithObjectsAndKeys: 532 [NSNumber numberWithBool:YES], kCWScanKeyMerge, 533 [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType, 534 [NSNumber numberWithInteger:100], kCWScanKeyRestTime, 535 qt_QStringToNSString(wantedSsid), kCWScanKeySSID, 536 nil]; 537 538 NSArray *scanArray = [wifiInterface scanForNetworksWithParameters:scanParameters error:&err]; 530 531 NSSet *scanArray = [wifiInterface scanForNetworksWithSSID:nil error:&err]; 539 532 540 533 if(!err) { 541 for(uint row=0; row < [scanArray count]; row++ ) { 542 CWNetwork *apNetwork = [scanArray objectAtIndex:row]; 534 for(CWNetwork *apNetwork in scanArray) { 543 535 544 536 if(wantedSsid == qt_NSStringToQString([apNetwork ssid])) { 545 537 … … 595 587 } else { 596 588 qDebug() << "SecKeychainSearchCopyNext error"; 597 589 } 598 [params setValue: password forKey: kCWAssocKeyPassphrase];590 //[params setValue: password forKey: kCWAssocKeyPassphrase]; 599 591 } // end using8021X 600 592 601 593 … … 634 626 [CWInterface interfaceWithName: qt_QStringToNSString(interfaceString)]; 635 627 636 628 [wifiInterface disassociate]; 637 if ( [[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive){629 if ( [wifiInterface serviceActive] ){ 638 630 locker.unlock(); 639 631 emit connectionError(id, DisconnectionError); 640 632 locker.relock();