diff options
| author | Niklas | 2011-07-21 17:29:53 +0200 |
|---|---|---|
| committer | Niklas | 2011-07-21 17:29:53 +0200 |
| commit | ddac93a94b860c94e6fb893ed5a9c508c19231f1 (patch) | |
| tree | fc37d45829e2d94f9fbcfe08531fdb3a10750009 /workspace/LogReceiver | |
| parent | configuration of more than one interface is working. Both progressbars are up... (diff) | |
| download | fbgui-ddac93a94b860c94e6fb893ed5a9c508c19231f1.tar.gz fbgui-ddac93a94b860c94e6fb893ed5a9c508c19231f1.tar.xz fbgui-ddac93a94b860c94e6fb893ed5a9c508c19231f1.zip | |
log messages are delivered to qt app.
Diffstat (limited to 'workspace/LogReceiver')
| -rwxr-xr-x | workspace/LogReceiver/LogReceiver | bin | 56166 -> 60452 bytes | |||
| -rw-r--r-- | workspace/LogReceiver/logreceiver.cpp | 37 | ||||
| -rw-r--r-- | workspace/LogReceiver/logreceiver.h | 1 |
3 files changed, 28 insertions, 10 deletions
diff --git a/workspace/LogReceiver/LogReceiver b/workspace/LogReceiver/LogReceiver Binary files differindex 13304e8..b324cb7 100755 --- a/workspace/LogReceiver/LogReceiver +++ b/workspace/LogReceiver/LogReceiver diff --git a/workspace/LogReceiver/logreceiver.cpp b/workspace/LogReceiver/logreceiver.cpp index f1a20b0..4aeebfc 100644 --- a/workspace/LogReceiver/logreceiver.cpp +++ b/workspace/LogReceiver/logreceiver.cpp @@ -7,6 +7,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> + #include <syslog.h> #include "logreceiver.h" #include <qlocalserver.h> @@ -50,8 +51,8 @@ LogReceiver::LogReceiver(QWidget *parent) : buildGui(); addInterfacesToGroupBox(interfacesMap); pathToDhcpcdExe = "/home/niklas/fbgui/workspace/customdhcpcd/src/dhcpcd"; - dhcpcdArguments.append("-d"); - //QString ifName(); + //dhcpcdArguments.append("-d"); + QString ifName("eth1"); runDHCPCD(list); @@ -79,7 +80,19 @@ void LogReceiver::handleNewInput() { QLocalSocket * client = clients.value(socket); - QByteArray data = client->readAll(); + QString data(client->readAll()); + + data = data.trimmed(); + + QStringList lines = data.split("\n"); + + for (int i=0; i < lines.length(); i++) { + handleNewInputLine(lines.at(i)); + } +} + +void LogReceiver::handleNewInputLine(QString data) { + QString logMsg(data); QString interface = logMsg.section(";",0,0); QString s_state = logMsg.section(";", 1, 1); @@ -88,16 +101,17 @@ void LogReceiver::handleNewInput() { int pBar = indexToIfaceNameMap.value(interface); - qDebug() << logMsg; + //qDebug() << logMsg; - qDebug() << msg; + //qDebug() << msg; int st = s_state.toInt(); int sst = s_subState.toInt(); switch (st) { - case STAT_OK: - qDebug() << "received stat_ok"; + case LOG_INFO: + qDebug() << "received LOG_INFO"; + qDebug() << sst; switch (sst) { case DHCP_DISCOVER: handleProgress(pBar,10); @@ -126,15 +140,18 @@ void LogReceiver::handleNewInput() { default: break; } + + qDebug() << msg; + break; - case STAT_ERROR: + case LOG_ERR: qDebug() << "received stat_error"; break; default: - qDebug() << "undefined status"; + qDebug() << logMsg; } - statusLabel->setText(logMsg); + //statusLabel->setText(logMsg); } QList<QNetworkInterface> LogReceiver::getListOfNetworkInterfaces() { diff --git a/workspace/LogReceiver/logreceiver.h b/workspace/LogReceiver/logreceiver.h index 5bd209d..2dce00a 100644 --- a/workspace/LogReceiver/logreceiver.h +++ b/workspace/LogReceiver/logreceiver.h @@ -25,6 +25,7 @@ public: private slots: void handleNewConnection(); void handleNewInput(); + void handleNewInputLine(QString data); void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); void handleProcessStarted(); void handleProgress(int iFaceIndex, int newValue); |
