summaryrefslogtreecommitdiffstats
path: root/src/networkdiscovery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/networkdiscovery.cpp')
-rw-r--r--src/networkdiscovery.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/networkdiscovery.cpp b/src/networkdiscovery.cpp
index df1ae3c..75e822b 100644
--- a/src/networkdiscovery.cpp
+++ b/src/networkdiscovery.cpp
@@ -257,6 +257,7 @@ QString NetworkDiscovery::readLogFile() {
return retval;
}
}
+ qxtLog->debug() << _tag << " could not open log file";
}
@@ -271,11 +272,11 @@ QString NetworkDiscovery::readLogFile() {
*/
void NetworkDiscovery::tryAgain() {
// kill all cdhcpcd processes
- qDebug() << " kill cdhcpcd processes";
+ qxtLog->debug() << " kill cdhcpcd processes";
QProcess * p = new QProcess(this);
p->start("killall cdhcpcd");
p->waitForFinished();
- qDebug() << _tag << "[tryAgain]" << p->errorString();
+ qxtLog->debug() << _tag << "[tryAgain]" << p->errorString();
/*
foreach(Q_PID pid , _pidsList) {
if (kill(pid,SIGKILL) <= -1)
@@ -302,11 +303,21 @@ void NetworkDiscovery::tryAgain() {
}
+
/**/
QVariantMap NetworkDiscovery::getInterfaceConfig(QString ifName) {
+ QVariantMap jsonObj;
QList<QString> dns;
interfaceconfiguration * ifc = _ifcMap.value(ifName, NULL);
if (ifc != NULL) {
+ jsonObj.insert("ipaddr",ifc->getIpAddress());
+ jsonObj.insert("netmask",ifc->getNetmask());
+ jsonObj.insert("broadcast",ifc->getBroadcast());
+ jsonObj.insert("gateway",ifc->getGateway());
+
+ dns.clear();
+ dns = ifc->getDnsservers().trimmed().split(" ");
+ jsonObj.insert("dns",dns.first());
//
// dns.clear();
// dns = ifc->getDnsservers().trimmed().split(" ");
@@ -315,6 +326,7 @@ QVariantMap NetworkDiscovery::getInterfaceConfig(QString ifName) {
// //ifc->getGateway(), 0, AF_INET, "/etc/", dns);
//
}
+ return jsonObj;
}