author | mickeyl <mickeyl> | 2003-03-31 14:30:17 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-31 14:30:17 (UTC) |
commit | 13e8e8cbaede72948d3901a1a903eba43854d770 (patch) (unidiff) | |
tree | 672679ac87efdfecd4755f712cfd11c2d2abad43 /noncore | |
parent | e609b9726786efe7cd5be0cd6d8d9f4d91703da5 (diff) | |
download | opie-13e8e8cbaede72948d3901a1a903eba43854d770.zip opie-13e8e8cbaede72948d3901a1a903eba43854d770.tar.gz opie-13e8e8cbaede72948d3901a1a903eba43854d770.tar.bz2 |
- initial attempt to autodetect driver
- add possibility to play sounds when receiving beacon and/or found a new network
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 155 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 32 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 24 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 16 |
6 files changed, 166 insertions, 72 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index fa727f9..dda7ba0 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -2,42 +2,42 @@ | |||
2 | <class>WellenreiterConfigBase</class> | 2 | <class>WellenreiterConfigBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WellenreiterConfigBase</cstring> | 7 | <cstring>WellenreiterConfigBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
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>212</width> | 14 | <width>220</width> |
15 | <height>267</height> | 15 | <height>306</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> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>4</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>1</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLayoutWidget</class> | 38 | <class>QLayoutWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Layout5</cstring> | 41 | <cstring>Layout5</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
@@ -316,100 +316,145 @@ | |||
316 | <property stdset="1"> | 316 | <property stdset="1"> |
317 | <name>name</name> | 317 | <name>name</name> |
318 | <cstring>Line9_2</cstring> | 318 | <cstring>Line9_2</cstring> |
319 | </property> | 319 | </property> |
320 | <property stdset="1"> | 320 | <property stdset="1"> |
321 | <name>orientation</name> | 321 | <name>orientation</name> |
322 | <enum>Horizontal</enum> | 322 | <enum>Horizontal</enum> |
323 | </property> | 323 | </property> |
324 | </widget> | 324 | </widget> |
325 | </hbox> | 325 | </hbox> |
326 | </widget> | 326 | </widget> |
327 | <widget> | 327 | <widget> |
328 | <class>QCheckBox</class> | ||
329 | <property stdset="1"> | ||
330 | <name>name</name> | ||
331 | <cstring>groupNetworks</cstring> | ||
332 | </property> | ||
333 | <property stdset="1"> | ||
334 | <name>enabled</name> | ||
335 | <bool>false</bool> | ||
336 | </property> | ||
337 | <property stdset="1"> | ||
338 | <name>text</name> | ||
339 | <string>Group Detected Networks</string> | ||
340 | </property> | ||
341 | </widget> | ||
342 | <widget> | ||
343 | <class>QCheckBox</class> | ||
344 | <property stdset="1"> | ||
345 | <name>name</name> | ||
346 | <cstring>enableActivity</cstring> | ||
347 | </property> | ||
348 | <property stdset="1"> | ||
349 | <name>enabled</name> | ||
350 | <bool>false</bool> | ||
351 | </property> | ||
352 | <property stdset="1"> | ||
353 | <name>text</name> | ||
354 | <string>Enable Activity Display</string> | ||
355 | </property> | ||
356 | </widget> | ||
357 | <widget> | ||
328 | <class>QLayoutWidget</class> | 358 | <class>QLayoutWidget</class> |
329 | <property stdset="1"> | 359 | <property stdset="1"> |
330 | <name>name</name> | 360 | <name>name</name> |
331 | <cstring>Layout5</cstring> | 361 | <cstring>Layout5</cstring> |
332 | </property> | 362 | </property> |
333 | <property> | 363 | <grid> |
334 | <name>layoutSpacing</name> | ||
335 | </property> | ||
336 | <vbox> | ||
337 | <property stdset="1"> | 364 | <property stdset="1"> |
338 | <name>margin</name> | 365 | <name>margin</name> |
339 | <number>0</number> | 366 | <number>0</number> |
340 | </property> | 367 | </property> |
341 | <property stdset="1"> | 368 | <property stdset="1"> |
342 | <name>spacing</name> | 369 | <name>spacing</name> |
343 | <number>-1</number> | 370 | <number>6</number> |
344 | </property> | 371 | </property> |
345 | <widget> | 372 | <widget row="0" column="1" > |
346 | <class>QCheckBox</class> | 373 | <class>QLabel</class> |
347 | <property stdset="1"> | 374 | <property stdset="1"> |
348 | <name>name</name> | 375 | <name>name</name> |
349 | <cstring>groupNetworks</cstring> | 376 | <cstring>TextLabel1</cstring> |
350 | </property> | ||
351 | <property stdset="1"> | ||
352 | <name>enabled</name> | ||
353 | <bool>false</bool> | ||
354 | </property> | 377 | </property> |
355 | <property stdset="1"> | 378 | <property stdset="1"> |
356 | <name>text</name> | 379 | <name>text</name> |
357 | <string>Group Detected Networks</string> | 380 | <string>sound on new net</string> |
358 | </property> | 381 | </property> |
359 | </widget> | 382 | </widget> |
360 | <widget> | 383 | <widget row="1" column="0" > |
361 | <class>QCheckBox</class> | 384 | <class>QComboBox</class> |
385 | <item> | ||
386 | <property> | ||
387 | <name>text</name> | ||
388 | <string>Ignore</string> | ||
389 | </property> | ||
390 | </item> | ||
391 | <item> | ||
392 | <property> | ||
393 | <name>text</name> | ||
394 | <string>Touch</string> | ||
395 | </property> | ||
396 | </item> | ||
397 | <item> | ||
398 | <property> | ||
399 | <name>text</name> | ||
400 | <string>Key</string> | ||
401 | </property> | ||
402 | </item> | ||
403 | <item> | ||
404 | <property> | ||
405 | <name>text</name> | ||
406 | <string>Alarm</string> | ||
407 | </property> | ||
408 | </item> | ||
362 | <property stdset="1"> | 409 | <property stdset="1"> |
363 | <name>name</name> | 410 | <name>name</name> |
364 | <cstring>enableActivity</cstring> | 411 | <cstring>beaconSound</cstring> |
365 | </property> | ||
366 | <property stdset="1"> | ||
367 | <name>enabled</name> | ||
368 | <bool>false</bool> | ||
369 | </property> | ||
370 | <property stdset="1"> | ||
371 | <name>text</name> | ||
372 | <string>Enable Activity Display</string> | ||
373 | </property> | 412 | </property> |
374 | </widget> | 413 | </widget> |
375 | <widget> | 414 | <widget row="0" column="0" > |
376 | <class>QCheckBox</class> | 415 | <class>QComboBox</class> |
416 | <item> | ||
417 | <property> | ||
418 | <name>text</name> | ||
419 | <string>Ignore</string> | ||
420 | </property> | ||
421 | </item> | ||
422 | <item> | ||
423 | <property> | ||
424 | <name>text</name> | ||
425 | <string>Touch</string> | ||
426 | </property> | ||
427 | </item> | ||
428 | <item> | ||
429 | <property> | ||
430 | <name>text</name> | ||
431 | <string>Key</string> | ||
432 | </property> | ||
433 | </item> | ||
434 | <item> | ||
435 | <property> | ||
436 | <name>text</name> | ||
437 | <string>Alarm</string> | ||
438 | </property> | ||
439 | </item> | ||
377 | <property stdset="1"> | 440 | <property stdset="1"> |
378 | <name>name</name> | 441 | <name>name</name> |
379 | <cstring>beepOnFound</cstring> | 442 | <cstring>netSound</cstring> |
380 | </property> | 443 | </property> |
444 | </widget> | ||
445 | <widget row="1" column="1" > | ||
446 | <class>QLabel</class> | ||
381 | <property stdset="1"> | 447 | <property stdset="1"> |
382 | <name>enabled</name> | 448 | <name>name</name> |
383 | <bool>false</bool> | 449 | <cstring>TextLabel1_3</cstring> |
384 | </property> | 450 | </property> |
385 | <property stdset="1"> | 451 | <property stdset="1"> |
386 | <name>text</name> | 452 | <name>text</name> |
387 | <string>Beep on new network</string> | 453 | <string>sound on beacon</string> |
388 | </property> | 454 | </property> |
389 | </widget> | 455 | </widget> |
390 | </vbox> | 456 | </grid> |
391 | </widget> | 457 | </widget> |
392 | <spacer> | ||
393 | <property> | ||
394 | <name>name</name> | ||
395 | <cstring>Spacer2</cstring> | ||
396 | </property> | ||
397 | <property stdset="1"> | ||
398 | <name>orientation</name> | ||
399 | <enum>Vertical</enum> | ||
400 | </property> | ||
401 | <property stdset="1"> | ||
402 | <name>sizeType</name> | ||
403 | <enum>Expanding</enum> | ||
404 | </property> | ||
405 | <property> | ||
406 | <name>sizeHint</name> | ||
407 | <size> | ||
408 | <width>20</width> | ||
409 | <height>20</height> | ||
410 | </size> | ||
411 | </property> | ||
412 | </spacer> | ||
413 | </vbox> | 458 | </vbox> |
414 | </widget> | 459 | </widget> |
415 | </UI> | 460 | </UI> |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 6dd862f..e287b47 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -8,58 +8,86 @@ | |||
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 | /* LOCAL */ | 16 | /* LOCAL */ |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | 18 | ||
19 | /* QT */ | 19 | /* QT */ |
20 | #include <qmap.h> | ||
21 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qfile.h> | ||
22 | #include <qlayout.h> | ||
23 | #include <qmap.h> | ||
22 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
23 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
24 | #include <qlayout.h> | 26 | #include <qtextstream.h> |
25 | 27 | ||
26 | /* OPIE */ | 28 | /* OPIE */ |
27 | #include <opie2/onetwork.h> | 29 | #include <opie2/onetwork.h> |
28 | 30 | ||
31 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | ||
32 | |||
29 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 33 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
30 | :WellenreiterConfigBase( parent, name, true, f ) | 34 | :WellenreiterConfigBase( parent, name, true, f ) |
31 | { | 35 | { |
32 | _devicetype[ "cisco" ] = 1; | 36 | _devicetype[ "cisco" ] = 1; |
33 | _devicetype[ "wlan-ng" ] = 2; | 37 | _devicetype[ "wlan-ng" ] = 2; |
34 | _devicetype[ "hostap" ] = 3; | 38 | _devicetype[ "hostap" ] = 3; |
35 | _devicetype[ "orinoco" ] = 4; | 39 | _devicetype[ "orinoco" ] = 4; |
36 | _devicetype[ "<manual>" ] = 5; | 40 | _devicetype[ "<manual>" ] = 5; |
37 | 41 | ||
38 | // gather possible interface names from ONetwork | 42 | // gather possible interface names from ONetwork |
39 | ONetwork* net = ONetwork::instance(); | 43 | ONetwork* net = ONetwork::instance(); |
40 | ONetwork::InterfaceIterator it = net->iterator(); | 44 | ONetwork::InterfaceIterator it = net->iterator(); |
41 | while ( it.current() ) | 45 | while ( it.current() ) |
42 | { | 46 | { |
43 | if ( it.current()->isWireless() ) | 47 | if ( it.current()->isWireless() ) |
44 | interfaceName->insertItem( it.current()->name() ); | 48 | interfaceName->insertItem( it.current()->name() ); |
45 | ++it; | 49 | ++it; |
46 | } | 50 | } |
47 | 51 | ||
52 | // try to guess device type | ||
53 | QFile m( "/proc/modules" ); | ||
54 | if ( m.open( IO_ReadOnly ) ) | ||
55 | { | ||
56 | int devicetype(0); | ||
57 | QString line; | ||
58 | QTextStream modules( &m ); | ||
59 | while( !modules.atEnd() && !devicetype ) | ||
60 | { | ||
61 | modules >> line; | ||
62 | if ( line.contains( "cisco" ) ) devicetype = 1; | ||
63 | else if ( line.contains( "wlan" ) ) devicetype = 2; | ||
64 | else if ( line.contains( "hostap" ) ) devicetype = 3; | ||
65 | else if ( line.contains( "orinoco" ) ) devicetype = 4; | ||
66 | } | ||
67 | if ( devicetype ) | ||
68 | { | ||
69 | deviceType->setCurrentItem( devicetype ); | ||
70 | qDebug( "Wellenreiter: guessed device type to be %d", devicetype ); | ||
71 | } | ||
72 | } | ||
73 | |||
48 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | 74 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here |
49 | QPushButton* okButton = new QPushButton( "ok", this ); | 75 | QPushButton* okButton = new QPushButton( "ok", this ); |
50 | okButton->show(); | 76 | okButton->show(); |
51 | Layout5_2->addWidget( okButton ); //FIXME: rename this in configbase.ui | 77 | Layout5_2->addWidget( okButton ); //FIXME: rename this in configbase.ui |
52 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | 78 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
53 | #endif | 79 | #endif |
80 | |||
81 | WellenreiterConfigWindow::_instance = this; | ||
54 | }; | 82 | }; |
55 | 83 | ||
56 | int WellenreiterConfigWindow::daemonDeviceType() | 84 | int WellenreiterConfigWindow::daemonDeviceType() |
57 | { | 85 | { |
58 | QString name = deviceType->currentText(); | 86 | QString name = deviceType->currentText(); |
59 | if ( _devicetype.contains( name ) ) | 87 | if ( _devicetype.contains( name ) ) |
60 | { | 88 | { |
61 | return _devicetype[name]; | 89 | return _devicetype[name]; |
62 | } | 90 | } |
63 | else | 91 | else |
64 | { | 92 | { |
65 | return 0; | 93 | return 0; |
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index c627901..5fd0327 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h | |||
@@ -9,28 +9,36 @@ | |||
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 | #ifndef WELLENREITERCONFIGWINDOW_H | 16 | #ifndef WELLENREITERCONFIGWINDOW_H |
17 | #define WELLENREITERCONFIGWINDOW_H | 17 | #define WELLENREITERCONFIGWINDOW_H |
18 | 18 | ||
19 | #include "configbase.h" | 19 | #include "configbase.h" |
20 | #include <qmap.h> | 20 | #include <qmap.h> |
21 | #include <qcombobox.h> | ||
22 | #include <qstring.h> | ||
23 | |||
24 | class WellenreiterConfigWindow; | ||
21 | 25 | ||
22 | class WellenreiterConfigWindow : public WellenreiterConfigBase | 26 | class WellenreiterConfigWindow : public WellenreiterConfigBase |
23 | { | 27 | { |
24 | 28 | ||
25 | public: | 29 | public: |
26 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); | 30 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); |
27 | int daemonDeviceType(); | 31 | int daemonDeviceType(); |
28 | int daemonHopInterval(); | 32 | int daemonHopInterval(); |
33 | const QString soundOnNetwork() const { return netSound->currentText(); }; | ||
34 | const QString soundOnBeacon() const { return beaconSound->currentText(); }; | ||
35 | static WellenreiterConfigWindow* instance() { return _instance; }; | ||
29 | 36 | ||
30 | protected: | 37 | protected: |
31 | QMap<QString, int> _devicetype; | 38 | QMap<QString, int> _devicetype; |
39 | static WellenreiterConfigWindow* _instance; | ||
32 | 40 | ||
33 | }; | 41 | }; |
34 | 42 | ||
35 | #endif | 43 | #endif |
36 | 44 | ||
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index be1245e..a006a3c 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -5,30 +5,36 @@ | |||
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 | #include "scanlist.h" | 16 | #include "scanlist.h" |
17 | #include "configwindow.h" | ||
17 | 18 | ||
18 | #include <assert.h> | 19 | #include <assert.h> |
19 | #include "manufacturers.h" | 20 | #include "manufacturers.h" |
20 | #include <qdatetime.h> | 21 | #include <qdatetime.h> |
21 | #include <qtextstream.h> | 22 | #include <qtextstream.h> |
22 | 23 | ||
24 | #ifdef QWS | ||
25 | #include <opie/odevice.h> | ||
26 | using namespace Opie; | ||
27 | #endif | ||
28 | |||
23 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 29 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
24 | :OListView( parent, name ), _manufacturerdb( 0 ) | 30 | :OListView( parent, name ), _manufacturerdb( 0 ) |
25 | { | 31 | { |
26 | 32 | ||
27 | setFrameShape( QListView::StyledPanel ); | 33 | setFrameShape( QListView::StyledPanel ); |
28 | setFrameShadow( QListView::Sunken ); | 34 | setFrameShadow( QListView::Sunken ); |
29 | 35 | ||
30 | addColumn( tr( "Net/Station" ) ); | 36 | addColumn( tr( "Net/Station" ) ); |
31 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); | 37 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); |
32 | addColumn( tr( "B" ) ); | 38 | addColumn( tr( "B" ) ); |
33 | setColumnAlignment( 1, AlignCenter ); | 39 | setColumnAlignment( 1, AlignCenter ); |
34 | addColumn( tr( "AP" ) ); | 40 | addColumn( tr( "AP" ) ); |
@@ -133,25 +139,24 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
133 | { | 139 | { |
134 | // we have already seen this item, it's a dupe | 140 | // we have already seen this item, it's a dupe |
135 | #ifdef DEBUG | 141 | #ifdef DEBUG |
136 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 142 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
137 | #endif | 143 | #endif |
138 | item->receivedBeacon(); | 144 | item->receivedBeacon(); |
139 | return; | 145 | return; |
140 | } | 146 | } |
141 | } | 147 | } |
142 | else | 148 | else |
143 | { | 149 | { |
144 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); | 150 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); |
145 | |||
146 | network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); | 151 | network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); |
147 | } | 152 | } |
148 | 153 | ||
149 | 154 | ||
150 | // insert new station as child from network | 155 | // insert new station as child from network |
151 | 156 | ||
152 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 157 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
153 | 158 | ||
154 | qDebug( "inserting new station %s", (const char*) macaddr ); | 159 | qDebug( "inserting new station %s", (const char*) macaddr ); |
155 | 160 | ||
156 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 161 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
157 | if ( _manufacturerdb ) | 162 | if ( _manufacturerdb ) |
@@ -183,24 +188,26 @@ const int col_wep = 4; | |||
183 | const int col_traffic = 5; | 188 | const int col_traffic = 5; |
184 | const int col_manuf = 6; | 189 | const int col_manuf = 6; |
185 | const int col_firstseen = 7; | 190 | const int col_firstseen = 7; |
186 | const int col_lastseen = 8; | 191 | const int col_lastseen = 8; |
187 | 192 | ||
188 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 193 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
189 | bool wep, int channel, int signal ) | 194 | bool wep, int channel, int signal ) |
190 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 195 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
191 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 196 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
192 | _channel( channel ), _signal( signal ), _beacons( 0 ) | 197 | _channel( channel ), _signal( signal ), _beacons( 0 ) |
193 | { | 198 | { |
194 | qDebug( "creating scanlist item" ); | 199 | qDebug( "creating scanlist item" ); |
200 | if ( WellenreiterConfigWindow::instance() && type == "networks" ) | ||
201 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | ||
195 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 202 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
196 | } | 203 | } |
197 | 204 | ||
198 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 205 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
199 | bool wep, int channel, int signal ) | 206 | bool wep, int channel, int signal ) |
200 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 207 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
201 | { | 208 | { |
202 | qDebug( "creating scanlist item" ); | 209 | qDebug( "creating scanlist item" ); |
203 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 210 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
204 | } | 211 | } |
205 | 212 | ||
206 | OListViewItem* MScanListItem::childFactory() | 213 | OListViewItem* MScanListItem::childFactory() |
@@ -262,27 +269,42 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
262 | 269 | ||
263 | listView()->triggerUpdate(); | 270 | listView()->triggerUpdate(); |
264 | 271 | ||
265 | this->type = type; | 272 | this->type = type; |
266 | _type = type; | 273 | _type = type; |
267 | _essid = essid; | 274 | _essid = essid; |
268 | _macaddr = macaddr; | 275 | _macaddr = macaddr; |
269 | _channel = channel; | 276 | _channel = channel; |
270 | _beacons = 0; | 277 | _beacons = 0; |
271 | _signal = 0; | 278 | _signal = 0; |
272 | } | 279 | } |
273 | 280 | ||
281 | |||
274 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 282 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
275 | { | 283 | { |
276 | setText( col_manuf, manufacturer ); | 284 | setText( col_manuf, manufacturer ); |
277 | } | 285 | } |
278 | 286 | ||
287 | |||
288 | void MScanListItem::playSound( const QString& sound ) const | ||
289 | { | ||
290 | #ifdef QWS | ||
291 | if ( sound == "Ignore" ) return; | ||
292 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); | ||
293 | else if ( sound == "Key" ) ODevice::inst()->keySound(); | ||
294 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); | ||
295 | #endif | ||
296 | } | ||
297 | |||
298 | |||
279 | void MScanListItem::receivedBeacon() | 299 | void MScanListItem::receivedBeacon() |
280 | { | 300 | { |
281 | _beacons++; | 301 | _beacons++; |
282 | #ifdef DEBUG | 302 | #ifdef DEBUG |
283 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | 303 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); |
284 | #endif | 304 | #endif |
285 | setText( col_sig, QString::number( _beacons ) ); | 305 | setText( col_sig, QString::number( _beacons ) ); |
286 | setText( col_lastseen, QTime::currentTime().toString() ); | 306 | setText( col_lastseen, QTime::currentTime().toString() ); |
307 | if ( WellenreiterConfigWindow::instance() ) | ||
308 | playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() ); | ||
287 | } | 309 | } |
288 | 310 | ||
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index da9369f..01db172 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -82,24 +82,27 @@ class MScanListItem: public OListViewItem | |||
82 | int signal() { return _signal; }; | 82 | int signal() { return _signal; }; |
83 | int beacons() { return _beacons; }; | 83 | int beacons() { return _beacons; }; |
84 | 84 | ||
85 | void setSignal( int signal ) { /* TODO */ }; | 85 | void setSignal( int signal ) { /* TODO */ }; |
86 | void receivedBeacon(); | 86 | void receivedBeacon(); |
87 | 87 | ||
88 | void setManufacturer( const QString& manufacturer ); | 88 | void setManufacturer( const QString& manufacturer ); |
89 | 89 | ||
90 | virtual OListViewItem* childFactory(); | 90 | virtual OListViewItem* childFactory(); |
91 | virtual void serializeTo( QDataStream& s ) const; | 91 | virtual void serializeTo( QDataStream& s ) const; |
92 | virtual void serializeFrom( QDataStream& s ); | 92 | virtual void serializeFrom( QDataStream& s ); |
93 | 93 | ||
94 | protected: | ||
95 | void playSound( const QString& ) const; | ||
96 | |||
94 | private: | 97 | private: |
95 | QString _type; | 98 | QString _type; |
96 | QString _essid; | 99 | QString _essid; |
97 | QString _macaddr; | 100 | QString _macaddr; |
98 | bool _wep; | 101 | bool _wep; |
99 | int _channel; | 102 | int _channel; |
100 | int _signal; | 103 | int _signal; |
101 | int _beacons; | 104 | int _beacons; |
102 | 105 | ||
103 | }; | 106 | }; |
104 | 107 | ||
105 | //****************************** MScanListViewFactory **************************************************************** | 108 | //****************************** MScanListViewFactory **************************************************************** |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 41ffdcc..d1dd73a 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -101,27 +101,24 @@ Wellenreiter::~Wellenreiter() | |||
101 | 101 | ||
102 | delete manufacturerdb; | 102 | delete manufacturerdb; |
103 | delete pcap; | 103 | delete pcap; |
104 | } | 104 | } |
105 | 105 | ||
106 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 106 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
107 | { | 107 | { |
108 | configwindow = cw; | 108 | configwindow = cw; |
109 | } | 109 | } |
110 | 110 | ||
111 | void Wellenreiter::receivePacket(OPacket* p) | 111 | void Wellenreiter::receivePacket(OPacket* p) |
112 | { | 112 | { |
113 | logwindow->log( "(d) Received data from daemon" ); | ||
114 | //TODO | ||
115 | |||
116 | // check if we received a beacon frame | 113 | // check if we received a beacon frame |
117 | // static_cast is justified here | 114 | // static_cast is justified here |
118 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); | 115 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); |
119 | if ( !beacon ) return; | 116 | if ( !beacon ) return; |
120 | QString type; | 117 | QString type; |
121 | 118 | ||
122 | //FIXME: Can stations in ESS mode can be distinguished from APs? | 119 | //FIXME: Can stations in ESS mode can be distinguished from APs? |
123 | //FIXME: Apparently yes, but not by listening to beacons, because | 120 | //FIXME: Apparently yes, but not by listening to beacons, because |
124 | //FIXME: they simply don't send beacons in infrastructure mode. | 121 | //FIXME: they simply don't send beacons in infrastructure mode. |
125 | //FIXME: so we also have to listen to data packets | 122 | //FIXME: so we also have to listen to data packets |
126 | 123 | ||
127 | if ( beacon->canIBSS() ) | 124 | if ( beacon->canIBSS() ) |
@@ -154,37 +151,28 @@ void Wellenreiter::startStopClicked() | |||
154 | #endif | 151 | #endif |
155 | 152 | ||
156 | // get interface name from config window | 153 | // get interface name from config window |
157 | const QString& interface = configwindow->interfaceName->currentText(); | 154 | const QString& interface = configwindow->interfaceName->currentText(); |
158 | ONetwork* net = ONetwork::instance(); | 155 | ONetwork* net = ONetwork::instance(); |
159 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 156 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
160 | 157 | ||
161 | // switch off monitor mode | 158 | // switch off monitor mode |
162 | iface->setMonitorMode( false ); | 159 | iface->setMonitorMode( false ); |
163 | // switch off promisc flag | 160 | // switch off promisc flag |
164 | iface->setPromiscuousMode( false ); | 161 | iface->setPromiscuousMode( false ); |
165 | 162 | ||
166 | //TODO: Display "please wait..." (use owait?) | 163 | system( "cardctl reset; sleep 1; dhclient; udhcpc" ); //FIXME: Use OProcess |
167 | |||
168 | /* | ||
169 | |||
170 | QString cmdline; | ||
171 | cmdline.sprintf( "ifdown %s; sleep 1; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface ); | ||
172 | system( cmdline ); //FIXME: Use OProcess | ||
173 | |||
174 | */ | ||
175 | 164 | ||
176 | // message the user | 165 | // message the user |
177 | 166 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | |
178 | //QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | ||
179 | } | 167 | } |
180 | 168 | ||
181 | else | 169 | else |
182 | { | 170 | { |
183 | // get configuration from config window | 171 | // get configuration from config window |
184 | 172 | ||
185 | const QString& interface = configwindow->interfaceName->currentText(); | 173 | const QString& interface = configwindow->interfaceName->currentText(); |
186 | const int cardtype = configwindow->daemonDeviceType(); | 174 | const int cardtype = configwindow->daemonDeviceType(); |
187 | const int interval = configwindow->daemonHopInterval(); | 175 | const int interval = configwindow->daemonHopInterval(); |
188 | 176 | ||
189 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 177 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
190 | { | 178 | { |