Connect fileSystemWatcher.

This commit is contained in:
Gerhard Hoffmann 2024-11-07 14:14:25 +01:00
parent 73b2dec85e
commit 821a6e63bf

View File

@ -15,6 +15,7 @@
#include <cstring>
#include <QThread>
#include <QDebug>
#include <QFileSystemWatcher>
static uint32_t hwapi_lastStartAmount;
@ -35,6 +36,7 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
qCritical() << " hwapi::hwapi() APP_EXTENDED_VERSION:" << APP_EXTENDED_VERSION;
qCritical() << "hwapi::hwapi() APP_EXTENDED_VERSION_LIB:" << APP_EXTENDED_VERSION_LIB;
m_fileSystemWatcher.reset();
// create or attach shared memory segment
m_sharedMem = SharedMem::getShm(sizeof(SharedMem));
@ -56,8 +58,20 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
#error "SLAVE LIB COMPILED INTO MASTER"
#endif
myDatif = new T_datif(this); // für die CAslave-Lib auskommentieren!
// m_sysfs_remout_out = "/sys/class/leds/wakeupctrl_cc/brightness";
m_watchedFile = "/tmp/watch.txt";
m_fileSystemWatcher.reset(new QFileSystemWatcher());
if (!m_fileSystemWatcher->addPath(m_watchedFile)) {
qCritical() << "cannot add path for" << m_watchedFile;
} else {
if (connect(m_fileSystemWatcher.get(), SIGNAL(fileChanged(QString const&)),
this, SLOT(onCCWakeGpioChanged(QString const&)))) {
qCritical() << "connected file watcher with" << m_watchedFile;
}
}
myDatif = new T_datif(this); // für die CAslave-Lib auskommentieren!
#endif
#ifdef THIS_IS_CA_SLAVE