author | mickeyl <mickeyl> | 2004-02-23 15:59:05 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-23 15:59:05 (UTC) |
commit | 20b0e62e6c23cdaed9a30d6fad73431edc60be53 (patch) (unidiff) | |
tree | a179f858449e56b04883267c61141f163b4dfbac | |
parent | 68c8d3eb878f9ba913c42368fbb253d7320c62be (diff) | |
download | opie-20b0e62e6c23cdaed9a30d6fad73431edc60be53.zip opie-20b0e62e6c23cdaed9a30d6fad73431edc60be53.tar.gz opie-20b0e62e6c23cdaed9a30d6fad73431edc60be53.tar.bz2 |
addition to API: OWirelessNetworkInterface::signalStrength() [wip]
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 20 |
2 files changed, 21 insertions, 7 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index d918193..16fa8ae 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -955,24 +955,32 @@ OStationList* OWirelessNetworkInterface::scanNetwork() | |||
955 | 955 | ||
956 | return stations; | 956 | return stations; |
957 | 957 | ||
958 | } | 958 | } |
959 | else | 959 | else |
960 | { | 960 | { |
961 | odebug << " - no results (timeout) :(" << oendl; | 961 | odebug << " - no results (timeout) :(" << oendl; |
962 | return stations; | 962 | return stations; |
963 | } | 963 | } |
964 | } | 964 | } |
965 | 965 | ||
966 | 966 | ||
967 | int OWirelessNetworkInterface::signalStrength() const | ||
968 | { | ||
969 | int max = _range.max_qual.level; | ||
970 | odebug << "signalStrength(): max quality seems to be " << max << "dBM" << oendl; | ||
971 | return 50; | ||
972 | } | ||
973 | |||
974 | |||
967 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const | 975 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const |
968 | { | 976 | { |
969 | #ifndef NODEBUG | 977 | #ifndef NODEBUG |
970 | int result = ::ioctl( _sfd, call, &iwreq ); | 978 | int result = ::ioctl( _sfd, call, &iwreq ); |
971 | 979 | ||
972 | if ( result == -1 ) | 980 | if ( result == -1 ) |
973 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" | 981 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" |
974 | << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; | 982 | << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; |
975 | else | 983 | else |
976 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" | 984 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" |
977 | << debugmapper->map( call ) << "' - Status: Ok." << oendl; | 985 | << debugmapper->map( call ) << "' - Status: Ok." << oendl; |
978 | 986 | ||
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index bc9e299..9b8a0d4 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer |
4 | =. | 4 | =. <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
@@ -51,31 +51,31 @@ class OWirelessNetworkInterface; | |||
51 | class OChannelHopper; | 51 | class OChannelHopper; |
52 | class OMonitoringInterface; | 52 | class OMonitoringInterface; |
53 | 53 | ||
54 | /*====================================================================================== | 54 | /*====================================================================================== |
55 | * ONetwork | 55 | * ONetwork |
56 | *======================================================================================*/ | 56 | *======================================================================================*/ |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * @brief A container class for all network interfaces | 59 | * @brief A container class for all network interfaces |
60 | * | 60 | * |
61 | * This class provides access to all available network interfaces of your computer. | 61 | * This class provides access to all available network interfaces of your computer. |
62 | * | 62 | * |
63 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 63 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
64 | */ | 64 | */ |
65 | class ONetwork : public QObject | 65 | class ONetwork : public QObject |
66 | { | 66 | { |
67 | Q_OBJECT | 67 | Q_OBJECT |
68 | 68 | ||
69 | public: | 69 | public: |
70 | typedef QDict<ONetworkInterface> InterfaceMap; | 70 | typedef QDict<ONetworkInterface> InterfaceMap; |
71 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 71 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
72 | 72 | ||
73 | public: | 73 | public: |
74 | /** | 74 | /** |
75 | * @returns the number of available interfaces | 75 | * @returns the number of available interfaces |
76 | */ | 76 | */ |
77 | int count() const; | 77 | int count() const; |
78 | /** | 78 | /** |
79 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 79 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
80 | */ | 80 | */ |
81 | static ONetwork* instance(); | 81 | static ONetwork* instance(); |
@@ -115,25 +115,25 @@ class ONetwork : public QObject | |||
115 | /*====================================================================================== | 115 | /*====================================================================================== |
116 | * ONetworkInterface | 116 | * ONetworkInterface |
117 | *======================================================================================*/ | 117 | *======================================================================================*/ |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * @brief A network interface wrapper. | 120 | * @brief A network interface wrapper. |
121 | * | 121 | * |
122 | * This class provides a wrapper for a network interface. All the cumbersume details of | 122 | * This class provides a wrapper for a network interface. All the cumbersume details of |
123 | * Linux ioctls are hidden under a convenient high-level interface. | 123 | * Linux ioctls are hidden under a convenient high-level interface. |
124 | * @warning Most of the setting methods contained in this class require the appropriate | 124 | * @warning Most of the setting methods contained in this class require the appropriate |
125 | * process permissions to work. | 125 | * process permissions to work. |
126 | * | 126 | * |
127 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 127 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
128 | */ | 128 | */ |
129 | class ONetworkInterface : public QObject | 129 | class ONetworkInterface : public QObject |
130 | { | 130 | { |
131 | friend class OMonitoringInterface; | 131 | friend class OMonitoringInterface; |
132 | friend class OCiscoMonitoringInterface; | 132 | friend class OCiscoMonitoringInterface; |
133 | friend class OWlanNGMonitoringInterface; | 133 | friend class OWlanNGMonitoringInterface; |
134 | friend class OHostAPMonitoringInterface; | 134 | friend class OHostAPMonitoringInterface; |
135 | friend class OOrinocoMonitoringInterface; | 135 | friend class OOrinocoMonitoringInterface; |
136 | 136 | ||
137 | public: | 137 | public: |
138 | /** | 138 | /** |
139 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, | 139 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, |
@@ -225,25 +225,25 @@ class ONetworkInterface : public QObject | |||
225 | /*====================================================================================== | 225 | /*====================================================================================== |
226 | * OChannelHopper | 226 | * OChannelHopper |
227 | *======================================================================================*/ | 227 | *======================================================================================*/ |
228 | 228 | ||
229 | /** | 229 | /** |
230 | * @brief A radio frequency channel hopper. | 230 | * @brief A radio frequency channel hopper. |
231 | * | 231 | * |
232 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 232 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
233 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 233 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
234 | * This is necessary when in monitoring mode and scanning for other devices, because | 234 | * This is necessary when in monitoring mode and scanning for other devices, because |
235 | * the radio frequency hardware can only detect packets sent on the same frequency. | 235 | * the radio frequency hardware can only detect packets sent on the same frequency. |
236 | * | 236 | * |
237 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 237 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
238 | */ | 238 | */ |
239 | class OChannelHopper : public QObject | 239 | class OChannelHopper : public QObject |
240 | { | 240 | { |
241 | Q_OBJECT | 241 | Q_OBJECT |
242 | 242 | ||
243 | public: | 243 | public: |
244 | /** | 244 | /** |
245 | * Constructor. | 245 | * Constructor. |
246 | */ | 246 | */ |
247 | OChannelHopper( OWirelessNetworkInterface* ); | 247 | OChannelHopper( OWirelessNetworkInterface* ); |
248 | /** | 248 | /** |
249 | * Destructor. | 249 | * Destructor. |
@@ -285,25 +285,25 @@ class OChannelHopper : public QObject | |||
285 | }; | 285 | }; |
286 | 286 | ||
287 | 287 | ||
288 | /*====================================================================================== | 288 | /*====================================================================================== |
289 | * OWirelessNetworkInterface | 289 | * OWirelessNetworkInterface |
290 | *======================================================================================*/ | 290 | *======================================================================================*/ |
291 | 291 | ||
292 | /** | 292 | /** |
293 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 293 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
294 | * | 294 | * |
295 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 295 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
296 | * | 296 | * |
297 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 297 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
298 | */ | 298 | */ |
299 | class OWirelessNetworkInterface : public ONetworkInterface | 299 | class OWirelessNetworkInterface : public ONetworkInterface |
300 | { | 300 | { |
301 | friend class OMonitoringInterface; | 301 | friend class OMonitoringInterface; |
302 | friend class OCiscoMonitoringInterface; | 302 | friend class OCiscoMonitoringInterface; |
303 | friend class OWlanNGMonitoringInterface; | 303 | friend class OWlanNGMonitoringInterface; |
304 | friend class OHostAPMonitoringInterface; | 304 | friend class OHostAPMonitoringInterface; |
305 | friend class OOrinocoMonitoringInterface; | 305 | friend class OOrinocoMonitoringInterface; |
306 | 306 | ||
307 | friend class OPrivateIOCTL; | 307 | friend class OPrivateIOCTL; |
308 | 308 | ||
309 | public: | 309 | public: |
@@ -405,24 +405,30 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
405 | * which network to associate with (use "any" to let the driver decide). | 405 | * which network to associate with (use "any" to let the driver decide). |
406 | */ | 406 | */ |
407 | virtual void setSSID( const QString& ssid ); | 407 | virtual void setSSID( const QString& ssid ); |
408 | /** | 408 | /** |
409 | * @returns the current SSID (Service Set ID). | 409 | * @returns the current SSID (Service Set ID). |
410 | */ | 410 | */ |
411 | virtual QString SSID() const; | 411 | virtual QString SSID() const; |
412 | /** | 412 | /** |
413 | * Perform scanning the wireless network neighbourhood. | 413 | * Perform scanning the wireless network neighbourhood. |
414 | * @note: UNSTABLE API - UNDER CONSTRUCTION - DON'T USE! | 414 | * @note: UNSTABLE API - UNDER CONSTRUCTION - DON'T USE! |
415 | */ | 415 | */ |
416 | virtual OStationList* scanNetwork(); | 416 | virtual OStationList* scanNetwork(); |
417 | /** | ||
418 | * @return signal strength to associated neighbour (in percent). | ||
419 | * In infrastructure mode, this is the signal strength of the Access Point. | ||
420 | * In other modes the result is driver dependent. | ||
421 | */ | ||
422 | virtual int signalStrength() const; | ||
417 | /** @internal commit pending changes to the driver | 423 | /** @internal commit pending changes to the driver |
418 | * | 424 | * |
419 | */ | 425 | */ |
420 | void commit() const; | 426 | void commit() const; |
421 | 427 | ||
422 | protected: | 428 | protected: |
423 | void buildInformation(); | 429 | void buildInformation(); |
424 | void buildPrivateList(); | 430 | void buildPrivateList(); |
425 | void dumpInformation() const; | 431 | void dumpInformation() const; |
426 | virtual void init(); | 432 | virtual void init(); |
427 | struct iwreq& iwr() const; | 433 | struct iwreq& iwr() const; |
428 | bool wioctl( int call ) const; | 434 | bool wioctl( int call ) const; |