Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 98 |
1 files changed, 83 insertions, 15 deletions
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 | |||
@@ -18,2 +18,11 @@ | |||
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 | ||
@@ -26,2 +35,3 @@ | |||
26 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | #include <stdlib.h> | ||
27 | 37 | ||
@@ -33,2 +43,3 @@ | |||
33 | #include "hexwindow.h" | 43 | #include "hexwindow.h" |
44 | #include "configwindow.h" | ||
34 | 45 | ||
@@ -39,3 +50,3 @@ | |||
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 | { |
@@ -151,6 +162,6 @@ 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(); |
@@ -159,3 +170,3 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) | |||
159 | { | 170 | { |
160 | qDebug( "no message..." ); | 171 | //qDebug( "no message..." ); |
161 | } | 172 | } |
@@ -239,19 +250,76 @@ 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 | } |