summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseniy-Movshev <dodoradio@outlook.com>2023-05-28 12:49:41 +0100
committerArseniy-Movshev <dodoradio@outlook.com>2023-05-28 15:42:41 +0100
commit9a838b7f9f56c2bd92a0aba72bcd37ec1f3d9f89 (patch)
tree38a3a1095cd239228b07031d5b3c899670f54c98
parentc212210e41487e88f62d5f8f51c57e63b534c38f (diff)
Add a dbus interface to allow reinitialising the logger
This is to allow the logger to be reinitialised form qml
-rw-r--r--daemon/logger.cpp10
-rw-r--r--daemon/logger.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/daemon/logger.cpp b/daemon/logger.cpp
index ff62ff6..56d1c3c 100644
--- a/daemon/logger.cpp
+++ b/daemon/logger.cpp
@@ -26,6 +26,12 @@
Logger::Logger(QObject *parent) :
QObject(parent){
+ if(!QDBusConnection::sessionBus().registerService("org.asteroid.sensorlogd.logger")) qDebug() << "failed to register service";
+ if(!QDBusConnection::sessionBus().registerObject("/org/asteroid/sensorlogd/logger", this, QDBusConnection::ExportAllContents)) qDebug() << "failed to register object";
+ this->setup();
+}
+
+void Logger::setup() {
m_iface = new QDBusInterface("com.nokia.mce","/com/nokia/mce/signal", "com.nokia.mce.signal", QDBusConnection::systemBus());
settings = new QSettings;
@@ -52,6 +58,10 @@ Logger::Logger(QObject *parent) :
qDebug() << "healthd sensors logger initialised";
}
+void Logger::resetup() {
+ this->setup();
+}
+
void Logger::displayOn(QString displayState) {
if (displayState == "off")
return;
diff --git a/daemon/logger.h b/daemon/logger.h
index d9b418d..6047a04 100644
--- a/daemon/logger.h
+++ b/daemon/logger.h
@@ -18,6 +18,7 @@
#include <QTimer>
#include <QString>
#include <QSettings>
+#include <QDBusAbstractAdaptor>
#include "sensorPlugins/stepCounter.h"
#include "sensorPlugins/heartrateSensor.h"
@@ -28,6 +29,9 @@ class Logger : public QObject
public:
explicit Logger(QObject *parent = 0);
virtual ~Logger() {};
+public slots:
+ void setup();
+ void resetup();
private slots:
void displayOn(QString displayState);