Compare commits

..

9 Commits

Author SHA1 Message Date
d5693cb2b1 Merge branch 'master' into palanga-switch-terminal-on-off 2024-11-13 14:18:45 +01:00
d3b1046a9f onCCWakeGpioChanged():
Use commands credit_switchWake/switchPower to reboot cc-terminal.
2024-11-13 13:28:04 +01:00
a98ddbdb85 Changed file name to check for cc-terminal rebbot to /run/powerctrl_cc. 2024-11-13 13:27:13 +01:00
91a0f88cd9 hwapi::onCCWakeGpioChanged():
when switching cc-terminal off, send 0 to watch-file (watched by a
	filesystem watcher).
	when switching cc-terminal on, send 1 to watch-file (watched by a
	filesystem watcher).
2024-11-11 16:20:15 +01:00
c31b38917a Use QSettings to get watch.txt file path.
onCCWakeGpioChanged():

	remove obsolete code.
2024-11-08 12:06:19 +01:00
fe1351fcca switching on/off modem seems to be enough 2024-11-07 16:09:20 +01:00
dd29fb0762 datif: command 112: accecpt 40ct coin value ("Stadtmünze" Kirchdorf) 2024-11-06 10:09:12 +01:00
c9e5834e29 Merge branch 'proposal_detect_obsolete_data' 2024-10-22 12:26:40 +02:00
8fa6d40a0c Merge branch 'proposal_detect_obsolete_data' of git.mimbach49.de:GerhardHoffmann/DCLibraries into proposal_detect_obsolete_data 2024-10-22 12:25:24 +02:00
2 changed files with 24 additions and 57 deletions

View File

@@ -1205,7 +1205,7 @@ char T_datif::loadRecDataFromFrame()
uit2=0; uit2=0;
} }
if (uit2==3 || uit2==5 || uit2==10 || uit2==20 || uit2==50 || uit2==100 || uit2==200 || uit2==500) if (uit2==3 || uit2==5 || uit2==10 || uit2==20 || uit2==40 || uit2==50 || uit2==100 || uit2==200 || uit2==500)
{ {
// valid coin // valid coin
if ((newInsertedAmount != lastInsertedAmount) || uit2>0 ) if ((newInsertedAmount != lastInsertedAmount) || uit2>0 )

View File

@@ -16,6 +16,7 @@
#include <QThread> #include <QThread>
#include <QDebug> #include <QDebug>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QSettings>
static uint32_t hwapi_lastStartAmount; static uint32_t hwapi_lastStartAmount;
@@ -58,9 +59,10 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
#error "SLAVE LIB COMPILED INTO MASTER" #error "SLAVE LIB COMPILED INTO MASTER"
#endif #endif
QSettings settings("/opt/app/ATBAPP/ATBQT.ini", QSettings::IniFormat);
m_watchedFile = settings.value("AsyncPOS_CCPlugin/terminal_watch_file",
"/run/powerctrl_cc").toString();
// m_sysfs_remout_out = "/sys/class/leds/wakeupctrl_cc/brightness";
m_watchedFile = "/tmp/watch.txt";
m_fileSystemWatcher.reset(new QFileSystemWatcher()); m_fileSystemWatcher.reset(new QFileSystemWatcher());
if (!m_fileSystemWatcher->addPath(m_watchedFile)) { if (!m_fileSystemWatcher->addPath(m_watchedFile)) {
qCritical() << "cannot add path for" << m_watchedFile; qCritical() << "cannot add path for" << m_watchedFile;
@@ -136,70 +138,35 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
void hwapi::onCCWakeGpioChanged(QString const &fileName) { void hwapi::onCCWakeGpioChanged(QString const &fileName) {
if (fileName == m_watchedFile) { if (fileName == m_watchedFile) {
qCritical() << __func__ << ":" << __LINE__ << " " << m_watchedFile;
QFile f(m_watchedFile); QFile f(m_watchedFile);
if (f.open(QFile::ReadWrite | QFile::Text)) { if (f.exists() && f.open(QFile::ReadOnly | QFile::Text)) {
QTextStream stream(&f); QTextStream stream(&f);
int sleepTime = 5000;
QString const &content = stream.readAll(); QString const &content = stream.readAll();
if (content.startsWith("0")) { if (content.startsWith("0")) {
if (mod_isGsmPowerOn()) { qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal off...";
qCritical() << __func__ << ":" << __LINE__; credit_switchWake(false);
mod_switchWake(false); credit_switchPower(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 } else
if (content.startsWith("1")) { if (content.startsWith("1")) {
if (mod_isGsmPowerOn() == false) { qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal on...";
static bool mod_powerOnCalled = false; credit_switchPower(true);
if (mod_powerOnCalled == false) { credit_switchWake(true);
mod_switchPower(true); } else
mod_switchWake(true); if (content.startsWith("2")) {
mod_powerOnCalled = true; qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal off and on...";
} credit_switchWake(false);
//if (mod_isGsmPowerOn() == false) { // try again credit_switchPower(false);
// mod_switchWake(true); QThread::sleep(1);
// qCritical() << __func__ << ":" << __LINE__; credit_switchPower(true);
// stream << "1"; credit_switchWake(true);
// 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 { } else {
qCritical() << "watched file contained" << content; qCritical() << "switching cc-terminal watched file contained" << content;
QFile::resize(m_watchedFile, 0); // empty file
} }
} }
} else { } else {
qCritical() << "ERROR watching the wrong file" << fileName; qCritical() << "ERROR watching the wrong file" << fileName << m_watchedFile;
} }
} }