Index: LeahiRt/LeahiRtController.h =================================================================== diff -u -r64243101dff61b5c1a40b96ef33080236999acf6 -ra5781739bcbe58c754aff8861561495624bc5b67 --- LeahiRt/LeahiRtController.h (.../LeahiRtController.h) (revision 64243101dff61b5c1a40b96ef33080236999acf6) +++ LeahiRt/LeahiRtController.h (.../LeahiRtController.h) (revision a5781739bcbe58c754aff8861561495624bc5b67) @@ -22,20 +22,17 @@ #include #include -#include "AgentInterface.h" -#include "AgentMessage.h" +#include "RtInterface.h" +#include "RtMessage.h" #include "CanInterface.h" #include "CanMessage.h" +#include "RtServer.h" #include "MessageDispatcher.h" using namespace Can; /*! - * \brief Real-time CAN to cloud controller - * \details Owns the CAN→cloud pipeline. CanInterface receives frames, the - * MessageDispatcher reassembles them per CAN id, and completed messages - * are converted to protobuf and forwarded to the Connectivity Agent - * over the AgentInterface. + * \brief Real-time Cloud Communications controller */ class LeahiRtController : public QObject { @@ -45,12 +42,17 @@ explicit LeahiRtController(const QString &configPath, const QString &msgHandlingPath, QObject *parent = nullptr); ~LeahiRtController(); + void connectToAgent(); + bool listenForApp(); + +Q_SIGNALS: /*! - * \brief connectToAgent - * \details Initialises the AgentInterface using the socket path and reconnect - * interval from the settings file. + * \brief didCanMessageReceive + * \details Emitted when a complete CAN message has been reassembled. + * \param timestamp - time the message was completed + * \param msg - the completed message */ - void connectToAgent(); + void didCanMessageReceive(const QDateTime timestamp, const Can::Message msg); private: /*! @@ -67,7 +69,7 @@ */ struct MsgHandling { MsgAction action = MsgAction::Drop; - AgentMessage::MsgId topic = AgentMessage::MsgId::ClinicalData; + RtMessage::MsgId topic = RtMessage::MsgId::ClinicalData; }; void loadMsgHandling(const QString &msgHandlingPath); @@ -78,39 +80,13 @@ Can::MessageDispatcher _dispatcher; QMap> _msgCache; QHash _msgHandling; - AgentInterface _agentInterface; + RtInterface _agentInterface; QThread _agentThread; + RtServer _appServer; ///< The Luis application connects here. quint16 _txSequence = 0; -Q_SIGNALS: - /*! - * \brief didCanMessageReceive - * \details Emitted when a complete CAN message has been reassembled. - * \param timestamp - time the message was completed - * \param msg - the completed message - */ - void didCanMessageReceive(const QDateTime timestamp, const Can::Message msg); - private Q_SLOTS: - /*! - * \brief onFrameReceive - * \details Unpacks a CAN frame and feeds it to the dispatcher for reassembly. - * \param frame - the received CAN frame - */ void onFrameReceive(const QCanBusFrame frame); - - /*! - * \brief onMessageReceive - * \details Applies the message handling policy: drops, forwards unconditionally, - * or forwards only on payload change, using the INI-configured topic. - * \param msg - the reassembled message - */ void onMessageReceive(const Can::Message &msg); - - /*! - * \brief onAgentDisconnect - * \details Resets the received flag on all cache entries so that send_delta - * messages are treated as new on the next connection. - */ void onAgentDisconnect(); };