[PC-BSD Commits] r6888 - in pcbsd: current/pcbsd-netmanager/src/NetworkManager current/pcbsd-netmanager/src/NetworkTray current/pcbsd-netmanager/src/wificonfig stable/pcbsd-netmanager/src/NetworkManager stable/pcbsd-netmanager/src/NetworkTray stable/pcbsd-netmanager/src/wificonfig
svn at pcbsd.org
svn at pcbsd.org
Thu Jun 10 08:50:49 PDT 2010
Author: kris
Date: 2010-06-10 08:50:49 -0700 (Thu, 10 Jun 2010)
New Revision: 6888
Modified:
pcbsd/current/pcbsd-netmanager/src/NetworkManager/networkman.cpp
pcbsd/current/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp
pcbsd/current/pcbsd-netmanager/src/wificonfig/wifiscanssid.cpp
pcbsd/current/pcbsd-netmanager/src/wificonfig/wifiscanssid.h
pcbsd/stable/pcbsd-netmanager/src/NetworkManager/networkman.cpp
pcbsd/stable/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp
pcbsd/stable/pcbsd-netmanager/src/wificonfig/wifiscanssid.cpp
pcbsd/stable/pcbsd-netmanager/src/wificonfig/wifiscanssid.h
Log:
Update to network manager, fixed signal strength bugs in network tray, now
properly get a % value of strength, also exclude a few bogus net devs from showing up in GUI list
Modified: pcbsd/current/pcbsd-netmanager/src/NetworkManager/networkman.cpp
===================================================================
--- pcbsd/current/pcbsd-netmanager/src/NetworkManager/networkman.cpp 2010-06-10 14:11:57 UTC (rev 6887)
+++ pcbsd/current/pcbsd-netmanager/src/NetworkManager/networkman.cpp 2010-06-10 15:50:49 UTC (rev 6888)
@@ -93,11 +93,13 @@
QString dev = *it;
if (dev.indexOf("lo") != 0
+ && dev.indexOf("fwe") == -1
+ && dev.indexOf("ipfw") == -1
&& dev.indexOf("lagg") == -1
- && dev.indexOf("fwe") == -1
&& dev.indexOf("plip") == -1
&& dev.indexOf("pfsync") == -1
&& dev.indexOf("pflog") == -1
+ && dev.indexOf("vboxnet") == -1
&& dev.indexOf("tun") == -1)
{
if ( FreeBSDMajor >= 8 )
Modified: pcbsd/current/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/current/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp 2010-06-10 14:11:57 UTC (rev 6887)
+++ pcbsd/current/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp 2010-06-10 15:50:49 UTC (rev 6888)
@@ -235,19 +235,52 @@
QString NetworkTray::getSignalStrengthForIdent( QString ident )
{
+ // Get the signal strength of this device
QString command = "ifconfig " + ident + " list scan | grep " + DeviceSSID;
QString line = getLineFromCommandOutput(command);
- QString tmp;
+ QString tmp, sig, noise;
+ bool ok, ok2;
+ int isig, inoise, percent;
- // Get the signal strength of this device
tmp = line.simplified();
- // First remove the SSID which may have spaces in it
- tmp.remove(tmp.lastIndexOf(":"), tmp.size());
- tmp = tmp.simplified();
- tmp.remove(0, tmp.lastIndexOf(" "));
- tmp = tmp.simplified();
+ // Lets find the signal strength / noise variables now
+ tmp.remove(0, tmp.indexOf(":"));
+ tmp.remove(0, tmp.indexOf(" "));
+ // Get the noise
+ noise = tmp.simplified();
+ noise.remove(0, noise.lastIndexOf(":") + 1);
+ noise.remove(noise.indexOf(" "), noise.size());
+ noise = noise.simplified();
+ if ( noise.indexOf("-") == 0)
+ noise.remove(0, 1);
+
+ // Get the signal
+ sig = tmp.simplified();
+ sig.remove(sig.indexOf(":"), sig.size());
+ sig.remove(0, sig.lastIndexOf(" "));
+ sig = sig.simplified();
+ if ( sig.indexOf("-") == 0)
+ sig.remove(0, 1);
+
+ //qDebug() << "Signal:" << sig << " Noise:" << noise;
+
+ // Now figure out the percentage
+ isig = sig.toInt(&ok);
+ inoise = noise.toInt(&ok2);
+ if ( ok && ok2 ) {
+ percent = (inoise - isig) * 4;
+ // Sanity check
+ if ( percent > 100 )
+ percent = 100;
+ if ( percent < 0 )
+ percent = 0;
+ tmp.setNum(percent);
+ } else {
+ tmp = "";
+ }
+
return tmp;
}
@@ -442,9 +475,11 @@
iconStrength = 85;
Icon = iconWifiConnect85;
}
- }
- // Get the connection speed being used
- DeviceWirelessSpeed = getWirelessSpeedForIdent( DeviceName );
+ } else {
+ DeviceSignalStrength = tr("Unknown");
+ }
+ // Get the connection speed being used
+ DeviceWirelessSpeed = getWirelessSpeedForIdent( DeviceName );
}
}
@@ -614,7 +649,9 @@
ifconfigOutput.clear();
ifconfigOutput = getIfProc->readAllStandardOutput().simplified();
}
- qDebug() << "ifconfig output: " << ifconfigOutput <<"\n";
+
+ //qDebug() << "ifconfig output: " << ifconfigOutput <<"\n";
+
getIfProc->kill();
delete getIfProc;
}
Modified: pcbsd/current/pcbsd-netmanager/src/wificonfig/wifiscanssid.cpp
===================================================================
--- pcbsd/current/pcbsd-netmanager/src/wificonfig/wifiscanssid.cpp 2010-06-10 14:11:57 UTC (rev 6887)
+++ pcbsd/current/pcbsd-netmanager/src/wificonfig/wifiscanssid.cpp 2010-06-10 15:50:49 UTC (rev 6888)
@@ -15,6 +15,58 @@
connect( pushSelect, SIGNAL( clicked() ), this, SLOT(slotConnect()) );
connect( pushCancel, SIGNAL( clicked() ), this, SLOT(slotCancel()) );
}
+
+QString wifiscanssid::getSignalStrengthForIdent( QString ifoutput )
+{
+ // Get the signal strength of this device
+ QString tmp, sig, noise;
+ bool ok, ok2;
+ int isig, inoise, percent;
+
+ tmp = ifoutput.simplified();
+
+ // Lets find the signal strength / noise variables now
+ tmp.remove(0, tmp.indexOf(":"));
+ tmp.remove(0, tmp.indexOf(" "));
+
+ // Get the noise
+ noise = tmp.simplified();
+ noise.remove(0, noise.indexOf(" "));
+ noise.remove(0, noise.indexOf(" "));
+ noise.remove(0, noise.indexOf(":") + 1);
+ noise.remove(noise.indexOf(" "), noise.size());
+ noise = noise.simplified();
+ if ( noise.indexOf("-") == 0)
+ noise.remove(0, 1);
+
+ // Get the signal
+ sig = tmp.simplified();
+ sig.remove(sig.indexOf(":"), sig.size());
+ sig.remove(0, sig.lastIndexOf(" "));
+ sig = sig.simplified();
+ if ( sig.indexOf("-") == 0)
+ sig.remove(0, 1);
+
+ //qDebug() << "Signal:" << sig << " Noise:" << noise;
+ //QMessageBox::warning( this, "Testing", "signal:" + sig + " noise:" + noise );
+
+ // Now figure out the percentage
+ isig = sig.toInt(&ok);
+ inoise = noise.toInt(&ok2);
+ if ( ok && ok2 ) {
+ percent = (inoise - isig) * 4;
+ // Sanity check
+ if ( percent > 100 )
+ percent = 100;
+ if ( percent < 0 )
+ percent = 0;
+ tmp.setNum(percent);
+ } else {
+ tmp = "";
+ }
+
+ return tmp;
+}
void wifiscanssid::scanWifi()
{
@@ -51,18 +103,8 @@
ssid = tmp;
// Get the signal strength of this device
- tmp = line;
- tmp = tmp.simplified();
+ strength = getSignalStrengthForIdent( line );
- // First remove the SSID which may have spaces in it
- tmp.remove(0, tmp.indexOf(":"));
-
- // Now find the strength section
- tmp.truncate(tmp.lastIndexOf("SSID<"));
- tmp.truncate(tmp.lastIndexOf(":"));
- tmp.remove(0, tmp.lastIndexOf(" "));
- strength = tmp;
-
//QMessageBox::warning( this, "Testing", "SSID:" + ssid + " STR:" + strength );
// Add the device to the list box
strength.toInt(&ok);
@@ -79,7 +121,6 @@
FileLoad=KStandardDirs::locate("data", "pc-netmanager/pics/tray_wifi85.png");
}
-
QImage *Icon = new QImage(FileLoad);
QPixmap PixmapIcon;
PixmapIcon.fromImage(Icon->scaled(22,22));
Modified: pcbsd/current/pcbsd-netmanager/src/wificonfig/wifiscanssid.h
===================================================================
--- pcbsd/current/pcbsd-netmanager/src/wificonfig/wifiscanssid.h 2010-06-10 14:11:57 UTC (rev 6887)
+++ pcbsd/current/pcbsd-netmanager/src/wificonfig/wifiscanssid.h 2010-06-10 15:50:49 UTC (rev 6888)
@@ -30,6 +30,7 @@
private:
QString DeviceName;
QString getLineFromCommandOutput( QString command );
+ QString getSignalStrengthForIdent( QString ifoutput );
signals:
void saved(QString);
Modified: pcbsd/stable/pcbsd-netmanager/src/NetworkManager/networkman.cpp
===================================================================
--- pcbsd/stable/pcbsd-netmanager/src/NetworkManager/networkman.cpp 2010-06-10 14:11:57 UTC (rev 6887)
+++ pcbsd/stable/pcbsd-netmanager/src/NetworkManager/networkman.cpp 2010-06-10 15:50:49 UTC (rev 6888)
@@ -93,11 +93,13 @@
QString dev = *it;
if (dev.indexOf("lo") != 0
+ && dev.indexOf("fwe") == -1
+ && dev.indexOf("ipfw") == -1
&& dev.indexOf("lagg") == -1
- && dev.indexOf("fwe") == -1
&& dev.indexOf("plip") == -1
&& dev.indexOf("pfsync") == -1
&& dev.indexOf("pflog") == -1
+ && dev.indexOf("vboxnet") == -1
&& dev.indexOf("tun") == -1)
{
if ( FreeBSDMajor >= 8 )
Modified: pcbsd/stable/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/stable/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp 2010-06-10 14:11:57 UTC (rev 6887)
+++ pcbsd/stable/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp 2010-06-10 15:50:49 UTC (rev 6888)
@@ -235,19 +235,52 @@
QString NetworkTray::getSignalStrengthForIdent( QString ident )
{
+ // Get the signal strength of this device
QString command = "ifconfig " + ident + " list scan | grep " + DeviceSSID;
QString line = getLineFromCommandOutput(command);
- QString tmp;
+ QString tmp, sig, noise;
+ bool ok, ok2;
+ int isig, inoise, percent;
- // Get the signal strength of this device
tmp = line.simplified();
- // First remove the SSID which may have spaces in it
- tmp.remove(tmp.lastIndexOf(":"), tmp.size());
- tmp = tmp.simplified();
- tmp.remove(0, tmp.lastIndexOf(" "));
- tmp = tmp.simplified();
+ // Lets find the signal strength / noise variables now
+ tmp.remove(0, tmp.indexOf(":"));
+ tmp.remove(0, tmp.indexOf(" "));
+ // Get the noise
+ noise = tmp.simplified();
+ noise.remove(0, noise.lastIndexOf(":") + 1);
+ noise.remove(noise.indexOf(" "), noise.size());
+ noise = noise.simplified();
+ if ( noise.indexOf("-") == 0)
+ noise.remove(0, 1);
+
+ // Get the signal
+ sig = tmp.simplified();
+ sig.remove(sig.indexOf(":"), sig.size());
+ sig.remove(0, sig.lastIndexOf(" "));
+ sig = sig.simplified();
+ if ( sig.indexOf("-") == 0)
+ sig.remove(0, 1);
+
+ //qDebug() << "Signal:" << sig << " Noise:" << noise;
+
+ // Now figure out the percentage
+ isig = sig.toInt(&ok);
+ inoise = noise.toInt(&ok2);
+ if ( ok && ok2 ) {
+ percent = (inoise - isig) * 4;
+ // Sanity check
+ if ( percent > 100 )
+ percent = 100;
+ if ( percent < 0 )
+ percent = 0;
+ tmp.setNum(percent);
+ } else {
+ tmp = "";
+ }
+
return tmp;
}
@@ -442,9 +475,11 @@
iconStrength = 85;
Icon = iconWifiConnect85;
}
- }
- // Get the connection speed being used
- DeviceWirelessSpeed = getWirelessSpeedForIdent( DeviceName );
+ } else {
+ DeviceSignalStrength = tr("Unknown");
+ }
+ // Get the connection speed being used
+ DeviceWirelessSpeed = getWirelessSpeedForIdent( DeviceName );
}
}
@@ -614,7 +649,9 @@
ifconfigOutput.clear();
ifconfigOutput = getIfProc->readAllStandardOutput().simplified();
}
- qDebug() << "ifconfig output: " << ifconfigOutput <<"\n";
+
+ //qDebug() << "ifconfig output: " << ifconfigOutput <<"\n";
+
getIfProc->kill();
delete getIfProc;
}
Modified: pcbsd/stable/pcbsd-netmanager/src/wificonfig/wifiscanssid.cpp
===================================================================
--- pcbsd/stable/pcbsd-netmanager/src/wificonfig/wifiscanssid.cpp 2010-06-10 14:11:57 UTC (rev 6887)
+++ pcbsd/stable/pcbsd-netmanager/src/wificonfig/wifiscanssid.cpp 2010-06-10 15:50:49 UTC (rev 6888)
@@ -15,6 +15,58 @@
connect( pushSelect, SIGNAL( clicked() ), this, SLOT(slotConnect()) );
connect( pushCancel, SIGNAL( clicked() ), this, SLOT(slotCancel()) );
}
+
+QString wifiscanssid::getSignalStrengthForIdent( QString ifoutput )
+{
+ // Get the signal strength of this device
+ QString tmp, sig, noise;
+ bool ok, ok2;
+ int isig, inoise, percent;
+
+ tmp = ifoutput.simplified();
+
+ // Lets find the signal strength / noise variables now
+ tmp.remove(0, tmp.indexOf(":"));
+ tmp.remove(0, tmp.indexOf(" "));
+
+ // Get the noise
+ noise = tmp.simplified();
+ noise.remove(0, noise.indexOf(" "));
+ noise.remove(0, noise.indexOf(" "));
+ noise.remove(0, noise.indexOf(":") + 1);
+ noise.remove(noise.indexOf(" "), noise.size());
+ noise = noise.simplified();
+ if ( noise.indexOf("-") == 0)
+ noise.remove(0, 1);
+
+ // Get the signal
+ sig = tmp.simplified();
+ sig.remove(sig.indexOf(":"), sig.size());
+ sig.remove(0, sig.lastIndexOf(" "));
+ sig = sig.simplified();
+ if ( sig.indexOf("-") == 0)
+ sig.remove(0, 1);
+
+ //qDebug() << "Signal:" << sig << " Noise:" << noise;
+ //QMessageBox::warning( this, "Testing", "signal:" + sig + " noise:" + noise );
+
+ // Now figure out the percentage
+ isig = sig.toInt(&ok);
+ inoise = noise.toInt(&ok2);
+ if ( ok && ok2 ) {
+ percent = (inoise - isig) * 4;
+ // Sanity check
+ if ( percent > 100 )
+ percent = 100;
+ if ( percent < 0 )
+ percent = 0;
+ tmp.setNum(percent);
+ } else {
+ tmp = "";
+ }
+
+ return tmp;
+}
void wifiscanssid::scanWifi()
{
@@ -51,18 +103,8 @@
ssid = tmp;
// Get the signal strength of this device
- tmp = line;
- tmp = tmp.simplified();
+ strength = getSignalStrengthForIdent( line );
- // First remove the SSID which may have spaces in it
- tmp.remove(0, tmp.indexOf(":"));
-
- // Now find the strength section
- tmp.truncate(tmp.lastIndexOf("SSID<"));
- tmp.truncate(tmp.lastIndexOf(":"));
- tmp.remove(0, tmp.lastIndexOf(" "));
- strength = tmp;
-
//QMessageBox::warning( this, "Testing", "SSID:" + ssid + " STR:" + strength );
// Add the device to the list box
strength.toInt(&ok);
@@ -79,7 +121,6 @@
FileLoad=KStandardDirs::locate("data", "pc-netmanager/pics/tray_wifi85.png");
}
-
QImage *Icon = new QImage(FileLoad);
QPixmap PixmapIcon;
PixmapIcon.fromImage(Icon->scaled(22,22));
Modified: pcbsd/stable/pcbsd-netmanager/src/wificonfig/wifiscanssid.h
===================================================================
--- pcbsd/stable/pcbsd-netmanager/src/wificonfig/wifiscanssid.h 2010-06-10 14:11:57 UTC (rev 6887)
+++ pcbsd/stable/pcbsd-netmanager/src/wificonfig/wifiscanssid.h 2010-06-10 15:50:49 UTC (rev 6888)
@@ -30,6 +30,7 @@
private:
QString DeviceName;
QString getLineFromCommandOutput( QString command );
+ QString getSignalStrengthForIdent( QString ifoutput );
signals:
void saved(QString);
More information about the Commits
mailing list