diff options
author | Arseniy-Movshev <dodoradio@outlook.com> | 2023-07-02 12:11:28 +0100 |
---|---|---|
committer | Arseniy-Movshev <dodoradio@outlook.com> | 2023-07-02 12:12:53 +0100 |
commit | 162c92bc3b3a7dbe3d1484f7efc812aa36b23bcb (patch) | |
tree | eb4c4fe2638229f03adb220b5f0b2090ce670514 /daemon | |
parent | e1617431b4d1ef72c96d89d0754d42ed0e2cdb24 (diff) |
Move fileaddrecord to common.h so that it can be used from qml plugin
Diffstat (limited to '')
-rw-r--r-- | daemon/logger.cpp | 12 | ||||
-rw-r--r-- | daemon/logger.h | 1 | ||||
-rw-r--r-- | daemon/sensorPlugins/heartrateSensor.cpp | 1 | ||||
-rw-r--r-- | daemon/sensorPlugins/stepCounter.cpp | 1 |
4 files changed, 2 insertions, 13 deletions
diff --git a/daemon/logger.cpp b/daemon/logger.cpp index e8f75ba..7e06c63 100644 --- a/daemon/logger.cpp +++ b/daemon/logger.cpp @@ -111,18 +111,6 @@ bool Logger::getDaemonFresh() { } } -void fileAddRecord(QString sensorPrefix, QString logdata, QDateTime recordTime) { //adds a record to today's log file for the given sensor - qDebug() << fileNameForDate(recordTime.date(), sensorPrefix); - QFile file(fileNameForDate(recordTime.date(), sensorPrefix)); - if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) { - qDebug() << "failed to open file"; - return; - } - file.seek(file.size()); - QTextStream out(&file); - out << QString::number(recordTime.currentSecsSinceEpoch()) + ":" + logdata + "\n"; - file.close(); -} bool dayFileExists(QString sensorPrefix, QDateTime dateTime) { return QFile::exists(fileNameForDate(dateTime.date(), sensorPrefix)); } diff --git a/daemon/logger.h b/daemon/logger.h index 328c0d7..c16908d 100644 --- a/daemon/logger.h +++ b/daemon/logger.h @@ -47,7 +47,6 @@ private: bool getDaemonFresh(); }; - void fileAddRecord(QString sensorPrefix, QString logdata, QDateTime recordTime = QDateTime::currentDateTime()); //adds a record to today's log file for the given sensor bool dayFileExists(QString sensorPrefix, QDateTime date = QDateTime::currentDateTime()); //check if today has a log file for the given sensor QStringList fileGetPrevRecord(QString sensorPrefix, QDateTime recordTime = QDateTime::currentDateTime()); //works backwards to find the last record in today's file before the given time - returns nothing if no file is found. void setupFilePath(QString sensorPrefix); //sets up the paths for sensors to write into diff --git a/daemon/sensorPlugins/heartrateSensor.cpp b/daemon/sensorPlugins/heartrateSensor.cpp index 8b329b9..d03703c 100644 --- a/daemon/sensorPlugins/heartrateSensor.cpp +++ b/daemon/sensorPlugins/heartrateSensor.cpp @@ -16,6 +16,7 @@ #include <QString> #include "../logger.h" +#include "../../common.h" #include "heartrateSensor.h" diff --git a/daemon/sensorPlugins/stepCounter.cpp b/daemon/sensorPlugins/stepCounter.cpp index fd09e81..87c1c3c 100644 --- a/daemon/sensorPlugins/stepCounter.cpp +++ b/daemon/sensorPlugins/stepCounter.cpp @@ -19,6 +19,7 @@ #include <time.h> #include "../logger.h" +#include "../../common.h" #include "stepCounter.h" |