author | benmeyer <benmeyer> | 2002-12-11 20:26:40 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-12-11 20:26:40 (UTC) |
commit | b433feb7b048d5155e085c12f88ac5531d045140 (patch) (unidiff) | |
tree | 9acc6fa0b1722bdbf04fe4730562972b31896303 | |
parent | 3b2ec1e3ba172771365ff7822f623c3c6cb4d378 (diff) | |
download | opie-b433feb7b048d5155e085c12f88ac5531d045140.zip opie-b433feb7b048d5155e085c12f88ac5531d045140.tar.gz opie-b433feb7b048d5155e085c12f88ac5531d045140.tar.bz2 |
Added PDF url
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wextensions.cpp | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp index 16654bb..827d075 100644 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/noncore/net/networksetup/wlan/wextensions.cpp | |||
@@ -87,32 +87,35 @@ double WExtensions::frequency(){ | |||
87 | if(!hasWirelessExtensions) | 87 | if(!hasWirelessExtensions) |
88 | return 0; | 88 | return 0; |
89 | if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) | 89 | if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) |
90 | return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 90 | return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Get the channel that the interface is running at. | 95 | * Get the channel that the interface is running at. |
96 | * @return int the channel that the interfacae is running at. | 96 | * @return int the channel that the interfacae is running at. |
97 | */ | 97 | */ |
98 | int WExtensions::channel(){ | 98 | int WExtensions::channel(){ |
99 | if(!hasWirelessExtensions) | 99 | if(!hasWirelessExtensions) |
100 | return 0; | 100 | return 0; |
101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) | 101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) |
102 | return 0; | 102 | return 0; |
103 | |||
104 | // http://www.elanix.com/pdf/an137e.pdf | ||
105 | |||
103 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 106 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
104 | double left = 2.401; | 107 | double left = 2.401; |
105 | double right = 2.416; | 108 | double right = 2.416; |
106 | for(int channel = 1; channel<= 15; channel++){ | 109 | for(int channel = 1; channel<= 15; channel++){ |
107 | if( num >= left && num <= right ) | 110 | if( num >= left && num <= right ) |
108 | return channel; | 111 | return channel; |
109 | left += 0.005; | 112 | left += 0.005; |
110 | right += 0.005; | 113 | right += 0.005; |
111 | } | 114 | } |
112 | qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); | 115 | qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); |
113 | return -1; | 116 | return -1; |
114 | } | 117 | } |
115 | 118 | ||
116 | /*** | 119 | /*** |
117 | * Get the current rate that the card is transmiting at. | 120 | * Get the current rate that the card is transmiting at. |
118 | * @return double the rate, 0 if error. | 121 | * @return double the rate, 0 if error. |
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index 16654bb..827d075 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp | |||
@@ -87,32 +87,35 @@ double WExtensions::frequency(){ | |||
87 | if(!hasWirelessExtensions) | 87 | if(!hasWirelessExtensions) |
88 | return 0; | 88 | return 0; |
89 | if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) | 89 | if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) |
90 | return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 90 | return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Get the channel that the interface is running at. | 95 | * Get the channel that the interface is running at. |
96 | * @return int the channel that the interfacae is running at. | 96 | * @return int the channel that the interfacae is running at. |
97 | */ | 97 | */ |
98 | int WExtensions::channel(){ | 98 | int WExtensions::channel(){ |
99 | if(!hasWirelessExtensions) | 99 | if(!hasWirelessExtensions) |
100 | return 0; | 100 | return 0; |
101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) | 101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) |
102 | return 0; | 102 | return 0; |
103 | |||
104 | // http://www.elanix.com/pdf/an137e.pdf | ||
105 | |||
103 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 106 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
104 | double left = 2.401; | 107 | double left = 2.401; |
105 | double right = 2.416; | 108 | double right = 2.416; |
106 | for(int channel = 1; channel<= 15; channel++){ | 109 | for(int channel = 1; channel<= 15; channel++){ |
107 | if( num >= left && num <= right ) | 110 | if( num >= left && num <= right ) |
108 | return channel; | 111 | return channel; |
109 | left += 0.005; | 112 | left += 0.005; |
110 | right += 0.005; | 113 | right += 0.005; |
111 | } | 114 | } |
112 | qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); | 115 | qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); |
113 | return -1; | 116 | return -1; |
114 | } | 117 | } |
115 | 118 | ||
116 | /*** | 119 | /*** |
117 | * Get the current rate that the card is transmiting at. | 120 | * Get the current rate that the card is transmiting at. |
118 | * @return double the rate, 0 if error. | 121 | * @return double the rate, 0 if error. |