summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2012-02-01 15:46:36 +0100
committerJonathan Bauer2012-02-01 15:46:36 +0100
commit3084244f6af4492582c05d27819b6aa61e36c688 (patch)
treec148c26ed066171fef36a67b93ad7afd96bea8a4
parentadapted existing classes to reflect changes (diff)
downloadfbgui-3084244f6af4492582c05d27819b6aa61e36c688.tar.gz
fbgui-3084244f6af4492582c05d27819b6aa61e36c688.tar.xz
fbgui-3084244f6af4492582c05d27819b6aa61e36c688.zip
sysInfo gets interface name for MAC adress from networkdiscovery
-rw-r--r--src/fbgui/fbgui.cpp2
-rw-r--r--src/fbgui/fbgui.h1
-rw-r--r--src/fbgui/main.cpp2
-rw-r--r--src/fbgui/ndgui.cpp4
-rw-r--r--src/fbgui/sysinfo.cpp17
5 files changed, 10 insertions, 16 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp
index ee74452..7bf84e8 100644
--- a/src/fbgui/fbgui.cpp
+++ b/src/fbgui/fbgui.cpp
@@ -57,7 +57,7 @@ void fbgui::init() {
_webView->page()->mainFrame());
QObject::connect(jsi, SIGNAL(quitFbgui()), this, SLOT(close()));
QObject::connect(jsi, SIGNAL(shutDownClient()), this,
- SLOT(performShutDown()));
+ SLOT(shutdownSystem()));
QObject::connect(_webView->page()->mainFrame(), SIGNAL(
javaScriptWindowObjectCleared()), jsi, SLOT(attachToDOM()));
diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h
index 2feafa1..46c3b9b 100644
--- a/src/fbgui/fbgui.h
+++ b/src/fbgui/fbgui.h
@@ -46,6 +46,7 @@ extern QString downloadPath;
extern QUrl baseURL;
extern int debugMode;
extern int updateInterval;
+extern QString interfaceName;
class fbgui : public agui
{
diff --git a/src/fbgui/main.cpp b/src/fbgui/main.cpp
index e14e683..6286b9f 100644
--- a/src/fbgui/main.cpp
+++ b/src/fbgui/main.cpp
@@ -10,10 +10,8 @@
#include <log4cxx/propertyconfigurator.h>
#include "qlog4cxx.h"
-#include "agui.h"
#include "fbgui.h"
#include "ndgui.h"
-#include "console.h"
#include "../common/fbgui.h"
diff --git a/src/fbgui/ndgui.cpp b/src/fbgui/ndgui.cpp
index 34a3f2d..67bfa79 100644
--- a/src/fbgui/ndgui.cpp
+++ b/src/fbgui/ndgui.cpp
@@ -24,7 +24,7 @@ QString gServerIp("");
bool gAutoUp = true;
QString gSocketServerPath("");
QString gPathToDhcpExe("");
-
+QString interfaceName("");
/**
@@ -233,6 +233,7 @@ void ndgui::handleAllProcessesFinished() {
void ndgui::continueBoot(QString ifName) {
if (_networkDiscovery->checkConnectivity(ifName)) {
LOG4CXX_DEBUG(ndLogger, " continue with interface: " << ifName);
+ interfaceName = ifName;
emit initFbgui();
this->close();
} else {
@@ -248,6 +249,7 @@ void ndgui::continueBoot(QString ifName) {
*/
void ndgui::continueBootWithoutCheck(QString ifName) {
LOG4CXX_DEBUG(ndLogger, " continue with interface: " << ifName);
+ interfaceName = ifName;
emit initFbgui();
this->close();
}
diff --git a/src/fbgui/sysinfo.cpp b/src/fbgui/sysinfo.cpp
index 6338025..807413b 100644
--- a/src/fbgui/sysinfo.cpp
+++ b/src/fbgui/sysinfo.cpp
@@ -41,7 +41,6 @@ SysInfo::~SysInfo() {
* @see JavascriptInterface::getSysInfo(const QString& info)
*/
const QString SysInfo::getInfo(const QString& infoName) {
- LOG4CXX_DEBUG(siLogger, "requested " << infoName);
if (infoName == QString("mbserial"))
return getMainboardSerial();
else if (infoName == QString("usb"))
@@ -55,12 +54,12 @@ const QString SysInfo::getInfo(const QString& infoName) {
}
const QString SysInfo::getMACAddress() {
// Returns MAC address of eth0 for now
- QNetworkInterface qni = QNetworkInterface::interfaceFromName(QString("eth0"));
+ LOG4CXX_DEBUG(siLogger, "Requesting MAC of: " << interfaceName << " ...");
+ QNetworkInterface qni = QNetworkInterface::interfaceFromName(interfaceName);
if (!qni.isValid()) {
- //qxtLog->debug() << "[sysinfo] MAC Address: No interface matching \"eth0\" found.";
- return "no_eth0";
+ LOG4CXX_DEBUG(siLogger, "No valid interface with name: " << interfaceName);
+ return "no_interface";
}
- //eth0_index = qni.index();
return qni.hardwareAddress();
}
// -----------------------------------------------------------------------------------------------
@@ -82,6 +81,7 @@ const QString SysInfo::getMACAddress() {
* @see SysInfo::getInfo(const QString& infoName)
*/
const QString SysInfo::getMainboardSerial() {
+ LOG4CXX_DEBUG(siLogger, "Requesting Mainboard Serial...");
QString out = "";
struct sysfs_class_device *class_device = sysfs_open_class_device("dmi",
"id");
@@ -214,11 +214,4 @@ const QString SysInfo::getUsbVendorIdProductIdSerialNumber() {
}
libusb_free_device_list(devs, 1); //free the list, unref the devices in it
libusb_exit(ctx); //close the session
-
-
- /*
- QByteArray json = serializer.serialize(list);
- LOG4CXX_DEBUG(siLogger, tag + "json object: " + json);
- return json;
- */
}