Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 75 |
1 files changed, 64 insertions, 11 deletions
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 | |||
@@ -15,2 +15,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 |
@@ -38,2 +50,3 @@ using namespace Opie; | |||
38 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qobjectlist.h> | ||
39 | #include <qregexp.h> | 52 | #include <qregexp.h> |
@@ -52,13 +65,2 @@ using namespace Opie; | |||
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 | |||
64 | Wellenreiter::Wellenreiter( QWidget* parent ) | 66 | Wellenreiter::Wellenreiter( QWidget* parent ) |
@@ -139,2 +141,26 @@ void Wellenreiter::channelHopped(int c) | |||
139 | 141 | ||
142 | void 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 | |||
140 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | 166 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) |
@@ -247,2 +273,8 @@ void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) | |||
247 | 273 | ||
274 | QObject* childIfToParse( OPacket* p, const QString& protocol ) | ||
275 | { | ||
276 | //FIXME: Implement | ||
277 | } | ||
278 | |||
279 | |||
248 | void Wellenreiter::receivePacket( OPacket* p ) | 280 | void Wellenreiter::receivePacket( OPacket* p ) |
@@ -251,2 +283,4 @@ void Wellenreiter::receivePacket( OPacket* p ) | |||
251 | 283 | ||
284 | handleNotification( p ); | ||
285 | |||
252 | // check if we received a beacon frame | 286 | // check if we received a beacon frame |
@@ -433 +467,20 @@ void Wellenreiter::timerEvent( QTimerEvent* ) | |||
433 | 467 | ||
468 | |||
469 | void 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 | } | ||