diff options
author | Arseniy-Movshev <dodoradio@outlook.com> | 2023-05-28 12:49:41 +0100 |
---|---|---|
committer | Arseniy-Movshev <dodoradio@outlook.com> | 2023-05-28 15:42:41 +0100 |
commit | 9a838b7f9f56c2bd92a0aba72bcd37ec1f3d9f89 (patch) | |
tree | 38a3a1095cd239228b07031d5b3c899670f54c98 /daemon | |
parent | c212210e41487e88f62d5f8f51c57e63b534c38f (diff) |
Add a dbus interface to allow reinitialising the logger
This is to allow the logger to be reinitialised form qml
Diffstat (limited to '')
-rw-r--r-- | daemon/logger.cpp | 10 | ||||
-rw-r--r-- | daemon/logger.h | 4 |
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); |