Index: sources/applicationcontroller.cpp =================================================================== diff -u -rfee7fabf49befb065c89248c19e15efc9ca194e4 -r4b9619614f0a9deb0438a803c057918b94aacbec --- sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision fee7fabf49befb065c89248c19e15efc9ca194e4) +++ sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 4b9619614f0a9deb0438a803c057918b94aacbec) @@ -17,6 +17,7 @@ // Project #include "guiglobals.h" +#include "maintimer.h" #include "guicontroller.h" #include "messagedispatcher.h" @@ -50,6 +51,10 @@ */ void ApplicationController::initConnections() { + + connect(_MainTimer , SIGNAL( didTimeout()), + this , SLOT(onMainTimerTimeout())); + // From GUI connect(_GuiController , SIGNAL(didActionTransmit(GuiActionType, const QVariantList &)), this , SLOT( onActionTransmit(GuiActionType, const QVariantList &))); @@ -79,3 +84,27 @@ { emit didActionReceive (vAction, vData); } + +/*! + * \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::keepAlive + * \details This is the message which has to be send over the CANBUS + * as an monitor for other nodes on the bus to notify UI is alive + */ +void ApplicationController::keepAlive() +{ +#ifndef DISABLE_KEEP_ALIVE + QVariantList mData; + mData += static_cast(GuiActionData::NoData); + onActionTransmit(GuiActionType::KeepAlive, mData); +#endif +} Index: sources/applicationcontroller.h =================================================================== diff -u -rfee7fabf49befb065c89248c19e15efc9ca194e4 -r4b9619614f0a9deb0438a803c057918b94aacbec --- sources/applicationcontroller.h (.../applicationcontroller.h) (revision fee7fabf49befb065c89248c19e15efc9ca194e4) +++ sources/applicationcontroller.h (.../applicationcontroller.h) (revision 4b9619614f0a9deb0438a803c057918b94aacbec) @@ -46,11 +46,14 @@ private: void initConnections(); + void keepAlive(); private slots: // Should be private for thread safety and is connected internally. void onActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG void onActionTransmit(GuiActionType vAction, const QVariantList &vData); // UI => HD/DG + void onMainTimerTimeout(); + signals: void didActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG void didActionTransmit(GuiActionType vAction, const QVariantList &vData); // UI => HD/DG Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -rb5c381df9625b215d27649976825c64a4c4ca4f0 -r4b9619614f0a9deb0438a803c057918b94aacbec --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision b5c381df9625b215d27649976825c64a4c4ca4f0) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 4b9619614f0a9deb0438a803c057918b94aacbec) @@ -18,7 +18,6 @@ // Project #include "applicationcontroller.h" #include "messagehandler.h" -#include "maintimer.h" using namespace Can; @@ -53,27 +52,9 @@ // From HD connect(_MessageHandler , SIGNAL(didFrameReceive ( Can_Id, const QByteArray &)), this , SLOT( onFrameReceive ( Can_Id, const QByteArray &))); - - // From GUI : Scheduled keep alive signal - connect(_MainTimer , SIGNAL( didTimeout()), - this , SLOT(onMainTimerTimeout())); } /*! - * \brief MessageDispatcher::keepAlive - * \details This is the message which has to be send over the CANBUS - * as an monitor for other nodes on the bus to notify UI is alive - */ -void MessageDispatcher::keepAlive() -{ -#ifndef DISABLE_KEEP_ALIVE - QVariantList mData; - mData += static_cast(GuiActionData::NoData); - actionTransmit(GuiActionType::KeepAlive, mData); -#endif -} - -/*! * \brief MessageDispatcher::onFrameReceive * \details Upon message has been received over CANBUS this slot will be called * by MessageHandler::didFrameReceive signal to process the frame @@ -146,13 +127,3 @@ } } -/*! - * \brief MessageDispatcher::onMainTimerTimeout - * \details This slot is called by MainTimer::didTimeout each second - * to call required methods like keepAlive - */ -void MessageDispatcher::onMainTimerTimeout() -{ - //QMetaObject::invokeMethod(this, "checked_in"); - keepAlive(); -} Index: sources/canbus/messagedispatcher.h =================================================================== diff -u -rb5c381df9625b215d27649976825c64a4c4ca4f0 -r4b9619614f0a9deb0438a803c057918b94aacbec --- sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision b5c381df9625b215d27649976825c64a4c4ca4f0) +++ sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision 4b9619614f0a9deb0438a803c057918b94aacbec) @@ -92,7 +92,6 @@ private: void initConnections(); - void keepAlive(); void actionTransmit(GuiActionType vActionId, const QVariantList &vData); @@ -121,8 +120,6 @@ // An Action has been requested to be transmitted. void onActionTransmit(GuiActionType vActionId, const QVariantList &vData); - - void onMainTimerTimeout(); }; }