forked from GerhardHoffmann/DCLibraries
Remove CCWakelineAbstraction
This commit is contained in:
parent
0ea9ac9af3
commit
cd6b1fed00
@ -1,51 +0,0 @@
|
|||||||
#include <QFileSystemWatcher>
|
|
||||||
#include <QFile>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "CCWakelineAbstraction.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this is based on a solution from:
|
|
||||||
* https://embeddeduse.com/2018/09/18/monitoring-sys-files-qfilesystemwatcher/
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
CCWakelineAbstraction::CCWakelineAbstraction(hwinf *dc, QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, dc(dc)
|
|
||||||
{
|
|
||||||
auto ccWakeMonitor = new QFileSystemWatcher(this);
|
|
||||||
|
|
||||||
ccWakeMonitor->addPath("/sys/class/leds/wakeupctrl_cc/brightness");
|
|
||||||
connect(ccWakeMonitor, &QFileSystemWatcher::fileChanged,
|
|
||||||
this, &CCWakelineAbstraction::ccWakeChanged);
|
|
||||||
|
|
||||||
qCritical() << "... init CCWakelineAbstraction";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CCWakelineAbstraction::ccWakeChanged(const QString &path)
|
|
||||||
{
|
|
||||||
QFile ccWakeFile(path);
|
|
||||||
if (!ccWakeFile.open(QIODevice::ReadOnly)) {
|
|
||||||
qWarning() << "ERROR: Could not open ccWakeFile file.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto ccWake = ccWakeFile.readAll();
|
|
||||||
if (!ccWake.isEmpty()) {
|
|
||||||
int state = ccWake.at(0);
|
|
||||||
//qCritical() << "INFO: ccWake = " << state;
|
|
||||||
switch (state) {
|
|
||||||
case 0x30: // '1'
|
|
||||||
qCritical() << "INFO: ccWake -> sleep";
|
|
||||||
this->dc->credit_switchWake(true); // switch 'sleep'
|
|
||||||
break;
|
|
||||||
case 0x31: // '0'
|
|
||||||
qCritical() << "INFO: ccWake -> wake";
|
|
||||||
this->dc->credit_switchWake(false); // switch 'wake'
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
#ifndef CCWAKELINEABSTRACTION_H
|
|
||||||
#define CCWAKELINEABSTRACTION_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class hwinf;
|
|
||||||
class QFileSystemWatcher;
|
|
||||||
|
|
||||||
|
|
||||||
class CCWakelineAbstraction : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CCWakelineAbstraction(hwinf *dc, QObject *parent = nullptr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
hwinf *dc;
|
|
||||||
QFileSystemWatcher *ccWakeMonitor;
|
|
||||||
|
|
||||||
void ccWakeChanged(const QString &path);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CCWAKELINEABSTRACTION_H
|
|
@ -40,7 +40,6 @@ DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
|||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
CArun.cpp \
|
CArun.cpp \
|
||||||
CCWakelineAbstraction.cpp \
|
|
||||||
DigitalOutputAbstraction.cpp \
|
DigitalOutputAbstraction.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
tslib.cpp \
|
tslib.cpp \
|
||||||
@ -48,7 +47,6 @@ SOURCES += \
|
|||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CArun.h \
|
CArun.h \
|
||||||
CCWakelineAbstraction.h \
|
|
||||||
DigitalOutputAbstraction.h \
|
DigitalOutputAbstraction.h \
|
||||||
guidefs.h \
|
guidefs.h \
|
||||||
tslib.h \
|
tslib.h \
|
||||||
|
Loading…
Reference in New Issue
Block a user