summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/wlan/wextensions.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/wlan/wextensions.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp
index bd7cf93..d1fff88 100644
--- a/noncore/settings/networksettings/wlan/wextensions.cpp
+++ b/noncore/settings/networksettings/wlan/wextensions.cpp
@@ -110,91 +110,91 @@ int WExtensions::channel(){
if( num >= left && num <= right )
return channel;
left += 0.005;
right += 0.005;
}
qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1());
return -1;
}
/***
* Get the current rate that the card is transmiting at.
* @return double the rate, 0 if error.
*/
double WExtensions::rate(){
if(!hasWirelessExtensions)
return 0;
if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){
return ((double)iwr.u.bitrate.value)/1000000;
}
return 0;
}
/**
* @return QString the AccessPoint that the interface is connected to.
*/
QString WExtensions::ap(){
if(!hasWirelessExtensions)
return QString();
if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){
QString ap;
ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
iwr.u.ap_addr.sa_data[0]&0xff,
iwr.u.ap_addr.sa_data[1]&0xff,
iwr.u.ap_addr.sa_data[2]&0xff,
iwr.u.ap_addr.sa_data[3]&0xff,
iwr.u.ap_addr.sa_data[4]&0xff,
iwr.u.ap_addr.sa_data[5]&0xff );
return ap;
}
else return QString();
}
/**
* Get the stats for interfaces
* @param signal the signal strength of interface
* @param noise the noise level of the interface
* @param quality the quality level of the interface
- * @return bool true if successfull
+ * @return bool true if successful
*/
bool WExtensions::stats(int &signal, int &noise, int &quality){
// gather link quality from /proc/net/wireless
if(!QFile::exists(PROCNETWIRELESS))
return false;
char c;
QString status;
QString name;
QFile wfile( PROCNETWIRELESS );
if(!wfile.open( IO_ReadOnly ))
return false;
QTextStream wstream( &wfile );
wstream.readLine(); // skip the first two lines
wstream.readLine(); // because they only contain headers
while(!wstream.atEnd()){
wstream >> name >> status >> quality >> c >> signal >> c >> noise;
if(name == QString("%1:").arg(interface)){
if ( quality > 92 )
qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
//qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1());
signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER;
noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
quality = ( quality*100 ) / 92;
return true;
}
}
qDebug("WExtensions::statsCard no longer present.");
quality = -1;
signal = IW_LOWER;
noise = IW_LOWER;
return false;
}
// wextensions.cpp