Index: main.cpp =================================================================== diff -u -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc -r922463c555493a51ea20744a95dd62976adaf0f9 --- main.cpp (.../main.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) +++ main.cpp (.../main.cpp) (revision 922463c555493a51ea20744a95dd62976adaf0f9) @@ -371,7 +371,6 @@ LOG_DEBUG("UI Initializing"); if ( startGui() ) { LOG_DEBUG("UI Initialized"); - // _ApplicationController .startPOST(); app_exec = app.exec(); } Index: sources/ApplicationController.cpp =================================================================== diff -u -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc -r922463c555493a51ea20744a95dd62976adaf0f9 --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 922463c555493a51ea20744a95dd62976adaf0f9) @@ -18,7 +18,6 @@ #include // Project -#include "MainTimer.h" #include "MessageDispatcher.h" #include "Logger.h" #include "DeviceController.h" @@ -28,6 +27,7 @@ #include "MSettings.h" #include "WifiInterface.h" #include "BluetoothInterface.h" +#include "MessageAcknowModel.h" /*! * \brief ApplicationController::ApplicationController @@ -99,9 +99,6 @@ connect(&_post , SIGNAL( didDone (bool )), this , SLOT (onPOSTDone (bool ))); - connect(&_MainTimer , SIGNAL( didTimeout()), - this , SLOT(onMainTimerTimeout())); - // From GUI connect(&_GuiController , SIGNAL(didActionTransmit(GuiActionType, const QVariantList &)), this , SLOT( onActionTransmit(GuiActionType, const QVariantList &))); @@ -220,16 +217,6 @@ } /*! - * \brief ApplicationController::onMainTimerTimeout - * \details This slot is called by MainTimer::didTimeout each second - * to call required methods like keepAlive - */ -void ApplicationController::onMainTimerTimeout() -{ - keepAlive(); -} - -/*! * \brief ApplicationController::onUSBDriveMount * \details This is the slot which connects to the _DeviceController didUSBDriveMount signal * and notifies the other classes (GuiController) by emitting its signal didUSBDriveMount @@ -574,14 +561,17 @@ */ void ApplicationController::onstartPOST() { LOG_DEBUG("ApplicationPost Start"); - emit didActionTransmit(GuiActionType::ID_KeepAlive, {}); + _MessageAcknowModel.doStartCheckIn(); _post.start(); } +/*! + * \brief ApplicationController::onGuiReadyNotify + * \details The POST entry point + * - calls the private slot onstartPOST + * \return void + */ void ApplicationController::onGuiReadyNotify() { - LOG_DEBUG("ApplicationPost Start"); - emit didActionTransmit(GuiActionType::ID_KeepAlive, {}); - _MainTimer.start(); - _post.start(); + onstartPOST(); } Index: sources/MainTimer.cpp =================================================================== diff -u -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc -r922463c555493a51ea20744a95dd62976adaf0f9 --- sources/MainTimer.cpp (.../MainTimer.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) +++ sources/MainTimer.cpp (.../MainTimer.cpp) (revision 922463c555493a51ea20744a95dd62976adaf0f9) @@ -115,8 +115,6 @@ */ void MainTimer::timerEvent(QTimerEvent *) { - if ( ! _running ) return; - #ifndef DISABLE_ACKNOW_CHECKIN_MESSAGE_LOG emit didTimeout(); #endif Index: sources/MainTimer.h =================================================================== diff -u -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc -r922463c555493a51ea20744a95dd62976adaf0f9 --- sources/MainTimer.h (.../MainTimer.h) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) +++ sources/MainTimer.h (.../MainTimer.h) (revision 922463c555493a51ea20744a95dd62976adaf0f9) @@ -36,14 +36,9 @@ static const int _interval = 1000; //ms - bool _running = false; - public: bool init(); void quit(); - inline void start() { - _running = true; - } private: bool isDateChanged(bool vIncludeTime = false); Index: sources/canbus/MessageAcknowModel.cpp =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -r922463c555493a51ea20744a95dd62976adaf0f9 --- sources/canbus/MessageAcknowModel.cpp (.../MessageAcknowModel.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/canbus/MessageAcknowModel.cpp (.../MessageAcknowModel.cpp) (revision 922463c555493a51ea20744a95dd62976adaf0f9) @@ -45,7 +45,7 @@ // runs in MessageAcknowModel thread initConnections(); LOG_DEBUG(tr("%1 Initialized").arg(metaObject()->className())); - + startTimer(_interval); return true; } @@ -73,6 +73,7 @@ { // coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. + qDeleteAll(_acknowList); quitThread(); // validated } // coco end Index: sources/canbus/MessageAcknowModel.h =================================================================== diff -u -rfc329c788fe9453983072bee937ccbc95b4ed6e4 -r922463c555493a51ea20744a95dd62976adaf0f9 --- sources/canbus/MessageAcknowModel.h (.../MessageAcknowModel.h) (revision fc329c788fe9453983072bee937ccbc95b4ed6e4) +++ sources/canbus/MessageAcknowModel.h (.../MessageAcknowModel.h) (revision 922463c555493a51ea20744a95dd62976adaf0f9) @@ -120,10 +120,28 @@ QThread *_thread = nullptr; bool _init = false; + const int _interval = 1000; // in ms + bool _checkin = false; + +protected: + void timerEvent(QTimerEvent *) override { + if ( _checkin ) + emit didCheckIn(); + } + public slots: bool init(); bool init(QThread &vThread); + /*! + * \brief doStartCheckIn + * \details emits the first check-in signal and sets the check-in flag to start the check-in + */ + void doStartCheckIn() { + emit didCheckIn(); + _checkin = true; + } + private slots: void quit(); @@ -134,6 +152,11 @@ void quitThread(); signals: + /*! + * \brief didCheckIn + * \details This signal is emitted on each interval (1s) to notify MessageDispatcher to send a Check-In + */ + void didCheckIn(); /*! * \brief didFramesTransmit Index: sources/canbus/MessageDispatcher.cpp =================================================================== diff -u -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc -r922463c555493a51ea20744a95dd62976adaf0f9 --- sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) +++ sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision 922463c555493a51ea20744a95dd62976adaf0f9) @@ -104,6 +104,9 @@ connect(&_MessageAcknowModel , SIGNAL(didFailedTransmit( Sequence )), this , SLOT( onFailedTransmit( Sequence ))); + connect(&_MessageAcknowModel , SIGNAL(didCheckIn ( )), + this , SLOT( onCheckIn ( ))); + // Application Settings are ready connect(&_ApplicationController, SIGNAL(didSettingsDone ()), this , SLOT( onSettingsDone ())); @@ -213,6 +216,15 @@ // coco end /*! + * \brief MessageDispatcher::onCheckIn + * \details Sending the Check-In message. + */ +void MessageDispatcher::onCheckIn() +{ + actionTransmit(GuiActionType::ID_KeepAlive, {}); +} + +/*! * \brief MessageDispatcher::onActionTransmit * \details This slot will be called by ApplicationController::didActionTransmit * upon UI message transmit request and calls MessageDispatcher::actionTransmit method. Index: sources/canbus/MessageDispatcher.h =================================================================== diff -u -rcbb246d6efa242f927f88ac5da518dedb2d63320 -r922463c555493a51ea20744a95dd62976adaf0f9 --- sources/canbus/MessageDispatcher.h (.../MessageDispatcher.h) (revision cbb246d6efa242f927f88ac5da518dedb2d63320) +++ sources/canbus/MessageDispatcher.h (.../MessageDispatcher.h) (revision 922463c555493a51ea20744a95dd62976adaf0f9) @@ -246,6 +246,7 @@ // void onFramesTransmit (Can_Id vCan_Id, Sequence vSequence, const FrameList &vFrameList); void onFailedTransmit ( Sequence vSequence); + void onCheckIn (); // An Action has been requested to be transmitted. void onActionTransmit (GuiActionType vActionId, const QVariantList &vData);