summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-05-07 21:53:35 (UTC)
committer mickeyl <mickeyl>2003-05-07 21:53:35 (UTC)
commit3d150d3dceb6f66930d487958af95a169462ea84 (patch) (unidiff)
treef93c5754689afebb5be8e2affa57517a4bb4a825
parent8344bbd32ca4ebfef275746de29cb3109b013cb6 (diff)
downloadopie-3d150d3dceb6f66930d487958af95a169462ea84.zip
opie-3d150d3dceb6f66930d487958af95a169462ea84.tar.gz
opie-3d150d3dceb6f66930d487958af95a169462ea84.tar.bz2
first half of event system completed
Diffstat (more/less context) (ignore 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
@@ -103,9 +103,15 @@ bool ProtocolListView::isProtocolChecked( const QString& name )
103} 103}
104 104
105 105
106QString ProtocolListView::protocolAction( const QString& name ) const 106QString ProtocolListView::protocolAction( const QString& name )
107{ 107{
108 //FIXME 108 //QObject * child ( const char * objName, const char * inheritsClass = 0,
109 // bool recursiveSearch = TRUE )
110
111 QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" );
112 if ( combo )
113 return combo->currentText();
114 else
115 return "<unknown>";
109} 116}
110 117
111
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
@@ -32,7 +32,7 @@ class ProtocolListView : public QScrollView
32 virtual ~ProtocolListView(); 32 virtual ~ProtocolListView();
33 33
34 bool isProtocolChecked( const QString& name ); 34 bool isProtocolChecked( const QString& name );
35 QString protocolAction( const QString& name ) const; 35 QString protocolAction( const QString& name );
36 36
37 protected: 37 protected:
38 virtual void addProtocol( const QString& name ); 38 virtual void addProtocol( const QString& name );
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
@@ -13,6 +13,18 @@
13** 13**
14***********************************************************************/ 14***********************************************************************/
15 15
16// Local
17
18#include "wellenreiter.h"
19#include "scanlist.h"
20#include "logwindow.h"
21#include "hexwindow.h"
22#include "configwindow.h"
23#include "statwindow.h"
24#include "graphwindow.h"
25#include "manufacturers.h"
26#include "protolistview.h"
27
16// Opie 28// Opie
17 29
18#ifdef QWS 30#ifdef QWS
@@ -36,6 +48,7 @@ using namespace Opie;
36#include <qpushbutton.h> 48#include <qpushbutton.h>
37#include <qlineedit.h> 49#include <qlineedit.h>
38#include <qmessagebox.h> 50#include <qmessagebox.h>
51#include <qobjectlist.h>
39#include <qregexp.h> 52#include <qregexp.h>
40#include <qspinbox.h> 53#include <qspinbox.h>
41#include <qtoolbutton.h> 54#include <qtoolbutton.h>
@@ -50,17 +63,6 @@ using namespace Opie;
50#include <sys/types.h> 63#include <sys/types.h>
51#include <stdlib.h> 64#include <stdlib.h>
52 65
53// Local
54
55#include "wellenreiter.h"
56#include "scanlist.h"
57#include "logwindow.h"
58#include "hexwindow.h"
59#include "configwindow.h"
60#include "statwindow.h"
61#include "graphwindow.h"
62#include "manufacturers.h"
63
64Wellenreiter::Wellenreiter( QWidget* parent ) 66Wellenreiter::Wellenreiter( QWidget* parent )
65 : WellenreiterBase( parent, 0, 0 ), 67 : WellenreiterBase( parent, 0, 0 ),
66 sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) 68 sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 )
@@ -137,6 +139,30 @@ void Wellenreiter::channelHopped(int c)
137} 139}
138 140
139 141
142void Wellenreiter::handleNotification( OPacket* p )
143{
144 QObjectList* l = p->queryList();
145 QObjectListIt it( *l );
146 QObject* o;
147
148 while ( (o = it.current()) != 0 )
149 {
150 QString name = it.current()->name();
151 if ( configwindow->parsePackets->isProtocolChecked( name ) )
152 {
153 QString action = configwindow->parsePackets->protocolAction( name );
154 qDebug( "action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
155 doAction( action, name, p );
156 }
157 else
158 {
159 qDebug( "protocol '%s' not checked.", (const char*) name );
160 }
161 ++it;
162 }
163}
164
165
140void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) 166void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
141{ 167{
142 QString type; 168 QString type;
@@ -245,10 +271,18 @@ void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data )
245} 271}
246 272
247 273
274QObject* childIfToParse( OPacket* p, const QString& protocol )
275{
276 //FIXME: Implement
277}
278
279
248void Wellenreiter::receivePacket( OPacket* p ) 280void Wellenreiter::receivePacket( OPacket* p )
249{ 281{
250 hexWindow()->log( p->dump( 8 ) ); 282 hexWindow()->log( p->dump( 8 ) );
251 283
284 handleNotification( p );
285
252 // check if we received a beacon frame 286 // check if we received a beacon frame
253 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 287 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
254 if ( beacon && beacon->managementType() == "Beacon" ) 288 if ( beacon && beacon->managementType() == "Beacon" )
@@ -431,3 +465,22 @@ void Wellenreiter::timerEvent( QTimerEvent* )
431 } 465 }
432} 466}
433 467
468
469void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p )
470{
471 if ( action == "TouchSound" )
472 ODevice::inst()->touchSound();
473 else if ( action == "AlarmSound" )
474 ODevice::inst()->alarmSound();
475 else if ( action == "KeySound" )
476 ODevice::inst()->keySound();
477 else if ( action == "LedOn" )
478 ODevice::inst()->setLedState( Led_Mail, Led_On );
479 else if ( action == "LedOff" )
480 ODevice::inst()->setLedState( Led_Mail, Led_Off );
481 else if ( action == "LogMessage" )
482 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
483 else if ( action == "MessageBox" )
484 QMessageBox::information ( this, "Notification!",
485 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
486}
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
@@ -66,6 +66,9 @@ class Wellenreiter : public WellenreiterBase {
66 private: 66 private:
67 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); 67 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon );
68 void handleData( OPacket* p, OWaveLanDataPacket* data ); 68 void handleData( OPacket* p, OWaveLanDataPacket* data );
69 void handleNotification( OPacket* p );
70 void doAction( const QString& action, const QString& protocol, OPacket* p );
71 QObject* childIfToParse( OPacket* p, const QString& protocol );
69 72
70 private: 73 private:
71 #ifdef QWS 74 #ifdef QWS