author | mickeyl <mickeyl> | 2003-03-30 01:41:56 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-30 01:41:56 (UTC) |
commit | 99899abc80a8aa05044eeecd8a061b0a8efaa713 (patch) (side-by-side diff) | |
tree | 45db7a60f17d00ae72d0e8d6b986d5be10232c6c /libopie2/opienet/onetwork.cpp | |
parent | 340cb7e64fb898966996b00b93c03ca05a347aa5 (diff) | |
download | opie-99899abc80a8aa05044eeecd8a061b0a8efaa713.zip opie-99899abc80a8aa05044eeecd8a061b0a8efaa713.tar.gz opie-99899abc80a8aa05044eeecd8a061b0a8efaa713.tar.bz2 |
- add classes for 802.11 tagged values
- adjust miniwellenreiter accordingly
Diffstat (limited to 'libopie2/opienet/onetwork.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 1d3b9fe..25c70e0 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -292,5 +292,6 @@ bool ONetworkInterface::isWireless() const OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) :QObject( 0, "Mickey's funky hopper" ), - _iface( iface ), _interval( 0 ), _channel( 0 ), _tid( 0 ) + _iface( iface ), _interval( 0 ), _channel( 1 ), _tid( 0 ), + _maxChannel( iface->channels()+1 ) { } @@ -302,8 +303,19 @@ OChannelHopper::~OChannelHopper() +bool OChannelHopper::isActive() const +{ + return _tid; +} + + +int OChannelHopper::channel() const +{ + return _channel; +} + + void OChannelHopper::timerEvent( QTimerEvent* ) { - //FIXME: Get available channels from OWirelessNetworkInterface - if ( --_channel < 0 ) _channel = 13; + if ( !--_channel ) _channel = _maxChannel; _iface->setChannel( _channel ); qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'", @@ -320,4 +332,5 @@ void OChannelHopper::setInterval( int interval ) killTimer( _tid ); + _tid = 0; _interval = interval; @@ -340,5 +353,5 @@ int OChannelHopper::interval() const OWirelessNetworkInterface::OWirelessNetworkInterface( const QString& name ) - :ONetworkInterface( name ), _hopper( this ) + :ONetworkInterface( name ), _hopper( 0 ) { qDebug( "OWirelessNetworkInterface::OWirelessNetworkInterface()" ); @@ -377,11 +390,8 @@ void OWirelessNetworkInterface::init() } - //TODO: Find out what the difference between num_channel and - // num_frequency is about. - for ( int i = 0; i < range.num_frequency; ++i ) { int freq = (int) ( double( range.freq[i].m ) * pow( 10, range.freq[i].e ) / 1000000.0 ); - _channels.insert( freq, i ); + _channels.insert( freq, i+1 ); } } @@ -413,4 +423,10 @@ QString OWirelessNetworkInterface::associatedAP() const int OWirelessNetworkInterface::channel() const { + //FIXME: When monitoring enabled, then use it + //FIXME: to gather the current RF channel + //FIXME: Until then, get active channel from hopper. + if ( _hopper && _hopper->isActive() ) + return _hopper->channel(); + if ( !wioctl( SIOCGIWFREQ ) ) { @@ -419,5 +435,4 @@ int OWirelessNetworkInterface::channel() const else { - //FIXME: This is off-by-one !? Why? return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10, _iwr.u.freq.e ) / 1000000) ]; } @@ -462,5 +477,7 @@ int OWirelessNetworkInterface::channels() const void OWirelessNetworkInterface::setChannelHopping( int interval ) { - _hopper.setInterval( interval ); + if ( !_hopper ) _hopper = new OChannelHopper( this ); + _hopper->setInterval( interval ); + //FIXME: When and by whom will the channel hopper be deleted? } @@ -468,5 +485,5 @@ void OWirelessNetworkInterface::setChannelHopping( int interval ) int OWirelessNetworkInterface::channelHopping() const { - return _hopper.interval(); + return _hopper->interval(); } @@ -480,4 +497,5 @@ void OWirelessNetworkInterface::setMonitorMode( bool b ) } + bool OWirelessNetworkInterface::monitorMode() const { |