Index: sources/MainTimer.cpp =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/MainTimer.cpp (.../MainTimer.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/MainTimer.cpp (.../MainTimer.cpp) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file MainTimer.cpp - * \author (last) Behrouz NematiPour - * \date (last) 08-Sep-2020 - * \author (original) Behrouz NematiPour - * \date (original) 26-Aug-2020 + * \file MainTimer.cpp + * \author (last) Behrouz NematiPour + * \date (last) 28-Sep-2022 + * \author (original) Behrouz NematiPour + * \date (original) 26-Aug-2020 * */ #include "MainTimer.h" @@ -19,7 +19,7 @@ //Project #include "Logger.h" -#include "FileHandler.h" +#include "ApplicationController.h" /*! * \brief MainTimer::MainTimer @@ -36,21 +36,30 @@ */ bool MainTimer::init() { - // coco begin validated: This is a fake data generator for CANBus missing/swapped frames Testing + // disabled coco begin validated: This is a fake data generator for CANBus missing/swapped frames Testing // will never be executed on the product // has been tested manually if (gFakeInterval) { startTimer(gFakeInterval); } - // coco end - else { - startTimer(_interval); - } + + initConnections(); LOG_DEBUG(tr("%1 Initialized").arg(metaObject()->className())); return true; } /*! + * \brief ApplicationController::initConnections + * \details Initializes the required signal/slot connection between this class and other objects + * to be able to communicate. + */ +void MainTimer::initConnections() +{ + connect(&_ApplicationController , SIGNAL(didKeepAliveBegin()), + this , SLOT( onKeepAliveBegin())); +} + +/*! * \brief MainTimer::quit * \details Does nothing for now */ @@ -69,7 +78,7 @@ static int oH,oM,oS; int cH,cM,cS; QDateTime::currentDateTime().date().getDate(&cy, &cm, &cd); - // coco begin validated: Decided to not to check each second + // disabled coco begin validated: Decided to not to check each second // has been tested manually if (vIncludeTime) { QTime currentTime = QDateTime::currentDateTime().time(); @@ -93,7 +102,7 @@ oM = cM; oS = cS; } - // coco end + // disabled coco end } else return false; @@ -107,6 +116,18 @@ } /*! + * \brief MainTimer::onKeepAliveBegin + * \details the handler for the signal didKeepAliveBegin + * comming from ApplicationController + */ +void MainTimer::onKeepAliveBegin() +{ + if ( ! gFakeInterval ) { + startTimer(_interval); + } +} + +/*! * \brief MainTimer::timerEvent * \details This event handler has been re-implemented in here * to receive timer events for the object @@ -115,7 +136,7 @@ */ void MainTimer::timerEvent(QTimerEvent *) { -#ifndef DISABLE_ACKNOW_CHECKIN_MESSAGE_LOG +#ifndef DISABLE_KEEP_ALIVE emit didTimeout(); #endif // I'm not sure how often we need to check for this.