Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -rc5389647e2259e67f8e6d923f3481d7d3f4eab68 -rb5c381df9625b215d27649976825c64a4c4ca4f0 --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision c5389647e2259e67f8e6d923f3481d7d3f4eab68) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision b5c381df9625b215d27649976825c64a4c4ca4f0) @@ -41,8 +41,8 @@ /*! * \brief Message Handler connections definition - * \details Initializes the required signal/slot connection between this class and other objects\n - * to be able to communicate. + * \details Initializes the required signal/slot connection between this class and other objects + * to be able to communicate. */ void MessageDispatcher::initConnections() { @@ -59,6 +59,11 @@ 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 @@ -68,6 +73,16 @@ #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 + * Upon completion of collected all the required frames + * on successful interpretation of the message, emits didActionReceived signal. + * The message will be removed from list of the channel vCan_Id messages. + * \param vCanId - CANBUS channel of the frame + * \param vPayload - Payload of the frame + */ void MessageDispatcher::onFrameReceive(Can_Id vCanId, const QByteArray &vPayload) { // Append a message to the list @@ -93,11 +108,26 @@ } } +/*! + * \brief MessageDispatcher::onActionTransmit + * \details This slot will be called by ApplicationController::didActionTransmit + * upon UI message transmit request and calls MessageDispatcher::actionTransmit method. + * \param vActionId - The ActionID of the message + * \param vData - The data of the Message + */ void MessageDispatcher::onActionTransmit(GuiActionType vActionId, const QVariantList &vData) { actionTransmit(vActionId, vData); } +/*! + * \brief MessageDispatcher::actionTransmit + * \details This method is called by slot MessageDispatcher::onActionTransmit + * which emits didFrameTransmit on successful interpretation of the requested message + * and successfully creating of frame(s). + * \param vActionId - The ActionID of the message + * \param vData - The data of the Message + */ void MessageDispatcher::actionTransmit(GuiActionType vActionId, const QVariantList &vData) { QByteArray mData; @@ -116,6 +146,11 @@ } } +/*! + * \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"); Index: sources/canbus/messagedispatcher.h =================================================================== diff -u -rc5389647e2259e67f8e6d923f3481d7d3f4eab68 -rb5c381df9625b215d27649976825c64a4c4ca4f0 --- sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision c5389647e2259e67f8e6d923f3481d7d3f4eab68) +++ sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision b5c381df9625b215d27649976825c64a4c4ca4f0) @@ -28,52 +28,52 @@ using namespace Gui; namespace Can { /*! - * \brief The MessageDispatcher class - * \details Message Dispatcher is the class which is the mediator between CanBus Frames - * and Application Messages. - * The massages and frames need to be interpreted form/to hex - * and also need to be split into frames or constructor from frames to be a message. - * ---------------------------------------------------------------------------------------- - * - * Interpreter : message [ toHex , fromHex] - * - * Builder : message [ toFrame , fromFrame ] - * - * Dispatcher : signal->Handler( .. frame .. ) - * - * Handler : signal->Dispatcher( .. frame .. ) - * - * ---------------------------------------------------------------------------------------- - * - * *** UI <-> AppController <-> Dispatcher <-> Handler <-> HD *** - * - * ---------------------------------------------------------------------------------------- - * - * UI -> message -> - * AppController { - * signal->Dispatcher ( .. message .. ) - * } - * - * Dispatcher { - * .. - * messageList[ch][frameList] += Builder.toFrame ( Interpreter.toHex ( message ) ) - * .. - * signal->Handler( .. frame .. ) - * } - * - * ---------------------------------------------------------------------------------------- - * - * HD -> frame -> - * Handler { - * signal->Dispatcher ( .. frame .. ) - * } - * - * Dispatcher { - * messageList[ch][frameList] += Interpreter.fromHex( frame ) - * isComplete => Builder.fromFrame( frameList ) : signal->AppController - * } - * - * ---------------------------------------------------------------------------------------- + * \brief The MessageDispatcher class \n + * \details Message Dispatcher is the class which is the mediator between CanBus Frames \n + * and Application Messages. \n + * The massages and frames need to be interpreted form/to hex \n + * and also need to be split into frames or constructor from frames to be a message. \n + * ---------------------------------------------------------------------------------------- \n + * \n + * Interpreter : message [ toHex , fromHex] \n + * \n + * Builder : message [ toFrame , fromFrame ] \n + * \n + * Dispatcher : signal->Handler( .. frame .. ) \n + * \n + * Handler : signal->Dispatcher( .. frame .. ) \n + * \n + * ---------------------------------------------------------------------------------------- \n + * \n + * *** UI <-> AppController <-> Dispatcher <-> Handler <-> HD *** \n + * \n + * ---------------------------------------------------------------------------------------- \n + * \n + * UI -> message -> \n + * AppController { \n + * signal->Dispatcher ( .. message .. ) \n + * } \n + * \n + * Dispatcher { \n + * .. \n + * messageList[ch][frameList] += Builder.toFrame ( Interpreter.toHex ( message ) ) \n + * .. \n + * signal->Handler( .. frame .. ) \n + * } \n + * \n + * ---------------------------------------------------------------------------------------- \n + * \n + * HD -> frame -> \n + * Handler { \n + * signal->Dispatcher ( .. frame .. ) \n + * } \n + * \n + * Dispatcher { \n + * messageList[ch][frameList] += Interpreter.fromHex( frame ) \n + * isComplete => Builder.fromFrame( frameList ) : signal->AppController \n + * } \n + * \n + * ---------------------------------------------------------------------------------------- \n */ class MessageDispatcher : public QObject { @@ -97,8 +97,22 @@ void actionTransmit(GuiActionType vActionId, const QVariantList &vData); signals: - // When frames received and processed to action and are ready then notifies UI Action is ready + /*! + * \brief didActionReceive + * \details When a message received over the CANBUS this signal is emitted + * on successful collecting all required payloads from different frames if any + * and successfully has been built into a message and can be interpreted + * \param vAction - The action has been extracted from CANBUS message header to be done + * \param vData - The data has been collected from CANBUS frame(s) + */ void didActionReceive(GuiActionType vAction , const QVariantList &vData); + /*! + * \brief didFrameTransmit + * \details When a message is requested to be transmitted this signal is emitted + * on successful interpretation and building the message into frames + * \param vCanId - Target channel of the CANBUS message + * \param vPayload - The payload of the message to be sent + */ void didFrameTransmit(Can_Id vCanId , const QByteArray &vPayload); private slots: