switching on/off modem seems to be enough

This commit is contained in:
Gerhard Hoffmann 2024-11-07 16:09:20 +01:00
parent c337b6e50e
commit fe1351fcca

View File

@ -135,15 +135,16 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
} }
void hwapi::onCCWakeGpioChanged(QString const &fileName) { void hwapi::onCCWakeGpioChanged(QString const &fileName) {
qCritical() << __func__ << ":" << __LINE__ << QDateTime::currentDateTime().toString(Qt::ISODateWithMs);
if (fileName == m_watchedFile) { if (fileName == m_watchedFile) {
QFile f(m_watchedFile); QFile f(m_watchedFile);
if (f.open(QFile::ReadWrite | QFile::Text)) { if (f.open(QFile::ReadOnly | QFile::Text)) {
QTextStream stream(&f); QTextStream stream(&f);
int sleepTime = 5000; //int sleepTime = 5000;
QString const &content = stream.readAll(); QString const &content = stream.readAll();
if (content.startsWith("0")) { if (content.startsWith("0")) {
if (mod_isGsmPowerOn()) { //if (mod_isGsmPowerOn()) {
qCritical() << __func__ << ":" << __LINE__; qCritical() << __func__ << ":" << __LINE__ << "OFF";
mod_switchWake(false); mod_switchWake(false);
mod_switchPower(false); mod_switchPower(false);
//if (mod_isGsmPowerOn()) { // try again //if (mod_isGsmPowerOn()) { // try again
@ -151,7 +152,7 @@ void hwapi::onCCWakeGpioChanged(QString const &fileName) {
// stream << "0"; // stream << "0";
// QThread::msleep(sleepTime); // QThread::msleep(sleepTime);
//} //}
} //}
if (cred_isCreditPowerOn()) { // try again if (cred_isCreditPowerOn()) { // try again
//qCritical() << __func__ << ":" << __LINE__; //qCritical() << __func__ << ":" << __LINE__;
@ -165,23 +166,24 @@ void hwapi::onCCWakeGpioChanged(QString const &fileName) {
} }
} else } else
if (content.startsWith("1")) { if (content.startsWith("1")) {
if (mod_isGsmPowerOn() == false) { //if (mod_isGsmPowerOn() == false) {
static bool mod_powerOnCalled = false; // static bool mod_powerOnCalled = false;
if (mod_powerOnCalled == false) { // if (mod_powerOnCalled == false) {
qCritical() << __func__ << ":" << __LINE__ << "ON";
mod_switchPower(true); mod_switchPower(true);
mod_switchWake(true); mod_switchWake(true);
mod_powerOnCalled = true; // mod_powerOnCalled = true;
} // }
//if (mod_isGsmPowerOn() == false) { // try again //if (mod_isGsmPowerOn() == false) { // try again
// mod_switchWake(true); // mod_switchWake(true);
// qCritical() << __func__ << ":" << __LINE__; // qCritical() << __func__ << ":" << __LINE__;
// stream << "1"; // stream << "1";
// QThread::msleep(sleepTime); // QThread::msleep(sleepTime);
//} //}
} //}
if (cred_isCreditPowerOn() == false) { if (cred_isCreditPowerOn() == false) {
static bool cred_powerOnCalled = false; // static bool cred_powerOnCalled = false;
//if (cred_powerOnCalled == false) { //if (cred_powerOnCalled == false) {
// credit_switchPower(true); // credit_switchPower(true);
// credit_switchWake(true); // credit_switchWake(true);
@ -201,6 +203,7 @@ void hwapi::onCCWakeGpioChanged(QString const &fileName) {
} else { } else {
qCritical() << "ERROR watching the wrong file" << fileName; qCritical() << "ERROR watching the wrong file" << fileName;
} }
qCritical() << __func__ << ":" << __LINE__ << QDateTime::currentDateTime().toString(Qt::ISODateWithMs);
} }
void hwapi::hwapi_slotPayProc(void) void hwapi::hwapi_slotPayProc(void)