author | mickeyl <mickeyl> | 2002-12-28 13:57:48 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2002-12-28 13:57:48 (UTC) |
commit | 0ab4ac99bead80d8af18988045748fd2b3dd3a15 (patch) (unidiff) | |
tree | b01ce259b2935dfc54ff4322a1167cbe4ec0b282 | |
parent | 224f9b43d51d1e0a261b807c2b8a37aa2a5289bb (diff) | |
download | opie-0ab4ac99bead80d8af18988045748fd2b3dd3a15.zip opie-0ab4ac99bead80d8af18988045748fd2b3dd3a15.tar.gz opie-0ab4ac99bead80d8af18988045748fd2b3dd3a15.tar.bz2 |
- catch up with new filenames and include paths.
- remove Makefile.in (who added this??)
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in | 101 | ||||
-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/wellenreiter.cpp | 10 |
4 files changed, 9 insertions, 110 deletions
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in b/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in deleted file mode 100644 index c542a59..0000000 --- a/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in +++ b/dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | ############################################################################# | ||
2 | |||
3 | ####### Compiler, tools and options | ||
4 | |||
5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) | ||
6 | CXXFLAGS=$(SYSCONF_CXXFLAGS) | ||
7 | CC =$(SYSCONF_CC) $(QT_C_MT) | ||
8 | CFLAGS =$(SYSCONF_CFLAGS) | ||
9 | INCPATH = | ||
10 | LFLAGS =$(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | ||
11 | LIBS =$(SUBLIBS) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) | ||
12 | MOC =$(SYSCONF_MOC) | ||
13 | UIC =$(SYSCONF_UIC) | ||
14 | |||
15 | ####### Target | ||
16 | |||
17 | DESTDIR = $(OPIEDIR)/bin/ | ||
18 | VER_MAJ = 1 | ||
19 | VER_MIN = 0 | ||
20 | VER_PATCH = 0 | ||
21 | TARGET= orinoco_hopper | ||
22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS = | ||
27 | SOURCES =orinoco_hopper.c | ||
28 | OBJECTS =orinoco_hopper.o | ||
29 | INTERFACES = | ||
30 | UICDECLS = | ||
31 | UICIMPLS = | ||
32 | SRCMOC = | ||
33 | OBJMOC = | ||
34 | |||
35 | |||
36 | ####### Implicit rules | ||
37 | |||
38 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
39 | |||
40 | .cpp.o: | ||
41 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
42 | |||
43 | .cxx.o: | ||
44 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
45 | |||
46 | .cc.o: | ||
47 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
48 | |||
49 | .C.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .c.o: | ||
53 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | ####### Build rules | ||
56 | |||
57 | |||
58 | all: $(DESTDIR)$(TARGET) | ||
59 | |||
60 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
61 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
62 | |||
63 | moc: $(SRCMOC) | ||
64 | |||
65 | tmake: | ||
66 | tmake orinoco_hopper.pro | ||
67 | |||
68 | clean: | ||
69 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) | ||
70 | -rm -f *~ core | ||
71 | -rm -f allmoc.cpp | ||
72 | |||
73 | ####### Extension Modules | ||
74 | |||
75 | listpromodules: | ||
76 | @echo | ||
77 | |||
78 | listallmodules: | ||
79 | @echo | ||
80 | |||
81 | listaddonpromodules: | ||
82 | @echo | ||
83 | |||
84 | listaddonentmodules: | ||
85 | @echo | ||
86 | |||
87 | |||
88 | REQUIRES= | ||
89 | |||
90 | ####### Sub-libraries | ||
91 | |||
92 | |||
93 | ###### Combined headers | ||
94 | |||
95 | |||
96 | |||
97 | ####### Compile | ||
98 | |||
99 | orinoco_hopper.o: orinoco_hopper.c | ||
100 | |||
101 | |||
diff --git a/noncore/net/wellenreiter/gui/gui-x11.pro b/noncore/net/wellenreiter/gui/gui-x11.pro index 0cddd22..6b4a7bf 100644 --- a/noncore/net/wellenreiter/gui/gui-x11.pro +++ b/noncore/net/wellenreiter/gui/gui-x11.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | DESTDIR = . | 1 | 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 | 5 | HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h configwindow.h resource.h |
6 | SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp resource.cpp | 6 | SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp resource.cpp |
7 | INCLUDEPATH += ../daemon | 7 | INCLUDEPATH += ../ |
8 | DEPENDPATH += ../daemon | 8 | DEPENDPATH += ../ |
9 | LIBS += -lwellenreiter | 9 | LIBS += -lwellenreiter |
10 | INTERFACES = configbase.ui | 10 | INTERFACES = configbase.ui |
11 | TARGET = wellenreiter | 11 | TARGET = wellenreiter |
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index b271ee3..b6e884d 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | 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 | 5 | HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h configwindow.h |
6 | SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp | 6 | SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp |
7 | INCLUDEPATH += $(OPIEDIR)/include ../daemon | 7 | INCLUDEPATH += $(OPIEDIR)/include ../ |
8 | DEPENDPATH += $(OPIEDIR)/include ../daemon | 8 | DEPENDPATH += $(OPIEDIR)/include ../ |
9 | LIBS += -lqpe -lopie -lwellenreiter | 9 | LIBS += -lqpe -lopie -lwellenreiter |
10 | INTERFACES = configbase.ui | 10 | INTERFACES = configbase.ui |
11 | TARGET = wellenreiter | 11 | TARGET = wellenreiter |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 0e95b28..0fd929f 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -1,335 +1,335 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ***********************************************************************/ | 14 | ***********************************************************************/ |
15 | 15 | ||
16 | // Qt | 16 | // Qt |
17 | 17 | ||
18 | #include <qpushbutton.h> | 18 | #include <qpushbutton.h> |
19 | #include <qmessagebox.h> | 19 | #include <qmessagebox.h> |
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qspinbox.h> | 21 | #include <qspinbox.h> |
22 | 22 | ||
23 | // Qtopia | 23 | // Qtopia |
24 | 24 | ||
25 | #ifdef QWS | 25 | #ifdef QWS |
26 | #include <qpe/global.h> | 26 | #include <qpe/global.h> |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | // Standard | 29 | // Standard |
30 | 30 | ||
31 | #include <assert.h> | 31 | #include <assert.h> |
32 | #include <errno.h> | 32 | #include <errno.h> |
33 | #include <unistd.h> | 33 | #include <unistd.h> |
34 | #include <string.h> | 34 | #include <string.h> |
35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | // Local | 38 | // Local |
39 | 39 | ||
40 | #include "wellenreiter.h" | 40 | #include "wellenreiter.h" |
41 | #include "scanlistitem.h" | 41 | #include "scanlistitem.h" |
42 | #include "logwindow.h" | 42 | #include "logwindow.h" |
43 | #include "hexwindow.h" | 43 | #include "hexwindow.h" |
44 | #include "configwindow.h" | 44 | #include "configwindow.h" |
45 | 45 | ||
46 | #include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! | 46 | #include <libwellenreiter/source/wl_sock.hh> |
47 | #include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS! | 47 | #include <libwellenreiter/source/wl_proto.hh> |
48 | #include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! | 48 | #include <daemon/source/config.hh> |
49 | 49 | ||
50 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | 50 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) |
51 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ) | 51 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ) |
52 | { | 52 | { |
53 | 53 | ||
54 | logwindow->log( "(i) Wellenreiter has been started." ); | 54 | logwindow->log( "(i) Wellenreiter has been started." ); |
55 | 55 | ||
56 | connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); | 56 | connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); |
57 | netview->setColumnWidthMode( 1, QListView::Manual ); | 57 | netview->setColumnWidthMode( 1, QListView::Manual ); |
58 | 58 | ||
59 | // | 59 | // |
60 | // setup socket for daemon communication and start poller | 60 | // setup socket for daemon communication and start poller |
61 | // | 61 | // |
62 | 62 | ||
63 | daemon_fd = commsock( GUIADDR, GUIPORT ); | 63 | daemon_fd = wl_setupsock( GUIADDR, GUIPORT ); |
64 | if ( daemon_fd == -1 ) | 64 | if ( daemon_fd == -1 ) |
65 | { | 65 | { |
66 | logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); | 66 | logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); |
67 | qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); | 67 | qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); |
68 | } | 68 | } |
69 | else | 69 | else |
70 | startTimer( 700 ); | 70 | startTimer( 700 ); |
71 | 71 | ||
72 | } | 72 | } |
73 | 73 | ||
74 | Wellenreiter::~Wellenreiter() | 74 | Wellenreiter::~Wellenreiter() |
75 | { | 75 | { |
76 | // no need to delete child widgets, Qt does it all for us | 76 | // no need to delete child widgets, Qt does it all for us |
77 | } | 77 | } |
78 | 78 | ||
79 | void Wellenreiter::handleMessage() | 79 | void Wellenreiter::handleMessage() |
80 | { | 80 | { |
81 | // FIXME: receive message and handle it | 81 | // FIXME: receive message and handle it |
82 | 82 | ||
83 | qDebug( "received message from daemon." ); | 83 | qDebug( "received message from daemon." ); |
84 | 84 | ||
85 | char buffer[128]; | 85 | char buffer[128]; |
86 | 86 | ||
87 | int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) ); | 87 | int result = wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); |
88 | qDebug( "received %d from recvcomm", result ); | 88 | qDebug( "received %d from recvcomm", result ); |
89 | 89 | ||
90 | /* | 90 | /* |
91 | typedef struct { | 91 | typedef struct { |
92 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc | 92 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc |
93 | int ssid_len; Length of SSID | 93 | int ssid_len; Length of SSID |
94 | int channel; Channel | 94 | int channel; Channel |
95 | int wep; 1 = WEP enabled ; 0 = disabled | 95 | int wep; 1 = WEP enabled ; 0 = disabled |
96 | char mac[64]; MAC address of Accesspoint | 96 | char mac[64]; MAC address of Accesspoint |
97 | char bssid[128]; BSSID of Accesspoint | 97 | char bssid[128]; BSSID of Accesspoint |
98 | } wl_network_t; | 98 | } wl_network_t; |
99 | */ | 99 | */ |
100 | 100 | ||
101 | // qDebug( "Sniffer sent: '%s'", (const char*) buffer ); | 101 | // qDebug( "Sniffer sent: '%s'", (const char*) buffer ); |
102 | hexwindow->log( (const char*) &buffer ); | 102 | hexwindow->log( (const char*) &buffer ); |
103 | 103 | ||
104 | if ( result == NETFOUND ) /* new network found */ | 104 | if ( result == NETFOUND ) /* new network found */ |
105 | { | 105 | { |
106 | qDebug( "Sniffer said: new network found." ); | 106 | qDebug( "Sniffer said: new network found." ); |
107 | wl_network_t n; | 107 | wl_network_t n; |
108 | get_network_found( &n, (char*) &buffer ); | 108 | get_network_found( &n, (char*) &buffer ); |
109 | 109 | ||
110 | qDebug( "Sniffer said: net_type is %d.", n.net_type ); | 110 | qDebug( "Sniffer said: net_type is %d.", n.net_type ); |
111 | qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); | 111 | qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); |
112 | 112 | ||
113 | //n.bssid[n.ssid_len] = "\0"; | 113 | //n.bssid[n.ssid_len] = "\0"; |
114 | 114 | ||
115 | QString type; | 115 | QString type; |
116 | 116 | ||
117 | if ( n.net_type == 1 ) | 117 | if ( n.net_type == 1 ) |
118 | type = "managed"; | 118 | type = "managed"; |
119 | else | 119 | else |
120 | type = "adhoc"; | 120 | type = "adhoc"; |
121 | 121 | ||
122 | addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); | 122 | addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); |
123 | 123 | ||
124 | } | 124 | } |
125 | 125 | ||
126 | else | 126 | else |
127 | 127 | ||
128 | { | 128 | { |
129 | qDebug( "unknown sniffer command." ); | 129 | qDebug( "unknown sniffer command." ); |
130 | } | 130 | } |
131 | 131 | ||
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | bool Wellenreiter::hasMessage() | 135 | bool Wellenreiter::hasMessage() |
136 | { | 136 | { |
137 | 137 | ||
138 | // FIXME: do this in libwellenreiter, not here!!! | 138 | // FIXME: do this in libwellenreiter, not here!!! |
139 | 139 | ||
140 | fd_set rfds; | 140 | fd_set rfds; |
141 | FD_ZERO( &rfds ); | 141 | FD_ZERO( &rfds ); |
142 | FD_SET( daemon_fd, &rfds ); | 142 | FD_SET( daemon_fd, &rfds ); |
143 | struct timeval tv; | 143 | struct timeval tv; |
144 | tv.tv_sec = 0; | 144 | tv.tv_sec = 0; |
145 | tv.tv_usec = 10; | 145 | tv.tv_usec = 10; |
146 | int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); | 146 | int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); |
147 | 147 | ||
148 | if ( result == 0 ) | 148 | if ( result == 0 ) |
149 | { | 149 | { |
150 | return false; | 150 | return false; |
151 | } | 151 | } |
152 | else if ( result == -1 ) | 152 | else if ( result == -1 ) |
153 | { | 153 | { |
154 | qDebug( "selected returned: %s", strerror( errno ) ); | 154 | qDebug( "selected returned: %s", strerror( errno ) ); |
155 | return false; | 155 | return false; |
156 | } | 156 | } |
157 | else | 157 | else |
158 | return true; //FD_ISSET( daemon_fd, &rfds ); gibbet 'eh nur einen Deskriptor | 158 | return true; //FD_ISSET( daemon_fd, &rfds ); gibbet 'eh nur einen Deskriptor |
159 | } | 159 | } |
160 | 160 | ||
161 | void Wellenreiter::timerEvent( QTimerEvent* e ) | 161 | void Wellenreiter::timerEvent( QTimerEvent* e ) |
162 | { | 162 | { |
163 | //qDebug( "checking for message..." ); | 163 | //qDebug( "checking for message..." ); |
164 | if ( hasMessage() ) | 164 | if ( hasMessage() ) |
165 | { | 165 | { |
166 | //qDebug( "got message from daemon" ); | 166 | //qDebug( "got message from daemon" ); |
167 | handleMessage(); | 167 | handleMessage(); |
168 | } | 168 | } |
169 | else | 169 | else |
170 | { | 170 | { |
171 | //qDebug( "no message..." ); | 171 | //qDebug( "no message..." ); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 175 | void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
176 | { | 176 | { |
177 | // FIXME: this code belongs in customized QListView, not into this class | 177 | // FIXME: this code belongs in customized QListView, not into this class |
178 | // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) | 178 | // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) |
179 | 179 | ||
180 | qDebug( "Wellenreiter::addNewItem( %s / %s / %s [%d]", | 180 | qDebug( "Wellenreiter::addNewItem( %s / %s / %s [%d]", |
181 | (const char*) type, | 181 | (const char*) type, |
182 | (const char*) essid, | 182 | (const char*) essid, |
183 | (const char*) macaddr, | 183 | (const char*) macaddr, |
184 | channel ); | 184 | channel ); |
185 | 185 | ||
186 | // search, if we already have seen this net | 186 | // search, if we already have seen this net |
187 | 187 | ||
188 | QString s; | 188 | QString s; |
189 | MScanListItem* network; | 189 | MScanListItem* network; |
190 | MScanListItem* item = static_cast<MScanListItem*> ( netview->firstChild() ); | 190 | MScanListItem* item = static_cast<MScanListItem*> ( netview->firstChild() ); |
191 | 191 | ||
192 | while ( item && ( item->text( 0 ) != essid ) ) | 192 | while ( item && ( item->text( 0 ) != essid ) ) |
193 | { | 193 | { |
194 | qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); | 194 | qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); |
195 | item = static_cast<MScanListItem*> ( item->itemBelow() ); | 195 | item = static_cast<MScanListItem*> ( item->itemBelow() ); |
196 | } | 196 | } |
197 | if ( item ) | 197 | if ( item ) |
198 | { | 198 | { |
199 | // we have already seen this net, check all childs if MAC exists | 199 | // we have already seen this net, check all childs if MAC exists |
200 | 200 | ||
201 | network = item; | 201 | network = item; |
202 | 202 | ||
203 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 203 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
204 | assert( item ); // this shouldn't fail | 204 | assert( item ); // this shouldn't fail |
205 | 205 | ||
206 | while ( item && ( item->text( 2 ) != macaddr ) ) | 206 | while ( item && ( item->text( 2 ) != macaddr ) ) |
207 | { | 207 | { |
208 | qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); | 208 | qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); |
209 | item = static_cast<MScanListItem*> ( item->itemBelow() ); | 209 | item = static_cast<MScanListItem*> ( item->itemBelow() ); |
210 | } | 210 | } |
211 | 211 | ||
212 | if ( item ) | 212 | if ( item ) |
213 | { | 213 | { |
214 | // we have already seen this item, it's a dupe | 214 | // we have already seen this item, it's a dupe |
215 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 215 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
216 | return; | 216 | return; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | else | 219 | else |
220 | { | 220 | { |
221 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); | 221 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); |
222 | logwindow->log( s ); | 222 | logwindow->log( s ); |
223 | 223 | ||
224 | network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 ); | 224 | network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 ); |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
228 | // insert new station as child from network | 228 | // insert new station as child from network |
229 | 229 | ||
230 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 230 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
231 | 231 | ||
232 | qDebug( "inserting new station %s", (const char*) macaddr ); | 232 | qDebug( "inserting new station %s", (const char*) macaddr ); |
233 | 233 | ||
234 | new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 234 | new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
235 | 235 | ||
236 | if ( type == "managed" ) | 236 | if ( type == "managed" ) |
237 | { | 237 | { |
238 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); | 238 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); |
239 | } | 239 | } |
240 | else | 240 | else |
241 | { | 241 | { |
242 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); | 242 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); |
243 | } | 243 | } |
244 | 244 | ||
245 | logwindow->log( s ); | 245 | logwindow->log( s ); |
246 | 246 | ||
247 | } | 247 | } |
248 | 248 | ||
249 | void Wellenreiter::buttonClicked() | 249 | void Wellenreiter::buttonClicked() |
250 | { | 250 | { |
251 | if ( daemonRunning ) | 251 | if ( daemonRunning ) |
252 | { | 252 | { |
253 | logwindow->log( "(i) Daemon has been stopped." ); | 253 | logwindow->log( "(i) Daemon has been stopped." ); |
254 | button->setText( "Start Scanning" ); | 254 | button->setText( "Start Scanning" ); |
255 | 255 | ||
256 | // Stop daemon - ugly for now... later better | 256 | // Stop daemon - ugly for now... later better |
257 | 257 | ||
258 | system( "killall orinoco_hopper" ); | 258 | system( "killall orinoco_hopper" ); |
259 | system( "killall wellenreiterd" ); | 259 | system( "killall wellenreiterd" ); |
260 | 260 | ||
261 | // FIXME: reset the card trying to get into a usable state again | 261 | // FIXME: reset the card trying to get into a usable state again |
262 | 262 | ||
263 | // for now, just message the user | 263 | // for now, just message the user |
264 | 264 | ||
265 | QMessageBox::information( this, "Wellenreiter/Opie", "You should reset your\ndevice before using it again." ); | 265 | QMessageBox::information( this, "Wellenreiter/Opie", "You should reset your\ndevice before using it again." ); |
266 | } | 266 | } |
267 | 267 | ||
268 | else | 268 | else |
269 | { | 269 | { |
270 | 270 | ||
271 | logwindow->log( "(i) Daemon has been started." ); | 271 | logwindow->log( "(i) Daemon has been started." ); |
272 | daemonRunning = true; | 272 | daemonRunning = true; |
273 | button->setText( "Stop Scanning" ); | 273 | button->setText( "Stop Scanning" ); |
274 | 274 | ||
275 | // get configuration from config window | 275 | // get configuration from config window |
276 | 276 | ||
277 | const QString& interface = configwindow->interfaceName->currentText(); | 277 | const QString& interface = configwindow->interfaceName->currentText(); |
278 | const QString& cardtype = configwindow->deviceType->currentText(); | 278 | const QString& cardtype = configwindow->deviceType->currentText(); |
279 | const QString& interval = configwindow->hopInterval->cleanText(); | 279 | const QString& interval = configwindow->hopInterval->cleanText(); |
280 | 280 | ||
281 | if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) | 281 | if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) |
282 | { | 282 | { |
283 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); | 283 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); |
284 | return; | 284 | return; |
285 | } | 285 | } |
286 | 286 | ||
287 | // set interface into monitor mode | 287 | // set interface into monitor mode |
288 | /* Global::Execute definitely does not work very well with non-gui stuff! :( */ | 288 | /* Global::Execute definitely does not work very well with non-gui stuff! :( */ |
289 | 289 | ||
290 | QString cmdline; | 290 | QString cmdline; |
291 | 291 | ||
292 | cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); | 292 | cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); |
293 | system( cmdline ); | 293 | system( cmdline ); |
294 | cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); | 294 | cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); |
295 | system( cmdline ); | 295 | system( cmdline ); |
296 | 296 | ||
297 | // start channel hopper | 297 | // start channel hopper |
298 | 298 | ||
299 | cmdline = "orinoco_hopper "; | 299 | cmdline = "orinoco_hopper "; |
300 | cmdline += interface; | 300 | cmdline += interface; |
301 | cmdline += " -i "; | 301 | cmdline += " -i "; |
302 | cmdline += interval; | 302 | cmdline += interval; |
303 | cmdline += " &"; | 303 | cmdline += " &"; |
304 | qDebug( "execute: %s", (const char*) cmdline ); | 304 | qDebug( "execute: %s", (const char*) cmdline ); |
305 | system( cmdline ); | 305 | system( cmdline ); |
306 | qDebug( "done" ); | 306 | qDebug( "done" ); |
307 | 307 | ||
308 | // start daemon | 308 | // start daemon |
309 | 309 | ||
310 | cmdline = "wellenreiterd "; | 310 | cmdline = "wellenreiterd "; |
311 | cmdline += interface; | 311 | cmdline += interface; |
312 | cmdline += " 3"; | 312 | cmdline += " 3"; |
313 | cmdline += " &"; | 313 | cmdline += " &"; |
314 | 314 | ||
315 | qDebug( "execute: %s", (const char*) cmdline ); | 315 | qDebug( "execute: %s", (const char*) cmdline ); |
316 | system( cmdline ); | 316 | system( cmdline ); |
317 | qDebug( "done" ); | 317 | qDebug( "done" ); |
318 | 318 | ||
319 | /* | 319 | /* |
320 | 320 | ||
321 | // add some test stations, so that we can see if the GUI part works | 321 | // add some test stations, so that we can see if the GUI part works |
322 | 322 | ||
323 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); | 323 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); |
324 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); | 324 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); |
325 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); | 325 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); |
326 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); | 326 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); |
327 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); | 327 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); |
328 | 328 | ||
329 | QString command ("98"); | 329 | QString command ("98"); |
330 | 330 | ||
331 | //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); | 331 | //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); |
332 | 332 | ||
333 | */ | 333 | */ |
334 | } | 334 | } |
335 | } | 335 | } |