summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/protolistview.cpp12
-rw-r--r--noncore/net/wellenreiter/gui/protolistview.h2
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp75
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h3
4 files changed, 77 insertions, 15 deletions
diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp
index 05ff5e7..d4b0dfe 100644
--- a/noncore/net/wellenreiter/gui/protolistview.cpp
+++ b/noncore/net/wellenreiter/gui/protolistview.cpp
@@ -104,8 +104,14 @@ bool ProtocolListView::isProtocolChecked( const QString& name )
-QString ProtocolListView::protocolAction( const QString& name ) const
+QString ProtocolListView::protocolAction( const QString& name )
{
- //FIXME
+ //QObject * child ( const char * objName, const char * inheritsClass = 0,
+ // bool recursiveSearch = TRUE )
+
+ QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" );
+ if ( combo )
+ return combo->currentText();
+ else
+ return "<unknown>";
}
-
diff --git a/noncore/net/wellenreiter/gui/protolistview.h b/noncore/net/wellenreiter/gui/protolistview.h
index 723e8cd..166b648 100644
--- a/noncore/net/wellenreiter/gui/protolistview.h
+++ b/noncore/net/wellenreiter/gui/protolistview.h
@@ -33,5 +33,5 @@ class ProtocolListView : public QScrollView
bool isProtocolChecked( const QString& name );
- QString protocolAction( const QString& name ) const;
+ QString protocolAction( const QString& name );
protected:
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 2f3d093..edf7dcf 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -14,4 +14,16 @@
***********************************************************************/
+// Local
+
+#include "wellenreiter.h"
+#include "scanlist.h"
+#include "logwindow.h"
+#include "hexwindow.h"
+#include "configwindow.h"
+#include "statwindow.h"
+#include "graphwindow.h"
+#include "manufacturers.h"
+#include "protolistview.h"
+
// Opie
@@ -37,4 +49,5 @@ using namespace Opie;
#include <qlineedit.h>
#include <qmessagebox.h>
+#include <qobjectlist.h>
#include <qregexp.h>
#include <qspinbox.h>
@@ -51,15 +64,4 @@ using namespace Opie;
#include <stdlib.h>
-// Local
-
-#include "wellenreiter.h"
-#include "scanlist.h"
-#include "logwindow.h"
-#include "hexwindow.h"
-#include "configwindow.h"
-#include "statwindow.h"
-#include "graphwindow.h"
-#include "manufacturers.h"
-
Wellenreiter::Wellenreiter( QWidget* parent )
: WellenreiterBase( parent, 0, 0 ),
@@ -138,4 +140,28 @@ void Wellenreiter::channelHopped(int c)
+void Wellenreiter::handleNotification( OPacket* p )
+{
+ QObjectList* l = p->queryList();
+ QObjectListIt it( *l );
+ QObject* o;
+
+ while ( (o = it.current()) != 0 )
+ {
+ QString name = it.current()->name();
+ if ( configwindow->parsePackets->isProtocolChecked( name ) )
+ {
+ QString action = configwindow->parsePackets->protocolAction( name );
+ qDebug( "action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
+ doAction( action, name, p );
+ }
+ else
+ {
+ qDebug( "protocol '%s' not checked.", (const char*) name );
+ }
+ ++it;
+ }
+}
+
+
void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
{
@@ -246,8 +272,16 @@ void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data )
+QObject* childIfToParse( OPacket* p, const QString& protocol )
+{
+ //FIXME: Implement
+}
+
+
void Wellenreiter::receivePacket( OPacket* p )
{
hexWindow()->log( p->dump( 8 ) );
+ handleNotification( p );
+
// check if we received a beacon frame
OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
@@ -432,2 +466,21 @@ void Wellenreiter::timerEvent( QTimerEvent* )
}
+
+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 ) );
+}
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index ea8a692..e227a24 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -67,4 +67,7 @@ class Wellenreiter : public WellenreiterBase {
void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon );
void handleData( OPacket* p, OWaveLanDataPacket* data );
+ void handleNotification( OPacket* p );
+ void doAction( const QString& action, const QString& protocol, OPacket* p );
+ QObject* childIfToParse( OPacket* p, const QString& protocol );
private: