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