Index: sources/canbus/messagedispatcher.h =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r0e87420e50dd94c37eb25f289ef3262e0e45d7f4 --- sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision 0e87420e50dd94c37eb25f289ef3262e0e45d7f4) @@ -88,6 +88,9 @@ QHash _messageList; + Sequence _txSequence = 0; + Sequence _rxSequence = 0; + MessageBuilder _builder; MessageInterpreter _interpreter; @@ -113,10 +116,18 @@ void initThread(QThread &vThread); void quitThread(); - void actionTransmit(GuiActionType vActionId, const QVariantList &vData, Sequence vSequence = 0); + void actionTransmit (GuiActionType vActionId, const QVariantList &vData, Sequence vSequence = 0); + void framesTransmit (Can_Id vCan_Id, const FrameList &vFrameList); + bool needsAcknow (GuiActionType vActionId); + bool buildMessage (Can_Id vCan_Id, const QByteArray &vPayload); bool interpretMessage(const Message &vMessage); + + Sequence txCount(); + Sequence rxCount(); + + signals: /*! * \brief didActionReceive @@ -126,38 +137,57 @@ * \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); + void didActionReceive (GuiActionType vAction , const QVariantList &vData); /*! * \brief didActionReceive * \details Emits when a message requires * \param vData */ - void didActionReceive(const Message &vMessage); + void didActionReceive (const Message &vMessage); /** * @brief didAcknowReceive * @details if the type the received message id is and Acknow this signal will be emitted * @param vData - the data of the Acknow message which is the message Sequence * which we got the Ack for. */ - void didAcknowReceive(const Sequence &vSequence); + void didAcknowReceive (Sequence vSequence); /*! + * \brief didAcknowTransmit + * \details this signal will be emitted when the message which has been sent + * needs Acknowledge back. + * \param vFrameList - the frames which has been send + * and will be used to be send on retries. + */ + void didAcknowTransmit(Sequence vSequence, Can_Id vCan_Id, const FrameList &vFrameList); + + /*! + * \brief didFramesTransmit + * \details when this signal is emitted frame(s) in the vFramesList + * will be queued to be sent. + * \param vFrameList - list of the frame(s) to be sent. + */ + void didFramesTransmit(Can_Id vCan_Id, const FrameList &vFrameList); + + /*! * \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 vCan_Id - Target channel of the CANBUS message * \param vPayload - The payload of the message to be sent */ - void didFrameTransmit(Can_Id vCan_Id , const QByteArray &vPayload); + void didFrameTransmit (Can_Id vCan_Id, const QByteArray &vPayload); private slots: // A Frame has been received from CanInterface - void onFrameReceive (Can_Id vCan_Id , const QByteArray &vPayload); + void onFrameReceive (Can_Id vCan_Id, const QByteArray &vPayload); + void onFramesTransmit (Can_Id vCan_Id, const FrameList &vFrameList); // An Action has been requested to be transmitted. - void onActionTransmit(GuiActionType vActionId, const QVariantList &vData); + void onActionTransmit (GuiActionType vActionId, const QVariantList &vData); + }; }