-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 4c1c972..c1aae86 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -199,88 +199,85 @@ typedef struct { | |||
199 | 199 | ||
200 | else | 200 | else |
201 | 201 | ||
202 | { | 202 | { |
203 | qDebug( "unknown sniffer command." ); | 203 | qDebug( "unknown sniffer command." ); |
204 | } | 204 | } |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | void Wellenreiter::dataReceived() | 208 | void Wellenreiter::dataReceived() |
209 | { | 209 | { |
210 | logwindow->log( "(d) Received data from daemon" ); | 210 | logwindow->log( "(d) Received data from daemon" ); |
211 | handleMessage(); | 211 | handleMessage(); |
212 | } | 212 | } |
213 | 213 | ||
214 | void Wellenreiter::buttonClicked() | 214 | void Wellenreiter::buttonClicked() |
215 | { | 215 | { |
216 | /* | 216 | /* |
217 | // add some test stations, so that we can see if the GUI part works | 217 | // add some test stations, so that we can see if the GUI part works |
218 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); | 218 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); |
219 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); | 219 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); |
220 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); | 220 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); |
221 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); | 221 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); |
222 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); | 222 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); |
223 | */ | 223 | */ |
224 | 224 | ||
225 | 225 | ||
226 | if ( daemonRunning ) | 226 | if ( daemonRunning ) |
227 | { | 227 | { |
228 | daemonRunning = false; | 228 | daemonRunning = false; |
229 | 229 | ||
230 | logwindow->log( "(i) Daemon has been stopped." ); | 230 | logwindow->log( "(i) Daemon has been stopped." ); |
231 | button->setText( "Start Scanning" ); | 231 | button->setText( tr( "Start Scanning" ) ); |
232 | setCaption( tr( "Scanning in progress..." ) ); | ||
232 | 233 | ||
233 | // Stop daemon - ugly for now... later better | 234 | // Stop daemon - ugly for now... later better |
234 | 235 | ||
235 | system( "killall wellenreiterd" ); | 236 | system( "killall wellenreiterd" ); |
236 | 237 | ||
237 | // get configuration from config window | 238 | // get configuration from config window |
238 | 239 | ||
239 | const QString& interface = configwindow->interfaceName->currentText(); | 240 | const QString& interface = configwindow->interfaceName->currentText(); |
240 | const QString& cardtype = configwindow->deviceType->currentText(); | ||
241 | //const QString& interval = configwindow->hopInterval->cleanText(); | ||
242 | 241 | ||
243 | // reset the card trying to get into a usable state again | 242 | // reset the interface trying to get it into a usable state again |
244 | 243 | ||
245 | QString cmdline; | 244 | QString cmdline; |
246 | cmdline.sprintf( "cardctl eject; cardctl insert" ); | 245 | cmdline.sprintf( "ifdown %s; ifup %s", (const char*) interface, (const char*) interface ); |
247 | system( cmdline ); | 246 | system( cmdline ); |
248 | cmdline.sprintf( "killall -14 dhcpcd" ); | ||
249 | system( cmdline ); | ||
250 | cmdline.sprintf( "killall -10 udhcpc" ); | ||
251 | 247 | ||
252 | // message the user | 248 | // message the user |
253 | 249 | ||
254 | QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); | 250 | QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); |
255 | } | 251 | } |
256 | 252 | ||
257 | else | 253 | else |
258 | { | 254 | { |
259 | 255 | ||
260 | // get configuration from config window | 256 | // get configuration from config window |
261 | 257 | ||
262 | const QString& interface = configwindow->interfaceName->currentText(); | 258 | const QString& interface = configwindow->interfaceName->currentText(); |
263 | const int cardtype = configwindow->daemonDeviceType(); | 259 | const int cardtype = configwindow->daemonDeviceType(); |
264 | const int interval = configwindow->daemonHopInterval(); | 260 | const int interval = configwindow->daemonHopInterval(); |
265 | 261 | ||
266 | if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) | 262 | if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) |
267 | { | 263 | { |
268 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); | 264 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); |
269 | return; | 265 | return; |
270 | } | 266 | } |
271 | 267 | ||
272 | // start wellenreiterd | 268 | // start wellenreiterd |
273 | 269 | ||
274 | QString cmdline; | 270 | QString cmdline; |
275 | cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype ); | 271 | cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype ); |
276 | 272 | ||
277 | qDebug( "about to execute '%s' ...", (const char*) cmdline ); | 273 | qDebug( "about to execute '%s' ...", (const char*) cmdline ); |
278 | system( cmdline ); | 274 | system( cmdline ); |
279 | qDebug( "done!" ); | 275 | qDebug( "done!" ); |
280 | 276 | ||
281 | logwindow->log( "(i) Daemon has been started." ); | 277 | logwindow->log( "(i) Daemon has been started." ); |
282 | daemonRunning = true; | 278 | daemonRunning = true; |
283 | button->setText( "Stop Scanning" ); | 279 | button->setText( tr( "Stop Scanning" ) ); |
280 | setCaption( tr( "Wellenreiter/Opie" ) ); | ||
284 | 281 | ||
285 | } | 282 | } |
286 | } | 283 | } |