diff --git a/KelvinDashboardService/DapLogReader.cpp b/KelvinDashboardService/DapLogReader.cpp index 83a97f46f45e3eda3242b623ff3e1ec923b1d504..fb2fc13b129d2dcc273df01901584386625ada48 100644 --- a/KelvinDashboardService/DapLogReader.cpp +++ b/KelvinDashboardService/DapLogReader.cpp @@ -1,13 +1,27 @@ #include "DapLogReader.h" + + DapLogReader::DapLogReader(QObject *parent) : QObject(parent) { } -QList<QString> DapLogReader::request(int aiTimeStamp, int aiRowCount) +QStringList DapLogReader::parse(const QByteArray &aLogMessages) +{ + auto list = QString::fromLatin1(aLogMessages).split(";"); + + for(QString l : list) + { + if(l.contains("[")) + qDebug() << l; + } + + return list; +} + +QStringList DapLogReader::request(int aiTimeStamp, int aiRowCount) { - QList<QString> str; QByteArray result; QProcess process; process.start(QString("%1 print_log ts_after %2 limit %3").arg("/home/andrey/Demlabs/build-kelvin-node/kelvin-node-cli").arg(aiTimeStamp).arg(aiRowCount)); @@ -19,7 +33,6 @@ QList<QString> DapLogReader::request(int aiTimeStamp, int aiRowCount) else { qDebug() << "TRUE"; - qDebug() << QString::fromLatin1(result); } - return str; + return parse(result); } diff --git a/KelvinDashboardService/DapLogReader.h b/KelvinDashboardService/DapLogReader.h index 6362047b8067f104b61e1842327e5c1444393193..47dc5079a8bebfc8465199f6d8aafffa695cd8ff 100644 --- a/KelvinDashboardService/DapLogReader.h +++ b/KelvinDashboardService/DapLogReader.h @@ -9,7 +9,8 @@ class DapLogReader : public QObject { Q_OBJECT - +protected: + virtual QStringList parse(const QByteArray& aLogMessages); public: explicit DapLogReader(QObject *parent = nullptr); @@ -17,7 +18,7 @@ signals: public slots: - QList<QString> request(int aiTimeStamp, int aiRowCount); + QStringList request(int aiTimeStamp, int aiRowCount); }; #endif // DAPLOGREADER_H diff --git a/KelvinDashboardService/main.cpp b/KelvinDashboardService/main.cpp index f83eef8b7e7baa702fbabc6283764060a0e5cef8..5b0872a2362083102dfe81d48b938b653088bea5 100755 --- a/KelvinDashboardService/main.cpp +++ b/KelvinDashboardService/main.cpp @@ -37,8 +37,6 @@ int main(int argc, char *argv[]) //#endif DapLogReader dapLogReader; auto var = dapLogReader.request(0, 100); - auto var1 = dapLogReader.request(1, 100); - auto var2 = dapLogReader.request(2, 100); // Creating the main application object DapChainDashboardService service; service.start();