Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 0bfc8e9..3372883 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -35,4 +35,5 @@ using namespace Opie; #include <qcombobox.h> #include <qspinbox.h> +#include <qtoolbutton.h> #include <qmainwindow.h> @@ -53,5 +54,5 @@ using namespace Opie; #include "hexwindow.h" #include "configwindow.h" - +#include "statwindow.h" #include "manufacturers.h" @@ -218,7 +219,6 @@ void Wellenreiter::receivePacket(OPacket* p) } -void Wellenreiter::startStopClicked() -{ - if ( sniffing ) + +void Wellenreiter::stopClicked() { disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); @@ -250,7 +250,30 @@ void Wellenreiter::startStopClicked() // message the user QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); + + sniffing = false; + emit( stoppedSniffing() ); + + // print out statistics + statwindow->log( "-----------------------------------------" ); + statwindow->log( "- Wellenreiter II Capturing Statistic -" ); + statwindow->log( "-----------------------------------------" ); + statwindow->log( "Packet Type | Receive Count" ); + + for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) + { + QString left; + left.sprintf( "%s", (const char*) it.key() ); + left = left.leftJustify( 20 ); + left.append( '|' ); + QString right; + right.sprintf( "%d", it.data() ); + right = right.rightJustify( 7 ); + statwindow->log( left + right ); } - else +} + + +void Wellenreiter::startClicked() { // get configuration from config window @@ -279,7 +302,9 @@ void Wellenreiter::startStopClicked() case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; - default: assert( 0 ); // shouldn't happen + default: + QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); } + if ( cardtype > 0 && cardtype < 5 ) iface->setMonitorMode( true ); @@ -311,5 +336,4 @@ void Wellenreiter::startStopClicked() logwindow->log( "(i) Started Scanning." ); sniffing = true; - - } + emit( startedSniffing() ); } |