summaryrefslogtreecommitdiff
path: root/noncore
authormickeyl <mickeyl>2003-06-16 17:23:39 (UTC)
committer mickeyl <mickeyl>2003-06-16 17:23:39 (UTC)
commit9574bc74f6240a060f941ef65028a51e8969fe06 (patch) (side-by-side diff)
treed2f64e32e1c520f5d15769a364805c70bdd32d75 /noncore
parent020c6d76b3faad399164ba196c51804221a259e1 (diff)
downloadopie-9574bc74f6240a060f941ef65028a51e8969fe06.zip
opie-9574bc74f6240a060f941ef65028a51e8969fe06.tar.gz
opie-9574bc74f6240a060f941ef65028a51e8969fe06.tar.bz2
sanity check and providing the interface for the qcop call
tille: we no longer match the qcop-signature - is this a problem?
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 448b52b..79734a2 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -400,114 +400,123 @@ void Wellenreiter::startClicked()
{
pcap->open( interface );
if ( configwindow->writeCaptureFile->isOn() )
{
QString dumpname( configwindow->captureFileName->text() );
dumpname.append( '-' );
dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
dumpname.append( ".wellenreiter" );
pcap->openDumpFile( dumpname );
}
else
{
pcap->open( interface );
}
}
else
{
pcap->open( QFile( interface ) );
}
if ( !pcap->isOpen() )
{
QMessageBox::warning( this, "Wellenreiter II",
tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) ));
return;
}
// set capturer to non-blocking mode
pcap->setBlocking( false );
// start channel hopper
if ( cardtype != DEVTYPE_FILE )
iface->setChannelHopping( 1000 ); //use interval from config window
if ( cardtype != DEVTYPE_FILE )
{
// connect socket notifier and start channel hopper
connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
}
else
{
// start timer for reading packets
startTimer( 100 );
}
logwindow->log( "(i) Started Scanning." );
sniffing = true;
emit( startedSniffing() );
if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
else
{
assert( parent() );
( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
}
}
void Wellenreiter::timerEvent( QTimerEvent* )
{
qDebug( "Wellenreiter::timerEvent()" );
OPacket* p = pcap->next();
if ( !p ) // no more packets available
{
stopClicked();
}
else
{
receivePacket( p );
delete p;
}
}
void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p )
{
if ( action == "TouchSound" )
ODevice::inst()->touchSound();
else if ( action == "AlarmSound" )
ODevice::inst()->alarmSound();
else if ( action == "KeySound" )
ODevice::inst()->keySound();
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().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
else if ( action == "MessageBox" )
QMessageBox::information ( this, "Notification!",
QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
}
void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
{
- // we need the interface too:
- const QString iface = "wlan0";
- qDebug( "joinNetwork() - %s, %s, %d, %s",
+ 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;
+ }
+
+ qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s",
+ (const char*) iface->name(),
(const char*) type,
(const char*) essid,
channel,
(const char*) macaddr );
- // TODO: Stop scanning here
-
QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
- msg << iface << QString("Mode") << type;
- msg << iface << QString("ESSID") << essid;
- msg << iface << QString("Channel") << channel;
- msg << iface << QString("MacAddr") << macaddr;
+ msg << iface->name() << QString("Mode") << type;
+ msg << iface->name() << QString("ESSID") << essid;
+ msg << iface->name() << QString("Channel") << channel;
+ msg << iface->name() << QString("MacAddr") << macaddr;
}