Compare commits
6 Commits
palanga-sw
...
1.99.11-1
Author | SHA1 | Date | |
---|---|---|---|
d5693cb2b1
|
|||
d3b1046a9f | |||
a98ddbdb85 | |||
dd29fb0762
|
|||
c9e5834e29
|
|||
8fa6d40a0c
|
@@ -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 )
|
||||||
|
@@ -61,7 +61,7 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
QSettings settings("/opt/app/ATBAPP/ATBQT.ini", QSettings::IniFormat);
|
QSettings settings("/opt/app/ATBAPP/ATBQT.ini", QSettings::IniFormat);
|
||||||
m_watchedFile = settings.value("AsyncPOS_CCPlugin/terminal_watch_file",
|
m_watchedFile = settings.value("AsyncPOS_CCPlugin/terminal_watch_file",
|
||||||
"/opt/app/ATBAPP/watch.txt").toString();
|
"/run/powerctrl_cc").toString();
|
||||||
|
|
||||||
m_fileSystemWatcher.reset(new QFileSystemWatcher());
|
m_fileSystemWatcher.reset(new QFileSystemWatcher());
|
||||||
if (!m_fileSystemWatcher->addPath(m_watchedFile)) {
|
if (!m_fileSystemWatcher->addPath(m_watchedFile)) {
|
||||||
@@ -138,39 +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::ReadOnly | QFile::Text)) {
|
if (f.exists() && f.open(QFile::ReadOnly | QFile::Text)) {
|
||||||
QTextStream stream(&f);
|
QTextStream stream(&f);
|
||||||
QString const &content = stream.readAll();
|
QString const &content = stream.readAll();
|
||||||
if (content.startsWith("0")) {
|
if (content.startsWith("0")) {
|
||||||
qCritical() << __func__ << ":" << __LINE__ << "switching terminal off...";
|
qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal off...";
|
||||||
mod_switchWake(false);
|
credit_switchWake(false);
|
||||||
mod_switchPower(false);
|
credit_switchPower(false);
|
||||||
f.close();
|
|
||||||
f.setFileName(m_watchedFile);
|
|
||||||
// to turn off cc-terminal, the content must be "0"
|
|
||||||
if (f.open(QFile::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
|
|
||||||
QTextStream s(&f);
|
|
||||||
s << "switching terminal off";
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
if (content.startsWith("1")) {
|
if (content.startsWith("1")) {
|
||||||
qCritical() << __func__ << ":" << __LINE__ << "switching terminal on...";
|
qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal on...";
|
||||||
mod_switchPower(true);
|
credit_switchPower(true);
|
||||||
mod_switchWake(true);
|
credit_switchWake(true);
|
||||||
f.close();
|
} else
|
||||||
f.setFileName(m_watchedFile);
|
if (content.startsWith("2")) {
|
||||||
// to turn on cc-terminal, the content must be "1"
|
qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal off and on...";
|
||||||
if (f.open(QFile::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
|
credit_switchWake(false);
|
||||||
QTextStream s(&f);
|
credit_switchPower(false);
|
||||||
s << "switching terminal on";
|
QThread::sleep(1);
|
||||||
}
|
credit_switchPower(true);
|
||||||
|
credit_switchWake(true);
|
||||||
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user