hwapi::onCCWakeGpioChanged():

start implementation of slot for fileSystemWatcher.
	Seems to be enough to start only the modem, as the cc-terminal
	is connected to the modem.
This commit is contained in:
Gerhard Hoffmann 2024-11-07 14:14:58 +01:00
parent 821a6e63bf
commit c337b6e50e

View File

@ -134,6 +134,75 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
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)
{