summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui80
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp98
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h2
4 files changed, 151 insertions, 30 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui
index 57ffd2a..e2f734a 100644
--- a/noncore/net/wellenreiter/gui/configbase.ui
+++ b/noncore/net/wellenreiter/gui/configbase.ui
@@ -2,55 +2,64 @@
<class>WellenreiterConfigBase</class>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>WellenreiterConfigBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>240</width>
- <height>276</height>
+ <width>232</width>
+ <height>267</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Form1</string>
</property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>11</number>
+ <number>4</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>0</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout5</cstring>
</property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>2</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>1</vsizetype>
@@ -71,32 +80,35 @@
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout7</cstring>
</property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>2</number>
</property>
<widget row="0" column="0" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>&lt;select&gt;</string>
</property>
</item>
<item>
<property>
<name>text</name>
@@ -130,25 +142,25 @@
<item>
<property>
<name>text</name>
<string>wifi1</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>interfaceName</cstring>
</property>
<property stdset="1">
<name>enabled</name>
- <bool>false</bool>
+ <bool>true</bool>
</property>
</widget>
<widget row="4" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>activeScanning</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
@@ -186,25 +198,25 @@
<item>
<property>
<name>text</name>
<string>&lt;manual&gt;</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>deviceType</cstring>
</property>
<property stdset="1">
<name>enabled</name>
- <bool>false</bool>
+ <bool>true</bool>
</property>
</widget>
<widget row="3" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>additionalInfo</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
@@ -212,25 +224,25 @@
<name>text</name>
<string>Gather Additional Info</string>
</property>
</widget>
<widget row="2" column="0" >
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>hopInterval</cstring>
</property>
<property stdset="1">
<name>enabled</name>
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>suffix</name>
<string> ms</string>
</property>
<property stdset="1">
<name>maxValue</name>
<number>2000</number>
</property>
<property stdset="1">
<name>minValue</name>
<number>100</number>
@@ -239,77 +251,80 @@
<name>lineStep</name>
<number>100</number>
</property>
</widget>
<widget row="2" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_3</cstring>
</property>
<property stdset="1">
<name>enabled</name>
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Hop Interval</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_3</cstring>
</property>
<property stdset="1">
<name>enabled</name>
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Device Type</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
<name>enabled</name>
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Interface Name</string>
</property>
</widget>
</grid>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout6</cstring>
</property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>2</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_2_2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>1</vsizetype>
@@ -328,34 +343,37 @@
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout8</cstring>
+ <cstring>Layout5</cstring>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>-1</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>groupNetworks</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
@@ -369,17 +387,49 @@
<name>name</name>
<cstring>enableActivity</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Enable Activity Display</string>
</property>
</widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>beepOnFound</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Beep on new network</string>
+ </property>
+ </widget>
</vbox>
</widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
</vbox>
</widget>
</UI>
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index 759d46d..c2db283 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -15,16 +15,17 @@
#ifndef WELLENREITERCONFIGWINDOW_H
#define WELLENREITERCONFIGWINDOW_H
#include "configbase.h"
class WellenreiterConfigWindow : public WellenreiterConfigBase
{
public:
WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 );
+
};
#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 5808e9c..764ef34 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -7,46 +7,57 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
***********************************************************************/
// Qt
#include <qpushbutton.h>
+#include <qmessagebox.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
+
+// Qtopia
+
+#ifdef QWS
+#include <qpe/global.h>
+#endif
// Standard
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
+#include <stdlib.h>
// Local
#include "wellenreiter.h"
#include "scanlistitem.h"
#include "logwindow.h"
#include "hexwindow.h"
+#include "configwindow.h"
#include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS!
#include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS!
#include "../daemon/source/config.hh" // <--- ugly path, FIX THIS!
Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
- : WellenreiterBase( parent, name, fl )
+ : WellenreiterBase( parent, name, fl ), daemonRunning( false )
{
logwindow->log( "(i) Wellenreiter has been started." );
connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
netview->setColumnWidthMode( 1, QListView::Manual );
//
// setup socket for daemon communication and start poller
//
daemon_fd = commsock( GUIADDR, GUIPORT );
@@ -140,33 +151,33 @@ bool Wellenreiter::hasMessage()
}
else if ( result == -1 )
{
qDebug( "selected returned: %s", strerror( errno ) );
return false;
}
else
return true; //FD_ISSET( daemon_fd, &rfds ); gibbet 'eh nur einen Deskriptor
}
void Wellenreiter::timerEvent( QTimerEvent* e )
{
- qDebug( "checking for message..." );
+ //qDebug( "checking for message..." );
if ( hasMessage() )
{
- qDebug( "got message" );
+ //qDebug( "got message from daemon" );
handleMessage();
}
else
{
- qDebug( "no message..." );
+ //qDebug( "no message..." );
}
}
void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
{
// FIXME: this code belongs in customized QListView, not into this class
// FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
qDebug( "Wellenreiter::addNewItem( %s / %s / %s [%d]",
(const char*) type,
(const char*) essid,
(const char*) macaddr,
@@ -228,30 +239,87 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo
}
else
{
s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
}
logwindow->log( s );
}
void Wellenreiter::buttonClicked()
{
+ if ( daemonRunning )
+ {
+ logwindow->log( "(i) Daemon has been stopped." );
+ button->setText( "Start Scanning" );
+
+ // Stop daemon
+
+ // find out pids of wellenreiterd and orinoco_hopper
+
+ }
+
+ else
+ {
+
+ // get configuration from config window
+
+ const QString& interface = configwindow->interfaceName->currentText();
+ const QString& cardtype = configwindow->deviceType->currentText();
+ const QString& interval = configwindow->hopInterval->cleanText();
+
+ if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) )
+ {
+ QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." );
+ return;
+ }
+
+ logwindow->log( "(i) Daemon has been started." );
+ button->setText( "Stop Scanning" );
+
+#ifdef QWS
+
+ // set interface into monitor mode
+
+ QString cmdline;
+
+ cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface );
+ system( cmdline );
+ cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface );
+ system( cmdline );
+
+ // start channel hopper
+
+ cmdline = "orinoco_hopper ";
+ cmdline += interface;
+ cmdline += " -i ";
+ cmdline += interval;
+ //qDebug( "execute: %s", (const char*) cmdline );
+ Global::execute( cmdline );
+
+ // start daemon
+
+ cmdline = "wellenreiterd ";
+ cmdline += interface;
+ cmdline += " 3";
+ //qDebug( "execute: %s", (const char*) cmdline );
+ Global::execute( cmdline );
+#endif
- // FIXME: communicate with daemon and set button text according to state
+ /*
- button->setText( "Stop Scanning" );
+ // add some test stations, so that we can see if the GUI part works
- // add some test stations, so that we can see if the GUI part works
+ addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 );
+ addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 );
+ addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 );
+ addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 );
+ addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 );
- addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 );
- addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 );
- addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 );
- addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 );
- addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 );
-
- QString command ("98");
+ QString command ("98");
- //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command );
+ //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command );
+ */
+ }
}
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 61f7503..052a242 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -21,24 +21,26 @@
class QTimerEvent;
class Wellenreiter : public WellenreiterBase {
Q_OBJECT
public:
Wellenreiter( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~Wellenreiter();
protected:
virtual void timerEvent( QTimerEvent* );
+
+ bool daemonRunning;
public slots:
void buttonClicked();
void addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal );
private:
int daemon_fd; // socket filedescriptor for udp communication socket
bool hasMessage();
void handleMessage();
//void readConfig();