Compare commits
No commits in common. "c337b6e50eb17c07300a6986a54833d09a09901f" and "3e7f71899c7553f01a965d7a70fe3e982d70b0ad" have entirely different histories.
c337b6e50e
...
3e7f71899c
@ -63,8 +63,7 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
|||||||
#include "shared_mem_buffer.h"
|
#include "shared_mem_buffer.h"
|
||||||
#include "runProc.h"
|
#include "runProc.h"
|
||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
#include <QScopedPointer>
|
|
||||||
#include <QFileSystemWatcher>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* select Plugin Type here
|
* select Plugin Type here
|
||||||
@ -99,7 +98,7 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
|||||||
//#define THIS_IS_CA_MASTER
|
//#define THIS_IS_CA_MASTER
|
||||||
|
|
||||||
|
|
||||||
class QFileSystemWatcher;
|
|
||||||
class QSharedMemory;
|
class QSharedMemory;
|
||||||
class DownloadThread;
|
class DownloadThread;
|
||||||
class ReportingThread;
|
class ReportingThread;
|
||||||
@ -116,11 +115,7 @@ private:
|
|||||||
QSharedMemory *m_sharedMem;
|
QSharedMemory *m_sharedMem;
|
||||||
ReportingThread *m_reportingThread;
|
ReportingThread *m_reportingThread;
|
||||||
DownloadThread *m_downloadThread;
|
DownloadThread *m_downloadThread;
|
||||||
QScopedPointer<QFileSystemWatcher> m_fileSystemWatcher;
|
//QTimer *hwapi_triggerBL;
|
||||||
QString m_watchedFile;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onCCWakeGpioChanged(QString const &file);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit hwapi(QObject *parent = nullptr);
|
explicit hwapi(QObject *parent = nullptr);
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileSystemWatcher>
|
|
||||||
|
|
||||||
|
|
||||||
static uint32_t hwapi_lastStartAmount;
|
static uint32_t hwapi_lastStartAmount;
|
||||||
@ -36,7 +35,6 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
|
|||||||
qCritical() << " hwapi::hwapi() APP_EXTENDED_VERSION:" << APP_EXTENDED_VERSION;
|
qCritical() << " hwapi::hwapi() APP_EXTENDED_VERSION:" << APP_EXTENDED_VERSION;
|
||||||
qCritical() << "hwapi::hwapi() APP_EXTENDED_VERSION_LIB:" << APP_EXTENDED_VERSION_LIB;
|
qCritical() << "hwapi::hwapi() APP_EXTENDED_VERSION_LIB:" << APP_EXTENDED_VERSION_LIB;
|
||||||
|
|
||||||
m_fileSystemWatcher.reset();
|
|
||||||
|
|
||||||
// create or attach shared memory segment
|
// create or attach shared memory segment
|
||||||
m_sharedMem = SharedMem::getShm(sizeof(SharedMem));
|
m_sharedMem = SharedMem::getShm(sizeof(SharedMem));
|
||||||
@ -58,20 +56,8 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
|
|||||||
#error "SLAVE LIB COMPILED INTO MASTER"
|
#error "SLAVE LIB COMPILED INTO MASTER"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// 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!
|
myDatif = new T_datif(this); // für die CAslave-Lib auskommentieren!
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef THIS_IS_CA_SLAVE
|
#ifdef THIS_IS_CA_SLAVE
|
||||||
@ -134,75 +120,6 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
|
|||||||
connect(runProcess, SIGNAL(runProc_coinAttached()), this, SLOT(coinAttached()));
|
connect(runProcess, SIGNAL(runProc_coinAttached()), this, SLOT(coinAttached()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::onCCWakeGpioChanged(QString const &fileName) {
|
|
||||||
if (fileName == m_watchedFile) {
|
|
||||||
QFile f(m_watchedFile);
|
|
||||||
if (f.open(QFile::ReadWrite | QFile::Text)) {
|
|
||||||
QTextStream stream(&f);
|
|
||||||
int sleepTime = 5000;
|
|
||||||
QString const &content = stream.readAll();
|
|
||||||
if (content.startsWith("0")) {
|
|
||||||
if (mod_isGsmPowerOn()) {
|
|
||||||
qCritical() << __func__ << ":" << __LINE__;
|
|
||||||
mod_switchWake(false);
|
|
||||||
mod_switchPower(false);
|
|
||||||
//if (mod_isGsmPowerOn()) { // try again
|
|
||||||
// qCritical() << __func__ << ":" << __LINE__;
|
|
||||||
// stream << "0";
|
|
||||||
// QThread::msleep(sleepTime);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cred_isCreditPowerOn()) { // try again
|
|
||||||
//qCritical() << __func__ << ":" << __LINE__;
|
|
||||||
//credit_switchWake(false);
|
|
||||||
//credit_switchPower(false);
|
|
||||||
//if (cred_isCreditPowerOn()) { // try again
|
|
||||||
// qCritical() << __func__ << ":" << __LINE__;
|
|
||||||
// stream << "0";
|
|
||||||
// QThread::msleep(sleepTime);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
if (content.startsWith("1")) {
|
|
||||||
if (mod_isGsmPowerOn() == false) {
|
|
||||||
static bool mod_powerOnCalled = false;
|
|
||||||
if (mod_powerOnCalled == false) {
|
|
||||||
mod_switchPower(true);
|
|
||||||
mod_switchWake(true);
|
|
||||||
mod_powerOnCalled = true;
|
|
||||||
}
|
|
||||||
//if (mod_isGsmPowerOn() == false) { // try again
|
|
||||||
// mod_switchWake(true);
|
|
||||||
// qCritical() << __func__ << ":" << __LINE__;
|
|
||||||
// stream << "1";
|
|
||||||
// QThread::msleep(sleepTime);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cred_isCreditPowerOn() == false) {
|
|
||||||
static bool cred_powerOnCalled = false;
|
|
||||||
//if (cred_powerOnCalled == false) {
|
|
||||||
// credit_switchPower(true);
|
|
||||||
// credit_switchWake(true);
|
|
||||||
// cred_powerOnCalled = true;
|
|
||||||
//}
|
|
||||||
//if (cred_isCreditPowerOn() == false) { // try again
|
|
||||||
// credit_switchWake(true);
|
|
||||||
// qCritical() << __func__ << ":" << __LINE__;
|
|
||||||
// stream << "1";
|
|
||||||
// QThread::msleep(sleepTime);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qCritical() << "watched file contained" << content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qCritical() << "ERROR watching the wrong file" << fileName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void hwapi::hwapi_slotPayProc(void)
|
void hwapi::hwapi_slotPayProc(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user