-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 764ef34..0e95b28 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -224,102 +224,112 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo | |||
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 | 256 | // Stop daemon - ugly for now... later better |
257 | 257 | ||
258 | // find out pids of wellenreiterd and orinoco_hopper | 258 | system( "killall orinoco_hopper" ); |
259 | system( "killall wellenreiterd" ); | ||
259 | 260 | ||
261 | // FIXME: reset the card trying to get into a usable state again | ||
262 | |||
263 | // for now, just message the user | ||
264 | |||
265 | QMessageBox::information( this, "Wellenreiter/Opie", "You should reset your\ndevice before using it again." ); | ||
260 | } | 266 | } |
261 | 267 | ||
262 | else | 268 | else |
263 | { | 269 | { |
264 | 270 | ||
271 | logwindow->log( "(i) Daemon has been started." ); | ||
272 | daemonRunning = true; | ||
273 | button->setText( "Stop Scanning" ); | ||
274 | |||
265 | // get configuration from config window | 275 | // get configuration from config window |
266 | 276 | ||
267 | const QString& interface = configwindow->interfaceName->currentText(); | 277 | const QString& interface = configwindow->interfaceName->currentText(); |
268 | const QString& cardtype = configwindow->deviceType->currentText(); | 278 | const QString& cardtype = configwindow->deviceType->currentText(); |
269 | const QString& interval = configwindow->hopInterval->cleanText(); | 279 | const QString& interval = configwindow->hopInterval->cleanText(); |
270 | 280 | ||
271 | if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) | 281 | if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) |
272 | { | 282 | { |
273 | 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." ); |
274 | return; | 284 | return; |
275 | } | 285 | } |
276 | 286 | ||
277 | logwindow->log( "(i) Daemon has been started." ); | ||
278 | button->setText( "Stop Scanning" ); | ||
279 | |||
280 | #ifdef QWS | ||
281 | |||
282 | // set interface into monitor mode | 287 | // set interface into monitor mode |
288 | /* Global::Execute definitely does not work very well with non-gui stuff! :( */ | ||
283 | 289 | ||
284 | QString cmdline; | 290 | QString cmdline; |
285 | 291 | ||
286 | cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); | 292 | cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); |
287 | system( cmdline ); | 293 | system( cmdline ); |
288 | cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); | 294 | cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); |
289 | system( cmdline ); | 295 | system( cmdline ); |
290 | 296 | ||
291 | // start channel hopper | 297 | // start channel hopper |
292 | 298 | ||
293 | cmdline = "orinoco_hopper "; | 299 | cmdline = "orinoco_hopper "; |
294 | cmdline += interface; | 300 | cmdline += interface; |
295 | cmdline += " -i "; | 301 | cmdline += " -i "; |
296 | cmdline += interval; | 302 | cmdline += interval; |
297 | //qDebug( "execute: %s", (const char*) cmdline ); | 303 | cmdline += " &"; |
298 | Global::execute( cmdline ); | 304 | qDebug( "execute: %s", (const char*) cmdline ); |
305 | system( cmdline ); | ||
306 | qDebug( "done" ); | ||
299 | 307 | ||
300 | // start daemon | 308 | // start daemon |
301 | 309 | ||
302 | cmdline = "wellenreiterd "; | 310 | cmdline = "wellenreiterd "; |
303 | cmdline += interface; | 311 | cmdline += interface; |
304 | cmdline += " 3"; | 312 | cmdline += " 3"; |
305 | //qDebug( "execute: %s", (const char*) cmdline ); | 313 | cmdline += " &"; |
306 | Global::execute( cmdline ); | ||
307 | #endif | ||
308 | 314 | ||
309 | /* | 315 | qDebug( "execute: %s", (const char*) cmdline ); |
316 | system( cmdline ); | ||
317 | qDebug( "done" ); | ||
310 | 318 | ||
319 | /* | ||
320 | |||
311 | // 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 |
312 | 322 | ||
313 | 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 ); |
314 | 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 ); |
315 | 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 ); |
316 | 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 ); |
317 | 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 ); |
318 | 328 | ||
319 | QString command ("98"); | 329 | QString command ("98"); |
320 | 330 | ||
321 | //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); | 331 | //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); |
322 | 332 | ||
323 | */ | 333 | */ |
324 | } | 334 | } |
325 | } | 335 | } |