-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 80 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 98 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 2 |
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 | |||
@@ -10,39 +10,48 @@ | |||
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>240</width> | 14 | <width>232</width> |
15 | <height>276</height> | 15 | <height>267</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
22 | <vbox> | 28 | <vbox> |
23 | <property stdset="1"> | 29 | <property stdset="1"> |
24 | <name>margin</name> | 30 | <name>margin</name> |
25 | <number>11</number> | 31 | <number>4</number> |
26 | </property> | 32 | </property> |
27 | <property stdset="1"> | 33 | <property stdset="1"> |
28 | <name>spacing</name> | 34 | <name>spacing</name> |
29 | <number>6</number> | 35 | <number>0</number> |
30 | </property> | 36 | </property> |
31 | <widget> | 37 | <widget> |
32 | <class>QLayoutWidget</class> | 38 | <class>QLayoutWidget</class> |
33 | <property stdset="1"> | 39 | <property stdset="1"> |
34 | <name>name</name> | 40 | <name>name</name> |
35 | <cstring>Layout5</cstring> | 41 | <cstring>Layout5</cstring> |
36 | </property> | 42 | </property> |
43 | <property> | ||
44 | <name>layoutSpacing</name> | ||
45 | </property> | ||
37 | <hbox> | 46 | <hbox> |
38 | <property stdset="1"> | 47 | <property stdset="1"> |
39 | <name>margin</name> | 48 | <name>margin</name> |
40 | <number>0</number> | 49 | <number>0</number> |
41 | </property> | 50 | </property> |
42 | <property stdset="1"> | 51 | <property stdset="1"> |
43 | <name>spacing</name> | 52 | <name>spacing</name> |
44 | <number>6</number> | 53 | <number>2</number> |
45 | </property> | 54 | </property> |
46 | <widget> | 55 | <widget> |
47 | <class>QLabel</class> | 56 | <class>QLabel</class> |
48 | <property stdset="1"> | 57 | <property stdset="1"> |
@@ -79,16 +88,19 @@ | |||
79 | <property stdset="1"> | 88 | <property stdset="1"> |
80 | <name>name</name> | 89 | <name>name</name> |
81 | <cstring>Layout7</cstring> | 90 | <cstring>Layout7</cstring> |
82 | </property> | 91 | </property> |
92 | <property> | ||
93 | <name>layoutSpacing</name> | ||
94 | </property> | ||
83 | <grid> | 95 | <grid> |
84 | <property stdset="1"> | 96 | <property stdset="1"> |
85 | <name>margin</name> | 97 | <name>margin</name> |
86 | <number>0</number> | 98 | <number>0</number> |
87 | </property> | 99 | </property> |
88 | <property stdset="1"> | 100 | <property stdset="1"> |
89 | <name>spacing</name> | 101 | <name>spacing</name> |
90 | <number>6</number> | 102 | <number>2</number> |
91 | </property> | 103 | </property> |
92 | <widget row="0" column="0" > | 104 | <widget row="0" column="0" > |
93 | <class>QComboBox</class> | 105 | <class>QComboBox</class> |
94 | <item> | 106 | <item> |
@@ -138,9 +150,9 @@ | |||
138 | <cstring>interfaceName</cstring> | 150 | <cstring>interfaceName</cstring> |
139 | </property> | 151 | </property> |
140 | <property stdset="1"> | 152 | <property stdset="1"> |
141 | <name>enabled</name> | 153 | <name>enabled</name> |
142 | <bool>false</bool> | 154 | <bool>true</bool> |
143 | </property> | 155 | </property> |
144 | </widget> | 156 | </widget> |
145 | <widget row="4" column="0" rowspan="1" colspan="2" > | 157 | <widget row="4" column="0" rowspan="1" colspan="2" > |
146 | <class>QCheckBox</class> | 158 | <class>QCheckBox</class> |
@@ -194,9 +206,9 @@ | |||
194 | <cstring>deviceType</cstring> | 206 | <cstring>deviceType</cstring> |
195 | </property> | 207 | </property> |
196 | <property stdset="1"> | 208 | <property stdset="1"> |
197 | <name>enabled</name> | 209 | <name>enabled</name> |
198 | <bool>false</bool> | 210 | <bool>true</bool> |
199 | </property> | 211 | </property> |
200 | </widget> | 212 | </widget> |
201 | <widget row="3" column="0" rowspan="1" colspan="2" > | 213 | <widget row="3" column="0" rowspan="1" colspan="2" > |
202 | <class>QCheckBox</class> | 214 | <class>QCheckBox</class> |
@@ -220,9 +232,9 @@ | |||
220 | <cstring>hopInterval</cstring> | 232 | <cstring>hopInterval</cstring> |
221 | </property> | 233 | </property> |
222 | <property stdset="1"> | 234 | <property stdset="1"> |
223 | <name>enabled</name> | 235 | <name>enabled</name> |
224 | <bool>false</bool> | 236 | <bool>true</bool> |
225 | </property> | 237 | </property> |
226 | <property stdset="1"> | 238 | <property stdset="1"> |
227 | <name>suffix</name> | 239 | <name>suffix</name> |
228 | <string> ms</string> | 240 | <string> ms</string> |
@@ -247,9 +259,9 @@ | |||
247 | <cstring>TextLabel3_3</cstring> | 259 | <cstring>TextLabel3_3</cstring> |
248 | </property> | 260 | </property> |
249 | <property stdset="1"> | 261 | <property stdset="1"> |
250 | <name>enabled</name> | 262 | <name>enabled</name> |
251 | <bool>false</bool> | 263 | <bool>true</bool> |
252 | </property> | 264 | </property> |
253 | <property stdset="1"> | 265 | <property stdset="1"> |
254 | <name>text</name> | 266 | <name>text</name> |
255 | <string>Hop Interval</string> | 267 | <string>Hop Interval</string> |
@@ -262,9 +274,9 @@ | |||
262 | <cstring>TextLabel2_3</cstring> | 274 | <cstring>TextLabel2_3</cstring> |
263 | </property> | 275 | </property> |
264 | <property stdset="1"> | 276 | <property stdset="1"> |
265 | <name>enabled</name> | 277 | <name>enabled</name> |
266 | <bool>false</bool> | 278 | <bool>true</bool> |
267 | </property> | 279 | </property> |
268 | <property stdset="1"> | 280 | <property stdset="1"> |
269 | <name>text</name> | 281 | <name>text</name> |
270 | <string>Device Type</string> | 282 | <string>Device Type</string> |
@@ -277,9 +289,9 @@ | |||
277 | <cstring>TextLabel1_2</cstring> | 289 | <cstring>TextLabel1_2</cstring> |
278 | </property> | 290 | </property> |
279 | <property stdset="1"> | 291 | <property stdset="1"> |
280 | <name>enabled</name> | 292 | <name>enabled</name> |
281 | <bool>false</bool> | 293 | <bool>true</bool> |
282 | </property> | 294 | </property> |
283 | <property stdset="1"> | 295 | <property stdset="1"> |
284 | <name>text</name> | 296 | <name>text</name> |
285 | <string>Interface Name</string> | 297 | <string>Interface Name</string> |
@@ -292,16 +304,19 @@ | |||
292 | <property stdset="1"> | 304 | <property stdset="1"> |
293 | <name>name</name> | 305 | <name>name</name> |
294 | <cstring>Layout6</cstring> | 306 | <cstring>Layout6</cstring> |
295 | </property> | 307 | </property> |
308 | <property> | ||
309 | <name>layoutSpacing</name> | ||
310 | </property> | ||
296 | <hbox> | 311 | <hbox> |
297 | <property stdset="1"> | 312 | <property stdset="1"> |
298 | <name>margin</name> | 313 | <name>margin</name> |
299 | <number>0</number> | 314 | <number>0</number> |
300 | </property> | 315 | </property> |
301 | <property stdset="1"> | 316 | <property stdset="1"> |
302 | <name>spacing</name> | 317 | <name>spacing</name> |
303 | <number>6</number> | 318 | <number>2</number> |
304 | </property> | 319 | </property> |
305 | <widget> | 320 | <widget> |
306 | <class>QLabel</class> | 321 | <class>QLabel</class> |
307 | <property stdset="1"> | 322 | <property stdset="1"> |
@@ -336,18 +351,21 @@ | |||
336 | <widget> | 351 | <widget> |
337 | <class>QLayoutWidget</class> | 352 | <class>QLayoutWidget</class> |
338 | <property stdset="1"> | 353 | <property stdset="1"> |
339 | <name>name</name> | 354 | <name>name</name> |
340 | <cstring>Layout8</cstring> | 355 | <cstring>Layout5</cstring> |
356 | </property> | ||
357 | <property> | ||
358 | <name>layoutSpacing</name> | ||
341 | </property> | 359 | </property> |
342 | <vbox> | 360 | <vbox> |
343 | <property stdset="1"> | 361 | <property stdset="1"> |
344 | <name>margin</name> | 362 | <name>margin</name> |
345 | <number>0</number> | 363 | <number>0</number> |
346 | </property> | 364 | </property> |
347 | <property stdset="1"> | 365 | <property stdset="1"> |
348 | <name>spacing</name> | 366 | <name>spacing</name> |
349 | <number>6</number> | 367 | <number>-1</number> |
350 | </property> | 368 | </property> |
351 | <widget> | 369 | <widget> |
352 | <class>QCheckBox</class> | 370 | <class>QCheckBox</class> |
353 | <property stdset="1"> | 371 | <property stdset="1"> |
@@ -377,9 +395,41 @@ | |||
377 | <name>text</name> | 395 | <name>text</name> |
378 | <string>Enable Activity Display</string> | 396 | <string>Enable Activity Display</string> |
379 | </property> | 397 | </property> |
380 | </widget> | 398 | </widget> |
399 | <widget> | ||
400 | <class>QCheckBox</class> | ||
401 | <property stdset="1"> | ||
402 | <name>name</name> | ||
403 | <cstring>beepOnFound</cstring> | ||
404 | </property> | ||
405 | <property stdset="1"> | ||
406 | <name>text</name> | ||
407 | <string>Beep on new network</string> | ||
408 | </property> | ||
409 | </widget> | ||
381 | </vbox> | 410 | </vbox> |
382 | </widget> | 411 | </widget> |
412 | <spacer> | ||
413 | <property> | ||
414 | <name>name</name> | ||
415 | <cstring>Spacer2</cstring> | ||
416 | </property> | ||
417 | <property stdset="1"> | ||
418 | <name>orientation</name> | ||
419 | <enum>Vertical</enum> | ||
420 | </property> | ||
421 | <property stdset="1"> | ||
422 | <name>sizeType</name> | ||
423 | <enum>Expanding</enum> | ||
424 | </property> | ||
425 | <property> | ||
426 | <name>sizeHint</name> | ||
427 | <size> | ||
428 | <width>20</width> | ||
429 | <height>20</height> | ||
430 | </size> | ||
431 | </property> | ||
432 | </spacer> | ||
383 | </vbox> | 433 | </vbox> |
384 | </widget> | 434 | </widget> |
385 | </UI> | 435 | </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 | |||
@@ -23,8 +23,9 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase | |||
23 | 23 | ||
24 | public: | 24 | public: |
25 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); | 25 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); |
26 | 26 | ||
27 | |||
27 | }; | 28 | }; |
28 | 29 | ||
29 | #endif | 30 | #endif |
30 | 31 | ||
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 | |||
@@ -15,30 +15,41 @@ | |||
15 | 15 | ||
16 | // Qt | 16 | // Qt |
17 | 17 | ||
18 | #include <qpushbutton.h> | 18 | #include <qpushbutton.h> |
19 | #include <qmessagebox.h> | ||
20 | #include <qcombobox.h> | ||
21 | #include <qspinbox.h> | ||
22 | |||
23 | // Qtopia | ||
24 | |||
25 | #ifdef QWS | ||
26 | #include <qpe/global.h> | ||
27 | #endif | ||
19 | 28 | ||
20 | // Standard | 29 | // Standard |
21 | 30 | ||
22 | #include <assert.h> | 31 | #include <assert.h> |
23 | #include <errno.h> | 32 | #include <errno.h> |
24 | #include <unistd.h> | 33 | #include <unistd.h> |
25 | #include <string.h> | 34 | #include <string.h> |
26 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | #include <stdlib.h> | ||
27 | 37 | ||
28 | // Local | 38 | // Local |
29 | 39 | ||
30 | #include "wellenreiter.h" | 40 | #include "wellenreiter.h" |
31 | #include "scanlistitem.h" | 41 | #include "scanlistitem.h" |
32 | #include "logwindow.h" | 42 | #include "logwindow.h" |
33 | #include "hexwindow.h" | 43 | #include "hexwindow.h" |
44 | #include "configwindow.h" | ||
34 | 45 | ||
35 | #include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! | 46 | #include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! |
36 | #include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS! | 47 | #include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS! |
37 | #include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! | 48 | #include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! |
38 | 49 | ||
39 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | 50 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) |
40 | : WellenreiterBase( parent, name, fl ) | 51 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ) |
41 | { | 52 | { |
42 | 53 | ||
43 | logwindow->log( "(i) Wellenreiter has been started." ); | 54 | logwindow->log( "(i) Wellenreiter has been started." ); |
44 | 55 | ||
@@ -148,17 +159,17 @@ bool Wellenreiter::hasMessage() | |||
148 | } | 159 | } |
149 | 160 | ||
150 | void Wellenreiter::timerEvent( QTimerEvent* e ) | 161 | void Wellenreiter::timerEvent( QTimerEvent* e ) |
151 | { | 162 | { |
152 | qDebug( "checking for message..." ); | 163 | //qDebug( "checking for message..." ); |
153 | if ( hasMessage() ) | 164 | if ( hasMessage() ) |
154 | { | 165 | { |
155 | qDebug( "got message" ); | 166 | //qDebug( "got message from daemon" ); |
156 | handleMessage(); | 167 | handleMessage(); |
157 | } | 168 | } |
158 | else | 169 | else |
159 | { | 170 | { |
160 | qDebug( "no message..." ); | 171 | //qDebug( "no message..." ); |
161 | } | 172 | } |
162 | } | 173 | } |
163 | 174 | ||
164 | 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 ) |
@@ -236,22 +247,79 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo | |||
236 | } | 247 | } |
237 | 248 | ||
238 | void Wellenreiter::buttonClicked() | 249 | void Wellenreiter::buttonClicked() |
239 | { | 250 | { |
251 | if ( daemonRunning ) | ||
252 | { | ||
253 | logwindow->log( "(i) Daemon has been stopped." ); | ||
254 | button->setText( "Start Scanning" ); | ||
255 | |||
256 | // Stop daemon | ||
257 | |||
258 | // find out pids of wellenreiterd and orinoco_hopper | ||
259 | |||
260 | } | ||
261 | |||
262 | else | ||
263 | { | ||
264 | |||
265 | // get configuration from config window | ||
266 | |||
267 | const QString& interface = configwindow->interfaceName->currentText(); | ||
268 | const QString& cardtype = configwindow->deviceType->currentText(); | ||
269 | const QString& interval = configwindow->hopInterval->cleanText(); | ||
270 | |||
271 | if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) | ||
272 | { | ||
273 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); | ||
274 | return; | ||
275 | } | ||
276 | |||
277 | logwindow->log( "(i) Daemon has been started." ); | ||
278 | button->setText( "Stop Scanning" ); | ||
279 | |||
280 | #ifdef QWS | ||
281 | |||
282 | // set interface into monitor mode | ||
283 | |||
284 | QString cmdline; | ||
285 | |||
286 | cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); | ||
287 | system( cmdline ); | ||
288 | cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); | ||
289 | system( cmdline ); | ||
290 | |||
291 | // start channel hopper | ||
292 | |||
293 | cmdline = "orinoco_hopper "; | ||
294 | cmdline += interface; | ||
295 | cmdline += " -i "; | ||
296 | cmdline += interval; | ||
297 | //qDebug( "execute: %s", (const char*) cmdline ); | ||
298 | Global::execute( cmdline ); | ||
299 | |||
300 | // start daemon | ||
301 | |||
302 | cmdline = "wellenreiterd "; | ||
303 | cmdline += interface; | ||
304 | cmdline += " 3"; | ||
305 | //qDebug( "execute: %s", (const char*) cmdline ); | ||
306 | Global::execute( cmdline ); | ||
307 | #endif | ||
240 | 308 | ||
241 | // FIXME: communicate with daemon and set button text according to state | 309 | /* |
242 | 310 | ||
243 | button->setText( "Stop Scanning" ); | 311 | // add some test stations, so that we can see if the GUI part works |
244 | 312 | ||
245 | // add some test stations, so that we can see if the GUI part works | 313 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); |
314 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); | ||
315 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); | ||
316 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); | ||
317 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); | ||
246 | 318 | ||
247 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); | 319 | QString command ("98"); |
248 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); | ||
249 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); | ||
250 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); | ||
251 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); | ||
252 | |||
253 | QString command ("98"); | ||
254 | 320 | ||
255 | //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); | 321 | //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); |
256 | 322 | ||
323 | */ | ||
324 | } | ||
257 | } | 325 | } |
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 | |||
@@ -29,8 +29,10 @@ public: | |||
29 | ~Wellenreiter(); | 29 | ~Wellenreiter(); |
30 | 30 | ||
31 | protected: | 31 | protected: |
32 | virtual void timerEvent( QTimerEvent* ); | 32 | virtual void timerEvent( QTimerEvent* ); |
33 | |||
34 | bool daemonRunning; | ||
33 | 35 | ||
34 | public slots: | 36 | public slots: |
35 | void buttonClicked(); | 37 | void buttonClicked(); |
36 | void addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal ); | 38 | void addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal ); |