-rw-r--r-- | noncore/net/wellenreiter/gui/gui-x11.pro | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/manufacturers.cpp | 58 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/manufacturers.h | 37 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.h | 22 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 16 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 5 |
7 files changed, 141 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/gui-x11.pro b/noncore/net/wellenreiter/gui/gui-x11.pro index 523bf15..c2a4394 100644 --- a/noncore/net/wellenreiter/gui/gui-x11.pro +++ b/noncore/net/wellenreiter/gui/gui-x11.pro | |||
@@ -2,8 +2,8 @@ DESTDIR = . | |||
2 | TEMPLATE = app | 2 | TEMPLATE = app |
3 | CONFIG = qt warn_on debug | 3 | CONFIG = qt warn_on debug |
4 | #CONFIG = qt warn_on release | 4 | #CONFIG = qt warn_on release |
5 | HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h configwindow.h resource.h wlan.h cardconfig.h | 5 | HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h configwindow.h resource.h wlan.h cardconfig.h manufacturers.h |
6 | SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp resource.cpp wlan.cpp cardconfig.cpp | 6 | SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp resource.cpp wlan.cpp cardconfig.cpp manufacturers.cpp |
7 | INCLUDEPATH += ../ | 7 | INCLUDEPATH += ../ |
8 | DEPENDPATH += ../ | 8 | DEPENDPATH += ../ |
9 | LIBS += -L. -lwellenreiter | 9 | LIBS += -L. -lwellenreiter |
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index ce1c387..52ed8c6 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -2,8 +2,8 @@ DESTDIR = $(OPIEDIR)/bin | |||
2 | TEMPLATE = app | 2 | TEMPLATE = app |
3 | CONFIG = qt warn_on debug | 3 | CONFIG = qt warn_on debug |
4 | #CONFIG = qt warn_on release | 4 | #CONFIG = qt warn_on release |
5 | HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h configwindow.h wlan.h cardconfig.h | 5 | HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h configwindow.h wlan.h cardconfig.h manufacturers.h |
6 | SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp wlan.cpp cardconfig.cpp | 6 | SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp wlan.cpp cardconfig.cpp manufacturers.h |
7 | INCLUDEPATH += $(OPIEDIR)/include ../ | 7 | INCLUDEPATH += $(OPIEDIR)/include ../ |
8 | DEPENDPATH += $(OPIEDIR)/include ../ | 8 | DEPENDPATH += $(OPIEDIR)/include ../ |
9 | LIBS += -lqpe -lopie -L. -lwellenreiter | 9 | LIBS += -lqpe -lopie -L. -lwellenreiter |
diff --git a/noncore/net/wellenreiter/gui/manufacturers.cpp b/noncore/net/wellenreiter/gui/manufacturers.cpp new file mode 100644 index 0000000..d235989 --- a/dev/null +++ b/noncore/net/wellenreiter/gui/manufacturers.cpp | |||
@@ -0,0 +1,58 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #include "manufacturers.h" | ||
17 | |||
18 | // Qt | ||
19 | #include <qstring.h> | ||
20 | #include <qfile.h> | ||
21 | #include <qtextstream.h> | ||
22 | |||
23 | ManufacturerDB::ManufacturerDB( const QString& filename ) | ||
24 | { | ||
25 | QFile file( filename ); | ||
26 | bool hasFile = file.open( IO_ReadOnly ); | ||
27 | if (!hasFile) | ||
28 | { | ||
29 | qDebug( "ManufacturerDB: D'oh! Manufacturer list '%s' not found!", (const char*) filename ); | ||
30 | } | ||
31 | else | ||
32 | { | ||
33 | qDebug( "ManufacturerDB: reading manufacturer list from '%s'...", (const char*) filename ); | ||
34 | QTextStream s( &file ); | ||
35 | QString addr; | ||
36 | QString manu; | ||
37 | |||
38 | while (!s.atEnd()) | ||
39 | { | ||
40 | s >> addr; | ||
41 | s.skipWhiteSpace(); | ||
42 | manu = s.readLine(); | ||
43 | qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); | ||
44 | manufacturers.insert( addr, manu ); | ||
45 | |||
46 | } | ||
47 | } | ||
48 | |||
49 | } | ||
50 | |||
51 | ManufacturerDB::~ManufacturerDB() | ||
52 | { | ||
53 | } | ||
54 | |||
55 | QString ManufacturerDB::lookup( const QString& macaddr ) | ||
56 | { | ||
57 | return manufacturers[macaddr.upper().left(8)]; | ||
58 | } | ||
diff --git a/noncore/net/wellenreiter/gui/manufacturers.h b/noncore/net/wellenreiter/gui/manufacturers.h new file mode 100644 index 0000000..d69977a --- a/dev/null +++ b/noncore/net/wellenreiter/gui/manufacturers.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #ifndef MANUFACTURERS_H | ||
17 | #define MANUFACTURERS_H | ||
18 | |||
19 | #include <qmap.h> | ||
20 | #include <string.h> | ||
21 | |||
22 | class ManufacturerDB | ||
23 | { | ||
24 | public: | ||
25 | |||
26 | ManufacturerDB( const QString& filename ); | ||
27 | virtual ~ManufacturerDB(); | ||
28 | QString lookup( const QString& macaddr ); | ||
29 | |||
30 | private: | ||
31 | |||
32 | QMap<QString, QString> manufacturers; | ||
33 | |||
34 | }; | ||
35 | |||
36 | #endif | ||
37 | |||
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.h b/noncore/net/wellenreiter/gui/scanlistitem.h index cd9d883..47a5a4e 100644 --- a/noncore/net/wellenreiter/gui/scanlistitem.h +++ b/noncore/net/wellenreiter/gui/scanlistitem.h | |||
@@ -49,6 +49,28 @@ class MScanListItem: public QListViewItem | |||
49 | 49 | ||
50 | QString type; | 50 | QString type; |
51 | 51 | ||
52 | public: | ||
53 | |||
54 | //const QString& type() { return _type; }; | ||
55 | const QString& essid() { return _essid; }; | ||
56 | const QString& macaddr() { return _macaddr; }; | ||
57 | bool wep() { return _wep; }; | ||
58 | int channel() { return _channel; }; | ||
59 | int signal() { return _signal; }; | ||
60 | int received() { return _received; }; | ||
61 | |||
62 | void setSignal( int signal ) { /* TODO */ }; | ||
63 | void incReceived() { _received++; }; | ||
64 | |||
65 | private: | ||
66 | QString _type; | ||
67 | QString _essid; | ||
68 | QString _macaddr; | ||
69 | bool _wep; | ||
70 | int _channel; | ||
71 | int _signal; | ||
72 | int _received; | ||
73 | |||
52 | }; | 74 | }; |
53 | 75 | ||
54 | #endif | 76 | #endif |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 2d9bbee..9068e3a 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -53,6 +53,8 @@ using namespace Opie; | |||
53 | #include "hexwindow.h" | 53 | #include "hexwindow.h" |
54 | #include "configwindow.h" | 54 | #include "configwindow.h" |
55 | 55 | ||
56 | #include "manufacturers.h" | ||
57 | |||
56 | #include <libwellenreiter/source/wl_sock.hh> | 58 | #include <libwellenreiter/source/wl_sock.hh> |
57 | #include <libwellenreiter/source/wl_proto.hh> | 59 | #include <libwellenreiter/source/wl_proto.hh> |
58 | #include <daemon/source/config.hh> | 60 | #include <daemon/source/config.hh> |
@@ -61,6 +63,18 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
61 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ) | 63 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ) |
62 | { | 64 | { |
63 | 65 | ||
66 | // | ||
67 | // construct manufacturer database | ||
68 | // | ||
69 | |||
70 | QString manufile; | ||
71 | #ifdef QWS | ||
72 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) qApp.qpeDir() ); | ||
73 | #else | ||
74 | manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" ); | ||
75 | #endif | ||
76 | manufacturerdb = new ManufacturerDB( manufile ); | ||
77 | |||
64 | logwindow->log( "(i) Wellenreiter has been started." ); | 78 | logwindow->log( "(i) Wellenreiter has been started." ); |
65 | 79 | ||
66 | // | 80 | // |
@@ -103,6 +117,8 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
103 | Wellenreiter::~Wellenreiter() | 117 | Wellenreiter::~Wellenreiter() |
104 | { | 118 | { |
105 | // no need to delete child widgets, Qt does it all for us | 119 | // no need to delete child widgets, Qt does it all for us |
120 | |||
121 | delete manufacturerdb; | ||
106 | } | 122 | } |
107 | 123 | ||
108 | void Wellenreiter::handleMessage() | 124 | void Wellenreiter::handleMessage() |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 2296892..9715983 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -25,6 +25,7 @@ using namespace Opie; | |||
25 | 25 | ||
26 | class QTimerEvent; | 26 | class QTimerEvent; |
27 | class QPixmap; | 27 | class QPixmap; |
28 | class ManufacturerDB; | ||
28 | 29 | ||
29 | class Wellenreiter : public WellenreiterBase { | 30 | class Wellenreiter : public WellenreiterBase { |
30 | Q_OBJECT | 31 | Q_OBJECT |
@@ -48,7 +49,9 @@ private: | |||
48 | OSystem _system; // Opie Operating System identifier | 49 | OSystem _system; // Opie Operating System identifier |
49 | #endif | 50 | #endif |
50 | void handleMessage(); | 51 | void handleMessage(); |
51 | 52 | ||
53 | ManufacturerDB* manufacturerdb; | ||
54 | |||
52 | //void readConfig(); | 55 | //void readConfig(); |
53 | //void writeConfig(); | 56 | //void writeConfig(); |
54 | }; | 57 | }; |