author | benmeyer <benmeyer> | 2002-12-11 20:16:34 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-12-11 20:16:34 (UTC) |
commit | 3b2ec1e3ba172771365ff7822f623c3c6cb4d378 (patch) (unidiff) | |
tree | d65ee26af6ee85b804ca3de5e738ba4fdb37d17c | |
parent | 3faddab31483bda0dd9d093cd473ffb801207b9c (diff) | |
download | opie-3b2ec1e3ba172771365ff7822f623c3c6cb4d378.zip opie-3b2ec1e3ba172771365ff7822f623c3c6cb4d378.tar.gz opie-3b2ec1e3ba172771365ff7822f623c3c6cb4d378.tar.bz2 |
Now will display the channel and not the freqency
-rw-r--r-- | noncore/net/networksetup/wlan/info.ui | 6 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/infoimp.cpp | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 23 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.h | 1 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/info.ui | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/infoimp.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wextensions.cpp | 23 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wextensions.h | 1 |
8 files changed, 56 insertions, 8 deletions
diff --git a/noncore/net/networksetup/wlan/info.ui b/noncore/net/networksetup/wlan/info.ui index 1e3e8b5..7a5bf0b 100644 --- a/noncore/net/networksetup/wlan/info.ui +++ b/noncore/net/networksetup/wlan/info.ui | |||
@@ -2,25 +2,25 @@ | |||
2 | <class>WlanInfo</class> | 2 | <class>WlanInfo</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WlanInfo</cstring> | 7 | <cstring>WlanInfo</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>242</width> | 14 | <width>238</width> |
15 | <height>316</height> | 15 | <height>316</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Interface Information</string> | 20 | <string>Interface Information</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
@@ -52,25 +52,25 @@ | |||
52 | <property stdset="1"> | 52 | <property stdset="1"> |
53 | <name>spacing</name> | 53 | <name>spacing</name> |
54 | <number>6</number> | 54 | <number>6</number> |
55 | </property> | 55 | </property> |
56 | <widget row="3" column="0" > | 56 | <widget row="3" column="0" > |
57 | <class>QLabel</class> | 57 | <class>QLabel</class> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>name</name> | 59 | <name>name</name> |
60 | <cstring>TextLabel4</cstring> | 60 | <cstring>TextLabel4</cstring> |
61 | </property> | 61 | </property> |
62 | <property stdset="1"> | 62 | <property stdset="1"> |
63 | <name>text</name> | 63 | <name>text</name> |
64 | <string>Frequency</string> | 64 | <string>Channel</string> |
65 | </property> | 65 | </property> |
66 | </widget> | 66 | </widget> |
67 | <widget row="2" column="0" > | 67 | <widget row="2" column="0" > |
68 | <class>QLabel</class> | 68 | <class>QLabel</class> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>name</name> | 70 | <name>name</name> |
71 | <cstring>TextLabel3</cstring> | 71 | <cstring>TextLabel3</cstring> |
72 | </property> | 72 | </property> |
73 | <property stdset="1"> | 73 | <property stdset="1"> |
74 | <name>text</name> | 74 | <name>text</name> |
75 | <string>Mode</string> | 75 | <string>Mode</string> |
76 | </property> | 76 | </property> |
@@ -163,25 +163,25 @@ | |||
163 | <name>frameShape</name> | 163 | <name>frameShape</name> |
164 | <enum>Panel</enum> | 164 | <enum>Panel</enum> |
165 | </property> | 165 | </property> |
166 | <property stdset="1"> | 166 | <property stdset="1"> |
167 | <name>frameShadow</name> | 167 | <name>frameShadow</name> |
168 | <enum>Sunken</enum> | 168 | <enum>Sunken</enum> |
169 | </property> | 169 | </property> |
170 | </widget> | 170 | </widget> |
171 | <widget row="3" column="1" > | 171 | <widget row="3" column="1" > |
172 | <class>QLabel</class> | 172 | <class>QLabel</class> |
173 | <property stdset="1"> | 173 | <property stdset="1"> |
174 | <name>name</name> | 174 | <name>name</name> |
175 | <cstring>freqLabel</cstring> | 175 | <cstring>channelLabel</cstring> |
176 | </property> | 176 | </property> |
177 | <property stdset="1"> | 177 | <property stdset="1"> |
178 | <name>frameShape</name> | 178 | <name>frameShape</name> |
179 | <enum>Panel</enum> | 179 | <enum>Panel</enum> |
180 | </property> | 180 | </property> |
181 | <property stdset="1"> | 181 | <property stdset="1"> |
182 | <name>frameShadow</name> | 182 | <name>frameShadow</name> |
183 | <enum>Sunken</enum> | 183 | <enum>Sunken</enum> |
184 | </property> | 184 | </property> |
185 | </widget> | 185 | </widget> |
186 | <spacer row="9" column="1" > | 186 | <spacer row="9" column="1" > |
187 | <property> | 187 | <property> |
diff --git a/noncore/net/networksetup/wlan/infoimp.cpp b/noncore/net/networksetup/wlan/infoimp.cpp index 6d3e167..bd56678 100644 --- a/noncore/net/networksetup/wlan/infoimp.cpp +++ b/noncore/net/networksetup/wlan/infoimp.cpp | |||
@@ -28,25 +28,25 @@ WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInf | |||
28 | void WlanInfoImp::update(){ | 28 | void WlanInfoImp::update(){ |
29 | WExtensions *wExtensions = new WExtensions(this->name()); | 29 | WExtensions *wExtensions = new WExtensions(this->name()); |
30 | if(!wExtensions->doesHaveWirelessExtensions()){ | 30 | if(!wExtensions->doesHaveWirelessExtensions()){ |
31 | qDebug("No extension"); | 31 | qDebug("No extension"); |
32 | delete wExtensions; | 32 | delete wExtensions; |
33 | timer->stop(); | 33 | timer->stop(); |
34 | return; | 34 | return; |
35 | } | 35 | } |
36 | essidLabel->setText(wExtensions->essid()); | 36 | essidLabel->setText(wExtensions->essid()); |
37 | apLabel->setText(wExtensions->ap()); | 37 | apLabel->setText(wExtensions->ap()); |
38 | stationLabel->setText(wExtensions->station()); | 38 | stationLabel->setText(wExtensions->station()); |
39 | modeLabel->setText(wExtensions->mode()); | 39 | modeLabel->setText(wExtensions->mode()); |
40 | freqLabel->setText(QString("%1 GHz").arg(wExtensions->frequency())); | 40 | channelLabel->setText(QString("%1").arg(wExtensions->channel())); |
41 | int signal = 0; | 41 | int signal = 0; |
42 | int noise = 0; | 42 | int noise = 0; |
43 | int quality = 0; | 43 | int quality = 0; |
44 | wExtensions->stats(signal, noise, quality); | 44 | wExtensions->stats(signal, noise, quality); |
45 | if(signalProgressBar->progress() != signal) | 45 | if(signalProgressBar->progress() != signal) |
46 | signalProgressBar->setProgress(signal); | 46 | signalProgressBar->setProgress(signal); |
47 | if(noiseProgressBar->progress() != noise) | 47 | if(noiseProgressBar->progress() != noise) |
48 | noiseProgressBar->setProgress(noise); | 48 | noiseProgressBar->setProgress(noise); |
49 | if(qualityProgressBar->progress() != quality) | 49 | if(qualityProgressBar->progress() != quality) |
50 | qualityProgressBar->setProgress(quality); | 50 | qualityProgressBar->setProgress(quality); |
51 | rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); | 51 | rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); |
52 | delete wExtensions; | 52 | delete wExtensions; |
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 | |||
@@ -82,26 +82,49 @@ QString WExtensions::mode(){ | |||
82 | /** | 82 | /** |
83 | * Get the frequency that the interface is running at. | 83 | * Get the frequency that the interface is running at. |
84 | * @return int the frequency that the interfacae is running at. | 84 | * @return int the frequency that the interfacae is running at. |
85 | */ | 85 | */ |
86 | double WExtensions::frequency(){ | 86 | 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 | /** | ||
95 | * Get the channel that the interface is running at. | ||
96 | * @return int the channel that the interfacae is running at. | ||
97 | */ | ||
98 | int WExtensions::channel(){ | ||
99 | if(!hasWirelessExtensions) | ||
100 | return 0; | ||
101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) | ||
102 | return 0; | ||
103 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | ||
104 | double left = 2.401; | ||
105 | double right = 2.416; | ||
106 | for(int channel = 1; channel<= 15; channel++){ | ||
107 | if( num >= left && num <= right ) | ||
108 | return channel; | ||
109 | left += 0.005; | ||
110 | right += 0.005; | ||
111 | } | ||
112 | qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); | ||
113 | return -1; | ||
114 | } | ||
115 | |||
94 | /*** | 116 | /*** |
95 | * Get the current rate that the card is transmiting at. | 117 | * Get the current rate that the card is transmiting at. |
118 | * @return double the rate, 0 if error. | ||
96 | */ | 119 | */ |
97 | double WExtensions::rate(){ | 120 | double WExtensions::rate(){ |
98 | if(!hasWirelessExtensions) | 121 | if(!hasWirelessExtensions) |
99 | return 0; | 122 | return 0; |
100 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ | 123 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ |
101 | return ((double)iwr.u.bitrate.value)/1000000; | 124 | return ((double)iwr.u.bitrate.value)/1000000; |
102 | } | 125 | } |
103 | return 0; | 126 | return 0; |
104 | } | 127 | } |
105 | 128 | ||
106 | 129 | ||
107 | /** | 130 | /** |
diff --git a/noncore/net/networksetup/wlan/wextensions.h b/noncore/net/networksetup/wlan/wextensions.h index 1565eb5..a89e33a 100644 --- a/noncore/net/networksetup/wlan/wextensions.h +++ b/noncore/net/networksetup/wlan/wextensions.h | |||
@@ -7,24 +7,25 @@ | |||
7 | #include <linux/wireless.h> | 7 | #include <linux/wireless.h> |
8 | 8 | ||
9 | class WExtensions { | 9 | class WExtensions { |
10 | 10 | ||
11 | public: | 11 | public: |
12 | WExtensions(QString interfaceName); | 12 | WExtensions(QString interfaceName); |
13 | QString getInterfaceName(){return interface;}; | 13 | QString getInterfaceName(){return interface;}; |
14 | bool doesHaveWirelessExtensions(){return hasWirelessExtensions;}; | 14 | bool doesHaveWirelessExtensions(){return hasWirelessExtensions;}; |
15 | QString station(); | 15 | QString station(); |
16 | QString essid(); | 16 | QString essid(); |
17 | QString mode(); | 17 | QString mode(); |
18 | double frequency(); | 18 | double frequency(); |
19 | int channel(); | ||
19 | double rate(); | 20 | double rate(); |
20 | QString ap(); | 21 | QString ap(); |
21 | bool stats( int &signal, int &noise, int &quality); | 22 | bool stats( int &signal, int &noise, int &quality); |
22 | 23 | ||
23 | private: | 24 | private: |
24 | bool hasWirelessExtensions; | 25 | bool hasWirelessExtensions; |
25 | QString interface; | 26 | QString interface; |
26 | 27 | ||
27 | // Used in we calls | 28 | // Used in we calls |
28 | struct iwreq iwr; | 29 | struct iwreq iwr; |
29 | int fd; | 30 | int fd; |
30 | 31 | ||
diff --git a/noncore/settings/networksettings/wlan/info.ui b/noncore/settings/networksettings/wlan/info.ui index 1e3e8b5..7a5bf0b 100644 --- a/noncore/settings/networksettings/wlan/info.ui +++ b/noncore/settings/networksettings/wlan/info.ui | |||
@@ -2,25 +2,25 @@ | |||
2 | <class>WlanInfo</class> | 2 | <class>WlanInfo</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WlanInfo</cstring> | 7 | <cstring>WlanInfo</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>242</width> | 14 | <width>238</width> |
15 | <height>316</height> | 15 | <height>316</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Interface Information</string> | 20 | <string>Interface Information</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
@@ -52,25 +52,25 @@ | |||
52 | <property stdset="1"> | 52 | <property stdset="1"> |
53 | <name>spacing</name> | 53 | <name>spacing</name> |
54 | <number>6</number> | 54 | <number>6</number> |
55 | </property> | 55 | </property> |
56 | <widget row="3" column="0" > | 56 | <widget row="3" column="0" > |
57 | <class>QLabel</class> | 57 | <class>QLabel</class> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>name</name> | 59 | <name>name</name> |
60 | <cstring>TextLabel4</cstring> | 60 | <cstring>TextLabel4</cstring> |
61 | </property> | 61 | </property> |
62 | <property stdset="1"> | 62 | <property stdset="1"> |
63 | <name>text</name> | 63 | <name>text</name> |
64 | <string>Frequency</string> | 64 | <string>Channel</string> |
65 | </property> | 65 | </property> |
66 | </widget> | 66 | </widget> |
67 | <widget row="2" column="0" > | 67 | <widget row="2" column="0" > |
68 | <class>QLabel</class> | 68 | <class>QLabel</class> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>name</name> | 70 | <name>name</name> |
71 | <cstring>TextLabel3</cstring> | 71 | <cstring>TextLabel3</cstring> |
72 | </property> | 72 | </property> |
73 | <property stdset="1"> | 73 | <property stdset="1"> |
74 | <name>text</name> | 74 | <name>text</name> |
75 | <string>Mode</string> | 75 | <string>Mode</string> |
76 | </property> | 76 | </property> |
@@ -163,25 +163,25 @@ | |||
163 | <name>frameShape</name> | 163 | <name>frameShape</name> |
164 | <enum>Panel</enum> | 164 | <enum>Panel</enum> |
165 | </property> | 165 | </property> |
166 | <property stdset="1"> | 166 | <property stdset="1"> |
167 | <name>frameShadow</name> | 167 | <name>frameShadow</name> |
168 | <enum>Sunken</enum> | 168 | <enum>Sunken</enum> |
169 | </property> | 169 | </property> |
170 | </widget> | 170 | </widget> |
171 | <widget row="3" column="1" > | 171 | <widget row="3" column="1" > |
172 | <class>QLabel</class> | 172 | <class>QLabel</class> |
173 | <property stdset="1"> | 173 | <property stdset="1"> |
174 | <name>name</name> | 174 | <name>name</name> |
175 | <cstring>freqLabel</cstring> | 175 | <cstring>channelLabel</cstring> |
176 | </property> | 176 | </property> |
177 | <property stdset="1"> | 177 | <property stdset="1"> |
178 | <name>frameShape</name> | 178 | <name>frameShape</name> |
179 | <enum>Panel</enum> | 179 | <enum>Panel</enum> |
180 | </property> | 180 | </property> |
181 | <property stdset="1"> | 181 | <property stdset="1"> |
182 | <name>frameShadow</name> | 182 | <name>frameShadow</name> |
183 | <enum>Sunken</enum> | 183 | <enum>Sunken</enum> |
184 | </property> | 184 | </property> |
185 | </widget> | 185 | </widget> |
186 | <spacer row="9" column="1" > | 186 | <spacer row="9" column="1" > |
187 | <property> | 187 | <property> |
diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp index 6d3e167..bd56678 100644 --- a/noncore/settings/networksettings/wlan/infoimp.cpp +++ b/noncore/settings/networksettings/wlan/infoimp.cpp | |||
@@ -28,25 +28,25 @@ WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInf | |||
28 | void WlanInfoImp::update(){ | 28 | void WlanInfoImp::update(){ |
29 | WExtensions *wExtensions = new WExtensions(this->name()); | 29 | WExtensions *wExtensions = new WExtensions(this->name()); |
30 | if(!wExtensions->doesHaveWirelessExtensions()){ | 30 | if(!wExtensions->doesHaveWirelessExtensions()){ |
31 | qDebug("No extension"); | 31 | qDebug("No extension"); |
32 | delete wExtensions; | 32 | delete wExtensions; |
33 | timer->stop(); | 33 | timer->stop(); |
34 | return; | 34 | return; |
35 | } | 35 | } |
36 | essidLabel->setText(wExtensions->essid()); | 36 | essidLabel->setText(wExtensions->essid()); |
37 | apLabel->setText(wExtensions->ap()); | 37 | apLabel->setText(wExtensions->ap()); |
38 | stationLabel->setText(wExtensions->station()); | 38 | stationLabel->setText(wExtensions->station()); |
39 | modeLabel->setText(wExtensions->mode()); | 39 | modeLabel->setText(wExtensions->mode()); |
40 | freqLabel->setText(QString("%1 GHz").arg(wExtensions->frequency())); | 40 | channelLabel->setText(QString("%1").arg(wExtensions->channel())); |
41 | int signal = 0; | 41 | int signal = 0; |
42 | int noise = 0; | 42 | int noise = 0; |
43 | int quality = 0; | 43 | int quality = 0; |
44 | wExtensions->stats(signal, noise, quality); | 44 | wExtensions->stats(signal, noise, quality); |
45 | if(signalProgressBar->progress() != signal) | 45 | if(signalProgressBar->progress() != signal) |
46 | signalProgressBar->setProgress(signal); | 46 | signalProgressBar->setProgress(signal); |
47 | if(noiseProgressBar->progress() != noise) | 47 | if(noiseProgressBar->progress() != noise) |
48 | noiseProgressBar->setProgress(noise); | 48 | noiseProgressBar->setProgress(noise); |
49 | if(qualityProgressBar->progress() != quality) | 49 | if(qualityProgressBar->progress() != quality) |
50 | qualityProgressBar->setProgress(quality); | 50 | qualityProgressBar->setProgress(quality); |
51 | rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); | 51 | rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); |
52 | delete wExtensions; | 52 | delete wExtensions; |
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index 6335ebc..16654bb 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp | |||
@@ -82,26 +82,49 @@ QString WExtensions::mode(){ | |||
82 | /** | 82 | /** |
83 | * Get the frequency that the interface is running at. | 83 | * Get the frequency that the interface is running at. |
84 | * @return int the frequency that the interfacae is running at. | 84 | * @return int the frequency that the interfacae is running at. |
85 | */ | 85 | */ |
86 | double WExtensions::frequency(){ | 86 | 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 | /** | ||
95 | * Get the channel that the interface is running at. | ||
96 | * @return int the channel that the interfacae is running at. | ||
97 | */ | ||
98 | int WExtensions::channel(){ | ||
99 | if(!hasWirelessExtensions) | ||
100 | return 0; | ||
101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) | ||
102 | return 0; | ||
103 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | ||
104 | double left = 2.401; | ||
105 | double right = 2.416; | ||
106 | for(int channel = 1; channel<= 15; channel++){ | ||
107 | if( num >= left && num <= right ) | ||
108 | return channel; | ||
109 | left += 0.005; | ||
110 | right += 0.005; | ||
111 | } | ||
112 | qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); | ||
113 | return -1; | ||
114 | } | ||
115 | |||
94 | /*** | 116 | /*** |
95 | * Get the current rate that the card is transmiting at. | 117 | * Get the current rate that the card is transmiting at. |
118 | * @return double the rate, 0 if error. | ||
96 | */ | 119 | */ |
97 | double WExtensions::rate(){ | 120 | double WExtensions::rate(){ |
98 | if(!hasWirelessExtensions) | 121 | if(!hasWirelessExtensions) |
99 | return 0; | 122 | return 0; |
100 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ | 123 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ |
101 | return ((double)iwr.u.bitrate.value)/1000000; | 124 | return ((double)iwr.u.bitrate.value)/1000000; |
102 | } | 125 | } |
103 | return 0; | 126 | return 0; |
104 | } | 127 | } |
105 | 128 | ||
106 | 129 | ||
107 | /** | 130 | /** |
diff --git a/noncore/settings/networksettings/wlan/wextensions.h b/noncore/settings/networksettings/wlan/wextensions.h index 1565eb5..a89e33a 100644 --- a/noncore/settings/networksettings/wlan/wextensions.h +++ b/noncore/settings/networksettings/wlan/wextensions.h | |||
@@ -7,24 +7,25 @@ | |||
7 | #include <linux/wireless.h> | 7 | #include <linux/wireless.h> |
8 | 8 | ||
9 | class WExtensions { | 9 | class WExtensions { |
10 | 10 | ||
11 | public: | 11 | public: |
12 | WExtensions(QString interfaceName); | 12 | WExtensions(QString interfaceName); |
13 | QString getInterfaceName(){return interface;}; | 13 | QString getInterfaceName(){return interface;}; |
14 | bool doesHaveWirelessExtensions(){return hasWirelessExtensions;}; | 14 | bool doesHaveWirelessExtensions(){return hasWirelessExtensions;}; |
15 | QString station(); | 15 | QString station(); |
16 | QString essid(); | 16 | QString essid(); |
17 | QString mode(); | 17 | QString mode(); |
18 | double frequency(); | 18 | double frequency(); |
19 | int channel(); | ||
19 | double rate(); | 20 | double rate(); |
20 | QString ap(); | 21 | QString ap(); |
21 | bool stats( int &signal, int &noise, int &quality); | 22 | bool stats( int &signal, int &noise, int &quality); |
22 | 23 | ||
23 | private: | 24 | private: |
24 | bool hasWirelessExtensions; | 25 | bool hasWirelessExtensions; |
25 | QString interface; | 26 | QString interface; |
26 | 27 | ||
27 | // Used in we calls | 28 | // Used in we calls |
28 | struct iwreq iwr; | 29 | struct iwreq iwr; |
29 | int fd; | 30 | int fd; |
30 | 31 | ||