author | benmeyer <benmeyer> | 2002-12-11 20:16:34 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-12-11 20:16:34 (UTC) |
commit | 3b2ec1e3ba172771365ff7822f623c3c6cb4d378 (patch) (side-by-side diff) | |
tree | d65ee26af6ee85b804ca3de5e738ba4fdb37d17c /noncore/net/networksetup/wlan/wextensions.cpp | |
parent | 3faddab31483bda0dd9d093cd473ffb801207b9c (diff) | |
download | opie-3b2ec1e3ba172771365ff7822f623c3c6cb4d378.zip opie-3b2ec1e3ba172771365ff7822f623c3c6cb4d378.tar.gz opie-3b2ec1e3ba172771365ff7822f623c3c6cb4d378.tar.bz2 |
Now will display the channel and not the freqency
Diffstat (limited to 'noncore/net/networksetup/wlan/wextensions.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp index 6335ebc..16654bb 100644 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/noncore/net/networksetup/wlan/wextensions.cpp @@ -92,6 +92,29 @@ double WExtensions::frequency(){ } +/** + * Get the channel that the interface is running at. + * @return int the channel that the interfacae is running at. + */ +int WExtensions::channel(){ + if(!hasWirelessExtensions) + return 0; + if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) + return 0; + double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); + double left = 2.401; + double right = 2.416; + for(int channel = 1; channel<= 15; channel++){ + if( num >= left && num <= right ) + return channel; + left += 0.005; + right += 0.005; + } + qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); + return -1; +} + /*** * Get the current rate that the card is transmiting at. + * @return double the rate, 0 if error. */ double WExtensions::rate(){ |