summaryrefslogtreecommitdiffstats
path: root/LogReceiver/networkdiscovery.cpp
diff options
context:
space:
mode:
authorNiklas2011-09-29 15:48:11 +0200
committerNiklas2011-09-29 15:48:11 +0200
commit1a88507a1b7294e6288e64bbd326c9ef923f656e (patch)
tree4210a9a2c201d91112d895c743a8ef773df3b24a /LogReceiver/networkdiscovery.cpp
parentdid some refactoring. added a user choice screen which is shown 2 seconds bef... (diff)
downloadfbgui-1a88507a1b7294e6288e64bbd326c9ef923f656e.tar.gz
fbgui-1a88507a1b7294e6288e64bbd326c9ef923f656e.tar.xz
fbgui-1a88507a1b7294e6288e64bbd326c9ef923f656e.zip
tried to solve the timing problem. but failed. it is also enough to test for the isRunning flag in order to get informations about pluged state
Diffstat (limited to 'LogReceiver/networkdiscovery.cpp')
-rw-r--r--LogReceiver/networkdiscovery.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/LogReceiver/networkdiscovery.cpp b/LogReceiver/networkdiscovery.cpp
index a526a6f..ee0b5ad 100644
--- a/LogReceiver/networkdiscovery.cpp
+++ b/LogReceiver/networkdiscovery.cpp
@@ -154,6 +154,11 @@ QList<QString> NetworkDiscovery::getListOfNetworkInterfaces() {
if(!(nI.flags() & QNetworkInterface::IsUp)) {
_networkManager.bringInterfaceUP(nI.humanReadableName());
}
+ /*
+ * if(!checkForIsRunning(nI)) {
+ continue;
+ }
+ */
if (!checkCarrierState(nI.humanReadableName())) {
continue;
}
@@ -166,6 +171,18 @@ QList<QString> NetworkDiscovery::getListOfNetworkInterfaces() {
return result;
}
+bool NetworkDiscovery::checkForIsRunning(QNetworkInterface networkInterface) {
+ bool retval = false;
+ for (int i = 0; i < 4; i++) {
+ retval = (networkInterface.flags() & QNetworkInterface::IsRunning);
+ if(retval) {
+ return retval;
+ }
+ sleep(1);
+ }
+ return retval;
+}
+
QList<QString> NetworkDiscovery::checkCarrierState(QList<QString> &interfaces) {
QList<QString> result;
foreach(QString nI, interfaces)