summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-04-21 10:21:18 (UTC)
committer mickeyl <mickeyl>2005-04-21 10:21:18 (UTC)
commit945c98bd21a59f18a3ac0cdf330153163861731a (patch) (unidiff)
treee868fa29ae20923a8567d3e5c2af429e1e8cf937
parenta5044439757037640435a5800584d408a58c1bba (diff)
downloadopie-945c98bd21a59f18a3ac0cdf330153163861731a.zip
opie-945c98bd21a59f18a3ac0cdf330153163861731a.tar.gz
opie-945c98bd21a59f18a3ac0cdf330153163861731a.tar.bz2
disable "Rescan Neighbourhood" while scanning
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/wlan.pro2
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp6
2 files changed, 5 insertions, 3 deletions
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro
index e975dde..eb9dd4f 100644
--- a/noncore/settings/networksettings/wlan/wlan.pro
+++ b/noncore/settings/networksettings/wlan/wlan.pro
@@ -1,32 +1,32 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on 2CONFIG += qt plugin warn_on
3DESTDIR = $(OPIEDIR)/plugins/networksettings 3DESTDIR = $(OPIEDIR)/plugins/networksettings
4 HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h 4 HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h
5 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp 5 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 6 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
7 DEPENDPATH+= $(OPIEDIR)/include 7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe -L../interfaces/ -linterfaces -lopiecore2 -lopienet2 8LIBS += -lqpe -L../interfaces/ -linterfaces -lopiecore2 -lopienet2
9 INTERFACES= wlan.ui info.ui 9 INTERFACES= wlan.ui info.ui
10 TARGET = wlan 10 TARGET = wlan
11 VERSION = 1.0.0 11 VERSION = 1.0.1
12 12
13#CONFIG += wirelessopts 13#CONFIG += wirelessopts
14 14
15wirelessopts { 15wirelessopts {
16 HEADERS+= wlanimp.h 16 HEADERS+= wlanimp.h
17 SOURCES+= wlanimp.cpp 17 SOURCES+= wlanimp.cpp
18} 18}
19 19
20! wirelessopts { 20! wirelessopts {
21 HEADERS+= wlanimp2.h 21 HEADERS+= wlanimp2.h
22 SOURCES += wlanimp2.cpp 22 SOURCES += wlanimp2.cpp
23} 23}
24 24
25include( $(OPIEDIR)/include.pro ) 25include( $(OPIEDIR)/include.pro )
26 26
27!isEmpty( LIBPCAP_INC_DIR ) { 27!isEmpty( LIBPCAP_INC_DIR ) {
28 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH 28 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH
29} 29}
30!isEmpty( LIBPCAP_LIB_DIR ) { 30!isEmpty( LIBPCAP_LIB_DIR ) {
31 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS 31 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS
32} 32}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index 5cb78cf..11dfe74 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -349,97 +349,99 @@ void WLANImp::rescanNeighbourhood()
349 else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); 349 else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) );
350 else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); 350 else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) );
351 else 351 else
352 { 352 {
353 odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl; 353 odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl;
354 return; 354 return;
355 } 355 }
356 356
357 wiface->setMode( "monitor" ); 357 wiface->setMode( "monitor" );
358 if ( wiface->mode() != "monitor" ) 358 if ( wiface->mode() != "monitor" )
359 { 359 {
360 owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl; 360 owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl;
361 return; 361 return;
362 } 362 }
363 363
364 // open a packet capturer 364 // open a packet capturer
365 OPacketCapturer* cap = new OPacketCapturer(); 365 OPacketCapturer* cap = new OPacketCapturer();
366 cap->open( name ); 366 cap->open( name );
367 if ( !cap->isOpen() ) 367 if ( !cap->isOpen() )
368 { 368 {
369 owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl; 369 owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl;
370 return; 370 return;
371 } 371 }
372 372
373 // display splash screen 373 // disable button and display splash screen
374 rescanButton->setEnabled( false );
374 QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); 375 QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize );
375 splash->setLineWidth( 2 ); 376 splash->setLineWidth( 2 );
376 splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); 377 splash->setFrameStyle( QFrame::Panel | QFrame::Raised );
377 QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); 378 QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 );
378 QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); 379 QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash );
379 QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); 380 QProgressBar* pb = new QProgressBar( wiface->channels(), splash );
380 vbox->addWidget( lab ); 381 vbox->addWidget( lab );
381 vbox->addWidget( pb ); 382 vbox->addWidget( pb );
382 pb->setCenterIndicator( true ); 383 pb->setCenterIndicator( true );
383 pb->setFixedHeight( pb->sizeHint().height() ); 384 pb->setFixedHeight( pb->sizeHint().height() );
384 QWidget* widgetDesktop = qApp->desktop(); 385 QWidget* widgetDesktop = qApp->desktop();
385 int dw = widgetDesktop->width(); 386 int dw = widgetDesktop->width();
386 int dh = widgetDesktop->height(); 387 int dh = widgetDesktop->height();
387 int pw = vbox->sizeHint().width(); 388 int pw = vbox->sizeHint().width();
388 int ph = vbox->sizeHint().height(); 389 int ph = vbox->sizeHint().height();
389 splash->setGeometry((dw-pw)/2,(dh-ph)/2,pw,ph); 390 splash->setGeometry((dw-pw)/2,(dh-ph)/2,pw,ph);
390 splash->show(); 391 splash->show();
391 splash->raise(); 392 splash->raise();
392 qApp->processEvents(); 393 qApp->processEvents();
393 394
394 // set capturer to non-blocking mode 395 // set capturer to non-blocking mode
395 cap->setBlocking( false ); 396 cap->setBlocking( false );
396 397
397 for ( int i = 1; i <= wiface->channels(); ++i ) 398 for ( int i = 1; i <= wiface->channels(); ++i )
398 { 399 {
399 wiface->setChannel( i ); 400 wiface->setChannel( i );
400 pb->setProgress( i ); 401 pb->setProgress( i );
401 qApp->processEvents(); 402 qApp->processEvents();
402 odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl; 403 odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl;
403 OPacket* p = cap->next( 1000 ); 404 OPacket* p = cap->next( 1000 );
404 if ( !p ) 405 if ( !p )
405 { 406 {
406 odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl; 407 odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl;
407 } 408 }
408 else 409 else
409 { 410 {
410 odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl; 411 odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl;
411 handlePacket( p ); 412 handlePacket( p );
412 } 413 }
413 } 414 }
414 415
415 cap->close(); 416 cap->close();
416 wiface->setMode( "managed" ); // TODO: use previous mode 417 wiface->setMode( "managed" ); // TODO: use previous mode
417 wiface->setPromiscuousMode( false ); 418 wiface->setPromiscuousMode( false );
418 419
420 // hide splash screen and reenable button
419 splash->hide(); 421 splash->hide();
420 delete splash; 422 delete splash;
421 423 rescanButton->setEnabled( true );
422} 424}
423 425
424void WLANImp::handlePacket( OPacket* p ) 426void WLANImp::handlePacket( OPacket* p )
425{ 427{
426 428
427 // check if we received a beacon frame 429 // check if we received a beacon frame
428 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 430 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
429 if ( beacon && beacon->managementType() == "Beacon" ) 431 if ( beacon && beacon->managementType() == "Beacon" )
430 { 432 {
431 433
432 QString type; 434 QString type;
433 if ( beacon->canIBSS() ) 435 if ( beacon->canIBSS() )
434 { 436 {
435 type = "adhoc"; 437 type = "adhoc";
436 } 438 }
437 else if ( beacon->canESS() ) 439 else if ( beacon->canESS() )
438 { 440 {
439 type = "managed"; 441 type = "managed";
440 } 442 }
441 else 443 else
442 { 444 {
443 owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl; 445 owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl;
444 return; 446 return;
445 } 447 }