summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/wlan/info.ui6
-rw-r--r--noncore/net/networksetup/wlan/infoimp.cpp2
-rw-r--r--noncore/net/networksetup/wlan/wextensions.cpp23
-rw-r--r--noncore/net/networksetup/wlan/wextensions.h1
-rw-r--r--noncore/settings/networksettings/wlan/info.ui6
-rw-r--r--noncore/settings/networksettings/wlan/infoimp.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp23
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.h1
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
@@ -1,321 +1,321 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
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>
27 <property stdset="1"> 27 <property stdset="1">
28 <name>spacing</name> 28 <name>spacing</name>
29 <number>0</number> 29 <number>0</number>
30 </property> 30 </property>
31 <widget> 31 <widget>
32 <class>QTabWidget</class> 32 <class>QTabWidget</class>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>name</name> 34 <name>name</name>
35 <cstring>tabWidget</cstring> 35 <cstring>tabWidget</cstring>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QWidget</class> 38 <class>QWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>Widget2</cstring> 41 <cstring>Widget2</cstring>
42 </property> 42 </property>
43 <attribute> 43 <attribute>
44 <name>title</name> 44 <name>title</name>
45 <string>802.11b</string> 45 <string>802.11b</string>
46 </attribute> 46 </attribute>
47 <grid> 47 <grid>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>margin</name> 49 <name>margin</name>
50 <number>11</number> 50 <number>11</number>
51 </property> 51 </property>
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>
77 </widget> 77 </widget>
78 <widget row="1" column="0" > 78 <widget row="1" column="0" >
79 <class>QLabel</class> 79 <class>QLabel</class>
80 <property stdset="1"> 80 <property stdset="1">
81 <name>name</name> 81 <name>name</name>
82 <cstring>TextLabel2</cstring> 82 <cstring>TextLabel2</cstring>
83 </property> 83 </property>
84 <property stdset="1"> 84 <property stdset="1">
85 <name>text</name> 85 <name>text</name>
86 <string>ESSID</string> 86 <string>ESSID</string>
87 </property> 87 </property>
88 </widget> 88 </widget>
89 <widget row="0" column="0" > 89 <widget row="0" column="0" >
90 <class>QLabel</class> 90 <class>QLabel</class>
91 <property stdset="1"> 91 <property stdset="1">
92 <name>name</name> 92 <name>name</name>
93 <cstring>TextLabel1</cstring> 93 <cstring>TextLabel1</cstring>
94 </property> 94 </property>
95 <property stdset="1"> 95 <property stdset="1">
96 <name>text</name> 96 <name>text</name>
97 <string>Station</string> 97 <string>Station</string>
98 </property> 98 </property>
99 </widget> 99 </widget>
100 <widget row="4" column="0" > 100 <widget row="4" column="0" >
101 <class>QLabel</class> 101 <class>QLabel</class>
102 <property stdset="1"> 102 <property stdset="1">
103 <name>name</name> 103 <name>name</name>
104 <cstring>TextLabel9</cstring> 104 <cstring>TextLabel9</cstring>
105 </property> 105 </property>
106 <property stdset="1"> 106 <property stdset="1">
107 <name>text</name> 107 <name>text</name>
108 <string>AP</string> 108 <string>AP</string>
109 </property> 109 </property>
110 </widget> 110 </widget>
111 <widget row="4" column="1" > 111 <widget row="4" column="1" >
112 <class>QLabel</class> 112 <class>QLabel</class>
113 <property stdset="1"> 113 <property stdset="1">
114 <name>name</name> 114 <name>name</name>
115 <cstring>apLabel</cstring> 115 <cstring>apLabel</cstring>
116 </property> 116 </property>
117 <property stdset="1"> 117 <property stdset="1">
118 <name>frameShape</name> 118 <name>frameShape</name>
119 <enum>Panel</enum> 119 <enum>Panel</enum>
120 </property> 120 </property>
121 <property stdset="1"> 121 <property stdset="1">
122 <name>frameShadow</name> 122 <name>frameShadow</name>
123 <enum>Sunken</enum> 123 <enum>Sunken</enum>
124 </property> 124 </property>
125 </widget> 125 </widget>
126 <widget row="2" column="1" > 126 <widget row="2" column="1" >
127 <class>QLabel</class> 127 <class>QLabel</class>
128 <property stdset="1"> 128 <property stdset="1">
129 <name>name</name> 129 <name>name</name>
130 <cstring>modeLabel</cstring> 130 <cstring>modeLabel</cstring>
131 </property> 131 </property>
132 <property stdset="1"> 132 <property stdset="1">
133 <name>frameShape</name> 133 <name>frameShape</name>
134 <enum>Panel</enum> 134 <enum>Panel</enum>
135 </property> 135 </property>
136 <property stdset="1"> 136 <property stdset="1">
137 <name>frameShadow</name> 137 <name>frameShadow</name>
138 <enum>Sunken</enum> 138 <enum>Sunken</enum>
139 </property> 139 </property>
140 </widget> 140 </widget>
141 <widget row="1" column="1" > 141 <widget row="1" column="1" >
142 <class>QLabel</class> 142 <class>QLabel</class>
143 <property stdset="1"> 143 <property stdset="1">
144 <name>name</name> 144 <name>name</name>
145 <cstring>essidLabel</cstring> 145 <cstring>essidLabel</cstring>
146 </property> 146 </property>
147 <property stdset="1"> 147 <property stdset="1">
148 <name>frameShape</name> 148 <name>frameShape</name>
149 <enum>Panel</enum> 149 <enum>Panel</enum>
150 </property> 150 </property>
151 <property stdset="1"> 151 <property stdset="1">
152 <name>frameShadow</name> 152 <name>frameShadow</name>
153 <enum>Sunken</enum> 153 <enum>Sunken</enum>
154 </property> 154 </property>
155 </widget> 155 </widget>
156 <widget row="0" column="1" > 156 <widget row="0" column="1" >
157 <class>QLabel</class> 157 <class>QLabel</class>
158 <property stdset="1"> 158 <property stdset="1">
159 <name>name</name> 159 <name>name</name>
160 <cstring>stationLabel</cstring> 160 <cstring>stationLabel</cstring>
161 </property> 161 </property>
162 <property stdset="1"> 162 <property stdset="1">
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>
188 <name>name</name> 188 <name>name</name>
189 <cstring>Spacer7</cstring> 189 <cstring>Spacer7</cstring>
190 </property> 190 </property>
191 <property stdset="1"> 191 <property stdset="1">
192 <name>orientation</name> 192 <name>orientation</name>
193 <enum>Vertical</enum> 193 <enum>Vertical</enum>
194 </property> 194 </property>
195 <property stdset="1"> 195 <property stdset="1">
196 <name>sizeType</name> 196 <name>sizeType</name>
197 <enum>Expanding</enum> 197 <enum>Expanding</enum>
198 </property> 198 </property>
199 <property> 199 <property>
200 <name>sizeHint</name> 200 <name>sizeHint</name>
201 <size> 201 <size>
202 <width>20</width> 202 <width>20</width>
203 <height>20</height> 203 <height>20</height>
204 </size> 204 </size>
205 </property> 205 </property>
206 </spacer> 206 </spacer>
207 <widget row="5" column="1" > 207 <widget row="5" column="1" >
208 <class>QProgressBar</class> 208 <class>QProgressBar</class>
209 <property stdset="1"> 209 <property stdset="1">
210 <name>name</name> 210 <name>name</name>
211 <cstring>signalProgressBar</cstring> 211 <cstring>signalProgressBar</cstring>
212 </property> 212 </property>
213 </widget> 213 </widget>
214 <widget row="6" column="1" > 214 <widget row="6" column="1" >
215 <class>QProgressBar</class> 215 <class>QProgressBar</class>
216 <property stdset="1"> 216 <property stdset="1">
217 <name>name</name> 217 <name>name</name>
218 <cstring>noiseProgressBar</cstring> 218 <cstring>noiseProgressBar</cstring>
219 </property> 219 </property>
220 </widget> 220 </widget>
221 <widget row="7" column="1" > 221 <widget row="7" column="1" >
222 <class>QProgressBar</class> 222 <class>QProgressBar</class>
223 <property stdset="1"> 223 <property stdset="1">
224 <name>name</name> 224 <name>name</name>
225 <cstring>qualityProgressBar</cstring> 225 <cstring>qualityProgressBar</cstring>
226 </property> 226 </property>
227 </widget> 227 </widget>
228 <widget row="8" column="1" > 228 <widget row="8" column="1" >
229 <class>QLabel</class> 229 <class>QLabel</class>
230 <property stdset="1"> 230 <property stdset="1">
231 <name>name</name> 231 <name>name</name>
232 <cstring>rateLabel</cstring> 232 <cstring>rateLabel</cstring>
233 </property> 233 </property>
234 <property stdset="1"> 234 <property stdset="1">
235 <name>sizePolicy</name> 235 <name>sizePolicy</name>
236 <sizepolicy> 236 <sizepolicy>
237 <hsizetype>7</hsizetype> 237 <hsizetype>7</hsizetype>
238 <vsizetype>1</vsizetype> 238 <vsizetype>1</vsizetype>
239 </sizepolicy> 239 </sizepolicy>
240 </property> 240 </property>
241 <property stdset="1"> 241 <property stdset="1">
242 <name>frameShape</name> 242 <name>frameShape</name>
243 <enum>Panel</enum> 243 <enum>Panel</enum>
244 </property> 244 </property>
245 <property stdset="1"> 245 <property stdset="1">
246 <name>frameShadow</name> 246 <name>frameShadow</name>
247 <enum>Sunken</enum> 247 <enum>Sunken</enum>
248 </property> 248 </property>
249 </widget> 249 </widget>
250 <widget row="8" column="0" > 250 <widget row="8" column="0" >
251 <class>QLabel</class> 251 <class>QLabel</class>
252 <property stdset="1"> 252 <property stdset="1">
253 <name>name</name> 253 <name>name</name>
254 <cstring>TextLabel4_2</cstring> 254 <cstring>TextLabel4_2</cstring>
255 </property> 255 </property>
256 <property stdset="1"> 256 <property stdset="1">
257 <name>text</name> 257 <name>text</name>
258 <string>Rate</string> 258 <string>Rate</string>
259 </property> 259 </property>
260 </widget> 260 </widget>
261 <widget row="7" column="0" > 261 <widget row="7" column="0" >
262 <class>QLabel</class> 262 <class>QLabel</class>
263 <property stdset="1"> 263 <property stdset="1">
264 <name>name</name> 264 <name>name</name>
265 <cstring>TextLabel3_2</cstring> 265 <cstring>TextLabel3_2</cstring>
266 </property> 266 </property>
267 <property stdset="1"> 267 <property stdset="1">
268 <name>text</name> 268 <name>text</name>
269 <string>Quality</string> 269 <string>Quality</string>
270 </property> 270 </property>
271 </widget> 271 </widget>
272 <widget row="6" column="0" > 272 <widget row="6" column="0" >
273 <class>QLabel</class> 273 <class>QLabel</class>
274 <property stdset="1"> 274 <property stdset="1">
275 <name>name</name> 275 <name>name</name>
276 <cstring>TextLabel2_2</cstring> 276 <cstring>TextLabel2_2</cstring>
277 </property> 277 </property>
278 <property stdset="1"> 278 <property stdset="1">
279 <name>text</name> 279 <name>text</name>
280 <string>Noise</string> 280 <string>Noise</string>
281 </property> 281 </property>
282 </widget> 282 </widget>
283 <widget row="5" column="0" > 283 <widget row="5" column="0" >
284 <class>QLabel</class> 284 <class>QLabel</class>
285 <property stdset="1"> 285 <property stdset="1">
286 <name>name</name> 286 <name>name</name>
287 <cstring>TextLabel1_2</cstring> 287 <cstring>TextLabel1_2</cstring>
288 </property> 288 </property>
289 <property stdset="1"> 289 <property stdset="1">
290 <name>text</name> 290 <name>text</name>
291 <string>Signal</string> 291 <string>Signal</string>
292 </property> 292 </property>
293 </widget> 293 </widget>
294 </grid> 294 </grid>
295 </widget> 295 </widget>
296 </widget> 296 </widget>
297 </vbox> 297 </vbox>
298</widget> 298</widget>
299<customwidgets> 299<customwidgets>
300 <customwidget> 300 <customwidget>
301 <class>QWidget</class> 301 <class>QWidget</class>
302 <header location="local">qwidget.h</header> 302 <header location="local">qwidget.h</header>
303 <sizehint> 303 <sizehint>
304 <width>100</width> 304 <width>100</width>
305 <height>100</height> 305 <height>100</height>
306 </sizehint> 306 </sizehint>
307 <container>0</container> 307 <container>0</container>
308 <sizepolicy> 308 <sizepolicy>
309 <hordata>7</hordata> 309 <hordata>7</hordata>
310 <verdata>7</verdata> 310 <verdata>7</verdata>
311 </sizepolicy> 311 </sizepolicy>
312 <pixmap>image0</pixmap> 312 <pixmap>image0</pixmap>
313 </customwidget> 313 </customwidget>
314</customwidgets> 314</customwidgets>
315<images> 315<images>
316 <image> 316 <image>
317 <name>image0</name> 317 <name>image0</name>
318 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> 318 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
319 </image> 319 </image>
320</images> 320</images>
321</UI> 321</UI>
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
@@ -1,56 +1,56 @@
1#include "infoimp.h" 1#include "infoimp.h"
2#include "wextensions.h" 2#include "wextensions.h"
3 3
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qprogressbar.h> 5#include <qprogressbar.h>
6#include <qlabel.h> 6#include <qlabel.h>
7 7
8/** 8/**
9 * Constructor. If wireless extensions are enabled on device name then 9 * Constructor. If wireless extensions are enabled on device name then
10 * start a timer that every second will update the information. 10 * start a timer that every second will update the information.
11 */ 11 */
12WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ 12WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){
13 WExtensions *wExtensions = new WExtensions(name); 13 WExtensions *wExtensions = new WExtensions(name);
14 if(!wExtensions->doesHaveWirelessExtensions()){ 14 if(!wExtensions->doesHaveWirelessExtensions()){
15 delete wExtensions; 15 delete wExtensions;
16 qDebug("WlanInfoImp::No wireless extension"); 16 qDebug("WlanInfoImp::No wireless extension");
17 return; 17 return;
18 } 18 }
19 delete wExtensions; 19 delete wExtensions;
20 timer = new QTimer( this ); 20 timer = new QTimer( this );
21 connect( timer, SIGNAL(timeout()), this, SLOT(update())); 21 connect( timer, SIGNAL(timeout()), this, SLOT(update()));
22 timer->start( 1000, false ); 22 timer->start( 1000, false );
23} 23}
24 24
25/** 25/**
26 * Updates the information about the wireless device. 26 * Updates the information about the wireless device.
27 */ 27 */
28void WlanInfoImp::update(){ 28void 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;
53} 53}
54 54
55// infoimp.cpp 55// infoimp.cpp
56 56
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
@@ -1,174 +1,197 @@
1#include "wextensions.h" 1#include "wextensions.h"
2 2
3#include <qfile.h> 3#include <qfile.h>
4#include <qtextstream.h> 4#include <qtextstream.h>
5 5
6#include <arpa/inet.h> 6#include <arpa/inet.h>
7#include <sys/socket.h> 7#include <sys/socket.h>
8#include <sys/ioctl.h> 8#include <sys/ioctl.h>
9 9
10#include <math.h> 10#include <math.h>
11 11
12#define PROCNETWIRELESS "/proc/net/wireless" 12#define PROCNETWIRELESS "/proc/net/wireless"
13#define IW_LOWER 0 13#define IW_LOWER 0
14#define IW_UPPER 256 14#define IW_UPPER 256
15 15
16/** 16/**
17 * Constructor. Sets hasWirelessExtensions 17 * Constructor. Sets hasWirelessExtensions
18 */ 18 */
19WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { 19WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) {
20 fd = socket( AF_INET, SOCK_DGRAM, 0 ); 20 fd = socket( AF_INET, SOCK_DGRAM, 0 );
21 if(fd == -1) 21 if(fd == -1)
22 return; 22 return;
23 23
24 const char* buffer[200]; 24 const char* buffer[200];
25 memset( &iwr, 0, sizeof( iwr ) ); 25 memset( &iwr, 0, sizeof( iwr ) );
26 iwr.u.essid.pointer = (caddr_t) buffer; 26 iwr.u.essid.pointer = (caddr_t) buffer;
27 iwr.u.essid.length = IW_ESSID_MAX_SIZE; 27 iwr.u.essid.length = IW_ESSID_MAX_SIZE;
28 iwr.u.essid.flags = 0; 28 iwr.u.essid.flags = 0;
29 29
30 // check if it is an IEEE 802.11 standard conform 30 // check if it is an IEEE 802.11 standard conform
31 // wireless device by sending SIOCGIWESSID 31 // wireless device by sending SIOCGIWESSID
32 // which also gives back the Extended Service Set ID 32 // which also gives back the Extended Service Set ID
33 // (see IEEE 802.11 for more information) 33 // (see IEEE 802.11 for more information)
34 34
35 const char* iname = interface.latin1(); 35 const char* iname = interface.latin1();
36 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); 36 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname );
37 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) 37 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) )
38 hasWirelessExtensions = true; 38 hasWirelessExtensions = true;
39} 39}
40 40
41/** 41/**
42 * @return QString the station name of the access point. 42 * @return QString the station name of the access point.
43 */ 43 */
44QString WExtensions::station(){ 44QString WExtensions::station(){
45 if(!hasWirelessExtensions) 45 if(!hasWirelessExtensions)
46 return QString(); 46 return QString();
47 const char* buffer[200]; 47 const char* buffer[200];
48 iwr.u.data.pointer = (caddr_t) buffer; 48 iwr.u.data.pointer = (caddr_t) buffer;
49 iwr.u.data.length = IW_ESSID_MAX_SIZE; 49 iwr.u.data.length = IW_ESSID_MAX_SIZE;
50 iwr.u.data.flags = 0; 50 iwr.u.data.flags = 0;
51 if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ 51 if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){
52 iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; 52 iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0';
53 return QString(iwr.u.data.pointer); 53 return QString(iwr.u.data.pointer);
54 } 54 }
55 return QString(); 55 return QString();
56} 56}
57 57
58/** 58/**
59 * @return QString the essid of the host 802.11 access point. 59 * @return QString the essid of the host 802.11 access point.
60 */ 60 */
61QString WExtensions::essid(){ 61QString WExtensions::essid(){
62 if(!hasWirelessExtensions) 62 if(!hasWirelessExtensions)
63 return QString(); 63 return QString();
64 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ 64 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){
65 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0'; 65 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0';
66 return QString(iwr.u.essid.pointer); 66 return QString(iwr.u.essid.pointer);
67 } 67 }
68 return QString(); 68 return QString();
69} 69}
70 70
71/** 71/**
72 * @return QString the mode of interface 72 * @return QString the mode of interface
73 */ 73 */
74QString WExtensions::mode(){ 74QString WExtensions::mode(){
75 if(!hasWirelessExtensions) 75 if(!hasWirelessExtensions)
76 return QString(); 76 return QString();
77 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) 77 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) )
78 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); 78 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed");
79 return QString(); 79 return QString();
80} 80}
81 81
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 */
86double WExtensions::frequency(){ 86double 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 */
98int 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 */
97double WExtensions::rate(){ 120double 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/**
108 * @return QString the AccessPoint that the interface is connected to. 131 * @return QString the AccessPoint that the interface is connected to.
109 */ 132 */
110QString WExtensions::ap(){ 133QString WExtensions::ap(){
111 if(!hasWirelessExtensions) 134 if(!hasWirelessExtensions)
112 return QString(); 135 return QString();
113 if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){ 136 if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){
114 QString ap; 137 QString ap;
115 ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", 138 ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
116 iwr.u.ap_addr.sa_data[0]&0xff, 139 iwr.u.ap_addr.sa_data[0]&0xff,
117 iwr.u.ap_addr.sa_data[1]&0xff, 140 iwr.u.ap_addr.sa_data[1]&0xff,
118 iwr.u.ap_addr.sa_data[2]&0xff, 141 iwr.u.ap_addr.sa_data[2]&0xff,
119 iwr.u.ap_addr.sa_data[3]&0xff, 142 iwr.u.ap_addr.sa_data[3]&0xff,
120 iwr.u.ap_addr.sa_data[4]&0xff, 143 iwr.u.ap_addr.sa_data[4]&0xff,
121 iwr.u.ap_addr.sa_data[5]&0xff ); 144 iwr.u.ap_addr.sa_data[5]&0xff );
122 return ap; 145 return ap;
123 } 146 }
124 else return QString(); 147 else return QString();
125} 148}
126 149
127/** 150/**
128 * Get the stats for interfaces 151 * Get the stats for interfaces
129 * @param signal the signal strength of interface 152 * @param signal the signal strength of interface
130 * @param noise the noise level of the interface 153 * @param noise the noise level of the interface
131 * @param quality the quality level of the interface 154 * @param quality the quality level of the interface
132 * @return bool true if successfull 155 * @return bool true if successfull
133 */ 156 */
134bool WExtensions::stats(int &signal, int &noise, int &quality){ 157bool WExtensions::stats(int &signal, int &noise, int &quality){
135 // gather link quality from /proc/net/wireless 158 // gather link quality from /proc/net/wireless
136 if(!QFile::exists(PROCNETWIRELESS)) 159 if(!QFile::exists(PROCNETWIRELESS))
137 return false; 160 return false;
138 161
139 char c; 162 char c;
140 QString status; 163 QString status;
141 QString name; 164 QString name;
142 165
143 QFile wfile( PROCNETWIRELESS ); 166 QFile wfile( PROCNETWIRELESS );
144 if(!wfile.open( IO_ReadOnly )) 167 if(!wfile.open( IO_ReadOnly ))
145 return false; 168 return false;
146 169
147 QTextStream wstream( &wfile ); 170 QTextStream wstream( &wfile );
148 wstream.readLine(); // skip the first two lines 171 wstream.readLine(); // skip the first two lines
149 wstream.readLine(); // because they only contain headers 172 wstream.readLine(); // because they only contain headers
150 while(!wstream.atEnd()){ 173 while(!wstream.atEnd()){
151 wstream >> name >> status >> quality >> c >> signal >> c >> noise; 174 wstream >> name >> status >> quality >> c >> signal >> c >> noise;
152 if(name == QString("%1:").arg(interface)){ 175 if(name == QString("%1:").arg(interface)){
153 if ( quality > 92 ) 176 if ( quality > 92 )
154 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); 177 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
155 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) 178 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
156 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); 179 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
157 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) 180 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
158 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); 181 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
159 //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); 182 //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1());
160 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; 183 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER;
161 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; 184 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
162 quality = ( quality*100 ) / 92; 185 quality = ( quality*100 ) / 92;
163 return true; 186 return true;
164 } 187 }
165 } 188 }
166 189
167 qDebug("WExtensions::statsCard no longer present."); 190 qDebug("WExtensions::statsCard no longer present.");
168 quality = -1; 191 quality = -1;
169 signal = IW_LOWER; 192 signal = IW_LOWER;
170 noise = IW_LOWER; 193 noise = IW_LOWER;
171 return false; 194 return false;
172} 195}
173 196
174// wextensions.cpp 197// wextensions.cpp
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
@@ -1,33 +1,34 @@
1#ifndef WEXTENSIONS_H 1#ifndef WEXTENSIONS_H
2#define WEXTENSIONS_H 2#define WEXTENSIONS_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5 5
6#include <netinet/ip.h> 6#include <netinet/ip.h>
7#include <linux/wireless.h> 7#include <linux/wireless.h>
8 8
9class WExtensions { 9class WExtensions {
10 10
11public: 11public:
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
23private: 24private:
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
31}; 32};
32 33
33#endif 34#endif
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
@@ -1,321 +1,321 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
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>
27 <property stdset="1"> 27 <property stdset="1">
28 <name>spacing</name> 28 <name>spacing</name>
29 <number>0</number> 29 <number>0</number>
30 </property> 30 </property>
31 <widget> 31 <widget>
32 <class>QTabWidget</class> 32 <class>QTabWidget</class>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>name</name> 34 <name>name</name>
35 <cstring>tabWidget</cstring> 35 <cstring>tabWidget</cstring>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QWidget</class> 38 <class>QWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>Widget2</cstring> 41 <cstring>Widget2</cstring>
42 </property> 42 </property>
43 <attribute> 43 <attribute>
44 <name>title</name> 44 <name>title</name>
45 <string>802.11b</string> 45 <string>802.11b</string>
46 </attribute> 46 </attribute>
47 <grid> 47 <grid>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>margin</name> 49 <name>margin</name>
50 <number>11</number> 50 <number>11</number>
51 </property> 51 </property>
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>
77 </widget> 77 </widget>
78 <widget row="1" column="0" > 78 <widget row="1" column="0" >
79 <class>QLabel</class> 79 <class>QLabel</class>
80 <property stdset="1"> 80 <property stdset="1">
81 <name>name</name> 81 <name>name</name>
82 <cstring>TextLabel2</cstring> 82 <cstring>TextLabel2</cstring>
83 </property> 83 </property>
84 <property stdset="1"> 84 <property stdset="1">
85 <name>text</name> 85 <name>text</name>
86 <string>ESSID</string> 86 <string>ESSID</string>
87 </property> 87 </property>
88 </widget> 88 </widget>
89 <widget row="0" column="0" > 89 <widget row="0" column="0" >
90 <class>QLabel</class> 90 <class>QLabel</class>
91 <property stdset="1"> 91 <property stdset="1">
92 <name>name</name> 92 <name>name</name>
93 <cstring>TextLabel1</cstring> 93 <cstring>TextLabel1</cstring>
94 </property> 94 </property>
95 <property stdset="1"> 95 <property stdset="1">
96 <name>text</name> 96 <name>text</name>
97 <string>Station</string> 97 <string>Station</string>
98 </property> 98 </property>
99 </widget> 99 </widget>
100 <widget row="4" column="0" > 100 <widget row="4" column="0" >
101 <class>QLabel</class> 101 <class>QLabel</class>
102 <property stdset="1"> 102 <property stdset="1">
103 <name>name</name> 103 <name>name</name>
104 <cstring>TextLabel9</cstring> 104 <cstring>TextLabel9</cstring>
105 </property> 105 </property>
106 <property stdset="1"> 106 <property stdset="1">
107 <name>text</name> 107 <name>text</name>
108 <string>AP</string> 108 <string>AP</string>
109 </property> 109 </property>
110 </widget> 110 </widget>
111 <widget row="4" column="1" > 111 <widget row="4" column="1" >
112 <class>QLabel</class> 112 <class>QLabel</class>
113 <property stdset="1"> 113 <property stdset="1">
114 <name>name</name> 114 <name>name</name>
115 <cstring>apLabel</cstring> 115 <cstring>apLabel</cstring>
116 </property> 116 </property>
117 <property stdset="1"> 117 <property stdset="1">
118 <name>frameShape</name> 118 <name>frameShape</name>
119 <enum>Panel</enum> 119 <enum>Panel</enum>
120 </property> 120 </property>
121 <property stdset="1"> 121 <property stdset="1">
122 <name>frameShadow</name> 122 <name>frameShadow</name>
123 <enum>Sunken</enum> 123 <enum>Sunken</enum>
124 </property> 124 </property>
125 </widget> 125 </widget>
126 <widget row="2" column="1" > 126 <widget row="2" column="1" >
127 <class>QLabel</class> 127 <class>QLabel</class>
128 <property stdset="1"> 128 <property stdset="1">
129 <name>name</name> 129 <name>name</name>
130 <cstring>modeLabel</cstring> 130 <cstring>modeLabel</cstring>
131 </property> 131 </property>
132 <property stdset="1"> 132 <property stdset="1">
133 <name>frameShape</name> 133 <name>frameShape</name>
134 <enum>Panel</enum> 134 <enum>Panel</enum>
135 </property> 135 </property>
136 <property stdset="1"> 136 <property stdset="1">
137 <name>frameShadow</name> 137 <name>frameShadow</name>
138 <enum>Sunken</enum> 138 <enum>Sunken</enum>
139 </property> 139 </property>
140 </widget> 140 </widget>
141 <widget row="1" column="1" > 141 <widget row="1" column="1" >
142 <class>QLabel</class> 142 <class>QLabel</class>
143 <property stdset="1"> 143 <property stdset="1">
144 <name>name</name> 144 <name>name</name>
145 <cstring>essidLabel</cstring> 145 <cstring>essidLabel</cstring>
146 </property> 146 </property>
147 <property stdset="1"> 147 <property stdset="1">
148 <name>frameShape</name> 148 <name>frameShape</name>
149 <enum>Panel</enum> 149 <enum>Panel</enum>
150 </property> 150 </property>
151 <property stdset="1"> 151 <property stdset="1">
152 <name>frameShadow</name> 152 <name>frameShadow</name>
153 <enum>Sunken</enum> 153 <enum>Sunken</enum>
154 </property> 154 </property>
155 </widget> 155 </widget>
156 <widget row="0" column="1" > 156 <widget row="0" column="1" >
157 <class>QLabel</class> 157 <class>QLabel</class>
158 <property stdset="1"> 158 <property stdset="1">
159 <name>name</name> 159 <name>name</name>
160 <cstring>stationLabel</cstring> 160 <cstring>stationLabel</cstring>
161 </property> 161 </property>
162 <property stdset="1"> 162 <property stdset="1">
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>
188 <name>name</name> 188 <name>name</name>
189 <cstring>Spacer7</cstring> 189 <cstring>Spacer7</cstring>
190 </property> 190 </property>
191 <property stdset="1"> 191 <property stdset="1">
192 <name>orientation</name> 192 <name>orientation</name>
193 <enum>Vertical</enum> 193 <enum>Vertical</enum>
194 </property> 194 </property>
195 <property stdset="1"> 195 <property stdset="1">
196 <name>sizeType</name> 196 <name>sizeType</name>
197 <enum>Expanding</enum> 197 <enum>Expanding</enum>
198 </property> 198 </property>
199 <property> 199 <property>
200 <name>sizeHint</name> 200 <name>sizeHint</name>
201 <size> 201 <size>
202 <width>20</width> 202 <width>20</width>
203 <height>20</height> 203 <height>20</height>
204 </size> 204 </size>
205 </property> 205 </property>
206 </spacer> 206 </spacer>
207 <widget row="5" column="1" > 207 <widget row="5" column="1" >
208 <class>QProgressBar</class> 208 <class>QProgressBar</class>
209 <property stdset="1"> 209 <property stdset="1">
210 <name>name</name> 210 <name>name</name>
211 <cstring>signalProgressBar</cstring> 211 <cstring>signalProgressBar</cstring>
212 </property> 212 </property>
213 </widget> 213 </widget>
214 <widget row="6" column="1" > 214 <widget row="6" column="1" >
215 <class>QProgressBar</class> 215 <class>QProgressBar</class>
216 <property stdset="1"> 216 <property stdset="1">
217 <name>name</name> 217 <name>name</name>
218 <cstring>noiseProgressBar</cstring> 218 <cstring>noiseProgressBar</cstring>
219 </property> 219 </property>
220 </widget> 220 </widget>
221 <widget row="7" column="1" > 221 <widget row="7" column="1" >
222 <class>QProgressBar</class> 222 <class>QProgressBar</class>
223 <property stdset="1"> 223 <property stdset="1">
224 <name>name</name> 224 <name>name</name>
225 <cstring>qualityProgressBar</cstring> 225 <cstring>qualityProgressBar</cstring>
226 </property> 226 </property>
227 </widget> 227 </widget>
228 <widget row="8" column="1" > 228 <widget row="8" column="1" >
229 <class>QLabel</class> 229 <class>QLabel</class>
230 <property stdset="1"> 230 <property stdset="1">
231 <name>name</name> 231 <name>name</name>
232 <cstring>rateLabel</cstring> 232 <cstring>rateLabel</cstring>
233 </property> 233 </property>
234 <property stdset="1"> 234 <property stdset="1">
235 <name>sizePolicy</name> 235 <name>sizePolicy</name>
236 <sizepolicy> 236 <sizepolicy>
237 <hsizetype>7</hsizetype> 237 <hsizetype>7</hsizetype>
238 <vsizetype>1</vsizetype> 238 <vsizetype>1</vsizetype>
239 </sizepolicy> 239 </sizepolicy>
240 </property> 240 </property>
241 <property stdset="1"> 241 <property stdset="1">
242 <name>frameShape</name> 242 <name>frameShape</name>
243 <enum>Panel</enum> 243 <enum>Panel</enum>
244 </property> 244 </property>
245 <property stdset="1"> 245 <property stdset="1">
246 <name>frameShadow</name> 246 <name>frameShadow</name>
247 <enum>Sunken</enum> 247 <enum>Sunken</enum>
248 </property> 248 </property>
249 </widget> 249 </widget>
250 <widget row="8" column="0" > 250 <widget row="8" column="0" >
251 <class>QLabel</class> 251 <class>QLabel</class>
252 <property stdset="1"> 252 <property stdset="1">
253 <name>name</name> 253 <name>name</name>
254 <cstring>TextLabel4_2</cstring> 254 <cstring>TextLabel4_2</cstring>
255 </property> 255 </property>
256 <property stdset="1"> 256 <property stdset="1">
257 <name>text</name> 257 <name>text</name>
258 <string>Rate</string> 258 <string>Rate</string>
259 </property> 259 </property>
260 </widget> 260 </widget>
261 <widget row="7" column="0" > 261 <widget row="7" column="0" >
262 <class>QLabel</class> 262 <class>QLabel</class>
263 <property stdset="1"> 263 <property stdset="1">
264 <name>name</name> 264 <name>name</name>
265 <cstring>TextLabel3_2</cstring> 265 <cstring>TextLabel3_2</cstring>
266 </property> 266 </property>
267 <property stdset="1"> 267 <property stdset="1">
268 <name>text</name> 268 <name>text</name>
269 <string>Quality</string> 269 <string>Quality</string>
270 </property> 270 </property>
271 </widget> 271 </widget>
272 <widget row="6" column="0" > 272 <widget row="6" column="0" >
273 <class>QLabel</class> 273 <class>QLabel</class>
274 <property stdset="1"> 274 <property stdset="1">
275 <name>name</name> 275 <name>name</name>
276 <cstring>TextLabel2_2</cstring> 276 <cstring>TextLabel2_2</cstring>
277 </property> 277 </property>
278 <property stdset="1"> 278 <property stdset="1">
279 <name>text</name> 279 <name>text</name>
280 <string>Noise</string> 280 <string>Noise</string>
281 </property> 281 </property>
282 </widget> 282 </widget>
283 <widget row="5" column="0" > 283 <widget row="5" column="0" >
284 <class>QLabel</class> 284 <class>QLabel</class>
285 <property stdset="1"> 285 <property stdset="1">
286 <name>name</name> 286 <name>name</name>
287 <cstring>TextLabel1_2</cstring> 287 <cstring>TextLabel1_2</cstring>
288 </property> 288 </property>
289 <property stdset="1"> 289 <property stdset="1">
290 <name>text</name> 290 <name>text</name>
291 <string>Signal</string> 291 <string>Signal</string>
292 </property> 292 </property>
293 </widget> 293 </widget>
294 </grid> 294 </grid>
295 </widget> 295 </widget>
296 </widget> 296 </widget>
297 </vbox> 297 </vbox>
298</widget> 298</widget>
299<customwidgets> 299<customwidgets>
300 <customwidget> 300 <customwidget>
301 <class>QWidget</class> 301 <class>QWidget</class>
302 <header location="local">qwidget.h</header> 302 <header location="local">qwidget.h</header>
303 <sizehint> 303 <sizehint>
304 <width>100</width> 304 <width>100</width>
305 <height>100</height> 305 <height>100</height>
306 </sizehint> 306 </sizehint>
307 <container>0</container> 307 <container>0</container>
308 <sizepolicy> 308 <sizepolicy>
309 <hordata>7</hordata> 309 <hordata>7</hordata>
310 <verdata>7</verdata> 310 <verdata>7</verdata>
311 </sizepolicy> 311 </sizepolicy>
312 <pixmap>image0</pixmap> 312 <pixmap>image0</pixmap>
313 </customwidget> 313 </customwidget>
314</customwidgets> 314</customwidgets>
315<images> 315<images>
316 <image> 316 <image>
317 <name>image0</name> 317 <name>image0</name>
318 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> 318 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
319 </image> 319 </image>
320</images> 320</images>
321</UI> 321</UI>
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
@@ -1,56 +1,56 @@
1#include "infoimp.h" 1#include "infoimp.h"
2#include "wextensions.h" 2#include "wextensions.h"
3 3
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qprogressbar.h> 5#include <qprogressbar.h>
6#include <qlabel.h> 6#include <qlabel.h>
7 7
8/** 8/**
9 * Constructor. If wireless extensions are enabled on device name then 9 * Constructor. If wireless extensions are enabled on device name then
10 * start a timer that every second will update the information. 10 * start a timer that every second will update the information.
11 */ 11 */
12WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ 12WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){
13 WExtensions *wExtensions = new WExtensions(name); 13 WExtensions *wExtensions = new WExtensions(name);
14 if(!wExtensions->doesHaveWirelessExtensions()){ 14 if(!wExtensions->doesHaveWirelessExtensions()){
15 delete wExtensions; 15 delete wExtensions;
16 qDebug("WlanInfoImp::No wireless extension"); 16 qDebug("WlanInfoImp::No wireless extension");
17 return; 17 return;
18 } 18 }
19 delete wExtensions; 19 delete wExtensions;
20 timer = new QTimer( this ); 20 timer = new QTimer( this );
21 connect( timer, SIGNAL(timeout()), this, SLOT(update())); 21 connect( timer, SIGNAL(timeout()), this, SLOT(update()));
22 timer->start( 1000, false ); 22 timer->start( 1000, false );
23} 23}
24 24
25/** 25/**
26 * Updates the information about the wireless device. 26 * Updates the information about the wireless device.
27 */ 27 */
28void WlanInfoImp::update(){ 28void 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;
53} 53}
54 54
55// infoimp.cpp 55// infoimp.cpp
56 56
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
@@ -1,174 +1,197 @@
1#include "wextensions.h" 1#include "wextensions.h"
2 2
3#include <qfile.h> 3#include <qfile.h>
4#include <qtextstream.h> 4#include <qtextstream.h>
5 5
6#include <arpa/inet.h> 6#include <arpa/inet.h>
7#include <sys/socket.h> 7#include <sys/socket.h>
8#include <sys/ioctl.h> 8#include <sys/ioctl.h>
9 9
10#include <math.h> 10#include <math.h>
11 11
12#define PROCNETWIRELESS "/proc/net/wireless" 12#define PROCNETWIRELESS "/proc/net/wireless"
13#define IW_LOWER 0 13#define IW_LOWER 0
14#define IW_UPPER 256 14#define IW_UPPER 256
15 15
16/** 16/**
17 * Constructor. Sets hasWirelessExtensions 17 * Constructor. Sets hasWirelessExtensions
18 */ 18 */
19WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { 19WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) {
20 fd = socket( AF_INET, SOCK_DGRAM, 0 ); 20 fd = socket( AF_INET, SOCK_DGRAM, 0 );
21 if(fd == -1) 21 if(fd == -1)
22 return; 22 return;
23 23
24 const char* buffer[200]; 24 const char* buffer[200];
25 memset( &iwr, 0, sizeof( iwr ) ); 25 memset( &iwr, 0, sizeof( iwr ) );
26 iwr.u.essid.pointer = (caddr_t) buffer; 26 iwr.u.essid.pointer = (caddr_t) buffer;
27 iwr.u.essid.length = IW_ESSID_MAX_SIZE; 27 iwr.u.essid.length = IW_ESSID_MAX_SIZE;
28 iwr.u.essid.flags = 0; 28 iwr.u.essid.flags = 0;
29 29
30 // check if it is an IEEE 802.11 standard conform 30 // check if it is an IEEE 802.11 standard conform
31 // wireless device by sending SIOCGIWESSID 31 // wireless device by sending SIOCGIWESSID
32 // which also gives back the Extended Service Set ID 32 // which also gives back the Extended Service Set ID
33 // (see IEEE 802.11 for more information) 33 // (see IEEE 802.11 for more information)
34 34
35 const char* iname = interface.latin1(); 35 const char* iname = interface.latin1();
36 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); 36 strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname );
37 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) 37 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) )
38 hasWirelessExtensions = true; 38 hasWirelessExtensions = true;
39} 39}
40 40
41/** 41/**
42 * @return QString the station name of the access point. 42 * @return QString the station name of the access point.
43 */ 43 */
44QString WExtensions::station(){ 44QString WExtensions::station(){
45 if(!hasWirelessExtensions) 45 if(!hasWirelessExtensions)
46 return QString(); 46 return QString();
47 const char* buffer[200]; 47 const char* buffer[200];
48 iwr.u.data.pointer = (caddr_t) buffer; 48 iwr.u.data.pointer = (caddr_t) buffer;
49 iwr.u.data.length = IW_ESSID_MAX_SIZE; 49 iwr.u.data.length = IW_ESSID_MAX_SIZE;
50 iwr.u.data.flags = 0; 50 iwr.u.data.flags = 0;
51 if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ 51 if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){
52 iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; 52 iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0';
53 return QString(iwr.u.data.pointer); 53 return QString(iwr.u.data.pointer);
54 } 54 }
55 return QString(); 55 return QString();
56} 56}
57 57
58/** 58/**
59 * @return QString the essid of the host 802.11 access point. 59 * @return QString the essid of the host 802.11 access point.
60 */ 60 */
61QString WExtensions::essid(){ 61QString WExtensions::essid(){
62 if(!hasWirelessExtensions) 62 if(!hasWirelessExtensions)
63 return QString(); 63 return QString();
64 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ 64 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){
65 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0'; 65 iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0';
66 return QString(iwr.u.essid.pointer); 66 return QString(iwr.u.essid.pointer);
67 } 67 }
68 return QString(); 68 return QString();
69} 69}
70 70
71/** 71/**
72 * @return QString the mode of interface 72 * @return QString the mode of interface
73 */ 73 */
74QString WExtensions::mode(){ 74QString WExtensions::mode(){
75 if(!hasWirelessExtensions) 75 if(!hasWirelessExtensions)
76 return QString(); 76 return QString();
77 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) 77 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) )
78 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); 78 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed");
79 return QString(); 79 return QString();
80} 80}
81 81
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 */
86double WExtensions::frequency(){ 86double 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 */
98int 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 */
97double WExtensions::rate(){ 120double 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/**
108 * @return QString the AccessPoint that the interface is connected to. 131 * @return QString the AccessPoint that the interface is connected to.
109 */ 132 */
110QString WExtensions::ap(){ 133QString WExtensions::ap(){
111 if(!hasWirelessExtensions) 134 if(!hasWirelessExtensions)
112 return QString(); 135 return QString();
113 if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){ 136 if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){
114 QString ap; 137 QString ap;
115 ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", 138 ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
116 iwr.u.ap_addr.sa_data[0]&0xff, 139 iwr.u.ap_addr.sa_data[0]&0xff,
117 iwr.u.ap_addr.sa_data[1]&0xff, 140 iwr.u.ap_addr.sa_data[1]&0xff,
118 iwr.u.ap_addr.sa_data[2]&0xff, 141 iwr.u.ap_addr.sa_data[2]&0xff,
119 iwr.u.ap_addr.sa_data[3]&0xff, 142 iwr.u.ap_addr.sa_data[3]&0xff,
120 iwr.u.ap_addr.sa_data[4]&0xff, 143 iwr.u.ap_addr.sa_data[4]&0xff,
121 iwr.u.ap_addr.sa_data[5]&0xff ); 144 iwr.u.ap_addr.sa_data[5]&0xff );
122 return ap; 145 return ap;
123 } 146 }
124 else return QString(); 147 else return QString();
125} 148}
126 149
127/** 150/**
128 * Get the stats for interfaces 151 * Get the stats for interfaces
129 * @param signal the signal strength of interface 152 * @param signal the signal strength of interface
130 * @param noise the noise level of the interface 153 * @param noise the noise level of the interface
131 * @param quality the quality level of the interface 154 * @param quality the quality level of the interface
132 * @return bool true if successfull 155 * @return bool true if successfull
133 */ 156 */
134bool WExtensions::stats(int &signal, int &noise, int &quality){ 157bool WExtensions::stats(int &signal, int &noise, int &quality){
135 // gather link quality from /proc/net/wireless 158 // gather link quality from /proc/net/wireless
136 if(!QFile::exists(PROCNETWIRELESS)) 159 if(!QFile::exists(PROCNETWIRELESS))
137 return false; 160 return false;
138 161
139 char c; 162 char c;
140 QString status; 163 QString status;
141 QString name; 164 QString name;
142 165
143 QFile wfile( PROCNETWIRELESS ); 166 QFile wfile( PROCNETWIRELESS );
144 if(!wfile.open( IO_ReadOnly )) 167 if(!wfile.open( IO_ReadOnly ))
145 return false; 168 return false;
146 169
147 QTextStream wstream( &wfile ); 170 QTextStream wstream( &wfile );
148 wstream.readLine(); // skip the first two lines 171 wstream.readLine(); // skip the first two lines
149 wstream.readLine(); // because they only contain headers 172 wstream.readLine(); // because they only contain headers
150 while(!wstream.atEnd()){ 173 while(!wstream.atEnd()){
151 wstream >> name >> status >> quality >> c >> signal >> c >> noise; 174 wstream >> name >> status >> quality >> c >> signal >> c >> noise;
152 if(name == QString("%1:").arg(interface)){ 175 if(name == QString("%1:").arg(interface)){
153 if ( quality > 92 ) 176 if ( quality > 92 )
154 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); 177 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
155 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) 178 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
156 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); 179 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
157 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) 180 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
158 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); 181 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
159 //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); 182 //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1());
160 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; 183 signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER;
161 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; 184 noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
162 quality = ( quality*100 ) / 92; 185 quality = ( quality*100 ) / 92;
163 return true; 186 return true;
164 } 187 }
165 } 188 }
166 189
167 qDebug("WExtensions::statsCard no longer present."); 190 qDebug("WExtensions::statsCard no longer present.");
168 quality = -1; 191 quality = -1;
169 signal = IW_LOWER; 192 signal = IW_LOWER;
170 noise = IW_LOWER; 193 noise = IW_LOWER;
171 return false; 194 return false;
172} 195}
173 196
174// wextensions.cpp 197// wextensions.cpp
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
@@ -1,33 +1,34 @@
1#ifndef WEXTENSIONS_H 1#ifndef WEXTENSIONS_H
2#define WEXTENSIONS_H 2#define WEXTENSIONS_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5 5
6#include <netinet/ip.h> 6#include <netinet/ip.h>
7#include <linux/wireless.h> 7#include <linux/wireless.h>
8 8
9class WExtensions { 9class WExtensions {
10 10
11public: 11public:
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
23private: 24private:
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
31}; 32};
32 33
33#endif 34#endif