summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interface.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interface.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/noncore/settings/networksettings/interface.cpp b/noncore/settings/networksettings/interface.cpp
index 1e01da4..a84b91f 100644
--- a/noncore/settings/networksettings/interface.cpp
+++ b/noncore/settings/networksettings/interface.cpp
@@ -8,13 +8,13 @@
#define IFCONFIG "/sbin/ifconfig"
#define HDCP_INFO_DIR "/etc/dhcpc"
#include <stdio.h>
#include <stdlib.h>
-Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
+Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardwareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
refresh();
}
/**
* Set status
* @param newStatus - the new status
@@ -40,13 +40,13 @@ void Interface::setAttached(bool isAttached){
/**
* Set Hardware name
* @param name - the new name
* emit updateInterface
*/
void Interface::setHardwareName(QString name){
- hardareName = name;
+ hardwareName = name;
emit(updateInterface(this));
};
/**
* Set Module owner
* @param owner - the new owner
@@ -63,13 +63,13 @@ void Interface::setModuleOwner(Module *owner){
*/
void Interface::start(){
// check to see if we are already running.
if(true == status)
return;
- int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(interfaceName).latin1());
+ int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
// See if it was successfull...
if(ret != 0)
return;
status = true;
refresh();
@@ -80,13 +80,13 @@ void Interface::start(){
*/
void Interface::stop(){
// check to see if we are already stopped.
if(false == status)
return;
- int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(interfaceName).latin1());
+ int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
if(ret != 0)
return;
status = true;
refresh();
}
@@ -116,14 +116,14 @@ bool Interface::refresh(){
leaseObtained = "";
leaseExpires = "";
emit(updateInterface(this));
return true;
}
- QString fileName = QString("/tmp/%1_ifconfig_info").arg(interfaceName);
- int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(interfaceName).arg(fileName).latin1());
+ QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
+ int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
if(ret != 0){
qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
return false;
}
QFile file(fileName);
@@ -174,13 +174,13 @@ bool Interface::refresh(){
QString dhcpDirectory(HDCP_INFO_DIR);
QDir d(dhcpDirectory);
if(!d.exists(dhcpDirectory))
dhcpDirectory = "/var/run";
// See if we have
- QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(interfaceName));
+ QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
// If there is no DHCP information then exit now with no errors.
if(!QFile::exists(dhcpFile)){
emit(updateInterface(this));
return true;
}
@@ -206,13 +206,13 @@ bool Interface::refresh(){
}
file.close();
//qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1());
//qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1());
// Get the pid of the deamond
- dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(interfaceName));
+ dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name()));
file.setName(dhcpFile);
if (!file.open(IO_ReadOnly)){
qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
return false;
}