Index: sources/canbus/messagehandler.h =================================================================== diff -u -r1732e83d2a0308b9c706f37d6d7724a364bbff2a -rfee7fabf49befb065c89248c19e15efc9ca194e4 --- sources/canbus/messagehandler.h (.../messagehandler.h) (revision 1732e83d2a0308b9c706f37d6d7724a364bbff2a) +++ sources/canbus/messagehandler.h (.../messagehandler.h) (revision fee7fabf49befb065c89248c19e15efc9ca194e4) @@ -1,14 +1,10 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2019-2019 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 messagehandler.h * date 10/26/2019 @@ -38,18 +34,28 @@ using namespace Gui; namespace Can { +/*! + * \brief The MessageHandler class \n + * \details This class is an adapter or translator from QByteArray and QCanBusFrame \n + * So this class gets the data for the frame as QByteArray and creates a frame \n + * and send it to the CanInterface to deal with the CANBUS. \n + */ class MessageHandler : public QObject { Q_OBJECT // friends friend class ::unittests; + /*! + * \brief The ChannelGroup enum + * \details The enum which represent the categories of the CANBUS channel + */ enum class ChannelGroup { - eChannel_Unknown, - eChannel_Ignores, - eChannel_Listens, - eChannel_Outputs, + eChannel_Unknown, ///< An Unknown channels category + eChannel_Ignores, ///< The Channels which will be ignored by UI + eChannel_Listens, ///< The Channels that UI is listening to + eChannel_Outputs, ///< The Channels that are related to UI frames out. }; // Singleton @@ -59,17 +65,37 @@ private: void initConnections(); - void transmitFrame(Can_Id vCan_Id, const QByteArray &vData = 0); - ChannelGroup checkChannel(quint32 vFrameId, bool *vOK = nullptr); private slots: // Should be private for thread safety and is connected internally. void onFrameTransmit(Can_Id vCan_ID, const QByteArray &vData ); // GUI => CAN void onFrameReceive ( const QCanBusFrame &vFrame ); // GUI <= CAN signals: - void didFrameReceive (Can_Id vCan_ID, const QByteArray &vPayload); // GUI <= CAN + /*! + * \brief didFrameReceive + * \details After CanInterface receives a frame notifies MessageHandler + * by emitting CanInterface::didFrameReceive signal, + * then Message Handler calls its slot MessageHandler::onFrameReceive to handle the message, + * And when the message has been processed vCan_Id of type Can_Id which is the Channel ID of the frame + * and vPayload of the frame of type QByteArray has been extracted, + * This signal will be emitted to notify MessageDispatcher to start collecting data + * for this message over this channel. + * \param vCan_ID - Channel Id of the frame. + * \param vPayload - Payload of the frame. + */ + void didFrameReceive (Can_Id vCan_Id, const QByteArray &vPayload); // GUI <= CAN + + /*! + * \brief didFrameTransmit + * \details After MessageDispatcher requests MessageHandler to transmit a message, + * And MessageHandler calls its slot MessageHandler::onFrameTransmit to handle the message, + * And when the message has been processed and a Frame has been created, + * this signal will be emitted to notify CanInterface to send the frame. + * \ref CanInterface::onFrameTransmit + * \param vFrame - The frame which has been created to be transmitted. + */ void didFrameTransmit( const QCanBusFrame &vFrame ); // GUI => CAN }; }