Index: sources/storage/TreatmentLog.cpp =================================================================== diff -u -ra6586ea871f21a08e7d50552983360fb5e344b3a -r380136967ba230affe91f614a9805319688eb05b --- sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision a6586ea871f21a08e7d50552983360fb5e344b3a) +++ sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 380136967ba230affe91f614a9805319688eb05b) @@ -43,7 +43,6 @@ TreatmentLog::TreatmentLog(QObject *parent) : QObject(parent) { initConnections(); logPath(Logger::eLogTrtmt, _Logger.logPath(Logger::eLogTrtmt)); - startTimer(_interval); } @@ -60,6 +59,9 @@ connect(&_saveWatcher , SIGNAL(finished()), this , SLOT(onSave ())); + connect(&_CloudSyncController , SIGNAL(didCloudSyncStatus(bool)), + this , SLOT( onCloudSyncStatus(bool))); + connect(&_CloudSyncController , SIGNAL(didTxCodeReceive(const QString &)), this , SLOT( onTxCodeReceive(const QString &))); @@ -416,6 +418,24 @@ } /*! + * \brief TreatmentLog::onCloudSyncStatus + * \details This is the handler to the slot CloudSyncController::didCloudSyncStatus, + * which will be emitted when the Cloud is running and the device is registered, with vReady as true. + * Therefore pending Treatment logs can be sent. + * or with ready as false if CloudSync stops or for any error can't communicate to send the logs. + */ +void TreatmentLog::onCloudSyncStatus(bool vReady) +{ + static int id; + if ( vReady ) { + id = startTimer(_interval); + } + else { + killTimer(id); + } +} + +/*! * \brief TreatmentLog::onTxCodeReceive * \details this slot will update the treatment code sent by CS. * \param vTxCode - The treatment code sent by CS.