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;
|
||||
}
|
||||
|
||||
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
|
||||
if ((newInsertedAmount != lastInsertedAmount) || uit2>0 )
|
||||
|
@@ -61,7 +61,7 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
|
||||
|
||||
QSettings settings("/opt/app/ATBAPP/ATBQT.ini", QSettings::IniFormat);
|
||||
m_watchedFile = settings.value("AsyncPOS_CCPlugin/terminal_watch_file",
|
||||
"/opt/app/ATBAPP/watch.txt").toString();
|
||||
"/run/powerctrl_cc").toString();
|
||||
|
||||
m_fileSystemWatcher.reset(new QFileSystemWatcher());
|
||||
if (!m_fileSystemWatcher->addPath(m_watchedFile)) {
|
||||
@@ -138,39 +138,35 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
|
||||
|
||||
void hwapi::onCCWakeGpioChanged(QString const &fileName) {
|
||||
if (fileName == m_watchedFile) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << " " << 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);
|
||||
QString const &content = stream.readAll();
|
||||
if (content.startsWith("0")) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << "switching terminal off...";
|
||||
mod_switchWake(false);
|
||||
mod_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";
|
||||
}
|
||||
qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal off...";
|
||||
credit_switchWake(false);
|
||||
credit_switchPower(false);
|
||||
} else
|
||||
if (content.startsWith("1")) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << "switching terminal on...";
|
||||
mod_switchPower(true);
|
||||
mod_switchWake(true);
|
||||
f.close();
|
||||
f.setFileName(m_watchedFile);
|
||||
// to turn on cc-terminal, the content must be "1"
|
||||
if (f.open(QFile::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
|
||||
QTextStream s(&f);
|
||||
s << "switching terminal on";
|
||||
}
|
||||
qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal on...";
|
||||
credit_switchPower(true);
|
||||
credit_switchWake(true);
|
||||
} else
|
||||
if (content.startsWith("2")) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << "switching cc-terminal off and on...";
|
||||
credit_switchWake(false);
|
||||
credit_switchPower(false);
|
||||
QThread::sleep(1);
|
||||
credit_switchPower(true);
|
||||
credit_switchWake(true);
|
||||
} else {
|
||||
qCritical() << "watched file contained" << content;
|
||||
qCritical() << "switching cc-terminal watched file contained" << content;
|
||||
QFile::resize(m_watchedFile, 0); // empty file
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qCritical() << "ERROR watching the wrong file" << fileName;
|
||||
qCritical() << "ERROR watching the wrong file" << fileName << m_watchedFile;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user