From 821a6e63bf68de9e94003db2c7d7b61392a512f5 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 7 Nov 2024 14:14:25 +0100 Subject: [PATCH] Connect fileSystemWatcher. --- src/hwapi.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/hwapi.cpp b/src/hwapi.cpp index ee32e98..c4a6ede 100755 --- a/src/hwapi.cpp +++ b/src/hwapi.cpp @@ -15,6 +15,7 @@ #include #include #include +#include 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