author | mickeyl <mickeyl> | 2003-04-09 10:36:30 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-09 10:36:30 (UTC) |
commit | 5cb59a3e8abdbb05fe4bbc9e549f264153168232 (patch) (unidiff) | |
tree | b19a1c6e59b3c75224447409a3cf1eab16626939 | |
parent | 16c67ebbe538493fd330f56b0db30343efe6f0ae (diff) | |
download | opie-5cb59a3e8abdbb05fe4bbc9e549f264153168232.zip opie-5cb59a3e8abdbb05fe4bbc9e549f264153168232.tar.gz opie-5cb59a3e8abdbb05fe4bbc9e549f264153168232.tar.bz2 |
add signal hopped(int) to OChannelHopper
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 7 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 9 |
2 files changed, 16 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 | |||
@@ -344,16 +344,17 @@ 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 | { |
@@ -588,16 +589,22 @@ void OWirelessNetworkInterface::setChannelHopping( int interval ) | |||
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 | ||
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 10f52b8..d2cc25d 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -222,25 +222,30 @@ class ONetworkInterface : public QObject | |||
222 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 222 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
223 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 223 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
224 | * This is necessary when in monitoring mode and scanning for other devices, because | 224 | * This is necessary when in monitoring mode and scanning for other devices, because |
225 | * the radio frequency hardware can only detect packets sent on the same frequency. | 225 | * the radio frequency hardware can only detect packets sent on the same frequency. |
226 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 226 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
227 | */ | 227 | */ |
228 | class OChannelHopper : public QObject | 228 | class OChannelHopper : public QObject |
229 | { | 229 | { |
230 | Q_OBJECT | ||
231 | |||
230 | public: | 232 | public: |
231 | OChannelHopper( OWirelessNetworkInterface* ); | 233 | OChannelHopper( OWirelessNetworkInterface* ); |
232 | virtual ~OChannelHopper(); | 234 | virtual ~OChannelHopper(); |
233 | bool isActive() const; | 235 | bool isActive() const; |
234 | int channel() const; | 236 | int channel() const; |
235 | virtual void timerEvent( QTimerEvent* ); | 237 | virtual void timerEvent( QTimerEvent* ); |
236 | void setInterval( int ); | 238 | void setInterval( int ); |
237 | int interval() const; | 239 | int interval() const; |
238 | 240 | ||
241 | signals: | ||
242 | void hopped( int ); | ||
243 | |||
239 | private: | 244 | private: |
240 | OWirelessNetworkInterface* _iface; | 245 | OWirelessNetworkInterface* _iface; |
241 | int _interval; | 246 | int _interval; |
242 | int _tid; | 247 | int _tid; |
243 | QValueList<int> _channels; | 248 | QValueList<int> _channels; |
244 | QValueList<int>::Iterator _channel; | 249 | QValueList<int>::Iterator _channel; |
245 | }; | 250 | }; |
246 | 251 | ||
@@ -320,16 +325,20 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
320 | * @see OChannelHopper | 325 | * @see OChannelHopper |
321 | */ | 326 | */ |
322 | virtual void setChannelHopping( int interval = 0 ); | 327 | virtual void setChannelHopping( int interval = 0 ); |
323 | /** | 328 | /** |
324 | * @returns the channel hopping interval or 0, if channel hopping is disabled. | 329 | * @returns the channel hopping interval or 0, if channel hopping is disabled. |
325 | */ | 330 | */ |
326 | virtual int channelHopping() const; | 331 | virtual int channelHopping() const; |
327 | /** | 332 | /** |
333 | * @returns the @ref OChannelHopper of this interface or 0, if channel hopping has not been activated before | ||
334 | */ | ||
335 | virtual OChannelHopper* channelHopper() const; | ||
336 | /** | ||
328 | * Set the station @a nickname. | 337 | * Set the station @a nickname. |
329 | */ | 338 | */ |
330 | virtual void setNickName( const QString& nickname ) {}; //FIXME: Implement this | 339 | virtual void setNickName( const QString& nickname ) {}; //FIXME: Implement this |
331 | /** | 340 | /** |
332 | * @returns the current station nickname. | 341 | * @returns the current station nickname. |
333 | */ | 342 | */ |
334 | virtual QString nickName() const; | 343 | virtual QString nickName() const; |
335 | /** | 344 | /** |