-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 37 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 1 |
2 files changed, 30 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 8c2c315..0bfc8e9 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -31,13 +31,13 @@ using namespace Opie; // Qt #include <qpushbutton.h> #include <qmessagebox.h> #include <qcombobox.h> #include <qspinbox.h> -#include <qsocketnotifier.h> +#include <qmainwindow.h> // Standard #include <assert.h> #include <errno.h> #include <unistd.h> @@ -92,25 +92,48 @@ Wellenreiter::Wellenreiter( QWidget* parent ) netview->setManufacturerDB( manufacturerdb ); pcap = new OPacketCapturer(); } + Wellenreiter::~Wellenreiter() { // no need to delete child widgets, Qt does it all for us delete manufacturerdb; delete pcap; } + void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) { configwindow = cw; } + +void Wellenreiter::channelHopped(int c) +{ + QString title = "Wellenreiter II -scan- ["; + QString left; + if ( c > 1 ) left.fill( '.', c-1 ); + title.append( left ); + title.append( '|' ); + if ( c < iface->channels() ) + { + QString right; + right.fill( '.', iface->channels()-c ); + title.append( right ); + } + title.append( "]" ); + //title.append( QString().sprintf( " %02d", c ) ); + assert( parent() ); + ( (QMainWindow*) parent() )->setCaption( title ); +} + + void Wellenreiter::receivePacket(OPacket* p) { hexWindow()->log( p->dump( 8 ) ); // check if we received a beacon frame OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); @@ -183,26 +206,26 @@ void Wellenreiter::receivePacket(OPacket* p) else { qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", (const char*) wlan->macAddress2().toString(true), (const char*) wlan->macAddress1().toString(true), (const char*) wlan->macAddress3().toString(true) ); - netView()->traffic( "fromDS", wlan->macAddress2().toString(), + netView()->traffic( "IBSS", wlan->macAddress2().toString(), wlan->macAddress1().toString(), wlan->macAddress3().toString() ); } return; } } void Wellenreiter::startStopClicked() { if ( sniffing ) { disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); - + disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); iface->setChannelHopping(); // stop hopping channels pcap->close(); sniffing = false; #ifdef QWS oApp->setTitle(); #else @@ -218,12 +241,14 @@ void Wellenreiter::startStopClicked() iface->setMonitorMode( false ); // switch off promisc flag iface->setPromiscuousMode( false ); system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess logwindow->log( "(i) Stopped Scanning." ); + assert( parent() ); + ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); // message the user QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); } else @@ -278,17 +303,13 @@ void Wellenreiter::startStopClicked() // start channel hopper iface->setChannelHopping( 1000 ); //use interval from config window // connect connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); + connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); logwindow->log( "(i) Started Scanning." ); - #ifdef QWS - oApp->setTitle( "Scanning ..." ); - #else - qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." ); - #endif sniffing = true; } } diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index ff73dd4..85f889b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -45,12 +45,13 @@ class Wellenreiter : public WellenreiterBase { MScanListView* netView() const { return netview; }; MLogWindow* logWindow() const { return logwindow; }; MHexWindow* hexWindow() const { return hexwindow; }; bool isDaemonRunning() const { return sniffing; }; public slots: + void channelHopped(int); void receivePacket(OPacket*); void startStopClicked(); private: #ifdef QWS OSystem _system; // Opie Operating System identifier |