summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2002-10-22 20:41:01 (UTC)
committer benmeyer <benmeyer>2002-10-22 20:41:01 (UTC)
commit1e1b3e398d6b978a9c2bbd85d8f6b7aafbf72b2f (patch) (side-by-side diff)
treec1e6feec60794552bdca607f4dbe180e1988a924
parent44a60b35b903b68f2f60f5ba29b84db1563dd9f3 (diff)
downloadopie-1e1b3e398d6b978a9c2bbd85d8f6b7aafbf72b2f.zip
opie-1e1b3e398d6b978a9c2bbd85d8f6b7aafbf72b2f.tar.gz
opie-1e1b3e398d6b978a9c2bbd85d8f6b7aafbf72b2f.tar.bz2
info now works
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/networksetup/wlan/info.ui35
-rw-r--r--noncore/net/networksetup/wlan/wextensions.cpp41
-rw-r--r--noncore/net/networksetup/wlan/wextensions.h1
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.cpp3
-rw-r--r--noncore/settings/networksettings/wlan/info.ui35
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp41
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.h1
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp3
8 files changed, 132 insertions, 28 deletions
diff --git a/noncore/net/networksetup/wlan/info.ui b/noncore/net/networksetup/wlan/info.ui
index 4e85b1b..52d3a43 100644
--- a/noncore/net/networksetup/wlan/info.ui
+++ b/noncore/net/networksetup/wlan/info.ui
@@ -226,5 +226,5 @@
<number>6</number>
</property>
- <spacer row="3" column="1" >
+ <spacer row="4" column="1" >
<property>
<name>name</name>
@@ -301,4 +301,37 @@
</property>
</widget>
+ <widget row="3" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel4_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Rate</string>
+ </property>
+ </widget>
+ <widget row="3" column="1" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rateLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>Panel</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
+ </property>
+ </widget>
</grid>
</widget>
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp
index f45ebf2..ef4ba8f 100644
--- a/noncore/net/networksetup/wlan/wextensions.cpp
+++ b/noncore/net/networksetup/wlan/wextensions.cpp
@@ -11,6 +11,6 @@
#define PROCNETWIRELESS "/proc/net/wireless"
-#define IW_LOWER 140
-#define IW_UPPER 200
+#define IW_LOWER 0
+#define IW_UPPER 256
/**
@@ -90,6 +90,19 @@ double WExtensions::frequency(){
if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr ))
return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
- return 0;;
+ return 0;
+}
+
+/***
+ * Get the current rate that the card is transmiting at.
+ */
+double WExtensions::rate(){
+ if(!hasWirelessExtensions)
+ return 0;
+ if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){
+ return ((double)iwr.u.bitrate.value)/1000000;
}
+ return 0;
+}
+
/**
@@ -111,7 +124,13 @@ QString WExtensions::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
+ */
bool WExtensions::stats(int &signal, int &noise, int &quality){
// gather link quality from /proc/net/wireless
@@ -132,22 +151,20 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){
while(!wstream.atEnd()){
wstream >> name >> status >> quality >> c >> signal >> c >> noise;
- if(name == interface){
+ if(name == QString("%1:").arg(interface)){
if ( quality > 92 )
- #ifdef MDEBUG
qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
- #endif
if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
- #ifdef MDEBUG
qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
- #endif
if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
- #ifdef MDEBUG
qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
- #endif
+ 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("Card no longer present");
+ qDebug("WExtensions::statsCard no longer present.");
quality = -1;
signal = IW_LOWER;
diff --git a/noncore/net/networksetup/wlan/wextensions.h b/noncore/net/networksetup/wlan/wextensions.h
index 29997f5..1565eb5 100644
--- a/noncore/net/networksetup/wlan/wextensions.h
+++ b/noncore/net/networksetup/wlan/wextensions.h
@@ -17,4 +17,5 @@ public:
QString mode();
double frequency();
+ double rate();
QString ap();
bool stats( int &signal, int &noise, int &quality);
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp
index ab0b9a5..73e753c 100644
--- a/noncore/net/networksetup/wlan/wlanmodule.cpp
+++ b/noncore/net/networksetup/wlan/wlanmodule.cpp
@@ -84,5 +84,5 @@ QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
info->stationLabel->setText(we.station());
info->modeLabel->setText(we.mode());
- info->freqLabel->setText(QString("%1").arg(we.frequency()));
+ info->freqLabel->setText(QString("%1 GHz").arg(we.frequency()));
int signal = 0;
int noise = 0;
@@ -92,4 +92,5 @@ QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
info->noiseProgressBar->setProgress(noise);
info->qualityProgressBar->setProgress(quality);
+ info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate()));
return info;
}
diff --git a/noncore/settings/networksettings/wlan/info.ui b/noncore/settings/networksettings/wlan/info.ui
index 4e85b1b..52d3a43 100644
--- a/noncore/settings/networksettings/wlan/info.ui
+++ b/noncore/settings/networksettings/wlan/info.ui
@@ -226,5 +226,5 @@
<number>6</number>
</property>
- <spacer row="3" column="1" >
+ <spacer row="4" column="1" >
<property>
<name>name</name>
@@ -301,4 +301,37 @@
</property>
</widget>
+ <widget row="3" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel4_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Rate</string>
+ </property>
+ </widget>
+ <widget row="3" column="1" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rateLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>Panel</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
+ </property>
+ </widget>
</grid>
</widget>
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp
index f45ebf2..ef4ba8f 100644
--- a/noncore/settings/networksettings/wlan/wextensions.cpp
+++ b/noncore/settings/networksettings/wlan/wextensions.cpp
@@ -11,6 +11,6 @@
#define PROCNETWIRELESS "/proc/net/wireless"
-#define IW_LOWER 140
-#define IW_UPPER 200
+#define IW_LOWER 0
+#define IW_UPPER 256
/**
@@ -90,6 +90,19 @@ double WExtensions::frequency(){
if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr ))
return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
- return 0;;
+ return 0;
+}
+
+/***
+ * Get the current rate that the card is transmiting at.
+ */
+double WExtensions::rate(){
+ if(!hasWirelessExtensions)
+ return 0;
+ if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){
+ return ((double)iwr.u.bitrate.value)/1000000;
}
+ return 0;
+}
+
/**
@@ -111,7 +124,13 @@ QString WExtensions::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
+ */
bool WExtensions::stats(int &signal, int &noise, int &quality){
// gather link quality from /proc/net/wireless
@@ -132,22 +151,20 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){
while(!wstream.atEnd()){
wstream >> name >> status >> quality >> c >> signal >> c >> noise;
- if(name == interface){
+ if(name == QString("%1:").arg(interface)){
if ( quality > 92 )
- #ifdef MDEBUG
qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
- #endif
if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
- #ifdef MDEBUG
qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
- #endif
if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
- #ifdef MDEBUG
qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
- #endif
+ 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("Card no longer present");
+ qDebug("WExtensions::statsCard no longer present.");
quality = -1;
signal = IW_LOWER;
diff --git a/noncore/settings/networksettings/wlan/wextensions.h b/noncore/settings/networksettings/wlan/wextensions.h
index 29997f5..1565eb5 100644
--- a/noncore/settings/networksettings/wlan/wextensions.h
+++ b/noncore/settings/networksettings/wlan/wextensions.h
@@ -17,4 +17,5 @@ public:
QString mode();
double frequency();
+ double rate();
QString ap();
bool stats( int &signal, int &noise, int &quality);
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index ab0b9a5..73e753c 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -84,5 +84,5 @@ QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
info->stationLabel->setText(we.station());
info->modeLabel->setText(we.mode());
- info->freqLabel->setText(QString("%1").arg(we.frequency()));
+ info->freqLabel->setText(QString("%1 GHz").arg(we.frequency()));
int signal = 0;
int noise = 0;
@@ -92,4 +92,5 @@ QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
info->noiseProgressBar->setProgress(noise);
info->qualityProgressBar->setProgress(quality);
+ info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate()));
return info;
}