diff options
Diffstat (limited to 'workspace/LogReceiver/logreceiver.cpp')
| -rw-r--r-- | workspace/LogReceiver/logreceiver.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
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() { |
