-rw-r--r-- | libopie2/opienet/onetwork.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index cd36f16..50d67bb 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -380,33 +380,33 @@ void OWirelessNetworkInterface::init() | |||
380 | 380 | ||
381 | iwrangestruct range; | 381 | iwrangestruct range; |
382 | //ML: work around an ugly HostAP bug, which needs | 382 | //ML: work around an ugly HostAP bug, which needs |
383 | //ML: extra space or will complain with "invalid argument length"... :-( | 383 | //ML: extra space or will complain with "invalid argument length"... :-( |
384 | char __extraBufferForBuggyDrivers[sizeof range]; | 384 | char __extraBufferForBuggyDrivers[sizeof range]; |
385 | _iwr.u.data.pointer = (char*) ⦥ | 385 | _iwr.u.data.pointer = (char*) ⦥ |
386 | _iwr.u.data.length = (sizeof range) * 2; | 386 | _iwr.u.data.length = (sizeof range) * 2; |
387 | _iwr.u.data.flags = 0; | 387 | _iwr.u.data.flags = 0; |
388 | if ( !wioctl( SIOCGIWRANGE ) ) | 388 | if ( !wioctl( SIOCGIWRANGE ) ) |
389 | { | 389 | { |
390 | qDebug( "OWirelessNetworkInterface::init(): SIOCGIWRANGE failed (%s)", strerror( errno ) ); | 390 | qDebug( "OWirelessNetworkInterface::init(): SIOCGIWRANGE failed (%s)", strerror( errno ) ); |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | 393 | ||
394 | for ( int i = 0; i < range.num_frequency; ++i ) | 394 | for ( int i = 0; i < range.num_frequency; ++i ) |
395 | { | 395 | { |
396 | int freq = (int) ( double( range.freq[i].m ) * pow( 10, range.freq[i].e ) / 1000000.0 ); | 396 | int freq = (int) ( double( range.freq[i].m ) * pow( 10.0, range.freq[i].e ) / 1000000.0 ); |
397 | _channels.insert( freq, i+1 ); | 397 | _channels.insert( freq, i+1 ); |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | QString OWirelessNetworkInterface::associatedAP() const | 402 | QString OWirelessNetworkInterface::associatedAP() const |
403 | { | 403 | { |
404 | //FIXME: use OMacAddress | 404 | //FIXME: use OMacAddress |
405 | QString mac; | 405 | QString mac; |
406 | 406 | ||
407 | if ( ioctl( SIOCGIWAP ) ) | 407 | if ( ioctl( SIOCGIWAP ) ) |
408 | { | 408 | { |
409 | mac.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", | 409 | mac.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", |
410 | _ifr.ifr_hwaddr.sa_data[0]&0xff, | 410 | _ifr.ifr_hwaddr.sa_data[0]&0xff, |
411 | _ifr.ifr_hwaddr.sa_data[1]&0xff, | 411 | _ifr.ifr_hwaddr.sa_data[1]&0xff, |
412 | _ifr.ifr_hwaddr.sa_data[2]&0xff, | 412 | _ifr.ifr_hwaddr.sa_data[2]&0xff, |
@@ -423,62 +423,62 @@ QString OWirelessNetworkInterface::associatedAP() const | |||
423 | 423 | ||
424 | 424 | ||
425 | int OWirelessNetworkInterface::channel() const | 425 | int OWirelessNetworkInterface::channel() const |
426 | { | 426 | { |
427 | //FIXME: When monitoring enabled, then use it | 427 | //FIXME: When monitoring enabled, then use it |
428 | //FIXME: to gather the current RF channel | 428 | //FIXME: to gather the current RF channel |
429 | //FIXME: Until then, get active channel from hopper. | 429 | //FIXME: Until then, get active channel from hopper. |
430 | if ( _hopper && _hopper->isActive() ) | 430 | if ( _hopper && _hopper->isActive() ) |
431 | return _hopper->channel(); | 431 | return _hopper->channel(); |
432 | 432 | ||
433 | if ( !wioctl( SIOCGIWFREQ ) ) | 433 | if ( !wioctl( SIOCGIWFREQ ) ) |
434 | { | 434 | { |
435 | return -1; | 435 | return -1; |
436 | } | 436 | } |
437 | else | 437 | else |
438 | { | 438 | { |
439 | return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10, _iwr.u.freq.e ) / 1000000) ]; | 439 | return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; |
440 | } | 440 | } |
441 | } | 441 | } |
442 | 442 | ||
443 | 443 | ||
444 | void OWirelessNetworkInterface::setChannel( int c ) const | 444 | void OWirelessNetworkInterface::setChannel( int c ) const |
445 | { | 445 | { |
446 | if ( !_mon ) | 446 | if ( !_mon ) |
447 | { | 447 | { |
448 | memset( &_iwr, 0, sizeof( iwreqstruct ) ); | 448 | memset( &_iwr, 0, sizeof( iwreqstruct ) ); |
449 | _iwr.u.freq.m = c; | 449 | _iwr.u.freq.m = c; |
450 | _iwr.u.freq.e = 0; | 450 | _iwr.u.freq.e = 0; |
451 | wioctl( SIOCSIWFREQ ); | 451 | wioctl( SIOCSIWFREQ ); |
452 | } | 452 | } |
453 | else | 453 | else |
454 | { | 454 | { |
455 | _mon->setChannel( c ); | 455 | _mon->setChannel( c ); |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | double OWirelessNetworkInterface::frequency() const | 460 | double OWirelessNetworkInterface::frequency() const |
461 | { | 461 | { |
462 | if ( !wioctl( SIOCGIWFREQ ) ) | 462 | if ( !wioctl( SIOCGIWFREQ ) ) |
463 | { | 463 | { |
464 | return -1.0; | 464 | return -1.0; |
465 | } | 465 | } |
466 | else | 466 | else |
467 | { | 467 | { |
468 | return double( _iwr.u.freq.m ) * pow( 10, _iwr.u.freq.e ) / 1000000000.0; | 468 | return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0; |
469 | } | 469 | } |
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | int OWirelessNetworkInterface::channels() const | 473 | int OWirelessNetworkInterface::channels() const |
474 | { | 474 | { |
475 | return _channels.count(); | 475 | return _channels.count(); |
476 | } | 476 | } |
477 | 477 | ||
478 | 478 | ||
479 | void OWirelessNetworkInterface::setChannelHopping( int interval ) | 479 | void OWirelessNetworkInterface::setChannelHopping( int interval ) |
480 | { | 480 | { |
481 | if ( !_hopper ) _hopper = new OChannelHopper( this ); | 481 | if ( !_hopper ) _hopper = new OChannelHopper( this ); |
482 | _hopper->setInterval( interval ); | 482 | _hopper->setInterval( interval ); |
483 | //FIXME: When and by whom will the channel hopper be deleted? | 483 | //FIXME: When and by whom will the channel hopper be deleted? |
484 | } | 484 | } |