summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common.cpp6
-rw-r--r--common.h1
-rw-r--r--daemon/logger.cpp5
-rw-r--r--daemon/logger.h1
4 files changed, 7 insertions, 6 deletions
diff --git a/common.cpp b/common.cpp
index 10c18d4..71524dc 100644
--- a/common.cpp
+++ b/common.cpp
@@ -12,6 +12,7 @@
#include <QStandardPaths>
#include <QFile>
#include <QDebug>
+#include <QDir>
#include "common.h"
QString fileNameForDate(QDate date, QString prefix) {
@@ -36,3 +37,8 @@ void fileAddRecord(QString sensorPrefix, QString logdata, QDateTime recordTime)
out << QString::number(recordTime.currentSecsSinceEpoch()) + ":" + logdata + "\n";
file.close();
}
+
+void setupFilePath(QString sensorPrefix) {
+ QSettings settings("asteroid","sensorlogd"); //this should be moved out of here at some point TODO
+ QDir::root().mkpath(settings.value("loggerRootPath",QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.asteroid-sensorlogd/").toString() + sensorPrefix);
+}
diff --git a/common.h b/common.h
index 8240d06..52c095a 100644
--- a/common.h
+++ b/common.h
@@ -17,5 +17,6 @@
QString fileNameForDate(QDate date, QString prefix);
QString sensorDirPath(QString prefix);
void fileAddRecord(QString sensorPrefix, QString logdata, QDateTime recordTime = QDateTime::currentDateTime()); //adds a record to today's log file for the given sensor
+void setupFilePath(QString sensorPrefix); //sets up the paths for sensors to write into
#endif //SENSORLOGD_COMMON_H
diff --git a/daemon/logger.cpp b/daemon/logger.cpp
index 7e06c63..3cadf2c 100644
--- a/daemon/logger.cpp
+++ b/daemon/logger.cpp
@@ -14,7 +14,6 @@
#include <QDBusConnection>
#include <QDateTime>
#include <QFile>
-#include <QDir>
#include <QTextStream>
#include <QTimer>
#include <QDebug>
@@ -135,9 +134,5 @@ QStringList fileGetPrevRecord(QString sensorPrefix, QDateTime recordTime) {
return line.split(":");
}
-void setupFilePath(QString sensorPrefix) {
- QSettings settings("asteroid","sensorlogd"); //this should be moved out of here at some point TODO
- QDir::root().mkpath(settings.value("loggerRootPath",QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.asteroid-sensorlogd/").toString() + sensorPrefix);
-}
diff --git a/daemon/logger.h b/daemon/logger.h
index c16908d..056645b 100644
--- a/daemon/logger.h
+++ b/daemon/logger.h
@@ -49,6 +49,5 @@ private:
};
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
#endif // LOGGER_H