Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 8cabf0d..c4e6f02 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -37,98 +37,96 @@ /* QT */ #include <qcheckbox.h> #include <qcombobox.h> #include <qdatetime.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qmessagebox.h> #include <qobjectlist.h> #include <qregexp.h> #include <qspinbox.h> #include <qtimer.h> #include <qtoolbutton.h> #include <qmainwindow.h> /* STD */ #include <assert.h> #include <errno.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <stdlib.h> #include <signal.h> using namespace Opie::Core; using namespace Opie::Net; using namespace Opie::Ui; Wellenreiter* Wellenreiter::instance = 0; Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), sniffing( false ), iface( 0 ), configwindow( 0 ) { logwindow->log( "(i) Wellenreiter has been started." ); // // detect operating system // #ifdef QWS QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() ); _system = ODevice::inst()->system(); logwindow->log( sys ); #endif netview->setColumnWidthMode( 1, QListView::Manual ); - connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), - this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); pcap = new OPacketCapturer(); pcap->setAutoDelete( false ); gps = new GPS( this ); QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); registerSignalHandler(); } Wellenreiter::~Wellenreiter() { delete pcap; //unregisterSignalHandler(); } void Wellenreiter::initialTimer() { odebug << "preloading manufacturer database..." << oendl; OManufacturerDB::instance(); } void Wellenreiter::signalHandler( int sig ) { Q_UNUSED( sig ) oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; if ( Wellenreiter::instance->sniffing ) { Wellenreiter::instance->pcap->closeDumpFile(); Wellenreiter::instance->pcap->close(); Wellenreiter::instance->stopClicked(); } oerr << "Phew. Seemed to work." << oendl; ::exit( -1 ); } void Wellenreiter::registerSignalHandler() { Wellenreiter::instance = this; struct sigaction action; action.sa_handler = Wellenreiter::signalHandler; if (sigemptyset(&action.sa_mask)) oerr << "sigemptyset() failure:" << strerror( errno ) << oendl; @@ -683,97 +681,60 @@ void Wellenreiter::startClicked() { assert( parent() ); ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); } } void Wellenreiter::timerEvent( QTimerEvent* ) { odebug << "Wellenreiter::timerEvent()" << oendl; OPacket* p = pcap->next(); if ( !p ) // no more packets available { stopClicked(); } else { receivePacket( p ); // We no longer delete packets here. Ownership of the packets is // transferred to the PacketView. //delete p; } } void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) { #ifdef QWS if ( action == "TouchSound" ) ODevice::inst()->playTouchSound(); else if ( action == "AlarmSound" ) ODevice::inst()->playAlarmSound(); else if ( action == "KeySound" ) ODevice::inst()->playKeySound(); else if ( action == "LedOn" ) ODevice::inst()->setLedState( Led_Mail, Led_On ); else if ( action == "LedOff" ) ODevice::inst()->setLedState( Led_Mail, Led_Off ); else if ( action == "LogMessage" ) logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); else if ( action == "MessageBox" ) QMessageBox::information( this, "Notification!", QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); #else #warning Actions do not work with Qt/X11 yet #endif } -void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) -{ - #ifdef QWS - if ( !iface ) - { - QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); - return; - } - - if ( sniffing ) - { - QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); - return; - } - - odebug << "joinNetwork() with Interface " << iface->name() - << ": " << type << ", " << essid - << ", " << channel << ", " << macaddr << oendl; - - QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); - int count = 3; - odebug << "sending " << count << " messages" << oendl; - msg << QString("count") << QString::number(count); - odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; - msg << QString(iface->name()) << QString("Mode") << type; - odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; - msg << QString(iface->name()) << QString("ESSID") << essid; - odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; - msg << QString(iface->name()) << QString("Channel") << channel; -// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; -// msg << QString(iface->name()) << QString("MacAddr") << macaddr; - #else - QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); - #endif - -} - void Wellenreiter::updateStatistics() { // print out statistics for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) statwindow->updateCounter( it.key(), it.data() ); } void Wellenreiter::slotTabChanged( QWidget* wid ) { if ( wid == statwindow ) updateStatistics(); } |