From cfeacf02d585f299cc404eb5aa5b2618ed6a45b8 Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Thu, 10 Mar 2011 01:19:46 +0100 Subject: added a test getSysInfo("all") function --- src/fbgui.conf | 2 +- src/sysInfo.cpp | 7 +++++++ src/sysInfo.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fbgui.conf b/src/fbgui.conf index 2319dbd..1718021 100644 --- a/src/fbgui.conf +++ b/src/fbgui.conf @@ -1,3 +1,3 @@ [default] -url=http://132.230.4.3/test.html +url=http://132.230.4.3/mockup/index.html downloadDirectory=/downloads diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index 8da1c46..a3151b9 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -18,6 +18,8 @@ QString sysInfo::getInfo(QString& infoName){ return getMACAddress(); else if (infoName == QString("ip")) return getIPAddress(); + else if (infoName == QString("all")) + return getAllInfos(); // still here? return "info_error"; } @@ -47,3 +49,8 @@ QString sysInfo::getIPAddress(){ // still here? return "ip_error"; } +// ------------------------------------------------------------------------------------------------ +QString sysInfo::getAllInfos(){ + + return "test"; +} diff --git a/src/sysInfo.h b/src/sysInfo.h index 86443b8..e389500 100644 --- a/src/sysInfo.h +++ b/src/sysInfo.h @@ -12,6 +12,7 @@ class sysInfo { private: QString getMACAddress(); QString getIPAddress(); + QString getAllInfos(); }; #endif // SYSTEMINFO_H -- cgit v1.2.3-55-g7522 From bf9ca3c302e7302f172fee1c9869b342d1c98576 Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Thu, 10 Mar 2011 12:43:29 +0100 Subject: small changes in the test method getAllInfo() in sysinfo class --- src/fbgui.conf | 2 +- src/sysInfo.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fbgui.conf b/src/fbgui.conf index 1718021..99d7d0e 100644 --- a/src/fbgui.conf +++ b/src/fbgui.conf @@ -1,3 +1,3 @@ [default] -url=http://132.230.4.3/mockup/index.html +url=http://132.230.4.3/mockup/openslx.php downloadDirectory=/downloads diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index a3151b9..b4c1dd0 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -51,6 +51,7 @@ QString sysInfo::getIPAddress(){ } // ------------------------------------------------------------------------------------------------ QString sysInfo::getAllInfos(){ + QString tmp = "[{\"mac\":\"" + getMACAddress() +"\", \"ip\":\"" + getIPAddress() +"\"]}]"; - return "test"; + return tmp; } -- cgit v1.2.3-55-g7522 From dd2f4cb7d413b9ec0824ac230fc88ff0dbb684a4 Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Thu, 10 Mar 2011 12:58:25 +0100 Subject: fixed wrong syntax in the getAllInfos() method --- src/sysInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index b4c1dd0..dc8ba97 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -51,7 +51,7 @@ QString sysInfo::getIPAddress(){ } // ------------------------------------------------------------------------------------------------ QString sysInfo::getAllInfos(){ - QString tmp = "[{\"mac\":\"" + getMACAddress() +"\", \"ip\":\"" + getIPAddress() +"\"]}]"; + QString tmp = "[\"mac\":\"" + getMACAddress() +"\", \"ip\":\"" + getIPAddress() +"\"]"; return tmp; } -- cgit v1.2.3-55-g7522 From 2dd9637fee9fb61363c5ba2f68dc7a7c96b1096b Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Thu, 10 Mar 2011 13:14:51 +0100 Subject: again syntax fix --- src/sysInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index dc8ba97..968317d 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -51,7 +51,7 @@ QString sysInfo::getIPAddress(){ } // ------------------------------------------------------------------------------------------------ QString sysInfo::getAllInfos(){ - QString tmp = "[\"mac\":\"" + getMACAddress() +"\", \"ip\":\"" + getIPAddress() +"\"]"; + QString tmp = '["mac":"' + getMACAddress() + '", "ip":"' + getIPAddress() +'"]'; return tmp; } -- cgit v1.2.3-55-g7522 From c5ba0c531d70a116bdce0d2ed676f9c186cf2d57 Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Thu, 10 Mar 2011 13:42:51 +0100 Subject: sytax fix and a new tryout for the getAllInfo() return a string without the "object" brakets "{" and "}" --- src/sysInfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index 968317d..9456fe5 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -51,7 +51,8 @@ QString sysInfo::getIPAddress(){ } // ------------------------------------------------------------------------------------------------ QString sysInfo::getAllInfos(){ - QString tmp = '["mac":"' + getMACAddress() + '", "ip":"' + getIPAddress() +'"]'; + //QString tmp = '{"mac":"' + getMACAddress() + '", "ip":"' + getIPAddress() +'"}'; + QString tmp = "\"mac\":\"" + getMACAddress() + "\", \"ip\":\"" + getIPAddress() +"\""; return tmp; } -- cgit v1.2.3-55-g7522 From 86baaed2cad6a9f03f6d0d4bda2967fc5f37787c Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Thu, 10 Mar 2011 14:08:04 +0100 Subject: now the getAllInfo() method works. We just return a String the parens will be set by javascript on the site. also changed the getIPAddress method. now we get the ip address which is not the localhost address --- src/sysInfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index 9456fe5..796d06d 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -42,16 +42,17 @@ QString sysInfo::getIPAddress(){ QList addrlist = qni.allAddresses(); // This is does not return the right IP atm... foreach(QHostAddress addr, addrlist){ - if (addr.protocol() == QAbstractSocket::IPv4Protocol) + if (addr.protocol() == QAbstractSocket::IPv4Protocol && addr != QHostAddress::LocalHost){ qDebug() << "eth0: IPv4 Address: " << addr.toString(); return addr.toString(); + } } // still here? + qDebug() << "ip_error"; return "ip_error"; } // ------------------------------------------------------------------------------------------------ QString sysInfo::getAllInfos(){ - //QString tmp = '{"mac":"' + getMACAddress() + '", "ip":"' + getIPAddress() +'"}'; QString tmp = "\"mac\":\"" + getMACAddress() + "\", \"ip\":\"" + getIPAddress() +"\""; return tmp; -- cgit v1.2.3-55-g7522