-rw-r--r-- | libopie2/opienet/onetwork.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index e916c44..73b543b 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -328,48 +328,49 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) | |||
328 | 328 | ||
329 | } | 329 | } |
330 | 330 | ||
331 | 331 | ||
332 | OChannelHopper::~OChannelHopper() | 332 | OChannelHopper::~OChannelHopper() |
333 | { | 333 | { |
334 | } | 334 | } |
335 | 335 | ||
336 | 336 | ||
337 | bool OChannelHopper::isActive() const | 337 | bool OChannelHopper::isActive() const |
338 | { | 338 | { |
339 | return _tid; | 339 | return _tid; |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | int OChannelHopper::channel() const | 343 | int OChannelHopper::channel() const |
344 | { | 344 | { |
345 | return *_channel; | 345 | return *_channel; |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | void OChannelHopper::timerEvent( QTimerEvent* ) | 349 | void OChannelHopper::timerEvent( QTimerEvent* ) |
350 | { | 350 | { |
351 | _iface->setChannel( *_channel ); | 351 | _iface->setChannel( *_channel ); |
352 | emit( hopped( *_channel ) ); | ||
352 | qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'", | 353 | qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'", |
353 | *_channel, (const char*) _iface->name() ); | 354 | *_channel, (const char*) _iface->name() ); |
354 | if ( ++_channel == _channels.end() ) _channel = _channels.begin(); | 355 | if ( ++_channel == _channels.end() ) _channel = _channels.begin(); |
355 | } | 356 | } |
356 | 357 | ||
357 | 358 | ||
358 | void OChannelHopper::setInterval( int interval ) | 359 | void OChannelHopper::setInterval( int interval ) |
359 | { | 360 | { |
360 | if ( interval == _interval ) | 361 | if ( interval == _interval ) |
361 | return; | 362 | return; |
362 | 363 | ||
363 | if ( _interval ) | 364 | if ( _interval ) |
364 | killTimer( _tid ); | 365 | killTimer( _tid ); |
365 | 366 | ||
366 | _tid = 0; | 367 | _tid = 0; |
367 | _interval = interval; | 368 | _interval = interval; |
368 | 369 | ||
369 | if ( _interval ) | 370 | if ( _interval ) |
370 | { | 371 | { |
371 | _tid = startTimer( interval ); | 372 | _tid = startTimer( interval ); |
372 | } | 373 | } |
373 | } | 374 | } |
374 | 375 | ||
375 | 376 | ||
@@ -572,48 +573,54 @@ double OWirelessNetworkInterface::frequency() const | |||
572 | } | 573 | } |
573 | 574 | ||
574 | 575 | ||
575 | int OWirelessNetworkInterface::channels() const | 576 | int OWirelessNetworkInterface::channels() const |
576 | { | 577 | { |
577 | return _channels.count(); | 578 | return _channels.count(); |
578 | } | 579 | } |
579 | 580 | ||
580 | 581 | ||
581 | void OWirelessNetworkInterface::setChannelHopping( int interval ) | 582 | void OWirelessNetworkInterface::setChannelHopping( int interval ) |
582 | { | 583 | { |
583 | if ( !_hopper ) _hopper = new OChannelHopper( this ); | 584 | if ( !_hopper ) _hopper = new OChannelHopper( this ); |
584 | _hopper->setInterval( interval ); | 585 | _hopper->setInterval( interval ); |
585 | //FIXME: When and by whom will the channel hopper be deleted? | 586 | //FIXME: When and by whom will the channel hopper be deleted? |
586 | //TODO: rely on QObject hierarchy | 587 | //TODO: rely on QObject hierarchy |
587 | } | 588 | } |
588 | 589 | ||
589 | 590 | ||
590 | int OWirelessNetworkInterface::channelHopping() const | 591 | int OWirelessNetworkInterface::channelHopping() const |
591 | { | 592 | { |
592 | return _hopper->interval(); | 593 | return _hopper->interval(); |
593 | } | 594 | } |
594 | 595 | ||
595 | 596 | ||
597 | OChannelHopper* OWirelessNetworkInterface::channelHopper() const | ||
598 | { | ||
599 | return _hopper; | ||
600 | } | ||
601 | |||
602 | |||
596 | void OWirelessNetworkInterface::setMonitorMode( bool b ) | 603 | void OWirelessNetworkInterface::setMonitorMode( bool b ) |
597 | { | 604 | { |
598 | if ( _mon ) | 605 | if ( _mon ) |
599 | _mon->setEnabled( b ); | 606 | _mon->setEnabled( b ); |
600 | else | 607 | else |
601 | qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); | 608 | qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); |
602 | } | 609 | } |
603 | 610 | ||
604 | 611 | ||
605 | bool OWirelessNetworkInterface::monitorMode() const | 612 | bool OWirelessNetworkInterface::monitorMode() const |
606 | { | 613 | { |
607 | qDebug( "dataLinkType = %d", dataLinkType() ); | 614 | qDebug( "dataLinkType = %d", dataLinkType() ); |
608 | return dataLinkType() == ARPHRD_IEEE80211; | 615 | return dataLinkType() == ARPHRD_IEEE80211; |
609 | } | 616 | } |
610 | 617 | ||
611 | 618 | ||
612 | QString OWirelessNetworkInterface::nickName() const | 619 | QString OWirelessNetworkInterface::nickName() const |
613 | { | 620 | { |
614 | char str[IW_ESSID_MAX_SIZE]; | 621 | char str[IW_ESSID_MAX_SIZE]; |
615 | _iwr.u.data.pointer = &str[0]; | 622 | _iwr.u.data.pointer = &str[0]; |
616 | _iwr.u.data.length = IW_ESSID_MAX_SIZE; | 623 | _iwr.u.data.length = IW_ESSID_MAX_SIZE; |
617 | if ( !wioctl( SIOCGIWNICKN ) ) | 624 | if ( !wioctl( SIOCGIWNICKN ) ) |
618 | { | 625 | { |
619 | return "<unknown>"; | 626 | return "<unknown>"; |