summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2012-02-23 09:38:21 +0100
committerJonathan Bauer2012-02-23 09:38:21 +0100
commitebfec6cb6e5821ee8d6bf3def47b46eba508324c (patch)
tree72674177af64972369c83013de8cafca34350ba3
parentsorted functions declarations & deleted some unused members... (diff)
downloadfbgui-ebfec6cb6e5821ee8d6bf3def47b46eba508324c.tar.gz
fbgui-ebfec6cb6e5821ee8d6bf3def47b46eba508324c.tar.xz
fbgui-ebfec6cb6e5821ee8d6bf3def47b46eba508324c.zip
connected interfaces saved in networkdiscovery class and now accessed by getter & minor
-rw-r--r--src/fbgui/fbgui.cpp3
-rw-r--r--src/fbgui/ndgui.cpp25
-rw-r--r--src/fbgui/ndgui.h1
-rw-r--r--src/fbgui/networkdiscovery.cpp14
-rw-r--r--src/fbgui/networkdiscovery.h7
5 files changed, 23 insertions, 27 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp
index 3a9f686..48e776b 100644
--- a/src/fbgui/fbgui.cpp
+++ b/src/fbgui/fbgui.cpp
@@ -191,6 +191,9 @@ QByteArray fbgui::generatePOSTData() {
serial.chop(1); // chop EOF
LOG4CXX_DEBUG(coreLogger, "[post] Serial number is: " << serial);
+ if (gInterfaceName.isEmpty())
+ gInterfaceName = "eth0";
+
// construct final byte array
QByteArray postData("mac=");
postData.append(si.getInfo("mac"));
diff --git a/src/fbgui/ndgui.cpp b/src/fbgui/ndgui.cpp
index 447b396..ad7ff5f 100644
--- a/src/fbgui/ndgui.cpp
+++ b/src/fbgui/ndgui.cpp
@@ -62,8 +62,6 @@ void ndgui::init() {
connect(_networkDiscovery,
SIGNAL(changeProgressBarValue(const QString & , const int& )),
_jsi, SLOT(updateIfProgressBar(const QString & , const int&)));
- connect(_networkDiscovery, SIGNAL(connectionEstablished(QString)), this,
- SLOT(handleConnectionEstablished(QString)));
connect(_networkDiscovery, SIGNAL(allProcessesFinished()), this,
SLOT(handleAllProcessesFinished()));
connect(_jsi, SIGNAL(startFbgui(const QString&)), this,
@@ -128,18 +126,6 @@ void ndgui::startNetworkDiscovery() {
}
/**
- * @brief handle if a interface is able to connect
- *
- * if we have a user choice (_userChoice = true) than networkDiscovery will
- * emit connectionEstablished signals.
- * Add the interface name to a _ifNameList. This list holds all interfaces
- * the user can choose out of.
- */
-void ndgui::handleConnectionEstablished(QString ifName) {
- _ifNameList.append(ifName);
-}
-
-/**
* @brief determines if we continue the boot sequence or if we show the chooseInterface or abortBoot dialog
*
* if we have a user choice (_userChoice = true) than networkDiscovery will
@@ -152,11 +138,12 @@ void ndgui::handleConnectionEstablished(QString ifName) {
void ndgui::handleAllProcessesFinished() {
LOG4CXX_DEBUG(ndLogger, "all Processes finished");
_allowUserChoice->setEnabled(false);
- if (_ifNameList.size() > 0) {
+ QList<QString> ifConnectedList = _networkDiscovery->getIfConnectedList();
+ if (ifConnectedList.size() > 0) {
if (_userChoice) {
- _jsi->chooseInterfaceDialog(_ifNameList);
+ _jsi->chooseInterfaceDialog(ifConnectedList);
} else {
- foreach(QString i, _ifNameList)
+ foreach(QString i, ifConnectedList)
{
if (_networkDiscovery->checkConnectivity(i)) {
continueBootWithoutCheck(i);
@@ -165,10 +152,10 @@ void ndgui::handleAllProcessesFinished() {
}
}
} else {
- LOG4CXX_DEBUG(ndLogger, " No usable interfaces found!: " << _networkDiscovery->GetErrorStr());
+ LOG4CXX_DEBUG(ndLogger, " No usable interfaces found!: " << _networkDiscovery->getErrorStr());
LOG4CXX_DEBUG(ndLogger, " list is empty");
_jsi->abortBoot("No usable interfaces found!"
- + _networkDiscovery->GetErrorStr());
+ + _networkDiscovery->getErrorStr());
}
}
diff --git a/src/fbgui/ndgui.h b/src/fbgui/ndgui.h
index 8a02a99..3686c90 100644
--- a/src/fbgui/ndgui.h
+++ b/src/fbgui/ndgui.h
@@ -35,7 +35,6 @@ public slots:
void startNetworkDiscovery();
- void handleConnectionEstablished(QString ifName);
void handleAllProcessesFinished();
void continueBootWithoutCheck(QString ifName);
diff --git a/src/fbgui/networkdiscovery.cpp b/src/fbgui/networkdiscovery.cpp
index 865d76b..7b75ec5 100644
--- a/src/fbgui/networkdiscovery.cpp
+++ b/src/fbgui/networkdiscovery.cpp
@@ -61,7 +61,7 @@ void NetworkDiscovery::initAndRun(bool userChoice, QStringList* args) {
_ifUpCountdown = 10;
_errorStr = "";
- _networkManager = new NetworkManager();
+
_clientProcessToIfNameMap.clear();
_clients.clear();
_dhcpcdArguments.clear();
@@ -69,7 +69,10 @@ void NetworkDiscovery::initAndRun(bool userChoice, QStringList* args) {
_ifNameToClient.clear();
_ifUpList.clear();
_ifcMap.clear();
+
+
_server = new QLocalServer();
+ _networkManager = new NetworkManager();
if (gSocketServerPath != DEFAULT_QTSOCKETADDRESS) {
_dhcpcdArguments.append("-q");
@@ -370,7 +373,7 @@ void NetworkDiscovery::handleProcessFinished(int exitCode,
emit
updateIfStatus(ifName, "check connectivity");
if (checkConnectivity(ifName)) {
- emit connectionEstablished(ifName);
+ _ifConnectedList.append(ifName);
if (!_userChoice) {
// blockiere jeden weiteren check
_blocked = true;
@@ -739,6 +742,9 @@ void NetworkDiscovery::handleNewInputLine(QLocalSocket * client,
//-------------------------------------------------------------------------
// Public member access
//-------------------------------------------------------------------------
+const QList<QString>& NetworkDiscovery::getIfConnectedList(){
+ return _ifConnectedList;
+}
/**
* @brief Return the InterfaceConfiguration for the given interface.
*
@@ -755,14 +761,14 @@ InterfaceConfiguration* NetworkDiscovery::getInterfaceConfig(QString ifName) {
*
* @return The QList<QString> member.
*/
-QList<QString> NetworkDiscovery::getIfUpList() {
+const QList<QString>& NetworkDiscovery::getIfUpList() {
return _ifUpList;
}
/**/
-QString NetworkDiscovery::GetErrorStr() {
+const QString& NetworkDiscovery::getErrorStr() {
return _errorStr;
}
diff --git a/src/fbgui/networkdiscovery.h b/src/fbgui/networkdiscovery.h
index 51dc8a7..3675120 100644
--- a/src/fbgui/networkdiscovery.h
+++ b/src/fbgui/networkdiscovery.h
@@ -50,9 +50,10 @@ public:
void prepareTryAgain();
// Public member access
- QList<QString> getIfUpList();
+ const QList<QString>& getIfConnectedList();
+ const QList<QString>& getIfUpList();
InterfaceConfiguration* getInterfaceConfig(QString ifName);
- QString GetErrorStr();
+ const QString& getErrorStr();
public slots:
void readyForRun();
@@ -73,7 +74,6 @@ signals:
void addInterface(const QString &ifName);
void updateIfStatus(QString ifName, QString status);
void changeProgressBarValue(const QString & ifName, const int $newValue);
- void connectionEstablished(QString ifName);
void allProcessesFinished();
void continueBootWithoutCheck(QString ifName);
@@ -106,6 +106,7 @@ private:
QTimer*_timer;
QList<QString> _ifUpList;
QList<QString> _ifDownList;
+ QList<QString> _ifConnectedList;
int _ifUpCountdown;
int _numberOfProcesses;
QStringList _dhcpcdArguments;