summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index dcf796f..96733ff 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -429,102 +429,109 @@ void Wellenreiter::startClicked()
429 pcap->setBlocking( false ); 429 pcap->setBlocking( false );
430 430
431 // start channel hopper 431 // start channel hopper
432 if ( cardtype != DEVTYPE_FILE ) 432 if ( cardtype != DEVTYPE_FILE )
433 iface->setChannelHopping( 1000 ); //use interval from config window 433 iface->setChannelHopping( 1000 ); //use interval from config window
434 434
435 if ( cardtype != DEVTYPE_FILE ) 435 if ( cardtype != DEVTYPE_FILE )
436 { 436 {
437 // connect socket notifier and start channel hopper 437 // connect socket notifier and start channel hopper
438 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 438 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
439 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 439 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
440 } 440 }
441 else 441 else
442 { 442 {
443 // start timer for reading packets 443 // start timer for reading packets
444 startTimer( 100 ); 444 startTimer( 100 );
445 } 445 }
446 446
447 logwindow->log( "(i) Started Scanning." ); 447 logwindow->log( "(i) Started Scanning." );
448 sniffing = true; 448 sniffing = true;
449 emit( startedSniffing() ); 449 emit( startedSniffing() );
450 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title 450 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
451 else 451 else
452 { 452 {
453 assert( parent() ); 453 assert( parent() );
454 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); 454 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
455 } 455 }
456} 456}
457 457
458 458
459void Wellenreiter::timerEvent( QTimerEvent* ) 459void Wellenreiter::timerEvent( QTimerEvent* )
460{ 460{
461 qDebug( "Wellenreiter::timerEvent()" ); 461 qDebug( "Wellenreiter::timerEvent()" );
462 OPacket* p = pcap->next(); 462 OPacket* p = pcap->next();
463 if ( !p ) // no more packets available 463 if ( !p ) // no more packets available
464 { 464 {
465 stopClicked(); 465 stopClicked();
466 } 466 }
467 else 467 else
468 { 468 {
469 receivePacket( p ); 469 receivePacket( p );
470 delete p; 470 delete p;
471 } 471 }
472} 472}
473 473
474 474
475void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) 475void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p )
476{ 476{
477 #ifdef QWS
477 if ( action == "TouchSound" ) 478 if ( action == "TouchSound" )
478 ODevice::inst()->touchSound(); 479 ODevice::inst()->touchSound();
479 else if ( action == "AlarmSound" ) 480 else if ( action == "AlarmSound" )
480 ODevice::inst()->alarmSound(); 481 ODevice::inst()->alarmSound();
481 else if ( action == "KeySound" ) 482 else if ( action == "KeySound" )
482 ODevice::inst()->keySound(); 483 ODevice::inst()->keySound();
483 else if ( action == "LedOn" ) 484 else if ( action == "LedOn" )
484 ODevice::inst()->setLedState( Led_Mail, Led_On ); 485 ODevice::inst()->setLedState( Led_Mail, Led_On );
485 else if ( action == "LedOff" ) 486 else if ( action == "LedOff" )
486 ODevice::inst()->setLedState( Led_Mail, Led_Off ); 487 ODevice::inst()->setLedState( Led_Mail, Led_Off );
487 else if ( action == "LogMessage" ) 488 else if ( action == "LogMessage" )
488 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 489 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
489 else if ( action == "MessageBox" ) 490 else if ( action == "MessageBox" )
490 QMessageBox::information( this, "Notification!", 491 QMessageBox::information( this, "Notification!",
491 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 492 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
493 #else
494 #warning Actions do not work with Qt/X11 yet
495 #endif
492} 496}
493 497
494void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) 498void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
495{ 499{
500 #ifdef QWS
496 if ( !iface ) 501 if ( !iface )
497 { 502 {
498 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); 503 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
499 return; 504 return;
500 } 505 }
501 506
502 if ( sniffing ) 507 if ( sniffing )
503 { 508 {
504 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); 509 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) );
505 return; 510 return;
506 } 511 }
507 512
508 qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", 513 qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s",
509 (const char*) iface->name(), 514 (const char*) iface->name(),
510 (const char*) type, 515 (const char*) type,
511 (const char*) essid, 516 (const char*) essid,
512 channel, 517 channel,
513 (const char*) macaddr ); 518 (const char*) macaddr );
514 519
515 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); 520 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
516 int count = 3; 521 int count = 3;
517 qDebug("sending %d messages",count); 522 qDebug("sending %d messages",count);
518 msg << QString("count") << QString::number(count); 523 msg << QString("count") << QString::number(count);
519 qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); 524 qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() );
520 msg << QString(iface->name()) << QString("Mode") << type; 525 msg << QString(iface->name()) << QString("Mode") << type;
521 qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); 526 qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1());
522 msg << QString(iface->name()) << QString("ESSID") << essid; 527 msg << QString(iface->name()) << QString("ESSID") << essid;
523 qDebug("msg >%s< channel >%d<", iface->name(),channel); 528 qDebug("msg >%s< channel >%d<", iface->name(),channel);
524 msg << QString(iface->name()) << QString("Channel") << channel; 529 msg << QString(iface->name()) << QString("Channel") << channel;
525// qDebug("msg >%s< mac >%s<", iface->name(),macaddr); 530// qDebug("msg >%s< mac >%s<", iface->name(),macaddr);
526// msg << QString(iface->name()) << QString("MacAddr") << macaddr; 531// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
527 532 #else
533 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
534 #endif
528 535
529} 536}
530 537